Save Compatibility
* Added a workaround for call stack issues on old saves * Rebuilt whitespace * Removed redundant load_fix functions
This commit is contained in:
parent
10e99cbc05
commit
b2fc769e69
File diff suppressed because it is too large
Load Diff
@ -1,51 +0,0 @@
|
|||||||
|
|
||||||
# Must be appended AFTER update_patcher
|
|
||||||
init 2 python:
|
|
||||||
config.load_failed_label = "load_failed"
|
|
||||||
#config.after_load_callbacks.append(load_fix)
|
|
||||||
|
|
||||||
# load_fix function breaks saves compatiblity in Ren'py 7.4.9 onward,
|
|
||||||
# in fact, Ren'py will clear its own callstack and find correct label to jump to.
|
|
||||||
|
|
||||||
# init -1 python:
|
|
||||||
# def load_fix():
|
|
||||||
# # Scan the call stack for missing labels
|
|
||||||
# # If a label is missing, assume a fatal error will occur eventually
|
|
||||||
# # Then wipe the stack and jump to config.load_failed_label to prevent the error
|
|
||||||
|
|
||||||
# context = renpy.game.context()
|
|
||||||
# script = renpy.game.script
|
|
||||||
# for i in xrange(-1, -len(context.return_stack)-1, -1):
|
|
||||||
# node = None
|
|
||||||
|
|
||||||
# if script.has_label(context.return_stack[i]):
|
|
||||||
# node = script.lookup(context.return_stack[i])
|
|
||||||
# elif script.has_label(context.call_location_stack[i]):
|
|
||||||
# node = script.lookup(context.call_location_stack[i]).next
|
|
||||||
|
|
||||||
# if node is None:
|
|
||||||
# # Clean up similar to RollbackLog.load_failed
|
|
||||||
# while renpy.exports.call_stack_depth():
|
|
||||||
# renpy.exports.pop_call()
|
|
||||||
|
|
||||||
# renpy.game.contexts[0].force_checkpoint = True
|
|
||||||
# renpy.game.contexts[0].goto_label(renpy.config.load_failed_label)
|
|
||||||
|
|
||||||
# raise renpy.game.RestartTopContext()
|
|
||||||
# return
|
|
||||||
|
|
||||||
label load_failed:
|
|
||||||
python:
|
|
||||||
# Clear all screens and stop all sound
|
|
||||||
renpy.scene("screens")
|
|
||||||
for c in ["music", "bg_sounds", "weather"]:
|
|
||||||
renpy.music.stop(c, 0.5)
|
|
||||||
active_girl = None
|
|
||||||
|
|
||||||
$ renpy.block_rollback() # Prevent rollback to broken past
|
|
||||||
show screen blktone
|
|
||||||
"Something went wrong while loading your save, but all is not lost! You will be back in the office with the same progress as when you saved the game. However, you can't rollback to a time before that moment."
|
|
||||||
hide screen blktone
|
|
||||||
with d5
|
|
||||||
$ renpy.block_rollback() # Prevent rollback to this message
|
|
||||||
jump main_room
|
|
@ -53,6 +53,16 @@ init python:
|
|||||||
def __call__(self):
|
def __call__(self):
|
||||||
renpy.invoke_in_new_context(updater.update, self.url, simulate=self.simulate, **self.kwargs)
|
renpy.invoke_in_new_context(updater.update, self.url, simulate=self.simulate, **self.kwargs)
|
||||||
|
|
||||||
|
def fix_return_stack():
|
||||||
|
for layer in config.layers:
|
||||||
|
renpy.scene(layer)
|
||||||
|
|
||||||
|
for channel in renpy.audio.audio.channels.keys():
|
||||||
|
if isinstance(channel, str) and not channel.startswith("_"):
|
||||||
|
renpy.music.stop(channel)
|
||||||
|
|
||||||
|
renpy.set_return_stack(("main_room",))
|
||||||
|
|
||||||
def version_float():
|
def version_float():
|
||||||
control, major, minor = config.version.split(" ")[0].split(".")
|
control, major, minor = config.version.split(" ")[0].split(".")
|
||||||
return float("{}.{}{}".format(control, major, minor))
|
return float("{}.{}{}".format(control, major, minor))
|
||||||
@ -113,6 +123,8 @@ init python:
|
|||||||
|
|
||||||
char.rebuild()
|
char.rebuild()
|
||||||
|
|
||||||
|
fix_return_stack()
|
||||||
|
|
||||||
if current > latest:
|
if current > latest:
|
||||||
raise Exception("Loaded save file is incompatible. (Save Version: {}, Game Version: {})".format(current, latest))
|
raise Exception("Loaded save file is incompatible. (Save Version: {}, Game Version: {})".format(current, latest))
|
||||||
|
|
||||||
@ -123,6 +135,7 @@ init python:
|
|||||||
achievements.attempt_repair()
|
achievements.attempt_repair()
|
||||||
|
|
||||||
renpy.call_in_new_context("modal_popup", "Update Successful", "\nYour save file has been successfully updated to version {{b}}{}{{/b}}.\n\n{}".format(config.version, message), None, "Hurray!")
|
renpy.call_in_new_context("modal_popup", "Update Successful", "\nYour save file has been successfully updated to version {{b}}{}{{/b}}.\n\n{}".format(config.version, message), None, "Hurray!")
|
||||||
|
|
||||||
renpy.block_rollback()
|
renpy.block_rollback()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user