mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-10 22:01:52 +09:00
modification date now writes successfully
This commit is contained in:
@@ -167,13 +167,11 @@ object Terrarum : Disposable {
|
||||
|
||||
val RENDER_FPS = getConfigInt("displayfps")
|
||||
val USE_VSYNC = getConfigBoolean("usevsync")
|
||||
var VSYNC = USE_VSYNC
|
||||
val VSYNC_TRIGGER_THRESHOLD = 56
|
||||
val GL_VERSION: Int
|
||||
get() = Gdx.graphics.glVersion.majorVersion * 100 +
|
||||
Gdx.graphics.glVersion.minorVersion * 10 +
|
||||
Gdx.graphics.glVersion.releaseVersion
|
||||
val MINIMAL_GL_VERSION = 210
|
||||
/*val GL_MAX_TEXTURE_SIZE: Int
|
||||
get() {
|
||||
val intBuffer = BufferUtils.createIntBuffer(16) // size must be at least 16, or else LWJGL complains
|
||||
@@ -695,7 +693,6 @@ fun AppUpdateListOfSavegames() {
|
||||
println("${index+1}.\t${it.diskFile.absolutePath}")
|
||||
it.rebuild() // disk skimmer was created without initialisation, so do it now
|
||||
|
||||
// TODO write simple and dumb SAX parser for JSON
|
||||
val jsonFile = it.getFile(-1L)!!
|
||||
val json = JsonReader().parse(ByteArray64Reader(jsonFile.bytes, Common.CHARSET).readText())
|
||||
val worldUUID = UUID.fromString(json.getString("worldIndex"))
|
||||
@@ -722,7 +719,6 @@ fun AppUpdateListOfSavegames() {
|
||||
println("${index+1}.\t${it.diskFile.absolutePath}")
|
||||
it.rebuild() // disk skimmer was created without initialisation, so do it now
|
||||
|
||||
// TODO write simple and dumb SAX parser for JSON
|
||||
val jsonFile = it.getFile(-1L)!!
|
||||
val json = JsonReader().parse(ByteArray64Reader(jsonFile.bytes, Common.CHARSET).readText())
|
||||
val playerUUID = UUID.fromString(json.getString("uuid"))
|
||||
|
||||
@@ -7,8 +7,7 @@ import org.lwjgl.opengl.GL11
|
||||
class TerrarumGLinfo {
|
||||
private var _initialised = false
|
||||
|
||||
// some JVMs don't have this property, but they probably don't have "sun.misc.Unsafe" either, so it's no big issue \_(ツ)_/
|
||||
val MINIMAL_GL_VERSION = 320
|
||||
val MINIMAL_GL_VERSION = 430
|
||||
|
||||
var GL_VERSION = -1; private set
|
||||
get() = if (_initialised) field else throw UninitializedPropertyAccessException()
|
||||
@@ -31,7 +30,7 @@ class TerrarumGLinfo {
|
||||
|
||||
if (GL_VERSION < MINIMAL_GL_VERSION) {
|
||||
// TODO notify properly
|
||||
throw GdxRuntimeException("Graphics device not capable -- device's GL_VERSION: $GL_VERSION, required: $MINIMAL_GL_VERSION")
|
||||
throw GdxRuntimeException("Graphics device not capable -- device's GL_VERSION: $GL_VERSION, required version: $MINIMAL_GL_VERSION")
|
||||
}
|
||||
|
||||
GL_MAX_TEXTURE_SIZE = GL11.glGetInteger(GL11.GL_MAX_TEXTURE_SIZE)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package net.torvald.terrarum.savegame
|
||||
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.serialise.Common
|
||||
import java.io.IOException
|
||||
import java.nio.charset.Charset
|
||||
import java.util.*
|
||||
@@ -152,6 +154,9 @@ class VirtualDisk(
|
||||
// make sure to write root directory first
|
||||
entries[0L]!!.let { rootDir ->
|
||||
rootDir.serialize().forEach { buffer.add(it) }
|
||||
|
||||
printdbg(this, "Writing disk ${getDiskName(Common.CHARSET)}")
|
||||
printdbg(this, "Root creation: ${rootDir.creationDate}, modified: ${rootDir.modificationDate}")
|
||||
}
|
||||
entries.forEach {
|
||||
if (it.key != 0L) {
|
||||
|
||||
@@ -136,7 +136,6 @@ class WorldSavingThread(
|
||||
|
||||
Echo("Writing file to disk...")
|
||||
|
||||
disk.entries[0]!!.creationDate = creation_t
|
||||
disk.entries[0]!!.modificationDate = time_t
|
||||
// entry zero MUST NOT be used to get lastPlayDate, but we'll update it anyway
|
||||
// use entry -1 for that purpose!
|
||||
@@ -180,6 +179,7 @@ class PlayerSavingThread(
|
||||
|
||||
Echo("Writing The Player...")
|
||||
WritePlayer(ingame.actorGamer, disk, ingame, time_t)
|
||||
disk.entries[0]!!.modificationDate = time_t
|
||||
VDUtil.dumpToRealMachine(disk, outFile)
|
||||
|
||||
callback()
|
||||
|
||||
Reference in New Issue
Block a user