1
0
Fork 0
mirror of https://github.com/notwa/mm synced 2024-11-04 20:09:03 -08:00
mm/Lua/addrs/init.lua

45 lines
925 B
Lua
Raw Normal View History

2015-05-10 14:45:51 -07:00
local basics = require "addrs.basics"
local versions = require "addrs.versions"
2015-03-23 20:41:46 -07:00
local same = {
["O JP10"] = "O US10",
["O JP11"] = "O US11",
["O JP12"] = "O US12",
--["O JPGC MQ"] = "O USGC", -- maybe?
}
2015-05-10 14:45:51 -07:00
hash = gameinfo.getromhash() -- TODO: send as argument
version = versions[hash] or _version_override
if version == nil then
print('ERROR: unknown rom')
return
end
local v = version:sub(1, 2)
oot = v == "O "
mm = v == "M "
2015-03-23 20:41:46 -07:00
local rv = same[version] or version
local b = basics[rv]
2015-05-10 14:45:51 -07:00
function AL(a, s) return A(b.link + a, s) end
2015-03-26 06:56:27 -07:00
function AG(a, s)
if rv == 'M JP10' or rv == 'M JP11' then
if a >= 0x17000 then -- approximate
a = a - 0x20
end
end
return A(b.global + a, s)
end
2015-05-10 14:45:51 -07:00
function AA(a, s) return A(b.actor + a, s) end
2015-05-10 14:45:51 -07:00
addrs = require("addrs."..rv)
2015-05-10 14:45:51 -07:00
local common = require("addrs."..v.."common")
setmetatable(addrs, {__index=common})
return addrs