Clean up some WRAM and SRAM involving unused mobile data (#6)

This commit is contained in:
xCrystal 2023-08-18 12:04:53 +02:00
parent a5feb38470
commit d7ce3b27ab
7 changed files with 11 additions and 77 deletions

View File

@ -411,12 +411,12 @@ DebugRoom_PrintBattleSkip:
db "SKIP@"
DebugRoomMenu_ChangeSex:
ld a, BANK(sCrystalData)
ld a, BANK(sGameData)
call OpenSRAM
ld a, [sCrystalData + (wPlayerGender - wCrystalData)]
ld a, [sGameData + (wPlayerGender - wGameData)]
inc a
and 1
ld [sCrystalData + (wPlayerGender - wCrystalData)], a
ld [sGameData + (wPlayerGender - wGameData)], a
call CloseSRAM
ret
@ -424,9 +424,9 @@ DebugRoom_PrintGender:
hlcoord 16, 0
ld de, .SexString
call PlaceString
ld a, BANK(sCrystalData)
ld a, BANK(sGameData)
call OpenSRAM
ld a, [sCrystalData + (wPlayerGender - wCrystalData)]
ld a, [sGameData + (wPlayerGender - wGameData)]
call CloseSRAM
or a
ld a, "♂"

View File

@ -1,21 +1,3 @@
InitCrystalData:
ld a, $1
ld [wd474], a
xor a
ld [wd473], a
ld [wPlayerGender], a
ld [wd475], a
ld [wd476], a
ld [wd477], a
ld [wd478], a
ld a, [wd479]
res 0, a ; ???
ld [wd479], a
ld a, [wd479]
res 1, a ; ???
ld [wd479], a
ret
InitGender:
call InitGenderScreen
call LoadGenderScreenPal
@ -62,7 +44,6 @@ InitGenderScreen:
ld c, 8
call DelayFrames
call ClearBGPalettes
call InitCrystalData
call LoadFrame
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH

View File

@ -302,7 +302,6 @@ LoadOrRegenerateLuckyIDNumber:
Continue:
farcall TryLoadSaveFile
jr c, .FailToLoad
farcall _LoadData
call LoadStandardMenuHeader
call DisplaySaveInfoOnContinue
ld a, $1

View File

@ -339,7 +339,6 @@ ErasePreviousSave:
call EraseBoxes
call EraseHallOfFame
call EraseLinkBattleStats
call SaveData
ld a, BANK(sStackTop)
call OpenSRAM
xor a
@ -368,10 +367,6 @@ EraseHallOfFame:
call ByteFill
jp CloseSRAM
SaveData:
call _SaveData
ret
HallOfFame_InitSaveIfNeeded:
ld a, [wSavedAtLeastOnce]
and a
@ -717,31 +712,6 @@ VerifyBackupChecksum:
pop af
ret
_SaveData:
; This is called within two scenarios:
; a) ErasePreviousSave (the process of erasing the save from a previous game file)
; b) unused mobile functionality
; It is not part of a regular save.
ld a, BANK(sCrystalData)
call OpenSRAM
ld hl, wCrystalData
ld de, sCrystalData
ld bc, wCrystalDataEnd - wCrystalData
call CopyBytes
jp CloseSRAM
_LoadData:
ld a, BANK(sCrystalData)
call OpenSRAM
ld hl, sCrystalData
ld de, wCrystalData
ld bc, wCrystalDataEnd - wCrystalData
call CopyBytes
jp CloseSRAM
GetBoxAddress:
ld a, [wCurBox]
cp NUM_BOXES

View File

@ -284,7 +284,6 @@ SRAM $01
"Active Box"
"Link Battle Data"
"SRAM Hall of Fame"
"SRAM Crystal Data"
SRAM $02
"Boxes 1-7"
SRAM $03

View File

@ -112,11 +112,6 @@ endr
sHallOfFameEnd::
SECTION "SRAM Crystal Data", SRAM
sCrystalData:: ds wCrystalDataEnd - wCrystalData
; The PC boxes will not fit into one SRAM bank,
; so they use multiple SECTIONs
DEF box_n = 0

View File

@ -2226,22 +2226,6 @@ wBugContestSecsRemaining:: db
wMapStatusEnd::
wCrystalData::
wPlayerGender::
; bit 0:
; 0 male
; 1 female
db
wd473:: ds 1
wd474:: ds 1
wd475:: ds 1
wd476:: ds 1
wd477:: ds 1
wd478:: ds 1
wCrystalDataEnd::
wd479:: ds 2
wGameData::
wPlayerData::
wPlayerID:: dw
@ -2252,6 +2236,12 @@ wRivalName:: ds NAME_LENGTH
wRedsName:: ds NAME_LENGTH
wGreensName:: ds NAME_LENGTH
wPlayerGender::
; bit 0:
; 0 male
; 1 female
db
wSavedAtLeastOnce:: db
wSpawnAfterChampion:: db