new savegame loading wip

This commit is contained in:
minjaesong
2023-06-24 23:44:48 +09:00
parent 592e489411
commit 3d13941060
10 changed files with 527 additions and 42 deletions

View File

@@ -50,13 +50,13 @@ removefile:
fun checkFileSanity() {
if (!diskFile.exists()) throw NoSuchFileException(diskFile.absoluteFile)
if (diskFile.length() < 310L) throw RuntimeException("Invalid Virtual Disk file!")
if (diskFile.length() < 310L) throw RuntimeException("Invalid Virtual Disk file: ${diskFile.path}")
// check magic
val fis = FileInputStream(diskFile)
val magic = ByteArray(4).let { fis.read(it); it }
if (!magic.contentEquals(VirtualDisk.MAGIC)) throw RuntimeException("Invalid Virtual Disk file!")
if (!magic.contentEquals(VirtualDisk.MAGIC)) throw RuntimeException("Invalid Virtual Disk file: ${diskFile.path}")
fis.close()
}