Updated for Bizhawk. Supports both USA and JPN releases.
local Version = 0x00000C
local Money = 0x20731FC
local ArenaHP = 0x20FD780
local EnemyStart = 0x2119C00
local Map = 0x21DE000
local Lavos = 0x21C00CE
function Enemies(scrX, scrY)
--Enemies
gui.text(scrX, scrY, "Enemies", "white")
j = 1
for i = 0,7,1 do
EnemyBase = EnemyStart + (i * 0x80)
EI = memory.read_s16_le(EnemyBase)
if EI>0 and EI<255 then
EC = memory.read_s16_le(EnemyBase+0x3)
if EC>0 then
EF = memory.read_s16_le(EnemyBase+0x5)
gui.text(scrX, scrY + 15*j, i .. ": Index: " .. EI .. " HP: " .. EC .. "/" .. EF, "yellow")
j = j + 1
end
end
end
end
function Misc(scrX, scrY)
MoneyV = memory.read_s32_le(Money)
gui.text(scrX, scrY, "Money: " .. MoneyV, "white")
MapX = memory.readbyte(Map + 0xE3)
MapY = memory.readbyte(Map + 0xE7)
gui.text(scrX, scrY + 15, "Overworld coord: " .. MapX .. "," .. MapY, "white")
EpochStatus = memory.readbyte(Map + 0x294)
EpochMap = memory.read_s16_le(Map + 0x29F)
EpochChoice = memory.read_s16_le(Map + 0x2AF)
EpochUse = memory.readbyte(Lavos - 1)
gui.text(scrX, scrY + 30, "Epoch status: " .. bizstring.hex(EpochStatus) .. " Map: " .. EpochMap .. " Choice: " .. EpochChoice .. " Use: " .. EpochUse, "white")
LavosRoom = memory.readbyte(Lavos)
LavosPhase = memory.readbyte(Lavos + 0x10)
gui.text(scrX, scrY + 45, "Lavos room status: " .. LavosRoom .. " Phase: " .. LavosPhase, "white")
end
function Arena(scrX, scrY)
--Arena of Ages
HP = memory.read_s16_le(ArenaHP)
HPC = memory.read_s16_le(ArenaHP + 2)
Car = memory.read_s16_le(ArenaHP + 0x48)
Prize = memory.read_s16_le(ArenaHP + 0x50)
gui.text(scrX, scrY, "Arena of Ages", "white")
gui.text(scrX, scrY + 15, "Prize: " .. bizstring.hex(Prize), "yellow")
gui.text(scrX, scrY + 30, "Strength: 4011; Magic: 4012; Speed: 4013", "white")
gui.text(scrX, scrY + 45, "HP: " .. HP .. " HP Change: " .. HPC .. " Item: " .. bizstring.hex(Car), "yellow")
end
function getVersion()
--j
if mainmemory.read_s32_le(0x00000C) == 0x2655DEFF then
Money = Money + 0x20
ArenaHP = ArenaHP + 0x20
EnemyStart = EnemyStart + 0x20
end
end
getVersion()
memory.usememorydomain("ARM9 System Bus")
while true do
Enemies(5, 400)
Arena(5, 600)
Misc(5, 670)
emu.frameadvance()
end