Bug fixes

* Fixed generic update image creator
* Fixed new side image type regression
* Fixed MyMod game version inside manifest
* Fixed MyMod missing from release
* Fixed android mods detection
* Removed android searchpaths (superseded)
* Moved engine related changes into its own file
This commit is contained in:
LoafyLemon 2022-06-27 22:31:51 +01:00
parent bf5710bf10
commit 102d23d47f
8 changed files with 70 additions and 57 deletions

View File

@ -3,5 +3,5 @@
"Author": "LoafyLemon",
"Version": "1.0.0",
"Description": "Adds ponytail hairstyle for Hermione",
"GameVer": "1.40"
"GameVer": "1.43"
}

View File

@ -8,7 +8,7 @@ init python:
return 0
layeredimage genie:
anchor (0, 1.0)
anchor (0.0, 1.0)
group hair:
attribute nude "characters/genie/hair.webp"

View File

@ -31,6 +31,8 @@ screen say(who, what, side_image=None, icon=None):
if side_image:
add side_image yalign 1.0 yanchor 1.0 zoom 0.5
else:
add SideImage()
window id "window":
style gui.theme("say_window")

View File

@ -13,13 +13,6 @@ init python:
global mods_list
all_files = renpy.list_files()
if renpy.android:
# Include files outside the application archive and strip the directory path.
# Normally it wouldn't be necessary but `renpy.list_files` does not list files outside archives on android.
for dir in config.searchpath:
all_files.extend([os.path.join(path.replace(dir, ""), name) for path, _, files in os.walk(dir) for name in files])
mods = filter(lambda x: x.endswith(".json"), all_files)
for i, manifest in enumerate(mods):

View File

@ -25,7 +25,6 @@ init python:
# https://www.renpy.org/doc/html/config.html
# Pre-Release related flags and variables
define config.searchpath = [os.environ["ANDROID_PUBLIC"]] if renpy.android else [config.gamedir, config.commondir]
define config.autoreload = False
define config.developer = "auto"
define config.console = True
@ -152,6 +151,7 @@ init python:
build.classify("icon.ico", "windows")
build.classify("game/presplash_*.png", "renpy")
build.classify("game/outfits/**", "all")
build.classify("game/mods/MyMod/**", "all")
build.classify("**.py", None)
build.classify("**.txt", None)
@ -169,4 +169,5 @@ init python:
build.classify("cache/**", None)
build.classify("game/saves/**", None)
build.classify("game/mods/**", None)

View File

@ -1,48 +1,3 @@
init python:
if renpy.android:
class Android11TextureLeakFix(NoRollback):
def __init__(self, limit=100):
self.statements = 0
self.limit = limit
def __call__(self, name):
if renpy.is_init_phase():
return
self.statements += 1
if self.statements > self.limit:
self.statements = 0
# Big thanks to Andykl (https://github.com/Andykl)
# for finding the issue and inventing this workaround.
# https://github.com/renpy/renpy/issues/3643
cache = renpy.display.im.cache
cache_size = cache.get_total_size()
cache_limit = cache.cache_limit * 0.95
if cache_size >= cache_limit:
if config.developer:
print("Cache limit reached, purging cache... ({}/{})\n{}".format(cache_size, cache_limit, renpy.get_filename_line()))
cache.clear()
if renpy.game.interface is not None:
if config.developer:
print("Statements limit reached, cleaning textures... ({})\n{}".format(self.limit, renpy.get_filename_line()))
renpy.game.interface.full_redraw = True
renpy.game.interface.restart_interaction = True
if renpy.display.draw is not None:
renpy.display.draw.kill_textures()
renpy.display.render.free_memory()
config.statement_callbacks.append(Android11TextureLeakFix())
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.")

View File

@ -0,0 +1,62 @@
init -10 python:
if renpy.android:
# Attempts at fixing the texture leak plaguing
# android devices, mainly running on Android11 & Android 12.
class Android11TextureLeakFix(NoRollback):
def __init__(self, limit=100):
self.statements = 0
self.limit = limit
def __call__(self, name):
if renpy.is_init_phase():
return
self.statements += 1
if self.statements > self.limit:
self.statements = 0
# Big thanks to Andykl (https://github.com/Andykl)
# for finding the issue and inventing this workaround.
# https://github.com/renpy/renpy/issues/3643
cache = renpy.display.im.cache
cache_size = cache.get_total_size()
cache_limit = cache.cache_limit * 0.95
if cache_size >= cache_limit:
if config.developer:
print("Cache limit reached, purging cache... ({}/{})\n{}".format(cache_size, cache_limit, renpy.get_filename_line()))
cache.clear()
if renpy.game.interface is not None:
if config.developer:
print("Statements limit reached, cleaning textures... ({})\n{}".format(self.limit, renpy.get_filename_line()))
renpy.game.interface.full_redraw = True
renpy.game.interface.restart_interaction = True
if renpy.display.draw is not None:
renpy.display.draw.kill_textures()
renpy.display.render.free_memory()
config.statement_callbacks.append(Android11TextureLeakFix())
if renpy.windows:
# On windows, Renpy does not support backslashes in some of its functions,
# but because the code needs to be platform-independent,
# we require to monkey patch those functions in order
# to remain compatible with all platforms without losing functionality.
_renpy_loadable = renpy.loadable
@renpy.pure
def _loadable(filename):
filename = filename.replace("\\", "/")
return _renpy_loadable(filename)
renpy.loadable = _loadable

View File

@ -82,7 +82,7 @@ init python:
def version_logo():
url = UPDATE_URL
filename = "logo_{}.webp".format(UPDATE_VER)
path = os.path.join(config.basedir, "update/{}".format(filename))
path = os.path.join(config.basedir, "update", filename)
# Read file if exists
if os.path.isfile(path):
@ -103,7 +103,7 @@ init python:
return im.Data(data, path)
except:
path = os.path.join(config.basedir, "update/generic.webp")
path = os.path.join(config.basedir, "update", "generic.webp")
with open(path, "rb") as f:
data = f.read()