From 3e29c30b33e861bc1c0f7a8f5db41fd323b591d9 Mon Sep 17 00:00:00 2001 From: sup39 Date: Sun, 25 Feb 2024 05:49:46 +0900 Subject: [PATCH] feat (ILSEx v1.2): add fade-in transition --- InstantLevelSelectExtra/@code.xml | 612 ++++++++++++++++------------- InstantLevelSelectExtra/info.xml | 4 +- InstantLevelSelectExtra/make.py | 2 + InstantLevelSelectExtra/src/main.s | 90 ++++- 4 files changed, 426 insertions(+), 282 deletions(-) diff --git a/InstantLevelSelectExtra/@code.xml b/InstantLevelSelectExtra/@code.xml index 650e6f9..9456667 100644 --- a/InstantLevelSelectExtra/@code.xml +++ b/InstantLevelSelectExtra/@code.xml @@ -3,11 +3,11 @@ Instant Level Select Extra レベル選択EX sup39(サポミク) - 1.0 - Feb 09, 2024 + 1.2 + Feb 25, 2024 ::: 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 @@ -39,7 +39,7 @@ ::: warning - Zメニューを開く・閉じる最中にこのコードを使うとクラッシュする可能性があります + このコードはポーズ時及びZメニューでは無効化されます。 ::: #### ポーズせずにやり直し @@ -69,7 +69,7 @@ 4. これで好きなだけハニスキを練習できます。他のエリアに入ろうとする時に自動的にやり直すので、手動でやり直す必要がありません。必要であれば`十字キー上`でやり直すこともできます。 - C20F9B74 00000052 + C20F9B74 00000065 3C80817F 816D97D0 3D808040 80AC0D80 20050022 540A043D @@ -78,69 +78,73 @@ 28830001 4C451102 40A2000C 38A00008 90AC0D80 7C7D1B79 - 4182024C 818D97E8 - 7D8C6379 41820014 - 898C0064 38000021 - 5C00656B 40820230 - 70A00004 41A20040 - 881F0008 2C000008 - 41820034 881F000E - 3D40803B 394A40E8 - 7CEA00AE 2C070001 - 40810204 38070001 - 5400EFFE 7CE70214 - 54E7403E 60E700FF - 480000FC 70A00008 - 41A201E4 4800003D - 00141516 0017181D - 34000090 2F2E3020 - 32293328 2A1FBA3C - 371E213A 0E2C3900 - 00010507 08090200 - 123457D0 24567000 - 12234070 23467001 - 7D2802A6 54A6CF3A - 50A6E7BC 50A6D7FE - 54A0F77A 7CC60378 - 54A0C738 50A0B77C - 7CC60378 54A3873F - 41820054 2C030009 - 41820098 3C00C84A - 6000C004 1C630003 - 5C031F7E 5465103A - 2C06000C 408000BC - 2C06000A 408000D4 - 2C060008 40800090 - 3C005689 60000234 - 546C103A 5C0C652E - 7CC76378 54C8077E - 480000C4 A0FF000E - 2C060000 41820028 - 2C060004 41820028 - 2C06000A 41820028 - 7C0930AE 540744AE - 5408CFFE 1D080007 - 48000094 A01F000A - B01F000E 890B00DF - 4800008C A0E40028 - 8904002A 48000078 - 3989000C 7C0C30AE - 540744AE 5007CFFE - 3C00AC1A 60005CA2 - 1D860003 5C08677E - 48000054 39890018 - 7C0C18AE 540744AE - 3C001373 60002301 - 5C082F7E 48000038 - 3989FFF8 54C016B8 - 7C0C006E 5C072F7E - 5007252E 800C0004 - 5C082F7E 48000018 - 3C001578 60009200 - 5C072F3E 60E70100 - 39000000 B0E40028 - 9904002A 38000001 - 980400B3 990B00DF + 418202D0 818D97E8 + 2B0C0000 419A0018 + 898C0064 2E8C0009 + 38000021 5C00656B + 408202B0 70A00004 + 41A20040 881F0008 + 2C000008 41820034 + 881F000E 3D40803B + 394A40E8 7CEA00AE + 2C070001 40810284 + 38070001 5400EFFE + 7CE70214 54E7403E + 60E700FF 4800011C + 70A00008 41A20264 + 48000045 00141516 + 0017181D 34000090 + 2F2E3020 32293328 + 2A1FBA3C 371E213A + 0E2C3900 00010507 + 08090200 123457D0 + 24567000 12234070 + 23467001 7D8903A6 + 4E800420 7D2802A6 + 54A6CF3A 50A6E7BC + 50A6D7FE 54A0F77A + 7CC60378 54A0C738 + 50A0B77C 7CC60378 + 54A3873F 41820054 + 2C030009 418200B0 + 3C00C84A 6000C004 + 1C630003 5C031F7E + 5465103A 2C06000C + 408000D4 2C06000A + 408000EC 2C060008 + 408000A8 3C005689 + 60000234 546C103A + 5C0C652E 7CC76378 + 54C8077E 480000DC + A0FF000E 2C060000 + 41820028 2C060004 + 41820040 2C06000A + 41820040 7C0930AE + 540744AE 5408CFFE + 1D080007 480000AC + 88040007 2C000000 + 40820014 A01F000A + B01F000E 9BA40007 + 48000008 A0FF0012 + 890B00DF 4800008C + A0E40028 8904002A + 48000078 3989000C + 7C0C30AE 540744AE + 5007CFFE 3C00AC1A + 60005CA2 1D860003 + 5C08677E 48000054 + 39890018 7C0C18AE + 540744AE 3C001373 + 60002301 5C082F7E + 48000038 3989FFF8 + 54C016B8 7C0C006E + 5C072F7E 5007252E + 800C0004 5C082F7E + 48000018 3C001578 + 60009200 5C072F3E + 60E70100 39000000 + B0E40028 9904002A + 9BA400B3 990B00DF 38000000 900B00D8 A00B00CC 60004000 54000524 B00B00CC @@ -150,11 +154,26 @@ 3800003B 41820008 38000000 B00C00E4 A00C00E2 540007FA - B00C00E2 54FDD7BE - 3BBD0005 00000000 + B00C00E2 409A0010 + 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 - C22A6170 00000052 + C22A6170 00000065 3C80817F 816D9FA0 3D808040 80AC4484 20050022 540A043D @@ -163,69 +182,73 @@ 28830001 4C451102 40A2000C 38A00008 90AC4484 7C7D1B79 - 4182024C 818D9FB8 - 7D8C6379 41820014 - 898C0064 38000021 - 5C00656B 40820230 - 70A00004 41A20040 - 881F0008 2C000008 - 41820034 881F000E - 3D40803E 394AF498 - 7CEA00AE 2C070001 - 40810204 38070001 - 5400EFFE 7CE70214 - 54E7403E 60E700FF - 480000FC 70A00008 - 41A201E4 4800003D - 00141516 0017181D - 34000090 2F2E3020 - 32293328 2A1FBA3C - 371E213A 0E2C3900 - 00010507 08090200 - 123457D0 24567000 - 12234070 23467001 - 7D2802A6 54A6CF3A - 50A6E7BC 50A6D7FE - 54A0F77A 7CC60378 - 54A0C738 50A0B77C - 7CC60378 54A3873F - 41820054 2C030009 - 41820098 3C00C84A - 6000C004 1C630003 - 5C031F7E 5465103A - 2C06000C 408000BC - 2C06000A 408000D4 - 2C060008 40800090 - 3C005689 60000234 - 546C103A 5C0C652E - 7CC76378 54C8077E - 480000C4 A0FF000E - 2C060000 41820028 - 2C060004 41820028 - 2C06000A 41820028 - 7C0930AE 540744AE - 5408CFFE 1D080007 - 48000094 A01F000A - B01F000E 890B00DF - 4800008C A0E40028 - 8904002A 48000078 - 3989000C 7C0C30AE - 540744AE 5007CFFE - 3C00AC1A 60005CA2 - 1D860003 5C08677E - 48000054 39890018 - 7C0C18AE 540744AE - 3C001373 60002301 - 5C082F7E 48000038 - 3989FFF8 54C016B8 - 7C0C006E 5C072F7E - 5007252E 800C0004 - 5C082F7E 48000018 - 3C001578 60009200 - 5C072F3E 60E70100 - 39000000 B0E40028 - 9904002A 38000001 - 980400B3 990B00DF + 418202D0 818D9FB8 + 2B0C0000 419A0018 + 898C0064 2E8C0009 + 38000021 5C00656B + 408202B0 70A00004 + 41A20040 881F0008 + 2C000008 41820034 + 881F000E 3D40803E + 394AF498 7CEA00AE + 2C070001 40810284 + 38070001 5400EFFE + 7CE70214 54E7403E + 60E700FF 4800011C + 70A00008 41A20264 + 48000045 00141516 + 0017181D 34000090 + 2F2E3020 32293328 + 2A1FBA3C 371E213A + 0E2C3900 00010507 + 08090200 123457D0 + 24567000 12234070 + 23467001 7D8903A6 + 4E800420 7D2802A6 + 54A6CF3A 50A6E7BC + 50A6D7FE 54A0F77A + 7CC60378 54A0C738 + 50A0B77C 7CC60378 + 54A3873F 41820054 + 2C030009 418200B0 + 3C00C84A 6000C004 + 1C630003 5C031F7E + 5465103A 2C06000C + 408000D4 2C06000A + 408000EC 2C060008 + 408000A8 3C005689 + 60000234 546C103A + 5C0C652E 7CC76378 + 54C8077E 480000DC + A0FF000E 2C060000 + 41820028 2C060004 + 41820040 2C06000A + 41820040 7C0930AE + 540744AE 5408CFFE + 1D080007 480000AC + 88040007 2C000000 + 40820014 A01F000A + B01F000E 9BA40007 + 48000008 A0FF0012 + 890B00DF 4800008C + A0E40028 8904002A + 48000078 3989000C + 7C0C30AE 540744AE + 5007CFFE 3C00AC1A + 60005CA2 1D860003 + 5C08677E 48000054 + 39890018 7C0C18AE + 540744AE 3C001373 + 60002301 5C082F7E + 48000038 3989FFF8 + 54C016B8 7C0C006E + 5C072F7E 5007252E + 800C0004 5C082F7E + 48000018 3C001578 + 60009200 5C072F3E + 60E70100 39000000 + B0E40028 9904002A + 9BA400B3 990B00DF 38000000 900B00D8 A00B00CC 60004000 54000524 B00B00CC @@ -235,11 +258,26 @@ 3800003B 41820008 38000000 B00C00E4 A00C00E2 540007FA - B00C00E2 54FDD7BE - 3BBD0005 00000000 + B00C00E2 409A0010 + 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 - C229E080 00000052 + C229E080 00000065 3C80817F 816D9EC8 3D808040 80ACBC24 20050022 540A043D @@ -248,69 +286,73 @@ 28830001 4C451102 40A2000C 38A00008 90ACBC24 7C7D1B79 - 4182024C 818D9EE0 - 7D8C6379 41820014 - 898C0064 38000021 - 5C00656B 40820230 - 70A00004 41A20040 - 881F0008 2C000008 - 41820034 881F000E - 3D40803D 394A6DB0 - 7CEA00AE 2C070001 - 40810204 38070001 - 5400EFFE 7CE70214 - 54E7403E 60E700FF - 480000FC 70A00008 - 41A201E4 4800003D - 00141516 0017181D - 34000090 2F2E3020 - 32293328 2A1FBA3C - 371E213A 0E2C3900 - 00010507 08090200 - 123457D0 24567000 - 12234070 23467001 - 7D2802A6 54A6CF3A - 50A6E7BC 50A6D7FE - 54A0F77A 7CC60378 - 54A0C738 50A0B77C - 7CC60378 54A3873F - 41820054 2C030009 - 41820098 3C00C84A - 6000C004 1C630003 - 5C031F7E 5465103A - 2C06000C 408000BC - 2C06000A 408000D4 - 2C060008 40800090 - 3C005689 60000234 - 546C103A 5C0C652E - 7CC76378 54C8077E - 480000C4 A0FF000E - 2C060000 41820028 - 2C060004 41820028 - 2C06000A 41820028 - 7C0930AE 540744AE - 5408CFFE 1D080007 - 48000094 A01F000A - B01F000E 890B00DF - 4800008C A0E40028 - 8904002A 48000078 - 3989000C 7C0C30AE - 540744AE 5007CFFE - 3C00AC1A 60005CA2 - 1D860003 5C08677E - 48000054 39890018 - 7C0C18AE 540744AE - 3C001373 60002301 - 5C082F7E 48000038 - 3989FFF8 54C016B8 - 7C0C006E 5C072F7E - 5007252E 800C0004 - 5C082F7E 48000018 - 3C001578 60009200 - 5C072F3E 60E70100 - 39000000 B0E40028 - 9904002A 38000001 - 980400B3 990B00DF + 418202D0 818D9EE0 + 2B0C0000 419A0018 + 898C0064 2E8C0009 + 38000021 5C00656B + 408202B0 70A00004 + 41A20040 881F0008 + 2C000008 41820034 + 881F000E 3D40803D + 394A6DB0 7CEA00AE + 2C070001 40810284 + 38070001 5400EFFE + 7CE70214 54E7403E + 60E700FF 4800011C + 70A00008 41A20264 + 48000045 00141516 + 0017181D 34000090 + 2F2E3020 32293328 + 2A1FBA3C 371E213A + 0E2C3900 00010507 + 08090200 123457D0 + 24567000 12234070 + 23467001 7D8903A6 + 4E800420 7D2802A6 + 54A6CF3A 50A6E7BC + 50A6D7FE 54A0F77A + 7CC60378 54A0C738 + 50A0B77C 7CC60378 + 54A3873F 41820054 + 2C030009 418200B0 + 3C00C84A 6000C004 + 1C630003 5C031F7E + 5465103A 2C06000C + 408000D4 2C06000A + 408000EC 2C060008 + 408000A8 3C005689 + 60000234 546C103A + 5C0C652E 7CC76378 + 54C8077E 480000DC + A0FF000E 2C060000 + 41820028 2C060004 + 41820040 2C06000A + 41820040 7C0930AE + 540744AE 5408CFFE + 1D080007 480000AC + 88040007 2C000000 + 40820014 A01F000A + B01F000E 9BA40007 + 48000008 A0FF0012 + 890B00DF 4800008C + A0E40028 8904002A + 48000078 3989000C + 7C0C30AE 540744AE + 5007CFFE 3C00AC1A + 60005CA2 1D860003 + 5C08677E 48000054 + 39890018 7C0C18AE + 540744AE 3C001373 + 60002301 5C082F7E + 48000038 3989FFF8 + 54C016B8 7C0C006E + 5C072F7E 5007252E + 800C0004 5C082F7E + 48000018 3C001578 + 60009200 5C072F3E + 60E70100 39000000 + B0E40028 9904002A + 9BA400B3 990B00DF 38000000 900B00D8 A00B00CC 60004000 54000524 B00B00CC @@ -320,11 +362,26 @@ 3800003B 41820008 38000000 B00C00E4 A00C00E2 540007FA - B00C00E2 54FDD7BE - 3BBD0005 00000000 + B00C00E2 409A0010 + 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 - C2285FCC 00000052 + C2285FCC 00000065 3C80817F 816D9E60 3D80803F 80AC5458 20050022 540A043D @@ -333,69 +390,73 @@ 28830001 4C451102 40A2000C 38A00008 90AC5458 7C7D1B79 - 4182024C 818D9E78 - 7D8C6379 41820014 - 898C0064 38000021 - 5C00656B 40820230 - 70A00004 41A20040 - 881F0008 2C000008 - 41820034 881F000E - 3D40803D 394AF9B8 - 7CEA00AE 2C070001 - 40810204 38070001 - 5400EFFE 7CE70214 - 54E7403E 60E700FF - 480000FC 70A00008 - 41A201E4 4800003D - 00141516 0017181D - 34000090 2F2E3020 - 32293328 2A1FBA3C - 371E213A 0E2C3900 - 00010507 08090200 - 123457D0 24567000 - 12234070 23467001 - 7D2802A6 54A6CF3A - 50A6E7BC 50A6D7FE - 54A0F77A 7CC60378 - 54A0C738 50A0B77C - 7CC60378 54A3873F - 41820054 2C030009 - 41820098 3C00C84A - 6000C004 1C630003 - 5C031F7E 5465103A - 2C06000C 408000BC - 2C06000A 408000D4 - 2C060008 40800090 - 3C005689 60000234 - 546C103A 5C0C652E - 7CC76378 54C8077E - 480000C4 A0FF000E - 2C060000 41820028 - 2C060004 41820028 - 2C06000A 41820028 - 7C0930AE 540744AE - 5408CFFE 1D080007 - 48000094 A01F000A - B01F000E 890B00DF - 4800008C A0E40028 - 8904002A 48000078 - 3989000C 7C0C30AE - 540744AE 5007CFFE - 3C00AC1A 60005CA2 - 1D860003 5C08677E - 48000054 39890018 - 7C0C18AE 540744AE - 3C001373 60002301 - 5C082F7E 48000038 - 3989FFF8 54C016B8 - 7C0C006E 5C072F7E - 5007252E 800C0004 - 5C082F7E 48000018 - 3C001578 60009200 - 5C072F3E 60E70100 - 39000000 B0E40028 - 9904002A 38000001 - 980400B3 990B00DF + 418202D0 818D9E78 + 2B0C0000 419A0018 + 898C0064 2E8C0009 + 38000021 5C00656B + 408202B0 70A00004 + 41A20040 881F0008 + 2C000008 41820034 + 881F000E 3D40803D + 394AF9B8 7CEA00AE + 2C070001 40810284 + 38070001 5400EFFE + 7CE70214 54E7403E + 60E700FF 4800011C + 70A00008 41A20264 + 48000045 00141516 + 0017181D 34000090 + 2F2E3020 32293328 + 2A1FBA3C 371E213A + 0E2C3900 00010507 + 08090200 123457D0 + 24567000 12234070 + 23467001 7D8903A6 + 4E800420 7D2802A6 + 54A6CF3A 50A6E7BC + 50A6D7FE 54A0F77A + 7CC60378 54A0C738 + 50A0B77C 7CC60378 + 54A3873F 41820054 + 2C030009 418200B0 + 3C00C84A 6000C004 + 1C630003 5C031F7E + 5465103A 2C06000C + 408000D4 2C06000A + 408000EC 2C060008 + 408000A8 3C005689 + 60000234 546C103A + 5C0C652E 7CC76378 + 54C8077E 480000DC + A0FF000E 2C060000 + 41820028 2C060004 + 41820040 2C06000A + 41820040 7C0930AE + 540744AE 5408CFFE + 1D080007 480000AC + 88040007 2C000000 + 40820014 A01F000A + B01F000E 9BA40007 + 48000008 A0FF0012 + 890B00DF 4800008C + A0E40028 8904002A + 48000078 3989000C + 7C0C30AE 540744AE + 5007CFFE 3C00AC1A + 60005CA2 1D860003 + 5C08677E 48000054 + 39890018 7C0C18AE + 540744AE 3C001373 + 60002301 5C082F7E + 48000038 3989FFF8 + 54C016B8 7C0C006E + 5C072F7E 5007252E + 800C0004 5C082F7E + 48000018 3C001578 + 60009200 5C072F3E + 60E70100 39000000 + B0E40028 9904002A + 9BA400B3 990B00DF 38000000 900B00D8 A00B00CC 60004000 54000524 B00B00CC @@ -405,7 +466,22 @@ 3800003B 41820008 38000000 B00C00E4 A00C00E2 540007FA - B00C00E2 54FDD7BE - 3BBD0005 00000000 + B00C00E2 409A0010 + 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 diff --git a/InstantLevelSelectExtra/info.xml b/InstantLevelSelectExtra/info.xml index 3f16cb3..ff8ec05 100644 --- a/InstantLevelSelectExtra/info.xml +++ b/InstantLevelSelectExtra/info.xml @@ -3,8 +3,8 @@ Instant Level Select Extra レベル選択EX sup39(サポミク) - 1.1 - Feb 24, 2024 + 1.2 + Feb 25, 2024 ::: warning The code is disabled when paused and in Z menu. diff --git a/InstantLevelSelectExtra/make.py b/InstantLevelSelectExtra/make.py index e743e4b..2bf99a8 100644 --- a/InstantLevelSelectExtra/make.py +++ b/InstantLevelSelectExtra/make.py @@ -8,6 +8,8 @@ def main(g, ver): '.set $LevelSelect.area, 0x817F0028', '.set $LevelSelect.epFlag, 0x817F002A', '.set $LevelSelect.AreaLock, 0x817F002B', + # TODO conflict with Level Select + '.set $restartNActivated, 0x817F0007', ]); make_xml(main) diff --git a/InstantLevelSelectExtra/src/main.s b/InstantLevelSelectExtra/src/main.s index d57986b..90d3855 100644 --- a/InstantLevelSelectExtra/src/main.s +++ b/InstantLevelSelectExtra/src/main.s @@ -11,9 +11,20 @@ .set rApp, 31 # gpApplication .set rNextGameMode, 29 .set crAreaLock, 7 +.set crMarDirector, 6 +.set crWarping, 5 .set $btnLevelSelect, 0x8 # D_UP .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: ## prepare registers lis r817F, 0x817F @@ -50,7 +61,7 @@ .L.checkAreaLock.done: ## orig mr. rNextGameMode, r3 -## return now if still setting up +## return now if still setting up (nextGameMode != 0) beq .L.done @@ -58,10 +69,13 @@ .L.checkPaused: ### r12 = *gpMarDirector lwz r12, gpMarDirector$r13(r13) - mr. r12, r12 - beq .L.checkPaused.done -### if (u8) @ *gpMarDirector + 0x64 == 5 or 10 + cmplwi crMarDirector, r12, 0 + beq crMarDirector, .L.checkPaused.done +### r12 = gpMarDirector->gameMode 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) rlwnm. r0, r0, r12, 31-10, 31-10 # LSB 10 bne .L.done @@ -134,6 +148,10 @@ .long 0x12234070 .long 0x23467001 +call: + mtctr r12 + bctr + .L.LevelSelect: mflr rD @@ -198,7 +216,7 @@ b .L.loadStage handleSpecial: - lhz rAns, 0xE(rApp) # backup for handleRestartN + lhz rAns, 0xE(rApp) # set for handleRestart{N,Z} ## neutral cmpwi rIdx, 0 beq handleRestartN @@ -217,9 +235,23 @@ handleSpecial: b .L.loadStage 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) 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: ## load curMap, ep lbz rAnsEp, 0xDF(rFM) @@ -282,16 +314,13 @@ handlePlaza: /* rAns, rAnsEp, rFM, rApp, r817F */ .L.loadStageWithoutBackup: ## reset QFT - li r0, 1 - stb r0, 0xB3(r817F) + stb rNextGameMode, 0xB3(r817F) # >0 ## FlagManager ### epFlag(40003) stb rAnsEp, 0xDF(rFM) ### reset coin counter(40002) - li r0, 0 + li r0, 0 ## FIXME: make use of other register stw r0, 0xD8(rFM) -##### set SGT Stop Stopwatch Flag = 0 -# stw r0, 0x10C(r817F) ### set flag lhz r0, 0xCC(rFM) #### Got a Shine in previous stage (30006) @@ -322,9 +351,46 @@ handlePlaza: rlwinm r0, r0, 0, 31, 29 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) rlwinm rNextGameMode, rAns, 32-6, 0x3 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: + +## 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: