mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 11:34:05 +09:00
initial save from newgame is now marked as autosave
This commit is contained in:
@@ -322,7 +322,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// make initial savefile
|
// make initial savefile
|
||||||
WriteSavegame.immediate(savegameArchive, getSaveFileMain(), this) {
|
WriteSavegame.immediate(savegameArchive, getSaveFileMain(), this, true) {
|
||||||
makeSavegameBackupCopy() // don't put it on the postInit() or render(); must be called using callback
|
makeSavegameBackupCopy() // don't put it on the postInit() or render(); must be called using callback
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ object Save : ConsoleCommand {
|
|||||||
val disk = VDUtil.createNewDisk(1L shl 60, savename, Common.CHARSET)
|
val disk = VDUtil.createNewDisk(1L shl 60, savename, Common.CHARSET)
|
||||||
val file = File(App.defaultSaveDir + "/${args[1]}")
|
val file = File(App.defaultSaveDir + "/${args[1]}")
|
||||||
|
|
||||||
WriteSavegame(disk, file, ingame)
|
WriteSavegame(disk, file, ingame, false)
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (e: IOException) {
|
catch (e: IOException) {
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
|
|||||||
INGAME.makeSavegameBackupCopy()
|
INGAME.makeSavegameBackupCopy()
|
||||||
|
|
||||||
// save the game
|
// save the game
|
||||||
WriteSavegame(INGAME.savegameArchive, File(App.defaultSaveDir, INGAME.savegameNickname), Terrarum.ingame!! as TerrarumIngame) {
|
WriteSavegame(INGAME.savegameArchive, File(App.defaultSaveDir, INGAME.savegameNickname), Terrarum.ingame!! as TerrarumIngame, false) {
|
||||||
// callback:
|
// callback:
|
||||||
System.gc()
|
System.gc()
|
||||||
screen = 0
|
screen = 0
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import java.util.zip.GZIPOutputStream
|
|||||||
/**
|
/**
|
||||||
* Created by minjaesong on 2021-09-14.
|
* Created by minjaesong on 2021-09-14.
|
||||||
*/
|
*/
|
||||||
class GameSavingThread(val disk: VirtualDisk, val outFile: File, val ingame: TerrarumIngame, val hasThumbnail: Boolean, val callback: () -> Unit) : Runnable {
|
class GameSavingThread(val disk: VirtualDisk, val outFile: File, val ingame: TerrarumIngame, val hasThumbnail: Boolean, val isAuto: Boolean, val callback: () -> Unit) : Runnable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will happily overwrite existing entry
|
* Will happily overwrite existing entry
|
||||||
@@ -29,7 +29,7 @@ class GameSavingThread(val disk: VirtualDisk, val outFile: File, val ingame: Ter
|
|||||||
private val actorProgressMultiplier = 1f
|
private val actorProgressMultiplier = 1f
|
||||||
|
|
||||||
override fun run() {
|
override fun run() {
|
||||||
disk.saveMode = 0 // no quick, no auto
|
disk.saveMode = 2 * isAuto.toInt() // no quick
|
||||||
|
|
||||||
if (hasThumbnail) {
|
if (hasThumbnail) {
|
||||||
while (!IngameRenderer.fboRGBexportedLatch) {
|
while (!IngameRenderer.fboRGBexportedLatch) {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ object WriteSavegame {
|
|||||||
@Volatile var saveProgress = 0f
|
@Volatile var saveProgress = 0f
|
||||||
@Volatile var saveProgressMax = 1f
|
@Volatile var saveProgressMax = 1f
|
||||||
|
|
||||||
operator fun invoke(disk: VirtualDisk, outFile: File, ingame: TerrarumIngame, callback: () -> Unit = {}) {
|
operator fun invoke(disk: VirtualDisk, outFile: File, ingame: TerrarumIngame, isAuto: Boolean, callback: () -> Unit = {}) {
|
||||||
savingStatus = 0
|
savingStatus = 0
|
||||||
|
|
||||||
Echo("Save queued")
|
Echo("Save queued")
|
||||||
@@ -48,7 +48,7 @@ object WriteSavegame {
|
|||||||
}
|
}
|
||||||
IngameRenderer.fboRGBexportRequested = true
|
IngameRenderer.fboRGBexportRequested = true
|
||||||
|
|
||||||
val savingThread = Thread(GameSavingThread(disk, outFile, ingame, true, callback), "TerrarumBasegameGameSaveThread")
|
val savingThread = Thread(GameSavingThread(disk, outFile, ingame, true, isAuto, callback), "TerrarumBasegameGameSaveThread")
|
||||||
savingThread.start()
|
savingThread.start()
|
||||||
|
|
||||||
// it is caller's job to keep the game paused or keep a "save in progress" ui up
|
// it is caller's job to keep the game paused or keep a "save in progress" ui up
|
||||||
@@ -56,12 +56,12 @@ object WriteSavegame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun immediate(disk: VirtualDisk, outFile: File, ingame: TerrarumIngame, callback: () -> Unit = {}) {
|
fun immediate(disk: VirtualDisk, outFile: File, ingame: TerrarumIngame, isAuto: Boolean, callback: () -> Unit = {}) {
|
||||||
savingStatus = 0
|
savingStatus = 0
|
||||||
|
|
||||||
Echo("Immediate save fired")
|
Echo("Immediate save fired")
|
||||||
|
|
||||||
val savingThread = Thread(GameSavingThread(disk, outFile, ingame, false, callback), "TerrarumBasegameGameSaveThread")
|
val savingThread = Thread(GameSavingThread(disk, outFile, ingame, false, isAuto, callback), "TerrarumBasegameGameSaveThread")
|
||||||
savingThread.start()
|
savingThread.start()
|
||||||
|
|
||||||
// it is caller's job to keep the game paused or keep a "save in progress" ui up
|
// it is caller's job to keep the game paused or keep a "save in progress" ui up
|
||||||
|
|||||||
Reference in New Issue
Block a user