-Add Super FX Overclock option

This commit is contained in:
Juan Ruvalcaba 2016-03-12 13:58:51 -07:00
parent 56046d2f77
commit 3c0bafb263
6 changed files with 57 additions and 13 deletions

View File

@ -39,6 +39,7 @@
#include "utils/gettext.h"
#include "snes9x/snes9x.h"
#include "snes9x/fxemu.h"
#include "snes9x/memmap.h"
#include "snes9x/cheats.h"
@ -3101,6 +3102,7 @@ static int MenuSettingsVideo()
int ret;
int i = 0;
bool firstRun = true;
bool reset_sfx = false;
OptionList options;
sprintf(options.name[i++], "Rendering");
@ -3111,6 +3113,7 @@ static int MenuSettingsVideo()
sprintf(options.name[i++], "Crosshair");
sprintf(options.name[i++], "Video Mode");
sprintf(options.name[i++], "Show Framerate");
sprintf(options.name[i++], "SuperFX Overclock");
options.length = i;
#ifdef HW_DOL
@ -3202,6 +3205,18 @@ static int MenuSettingsVideo()
Settings.AutoDisplayMessages ^= 1;
Settings.DisplayFrameRate ^= 1;
break;
case 8:
GCSettings.sfxOverclock++;
if (GCSettings.sfxOverclock > 2)
GCSettings.sfxOverclock = 0;
switch(GCSettings.sfxOverclock)
{
case 0: Settings.SuperFXSpeedPerLine = 0.417 * 10.5e6; reset_sfx = true; break;
case 1: Settings.SuperFXSpeedPerLine = 0.417 * 40.5e6; reset_sfx = true; break;
case 2: Settings.SuperFXSpeedPerLine = 0.417 * 60.5e6; reset_sfx = true; break;
}
if (reset_sfx) S9xResetSuperFX(); S9xReset();
break;
}
if(ret >= 0 || firstRun)
@ -3244,6 +3259,15 @@ static int MenuSettingsVideo()
sprintf (options.value[6], "PAL (60Hz)"); break;
}
sprintf (options.value[7], "%s", Settings.DisplayFrameRate ? "On" : "Off");
switch(GCSettings.sfxOverclock)
{
case 0:
sprintf (options.value[8], "Default"); break;
case 1:
sprintf (options.value[8], "40 Mhz"); break;
case 2:
sprintf (options.value[8], "60 Mhz"); break;
}
optionBrowser.TriggerUpdate();
}

View File

@ -146,6 +146,7 @@ preparePrefsData ()
createXMLSetting("FilterMethod", "Filter Method", toStr(GCSettings.FilterMethod));
createXMLSetting("xshift", "Horizontal Video Shift", toStr(GCSettings.xshift));
createXMLSetting("yshift", "Vertical Video Shift", toStr(GCSettings.yshift));
createXMLSetting("sfxOverclock", "SuperFX Overclock", toStr(GCSettings.sfxOverclock));
createXMLSection("Menu", "Menu Settings");
@ -323,6 +324,10 @@ decodePrefsData ()
loadXMLSetting(&GCSettings.xshift, "xshift");
loadXMLSetting(&GCSettings.yshift, "yshift");
//Emulation Settings
loadXMLSetting(&GCSettings.sfxOverclock, "sfxOverclock");
// Menu Settings
loadXMLSetting(&GCSettings.WiimoteOrientation, "WiimoteOrientation");
@ -346,6 +351,7 @@ decodePrefsData ()
loadXMLController(btnmap[CTRL_MOUSE][CTRLR_WIIMOTE], "btnmap_mouse_wiimote");
loadXMLController(btnmap[CTRL_JUST][CTRLR_GCPAD], "btnmap_just_gcpad");
loadXMLController(btnmap[CTRL_JUST][CTRLR_WIIMOTE], "btnmap_just_wiimote");
}
mxmlDelete(xml);
}
@ -474,6 +480,11 @@ DefaultSettings ()
// Frame timings in 50hz and 60hz cpu mode
Settings.FrameTimePAL = 20000;
Settings.FrameTimeNTSC = 16667;
GCSettings.sfxOverclock = 0;
/* Initialize SuperFX CPU to normal speed by default */
Settings.SuperFXSpeedPerLine = 0.417 * 10.5e6;
}
/****************************************************************************

View File

@ -199,7 +199,8 @@ void S9xInitSuperFX (void)
void S9xResetSuperFX (void)
{
// FIXME: Snes9x can't execute CPU and SuperFX at a time. Don't ask me what is 0.417 :P
SuperFX.speedPerLine = (uint32) (0.417 * 10.5e6 * ((1.0 / (float) Memory.ROMFramesPerSecond) / ((float) (Timings.V_Max))));
//SuperFX.speedPerLine = (uint32) (0.417 * 10.5e6 * ((1.0 / (float) Memory.ROMFramesPerSecond) / ((float) (Timings.V_Max))));
SuperFX.speedPerLine = (uint32) (Settings.SuperFXSpeedPerLine * ((1.0f / Memory.ROMFramesPerSecond) / ((float) (Timings.V_Max))));
SuperFX.oneLineDone = FALSE;
SuperFX.vFlags = 0;
FxReset(&SuperFX);

View File

@ -446,6 +446,7 @@ struct SSettings
bool8 UpAndDown;
bool8 OpenGLEnable;
float SuperFXSpeedPerLine;
};
struct SSNESGameFixes

View File

@ -44,6 +44,7 @@
#include "utils/FreeTypeGX.h"
#include "snes9x/snes9x.h"
#include "snes9x/fxemu.h"
#include "snes9x/memmap.h"
#include "snes9x/apu/apu.h"
#include "snes9x/controls.h"
@ -504,6 +505,14 @@ int main(int argc, char *argv[])
BrowserLoadFile();
}
switch (GCSettings.sfxOverclock)
{
case 0: Settings.SuperFXSpeedPerLine = 0.417 * 10.5e6; break;
case 1: Settings.SuperFXSpeedPerLine = 0.417 * 40.5e6; break;
case 2: Settings.SuperFXSpeedPerLine = 0.417 * 60.5e6; break;
S9xResetSuperFX();
}
while (1) // main loop
{
// go back to checking if devices were inserted/removed
@ -512,10 +521,6 @@ int main(int argc, char *argv[])
SwitchAudioMode(1);
// if(SNESROMSize == 0)
// MainMenu(MENU_GAMESELECTION);
// else
// MainMenu(MENU_GAME);
if(!autoboot)
{
if(SNESROMSize == 0)
@ -549,11 +554,11 @@ int main(int argc, char *argv[])
HaltDeviceThread();
AudioStart ();
FrameTimer = 0;
setFrameTimerMethod (); // set frametimer method every time a ROM is loaded
CheckVideo = 2; // force video update
FrameTimer = 0;
setFrameTimerMethod (); // set frametimer method every time a ROM is loaded
CheckVideo = 2; // force video update
prevRenderedFrameCount = IPPU.RenderedFramesCount;
currentMode = GCSettings.render;

View File

@ -19,9 +19,9 @@
#include "filter.h"
#include "filelist.h"
#define APPNAME "Snes9x GX"
#define APPVERSION "4.3.6"
#define APPFOLDER "snes9xgx"
#define APPNAME "Snes9x GX"
#define APPVERSION "4.3.6"
#define APPFOLDER "snes9xgx"
#define PREF_FILE_NAME "settings.xml"
#define NOTSILENT 0
@ -114,7 +114,9 @@ struct SGCSettings{
int MusicVolume;
int SFXVolume;
int Rumble;
int language;
int language;
int sfxOverclock;
};
void ExitApp();