-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMSH.CT
More file actions
743 lines (691 loc) · 23.6 KB
/
MSH.CT
File metadata and controls
743 lines (691 loc) · 23.6 KB
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="34">
<Forms>
<MainWindow Class="TCEForm" Encoding="Ascii85">jg)K1)m*u-r!CNbi]g}t.K77!.;^S]e,O=.K!}iM*Ll4^fzHCPWrnna!1wS:7)a@1o.;(@OuTq@%9K*Mmi0nAed,W3o_)6ACkKGrsup$EsZ=n(u]VGd+O,+8o?t.Prj=ak4dLO4X*^H0:}V4zud(BQT20j+IAxfU,}do3tx$#x798sPXuxQ2.P?C3mb[_/[4=I)dqn4T.::H?1Owd(+(BZjm!W:zL*]a}32YAZHlVX/i7xET=JGg]3#[S3LG;u6]lKXOxn[UNS,,[3fGv@[ie06Iy%bgTx7C6HFGkM^!-f53.GsYTz}D3u+hjt+Uj;J1#2D)66}(;TP;(OcY@QLAd_Sx!-JyXYQ9F@Uo$ac1C2G.pRXogeaf!*ZueF_}$uvVTJ_gHfiN7;c0W(UIu$*rdQ9F@U75Azs8=}LJr[!Wuob+MKRKNSuc^uB-l(-a+OPJI;OlMLiCS(?K^Xdg3O)jg*9.R}^llBe7P_wp1*{rA/4R#?wyOYRuC362HJeMWZz5,=a%*O0uAr/+96UlBwfXP*#GsY.%wiyhV7zaPrLrQ)Rl6j{Z!3IgNqt*LFWekUeh71ovy-D}e7}JZ17=pYqPf)ER./TB$zKOrC?wVUb,OL]TSq[}p3r=f]eq*p$BG#k+aj#DoC];gc09JHjIAnap/.C2JSHjP^XWab,R-K[q3/Hjuq;Z8h%n6)kBtxVhhTJn.Jw#q*p6Wl+C}lNH(-/DVFk7xxdWAqfg,0Tl6NZA%(^r+/Le%Wp*PoH5[zyhbhSBE5mDEP@v-%4</MainWindow>
</Forms>
<CheatEntries>
<CheatEntry>
<ID>24</ID>
<Description>"Timer"</Description>
<ShowAsHex>1</ShowAsHex>
<VariableType>Byte</VariableType>
<Address>00746660</Address>
<Offsets>
<Offset>FF4809</Offset>
</Offsets>
</CheatEntry>
<CheatEntry>
<ID>9</ID>
<Description>"Timer (153 max)"</Description>
<VariableType>Byte</VariableType>
<Address>04AB57F8</Address>
<CheatEntries>
<CheatEntry>
<ID>6</ID>
<Description>"Timer Tick"</Description>
<VariableType>2 Bytes</VariableType>
<Address>04AB57F6</Address>
</CheatEntry>
</CheatEntries>
</CheatEntry>
<CheatEntry>
<ID>15</ID>
<Description>"P1"</Description>
<Options moHideChildren="1"/>
<LastState Value="" RealAddress="00000000"/>
<GroupHeader>1</GroupHeader>
<CheatEntries>
<CheatEntry>
<ID>10</ID>
<Description>"P1 Life"</Description>
<VariableType>Byte</VariableType>
<Address>0074E6D0</Address>
<Offsets>
<Offset>FF4190</Offset>
</Offsets>
<CheatEntries>
<CheatEntry>
<ID>11</ID>
<Description>"P1 Life Recover"</Description>
<VariableType>Byte</VariableType>
<Address>00746660</Address>
<Offsets>
<Offset>FFFAEC</Offset>
</Offsets>
</CheatEntry>
</CheatEntries>
</CheatEntry>
<CheatEntry>
<ID>37</ID>
<Description>"P1 Power"</Description>
<ShowAsSigned>0</ShowAsSigned>
<VariableType>Byte</VariableType>
<Address>00746660</Address>
<Offsets>
<Offset>FF4194</Offset>
</Offsets>
</CheatEntry>
<CheatEntry>
<ID>13</ID>
<Description>"P1 Vel X"</Description>
<VariableType>2 Bytes</VariableType>
<Address>00746660</Address>
<Offsets>
<Offset>FF4014</Offset>
</Offsets>
</CheatEntry>
<CheatEntry>
<ID>14</ID>
<Description>"P1 Vel X Flt"</Description>
<VariableType>2 Bytes</VariableType>
<Address>00746660</Address>
<Offsets>
<Offset>FF4016</Offset>
</Offsets>
</CheatEntry>
<CheatEntry>
<ID>20</ID>
<Description>"P1 Vel Y"</Description>
<VariableType>2 Bytes</VariableType>
<Address>00746660</Address>
<Offsets>
<Offset>FF401C</Offset>
</Offsets>
</CheatEntry>
<CheatEntry>
<ID>21</ID>
<Description>"P1 Vel Y Flt."</Description>
<VariableType>4 Bytes</VariableType>
<Address>00746660</Address>
<Offsets>
<Offset>FF401E</Offset>
</Offsets>
</CheatEntry>
<CheatEntry>
<ID>19</ID>
<Description>"P1 Pos X"</Description>
<VariableType>2 Bytes</VariableType>
<Address>0074E6D0</Address>
<Offsets>
<Offset>FF400C</Offset>
</Offsets>
</CheatEntry>
<CheatEntry>
<ID>18</ID>
<Description>"P1 Pos X Flt."</Description>
<VariableType>2 Bytes</VariableType>
<Address>0074E6D0</Address>
<Offsets>
<Offset>FF400E</Offset>
</Offsets>
</CheatEntry>
<CheatEntry>
<ID>17</ID>
<Description>"P1 Pos Y"</Description>
<VariableType>Byte</VariableType>
<Address>0074E6D0</Address>
<Offsets>
<Offset>FF4010</Offset>
</Offsets>
</CheatEntry>
<CheatEntry>
<ID>16</ID>
<Description>"P1 Pos Y Flt."</Description>
<VariableType>2 Bytes</VariableType>
<Address>0074E6D0</Address>
<Offsets>
<Offset>FF4012</Offset>
</Offsets>
</CheatEntry>
<CheatEntry>
<ID>33</ID>
<Description>"P1 Button Hold"</Description>
<ShowAsSigned>0</ShowAsSigned>
<VariableType>Binary</VariableType>
<BitStart>4</BitStart>
<BitLength>9</BitLength>
<ShowAsBinary>0</ShowAsBinary>
<Address>006C8B58</Address>
</CheatEntry>
</CheatEntries>
</CheatEntry>
<CheatEntry>
<ID>23</ID>
<Description>"P2"</Description>
<Options moHideChildren="1"/>
<LastState Value="" RealAddress="00000000"/>
<GroupHeader>1</GroupHeader>
<CheatEntries>
<CheatEntry>
<ID>7</ID>
<Description>"P2 Life"</Description>
<VariableType>Byte</VariableType>
<Address>0074E6D0</Address>
<Offsets>
<Offset>FF4590</Offset>
</Offsets>
<CheatEntries>
<CheatEntry>
<ID>8</ID>
<Description>"P2 Life Recover"</Description>
<VariableType>Byte</VariableType>
<Address>0074E6D0</Address>
<Offsets>
<Offset>FFFB1C</Offset>
</Offsets>
</CheatEntry>
</CheatEntries>
</CheatEntry>
<CheatEntry>
<ID>28</ID>
<Description>"P2 Power"</Description>
<ShowAsSigned>0</ShowAsSigned>
<VariableType>Byte</VariableType>
<Address>07C7FEBD</Address>
</CheatEntry>
<CheatEntry>
<ID>29</ID>
<Description>"P2 Power (for REAL) (143 max)"</Description>
<VariableType>Byte</VariableType>
<Address>07C7492B</Address>
</CheatEntry>
<CheatEntry>
<ID>22</ID>
<Description>"P2 Vel X"</Description>
<VariableType>Byte</VariableType>
<Address>04AB5403</Address>
</CheatEntry>
<CheatEntry>
<ID>34</ID>
<Description>"P2 Button Hold"</Description>
<ShowAsSigned>0</ShowAsSigned>
<VariableType>Binary</VariableType>
<BitStart>4</BitStart>
<BitLength>9</BitLength>
<ShowAsBinary>0</ShowAsBinary>
<Address>006C8B5A</Address>
</CheatEntry>
</CheatEntries>
</CheatEntry>
<CheatEntry>
<ID>25</ID>
<Description>"emuBase"</Description>
<ShowAsHex>1</ShowAsHex>
<VariableType>4 Bytes</VariableType>
<Address>00746660</Address>
</CheatEntry>
<CheatEntry>
<ID>26</ID>
<Description>"No description"</Description>
<ShowAsHex>1</ShowAsHex>
<VariableType>4 Bytes</VariableType>
<Address>00746660</Address>
<Offsets>
<Offset>0</Offset>
</Offsets>
</CheatEntry>
<CheatEntry>
<ID>27</ID>
<Description>"Kawaks Selected Game"</Description>
<VariableType>String</VariableType>
<Length>255</Length>
<Unicode>0</Unicode>
<CodePage>0</CodePage>
<ZeroTerminate>1</ZeroTerminate>
<Address>006C97D8</Address>
<Offsets>
<Offset>0</Offset>
<Offset>0</Offset>
</Offsets>
</CheatEntry>
<CheatEntry>
<ID>31</ID>
<Description>"No description"</Description>
<ShowAsSigned>0</ShowAsSigned>
<VariableType>Binary</VariableType>
<BitStart>0</BitStart>
<BitLength>6</BitLength>
<ShowAsBinary>0</ShowAsBinary>
<Address>0063B1CC</Address>
</CheatEntry>
<CheatEntry>
<ID>32</ID>
<Description>"Input Array"</Description>
<ShowAsHex>1</ShowAsHex>
<ShowAsSigned>0</ShowAsSigned>
<VariableType>8 Bytes</VariableType>
<Address>006C8B58</Address>
</CheatEntry>
</CheatEntries>
<UserdefinedSymbols/>
<LuaScript>-- Prints the data into a form.
-- By Jesuszilla
-- http://www.trinitymugen.net
local HITBOX_VULNERABILITY = 0
local HITBOX_ATTACK = 1
local HITBOX_PUSH = 2
local player1 = {
name = "Player 1",
addr = 0xFF4000
}
local player2 = {
name = "Player 2",
addr = 0xFF4400
}
local proj0 = {
name = "P1 Proj 0",
addr = 0xFFE400
}
selectedObj = player1 -- default
local dataInitialized = false
---------------
-- Variables --
---------------
aalist = getAutoAttachList()
stringlist_add(aalist,"WinKawaks.exe");
sfa3Mode = false
addressList = getAddressList()
base = 0
emuBase = {
kawaks = 0x00746660, -- Kawaks 1.62
}
boxBase = {
kawaks = 0x0074E700, -- Kawaks 1.62
}
game = {
numPlayers = 2,
numProj = 32,
hbTable = 0x90,
hbStart = 0x74,
projStart = 0xFFE400,
projOffset = 0x148,
offset = 0x00,
playerSpace = 0x400,
base = 0x00,
shift = 0x03,
anim = 0x00,
posX = 0x0C,
posXFlt = 0x0E,
posY = 0x10,
posYFlt = 0x12,
velX = 0x14,
velXFlt = 0x16,
velY = 0x1C,
velYFlt = 0x1E
}
-- In case user refreshes script
if getOpenedProcessID() ~= nil then
onOpenProcess(getOpenedProcessID())
end
---------------
-- Functions --
---------------
-- Game name watchdog timer tick
function check_name(sender)
gameName = addressList.getMemoryRecordByDescription("Kawaks Selected Game").getValue()
if gameName:match("Marvel Super Heroes") and not gameName:match("Marvel Super Heroes Vs.") then
game.base = readInteger(emuBase.kawaks)
base = readInteger(boxBase.kawaks)
else
game.base = 0
base = 0
end
game.projLimit = player1.addr + game.playerSpace * game.numPlayers
end
-- Proj watchdog timer tick
function check_proj(sender)
local mainForm = sender.getOwner()
if mainForm == nil then return end
local objList = mainForm.findComponentByName("ObjectListBox")
if objList == nil then return end
local i=0
for _,v in spairs(objects, compare_numeric_names) do
if v['name']:match("Proj") and proj_active(v) == true then
objList.Items[i] = v['name'] .. " (ACTIVE)"
elseif objList.Items[i]:match("ACT") then
objList.Items[i] = v['name']
end
i = i+1
end
end
-- Function to convert a signed byte to integer values
function signed_byte_to_int(value)
if bAnd(value,128) > 0 then
return value-256
else
return value
end
end
-- Function to convert a signed short to integer values
function signed_short_to_int(value)
if bAnd(value,32768) > 0 then
return value-65536
else
return value
end
end
-- Function to read shorts
function readShort(addr, signed)
local a = readBytes(addr, 1, false)
local b = readBytes(addr+1, 1, false)
local retVal = bOr(bShl(b,8),a)
if signed and bAnd(128,b) > 0 then
return signed_short_to_int(retVal)
else
return retVal
end
end
-- Reads a single byte, no bullshit
function readByte(addr)
return readBytes(addr, 1, false)
end
-- Reads a 32-bit Integer
function readInt32(addr)
local a = readShort(addr,false)
local b = readShort(addr+2,false)
local retVal = bOr(bShl(a,16),b)
return retVal
end
-- Counts the number of elements in a table
function count(t)
if t == nil then
return 0
end
local i = 0
for _ in pairs(t) do
i = i+1
end
return i
end
-- Determines whether or not a projectile is active. Thanks, Dammit!
function proj_active(obj)
if obj == nil or selectedObj == nil then return end
if readInteger(obj.addr + base) < game.numProj then
return false
else
return true
end
end
-- Iterates over a table in a sorted order
-- taken from http://stackoverflow.com/questions/15706270/sort-a-table-in-lua
function spairs(t, order)
-- collect the keys
local keys = {}
for k in pairs(t) do keys[#keys+1] = k end
-- if order function given, sort by it by passing the table and keys a, b,
-- otherwise just sort the keys
if order then
table.sort(keys, function(a,b) return order(t, a, b) end)
else
table.sort(keys)
end
-- return the iterator function
local i = 0
return function()
i = i + 1
if keys[i] then
return keys[i], t[keys[i]]
end
end
end
-- Compares the names
function compare_numeric_names(t, a,b)
local x = tonumber(t[a]['name']:match("%d+"))
local y = tonumber(t[b]['name']:match("%d+"))
if t[a]['name']:find("Player") ~= nil and t[b]['name']:find("Player") ~= nil then
return x < y
elseif t[a]['name']:find("Player") ~= nil then
return true
elseif t[b]['name']:find("Player") ~= nil then
return false
else
local x = tonumber(t[a]['name']:match("%d+"))
local y = tonumber(t[b]['name']:match("%d+"))
return x < y
end
end
---------------
-- Main --
---------------
-- Select the correct bases based on the process that was attached
function onOpenProcess(processid)
print("AAAAAAAAAAAAAAGH")
-- Kawaks hitbox base
game.base = readInteger(emuBase.kawaks)
base = readInteger(boxBase.kawaks)
print(string.format("game.base = 0x%X", game.base))
print(string.format("base = 0x%X", base))
-- Game name watchdog timer
gameWatchDogTimer = createTimer(nil, false)
timer_setInterval(gameWatchDogTimer, 500)
timer_onTimer(gameWatchDogTimer, check_name)
timer_setEnabled(gameWatchDogTimer, true)
end
-- Updates the velocity boxes
function update_data(sender)
if getOpenedProcessID() > 0 then
local form = sender.getOwner()
local listbox = form.findComponentByName("ObjectListBox")
-- Initialize the list of objects
if not dataInitialized then
local objList = form.findComponentByName("ObjectListBox")
initialize_data(objList)
else
-- Allocate the object list with the number of projectiles
for player = 1, 2 do
local i = 1
while i do
print(string.format("i = %d, addr = 0x%X", i, (game.projStart + (player-1)*game.projOffset - i*4)))
local obj = {name = string.format("Projectile %d (ACTIVE)", i-1),
addr = game.projStart + (player-1)*game.projOffset - i*4
}
if readInt32(game.base + obj.addr) < game.projLimit then
i = nil
else
objects[i+2] = obj
i = i+1
end
end
end
for k,v in spairs(objects, compare_numeric_names) do
listbox.items.add(objects[k]['name'])
end
update_obj_data(selectedObj, form)
end
end
end
-- Updates P1's data and puts them in the proper boxes
function update_obj_data(obj, mainForm)
if obj == nil then return end
-- Address list & form components
local xVelBox = mainForm.findComponentByName("CEEdit1")
local yVelBox = mainForm.findComponentByName("CEEdit2")
local deltaXVelBox = mainForm.findComponentByName("CEEdit3")
local deltaYVelBox = mainForm.findComponentByName("CEEdit4")
local xPosBox = mainForm.findComponentByName("CEEdit5")
local yPosBox = mainForm.findComponentByName("CEEdit6")
-- Previous velocities
prevVelX = tonumber(xVelBox.Text)
prevVelY = tonumber(yVelBox.Text)
-- Update the velocities
--print(string.format("velXInt = 0x%X", game.base + obj.addr + game.velX))
local velXInt = signed_byte_to_int(readByte(game.base + obj.addr + game.velX))
local velYInt = signed_byte_to_int(readByte(game.base + obj.addr + game.velY))
velX = velXInt + (readShort(game.base + obj.addr + game.velXFlt) / 65536.0)
velY = - (velYInt + (readShort(game.base + obj.addr + game.velYFlt) / 65536.0))
-- Update the positions
local posXInt = signed_byte_to_int(readByte(game.base + obj.addr + game.posX))
local posYInt = signed_byte_to_int(readByte(game.base + obj.addr + game.posY))
posX = posXInt + (readShort(game.base + obj.addr + game.posXFlt) / 65536.0)
posY = - (posYInt + (readShort(game.base + obj.addr + game.posYFlt) / 65536.0))
-- Deltas
deltaVelX = velX - prevVelX
deltaVelY = velY - prevVelY
-- Update the boxes
xVelBox.Text = velX
yVelBox.Text = velY
if not (velX == prevVelX) then
deltaXVelBox.Text = velX - prevVelX
end
if not (velY == prevVelY) then
deltaYVelBox.Text = velY - prevVelY
end
xPosBox.Text = posX
yPosBox.Text = posY
end
function start_timer(sender)
local vt = sender.getOwner().findComponentByName("VelocityTimer")
timer_setEnabled(vt, true)
end
-- Gets the specified hitbox coordinates
function get_obj_boxes(sender)
if selectedObj == nil then return end
--print(string.format("headBoxTable = 0x%x", game.base + selectedObj.addr + game.vulnStart))
local baseAddr = game.base + selectedObj.addr
local hitBoxTable = readInt32(baseAddr + game.hbTable)
print(string.format("hitBoxTable = 0x%X", hitBoxTable))
--local animPtr = addressList.getMemoryRecordByDescription("P1 Frame Val").getValue()
-- Attack 1
local atk1BoxOffset = readShort(baseAddr + game.hbStart + 0x0)
local ab1Off = bShl(bAnd(0x1FFF, atk1BoxOffset), game.shift)
print(string.format("atk1BoxOffset = 0x%X", atk1BoxOffset))
-- Attack 2
local atk2BoxOffset = readShort(baseAddr + game.hbStart + 0x2)
local ab2Off = bShl(bAnd(0x1FFF, atk2BoxOffset), game.shift)
print(string.format("atk2BoxOffset = 0x%X", atk2BoxOffset))
-- Head box
local headBoxOffset = readShort(baseAddr + game.hbStart + 0x4)
local hbOff = bShl(bAnd(0x1FFF, headBoxOffset), game.shift)
print(string.format("headBoxOffset = 0x%X", headBoxOffset))
-- Body box
local bodyBoxOffset = readShort(baseAddr + game.hbStart + 0x6)
local bbOff = bShl(bAnd(0x1FFF, bodyBoxOffset), game.shift)
print(string.format("bodyBoxOffset = 0x%X", bodyBoxOffset))
-- Legs box
local legsBoxOffset = readShort(baseAddr + game.hbStart + 0x8)
local lbOff = bShl(bAnd(0x1FFF, legsBoxOffset), game.shift)
print(string.format("legsBoxOffset = 0x%X", legsBoxOffset))
-- Extension box
local extsBoxOffset = readShort(baseAddr + game.hbStart + 0xA)
local ebOff = bShl(bAnd(0x1FFF, extsBoxOffset), game.shift)
print(string.format("extsBoxOffset = 0x%X", extsBoxOffset))
-- Load the damn hitboxes
selectedObj[HITBOX_VULNERABILITY] = {}
hitbox_load(selectedObj, 0, HITBOX_VULNERABILITY, hitBoxTable + hbOff)
hitbox_load(selectedObj, 1, HITBOX_VULNERABILITY, hitBoxTable + bbOff)
hitbox_load(selectedObj, 2, HITBOX_VULNERABILITY, hitBoxTable + lbOff)
hitbox_load(selectedObj, 3, HITBOX_VULNERABILITY, hitBoxTable + ebOff)
-- Load the damn attack boxes
selectedObj[HITBOX_ATTACK] = {}
hitbox_load(selectedObj, 0, HITBOX_ATTACK, hitBoxTable + ab1Off)
hitbox_load(selectedObj, 1, HITBOX_ATTACK, hitBoxTable + ab2Off)
-- Copy them to clipboard
local clsn2 = convert_to_air(selectedObj, HITBOX_VULNERABILITY)
local clsn1 = convert_to_air(selectedObj, HITBOX_ATTACK)
if clsn1 == "" then
writeToClipboard(clsn2)
else
writeToClipboard(clsn2 .. "\n" .. clsn1)
end
end
-- Converts hitboxes to .AIR syntax
function convert_to_air(obj, type)
local boxes = obj[type]
local clsnBase = ""
local clsnStr = ""
local clsnCount = count(boxes)
-- If there are no CLSNs, return an empty string
if clsnCount == 0 then
return ""
end
if type == HITBOX_VULNERABILITY then
clsnBase = "Clsn2"
else
clsnBase = "Clsn1"
end
clsnsStr = ""
boxNo = 0
for i=0,clsnCount-1 do
local box = boxes[i]
if box ~= nil then
local coords = ""
if box.left == 0 and box.top == 0 and box.right == 0 and box.bottom == 0 then
clsnCount = clsnCount -1
else
coords = string.format("%d,%d,%d,%d", box.left, box.top, box.right, box.bottom)
clsnsStr = clsnsStr .. string.format("\n %s[%d] = ", clsnBase, boxNo) .. coords
boxNo = boxNo + 1
end
end
end
if clsnCount == 0 or clsnsStr == "" then
return ""
else
clsnStr = clsnBase .. ": " .. clsnCount
return clsnStr .. clsnsStr
end
end
-- Swaps 16-bit words.
function word_swap(input)
local front = bAnd(input, 0xFFFF)
local back = bAnd(input, 0xFFFF0000)
local newBack = bShl(front, 16)
local newFront = bShr(back, 16)
return bOr(newFront, newBack)
end
function hitbox_load(obj, i, type, addr)
local addrBase = base + addr
print(string.format("base = 0x%X, addr = 0x%X, addrBase = 0x%X", base, addr, addrBase))
local hval = readShort(addrBase + 0, true)
local vval = readShort(addrBase + 4, true)
local hrad = readShort(addrBase + 2, true)
local vrad = readShort(addrBase + 6, true)
local debug = string.format("hval = 0x%X, vval = 0x%X, hrad = 0x%X, vrad = 0x%X", hval,vval,hrad,vrad)
--print(string.format("addr = 0x%X", addr))
--print(string.format("addrDec = 0x%X", tonumber(addrDec) + 2))
print(debug)
local left = -(hval + hrad)
local top = vval - vrad
local right = -(hval - hrad)
local bottom = vval + vrad
if type == HITBOX_VULNERABILITY then
obj[HITBOX_VULNERABILITY][i] = {
left = left,
right = right,
bottom = bottom,
top = top,
hval = hval,
vval = vval,
type = type
}
else
obj[type] = {
left = left,
right = right,
bottom = bottom,
top = top,
hval = hval,
vval = vval,
type = type
}
end
end
-- Populate the listbox
function initialize_data(listbox)
dataInitialized = true
local listItems = {}
listbox.items.clear()
objects = {player1, player2}
selectedObj = objects[0]
end
function set_selected_obj(sender, user)
for _,v in pairs(objects) do
if v['name'] == sender.Items[sender.getItemIndex()] then
selectedObj = v
--print(string.format("selectedObj.addr = 0x%X", selectedObj.addr))
break
end
end
end
</LuaScript>
</CheatTable>