X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=frontend%2Flibretro.c;h=a91c5c175da45d55b1f3df46fad57a78b0d4e793;hb=c94e67e135650c1cdcb9423cfabf176bc014b340;hp=504f50781eb47097e335821a067b8a03b5fb3810;hpb=8a60e610f2f7d6421077b7bd6e6aab075276ef63;p=pcsx_rearmed.git diff --git a/frontend/libretro.c b/frontend/libretro.c index 504f5078..a91c5c17 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -59,18 +59,6 @@ #define INTERNAL_FPS_SAMPLE_PERIOD 64 -#ifdef DRC_DISABLE -int stop; -u32 next_interupt; -u32 event_cycles[PSXINT_COUNT]; -int cycle_multiplier; -int new_dynarec_hacks; - -void new_dyna_before_save(void) {} -void new_dyna_after_save(void) {} -void new_dyna_freeze(void *f, int i) {} -#endif - //hack to prevent retroarch freezing when reseting in the menu but not while running with the hot key static int rebootemu = 0; @@ -124,6 +112,7 @@ int in_type[8] = { int in_analog_left[8][2] = { { 127, 127 }, { 127, 127 }, { 127, 127 }, { 127, 127 }, { 127, 127 }, { 127, 127 }, { 127, 127 }, { 127, 127 } }; int in_analog_right[8][2] = { { 127, 127 }, { 127, 127 }, { 127, 127 }, { 127, 127 }, { 127, 127 }, { 127, 127 }, { 127, 127 }, { 127, 127 } }; unsigned short in_keystate[PORTS_NUMBER]; +int in_mouse[8][2]; int multitap1 = 0; int multitap2 = 0; int in_enable_vibration = 1; @@ -607,6 +596,8 @@ static void update_controller_port_variable(unsigned port) in_type[port] = PSE_PAD_TYPE_NEGCON; else if (strcmp(var.value, "guncon") == 0) in_type[port] = PSE_PAD_TYPE_GUNCON; + else if (strcmp(var.value, "mouse") == 0) + in_type[port] = PSE_PAD_TYPE_MOUSE; else if (strcmp(var.value, "none") == 0) in_type[port] = PSE_PAD_TYPE_NONE; // else 'default' case, do nothing @@ -2440,6 +2431,39 @@ static void update_input(void) case PSE_PAD_TYPE_NEGCON: update_input_negcon(i, ret); break; + case PSE_PAD_TYPE_MOUSE: + { + /* mouse x/y movement, range -128 to +127 */ + float accum_x = 0, accum_y = 0; + + float x = input_state_cb(i, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_X); + float y = input_state_cb(i, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_Y); + + accum_x += x; + accum_y += y; + + if (accum_x > 127) + accum_x = 127; + else if (accum_x < -128) + accum_x = -128; + + if (accum_y > 127) + accum_y = 127; + else if (accum_y < -128) + accum_y = -128; + + in_mouse[i][0] = (int)accum_x; + in_mouse[i][1] = (int)accum_y; + + /* mouse button state */ + if (input_state_cb(i, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_LEFT)) + in_keystate[i] |= 1 << 11; + + if (input_state_cb(i, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_RIGHT)) + in_keystate[i] |= 1 << 10; + + break; + } default: // Query digital inputs for (j = 0; j < RETRO_PSX_MAP_LEN; j++)