-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata readouts.lua
executable file
·231 lines (212 loc) · 11.5 KB
/
data readouts.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
-- v2018-04-17/00
-- Opts
check_last = false;
check_loaded = true;
draw_to_osd = true;
--[[ Level
map_id = "level";
function format_output(v) return v end
function preformat_unknown(v) return "UNKNOWN: 0x"..format_4B_h(v) end
--]]
---[[ Movement
map_id = "mvmt_u";
function format_output(v) return format_mvmt_table(v) end
function preformat_unknown(v) return {"UNKNOWN:", "0x"..format_2B_h(v), "", "", ""} end
--]]
--[[ Last hit target
map_id = "last_hit_target_u";
function format_output(v) return v end
function preformat_unknown(v) return "Unassigned 0x"..format_1B_h(v) end
--]]
-- Functions
function read_n_bytes_at(addr, n) return n == 1 and memory.read_u8(addr) or (n == 2 and memory.read_u16_be(addr) or memory.read_u32_be(addr)) end
function format_1B_h(n) return string.format("%02s", bizstring.hex(n)) end
function format_2B_h(n) return string.format("%04s", bizstring.hex(n)) end
function format_4B_h(n) return string.format("%08s", bizstring.hex(n)) end
function rpad(s, with, to_len) return s..string.rep(with, to_len - #s) end
function format_mvmt_table(t) return rpad(t[1], " ", 16).." | "..rpad(t[2], " ", 14).." | "..rpad(t[3], " ", 13).." | "..rpad(t[4], " ", 14).." | "..t[5] end
-- Data
data_map = {
["level"] = {
["meta_addr_eu"] = 0x1D0A94, ["meta_addr_us"] = 0x1D0B94, ["meta_field_width"] = 4, ["meta_eu_offset"] = 0,
[0x00000000] = "Loading/Startup", [0xCCCCCCCC] = "Startup",
[0x42E44593] = "Demo #1 U/E: WoP -",
[0x435B6199] = "Demo #2 U/E: PS LZ3",
[0xC3A20774] = "Demo #3 U / #13 E: SoSaF LZ2",
[0xC2A554AA] = "Demo #4 U: Bayou LZ1", [0xC2A44502] = "Demo #4 E: Bayou LZ1",
[0xC16D7597] = "Demo #5 U: FG LZ0", [0xC16DA530] = "Demo #5 E: FG LZ0",
[0xC2E3DD31] = "Demo #6 U: Press LZ1", [0xC2D73A6F] = "Demo #6 E: Press LZ1",
[0xC392AF57] = "Demo #7 U/E: MoA LZ1",
[0xC0D8B0AB] = "Demo #8 U: SoRaL-A LZ2", [0xC175EB52] = "Demo #8 E: SoRaL-A LZ2",
[0x401AA748] = "Demo #9 U/E: TotA LZ0",
[0x41A4201B] = "Demo #10 U/E: Canopy LZ0",
[0xC293859F] = "Demo #11 U: WB LZ2", [0xC2578685] = "Demo #11 E: WB LZ2",
[0x3F02242C] = "Demo #12 U: SoRaL-B LZ1", [0x3EA92941] = "Demo #12 E: SoRaL-B LZ1",
[0x43620DE1] = "Demo #13 U: SoSaF LZ0", [0x4353DA07] = "Demo #3 E: SoSaF LZ0",
[0xC2C90F6D] = "Demo #14 U: PS LZ1", [0xC2C9983C] = "Demo #14 E: PS LZ1",
[0x41510FDC] = "Main Menu E",
[0x4275EC5C] = "AtB Cuts0 U/E", [0x433FBF9C] = "AtB - U/E",
[0x422C7B42] = "WoL <- AtB U/E", [0xC0E183F0] = "HoD - U/E", [0x41100000] = "WoL - E",
[0xC0C8A050] = "FG LZ0 U/E", [0xC145F840] = "FG LZ1 U/E", [0xC2AC756C] = "FG LZ2 U/E", [0xC2BDB373] = "FG LZ3 U/E", [0xC214239A] = "FG LZ4 U/E",
[0xC3825B50] = "MoA LZ0 U/E", [0xC392B4E8] = "MoA LZ1 U/E",
[0x4291DFE4] = "Bonus - U/E",
[0xC24833D6] = "Bayou Cuts0 U", [0xC28AC2B1] = "Bayou LZ0 U/E", [0xC13FECF8] = "Bayou LZ1 U/E",
[0x4380CA50] = "Lyfe - U/E",
[0xC060F2BC] = "TCC - U/E",
[0xC30F1097] = "SoWaI LZ0 U/E", [0xC30BD9F1] = "SoWaI LZ1 U/E", [0xBD5A2000] = "Polokus 1 U",
[0xC226FEAC] = "MH LZ0 U/E", [0xC3BC156C] = "MH LZ1 U/E", [0x435CA3A0] = "MH LZ2 U/E", [0xC39B9EBF] = "MH LZ3 U/E",
[0x43477F95] = "CoBD LZ0 U/E", [0x435F45E8] = "CoBD LZ1 U/E", [0xC2A27A10] = "CoBD LZ2 U/E",
[0x417EE800] = "Canopy LZ0 U/E", [0xC24F0E00] = "Canopy LZ1 U/E", [0x41464000] = "Canopy LZ2 U/E",
[0xC2563383] = "WB LZ0 U/E", [0x425359BE] = "WB LZ1 U/E", [0xC297F280] = "WB LZ2 U/E",
[0x4361B752] = "SoSaF LZ0 U/E", [0xC2F7E5F8] = "SoSaF LZ1 <- LZ0 U", [0xC3A2282F] = "SoSaF LZ2 U", [0xC357A18A] = "SoSaF LZ1 <- LZ2 U", [0xC35C0EAD] = "SoSaF LZ3 U",
[0x43387243] = "SoSaF LZ4 <- LZ3 U", [0x438A50E2] = "SoSaF LZ5 <- LZ4 U", [0x435A1EED] = "SoSaF LZ4 <- LZ5 U", [0x433625D3] = "SoSaF LZ6", [0x4340F423] = "SoSaF LZ5 <- LZ6 U", [0xC183B04E] = "Polokus 2 U",
[0x418E35AE] = "EC Cuts0 U/E", [0xC22999A3] = "EC LZ0 U/E", [0xC320961A] = "EC LZ1 U", [0x427FA376] = "EC LZ2 U",
[0x422AE5C5] = "Press LZ0 U/E", [0xC2FC7F4E] = "Press LZ1 U", [0x42B5A035] = "Press LZ2 U",
[0xC2F4166A] = "TotW LZ0 E", [0xC29CB89C] = "TotW LZ1 U",
[0xC368E9C0] = "SoRaL-A LZ0 E", [0xC24FEE00] = "SoRaL-A LZ1 U", [0xC2C85E80] = "SoRaL-A LZ2 U",
[0x42E447C0] = "WoP - E",
[0xC3BBE6F6] = "SoRaL-B LZ0 E", [0xBF234FA4] = "SoRaL-B LZ1 U", [0xC1D3A218] = "SoRaL-B LZ2 U", [0xC19724DA] = "Polokus 3 U",
[0x40BB44EC] = "TotA LZ0 E", --TODO
[0x436A6664] = "IM LZ0 E", [0x419C33D8] = "IM Cuts0 E", [0xC28EC88E] = "IM LZ1 E", [0xC3C8A7B3] = "IM LZ2 E",
[0xC198104A] = "Polokus (post-IM?) E", --TODO
[0xC19092C0] = "PS Cuts0 E", [0x404CB638] = "PS LZ0 E", [0xC2C99880] = "PS LZ1 E", [0x437A7D95] = "PS LZ2 E", [0x435AE5F8] = "PS LZ3 E",
[0x4341DAC7] = "PS LZ4 E", [0xC1933333] = "PS LZ4 no cuts E", [0x41A4FB9A] = "PS CutsX E", [0xC0973FE1] = "Credits E"
},
["mvmt_u"] = {
["meta_addr_eu"] = 0x1C689E, ["meta_addr_us"] = 0x1C699E, ["meta_field_width"] = 2, ["meta_eu_offset"] = 0x100,
-- [0xXXXX] = {`damage`, `(spec./-) lat. movement`, `vert. movement`, `spec. vert. movement`, `other`}
[0x0000] = {"", "", "", "", "Startup"}, [0xCCCC] = {"", "", "", "", "Startup"},
[0xD478] = {"", "Stationary", "", "", ""},
[0xD498] = {"", "Unknown", "A", "0xD498", ""}, --slow walking?
[0xD4B8] = {"", "Move (FBLR)", "", "", ""},
[0xD4F8] = {"", "Stationary", "Init. jump", "", ""},
[0xD538] = {"", "Indet.", "Fall", "", ""},
[0xD5B8] = {"", "Move (FBLR)", "", "Hang", ""},
[0xD5D8] = {"", "Stationary", "", "Hang", ""},
[0xD698] = {"", "Indet.", "Fall", "<'Copter/Ledge", "; Loading; HoD"},
[0xD6F8] = {"", "Stationary", "", "Ledge", ""},
[0xD758] = {"", "Indet.", "Hover; Fall", "'Copter", ""},
[0xD838] = {"", "Stationary", "", "Pull up <Ledge", ""},
[0xD878] = {"", "Stationary", "", "Climb", ""},
[0xD898] = {"", "Up", "", "Climb", ""},
[0xD8B8] = {"", "Down", "", "Climb", ""},
[0xD8D8] = {"", "Left", "", "Climb", ""},
[0xD8F8] = {"", "Right", "", "Climb", ""},
[0xDAF8] = {"", "Stationary", "", "", "Swim"},
[0xDB18] = {"", "Move (FBLRUD)", "", "", "Swim"},
[0xDBB8] = {"", "Strafe right", "", "", ""},
[0xDBF8] = {"", "Strafe left", "", "", ""},
[0xDC18] = {"", "Strafe forward", "", "", ""},
[0xDC38] = {"", "Strafe back", "", "", ""},
[0xDD98] = {"", "Acc. forward", "", "", "Purple lum"},
[0xDDD8] = {"", "Acc. back", "", "", "Purple lum"},
[0xDF98] = {"", "Move (FBLR)", "Init. jump", "", ""},
[0xDFB8] = {"", "Move (FBLR)>", "Fall", "", ""},
[0xE058] = {"", "Slide", "", "", ""},
[0xE0D8] = {"", "Stationary", "", "", "Carry"},
[0xE0F8] = {"", "Move (FBLR)", "", "", "Carry"},
[0xE138] = {"", "Keg rocket", "", "", ""},
[0xE218] = {"", "Strafe back", "", "Backflip", "; Acc. <purple lum"},
[0xE278] = {"", "Strafe back", "", "Pre-backflip", ""},
[0xE2B8] = {"", "", "", "", "Throw up"}, -- diff in stationary/moving
[0xE2D8] = {"", "", "", "", "Throw forward"},
[0xE338] = {"", "Misc. control", "", "", "; Cutscene"},
[0xE358] = {"", "Stationary", "", "Wedged", ""},
[0xE378] = {"", "Strafe forward", "", "Wedged", ""},
[0xE398] = {"", "Strafe back", "", "Wedged", ""},
[0xE4B8] = {"", "Strafe right", "", "Hang", ""},
[0xE4D8] = {"", "Strafe back", "", "Hang", ""},
[0xE4F8] = {"", "Strafe forward", "", "Hang", ""},
[0xE518] = {"", "Strafe left", "", "Hang", ""},
[0xE5B8] = {"", "Unknown", "Y", "0xE5B8", ""}, -- zapped?
[0xE618] = {"Death (freefall)", "", "", "", "; Teensy Doorway"},
[0xE638] = {"", "", "Freefall", "", ""},
[0xE658] = {"", "Unknown", "S", "0xE658", ""}, -- underwater stun?
[0xE678] = {"KB from hit", "", "Jump/Fall/", "/Climb/LDGRB", ""},
[0xE698] = {"KB from hit", "", "", "", ""},
[0xE718] = {"", "Unknown", "Z", "0xE718", ""},
[0xE758] = {"", "Stationary", "", "", "Pick up (orb/keg)"},
[0xE778] = {"", "Stationary", "", "", "Pick up (plum); Catch falling obj."},
[0xE7B8] = {"", "Unknown", "V", "0xE7B8", ""}, -- something something keg
[0xE898] = {"Death (misc.)", "", "", "", ""},
[0xE8B8] = {"Respawn", "", "", "", ""},
[0xE998] = {"", "Unknown", "T", "0xE998", ""}, -- squished?
[0xE9B8] = {"", "Rail chair", "", "", ""},
[0xE9D8] = {"", "Slide left", "", "", ""},
[0xE9F8] = {"", "Slide right", "", "", ""},
[0xEA98] = {"", "Unknown", "B", "0xEA98", ""},
[0xEAB8] = {"", "Unknown", "C", "0xEAB8", ""},
[0xEB38] = {"", "Unknown", "W", "0xEB38", ""}, -- victory dance?
[0xEB78] = {"", "Unknown", "X", "0xEB78", ""}, -- teensy jig?
[0xEBB8] = {"", "Stationary", "", "", "Victory dance"}, -- landing on hot air balloon, initiates cutscene
[0xEC38] = {"Prepare shot", "", "", "", ""},
[0xEC58] = {"Charge shot", "", "", "", ""},
[0xEC98] = {"Fire shot", "", "", "", ""},
[0xECD8] = {"Prepare shot", "", "", "Hang", ""},
[0xECF8] = {"Charge shot", "", "", "Hang", ""},
[0xED18] = {"Fire shot", "", "", "Hang", ""},
[0xED98] = {"Charge shot", "", "", "'Copter", ""},
[0xEDF8] = {"Prepare shot", "", "", "'Copter", ""},
[0xEE38] = {"Charge shot", "", "", "", "Swim"},
[0xEE58] = {"Prepare shot", "", "", "", "Swim"},
[0xEF18] = {"Fire shot", "Indet.", "Airborne", "", ""},
[0xEF78] = {"Fire shot", "Strafe forward", "", "", ""},
[0xEFB8] = {"Fire shot", "Strafe right", "", "", ""},
[0xF038] = {"Fire shot", "Strafe left", "", "", ""},
[0xF0B8] = {"Fire shot", "Strafe back", "", "", ""},
[0xF3D8] = {"Fire shot", "Move (FBLR)", "", "", ""},
[0xF6D8] = {"Fire shot", "", "", "'Copter", ""},
[0xF738] = {"Charge shot", "Strafe back", "", "", ""},
[0xF758] = {"Charge shot", "Strafe right", "", "", ""},
[0xF778] = {"Charge shot", "Strafe left", "", "", ""},
[0xF798] = {"Charge shot", "Strafe forward", "", "", ""},
[0xF998] = {"", "Stationary", "", "", "Idle (left hand)"},
[0xF9B8] = {"", "Stationary", "", "", "Idle (finger spin)"},
[0xF9D8] = {"", "Stationary", "", "", "Idle (both hands)"},
[0xFA38] = {"", "Stationary", "", "", "Idle (between 'legs')"},
[0xFAB8] = {"", "Stationary", "", "", "Idle (right hand)"},
[0xFB18] = {"", "Stationary", "", "", "Concentration"}
},
["last_hit_target_u"] = {
["meta_addr_eu"] = 0x1FDFF1, ["meta_addr_us"] = 0x1FDFF1, ["meta_field_width"] = 1, ["meta_eu_offset"] = 0,
-- [0xXX] = `name`
[0x01] = "Robo-Pirate",
[0x02] = "Clark controller", --TODO check
[0x03] = "Spider",
[0x04] = "Foutch",
[0x05] = "Axel", -- never shown
[0x06] = "Mini Jano",
[0x07] = "Razorbeard",
[0x08] = "Barrel Pirate"
}
};
-- Main
memory.usememorydomain("RDRAM");
if check_loaded then
while memory.read_u8(0x43921) > 85 do emu.frameadvance() end
end
is_eu = memory.read_u8(0x43921) == 69;
addr = is_eu and data_map[map_id]["meta_addr_eu"] or data_map[map_id]["meta_addr_us"];
all_c = data_map[map_id]["meta_field_width"] == 1 and 0xCC or (data_map[map_id]["meta_field_width"] == 2 and 0xCCCC or 0xCCCCCCCC);
if check_last then
last = 0;
while true do
v = read_n_bytes_at(addr, data_map[map_id]["meta_field_width"]);
if v ~= last then
last = v;
if v ~= 0 and v ~= all_c and is_eu then v = v + data_map[map_id]["meta_eu_offset"] end
v = data_map[map_id][v] == nil and preformat_unknown(v) or data_map[map_id][v];
if draw_to_osd then gui.addmessage(format_output(v)) else console.writeline(format_output(v)) end
end
emu.frameadvance();
end
else
while true do
v = read_n_bytes_at(addr, data_map[map_id]["meta_field_width"]);
if v ~= 0 and v ~= all_c and is_eu then v = v + data_map[map_id]["meta_eu_offset"] end
if draw_to_osd and data_map[map_id][v] == nil then console.writeline(format_output(preformat_unknown(v))) end
v = data_map[map_id][v] == nil and preformat_unknown(v) or data_map[map_id][v];
if draw_to_osd then gui.text(0, 8, format_output(v), 0xFF3F7FFF, "bottomleft") else console.writeline(format_output(v)) end
emu.frameadvance();
end
end