Clean up script files

This commit is contained in:
octorock
2021-03-06 18:32:11 +01:00
parent 15f480dc0f
commit 2bcea72f49
47 changed files with 276 additions and 285 deletions
+3 -2
View File
@@ -493,9 +493,10 @@
.short \s
.endm
.macro TextboxNoOverlapFollowPos w
.macro TextboxNoOverlapFollowPos a,b
.short 0x0c5c
.word \w
.short \a
.short \b
.endm
.macro TextboxNoOverlapFollowPos_1 s
+1 -1
View File
@@ -62,7 +62,7 @@ script_08008E12:
WaitForSomething2 0x00000100
_0807E5F8 0x00000004
WaitForSomething2 0x00000008
TextboxNoOverlapFollowPos 0x000e1053
TextboxNoOverlapFollowPos 0x1053, 0x000e
_0807EA94
_0807E5F8 0x00000080
WaitForSomething2 0x00000100
+1 -1
View File
@@ -4,7 +4,7 @@ SCRIPT_START script_08008FC0
SoundReq 0x0109
CallWithArg sub_0807F238, 0x0000045f
Call sub_0807F304
TextboxNoOverlapFollowPos 0x000e0501
TextboxNoOverlapFollowPos 0x0501, 0x000e
_0807EA94
_0807E5F8 0x00000020
Call sub_080791BC
+11 -11
View File
@@ -28,20 +28,20 @@ SCRIPT_START script_0800903C
_0807EB44 0x0004
_0807ECC4 0x0008
_0807E930 0x0004
TextboxNoOverlapFollowPos 0x000e1050
TextboxNoOverlapFollowPos 0x1050, 0x000e
_0807EA94
_0807EF80 0x0000
_0807E5F8 0x00000100
WaitForSomething2 0x00000080
_0807E930 0x0004
TextboxNoOverlapFollowPos 0x000e1052
TextboxNoOverlapFollowPos 0x1052, 0x000e
_0807EA94
_0807EF80 0x0000
_0807E5F8 0x00000100
WaitForSomething2 0x00000080
_0807EB44 0x0006
_0807E930 0x0005
TextboxNoOverlapFollowPos 0x000e1054
TextboxNoOverlapFollowPos 0x1054, 0x000e
_0807EA94
_0807EF80 0x0000
_0807E5F8 0x00000100
@@ -50,25 +50,25 @@ SCRIPT_START script_0800903C
_0807E5F8 0x00000100
WaitForSomething2 0x00000080
_0807E930 0x0004
TextboxNoOverlapFollowPos 0x000e1056
TextboxNoOverlapFollowPos 0x1056, 0x000e
_0807EA94
_0807EF80 0x0000
_0807E5F8 0x00000100
WaitForSomething2 0x00000080
_0807E930 0x0004
TextboxNoOverlapFollowPos 0x000e1057
TextboxNoOverlapFollowPos 0x1057, 0x000e
_0807EA94
_0807EF80 0x0000
_0807E5F8 0x00000100
WaitForSomething2 0x00000080
_0807E930 0x0004
TextboxNoOverlapFollowPos 0x000e1058
TextboxNoOverlapFollowPos 0x1058, 0x000e
_0807EA94
_0807EF80 0x0000
_0807E5F8 0x00000100
WaitForSomething2 0x00000080
_0807E930 0x0004
TextboxNoOverlapFollowPos 0x000e105c
TextboxNoOverlapFollowPos 0x105c, 0x000e
_0807EA94
_0807EF80 0x0000
_0807E5F8 0x00000100
@@ -90,7 +90,7 @@ script_0800917C:
WaitForSomething2 0x00000001
_0807EB74
_0807EF80 0x0001
TextboxNoOverlapFollowPos 0x0000105b
TextboxNoOverlapFollowPos 0x105b, 0x0000
_0807EA94
_0807EF80 0x0000
_0807E5F8 0x00000002
@@ -102,7 +102,7 @@ script_0800917C:
_0807EF80 0x0005
Wait 0x003c
_0807EF80 0x0001
TextboxNoOverlapFollowPos 0x00001051
TextboxNoOverlapFollowPos 0x1051, 0x0000
_0807EA94
_0807EF80 0x0000
_0807E5F8 0x00000002
@@ -112,7 +112,7 @@ script_0800917C:
_0807EB74
_0807EB8C
_0807EF80 0x0001
TextboxNoOverlapFollowPos 0x00001055
TextboxNoOverlapFollowPos 0x1055, 0x0000
_0807EA94
_0807EF80 0x0000
_0807E5F8 0x00000002
@@ -126,7 +126,7 @@ script_0800917C:
_0807EB74
_0807EF80 0x0000
_0807EF80 0x0001
TextboxNoOverlapFollowPos 0x00001059
TextboxNoOverlapFollowPos 0x1059, 0x0000
_0807EA94
_0807EF80 0x0000
_0807E5F8 0x00000002
+3 -3
View File
@@ -18,7 +18,7 @@ SCRIPT_START script_08009B78
_0807EF80 0x0000
Wait 0x000f
_0807EF80 0x0001
TextboxNoOverlapFollowPos 0x00001009
TextboxNoOverlapFollowPos 0x1009, 0x0000
_0807E8E4_1
_0807EA94
_0807EF80 0x0000
@@ -26,7 +26,7 @@ SCRIPT_START script_08009B78
WaitForSomething2 0x00000008
_0807EB8C
_0807EF80 0x0001
TextboxNoOverlapFollowPos 0x0000100b
TextboxNoOverlapFollowPos 0x100b, 0x0000
_0807EA94
_0807EF80 0x0000
_0807E5F8 0x00000002
@@ -45,7 +45,7 @@ SCRIPT_START script_08009B78
WaitPlayerAction8
_0807E8E4_1
_0807EF80 0x0001
TextboxNoOverlapFollowPos 0x0000100c
TextboxNoOverlapFollowPos 0x100c, 0x0000
_0807EA94
_0807EF80 0x0000
_0807E5F8 0x00000004
+2 -2
View File
@@ -13,7 +13,7 @@ SCRIPT_START script_08009C68
_0807EB74
_0807EB8C
_0807EF80 0x0001
TextboxNoOverlapFollowPos 0x0000100a
TextboxNoOverlapFollowPos 0x100a, 0x0000
_0807EA94
_0807EF80 0x0000
_0807E5F8 0x00000008
@@ -22,7 +22,7 @@ SCRIPT_START script_08009C68
_0807EF80 0x0001
_0807EB8C
_0807EB44 0x0002
TextboxNoOverlapFollowPos 0x0000100d
TextboxNoOverlapFollowPos 0x100d, 0x0000
_0807EA94
_0807EF80 0x0000
_0807EDD4 0x0028, 0x0060
+1 -1
View File
@@ -21,7 +21,7 @@ script_08009F36:
StartPlayerScript script_0800A088
WaitForSomething2 0x00000002
Call sub_0806014C
TextboxNoOverlapFollowPos 0x00001f01
TextboxNoOverlapFollowPos 0x1f01, 0x0000
_0807EA94
Wait 0x001e
_0807F034 0x0065
+5 -5
View File
@@ -12,7 +12,7 @@ SCRIPT_START script_0800A1D8
WaitForSomething2 0x00000001
_0807E5F8 0x00000004
WaitForSomething2 0x00000080
TextboxNoOverlapFollowPos 0x00001659
TextboxNoOverlapFollowPos 0x1659, 0x0000
_0807EA94
Wait 0x003c
_0807E5F8 0x00000010
@@ -27,10 +27,10 @@ SCRIPT_START script_0800A1D8
_0807E5F8 0x00000004
Call sub_0807F3F8
WaitForSomething2 0x00000080
TextboxNoOverlapFollowPos 0x000e165a
TextboxNoOverlapFollowPos 0x165a, 0x000e
_0807EA94
Wait 0x003c
TextboxNoOverlapFollowPos 0x000e165b
TextboxNoOverlapFollowPos 0x165b, 0x000e
_0807EA94
_0807E5F8 0x00000002
WaitForSomething2 0x00000040
@@ -45,10 +45,10 @@ SCRIPT_START script_0800A1D8
WaitForSomething2 0x00000100
_0807E5F8 0x00000006
WaitForSomething2 0x000000c0
TextboxNoOverlapFollowPos 0x000e165c
TextboxNoOverlapFollowPos 0x165c, 0x000e
_0807EA94
SoundReq0x80100000
TextboxNoOverlapFollowPos 0x000e165d
TextboxNoOverlapFollowPos 0x165d, 0x000e
_0807EA94
_0807E5F8 0x00000006
WaitForSomething2 0x000000c0
+2 -2
View File
@@ -13,9 +13,9 @@ SCRIPT_START script_0800AB08
_0807F0B4 0x0001
SetEntityPositionRelative 0x00780088
Call sub_0807F5C0
TextboxNoOverlapFollowPos 0x00001664
TextboxNoOverlapFollowPos 0x1664, 0x0000
_0807EA94
TextboxNoOverlapFollowPos 0x000e165e
TextboxNoOverlapFollowPos 0x165e, 0x000e
_0807EA94
CallWithArg sub_0805DDEC, 0x00000001
_0807F0C8 0xffff, 0x0000
+6 -6
View File
@@ -13,15 +13,15 @@ SCRIPT_START script_0800AB6E
Wait 0x003c
_0807E5F8 0x00000002
WaitForSomething2 0x00000004
TextboxNoOverlapFollowPos 0x000e165f
TextboxNoOverlapFollowPos 0x165f, 0x000e
_0807EA94
StartPlayerScript script_0800ACBC
WaitForSomething2 0x00000001
TextboxNoOverlapFollowPos 0x000e1660
TextboxNoOverlapFollowPos 0x1660, 0x000e
_0807EA94
_0807E5F8 0x00000002
WaitForSomething2 0x00000004
TextboxNoOverlapFollowPos 0x000e1661
TextboxNoOverlapFollowPos 0x1661, 0x000e
_0807EA94
_0807E5F8 0x00000008
_0807E5F8 0x00000002
@@ -32,9 +32,9 @@ SCRIPT_START script_0800AB6E
StartPlayerScript script_0800ACE0
WaitForSomething2 0x00000001
Wait 0x003c
TextboxNoOverlapFollowPos 0x000e1662
TextboxNoOverlapFollowPos 0x1662, 0x000e
_0807EA94
TextboxNoOverlapFollowPos 0x000e1663
TextboxNoOverlapFollowPos 0x1663, 0x000e
_0807EA94
SetEntityPosition 0x0000, 0xffe0
Call sub_0807F5C0
@@ -45,7 +45,7 @@ SCRIPT_START script_0800AB6E
StartPlayerScript script_0800AD54
WaitForSomething2 0x00000001
Wait 0x003c
TextboxNoOverlapFollowPos 0x000e1665
TextboxNoOverlapFollowPos 0x1665, 0x000e
_0807EA94
_0807E5F8 0x00000002
WaitForSomething2 0x00000004
+5 -5
View File
@@ -222,7 +222,7 @@ script_0800D032:
_0807EB74
_0807E914 0x00000000
Call sub_0806C028
TextboxNoOverlapFollowPos 0x0002125c
TextboxNoOverlapFollowPos 0x125c, 0x0002
_0807EA94
StartPlayerScript script_0800D1B4
WaitForSomething2 0x00000008
@@ -233,7 +233,7 @@ script_0800D032:
_0807E5F8 0x00000020
StartPlayerScript script_0800D1E0
WaitForSomething2 0x00000008
TextboxNoOverlapFollowPos 0x0002125d
TextboxNoOverlapFollowPos 0x125d, 0x0002
Jump script_0800D17C
script_0800D098:
CheckLocalFlag 0x007e
@@ -250,7 +250,7 @@ script_0800D0A8:
_0807EB74
_0807E914 0x00000000
Call sub_0806C028
TextboxNoOverlapFollowPos 0x0002123d
TextboxNoOverlapFollowPos 0x123d, 0x0002
_0807EA94
StartPlayerScript script_0800D1B4
WaitForSomething2 0x00000008
@@ -265,7 +265,7 @@ script_0800D108:
SoundReq 0x00f8
_0807E5F8 0x00000010
SetLocalFlag 0x007e
TextboxNoOverlapFollowPos 0x0002123e
TextboxNoOverlapFollowPos 0x123e, 0x0002
_0807EA94
Wait 0x000f
_0807E930 0x0009
@@ -274,7 +274,7 @@ script_0800D108:
_0807E5F8 0x00000002
WaitForSomething2 0x00000004
Wait 0x001e
TextboxNoOverlapFollowPos 0x0002123f
TextboxNoOverlapFollowPos 0x123f, 0x0002
_0807EA94
_0807E5F8 0x00000001
WaitForSomething2 0x00000004
+2 -2
View File
@@ -16,11 +16,11 @@ script_0800DA64:
Call sub_0807F5C0
_0807E5F8 0x00000001
WaitForSomething2 0x00000002
TextboxNoOverlapFollowPos 0x0002162d
TextboxNoOverlapFollowPos 0x162d, 0x0002
_0807EA94
_0807E5F8 0x00000001
Wait 0x001e
TextboxNoOverlapFollowPos 0x0002162e
TextboxNoOverlapFollowPos 0x162e, 0x0002
_0807EA94
_0807E8E4_0
CallWithArg sub_0807F75C, 0x00780138
+1 -1
View File
@@ -34,7 +34,7 @@ script_0800DBCA:
_0807E5F8 0x00000001
StartPlayerScript script_0800DE00
WaitForSomething2 0x00000006
TextboxNoOverlapFollowPos 0x00021643
TextboxNoOverlapFollowPos 0x1643, 0x0002
_0807EA94
_0807EB28 0x1645
_0807EA94
+1 -1
View File
@@ -19,7 +19,7 @@ SCRIPT_START script_0800DF24
Call sub_08066C94
Wait 0x00e9
_0807EF80 0x0007
TextboxNoOverlapFollowPos 0x0002162f
TextboxNoOverlapFollowPos 0x162f, 0x0002
_0807EA94
SoundReq2 0x002f
_0807EF80 0x0019
+2 -2
View File
@@ -4,7 +4,7 @@ SCRIPT_START script_0800DFE4
_0807E864
StopScript
SoundReq0x80100000
TextboxNoOverlapFollowPos 0x00021632
TextboxNoOverlapFollowPos 0x1632, 0x0002
_0807EA94
SetRoomFlag 0x0003
script_0800DFFE:
@@ -19,7 +19,7 @@ script_0800E012:
_0807E864
Call sub_0807DF28
SetLocalFlag 0x007b
TextboxNoOverlapFollowPos 0x000c1639
TextboxNoOverlapFollowPos 0x1639, 0x000c
_0807EA94
Wait 0x0096
SoundReq 0x00f6
+3 -3
View File
@@ -58,18 +58,18 @@ script_0800F09A:
WaitForSomething2 0x00000001
_0807E5F8 0x0000001e
WaitForSomething2 0x00000040
TextboxNoOverlapFollowPos 0x000c1201
TextboxNoOverlapFollowPos 0x1201, 0x000c
_0807EA94
WaitForSomething2 0x000003c0
_0807E8E4_0
TextboxNoOverlapFollowPos 0x000c1202
TextboxNoOverlapFollowPos 0x1202, 0x000c
_0807EA94
_0807F034 0x0067
WaitPlayerAction8
_0807E8E4_0
_0807E5F8 0x00000002
WaitForSomething2 0x00000040
TextboxNoOverlapFollowPos 0x000c1203
TextboxNoOverlapFollowPos 0x1203, 0x000c
_0807EA94
_0807E5F8 0x00000002
Call sub_0807DF50
+5 -5
View File
@@ -32,7 +32,7 @@ script_0800F1E6:
_0807E930 0x0008
_0807EF80 0x0004
Wait 0x003c
TextboxNoOverlapFollowPos 0x000c1206
TextboxNoOverlapFollowPos 0x1206, 0x000c
_0807EA94
StartPlayerScript script_0800F33C
WaitForSomething2 0x00000400
@@ -48,7 +48,7 @@ script_0800F22A:
_0807E930 0x0008
_0807EF80 0x0004
Wait 0x003c
TextboxNoOverlapFollowPos 0x000c1206
TextboxNoOverlapFollowPos 0x1206, 0x000c
_0807EA94
StartPlayerScript script_0800F354
WaitForSomething2 0x00000400
@@ -64,7 +64,7 @@ script_0800F26A:
_0807E930 0x0008
_0807EF80 0x0004
Wait 0x003c
TextboxNoOverlapFollowPos 0x000c1206
TextboxNoOverlapFollowPos 0x1206, 0x000c
_0807EA94
StartPlayerScript script_0800F36C
WaitForSomething2 0x00000400
@@ -80,7 +80,7 @@ script_0800F2AA:
_0807E930 0x0008
_0807EF80 0x0004
Wait 0x003c
TextboxNoOverlapFollowPos 0x000c1206
TextboxNoOverlapFollowPos 0x1206, 0x000c
_0807EA94
StartPlayerScript script_0800F384
WaitForSomething2 0x00000400
@@ -97,7 +97,7 @@ script_0800F2EA:
_0807E864
_0807EB74
_0807E930 0x0008
TextboxNoOverlapFollowPos 0x000c1208
TextboxNoOverlapFollowPos 0x1208, 0x000c
_0807EA94
_0807E878
Jump script_0800F1E6
+16 -16
View File
@@ -27,7 +27,7 @@ script_0800F72C:
Call sub_0807F5C0
WaitForSomething2 0x00000001
WaitForSomething2 0x00000004
TextboxNoOverlapFollowPos 0x00002501
TextboxNoOverlapFollowPos 0x2501, 0x0000
_0807EA94
_0807E5F8 0x00000002
WaitForSomething2 0x00000004
@@ -43,7 +43,7 @@ script_0800F72C:
WaitForSomething2 0x00000001
_0807E5F8 0x00000002
WaitForSomething2 0x00000004
TextboxNoOverlapFollowPos 0x000e2503
TextboxNoOverlapFollowPos 0x2503, 0x000e
_0807EA94
_0807E5F8 0x00000002
WaitForSomething2 0x00000004
@@ -56,7 +56,7 @@ script_0800F72C:
WaitForSomething2 0x00000001
_0807E5F8 0x00000002
WaitForSomething2 0x00000004
TextboxNoOverlapFollowPos 0x000e2504
TextboxNoOverlapFollowPos 0x2504, 0x000e
_0807EA94
_0807E5F8 0x00000002
WaitForSomething2 0x00000004
@@ -69,7 +69,7 @@ script_0800F72C:
WaitForSomething2 0x00000001
_0807E5F8 0x00000002
WaitForSomething2 0x00000004
TextboxNoOverlapFollowPos 0x000e2505
TextboxNoOverlapFollowPos 0x2505, 0x000e
_0807EA94
_0807E5F8 0x00000002
WaitForSomething2 0x00000004
@@ -84,7 +84,7 @@ script_0800F72C:
_0807E8E4_0
Call sub_0807F3F8
Wait 0x003c
TextboxNoOverlapFollowPos 0x000e1021
TextboxNoOverlapFollowPos 0x1021, 0x000e
_0807EA94
StartPlayerScript script_0800FAE4
SetEntityPositionRelative 0x025800f0
@@ -93,44 +93,44 @@ script_0800F72C:
Wait 0x001e
Call sub_08063C2C
WaitForSomething2 0x00000001
TextboxNoOverlapFollowPos 0x000e1022
TextboxNoOverlapFollowPos 0x1022, 0x000e
_0807EA94
_0807E8E4_0
Call sub_08063C14
Call sub_08094CDC
Wait 0x001e
TextboxNoOverlapFollowPos 0x000e1023
TextboxNoOverlapFollowPos 0x1023, 0x000e
_0807EA94
Call sub_08063C14
Call sub_08094DD8
Wait 0x001e
TextboxNoOverlapFollowPos 0x000e1024
TextboxNoOverlapFollowPos 0x1024, 0x000e
_0807EA94
Call sub_08063C14
Call sub_08094D34
Wait 0x001e
TextboxNoOverlapFollowPos 0x000e1025
TextboxNoOverlapFollowPos 0x1025, 0x000e
_0807EA94
Call sub_08063C5C
TextboxNoOverlapFollowPos 0x000e1026
TextboxNoOverlapFollowPos 0x1026, 0x000e
_0807EA94
_0807E5F8 0x00000002
WaitForSomething2 0x00000004
_0807E8E4_1
Call sub_08063C2C
TextboxNoOverlapFollowPos 0x00001027
TextboxNoOverlapFollowPos 0x1027, 0x0000
_0807EA94
Call sub_08063C74
Wait 0x003c
Call sub_08063C14
_0807E8E4_0
TextboxNoOverlapFollowPos 0x000e1028
TextboxNoOverlapFollowPos 0x1028, 0x000e
_0807EA94
_0807E8E4_1
TextboxNoOverlapFollowPos 0x00001029
TextboxNoOverlapFollowPos 0x1029, 0x0000
_0807EA94
_0807E8E4_0
TextboxNoOverlapFollowPos 0x000e102a
TextboxNoOverlapFollowPos 0x102a, 0x000e
_0807EA94
Call sub_08063C14
Call sub_08094D70
@@ -145,7 +145,7 @@ script_0800F72C:
_0807E8E4_1
Call sub_0807F3F8
Wait 0x003c
TextboxNoOverlapFollowPos 0x0000102b
TextboxNoOverlapFollowPos 0x102b, 0x0000
_0807EA94
_0807F034 0x000d
WaitPlayerAction8
@@ -158,7 +158,7 @@ script_0800F72C:
Wait 0x00b7
_0807E914 0x00000000
Call sub_0807F5B0
TextboxNoOverlapFollowPos 0x0000102c
TextboxNoOverlapFollowPos 0x102c, 0x0000
_0807EA94
CallWithArg sub_0807F29C, 0x00000000
Call sub_0806DC58
+2 -2
View File
@@ -9,7 +9,7 @@ script_0800FD1A:
JumpIf script_0800FD5C
_0807E864
Call sub_0807F9A4
TextboxNoOverlapFollowPos 0x00002506
TextboxNoOverlapFollowPos 0x2506, 0x0000
_0807EA94
StartPlayerScript script_0800FD80
WaitForSomething2 0x00000008
@@ -21,7 +21,7 @@ script_0800FD50:
script_0800FD5C:
_0807E864
Call sub_0807F9A4
TextboxNoOverlapFollowPos 0x0000106c
TextboxNoOverlapFollowPos 0x106c, 0x0000
_0807EA94
StartPlayerScript script_0800FD80
WaitForSomething2 0x00000008
+2 -2
View File
@@ -52,7 +52,7 @@ script_0801015A:
_0807EB74
CheckRoomFlag 0x0001
JumpIf script_0801019E
TextboxNoOverlapFollowPos 0x00003001
TextboxNoOverlapFollowPos 0x3001, 0x0000
_0807EA94
_0807E3E8
JumpIfNot script_080101A6
@@ -77,7 +77,7 @@ script_080101A6:
Call sub_080A1270
_0807E864
Call sub_0807DF28
TextboxNoOverlapFollowPos 0x00073004
TextboxNoOverlapFollowPos 0x3004, 0x0007
_0807EA94
SoundReq0x80100000
_0807E778 0x0004
+7 -7
View File
@@ -23,15 +23,15 @@ script_08010BCA:
StartPlayerScript script_08011074
WaitForSomething2 0x00000400
_0807F078 0x0034, 0x0002
TextboxNoOverlapFollowPos 0x000c1036
TextboxNoOverlapFollowPos 0x1036, 0x000c
_0807EA94
_0807E5F8 0x00000010
WaitForSomething2 0x00000020
TextboxNoOverlapFollowPos 0x00021037
TextboxNoOverlapFollowPos 0x1037, 0x0002
_0807EA94
_0807E5F8 0x00000010
WaitForSomething2 0x00000020
TextboxNoOverlapFollowPos 0x000c1038
TextboxNoOverlapFollowPos 0x1038, 0x000c
_0807EA94
SoundReq0x80100000
_0807E778 0x0004
@@ -68,7 +68,7 @@ script_08010BCA:
_0807E8E4_1
_0807E5F8 0x00000004
WaitForSomething2 0x00000008
TextboxNoOverlapFollowPos 0x000c1039
TextboxNoOverlapFollowPos 0x1039, 0x000c
_0807EA94
SoundReq2 0x0001
_0807E8E4_2
@@ -81,7 +81,7 @@ script_08010BCA:
Wait 0x012c
_0807E5F8 0x00000004
WaitForSomething2 0x00000008
TextboxNoOverlapFollowPos 0x000c103a
TextboxNoOverlapFollowPos 0x103a, 0x000c
_0807EA94
SetEntityPositionRelative 0x01c001f8
_0807F0B4 0x0004
@@ -99,7 +99,7 @@ script_08010BCA:
SoundReq 0x009b
_0807E5F8 0x00000100
WaitForSomething2 0x00000200
TextboxNoOverlapFollowPos 0x00001043
TextboxNoOverlapFollowPos 0x1043, 0x0000
_0807EA94
SoundReq2 0x000d
_0807E5F8 0x00000100
@@ -115,7 +115,7 @@ script_08010BCA:
WaitForSomething2 0x00005000
_0807E5F8 0x00028000
WaitForSomething2 0x00050000
TextboxNoOverlapFollowPos 0x00001044
TextboxNoOverlapFollowPos 0x1044, 0x0000
_0807EA94
SetEntityPositionRelative 0x009801f8
SoundReq0x80100000
+2 -2
View File
@@ -47,9 +47,9 @@ SCRIPT_START script_08010E5A
_0807E5F8 0x00000100
WaitForSomething2 0x00000020
WaitForSomething2 0x00000200
TextboxNoOverlapFollowPos 0x000c1045
TextboxNoOverlapFollowPos 0x1045, 0x000c
_0807EA94
TextboxNoOverlapFollowPos 0x00001046
TextboxNoOverlapFollowPos 0x1046, 0x0000
_0807EA94
CallWithArg sub_0805DDEC, 0x00000002
_0807F0C8 0xffff, 0x0000
+3 -3
View File
@@ -4,7 +4,7 @@ SCRIPT_START script_08010F84
WaitForSomething2 0x00000200
StartPlayerScript script_080110BC
WaitForSomething2 0x00000400
TextboxNoOverlapFollowPos 0x00001047
TextboxNoOverlapFollowPos 0x1047, 0x0000
_0807EA94
Call sub_0806DC3C
Call sub_080791BC
@@ -28,11 +28,11 @@ SCRIPT_START script_08010F84
WaitForSomething2 0x00000020
SoundReq0x80100000
Wait 0x003c
TextboxNoOverlapFollowPos 0x0000104a
TextboxNoOverlapFollowPos 0x104a, 0x0000
_0807EA94
_0807E5F8 0x00000100
WaitForSomething2 0x00000200
TextboxNoOverlapFollowPos 0x00001049
TextboxNoOverlapFollowPos 0x1049, 0x0000
_0807EA94
SetEntityPositionRelative 0x009801f8
Wait 0x0078
+1 -1
View File
@@ -126,7 +126,7 @@ script_08011AE4:
Call sub_0807F9A4
Call sub_0807DF28
script_08011AFA:
TextboxNoOverlapFollowPos 0x00071321
TextboxNoOverlapFollowPos 0x1321, 0x0007
_0807EA94
SetLocalFlag 0x0010
CallWithArg sub_0806DA1C, 0x00000003
+1 -1
View File
@@ -1,7 +1,7 @@
SCRIPT_START script_08011B20
_0807E864
Call sub_0807DF28
TextboxNoOverlapFollowPos 0x000c1320
TextboxNoOverlapFollowPos 0x1320, 0x000c
_0807EA94
_0807E878
Call sub_0807DF50
+1 -1
View File
@@ -35,7 +35,7 @@ script_0801248A:
Call sub_0807F9A4
Call sub_0807DF28
StartPlayerScript script_08012AB0
TextboxNoOverlapFollowPos 0x00071101
TextboxNoOverlapFollowPos 0x1101, 0x0007
_0807EA94
CameraTargetPlayer
_0807E778 0x0004
+19 -19
View File
@@ -7,14 +7,14 @@ SCRIPT_START script_080126FC
WaitForSomething2 0x00000004
_0807E930 0x0022
Call sub_0807F3C8
TextboxNoOverlapFollowPos 0x000c1102
TextboxNoOverlapFollowPos 0x1102, 0x000c
_0807EA94
_0807E930 0x0020
_0807E5F8 0x00000008
WaitForSomething2 0x00000004
_0807E930 0x0021
Call sub_0807F3C8
TextboxNoOverlapFollowPos 0x000c1103
TextboxNoOverlapFollowPos 0x1103, 0x000c
_0807EA94
_0807E930 0x0020
_0807E5F8 0x00000008
@@ -25,29 +25,29 @@ SCRIPT_START script_080126FC
WaitForSomething2 0x00000004
_0807EF80 0x0011
_0807E930 0x001c
TextboxNoOverlapFollowPos 0x000c1105
TextboxNoOverlapFollowPos 0x1105, 0x000c
_0807EA94
_0807E930 0x0020
_0807E5F8 0x00000008
WaitForSomething2 0x00000004
_0807E930 0x0022
Call sub_0807F3C8
TextboxNoOverlapFollowPos 0x000c1106
TextboxNoOverlapFollowPos 0x1106, 0x000c
_0807EA94
_0807E930 0x001c
Call sub_0806D96C
TextboxNoOverlapFollowPos 0x000c1107
TextboxNoOverlapFollowPos 0x1107, 0x000c
_0807EA94
_0807E930 0x0020
_0807E5F8 0x00000008
WaitForSomething2 0x00000004
_0807E930 0x0021
Call sub_0807F3C8
TextboxNoOverlapFollowPos 0x000c1108
TextboxNoOverlapFollowPos 0x1108, 0x000c
_0807EA94
_0807E930 0x001c
Call sub_0806D96C
TextboxNoOverlapFollowPos 0x000c1109
TextboxNoOverlapFollowPos 0x1109, 0x000c
_0807EA94
_0807E930 0x0020
_0807EF80 0x000a
@@ -64,7 +64,7 @@ script_080127F2:
_0807E864
Call sub_0806D944
_0807E930 0x0010
TextboxNoOverlapFollowPos 0x000c1114
TextboxNoOverlapFollowPos 0x1114, 0x000c
_0807EA94
_0807E930 0x0020
_0807E878
@@ -82,13 +82,13 @@ script_08012824:
WaitForSomething2 0x00000004
Call sub_0806D944
_0807E930 0x0010
TextboxNoOverlapFollowPos 0x000c110a
TextboxNoOverlapFollowPos 0x110a, 0x000c
_0807EA94
_0807E930 0x001f
_0807E5F8 0x00000008
WaitForSomething2 0x00000004
_0807E930 0x0010
TextboxNoOverlapFollowPos 0x000c110b
TextboxNoOverlapFollowPos 0x110b, 0x000c
_0807EA94
_0807E930 0x001f
_0807E5F8 0x00000008
@@ -96,19 +96,19 @@ script_08012824:
_0807EF80 0x0004
Wait 0x003c
_0807E930 0x0010
TextboxNoOverlapFollowPos 0x000c110c
TextboxNoOverlapFollowPos 0x110c, 0x000c
_0807EA94
_0807E930 0x001f
_0807E5F8 0x00000008
WaitForSomething2 0x00000004
_0807E930 0x0010
TextboxNoOverlapFollowPos 0x000c110d
TextboxNoOverlapFollowPos 0x110d, 0x000c
_0807EA94
_0807E930 0x001f
_0807E5F8 0x00000008
WaitForSomething2 0x00000004
_0807E930 0x0010
TextboxNoOverlapFollowPos 0x000c110e
TextboxNoOverlapFollowPos 0x110e, 0x000c
_0807EA94
_0807E930 0x0018
SetEntityNonPlanarMovement 0x0080
@@ -131,7 +131,7 @@ script_08012920:
_0807E864
_0807E930 0x0010
StopScript
TextboxNoOverlapFollowPos 0x000c1115
TextboxNoOverlapFollowPos 0x1115, 0x000c
_0807EA94
_0807E930 0x0018
_0807E878
@@ -144,7 +144,7 @@ script_0801293A:
_0807EB8C
Call sub_0806D944
_0807E930 0x0010
TextboxNoOverlapFollowPos 0x000c110f
TextboxNoOverlapFollowPos 0x110f, 0x000c
_0807E930 0x0018
SetEntityNonPlanarMovement 0x0080
Call sub_0806D908
@@ -167,7 +167,7 @@ script_080129A0:
_0807E864
_0807E930 0x0010
StopScript
TextboxNoOverlapFollowPos 0x000c1115
TextboxNoOverlapFollowPos 0x1115, 0x000c
_0807EA94
_0807E930 0x0018
_0807E878
@@ -180,7 +180,7 @@ script_080129BA:
_0807EB8C
Call sub_0806D944
_0807E930 0x0010
TextboxNoOverlapFollowPos 0x000c1110
TextboxNoOverlapFollowPos 0x1110, 0x000c
_0807E930 0x0018
SetEntityNonPlanarMovement 0x0080
Call sub_0806D908
@@ -204,7 +204,7 @@ script_08012A24:
_0807E864
_0807E930 0x0010
StopScript
TextboxNoOverlapFollowPos 0x000c1115
TextboxNoOverlapFollowPos 0x1115, 0x000c
_0807EA94
_0807E930 0x0018
_0807E878
@@ -219,7 +219,7 @@ script_08012A3E:
_0807EB8C
Call sub_0806D944
_0807E930 0x0010
TextboxNoOverlapFollowPos 0x000c1111
TextboxNoOverlapFollowPos 0x1111, 0x000c
_0807E930 0x0018
SetEntityNonPlanarMovement 0x0080
Call sub_0806D8A0
+3 -3
View File
@@ -32,7 +32,7 @@ script_080131AC:
_0807E864
Call sub_0807DF28
WaitFor_2
TextboxNoOverlapFollowPos 0x000c1602
TextboxNoOverlapFollowPos 0x1602, 0x000c
_0807EA94
_0807E5F8 0x00000008
WaitForSomething2 0x00000010
@@ -46,7 +46,7 @@ script_080131AC:
StartPlayerScript script_08013378
_0807E5F8 0x00000020
WaitForSomething2 0x00000042
TextboxNoOverlapFollowPos 0x000c1603
TextboxNoOverlapFollowPos 0x1603, 0x000c
_0807EA94
_0807E5F8 0x00000020
WaitForSomething2 0x00000040
@@ -59,7 +59,7 @@ script_080131AC:
Wait 0x003c
CameraTargetPlayer
Call sub_0807F5C0
TextboxNoOverlapFollowPos 0x00071604
TextboxNoOverlapFollowPos 0x1604, 0x0007
_0807EA94
_0807E788 0xffffffff
_0807E778 0x0004
+1 -1
View File
@@ -66,7 +66,7 @@ script_080134F8:
DoFade6
WaitFor_2
SoundReq 0x0109
TextboxNoOverlapFollowPos 0x000c0503
TextboxNoOverlapFollowPos 0x0503, 0x000c
_0807EA94
_0807E5F8 0x00040000
CallWithArg sub_0805DDEC, 0x00000001
+1 -1
View File
@@ -69,7 +69,7 @@ script_0801373C:
DoFade6
WaitFor_2
SoundReq 0x0109
TextboxNoOverlapFollowPos 0x000c0504
TextboxNoOverlapFollowPos 0x0504, 0x000c
_0807EA94
_0807E5F8 0x00040000
SetLocalFlag 0x007b
+1 -1
View File
@@ -74,7 +74,7 @@ script_080138D0:
DoFade6
WaitFor_2
SoundReq 0x0109
TextboxNoOverlapFollowPos 0x000c0505
TextboxNoOverlapFollowPos 0x0505, 0x000c
_0807EA94
_0807E5F8 0x00040000
_0807F0B4 0x0002
+1 -1
View File
@@ -23,7 +23,7 @@ script_08014298:
CheckEntityInteractType
JumpIfNot script_08014298
_0807E864
TextboxNoOverlapFollowPos 0x000c0647
TextboxNoOverlapFollowPos 0x0647, 0x000c
_0807EA94
_0807E878
Jump script_08014298
+1 -1
View File
@@ -11,7 +11,7 @@ script_080145C2:
ClearRoomFlag 0x0005
Wait 0x000c
_0807EB8C
TextboxNoOverlapFollowPos 0x000c432e
TextboxNoOverlapFollowPos 0x432e, 0x000c
_0807EA94
_0807E878
Jump script_080145C2
+7 -7
View File
@@ -36,7 +36,7 @@ script_0801463A:
JumpIf script_080146A0
_0807E864
_0807EB8C
TextboxNoOverlapFollowPos 0x000c432b
TextboxNoOverlapFollowPos 0x432b, 0x000c
Jump script_080147CE
script_08014672:
Call sub_08088658
@@ -59,7 +59,7 @@ script_080146A0:
_0807E930 0x0002
CheckGlobalFlag 0x0059
JumpIfNot script_080146C6
TextboxNoOverlapFollowPos 0x000c432f
TextboxNoOverlapFollowPos 0x432f, 0x000c
Jump script_080147CE
script_080146C6:
CheckRoomFlag 0x0004
@@ -74,16 +74,16 @@ script_080146C6:
SetRoomFlag 0x0009
Jump script_0801473C
script_080146F4:
TextboxNoOverlapFollowPos 0x000c431e
TextboxNoOverlapFollowPos 0x431e, 0x000c
Jump script_080147CE
script_080146FE:
SetRoomFlag 0x0009
SetLocalFlag 0x005c
TextboxNoOverlapFollowPos 0x000c4305
TextboxNoOverlapFollowPos 0x4305, 0x000c
_0807EA94
_0807E3BC 0x0001
JumpIfNot script_080147C4
TextboxNoOverlapFollowPos 0x000c4306
TextboxNoOverlapFollowPos 0x4306, 0x000c
Jump script_0801473C
script_08014720:
SetRoomFlag 0x0009
@@ -107,7 +107,7 @@ script_08014754:
ClearRoomFlag 0x0003
_0807EA94
SetRoomFlag 0x0004
TextboxNoOverlapFollowPos 0x000c431e
TextboxNoOverlapFollowPos 0x431e, 0x000c
Jump script_080147CE
script_08014770:
SetRoomFlag 0x0009
@@ -137,7 +137,7 @@ script_080147B4:
Jump script_0801478A
script_080147C4:
SetRoomFlag 0x0009
TextboxNoOverlapFollowPos 0x000c4307
TextboxNoOverlapFollowPos 0x4307, 0x000c
script_080147CE:
_0807EA94
Wait 0x0004
+3 -3
View File
@@ -9,7 +9,7 @@ SCRIPT_START script_08014804
Wait 0x0010
CheckLocalFlag 0x0093
JumpIf script_080148B6
TextboxNoOverlapFollowPos 0x000c4215
TextboxNoOverlapFollowPos 0x4215, 0x000c
_0807E878
script_0801482E:
TestBit 0x00000001
@@ -22,7 +22,7 @@ script_0801482E:
_0807E930 0x0008
Wait 0x0020
_0807E930 0x0002
TextboxNoOverlapFollowPos 0x000c4215
TextboxNoOverlapFollowPos 0x4215, 0x000c
_0807E878
Jump script_0801482E
script_08014862:
@@ -49,7 +49,7 @@ script_0801488E:
Wait 0x0020
_0807E930 0x0002
script_080148B6:
TextboxNoOverlapFollowPos 0x000c4216
TextboxNoOverlapFollowPos 0x4216, 0x000c
_0807E878
Jump script_0801488E
script_080148C2:
+1 -1
View File
@@ -11,7 +11,7 @@ SCRIPT_START script_08014CDC
WaitForSomething2 0x00000001
Call sub_08066E08
_0807E864
TextboxNoOverlapFollowPos 0x000c1010
TextboxNoOverlapFollowPos 0x1010, 0x000c
_0807EA94
_0807E5F8 0x00000002
script_08014D1E:
+3 -3
View File
@@ -143,7 +143,7 @@ script_08014FCC:
CameraTargetEntity
StartPlayerScript script_080152B4
WaitForSomething2 0x00000001
TextboxNoOverlapFollowPos 0x00021301
TextboxNoOverlapFollowPos 0x1301, 0x0002
_0807EA94
Call sub_0807F3F8
Wait 0x003c
@@ -154,11 +154,11 @@ script_08014FCC:
SoundReq2 0x000d
_0807EB28 0x1302
_0807EA94
TextboxNoOverlapFollowPos 0x00021303
TextboxNoOverlapFollowPos 0x1303, 0x0002
_0807EA94
_0807EB28 0x1304
_0807EA94
TextboxNoOverlapFollowPos 0x00021305
TextboxNoOverlapFollowPos 0x1305, 0x0002
_0807EA94
_0807E5F8 0x00000002
WaitForSomething2 0x00000004
+1 -1
View File
@@ -7,7 +7,7 @@ SCRIPT_START script_08015390
Call sub_0806D944
WaitForSomething2 0x00000008
_0807E930 0x0010
TextboxNoOverlapFollowPos 0x000c1314
TextboxNoOverlapFollowPos 0x1314, 0x000c
_0807EA94
_0807E930 0x0018
Call sub_0806D8A0
+5 -5
View File
@@ -17,20 +17,20 @@ SCRIPT_START script_080153EC
WaitForSomething2 0x00001100
_0807F0B4 0x0004
SetEntityPositionRelative 0x00900078
TextboxNoOverlapFollowPos 0x00021330
TextboxNoOverlapFollowPos 0x1330, 0x0002
_0807EA94
_0807E5F8 0x00008000
WaitForSomething2 0x00010000
_0807E5F8 0x00000880
WaitForSomething2 0x00001000
Wait 0x003c
TextboxNoOverlapFollowPos 0x0002130d
TextboxNoOverlapFollowPos 0x130d, 0x0002
_0807EA94
TextboxNoOverlapFollowPos 0x000c130e
TextboxNoOverlapFollowPos 0x130e, 0x000c
_0807EA94
TextboxNoOverlapFollowPos 0x0002130f
TextboxNoOverlapFollowPos 0x130f, 0x0002
_0807EA94
TextboxNoOverlapFollowPos 0x000c1310
TextboxNoOverlapFollowPos 0x1310, 0x000c
_0807EA94
CallWithArg sub_0805DDEC, 0x00000001
_0807F0C8 0xffff, 0x0000
+2 -2
View File
@@ -5,7 +5,7 @@ SCRIPT_START script_0801548E
CallWithArg sub_0807FB28, 0x00000003
_0807E5F8 0x00048000
WaitForSomething2 0x00090000
TextboxNoOverlapFollowPos 0x00021311
TextboxNoOverlapFollowPos 0x1311, 0x0002
_0807EA94
_0807E5F8 0x00008000
WaitForSomething2 0x00010000
@@ -13,7 +13,7 @@ SCRIPT_START script_0801548E
WaitForSomething2 0x00010000
CallWithArg sub_0805DE18, 0x00000001
_0807F0C8 0x0000, 0x0000
TextboxNoOverlapFollowPos 0x000c1312
TextboxNoOverlapFollowPos 0x1312, 0x000c
_0807EA94
_0807E5F8 0x00000800
WaitForSomething2 0x00001000
+3 -3
View File
@@ -33,7 +33,7 @@ script_080157DA:
WaitForSomething2 0x00000010
_0807E5F8 0x00000001
WaitForSomething2 0x00000002
TextboxNoOverlapFollowPos 0x00021066
TextboxNoOverlapFollowPos 0x1066, 0x0002
_0807EA94
_0807E5F8 0x00000001
WaitForSomething2 0x00000002
@@ -55,12 +55,12 @@ script_08015888:
CameraTargetEntity
StartPlayerScript script_08015938
WaitForSomething2 0x00000010
TextboxNoOverlapFollowPos 0x000c106a
TextboxNoOverlapFollowPos 0x106a, 0x000c
_0807EA94
_0807E5F8 0x00000008
Wait 0x0078
_0807E8E4_2
TextboxNoOverlapFollowPos 0x00021068
TextboxNoOverlapFollowPos 0x1068, 0x0002
_0807EA94
_0807E5F8 0x00000001
WaitForSomething2 0x00000002
+2 -2
View File
@@ -15,7 +15,7 @@ SCRIPT_START script_08015958
_0807EDD4 0x01f8, 0x02f8
_0807EB44 0x0004
_0807EF80 0x0000
TextboxNoOverlapFollowPos 0x00021011
TextboxNoOverlapFollowPos 0x1011, 0x0002
_0807EA94
_0807EDD4 0x01f8, 0x0268
SetEntityPositionRelative 0x02180248
@@ -57,7 +57,7 @@ script_08015A32:
CheckEntityInteractType
JumpIfNot script_08015A32
StopScript
TextboxNoOverlapFollowPos 0x00021067
TextboxNoOverlapFollowPos 0x1067, 0x0002
_0807EA94
Jump script_08015A32
script_08015A54:
+1 -1
View File
@@ -10,7 +10,7 @@ script_08015B34:
_0807E864
Call sub_0807F9A4
Call sub_0807DF28
TextboxNoOverlapFollowPos 0x00022506
TextboxNoOverlapFollowPos 0x2506, 0x0002
_0807EA94
StartPlayerScript script_08015B84
WaitForSomething2 0x00000004
+1 -1
View File
@@ -8,7 +8,7 @@ SCRIPT_START script_08015C7C
_0807EF80 0x0000
CallWithArg sub_0807F238, 0x000003c5
Call sub_0807F304
TextboxNoOverlapFollowPos 0x000c1318
TextboxNoOverlapFollowPos 0x1318, 0x000c
_0807EA94
CallWithArg sub_0807F238, 0x000003c9
Call sub_0807F304
+51 -52
View File
@@ -1,19 +1,20 @@
from utils import barray_to_u16_hex, barray_to_u32_hex, barray_to_s16
import struct
# A list of all the commands, their correspondingScriptCommand_ functions and what kind of parameters they take
commands = [
{'fun': 'ScriptCommandNop', 'params': ''},
{'fun': 'ScriptCommand_StartScript', 'params': '', 'name': 'start executing scripts'},
{'fun': 'ScriptCommand_StopScript', 'params': '', 'name': 'stop executing scripts'},
{'fun': 'ScriptCommand_Jump', 'params': 'j', 'name': 'jump by offset'},
{'fun': 'ScriptCommand_JumpIf', 'params': 'j', 'name': 'jump if'},
{'fun': 'ScriptCommand_JumpIfNot', 'params': 'j', 'name': 'jump if not'},
{'fun': 'ScriptCommand_StartScript', 'params': ''},
{'fun': 'ScriptCommand_StopScript', 'params': ''},
{'fun': 'ScriptCommand_Jump', 'params': 'j'},
{'fun': 'ScriptCommand_JumpIf', 'params': 'j'},
{'fun': 'ScriptCommand_JumpIfNot', 'params': 'j'},
{'fun': 'ScriptCommand_JumpSwitch', 'params': ['jj', 'jjj', 'jjjj', 'jjjjjjj', 'jjjjjjjjj']},
{'fun': 'ScriptCommand_JumpAbsolute', 'params': 'x','name': 'abs jump' },
{'fun': 'ScriptCommand_JumpAbsoluteIf', 'params': 'x', 'name': 'abs jump if'},
{'fun': 'ScriptCommand_JumpAbsoluteIfNot', 'params': 'x', 'name': 'abs jump if not'},
{'fun': 'ScriptCommand_JumpAbsolute', 'params': 'x'},
{'fun': 'ScriptCommand_JumpAbsoluteIf', 'params': 'x'},
{'fun': 'ScriptCommand_JumpAbsoluteIfNot', 'params': 'x'},
{'fun': 'ScriptCommand_JumpAbsoluteSwitch', 'params': 'xx'},
{'fun': 'ScriptCommand_Call', 'params':'p', 'name': 'Execute function via pointer'},# 'exec': ScriptCommand_Call},
{'fun': 'ScriptCommand_Call', 'params': 'p'},
{'fun': 'ScriptCommand_CallWithArg', 'params': ['pw', 'p']},
{'fun': 'ScriptCommand_LoadRoomEntityList', 'params': 'd'},
{'fun': 'ScriptCommand_TestBit', 'params': 'w'},
@@ -37,12 +38,12 @@ commands = [
{'fun': 'ScriptCommand_0807E4CC', 'params': 'w'},
{'fun': 'ScriptCommand_0807E4EC', 'params': 'w'},
{'fun': 'ScriptCommand_0807E514', 'params': 'w'},
{'fun': 'ScriptCommand_CheckPlayerFlags', 'params':'w'},
{'fun': 'ScriptCommand_CheckPlayerFlags', 'params': 'w'},
{'fun': 'ScriptCommand_0807E564', 'params': ''},
{'fun': 'ScriptCommand_EntityHasHeight', 'params': ''},
{'fun': 'ScriptCommand_ComparePlayerAction', 'params': 's'},
{'fun': 'ScriptCommand_ComparePlayerAnimationState', 'params': 's'},
{'fun': 'ScriptCommand_0807E5F8', 'params': 'w'},# 'exec': ScriptCommand_0807E5F8},
{'fun': 'ScriptCommand_0807E5F8', 'params': 'w'},
{'fun': 'ScriptCommand_0807E610', 'params': 'w'},
{'fun': 'ScriptCommand_SetLocalFlag', 'params': 's'},
{'fun': 'ScriptCommand_SetLocalFlagByOffset', 'params': 'ss'},
@@ -75,10 +76,10 @@ commands = [
{'fun': 'ScriptCommand_SetPlayerAction', 'params': 'w'},
{'fun': 'ScriptCommand_StartPlayerScript', 'params': 'x'},
{'fun': 'ScriptCommand_0807E8D4', 'params': 's'},
{'fun': 'ScriptCommand_0807E8E4_0', 'params': ''}, # duplicate
{'fun': 'ScriptCommand_0807E8E4_1', 'params': ''}, # duplicate
{'fun': 'ScriptCommand_0807E8E4_2', 'params': ''}, # duplicate
{'fun': 'ScriptCommand_0807E8E4_3', 'params': ''}, # duplicate
{'fun': 'ScriptCommand_0807E8E4_0', 'params': ''}, # duplicate
{'fun': 'ScriptCommand_0807E8E4_1', 'params': ''}, # duplicate
{'fun': 'ScriptCommand_0807E8E4_2', 'params': ''}, # duplicate
{'fun': 'ScriptCommand_0807E8E4_3', 'params': ''}, # duplicate
{'fun': 'ScriptCommand_0807E908', 'params': 's'},
{'fun': 'ScriptCommand_0807E914', 'params': 'w'},
{'fun': 'ScriptCommand_0807E924', 'params': ''},
@@ -94,7 +95,7 @@ commands = [
{'fun': 'ScriptCommand_0807EA94', 'params': ''},
{'fun': 'ScriptCommand_TextboxNoOverlapFollow', 'params': 's'},
{'fun': 'ScriptCommand_TextboxNoOverlap', 'params': 's'},
{'fun': 'ScriptCommand_TextboxNoOverlapFollowPos', 'params': ['w', 's']}, # TODO w or ss?
{'fun': 'ScriptCommand_TextboxNoOverlapFollowPos', 'params': ['ss', 's']},
{'fun': 'ScriptCommand_0807EAF0', 'params': ['ss', 'sss', 'ssss']},
{'fun': 'ScriptCommand_TextboxNoOverlapVar', 'params': ''},
{'fun': 'ScriptCommand_0807EB28', 'params': 's'},
@@ -143,9 +144,6 @@ commands = [
{'fun': 'ScriptCommand_0807F0C8', 'params': 'ss'}
]
# Functions that have already been renamed
POINTER_MAP = {
'sub_08095458': 'nullsub_527',
@@ -157,18 +155,22 @@ POINTER_MAP = {
'sub_080A2138': 'Windcrest_Unlock',
'sub_080A29BC': 'CreateDust'
}
# tries to directly reference the function this is pointing to
def get_pointer(barray):
# tries to directly reference the function this is pointing to
integers = struct.unpack('I', barray)
pointer = 'sub_' + (struct.pack('>I', integers[0]-1).hex()).upper()
if pointer in POINTER_MAP:
return POINTER_MAP[pointer]
return pointer
# Data pointers that actually point to a script location
DATA_MAP = {
'gUnk_08016384': 'script_08016384'
}
def get_data_pointer(barray):
integers = struct.unpack('I', barray)
pointer = 'gUnk_' + (struct.pack('>I', integers[0]).hex()).upper()
@@ -176,6 +178,7 @@ def get_data_pointer(barray):
return DATA_MAP[pointer]
return pointer
def get_script_pointer(barray):
integers = struct.unpack('I', barray)
return 'script_' + (struct.pack('>I', integers[0]).hex()).upper()
@@ -184,7 +187,7 @@ def get_script_pointer(barray):
def get_script_label(u32):
return hex(u32).upper().replace('0X', 'script_0')
# Collects a set of all the labels that were jumped to
used_labels = set()
def use_script_label(u32):
global used_labels
@@ -193,125 +196,121 @@ def use_script_label(u32):
return label
# definitions for parameter types
parameters = {
'': {
'length':0,
'length': 0,
'param': '',
'expr': '',
'read': lambda ctx: ''
},
's': {
's': {
'length': 1,
'param': 's',
'expr': ' .short \s',
'read': lambda ctx: barray_to_u16_hex(ctx.data[ctx.ptr+2:ctx.ptr+4])[0]
'read': lambda ctx: barray_to_u16_hex(ctx.data[ctx.ptr + 2:ctx.ptr + 4])[0]
},
'ss': {
'length': 2,
'param': 'a,b',
'expr': ' .short \\a\n .short \\b',
'read': lambda ctx: ', '.join(barray_to_u16_hex(ctx.data[ctx.ptr+2:ctx.ptr+6]))
'read': lambda ctx: ', '.join(barray_to_u16_hex(ctx.data[ctx.ptr + 2:ctx.ptr + 6]))
},
'sss': {
'length': 3,
'param': 'a,b,c',
'expr': ' .short \\a\n .short \\b\n .short \\c',
'read': lambda ctx: ', '.join(barray_to_u16_hex(ctx.data[ctx.ptr+2:ctx.ptr+8]))
'read': lambda ctx: ', '.join(barray_to_u16_hex(ctx.data[ctx.ptr + 2:ctx.ptr + 8]))
},
'ssss': {
'length': 4,
'param': 'a,b,c,d',
'expr': ' .short \\a\n .short \\b\n .short \\c\n .short \\d',
'read': lambda ctx: ', '.join(barray_to_u16_hex(ctx.data[ctx.ptr+2:ctx.ptr+10]))
'read': lambda ctx: ', '.join(barray_to_u16_hex(ctx.data[ctx.ptr + 2:ctx.ptr + 10]))
},
'w': {
'length': 2,
'param': 'w',
'expr': ' .word \w',
'read': lambda ctx: barray_to_u32_hex(ctx.data[ctx.ptr+2:ctx.ptr+6])[0]
'read': lambda ctx: barray_to_u32_hex(ctx.data[ctx.ptr + 2:ctx.ptr + 6])[0]
},
'ww': {
'length': 4,
'param': 'a,b',
'expr': ' .word \\a\n .word \\b',
'read': lambda ctx: ', '.join(barray_to_u32_hex(ctx.data[ctx.ptr+2:ctx.ptr+10]))
'read': lambda ctx: ', '.join(barray_to_u32_hex(ctx.data[ctx.ptr + 2:ctx.ptr + 10]))
},
'j': { # Relative jump target
'j': { # Relative jump target
'length': 1,
'param': 's',
'expr': '1: .short \s - 1b',
'read': lambda ctx: use_script_label(ctx.script_addr+ctx.ptr+ 2 +barray_to_s16(ctx.data[ctx.ptr+2:ctx.ptr+4]))
# hex(ctx.script_addr + barray_to_s16(ctx.data[ctx.ptr+2:ctx.ptr+4])).upper().replace('0X', 'script_0')
'read': lambda ctx: use_script_label(ctx.script_addr + ctx.ptr + 2 + barray_to_s16(ctx.data[ctx.ptr + 2:ctx.ptr + 4]))
},
'jj': {
'length': 2,
'param': 'a,b',
'expr': '1: .short \\a - 1b\n .short \\b - 1b - 2',
'read': lambda ctx: ', '.join([use_script_label(ctx.script_addr+ctx.ptr+ 2 +barray_to_s16(ctx.data[ctx.ptr+x*2+2:ctx.ptr+x*2+4]) + x*2) for x in range(0,2)])
},
'read': lambda ctx: ', '.join([use_script_label(ctx.script_addr + ctx.ptr + 2 + barray_to_s16(ctx.data[ctx.ptr + x * 2 + 2:ctx.ptr + x * 2 + 4]) + x * 2) for x in range(0, 2)])
},
'jjj': {
'length': 3,
'param': 'a,b,c',
'expr': '1: .short \\a - 1b\n .short \\b - 1b - 2\n .short \\c - 1b - 4',
'read': lambda ctx: ', '.join([use_script_label(ctx.script_addr+ctx.ptr+ 2 +barray_to_s16(ctx.data[ctx.ptr+x*2+2:ctx.ptr+x*2+4]) + x*2) for x in range(0,3)])
'read': lambda ctx: ', '.join([use_script_label(ctx.script_addr + ctx.ptr + 2 + barray_to_s16(ctx.data[ctx.ptr + x * 2 + 2:ctx.ptr + x * 2 + 4]) + x*2) for x in range(0, 3)])
},
'jjjj': {
'length': 4,
'param': 'a,b,c,d',
'expr': '1: .short \\a - 1b\n .short \\b - 1b - 2\n .short \\c - 1b - 4\n .short \\d - 1b - 6',
'read': lambda ctx: ', '.join([use_script_label(ctx.script_addr+ctx.ptr+ 2 +barray_to_s16(ctx.data[ctx.ptr+x*2+2:ctx.ptr+x*2+4]) + x*2) for x in range(0,4)])
'read': lambda ctx: ', '.join([use_script_label(ctx.script_addr + ctx.ptr + 2 + barray_to_s16(ctx.data[ctx.ptr + x * 2 + 2:ctx.ptr + x * 2 + 4]) + x*2) for x in range(0, 4)])
},
'jjjjjjj': {
'length': 7,
'param': 'a,b,c,d,e,f,g',
'expr': '1: .short \\a - 1b\n .short \\b - 1b - 2\n .short \\c - 1b - 4\n .short \\d - 1b - 6\n .short \\e - 1b - 8\n .short \\f - 1b - 10\n .short \\g - 1b - 12',
'read': lambda ctx: ', '.join([use_script_label(ctx.script_addr+ctx.ptr+ 2 +barray_to_s16(ctx.data[ctx.ptr+x*2+2:ctx.ptr+x*2+4]) + x*2) for x in range(0,7)])
},
'read': lambda ctx: ', '.join([use_script_label(ctx.script_addr + ctx.ptr + 2 + barray_to_s16(ctx.data[ctx.ptr + x * 2 + 2:ctx.ptr + x * 2 + 4]) + x*2) for x in range(0, 7)])
},
'jjjjjjjjj': {
'length': 9,
'param': 'a,b,c,d,e,f,g,h,i',
'expr': '1: .short \\a - 1b\n .short \\b - 1b - 2\n .short \\c - 1b - 4\n .short \\d - 1b - 6\n .short \\e - 1b - 8\n .short \\f - 1b - 10\n .short \\g - 1b - 12\n .short \\h - 1b - 14\n .short \\i - 1b - 16',
'read': lambda ctx: ', '.join([use_script_label(ctx.script_addr+ctx.ptr+ 2 +barray_to_s16(ctx.data[ctx.ptr+x*2+2:ctx.ptr+x*2+4]) + x*2) for x in range(0,9)])
},
'read': lambda ctx: ', '.join([use_script_label(ctx.script_addr + ctx.ptr + 2 + barray_to_s16(ctx.data[ctx.ptr + x * 2 + 2:ctx.ptr + x * 2 + 4]) + x*2) for x in range(0, 9)])
},
'p': {
'length': 2,
'param': 'w',
'expr': ' .word \w',
'read': lambda ctx: get_pointer(ctx.data[ctx.ptr+2:ctx.ptr+6])
'read': lambda ctx: get_pointer(ctx.data[ctx.ptr + 2:ctx.ptr + 6])
},
'pw': {
'length': 4,
'param': 'a,b',
'expr': ' .word \\a\n .word \\b',
'read': lambda ctx: get_pointer(ctx.data[ctx.ptr+2:ctx.ptr+6]) + ', ' + barray_to_u32_hex(ctx.data[ctx.ptr+6:ctx.ptr+14])[0]
'read': lambda ctx: get_pointer(ctx.data[ctx.ptr + 2:ctx.ptr + 6]) + ', ' + barray_to_u32_hex(ctx.data[ctx.ptr + 6:ctx.ptr + 14])[0]
},
'd': { # Data pointer
'd': { # Data pointer
'length': 2,
'param': 'w',
'expr': ' .word \w',
'read': lambda ctx: get_data_pointer(ctx.data[ctx.ptr+2:ctx.ptr+6])
'read': lambda ctx: get_data_pointer(ctx.data[ctx.ptr + 2:ctx.ptr + 6])
},
'x': { # Script pointer
'x': { # Script pointer
'length': 2,
'param': 'w',
'expr': ' .word \w',
'read': lambda ctx: get_script_pointer(ctx.data[ctx.ptr+2:ctx.ptr+6])
'read': lambda ctx: get_script_pointer(ctx.data[ctx.ptr + 2:ctx.ptr + 6])
},
'xx': {
'length': 4,
'param': 'a, b',
'expr': ' .word \\a\n .word \\b',
'read': lambda ctx: get_script_pointer(ctx.data[ctx.ptr+2:ctx.ptr+6]) + ', ' + get_script_pointer(ctx.data[ctx.ptr+6:ctx.ptr+10])
'read': lambda ctx: get_script_pointer(ctx.data[ctx.ptr + 2:ctx.ptr + 6]) + ', ' + get_script_pointer(ctx.data[ctx.ptr + 6:ctx.ptr + 10])
},
# Commands with variable parameter count are now handled by explicitely defining all used parameter configurations
# 'v': {
# 'v': {
# 'length': -1,
# 'param': '',
# 'expr': '',
@@ -323,4 +322,4 @@ parameters = {
# 'expr': ' .word \w',
# 'read': lambda ctx: ''
# },
}
}
@@ -1,14 +1,14 @@
from dataclasses import dataclass
import struct
from utils import barray_to_u16_hex, barray_to_u32_hex, u16_to_hex, u32_to_hex
from definitions import get_pointer, get_data_pointer, get_script_pointer, commands, parameters, get_script_label, used_labels
from utils import barray_to_u16_hex, u16_to_hex
from definitions import get_pointer, commands, parameters, get_script_label, used_labels
# Disassembler for tmc scripts
# Input 'macros' to generate the macros for the script commands
# Input the script bytes as hex to disassemble the script
# Build macros: echo "macros" | python script_disassembler.py > ~/git/tmc/github/asm/macros/scripts.inc
# Build macros: echo "macros" | python script_disassembler.py > ~/git/tmc/github/asm/macros/scripts.inc
@dataclass
class Context:
@@ -18,20 +18,23 @@ class Context:
# Remove the ScriptCommand_ prefix for the asm macros
def build_script_command(name: str):
def build_script_command(name: str):
name = name.replace("ScriptCommand_", "")
if name[0].isdigit(): # asm macros cannot start with an _
return '_' + name
if name[0].isdigit(): # asm macros cannot start with an _
return f'_{name}'
return name
def print_rest_bytes(ctx):
print('\n'.join(['.byte ' + hex(x) for x in ctx.data[ctx.ptr:]]))
print('\n'.join(['.byte ' + hex(x) for x in ctx.data[ctx.ptr:]]))
def disassemble_command(ctx: Context, add_all_annotations=False):
global used_labels
if add_all_annotations or ctx.script_addr + ctx.ptr in used_labels:
print(f'{get_script_label(ctx.script_addr + ctx.ptr)}:') # print offsets to debug when manually inserting labels
cmd = struct.unpack('H', ctx.data[ctx.ptr:ctx.ptr+2])[0]
# print offsets to debug when manually inserting labels
print(f'{get_script_label(ctx.script_addr + ctx.ptr)}:')
cmd = struct.unpack('H', ctx.data[ctx.ptr:ctx.ptr + 2])[0]
if cmd == 0:
# this does not need to be the end of the script
print('\t.short 0x0000')
@@ -41,99 +44,88 @@ def disassemble_command(ctx: Context, add_all_annotations=False):
if cmd == 0xffff:
ctx.ptr += 2
print('SCRIPT_END')
cmd = struct.unpack('H', ctx.data[ctx.ptr:ctx.ptr+2])[0]
cmd = struct.unpack('H', ctx.data[ctx.ptr:ctx.ptr + 2])[0]
if cmd == 0x0000:
# This is actually the end of the script
print('\t.short 0x0000')
ctx.ptr += 2
return 2
return 3 # There is a SCRIPT_END without 0x0000 afterwards, but still split into a new file, please
return 3 # There is a SCRIPT_END without 0x0000 afterwards, but still split into a new file, please
commandSize = cmd >> 0xA
if commandSize == 0:
raise Exception(f'Zero commandSize')
# TODO error
return 0
raise Exception(f'Zero commandSize not allowed')
commandId = cmd & 0x3FF
if commandId >= len(commands):
#print_rest_bytes(ctx)
print(f'\t.short {u16_to_hex(cmd)}')
ctx.ptr += 2
#raise Exception(f'Invalid commandId {commandId} / {len(commands)} {cmd}')
# TODO error
return 1
raise Exception(f'Invalid commandId {commandId} / {len(commands)} {cmd}')
command = commands[commandId]
param_length = commandSize - 1
param_length = commandSize - 1
if commandSize > 1:
if ctx.ptr+2*commandSize > len(ctx.data):
if ctx.ptr + 2 * commandSize > len(ctx.data):
raise Exception(f'Not enough data to fetch {commandSize-1} params')
return 0
#meta = struct.unpack(
# 'H'*(unk_06-1), ctx.data[ctx.ptr+2:ctx.ptr+2*unk_06])
#print('meta', meta)
# Handle parameters
if not 'params' in command:
raise Exception('Parameters not defined for ' + command['fun'] + ' Should be of length ' + str(param_length))
raise Exception(f'Parameters not defined for {command["fun"]}. Should be of length {str(param_length)}')
params = None
suffix = ''
suffix = ''
# When there are multiple variants of parameters, choose the one with the correct count for this
if isinstance(command['params'], list):
for i,param in enumerate(command['params']):
for i, param in enumerate(command['params']):
if not param in parameters:
raise Exception(f'Parameter configuration {param} not defined')
candidate = parameters[param]
if candidate['length'] == commandSize -1:
if candidate['length'] == commandSize - 1:
params = candidate
if i != 0:
suffix = f'_{params["length"]}'# We need to add a suffix to distinguish the correct parameter variant
# We need to add a suffix to distinguish the correct parameter variant
suffix = f'_{params["length"]}'
break
if params is None:
raise Exception(f'No suitable parameter configuration with length {commandSize-1} found for {command["fun"]}')
raise Exception(
f'No suitable parameter configuration with length {commandSize-1} found for {command["fun"]}')
else:
if not command['params'] in parameters:
raise Exception('Parameter configuration ' + command['params'] + ' not defined')
raise Exception(f'Parameter configuration {command["params"]} not defined')
params = parameters[command['params']]
command_name = f'{command["fun"]}{suffix}'
if params['length'] == -1: # variable parameter length
if params['length'] == -1: # variable parameter length
print(f'\t.short {u16_to_hex(cmd)} @ {build_script_command(command_name)} with {commandSize-1} parameters')
if commandSize > 1:
print('\n'.join(['\t.short ' + x for x in barray_to_u16_hex(ctx.data[ctx.ptr+2:ctx.ptr+commandSize*2])]))
print('\n'.join(['\t.short ' + x for x in barray_to_u16_hex(ctx.data[ctx.ptr + 2:ctx.ptr + commandSize * 2])]))
print(f'@ End of parameters')
ctx.ptr += commandSize*2
ctx.ptr += commandSize * 2
return 1
elif params['length'] == -2: # point and var
elif params['length'] == -2: # point and var
print(f'\t.short {u16_to_hex(cmd)} @ {build_script_command(command_name)} with {commandSize-3} parameters')
print('\t.word '+ get_pointer(ctx.data[ctx.ptr+2:ctx.ptr+6]))
print('\t.word ' + get_pointer(ctx.data[ctx.ptr + 2:ctx.ptr + 6]))
if commandSize > 3:
print('\n'.join(['\t.short ' + x for x in barray_to_u16_hex(ctx.data[ctx.ptr+6:ctx.ptr+commandSize*2])]))
print('\n'.join(['\t.short ' + x for x in barray_to_u16_hex(ctx.data[ctx.ptr + 6:ctx.ptr + commandSize * 2])]))
print(f'@ End of parameters')
ctx.ptr += commandSize*2
ctx.ptr += commandSize * 2
return 1
if commandSize-1 != params['length']:
raise Exception(f'Call {command_name} with ' + str(commandSize-1) +' length, while length of ' + str(params['length'])+' defined')
raise Exception(f'Call {command_name} with {commandSize-1} length, while length of {params["length"]} defined')
print(f'\t{build_script_command(command_name)} {params["read"](ctx)}')
# Execute script
ctx.ptr += commandSize*2
ctx.ptr += commandSize * 2
return 1
def disassemble_script(input_bytes, script_addr, add_all_annotations=False):
ctx = Context(0, input_bytes, script_addr)
foundEnd = False
while True:
if ctx.ptr >= len(ctx.data) - 1: # End of file (there need to be at least two bytes remaining for the next operation id)
# End of file (there need to be at least two bytes remaining for the next operation id)
if ctx.ptr >= len(ctx.data) - 1:
break
res = disassemble_command(ctx, add_all_annotations)
if res == 0:
@@ -145,26 +137,21 @@ def disassemble_script(input_bytes, script_addr, add_all_annotations=False):
# End in the middle of the script, please create a new file
return ctx.ptr
# Print rest (did not manage to get there)
if ctx.ptr < len(ctx.data):
if (len(ctx.data) - ctx.ptr) % 2 != 0:
print_rest_bytes(ctx)
# TODO error
raise Exception('DONT WANT EXTRA after '+ str(ctx.ptr) + ' / ' + str(len(ctx.data)))
return
raise Exception(f'There is extra data at the end {ctx.ptr} / {len(ctx.data)}')
print('\n'.join(['.short ' + x for x in barray_to_u16_hex(ctx.data[ctx.ptr:])]))
raise Exception('DONT WANT EXTRA after '+ str(ctx.ptr) + ' / ' + str(len(ctx.data)))
raise Exception(f'There is extra data at the end {ctx.ptr} / {len(ctx.data)}')
if not foundEnd:
# Seems to happen, sadly
# Sadly, there are script files without and end?
return 0
#print('\033[93mNo end found\033[0m')
#raise Exception('No end found')
return 0
def generate_macros():
print('@ All the macro functions for scripts')
print('@ Generated by disassemble_script.py')
@@ -182,7 +169,7 @@ def generate_macros():
print('')
for num, command in enumerate(commands):
if not 'params' in command:
raise Exception('Parameters not defined for ' + command['fun'] + '!')
raise Exception(f'Parameters not defined for {command["fun"]}')
def emit_macro(command_name, id, params):
print(f'.macro {command_name} {params["param"]}')
@@ -194,29 +181,29 @@ def generate_macros():
if isinstance(command['params'], list):
# emit macros for all variants
for i,variant in enumerate(command['params']):
for i, variant in enumerate(command['params']):
if not variant in parameters:
raise Exception('Parameter configuration ' + variant + ' not defined')
raise Exception(f'Parameter configuration {variant} not defined')
params = parameters[variant]
id = ((params['length']+1) << 0xA) + num
id = ((params['length'] + 1) << 0xA) + num
suffix = ''
if i != 0:
suffix = f'_{params["length"]}'
emit_macro(f'{build_script_command(command["fun"])}{suffix}', id, params)
else:
if not command['params'] in parameters:
raise Exception('Parameter configuration ' + command['params'] + ' not defined')
raise Exception(f'Parameter configuration {command["params"]} not defined')
params = parameters[command['params']]
id = ((params['length']+1) << 0xA) + num
id = ((params['length'] + 1) << 0xA) + num
if params['length'] < 0: # Don't emit anything for variable parameters
if params['length'] < 0: # Don't emit anything for variable parameters
continue
emit_macro(build_script_command(command['fun']), id, params)
#print('#define ' + command['fun'] + '(' + params['param'] + ') asm(".short '+u16_to_hex(id)+'");' + params['expr'])
print('')
def main():
# Read input
@@ -226,6 +213,7 @@ def main():
generate_macros()
return
disassemble_script(bytearray.fromhex(input_data))
if __name__ == '__main__':
main()
main()
@@ -1,27 +1,30 @@
# This python script reads the script.s file which contains all the .incbin macros
# Then it fetches the corresponding data of the baserom, o
TMC_FOLDER='../..'
import subprocess
import sys
from script_disassembler import disassemble_script, generate_macros
import sys
ROM_OFFSET=0x08000000
SCRIPTS_START=0x08008B5C
SCRIPTS_END=0x08016984
# Reads a section from the baserom, splits the residing scripts into seperate files and disassembles them
# Should only be run before any manual changes to the script files are done!
TMC_FOLDER = '../..'
ROM_OFFSET = 0x08000000
SCRIPTS_START = 0x08008B5C
SCRIPTS_END = 0x08016984
# Create labels for these additional script instructions
# Currently done by splitting the script at that point
LABEL_BREAKS=[0x0800A088, 0x0800ACE0, 0x0800AD54, 0x0800B41C, 0x0800B7C4, 0x0800C8C8, 0x0800D190, 0x800D3EC, 0x0800E9F4, 0x0800FD80, 0x08012AC8, 0x08012F0C, 0x080130E4, 0x08013B70, 0x080142B0, 0x080147DC, 0x08014A80, 0x08014B10,0x0801635C, 0x08016384, 0x080165D8]
LABEL_BREAKS = [0x0800A088, 0x0800ACE0, 0x0800AD54, 0x0800B41C, 0x0800B7C4, 0x0800C8C8, 0x0800D190, 0x800D3EC, 0x0800E9F4, 0x0800FD80,
0x08012AC8, 0x08012F0C, 0x080130E4, 0x08013B70, 0x080142B0, 0x080147DC, 0x08014A80, 0x08014B10, 0x0801635C, 0x08016384, 0x080165D8]
# Whether to output a label for every line
PRINT_ALL_LABELS=False
PRINT_ALL_LABELS = False
def read_baserom():
# read baserom data
with open(f'{TMC_FOLDER}/baserom.gba', 'rb') as baserom:
return bytearray(baserom.read())
def get_label(addr):
return hex(addr).upper().replace('0X', 'script_0')
@@ -42,10 +45,10 @@ def disassemble_scripts(baserom_data):
label_break = 0
while script_start < SCRIPTS_END-ROM_OFFSET:
if label_break < len(LABEL_BREAKS) and script_start+ROM_OFFSET >=LABEL_BREAKS[label_break]:
if label_break < len(LABEL_BREAKS) and script_start + ROM_OFFSET >= LABEL_BREAKS[label_break]:
label_break += 1
label = get_label(script_start+ROM_OFFSET)
label = get_label(script_start + ROM_OFFSET)
print(f"Disassembling \033[1;34m{label}\033[0m ({script_start} / { SCRIPTS_END-ROM_OFFSET} bytes converted)...")
# find end of the script signified by 0xffff0000
script_end = baserom_data.index(b'\xff\xff\x00\x00', script_start) + 4
@@ -53,41 +56,40 @@ def disassemble_scripts(baserom_data):
if script_end > SCRIPTS_END-ROM_OFFSET:
script_end = SCRIPTS_END-ROM_OFFSET
if label_break < len(LABEL_BREAKS) and script_end+ROM_OFFSET > LABEL_BREAKS[label_break]:
#print(f'break at {hex(LABEL_BREAKS[label_break])} instead of {hex(script_end)}')
# break at a predefined label into a new file
if label_break < len(LABEL_BREAKS) and script_end + ROM_OFFSET > LABEL_BREAKS[label_break]:
script_end = LABEL_BREAKS[label_break]-ROM_OFFSET
# read data from rom
data = baserom_data[script_start:script_end]
scripts += f' .include "data/scripts/{label}.inc"\n'
stdout = sys.stdout
with open(f'{TMC_FOLDER}/data/scripts/{label}.inc','w') as out:
with open(f'{TMC_FOLDER}/data/scripts/{label}.inc', 'w') as out:
sys.stdout = out
if script_start == 0x1637C: # This function is actually assembly
print ('''thumb_func_start script_0801637C
if script_start == 0x1637C: # This function is actually assembly
print('''thumb_func_start script_0801637C
script_0801637C:
push {lr}
bl CreateDust
pop {pc}''')
sys.stdout = stdout
script_start = script_end
script_start = script_end
continue
print(f'SCRIPT_START {label}')
res = disassemble_script(data, script_start+ROM_OFFSET, PRINT_ALL_LABELS)
res = disassemble_script(data, script_start + ROM_OFFSET, PRINT_ALL_LABELS)
if res != 0:
# Script ended in the middle, need to create a new file
script_end = script_start + res
sys.stdout = stdout
script_start = script_end
script_start = script_end
return scripts
def main():
baserom_data = read_baserom()
@@ -111,5 +113,6 @@ def main():
print('\033[1;92mDone\033[0m\n')
if __name__ == '__main__':
main()
main()