Now setrenderplanes() works also for SuperGrafx.

This commit is contained in:
taotao54321 2012-03-11 09:51:23 +00:00
parent f25ddb2fce
commit 575c44f470
7 changed files with 38 additions and 27 deletions

View File

@ -101,7 +101,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
else if (SuperGrafx)
{
VDC2 = new VDC(this, Cpu, VCE);
VPC = new VPC(VDC1, VDC2, VCE, Cpu);
VPC = new VPC(this, VDC1, VDC2, VCE, Cpu);
Ram = new byte[0x8000];
Cpu.ReadMemory21 = ReadMemorySGX;
Cpu.WriteMemory21 = WriteMemorySGX;

View File

@ -108,8 +108,8 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
if (ActiveLine >= FrameHeight)
return;
RenderBackgroundScanline(pce.CoreInputComm.PCE_ShowBG);
RenderSpritesScanline(pce.CoreInputComm.PCE_ShowOBJ);
RenderBackgroundScanline(pce.CoreInputComm.PCE_ShowBG1);
RenderSpritesScanline(pce.CoreInputComm.PCE_ShowOBJ1);
}
void RenderBackgroundScanline(bool show)

View File

@ -12,6 +12,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
public sealed class VPC : IVideoProvider
{
PCEngine PCE;
public VDC VDC1;
public VDC VDC2;
public VCE VCE;
@ -26,8 +27,9 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
public int PriorityModeSlot2 { get { return Registers[1] & 0x0F; } }
public int PriorityModeSlot3 { get { return (Registers[1] >> 4) & 0x0F; } }
public VPC(VDC vdc1, VDC vdc2, VCE vce, HuC6280 cpu)
public VPC(PCEngine pce, VDC vdc1, VDC vdc2, VCE vce, HuC6280 cpu)
{
PCE = pce;
VDC1 = vdc1;
VDC2 = vdc2;
VCE = vce;
@ -265,16 +267,16 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
switch (EffectivePriorityMode)
{
case 0:
RenderBackgroundScanline(VDC1, 12);
RenderBackgroundScanline(VDC2, 2);
RenderSpritesScanline(VDC1, 11, 14);
RenderSpritesScanline(VDC2, 1, 3);
RenderBackgroundScanline(VDC1, 12, PCE.CoreInputComm.PCE_ShowBG1);
RenderBackgroundScanline(VDC2, 2, PCE.CoreInputComm.PCE_ShowBG2);
RenderSpritesScanline(VDC1, 11, 14, PCE.CoreInputComm.PCE_ShowOBJ1);
RenderSpritesScanline(VDC2, 1, 3, PCE.CoreInputComm.PCE_ShowOBJ2);
break;
case 1:
RenderBackgroundScanline(VDC1, 12);
RenderBackgroundScanline(VDC2, 2);
RenderSpritesScanline(VDC1, 11, 14);
RenderSpritesScanline(VDC2, 1, 13);
RenderBackgroundScanline(VDC1, 12, PCE.CoreInputComm.PCE_ShowBG1);
RenderBackgroundScanline(VDC2, 2, PCE.CoreInputComm.PCE_ShowBG2);
RenderSpritesScanline(VDC1, 11, 14, PCE.CoreInputComm.PCE_ShowOBJ1);
RenderSpritesScanline(VDC2, 1, 13, PCE.CoreInputComm.PCE_ShowOBJ2);
break;
}
}
@ -289,7 +291,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
FrameBuffer[(scanline * FrameWidth) + i] = VCE.Palette[0];
}
void RenderBackgroundScanline(VDC vdc, byte priority)
void RenderBackgroundScanline(VDC vdc, byte priority, bool show)
{
if (vdc.BackgroundEnabled == false)
return;
@ -312,7 +314,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
byte c = vdc.PatternBuffer[(tileNo * 64) + (yOfs * 8) + xOfs];
if (c != 0)
{
FrameBuffer[(vdc.ActiveLine * FrameWidth) + x] = VCE.Palette[paletteBase + c];
FrameBuffer[(vdc.ActiveLine * FrameWidth) + x] = show ? VCE.Palette[paletteBase + c] : VCE.Palette[0];
PriorityBuffer[x] = priority;
}
}
@ -320,7 +322,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
static byte[] heightTable = { 16, 32, 64, 64 };
void RenderSpritesScanline(VDC vdc, byte lowPriority, byte highPriority)
void RenderSpritesScanline(VDC vdc, byte lowPriority, byte highPriority, bool show)
{
if (vdc.SpritesEnabled == false)
return;
@ -426,7 +428,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
byte myPriority = priority ? highPriority : lowPriority;
if (PriorityBuffer[xs] < myPriority)
{
FrameBuffer[(vdc.ActiveLine * FrameWidth) + xs] = VCE.Palette[paletteBase + pixel];
if (show) FrameBuffer[(vdc.ActiveLine * FrameWidth) + xs] = VCE.Palette[paletteBase + pixel];
PriorityBuffer[xs] = myPriority;
}
}
@ -445,7 +447,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
byte myPriority = priority ? highPriority : lowPriority;
if (PriorityBuffer[xs] < myPriority)
{
FrameBuffer[(vdc.ActiveLine * FrameWidth) + xs] = VCE.Palette[paletteBase + pixel];
if (show) FrameBuffer[(vdc.ActiveLine * FrameWidth) + xs] = VCE.Palette[paletteBase + pixel];
PriorityBuffer[xs] = myPriority;
}
}
@ -467,7 +469,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
byte myPriority = priority ? highPriority : lowPriority;
if (PriorityBuffer[xs] < myPriority)
{
FrameBuffer[(vdc.ActiveLine * FrameWidth) + xs] = VCE.Palette[paletteBase + pixel];
if (show) FrameBuffer[(vdc.ActiveLine * FrameWidth) + xs] = VCE.Palette[paletteBase + pixel];
PriorityBuffer[xs] = myPriority;
}
}
@ -485,7 +487,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
byte myPriority = priority ? highPriority : lowPriority;
if (PriorityBuffer[xs] < myPriority)
{
FrameBuffer[(vdc.ActiveLine * FrameWidth) + xs] = VCE.Palette[paletteBase + pixel];
if (show) FrameBuffer[(vdc.ActiveLine * FrameWidth) + xs] = VCE.Palette[paletteBase + pixel];
PriorityBuffer[xs] = myPriority;
}
}
@ -516,4 +518,4 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
get { return VCE.Palette[0]; }
}
}
}
}

View File

@ -5,7 +5,7 @@
public int NES_BackdropColor;
public bool NES_UnlimitedSprites;
public bool NES_ShowBG, NES_ShowOBJ;
public bool PCE_ShowBG, PCE_ShowOBJ;
public bool PCE_ShowBG1, PCE_ShowOBJ1, PCE_ShowBG2, PCE_ShowOBJ2;
}
public class CoreOutputComm

View File

@ -296,8 +296,10 @@
public int NESTopLine = 8;
public int NESBottomLine = 231;
public bool PCEDispBackground = true;
public bool PCEDispSprites = true;
public bool PCEDispBG1 = true;
public bool PCEDispOBJ1= true;
public bool PCEDispBG2 = true;
public bool PCEDispOBJ2= true;
//GB Debugger settings
public bool AutoloadGBDebugger = false;

View File

@ -403,8 +403,13 @@ namespace BizHawk.MultiClient
}
else if(Global.Emulator is BizHawk.Emulation.Consoles.TurboGrafx.PCEngine)
{
Global.CoreInputComm.PCE_ShowOBJ = Global.Config.PCEDispSprites = (bool)lua_p[0];
Global.CoreInputComm.PCE_ShowBG = Global.Config.PCEDispBackground = (bool)lua_p[1];
Global.CoreInputComm.PCE_ShowOBJ1 = Global.Config.PCEDispOBJ1 = (bool)lua_p[0];
Global.CoreInputComm.PCE_ShowBG1 = Global.Config.PCEDispBG1 = (bool)lua_p[1];
if (lua_p.Length > 2)
{
Global.CoreInputComm.PCE_ShowOBJ2 = Global.Config.PCEDispOBJ2 = (bool)lua_p[2];
Global.CoreInputComm.PCE_ShowBG2 = Global.Config.PCEDispBG2 = (bool)lua_p[3];
}
}
}

View File

@ -252,8 +252,10 @@ namespace BizHawk.MultiClient
Global.CoreInputComm.NES_UnlimitedSprites = Global.Config.NESAllowMoreThanEightSprites;
Global.CoreInputComm.NES_ShowBG = Global.Config.NESDispBackground;
Global.CoreInputComm.NES_ShowOBJ = Global.Config.NESDispSprites;
Global.CoreInputComm.PCE_ShowBG = Global.Config.PCEDispBackground;
Global.CoreInputComm.PCE_ShowOBJ = Global.Config.PCEDispSprites;
Global.CoreInputComm.PCE_ShowBG1 = Global.Config.PCEDispBG1;
Global.CoreInputComm.PCE_ShowOBJ1 = Global.Config.PCEDispOBJ1;
Global.CoreInputComm.PCE_ShowBG2 = Global.Config.PCEDispBG2;
Global.CoreInputComm.PCE_ShowOBJ2 = Global.Config.PCEDispOBJ2;
}
void SyncPresentationMode()