gba: support register reading. shows current mode's r0..r15, cpsr, spsr. at the moment, none of the other out of context banked regs are shown, which may or may not be a good idea.
This commit is contained in:
parent
c7155b3aea
commit
323df9b92e
|
@ -261,5 +261,33 @@ namespace BizHawk.Emulation.Consoles.Nintendo.GBA
|
|||
/// <param name="scanline">0-227, 160 occurring first in a frame</param>
|
||||
[DllImport("libmeteor.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void libmeteor_setscanlinecallback(ScanlineCallback callback, int scanline);
|
||||
|
||||
/// <summary>
|
||||
/// get current cpu regs
|
||||
/// </summary>
|
||||
/// <param name="dest">length 18 please</param>
|
||||
public static extern void libmeteor_getregs(int[] dest);
|
||||
|
||||
public static readonly string[] regnames = new string[]
|
||||
{
|
||||
"r0",
|
||||
"r1",
|
||||
"r2",
|
||||
"r3",
|
||||
"r4",
|
||||
"r5",
|
||||
"r6",
|
||||
"r7",
|
||||
"r8",
|
||||
"r9",
|
||||
"r10",
|
||||
"r11",
|
||||
"r12",
|
||||
"r13",
|
||||
"r14",
|
||||
"r15",
|
||||
"cpsr",
|
||||
"spsr"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,12 @@ namespace BizHawk.Emulation.Consoles.Nintendo.GBA
|
|||
{
|
||||
public List<KeyValuePair<string, int>> GetCpuFlagsAndRegisters()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var ret = new List<KeyValuePair<string, int>>();
|
||||
int[] data = new int[LibMeteor.regnames.Length];
|
||||
LibMeteor.libmeteor_getregs(data);
|
||||
for (int i = 0; i < data.Length; i++)
|
||||
ret.Add(new KeyValuePair<string, int>(LibMeteor.regnames[i], data[i]));
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static readonly ControllerDefinition GBAController =
|
||||
|
|
|
@ -235,3 +235,12 @@ void scanlinecallback_bizhawk()
|
|||
if (slcallback)
|
||||
slcallback();
|
||||
}
|
||||
|
||||
EXPORT void libmeteor_getregs(int *dest)
|
||||
{
|
||||
AMeteor::_cpu.UpdateCpsr();
|
||||
for (int i = 0; i < 16; i++)
|
||||
dest[i] = AMeteor::_cpu.Reg(i);
|
||||
dest[16] = AMeteor::_cpu.Cpsr().dw;
|
||||
dest[17] = AMeteor::_cpu.Spsr().dw;
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue