Skip to content

Commit 8f5a8c5

Browse files
authored
Identify wCrystalData's content and rename memory locations accordingly (#1191)
1 parent 36fdf1a commit 8f5a8c5

File tree

7 files changed

+92
-91
lines changed

7 files changed

+92
-91
lines changed

engine/menus/init_gender.asm

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
InitCrystalData:
22
ld a, $1
3-
ld [wd474], a
3+
ld [wPlayerPrefecture], a
44
xor a
5-
ld [wd473], a
5+
ld [wPlayerAge], a
66
ld [wPlayerGender], a
7-
ld [wd475], a
8-
ld [wd476], a
9-
ld [wd477], a
10-
ld [wd478], a
7+
ld [wPlayerPostalCode], a
8+
ld [wPlayerPostalCode+1], a
9+
ld [wPlayerPostalCode+2], a
10+
ld [wPlayerPostalCode+3], a
1111
ld [wd002], a
1212
ld [wd003], a
13-
ld a, [wd479]
13+
ld a, [wCrystalFlags]
1414
res 0, a ; ???
15-
ld [wd479], a
16-
ld a, [wd479]
15+
ld [wCrystalFlags], a
16+
ld a, [wCrystalFlags]
1717
res 1, a ; ???
18-
ld [wd479], a
18+
ld [wCrystalFlags], a
1919
ret
2020

2121
INCLUDE "mobile/mobile_12.asm"

engine/menus/intro_menu.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ PostCreditsSpawn:
402402
Continue_MobileAdapterMenu: ; unused
403403
farcall CheckMobileAdapterStatus
404404
ret nc
405-
ld hl, wd479
405+
ld hl, wCrystalFlags
406406
bit 1, [hl]
407407
ret nz
408408
ld a, 5

engine/menus/save.asm

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -451,11 +451,11 @@ Function14d6c: ; unreferenced
451451
ret
452452

453453
Function14d83: ; unreferenced
454-
ld a, BANK(s4_a60c) ; aka BANK(s4_a60d) ; MBC30 bank used by JP Crystal; inaccessible by MBC3
454+
ld a, BANK(s4_a60c) ; MBC30 bank used by JP Crystal; inaccessible by MBC3
455455
call OpenSRAM
456456
xor a
457457
ld [s4_a60c], a ; address of MBC30 bank
458-
ld [s4_a60d], a ; address of MBC30 bank
458+
ld [s4_a60c+1], a ; address of MBC30 bank
459459
call CloseSRAM
460460
ret
461461

@@ -840,15 +840,15 @@ _SaveData:
840840
call CopyBytes
841841

842842
; This block originally had some mobile functionality, but since we're still in
843-
; BANK(sCrystalData), it instead overwrites the sixteen wEventFlags starting at 1:s4_a60e with
844-
; garbage from wd479. This isn't an issue, since ErasePreviousSave is followed by a regular
843+
; BANK(sCrystalData), it instead overwrites the sixteen wEventFlags starting at 1:sCrystalFlags with
844+
; garbage from wCrystalFlags. This isn't an issue, since ErasePreviousSave is followed by a regular
845845
; save that unwrites the garbage.
846846

847-
ld hl, wd479
847+
ld hl, wCrystalFlags
848848
ld a, [hli]
849-
ld [s4_a60e + 0], a
849+
ld [sCrystalFlags + 0], a
850850
ld a, [hli]
851-
ld [s4_a60e + 1], a
851+
ld [sCrystalFlags + 1], a
852852

853853
jp CloseSRAM
854854

@@ -861,12 +861,12 @@ _LoadData:
861861
call CopyBytes
862862

863863
; This block originally had some mobile functionality to mirror _SaveData above, but instead it
864-
; (harmlessly) writes the aforementioned wEventFlags to the unused wd479.
864+
; (harmlessly) writes the aforementioned wEventFlags to the unused wCrystalFlags.
865865

866-
ld hl, wd479
867-
ld a, [s4_a60e + 0]
866+
ld hl, wCrystalFlags
867+
ld a, [sCrystalFlags + 0]
868868
ld [hli], a
869-
ld a, [s4_a60e + 1]
869+
ld a, [sCrystalFlags + 1]
870870
ld [hli], a
871871

872872
jp CloseSRAM

0 commit comments

Comments
 (0)