mirror of
https://github.com/libretro/Mesen.git
synced 2024-11-24 09:39:44 +00:00
Debugger: Lua - Added getPrgRomOffset/getChrRomOffset functions
This commit is contained in:
parent
d65261d990
commit
f708b2a2cc
@ -63,6 +63,8 @@ int LuaApi::GetLibrary(lua_State *lua)
|
||||
{ "write", LuaApi::WriteMemory },
|
||||
{ "readWord", LuaApi::ReadMemoryWord },
|
||||
{ "writeWord", LuaApi::WriteMemoryWord },
|
||||
{ "getPrgRomOffset", LuaApi::GetPrgRomOffset },
|
||||
{ "getChrRomOffset", LuaApi::GetChrRomOffset },
|
||||
{ "revertPrgChrChanges", LuaApi::RevertPrgChrChanges },
|
||||
{ "addMemoryCallback", LuaApi::RegisterMemoryCallback },
|
||||
{ "removeMemoryCallback", LuaApi::UnregisterMemoryCallback },
|
||||
@ -236,6 +238,30 @@ int LuaApi::WriteMemoryWord(lua_State *lua)
|
||||
return l.ReturnCount();
|
||||
}
|
||||
|
||||
int LuaApi::GetPrgRomOffset(lua_State *lua)
|
||||
{
|
||||
LuaCallHelper l(lua);
|
||||
int address = l.ReadInteger();
|
||||
checkminparams(1);
|
||||
errorCond(address < 0 || address > 0xFFFF, "address must be between 0 and $FFFF");
|
||||
|
||||
int32_t prgRomOffset = _debugger->GetAbsoluteAddress((uint32_t)address);
|
||||
l.Return(prgRomOffset);
|
||||
return l.ReturnCount();
|
||||
}
|
||||
|
||||
int LuaApi::GetChrRomOffset(lua_State *lua)
|
||||
{
|
||||
LuaCallHelper l(lua);
|
||||
int address = l.ReadInteger();
|
||||
checkminparams(1);
|
||||
errorCond(address < 0 || address > 0x3FFF, "address must be between 0 and $3FFF");
|
||||
|
||||
int32_t chrRomOffset = _debugger->GetAbsoluteChrAddress((uint32_t)address);
|
||||
l.Return(chrRomOffset);
|
||||
return l.ReturnCount();
|
||||
}
|
||||
|
||||
int LuaApi::RevertPrgChrChanges(lua_State *lua)
|
||||
{
|
||||
LuaCallHelper l(lua);
|
||||
|
@ -20,6 +20,8 @@ public:
|
||||
static int WriteMemory(lua_State *lua);
|
||||
static int ReadMemoryWord(lua_State *lua);
|
||||
static int WriteMemoryWord(lua_State *lua);
|
||||
static int GetPrgRomOffset(lua_State *lua);
|
||||
static int GetChrRomOffset(lua_State *lua);
|
||||
static int RevertPrgChrChanges(lua_State *lua);
|
||||
|
||||
static int RegisterMemoryCallback(lua_State *lua);
|
||||
|
Loading…
Reference in New Issue
Block a user