diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/LibmGBA.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/LibmGBA.cs index 15ffeccd58..62da32fbfd 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/LibmGBA.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/LibmGBA.cs @@ -25,7 +25,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA public static extern bool BizLoad(IntPtr ctx, byte[] data, int length); [DllImport(dll, CallingConvention = cc)] - public static extern void BizAdvance(IntPtr ctx, int keys, int[] vbuff, ref int nsamp, short[] sbuff); + public static extern void BizAdvance(IntPtr ctx, LibVBANext.Buttons keys, int[] vbuff, ref int nsamp, short[] sbuff); } } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.cs index 507fec1b2d..2579ac80d7 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.cs @@ -40,15 +40,16 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA } public IEmulatorServiceProvider ServiceProvider { get; private set; } - public ControllerDefinition ControllerDefinition { get { return GBA.GBAController; } } - public IController Controller { get; set; } public void FrameAdvance(bool render, bool rendersound = true) { Frame++; - LibmGBA.BizAdvance(core, 0, videobuff, ref nsamp, soundbuff); + if (Controller["Power"]) + LibmGBA.BizReset(core); + + LibmGBA.BizAdvance(core, VBANext.GetButtons(Controller), videobuff, ref nsamp, soundbuff); } public int Frame { get; private set; } @@ -98,6 +99,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA { nsamp = this.nsamp; samples = soundbuff; + Console.WriteLine(nsamp); DiscardSamples(); } public void DiscardSamples() diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.cs index a56d208be7..8dc7473d4f 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.cs @@ -108,7 +108,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA SyncTraceCallback(); - IsLagFrame = LibVBANext.FrameAdvance(Core, GetButtons(), videobuff, soundbuff, out numsamp, videopalette); + IsLagFrame = LibVBANext.FrameAdvance(Core, GetButtons(Controller), videobuff, soundbuff, out numsamp, videopalette); if (IsLagFrame) LagCount++; @@ -210,12 +210,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA public ControllerDefinition ControllerDefinition { get { return GBA.GBAController; } } public IController Controller { get; set; } - private LibVBANext.Buttons GetButtons() + public static LibVBANext.Buttons GetButtons(IController c) { LibVBANext.Buttons ret = 0; foreach (string s in Enum.GetNames(typeof(LibVBANext.Buttons))) { - if (Controller[s]) + if (c[s]) ret |= (LibVBANext.Buttons)Enum.Parse(typeof(LibVBANext.Buttons), s); } return ret;