Implemented a more efficient frameskip support, skipping frames at GPU level, which is loads faster.

It only works for Windows port atm, to make it work in the other ports :
call NDS_SkipFrame with param : true = skip the current frame, false = render the current frame.
This commit is contained in:
luigi__ 2009-01-21 22:35:46 +00:00
parent 47785d2015
commit c6c4871020
3 changed files with 287 additions and 270 deletions

View File

@ -1010,6 +1010,10 @@ int NDS_LoadFirmware(const char *filename)
return i;
}
bool skipThisFrame = false;
void NDS_SkipFrame(bool skip) { skipThisFrame = skip; }
#define INDEX(i) ((((i)>>16)&0xFF0)|(((i)>>4)&0xF))
@ -1115,8 +1119,11 @@ u32 NDS_exec(s32 nb)
if(nds.VCount<192)
{
GPU_ligne(&MainScreen, nds.VCount);
GPU_ligne(&SubScreen, nds.VCount);
if(!skipThisFrame)
{
GPU_ligne(&MainScreen, nds.VCount);
GPU_ligne(&SubScreen, nds.VCount);
}
if(MMU.DMAStartTime[0][0] == 2)
MMU_doDMA<ARMCPU_ARM9>(0);
@ -1226,7 +1233,8 @@ u32 NDS_exec(s32 nb)
if(MMU.DMAStartTime[1][3] == 1)
MMU_doDMA<ARMCPU_ARM7>(3);
}
else if(nds.VCount==215) {
else if(nds.VCount==215)
{
gfx3d_VBlankEndSignal();
}
else if(nds.VCount==263)

View File

@ -210,6 +210,8 @@ int NDS_WriteBMP(const char *filename);
int NDS_LoadFirmware(const char *filename);
int NDS_CreateDummyFirmware( struct NDS_fw_config_data *user_settings);
void NDS_SkipFrame(bool skip);
template<bool FORCE>
u32 NDS_exec(s32 nb);

View File

@ -971,8 +971,8 @@ DWORD WINAPI run()
DRV_AviSoundUpdate(SPU_core->outbuf,spu_core_samples);
DRV_AviVideoUpdate((u16*)GPU_screen);
if (!skipnextframe)
{
// if (!skipnextframe)
// {
input->process();
if (FpsDisplay) osd->addFixed(0, 5, "%02d Fps", fps);
@ -1002,10 +1002,15 @@ DWORD WINAPI run()
SetWindowText(hwnd, txt);
}
if(!skipnextframe)
{
framesskipped = 0;
if (framestoskip > 0)
skipnextframe = 1;
NDS_SkipFrame(false);
}
else
{
@ -1017,6 +1022,8 @@ DWORD WINAPI run()
skipnextframe = 1;
framesskipped++;
NDS_SkipFrame(true);
}
while(SpeedThrottle())