Save, Bill's PC

This commit is contained in:
PikalaxALT 2015-11-17 23:29:14 -05:00
parent 27ef600ace
commit bc1870e3f4
12 changed files with 218 additions and 199 deletions

View File

@ -1165,30 +1165,30 @@ endr
cp $f cp $f
jr z, .asm_e2bf5 jr z, .asm_e2bf5
ld b, a ld b, a
call Functione3396 call GetBoxPointer
ld a, b ld a, b
call GetSRAMBank call GetSRAMBank
push hl push hl
ld bc, $35 ld bc, sBoxMon1Level - sBox
add hl, bc add hl, bc
ld bc, $20 ld bc, BOXMON_STRUCT_LENGTH
ld a, e ld a, e
call AddNTimes call AddNTimes
ld a, [hl] ld a, [hl]
ld [TempMonLevel], a ld [TempMonLevel], a
pop hl pop hl
push hl push hl
ld bc, $17 ld bc, sBoxMon1Item - sBox
add hl, bc add hl, bc
ld bc, $20 ld bc, BOXMON_STRUCT_LENGTH
ld a, e ld a, e
call AddNTimes call AddNTimes
ld a, [hl] ld a, [hl]
ld [TempMonItem], a ld [TempMonItem], a
pop hl pop hl
ld bc, $2b ld bc, sBoxMon1DVs - sBox
add hl, bc add hl, bc
ld bc, $20 ld bc, BOXMON_STRUCT_LENGTH
ld a, e ld a, e
call AddNTimes call AddNTimes
ld de, TempMonDVs ld de, TempMonDVs
@ -1201,19 +1201,19 @@ endr
ret ret
.asm_e2bc6 .asm_e2bc6
ld hl, PartyMon1Level ld hl, PartyMon1Level
ld bc, $30 ld bc, PARTYMON_STRUCT_LENGTH
ld a, e ld a, e
call AddNTimes call AddNTimes
ld a, [hl] ld a, [hl]
ld [TempMonLevel], a ld [TempMonLevel], a
ld hl, PartyMon1Item ld hl, PartyMon1Item
ld bc, $30 ld bc, PARTYMON_STRUCT_LENGTH
ld a, e ld a, e
call AddNTimes call AddNTimes
ld a, [hl] ld a, [hl]
ld [TempMonItem], a ld [TempMonItem], a
ld hl, PartyMon1DVs ld hl, PartyMon1DVs
ld bc, $30 ld bc, PARTYMON_STRUCT_LENGTH
ld a, e ld a, e
call AddNTimes call AddNTimes
ld de, TempMonDVs ld de, TempMonDVs
@ -1228,21 +1228,21 @@ endr
ld a, BANK(sBox) ld a, BANK(sBox)
call GetSRAMBank call GetSRAMBank
ld hl, sBoxMon1Level ld hl, sBoxMon1Level
ld bc, $20 ld bc, BOXMON_STRUCT_LENGTH
ld a, e ld a, e
call AddNTimes call AddNTimes
ld a, [hl] ld a, [hl]
ld [TempMonLevel], a ld [TempMonLevel], a
ld hl, sBoxMon1Item ld hl, sBoxMon1Item
ld bc, $20 ld bc, BOXMON_STRUCT_LENGTH
ld a, e ld a, e
call AddNTimes call AddNTimes
ld a, [hl] ld a, [hl]
ld [TempMonItem], a ld [TempMonItem], a
ld hl, sBoxMon1DVs ld hl, sBoxMon1DVs
ld bc, $20 ld bc, BOXMON_STRUCT_LENGTH
ld a, e ld a, e
call AddNTimes call AddNTimes
ld de, TempMonDVs ld de, TempMonDVs
@ -1307,6 +1307,7 @@ Functione2c6e: ; e2c6e (38:6c6e)
ld de, String_e2c67 ld de, String_e2c67
call PlaceString call PlaceString
ret ret
.asm_e2c7c .asm_e2c7c
inc de inc de
ld a, [de] ld a, [de]
@ -1320,36 +1321,38 @@ Functione2c6e: ; e2c6e (38:6c6e)
cp $f cp $f
jr z, .asm_e2cf1 jr z, .asm_e2cf1
push hl push hl
call Functione3396 call GetBoxPointer
ld a, b ld a, b
call GetSRAMBank call GetSRAMBank
push hl push hl
ld bc, $16 ld bc, sBoxMons - sBox
add hl, bc add hl, bc
ld bc, $20 ld bc, BOXMON_STRUCT_LENGTH
ld a, e ld a, e
call AddNTimes call AddNTimes
ld a, [hl] ld a, [hl]
pop hl pop hl
and a and a
jr z, .asm_e2cc2 jr z, .asm_e2cc2
ld bc, $372 ld bc, sBoxMonNicknames - sBox
add hl, bc add hl, bc
ld bc, $b ld bc, PKMN_NAME_LENGTH
ld a, e ld a, e
call AddNTimes call AddNTimes
ld de, StringBuffer1 ld de, StringBuffer1
ld bc, $b ld bc, PKMN_NAME_LENGTH
call CopyBytes call CopyBytes
call CloseSRAM call CloseSRAM
pop hl pop hl
ld de, StringBuffer1 ld de, StringBuffer1
call PlaceString call PlaceString
ret ret
.asm_e2cc2 .asm_e2cc2
call CloseSRAM call CloseSRAM
pop hl pop hl
jr .asm_e2d23 jr .asm_e2d23
.asm_e2cc8 .asm_e2cc8
push hl push hl
ld hl, PartySpecies ld hl, PartySpecies
@ -1359,19 +1362,21 @@ Functione2c6e: ; e2c6e (38:6c6e)
and a and a
jr z, .asm_e2cee jr z, .asm_e2cee
ld hl, PartyMonNicknames ld hl, PartyMonNicknames
ld bc, $b ld bc, PKMN_NAME_LENGTH
ld a, e ld a, e
call AddNTimes call AddNTimes
ld de, StringBuffer1 ld de, StringBuffer1
ld bc, $b ld bc, PKMN_NAME_LENGTH
call CopyBytes call CopyBytes
pop hl pop hl
ld de, StringBuffer1 ld de, StringBuffer1
call PlaceString call PlaceString
ret ret
.asm_e2cee .asm_e2cee
pop hl pop hl
jr .asm_e2d23 jr .asm_e2d23
.asm_e2cf1 .asm_e2cf1
push hl push hl
ld a, BANK(sBox) ld a, BANK(sBox)
@ -1394,6 +1399,7 @@ Functione2c6e: ; e2c6e (38:6c6e)
ld de, StringBuffer1 ld de, StringBuffer1
call PlaceString call PlaceString
ret ret
.asm_e2d1f .asm_e2d1f
call CloseSRAM call CloseSRAM
pop hl pop hl
@ -1422,7 +1428,7 @@ Functione2d30: ; e2d30 (38:6d30)
cp $f cp $f
jr z, .asm_e2db7 jr z, .asm_e2db7
ld b, a ld b, a
call Functione3396 call GetBoxPointer
ld a, b ld a, b
call GetSRAMBank call GetSRAMBank
inc hl inc hl
@ -1447,6 +1453,7 @@ Functione2d30: ; e2d30 (38:6d30)
inc a inc a
ld [wd004], a ld [wd004], a
jr .asm_e2d57 jr .asm_e2d57
.asm_e2d79 .asm_e2d79
call CloseSRAM call CloseSRAM
ld a, $ff ld a, $ff
@ -1455,6 +1462,7 @@ Functione2d30: ; e2d30 (38:6d30)
inc a inc a
ld [wcb2c], a ld [wcb2c], a
ret ret
.asm_e2d87 .asm_e2d87
ld hl, PartySpecies ld hl, PartySpecies
.asm_e2d8a .asm_e2d8a
@ -1478,6 +1486,7 @@ Functione2d30: ; e2d30 (38:6d30)
inc a inc a
ld [wd004], a ld [wd004], a
jr .asm_e2d8a jr .asm_e2d8a
.asm_e2dac .asm_e2dac
ld a, $ff ld a, $ff
ld [de], a ld [de], a
@ -1485,6 +1494,7 @@ Functione2d30: ; e2d30 (38:6d30)
inc a inc a
ld [wcb2c], a ld [wcb2c], a
ret ret
.asm_e2db7 .asm_e2db7
ld a, BANK(sBox) ld a, BANK(sBox)
call GetSRAMBank call GetSRAMBank
@ -1510,6 +1520,7 @@ Functione2d30: ; e2d30 (38:6d30)
inc a inc a
ld [wd004], a ld [wd004], a
jr .asm_e2dbf jr .asm_e2dbf
.asm_e2de1 .asm_e2de1
call CloseSRAM call CloseSRAM
ld a, $ff ld a, $ff
@ -1538,10 +1549,11 @@ Functione2e01: ; e2e01 (38:6e01)
jr nz, .asm_e2e0b jr nz, .asm_e2e0b
call ClearSprites call ClearSprites
ret ret
.asm_e2e0b .asm_e2e0b
ld hl, Unknown_e2e2b ld hl, Unknown_e2e2b
ld de, Sprites ld de, Sprites
.done1 .loop
ld a, [hl] ld a, [hl]
cp $ff cp $ff
ret z ret z
@ -1561,7 +1573,7 @@ Functione2e01: ; e2e01 (38:6e01)
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a
inc de inc de
jr .done1 jr .loop
; e2e2b (38:6e2b) ; e2e2b (38:6e2b)
Unknown_e2e2b: ; e2e2b Unknown_e2e2b: ; e2e2b
@ -1795,11 +1807,11 @@ Functione2fd6: ; e2fd6 (38:6fd6)
ld a, BANK(sBox) ld a, BANK(sBox)
call GetSRAMBank call GetSRAMBank
ld hl, sBoxSpecies ld hl, sBoxSpecies
call Functione3357 call CopySpeciesToTemp
ld hl, sBoxMonNicknames ld hl, sBoxMonNicknames
call Functione3363 call CopyNicknameToTemp
ld hl, sBoxMonOT ld hl, sBoxMonOT
call Functione3376 call CopyOTNameToTemp
ld hl, sBoxMons ld hl, sBoxMons
ld bc, BOXMON_STRUCT_LENGTH ld bc, BOXMON_STRUCT_LENGTH
ld a, [CurPartyMon] ld a, [CurPartyMon]
@ -1813,11 +1825,11 @@ Functione2fd6: ; e2fd6 (38:6fd6)
.asm_e3020 .asm_e3020
ld hl, PartySpecies ld hl, PartySpecies
call Functione3357 call CopySpeciesToTemp
ld hl, PartyMonNicknames ld hl, PartyMonNicknames
call Functione3363 call CopyNicknameToTemp
ld hl, PartyMonOT ld hl, PartyMonOT
call Functione3376 call CopyOTNameToTemp
ld hl, PartyMons ; wdcdf (aliases: PartyMon1, PartyMon1Species) ld hl, PartyMons ; wdcdf (aliases: PartyMon1, PartyMon1Species)
ld bc, PARTYMON_STRUCT_LENGTH ld bc, PARTYMON_STRUCT_LENGTH
ld a, [CurPartyMon] ld a, [CurPartyMon]
@ -1829,27 +1841,27 @@ Functione2fd6: ; e2fd6 (38:6fd6)
.asm_e3048 .asm_e3048
ld b, a ld b, a
call Functione3396 call GetBoxPointer
ld a, b ld a, b
call GetSRAMBank call GetSRAMBank
push hl push hl
inc hl inc hl
call Functione3357 call CopySpeciesToTemp
pop hl pop hl
push hl push hl
ld bc, $372 ld bc, sBoxMonNicknames - sBox
add hl, bc add hl, bc
call Functione3363 call CopyNicknameToTemp
pop hl pop hl
push hl push hl
ld bc, $296 ld bc, sBoxMonOT - sBox
add hl, bc add hl, bc
call Functione3376 call CopyOTNameToTemp
pop hl pop hl
ld bc, $16 ld bc, sBoxMons - sBox
add hl, bc add hl, bc
ld bc, $20 ld bc, BOXMON_STRUCT_LENGTH
call Functione3389 call CopyMonToTemp
call CloseSRAM call CloseSRAM
callba Function5088b callba Function5088b
ret ret
@ -2141,7 +2153,7 @@ Functione32b0: ; e32b0
ld a, [wcb31] ld a, [wcb31]
dec a dec a
ld e, a ld e, a
callba Function14ac2 callba MovePkmnWOMail_SaveGame
ld a, [wcb30] ld a, [wcb30]
ld hl, wcb2f ld hl, wcb2f
add [hl] add [hl]
@ -2149,14 +2161,14 @@ Functione32b0: ; e32b0
ld a, $1 ld a, $1
call GetSRAMBank call GetSRAMBank
ld hl, sBoxSpecies ld hl, sBoxSpecies
call Functione3357 call CopySpeciesToTemp
ld hl, sBoxMonNicknames ld hl, sBoxMonNicknames
call Functione3363 call CopyNicknameToTemp
ld hl, sBoxMonOT ld hl, sBoxMonOT
call Functione3376 call CopyOTNameToTemp
ld hl, sBoxMons ld hl, sBoxMons
ld bc, BOXMON_STRUCT_LENGTH ld bc, BOXMON_STRUCT_LENGTH
call Functione3389 call CopyMonToTemp
call CloseSRAM call CloseSRAM
callba Function5088b callba Function5088b
ld a, PC_DEPOSIT ld a, PC_DEPOSIT
@ -2169,7 +2181,7 @@ Functione32fa: ; e32fa
ld a, [wcb2e] ld a, [wcb2e]
dec a dec a
ld e, a ld e, a
callba Function14ac2 callba MovePkmnWOMail_SaveGame
ld a, [wcb2b] ld a, [wcb2b]
ld hl, wcb2a ld hl, wcb2a
add [hl] add [hl]
@ -2184,14 +2196,14 @@ Functione3316: ; e3316
add [hl] add [hl]
ld [CurPartyMon], a ld [CurPartyMon], a
ld hl, PartySpecies ld hl, PartySpecies
call Functione3357 call CopySpeciesToTemp
ld hl, PartyMonNicknames ld hl, PartyMonNicknames
call Functione3363 call CopyNicknameToTemp
ld hl, PartyMonOT ld hl, PartyMonOT
call Functione3376 call CopyOTNameToTemp
ld hl, PartyMon1Species ld hl, PartyMon1Species
ld bc, PARTYMON_STRUCT_LENGTH ld bc, PARTYMON_STRUCT_LENGTH
call Functione3389 call CopyMonToTemp
xor a xor a
ld [wPokemonWithdrawDepositParameter], a ld [wPokemonWithdrawDepositParameter], a
callba Functione039 callba Functione039
@ -2207,7 +2219,7 @@ Functione3346: ; e3346
ret ret
; e3357 ; e3357
Functione3357: ; e3357 (38:7357) CopySpeciesToTemp: ; e3357 (38:7357)
ld a, [CurPartyMon] ld a, [CurPartyMon]
ld c, a ld c, a
ld b, $0 ld b, $0
@ -2216,36 +2228,36 @@ Functione3357: ; e3357 (38:7357)
ld [CurPartySpecies], a ld [CurPartySpecies], a
ret ret
Functione3363: ; e3363 (38:7363) CopyNicknameToTemp: ; e3363 (38:7363)
ld bc, $b ld bc, PKMN_NAME_LENGTH
ld a, [CurPartyMon] ld a, [CurPartyMon]
call AddNTimes call AddNTimes
ld de, wd002 ld de, wd002
ld bc, $b ld bc, PKMN_NAME_LENGTH
call CopyBytes call CopyBytes
ret ret
Functione3376: ; e3376 (38:7376) CopyOTNameToTemp: ; e3376 (38:7376)
ld bc, $b ld bc, NAME_LENGTH
ld a, [CurPartyMon] ld a, [CurPartyMon]
call AddNTimes call AddNTimes
ld de, wd00d ld de, wd00d
ld bc, $b ld bc, NAME_LENGTH
call CopyBytes call CopyBytes
ret ret
Functione3389: ; e3389 (38:7389) CopyMonToTemp: ; e3389 (38:7389)
ld a, [CurPartyMon] ld a, [CurPartyMon]
call AddNTimes call AddNTimes
ld de, wd018 ld de, wd018_Mon
call CopyBytes call CopyBytes
ret ret
Functione3396: ; e3396 (38:7396) GetBoxPointer: ; e3396 (38:7396)
dec b dec b
ld c, b ld c, b
ld b, 0 ld b, 0
ld hl, Unknown_e33a6 ld hl, .boxes
rept 3 rept 3
add hl, bc add hl, bc
endr endr
@ -2257,7 +2269,7 @@ endr
ret ret
; e33a6 (38:73a6) ; e33a6 (38:73a6)
Unknown_e33a6: ; e33a6 .boxes: ; e33a6
; bank, address ; bank, address
dba sBox1 dba sBox1
dba sBox2 dba sBox2
@ -2576,7 +2588,7 @@ Functione36f9: ; e36f9 (38:76f9)
ld a, [wCurBox] ld a, [wCurBox]
cp e cp e
ret z ret z
callba Function14a83 callba ChangeBoxSaveGame
ret ret
.asm_e3745 .asm_e3745

View File

@ -3969,7 +3969,7 @@ Function29e53: ; 29e53
Special_TryQuickSave: ; 29e66 Special_TryQuickSave: ; 29e66
ld a, [wd265] ld a, [wd265]
push af push af
callba Function14ab2 callba Link_SaveGame
ld a, $1 ld a, $1
jr nc, .asm_29e75 jr nc, .asm_29e75
xor a xor a

View File

@ -150,7 +150,7 @@ Function49da4: ; 49da4
nop nop
nop nop
nop nop
ld a, [wcfcd] ld a, [wSaveFileExists]
and a and a
jr nz, .next jr nz, .next
ld a, $0 ld a, $0
@ -220,7 +220,7 @@ Function49de4: ; 49de4
; 49e09 ; 49e09
Function49e09: ; 49e09 Function49e09: ; 49e09
ld a, [wcfcd] ld a, [wSaveFileExists]
and a and a
ret z ret z
xor a xor a
@ -256,7 +256,7 @@ Function49e27: ; 49e27
Function49e3d: ; 49e3d Function49e3d: ; 49e3d
ld a, [wcfcd] ld a, [wSaveFileExists]
and a and a
ret z ret z
call Function6e3 call Function6e3
@ -566,7 +566,7 @@ Function4a0c2: ; 4a0c2 (12:60c2)
pop af pop af
and a and a
jr nz, .asm_4a0f9 jr nz, .asm_4a0f9
callba Function1509a callba _SaveData
.asm_4a0f9 .asm_4a0f9
ld c, 5 ld c, 5
call DelayFrames call DelayFrames

View File

@ -3,11 +3,11 @@ SaveMenu: ; 14a1a
callba Function5e9a callba Function5e9a
call SpeechTextBox call SpeechTextBox
call UpdateSprites call UpdateSprites
callba Function4cf45 callba SaveMenu_LoadDETile
ld hl, UnknownText_0x15283 ld hl, UnknownText_0x15283
call SaveTheGame_yesorno call SaveTheGame_yesorno
jr nz, .refused jr nz, .refused
call CheckForExistingSaveFile call AskOverwriteSaveFile
jr c, .refused jr c, .refused
call SetWRAMStateForSave call SetWRAMStateForSave
call _SavingDontTurnOffThePower call _SavingDontTurnOffThePower
@ -15,36 +15,37 @@ SaveMenu: ; 14a1a
call ExitMenu call ExitMenu
and a and a
ret ret
.refused .refused
call ExitMenu call ExitMenu
call Functiond90 call Functiond90
callba Function4cf45 callba SaveMenu_LoadDETile
scf scf
ret ret
Function14a58: ; 14a58 Function14a58: ; 14a58
call SetWRAMStateForSave call SetWRAMStateForSave
callba Function14056 callba StageRTCTimeForSave
callba Function1050d9 callba BackupMysteryGift
call SavePokemonData call SavePokemonData
call Function14e13 call SaveChecksum
call SaveBackupPokemonData call SaveBackupPokemonData
call SaveBackupChecksum call SaveBackupChecksum
callba BackupPartyMonMail callba BackupPartyMonMail
callba Function1406a callba SaveRTC
call ClearWRAMStateAfterSave call ClearWRAMStateAfterSave
ret ret
; 14a83 ; 14a83
Function14a83: ; 14a83 (5:4a83) ChangeBoxSaveGame: ; 14a83 (5:4a83)
push de push de
ld hl, UnknownText_0x152a1 ld hl, UnknownText_0x152a1
call MenuTextBox call MenuTextBox
call YesNoBox call YesNoBox
call ExitMenu call ExitMenu
jr c, .refused jr c, .refused
call CheckForExistingSaveFile call AskOverwriteSaveFile
jr c, .refused jr c, .refused
call SetWRAMStateForSave call SetWRAMStateForSave
call SavingDontTurnOffThePower call SavingDontTurnOffThePower
@ -61,8 +62,8 @@ Function14a83: ; 14a83 (5:4a83)
pop de pop de
ret ret
Function14ab2: ; 14ab2 Link_SaveGame: ; 14ab2
call CheckForExistingSaveFile call AskOverwriteSaveFile
jr c, .refused jr c, .refused
call SetWRAMStateForSave call SetWRAMStateForSave
call _SavingDontTurnOffThePower call _SavingDontTurnOffThePower
@ -73,7 +74,7 @@ Function14ab2: ; 14ab2
ret ret
; 14ac2 ; 14ac2
Function14ac2: ; 14ac2 MovePkmnWOMail_SaveGame: ; 14ac2
call SetWRAMStateForSave call SetWRAMStateForSave
push de push de
call SaveBox call SaveBox
@ -93,14 +94,14 @@ Function14ad5: ; 14ad5
ld a, e ld a, e
ld [wCurBox], a ld [wCurBox], a
ld a, $1 ld a, $1
ld [wcfcd], a ld [wSaveFileExists], a
callba Function14056 callba StageRTCTimeForSave
callba Function1050d9 callba BackupMysteryGift
call ValidateSave call ValidateSave
call SaveOptions call SaveOptions
call SavePlayerData call SavePlayerData
call SavePokemonData call SavePokemonData
call Function14e13 call SaveChecksum
call ValidateBackupSave call ValidateBackupSave
call SaveBackupOptions call SaveBackupOptions
call SaveBackupPlayerData call SaveBackupPlayerData
@ -108,31 +109,31 @@ Function14ad5: ; 14ad5
call SaveBackupChecksum call SaveBackupChecksum
callba BackupPartyMonMail callba BackupPartyMonMail
callba BackupMobileEventIndex callba BackupMobileEventIndex
callba Function1406a callba SaveRTC
call LoadBox call LoadBox
call ClearWRAMStateAfterSave call ClearWRAMStateAfterSave
ld de, SFX_SAVE ld de, SFX_SAVE
call PlaySFX call PlaySFX
ld c, $18 ld c, 24
call DelayFrames call DelayFrames
ret ret
; 14b34 ; 14b34
Function14b34: ; 14b34 StartMovePkmnWOMail_SaveGame: ; 14b34
ld hl, UnknownText_0x152a6 ld hl, UnknownText_0x152a6
call MenuTextBox call MenuTextBox
call YesNoBox call YesNoBox
call ExitMenu call ExitMenu
jr c, .asm_14b52 jr c, .refused
call CheckForExistingSaveFile call AskOverwriteSaveFile
jr c, .asm_14b52 jr c, .refused
call SetWRAMStateForSave call SetWRAMStateForSave
call _SavingDontTurnOffThePower call _SavingDontTurnOffThePower
call ClearWRAMStateAfterSave call ClearWRAMStateAfterSave
and a and a
ret ret
.asm_14b52 .refused
scf scf
ret ret
; 14b54 ; 14b54
@ -177,8 +178,8 @@ SaveGameData: ; 14b85
ret ret
; 14b89 ; 14b89
CheckForExistingSaveFile: ; 14b89 AskOverwriteSaveFile: ; 14b89
ld a, [wcfcd] ld a, [wSaveFileExists]
and a and a
jr z, .erase jr z, .erase
call Function14bcb call Function14bcb
@ -269,15 +270,15 @@ SavedTheGame: ; 14be6
SaveGameData_: ; 14c10 SaveGameData_: ; 14c10
ld a, 1 ld a, 1
ld [wcfcd], a ld [wSaveFileExists], a
callba Function14056 callba StageRTCTimeForSave
callba Function1050d9 callba BackupMysteryGift
call ValidateSave call ValidateSave
call SaveOptions call SaveOptions
call SavePlayerData call SavePlayerData
call SavePokemonData call SavePokemonData
call SaveBox call SaveBox
call Function14e13 call SaveChecksum
call ValidateBackupSave call ValidateBackupSave
call SaveBackupOptions call SaveBackupOptions
call SaveBackupPlayerData call SaveBackupPlayerData
@ -286,14 +287,14 @@ SaveGameData_: ; 14c10
call UpdateStackTop call UpdateStackTop
callba BackupPartyMonMail callba BackupPartyMonMail
callba BackupMobileEventIndex callba BackupMobileEventIndex
callba Function1406a callba SaveRTC
ld a, BANK(s1_be45) ld a, BANK(sSaveType)
call GetSRAMBank call GetSRAMBank
ld a, [s1_be45] ld a, [sSaveType]
cp $4 cp $4
jr nz, .ok jr nz, .ok
xor a xor a
ld [s1_be45], a ld [sSaveType], a
.ok .ok
call CloseSRAM call CloseSRAM
ret ret
@ -371,7 +372,7 @@ ErasePreviousSave: ; 14cbb
call EraseHallOfFame call EraseHallOfFame
call EraseLinkBattleStats call EraseLinkBattleStats
call EraseMysteryGift call EraseMysteryGift
call Function14d68 call SaveData
call Function14d5c call Function14d5c
ld a, BANK(sStackTop) ld a, BANK(sStackTop)
call GetSRAMBank call GetSRAMBank
@ -395,10 +396,10 @@ EraseLinkBattleStats: ; 14ce2
; 14cf4 ; 14cf4
EraseMysteryGift: ; 14cf4 EraseMysteryGift: ; 14cf4
ld a, BANK(s0_abe4) ld a, BANK(sBackupMysteryGiftItem)
call GetSRAMBank call GetSRAMBank
ld hl, s0_abe4 ld hl, sBackupMysteryGiftItem
ld bc, s0_abe4End - s0_abe4 ld bc, sBackupMysteryGiftItemEnd - sBackupMysteryGiftItem
xor a xor a
call ByteFill call ByteFill
jp CloseSRAM jp CloseSRAM
@ -437,15 +438,15 @@ Unknown_14d2c: ; 14d2c
; 14d5c ; 14d5c
Function14d5c: ; 14d5c Function14d5c: ; 14d5c
ld a, BANK(s1_be45) ld a, BANK(sSaveType)
call GetSRAMBank call GetSRAMBank
xor a xor a
ld [s1_be45], a ld [sSaveType], a
jp CloseSRAM jp CloseSRAM
; 14d68 ; 14d68
Function14d68: ; 14d68 SaveData: ; 14d68
call Function1509a call _SaveData
ret ret
; 14d6c ; 14d6c
@ -547,7 +548,7 @@ SaveBox: ; 14e0c
ret ret
; 14e13 ; 14e13
Function14e13: ; 14e13 SaveChecksum: ; 14e13
ld hl, sGameData ld hl, sGameData
ld bc, sGameDataEnd - sGameData ld bc, sGameDataEnd - sGameData
ld a, BANK(sGameData) ld a, BANK(sGameData)
@ -632,7 +633,7 @@ TryLoadSaveFile: ; 14ea5 (5:4ea5)
call LoadBox call LoadBox
callba RestorePartyMonMail callba RestorePartyMonMail
callba RestoreMobileEventIndex callba RestoreMobileEventIndex
callba Function1050ea callba RestoreMysteryGift
call ValidateBackupSave call ValidateBackupSave
call SaveBackupOptions call SaveBackupOptions
call SaveBackupPlayerData call SaveBackupPlayerData
@ -649,12 +650,12 @@ TryLoadSaveFile: ; 14ea5 (5:4ea5)
call LoadBox call LoadBox
callba RestorePartyMonMail callba RestorePartyMonMail
callba RestoreMobileEventIndex callba RestoreMobileEventIndex
callba Function1050ea callba RestoreMysteryGift
call ValidateSave call ValidateSave
call SaveOptions call SaveOptions
call SavePlayerData call SavePlayerData
call SavePokemonData call SavePokemonData
call Function14e13 call SaveChecksum
and a and a
ret ret
@ -671,11 +672,11 @@ TryLoadSaveFile: ; 14ea5 (5:4ea5)
ret ret
Function14f1c: ; 14f1c TryLoadSaveData: ; 14f1c
xor a xor a
ld [wcfcd], a ld [wSaveFileExists], a
call Function14f84 call CheckPrimarySaveFile
ld a, [wcfcd] ld a, [wSaveFileExists]
and a and a
jr z, .backup jr z, .backup
@ -693,8 +694,8 @@ Function14f1c: ; 14f1c
ret ret
.backup .backup
call Function14faf call CheckBackupSaveFile
ld a, [wcfcd] ld a, [wSaveFileExists]
and a and a
jr z, .corrupt jr z, .corrupt
@ -716,7 +717,7 @@ Function14f1c: ; 14f1c
ld de, Options ld de, Options
ld bc, OptionsEnd - Options ld bc, OptionsEnd - Options
call CopyBytes call CopyBytes
call Function67e call PanicResetClock
ret ret
; 14f7c ; 14f7c
@ -731,7 +732,7 @@ DefaultOptions: ; 14f7c
db $00 db $00
; 14f84 ; 14f84
Function14f84: ; 14f84 CheckPrimarySaveFile: ; 14f84
ld a, BANK(s1_a008) ld a, BANK(s1_a008)
call GetSRAMBank call GetSRAMBank
ld a, [s1_a008] ld a, [s1_a008]
@ -746,14 +747,14 @@ Function14f84: ; 14f84
call CopyBytes call CopyBytes
call CloseSRAM call CloseSRAM
ld a, $1 ld a, $1
ld [wcfcd], a ld [wSaveFileExists], a
.nope .nope
call CloseSRAM call CloseSRAM
ret ret
; 14faf ; 14faf
Function14faf: ; 14faf CheckBackupSaveFile: ; 14faf
ld a, BANK(s0_b208) ld a, BANK(s0_b208)
call GetSRAMBank call GetSRAMBank
ld a, [s0_b208] ld a, [s0_b208]
@ -767,7 +768,7 @@ Function14faf: ; 14faf
ld bc, OptionsEnd - Options ld bc, OptionsEnd - Options
call CopyBytes call CopyBytes
ld a, $2 ld a, $2
ld [wcfcd], a ld [wSaveFileExists], a
.nope .nope
call CloseSRAM call CloseSRAM
@ -787,14 +788,14 @@ LoadPlayerData: ; 14fd7 (5:4fd7)
ld bc, wMapDataEnd - wMapData ld bc, wMapDataEnd - wMapData
call CopyBytes call CopyBytes
call CloseSRAM call CloseSRAM
ld a, BANK(s1_be45) ld a, BANK(sSaveType)
call GetSRAMBank call GetSRAMBank
ld a, [s1_be45] ld a, [sSaveType]
cp $4 cp $4
jr nz, .asm_15008 jr nz, .not_4
ld a, $3 ld a, $3
ld [s1_be45], a ld [sSaveType], a
.asm_15008 .not_4
call CloseSRAM call CloseSRAM
ret ret
@ -822,10 +823,10 @@ VerifyChecksum: ; 15028 (5:5028)
call Checksum call Checksum
ld a, [sChecksum + 0] ld a, [sChecksum + 0]
cp e cp e
jr nz, .asm_15040 jr nz, .fail
ld a, [sChecksum + 1] ld a, [sChecksum + 1]
cp d cp d
.asm_15040 .fail
push af push af
call CloseSRAM call CloseSRAM
pop af pop af
@ -863,17 +864,17 @@ VerifyBackupChecksum: ; 1507c (5:507c)
call Checksum call Checksum
ld a, [sBackupChecksum + 0] ld a, [sBackupChecksum + 0]
cp e cp e
jr nz, .asm_15094 jr nz, .fail
ld a, [sBackupChecksum + 1] ld a, [sBackupChecksum + 1]
cp d cp d
.asm_15094 .fail
push af push af
call CloseSRAM call CloseSRAM
pop af pop af
ret ret
Function1509a: ; 1509a _SaveData: ; 1509a
ld a, BANK(sCrystalData) ld a, BANK(sCrystalData)
call GetSRAMBank call GetSRAMBank
ld hl, wCrystalData ld hl, wCrystalData

View File

@ -5,10 +5,10 @@ AskTimer:: ; 591
push af push af
ld a, [hMobile] ld a, [hMobile]
and a and a
jr z, .asm_59a jr z, .not_mobile
call Timer call Timer
.asm_59a .not_mobile
pop af pop af
reti reti
; 59c ; 59c
@ -190,7 +190,7 @@ FixTime:: ; 61d
Function658:: ; 658 Function658:: ; 658
xor a xor a
ld [StringBuffer2], a ld [StringBuffer2], a
ld a, $0 ld a, $0 ; useless
ld [StringBuffer2 + 3], a ld [StringBuffer2 + 3], a
jr Function677 jr Function677
@ -202,7 +202,7 @@ Function663:: ; 663
ld [StringBuffer2 + 2], a ld [StringBuffer2 + 2], a
ld a, [hSeconds] ld a, [hSeconds]
ld [StringBuffer2 + 3], a ld [StringBuffer2 + 3], a
jr Function677 jr Function677 ; useless
Function677:: ; 677 Function677:: ; 677
callba Function140ed callba Function140ed
@ -211,13 +211,13 @@ Function677:: ; 677
Function67e:: ; 67e PanicResetClock:: ; 67e
call Function685 call .ClearhRTC
call SetClock call SetClock
ret ret
; 685 ; 685
Function685:: ; 685 .ClearhRTC ; 685
xor a xor a
ld [hRTCSeconds], a ld [hRTCSeconds], a
ld [hRTCMinutes], a ld [hRTCMinutes], a

View File

@ -494,7 +494,7 @@ Function5df0: ; 5df0
call DelayFrames call DelayFrames
ld c, $1 ld c, $1
callba Function4802f callba Function4802f
callba Function1509a callba _SaveData
ld a, $8 ld a, $8
ld [MusicFade], a ld [MusicFade], a
ld a, MUSIC_NONE % $100 ld a, MUSIC_NONE % $100
@ -1466,7 +1466,7 @@ CopyrightString: ; 63fd
; 642e ; 642e
GameInit:: ; 642e GameInit:: ; 642e
callba Function14f1c callba TryLoadSaveData
call ResetTextRelatedRAM call ResetTextRelatedRAM
call ClearBGPalettes call ClearBGPalettes
call ClearTileMap call ClearTileMap
@ -9924,7 +9924,7 @@ BillsPC_MovePKMNMenu: ; e4cd
jr .quit jr .quit
.no_mail .no_mail
callba Function14b34 callba StartMovePkmnWOMail_SaveGame
jr c, .quit jr c, .quit
callba _MovePKMNWithoutMail callba _MovePKMNWithoutMail
call ReturnToMapFromSubmenu call ReturnToMapFromSubmenu
@ -11219,7 +11219,7 @@ Unknown_1404e: ; Unreferenced
; 14056 ; 14056
Function14056: ; 14056 StageRTCTimeForSave: ; 14056
call UpdateTime call UpdateTime
ld hl, wRTC ld hl, wRTC
ld a, [CurDay] ld a, [CurDay]
@ -11233,7 +11233,7 @@ Function14056: ; 14056
ret ret
; 1406a ; 1406a
Function1406a: ; 1406a SaveRTC: ; 1406a
ld a, $a ld a, $a
ld [MBC3SRamEnable], a ld [MBC3SRamEnable], a
call LatchClock call LatchClock
@ -14969,12 +14969,12 @@ Function2c642: ; 2c642 (b:4642)
call Function2c6ac call Function2c6ac
ld [de], a ld [de], a
inc de inc de
ld a, BANK(s0_abe4) ld a, BANK(sBackupMysteryGiftItem)
call GetSRAMBank call GetSRAMBank
ld a, [s0_abe4] ld a, [sBackupMysteryGiftItem]
ld [de], a ld [de], a
inc de inc de
ld a, [s0_abe4 + 1] ld a, [sBackupMysteryGiftItem + 1]
ld [de], a ld [de], a
ld a, $14 ld a, $14
ld [wca00], a ld [wca00], a
@ -20677,7 +20677,7 @@ EmptyAllSRAMBanks: ; 4cf1f
; 4cf45 ; 4cf45
Function4cf45: ; 4cf45 (13:4f45) SaveMenu_LoadDETile: ; 4cf45 (13:4f45)
ld a, [hCGB] ld a, [hCGB]
and a and a
jp z, WaitBGMap jp z, WaitBGMap
@ -38369,7 +38369,7 @@ DoMysteryGift: ; 1048ba (41:48ba)
ld c, a ld c, a
callba MysteryGiftGetItemHeldEffect callba MysteryGiftGetItemHeldEffect
ld a, c ld a, c
ld [s0_abe4], a ld [sBackupMysteryGiftItem], a
ld [wNamedObjectIndexBuffer], a ld [wNamedObjectIndexBuffer], a
call CloseSRAM call CloseSRAM
call GetItemName call GetItemName
@ -39434,10 +39434,10 @@ Function1050c8: ; 1050c8
; 1050d9 ; 1050d9
Function1050d9: ; 1050d9 BackupMysteryGift: ; 1050d9
call GetMysteryGiftBank call GetMysteryGiftBank
ld hl, sMysteryGiftItem ld hl, sMysteryGiftItem
ld de, s0_abe4 ld de, sBackupMysteryGiftItem
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a
inc de inc de
@ -39447,9 +39447,9 @@ Function1050d9: ; 1050d9
; 1050ea ; 1050ea
Function1050ea: ; 1050ea (41:50ea) RestoreMysteryGift: ; 1050ea (41:50ea)
call GetMysteryGiftBank call GetMysteryGiftBank
ld hl, s0_abe4 ld hl, sBackupMysteryGiftItem
ld de, sMysteryGiftItem ld de, sMysteryGiftItem
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a
@ -39470,7 +39470,7 @@ Function1050fb: ; 1050fb (41:50fb)
GetMysteryGiftBank: ; 105106 GetMysteryGiftBank: ; 105106
ld a, BANK(s0_abe4) ld a, BANK(sBackupMysteryGiftItem)
jp GetSRAMBank jp GetSRAMBank
; 10510b ; 10510b

View File

@ -409,10 +409,10 @@ CopyBTTrainer_FromBT_OT_TowBT_OTTemp: ; 1704a2
pop af pop af
ld [rSVBK], a ld [rSVBK], a
ld a, BANK(s1_be45) ld a, BANK(sSaveType)
call GetSRAMBank call GetSRAMBank
ld a, $2 ld a, $2
ld [s1_be45], a ld [sSaveType], a
ld hl, sNrOfBeatenBattleTowerTrainers ld hl, sNrOfBeatenBattleTowerTrainers
inc [hl] inc [hl]
call CloseSRAM call CloseSRAM

View File

@ -7965,7 +7965,7 @@ Function10378c: ; 10378c
.asm_10379c .asm_10379c
push bc push bc
callba Function14ab2 callba Link_SaveGame
pop bc pop bc
jr c, .asm_1037b5 jr c, .asm_1037b5
ld a, $1 ld a, $1

View File

@ -652,18 +652,18 @@ Function1706ee: ; 1706ee (5c:46ee)
ret ret
Function17071b: ; 17071b (5c:471b) Function17071b: ; 17071b (5c:471b)
ld a, BANK(s1_be45) ld a, BANK(sSaveType)
call GetSRAMBank call GetSRAMBank
ld a, $3 ld a, $3
ld [s1_be45], a ld [sSaveType], a
call CloseSRAM call CloseSRAM
ret ret
Function170729: ; 170729 (5c:4729) Function170729: ; 170729 (5c:4729)
ld a, BANK(s1_be45) ld a, BANK(sSaveType)
call GetSRAMBank call GetSRAMBank
ld a, $4 ld a, $4
ld [s1_be45], a ld [sSaveType], a
call CloseSRAM call CloseSRAM
ret ret
@ -704,8 +704,8 @@ Function17075f: ; 17075f (5c:475f)
ret ret
Function170778: ; 170778 (5c:4778) Function170778: ; 170778 (5c:4778)
ld hl, s1_be45 ld hl, sSaveType
ld a, BANK(s1_be45) ld a, BANK(sSaveType)
call GetSRAMBank call GetSRAMBank
ld a, [hl] ld a, [hl]
ld [ScriptVar], a ld [ScriptVar], a
@ -728,10 +728,10 @@ Function170799: ; 170799 (5c:4799)
Function17079d: ; 17079d (5c:479d) Function17079d: ; 17079d (5c:479d)
ld c, $0 ld c, $0
asm_17079f: ; 17079f (5c:479f) asm_17079f: ; 17079f (5c:479f)
ld a, BANK(s1_be45) ld a, BANK(sSaveType)
call GetSRAMBank call GetSRAMBank
ld a, c ld a, c
ld [s1_be45], a ld [sSaveType], a
call CloseSRAM call CloseSRAM
ret ret
@ -868,7 +868,7 @@ Function170881: ; 170881 (5c:4881)
ret ret
Function17089a: ; 17089a Function17089a: ; 17089a
ld a, [wcfcd] ld a, [wSaveFileExists]
and a and a
jr z, .asm_1708ad jr z, .asm_1708ad
callba Function14bcb callba Function14bcb

View File

@ -3111,7 +3111,7 @@ Function17e3ac: ; 17e3ac
push af push af
ld a, $1 ld a, $1
ld [rSVBK], a ld [rSVBK], a
callba Function14e13 callba SaveChecksum
pop af pop af
ld [rSVBK], a ld [rSVBK], a
ret ret

View File

@ -15,15 +15,16 @@ mailmsg: MACRO
ds 3 ds 3
\1MailType:: ds 1 \1MailType:: ds 1
endm endm
; a600
sPartyMail:: sPartyMail::
sPartyMon1Mail:: mailmsg sPartyMon1Mail sPartyMon1Mail:: mailmsg sPartyMon1Mail
sPartyMon2Mail:: mailmsg sPartyMon2Mail sPartyMon2Mail:: mailmsg sPartyMon2Mail
sPartyMon3Mail:: mailmsg sPartyMon3Mail sPartyMon3Mail:: mailmsg sPartyMon3Mail
sPartyMon4Mail:: mailmsg sPartyMon4Mail sPartyMon4Mail:: mailmsg sPartyMon4Mail
sPartyMon5Mail:: mailmsg sPartyMon5Mail sPartyMon5Mail:: mailmsg sPartyMon5Mail
sPartyMon6Mail:: mailmsg sPartyMon6Mail sPartyMon6Mail:: mailmsg sPartyMon6Mail
; a71a
sPartyMailBackup:: sPartyMailBackup::
sPartyMon1MailBackup:: mailmsg sPartyMon1MailBackup sPartyMon1MailBackup:: mailmsg sPartyMon1MailBackup
sPartyMon2MailBackup:: mailmsg sPartyMon2MailBackup sPartyMon2MailBackup:: mailmsg sPartyMon2MailBackup
@ -32,35 +33,38 @@ sPartyMon4MailBackup:: mailmsg sPartyMon4MailBackup
sPartyMon5MailBackup:: mailmsg sPartyMon5MailBackup sPartyMon5MailBackup:: mailmsg sPartyMon5MailBackup
sPartyMon6MailBackup:: mailmsg sPartyMon6MailBackup sPartyMon6MailBackup:: mailmsg sPartyMon6MailBackup
; a834
sMailboxCount:: ds 1 sMailboxCount:: ds 1
sMailbox:: sMailbox::
sMailbox1:: mailmsg sMailbox1 sMailbox1:: mailmsg sMailbox1
sMailbox2:: mailmsg sMailbox2 sMailbox2:: mailmsg sMailbox2
sMailbox3:: mailmsg sMailbox3 sMailbox3:: mailmsg sMailbox3
sMailbox4:: mailmsg sMailbox4 sMailbox4:: mailmsg sMailbox4
sMailbox5:: mailmsg sMailbox5 sMailbox5:: mailmsg sMailbox5
sMailbox6:: mailmsg sMailbox6 sMailbox6:: mailmsg sMailbox6
sMailbox7:: mailmsg sMailbox7 sMailbox7:: mailmsg sMailbox7
sMailbox8:: mailmsg sMailbox8 sMailbox8:: mailmsg sMailbox8
sMailbox9:: mailmsg sMailbox9 sMailbox9:: mailmsg sMailbox9
sMailbox10:: mailmsg sMailbox10 sMailbox10:: mailmsg sMailbox10
; aa0b
sMailboxCountBackup:: ds 1 sMailboxCountBackup:: ds 1
sMailboxBackup:: sMailboxBackup::
sMailbox1Backup:: mailmsg sMailbox1Backup sMailbox1Backup:: mailmsg sMailbox1Backup
sMailbox2Backup:: mailmsg sMailbox2Backup sMailbox2Backup:: mailmsg sMailbox2Backup
sMailbox3Backup:: mailmsg sMailbox3Backup sMailbox3Backup:: mailmsg sMailbox3Backup
sMailbox4Backup:: mailmsg sMailbox4Backup sMailbox4Backup:: mailmsg sMailbox4Backup
sMailbox5Backup:: mailmsg sMailbox5Backup sMailbox5Backup:: mailmsg sMailbox5Backup
sMailbox6Backup:: mailmsg sMailbox6Backup sMailbox6Backup:: mailmsg sMailbox6Backup
sMailbox7Backup:: mailmsg sMailbox7Backup sMailbox7Backup:: mailmsg sMailbox7Backup
sMailbox8Backup:: mailmsg sMailbox8Backup sMailbox8Backup:: mailmsg sMailbox8Backup
sMailbox9Backup:: mailmsg sMailbox9Backup sMailbox9Backup:: mailmsg sMailbox9Backup
sMailbox10Backup:: mailmsg sMailbox10Backup sMailbox10Backup:: mailmsg sMailbox10Backup
; abe2
sMysteryGiftItem:: ds 1 sMysteryGiftItem:: ds 1
s0_abe3:: ds 1 s0_abe3:: ds 1
s0_abe4:: ds 1 sBackupMysteryGiftItem:: ds 1
s0_abe5:: ds 1 s0_abe5:: ds 1
s0_abe6:: ds 10 s0_abe6:: ds 10
s0_abf0:: ds 10 s0_abf0:: ds 10
@ -71,7 +75,7 @@ sMysteryGiftTrainerHouseFlag:: ds 1
s0_abfe:: ds 12 s0_abfe:: ds 12
sMysteryGiftTrainer:: ds (1 + 1 + NUM_MOVES) * PARTY_LENGTH + 1 sMysteryGiftTrainer:: ds (1 + 1 + NUM_MOVES) * PARTY_LENGTH + 1
ds 1 ds 1
s0_abe4End:: sBackupMysteryGiftItemEnd::
ds $30 ds $30
@ -145,7 +149,9 @@ sMobileEventIndex:: ds 1
sCrystalData:: sCrystalData::
ds wCrystalDataEnd - wCrystalData ds wCrystalDataEnd - wCrystalData
sMobileEventIndexBackup:: ds 1 sMobileEventIndexBackup:: ds 1
s1_be45:: ds 1 sSaveType:: ds 1
; 0: normal
; 2: battle tower
; data of the BattleTower must be in SRAM because you can save and leave between battles ; data of the BattleTower must be in SRAM because you can save and leave between battles
sBattleTower:: ; be46 sBattleTower:: ; be46

View File

@ -1418,7 +1418,7 @@ Options:: ; cfcc
; bit 7: battle scene off/on ; bit 7: battle scene off/on
ds 1 ds 1
wcfcd:: ds 1 wSaveFileExists:: ds 1
TextBoxFrame:: ; cfce TextBoxFrame:: ; cfce
; bits 0-2: textbox frame 0-7 ; bits 0-2: textbox frame 0-7