X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=frontend%2Flibretro.c;h=09e833bad1de3672d1aea7820420cf454cd65ab7;hp=23eecf6e25ec5ce5c5249e4f8cbc6a40f8cccf43;hb=32ab9e53f99b5b37b1262807393382baed8d8bba;hpb=48f615ba48949d7b6cf7b6765a15f069033a3fdd diff --git a/frontend/libretro.c b/frontend/libretro.c index 23eecf6e..09e833ba 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -37,6 +37,7 @@ static void *vout_buf; static int vout_width, vout_height; static int vout_doffs_old, vout_fb_dirty; static bool vout_can_dupe; +static bool duping_enable; static int samples_sent, samples_to_send; static int plugins_opened; @@ -251,6 +252,7 @@ void retro_set_environment(retro_environment_t cb) { "neon_enhancement_enable", "Enhanced resolution (slow); disabled|enabled" }, { "neon_enhancement_no_main", "Enhanced resolution speed hack; disabled|enabled" }, #endif + { "pcsx_rearmed_duping_enable", "Frame duping; on|off" }, { NULL, NULL }, }; @@ -834,6 +836,18 @@ static void update_variables(bool in_flight) pl_rearmed_cbs.gpu_neon.enhancement_no_main = 1; } #endif + + var.value = "NULL"; + var.key = "pcsx_rearmed_duping_enable"; + + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value) + { + if (strcmp(var.value, "off") == 0) + duping_enable = false; + else if (strcmp(var.value, "on") == 0) + duping_enable = true; + } + #ifndef DRC_DISABLE var.value = NULL; var.key = "rearmed_drc"; @@ -856,17 +870,17 @@ static void update_variables(bool in_flight) } #endif - if (in_flight) { - // inform core things about possible config changes - plugin_call_rearmed_cbs(); + if (in_flight) { + // inform core things about possible config changes + plugin_call_rearmed_cbs(); - if (GPU_open != NULL && GPU_close != NULL) { - GPU_close(); - GPU_open(&gpuDisp, "PCSX", NULL); - } + if (GPU_open != NULL && GPU_close != NULL) { + GPU_close(); + GPU_open(&gpuDisp, "PCSX", NULL); + } - dfinput_activate(); - } + dfinput_activate(); + } } void retro_run(void) @@ -888,20 +902,20 @@ void retro_run(void) if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i)) in_keystate |= retro_psx_map[i]; - if (in_type1 == PSE_PAD_TYPE_ANALOGPAD) - { - in_a1[0] = (input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_X) / 256) + 128; - in_a1[1] = (input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_Y) / 256) + 128; - in_a2[0] = (input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X) / 256) + 128; - in_a2[1] = (input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_Y) / 256) + 128; - } + if (in_type1 == PSE_PAD_TYPE_ANALOGPAD) + { + in_a1[0] = (input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_X) / 256) + 128; + in_a1[1] = (input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_Y) / 256) + 128; + in_a2[0] = (input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X) / 256) + 128; + in_a2[1] = (input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_Y) / 256) + 128; + } stop = 0; psxCpu->Execute(); samples_to_send += is_pal_mode ? 44100 / 50 : 44100 / 60; - video_cb((vout_fb_dirty || !vout_can_dupe) ? vout_buf : NULL, + video_cb((vout_fb_dirty || !vout_can_dupe || !duping_enable) ? vout_buf : NULL, vout_width, vout_height, vout_width * 2); vout_fb_dirty = 0; } @@ -960,6 +974,12 @@ static bool find_any_bios(const char *dirpath, char *path, size_t path_size) #define find_any_bios(...) false #endif +static void check_system_specs(void) +{ + unsigned level = 6; + environ_cb(RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL, &level); +} + void retro_init(void) { const char *bios[] = { "scph1001", "scph5501", "scph7001" }; @@ -975,7 +995,11 @@ void retro_init(void) exit(1); } +#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L) + posix_memalign(&vout_buf, 16, VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2); +#else vout_buf = malloc(VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2); +#endif if (environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &dir) && dir) { @@ -1031,6 +1055,7 @@ void retro_init(void) SaveFuncs.close = save_close; update_variables(false); + check_system_specs(); } void retro_deinit(void)