ekeeke / Genesis-Plus-GX

An enhanced port of Genesis Plus - accurate & portable Sega 8/16 bit emulator
Other
673 stars 193 forks source link

[Gamecube/Wii] CPU overclocking options #467

Closed 60fpshacksrock closed 1 year ago

60fpshacksrock commented 1 year ago

Can overclocking options be added?

I know the RA versions have it, but the latest version of GPGX in RA as of this post is broken.

Not to mention your port runs better and is more optimized.

ekeeke commented 1 year ago

It's already there in the code so it should just be a matter of adding a compilation flag in Gamecube/Wii Makefile so it get activated and hook up needed config setting in the menu.

It is disactivated by default because it has an impact on emulation performance (even when CPU speed is not overclocked) as it requires additional operations when cpus cycle counts are increased, which occurs each time a cpu instruction is emulated. So i would be curious to see how much is the impact and if games that are more beefy to emulate (like Virtua Racing or some Mega CD games) can still run full speed on Gamecube (or even on Wii) with this activated.

60fpshacksrock commented 1 year ago

I am guessing that maybe an alternate version could be compiled?

saulfabregwiivc commented 1 year ago

I am guessing that maybe an alternate version could be compiled?

x2 (i also think in you can post alternate builds with the overclock setting added)

If SNES (and also NES) emulators on Wii (ex. FCEUX TX, Snes9x TX) have that option, why not the SEGA emulators on Wii too? :)

ekeeke commented 1 year ago

So i would be curious to see how much is the impact and if games that are more beefy to emulate (like Virtua Racing or some Mega CD games) can still run full speed on Gamecube (or even on Wii) with this activated.

Here are some comparative results testing the raw emulation speed (with fast-forward enabled i.e not synced to audio/video) between the current official build and a modified build with configurable M68K/S68K/Z80 CPU overclock (set to 1x to have comparable measures), using a few different games (playing level 1 mostly) on different systems:

Master System Game Official Overclock Mod
Alex Kidd in Miracle World 511-512 fps 502-503 fps
Sonic The Hedgehog 449-451 fps 444-446 fps
Castle of Illusion 503-507 fps 499-503 fps
Mega Drive Game Official Overclock Mod
Aladdin 186-195 fps 181-194 fps
Sonic The Hedgehog 177-180 fps 173-177 fps
Virtua Racing (intro) 70-76 fps 70-76 fps
Street of Rage 2 (paused) 223 fps 218 fps
Mega-CD Game Official Overclock Mod
Sonic CD 169-171 fps 165-167 fps
Sonic CD (paused) 208 fps 203 fps
Wonderdog 154 fps 150 fps
Earthworm Jim 2 148-149 fps 144 fps
Earthworm Jim 2 (paused) 166 fps 161 fps
Lunar Eternal Blue (intro) 169-170 fps 164-165 fps
Lunar Eternal Blue (title) 186 fps 181 fps

As suspected, there is a slight impact on raw emulation speed but it is limited to ~5fps and does not seem to be cumulative the more CPU you have emulated (M68K+Z80 for Mega Drive, M68K+S68K+Z80 for Mega-CD). Virtua Racing is not impacted, probably because the emulation of the SVP is what takes most of the CPU time already so other CPU emulation speed has no impact. Considering the raw emulation speed is still way ahead of the needed speed when synchronized to audio/video (60 fps) and that, even on Gamecube (which is roughly 1.5x slower than Wii), we still get full speed emulation of every system, I think it's safe to add this feature in official build.

Here is a test build with configurable CPU overclocking (in system menu, M68K, S68K and Z80 speed can be overclocked separately, up to 3x) so you can tell me if it works in the few games were this might improve the animation speed. genplus-gx-overclock-test.zip

x2 (i also think in you can post alternate builds with the overclock setting added)

Sorry but I don't think you realize how painful this is to build and release different versions each time you commit a change, then having to deal with people reporting issues on different builds so this would never have happened (for this or other thing). I am not sure also what would have been the point anyway to release something that allows CPU overclocking if you are not able to run games at full speed anymore when emulating normal CPU speed ?

If SNES (and also NES) emulators on Wii (ex. FCEUX TX, Snes9x TX) have that option, why not the SEGA emulators on Wii too?

Well, maybe because SNES and NES games benefit a lot more of CPU overclocking considering how slow the hardware was, while Mega Drive games do not really need it thanks to Blast Processing :-P More seriously, requesting features because different emulators have it is pointless. Anybody is free to work on what he wants, when he has time to work on it. Also, I personally think this is the kind of feature that people will only use a few times with the few games were it is beneficial because of the novelty then never use it again.

60fpshacksrock commented 1 year ago

Thank you for this.

Also I might have been wrong, I hadn't noticed RA was updated recently because the older version broke this core. Maybe they fixed it.

ekeeke commented 1 year ago

I assume the test build is working as expected since there wasn't any reported issue so this is now officially added through https://github.com/ekeeke/Genesis-Plus-GX/commit/ec466a7c9e833a5d5fca4b6fe3baa6ea9238fc42

60fpshacksrock commented 1 year ago

Works great. Thank you much.