gba: support hard reset. doesn't work right with saveram because saveram isn't all hooked up anyway yet

This commit is contained in:
goyuken 2012-11-23 04:28:38 +00:00
parent a20f838e20
commit 32d0b546e0
4 changed files with 19 additions and 16 deletions

View File

@ -12,10 +12,10 @@ namespace BizHawk.Emulation.Consoles.Nintendo.GBA
public static class LibMeteor
{
/// <summary>
/// reset the emulation core
/// power cycle the emulation core
/// </summary>
[DllImport("libmeteor.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void libmeteor_reset();
public static extern void libmeteor_hardreset();
/// <summary>
/// signal that you are removing data from the sound buffer.
@ -85,16 +85,16 @@ namespace BizHawk.Emulation.Consoles.Nintendo.GBA
[Flags]
public enum Buttons : ushort
{
BTN_A = 0x001,
BTN_B = 0x002,
BTN_SELECT = 0x004,
BTN_START = 0x008,
BTN_RIGHT = 0x010,
BTN_LEFT = 0x020,
BTN_UP = 0x040,
BTN_DOWN = 0x080,
BTN_R = 0x100,
BTN_L = 0x200
BTN_A = 0x001,
BTN_B = 0x002,
BTN_SELECT = 0x004,
BTN_START = 0x008,
BTN_RIGHT = 0x010,
BTN_LEFT = 0x020,
BTN_UP = 0x040,
BTN_DOWN = 0x080,
BTN_R = 0x100,
BTN_L = 0x200
}
/// <summary>

View File

@ -15,7 +15,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo.GBA
Name = "GBA Controller",
BoolButtons =
{
"Up", "Down", "Left", "Right", "Select", "Start", "B", "A", "L", "R"//, "Reset", "Power",
"Up", "Down", "Left", "Right", "Select", "Start", "B", "A", "L", "R", "Power"
}
};
public ControllerDefinition ControllerDefinition { get { return GBAController; } }
@ -26,7 +26,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo.GBA
if (bios.Length != 16384)
throw new Exception("GBA bios must be exactly 16384 bytes!");
Init();
LibMeteor.libmeteor_reset();
LibMeteor.libmeteor_hardreset();
LibMeteor.libmeteor_loadbios(bios, (uint)bios.Length);
LibMeteor.libmeteor_loadrom(rom, (uint)rom.Length);
@ -37,6 +37,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo.GBA
{
Controller.UpdateControls(Frame++);
IsLagFrame = true;
if (Controller["Power"])
LibMeteor.libmeteor_hardreset();
if (!coredead)
LibMeteor.libmeteor_frameadvance();
if (IsLagFrame)

View File

@ -42,9 +42,9 @@ EXPORT void libmeteor_setkeycallback(uint16_t (*callback)())
keycallback = callback;
}
EXPORT void libmeteor_reset()
EXPORT void libmeteor_hardreset()
{
AMeteor::Reset(AMeteor::UNIT_ALL ^ AMeteor::UNIT_MEMORY_BIOS);
AMeteor::Reset(AMeteor::UNIT_ALL ^ (AMeteor::UNIT_MEMORY_BIOS | AMeteor::UNIT_MEMORY_ROM));
}
uint32_t *videobuff;