From 69b2b83ac585121b6cc37ff8fdcddf9ebd5cd5ce Mon Sep 17 00:00:00 2001 From: Treeki Date: Sat, 15 Sep 2012 17:48:38 +0200 Subject: initial version of file select --- src/fileselect.S | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 src/fileselect.S (limited to 'src/fileselect.S') diff --git a/src/fileselect.S b/src/fileselect.S new file mode 100644 index 0000000..b243e7f --- /dev/null +++ b/src/fileselect.S @@ -0,0 +1,120 @@ +.set sp,1 +.set rtoc,2 + +.text +.extern enableNonLoopAnim__Q23m2d13EmbedLayout_cFib +.global FSShowCD, FSHideCD +FSShowCD: + addi r3, r3, 0x74 + li r4, 0x2A + b enableNonLoopAnim__Q23m2d13EmbedLayout_cFib + +FSHideCD: + addi r3, r3, 0x74 + li r4, 0x2B + b enableNonLoopAnim__Q23m2d13EmbedLayout_cFib + +.global FSShowCD_OpenWait +FSShowCD_OpenWait: + addi r3, r31, 0x74 + li r4, 0x2A + bl enableNonLoopAnim__Q23m2d13EmbedLayout_cFib + lwz r0, 0x14(r1) + lwz r31, 0xC(r1) + mtlr r0 + addi r1, r1, 0x10 + blr + +#.global FSHideCD_IWOSAEW +#FSHideCD_IWOSAEW: +# addi r3, r31, 0x74 +# li r4, 0x2B +# bl enableNonLoopAnim__Q23m2d13EmbedLayout_cFib +# lwz r0, 0x14(r1) +# lwz r31, 0xC(r1) +# mtlr r0 +# addi r1, r1, 0x10 +# blr + +.global DFNiceTitle +DFNiceTitle: + mr r3, r4 + lis r4, DFTitle@h + ori r4, r4, DFTitle@l + lwz r6, 0xE44(r30) + addi r6, r6, '1' + sth r6, 0xA(r4) + li r5, 0 + li r6, 6 + lwz r12, 0(r3) + lwz r12, 0x80(r12) + mtctr r12 + bctr + +.align 4 + +.data +.global FSDummyBrlanName, FSDummyGroup, FSDummyPane +FSDummyBrlanName: .string "fileSelectBase_18_DummyAnim.brlan" +FSDummyGroup: .string "DummyGroup" +FSDummyPane: .string "DummyPane" + +.global A00_window +A00_window: .string "A00_window" +.global ShowEraseCopy, HideEraseCopy +ShowEraseCopy: .string "fileSelectBase_18_ShowEraseCopy.brlan" +HideEraseCopy: .string "fileSelectBase_18_HideEraseCopy.brlan" +.global N_posFile1_00 +N_posFile1_00: .string "N_posFile1_00" +.global CDHolderGroup +CDHolderGroup: .string "CDHolderGroup" + +.align 4 +DFTitle: +.short 'F','i','l','e',' ','X' + +NameYI: .string "Yoshi's Island" +NameDesert: .string "Rubble Ruins" +NameSewer: .string "Soggy Sewers" +NameMountain: .string "Mushroom Peaks" +NameJapan: .string "Sakura Village" +NameFF: .string "FreezeFlame Valley" +NameVolcano: .string "FreezeFlame Volcano" +NameGhost: .string "Pumpkin Boneyard" +NameSkyM: .string "Sky Mountain" +NameSky: .string "Starry Skies" +NameKoopa: .string "Koopa Planet" +NameCore: .string "Koopa Core" +NameGoldwood: .string "Goldwood Forest" +NameCaverns: .string "Crystal Caves" +NameBomb: .string "Bombard Cliffs" +NameMiniMega: .string "Mini-Mega Island" +NameSkyCity: .string "Sky City" +NameBonus: .string "Bonus Land" + +# [05:59:00] W1 GW W2 MM W3 W4 W5 CC W6 BC W7 SC W8 KC W9 +.align 4 +# Struct definition: World, Level, IsSecret, Name +.long -1,-1,0,NameYI +.long 1,6,1,NameGoldwood +.long 1,38,0,NameDesert +.long 2,1,0,NameSewer +.long 2,15,0,NameDesert +.long 2,9,1,NameMiniMega +.long 2,38,0,NameMountain +.long 3,38,0,NameJapan +.long 4,38,0,NameFF +.long 5,6,0,NameVolcano +.long 5,8,0,NameFF +.long 5,10,0,NameFF +.long 5,9,1,NameCaverns +.long 5,38,0,NameGhost +.long 6,8,0,NameBomb +.long 6,38,0,NameSkyM +.long 7,3,0,NameSky +.long 7,4,1,NameSkyCity +.long 7,38,0,NameKoopa +.long 8,25,0,NameCore +.long 8,26,0,NameBonus +.long 0,0,0,0 + -- cgit v1.2.3 From 8102791c2222c31d80858cd1d12b208dcd4ecbc3 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 16 Sep 2012 04:31:01 +0200 Subject: added an untested world name thing --- src/fileselect.S | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/fileselect.S') diff --git a/src/fileselect.S b/src/fileselect.S index b243e7f..0c1590c 100644 --- a/src/fileselect.S +++ b/src/fileselect.S @@ -51,6 +51,34 @@ DFNiceTitle: mtctr r12 bctr +.extern NewerWorldNames +.global DFNiceWorldName +DFNiceWorldName: + stwu r1, -0x10(r1) + mflr r0 + stw r0, 0x14(r1) + stw r20, 0xC(r1) + mr r20, r4 + + # get Newer map number + lbz r6, 0x6FC(r31) + slwi r6, r6, 4 + lis r7, NewerWorldNames@h + ori r7, r7, NewerWorldNames@l + lwzx r4, r7, r6 + + mr r3, r20 + lwz r12, 0(r3) + lwz r12, 0x7C(r12) + mtctr r12 + bctrl + + lwz r20, 0xC(r1) + lwz r0, 0x14(r1) + mtlr r0 + addi r1, r1, 0x10 + blr + .align 4 .data -- cgit v1.2.3 From eb4b6edcbef13c80b0051abe9dc89c93e7a960d0 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 16 Sep 2012 17:32:09 +0200 Subject: a bugfix, and some debug code --- src/fileselect.S | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/fileselect.S') diff --git a/src/fileselect.S b/src/fileselect.S index 0c1590c..faa6f48 100644 --- a/src/fileselect.S +++ b/src/fileselect.S @@ -2,6 +2,8 @@ .set rtoc,2 .text +.extern OSReport + .extern enableNonLoopAnim__Q23m2d13EmbedLayout_cFib .global FSShowCD, FSHideCD FSShowCD: @@ -66,6 +68,7 @@ DFNiceWorldName: lis r7, NewerWorldNames@h ori r7, r7, NewerWorldNames@l lwzx r4, r7, r6 + li r5, 0 mr r3, r20 lwz r12, 0(r3) @@ -79,9 +82,41 @@ DFNiceWorldName: addi r1, r1, 0x10 blr +.global FSDebugStates +FSDebugStates: + stwu r1, -0x10(r1) + mflr r0 + stw r0, 0x14(r1) + stw r31, 0xC(r1) + stw r30, 0x8(r1) + mr r31, r3 + mr r30, r4 + + lis r3, FSStateDebugStr@h + ori r3, r3, FSStateDebugStr@l + crclr 4*cr1+eq + lwz r4, 4(r4) + bl OSReport + + mr r3, r31 + mr r4, r30 + lwzu r12, 0x18(r3) + lwz r12, 0x18(r12) + mtctr r12 + bctrl + + lwz r31, 0xC(r1) + lwz r30, 0x8(r1) + lwz r0, 0x14(r1) + mtlr r0 + addi r1, r1, 0x10 + blr + .align 4 .data +FSStateDebugStr: .string "State: %s\n" + .global FSDummyBrlanName, FSDummyGroup, FSDummyPane FSDummyBrlanName: .string "fileSelectBase_18_DummyAnim.brlan" FSDummyGroup: .string "DummyGroup" -- cgit v1.2.3 From acd5537aa58e827bb9ab80bda9b3297a40ddf3e5 Mon Sep 17 00:00:00 2001 From: Treeki Date: Wed, 19 Sep 2012 03:16:02 +0200 Subject: fix bug with fileselect world names --- src/fileselect.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/fileselect.S') diff --git a/src/fileselect.S b/src/fileselect.S index faa6f48..7b9b9d6 100644 --- a/src/fileselect.S +++ b/src/fileselect.S @@ -64,7 +64,7 @@ DFNiceWorldName: # get Newer map number lbz r6, 0x6FC(r31) - slwi r6, r6, 4 + slwi r6, r6, 2 lis r7, NewerWorldNames@h ori r7, r7, NewerWorldNames@l lwzx r4, r7, r6 -- cgit v1.2.3 From c966111a279251fb7c2499e5ed6eee464411006d Mon Sep 17 00:00:00 2001 From: Treeki Date: Wed, 19 Sep 2012 05:03:39 +0200 Subject: added Exits and Star Coins fields to datefile --- src/fileselect.S | 186 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 134 insertions(+), 52 deletions(-) (limited to 'src/fileselect.S') diff --git a/src/fileselect.S b/src/fileselect.S index 7b9b9d6..3145846 100644 --- a/src/fileselect.S +++ b/src/fileselect.S @@ -53,22 +53,41 @@ DFNiceTitle: mtctr r12 bctr +.extern findTextBoxByName__Q23m2d17EmbedLayoutBase_cCFPCc .extern NewerWorldNames +.extern NewerWorldCount +.extern InsertIntIntoTextBox1 .global DFNiceWorldName DFNiceWorldName: - stwu r1, -0x10(r1) + stwu r1, -0x30(r1) mflr r0 - stw r0, 0x14(r1) - stw r20, 0xC(r1) + stw r0, 0x34(r1) + stw r20, 0x2C(r1) + stw r21, 0x28(r1) + stw r22, 0x24(r1) + # r1+0x20 is reserved for the stupid ints in textboxes + stw r23, 0x1C(r1) + stw r24, 0x18(r1) + stw r25, 0x14(r1) mr r20, r4 # get Newer map number lbz r6, 0x6FC(r31) + lis r8, NewerWorldCount@h + ori r8, r8, NewerWorldCount@h + lwz r8, 0(r8) + cmpw r6, r8 + bge invalidThing slwi r6, r6, 2 lis r7, NewerWorldNames@h ori r7, r7, NewerWorldNames@l lwzx r4, r7, r6 li r5, 0 + b gotName +invalidThing: + lis r4, InvalidWorld@h + ori r4, InvalidWorld@l +gotName: mr r3, r20 lwz r12, 0(r3) @@ -76,10 +95,111 @@ DFNiceWorldName: mtctr r12 bctrl - lwz r20, 0xC(r1) - lwz r0, 0x14(r1) + # While we're at it, take care of some other things + # r21 shall hold our star coin count; r22 shall hold our exit count + # r23 shall hold the level pointer + # r24 shall hold the world number, and r25 the level number + + li r21, 0 + li r22, 0 + li r24, 0 + li r25, 0 + + # Loop through ALL levels + addi r23, r31, 0x6C + li r4, 420 + mtctr r4 + +levelLoop: + lwz r4, 0(r23) + + cmpwi r25, 38 + beq ignoreStartPoint + + clrlwi. r0, r4, 31 + beq noCoin1 + addi r21, r21, 1 +noCoin1: + extrwi. r0, r4, 1,30 + beq noCoin2 + addi r21, r21, 1 +noCoin2: + extrwi. r0, r4, 1,29 + beq noCoin3 + addi r21, r21, 1 +noCoin3: + + extrwi. r0, r4, 1,27 + beq noNormalExit + addi r22, r22, 1 + + lis r3, NormalExitStr@h + ori r3, r3, NormalExitStr@l + mr r4, r24 + mr r5, r25 + crclr 4*cr1+eq + bl OSReport +noNormalExit: + lwz r4, 0(r23) + extrwi. r0, r4, 1,26 + beq noSecretExit + addi r22, r22, 1 + + lis r3, SecretExitStr@h + ori r3, r3, SecretExitStr@l + mr r4, r24 + mr r5, r25 + crclr 4*cr1+eq + bl OSReport +noSecretExit: + +ignoreStartPoint: + + addi r23, r23, 4 + addi r25, r25, 1 + cmpwi r25, 42 + blt dontGoNextWorld + addi r24, r24, 1 + li r25, 0 +dontGoNextWorld: + bdnz levelLoop + + # Now, subtract the paid star coins + lhz r3, 0x66(r31) + sub r21, r21, r3 + + # And write everything ... + addi r3, r30, 0x74 + lis r4, ExitCount@h + ori r4, r4, ExitCount@l + bl findTextBoxByName__Q23m2d17EmbedLayoutBase_cCFPCc + + stw r22, 0x20(r1) + mr r4, r3 + addi r3, r1, 0x20 + li r5, 1 + bl InsertIntIntoTextBox1 + + addi r3, r30, 0x74 + lis r4, StarCoinCount@h + ori r4, r4, StarCoinCount@l + bl findTextBoxByName__Q23m2d17EmbedLayoutBase_cCFPCc + + stw r21, 0x20(r1) + mr r4, r3 + addi r3, r1, 0x20 + li r5, 0 + bl InsertIntIntoTextBox1 + + lwz r25, 0x14(r1) + lwz r24, 0x18(r1) + lwz r23, 0x1C(r1) + lwz r22, 0x24(r1) + lwz r21, 0x28(r1) + lwz r20, 0x2C(r1) + lwz r0, 0x34(r1) mtlr r0 - addi r1, r1, 0x10 + addi r1, r1, 0x30 blr .global FSDebugStates @@ -132,52 +252,14 @@ N_posFile1_00: .string "N_posFile1_00" .global CDHolderGroup CDHolderGroup: .string "CDHolderGroup" +NormalExitStr: .string " %d-%d\n" +SecretExitStr: .string " %d-%d\n" +StarCoinCount: .string "StarCoinCount" +ExitCount: .string "ExitCount" + .align 4 DFTitle: -.short 'F','i','l','e',' ','X' - -NameYI: .string "Yoshi's Island" -NameDesert: .string "Rubble Ruins" -NameSewer: .string "Soggy Sewers" -NameMountain: .string "Mushroom Peaks" -NameJapan: .string "Sakura Village" -NameFF: .string "FreezeFlame Valley" -NameVolcano: .string "FreezeFlame Volcano" -NameGhost: .string "Pumpkin Boneyard" -NameSkyM: .string "Sky Mountain" -NameSky: .string "Starry Skies" -NameKoopa: .string "Koopa Planet" -NameCore: .string "Koopa Core" -NameGoldwood: .string "Goldwood Forest" -NameCaverns: .string "Crystal Caves" -NameBomb: .string "Bombard Cliffs" -NameMiniMega: .string "Mini-Mega Island" -NameSkyCity: .string "Sky City" -NameBonus: .string "Bonus Land" - -# [05:59:00] W1 GW W2 MM W3 W4 W5 CC W6 BC W7 SC W8 KC W9 -.align 4 -# Struct definition: World, Level, IsSecret, Name -.long -1,-1,0,NameYI -.long 1,6,1,NameGoldwood -.long 1,38,0,NameDesert -.long 2,1,0,NameSewer -.long 2,15,0,NameDesert -.long 2,9,1,NameMiniMega -.long 2,38,0,NameMountain -.long 3,38,0,NameJapan -.long 4,38,0,NameFF -.long 5,6,0,NameVolcano -.long 5,8,0,NameFF -.long 5,10,0,NameFF -.long 5,9,1,NameCaverns -.long 5,38,0,NameGhost -.long 6,8,0,NameBomb -.long 6,38,0,NameSkyM -.long 7,3,0,NameSky -.long 7,4,1,NameSkyCity -.long 7,38,0,NameKoopa -.long 8,25,0,NameCore -.long 8,26,0,NameBonus -.long 0,0,0,0 +.short 'F','i','l','e',' ','X',0 +InvalidWorld: +.short '<','I','n','v','a','l','i','d',' ','W','o','r','l','d','>',0 -- cgit v1.2.3 From a7fc34dfdfee0c899712e0209885e40b19305d7f Mon Sep 17 00:00:00 2001 From: Treeki Date: Wed, 19 Sep 2012 05:24:50 +0200 Subject: couple of fixes --- src/fileselect.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/fileselect.S') diff --git a/src/fileselect.S b/src/fileselect.S index 3145846..75f3130 100644 --- a/src/fileselect.S +++ b/src/fileselect.S @@ -86,7 +86,7 @@ DFNiceWorldName: b gotName invalidThing: lis r4, InvalidWorld@h - ori r4, InvalidWorld@l + ori r4, r4, InvalidWorld@l gotName: mr r3, r20 -- cgit v1.2.3 From 48ffeacbebb2da2fee3bff600f4218ad7f24c9cc Mon Sep 17 00:00:00 2001 From: Treeki Date: Fri, 21 Sep 2012 19:08:05 +0200 Subject: file select level looping fixed --- src/fileselect.S | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'src/fileselect.S') diff --git a/src/fileselect.S b/src/fileselect.S index 75f3130..19710ef 100644 --- a/src/fileselect.S +++ b/src/fileselect.S @@ -102,13 +102,11 @@ gotName: li r21, 0 li r22, 0 + addi r23, r31, 0x6C li r24, 0 li r25, 0 # Loop through ALL levels - addi r23, r31, 0x6C - li r4, 420 - mtctr r4 levelLoop: lwz r4, 0(r23) @@ -133,24 +131,24 @@ noCoin3: beq noNormalExit addi r22, r22, 1 - lis r3, NormalExitStr@h - ori r3, r3, NormalExitStr@l - mr r4, r24 - mr r5, r25 - crclr 4*cr1+eq - bl OSReport +# lis r3, NormalExitStr@h +# ori r3, r3, NormalExitStr@l +# addi r4, r24, 1 +# addi r5, r25, 1 +# crclr 4*cr1+eq +# bl OSReport noNormalExit: lwz r4, 0(r23) extrwi. r0, r4, 1,26 beq noSecretExit addi r22, r22, 1 - lis r3, SecretExitStr@h - ori r3, r3, SecretExitStr@l - mr r4, r24 - mr r5, r25 - crclr 4*cr1+eq - bl OSReport +# lis r3, SecretExitStr@h +# ori r3, r3, SecretExitStr@l +# addi r4, r24, 1 +# addi r5, r25, 1 +# crclr 4*cr1+eq +# bl OSReport noSecretExit: ignoreStartPoint: @@ -158,11 +156,12 @@ ignoreStartPoint: addi r23, r23, 4 addi r25, r25, 1 cmpwi r25, 42 - blt dontGoNextWorld + blt levelLoop + # next world addi r24, r24, 1 li r25, 0 -dontGoNextWorld: - bdnz levelLoop + cmpwi r24, 10 + blt levelLoop # Now, subtract the paid star coins lhz r3, 0x66(r31) -- cgit v1.2.3