Sanity checks

* Added sanity checks for orphaned scripts
* Adjusted required Renpy version check
* Adjusted initialization priority for sanity checks
This commit is contained in:
LoafyLemon 2022-11-26 18:40:01 +00:00
parent d74daee216
commit 4765e14aa7
1 changed files with 20 additions and 3 deletions

View File

@ -1,6 +1,6 @@
init python early:
if renpy.version_tuple < (7,5,0,22061501):
raise RuntimeWarning("Your Ren'Py launcher is outdated, the current minimal requirement is 7.5.0.22061501+\nPlease perform an update and try launching the game again.")
init -1000 python early:
if renpy.version_tuple < (7,5,3,22090809):
raise RuntimeWarning("Your Ren'Py launcher is outdated, the current minimal requirement is 7.5.3.22090809+\nPlease perform an update and try launching the game again.")
from renpy.uguu import glGetString, GL_VENDOR, GL_RENDERER, GL_VERSION
@ -14,6 +14,23 @@ init python early:
def get_renderer():
return "DirectX" if preferences.renderer == "angle2" else "OpenGL"
def detect_orphaned_rpyc_files():
excluded = ["tl/"]
files = renpy.list_files(common=True)
compiled = [x for x in files if x.endswith(".rpyc") if not any(x.startswith(i) for i in excluded)]
scripts = [x for x in files if x.endswith(".rpy")]
orphaned = []
for i in compiled:
if not i[:-1] in scripts:
orphaned.append(i)
if orphaned:
raise Exception("Orphaned compiled scripts detected, please delete them before continuing:\n{}".format(orphaned))
detect_orphaned_rpyc_files()
init python:
config.missing_image_callback = missing_image_func