Save Compatibility

* Added edge case handling for missing label, and point of no return in case of a save file update.
* Refactoring
This commit is contained in:
LoafyLemon 2024-01-22 21:33:01 +00:00
parent 9c41933179
commit edaec46c86
2 changed files with 17 additions and 6 deletions

View File

@ -141,19 +141,27 @@ label missing_label():
$ renpy.choice_for_skipping()
$ err_msg1 = systemerror[0]
$ err_msg2 = systemerror[1]
"{color=#7a0000}System{/color}" "Uh-oh. Looks like you've encountered a bug. Don't worry, we will try to return you back to the office after displaying the error message, your save file won't be affected."
"{color=#7a0000}System{/color}" "{color=#7a0000}Error:{/color} [err_msg1] '{color=#7a0000}[err_msg2]{/color}'\n\n\n{size=-4}You can report this bug on our {a=https://discord.gg/7PD57yt}discord{/a}.{/size}"
if not _savecompat:
# Suppress debug on save update, it's normal.
"{color=#7a0000}System{/color}" "Uh-oh. Looks like you've encountered a bug. Don't worry, we will try to return you back to the office after displaying the error message, your save file won't be affected."
"{color=#7a0000}System{/color}" "{color=#7a0000}Error:{/color} [err_msg1] '{color=#7a0000}[err_msg2]{/color}'\n\n\n{size=-4}You can report this bug on our {a=https://discord.gg/7PD57yt}discord{/a}.{/size}"
$ states.last_girl = None
$ states.active_girl = None
$ systemerror = [None, None]
$ _savecompat = False
jump main_room
label missing_return():
$ renpy.choice_for_skipping()
"{color=#7a0000}System{/color}" "Uh-oh. Looks like you've encountered a bug. Don't worry, we will try to return you back to the office after displaying the error message, your save file won't be affected."
"{color=#7a0000}System{/color}" "{color=#7a0000}Error:{/color} Point of no return.\n\n\n{size=-4}You can report this bug on our {a=https://discord.gg/7PD57yt}discord{/a}.{/size}"
if not _savecompat:
# Suppress debug on save update, it's normal.
"{color=#7a0000}System{/color}" "Uh-oh. Looks like you've encountered a bug. Don't worry, we will try to return you back to the office after displaying the error message, your save file won't be affected."
"{color=#7a0000}System{/color}" "{color=#7a0000}Error:{/color} Point of no return.\n\n\n{size=-4}You can report this bug on our {a=https://discord.gg/7PD57yt}discord{/a}.{/size}"
$ states.last_girl = None
$ states.active_girl = None
$ _savecompat = False
jump main_room
screen placeholder():

View File

@ -94,6 +94,8 @@ init python:
control, major, *minor = version.split(" ")[0].split(".")
return float("{}.{}{}".format(control, major, "".join(minor)))
_savecompat = False
def version_patch():
if renpy.is_init_phase():
# Don't update save files from when game recovers from a crash.
@ -101,7 +103,7 @@ init python:
latest = version_float()
# For unknown reasons, sometimes version is missing from the save, so we need a fallback
current = getattr(renpy.store, "version", latest)
current = getattr(store, "version", latest)
if current < 1.452:
@ -186,7 +188,8 @@ init python:
raise Exception("Loaded save file is incompatible. (Save Version: {}, Game Version: {})".format(current, latest))
if current < latest:
setattr(renpy.store, "version", latest)
setattr(store, "version", latest)
setattr(store, "_savecompat", True)
message = "Have fun!"
achievements.attempt_repair()