From abaa52d6e4d0f52eb493770921887680cd2be6d9 Mon Sep 17 00:00:00 2001 From: zeromus Date: Wed, 10 Dec 2014 23:48:47 +0000 Subject: [PATCH] psc - disc led --- .../Consoles/Sony/PSX/Octoshock.cs | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs b/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs index 6eeb983f3a..244c57acfd 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs @@ -81,16 +81,18 @@ namespace BizHawk.Emulation.Cores.Sony.PSX class DiscInterface : IDisposable { - public DiscInterface(DiscSystem.Disc disc) + public DiscInterface(DiscSystem.Disc disc, Action cbActivity) { this.Disc = disc; cbReadTOC = ShockDisc_ReadTOC; cbReadLBA = ShockDisc_ReadLBA2448; + this.cbActivity = cbActivity; OctoshockDll.shock_CreateDisc(out OctoshockHandle, IntPtr.Zero, disc.LBACount, cbReadTOC, cbReadLBA, true); } OctoshockDll.ShockDisc_ReadTOC cbReadTOC; OctoshockDll.ShockDisc_ReadLBA cbReadLBA; + Action cbActivity; public DiscSystem.Disc Disc; public IntPtr OctoshockHandle; @@ -139,6 +141,8 @@ namespace BizHawk.Emulation.Cores.Sony.PSX int ShockDisc_ReadLBA2448(IntPtr opaque, int lba, void* dst) { + cbActivity(); + //lets you check subcode generation by logging it and checking against the CCD subcode bool subcodeLog = false; bool readLog = false; @@ -157,12 +161,12 @@ namespace BizHawk.Emulation.Cores.Sony.PSX Console.Write("{0:X2}", *((byte*)dst + 2352 + i)); Console.WriteLine(); } - return OctoshockDll.SHOCK_OK; } } + //note: its annoying that we have to have a disc before constructing this. //might want to change that later. HOWEVER - we need to definitely have a region, at least public Octoshock(CoreComm comm, DiscSystem.Disc disc) @@ -171,10 +175,18 @@ namespace BizHawk.Emulation.Cores.Sony.PSX var domains = new List(); CoreComm = comm; + CoreComm.UsesDriveLed = true; + Attach(); this.disc = disc; - discInterface = new DiscInterface(disc); + discInterface = new DiscInterface(disc, + () => + { + //if current disc this delegate disc, activity is happening + if (disc == this.disc) + CoreComm.DriveLED = true; + }); //determine region of the provided disc OctoshockDll.ShockDiscInfo discInfo; @@ -226,13 +238,6 @@ namespace BizHawk.Emulation.Cores.Sony.PSX //the psx instance cant be created until the desired region is known, which needs a disc, so we need the dll static attached first } - //public void LoadCuePath(string path) - //{ - // Attach(); - // DiscSystem.Disc.FromCCDPath - //} - - static Octoshock() { } @@ -279,6 +284,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX public void FrameAdvance(bool render, bool rendersound) { Frame++; + CoreComm.DriveLED = false; SetInput();