add logic and CLI for game-specific workarounds

This commit is contained in:
zeromus 2017-03-01 00:34:09 -06:00
parent 99f68c8a51
commit cfae9c7674
5 changed files with 21 additions and 4 deletions

View File

@ -1485,16 +1485,25 @@ static void execHardware_hstart()
gfx3d_VBlankEndSignal(frameSkipper.ShouldSkip3D()); gfx3d_VBlankEndSignal(frameSkipper.ShouldSkip3D());
} }
if(nds.VCount==261)
nds.overclock = 0;
if(nds.VCount==263) if(nds.VCount==263)
{ {
//when the vcount hits 263 it rolls over to 0
nds.VCount=0; nds.VCount=0;
} }
else if(nds.VCount==262) else if(nds.VCount==262)
{
if(!(NDS_ARM9.waitIRQ) && nds.overclock < 200 && CommonSettings.pokehax) {
nds.overclock++;
nds.VCount = 261;
}
else
{ {
//when the vcount hits 262, vblank ends (oam pre-renders by one scanline) //when the vcount hits 262, vblank ends (oam pre-renders by one scanline)
execHardware_hstart_vblankEnd(); execHardware_hstart_vblankEnd();
} }
}
else if(nds.VCount==192) else if(nds.VCount==192)
{ {
//turn on vblank status bit //turn on vblank status bit
@ -2515,6 +2524,7 @@ void NDS_Reset()
nds.isTouch = 0; nds.isTouch = 0;
nds.isFakeBooted = false; nds.isFakeBooted = false;
nds.paddle = 0; nds.paddle = 0;
nds.overclock = 0;
nds.ConsoleType = CommonSettings.ConsoleType; nds.ConsoleType = CommonSettings.ConsoleType;
nds._DebugConsole = CommonSettings.DebugConsole; nds._DebugConsole = CommonSettings.DebugConsole;
nds.ensataEmulation = CommonSettings.EnsataEmulation; nds.ensataEmulation = CommonSettings.EnsataEmulation;

View File

@ -176,6 +176,7 @@ struct NDSSystem
u64 timerCycle[2][4]; u64 timerCycle[2][4];
u32 VCount; u32 VCount;
u32 old; u32 old;
u8 overclock;
//raw adc touch coords for old NDS //raw adc touch coords for old NDS
u16 adc_touchX; u16 adc_touchX;
@ -577,6 +578,7 @@ extern struct TCommonSettings {
int num_cores; int num_cores;
bool single_core() { return num_cores==1; } bool single_core() { return num_cores==1; }
bool rigorous_timing; bool rigorous_timing;
bool pokehax;
int StylusPressure; int StylusPressure;
bool StylusJitter; bool StylusJitter;

View File

@ -124,6 +124,7 @@ ENDL
#endif #endif
" --advanced-timing Use advanced bus-level timing; default ON" ENDL " --advanced-timing Use advanced bus-level timing; default ON" ENDL
" --rigorous-timing Use more realistic component timings; default OFF" ENDL " --rigorous-timing Use more realistic component timings; default OFF" ENDL
" --pokehax Use game-specific hacks; default OFF" ENDL
" --spu-advanced Enable advanced SPU capture functions (reverb)" ENDL " --spu-advanced Enable advanced SPU capture functions (reverb)" ENDL
" --backupmem-db Use DB for autodetecting backup memory type" ENDL " --backupmem-db Use DB for autodetecting backup memory type" ENDL
ENDL ENDL
@ -244,6 +245,7 @@ bool CommandLine::parse(int argc,char **argv)
#endif #endif
{ "rigorous-timing", no_argument, &_rigorous_timing, 1}, { "rigorous-timing", no_argument, &_rigorous_timing, 1},
{ "advanced-timing", no_argument, &_advanced_timing, 1}, { "advanced-timing", no_argument, &_advanced_timing, 1},
{ "pokehax", no_argument, &_pokehax, 1},
{ "spu-advanced", no_argument, &_spu_advanced, 1}, { "spu-advanced", no_argument, &_spu_advanced, 1},
{ "backupmem-db", no_argument, &autodetect_method, 1}, { "backupmem-db", no_argument, &autodetect_method, 1},
@ -352,6 +354,7 @@ bool CommandLine::parse(int argc,char **argv)
if(_num_cores != -1) CommonSettings.num_cores = _num_cores; if(_num_cores != -1) CommonSettings.num_cores = _num_cores;
if(_rigorous_timing) CommonSettings.rigorous_timing = true; if(_rigorous_timing) CommonSettings.rigorous_timing = true;
if(_advanced_timing != -1) CommonSettings.advanced_timing = _advanced_timing==1; if(_advanced_timing != -1) CommonSettings.advanced_timing = _advanced_timing==1;
if(_advanced_timing != -1) CommonSettings.pokehax = _pokehax==1;
#ifdef HAVE_JIT #ifdef HAVE_JIT
if(_cpu_mode != -1) CommonSettings.use_jit = (_cpu_mode==1); if(_cpu_mode != -1) CommonSettings.use_jit = (_cpu_mode==1);

View File

@ -97,6 +97,7 @@ private:
int _num_cores; int _num_cores;
int _rigorous_timing; int _rigorous_timing;
int _advanced_timing; int _advanced_timing;
int _pokehax;
int _texture_deposterize; int _texture_deposterize;
int _texture_smooth; int _texture_smooth;
#ifdef HAVE_JIT #ifdef HAVE_JIT

View File

@ -206,6 +206,7 @@ SFORMAT SF_NDS[]={
{ "_FBS", 4, 1, &nds.freezeBus}, { "_FBS", 4, 1, &nds.freezeBus},
{ "_CEJ", 4, 1, &nds.cardEjected}, { "_CEJ", 4, 1, &nds.cardEjected},
{ "_PDL", 2, 1, &nds.paddle}, { "_PDL", 2, 1, &nds.paddle},
{ "_OVR", 1, 1, &nds.overclock},
{ "_P00", 1, 1, &nds.power1.lcd}, { "_P00", 1, 1, &nds.power1.lcd},
{ "_P01", 1, 1, &nds.power1.gpuMain}, { "_P01", 1, 1, &nds.power1.gpuMain},
{ "_P02", 1, 1, &nds.power1.gfx3d_render}, { "_P02", 1, 1, &nds.power1.gfx3d_render},