int amiga_send_input_event(int input_event, int state) { #ifdef DEBUG_SYNC write_sync_log("apply action %d state=%d\n", input_event, state); #endif //printf("amiga_send_input_event %d %d\n", input_event, state); int isabs = 0; if (input_event > INPUTEVENT_PRIVATE_START) { return handle_custom_action(input_event); } // FIXME: is max = 1 always appropriate? int max = 1; switch (input_event) { case INPUTEVENT_MOUSE1_HORIZ: //printf("INPUTEVENT_MOUSE1_HORIZ\n"); mouse_state(0, 0, state, isabs, &max); //return 1; break; case INPUTEVENT_MOUSE1_VERT: //printf("INPUTEVENT_MOUSE1_VERT\n"); mouse_state(0, 1, state, isabs, &max); //return 1; break; case INPUTEVENT_MOUSE2_HORIZ: //printf("INPUTEVENT_MOUSE2_HORIZ\n"); mouse_state(1, 0, state, isabs, &max); //return 1; break; case INPUTEVENT_MOUSE2_VERT: //printf("INPUTEVENT_MOUSE2_VERT\n"); mouse_state(1, 1, state, isabs, &max); //return 1; break; case INPUTEVENT_KEY_CAPS_LOCK: // handled specially because of toggle mode // keyboard 0, using input event as scan code (correctly mapped // in keymap.cpp) inputdevice_translatekeycode(0, INPUTEVENT_KEY_CAPS_LOCK, state); return 1; } int autofire = 0; bool canstopplayback = 1; bool playbackevent = 0; //amiga_configure_port_from_input_event(input_event); int result = amiga_handle_input_event (input_event, state, max, autofire, canstopplayback, playbackevent); if (result != 1) { write_log("amiga_handle_input_event(%d, %d, ...) failed with " "result %d", input_event, state, result); } return result; }
int amiga_send_input_event(int input_event, int state) { static bool caps_lock_state; //#ifdef DEBUG_SYNC write_sync_log("apply action %d state=%d\n", input_event, state); //#endif if (g_fs_log_input) { write_log("amiga_send_input_event %d %d\n", input_event, state); } if (input_event > INPUTEVENT_PRIVATE_START) { return handle_custom_action(input_event, state); } int max = 1; /* FIXME: is max = 1 always appropriate? */ bool magic_mouse = currprefs.input_mouse_untrap & MOUSEUNTRAP_MAGIC; if (uae_deterministic_mode()) { magic_mouse = false; } switch (input_event) { case INPUTEVENT_MOUSE1_HORIZ: case INPUTEVENT_MOUSE1_VERT: //printf("magic mouse %d\n", currprefs.input_magic_mouse); if (magic_mouse) { //printf("magic mouse %d %d\n", // fs_emu_mouse_absolute_x, fs_emu_mouse_absolute_y); uae_mousehack_helper(fs_emu_mouse_absolute_x, fs_emu_mouse_absolute_y); return 1; } case INPUTEVENT_MOUSE1_WHEEL: case INPUTEVENT_MOUSE2_HORIZ: case INPUTEVENT_MOUSE2_VERT: max = 0; break; case INPUTEVENT_KEY_CAPS_LOCK: if (state && !caps_lock_state) { caps_lock_state = true; } else if (state && caps_lock_state) { caps_lock_state = false; } state = caps_lock_state; #if 0 // handled specially because of toggle mode // keyboard 0, using input event as scan code (correctly mapped // in keymap.cpp) inputdevice_translatekeycode(0, INPUTEVENT_KEY_CAPS_LOCK, state); return 1; #endif } int autofire = 0; if (input_event == INPUTEVENT_JOY1_FIRE_BUTTON && g_joystick_port_autofire[0]) { autofire = 1; } else if (input_event == INPUTEVENT_JOY2_FIRE_BUTTON && g_joystick_port_autofire[1]) { autofire = 1; } else if (input_event == INPUTEVENT_PAR_JOY1_FIRE_BUTTON && g_joystick_port_autofire[2]) { autofire = 1; } else if (input_event == INPUTEVENT_PAR_JOY2_FIRE_BUTTON && g_joystick_port_autofire[3]) { autofire = 1; } else if ((input_event > INPUTEVENT_AUTOFIRE_BEGIN) && (input_event < INPUTEVENT_AUTOFIRE_END)) { autofire = 1; } bool canstopplayback = 1; bool playbackevent = 0; //amiga_configure_port_from_input_event(input_event); int result = amiga_handle_input_event ( input_event, state, max, autofire, canstopplayback, playbackevent); if (input_event >= INPUTEVENT_SPC_START && state == 0 && result == 0) { /* SPC / AKS keys do nothing for state 0 */ result = 1; } if (result != 1) { write_log("amiga_handle_input_event(%d, %d, ...) failed with " "result %d\n", input_event, state, result); } return result; }