Identify wCrystalData's content and rename memory locations accordingly (#1191)

This commit is contained in:
Brianum
2025-06-30 17:37:37 +02:00
committed by GitHub
parent 36fdf1a1fc
commit 8f5a8c5b5b
7 changed files with 92 additions and 91 deletions

View File

@@ -1,21 +1,21 @@
InitCrystalData:
ld a, $1
ld [wd474], a
ld [wPlayerPrefecture], a
xor a
ld [wd473], a
ld [wPlayerAge], a
ld [wPlayerGender], a
ld [wd475], a
ld [wd476], a
ld [wd477], a
ld [wd478], a
ld [wPlayerPostalCode], a
ld [wPlayerPostalCode+1], a
ld [wPlayerPostalCode+2], a
ld [wPlayerPostalCode+3], a
ld [wd002], a
ld [wd003], a
ld a, [wd479]
ld a, [wCrystalFlags]
res 0, a ; ???
ld [wd479], a
ld a, [wd479]
ld [wCrystalFlags], a
ld a, [wCrystalFlags]
res 1, a ; ???
ld [wd479], a
ld [wCrystalFlags], a
ret
INCLUDE "mobile/mobile_12.asm"

View File

@@ -402,7 +402,7 @@ PostCreditsSpawn:
Continue_MobileAdapterMenu: ; unused
farcall CheckMobileAdapterStatus
ret nc
ld hl, wd479
ld hl, wCrystalFlags
bit 1, [hl]
ret nz
ld a, 5

View File

@@ -451,11 +451,11 @@ Function14d6c: ; unreferenced
ret
Function14d83: ; unreferenced
ld a, BANK(s4_a60c) ; aka BANK(s4_a60d) ; MBC30 bank used by JP Crystal; inaccessible by MBC3
ld a, BANK(s4_a60c) ; MBC30 bank used by JP Crystal; inaccessible by MBC3
call OpenSRAM
xor a
ld [s4_a60c], a ; address of MBC30 bank
ld [s4_a60d], a ; address of MBC30 bank
ld [s4_a60c+1], a ; address of MBC30 bank
call CloseSRAM
ret
@@ -840,15 +840,15 @@ _SaveData:
call CopyBytes
; This block originally had some mobile functionality, but since we're still in
; BANK(sCrystalData), it instead overwrites the sixteen wEventFlags starting at 1:s4_a60e with
; garbage from wd479. This isn't an issue, since ErasePreviousSave is followed by a regular
; BANK(sCrystalData), it instead overwrites the sixteen wEventFlags starting at 1:sCrystalFlags with
; garbage from wCrystalFlags. This isn't an issue, since ErasePreviousSave is followed by a regular
; save that unwrites the garbage.
ld hl, wd479
ld hl, wCrystalFlags
ld a, [hli]
ld [s4_a60e + 0], a
ld [sCrystalFlags + 0], a
ld a, [hli]
ld [s4_a60e + 1], a
ld [sCrystalFlags + 1], a
jp CloseSRAM
@@ -861,12 +861,12 @@ _LoadData:
call CopyBytes
; This block originally had some mobile functionality to mirror _SaveData above, but instead it
; (harmlessly) writes the aforementioned wEventFlags to the unused wd479.
; (harmlessly) writes the aforementioned wEventFlags to the unused wCrystalFlags.
ld hl, wd479
ld a, [s4_a60e + 0]
ld hl, wCrystalFlags
ld a, [sCrystalFlags + 0]
ld [hli], a
ld a, [s4_a60e + 1]
ld a, [sCrystalFlags + 1]
ld [hli], a
jp CloseSRAM