mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 05:17:40 -07:00
ok this one actually works
This commit is contained in:
parent
2bf033e0bc
commit
0d6a8e0fb9
@ -129,27 +129,36 @@ bool SoftRenderer::DoTimings(s32 cycles, bool odd)
|
||||
return true;
|
||||
}
|
||||
|
||||
s32 SoftRenderer::DoTimingsPixels(u32 pixels, bool odd)
|
||||
u32 SoftRenderer::DoTimingsPixels(u32 pixels, bool odd)
|
||||
{
|
||||
// return the difference between the old span and the new span
|
||||
if (pixels <= 4) return 0;
|
||||
|
||||
u32 pixeltiming = (pixels - 4) * RasterFrac;
|
||||
u32 pixelsremain = pixels-4;
|
||||
u32 timinglimit = RasterTimingCap - RasterTimingCounterPrev;
|
||||
|
||||
//todo: do this without a for loop somehow.
|
||||
if (odd)
|
||||
{
|
||||
u32 rasterend = RasterTimingCap - (RasterTimingCounterOdd + RasterTimingCounterPrev);
|
||||
pixeltiming = rasterend - pixeltiming;
|
||||
for (; pixelsremain > 0; pixelsremain--)
|
||||
{
|
||||
RasterTimingCounterOdd += RasterFrac;
|
||||
if (RasterTimingCounterOdd >= timinglimit) break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
u32 rasterend = RasterTimingCap - (RasterTimingCounterEven + RasterTimingCounterPrev);
|
||||
pixeltiming = rasterend - pixeltiming;
|
||||
for (; pixelsremain > 0; pixelsremain--)
|
||||
{
|
||||
RasterTimingCounterEven += RasterFrac;
|
||||
if (RasterTimingCounterEven >= timinglimit) break;
|
||||
}
|
||||
}
|
||||
if (pixeltiming > 0) return 0;
|
||||
|
||||
if (pixelsremain <= 0) return 0;
|
||||
|
||||
GPU.GPU3D.DispCnt |= (1<<12);
|
||||
return pixels - (((pixeltiming + (RasterFrac-1)) / RasterFrac) + 4);
|
||||
return pixelsremain;
|
||||
}
|
||||
|
||||
void SoftRenderer::EndScanline(bool odd)
|
||||
|
@ -455,7 +455,7 @@ private:
|
||||
melonDS::GPU& GPU;
|
||||
RendererPolygon PolygonList[2048];
|
||||
bool DoTimings(s32 cycles, bool odd);
|
||||
s32 DoTimingsPixels(u32 pixels, bool odd);
|
||||
u32 DoTimingsPixels(u32 pixels, bool odd);
|
||||
void EndScanline(bool odd);
|
||||
void TextureLookup(u32 texparam, u32 texpal, s16 s, s16 t, u16* color, u8* alpha);
|
||||
u32 RenderPixel(Polygon* polygon, u8 vr, u8 vg, u8 vb, s16 s, s16 t);
|
||||
|
Loading…
Reference in New Issue
Block a user