-Added a very basic fix to the graphics scaling issue per adelikat's advice.
--Gets worse as the scale increases. --For x3, the box doesn't increase size, but the box still changes position. I think there might be a difference between the TargetZoomFactor and the actual screen size, so perhaps we should tie this to something else. -Working on very small optimizations to the NES PPU with CorruptedSyntax...this is more fun, so we'll do this first. --Eliminated an entire loop. --Branched to two loops instead of branching for every iteration in one loop. --Got rid of some redundant instructions using temporary variables. --This may be completely premature, but I seem to have gained a few FPS from doing this. For me, I get 38-39 FPS where I'd previously get 33-34.
This commit is contained in:
parent
5fa0a681e1
commit
05157997f1
|
@ -167,17 +167,14 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
|
||||
oamcount = oamcounts[renderslot];
|
||||
|
||||
//the main scanline rendering loop:
|
||||
//32 times, we will fetch a tile and then render 8 pixels.
|
||||
//two of those tiles were read in the last scanline.
|
||||
for (int xt = 0; xt < 32; xt++)
|
||||
{
|
||||
//ok, we're also going to draw here.
|
||||
//unless we're on the first dummy scanline
|
||||
if (sl != 0)
|
||||
//ok, we're also going to draw here.
|
||||
//unless we're on the first dummy scanline
|
||||
if (sl != 0)
|
||||
//the main scanline rendering loop:
|
||||
//32 times, we will fetch a tile and then render 8 pixels.
|
||||
//two of those tiles were read in the last scanline.
|
||||
for (int xt = 0; xt < 32; xt++)
|
||||
{
|
||||
|
||||
|
||||
int xstart = xt << 3;
|
||||
oamcount = oamcounts[renderslot];
|
||||
int target = (yp << 8) + xstart;
|
||||
|
@ -267,7 +264,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
{
|
||||
Reg2002_objhit = true;
|
||||
}
|
||||
|
||||
bool drawsprite = true;
|
||||
//priority handling
|
||||
if ((oam->oam[2] & 0x20) != 0)
|
||||
|
@ -278,7 +274,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
drawsprite = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (drawsprite && nes.CoreInputComm.NES_ShowOBJ)
|
||||
{
|
||||
//bring in the palette bits and palettize
|
||||
|
@ -287,13 +282,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
pixelcolor = PALRAM[0x10 + spixel];
|
||||
}
|
||||
} //rasterpos in sprite range
|
||||
|
||||
} //c# fixed oam ptr
|
||||
|
||||
|
||||
}//oamcount loop
|
||||
|
||||
|
||||
if (reg_2001.color_disable)
|
||||
pixelcolor &= 0x30;
|
||||
|
||||
|
@ -302,24 +292,21 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
target++;
|
||||
|
||||
} //loop across 8 pixels
|
||||
} //scanline != 0
|
||||
else
|
||||
{
|
||||
} //loop across 32 tiles
|
||||
else
|
||||
for (int xt = 0; xt < 32; xt++)
|
||||
Read_bgdata(ref bgdata[xt + 2]);
|
||||
}
|
||||
} //loop across 32 tiles
|
||||
|
||||
|
||||
//look for sprites (was supposed to run concurrent with bg rendering)
|
||||
oamcounts[scanslot] = 0;
|
||||
oamcount = 0;
|
||||
int spriteHeight = reg_2000.obj_size_16 ? 16 : 8;
|
||||
|
||||
for (int i = 0; i < 64; i++)
|
||||
oams[(scanslot<<6)+i].present = 0;
|
||||
int scanslot_lshift = scanslot << 6;
|
||||
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
oams[scanslot_lshift + i].present = 0;
|
||||
int spr = i * 4;
|
||||
{
|
||||
if (yp >= OAM[spr] && yp < OAM[spr] + spriteHeight)
|
||||
|
@ -335,18 +322,16 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//just copy some bytes into the internal sprite buffer
|
||||
TempOAM* oam = &oams[(scanslot << 6) + oamcount];
|
||||
TempOAM* oam = &oams[scanslot_lshift + oamcount];
|
||||
{
|
||||
for (int j = 0; j < 4; j++)
|
||||
oam->oam[j] = OAM[spr + j];
|
||||
oam->present = 1;
|
||||
}
|
||||
|
||||
//note that we stuff the oam index into [6].
|
||||
//i need to turn this into a struct so we can have fewer magic numbers
|
||||
oams[(scanslot<<6)+oamcount].index = (byte)i;
|
||||
oams[scanslot_lshift + oamcount].index = (byte)i;
|
||||
oamcount++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -508,12 +508,13 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
try
|
||||
{
|
||||
g.DrawRectangle(GetPen(line), LuaInt(X), LuaInt(Y), LuaInt(width), LuaInt(height));
|
||||
int int_x = LuaInt(X) * Global.Config.TargetZoomFactor;
|
||||
int int_y = LuaInt(Y) * Global.Config.TargetZoomFactor;
|
||||
int int_width = LuaInt(width) * Global.Config.TargetZoomFactor;
|
||||
int int_height = LuaInt(height) * Global.Config.TargetZoomFactor;
|
||||
g.DrawRectangle(GetPen(line), int_x, int_y, int_width, int_height);
|
||||
if (background != null)
|
||||
{
|
||||
g.FillRectangle(GetBrush(background), LuaInt(X), LuaInt(Y), LuaInt(width), LuaInt(height));
|
||||
}
|
||||
|
||||
g.FillRectangle(GetBrush(background), int_x, int_y, int_width, int_height);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue