diff --git a/constants.asm b/constants.asm index a9004b73a..782950e40 100644 --- a/constants.asm +++ b/constants.asm @@ -4,7 +4,6 @@ INCLUDE "gbhw.asm" INCLUDE "hram.asm" INCLUDE "constants/wram_constants.asm" -INCLUDE "constants/sram_constants.asm" INCLUDE "constants/pokemon_constants.asm" INCLUDE "constants/type_constants.asm" INCLUDE "constants/move_constants.asm" diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index 6082768ac..77b65a38a 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -142,6 +142,7 @@ NUM_WILDMONS_PER_AREA_TIME_OF_DAY EQU 7 WILDMON_GRASS_STRUCTURE_LENGTH EQU 2 + 3 * (1 + 2 * NUM_WILDMONS_PER_AREA_TIME_OF_DAY) MOBILE_EVENT_OBJECT_GS_BALL EQU $b +MOBILE_LOGIN_PASSWORD_LENGTH EQU 17 MALE EQU 0 FEMALE EQU 1 diff --git a/constants/sram_constants.asm b/constants/sram_constants.asm deleted file mode 100755 index f89343213..000000000 --- a/constants/sram_constants.asm +++ /dev/null @@ -1,53 +0,0 @@ -; Mobile bank 5 - -; sMobileEventIndex EQU $a000 ; moved to 1:BE3C in English -sTrainerRankings EQU $a001 -sTrainerRankingGameTimeHOF EQU $a001 -sTrainerRankingStepCountHOF EQU $a005 -sTrainerRankingHealingsHOF EQU $a009 -sTrainerRankingBattlesHOF EQU $a00d -sTrainerRankingStepCount EQU $a010 -sTrainerRankingBattleTowerWins EQU $a014 -sTrainerRankingTMsHMsTaught EQU $a018 -sTrainerRankingBattles EQU $a01b -sTrainerRankingWildBattles EQU $a01e -sTrainerRankingTrainerBattles EQU $a021 -sTrainerRankingUnused1 EQU $a024 -sTrainerRankingHOFEntries EQU $a027 -sTrainerRankingWildMonsCaught EQU $a02a -sTrainerRankingHookedEncounters EQU $a02d -sTrainerRankingEggsHatched EQU $a030 -sTrainerRankingMonsEvolved EQU $a033 -sTrainerRankingFruitPicked EQU $a036 -sTrainerRankingHealings EQU $a039 -sTrainerRankingMysteryGift EQU $a03c -sTrainerRankingTrades EQU $a03f -sTrainerRankingFly EQU $a042 -sTrainerRankingSurf EQU $a045 -sTrainerRankingWaterfall EQU $a048 -sTrainerRankingWhiteOuts EQU $a04b -sTrainerRankingLuckyNumberShow EQU $a04e -sTrainerRankingPhoneCalls EQU $a051 -sTrainerRankingUnused2 EQU $a054 -sTrainerRankingLinkBattles EQU $a057 -sTrainerRankingSplash EQU $a05a -sTrainerRankingTreeEncounters EQU $a05d -sTrainerRankingUnused3 EQU $a060 -sTrainerRankingColosseumWins EQU $a063 -sTrainerRankingColosseumLosses EQU $a066 -sTrainerRankingColosseumDraws EQU $a069 -sTrainerRankingSelfdestruct EQU $a06c -sTrainerRankingCurrentSlotsStreak EQU $a06f -sTrainerRankingLongestSlotsStreak EQU $a071 -sTrainerRankingTotalSlotsPayouts EQU $a073 -sTrainerRankingTotalBattlePayouts EQU $a077 -sTrainerRankingLongestMagikarp EQU $a07b -sTrainerRankingShortestMagikarp EQU $a07d -sTrainerRankingBugContestScore EQU $a07f -sTrainerRankingsChecksum EQU $a081 -sTrainerRankingsEnd EQU $a083 -; sMobileEventIndexBackup EQU $a083 ; moved to 1:BE44 in English -sTrainerRankingsBackup EQU $a084 - -sMobileLoginPassword EQU $aa4b -LOGIN_PASSWORD_LENGTH EQU 17 diff --git a/misc/mobile_41.asm b/misc/mobile_41.asm index 955682863..4bed1e321 100755 --- a/misc/mobile_41.asm +++ b/misc/mobile_41.asm @@ -5,7 +5,7 @@ SECTION "bank41_2", ROMX ; Copies certain values at the time the player enters the Hall of Fame. TrainerRankings_HallOfFame2:: mobile ; 0x105ef6 - ld a, $5 + ld a, BANK(sTrainerRankingGameTimeHOF) call GetSRAMBank ld hl, GameTimeHours @@ -36,7 +36,7 @@ TrainerRankings_HallOfFame2:: mobile ; 0x105ef6 ; 105f33 TrainerRankings_MagikarpLength: mobile ; 105f33 - ld a, $5 + ld a, BANK(sTrainerRankingLongestMagikarp) call GetSRAMBank ld de, Buffer1 ld hl, sTrainerRankingLongestMagikarp @@ -104,7 +104,7 @@ TrainerRankings_MagikarpLength: mobile ; 105f33 ; 105f79 TrainerRankings_BugContestScore: mobile ; 105f79 - ld a, $5 + ld a, BANK(sTrainerRankingBugContestScore) call GetSRAMBank ld a, [hProduct] ld hl, sTrainerRankingBugContestScore @@ -133,7 +133,7 @@ TrainerRankings_BugContestScore: mobile ; 105f79 ; 105f9f TrainerRankings_AddToSlotsWinStreak: mobile ; 105f9f - ld a, $5 + ld a, BANK(sTrainerRankingCurrentSlotsStreak) call GetSRAMBank ; Increment the current streak @@ -173,7 +173,7 @@ TrainerRankings_AddToSlotsWinStreak: mobile ; 105f9f ; 105fd0 TrainerRankings_EndSlotsWinStreak: mobile ; 105fd0 - ld a, $5 + ld a, BANK(sTrainerRankingCurrentSlotsStreak) call GetSRAMBank ld hl, sTrainerRankingCurrentSlotsStreak xor a @@ -185,7 +185,7 @@ TrainerRankings_EndSlotsWinStreak: mobile ; 105fd0 ; 105fe3 TrainerRankings_AddToSlotsPayouts: mobile ; 105fe3 - ld a, $5 + ld a, BANK(sTrainerRankingTotalSlotsPayouts) call GetSRAMBank ld hl, sTrainerRankingTotalSlotsPayouts + 3 ld a, e @@ -213,7 +213,7 @@ TrainerRankings_AddToSlotsPayouts: mobile ; 105fe3 ; 106008 TrainerRankings_AddToBattlePayouts: mobile ; 106008 - ld a, $5 + ld a, BANK(sTrainerRankingTotalBattlePayouts) call GetSRAMBank ld hl, sTrainerRankingTotalBattlePayouts + 3 ld a, [bc] @@ -416,7 +416,7 @@ TrainerRankings_Increment1Byte: ; 106129 ; Increments a big-endian value of bc + 1 bytes at hl TrainerRankings_Increment: ; 10612d - ld a, $5 + ld a, BANK(sTrainerRankings) call GetSRAMBank push hl push de @@ -453,7 +453,7 @@ TrainerRankings_Increment: ; 10612d ; Used when SRAM bank 5 isn’t already loaded — what’s the point of this? UpdateTrainerRankingsChecksum2: mobile ; 106155 - ld a, $5 + ld a, BANK(sTrainerRankings) call GetSRAMBank call UpdateTrainerRankingsChecksum call CloseSRAM diff --git a/misc/mobile_45.asm b/misc/mobile_45.asm index d871b5006..0bfc7da38 100644 --- a/misc/mobile_45.asm +++ b/misc/mobile_45.asm @@ -7249,13 +7249,13 @@ Function117942: ; 117942 (45:7942) call PlaceString ld a, $1e ld [wcd4e], a - ld a, $5 + ld a, BANK(sMobileLoginPassword) call GetSRAMBank ld a, [wcd4f] ld [sMobileLoginPassword], a ld hl, $c708 ld de, sMobileLoginPassword + 1 - ld bc, LOGIN_PASSWORD_LENGTH + ld bc, MOBILE_LOGIN_PASSWORD_LENGTH call CopyBytes call CloseSRAM ld a, [wcd4f] diff --git a/misc/mobile_46.asm b/misc/mobile_46.asm index cec93f62f..9d8196888 100755 --- a/misc/mobile_46.asm +++ b/misc/mobile_46.asm @@ -4224,10 +4224,10 @@ Function119eb4: ; 119eb4 (46:5eb4) ret Function119ec2: ; 119ec2 (46:5ec2) - ld a, $5 + ld a, BANK(sMobileLoginPassword) call GetSRAMBank xor a - ld [sMobileLoginPassword + LOGIN_PASSWORD_LENGTH], a + ld [sMobileLoginPassword + MOBILE_LOGIN_PASSWORD_LENGTH], a ld de, sMobileLoginPassword + 1 .loop ld a, [de] @@ -4395,7 +4395,7 @@ Function119f98: ; 119f98 ; 11a00e Function11a00e: ; 11a00e - ld a, $5 + ld a, BANK(sMobileLoginPassword) call GetSRAMBank ld a, [sMobileLoginPassword] and a @@ -4404,7 +4404,7 @@ Function11a00e: ; 11a00e call CloseSRAM and a ret nz - ld a, $5 + ld a, BANK(sMobileLoginPassword) call GetSRAMBank xor a ld [sMobileLoginPassword], a diff --git a/misc/mobile_5f.asm b/misc/mobile_5f.asm index fdb5ca8b4..e94a51ad8 100644 --- a/misc/mobile_5f.asm +++ b/misc/mobile_5f.asm @@ -4688,7 +4688,7 @@ Function17f555: ; 17f555 ret nz .asm_17f5a1 - ld a, $5 + ld a, BANK(sMobileLoginPassword) call GetSRAMBank xor a ld [sMobileLoginPassword], a diff --git a/misc/mobile_menu.asm b/misc/mobile_menu.asm index 84e592fcc..518ad9a25 100755 --- a/misc/mobile_menu.asm +++ b/misc/mobile_menu.asm @@ -441,11 +441,11 @@ Function4a28a: ; 4a28a (12:628a) ld a, [wMenuCursorY] cp $2 jr z, .dont_delete_password - ld a, $5 + ld a, BANK(sMobileLoginPassword) call GetSRAMBank ld hl, sMobileLoginPassword xor a - ld bc, LOGIN_PASSWORD_LENGTH + ld bc, MOBILE_LOGIN_PASSWORD_LENGTH call ByteFill call CloseSRAM ld hl, UnknownText_0x4a35d diff --git a/pokecrystal.link b/pokecrystal.link index 462833f14..9bd693e0f 100644 --- a/pokecrystal.link +++ b/pokecrystal.link @@ -356,3 +356,5 @@ SRAM $02 "Boxes 1-7" SRAM $03 "Boxes 8-14" +SRAM $05 + "SRAM Mobile" diff --git a/sram.asm b/sram.asm index c7992d926..22b377b3c 100644 --- a/sram.asm +++ b/sram.asm @@ -243,3 +243,57 @@ SECTION "Boxes 8-14", SRAM box sBox12 box sBox13 box sBox14 + +SECTION "SRAM Mobile", SRAM, BANK [5] +ds 1 ; Former location for sMobileEventIndex, moved to 1:BE3C in English +sTrainerRankings:: ; a001 +sTrainerRankingGameTimeHOF:: ds 4 +sTrainerRankingStepCountHOF:: ds 4 +sTrainerRankingHealingsHOF:: ds 4 +sTrainerRankingBattlesHOF:: ds 3 +sTrainerRankingStepCount:: ds 4 +sTrainerRankingBattleTowerWins:: ds 4 +sTrainerRankingTMsHMsTaught:: ds 3 +sTrainerRankingBattles:: ds 3 +sTrainerRankingWildBattles:: ds 3 +sTrainerRankingTrainerBattles:: ds 3 +sTrainerRankingUnused1:: ds 3 +sTrainerRankingHOFEntries:: ds 3 +sTrainerRankingWildMonsCaught:: ds 3 +sTrainerRankingHookedEncounters:: ds 3 +sTrainerRankingEggsHatched:: ds 3 +sTrainerRankingMonsEvolved:: ds 3 +sTrainerRankingFruitPicked:: ds 3 +sTrainerRankingHealings:: ds 3 +sTrainerRankingMysteryGift:: ds 3 +sTrainerRankingTrades:: ds 3 +sTrainerRankingFly:: ds 3 +sTrainerRankingSurf:: ds 3 +sTrainerRankingWaterfall:: ds 3 +sTrainerRankingWhiteOuts:: ds 3 +sTrainerRankingLuckyNumberShow:: ds 3 +sTrainerRankingPhoneCalls:: ds 3 +sTrainerRankingUnused2:: ds 3 +sTrainerRankingLinkBattles:: ds 3 +sTrainerRankingSplash:: ds 3 +sTrainerRankingTreeEncounters:: ds 3 +sTrainerRankingUnused3:: ds 3 +sTrainerRankingColosseumWins:: ds 3 +sTrainerRankingColosseumLosses:: ds 3 +sTrainerRankingColosseumDraws:: ds 3 +sTrainerRankingSelfdestruct:: ds 3 +sTrainerRankingCurrentSlotsStreak:: ds 2 +sTrainerRankingLongestSlotsStreak:: ds 2 +sTrainerRankingTotalSlotsPayouts:: ds 4 +sTrainerRankingTotalBattlePayouts:: ds 4 +sTrainerRankingLongestMagikarp:: ds 2 +sTrainerRankingShortestMagikarp:: ds 2 +sTrainerRankingBugContestScore:: ds 2 +sTrainerRankingsChecksum:: ds 2 +sTrainerRankingsEnd:: ; a083 +ds 1 ; Former location for sMobileEventIndexBackup, moved to 1:BE44 in English +sTrainerRankingsBackup:: ds sTrainerRankingsEnd - sTrainerRankings + +ds $945 +; aa4b +sMobileLoginPassword:: ds MOBILE_LOGIN_PASSWORD_LENGTH