mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[storage] New attempt to save cursor position
This commit is contained in:
@@ -65,6 +65,21 @@ bool Script::nameCompliant(const char * name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint16_t Script::cursorOffset() {
|
||||
assert(!isNull());
|
||||
Ion::Storage::Metadata metadata = Ion::Storage::sharedStorage()->metadataForRecord(*this);
|
||||
if (metadata.buffer != nullptr) {
|
||||
assert(metadata.size == 2);
|
||||
return *((uint16_t*) metadata.buffer);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
void Script::setCursorOffset(uint16_t position) {
|
||||
assert(!isNull());
|
||||
Ion::Storage::sharedStorage()->setMetadataForRecord(*this, { &position, sizeof(uint16_t) });
|
||||
}
|
||||
|
||||
uint8_t * StatusFromData(Script::Data d) {
|
||||
return const_cast<uint8_t *>(static_cast<const uint8_t *>(d.buffer));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user