mirror of https://github.com/pret/pokecrystal.git
Remove incomplete fix for the save corruption bug
This commit is contained in:
parent
650686476c
commit
f954c61668
|
@ -2019,103 +2019,7 @@ This bug can prevent you from talking to Eusine in Celadon City or encountering
|
||||||
|
|
||||||
([Video 1](https://www.youtube.com/watch?v=ukqtK0l6bu0), [Video 2](https://www.youtube.com/watch?v=c2zHd1BPtvc))
|
([Video 1](https://www.youtube.com/watch?v=ukqtK0l6bu0), [Video 2](https://www.youtube.com/watch?v=c2zHd1BPtvc))
|
||||||
|
|
||||||
**Fix:** Edit `MoveMonWOMail_InsertMon_SaveGame` and `_SaveGameData` in [engine/menus/save.asm](https://github.com/pret/pokecrystal/blob/master/engine/menus/save.asm):
|
This does not have a simple and accurate fix. It would involve redesigning parts of the save system for Pokémon boxes.
|
||||||
|
|
||||||
```diff
|
|
||||||
MoveMonWOMail_InsertMon_SaveGame:
|
|
||||||
...
|
|
||||||
ld a, TRUE
|
|
||||||
ld [wSaveFileExists], a
|
|
||||||
farcall StageRTCTimeForSave
|
|
||||||
farcall BackupMysteryGift
|
|
||||||
- call ValidateSave
|
|
||||||
+ call InvalidateSave
|
|
||||||
call SaveOptions
|
|
||||||
call SavePlayerData
|
|
||||||
call SavePokemonData
|
|
||||||
call SaveChecksum
|
|
||||||
- call ValidateBackupSave
|
|
||||||
+ call ValidateSave
|
|
||||||
+ call InvalidateBackupSave
|
|
||||||
call SaveBackupOptions
|
|
||||||
call SaveBackupPlayerData
|
|
||||||
call SaveBackupPokemonData
|
|
||||||
call SaveBackupChecksum
|
|
||||||
+ call ValidateBackupSave
|
|
||||||
farcall BackupPartyMonMail
|
|
||||||
farcall BackupMobileEventIndex
|
|
||||||
farcall SaveRTC
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
```diff
|
|
||||||
_SaveGameData:
|
|
||||||
...
|
|
||||||
ld a, TRUE
|
|
||||||
ld [wSaveFileExists], a
|
|
||||||
farcall StageRTCTimeForSave
|
|
||||||
farcall BackupMysteryGift
|
|
||||||
- call ValidateSave
|
|
||||||
+ call InvalidateSave
|
|
||||||
call SaveOptions
|
|
||||||
call SavePlayerData
|
|
||||||
call SavePokemonData
|
|
||||||
call SaveBox
|
|
||||||
call SaveChecksum
|
|
||||||
- call ValidateBackupSave
|
|
||||||
+ call ValidateSave
|
|
||||||
+ call InvalidateBackupSave
|
|
||||||
call SaveBackupOptions
|
|
||||||
call SaveBackupPlayerData
|
|
||||||
call SaveBackupPokemonData
|
|
||||||
call SaveBackupChecksum
|
|
||||||
+ call ValidateBackupSave
|
|
||||||
call UpdateStackTop
|
|
||||||
farcall BackupPartyMonMail
|
|
||||||
farcall BackupMobileEventIndex
|
|
||||||
farcall SaveRTC
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
Then create two new routines, `InvalidateSave` and `InvalidateBackupSave`:
|
|
||||||
|
|
||||||
```diff
|
|
||||||
ValidateSave:
|
|
||||||
ld a, BANK(sCheckValue1) ; aka BANK(sCheckValue2)
|
|
||||||
call OpenSRAM
|
|
||||||
ld a, SAVE_CHECK_VALUE_1
|
|
||||||
ld [sCheckValue1], a
|
|
||||||
ld a, SAVE_CHECK_VALUE_2
|
|
||||||
ld [sCheckValue2], a
|
|
||||||
jp CloseSRAM
|
|
||||||
|
|
||||||
+InvalidateSave:
|
|
||||||
+ ld a, BANK(sCheckValue1) ; aka BANK(sCheckValue2)
|
|
||||||
+ call OpenSRAM
|
|
||||||
+ xor a
|
|
||||||
+ ld [sCheckValue1], a
|
|
||||||
+ ld [sCheckValue2], a
|
|
||||||
+ jp CloseSRAM
|
|
||||||
```
|
|
||||||
|
|
||||||
```diff
|
|
||||||
ValidateBackupSave:
|
|
||||||
ld a, BANK(sBackupCheckValue1) ; aka BANK(sBackupCheckValue2)
|
|
||||||
call OpenSRAM
|
|
||||||
ld a, SAVE_CHECK_VALUE_1
|
|
||||||
ld [sBackupCheckValue1], a
|
|
||||||
ld a, SAVE_CHECK_VALUE_2
|
|
||||||
ld [sBackupCheckValue2], a
|
|
||||||
jp CloseSRAM
|
|
||||||
|
|
||||||
+InvalidateBackupSave:
|
|
||||||
+ ld a, BANK(sBackupCheckValue1) ; aka BANK(sBackupCheckValue2)
|
|
||||||
+ call OpenSRAM
|
|
||||||
+ xor a
|
|
||||||
+ ld [sBackupCheckValue1], a
|
|
||||||
+ ld [sBackupCheckValue2], a
|
|
||||||
+ jp CloseSRAM
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### `ScriptCall` can overflow `wScriptStack` and crash
|
### `ScriptCall` can overflow `wScriptStack` and crash
|
||||||
|
|
Loading…
Reference in New Issue