X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=frontend%2Flibretro.c;h=31872f4d7bfeb0c8d4a571149f764b02d4a18056;hb=ce188d4d7f3b9ad04867c49b424e8497c2ade92b;hp=06b66b11b561b7e8c0b867a66978f7e5fe34d1d5;hpb=1d6abe26ddb1f893cf96ccd3e251f25b1afbba2a;p=pcsx_rearmed.git diff --git a/frontend/libretro.c b/frontend/libretro.c index 06b66b11..31872f4d 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -50,6 +50,8 @@ #define ISHEXDEC ((buf[cursor]>='0') && (buf[cursor]<='9')) || ((buf[cursor]>='a') && (buf[cursor]<='f')) || ((buf[cursor]>='A') && (buf[cursor]<='F')) +#define INTERNAL_FPS_SAMPLE_PERIOD 64 + //hack to prevent retroarch freezing when reseting in the menu but not while running with the hot key static int rebootemu = 0; @@ -69,6 +71,8 @@ static int vout_doffs_old, vout_fb_dirty; static bool vout_can_dupe; static bool duping_enable; static bool found_bios; +static bool display_internal_fps = false; +static unsigned frame_count = 0; static int plugins_opened; static int is_pal_mode; @@ -497,6 +501,7 @@ void retro_set_environment(retro_environment_t cb) { "pcsx_rearmed_neon_enhancement_no_main", "Enhanced resolution speed hack; disabled|enabled" }, #endif { "pcsx_rearmed_duping_enable", "Frame duping; enabled|disabled" }, + { "pcsx_rearmed_display_internal_fps", "Display Internal FPS; disabled|enabled" }, { "pcsx_rearmed_show_bios_bootlogo", "Show Bios Bootlogo(Breaks some games); disabled|enabled" }, { "pcsx_rearmed_spu_reverb", "Sound: Reverb; enabled|disabled" }, { "pcsx_rearmed_spu_interpolation", "Sound: Interpolation; simple|gaussian|cubic|off" }, @@ -691,7 +696,7 @@ void retro_get_system_info(struct retro_system_info *info) #define GIT_VERSION "" #endif info->library_version = "r22" GIT_VERSION; - info->valid_extensions = "bin|cue|img|mdf|pbp|toc|cbn|m3u"; + info->valid_extensions = "bin|cue|img|mdf|pbp|toc|cbn|m3u|chd"; info->need_fullpath = true; } @@ -1233,6 +1238,8 @@ bool retro_load_game(const struct retro_game_info *info) { 0 }, }; + frame_count = 0; + environ_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, desc); #ifdef FRONTEND_SUPPORTS_RGB565 @@ -1297,10 +1304,7 @@ bool retro_load_game(const struct retro_game_info *info) return false; } - /* TODO: Calling SysReset() outside retro_run for some system - * causes RetroArch to freeze, e.g Ludo */ - //SysReset(); - rebootemu = 1; + SysReset(); if (LoadCdrom() == -1) { log_cb(RETRO_LOG_INFO, "could not load CD\n"); @@ -1494,6 +1498,17 @@ static void update_variables(bool in_flight) duping_enable = true; } + var.value = "NULL"; + var.key = "pcsx_rearmed_display_internal_fps"; + + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value) + { + if (strcmp(var.value, "disabled") == 0) + display_internal_fps = false; + else if (strcmp(var.value, "enabled") == 0) + display_internal_fps = true; + } + #ifndef DRC_DISABLE var.value = NULL; var.key = "pcsx_rearmed_drc"; @@ -1591,7 +1606,8 @@ static void update_variables(bool in_flight) dfinput_activate(); } - else{ + else + { //not yet running //bootlogo display hack @@ -1600,10 +1616,13 @@ static void update_variables(bool in_flight) var.key = "pcsx_rearmed_show_bios_bootlogo"; if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value) { + Config.SlowBoot = 0; + rebootemu = 0; if (strcmp(var.value, "enabled") == 0) + { Config.SlowBoot = 1; - else - Config.SlowBoot = 0; + rebootemu = 1; + } } } #ifndef DRC_DISABLE @@ -1663,6 +1682,31 @@ void retro_run(void) } } + if (display_internal_fps) { + frame_count++; + + if (frame_count % INTERNAL_FPS_SAMPLE_PERIOD == 0) { + unsigned internal_fps = pl_rearmed_cbs.flip_cnt * (is_pal_mode ? 50 : 60) / INTERNAL_FPS_SAMPLE_PERIOD; + char str[64]; + const char *strc = (const char*)str; + struct retro_message msg = + { + strc, + 180 + }; + + str[0] = '\0'; + + snprintf(str, sizeof(str), "Internal FPS: %2d", internal_fps); + + pl_rearmed_cbs.flip_cnt = 0; + + environ_cb(RETRO_ENVIRONMENT_SET_MESSAGE, &msg); + } + } else { + frame_count = 0; + } + input_poll_cb(); bool updated = false;