Remove incomplete fix for the save corruption bug

This commit is contained in:
Rangi 2020-10-21 21:54:44 -04:00
parent 650686476c
commit f954c61668
1 changed files with 1 additions and 97 deletions

View File

@ -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))
**Fix:** Edit `MoveMonWOMail_InsertMon_SaveGame` and `_SaveGameData` in [engine/menus/save.asm](https://github.com/pret/pokecrystal/blob/master/engine/menus/save.asm):
```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
```
This does not have a simple and accurate fix. It would involve redesigning parts of the save system for Pokémon boxes.
### `ScriptCall` can overflow `wScriptStack` and crash