feat: add InstantLevelSelect
This commit is contained in:
parent
1fb4a18b6a
commit
ce36acba05
5 changed files with 763 additions and 0 deletions
362
InstantLevelSelect/@code.xml
Normal file
362
InstantLevelSelect/@code.xml
Normal file
|
@ -0,0 +1,362 @@
|
|||
<code>
|
||||
<category>misc</category>
|
||||
<title lang="en-US">Instant Level Select</title>
|
||||
<title lang="ja-JP">レベル選択DX</title>
|
||||
<author>sup39(サポミク)</author>
|
||||
<version>0.4</version>
|
||||
<date>Feb 21, 2023</date>
|
||||
<description lang="en-US">
|
||||
::: warning
|
||||
Shine Get Timer does not restart with this code.
|
||||
:::
|
||||
::: warning
|
||||
Z menu will be disabled
|
||||
:::
|
||||
|
||||
#### Instant Restart
|
||||
- Press `B + D-Pad Up` to **restart the current area**
|
||||
- The **respawn position** will be the same. It can be used to practice Honey Skip or stage movement in Delfino Plaza
|
||||
|
||||
#### Level Select
|
||||
Press `{the following button combination} + B + D-Pad Up` to warp to other area instantly.
|
||||
![Level Select Combinations](/img/levelselect.png)
|
||||
|
||||
- For `Z + B + D-Pad Up`, the current area will be restarted, but the **respawn position will be reset**. It is like B+Up, but the respawn position will be the default position instead of the previous one
|
||||
- For `Y + B + D-Pad Up`, it will restart from the **previous selected area**. For example, if you select SB4 with this code, and enter hotel/casino then press Y+B+Up, it will restart from SB4 beach (instead of hotel/casino if you use B+Up or Z+B+Up)
|
||||
|
||||
#### Area Lock
|
||||
- Press `R + D-Pad Left/Right` to enable/disable **Area Lock**
|
||||
- With Area Lock, warps will restart the current area instead of sending Mario to other areas, which can be used to practice specific area (e.g. outside of BH2 wildmill, secret stage entering)
|
||||
- Restarting acts like B+Up, and therefore can be used to practice Honey Skip, etc.
|
||||
|
||||
#### Example of Usage: Practising Honey Skip
|
||||
1. Press `R + D-Pad Left` to enable Area Lock
|
||||
2. Press `C-Stick LeftDown + B + D-Pad Up` to go to Pianta Village
|
||||
3. Press `C-Stick RightDown + Y + B + D-Pad Up` to go to Pinna unlock plaza
|
||||
4. Practice Honey Skip as much as you want! It will restart automatically when you are going to leave the area so you don't need to reset manually. You can also restart with `B + D-Pad Up` if you want.
|
||||
</description>
|
||||
<description lang="ja-JP">
|
||||
::: warning
|
||||
シャインゲットタイマーには未対応です。
|
||||
:::
|
||||
::: warning
|
||||
Zメニューは無効化されます。
|
||||
:::
|
||||
|
||||
#### ポーズせずにやり直し
|
||||
- `B+十字キー上`で**現在のエリアをやり直す**
|
||||
- ドルピックタウンでは同じ開始位置からやり直すので、ハニスキといったステージ移動の練習も可能
|
||||
#### レベル選択
|
||||
`{次のボタン}+B+十字キー上`でレベル選択
|
||||
|
||||
![レベル選択](/img/levelselect.png)
|
||||
|
||||
- `Z+B+上`は**現在のエリアをやり直す**が、ドルピックタウンでの**開始位置がリセット**され、デフォルトの開始位置からとなる(B+上の場合はリセットされない)
|
||||
- `Y+B+上`は**前回選択したレベル**からやり直す(例えばSB4を選択し、ホテル・カジノに入ってY+B+上を押すと、ホテル外からやり直すことになる)
|
||||
#### エリアロック
|
||||
`R+十字キー左/右`でエリアロック/ロック解除
|
||||
- エリアロックするとステージ移動がやり直しに置き換え、ヒミツINといった特定のエリアの練習が可能
|
||||
- やり直しの動作はB+上と同じなので、ハニスキなどの練習にも使える
|
||||
#### 使用例:ハニスキの練習
|
||||
1. `R + 十字キー左`でエリアロック
|
||||
2. `Cスティック左下 + B + 十字キー上`でモンテの村に移動
|
||||
3. `Cスティック右下 + Y + B + 十字キー上`でピンナ解放のドルピックタウンに移動
|
||||
4. これで好きなだけハニスキを練習できます。他のエリアに入ろうとする時に自動的にやり直すので、手動でやり直す必要がありません。必要であれば`B + 十字キー上`でやり直すこともできます。
|
||||
</description>
|
||||
<source version="GMSJ01">
|
||||
C60EB020 800EB02C
|
||||
C20F9B74 00000046
|
||||
3C80817F 816D97D0
|
||||
3D808040 80AC0D80
|
||||
20050022 540A043D
|
||||
41820008 8804002B
|
||||
540007FF 9804002B
|
||||
28830001 4C451102
|
||||
40A2000C 38A00208
|
||||
90AC0D80 7C7D1B79
|
||||
418201EC 4800003D
|
||||
00141516 0017181D
|
||||
34000090 2F2E3020
|
||||
32293328 2A1FBA3C
|
||||
371E213A 0E2C3900
|
||||
00010507 08090200
|
||||
123457D0 24567000
|
||||
12234070 23467001
|
||||
7D2802A6 70A00208
|
||||
28000208 40A201A0
|
||||
54A6CF38 50A6F77A
|
||||
50A6E7BC 50A6D7FE
|
||||
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
|
||||
38000000 900B00D8
|
||||
A00B00CC 60004000
|
||||
54000524 B00B00CC
|
||||
B0FF0012 54E0C63E
|
||||
819F0020 2C000007
|
||||
2C80000E 4C423382
|
||||
3800003B 41820008
|
||||
38000000 B00C00E4
|
||||
A00C00E2 540007FA
|
||||
B00C00E2 54FDD7BE
|
||||
3BBD0005 00000000
|
||||
</source>
|
||||
<source version="GMSE01">
|
||||
C6297A64 80297A70
|
||||
C22A6170 00000046
|
||||
3C80817F 816D9FA0
|
||||
3D808040 80AC4484
|
||||
20050022 540A043D
|
||||
41820008 8804002B
|
||||
540007FF 9804002B
|
||||
28830001 4C451102
|
||||
40A2000C 38A00208
|
||||
90AC4484 7C7D1B79
|
||||
418201EC 4800003D
|
||||
00141516 0017181D
|
||||
34000090 2F2E3020
|
||||
32293328 2A1FBA3C
|
||||
371E213A 0E2C3900
|
||||
00010507 08090200
|
||||
123457D0 24567000
|
||||
12234070 23467001
|
||||
7D2802A6 70A00208
|
||||
28000208 40A201A0
|
||||
54A6CF38 50A6F77A
|
||||
50A6E7BC 50A6D7FE
|
||||
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
|
||||
38000000 900B00D8
|
||||
A00B00CC 60004000
|
||||
54000524 B00B00CC
|
||||
B0FF0012 54E0C63E
|
||||
819F0020 2C000007
|
||||
2C80000E 4C423382
|
||||
3800003B 41820008
|
||||
38000000 B00C00E4
|
||||
A00C00E2 540007FA
|
||||
B00C00E2 54FDD7BE
|
||||
3BBD0005 00000000
|
||||
</source>
|
||||
<source version="GMSP01">
|
||||
C628F8FC 8028F908
|
||||
C229E080 00000046
|
||||
3C80817F 816D9EC8
|
||||
3D808040 80ACBC24
|
||||
20050022 540A043D
|
||||
41820008 8804002B
|
||||
540007FF 9804002B
|
||||
28830001 4C451102
|
||||
40A2000C 38A00208
|
||||
90ACBC24 7C7D1B79
|
||||
418201EC 4800003D
|
||||
00141516 0017181D
|
||||
34000090 2F2E3020
|
||||
32293328 2A1FBA3C
|
||||
371E213A 0E2C3900
|
||||
00010507 08090200
|
||||
123457D0 24567000
|
||||
12234070 23467001
|
||||
7D2802A6 70A00208
|
||||
28000208 40A201A0
|
||||
54A6CF38 50A6F77A
|
||||
50A6E7BC 50A6D7FE
|
||||
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
|
||||
38000000 900B00D8
|
||||
A00B00CC 60004000
|
||||
54000524 B00B00CC
|
||||
B0FF0012 54E0C63E
|
||||
819F0020 2C000007
|
||||
2C80000E 4C423382
|
||||
3800003B 41820008
|
||||
38000000 B00C00E4
|
||||
A00C00E2 540007FA
|
||||
B00C00E2 54FDD7BE
|
||||
3BBD0005 00000000
|
||||
</source>
|
||||
<source version="GMSJ0A">
|
||||
C627770C 80277718
|
||||
C2285FCC 00000046
|
||||
3C80817F 816D9E60
|
||||
3D80803F 80AC5458
|
||||
20050022 540A043D
|
||||
41820008 8804002B
|
||||
540007FF 9804002B
|
||||
28830001 4C451102
|
||||
40A2000C 38A00208
|
||||
90AC5458 7C7D1B79
|
||||
418201EC 4800003D
|
||||
00141516 0017181D
|
||||
34000090 2F2E3020
|
||||
32293328 2A1FBA3C
|
||||
371E213A 0E2C3900
|
||||
00010507 08090200
|
||||
123457D0 24567000
|
||||
12234070 23467001
|
||||
7D2802A6 70A00208
|
||||
28000208 40A201A0
|
||||
54A6CF38 50A6F77A
|
||||
50A6E7BC 50A6D7FE
|
||||
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
|
||||
38000000 900B00D8
|
||||
A00B00CC 60004000
|
||||
54000524 B00B00CC
|
||||
B0FF0012 54E0C63E
|
||||
819F0020 2C000007
|
||||
2C80000E 4C423382
|
||||
3800003B 41820008
|
||||
38000000 B00C00E4
|
||||
A00C00E2 540007FA
|
||||
B00C00E2 54FDD7BE
|
||||
3BBD0005 00000000
|
||||
</source>
|
||||
</code>
|
28
InstantLevelSelect/README.md
Normal file
28
InstantLevelSelect/README.md
Normal file
|
@ -0,0 +1,28 @@
|
|||
# Instant Level Select
|
||||
|
||||
## Caveats
|
||||
- Shine Get Timer does not restart with this code
|
||||
- Z menu will be disabled
|
||||
|
||||
## Usage
|
||||
### Instant Restart
|
||||
- Press `B + D-Pad Up` to **restart the current area**
|
||||
- The **respawn position** will be the same. It can be used to practice Honey Skip or stage movement in Delfino Plaza
|
||||
|
||||
### Level Select
|
||||
Press `{the following button combination} + B + D-Pad Up` to warp to other area instantly.
|
||||
![Level Select Combinations](/img/levelselect.png)
|
||||
|
||||
- For `Z + B + D-Pad Up`, the current area will be restarted, but the **respawn position will be reset**. It is like B+Up, but the respawn position will be the default position instead of the previous one
|
||||
- For `Y + B + D-Pad Up`, it will restart from the **previous selected area**. For example, if you select SB4 with this code, and enter hotel/casino then press Y+B+Up, it will restart from SB4 beach (instead of hotel/casino if you use B+Up or Z+B+Up)
|
||||
|
||||
### Area Lock
|
||||
- Press `R + D-Pad Left/Right` to enable/disable **Area Lock**
|
||||
- With Area Lock, warps will restart the current area instead of sending Mario to other areas, which can be used to practice specific area (e.g. outside of BH2 wildmill, secret stage entering)
|
||||
- Restarting acts like B+Up, and therefore can be used to practice Honey Skip, etc.
|
||||
|
||||
### Example of Usage: Practising Honey Skip
|
||||
1. Press `R + D-Pad Left` to enable Area Lock
|
||||
2. Press `C-Stick LeftDown + B + D-Pad Up` to go to Pianta Village
|
||||
3. Press `C-Stick RightDown + Y + B + D-Pad Up` to go to Pinna unlock plaza
|
||||
4. Practice Honey Skip as much as you want! It will restart automatically when you are going to leave the area so you don't need to reset manually. You can also restart with `B + D-Pad Up` if you want.
|
66
InstantLevelSelect/info.xml
Normal file
66
InstantLevelSelect/info.xml
Normal file
|
@ -0,0 +1,66 @@
|
|||
<code>
|
||||
<category>misc</category>
|
||||
<title lang="en-US">Instant Level Select</title>
|
||||
<title lang="ja-JP">レベル選択DX</title>
|
||||
<author>sup39(サポミク)</author>
|
||||
<version>0.4</version>
|
||||
<date>Feb 21, 2023</date>
|
||||
<description lang="en-US">
|
||||
::: warning
|
||||
Shine Get Timer does not restart with this code.
|
||||
:::
|
||||
::: warning
|
||||
Z menu will be disabled
|
||||
:::
|
||||
|
||||
#### Instant Restart
|
||||
- Press `B + D-Pad Up` to **restart the current area**
|
||||
- The **respawn position** will be the same. It can be used to practice Honey Skip or stage movement in Delfino Plaza
|
||||
|
||||
#### Level Select
|
||||
Press `{the following button combination} + B + D-Pad Up` to warp to other area instantly.
|
||||
![Level Select Combinations](/img/levelselect.png)
|
||||
|
||||
- For `Z + B + D-Pad Up`, the current area will be restarted, but the **respawn position will be reset**. It is like B+Up, but the respawn position will be the default position instead of the previous one
|
||||
- For `Y + B + D-Pad Up`, it will restart from the **previous selected area**. For example, if you select SB4 with this code, and enter hotel/casino then press Y+B+Up, it will restart from SB4 beach (instead of hotel/casino if you use B+Up or Z+B+Up)
|
||||
|
||||
#### Area Lock
|
||||
- Press `R + D-Pad Left/Right` to enable/disable **Area Lock**
|
||||
- With Area Lock, warps will restart the current area instead of sending Mario to other areas, which can be used to practice specific area (e.g. outside of BH2 wildmill, secret stage entering)
|
||||
- Restarting acts like B+Up, and therefore can be used to practice Honey Skip, etc.
|
||||
|
||||
#### Example of Usage: Practising Honey Skip
|
||||
1. Press `R + D-Pad Left` to enable Area Lock
|
||||
2. Press `C-Stick LeftDown + B + D-Pad Up` to go to Pianta Village
|
||||
3. Press `C-Stick RightDown + Y + B + D-Pad Up` to go to Pinna unlock plaza
|
||||
4. Practice Honey Skip as much as you want! It will restart automatically when you are going to leave the area so you don't need to reset manually. You can also restart with `B + D-Pad Up` if you want.
|
||||
</description>
|
||||
<description lang="ja-JP">
|
||||
::: warning
|
||||
シャインゲットタイマーには未対応です。
|
||||
:::
|
||||
::: warning
|
||||
Zメニューは無効化されます。
|
||||
:::
|
||||
|
||||
#### ポーズせずにやり直し
|
||||
- `B+十字キー上`で**現在のエリアをやり直す**
|
||||
- ドルピックタウンでは同じ開始位置からやり直すので、ハニスキといったステージ移動の練習も可能
|
||||
#### レベル選択
|
||||
`{次のボタン}+B+十字キー上`でレベル選択
|
||||
|
||||
![レベル選択](/img/levelselect.png)
|
||||
|
||||
- `Z+B+上`は**現在のエリアをやり直す**が、ドルピックタウンでの**開始位置がリセット**され、デフォルトの開始位置からとなる(B+上の場合はリセットされない)
|
||||
- `Y+B+上`は**前回選択したレベル**からやり直す(例えばSB4を選択し、ホテル・カジノに入ってY+B+上を押すと、ホテル外からやり直すことになる)
|
||||
#### エリアロック
|
||||
`R+十字キー左/右`でエリアロック/ロック解除
|
||||
- エリアロックするとステージ移動がやり直しに置き換え、ヒミツINといった特定のエリアの練習が可能
|
||||
- やり直しの動作はB+上と同じなので、ハニスキなどの練習にも使える
|
||||
#### 使用例:ハニスキの練習
|
||||
1. `R + 十字キー左`でエリアロック
|
||||
2. `Cスティック左下 + B + 十字キー上`でモンテの村に移動
|
||||
3. `Cスティック右下 + Y + B + 十字キー上`でピンナ解放のドルピックタウンに移動
|
||||
4. これで好きなだけハニスキを練習できます。他のエリアに入ろうとする時に自動的にやり直すので、手動でやり直す必要がありません。必要であれば`B + 十字キー上`でやり直すこともできます。
|
||||
</description>
|
||||
</code>
|
23
InstantLevelSelect/make.py
Normal file
23
InstantLevelSelect/make.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
from supSMSGecko import make_xml, symbols
|
||||
|
||||
disable_z_addrs = {
|
||||
'GMSJ01': (0x800EB020, 0x800EB02C),
|
||||
'GMSJ0A': (0x8027770C, 0x80277718),
|
||||
'GMSP01': (0x8028F8FC, 0x8028F908),
|
||||
'GMSE01': (0x80297A64, 0x80297A70),
|
||||
}
|
||||
|
||||
def main(g, ver):
|
||||
S = symbols[ver]
|
||||
|
||||
# disable Z button
|
||||
g.branch(*disable_z_addrs[ver])
|
||||
|
||||
# Instant Level Select main function
|
||||
g.C2(0x220 + S['TApplication_gameLoop'], 'src/main.s', extra_as_input=[
|
||||
'.set $LevelSelect.area, 0x817F0028',
|
||||
'.set $LevelSelect.epFlag, 0x817F002A',
|
||||
'.set $LevelSelect.AreaLock, 0x817F002B',
|
||||
]);
|
||||
|
||||
make_xml(main)
|
284
InstantLevelSelect/src/main.s
Normal file
284
InstantLevelSelect/src/main.s
Normal file
|
@ -0,0 +1,284 @@
|
|||
.set rC, 3 # SHOULD NOT BE USE UNTIL checkAreaLock ENDS
|
||||
.set r817F, 4
|
||||
.set rBtn, 5
|
||||
.set rC4, 5
|
||||
.set rIdx, 6
|
||||
.set rAns, 7
|
||||
.set rAnsEp, 8
|
||||
.set rD, 9 # BL trick
|
||||
.set rApp, 31
|
||||
.set rFM, 11 # FlagManager
|
||||
.set rTmp, 10
|
||||
.set crAreaLock, 7
|
||||
|
||||
.L.prepare:
|
||||
## prepare registers
|
||||
lis r817F, 0x817F
|
||||
lwz rFM, TFlagManager_smInstance$r13(r13)
|
||||
|
||||
## read button input: [M]*1 [C]*1 [btn]*2
|
||||
lis r12, JUTGamePad_mPadButton@ha
|
||||
lwz rBtn, JUTGamePad_mPadButton@l(r12)
|
||||
|
||||
/** NOTE: DO NOT CHANGE r12 UNTIL checkAreaLock ENDS */
|
||||
.L.checkAreaLock:
|
||||
## r0 = 0x22 - btn
|
||||
subfic r0, rBtn, 0x22
|
||||
### (lower 16 bit of r0 & ~1) == 0 => use r0&1 as AreaLock enable state
|
||||
rlwinm. rTmp, r0, 0, 0x10, 0x1E
|
||||
beq .L.checkAreaLock.1
|
||||
### else, load r0 = current state from RAM
|
||||
lbz r0, $LevelSelect.AreaLock@l(r817F)
|
||||
.L.checkAreaLock.1:
|
||||
## !cr0.eq: AreaLock enabled
|
||||
rlwinm. r0, r0, 0, 0x1
|
||||
## write current enable state to RAM
|
||||
stb r0, $LevelSelect.AreaLock@l(r817F)
|
||||
|
||||
## activate AreaLock only if director finished (r29 > 1)
|
||||
cmplwi cr1, r3, 1
|
||||
crandc eq, 4*cr1+gt, eq
|
||||
bne+ .L.checkAreaLock.done
|
||||
|
||||
## set button input to (handleRestartN) if AreaLock enabled
|
||||
li rBtn, 0x208
|
||||
stw rBtn, JUTGamePad_mPadButton@l(r12)
|
||||
|
||||
.L.checkAreaLock.done:
|
||||
## orig
|
||||
mr. r29, r3
|
||||
## return now if still setting up
|
||||
beq .L.done
|
||||
|
||||
|
||||
## Level Select
|
||||
bl .L.LevelSelect
|
||||
.D:
|
||||
.D.Special:
|
||||
# 8 bit/entry: [1bit] epFlag==7 | [7bit] area
|
||||
.long 0x00141516
|
||||
.long 0x0017181D
|
||||
.long 0x34000090 # Red coin fish@NB8: 0x80|0x10
|
||||
.D.Secrets:
|
||||
# 8 bit/entry: [1bit] ep==1 | [7bit] area
|
||||
.long 0x2F2E3020
|
||||
.long 0x32293328
|
||||
.long 0x2A1FBA3C
|
||||
.D.Sublevels:
|
||||
# 8 bit/entry
|
||||
.long 0x371E213A
|
||||
.long 0x0E2C3900
|
||||
.D.Plaza:
|
||||
.long 0x00010507
|
||||
.long 0x08090200
|
||||
.D.Extra:
|
||||
.D.PinnaPark:
|
||||
## ep: 0,1,2,3,4,5,7 | area=D
|
||||
## epFlag: 0,2,4,5,6,7,0
|
||||
.long 0x123457D0
|
||||
.long 0x24567000
|
||||
.D.SirenaHotel:
|
||||
## ep: 0,1,2,2,3,4 | area=7
|
||||
## episo: 1,2,3,4,6,7
|
||||
.long 0x12234070
|
||||
.long 0x23467001
|
||||
|
||||
.L.LevelSelect:
|
||||
mflr rD
|
||||
|
||||
.L.checkDisabled:
|
||||
## check input
|
||||
### goto done if r0!=0x208
|
||||
andi. r0, rBtn, 0x208
|
||||
cmplwi r0, 0x208
|
||||
bne+ .L.done
|
||||
|
||||
.L.main:
|
||||
## calc index
|
||||
## btn: S YXZA -LRZ ----
|
||||
## XZRL=8,4,2,1
|
||||
rlwinm rIdx, rBtn, 32-7, 0x8 # X=8
|
||||
rlwimi rIdx, rBtn, 32-2, 0x4 # Z=4
|
||||
rlwimi rIdx, rBtn, 32-4, 0x2 # R=2
|
||||
rlwimi rIdx, rBtn, 32-6, 0x1 # L=1
|
||||
## YSY=8,4,2
|
||||
rlwinm r0, rBtn, 32- 8, 0x8 # Y=+8
|
||||
rlwimi r0, rBtn, 32-10, 0x6 # S,Y=4,+2
|
||||
## merge XZRL and YSY-
|
||||
or rIdx, rIdx, r0
|
||||
# TODO? handle rIdx>=12
|
||||
|
||||
## check C==0(Special) or 9(Secrets)
|
||||
rlwinm. rC, rBtn, 32-16, 0xF
|
||||
beq handleSpecial
|
||||
cmpwi rC, 9
|
||||
beq handleSecrets
|
||||
|
||||
## calc C index
|
||||
### [(*), 6, 2, (*); 4, 5, 3, (*); 0, (*), 1]
|
||||
### 110 0/10 00/0 100/ 101 0|11 00/0 000/ 000 0/01 00
|
||||
.set CIdxMagic, 06204530001<<(32-3*10)
|
||||
### CIdx = magic <<(3*C) &7
|
||||
lis r0, CIdxMagic@h
|
||||
ori r0, r0, CIdxMagic@l
|
||||
mulli rC, rC, 3
|
||||
rlwnm rC, r0, rC, 0x7
|
||||
## prepare CIdx<<2 (destroy rBtn)
|
||||
slwi rC4, rC, 2
|
||||
|
||||
## Y+Z(14) -> SirenaHotel
|
||||
## X+Z(12) -> PinnaPark
|
||||
cmpwi rIdx, 12
|
||||
bge handleExtra
|
||||
|
||||
## Y(10) -> Plaza
|
||||
cmpwi rIdx, 10
|
||||
bge handlePlaza
|
||||
## X(8) -> Sublevels
|
||||
cmpwi rIdx, 8
|
||||
bge handleSublevels
|
||||
|
||||
## stage
|
||||
### area: [2, 3, 4, 5, 6, 8, 9, (*)]
|
||||
### magic = 0x34568902 rotl sizeof(0xFF)
|
||||
### ans = idx | (magic<<(Cidx<<2)) &0x0F00
|
||||
### ep = idx
|
||||
lis r0, 0x5689
|
||||
ori r0, r0, 0x0234
|
||||
slwi r12, rC, 2
|
||||
rlwnm r12, r0, r12, 0x0F00
|
||||
or rAns, rIdx, r12
|
||||
rlwinm rAnsEp, rIdx, 0, 0x7
|
||||
b .L.loadStage
|
||||
|
||||
handleSpecial:
|
||||
lhz rAns, 0xE(rApp) # backup for handleRestartN
|
||||
## neutral
|
||||
cmpwi rIdx, 0
|
||||
beq handleRestartN
|
||||
## Z restart
|
||||
cmpwi rIdx, 4
|
||||
beq handleRestartZ
|
||||
## Y restart
|
||||
cmpwi rIdx, 10
|
||||
beq handleRestartY
|
||||
## Special
|
||||
# rD = .D.Special
|
||||
lbzx r0, rD, rIdx # offset = idx
|
||||
rlwinm rAns, r0, 8, 0x3F00
|
||||
rlwinm rAnsEp, r0, 32-7, 0x1
|
||||
mulli rAnsEp, rAnsEp, 7
|
||||
b .L.loadStage
|
||||
|
||||
handleRestartN:
|
||||
## set prevMap = curMap
|
||||
lhz r0, 0xA(rApp)
|
||||
sth r0, 0xE(rApp)
|
||||
handleRestartZ:
|
||||
## load curMap, ep
|
||||
lbz rAnsEp, 0xDF(rFM)
|
||||
b .L.loadStageWithoutBackup
|
||||
handleRestartY: # load 817F0000
|
||||
lhz rAns, $LevelSelect.area@l(r817F)
|
||||
lbz rAnsEp, $LevelSelect.epFlag@l(r817F)
|
||||
b .L.loadStage
|
||||
|
||||
handleSecrets:
|
||||
la r12, .D.Secrets-.D(rD)
|
||||
lbzx r0, r12, rIdx
|
||||
rlwinm rAns, r0, 8, 0x3F00
|
||||
rlwimi rAns, r0, 32-7, 0x0001
|
||||
# ep: 2,5,3,0,1,5,1,3,4,5,0,*
|
||||
.set SecretEpMagic, 05301513450<<2 | 02
|
||||
lis r0, SecretEpMagic@h
|
||||
ori r0, r0, SecretEpMagic@l
|
||||
mulli r12, rIdx, 3
|
||||
rlwnm rAnsEp, r0, r12, 0x7
|
||||
b .L.loadStage
|
||||
|
||||
handleSublevels:
|
||||
la r12, .D.Sublevels-.D(rD)
|
||||
lbzx r0, r12, rC # Cidx as index
|
||||
rlwinm rAns, r0, 8, 0x3F00
|
||||
# ep: 1,1,3,7,3,2,3
|
||||
.set SublevelEpMagic, 0x13732301
|
||||
lis r0, SublevelEpMagic@h
|
||||
ori r0, r0, SublevelEpMagic@l
|
||||
rlwnm rAnsEp, r0, rC4, 0x7
|
||||
b .L.loadStage
|
||||
|
||||
handleExtra:
|
||||
la r12, .D.Extra-.D-12*4(rD)
|
||||
rlwinm r0, rIdx, 2, 0x38 # offset: {12,14}<<2
|
||||
lwzux r0, r12, r0
|
||||
rlwnm rAns, r0, rC4, 0x7 # ep
|
||||
rlwimi rAns, r0, 4, 0x0F00 # a0 => aEE
|
||||
lwz r0, 4(r12)
|
||||
rlwnm rAnsEp, r0, rC4, 0x7
|
||||
b .L.loadStage
|
||||
|
||||
handlePlaza:
|
||||
## [0, 1, 5, 7; 8, 9, 2, (*)]
|
||||
## 15789200
|
||||
## ans == 0x0100 | (magic << (arr:=CIdx<<2) &0xF)
|
||||
.set PlazaEpMagic, 0x15789200
|
||||
lis r0, PlazaEpMagic@h
|
||||
ori r0, r0, PlazaEpMagic@l
|
||||
rlwnm rAns, r0, rC4, 0xF
|
||||
ori rAns, rAns, 0x0100
|
||||
li rAnsEp, 0
|
||||
|
||||
.L.loadStage:
|
||||
### backup to 817F0000 (for Y)
|
||||
sth rAns, $LevelSelect.area@l(r817F)
|
||||
stb rAnsEp, $LevelSelect.epFlag@l(r817F)
|
||||
|
||||
/* rAns, rAnsEp, rFM, rApp, r817F */
|
||||
.L.loadStageWithoutBackup:
|
||||
## reset QFT
|
||||
li r0, 1
|
||||
stb r0, 0xB3(r817F)
|
||||
## FlagManager
|
||||
### epFlag(40003)
|
||||
stb rAnsEp, 0xDF(rFM)
|
||||
### reset coin counter(40002)
|
||||
li r0, 0
|
||||
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)
|
||||
ori r0, r0, 0x4000
|
||||
#### clear watched Pinna kidnap FMV flag (prevent spawn in PP unlocked position)
|
||||
rlwinm r0, r0, 0, 0x14, 0x12
|
||||
sth r0, 0xCC(rFM)
|
||||
## rApp = gpApplication
|
||||
### write nextArea
|
||||
sth rAns, 0x12(rApp)
|
||||
|
||||
.set rMGP, 12
|
||||
# SirenaHotel(0x07) or Casino(0x0E) ? 59 : 0
|
||||
rlwinm r0, rAns, 32-8, 0xFF # area
|
||||
lwz rMGP, 0x20(rApp) # TMarioGamePad*
|
||||
cmpwi r0, 0x07 # SirenaHotel
|
||||
cmpwi cr1, r0, 0x0E # Casino
|
||||
cror eq, eq, 4*cr1+eq
|
||||
li r0, 59
|
||||
beq- .L.handleStickCD
|
||||
li r0, 0
|
||||
.L.handleStickCD:
|
||||
sth r0, 0xe4(rMGP)
|
||||
|
||||
.L.handleStickFlag:
|
||||
## clear 0x2 bit of 0xe2 flag
|
||||
lhz r0, 0xe2(rMGP)
|
||||
rlwinm r0, r0, 0, 31, 29
|
||||
sth r0, 0xe2(rMGP)
|
||||
|
||||
## nextGameMode = nextArea == (shine select) ? 8 : 5
|
||||
### (Note: all valid area id < 0x40)
|
||||
rlwinm r29, rAns, 32-6, 0x3 # 0xC0 => 0x03
|
||||
addi r29, r29, 5
|
||||
|
||||
.L.done:
|
Loading…
Reference in a new issue