mirror of
https://github.com/notwa/mm
synced 2024-11-04 22:49:03 -08:00
refactor addresses, tuck away in folder
This commit is contained in:
parent
3b7c7ffcd6
commit
304790bd7e
28 changed files with 130 additions and 190 deletions
|
@ -1,12 +0,0 @@
|
|||
local link = 0x1E6B50
|
||||
local global = 0x3DDFC0
|
||||
local actor = 0x3F7250
|
||||
|
||||
function AL(a, s) return A(link+a, s) end
|
||||
function AG(a, s) return A(global+a, s) end
|
||||
function AA(a, s) return A(actor+a, s) end
|
||||
|
||||
local common = dofile("A common.lua")
|
||||
|
||||
return merge(common, {
|
||||
})
|
|
@ -1,12 +0,0 @@
|
|||
local link = 0x1E6EF0
|
||||
local global = 0x3DE360
|
||||
local actor = 0x3F75F0
|
||||
|
||||
function AL(a, s) return A(link+a, s) end
|
||||
function AG(a, s) return A(global+a, s) end
|
||||
function AA(a, s) return A(actor+a, s) end
|
||||
|
||||
local common = dofile("A common.lua")
|
||||
|
||||
return merge(common, {
|
||||
})
|
|
@ -1,12 +0,0 @@
|
|||
local link = 0x1E5480
|
||||
local global = 0x378EB0
|
||||
local actor = 0x392140
|
||||
|
||||
function AL(a, s) return A(link+a, s) end
|
||||
function AG(a, s) return A(global+a, s) end
|
||||
function AA(a, s) return A(actor+a, s) end
|
||||
|
||||
local common = dofile("A common.lua")
|
||||
|
||||
return merge(common, {
|
||||
})
|
|
@ -1,12 +0,0 @@
|
|||
local link = 0x1EF710
|
||||
local global = 0x3E6FB0
|
||||
local actor = 0x400260
|
||||
|
||||
function AL(a, s) return A(link+a, s) end
|
||||
function AG(a, s) return A(global+a, s) end
|
||||
function AA(a, s) return A(actor+a, s) end
|
||||
|
||||
local common = dofile("A common.lua")
|
||||
|
||||
return merge(common, {
|
||||
})
|
|
@ -1,12 +0,0 @@
|
|||
local link = 0x1ED820
|
||||
local global = 0x381250
|
||||
local actor = 0x39A4E0
|
||||
|
||||
function AL(a, s) return A(link+a, s) end
|
||||
function AG(a, s) return A(global+a, s) end
|
||||
function AA(a, s) return A(actor+a, s) end
|
||||
|
||||
local common = dofile("A common.lua")
|
||||
|
||||
return merge(common, {
|
||||
})
|
|
@ -1,12 +0,0 @@
|
|||
local link = 0x1EEE80
|
||||
local global = 0x3E63B0
|
||||
local actor = 0x3FF680
|
||||
|
||||
function AL(a, s) return A(link+a, s) end
|
||||
function AG(a, s) return A(global+a, s) end
|
||||
function AA(a, s) return A(actor+a, s) end
|
||||
|
||||
local common = dofile("A common.lua")
|
||||
|
||||
return merge(common, {
|
||||
})
|
|
@ -1,12 +0,0 @@
|
|||
local link = 0x1ED830
|
||||
local global = 0x381260
|
||||
local actor = 0x39A4F0
|
||||
|
||||
function AL(a, s) return A(link+a, s) end
|
||||
function AG(a, s) return A(global+a, s) end
|
||||
function AA(a, s) return A(actor+a, s) end
|
||||
|
||||
local common = dofile("A common.lua")
|
||||
|
||||
return merge(common, {
|
||||
})
|
|
@ -1,13 +1,11 @@
|
|||
require "boilerplate"
|
||||
require "addrs"
|
||||
require "addrs.init"
|
||||
|
||||
-- bizhawk lua has some nasty memory leaks at the moment,
|
||||
-- so instead of creating an object every time,
|
||||
-- using a template to offset from will do for now.
|
||||
local actor_t = Actor(0)
|
||||
|
||||
local oot = version:sub(1, 2) == "O "
|
||||
|
||||
local actor_names, damage_names
|
||||
if oot then
|
||||
actor_names = require "actor names oot"
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
versions = { -- sha1 hashes of .z64s
|
||||
-- Majora's Mask
|
||||
['D6133ACE5AFAA0882CF214CF88DABA39E266C078'] = "US10",
|
||||
['2F0744F2422B0421697A74B305CB1EF27041AB11'] = "USDE",
|
||||
['9743AA026E9269B339EB0E3044CD5830A440C1FD'] = "USGC",
|
||||
['C04599CDAFEE1C84A7AF9A71DF68F139179ADA84'] = "EU10",
|
||||
['BB4E4757D10727C7584C59C1F2E5F44196E9C293'] = "EU11",
|
||||
['B38B71D2961DFFB523020A67F4807A4B704E347A'] = "EUDB",
|
||||
['A849A65E56D57D4DD98B550524150F898DF90A9F'] = "EUGC",
|
||||
['5FB2301AACBF85278AF30DCA3E4194AD48599E36'] = "JP10",
|
||||
['41FDB879AB422EC158B4EAFEA69087F255EA8589'] = "JP11",
|
||||
['1438FD501E3E5B25461770AF88C02AB1E41D3A7E'] = "JPGC",
|
||||
|
||||
-- Ocarina of Time
|
||||
['AD69C91157F6705E8AB06C79FE08AAD47BB57BA7'] = "O US10",
|
||||
-- this is supposedly the same ROM, but i don't have it offhand to verify
|
||||
['79A4F053D34018E59279E6D4B83C7DACCD985C87'] = "O US10",
|
||||
}
|
||||
|
||||
--while version == nil do
|
||||
-- emu.yield() -- wait until a known ROM is loaded (doesn't work)
|
||||
hash = gameinfo.getromhash()
|
||||
version = versions[hash]
|
||||
--end
|
||||
|
||||
addrs = require("A "..version)
|
||||
|
||||
return addrs
|
1
Lua/addrs/M EU10.lua
Executable file
1
Lua/addrs/M EU10.lua
Executable file
|
@ -0,0 +1 @@
|
|||
return {}
|
1
Lua/addrs/M EU11.lua
Executable file
1
Lua/addrs/M EU11.lua
Executable file
|
@ -0,0 +1 @@
|
|||
return {}
|
|
@ -1,14 +1,4 @@
|
|||
local link = 0x23F790
|
||||
local global = 0x448700
|
||||
local actor = 0x4619D0
|
||||
|
||||
function AL(a, s) return A(link+a, s) end
|
||||
function AG(a, s) return A(global+a, s) end
|
||||
function AA(a, s) return A(actor+a, s) end
|
||||
|
||||
local common = dofile("A common.lua")
|
||||
|
||||
return merge(common, {
|
||||
return {
|
||||
checksum = AL(0x100A, 2),
|
||||
disable_pause = AL(0x100D, 1),
|
||||
hookshot_ba = AL(0x100E, 1),
|
||||
|
@ -45,4 +35,4 @@ return merge(common, {
|
|||
screen_scale_enable = AL(0x3F60, 1),
|
||||
screen_scale = AL(0x3F64, 'f'),
|
||||
scene_flags_ingame = AL(0x3F68, 0x960),
|
||||
})
|
||||
}
|
1
Lua/addrs/M EUGC.lua
Executable file
1
Lua/addrs/M EUGC.lua
Executable file
|
@ -0,0 +1 @@
|
|||
return {}
|
|
@ -1,14 +1,4 @@
|
|||
local link = 0x1EF460
|
||||
local global = 0x3E6CF0
|
||||
local actor = 0x3FFFA0
|
||||
|
||||
function AL(a, s) return A(link+a, s) end
|
||||
function AG(a, s) return A(global+a, s) end
|
||||
function AA(a, s) return A(actor+a, s) end
|
||||
|
||||
local common = dofile("A common.lua")
|
||||
|
||||
return merge(common, {
|
||||
return {
|
||||
checksum = AL(0x138E, 2),
|
||||
--disable_pause = AL(, 1),
|
||||
--hookshot_ba = AL(, 1),
|
||||
|
@ -61,4 +51,4 @@ return merge(common, {
|
|||
--warp_begin = A(, 1),
|
||||
--screen_dim = A(, 1),
|
||||
--warp_destination = A(, 2),
|
||||
})
|
||||
}
|
1
Lua/addrs/M JP11.lua
Executable file
1
Lua/addrs/M JP11.lua
Executable file
|
@ -0,0 +1 @@
|
|||
return {}
|
1
Lua/addrs/M JPGC.lua
Executable file
1
Lua/addrs/M JPGC.lua
Executable file
|
@ -0,0 +1 @@
|
|||
return {}
|
|
@ -1,14 +1,4 @@
|
|||
local link = 0x1EF670
|
||||
local global = 0x3E6B20
|
||||
local actor = 0x3FFDB0
|
||||
|
||||
function AL(a, s) return A(link+a, s) end
|
||||
function AG(a, s) return A(global+a, s) end
|
||||
function AA(a, s) return A(actor+a, s) end
|
||||
|
||||
local common = dofile("A common.lua")
|
||||
|
||||
return merge(common, {
|
||||
return {
|
||||
checksum = AL(0x100A, 2),
|
||||
disable_pause = AL(0x100D, 1),
|
||||
hookshot_ba = AL(0x100E, 1),
|
||||
|
@ -61,4 +51,4 @@ return merge(common, {
|
|||
warp_begin = A(0x3FF395, 1),
|
||||
screen_dim = A(0x3FF397, 1),
|
||||
warp_destination = A(0x3FF39A, 2),
|
||||
})
|
||||
}
|
1
Lua/addrs/M USDE.lua
Executable file
1
Lua/addrs/M USDE.lua
Executable file
|
@ -0,0 +1 @@
|
|||
return {}
|
1
Lua/addrs/M USGC.lua
Executable file
1
Lua/addrs/M USGC.lua
Executable file
|
@ -0,0 +1 @@
|
|||
return {}
|
|
@ -1,13 +1,4 @@
|
|||
-- version-agnostic addresses
|
||||
A = require "boilerplate"
|
||||
|
||||
function merge(t1, t2)
|
||||
for k, v in pairs(t1) do
|
||||
t2[k] = v
|
||||
end
|
||||
return t2
|
||||
end
|
||||
|
||||
function Actor(addr)
|
||||
local function AA(a, s) return A(addr+a, s) end
|
||||
return {
|
||||
|
@ -245,6 +236,7 @@ return {
|
|||
current_scene_flags_4 = AG(0x1E6C, 4),
|
||||
current_scene_flags_5 = AG(0x1E74, 4),
|
||||
|
||||
--[[ FIXME
|
||||
link_actor = merge(Actor(AA(0,0).addr), {
|
||||
item_in_hand = AA(0x148, 1),
|
||||
animation_id = AA(0x24A, 2),
|
||||
|
@ -253,4 +245,5 @@ return {
|
|||
movement_angle = AA(0xAD4, 2),
|
||||
active_sword = AA(0xADB, 1),
|
||||
}),
|
||||
--]]
|
||||
}
|
3
Lua/addrs/O US10.lua
Normal file
3
Lua/addrs/O US10.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
target_style = AL(0x140C, 1),
|
||||
}
|
|
@ -1,20 +1,4 @@
|
|||
A = require "boilerplate"
|
||||
|
||||
local link = 0x11A5D0
|
||||
local global = 0x1C84A0
|
||||
local actor = 0x1DAA30
|
||||
|
||||
function AL(a, s) return A(link+a, s) end
|
||||
function AG(a, s) return A(global+a, s) end
|
||||
function AA(a, s) return A(actor+a, s) end
|
||||
|
||||
function merge(t1, t2)
|
||||
for k, v in pairs(t1) do
|
||||
t2[k] = v
|
||||
end
|
||||
return t2
|
||||
end
|
||||
|
||||
-- version-agnostic addresses
|
||||
function Actor(addr)
|
||||
local function AA(a, s) return A(addr+a, s) end
|
||||
return {
|
||||
|
@ -68,7 +52,7 @@ function Actor(addr)
|
|||
}
|
||||
end
|
||||
|
||||
local common = {
|
||||
return {
|
||||
exit_value = AL(0x02, 2),
|
||||
age_modifier = AL(0x04, 4),
|
||||
cutscene_status = AL(0x0A, 2), -- "cutscene number" 0xFFFx
|
||||
|
@ -185,7 +169,3 @@ local common = {
|
|||
z_cursor_actor = AG(0x1CC8, 4),
|
||||
z_target_actor = AG(0x1CCC, 4),
|
||||
}
|
||||
|
||||
return merge(common, {
|
||||
target_style = AL(0x140C, 1),
|
||||
})
|
103
Lua/addrs/init.lua
Executable file
103
Lua/addrs/init.lua
Executable file
|
@ -0,0 +1,103 @@
|
|||
local here = select("1", ...):match(".+%.") or ""
|
||||
|
||||
A = require "boilerplate"
|
||||
|
||||
versions = { -- sha1 hashes of .z64s
|
||||
-- Majora's Mask
|
||||
["D6133ACE5AFAA0882CF214CF88DABA39E266C078"] = "M US10",
|
||||
["2F0744F2422B0421697A74B305CB1EF27041AB11"] = "M USDE",
|
||||
["9743AA026E9269B339EB0E3044CD5830A440C1FD"] = "M USGC",
|
||||
["C04599CDAFEE1C84A7AF9A71DF68F139179ADA84"] = "M EU10",
|
||||
["BB4E4757D10727C7584C59C1F2E5F44196E9C293"] = "M EU11",
|
||||
["B38B71D2961DFFB523020A67F4807A4B704E347A"] = "M EUDB",
|
||||
["A849A65E56D57D4DD98B550524150F898DF90A9F"] = "M EUGC",
|
||||
["5FB2301AACBF85278AF30DCA3E4194AD48599E36"] = "M JP10",
|
||||
["41FDB879AB422EC158B4EAFEA69087F255EA8589"] = "M JP11",
|
||||
["1438FD501E3E5B25461770AF88C02AB1E41D3A7E"] = "M JPGC",
|
||||
|
||||
-- Ocarina of Time
|
||||
["AD69C91157F6705E8AB06C79FE08AAD47BB57BA7"] = "O US10",
|
||||
-- this is supposedly the same ROM, but i don't have it offhand to verify
|
||||
["79A4F053D34018E59279E6D4B83C7DACCD985C87"] = "O US10",
|
||||
}
|
||||
|
||||
local basics = {
|
||||
["M US10"] = {
|
||||
link = 0x1EF670,
|
||||
global = 0x3E6B20,
|
||||
actor = 0x3FFDB0,
|
||||
},
|
||||
["M USDE"] = {
|
||||
link = 0x1EEE80,
|
||||
global = 0x3E63B0,
|
||||
actor = 0x3FF680,
|
||||
},
|
||||
["M USGC"] = {
|
||||
link = 0x1ED830,
|
||||
global = 0x381260,
|
||||
actor = 0x39A4F0,
|
||||
},
|
||||
["M EU10"] = {
|
||||
link = 0x1E6B50,
|
||||
global = 0x3DDFC0,
|
||||
actor = 0x3F7250,
|
||||
},
|
||||
["M EU11"] = {
|
||||
link = 0x1E6EF0,
|
||||
global = 0x3DE360,
|
||||
actor = 0x3F75F0,
|
||||
},
|
||||
["M EUDB"] = {
|
||||
link = 0x23F790,
|
||||
global = 0x448700,
|
||||
actor = 0x4619D0,
|
||||
},
|
||||
["M EUGC"] = {
|
||||
link = 0x1E5480,
|
||||
global = 0x378EB0,
|
||||
actor = 0x392140,
|
||||
},
|
||||
["M JP10"] = {
|
||||
link = 0x1EF460,
|
||||
global = 0x3E6CF0,
|
||||
actor = 0x3FFFA0,
|
||||
},
|
||||
["M JP11"] = {
|
||||
link = 0x1EF710,
|
||||
global = 0x3E6FB0,
|
||||
actor = 0x400260,
|
||||
},
|
||||
["M JPGC"] = {
|
||||
link = 0x1ED820,
|
||||
global = 0x381250,
|
||||
actor = 0x39A4E0,
|
||||
},
|
||||
["O US10"] = {
|
||||
link = 0x11A5D0,
|
||||
global = 0x1C84A0,
|
||||
actor = 0x1DAA30,
|
||||
},
|
||||
}
|
||||
|
||||
--while version == nil do
|
||||
-- emu.yield() -- wait until a known ROM is loaded (doesn't work)
|
||||
hash = gameinfo.getromhash()
|
||||
version = versions[hash]
|
||||
--end
|
||||
|
||||
local v = version:sub(1, 2)
|
||||
oot = v == "O "
|
||||
mm = v == "M "
|
||||
|
||||
local b = basics[version]
|
||||
function AL(a, s) return A(b.link + a, s) end
|
||||
function AG(a, s) return A(b.global + a, s) end
|
||||
function AA(a, s) return A(b.actor + a, s) end
|
||||
|
||||
addrs = require(here..version)
|
||||
|
||||
local common = require(here..v.."common")
|
||||
|
||||
setmetatable(addrs, {__index=common})
|
||||
|
||||
return addrs
|
|
@ -1,5 +1,5 @@
|
|||
require "boilerplate"
|
||||
local addrs = require "addrs"
|
||||
local addrs = require "addrs.init"
|
||||
|
||||
local close = {text="close", type="close"}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "addrs"
|
||||
require "addrs.init"
|
||||
|
||||
-- precalculate hamming weights of bytes
|
||||
hamming_weight = {}
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
-- gimme gimme gimme
|
||||
local a = require "addrs"
|
||||
local a = require "addrs.init"
|
||||
require "item values"
|
||||
|
||||
local oot = version:sub(1, 2) == "O "
|
||||
|
||||
local iv
|
||||
if version == "JP10" or version == "JP11" then
|
||||
if version == "M JP10" or version == "M JP11" then
|
||||
iv = require "item values early"
|
||||
elseif oot then
|
||||
iv = require "item values oot"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
local A = require "boilerplate"
|
||||
local addrs = require "addrs"
|
||||
local addrs = require "addrs.init"
|
||||
|
||||
function printf(fmt, ...)
|
||||
print(fmt:format(...))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local addrs = require "addrs"
|
||||
local addrs = require "addrs.init"
|
||||
local anim_addr = addrs.link_actor.animation_id.addr
|
||||
|
||||
local anims_seen = {
|
||||
|
|
Loading…
Reference in a new issue