diff --git a/InstantLevelSelectExtra/@code.xml b/InstantLevelSelectExtra/@code.xml
index aa8974c..0ce354b 100644
--- a/InstantLevelSelectExtra/@code.xml
+++ b/InstantLevelSelectExtra/@code.xml
@@ -3,7 +3,7 @@
Instant Level Select Extra
レベル選択EX
sup39(サポミク)
- 1.3
+ 1.3.1
Feb 25, 2024
::: warning
@@ -69,7 +69,7 @@
4. これで好きなだけハニスキを練習できます。他のエリアに入ろうとする時に自動的にやり直すので、手動でやり直す必要がありません。必要であれば`十字キー上`でやり直すこともできます。
diff --git a/InstantLevelSelectExtra/info.xml b/InstantLevelSelectExtra/info.xml
index ac3525e..7e7d314 100644
--- a/InstantLevelSelectExtra/info.xml
+++ b/InstantLevelSelectExtra/info.xml
@@ -3,7 +3,7 @@
Instant Level Select Extra
レベル選択EX
sup39(サポミク)
- 1.3
+ 1.3.1
Feb 25, 2024
::: warning
diff --git a/InstantLevelSelectExtra/src/main.s b/InstantLevelSelectExtra/src/main.s
index b41a14e..981f832 100644
--- a/InstantLevelSelectExtra/src/main.s
+++ b/InstantLevelSelectExtra/src/main.s
@@ -11,6 +11,8 @@
.set rApp, 31 # gpApplication
.set rNextGameMode, 29
.set crAreaLock, 7
+.set crArea9, 6
+.set crArea234568, 5
.set $btnLevelSelect, 0x8 # D_UP
.set $btnShineSelect, 0x4 # D_DOWN
@@ -18,12 +20,6 @@
lis \reg, \val@h
ori \reg, \reg, \val@l
.endm
-#.macro call addr
-# li32 r12, \addr
-# mtlr r12
-# blrl r12
-# #bl call
-#.endm
.L.prepare:
## prepare registers
@@ -146,10 +142,6 @@
.long 0x12234070
.long 0x23467001
-#call:
-# mtctr r12
-# bctr
-
.L.LevelSelect:
mflr rD
@@ -316,48 +308,74 @@ handlePlaza:
### write nextArea
sth rAns, 0x12(rApp)
-.set rMGP, 12
-# SirenaHotel(0x07) or Casino(0x0E) ? 59 : 0
+.L.handleStickCD:
+ lwz r12, 0x20(rApp) # TMarioGamePad*
+## area
rlwinm r0, rAns, 32-8, 0xFF # area
- lwz rMGP, 0x20(rApp) # TMarioGamePad*
+## crArea9(eq): area == 9
+ cmpwi crArea9, r0, 9
+## crArea234568(eq)
+### cr1(gt): area >= 0x10
+ cmplwi cr1, r0, 0xF
+### cr0(eq): area magic == 0
+ li rTmp, 0x7D # 234568 => 111_1101
+ rlwnm. rTmp, rTmp, r0, 31-8, 31-8 # LSB 8
+### crArea234568(eq) = !(area >= 0x10) && !(area magic == 0)
+ crnor 4*crArea234568+eq, 4*cr1+gt, eq
+## SirenaHotel(0x07) or Casino(0x0E) ? 59 : 0
cmpwi r0, 0x07 # SirenaHotel
cmpwi cr1, r0, 0x0E # Casino
- cror eq, eq, 4*cr1+eq
+ cror eq, eq, 4*cr1+eq # (NOTE: cannot use rlwnm trick since area may >= 0x20)
li r0, 59
- beq- .L.handleStickCD
+ beq- .L.handleStickCD.apply
li r0, 0
-.L.handleStickCD:
- sth r0, 0xe4(rMGP)
+.L.handleStickCD.apply:
+ sth r0, 0xe4(r12)
.L.handleStickFlag:
## clear 0x2 bit of 0xe2 flag
- lhz r0, 0xe2(rMGP)
+ lhz r0, 0xe2(r12)
rlwinm r0, r0, 0, 31, 29
- sth r0, 0xe2(rMGP)
+ sth r0, 0xe2(r12)
## set nextGameMode if gpMarDirector == NULL
### nextGameMode = nextArea == (shine select) ? 8 : 5
## ep==0xFF ? 3 : 0 (Note: all valid ep id < 0x40)
- rlwinm rNextGameMode, rAns, 32-6, 0x3
+ ## cr0(eq) == ep!=0xFF
+ rlwinm. rNextGameMode, rAns, 32-6, 0x3
addi rNextGameMode, rNextGameMode, 5
.L.setFader:
## TSMSFader::setFadeStatus(gpApplication.fader, FadedOut(=0))
lwz r12, 0x34(rApp)
+.L.setFader.status:
### this->status = FadedOut(0);
li r0, 0
stw r0, 0x20(r12)
+.L.setFader.color:
+## TSMSFader::setColor(gpApplication.fader, color)
+/**
+ * (9, *) => white (0xd2d2d2ff)
+ * (*, 0xFF) => black (0xff)
+ * (2|3|4|5|6|8, *) => white
+ * _ => black
+ */
+### area == 9 => white
+ beq crArea9, .L.setFader.color.white
+### !(ep != 0xFF) => black (Note: DO NOT DESTROY cr0 UNTIL HERE!)
+ bne cr0, .L.setFader.color.black
+### area != 2|3|4|5|6|8 => black
+ bne crArea234568, .L.setFader.color.black
+.L.setFader.color.white:
+ li32 r0, 0xd2d2d200
+.L.setFader.color.black:
+ ori r0, r0, 0xff # r0 = 0 in .L.setFader.status
+.L.setFader.color.apply:
+ stw r0, 0x18(r12)
+
### this->color->a = 0xff; (overwritten afterward)
### (this->wipeRequest).type = 0x12;
li r0, 0x12
stw r0, 0x24(r12)
-## TSMSFader::setColor(gpApplication.fader, color=0xff)
-### this->color = rAns == 0x09FF ? 0xd2d2d2ff : 0xff
- li r0, 0xff
- cmplwi rAns, 0x09FF
- bne+ .L.setFader.color.apply
- li32 r0, 0xd2d2d2ff
-.L.setFader.color.apply:
- stw r0, 0x18(r12)
.L.done: