Exemplo n.º 1
0
void fs_emu_handle_libfsemu_action(int action, int state)
{
    if (g_fs_log_input)
        fs_log("fs_emu_handle_libfsemu_action %d %d\n", action, state);

    switch (action) {
    case FS_EMU_ACTION_FULL_KEYBOARD:
        if (state) {
            fs_emu_set_full_keyboard_emulation(
                !fs_emu_full_keyboard_emulation(), true);
        }
        break;
    case FS_EMU_ACTION_FULLSCREEN:
        if (state)
            fs_emu_toggle_fullscreen();
        break;
    case FS_EMU_ACTION_GRAB_INPUT:
        if (state) {
            if (g_fs_emu_grab_input_on_mod_release) {
                /* We had grapped the input, but is holding the modifier
                 * key. So we just don't ungrab on release. */
                g_fs_emu_grab_input_on_mod_release = false;
                fs_emu_show_cursor_msec(FS_EMU_MOUSE_DEFAULT_DURATION);
            } else {
                fs_emu_set_input_grab(!fs_emu_input_grab());
            }
        }
        break;
    case FS_EMU_ACTION_MENU_ALT:
        if (state)
            fs_emu_menu_toggle();
        break;
    case FS_EMU_ACTION_PAUSE:
        if (state)
            fs_emu_pause(!fs_emu_is_paused());
        break;
    case FS_EMU_ACTION_QUIT:
        if (state)
            fs_emu_quit();
        break;
    case FS_EMU_ACTION_SCREENSHOT:
        if (state)
            g_fs_emu_screenshot = 1;
        break;
    case FS_EMU_ACTION_SPECIAL:
        if (state)
            special_function();
        break;
    case FS_EMU_ACTION_SWITCH_WINDOW:
        if (state)
            switch_window();
        break;
    case FS_EMU_ACTION_TAUNT:
        if (state)
            taunt();
        break;
    case FS_EMU_ACTION_VOLUME_DOWN:
        if (state)
            fs_emu_volume_control(-2);
        break;
    case FS_EMU_ACTION_VOLUME_MUTE:
        if (state)
            fs_emu_volume_control(-1);
        break;
    case FS_EMU_ACTION_VOLUME_UP:
        if (state)
            fs_emu_volume_control(-3);
        break;
    case FS_EMU_ACTION_WARP:
        if (state) {
            /* FIXME: UAE-specific hot key hack for warp function,
             * should be moved out of libfsemu. */
            fs_emu_queue_input_event(0x00010000 | 275);
        }
        break;
    case FS_EMU_ACTION_ZOOM:
        if (state) {
            fs_emu_toggle_zoom(0);
        }
        break;
    case FS_EMU_ACTION_ZOOM_BORDER:
        if (state) {
            fs_emu_toggle_zoom(1);
        }
        break;
    case FSE_ACTION_CYCLE_STRETCH_MODE:
        if (state) {
            fse_cycle_stretch_mode();
        }
        break;
    }
}
Exemplo n.º 2
0
static void event_handler(int line)
{
    // printf("%d\n", line);
    if (line >= 0) {
        input_handler_loop(line);
        return;
    }
    //static int busy = 0;
    //static int idle = 0;
    //static int64_t last_time = 0;
    g_fs_uae_frame = g_fs_uae_frame + 1;

#if 0
    if (g_fs_uae_frame != amiga_get_vsync_counter()) {
        printf("g_fs_uae_frame %d amiga_get_vsync_count %d\n", g_fs_uae_frame, amiga_get_vsync_counter());
    }
#endif
    //printf("event_handler frame=%d\n", frame);

    fs_uae_record_frame(g_fs_uae_frame);

    /*
    int64_t t = fs_emu_monotonic_time();
    if (last_time > 0) {
        int dt = (t - last_time) / 1000;
        printf("%d\n", dt);
    }
    */

    //fs_emu_lua_run_handler("on_fs_uae_frame_start");

    fs_emu_wait_for_frame(g_fs_uae_frame);
    if (g_fs_uae_frame == 1) {
        // we configure input ports after first frame are confirmed,
        // because otherwise configure events would get lost if initially
        // connected to the server (for net play game), but aborted connection
        // before game started
        fs_uae_reconfigure_input_ports_amiga();
    }

    if (fs_emu_is_quitting()) {
        if (fs_emu_is_paused()) {
            fs_emu_pause(0);
        }
        static int quit_called = 0;
        if (quit_called == 0) {
            fs_log("calling amiga_quit\n");
            amiga_quit();
            quit_called = 1;
        }
        //return;
    }
    while (fs_emu_is_paused()) {
        /*
        if (!event_handler_loop()) {
            break;
        }
        */
        pause_throttle();
        if (fs_emu_is_quitting()) {
            break;
        }
    }

    //last_time = fs_emu_monotonic_time();

}
Exemplo n.º 3
0
static int pause_function(fs_emu_menu_item *item, void **data) {
    fs_emu_log("pause_function\n");
    //return FS_EMU_MENU_RESULT_CLOSE;
    fs_emu_pause(!fs_emu_is_paused());
    return FS_EMU_MENU_RESULT_UPDATE;
}