fork/m-overlay

git clone https://git.julia.blue/fork/m-overlay

blackops7799Added MiniMap panel for offscreen player display More work on PlayerPercent to make it show Nana's percentd16d89b

gui
9.4 KiB228 linesraw
1local map = {
2	[0x80479D60] = { type = "int", name = "frame" },
3	[0x80479D33] = { type = "byte", name = "menu" },
4}
5
6-- 804B302C = PAL
7local controllers = {
8	[1] = 0x804C1FAC + 0x44 * 0,
9	[2] = 0x804C1FAC + 0x44 * 1,
10	[3] = 0x804C1FAC + 0x44 * 2,
11	[4] = 0x804C1FAC + 0x44 * 3,
12}
13
14local controller_struct = {
15	[0x00] = { type = "int",	name = "buttons.pressed" },
16	[0x04] = { type = "int",	name = "buttons.pressed_previous" },
17	[0x08] = { type = "int",	name = "buttons.instant" },
18	[0x10] = { type = "int",	name = "buttons.released" },
19	[0x1C] = { type = "byte",	name = "analog.byte.l" },
20	[0x1D] = { type = "byte",	name = "analog.byte.r" },
21	[0x20] = { type = "float",	name = "joystick.x" },
22	[0x24] = { type = "float",	name = "joystick.y" },
23	[0x28] = { type = "float",	name = "cstick.x" },
24	[0x2C] = { type = "float",	name = "cstick.y" },
25	[0x30] = { type = "float",	name = "analog.float.l" },
26	[0x34] = { type = "float",	name = "analog.float.r" },
27	[0x41] = { type = "byte",	name = "plugged" },
28}
29
30for port, address in ipairs(controllers) do
31	for offset, info in pairs(controller_struct) do
32		map[address + offset] = {
33			type = info.type,
34			debug = info.debug,
35			name = string.format("controller.%d.%s", port, info.name),
36		}
37	end
38end
39
40local stage_info = 0x8049E6C8
41
42local stage_info_struct = {
43	[0x0000] = { type = "float", name = "camera.limit.left" },
44	[0x0004] = { type = "float", name = "camera.limit.right" },
45	[0x0008] = { type = "float", name = "camera.limit.top" },
46	[0x000C] = { type = "float", name = "camera.limit.bottom" },
47	
48	[0x0010] = { type = "float", name = "stage.offset.x" },
49	[0x0014] = { type = "float", name = "stage.offset.y" },
50
51	[0x0074] = { type = "float", name = "stage.blastzone.left" },
52	[0x0078] = { type = "float", name = "stage.blastzone.right" },
53	[0x007C] = { type = "float", name = "stage.blastzone.top" },
54	[0x0080] = { type = "float", name = "stage.blastzone.bottom" },
55}
56
57for offset, info in pairs(stage_info_struct) do
58	map[stage_info + offset] = info
59end
60
61local player_static_addresses = {
62	0x80453080, -- Player 1
63	0x80453F10, -- Player 2
64	0x80454DA0, -- Player 3
65	0x80455C30, -- Player 4
66}
67
68local player_static_struct = {
69	[0x000] = { type = "int", name = "state" },
70	[0x004] = { type = "int", name = "character" },
71	[0x008] = { type = "int", name = "mode" },
72	[0x00C] = { type = "short", name = "transformed" },
73	[0x010] = { type = "float", name = "position.x" },
74	[0x014] = { type = "float", name = "position.y" },
75	[0x018] = { type = "float", name = "position.z" },
76	[0x01C] = { type = "float", name = "partner_position.x" },
77	[0x020] = { type = "float", name = "partner_position.y" },
78	[0x024] = { type = "float", name = "partner_position.z" },
79	[0x040] = { type = "float", name = "facing" },
80	[0x044] = { type = "byte", name = "skin" },
81	[0x045] = { type = "byte", name = "port" },
82	[0x046] = { type = "byte", name = "color" },
83	[0x047] = { type = "byte", name = "team" },
84	[0x048] = { type = "byte", name = "port" },
85	[0x049] = { type = "byte", name = "cpu_level" },
86	[0x04A] = { type = "byte", name = "cpu_type" }, -- 4 = 20XX, 22 = normalish, 19 = Alt Normal
87	[0x054] = { type = "float", name = "attack_ratio" },
88	[0x058] = { type = "float", name = "damage_ratio" },
89	[0x060] = { type = "short", name = "percent" },
90	[0x062] = { type = "short", name = "percent_starting" },
91	[0x064] = { type = "short", name = "stamina" },
92	[0x068] = { type = "int", name = "falls" },
93	[0x070] = { type = "int", name = "kills.1" },
94	[0x074] = { type = "int", name = "kills.2" },
95	[0x078] = { type = "int", name = "kills.3" },
96	[0x07C] = { type = "int", name = "kills.4" },
97	[0x080] = { type = "int", name = "kills.5" },
98	[0x084] = { type = "int", name = "kills.6" },
99	[0x08C] = { type = "short", name = "suicides" },
100	[0x08E] = { type = "byte", name = "stocks" },
101	[0x090] = { type = "int", name = "coins" },
102	[0x094] = { type = "int", name = "coins_total" },
103	[0x0A8] = { type = "int", name = "name_tag" },
104
105	[0x0E8] = { type = "int", name = "attacks_count" },
106	[0x0F0] = { type = "int", name = "attacks_landed" },
107
108	-- Define these as pointers below
109	--[0x0B0] = { type = "int", name = "entity" }, -- Pointer to player entity -> 0x80453130
110	--[0x0B4] = { type = "int", name = "partner" }, -- Pointer to partner entity -> 0x80453134
111
112	[0xD1C] = { type = "float", name = "damage_taken" },
113	[0xD20] = { type = "float", name = "damage_peak" },
114	[0xD24] = { type = "int", name = "damage_recovered" },
115	[0xD28] = { type = "float", name = "damage_given" },
116	[0xD60] = { type = "int", name = "attacks_landed2" },
117	[0xDDC] = { type = "int", name = "air_time" },
118	[0xDE0] = { type = "int", name = "ground_time" },
119}
120
121for id, address in ipairs(player_static_addresses) do
122	for offset, info in pairs(player_static_struct) do
123		map[address + offset] = {
124			type = info.type,
125			debug = info.debug,
126			name = ("player.%i.%s"):format(id, info.name),
127		}
128	end
129end
130
131local entity_pointer_offsets = {
132	[0xB0] = "entity", -- The "main" controllable character
133	[0xB4] = "partner", -- Partner entity (For sheik/zelda/iceclimbers)
134}
135
136for id, address in ipairs(player_static_addresses) do
137	for offset, name in pairs(entity_pointer_offsets) do
138		map[address + offset] = {
139			type = "pointer", -- This struct moves around in memory each match, so we track where
140			name = ("player.%i.%s"):format(id, name),
141			struct = {
142				--[0x60 + 0x0000] = { type = "pointer", name = "base_entity" },
143
144				[0x60 + 0x0004] = { type = "int", name = "character" },
145				[0x60 + 0x0008] = { type = "int", name = "spawns" },
146				[0x60 + 0x000C] = { type = "byte", name = "port" },
147				[0x60 + 0x0010] = { type = "int", name = "action_state" },
148				[0x60 + 0x0014] = { type = "int", name = "animation_state" },
149				[0x60 + 0x0018] = { type = "int", name = "action_id" },
150				[0x60 + 0x002C] = { type = "float", name = "facing" },
151				[0x60 + 0x00B0] = { type = "float", name = "position.x" },
152				[0x60 + 0x00B4] = { type = "float", name = "position.y" },
153				[0x60 + 0x00B8] = { type = "float", name = "position.z" },
154				[0x60 + 0x0080] = { type = "float", name = "velocity.x" },
155				[0x60 + 0x0084] = { type = "float", name = "velocity.y" },
156				[0x60 + 0x0088] = { type = "float", name = "velocity.z" },
157
158				--[0x60 + 0x04B8] = { type = "float", name = "color.r" },
159
160				[0x60 + 0x0610] = { type = "byte", name = "subcolor.r" },
161				[0x60 + 0x0611] = { type = "byte", name = "subcolor.g" },
162				[0x60 + 0x0612] = { type = "byte", name = "subcolor.b" },
163				[0x60 + 0x0613] = { type = "byte", name = "subcolor.a" },
164
165				[0x60 + 0x0619] = { type = "byte", name = "skin" },
166				[0x60 + 0x061A] = { type = "byte", name = "color" }, -- 00 = no sub color, 01 = light, 02 = dark, 03 = black, 04 = gray, 05 = red (need code so doesnt freeze)
167				[0x60 + 0x061B] = { type = "byte", name = "team" },
168				[0x60 + 0x0128] = { type = "float", name = "friction" },
169				[0x60 + 0x0168] = { type = "int", name = "jumps" },
170				[0x60 + 0x016C] = { type = "float", name = "gravity" },
171				[0x60 + 0x0170] = { type = "float", name = "velocity.terminal" },
172				[0x60 + 0x0184] = { type = "float", name = "velocity.fastfall" },
173				[0x60 + 0x0198] = { type = "float", name = "weight" },
174				[0x60 + 0x019C] = { type = "float", name = "scale" },
175
176				[0x60 + 0x01F4] = { type = "float", name = "landing_lag.normal" },
177				[0x60 + 0x01F8] = { type = "float", name = "landing_lag.nair" },
178				[0x60 + 0x01FC] = { type = "float", name = "landing_lag.fair" },
179				[0x60 + 0x0200] = { type = "float", name = "landing_lag.bair" },
180				[0x60 + 0x0204] = { type = "float", name = "landing_lag.uair" },
181				[0x60 + 0x0208] = { type = "float", name = "landing_lag.dair" },
182
183				[0x60 + 0x0620] = { type = "float", name = "controller.joystick.x", },
184				[0x60 + 0x0624] = { type = "float", name = "controller.joystick.y" },
185				[0x60 + 0x0638] = { type = "float", name = "controller.cstick.x" },
186				[0x60 + 0x063C] = { type = "float", name = "controller.cstick.y" },
187				[0x60 + 0x0650] = { type = "float", name = "controller.analog.float" },
188				[0x60 + 0x065C] = { type = "int", name = "controller.buttons.pressed" },
189
190				[0x60 + 0x18C4] = { type = "int", name = "attacker" },
191				[0x60 + 0x1830] = { type = "float", name = "percent" },
192
193				[0x60 + 0x184C] = { type = "int", name = "flinch_animation" }, -- flinch from 0=low , 1=mid , 2=high
194				[0x60 + 0x18B0] = { type = "float", name = "knockback_resistance" }, -- 5 for Nana, 20 for Giga-Bowser, 0 on death
195
196				[0x60 + 0x1838] = { type = "float", name = "add_percent" }, -- Setting this to a value will apply the value as damage the next frame
197				[0x60 + 0x18F0] = { type = "int", name = "sub_percent" }, -- Setting this to a value will apply the value as a heal the next frame
198
199				[0x60 + 0x1A94] = { type = "int", name = "cpu_type" },
200				[0x60 + 0x1A98] = { type = "int", name = "cpu_level" },
201			},
202		}
203	end
204end
205
206local match_info = 0x8046B6A0
207
208local match_info_struct = {
209	[0x0008] = { type = "byte", name = "match.winner" },
210	[0x000D] = { type = "byte", name = "match.last_player_death" },
211	[0x000E] = { type = "byte", name = "match.finished", init = -1 },
212
213	[0x0024] = { type = "int", name = "match.frame" },
214	[0x0028] = { type = "int", name = "match.timer.seconds" },
215	[0x002C] = { type = "short", name = "match.timer.millis" },
216
217	[0x24D0] = { type = "byte", name = "match.teams" },
218	[0x24D3] = { type = "byte", name = "match.item.frequency" },
219	[0x24D4] = { type = "byte", name = "match.self_destruct" },
220	[0x24E8] = { type = "int", name = "match.item.flags.1" },
221	[0x24EC] = { type = "int", name = "match.item.flags.2" },
222}
223
224for offset, info in pairs(match_info_struct) do
225	map[match_info + offset] = info
226end
227
228return map