feat (ILSEx v1.2): add fade-in transition

This commit is contained in:
sup39 2024-02-25 05:49:46 +09:00
parent 0ae5bb1b3c
commit 3e29c30b33
Signed by: sup39
GPG key ID: 111C00916C1641E5
4 changed files with 426 additions and 282 deletions

View file

@ -3,11 +3,11 @@
<title lang="en-US">Instant Level Select Extra</title> <title lang="en-US">Instant Level Select Extra</title>
<title lang="ja-JP">レベル選択EX</title> <title lang="ja-JP">レベル選択EX</title>
<author>sup39(サポミク)</author> <author>sup39(サポミク)</author>
<version>1.0</version> <version>1.2</version>
<date>Feb 09, 2024</date> <date>Feb 25, 2024</date>
<description lang="en-US"> <description lang="en-US">
::: warning ::: warning
Do not use this code when opening/closing Z menu, or the game may crash! The code is disabled when paused and in Z menu.
::: :::
#### Instant Restart #### Instant Restart
@ -39,7 +39,7 @@
</description> </description>
<description lang="ja-JP"> <description lang="ja-JP">
::: warning ::: warning
Zメニューを開く・閉じる最中にこのコードを使うとクラッシュする可能性があります このコードはポーズ時及びZメニューでは無効化されます。
::: :::
#### ポーズせずにやり直し #### ポーズせずにやり直し
@ -69,7 +69,7 @@
4. これで好きなだけハニスキを練習できます。他のエリアに入ろうとする時に自動的にやり直すので、手動でやり直す必要がありません。必要であれば`十字キー上`でやり直すこともできます。 4. これで好きなだけハニスキを練習できます。他のエリアに入ろうとする時に自動的にやり直すので、手動でやり直す必要がありません。必要であれば`十字キー上`でやり直すこともできます。
</description> </description>
<source version="GMSJ01"> <source version="GMSJ01">
C20F9B74 00000052 C20F9B74 00000065
3C80817F 816D97D0 3C80817F 816D97D0
3D808040 80AC0D80 3D808040 80AC0D80
20050022 540A043D 20050022 540A043D
@ -78,69 +78,73 @@
28830001 4C451102 28830001 4C451102
40A2000C 38A00008 40A2000C 38A00008
90AC0D80 7C7D1B79 90AC0D80 7C7D1B79
4182024C 818D97E8 418202D0 818D97E8
7D8C6379 41820014 2B0C0000 419A0018
898C0064 38000021 898C0064 2E8C0009
5C00656B 40820230 38000021 5C00656B
70A00004 41A20040 408202B0 70A00004
881F0008 2C000008 41A20040 881F0008
41820034 881F000E 2C000008 41820034
3D40803B 394A40E8 881F000E 3D40803B
7CEA00AE 2C070001 394A40E8 7CEA00AE
40810204 38070001 2C070001 40810284
5400EFFE 7CE70214 38070001 5400EFFE
54E7403E 60E700FF 7CE70214 54E7403E
480000FC 70A00008 60E700FF 4800011C
41A201E4 4800003D 70A00008 41A20264
00141516 0017181D 48000045 00141516
34000090 2F2E3020 0017181D 34000090
32293328 2A1FBA3C 2F2E3020 32293328
371E213A 0E2C3900 2A1FBA3C 371E213A
00010507 08090200 0E2C3900 00010507
123457D0 24567000 08090200 123457D0
12234070 23467001 24567000 12234070
7D2802A6 54A6CF3A 23467001 7D8903A6
50A6E7BC 50A6D7FE 4E800420 7D2802A6
54A0F77A 7CC60378 54A6CF3A 50A6E7BC
54A0C738 50A0B77C 50A6D7FE 54A0F77A
7CC60378 54A3873F 7CC60378 54A0C738
41820054 2C030009 50A0B77C 7CC60378
41820098 3C00C84A 54A3873F 41820054
6000C004 1C630003 2C030009 418200B0
5C031F7E 5465103A 3C00C84A 6000C004
2C06000C 408000BC 1C630003 5C031F7E
2C06000A 408000D4 5465103A 2C06000C
2C060008 40800090 408000D4 2C06000A
3C005689 60000234 408000EC 2C060008
546C103A 5C0C652E 408000A8 3C005689
7CC76378 54C8077E 60000234 546C103A
480000C4 A0FF000E 5C0C652E 7CC76378
2C060000 41820028 54C8077E 480000DC
2C060004 41820028 A0FF000E 2C060000
2C06000A 41820028 41820028 2C060004
7C0930AE 540744AE 41820040 2C06000A
5408CFFE 1D080007 41820040 7C0930AE
48000094 A01F000A 540744AE 5408CFFE
B01F000E 890B00DF 1D080007 480000AC
4800008C A0E40028 88040007 2C000000
8904002A 48000078 40820014 A01F000A
3989000C 7C0C30AE B01F000E 9BA40007
540744AE 5007CFFE 48000008 A0FF0012
3C00AC1A 60005CA2 890B00DF 4800008C
1D860003 5C08677E A0E40028 8904002A
48000054 39890018 48000078 3989000C
7C0C18AE 540744AE 7C0C30AE 540744AE
3C001373 60002301 5007CFFE 3C00AC1A
5C082F7E 48000038 60005CA2 1D860003
3989FFF8 54C016B8 5C08677E 48000054
7C0C006E 5C072F7E 39890018 7C0C18AE
5007252E 800C0004 540744AE 3C001373
5C082F7E 48000018 60002301 5C082F7E
3C001578 60009200 48000038 3989FFF8
5C072F3E 60E70100 54C016B8 7C0C006E
39000000 B0E40028 5C072F7E 5007252E
9904002A 38000001 800C0004 5C082F7E
980400B3 990B00DF 48000018 3C001578
60009200 5C072F3E
60E70100 39000000
B0E40028 9904002A
9BA400B3 990B00DF
38000000 900B00D8 38000000 900B00D8
A00B00CC 60004000 A00B00CC 60004000
54000524 B00B00CC 54000524 B00B00CC
@ -150,11 +154,26 @@
3800003B 41820008 3800003B 41820008
38000000 B00C00E4 38000000 B00C00E4
A00C00E2 540007FA A00C00E2 540007FA
B00C00E2 54FDD7BE B00C00E2 409A0010
3BBD0005 00000000 54FDD7BE 3BBD0005
48000060 4196005C
806D97E8 3D80800E
618CAB40 4BFFFE29
387F0034 38800000
3D808020 618C1150
4BFFFE15 806D97E8
38800009 3D80800E
618CC11C 4BFFFE01
806D97E8 38800009
3D80800E 618CB80C
4BFFFDED 806D97E8
38000009 98030064
2C1D0001 4081000C
3D80817F 998C0007
60000000 00000000
</source> </source>
<source version="GMSE01"> <source version="GMSE01">
C22A6170 00000052 C22A6170 00000065
3C80817F 816D9FA0 3C80817F 816D9FA0
3D808040 80AC4484 3D808040 80AC4484
20050022 540A043D 20050022 540A043D
@ -163,69 +182,73 @@
28830001 4C451102 28830001 4C451102
40A2000C 38A00008 40A2000C 38A00008
90AC4484 7C7D1B79 90AC4484 7C7D1B79
4182024C 818D9FB8 418202D0 818D9FB8
7D8C6379 41820014 2B0C0000 419A0018
898C0064 38000021 898C0064 2E8C0009
5C00656B 40820230 38000021 5C00656B
70A00004 41A20040 408202B0 70A00004
881F0008 2C000008 41A20040 881F0008
41820034 881F000E 2C000008 41820034
3D40803E 394AF498 881F000E 3D40803E
7CEA00AE 2C070001 394AF498 7CEA00AE
40810204 38070001 2C070001 40810284
5400EFFE 7CE70214 38070001 5400EFFE
54E7403E 60E700FF 7CE70214 54E7403E
480000FC 70A00008 60E700FF 4800011C
41A201E4 4800003D 70A00008 41A20264
00141516 0017181D 48000045 00141516
34000090 2F2E3020 0017181D 34000090
32293328 2A1FBA3C 2F2E3020 32293328
371E213A 0E2C3900 2A1FBA3C 371E213A
00010507 08090200 0E2C3900 00010507
123457D0 24567000 08090200 123457D0
12234070 23467001 24567000 12234070
7D2802A6 54A6CF3A 23467001 7D8903A6
50A6E7BC 50A6D7FE 4E800420 7D2802A6
54A0F77A 7CC60378 54A6CF3A 50A6E7BC
54A0C738 50A0B77C 50A6D7FE 54A0F77A
7CC60378 54A3873F 7CC60378 54A0C738
41820054 2C030009 50A0B77C 7CC60378
41820098 3C00C84A 54A3873F 41820054
6000C004 1C630003 2C030009 418200B0
5C031F7E 5465103A 3C00C84A 6000C004
2C06000C 408000BC 1C630003 5C031F7E
2C06000A 408000D4 5465103A 2C06000C
2C060008 40800090 408000D4 2C06000A
3C005689 60000234 408000EC 2C060008
546C103A 5C0C652E 408000A8 3C005689
7CC76378 54C8077E 60000234 546C103A
480000C4 A0FF000E 5C0C652E 7CC76378
2C060000 41820028 54C8077E 480000DC
2C060004 41820028 A0FF000E 2C060000
2C06000A 41820028 41820028 2C060004
7C0930AE 540744AE 41820040 2C06000A
5408CFFE 1D080007 41820040 7C0930AE
48000094 A01F000A 540744AE 5408CFFE
B01F000E 890B00DF 1D080007 480000AC
4800008C A0E40028 88040007 2C000000
8904002A 48000078 40820014 A01F000A
3989000C 7C0C30AE B01F000E 9BA40007
540744AE 5007CFFE 48000008 A0FF0012
3C00AC1A 60005CA2 890B00DF 4800008C
1D860003 5C08677E A0E40028 8904002A
48000054 39890018 48000078 3989000C
7C0C18AE 540744AE 7C0C30AE 540744AE
3C001373 60002301 5007CFFE 3C00AC1A
5C082F7E 48000038 60005CA2 1D860003
3989FFF8 54C016B8 5C08677E 48000054
7C0C006E 5C072F7E 39890018 7C0C18AE
5007252E 800C0004 540744AE 3C001373
5C082F7E 48000018 60002301 5C082F7E
3C001578 60009200 48000038 3989FFF8
5C072F3E 60E70100 54C016B8 7C0C006E
39000000 B0E40028 5C072F7E 5007252E
9904002A 38000001 800C0004 5C082F7E
980400B3 990B00DF 48000018 3C001578
60009200 5C072F3E
60E70100 39000000
B0E40028 9904002A
9BA400B3 990B00DF
38000000 900B00D8 38000000 900B00D8
A00B00CC 60004000 A00B00CC 60004000
54000524 B00B00CC 54000524 B00B00CC
@ -235,11 +258,26 @@
3800003B 41820008 3800003B 41820008
38000000 B00C00E4 38000000 B00C00E4
A00C00E2 540007FA A00C00E2 540007FA
B00C00E2 54FDD7BE B00C00E2 409A0010
3BBD0005 00000000 54FDD7BE 3BBD0005
48000060 4196005C
806D9FB8 3D808029
618C7584 4BFFFE29
387F0034 38800000
3D808013 618CF638
4BFFFE15 806D9FB8
38800009 3D808029
618C8BB0 4BFFFE01
806D9FB8 38800009
3D808029 618C8250
4BFFFDED 806D9FB8
38000009 98030064
2C1D0001 4081000C
3D80817F 998C0007
60000000 00000000
</source> </source>
<source version="GMSP01"> <source version="GMSP01">
C229E080 00000052 C229E080 00000065
3C80817F 816D9EC8 3C80817F 816D9EC8
3D808040 80ACBC24 3D808040 80ACBC24
20050022 540A043D 20050022 540A043D
@ -248,69 +286,73 @@
28830001 4C451102 28830001 4C451102
40A2000C 38A00008 40A2000C 38A00008
90ACBC24 7C7D1B79 90ACBC24 7C7D1B79
4182024C 818D9EE0 418202D0 818D9EE0
7D8C6379 41820014 2B0C0000 419A0018
898C0064 38000021 898C0064 2E8C0009
5C00656B 40820230 38000021 5C00656B
70A00004 41A20040 408202B0 70A00004
881F0008 2C000008 41A20040 881F0008
41820034 881F000E 2C000008 41820034
3D40803D 394A6DB0 881F000E 3D40803D
7CEA00AE 2C070001 394A6DB0 7CEA00AE
40810204 38070001 2C070001 40810284
5400EFFE 7CE70214 38070001 5400EFFE
54E7403E 60E700FF 7CE70214 54E7403E
480000FC 70A00008 60E700FF 4800011C
41A201E4 4800003D 70A00008 41A20264
00141516 0017181D 48000045 00141516
34000090 2F2E3020 0017181D 34000090
32293328 2A1FBA3C 2F2E3020 32293328
371E213A 0E2C3900 2A1FBA3C 371E213A
00010507 08090200 0E2C3900 00010507
123457D0 24567000 08090200 123457D0
12234070 23467001 24567000 12234070
7D2802A6 54A6CF3A 23467001 7D8903A6
50A6E7BC 50A6D7FE 4E800420 7D2802A6
54A0F77A 7CC60378 54A6CF3A 50A6E7BC
54A0C738 50A0B77C 50A6D7FE 54A0F77A
7CC60378 54A3873F 7CC60378 54A0C738
41820054 2C030009 50A0B77C 7CC60378
41820098 3C00C84A 54A3873F 41820054
6000C004 1C630003 2C030009 418200B0
5C031F7E 5465103A 3C00C84A 6000C004
2C06000C 408000BC 1C630003 5C031F7E
2C06000A 408000D4 5465103A 2C06000C
2C060008 40800090 408000D4 2C06000A
3C005689 60000234 408000EC 2C060008
546C103A 5C0C652E 408000A8 3C005689
7CC76378 54C8077E 60000234 546C103A
480000C4 A0FF000E 5C0C652E 7CC76378
2C060000 41820028 54C8077E 480000DC
2C060004 41820028 A0FF000E 2C060000
2C06000A 41820028 41820028 2C060004
7C0930AE 540744AE 41820040 2C06000A
5408CFFE 1D080007 41820040 7C0930AE
48000094 A01F000A 540744AE 5408CFFE
B01F000E 890B00DF 1D080007 480000AC
4800008C A0E40028 88040007 2C000000
8904002A 48000078 40820014 A01F000A
3989000C 7C0C30AE B01F000E 9BA40007
540744AE 5007CFFE 48000008 A0FF0012
3C00AC1A 60005CA2 890B00DF 4800008C
1D860003 5C08677E A0E40028 8904002A
48000054 39890018 48000078 3989000C
7C0C18AE 540744AE 7C0C30AE 540744AE
3C001373 60002301 5007CFFE 3C00AC1A
5C082F7E 48000038 60005CA2 1D860003
3989FFF8 54C016B8 5C08677E 48000054
7C0C006E 5C072F7E 39890018 7C0C18AE
5007252E 800C0004 540744AE 3C001373
5C082F7E 48000018 60002301 5C082F7E
3C001578 60009200 48000038 3989FFF8
5C072F3E 60E70100 54C016B8 7C0C006E
39000000 B0E40028 5C072F7E 5007252E
9904002A 38000001 800C0004 5C082F7E
980400B3 990B00DF 48000018 3C001578
60009200 5C072F3E
60E70100 39000000
B0E40028 9904002A
9BA400B3 990B00DF
38000000 900B00D8 38000000 900B00D8
A00B00CC 60004000 A00B00CC 60004000
54000524 B00B00CC 54000524 B00B00CC
@ -320,11 +362,26 @@
3800003B 41820008 3800003B 41820008
38000000 B00C00E4 38000000 B00C00E4
A00C00E2 540007FA A00C00E2 540007FA
B00C00E2 54FDD7BE B00C00E2 409A0010
3BBD0005 00000000 54FDD7BE 3BBD0005
48000060 4196005C
806D9EE0 3D808028
618CF41C 4BFFFE29
387F0034 38800000
3D808013 618C41B4
4BFFFE15 806D9EE0
38800009 3D808029
618C0A48 4BFFFE01
806D9EE0 38800009
3D808029 618C00E8
4BFFFDED 806D9EE0
38000009 98030064
2C1D0001 4081000C
3D80817F 998C0007
60000000 00000000
</source> </source>
<source version="GMSJ0A"> <source version="GMSJ0A">
C2285FCC 00000052 C2285FCC 00000065
3C80817F 816D9E60 3C80817F 816D9E60
3D80803F 80AC5458 3D80803F 80AC5458
20050022 540A043D 20050022 540A043D
@ -333,69 +390,73 @@
28830001 4C451102 28830001 4C451102
40A2000C 38A00008 40A2000C 38A00008
90AC5458 7C7D1B79 90AC5458 7C7D1B79
4182024C 818D9E78 418202D0 818D9E78
7D8C6379 41820014 2B0C0000 419A0018
898C0064 38000021 898C0064 2E8C0009
5C00656B 40820230 38000021 5C00656B
70A00004 41A20040 408202B0 70A00004
881F0008 2C000008 41A20040 881F0008
41820034 881F000E 2C000008 41820034
3D40803D 394AF9B8 881F000E 3D40803D
7CEA00AE 2C070001 394AF9B8 7CEA00AE
40810204 38070001 2C070001 40810284
5400EFFE 7CE70214 38070001 5400EFFE
54E7403E 60E700FF 7CE70214 54E7403E
480000FC 70A00008 60E700FF 4800011C
41A201E4 4800003D 70A00008 41A20264
00141516 0017181D 48000045 00141516
34000090 2F2E3020 0017181D 34000090
32293328 2A1FBA3C 2F2E3020 32293328
371E213A 0E2C3900 2A1FBA3C 371E213A
00010507 08090200 0E2C3900 00010507
123457D0 24567000 08090200 123457D0
12234070 23467001 24567000 12234070
7D2802A6 54A6CF3A 23467001 7D8903A6
50A6E7BC 50A6D7FE 4E800420 7D2802A6
54A0F77A 7CC60378 54A6CF3A 50A6E7BC
54A0C738 50A0B77C 50A6D7FE 54A0F77A
7CC60378 54A3873F 7CC60378 54A0C738
41820054 2C030009 50A0B77C 7CC60378
41820098 3C00C84A 54A3873F 41820054
6000C004 1C630003 2C030009 418200B0
5C031F7E 5465103A 3C00C84A 6000C004
2C06000C 408000BC 1C630003 5C031F7E
2C06000A 408000D4 5465103A 2C06000C
2C060008 40800090 408000D4 2C06000A
3C005689 60000234 408000EC 2C060008
546C103A 5C0C652E 408000A8 3C005689
7CC76378 54C8077E 60000234 546C103A
480000C4 A0FF000E 5C0C652E 7CC76378
2C060000 41820028 54C8077E 480000DC
2C060004 41820028 A0FF000E 2C060000
2C06000A 41820028 41820028 2C060004
7C0930AE 540744AE 41820040 2C06000A
5408CFFE 1D080007 41820040 7C0930AE
48000094 A01F000A 540744AE 5408CFFE
B01F000E 890B00DF 1D080007 480000AC
4800008C A0E40028 88040007 2C000000
8904002A 48000078 40820014 A01F000A
3989000C 7C0C30AE B01F000E 9BA40007
540744AE 5007CFFE 48000008 A0FF0012
3C00AC1A 60005CA2 890B00DF 4800008C
1D860003 5C08677E A0E40028 8904002A
48000054 39890018 48000078 3989000C
7C0C18AE 540744AE 7C0C30AE 540744AE
3C001373 60002301 5007CFFE 3C00AC1A
5C082F7E 48000038 60005CA2 1D860003
3989FFF8 54C016B8 5C08677E 48000054
7C0C006E 5C072F7E 39890018 7C0C18AE
5007252E 800C0004 540744AE 3C001373
5C082F7E 48000018 60002301 5C082F7E
3C001578 60009200 48000038 3989FFF8
5C072F3E 60E70100 54C016B8 7C0C006E
39000000 B0E40028 5C072F7E 5007252E
9904002A 38000001 800C0004 5C082F7E
980400B3 990B00DF 48000018 3C001578
60009200 5C072F3E
60E70100 39000000
B0E40028 9904002A
9BA400B3 990B00DF
38000000 900B00D8 38000000 900B00D8
A00B00CC 60004000 A00B00CC 60004000
54000524 B00B00CC 54000524 B00B00CC
@ -405,7 +466,22 @@
3800003B 41820008 3800003B 41820008
38000000 B00C00E4 38000000 B00C00E4
A00C00E2 540007FA A00C00E2 540007FA
B00C00E2 54FDD7BE B00C00E2 409A0010
3BBD0005 00000000 54FDD7BE 3BBD0005
48000060 4196005C
806D9E78 3D808027
618C722C 4BFFFE29
387F0034 38800000
3D808012 618C0908
4BFFFE15 806D9E78
38800009 3D808027
618C8858 4BFFFE01
806D9E78 38800009
3D808027 618C7EF8
4BFFFDED 806D9E78
38000009 98030064
2C1D0001 4081000C
3D80817F 998C0007
60000000 00000000
</source> </source>
</code> </code>

View file

@ -3,8 +3,8 @@
<title lang="en-US">Instant Level Select Extra</title> <title lang="en-US">Instant Level Select Extra</title>
<title lang="ja-JP">レベル選択EX</title> <title lang="ja-JP">レベル選択EX</title>
<author>sup39(サポミク)</author> <author>sup39(サポミク)</author>
<version>1.1</version> <version>1.2</version>
<date>Feb 24, 2024</date> <date>Feb 25, 2024</date>
<description lang="en-US"> <description lang="en-US">
::: warning ::: warning
The code is disabled when paused and in Z menu. The code is disabled when paused and in Z menu.

View file

@ -8,6 +8,8 @@ def main(g, ver):
'.set $LevelSelect.area, 0x817F0028', '.set $LevelSelect.area, 0x817F0028',
'.set $LevelSelect.epFlag, 0x817F002A', '.set $LevelSelect.epFlag, 0x817F002A',
'.set $LevelSelect.AreaLock, 0x817F002B', '.set $LevelSelect.AreaLock, 0x817F002B',
# TODO conflict with Level Select
'.set $restartNActivated, 0x817F0007',
]); ]);
make_xml(main) make_xml(main)

View file

@ -11,9 +11,20 @@
.set rApp, 31 # gpApplication .set rApp, 31 # gpApplication
.set rNextGameMode, 29 .set rNextGameMode, 29
.set crAreaLock, 7 .set crAreaLock, 7
.set crMarDirector, 6
.set crWarping, 5
.set $btnLevelSelect, 0x8 # D_UP .set $btnLevelSelect, 0x8 # D_UP
.set $btnShineSelect, 0x4 # D_DOWN .set $btnShineSelect, 0x4 # D_DOWN
.macro li32 reg val
lis \reg, \val@h
ori \reg, \reg, \val@l
.endm
.macro call addr
li32 r12, \addr
bl call
.endm
.L.prepare: .L.prepare:
## prepare registers ## prepare registers
lis r817F, 0x817F lis r817F, 0x817F
@ -50,7 +61,7 @@
.L.checkAreaLock.done: .L.checkAreaLock.done:
## orig ## orig
mr. rNextGameMode, r3 mr. rNextGameMode, r3
## return now if still setting up ## return now if still setting up (nextGameMode != 0)
beq .L.done beq .L.done
@ -58,10 +69,13 @@
.L.checkPaused: .L.checkPaused:
### r12 = *gpMarDirector ### r12 = *gpMarDirector
lwz r12, gpMarDirector$r13(r13) lwz r12, gpMarDirector$r13(r13)
mr. r12, r12 cmplwi crMarDirector, r12, 0
beq .L.checkPaused.done beq crMarDirector, .L.checkPaused.done
### if (u8) @ *gpMarDirector + 0x64 == 5 or 10 ### r12 = gpMarDirector->gameMode
lbz r12, 0x64(r12) lbz r12, 0x64(r12)
### crWarping(eq) = gpMarDirector->gameMode == 9
cmpwi crWarping, r12, 9
### if gameMode == 5 or 10
li r0, 0x21 # (LSB 0, 5 == 1) li r0, 0x21 # (LSB 0, 5 == 1)
rlwnm. r0, r0, r12, 31-10, 31-10 # LSB 10 rlwnm. r0, r0, r12, 31-10, 31-10 # LSB 10
bne .L.done bne .L.done
@ -134,6 +148,10 @@
.long 0x12234070 .long 0x12234070
.long 0x23467001 .long 0x23467001
call:
mtctr r12
bctr
.L.LevelSelect: .L.LevelSelect:
mflr rD mflr rD
@ -198,7 +216,7 @@
b .L.loadStage b .L.loadStage
handleSpecial: handleSpecial:
lhz rAns, 0xE(rApp) # backup for handleRestartN lhz rAns, 0xE(rApp) # set for handleRestart{N,Z}
## neutral ## neutral
cmpwi rIdx, 0 cmpwi rIdx, 0
beq handleRestartN beq handleRestartN
@ -217,9 +235,23 @@ handleSpecial:
b .L.loadStage b .L.loadStage
handleRestartN: handleRestartN:
## set prevMap = curMap ## skip if restartN already activated
lbz r0, $restartNActivated@l(r817F)
cmpwi r0, 0
bne handleRestartN.alreadyActivated
handleRestartN.activate:
## set curArea = prevArea
lhz r0, 0xA(rApp) lhz r0, 0xA(rApp)
sth r0, 0xE(rApp) sth r0, 0xE(rApp)
## set restartNActivated flag (NOTE: nextGameMode > 0)
stb rNextGameMode, $restartNActivated@l(r817F)
## done
b handleRestartN.done
handleRestartN.alreadyActivated:
## load rAns from nextArea
lhz rAns, 0x12(rApp)
handleRestartN.done:
handleRestartZ: handleRestartZ:
## load curMap, ep ## load curMap, ep
lbz rAnsEp, 0xDF(rFM) lbz rAnsEp, 0xDF(rFM)
@ -282,16 +314,13 @@ handlePlaza:
/* rAns, rAnsEp, rFM, rApp, r817F */ /* rAns, rAnsEp, rFM, rApp, r817F */
.L.loadStageWithoutBackup: .L.loadStageWithoutBackup:
## reset QFT ## reset QFT
li r0, 1 stb rNextGameMode, 0xB3(r817F) # >0
stb r0, 0xB3(r817F)
## FlagManager ## FlagManager
### epFlag(40003) ### epFlag(40003)
stb rAnsEp, 0xDF(rFM) stb rAnsEp, 0xDF(rFM)
### reset coin counter(40002) ### reset coin counter(40002)
li r0, 0 li r0, 0 ## FIXME: make use of other register
stw r0, 0xD8(rFM) stw r0, 0xD8(rFM)
##### set SGT Stop Stopwatch Flag = 0
# stw r0, 0x10C(r817F)
### set flag ### set flag
lhz r0, 0xCC(rFM) lhz r0, 0xCC(rFM)
#### Got a Shine in previous stage (30006) #### Got a Shine in previous stage (30006)
@ -322,9 +351,46 @@ handlePlaza:
rlwinm r0, r0, 0, 31, 29 rlwinm r0, r0, 0, 31, 29
sth r0, 0xe2(rMGP) sth r0, 0xe2(rMGP)
## nextGameMode = nextArea == (shine select) ? 8 : 5
## set nextGameMode if gpMarDirector == NULL
bne crMarDirector, .L.setFader
### nextGameMode = nextArea == (shine select) ? 8 : 5
## ep==0xFF ? 3 : 0 (Note: all valid ep id < 0x40) ## ep==0xFF ? 3 : 0 (Note: all valid ep id < 0x40)
rlwinm rNextGameMode, rAns, 32-6, 0x3 rlwinm rNextGameMode, rAns, 32-6, 0x3
addi rNextGameMode, rNextGameMode, 5 addi rNextGameMode, rNextGameMode, 5
b .L.setFader.done
.L.setFader:
## skip setting fader if warping
beq crWarping, .L.setFader.done
## TMarDirector::moveStage(gpMarDirector)
lwz r3, gpMarDirector$r13(r13)
call TMarDirector_moveStage
## TSMSFader::setFadeStatus(main::gpApplication.fader, FadedOut(0))
addi r3, rApp, 0x34
li r4, 0
call TSMSFader_setFadeStatus
## TMarDirector::currentStateFinalize(gpMarDirector, 9);
lwz r3, gpMarDirector$r13(r13)
li r4, 9
call TMarDirector_currentStateFinalize
## TMarDirector::nextStateInitialize(gpMarDirectorthis, 9);
lwz r3, gpMarDirector$r13(r13)
li r4, 9
call TMarDirector_nextStateInitialize
## gpMarDirector->gameMode = 9
lwz r3, gpMarDirector$r13(r13)
li r0, 9
stb r0, 0x64(r3)
.L.setFader.done:
.L.done: .L.done:
## reset restartNActivated flag if game mode changes (>1)
.L.resetActivatedFlag:
cmpwi rNextGameMode, 1
ble .L.resetActivatedFlag.done
### activated flag = 0
lis r12, 0x817f
stb r12, $restartNActivated@l(r12) # 0x00
.L.resetActivatedFlag.done: