From 53148493470bc942d60f4963ca322ba975d9c752 Mon Sep 17 00:00:00 2001 From: zmike Date: Sun, 26 Jul 2020 14:04:19 -0400 Subject: [PATCH 1/2] libpcsxcore: add hooks for setframelimit plugin api epsxe and some plugins (e.g., pete's) use this for easy toggling of fast-forward mode --- libpcsxcore/plugins.c | 3 +++ libpcsxcore/plugins.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/libpcsxcore/plugins.c b/libpcsxcore/plugins.c index a1175e48..e3db78de 100644 --- a/libpcsxcore/plugins.c +++ b/libpcsxcore/plugins.c @@ -59,6 +59,7 @@ GPUvisualVibration GPU_visualVibration; GPUcursor GPU_cursor; GPUaddVertex GPU_addVertex; GPUsetSpeed GPU_setSpeed; +GPUsetframelimit GPU_setframelimit; GPUpgxpMemory GPU_pgxpMemory; GPUpgxpCacheVertex GPU_pgxpCacheVertex; @@ -223,6 +224,7 @@ void CALLBACK GPU__visualVibration(unsigned long iSmall, unsigned long iBig) {} void CALLBACK GPU__cursor(int player, int x, int y) {} void CALLBACK GPU__addVertex(short sx,short sy,s64 fx,s64 fy,s64 fz) {} void CALLBACK GPU__setSpeed(float newSpeed) {} +void CALLBACK GPU__setframelimit(unsigned long option) {} void CALLBACK GPU__pgxpMemory(unsigned int addr, unsigned char* pVRAM) {} void CALLBACK GPU__pgxpCacheVertex(short sx, short sy, const unsigned char* _pVertex) {} @@ -272,6 +274,7 @@ static int LoadGPUplugin(const char *GPUdll) { LoadGpuSym0(cursor, "GPUcursor"); LoadGpuSym0(addVertex, "GPUaddVertex"); LoadGpuSym0(setSpeed, "GPUsetSpeed"); + LoadGpuSym0(setframelimit, "GPUsetframelimit"); LoadGpuSym0(pgxpMemory, "GPUpgxpMemory"); LoadGpuSym0(pgxpCacheVertex, "GPUpgxpCacheVertex"); LoadGpuSym0(configure, "GPUconfigure"); diff --git a/libpcsxcore/plugins.h b/libpcsxcore/plugins.h index a9756b7e..d03cb667 100644 --- a/libpcsxcore/plugins.h +++ b/libpcsxcore/plugins.h @@ -98,6 +98,7 @@ typedef void (CALLBACK* GPUvisualVibration)(uint32_t, uint32_t); typedef void (CALLBACK* GPUcursor)(int, int, int); typedef void (CALLBACK* GPUaddVertex)(short,short,s64,s64,s64); typedef void (CALLBACK* GPUsetSpeed)(float); // 1.0 = natural speed +typedef void (CALLBACK* GPUsetframelimit)(unsigned long); typedef void (CALLBACK* GPUpgxpMemory)(unsigned int, unsigned char*); typedef void (CALLBACK* GPUpgxpCacheVertex)(short sx, short sy, const unsigned char* _pVertex); @@ -131,6 +132,7 @@ extern GPUvisualVibration GPU_visualVibration; extern GPUcursor GPU_cursor; extern GPUaddVertex GPU_addVertex; extern GPUsetSpeed GPU_setSpeed; +extern GPUsetframelimit GPU_setframelimit; extern GPUpgxpMemory GPU_pgxpMemory; extern GPUpgxpCacheVertex GPU_pgxpCacheVertex; From be326a7259f0e5f11933f4c6fed05fcc73c44e6e Mon Sep 17 00:00:00 2001 From: zmike Date: Sat, 25 Jul 2020 14:14:34 -0400 Subject: [PATCH 2/2] gui: change F4 to toggle fps limit like epsxe with setframelimit showing the pic of the current save state is pretty useless, and this is the only superior feature that epsxe has over pcsxr --- gui/Plugin.c | 6 +++++- win32/gui/plugin.c | 12 +++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/gui/Plugin.c b/gui/Plugin.c index 389f4246..9e6a3d15 100644 --- a/gui/Plugin.c +++ b/gui/Plugin.c @@ -46,6 +46,7 @@ int StatesC = 0; unsigned char loadedOld = FALSE; int speed = 100; extern int UseGui; +static unsigned int fpslimit = 1; void gpuShowPic() { gchar *state_filename; @@ -201,7 +202,10 @@ void PADhandleKey(int key) { gpuShowPic(); break; case XK_F4: - gpuShowPic(); + fpslimit = !fpslimit; + sprintf(Text, "fpslimit: %u", fpslimit); + GPU_displayText(Text); + GPU_setframelimit(fpslimit); break; case XK_section: if (pressed) break; diff --git a/win32/gui/plugin.c b/win32/gui/plugin.c index 5ae00824..8520b287 100644 --- a/win32/gui/plugin.c +++ b/win32/gui/plugin.c @@ -37,6 +37,7 @@ extern void LidInterrupt(); HANDLE hThread = 0; BOOL start = FALSE; BOOL restart = FALSE; +int speed = 100; void gpuHidePic() { @@ -145,7 +146,16 @@ void PADhandleKey(int key) { break; case VK_F4: - gpuShowPic(); + if (speed == 200) { + speed = 100; + } + else { + speed = 200; + } + sprintf(Text, "Speed: %u", speed); + GPU_displayText(Text); +// GPU_setSpeed(speed / 100.0); + GPU_setframelimit(speed == 100); break; case VK_F5: