From 06d879283040f51e8760f65670f8a305ca3347fb Mon Sep 17 00:00:00 2001 From: beirich Date: Sun, 24 Jul 2011 19:52:20 +0000 Subject: [PATCH] [PCE] fix Youkai Douchuuki, Yo Bro, and Order of the Griffon --- .../Consoles/PC Engine/Compat.txt | 6 +++--- .../Consoles/PC Engine/PCEngine.cs | 7 +++++++ .../Consoles/PC Engine/VDC.Render.cs | 20 +++++++++++-------- BizHawk.Emulation/Consoles/PC Engine/VDC.cs | 18 +++++++++++++---- BizHawk.Emulation/Sound/HuC6280PSG.cs | 2 +- BizHawk.MultiClient/output/gamedb.txt | 12 +++++------ 6 files changed, 43 insertions(+), 22 deletions(-) diff --git a/BizHawk.Emulation/Consoles/PC Engine/Compat.txt b/BizHawk.Emulation/Consoles/PC Engine/Compat.txt index d71eda3328..1440b64b7f 100644 --- a/BizHawk.Emulation/Consoles/PC Engine/Compat.txt +++ b/BizHawk.Emulation/Consoles/PC Engine/Compat.txt @@ -12,8 +12,7 @@ General: MML Demo - Echo channels are too loud (equal volume!) The Lost Sunheart (J) - Uses LFO in intro sound strongly! Eagan's Rendered Sprite Demo - demonstrates sprites that shouldnt be displayed -Yo, Bro - game screen black, can hear game playing though -Youkai Douchuuki(J) - part of bg missing? wtf. Cpu BRK right at beginning... + Games Express CD Card 1993 - dont forget to treat as a turbocd system card @@ -24,7 +23,8 @@ Games that need TV Emulation (to varying degrees) Greater degrees: Final Blaster - Intro does crazy shit with video modes; not sure what if anything to do about it -Griffon - Screen goes black because game changes video mode mid-frame +Griffon - Mid-frame res changes (hax to make playable) +Yo, Bro - Mid-frame res changes (hax to make playable) Lesser degrees: diff --git a/BizHawk.Emulation/Consoles/PC Engine/PCEngine.cs b/BizHawk.Emulation/Consoles/PC Engine/PCEngine.cs index 24e7382a2a..2ef26e9ca4 100644 --- a/BizHawk.Emulation/Consoles/PC Engine/PCEngine.cs +++ b/BizHawk.Emulation/Consoles/PC Engine/PCEngine.cs @@ -139,6 +139,13 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx if (game.GetOptions().ContainsStartsWith("HBlankPeriod")) VDC1.HBlankCycles = int.Parse(game.GetOptions().GetOptionValue("HBlankPeriod")); + // This is also a hack. Proper multi-res/TV emulation will be a native-code core feature. + + if (game.GetOptions().ContainsStartsWith("MultiResHack")) + { + VDC1.MultiResHack = int.Parse(game.GetOptions().GetOptionValue("MultiResHack")); + } + Cpu.ResetPC(); SetupMemoryDomains(); } diff --git a/BizHawk.Emulation/Consoles/PC Engine/VDC.Render.cs b/BizHawk.Emulation/Consoles/PC Engine/VDC.Render.cs index 766d6144f5..d6d28d2ad4 100644 --- a/BizHawk.Emulation/Consoles/PC Engine/VDC.Render.cs +++ b/BizHawk.Emulation/Consoles/PC Engine/VDC.Render.cs @@ -30,6 +30,9 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx public void ExecFrame(bool render) { + if (MultiResHack > 0 && render) + Array.Clear(FrameBuffer, 0, FrameBuffer.Length); + while (true) { int ActiveDisplayStartLine = DisplayStartLine; @@ -115,7 +118,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx if (BackgroundEnabled == false) { for (int i = 0; i < FrameWidth; i++) - FrameBuffer[(ActiveLine * FrameWidth) + i] = vce.Palette[0]; + FrameBuffer[(ActiveLine * FramePitch) + i] = vce.Palette[0]; return; } @@ -141,10 +144,10 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx byte c = PatternBuffer[(tileNo * 64) + (yOfs * 8) + xOfs]; if (c == 0) - FrameBuffer[(ActiveLine * FrameWidth) + x] = vce.Palette[0]; + FrameBuffer[(ActiveLine * FramePitch) + x] = vce.Palette[0]; else { - FrameBuffer[(ActiveLine * FrameWidth) + x] = vce.Palette[paletteBase + c]; + FrameBuffer[(ActiveLine * FramePitch) + x] = vce.Palette[paletteBase + c]; PriorityBuffer[x] = 1; } } @@ -273,7 +276,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx { InterSpritePriorityBuffer[xs] = 1; if (priority || PriorityBuffer[xs] == 0) - FrameBuffer[(ActiveLine * FrameWidth) + xs] = vce.Palette[paletteBase + pixel]; + FrameBuffer[(ActiveLine * FramePitch) + xs] = vce.Palette[paletteBase + pixel]; } } } @@ -290,7 +293,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx { InterSpritePriorityBuffer[xs] = 1; if (priority || PriorityBuffer[xs] == 0) - FrameBuffer[(ActiveLine * FrameWidth) + xs] = vce.Palette[paletteBase + pixel]; + FrameBuffer[(ActiveLine * FramePitch) + xs] = vce.Palette[paletteBase + pixel]; } } @@ -311,7 +314,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx { InterSpritePriorityBuffer[xs] = 1; if (priority || PriorityBuffer[xs] == 0) - FrameBuffer[(ActiveLine * FrameWidth) + xs] = vce.Palette[paletteBase + pixel]; + FrameBuffer[(ActiveLine * FramePitch) + xs] = vce.Palette[paletteBase + pixel]; } } if (width == 32) @@ -327,7 +330,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx { InterSpritePriorityBuffer[xs] = 1; if (priority || PriorityBuffer[xs] == 0) - FrameBuffer[(ActiveLine * FrameWidth) + xs] = vce.Palette[paletteBase + pixel]; + FrameBuffer[(ActiveLine * FramePitch) + xs] = vce.Palette[paletteBase + pixel]; } } } @@ -336,6 +339,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx } } + private int FramePitch = 256; private int FrameWidth = 256; private int FrameHeight = 240; private int[] FrameBuffer = new int[256 * 240]; @@ -347,7 +351,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx public int BufferWidth { - get { return FrameWidth; } + get { return FramePitch; } } public int BufferHeight diff --git a/BizHawk.Emulation/Consoles/PC Engine/VDC.cs b/BizHawk.Emulation/Consoles/PC Engine/VDC.cs index fa72c1c632..3f04023f22 100644 --- a/BizHawk.Emulation/Consoles/PC Engine/VDC.cs +++ b/BizHawk.Emulation/Consoles/PC Engine/VDC.cs @@ -88,6 +88,8 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx private HuC6280 cpu; private VCE vce; + public int MultiResHack = 0; + public VDC(HuC6280 cpu, VCE vce) { this.cpu = cpu; @@ -112,6 +114,9 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx { Registers[RegisterLatch] &= 0xFF00; Registers[RegisterLatch] |= value; + + if (RegisterLatch == BYR) + BackgroundY = Registers[BYR] & 0x1FF; } else if (port == MSB) { @@ -146,15 +151,20 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx break; case HDR: // Horizontal Display Register - update framebuffer size FrameWidth = RequestedFrameWidth; - if (FrameBuffer.Length != FrameWidth * FrameHeight) - FrameBuffer = new int[FrameWidth*FrameHeight]; + if (MultiResHack == 0) + FramePitch = MultiResHack; + if (FrameBuffer.Length != FramePitch * FrameHeight) + FrameBuffer = new int[FramePitch * FrameHeight]; break; case VDW: // Vertical Display Word? - update framebuffer size FrameHeight = RequestedFrameHeight; + FrameWidth = RequestedFrameWidth; if (FrameHeight > 242) FrameHeight = 242; - if (FrameBuffer.Length != FrameWidth * FrameHeight) - FrameBuffer = new int[FrameWidth * FrameHeight]; + if (MultiResHack != 0) + FramePitch = MultiResHack; + if (FrameBuffer.Length != FramePitch * FrameHeight) + FrameBuffer = new int[FramePitch * FrameHeight]; break; case LENR: // Initiate DMA transfer DmaRequested = true; diff --git a/BizHawk.Emulation/Sound/HuC6280PSG.cs b/BizHawk.Emulation/Sound/HuC6280PSG.cs index dbc1b92a31..6b5a37c5d9 100644 --- a/BizHawk.Emulation/Sound/HuC6280PSG.cs +++ b/BizHawk.Emulation/Sound/HuC6280PSG.cs @@ -239,7 +239,7 @@ namespace BizHawk.Emulation.Sound else if (args[0] == "VoiceLatch") VoiceLatch = byte.Parse(args[1]); else if (args[0] == "WaveTableWriteOffset") - WaveTableWriteOffset = byte.Parse(args[1]); + WaveTableWriteOffset = byte.Parse(args[1], NumberStyles.HexNumber); else if (args[0] == "[Channel1]") LoadChannelStateText(reader, 0); else if (args[0] == "[Channel2]") diff --git a/BizHawk.MultiClient/output/gamedb.txt b/BizHawk.MultiClient/output/gamedb.txt index b96e7d7239..6a6e7cde39 100644 --- a/BizHawk.MultiClient/output/gamedb.txt +++ b/BizHawk.MultiClient/output/gamedb.txt @@ -2789,10 +2789,10 @@ D5AC287B583B96F1F5401072CFDB2558 V Operation Wolf (J) [b2] PCE 2527346DB9F02F892FDDD51E00504EC7 V Operation Wolf (J) [b4] PCE 14ADF02DD3AB66F20F7B15C69588B777 Operation Wolf (J) PCE E2785473082EFEF1679B3D302CFAE255 Operation Wolf Sounds PCE -0735C827313F209ABB78397A33378B3B V Order of the Griffon (U) [b1] PCE -1DED54D2A726C2E77C034E87AA41055F Order of the Griffon (U) [h1] PCE -5EFB2D7C8D70792E5726A2FEDA86F64C V Order of the Griffon (U) [h1][b1] PCE -30FA2B6C1083E1B382FCAA2CAC782E08 Order of the Griffon (U) PCE +0735C827313F209ABB78397A33378B3B V Order of the Griffon (U) [b1] PCE MultiResHack=320;HBlankPeriod=101 +1DED54D2A726C2E77C034E87AA41055F Order of the Griffon (U) [h1] PCE MultiResHack=320;HBlankPeriod=101 +5EFB2D7C8D70792E5726A2FEDA86F64C V Order of the Griffon (U) [h1][b1] PCE MultiResHack=320;HBlankPeriod=101 +30FA2B6C1083E1B382FCAA2CAC782E08 Order of the Griffon (U) PCE MultiResHack=320;HBlankPeriod=101 2E3BD6EE158B239FF9A650D434BD92B3 Ordyne (J) PCE 9E50264E0784F71B2E4E66FF8783F7DB Ordyne (U) [h1] PCE D803EB8F622521E515FF1DD715E725C0 Ordyne (U) PCE @@ -3293,8 +3293,8 @@ E413C2A7769831419C4EFC9782DC4F97 World Sports Competition (U) PCE BRAM 62FFD154CEE0FEAC076541D7E819DF79 Xevious - Fardraut Densetsu (J) [t1] PCE 4EC600E148CA399C1C1F215949430129 Xevious - Fardraut Densetsu (J) PCE 1BA706CE54EF4694237AD51D66F00D22 Xevious - Fardraut Densetsu Sounds PCE -788069154F3DB58DD9A2A3246DC9FFEF Yo, Bro (U) [h1] PCE BRAM -8AAAD7004680EBEDE55B2C39AF87BB3B Yo, Bro (U) PCE BRAM +788069154F3DB58DD9A2A3246DC9FFEF Yo, Bro (U) [h1] PCE BRAM;MultiResHack=368 +8AAAD7004680EBEDE55B2C39AF87BB3B Yo, Bro (U) PCE BRAM;MultiResHack=368 CD2C47EAEB842CBCFE2EBCBE5710BF61 Youkai Douchuuki (J) [h1] PCE 46E8CA81EC6A426AE9E5B3372D4F2C29 Youkai Douchuuki (J) PCE 9E5E1E2CCCD56C28A849DC8036530996 Youkai Douchuuki Sounds PCE