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@" db "SKIP@"
DebugRoomMenu_ChangeSex: DebugRoomMenu_ChangeSex:
ld a, BANK(sCrystalData) ld a, BANK(sGameData)
call OpenSRAM call OpenSRAM
ld a, [sCrystalData + (wPlayerGender - wCrystalData)] ld a, [sGameData + (wPlayerGender - wGameData)]
inc a inc a
and 1 and 1
ld [sCrystalData + (wPlayerGender - wCrystalData)], a ld [sGameData + (wPlayerGender - wGameData)], a
call CloseSRAM call CloseSRAM
ret ret
@ -424,9 +424,9 @@ DebugRoom_PrintGender:
hlcoord 16, 0 hlcoord 16, 0
ld de, .SexString ld de, .SexString
call PlaceString call PlaceString
ld a, BANK(sCrystalData) ld a, BANK(sGameData)
call OpenSRAM call OpenSRAM
ld a, [sCrystalData + (wPlayerGender - wCrystalData)] ld a, [sGameData + (wPlayerGender - wGameData)]
call CloseSRAM call CloseSRAM
or a or a
ld 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: InitGender:
call InitGenderScreen call InitGenderScreen
call LoadGenderScreenPal call LoadGenderScreenPal
@ -62,7 +44,6 @@ InitGenderScreen:
ld c, 8 ld c, 8
call DelayFrames call DelayFrames
call ClearBGPalettes call ClearBGPalettes
call InitCrystalData
call LoadFrame call LoadFrame
hlcoord 0, 0 hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH ld bc, SCREEN_HEIGHT * SCREEN_WIDTH

View File

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

View File

@ -339,7 +339,6 @@ ErasePreviousSave:
call EraseBoxes call EraseBoxes
call EraseHallOfFame call EraseHallOfFame
call EraseLinkBattleStats call EraseLinkBattleStats
call SaveData
ld a, BANK(sStackTop) ld a, BANK(sStackTop)
call OpenSRAM call OpenSRAM
xor a xor a
@ -368,10 +367,6 @@ EraseHallOfFame:
call ByteFill call ByteFill
jp CloseSRAM jp CloseSRAM
SaveData:
call _SaveData
ret
HallOfFame_InitSaveIfNeeded: HallOfFame_InitSaveIfNeeded:
ld a, [wSavedAtLeastOnce] ld a, [wSavedAtLeastOnce]
and a and a
@ -717,31 +712,6 @@ VerifyBackupChecksum:
pop af pop af
ret 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: GetBoxAddress:
ld a, [wCurBox] ld a, [wCurBox]
cp NUM_BOXES cp NUM_BOXES

View File

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

View File

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

View File

@ -2226,22 +2226,6 @@ wBugContestSecsRemaining:: db
wMapStatusEnd:: 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:: wGameData::
wPlayerData:: wPlayerData::
wPlayerID:: dw wPlayerID:: dw
@ -2252,6 +2236,12 @@ wRivalName:: ds NAME_LENGTH
wRedsName:: ds NAME_LENGTH wRedsName:: ds NAME_LENGTH
wGreensName:: ds NAME_LENGTH wGreensName:: ds NAME_LENGTH
wPlayerGender::
; bit 0:
; 0 male
; 1 female
db
wSavedAtLeastOnce:: db wSavedAtLeastOnce:: db
wSpawnAfterChampion:: db wSpawnAfterChampion:: db