-
Notifications
You must be signed in to change notification settings - Fork 261
/
Copy pathsmash.lua
158 lines (133 loc) · 4.22 KB
/
smash.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
-- smash --
saveFileBuffer = edizon.getSaveFileBuffer()
function getValueFromSaveFile()
strArgs = edizon.getStrArgs()
intArgs = edizon.getIntArgs()
startingAddress = tonumber(strArgs[1], 16)
endingAddress= tonumber(strArgs[2], 16)
addressSize = intArgs[1]
valueSize = intArgs[2]
value = 0
if startingAddress ~= 0 then
if strArgs[1] == "53FF60" then
value = 1
for i = 0, endingAddress - startingAddress - 1, 16 do
value = value & saveFileBuffer[startingAddress+i+1] & saveFileBuffer[startingAddress+i+1+4] & saveFileBuffer[startingAddress+i+1+8]
end
end
if strArgs[1] == "426C77" then
value = 255
for i = 0, endingAddress - startingAddress - 1,28 do
value = value & saveFileBuffer[startingAddress+i+1]
end
end
if strArgs[1] == "426C76" then
for k=0, endingAddress - startingAddress - 1, 28 do
for i = 0, valueSize - 1 do
value = value | (saveFileBuffer[(startingAddress+k) + i + 1] << i * 8)
end
value = value & 65293
end
end
if strArgs[1] == "555BB8" then
value = 255
for i = 0, endingAddress- startingAddress - 1 do
value = value & saveFileBuffer[startingAddress+i+1]
end
end
if strArgs[1] == "00D0" then
value = 255
for i = 0, endingAddress - startingAddress - 1 do
value = value & saveFileBuffer[startingAddress+i+1]
end
end
if strArgs[1] == "434750" then
for k=0, endingAddress- startingAddress - 1, 52 do
for i = 0, valueSize - 1 do
value = value | (saveFileBuffer[(startingAddress+k) + i + 17] << i * 8)
end
value = value & 65294
end
end
else
for i = 0, valueSize - 1 do
value = value | (saveFileBuffer[endingAddress+ i + 1] << i * 8)
end
end
return value
end
function setValueInSaveFile(value)
strArgs = edizon.getStrArgs()
intArgs = edizon.getIntArgs()
startingAddress = tonumber(strArgs[1], 16)
endingAddress = tonumber(strArgs[2], 16)
addressSize = intArgs[1]
valueSize = intArgs[2]
if startingAddress ~= 0 then
if strArgs[1] == "53FF60" then
for i = 0, endingAddress - startingAddress - 1, 16 do
saveFileBuffer[startingAddress+i+1] = value
saveFileBuffer[startingAddress+i+1+4] = value
saveFileBuffer[startingAddress+i+1+8] = value
end
end
if strArgs[1] == "426C77" then
for i = 0, endingAddress - startingAddress - 1,28 do
saveFileBuffer[startingAddress + i + 1] = value
end
end
if strArgs[1] == "426C76" then
for i = 0, endingAddress - startingAddress - 1,28 do
for m = 0, valueSize - 1 do
saveFileBuffer[startingAddress + i + m + 1] = (value & (0xFF << m * 8)) >> (m * 8)
end
end
end
if strArgs[1] == "555BB8" then
for i = 0, endingAddress - startingAddress - 1 do
saveFileBuffer[startingAddress + i + 1] = value
end
end
if strArgs[1] == "00D0" then
for i = 0, endingAddress - startingAddress - 1 do
saveFileBuffer[startingAddress + i + 1] = value
end
end
if strArgs[1] == "434750" then
if value == 0 then
for i = 0, endingAddress - startingAddress - 1,52 do
for m = 0, valueSize - 1 do
saveFileBuffer[startingAddress + i + m + 1] = (4294967295 & (0xFF << m * 8)) >> (m * 8)
end
for m = 0, valueSize - 1 do
saveFileBuffer[startingAddress + i + m + 11] = (65535 & (0xFF << m * 8)) >> (m * 8)
end
for m = 0, valueSize - 1 do
saveFileBuffer[startingAddress + i + m + 17] = (14 & (0xFF << m * 8)) >> (m * 8)
end
end
else
spirit=1
for i = 0, endingAddress - startingAddress - 1,52 do
for m = 0, valueSize - 1 do
saveFileBuffer[startingAddress + i + m + 1] = (spirit & (0xFF << m * 8)) >> (m * 8)
end
for m = 0, valueSize - 1 do
saveFileBuffer[startingAddress + i + m + 11] = (spirit-1 & (0xFF << m * 8)) >> (m * 8)
end
for m = 0, valueSize - 1 do
saveFileBuffer[startingAddress + i + m + 17] = (value & (0xFF << m * 8)) >> (m * 8)
end
spirit=spirit+1
end
end
end
else
for i = 0, valueSize - 1 do
saveFileBuffer[endingAddress+ i + 1] = (value & (0xFF << i * 8)) >> (i * 8)
end
end
end
function getModifiedSaveFile()
return saveFileBuffer
end