Overclock by reducing cycles.

This commit is contained in:
Tatsuya79 2018-02-08 12:23:53 +01:00
parent e2ad3dfa35
commit 5a20ff0dc7
2 changed files with 18 additions and 3 deletions

View File

@ -36,6 +36,7 @@ struct retro_perf_callback perf_cb;
char retro_save_directory[PATH_MAX]; char retro_save_directory[PATH_MAX];
char retro_base_name[PATH_MAX]; char retro_base_name[PATH_MAX];
bool overclock_cycles = false;
#ifdef _WIN32 #ifdef _WIN32
char slash = '\\'; char slash = '\\';
@ -294,6 +295,7 @@ void retro_init(void)
static const struct retro_variable vars[] = static const struct retro_variable vars[] =
{ {
{ "catsfc_VideoMode", "Video Mode; auto|NTSC|PAL" }, { "catsfc_VideoMode", "Video Mode; auto|NTSC|PAL" },
{ "catsfc_overclock_cycles", "CPU Overclock (Hack, Unsafe, Restart); disabled|enabled" },
{ NULL, NULL }, { NULL, NULL },
}; };
@ -378,6 +380,17 @@ static void check_variables(void)
Settings.ForceNTSC = !strcmp(var.value, "NTSC"); Settings.ForceNTSC = !strcmp(var.value, "NTSC");
Settings.ForcePAL = !strcmp(var.value, "PAL"); Settings.ForcePAL = !strcmp(var.value, "PAL");
} }
var.key = "catsfc_overclock_cycles";
var.value = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (strcmp(var.value, "enabled") == 0)
overclock_cycles = true;
else
overclock_cycles = false;
}
} }
#ifdef PSP #ifdef PSP

View File

@ -46,9 +46,9 @@
#define SNES_CYCLES_PER_SCANLINE ((uint32_t) ((SNES_SCANLINE_TIME / SNES_CLOCK_LEN) * 6 + 0.5)) #define SNES_CYCLES_PER_SCANLINE ((uint32_t) ((SNES_SCANLINE_TIME / SNES_CLOCK_LEN) * 6 + 0.5))
#define ONE_CYCLE 6u #define ONE_CYCLE (overclock_cycles ? 4u : 6u)
#define SLOW_ONE_CYCLE 8u #define SLOW_ONE_CYCLE (overclock_cycles ? 4u : 8u)
#define TWO_CYCLES 12u #define TWO_CYCLES (overclock_cycles ? 6u : 12u)
#define SNES_TR_MASK (1u << 4) #define SNES_TR_MASK (1u << 4)
#define SNES_TL_MASK (1u << 5) #define SNES_TL_MASK (1u << 5)
@ -63,6 +63,8 @@
#define SNES_Y_MASK (1u << 14) #define SNES_Y_MASK (1u << 14)
#define SNES_B_MASK (1u << 15) #define SNES_B_MASK (1u << 15)
extern bool overclock_cycles;
enum enum
{ {
SNES_MULTIPLAYER5, SNES_MULTIPLAYER5,