From a39c6d01ea7a881f994c58326c1ccdcdecb59378 Mon Sep 17 00:00:00 2001 From: yhql Date: Thu, 28 Sep 2023 10:24:14 +0200 Subject: [PATCH] fix: do not parse fonts if symbol not present --- speculos/main.py | 2 ++ src/launcher.c | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/speculos/main.py b/speculos/main.py index 43fc8831..3eb88541 100644 --- a/speculos/main.py +++ b/speculos/main.py @@ -115,6 +115,8 @@ def get_elf_infos(app_path): fonts_addr = bagl_fonts_symbol[0]['st_value'] fonts_size = bagl_fonts_symbol[0]['st_size'] logger.info(f"Found C_bagl_fonts at 0x{fonts_addr:X} ({fonts_size} bytes)\n") + else: + logger.info("Disabling OCR.") supp_ram = elf.get_section_by_name('.rfbss') ram_addr, ram_size = (supp_ram['sh_addr'], supp_ram['sh_size']) if supp_ram is not None else (0, 0) diff --git a/src/launcher.c b/src/launcher.c index 5a328ea4..a8f6f523 100644 --- a/src/launcher.c +++ b/src/launcher.c @@ -541,8 +541,10 @@ static int run_app(char *name, unsigned long *parameters) app = get_current_app(); // Parse fonts and build bitmap -> character table - parse_fonts(memory.code, app->elf.text_load_addr, app->elf.fonts_addr, - app->elf.fonts_size); + if ((app->elf.fonts_addr != 0) && (hw_model != MODEL_STAX)) { + parse_fonts(memory.code, app->elf.text_load_addr, app->elf.fonts_addr, + app->elf.fonts_size); + } /* thumb mode */ f = (void *)((unsigned long)p | 1);