From d989c9370e9ada1d2a04e6c68ed4eb702ba8d0ba Mon Sep 17 00:00:00 2001 From: Mateusz Faderewski Date: Wed, 12 Jul 2023 19:23:04 +0200 Subject: [PATCH] TV type restore for PAL60 mode --- src/menu/menu.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/menu/menu.c b/src/menu/menu.c index caccadea..af17e71b 100644 --- a/src/menu/menu.c +++ b/src/menu/menu.c @@ -15,10 +15,12 @@ #define SETTINGS_FILE_PATH "config.txt" +#define TV_TYPE_RAM *((uint32_t *) (0x80000300)) static menu_t *menu; static bool boot_pending; +static tv_type_t tv_type; static void menu_init (boot_params_t *boot_params) { @@ -57,15 +59,19 @@ static void menu_init (boot_params_t *boot_params) { menu->browser.valid = false; menu->browser.directory = path_init(default_directory_exists ? menu->settings.default_directory : NULL); - if ((get_tv_type() == TV_PAL) && menu->settings.pal60) { + tv_type = get_tv_type(); + if ((tv_type == TV_PAL) && menu->settings.pal60) { // HACK: Set TV type to NTSC, so PAL console would output 60 Hz signal instead. - *((uint32_t *) (0x80000300)) = TV_NTSC; + TV_TYPE_RAM = TV_NTSC; } display_init(RESOLUTION_640x480, DEPTH_16_BPP, 2, GAMMA_NONE, ANTIALIAS_OFF); } static void menu_deinit (menu_t *menu) { + // NOTE: Restore previous TV type so boot procedure wouldn't passthrough wrong value. + TV_TYPE_RAM = tv_type; + flashcart_deinit(); path_free(menu->browser.directory);