writing savemode to the savegame binary

This commit is contained in:
minjaesong
2021-09-29 17:34:26 +09:00
parent 60a8382f93
commit 7ddde8e4f0
7 changed files with 24 additions and 9 deletions

View File

@@ -301,6 +301,11 @@ removefile:
}
}
fun setSaveMode(bits: Int) {
fa.seek(49L)
fa.writeByte(bits)
}
///////////////////////////////////////////////////////
// THESE ARE METHODS TO SUPPORT ON-LINE MODIFICATION //
///////////////////////////////////////////////////////

View File

@@ -64,7 +64,10 @@ Version 254 is a customised version of TEVD tailored to be used as a savegame fo
Int8 0xFE
Int8 Disk properties flag 1
0th bit: readonly
Int8[15] Extra info bytes
Int8 Save type
0th bit: unset - full save; set - quick save
1st bit: set - generated by autosave
Int8[14] Extra info bytes
Unit8[236] Rest of the long disk name (268 bytes total)
(Header size: 300 bytes)
@@ -127,6 +130,9 @@ class VirtualDisk(
var isReadOnly: Boolean
set(value) { extraInfoBytes[0] = (extraInfoBytes[0] and 0xFE.toByte()) or value.toBit() }
get() = capacity == 0L || (extraInfoBytes.size > 0 && extraInfoBytes[0].and(1) == 1.toByte())
var saveMode: Int
set(value) { extraInfoBytes[1] = value.toByte() }
get() = extraInfoBytes[1].toUint()
fun getDiskNameString(charset: Charset) = diskName.toCanonicalString(charset)
val root: DiskEntry
get() = entries[0]!!