|
Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
|
One loaded save: the raw 32 KB bytes, their expanded object tree, and the tools that move between them. More...
#include <savefile.h>
Public Member Functions | |
| SaveFile (QObject *parent=nullptr) | |
| The expanded, editable object tree. QML traverses in from here. | |
| virtual | ~SaveFile () |
| SaveFileIterator * | iterator () |
| Returns a unique iterator that's setup to iterate over the raw sav file data. | |
| void | setData (var8 *data, bool silent=false) |
| Change-out the save file. | |
| void | resetData (bool silent=false) |
| Empty this save file to zero's. | |
| void | flattenData () |
| Flatten expansion back to the save file, overwriting it's current contents with only data that's strictly nesesary. | |
| void | expandData () |
| Replace expansion with new expansion of current sav file. | |
| void | eraseExpansion () |
| Erase expansion data, this makes expansion data act like a new file but save file contents are preserved. | |
| void | randomizeExpansion () |
| Fully randomizes the expansion data, doesn't change save file data. | |
Public Attributes | |
| var8 * | data = nullptr |
| Actual SAV Data, a raw internal binary copy of the file. | |
| SaveFileExpanded * | dataExpanded = nullptr |
| Expanded SAV data to be readable and more usable. | |
| SaveFileToolset * | toolset = nullptr |
| Tools to operate directly on the raw sav file data. | |
Protected Member Functions | |
| void | dataExpandedChanged (SaveFileExpanded *expanded) |
| SAV file has changed but the old expansion has not been replaced with exxpansion of new data. | |
Protected Attributes | |
| : void dataChanged(var8* data) | |
One loaded save: the raw 32 KB bytes, their expanded object tree, and the tools that move between them.
SaveFile is the hinge of the whole app. It holds three things: the raw byte buffer data (the on-disk source of truth), the dataExpanded object tree that the QML UI actually edits, and a toolset for byte-level access. Its verbs move data between the two representations – expandData() parses raw -> objects, flattenData() writes objects -> raw (only the strictly-necessary bytes). It is exposed to QML through FileManagement as brg.file.data.
Definition at line 45 of file savefile.h.
| SaveFile::SaveFile | ( | QObject * | parent = nullptr | ) |
The expanded, editable object tree. QML traverses in from here.
Create a blank save file and a blank expanded save file.
Definition at line 27 of file savefile.cpp.
References data, dataExpanded, resetData(), SAV_DATA_SIZE, and toolset.
|
virtual |
Definition at line 45 of file savefile.cpp.
References data, dataExpanded, and toolset.
|
protected |
SAV file has changed but the old expansion has not been replaced with exxpansion of new data.
References eraseExpansion(), expandData(), flattenData(), randomizeExpansion(), and resetData().
Referenced by ItemMarketModel::ItemMarketModel(), resetData(), setData(), and Settings::Settings().
| void SaveFile::eraseExpansion | ( | ) |
Erase expansion data, this makes expansion data act like a new file but save file contents are preserved.
Definition at line 99 of file savefile.cpp.
References dataExpanded.
Referenced by dataExpandedChanged().
| void SaveFile::expandData | ( | ) |
Replace expansion with new expansion of current sav file.
Definition at line 94 of file savefile.cpp.
References dataExpanded.
Referenced by dataExpandedChanged(), resetData(), and setData().
| void SaveFile::flattenData | ( | ) |
Flatten expansion back to the save file, overwriting it's current contents with only data that's strictly nesesary.
A critical rule.
Definition at line 89 of file savefile.cpp.
References dataExpanded.
Referenced by dataExpandedChanged().
| SaveFileIterator * SaveFile::iterator | ( | ) |
Returns a unique iterator that's setup to iterate over the raw sav file data.
Heavily used by the file expansion to iterate and expand or flatten data.
Definition at line 53 of file savefile.cpp.
Referenced by SpriteData::checkMissable(), AreaPokemon::load(), ItemStorageBox::load(), MapConnData::load(), PlayerBasics::load(), PokemonBox::load(), SignData::load(), WarpData::load(), WorldOther::load(), WorldScripts::load(), SpriteData::loadSpriteData1(), SpriteData::loadSpriteData2(), SpriteData::loadSpriteDataNPC(), AreaPokemon::save(), ItemStorageBox::save(), MapConnData::save(), PokemonBox::save(), SignData::save(), WarpData::save(), WorldOther::save(), WorldScripts::save(), SpriteData::saveMissables(), SpriteData::saveSpriteData1(), SpriteData::saveSpriteData2(), SpriteData::saveSpriteDataNPC(), and PlayerBasics::setBadges().
| void SaveFile::randomizeExpansion | ( | ) |
Fully randomizes the expansion data, doesn't change save file data.
This tries to give fun and playable randomization. Due to the complexity of Gen 1 Games there are limits on randomization. The idea is to randomize everything we can and still allow you to jump in and play right away with Your Psychic Traded Pikachu named Bob that uses Ice Beam and Splash.
Definition at line 104 of file savefile.cpp.
References dataExpanded.
Referenced by dataExpandedChanged(), and pse::shortcutActions().
| void SaveFile::resetData | ( | bool | silent = false | ) |
Empty this save file to zero's.
Re-Expand the empty save file, overwriting prior expansion, unless marked silent.
Definition at line 58 of file savefile.cpp.
References data, dataExpanded, dataExpandedChanged(), expandData(), and SAV_DATA_SIZE.
Referenced by dataExpandedChanged(), and SaveFile().
| void SaveFile::setData | ( | var8 * | data, |
| bool | silent = false ) |
Change-out the save file.
Re-Expand the new save file, overwriting prior expansion, unless marked silent.
| data | New raw save bytes to adopt. |
| silent | When true, skip re-expanding the new data. |
Definition at line 69 of file savefile.cpp.
References data, dataExpanded, dataExpandedChanged(), expandData(), and SAV_DATA_SIZE.
|
protected |
Definition at line 75 of file savefile.h.
| var8* SaveFile::data = nullptr |
Actual SAV Data, a raw internal binary copy of the file.
Definition at line 111 of file savefile.h.
Referenced by resetData(), SaveFile(), setData(), and ~SaveFile().
| SaveFileExpanded* SaveFile::dataExpanded = nullptr |
Expanded SAV data to be readable and more usable.
Definition at line 114 of file savefile.h.
Referenced by eraseExpansion(), expandData(), flattenData(), randomizeExpansion(), resetData(), SaveFile(), setData(), and ~SaveFile().
| SaveFileToolset* SaveFile::toolset = nullptr |
Tools to operate directly on the raw sav file data.
Definition at line 117 of file savefile.h.
Referenced by AreaAudio::load(), AreaGeneral::load(), AreaLoadedSprites::load(), AreaMap::load(), AreaNPC::load(), AreaPlayer::load(), AreaPokemon::load(), AreaSign::load(), AreaSprites::load(), AreaTileset::load(), AreaWarps::load(), Daycare::load(), HallOfFame::load(), HoFPokemon::load(), HoFRecord::load(), ItemStorageBox::load(), PlayerBasics::load(), PlayerPokemon::load(), PokemonBox::load(), PokemonStorageBox::load(), Rival::load(), Storage::load(), WorldCompleted::load(), WorldEvents::load(), WorldGeneral::load(), WorldHidden::load(), WorldLocal::load(), WorldMissables::load(), WorldOther::load(), WorldTowns::load(), WorldTrades::load(), PlayerPokedex::loadPokedex(), AreaAudio::save(), AreaGeneral::save(), AreaLoadedSprites::save(), AreaMap::save(), AreaNPC::save(), AreaPlayer::save(), AreaPokemon::save(), AreaSign::save(), AreaSprites::save(), AreaTileset::save(), AreaWarps::save(), Daycare::save(), HallOfFame::save(), HoFPokemon::save(), HoFRecord::save(), PlayerBasics::save(), PlayerPokemon::save(), PokemonBox::save(), PokemonStorageBox::save(), Rival::save(), Storage::save(), WorldCompleted::save(), WorldEvents::save(), WorldGeneral::save(), WorldHidden::save(), WorldLocal::save(), WorldMissables::save(), WorldOther::save(), WorldTowns::save(), WorldTrades::save(), SaveFile(), PlayerPokedex::savePokedex(), and ~SaveFile().