I finally figured out why 2D and 3D get desynced when skipping 3D frames.
Thus, I fixed the frameskip system so it'll also skip 3D frames. 2D and 3D stay synchronized, and frameskip is now much faster when using the soft rasterizer, for example.
This commit is contained in:
parent
307fdf527f
commit
016a543ef3
|
@ -1587,10 +1587,10 @@ int NDS_LoadFirmware(const char *filename)
|
|||
|
||||
void NDS_Sleep() { nds.sleeping = TRUE; }
|
||||
|
||||
bool skipThisFrame = false;
|
||||
bool skipThisFrame3D = false;
|
||||
bool SkipCur2DFrame = false, SkipNext2DFrame = false;
|
||||
bool SkipCur3DFrame = false;
|
||||
|
||||
void NDS_SkipFrame(bool skip) { skipThisFrame = skip; }
|
||||
void NDS_SkipNextFrame() { SkipNext2DFrame = true; SkipCur3DFrame = true; }
|
||||
|
||||
#define INDEX(i) ((((i)>>16)&0xFF0)|(((i)>>4)&0xF))
|
||||
|
||||
|
@ -1699,7 +1699,7 @@ u32 NDS_exec(s32 nb)
|
|||
}
|
||||
|
||||
#ifdef EXPERIMENTAL_WIFI
|
||||
/* TODO: the wifi stuff isn't actually clocked by the ARM7 clock, */
|
||||
/* FIXME: the wifi stuff isn't actually clocked by the ARM7 clock, */
|
||||
/* but by a 22 mhz oscillator. */
|
||||
if(nds7old < nds.ARM7Cycle)
|
||||
{
|
||||
|
@ -1713,11 +1713,14 @@ u32 NDS_exec(s32 nb)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} // for (j = 0; j < INSTRUCTIONS_PER_BATCH && (!FORCE) && (execute); j++)
|
||||
|
||||
if(!nds.sleeping)
|
||||
{
|
||||
|
||||
// for(i = 0; i < INSTRUCTIONS_PER_BATCH && (!FORCE) && (execute); i++)
|
||||
// {
|
||||
|
||||
nds.cycles = std::min(nds.ARM9Cycle,nds.ARM7Cycle);
|
||||
|
||||
//debug();
|
||||
|
@ -1733,14 +1736,12 @@ u32 NDS_exec(s32 nb)
|
|||
|
||||
if(nds.VCount<192)
|
||||
{
|
||||
if(!skipThisFrame)
|
||||
if(!SkipCur2DFrame)
|
||||
{
|
||||
GPU_ligne(&MainScreen, nds.VCount);
|
||||
GPU_ligne(&SubScreen, nds.VCount);
|
||||
}
|
||||
|
||||
skipThisFrame3D = skipThisFrame;
|
||||
|
||||
if(MMU.DMAStartTime[0][0] == 2)
|
||||
MMU_doDMA<ARMCPU_ARM9>(0);
|
||||
if(MMU.DMAStartTime[0][1] == 2)
|
||||
|
@ -1819,6 +1820,14 @@ u32 NDS_exec(s32 nb)
|
|||
//osdA->update();
|
||||
gfx3d_VBlankSignal();
|
||||
|
||||
if(SkipNext2DFrame)
|
||||
{
|
||||
SkipCur2DFrame = true;
|
||||
SkipNext2DFrame = false;
|
||||
}
|
||||
else
|
||||
SkipCur2DFrame = false;
|
||||
|
||||
T1WriteWord(ARM9Mem.ARM9_REG, 4, T1ReadWord(ARM9Mem.ARM9_REG, 4) | 1);
|
||||
T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) | 1);
|
||||
NDS_ARM9VBlankInt();
|
||||
|
@ -1851,7 +1860,8 @@ u32 NDS_exec(s32 nb)
|
|||
}
|
||||
else if(nds.VCount==214)
|
||||
{
|
||||
gfx3d_VBlankEndSignal(false);
|
||||
gfx3d_VBlankEndSignal(SkipCur3DFrame);
|
||||
SkipCur3DFrame = false;
|
||||
}
|
||||
else if(nds.VCount==263)
|
||||
{
|
||||
|
@ -1929,7 +1939,16 @@ u32 NDS_exec(s32 nb)
|
|||
else
|
||||
T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) & 0xFFFB);
|
||||
}
|
||||
}
|
||||
} // if(nds.cycles >= nds.nextHBlank)
|
||||
|
||||
/* } // for(i = 0; i < INSTRUCTIONS_PER_BATCH && (!FORCE) && (execute); i++)
|
||||
|
||||
} // if(!nds.sleeping)
|
||||
|
||||
} // for (j = 0; j < INSTRUCTIONS_PER_BATCH && (!FORCE) && (execute); j++)
|
||||
|
||||
if(!nds.sleeping)
|
||||
{*/
|
||||
|
||||
if(MMU.divRunning)
|
||||
{
|
||||
|
|
|
@ -287,7 +287,8 @@ int NDS_CreateDummyFirmware( struct NDS_fw_config_data *user_settings);
|
|||
|
||||
void NDS_Sleep();
|
||||
|
||||
void NDS_SkipFrame(bool skip);
|
||||
void NDS_SkipNextFrame();
|
||||
#define NDS_SkipFrame(s) if(s) NDS_SkipNext2DFrame();
|
||||
|
||||
template<bool FORCE>
|
||||
u32 NDS_exec(s32 nb);
|
||||
|
|
|
@ -1160,11 +1160,14 @@ DWORD WINAPI run()
|
|||
}
|
||||
|
||||
|
||||
// TODO: make that thing properly threaded
|
||||
// because, here, if the emu is slower, the tools will refresh less often
|
||||
tools_frames++;
|
||||
if(tools_frames == 10)
|
||||
{
|
||||
if(MemView_IsOpened(ARMCPU_ARM9)) MemView_Refresh(ARMCPU_ARM9);
|
||||
if(MemView_IsOpened(ARMCPU_ARM7)) MemView_Refresh(ARMCPU_ARM7);
|
||||
// if(IORegView_IsOpened()) IORegView_Refresh();
|
||||
|
||||
tools_frames = 0;
|
||||
}
|
||||
|
@ -1201,8 +1204,6 @@ DWORD WINAPI run()
|
|||
|
||||
if (framestoskip > 0)
|
||||
skipnextframe = 1;
|
||||
|
||||
NDS_SkipFrame(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1215,8 +1216,9 @@ DWORD WINAPI run()
|
|||
|
||||
framesskipped++;
|
||||
|
||||
NDS_SkipFrame(true);
|
||||
NDS_SkipNextFrame();
|
||||
}
|
||||
|
||||
if(FastForward) {
|
||||
|
||||
if(framesskipped < 9)
|
||||
|
@ -1246,7 +1248,7 @@ DWORD WINAPI run()
|
|||
QueryPerformanceCounter((LARGE_INTEGER *)&curticks);
|
||||
diffticks = curticks-lastticks;
|
||||
|
||||
if(ThrottleIsBehind() && framesskipped < 9)
|
||||
if(ThrottleIsBehind() && (framesskipped < 9))
|
||||
{
|
||||
skipnextframe = 1;
|
||||
framestoskip = 1;
|
||||
|
@ -1934,6 +1936,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
|||
|
||||
MemView_DlgClose(ARMCPU_ARM9);
|
||||
MemView_DlgClose(ARMCPU_ARM7);
|
||||
//IORegView_DlgClose();
|
||||
|
||||
MemView_DeInit();
|
||||
|
||||
|
@ -3103,6 +3106,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
|||
return 0;
|
||||
case IDM_IOREG:
|
||||
ViewRegisters->open();
|
||||
//IORegView_DlgOpen(HWND_DESKTOP, "I/O registers");
|
||||
return 0;
|
||||
case IDM_MEMORY:
|
||||
/* ViewMem_ARM7->regClass("MemViewBox7", ViewMem_ARM7BoxProc);
|
||||
|
@ -3111,8 +3115,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
|||
ViewMem_ARM9->regClass("MemViewBox9", ViewMem_ARM9BoxProc);
|
||||
if (!ViewMem_ARM9->open())
|
||||
ViewMem_ARM9->unregClass();*/
|
||||
if(!MemView_IsOpened(ARMCPU_ARM9)) MemView_DlgOpen(hwnd, "ARM9 memory", ARMCPU_ARM9);
|
||||
if(!MemView_IsOpened(ARMCPU_ARM7)) MemView_DlgOpen(hwnd, "ARM7 memory", ARMCPU_ARM7);
|
||||
if(!MemView_IsOpened(ARMCPU_ARM9)) MemView_DlgOpen(HWND_DESKTOP, "ARM9 memory", ARMCPU_ARM9);
|
||||
if(!MemView_IsOpened(ARMCPU_ARM7)) MemView_DlgOpen(HWND_DESKTOP, "ARM7 memory", ARMCPU_ARM7);
|
||||
return 0;
|
||||
case IDM_DISASSEMBLER:
|
||||
ViewDisasm_ARM7->regClass("DesViewBox7",ViewDisasm_ARM7BoxProc);
|
||||
|
|
Loading…
Reference in New Issue