Bug fixes
* Fixed animation list for dolls * Attempt at fixing Android 11 Texture Leak
This commit is contained in:
parent
ba31e0cbdb
commit
e1766d767e
@ -50,10 +50,15 @@ init python:
|
||||
base_transform = doll_transform(self.pos, self.zoom, self.xzoom)
|
||||
animation = self.animation
|
||||
|
||||
if not isinstance(animation, list):
|
||||
animation = [animation]
|
||||
at_list = [base_transform]
|
||||
|
||||
renpy.show(name=self.tag, at_list=[base_transform] + animation, layer=self.layer, what=self.get_image(), zorder=self.zorder)
|
||||
if animation:
|
||||
if isinstance(animation, list):
|
||||
at_list += animation
|
||||
else:
|
||||
at_list.append(animation)
|
||||
|
||||
renpy.show(name=self.tag, at_list=at_list, layer=self.layer, what=self.get_image(), zorder=self.zorder)
|
||||
|
||||
def hide(self):
|
||||
renpy.hide(name=self.tag, layer=self.layer)
|
||||
|
@ -1,3 +1,47 @@
|
||||
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):
|
||||
|
Loading…
Reference in New Issue
Block a user