From 575c44f470ee9d43df2e7a10068e605964ef659e Mon Sep 17 00:00:00 2001 From: taotao54321 Date: Sun, 11 Mar 2012 09:51:23 +0000 Subject: [PATCH] Now setrenderplanes() works also for SuperGrafx. --- .../Consoles/PC Engine/PCEngine.cs | 2 +- .../Consoles/PC Engine/VDC.Render.cs | 4 +-- BizHawk.Emulation/Consoles/PC Engine/VPC.cs | 36 ++++++++++--------- BizHawk.Emulation/Interfaces/CoreComms.cs | 2 +- BizHawk.MultiClient/Config.cs | 6 ++-- BizHawk.MultiClient/LuaImplementation.cs | 9 +++-- BizHawk.MultiClient/MainForm.cs | 6 ++-- 7 files changed, 38 insertions(+), 27 deletions(-) diff --git a/BizHawk.Emulation/Consoles/PC Engine/PCEngine.cs b/BizHawk.Emulation/Consoles/PC Engine/PCEngine.cs index 8e82a1981d..826e0f798d 100644 --- a/BizHawk.Emulation/Consoles/PC Engine/PCEngine.cs +++ b/BizHawk.Emulation/Consoles/PC Engine/PCEngine.cs @@ -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; diff --git a/BizHawk.Emulation/Consoles/PC Engine/VDC.Render.cs b/BizHawk.Emulation/Consoles/PC Engine/VDC.Render.cs index 3b8c4d7d8c..3c87f3ff13 100644 --- a/BizHawk.Emulation/Consoles/PC Engine/VDC.Render.cs +++ b/BizHawk.Emulation/Consoles/PC Engine/VDC.Render.cs @@ -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) diff --git a/BizHawk.Emulation/Consoles/PC Engine/VPC.cs b/BizHawk.Emulation/Consoles/PC Engine/VPC.cs index b0649eb29b..274196da72 100644 --- a/BizHawk.Emulation/Consoles/PC Engine/VPC.cs +++ b/BizHawk.Emulation/Consoles/PC Engine/VPC.cs @@ -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]; } } } -} \ No newline at end of file +} diff --git a/BizHawk.Emulation/Interfaces/CoreComms.cs b/BizHawk.Emulation/Interfaces/CoreComms.cs index 3cf121c1e8..bb563c4948 100644 --- a/BizHawk.Emulation/Interfaces/CoreComms.cs +++ b/BizHawk.Emulation/Interfaces/CoreComms.cs @@ -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 diff --git a/BizHawk.MultiClient/Config.cs b/BizHawk.MultiClient/Config.cs index 1b42e76f8e..6eb1d61000 100644 --- a/BizHawk.MultiClient/Config.cs +++ b/BizHawk.MultiClient/Config.cs @@ -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; diff --git a/BizHawk.MultiClient/LuaImplementation.cs b/BizHawk.MultiClient/LuaImplementation.cs index bcb877087e..cddaccfeca 100644 --- a/BizHawk.MultiClient/LuaImplementation.cs +++ b/BizHawk.MultiClient/LuaImplementation.cs @@ -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]; + } } } diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 067b57627b..13bb518e8f 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -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()