mgba: input support
This commit is contained in:
parent
f30dec819d
commit
6d5d720d55
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue