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
|
pc_global = {
pid_mid_map = {}, -- map packet id to pictochat message id (key = pid)
msg = {}, -- pictochat messages (key = mid)
mid = 0, -- current pictochat message id
}
function bits(idx, len)
len = len or 1
return ((2^len)-1) * 2^idx
end
function fix_addr_endianness(addr)
local fixed = ByteArray.new()
fixed:set_size(6)
fixed:set_index(0, string.byte(addr, 2))
fixed:set_index(1, string.byte(addr, 1))
fixed:set_index(2, string.byte(addr, 4))
fixed:set_index(3, string.byte(addr, 3))
fixed:set_index(4, string.byte(addr, 6))
fixed:set_index(5, string.byte(addr, 5))
return fixed:raw()
end
room_user_addrs = { }
DS_SYSTEM_ADDRS = {
["\x00\x00\x00\x00\x00\x00"] = "Null / empty",
["\x03\x09\xbf\x00\x00\x00"] = "Multiplayer CMD",
["\x03\x09\xbf\x00\x00\x10"] = "Multiplayer Reply",
["\x03\x09\xbf\x00\x00\x03"] = "Multiplayer ACK",
["\x00\xf0\x77\x77\x77\x77"] = "Access point",
["\xff\xff\xff\xff\xff\xff"] = "Broadcast",
}
function get_addr_label(addr)
local label = DS_SYSTEM_ADDRS[addr]
if label ~= nil then
return label
end
label = room_user_addrs[addr]
if label ~= nil then
return string.format("user %s", label)
end
return nil
end
function add_addr(tree, field, buffer, value)
value = value or buffer:raw()
local treeitem = tree:add(field, buffer, value)
local label = get_addr_label(value)
if label ~= nil then
treeitem:append_text(string.format(" (%s)", label))
end
return treeitem
end
function add_addr_le(tree, field, buffer)
return add_addr(tree, field, buffer, fix_addr_endianness(buffer:raw()))
end
function register_addr(addr, label)
room_user_addrs[addr] = label
end
function register_addr_le(addr, label)
room_user_addrs[fix_addr_endianness(addr)] = label
end
GAMEID = {
PICTOCHAT = 0xe603,
MARIOKART = 0xbe01,
}
PROFILE_COLOR_MAP = {
[0] = "greyish blue",
[1] = "brown",
[2] = "red",
[3] = "light pink",
[4] = "orange",
[5] = "yellow",
[6] = "lime",
[7] = "light green",
[8] = "dark green",
[9] = "turqoise",
[10] = "light blue",
[11] = "blue",
[12] = "dark blue",
[13] = "dark purple",
[14] = "light purple",
[15] = "dark pink",
}
|