From 361330dd0b8441f8339a750f94566b1ca806662b Mon Sep 17 00:00:00 2001 From: LoafyLemon Date: Fri, 17 May 2024 14:27:11 +0100 Subject: [PATCH] Remove android crash defender (obsolete) --- game/scripts/gui/preferences.rpy | 11 ------ game/scripts/utility/engine.rpy | 61 -------------------------------- 2 files changed, 72 deletions(-) diff --git a/game/scripts/gui/preferences.rpy b/game/scripts/gui/preferences.rpy index 8dc375ed..a07c00be 100644 --- a/game/scripts/gui/preferences.rpy +++ b/game/scripts/gui/preferences.rpy @@ -307,17 +307,6 @@ screen preferences_accessibility(): style gui.theme("pref_button") action Confirm(gui.CONFIRM_DELETE_SAVES, Function(delete_saves)) - if renpy.android: - label _("Android Crash Defender") - - hbox: - style_prefix gui.theme("radio") - - textbutton "Aggressive" action [settings.Set("crashdefendersetting", 3), Function(crashdefender.set_mode, 3)] - textbutton "Balanced" action [settings.Set("crashdefendersetting", 2), Function(crashdefender.set_mode, 2)] - textbutton "Relaxed" action [settings.Set("crashdefendersetting", 1), Function(crashdefender.set_mode, 1)] - textbutton "Off" action [settings.Set("crashdefendersetting", 0), Function(crashdefender.set_mode, 0)] - define gui.CONFIRM_DELETE_PERSISTENT = """{color=#7a0000}Warning!{/color} {size=-4}You are about to reset all persistent data, including achievements, seen text, and preferences.{/size}\n diff --git a/game/scripts/utility/engine.rpy b/game/scripts/utility/engine.rpy index 5baff47c..bfd306d9 100644 --- a/game/scripts/utility/engine.rpy +++ b/game/scripts/utility/engine.rpy @@ -1,64 +1,3 @@ -init python: - if renpy.android: - settings.default("crashdefendersetting", 0) - - # 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.set_mode(settings.get("crashdefendersetting")) - - def set_mode(self, mode): - if mode == 3: - self.limit = 15 - elif mode == 2: - self.limit = 25 - elif mode == 1: - self.limit = 55 - else: - self.limit = 0 - - def __call__(self, name): - if renpy.is_init_phase() or self.limit == 0: - 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(f"Cache limit reached, purging cache... ({cache_size}/{cache_limit})\n{renpy.get_filename_line()}") - - cache.clear() - - if renpy.game.interface is not None: - if config.developer: - print(f"Statements limit reached, cleaning textures... ({self.limit})\n{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() - - crashdefender = Android11TextureLeakFix() - - config.statement_callbacks.append(crashdefender) - python early hide: import functools