summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/engine/bank01.asm4
-rw-r--r--src/engine/bank03.asm20
-rw-r--r--src/engine/bank04.asm331
-rw-r--r--src/engine/bank05.asm4
-rw-r--r--src/engine/bank06.asm2
-rw-r--r--src/engine/bank07.asm10
-rw-r--r--src/engine/home.asm18
-rw-r--r--src/sram.asm33
-rw-r--r--src/wram.asm13
9 files changed, 347 insertions, 88 deletions
diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm
index 449cd75..1bc9665 100644
--- a/src/engine/bank01.asm
+++ b/src/engine/bank01.asm
@@ -6159,9 +6159,9 @@ Func_66e9: ; 66e9 (1:66e9)
ret c
ld de, sCurrentDuel
call LoadSavedDuelData
- call Func_3a45
+ call ValidateGeneralSaveData
ret nc
- call Func_3a40
+ call LoadGeneralSaveData
or a
ret
diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm
index f9958b5..8d47a3a 100644
--- a/src/engine/bank03.asm
+++ b/src/engine/bank03.asm
@@ -238,8 +238,8 @@ Func_c1b1: ; c1b1 (3:41b1)
ld [wTempPlayerYCoord], a
ld a, SOUTH
ld [wTempPlayerDirection], a
- call Func_c9cb
- call Func_c9dd
+ call ClearEvents
+ call DetermineImakuniAndChallengeHall
farcall Func_80b7a
farcall ClearMasterBeatenList
farcall Func_131b3
@@ -252,9 +252,9 @@ Func_c1b1: ; c1b1 (3:41b1)
ret
Func_c1ed: ; c1ed (3:41ed)
- call Func_c9cb
- farcall Func_11416
- call Func_c9dd
+ call ClearEvents
+ farcall LoadBackupSaveData
+ call DetermineImakuniAndChallengeHall
ret
Func_c1f8: ; c1f8 (3:41f8)
@@ -1483,7 +1483,7 @@ Func_c9c7: ; c9c7 (3:49c7)
ld l, MAP_SCRIPT_CLOSE_TEXTBOX
jr CallMapScriptPointerIfExists
-Func_c9cb: ; c9cb (3:49cb)
+ClearEvents: ; c9cb (3:49cb)
push hl
push bc
ld hl, wEventVars
@@ -1500,11 +1500,11 @@ Func_c9cb: ; c9cb (3:49cb)
ret
; Clears temporary event vars before determining Imakuni Room
-Func_c9dd: ; c9dd (3:49dd)
+DetermineImakuniAndChallengeHall: ; c9dd (3:49dd)
xor a
ld [wEventVars + EVENT_VAR_BYTES - 1], a
call DetermineImakuniRoom
- call Func_ca0e
+ call DetermineChallengeHallEvent
ret
; Determines what room Imakuni is in when you reset
@@ -1535,7 +1535,7 @@ ImakuniPossibleRooms: ; ca0a (3:4a04)
db LIGHTNING_CLUB_LOBBY
db WATER_CLUB_LOBBY
-Func_ca0e: ; ca0e (3:4a0e)
+DetermineChallengeHallEvent: ; ca0e (3:4a0e)
ld a, [wOverworldMapSelection]
cp OWMAP_CHALLENGE_HALL
jr z, .done
@@ -3181,7 +3181,7 @@ ScriptCommand_GiftCenter: ; d39d (3:539d)
jp IncreaseScriptPointerBy2
ScriptCommand_PlayCredits: ; d3b9 (3:53b9)
- call Func_3917
+ call GetReceivedLegendaryCards
ld a, GAME_EVENT_CREDITS
ld [wGameEvent], a
ld hl, wd0b4
diff --git a/src/engine/bank04.asm b/src/engine/bank04.asm
index 9140e09..2f369f6 100644
--- a/src/engine/bank04.asm
+++ b/src/engine/bank04.asm
@@ -1085,11 +1085,51 @@ Func_111b3: ; 111b3 (4:51b3)
Func_111e9: ; 111e9 (4:51e9)
INCROM $111e9, $11238
-Func_11238: ; 11238 (4:5238)
- INCROM $11238, $1124d
+; saves all data to SRAM, including
+; General save data and Album/Deck data
+; and backs up in SRAM2
+SaveAndBackupData: ; 11238 (4:5238)
+ push de
+ ld de, sGeneralSaveData
+ call SaveGeneralSaveDataFromDE
+ ld de, sAlbumProgress
+ call UpdateAlbumProgress
+ call WriteBackupGeneralSaveData
+ call WriteBackupCardAndDeckSaveData
+ pop de
+ ret
+; 0x1124d
-Func_1124d: ; 1124d (4:524d)
- INCROM $1124d, $1127f
+_SaveGeneralSaveData: ; 1124d (4:524d)
+ push de
+ call GetReceivedLegendaryCards
+ ld de, sGeneralSaveData
+ call SaveGeneralSaveDataFromDE
+ ld de, sAlbumProgress
+ call UpdateAlbumProgress
+ pop de
+ ret
+; 0x1125f
+
+; de = pointer to general game data in SRAM
+SaveGeneralSaveDataFromDE: ; 1125f (4:525f)
+ push hl
+ push bc
+ call EnableSRAM
+ push de
+ farcall TryGiveMedalPCPacks
+ ld [wMedalCount], a
+ farcall OverworldMap_GetOWMapID
+ ld [wCurOverworldMap], a
+ pop de
+ push de
+ call CopyGeneralSaveDataToSRAM
+ pop de
+ call DisableSRAM
+ pop bc
+ pop hl
+ ret
+; 0x1127f
; writes in de total num of cards collected
; and in (de + 1) total num of cards to collect
@@ -1113,16 +1153,107 @@ UpdateAlbumProgress: ; 1127f (4:527f)
ret
; 0x11299
- INCROM $11299, $11320
+; save values that are listed in WRAMToSRAMMapper
+; from WRAM to SRAM, and calculate its checksum
+CopyGeneralSaveDataToSRAM: ; 11299 (4:5299)
+ push hl
+ push bc
+ push de
+ push de
+ ld hl, sGeneralSaveDataHeaderEnd - sGeneralSaveData
+ add hl, de
+ ld e, l
+ ld d, h
+ xor a
+ ld [wGeneralSaveDataByteCount + 0], a
+ ld [wGeneralSaveDataByteCount + 1], a
+ ld [wGeneralSaveDataCheckSum + 0], a
+ ld [wGeneralSaveDataCheckSum + 1], a
+
+ ld hl, WRAMToSRAMMapper
+.loop_map
+ ld a, [hli]
+ ld [wTempPointer + 0], a
+ ld c, a
+ ld a, [hli]
+ ld [wTempPointer + 1], a
+ or c
+ jr z, .done_copy
+ ld a, [hli]
+ ld c, a ; number of bytes LO
+ ld a, [hli]
+ ld b, a ; number of bytes HI
+ ld a, [wGeneralSaveDataByteCount + 0]
+ add c
+ ld [wGeneralSaveDataByteCount + 0], a
+ ld a, [wGeneralSaveDataByteCount + 1]
+ adc b
+ ld [wGeneralSaveDataByteCount + 1], a
+ call .CopyBytesToSRAM
+ inc hl
+ inc hl
+ jr .loop_map
+
+.done_copy
+ pop hl
+ ld a, $08
+ ld [hli], a
+ ld a, $00
+ ld [hli], a
+ ld a, [wGeneralSaveDataByteCount + 0]
+ ld [hli], a
+ ld a, [wGeneralSaveDataByteCount + 1]
+ ld [hli], a
+ ld a, [wGeneralSaveDataCheckSum + 0]
+ ld [hli], a
+ ld a, [wGeneralSaveDataCheckSum + 1]
+ ld [hli], a
+ pop de
+ pop bc
+ pop hl
+ ret
-Func_11320: ; 11320 (4:5320)
+.CopyBytesToSRAM
+ push hl
+ ld a, [wTempPointer + 0]
+ ld l, a
+ ld a, [wTempPointer + 1]
+ ld h, a
+.loop_bytes
+ push bc
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld c, a
+ ld a, [wGeneralSaveDataCheckSum + 0]
+ add c
+ ld [wGeneralSaveDataCheckSum + 0], a
+ ld a, [wGeneralSaveDataCheckSum + 1]
+ adc 0
+ ld [wGeneralSaveDataCheckSum + 1], a
+ pop bc
+ dec bc
+ ld a, c
+ or b
+ jr nz, .loop_bytes
+ ld a, l
+ ld [wTempPointer + 0], a
+ ld a, h
+ ld [wTempPointer + 1], a
+ pop hl
+ ret
+; 0x11320
+
+; returns carry if no error
+; is found in sBackupGeneralSaveData
+ValidateBackupGeneralSaveData: ; 11320 (4:5320)
push de
ldh a, [hBankSRAM]
push af
- ld a, $02
+ ld a, BANK(sBackupGeneralSaveData)
call BankswitchSRAM
- ld de, sb800
- call Func_1135d
+ ld de, sBackupGeneralSaveData
+ call ValidateGeneralSaveDataFromDE
ld de, sAlbumProgress
call LoadAlbumProgressFromSRAM
pop af
@@ -1134,10 +1265,25 @@ Func_11320: ; 11320 (4:5320)
ret
; 0x11343
-Func_11343: ; 11343 (4:5343)
- INCROM $11343, $1135d
+; returns carry if no error
+; is found in sGeneralSaveData
+_ValidateGeneralSaveData: ; 11343 (4:5343)
+ push de
+ call EnableSRAM
+ ld de, sGeneralSaveData
+ call ValidateGeneralSaveDataFromDE
+ ld de, sAlbumProgress
+ call LoadAlbumProgressFromSRAM
+ call DisableSRAM
+ pop de
+ ld a, [wNumSRAMValidationErrors]
+ cp 1
+ ret
+; 0x1135d
-Func_1135d: ; 1135d (4:535d)
+; validates the general game data saved in SRAM
+; de = pointer to general game data in SRAM
+ValidateGeneralSaveDataFromDE: ; 1135d (4:535d)
push hl
push bc
push de
@@ -1150,10 +1296,10 @@ Func_1135d: ; 1135d (4:535d)
inc de
ld a, [de]
inc de
- ld [wNumGeneralSaveDataBytes + 0], a
+ ld [wGeneralSaveDataByteCount + 0], a
ld a, [de]
inc de
- ld [wNumGeneralSaveDataBytes + 1], a
+ ld [wGeneralSaveDataByteCount + 1], a
ld a, [de]
inc de
ld [wGeneralSaveDataCheckSum + 0], a
@@ -1162,7 +1308,7 @@ Func_1135d: ; 1135d (4:535d)
ld [wGeneralSaveDataCheckSum + 1], a
pop de
- ld hl, $8
+ ld hl, sGeneralSaveDataHeaderEnd - sGeneralSaveData
add hl, de
ld e, l
ld d, h
@@ -1177,12 +1323,12 @@ Func_1135d: ; 1135d (4:535d)
ld c, a ; number of bytes LO
ld a, [hli]
ld b, a ; number of bytes HI
- ld a, [wNumGeneralSaveDataBytes + 0]
+ ld a, [wGeneralSaveDataByteCount + 0]
sub c
- ld [wNumGeneralSaveDataBytes + 0], a
- ld a, [wNumGeneralSaveDataBytes + 1]
+ ld [wGeneralSaveDataByteCount + 0], a
+ ld a, [wGeneralSaveDataByteCount + 1]
sbc b
- ld [wNumGeneralSaveDataBytes + 1], a
+ ld [wGeneralSaveDataByteCount + 1], a
; loop all the bytes of this struct
.loop_bytes
@@ -1226,12 +1372,12 @@ Func_1135d: ; 1135d (4:535d)
.exit_loop
pop hl
ld a, [hli]
- sub $08
+ sub $8
ld c, a
ld a, [hl]
sub 0
or c
- ld hl, wNumGeneralSaveDataBytes
+ ld hl, wGeneralSaveDataByteCount
or [hl]
inc hl
or [hl]
@@ -1239,25 +1385,28 @@ Func_1135d: ; 1135d (4:535d)
or [hl]
inc hl
or [hl]
- jr z, .asm_113ea
+ jr z, .no_header_error
ld hl, wNumSRAMValidationErrors
inc [hl]
-.asm_113ea
+.no_header_error
pop de
- ld hl, $c
+ ; copy play time minutes and hours
+ ld hl, (sPlayTimeCounter + 2) - sGeneralSaveData
add hl, de
ld a, [hli]
- ld [wd3c8 + 0], a
+ ld [wPlayTimeHourMinutes + 0], a
ld a, [hli]
- ld [wd3c8 + 1], a
+ ld [wPlayTimeHourMinutes + 1], a
ld a, [hli]
- ld [wd3c8 + 2], a
- ld hl, $8
+ ld [wPlayTimeHourMinutes + 2], a
+
+ ; copy medal count and current overworld map
+ ld hl, sGeneralSaveDataHeaderEnd - sGeneralSaveData
add hl, de
ld a, [hli]
- ld [wd3cc], a
+ ld [wMedalCount], a
ld a, [hl]
- ld [wd3cb], a
+ ld [wCurOverworldMap], a
pop bc
pop hl
ret
@@ -1274,36 +1423,53 @@ LoadAlbumProgressFromSRAM: ; 1140a (4:540a)
ret
; 0x11416
-Func_11416: ; 11416 (4:5416)
- INCROM $11416, $11430
+; first copies data from backup SRAM to main SRAM
+; then loads it to WRAM from main SRAM
+LoadBackupSaveData: ; 11416 (4:5416)
+ push hl
+ push de
+ call EnableSRAM
+ bank1call DiscardSavedDuelData
+ call DisableSRAM
+ call LoadBackupGeneralSaveData
+ call LoadBackupCardAndDeckSaveData
+ ld de, sGeneralSaveData
+ call LoadGeneralSaveDataFromDE
+ pop de
+ pop hl
+ ret
+; 0x11430
-Func_11430: ; 11430 (4:5430)
+_LoadGeneralSaveData: ; 11430 (4:5430)
push de
- ld de, sb800
- call .Func_11439
+ ld de, sGeneralSaveData
+ call LoadGeneralSaveDataFromDE
pop de
ret
+; 0x11439
-.Func_11439
+; de = pointer to save data
+LoadGeneralSaveDataFromDE: ; 11439 (4:5439)
push hl
push bc
call EnableSRAM
- call .Func_11447
+ call .LoadData
call DisableSRAM
pop bc
pop hl
ret
-.Func_11447
+.LoadData
push hl
push bc
push de
ld a, e
- add $08
+ add sGeneralSaveDataHeaderEnd - sGeneralSaveData
ld [wTempPointer + 0], a
ld a, d
adc 0
ld [wTempPointer + 1], a
+
ld hl, WRAMToSRAMMapper
.asm_11459
ld a, [hli]
@@ -1367,8 +1533,8 @@ ENDM
; the saved values is SRAM are legal, within the given value range
WRAMToSRAMMapper: ; 11498 (4:5498)
; pointer, number of bytes, unknown
- wram_sram_map wd3cc, 1, $00, $ff ; sb808
- wram_sram_map wd3cb, 1, $00, $ff ; sb809
+ wram_sram_map wMedalCount, 1, $00, $ff ; sMedalCount
+ wram_sram_map wCurOverworldMap, 1, $00, $ff ; sCurOverworldMap
wram_sram_map wPlayTimeCounter + 0, 1, $00, $ff ; sPlayTimeCounter
wram_sram_map wPlayTimeCounter + 1, 1, $00, $ff
wram_sram_map wPlayTimeCounter + 2, 1, $00, $ff
@@ -1433,7 +1599,7 @@ _SaveGame: ; 1157c (4:557c)
ld [wOverworldMapSelection], a
.save
- call Func_11238
+ call SaveAndBackupData
ret
_AddCardToCollectionAndUpdateAlbumProgress: ; 115a3 (4:55a3)
@@ -1465,7 +1631,74 @@ _AddCardToCollectionAndUpdateAlbumProgress: ; 115a3 (4:55a3)
ret
; 0x115d4
- INCROM $115d4, $1162a
+WriteBackupCardAndDeckSaveData: ; 115d4 (4:55d4)
+ ld bc, sCardAndDeckSaveDataEnd - sCardAndDeckSaveData
+ ld hl, sCardCollection
+ jr WriteDataToBackup
+
+WriteBackupGeneralSaveData: ; 115dc (4:55dc)
+ ld bc, sGeneralSaveDataEnd - sGeneralSaveData
+ ld hl, sGeneralSaveData
+; fallthrough
+
+; bc = number of bytes to copy to backup
+; hl = pointer in SRAM of data to backup
+WriteDataToBackup: ; 115e2 (4:55e2)
+ ldh a, [hBankSRAM]
+ push af
+.loop
+ xor a ; SRAM0
+ call BankswitchSRAM
+ ld a, [hl]
+ push af
+ ld a, BANK("SRAM2")
+ call BankswitchSRAM
+ pop af
+ ld [hli], a
+ dec bc
+ ld a, b
+ or c
+ jr nz, .loop
+ pop af
+ call BankswitchSRAM
+ call DisableSRAM
+ ret
+; 0x115ff
+
+LoadBackupCardAndDeckSaveData: ; 115ff (4:55ff)
+ ld bc, sCardAndDeckSaveDataEnd - sCardAndDeckSaveData
+ ld hl, sCardCollection
+ jr LoadDataFromBackup
+
+LoadBackupGeneralSaveData: ; 11607 (4:5607)
+ ld bc, sGeneralSaveDataEnd - sGeneralSaveData
+ ld hl, sGeneralSaveData
+; fallthrough
+
+; bc = number of bytes to load from backup
+; hl = pointer in SRAM of backup data
+LoadDataFromBackup: ; 1160d (4:560d)
+ ldh a, [hBankSRAM]
+ push af
+
+.loop
+ ld a, BANK("SRAM2")
+ call BankswitchSRAM
+ ld a, [hl]
+ push af
+ xor a
+ call BankswitchSRAM
+ pop af
+ ld [hli], a
+ dec bc
+ ld a, b
+ or c
+ jr nz, .loop
+ pop af
+ call BankswitchSRAM
+ call DisableSRAM
+ ret
+; 0x1162a
INCLUDE "data/map_scripts.asm"
@@ -3026,7 +3259,7 @@ MainMenu_NewGame: ; 12704 (4:6704)
MainMenu_ContinueFromDiary: ; 12741 (4:6741)
ld a, MUSIC_STOP
call PlaySong
- call Func_11320
+ call ValidateBackupGeneralSaveData
jr nc, MainMenu_NewGame
farcall Func_c1ed
farcall SetMainSGBBorder
@@ -3054,8 +3287,8 @@ MainMenu_CardPop: ; 12768 (4:6768)
MainMenu_ContinueDuel: ; 1277e (4:677e)
ld a, MUSIC_STOP
call PlaySong
- farcall Func_c9cb
- farcall $04, Func_3a40
+ farcall ClearEvents
+ farcall $04, LoadGeneralSaveData
farcall SetMainSGBBorder
ld a, GAME_EVENT_CONTINUE_DUEL
ld [wGameEvent], a
@@ -3427,7 +3660,7 @@ LoadSpriteAnimPointers: ; 12ae2 (4:6ae2)
pop hl ; hl is animation bank
ld a, [wTempPointerBank]
ld [hli], a
- ld a, [wTempPointer]
+ ld a, [wTempPointer + 0]
ld [hli], a
ld c, a
ld a, [wTempPointer + 1]
@@ -3461,7 +3694,7 @@ HandleAnimationFrame: ; 12b13 (4:6b13)
inc hl
inc hl
ld a, [hl] ; SPRITE_ANIM_FRAME_OFFSET_POINTER
- ld [wTempPointer], a
+ ld [wTempPointer + 0], a
add SPRITE_FRAME_OFFSET_SIZE ; advance FRAME_OFFSET_POINTER by 1 frame, 4 bytes
ld [hli], a
ld a, [hl]
@@ -3525,7 +3758,7 @@ GetAnimFramePointerFromOffset: ; 12b6a (4:6b6a)
ld a, [hli]
ld [wTempPointerBank], a
ld a, [hli]
- ld [wTempPointer], a
+ ld [wTempPointer + 0], a
ld a, [hli]
ld [wTempPointer + 1], a
pop hl
diff --git a/src/engine/bank05.asm b/src/engine/bank05.asm
index f8ed5d7..6927121 100644
--- a/src/engine/bank05.asm
+++ b/src/engine/bank05.asm
@@ -7064,10 +7064,10 @@ CheckIfOpponentHasBossDeckID: ; 17414 (5:7414)
ret
; sets carry if not a boss fight
-; and if s0a00a == 0
+; and if hasn't received legendary cards yet
CheckIfNotABossDeckID: ; 17426 (5:7426)
call EnableSRAM
- ld a, [s0a00a]
+ ld a, [sReceivedLegendaryCards]
call DisableSRAM
or a
jr nz, .no_carry
diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm
index 1e728fd..c0c663c 100644
--- a/src/engine/bank06.asm
+++ b/src/engine/bank06.asm
@@ -2101,7 +2101,7 @@ Func_1996e: ; 1996e (6:596e)
ld [s0a009], a
ld [s0a004], a
ld [sTotalCardPopsDone], a
- ld [s0a00a], a
+ ld [sReceivedLegendaryCards], a
farcall Func_8cf9
call DisableSRAM
ret
diff --git a/src/engine/bank07.asm b/src/engine/bank07.asm
index 206c014..c0d7a9f 100644
--- a/src/engine/bank07.asm
+++ b/src/engine/bank07.asm
@@ -1940,13 +1940,13 @@ Func_1d078: ; 1d078 (7:5078)
ret
Func_1d0fa: ; 1d0fa (7:50fa)
- farcall Func_11320
+ farcall ValidateBackupGeneralSaveData
ld a, $01
- jr c, .asm_1d104
+ jr c, .no_error
ld a, $00
-.asm_1d104
+.no_error
ld [wd624], a
- cp $00
+ cp $00 ; or a
jr z, .asm_1d114
bank1call ValidateSavedNonLinkDuelData
ld a, $01
@@ -1954,7 +1954,7 @@ Func_1d0fa: ; 1d0fa (7:50fa)
ld a, $00
.asm_1d114
ld [wd625], a
- farcall Func_11320
+ farcall ValidateBackupGeneralSaveData
ret
; 0x1d11c
diff --git a/src/engine/home.asm b/src/engine/home.asm
index dc95294..5aba9be 100644
--- a/src/engine/home.asm
+++ b/src/engine/home.asm
@@ -10698,7 +10698,7 @@ GameEvent_Duel: ; 38c0 (0:38c0)
xor a
ld [sba44], a
call DisableSRAM
- call Func_3a3b
+ call SaveGeneralSaveData
bank1call StartDuel
scf
ret
@@ -10736,11 +10736,11 @@ GameEvent_Credits: ; 3911 (0:3911)
or a
ret
-Func_3917: ; 3917 (0:3917)
+GetReceivedLegendaryCards: ; 3917 (0:3917)
ld a, EVENT_RECEIVED_LEGENDARY_CARDS
farcall GetEventValue
call EnableSRAM
- ld [s0a00a], a
+ ld [sReceivedLegendaryCards], a
call DisableSRAM
ret
@@ -10966,16 +10966,16 @@ GetDefaultSong: ; 3a1f (0:3a1f)
ld a, [wDefaultSong]
ret
-Func_3a3b: ; 3a3b (0:3a3b)
- farcall Func_1124d
+SaveGeneralSaveData: ; 3a3b (0:3a3b)
+ farcall _SaveGeneralSaveData
ret
-Func_3a40: ; 3a40 (0:3a40)
- farcall Func_11430
+LoadGeneralSaveData: ; 3a40 (0:3a40)
+ farcall _LoadGeneralSaveData
ret
-Func_3a45: ; 3a45 (0:3a45)
- farcall Func_11343
+ValidateGeneralSaveData: ; 3a45 (0:3a45)
+ farcall _ValidateGeneralSaveData
ret
; adds card with card ID in register a to collection
diff --git a/src/sram.asm b/src/sram.asm
index ea86210..5d01ef5 100644
--- a/src/sram.asm
+++ b/src/sram.asm
@@ -27,7 +27,7 @@ s0a008:: ; a008
ds $1
s0a009:: ; a009
ds $1
-s0a00a:: ; a00a
+sReceivedLegendaryCards:: ; a00a
ds $1
s0a00b:: ; a00b
ds $1
@@ -39,6 +39,8 @@ sPlayerName:: ; a010
ds $e0
+sCardAndDeckSaveData::
+
; for each card, how many (0-127) the player owns
; CARD_NOT_OWNED ($80) indicates that the player has not yet seen the card
sCardCollection:: ; a100
@@ -127,16 +129,27 @@ sUnnamedDeckCounter:: ; b701
; in the Card Album PC menu
sHasPromotionalCards:: ; b703
ds $4
+sCardAndDeckSaveDataEnd::
ds $f9
+sGeneralSaveData::
sb800:: ; b800
- ds $8
+ ds $2
+
+sGeneralSaveDataByteCount:: ; b802
+ ds $2
+
+sGeneralSaveDataCheckSum:: ; b804
+ ds $2
-sb808:: ; b808
+ ds $2
+sGeneralSaveDataHeaderEnd::
+
+sMedalCount:: ; b808
ds $1
-sb809:: ; b809
+sCurOverworldMap:: ; b809
ds $1
sPlayTimeCounter:: ; b80a
@@ -229,7 +242,10 @@ sb86b:: ; b86b
sEventVars:: ; b87b
ds $40
- ds $189
+ ds $45
+sGeneralSaveDataEnd::
+
+ ds $144
sba44:: ; ba44
ds $1
@@ -299,7 +315,12 @@ ENDU
SECTION "SRAM2", SRAM
- ds $18fe
+ ds $1800
+
+sBackupGeneralSaveData:: ; b800
+ ds $bb
+
+ ds $43
; byte 1 = total number of cards collected
; byte 2 = total number of cards to collect
diff --git a/src/wram.asm b/src/wram.asm
index 3b9df84..ff74424 100644
--- a/src/wram.asm
+++ b/src/wram.asm
@@ -2689,13 +2689,18 @@ wGeneralSaveDataCheckSum:: ; d3c5
wNumSRAMValidationErrors:: ; d3c7
ds $1
-wd3c8:: ; d3c8
+; play time hours and minutes
+; byte 0: minutes
+; byte 1: hours (lower byte)
+; byte 2: hours (higher byte)
+; unused?
+wPlayTimeHourMinutes:: ; d3c8
ds $3
-wd3cb:: ; d3cb
+wCurOverworldMap:: ; d3cb
ds $1
-wd3cc:: ; d3cc
+wMedalCount:: ; d3cc
ds $1
; total number of cards the player has collected
@@ -2878,7 +2883,7 @@ wCurSpriteTileSize:: ; d4c7
wTotalNumTiles:: ; d4c8
; checksum?
-wNumGeneralSaveDataBytes:: ; d4c8
+wGeneralSaveDataByteCount:: ; d4c8
ds $2
; stores tile offset in VRAM