gpu: emulate display capture while frame skipping
This commit is contained in:
parent
ffa4adfc47
commit
24a040ef2b
|
@ -2510,8 +2510,7 @@ static void GPU_ligne_layer(NDS_Screen * screen, u16 l)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: capture emulated not fully
|
template<bool SKIP> static void GPU_ligne_DispCapture(u16 l)
|
||||||
static void GPU_ligne_DispCapture(u16 l)
|
|
||||||
{
|
{
|
||||||
//this macro takes advantage of the fact that there are only two possible values for capx
|
//this macro takes advantage of the fact that there are only two possible values for capx
|
||||||
#define CAPCOPY(SRC,DST) \
|
#define CAPCOPY(SRC,DST) \
|
||||||
|
@ -2557,6 +2556,7 @@ static void GPU_ligne_DispCapture(u16 l)
|
||||||
u8* cap_src = ARM9Mem.ARM9_LCD + cap_src_adr;
|
u8* cap_src = ARM9Mem.ARM9_LCD + cap_src_adr;
|
||||||
u8* cap_dst = ARM9Mem.ARM9_LCD + cap_dst_adr;
|
u8* cap_dst = ARM9Mem.ARM9_LCD + cap_dst_adr;
|
||||||
|
|
||||||
|
if(!SKIP)
|
||||||
if (l < gpu->dispCapCnt.capy)
|
if (l < gpu->dispCapCnt.capy)
|
||||||
{
|
{
|
||||||
switch (gpu->dispCapCnt.capSrc)
|
switch (gpu->dispCapCnt.capSrc)
|
||||||
|
@ -2810,7 +2810,7 @@ void GPU::update_winh(int WIN_NUM)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPU_ligne(NDS_Screen * screen, u16 l)
|
void GPU_ligne(NDS_Screen * screen, u16 l, bool skip)
|
||||||
{
|
{
|
||||||
GPU * gpu = screen->gpu;
|
GPU * gpu = screen->gpu;
|
||||||
|
|
||||||
|
@ -2830,6 +2830,17 @@ void GPU_ligne(NDS_Screen * screen, u16 l)
|
||||||
gpu->refreshAffineStartRegs(-1,-1);
|
gpu->refreshAffineStartRegs(-1,-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(skip)
|
||||||
|
{
|
||||||
|
gpu->currLine = l;
|
||||||
|
if (gpu->core == GPU_MAIN)
|
||||||
|
{
|
||||||
|
GPU_ligne_DispCapture<true>(l);
|
||||||
|
if (l == 191) { disp_fifo.head = disp_fifo.tail = 0; }
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//if(gpu->core == 1)
|
//if(gpu->core == 1)
|
||||||
// printf("%d\n",l);
|
// printf("%d\n",l);
|
||||||
|
|
||||||
|
@ -2848,7 +2859,7 @@ void GPU_ligne(NDS_Screen * screen, u16 l)
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//cache some parameters which are assumed to be stable throughout the rendering of the entire line
|
//cache some parameters which are assumed to be stable throughout the rendering of the entire line
|
||||||
gpu->currLine = (u8)l;
|
gpu->currLine = l;
|
||||||
u16 mosaic_control = T1ReadWord((u8 *)&gpu->dispx_st->dispx_MISC.MOSAIC, 0);
|
u16 mosaic_control = T1ReadWord((u8 *)&gpu->dispx_st->dispx_MISC.MOSAIC, 0);
|
||||||
u16 mosaic_width = (mosaic_control & 0xF);
|
u16 mosaic_width = (mosaic_control & 0xF);
|
||||||
u16 mosaic_height = ((mosaic_control>>4) & 0xF);
|
u16 mosaic_height = ((mosaic_control>>4) & 0xF);
|
||||||
|
@ -2874,7 +2885,7 @@ void GPU_ligne(NDS_Screen * screen, u16 l)
|
||||||
|
|
||||||
if (gpu->core == GPU_MAIN)
|
if (gpu->core == GPU_MAIN)
|
||||||
{
|
{
|
||||||
GPU_ligne_DispCapture(l);
|
GPU_ligne_DispCapture<false>(l);
|
||||||
if (l == 191) { disp_fifo.head = disp_fifo.tail = 0; }
|
if (l == 191) { disp_fifo.head = disp_fifo.tail = 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -931,7 +931,7 @@ void GPU_addBack(GPU *, u8 num);
|
||||||
int GPU_ChangeGraphicsCore(int coreid);
|
int GPU_ChangeGraphicsCore(int coreid);
|
||||||
|
|
||||||
void GPU_set_DISPCAPCNT(u32 val) ;
|
void GPU_set_DISPCAPCNT(u32 val) ;
|
||||||
void GPU_ligne(NDS_Screen * screen, u16 l) ;
|
void GPU_ligne(NDS_Screen * screen, u16 l, bool skip = false) ;
|
||||||
void GPU_setMasterBrightness (GPU *gpu, u16 val);
|
void GPU_setMasterBrightness (GPU *gpu, u16 val);
|
||||||
|
|
||||||
inline void GPU_setWIN0_H(GPU* gpu, u16 val) { gpu->WIN0H0 = val >> 8; gpu->WIN0H1 = val&0xFF; gpu->need_update_winh[0] = true; }
|
inline void GPU_setWIN0_H(GPU* gpu, u16 val) { gpu->WIN0H0 = val >> 8; gpu->WIN0H1 = val&0xFF; gpu->need_update_winh[0] = true; }
|
||||||
|
|
|
@ -1806,11 +1806,8 @@ void execHardware_hblank()
|
||||||
//in practice we need to be more forgiving, in case things have overrun the scanline start.
|
//in practice we need to be more forgiving, in case things have overrun the scanline start.
|
||||||
//this should be safe since games cannot do anything timing dependent until this next
|
//this should be safe since games cannot do anything timing dependent until this next
|
||||||
//scanline begins, anyway (as this scanline was in the middle of drawing)
|
//scanline begins, anyway (as this scanline was in the middle of drawing)
|
||||||
if(!SkipCur2DFrame)
|
GPU_ligne(&MainScreen, nds.VCount, SkipCur2DFrame);
|
||||||
{
|
GPU_ligne(&SubScreen, nds.VCount, SkipCur2DFrame);
|
||||||
GPU_ligne(&MainScreen, nds.VCount);
|
|
||||||
GPU_ligne(&SubScreen, nds.VCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
//trigger hblank dmas
|
//trigger hblank dmas
|
||||||
//but notice, we do that just after we finished drawing the line
|
//but notice, we do that just after we finished drawing the line
|
||||||
|
|
|
@ -940,7 +940,6 @@ DWORD WINAPI run()
|
||||||
|
|
||||||
if(!skipnextframe)
|
if(!skipnextframe)
|
||||||
{
|
{
|
||||||
|
|
||||||
framesskipped = 0;
|
framesskipped = 0;
|
||||||
|
|
||||||
if (framestoskip > 0)
|
if (framestoskip > 0)
|
||||||
|
|
Loading…
Reference in New Issue