User File #638563921559665348

Upload All User Files

#638563921559665348 - Solatorobo Lua File

Solatorobo.lua
18 downloads
Uploaded 7/12/2024 2:42 PM by inconsistent (see all 32)
Displays the position, speed, angle, and state in the OSD, works on all versions (US, EU, JP)
memory.usememorydomain("Main RAM")
local rom_hash = gameinfo.getromhash()
-- console.log(rom_hash)

-- Determine version
if rom_hash == "C2E65ED81623DD9B46E1F06804352ED6" then -- US
    Pointer = memory.read_s32_le(0x260360)
    State_offs = 0xF4EF
elseif rom_hash == "AAAFEF6075062A27D767EAEA6317A161" then -- JP
    Pointer = memory.read_s32_le(0x280798)
    State_offs = 0xF487
elseif rom_hash == "3D2519DB4636E753517A2E6388ECE7FC" then -- EU
    Pointer = memory.read_s32_le(0x2792A0)
    State_offs = 0xF4EF
else -- Error if none
  error("\nLoaded ROM is NOT Solatorobo!!\n" ..
          "Run an official version of it,\n" .. 
          "then load this script again!!!")
end

while true do
    X = memory.read_s32_le(Pointer + 0x70 & 0xFFFFFF)
    Y = memory.read_s32_le(Pointer + 0x74 & 0xFFFFFF)
    Z = memory.read_s32_le(Pointer + 0x78 & 0xFFFFFF)
    Angl = memory.read_s16_le(Pointer + 0x7E & 0xFFFFFF)
    Hspd = memory.read_s16_le(Pointer + 0x9C & 0xFFFFFF)
    Vspd = memory.read_s16_le(Pointer + 0xA0 & 0xFFFFFF)
    State = memory.read_u8(Pointer + State_offs & 0xFFFFFF)

    gui.text(1,120, "X: " .. X, "white")
    gui.text(1,140, "Y: " .. Y, "white")
    gui.text(1,160, "Z: " .. Z, "white")
    gui.text(1,180, "Angle: " .. Angl, "white")
    gui.text(1,200, "H Speed: " .. Hspd, "white")
    gui.text(1,220, "V Speed: " .. Vspd, "white")
    gui.text(1,240, "State: " .. State, "white")
    -- gui.text(1,300, "P: " .. bizstring.hex(Pointer), "white")
    emu.frameadvance()
end