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) else if (SuperGrafx)
{ {
VDC2 = new VDC(this, Cpu, VCE); 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]; Ram = new byte[0x8000];
Cpu.ReadMemory21 = ReadMemorySGX; Cpu.ReadMemory21 = ReadMemorySGX;
Cpu.WriteMemory21 = WriteMemorySGX; Cpu.WriteMemory21 = WriteMemorySGX;

View File

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

View File

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

View File

@ -5,7 +5,7 @@
public int NES_BackdropColor; public int NES_BackdropColor;
public bool NES_UnlimitedSprites; public bool NES_UnlimitedSprites;
public bool NES_ShowBG, NES_ShowOBJ; 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 public class CoreOutputComm

View File

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

View File

@ -403,8 +403,13 @@ namespace BizHawk.MultiClient
} }
else if(Global.Emulator is BizHawk.Emulation.Consoles.TurboGrafx.PCEngine) else if(Global.Emulator is BizHawk.Emulation.Consoles.TurboGrafx.PCEngine)
{ {
Global.CoreInputComm.PCE_ShowOBJ = Global.Config.PCEDispSprites = (bool)lua_p[0]; Global.CoreInputComm.PCE_ShowOBJ1 = Global.Config.PCEDispOBJ1 = (bool)lua_p[0];
Global.CoreInputComm.PCE_ShowBG = Global.Config.PCEDispBackground = (bool)lua_p[1]; 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_UnlimitedSprites = Global.Config.NESAllowMoreThanEightSprites;
Global.CoreInputComm.NES_ShowBG = Global.Config.NESDispBackground; Global.CoreInputComm.NES_ShowBG = Global.Config.NESDispBackground;
Global.CoreInputComm.NES_ShowOBJ = Global.Config.NESDispSprites; Global.CoreInputComm.NES_ShowOBJ = Global.Config.NESDispSprites;
Global.CoreInputComm.PCE_ShowBG = Global.Config.PCEDispBackground; Global.CoreInputComm.PCE_ShowBG1 = Global.Config.PCEDispBG1;
Global.CoreInputComm.PCE_ShowOBJ = Global.Config.PCEDispSprites; Global.CoreInputComm.PCE_ShowOBJ1 = Global.Config.PCEDispOBJ1;
Global.CoreInputComm.PCE_ShowBG2 = Global.Config.PCEDispBG2;
Global.CoreInputComm.PCE_ShowOBJ2 = Global.Config.PCEDispOBJ2;
} }
void SyncPresentationMode() void SyncPresentationMode()