[Gamecube/Wii] added configurable overclock setting for M68K, S68K and Z80 CPUs

This commit is contained in:
ekeeke 2022-10-25 20:09:25 +02:00
parent 90bb356a17
commit ec466a7c9e
11 changed files with 79 additions and 13 deletions

View File

@ -174,6 +174,8 @@ Genesis Plus GX 1.7.5 (xx/xx/xxxx) (Eke-Eke)
(HOME + MINUS with Wii controllers or R TRIGGER + START with Gamecube controller) (HOME + MINUS with Wii controllers or R TRIGGER + START with Gamecube controller)
* added 50hz progressive mode (576p) support for emulation * added 50hz progressive mode (576p) support for emulation
* added WiiU GamePad Controller support on vWii (Fix94) * added WiiU GamePad Controller support on vWii (Fix94)
* added support for Sega CD / Mega-CD PRG-RAM and Word-RAM cheat codes
* added configurable overclock setting for M68K, S68K and Z80 CPUs
* reduced SRAM files size * reduced SRAM files size
* improved A/V Sync: when VSYNC is enabled, audio resampler output rate is now adjusted (+/-0,1 %) * improved A/V Sync: when VSYNC is enabled, audio resampler output rate is now adjusted (+/-0,1 %)
to always keep audio & video synchronized and input lag is reduced by one frame. to always keep audio & video synchronized and input lag is reduced by one frame.

View File

@ -26,7 +26,7 @@ INCLUDES := core core/m68k core/z80 core/sound core/tremor core/ntsc core/input_
# options for code generation # options for code generation
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
CFLAGS = -O3 -fomit-frame-pointer -Wall -Wno-strict-aliasing $(MACHDEP) $(INCLUDE) -DUSE_LIBTREMOR -DDISABLE_MANY_OGG_OPEN_FILES -DUSE_16BPP_RENDERING -DALT_RENDERER -DBLIP_INVERT CFLAGS = -O3 -fomit-frame-pointer -Wall -Wno-strict-aliasing $(MACHDEP) $(INCLUDE) -DUSE_LIBTREMOR -DDISABLE_MANY_OGG_OPEN_FILES -DUSE_16BPP_RENDERING -DALT_RENDERER -DBLIP_INVERT -DM68K_OVERCLOCK_SHIFT=20 -DZ80_OVERCLOCK_SHIFT=20
CXXFLAGS = $(CFLAGS) CXXFLAGS = $(CFLAGS)
LDFLAGS = $(MACHDEP) -Wl,-Map,$(notdir $@).map LDFLAGS = $(MACHDEP) -Wl,-Map,$(notdir $@).map

View File

@ -30,7 +30,7 @@ INCLUDES := core core/m68k core/z80 core/sound core/tremor core/ntsc core/input_
# options for code generation # options for code generation
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
CFLAGS = -O3 -fomit-frame-pointer -Wall -Wno-strict-aliasing $(MACHDEP) $(INCLUDE) -DMAXROMSIZE=15728640 -DUSE_LIBTREMOR -DUSE_LIBCHDR -DUSE_16BPP_RENDERING -DALT_RENDERER -DBLIP_INVERT -DHW_RVL -DCPU_IS_BIG_ENDIAN=1 -DWORDS_BIGENDIAN=1 -DPACKAGE_VERSION=\"1.3.2\" -DFLAC_API_EXPORTS -DFLAC__HAS_OGG=0 -DHAVE_LROUND -DHAVE_STDINT_H -DHAVE_SYS_PARAM_H -D_7ZIP_ST CFLAGS = -O3 -fomit-frame-pointer -Wall -Wno-strict-aliasing $(MACHDEP) $(INCLUDE) -DMAXROMSIZE=15728640 -DUSE_LIBTREMOR -DUSE_LIBCHDR -DUSE_16BPP_RENDERING -DALT_RENDERER -DBLIP_INVERT -DHW_RVL -DCPU_IS_BIG_ENDIAN=1 -DWORDS_BIGENDIAN=1 -DPACKAGE_VERSION=\"1.3.2\" -DFLAC_API_EXPORTS -DFLAC__HAS_OGG=0 -DHAVE_LROUND -DHAVE_STDINT_H -DHAVE_SYS_PARAM_H -D_7ZIP_ST -DM68K_OVERCLOCK_SHIFT=20 -DZ80_OVERCLOCK_SHIFT=20
CXXFLAGS = $(CFLAGS) CXXFLAGS = $(CFLAGS)
LDFLAGS = $(MACHDEP) -Wl,-Map,$(notdir $@).map LDFLAGS = $(MACHDEP) -Wl,-Map,$(notdir $@).map

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 MiB

After

Width:  |  Height:  |  Size: 3.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 MiB

After

Width:  |  Height:  |  Size: 4.0 MiB

View File

@ -127,6 +127,9 @@ void config_default(void)
config.add_on = HW_ADDON_AUTO; config.add_on = HW_ADDON_AUTO;
config.hot_swap = 0; config.hot_swap = 0;
config.cd_latency = 1; config.cd_latency = 1;
config.m68k_overclock = 1.0;
config.s68k_overclock = 1.0;
config.z80_overclock = 1.0;
/* video options */ /* video options */
config.xshift = 0; config.xshift = 0;

View File

@ -126,6 +126,9 @@ typedef struct
float ntsc_artifacts; float ntsc_artifacts;
float ntsc_fringing; float ntsc_fringing;
float ntsc_bleed; float ntsc_bleed;
float m68k_overclock;
float s68k_overclock;
float z80_overclock;
char sys_rom[12][256]; char sys_rom[12][256];
} t_config; } t_config;

Binary file not shown.

Binary file not shown.

View File

@ -392,6 +392,9 @@ static gui_item items_system[] =
{NULL,NULL,"Lock-On: SONIC&KNUCKLES", "Select Lock-On cartridge type", 56,132,276,48}, {NULL,NULL,"Lock-On: SONIC&KNUCKLES", "Select Lock-On cartridge type", 56,132,276,48},
{NULL,NULL,"Cartridge Swap: OFF", "Enable/Disable cartridge hot swap", 56,132,276,48}, {NULL,NULL,"Cartridge Swap: OFF", "Enable/Disable cartridge hot swap", 56,132,276,48},
{NULL,NULL,"BIOS & Lock-On ROM paths", "Configure Boot ROM & Lock-On ROM paths", 56,132,276,48}, {NULL,NULL,"BIOS & Lock-On ROM paths", "Configure Boot ROM & Lock-On ROM paths", 56,132,276,48},
{NULL,NULL,"Main 68k Overclock: 3.0x", "Adjust Mega Drive /Genesis CPU clock speed", 56,132,276,48},
{NULL,NULL,"Sub 68k Overclock: 3.0x", "Adjust Sega CD / Mega-CD CPU clock speed", 56,132,276,48},
{NULL,NULL,"Z80 Overclock: 3.0x", "Adjust Z80 CPU clock speed", 56,132,276,48},
{NULL,NULL,"SVP Cycles: 1500", "Adjust SVP chip emulation speed", 56,132,276,48} {NULL,NULL,"SVP Cycles: 1500", "Adjust SVP chip emulation speed", 56,132,276,48}
}; };
@ -1356,14 +1359,29 @@ static void systemmenu ()
sprintf (items[10].text, "Cartridge Swap: %s", (config.hot_swap & 1) ? "ON":"OFF"); sprintf (items[10].text, "Cartridge Swap: %s", (config.hot_swap & 1) ? "ON":"OFF");
if (config.m68k_overclock > 1.0)
sprintf (items[12].text, "Main 68k Overclock: %1.1fx", config.m68k_overclock);
else
sprintf (items[12].text, "Main 68k Overclock: OFF");
if (config.s68k_overclock > 1.0)
sprintf (items[13].text, "Sub 68k Overclock: %1.1fx", config.s68k_overclock);
else
sprintf (items[13].text, "Sub 68k Overclock: OFF");
if (config.z80_overclock > 1.0)
sprintf (items[14].text, "Z80 Overclock: %1.1fx", config.z80_overclock);
else
sprintf (items[14].text, "Z80 Overclock: OFF");
if (svp) if (svp)
{ {
sprintf (items[12].text, "SVP Cycles: %d", SVP_cycles); sprintf (items[15].text, "SVP Cycles: %d", SVP_cycles);
m->max_items = 13; m->max_items = 16;
} }
else else
{ {
m->max_items = 12; m->max_items = 15;
} }
GUI_InitMenu(m); GUI_InitMenu(m);
@ -1634,10 +1652,40 @@ static void systemmenu ()
break; break;
} }
case 12: /*** SVP cycles per line ***/ case 12: /*** Main 68k Overclock ***/
{
GUI_OptionBox(m,0,"Main 68k Overclock Ratio",(void *)&config.m68k_overclock,0.1,1.0,3.0,0);
if (config.m68k_overclock > 1.0)
sprintf (items[12].text, "Main 68k Overclock: %1.1fx", config.m68k_overclock);
else
sprintf (items[12].text, "Main 68k Overclock: OFF");
break;
}
case 13: /*** Sub 68k Overclock ***/
{
GUI_OptionBox(m,0,"Sub 68k Overclock Ratio",(void *)&config.s68k_overclock,0.1,1.0,3.0,0);
if (config.s68k_overclock > 1.0)
sprintf (items[13].text, "Sub 68k Overclock: %1.1fx", config.s68k_overclock);
else
sprintf (items[13].text, "Sub 68k Overclock: OFF");
break;
}
case 14: /*** Z80 Overclock ***/
{
GUI_OptionBox(m,0,"Z80 Overclock Ratio",(void *)&config.z80_overclock,0.1,1.0,3.0,0);
if (config.z80_overclock > 1.0)
sprintf (items[14].text, "Z80 Overclock: %1.1fx", config.z80_overclock);
else
sprintf (items[14].text, "Z80 Overclock: OFF");
break;
}
case 15: /*** SVP cycles per line ***/
{ {
GUI_OptionBox(m,0,"SVP Cycles",(void *)&SVP_cycles,1,1,1500,1); GUI_OptionBox(m,0,"SVP Cycles",(void *)&SVP_cycles,1,1,1500,1);
sprintf (items[12].text, "SVP Cycles: %d", SVP_cycles); sprintf (items[15].text, "SVP Cycles: %d", SVP_cycles);
break; break;
} }
@ -1707,6 +1755,11 @@ static void systemmenu ()
} }
} }
/* Initialize CPU overclock ratio */
m68k.cycle_ratio = (100 << M68K_OVERCLOCK_SHIFT) / (int)(config.m68k_overclock * 100.0);
s68k.cycle_ratio = (100 << M68K_OVERCLOCK_SHIFT) / (int)(config.s68k_overclock * 100.0);
z80_cycle_ratio = (100 << Z80_OVERCLOCK_SHIFT) / (int)(config.z80_overclock * 100.0);
GUI_DeleteMenu(m); GUI_DeleteMenu(m);
} }
@ -2034,27 +2087,27 @@ static void videomenu ()
} }
case VI_OFFSET+2: /*** NTSC Sharpness ***/ case VI_OFFSET+2: /*** NTSC Sharpness ***/
GUI_OptionBox(m,update_bgm,"NTSC Sharpness",(void *)&config.ntsc_sharpness,0.01,-1.0,1.0,0); GUI_OptionBox(m,0,"NTSC Sharpness",(void *)&config.ntsc_sharpness,0.01,-1.0,1.0,0);
sprintf(items[VI_OFFSET+2].text, "NTSC Sharpness: %1.2f", config.ntsc_sharpness); sprintf(items[VI_OFFSET+2].text, "NTSC Sharpness: %1.2f", config.ntsc_sharpness);
break; break;
case VI_OFFSET+3: /*** NTSC Resolution ***/ case VI_OFFSET+3: /*** NTSC Resolution ***/
GUI_OptionBox(m,update_bgm,"NTSC Resolution",(void *)&config.ntsc_resolution,0.01,0.0,1.0,0); GUI_OptionBox(m,0,"NTSC Resolution",(void *)&config.ntsc_resolution,0.01,0.0,1.0,0);
sprintf(items[VI_OFFSET+3].text, "NTSC Resolution: %1.2f", config.ntsc_resolution); sprintf(items[VI_OFFSET+3].text, "NTSC Resolution: %1.2f", config.ntsc_resolution);
break; break;
case VI_OFFSET+4: /*** NTSC Artifacts ***/ case VI_OFFSET+4: /*** NTSC Artifacts ***/
GUI_OptionBox(m,update_bgm,"NTSC Artifacts",(void *)&config.ntsc_artifacts,0.01,-1.0,0.0,0); GUI_OptionBox(m,0,"NTSC Artifacts",(void *)&config.ntsc_artifacts,0.01,-1.0,0.0,0);
sprintf(items[VI_OFFSET+4].text, "NTSC Artifacts: %1.2f", config.ntsc_artifacts); sprintf(items[VI_OFFSET+4].text, "NTSC Artifacts: %1.2f", config.ntsc_artifacts);
break; break;
case VI_OFFSET+5: /*** NTSC Color Bleed ***/ case VI_OFFSET+5: /*** NTSC Color Bleed ***/
GUI_OptionBox(m,update_bgm,"NTSC Color Bleed",(void *)&config.ntsc_bleed,0.01,-1.0,1.0,0); GUI_OptionBox(m,0,"NTSC Color Bleed",(void *)&config.ntsc_bleed,0.01,-1.0,1.0,0);
sprintf(items[VI_OFFSET+5].text, "NTSC Color Bleed: %1.2f", config.ntsc_bleed); sprintf(items[VI_OFFSET+5].text, "NTSC Color Bleed: %1.2f", config.ntsc_bleed);
break; break;
case VI_OFFSET+6: /*** NTSC Color Fringing ***/ case VI_OFFSET+6: /*** NTSC Color Fringing ***/
GUI_OptionBox(m,update_bgm,"NTSC Color Fringing",(void *)&config.ntsc_fringing,0.01,-1.0,1.0,0); GUI_OptionBox(m,0,"NTSC Color Fringing",(void *)&config.ntsc_fringing,0.01,-1.0,1.0,0);
sprintf(items[VI_OFFSET+6].text, "NTSC Color Fringing: %1.2f", config.ntsc_fringing); sprintf(items[VI_OFFSET+6].text, "NTSC Color Fringing: %1.2f", config.ntsc_fringing);
break; break;

View File

@ -3,7 +3,7 @@
* *
* Genesis Plus GX * Genesis Plus GX
* *
* Copyright Eke-Eke (2007-2021), based on original work from Softdev (2006) * Copyright Eke-Eke (2007-2022), based on original work from Softdev (2006)
* *
* Redistribution and use of this code or any derivative works are permitted * Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met: * provided that the following conditions are met:
@ -282,6 +282,11 @@ void reloadrom(void)
config.hot_swap |= 2; config.hot_swap |= 2;
} }
/* Initialize CPU overclock ratio */
m68k.cycle_ratio = (100 << M68K_OVERCLOCK_SHIFT) / (int)(config.m68k_overclock * 100.0);
s68k.cycle_ratio = (100 << M68K_OVERCLOCK_SHIFT) / (int)(config.s68k_overclock * 100.0);
z80_cycle_ratio = (100 << Z80_OVERCLOCK_SHIFT) / (int)(config.z80_overclock * 100.0);
/* Auto-Load Backup RAM */ /* Auto-Load Backup RAM */
slot_autoload(0,config.s_device); slot_autoload(0,config.s_device);