83 val =
state.takeLast();
void setBit(var8 size, var8 bit, bool value, bool reverse=false)
Set a bit at the cursor.
var16 getWord(var16 padding=0, bool reverse=false)
Read a 16-bit word at the cursor; advances.
void setHex(var16 size, QString hex, var16 padding=0, bool reverse=false)
Write hex at the cursor; advances.
var16 offset
Current offset in the save file. Can be freely changed directly.
SaveFileToolset * toolset()
Get the underlying address-based toolset.
void setBCD(var8 size, var32 val, var16 padding=0)
Write a BCD number at the cursor; advances.
SaveFileIterator * push()
Bookmark the current offset (push) ...
SaveFile * saveFile
The save file this cursor walks.
QVector< var8 > getRange(var16 size, var16 padding=0, bool reverse=false)
Copies a range of bytes to a buffer of size and returns them. Reads at the cursor,...
SaveFileIterator(SaveFile *saveFile)
SaveFileIterator * offsetBy(var16 val)
Move the cursor by a relative amount. Returns this for chaining.
void setStr(var16 size, var8 maxLen, QString str, var16 padding=0)
Write a font-encoded string at the cursor; advances.
QString getStr(var16 size, var8 maxLen, var16 padding=0)
Read a font-encoded string at the cursor; advances.
SaveFileIterator * pop()
... and return to the most recent bookmark (pop). Works like a FIFO stack.
QString getHex(var16 size, var16 padding=0, bool reverse=false)
Read hex at the cursor; advances.
void setBitField(var16 size, QVector< bool > src, var16 padding=0)
Write a bitfield at the cursor; advances.
QVector< bool > getBitField(var16 size, var16 padding=0)
Read a bitfield at the cursor; advances.
SaveFileIterator * skipPadding(var16 val)
Alias for code cleanliness (advance past padding).
SaveFile * file()
Get reference back to the save file.
bool getBit(var8 size, var8 bit, bool reverse=false)
Test a bit at the cursor.
QVector< var16 > state
Bookmark stack – saves places in the save file to go back to (push/pop).
SaveFileIterator * inc()
Increment the offset by one byte. Returns this.
void setByte(var8 val, var16 padding=0)
Write a byte at the cursor; advances.
var32 getBCD(var8 size, var16 padding=0)
Read a BCD number at the cursor; advances.
SaveFileIterator * dec()
Decrement the offset by one byte. Returns this.
void setWord(var16 val, var16 padding=0, bool reverse=false)
Write a 16-bit word at the cursor; advances.
void copyRange(var16 size, QVector< var8 > data, var16 padding=0, bool reverse=false)
Writes at the cursor, then advances by size + padding.
SaveFileIterator * offsetTo(var16 val)
Move the cursor to an absolute offset. Returns this for chaining.
var8 getByte(var16 padding=0)
Read a byte at the cursor; advances.
One loaded save: the raw 32 KB bytes, their expanded object tree, and the tools that move between the...
var8e var8
Everyday 8-bit alias. Exact (not "fastest") to dodge the pointer-width bug noted above.
var16e var16
Everyday 16-bit alias. Exact width to avoid the "fastest" widening bug.
var32e var32
Everyday 32-bit alias. Exact width to avoid the "fastest" widening bug.