From af227e0303d1c62f67194805be8e0b56cafe376d Mon Sep 17 00:00:00 2001 From: Anthony Samms Date: Sat, 20 Dec 2025 14:57:04 -0500 Subject: [PATCH] fix subtitle loading --- libs/file_navigator.py | 5 +++-- libs/texture.py | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/libs/file_navigator.py b/libs/file_navigator.py index 5f18d34..7177453 100644 --- a/libs/file_navigator.py +++ b/libs/file_navigator.py @@ -412,11 +412,12 @@ class YellowBox: self.is_back = is_back self.tja = tja if self.tja is not None: - subtitle_text = self.tja.metadata.subtitle.get(global_data.config['general']['language'], '') + subtitle_text = self.tja.metadata.subtitle.get(global_data.config['general']['language'], self.tja.metadata.subtitle.get('en', '')) font_size = tex.skin_config["yb_subtitle"].font_size if len(subtitle_text) < 30 else tex.skin_config["yb_subtitle"].font_size - int(10 * tex.screen_scale) self.subtitle = OutlinedText(subtitle_text, font_size, ray.WHITE, outline_thickness=5, vertical=True) + else: + self.subtitle = None self.is_dan = is_dan - self.subtitle = None self.left_out = tex.get_animation(9) self.right_out = tex.get_animation(10) diff --git a/libs/texture.py b/libs/texture.py index c88744f..fadf3e1 100644 --- a/libs/texture.py +++ b/libs/texture.py @@ -25,6 +25,9 @@ class SkinInfo: self.height = height self.font_size = font_size + def __repr__(self): + return f"{self.__dict__}" + class Texture: """Texture class for managing textures and animations.""" def __init__(self, name: str, texture: Any, init_vals: dict[str, int]): @@ -55,6 +58,9 @@ class Texture: self.y2: list[int] = [self.height] self.controllable: list[bool] = [False] + def __repr__(self): + return f"{self.__dict__}" + class TextureWrapper: """Texture wrapper class for managing textures and animations.""" def __init__(self): @@ -188,9 +194,15 @@ class TextureWrapper: with parent_zip_ref.open('texture.json') as json_file: tex_mapping_data = json.loads(json_file.read().decode('utf-8')) for tex_map in tex_mapping_data: - for key in tex_mapping_data[tex_map]: - if key in ["x", "y", "x2", "y2"]: - tex_mapping_data[tex_map][key] = tex_mapping_data[tex_map][key] * self.screen_scale + if isinstance(tex_mapping_data[tex_map], list): + for index, item in enumerate(tex_mapping_data[tex_map]): + for key in item: + if key in ["x", "y", "x2", "y2"]: + tex_mapping_data[tex_map][index][key] = tex_mapping_data[tex_map][index][key] * self.screen_scale + else: + for key in tex_mapping_data[tex_map]: + if key in ["x", "y", "x2", "y2"]: + tex_mapping_data[tex_map][key] = tex_mapping_data[tex_map][key] * self.screen_scale texture_json_source = "parent" else: raise Exception(f"texture.json file missing from both {zip_path} and {parent_zip_path}")