diff --git a/BizHawk.Emulation/Consoles/PC Engine/ArcadeCard.cs b/BizHawk.Emulation/Consoles/PC Engine/ArcadeCard.cs index baa876c2e2..f67eca550b 100644 --- a/BizHawk.Emulation/Consoles/PC Engine/ArcadeCard.cs +++ b/BizHawk.Emulation/Consoles/PC Engine/ArcadeCard.cs @@ -49,6 +49,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx void WriteArcadeCard(int addr, byte value) { + if (ArcadeCard == false) return; var page = ArcadePage[(addr >> 4) & 3]; switch (addr & 0x0F) { @@ -110,6 +111,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx byte ReadArcadeCard(int addr) { + if (ArcadeCard == false) return 0xFF; var page = ArcadePage[(addr >> 4) & 3]; switch (addr & 0x0F) { diff --git a/BizHawk.Emulation/Consoles/PC Engine/Compat.txt b/BizHawk.Emulation/Consoles/PC Engine/Compat.txt index 8739b24f26..27ac6ca117 100644 --- a/BizHawk.Emulation/Consoles/PC Engine/Compat.txt +++ b/BizHawk.Emulation/Consoles/PC Engine/Compat.txt @@ -21,18 +21,11 @@ Still some lesser issues with cancelling a fadeout. Otherwise CDDA is working no Arcade Card games: - JANSHIN DENSETSU sets the T flag prior to an LDA instruction; MANY TIMES (ie it doesnt seem to be an accident). Unclear if T flag actually affects LDA instruction. -- Madou Monogatari - Dies requesting more tracks than exist - Ryuuko no Ken is all messed up, and I don't super care :| -- Tengai Makyo eventually died requesting 0 sectors read - -- Rayxanber 2 weird issues at the end of first level with cd audio player - Record of Lodoss War wont start game from title screen -- Snatcher dies at startup while polling subcode, demonstrating the incorrectness of subcode polling code.. yeah that hangs together - Valis: Screen is black during entire intro section -- Valis III: Dies with 'request more tracks than exist' - -card angels does poll subcode... +- Valis III: playable,gfx issue on title screen... possible due to not updating VDC regs on LSB? really should just fix that once at for all... ======= TurboGrafx compatibility issues ======= @@ -42,6 +35,11 @@ General: Most emulators simply crop the screen at a certain vertical range. For now, I have chosen not to do this. Right now the emulator is simply displaying a framebuffer. Eventually, we will do an update that emulates NTSC. But for now we're letting this be. There's no intermediate step between emulating a framebuffer and emulating a TV. ++ Adding to this, there are only a handful of Hucards that do crazy thing with screen resolution, and our framebuffer + approach mostly seems reasonable. On TurboCD the situation changes somewhat, while the normal "gameplay" screens + are pretty standard, the various intro screens tend to do much more crazy stuff with the 'active display region' + much more frequently than was done on Hucards, and our framebuffer/active display strategy starts to look more silly. + Oh well, though. Changing this is a Native Version Core feature, not a C# Core feature. Eagan's Rendered Sprite Demo - demonstrates sprites that shouldnt be displayed (so does Turbo Engine!) diff --git a/BizHawk.Emulation/Consoles/PC Engine/ScsiCDBus.cs b/BizHawk.Emulation/Consoles/PC Engine/ScsiCDBus.cs index d889bc6e10..b44306aace 100644 --- a/BizHawk.Emulation/Consoles/PC Engine/ScsiCDBus.cs +++ b/BizHawk.Emulation/Consoles/PC Engine/ScsiCDBus.cs @@ -385,14 +385,14 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx sector |= CommandBuffer[2] << 8; sector |= CommandBuffer[3]; -if (CommandBuffer[4] == 0) -throw new Exception("requesting 0 sectors read............................."); - DataReadInProgress = true; DataTransferInProgress = true; CurrentReadingSector = sector; SectorsLeftToRead = CommandBuffer[4]; + if (CommandBuffer[4] == 0) + SectorsLeftToRead = 256; + Console.WriteLine("STARTED READ: {0} SECTORS FROM {1}",SectorsLeftToRead, CurrentReadingSector); DataReadWaitTimer = pce.Cpu.TotalExecutedCycles + 5000; // figure out proper read delay later pce.CDAudio.Stop(); @@ -421,6 +421,7 @@ throw new Exception("requesting 0 sectors read............................."); if (CommandBuffer[1] == 0) { + pce.CDAudio.PlayStartingAtLba(audioStartLBA); pce.CDAudio.Pause(); } else { pce.CDAudio.PlayStartingAtLba(audioStartLBA); @@ -464,8 +465,7 @@ throw new Exception("requesting 0 sectors read............................."); pce.CDAudio.EndLBA = audioEndLBA; pce.CDAudio.PlayMode = CDAudio.PlaybackMode.LoopOnCompletion; break; - case 2: // Play audio, fire IRQ2 when end position reached - Console.WriteLine("***********STOP MODE 2 ENGAGED. IT IS CONCEIVABLE THAT IRQ WILL FIRE."); + case 2: // Play audio, fire IRQ2 when end position reached, maybe pce.CDAudio.PlayStartingAtLba(audioStartLBA); pce.CDAudio.EndLBA = audioEndLBA; pce.CDAudio.PlayMode = CDAudio.PlaybackMode.CallbackOnCompletion; @@ -487,11 +487,8 @@ throw new Exception("requesting 0 sectors read............................."); void CommandReadSubcodeQ() { - Console.WriteLine("poll subcode"); - // TODO we are lacking some various things here. But we know when it gets used and it doesnt - // seem to be used that often. - - var sectorEntry = disc.ReadLBA_SectorEntry(pce.CDAudio.CurrentSector); + bool playing = pce.CDAudio.Mode != CDAudio.CDAudioMode.Stopped; + var sectorEntry = disc.ReadLBA_SectorEntry(playing ? pce.CDAudio.CurrentSector : CurrentReadingSector); DataIn.Clear(); @@ -511,6 +508,7 @@ throw new Exception("requesting 0 sectors read............................."); DataIn.Enqueue(sectorEntry.q_amin.BCDValue); // M(abs) DataIn.Enqueue(sectorEntry.q_asec.BCDValue); // S(abs) DataIn.Enqueue(sectorEntry.q_aframe.BCDValue); // F(abs) + SetPhase(BusPhase.DataIn); } @@ -543,14 +541,20 @@ throw new Exception("requesting 0 sectors read............................."); case 2: // Return starting position of specified track in MSF format { int track = CommandBuffer[2].BCDtoBin(); + var tracks = disc.TOC.Sessions[0].Tracks; if (CommandBuffer[2] > 0x99) throw new Exception("invalid track number BCD request... is something I need to handle?"); if (track == 0) track = 1; track--; - if (track > disc.TOC.Sessions[0].Tracks.Count) - throw new Exception("Request more tracks than exist.... need to do error handling"); - int lbaPos = disc.TOC.Sessions[0].Tracks[track].Indexes[1].aba - 150; + + int lbaPos; + + if (track > tracks.Count) + lbaPos = disc.TOC.Sessions[0].length_aba - 150; + else + lbaPos = tracks[track].Indexes[1].aba - 150; + byte m, s, f; Disc.ConvertLBAtoMSF(lbaPos, out m, out s, out f); @@ -558,7 +562,8 @@ throw new Exception("requesting 0 sectors read............................."); DataIn.Enqueue(m.BinToBCD()); DataIn.Enqueue(s.BinToBCD()); DataIn.Enqueue(f.BinToBCD()); - if (disc.TOC.Sessions[0].Tracks[track].TrackType == ETrackType.Audio) + + if (track > tracks.Count || disc.TOC.Sessions[0].Tracks[track].TrackType == ETrackType.Audio) DataIn.Enqueue(0); else DataIn.Enqueue(4); @@ -831,6 +836,5 @@ throw new Exception("requesting 0 sectors read............................."); Console.WriteLine("Skipping unrecognized identifier " + args[0]); } } - } } \ No newline at end of file diff --git a/BizHawk.Emulation/Sound/CDAudio.cs b/BizHawk.Emulation/Sound/CDAudio.cs index 7bcd936f6d..6d440ec039 100644 --- a/BizHawk.Emulation/Sound/CDAudio.cs +++ b/BizHawk.Emulation/Sound/CDAudio.cs @@ -70,7 +70,7 @@ namespace BizHawk.Emulation.Sound public void PlayStartingAtLba(int lba) { var point = Disc.TOC.SeekPoint(lba); - if (point == null) return; + if (point == null || point.Track == null) return; PlayingTrack = point.TrackNum; StartLBA = lba; diff --git a/BizHawk.MultiClient/output/gamedb_pce_cd.txt b/BizHawk.MultiClient/output/gamedb_pce_cd.txt index 7c8df319ff..dcef93c390 100644 --- a/BizHawk.MultiClient/output/gamedb_pce_cd.txt +++ b/BizHawk.MultiClient/output/gamedb_pce_cd.txt @@ -86,7 +86,8 @@ A52AB896E603673E6EA30C1769449DF4 Mystic Formula PCE NeedSuperSysCard C80A4ACE402AB5D7D72D2CA643A108A6 Prince of Persia (U) PCE NeedSuperSysCard;HBlankPeriod=89 F338D84D2B3E77DD81D611964C0D460F Psychic Storm PCE NeedSuperSysCard;EqualizeVolumes B16C8BC632CBDEC676B9874E39975DDD Puyo Puyo CD PCE NeedSuperSysCard -9398887DB9C2771F1FBB3D4FEF561A14 Rayxanber II PCE +1CB8337E94FFECDCD580A5610E1D5C8F Rayxanber II PCE +9398887DB9C2771F1FBB3D4FEF561A14 V Rayxanber II (bad dump) PCE 7FEC58BDB95CBF1F3AE553933DB5F60B Rayxanber III PCE NeedSuperSysCard 8EE01CE7C09A7F222180E9A550621EC5 Ryuuko no Ken PCE NeedSuperSysCard;ArcadeCard CBA55D463FECF2955736AA2EA5D6BD74 Lodoss Tousenki - Record of Lodoss War PCE