X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=frontend%2Flibretro.c;h=bd7dc43899cb62bdf59179ed34136c9fe624654e;hb=679b71e250ce6557f05b57882747029ab6af7edc;hp=64e4145281401bfc5611735ab71fb1d1b05101f7;hpb=144493e88e8d2dc22ea9db26c56a0a492db9f5f3;p=pcsx_rearmed.git diff --git a/frontend/libretro.c b/frontend/libretro.c index 64e41452..bd7dc438 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -59,6 +59,18 @@ #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; @@ -81,8 +93,12 @@ static bool found_bios; static bool display_internal_fps = false; static unsigned frame_count = 0; static bool libretro_supports_bitmasks = false; +#ifdef GPU_PEOPS static int show_advanced_gpu_peops_settings = -1; +#endif +#ifdef GPU_UNAI static int show_advanced_gpu_unai_settings = -1; +#endif static unsigned previous_width = 0; static unsigned previous_height = 0; @@ -126,6 +142,8 @@ int in_enable_vibration = 1; static int negcon_deadzone = 0; static int negcon_linearity = 1; +static bool axis_bounds_modifier; + /* PSX max resolution is 640x512, but with enhancement it's 1024x512 */ #define VOUT_MAX_WIDTH 1024 #define VOUT_MAX_HEIGHT 512 @@ -1598,7 +1616,9 @@ static void update_variables(bool in_flight) { struct retro_variable var; int i; +#ifdef GPU_PEOPS int gpu_peops_fix = 0; +#endif var.value = NULL; var.key = "pcsx_rearmed_frameskip"; @@ -1643,6 +1663,18 @@ static void update_variables(bool in_flight) } } + var.value = NULL; + var.key = "pcsx_rearmed_analog_axis_modifier"; + axis_bounds_modifier = true; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value) + { + if (strcmp(var.value, "square") == 0) { + axis_bounds_modifier = true; + } else if (strcmp(var.value, "circle") == 0) { + axis_bounds_modifier = false; + } + } + var.value = NULL; var.key = "pcsx_rearmed_vibration"; @@ -1677,7 +1709,7 @@ static void update_variables(bool in_flight) } } -#ifdef __ARM_NEON__ +#ifdef GPU_NEON var.value = "NULL"; var.key = "pcsx_rearmed_neon_interlace_enable"; @@ -1820,6 +1852,18 @@ static void update_variables(bool in_flight) Config.VSyncWA = 1; } +#ifndef _WIN32 + var.value = NULL; + var.key = "pcsx_rearmed_async_cd"; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value) + { + if (strcmp(var.value, "async") == 0) + Config.AsyncCD = 1; + else + Config.AsyncCD = 0; + } +#endif + var.value = NULL; var.key = "pcsx_rearmed_noxadecoding"; if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value) @@ -2128,7 +2172,8 @@ static void update_variables(bool in_flight) } } } -#ifndef DRC_DISABLE + +#if defined(LIGHTREC) || defined(NEW_DYNAREC) var.value = "NULL"; var.key = "pcsx_rearmed_psxclock"; if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value) @@ -2167,6 +2212,23 @@ static uint16_t get_analog_button(int16_t ret, retro_input_state_t input_state_c return button; } +unsigned char axis_range_modifier(int16_t axis_value, bool is_square) { + float modifier_axis_range = 0; + + if(is_square) { + modifier_axis_range = round((axis_value >> 8) / 0.785) + 128; + if(modifier_axis_range < 0) { + modifier_axis_range = 0; + } else if(modifier_axis_range > 255) { + modifier_axis_range = 255; + } + } else { + modifier_axis_range = MIN(((axis_value >> 8) + 128), 255); + } + + return modifier_axis_range; +} + void retro_run(void) { int i; @@ -2439,10 +2501,10 @@ void retro_run(void) // Query analog inputs if (in_type[i] == PSE_PAD_TYPE_ANALOGJOY || in_type[i] == PSE_PAD_TYPE_ANALOGPAD) { - in_analog_left[i][0] = MIN((input_state_cb(i, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_X) / 255) + 128, 255); - in_analog_left[i][1] = MIN((input_state_cb(i, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_Y) / 255) + 128, 255); - in_analog_right[i][0] = MIN((input_state_cb(i, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X) / 255) + 128, 255); - in_analog_right[i][1] = MIN((input_state_cb(i, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_Y) / 255) + 128, 255); + in_analog_left[i][0] = axis_range_modifier(input_state_cb(i, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_X), axis_bounds_modifier); + in_analog_left[i][1] = axis_range_modifier(input_state_cb(i, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_Y), axis_bounds_modifier); + in_analog_right[i][0] = axis_range_modifier(input_state_cb(i, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X), axis_bounds_modifier); + in_analog_right[i][1] = axis_range_modifier(input_state_cb(i, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_Y), axis_bounds_modifier); } } }