From fa4bdbbfb94acff02739d8820e7c706caf621a39 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Sat, 13 Jul 2024 22:18:33 +0100 Subject: [PATCH 1/5] Merge L and Z button action (#120) ## Description Merge the L and Z action to be the "same" button press, depending on how the joypad is gripped. ## Motivation and Context Simplifies the menu controls. https://github.com/Polprzewodnikowy/N64FlashcartMenu/pull/119#issuecomment-2218853256 ## How Has This Been Tested? ## Screenshots ## Types of changes - [x] Improvement (non-breaking change that adds a new feature) - [ ] Bug fix (fixes an issue) - [ ] Breaking change (breaking change) - [ ] Config and build (change in the configuration and build system, has no impact on code or features) ## Checklist: - [ ] My code follows the code style of this project. - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [ ] I have added tests to cover my changes. - [ ] All new and existing tests passed. Signed-off-by: GITHUB_USER --- src/menu/actions.c | 9 +++------ src/menu/menu_state.h | 3 +-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/menu/actions.c b/src/menu/actions.c index dcabccff..14c87fb6 100644 --- a/src/menu/actions.c +++ b/src/menu/actions.c @@ -21,8 +21,7 @@ static void actions_clear (menu_t *menu) { menu->actions.back = false; menu->actions.options = false; menu->actions.settings = false; - menu->actions.l_context = false; - menu->actions.z_context = false; + menu->actions.lz_context = false; } static void actions_update_direction (menu_t *menu) { @@ -93,10 +92,8 @@ static void actions_update_buttons (menu_t *menu) { menu->actions.options = true; } else if (pressed.start) { menu->actions.settings = true; - } else if (pressed.l) { - menu->actions.l_context = true; - } else if (pressed.z) { - menu->actions.z_context = true; + } else if (pressed.l || pressed.z) { + menu->actions.lz_context = true; } } diff --git a/src/menu/menu_state.h b/src/menu/menu_state.h index 5077da4e..0d6aa459 100644 --- a/src/menu/menu_state.h +++ b/src/menu/menu_state.h @@ -85,8 +85,7 @@ typedef struct { bool back; bool options; bool settings; - bool l_context; - bool z_context; + bool lz_context; } actions; struct { From 73f848450da8757342b7e4cec08115ebbe7d729b Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 15 Jul 2024 19:39:03 +0100 Subject: [PATCH 2/5] Add extra rom info screen (#121) ## Description Move certain parameters to a seperate screen (messagebox). ## Motivation and Context The ROM info was convoluted Builds on #120 ## How Has This Been Tested? ## Screenshots ![image](https://github.com/Polprzewodnikowy/N64FlashcartMenu/assets/11439699/7d1626c0-3b8d-4e7d-8c3b-61f23744dc60) ## Types of changes - [x] Improvement (non-breaking change that adds a new feature) - [ ] Bug fix (fixes an issue) - [ ] Breaking change (breaking change) - [ ] Config and build (change in the configuration and build system, has no impact on code or features) ## Checklist: - [ ] My code follows the code style of this project. - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [ ] I have added tests to cover my changes. - [ ] All new and existing tests passed. Signed-off-by: GITHUB_USER --- src/menu/views/load_rom.c | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/menu/views/load_rom.c b/src/menu/views/load_rom.c index fd53682e..5e2f2b70 100644 --- a/src/menu/views/load_rom.c +++ b/src/menu/views/load_rom.c @@ -4,7 +4,7 @@ #include "../sound.h" #include "views.h" - +static bool show_extra_info_message = false; static bool load_pending; static component_boxart_t *boxart; @@ -203,6 +203,13 @@ static void process (menu_t *menu) { } else if (menu->actions.options) { component_context_menu_show(&options_context_menu); sound_play_effect(SFX_SETTING); + } else if (menu->actions.lz_context) { + if (show_extra_info_message) { + show_extra_info_message = false; + } else { + show_extra_info_message = true; + } + sound_play_effect(SFX_SETTING); } } @@ -240,10 +247,7 @@ static void draw (menu_t *menu, surface_t *d) { " Save type: %s\n" " TV type: %s\n" " Expansion PAK: %s\n" - " CIC: %s\n" - " Boot address: 0x%08lX\n" - " SDK version: %.1f%c\n" - " Clock Rate: %.2fMHz\n", + " CIC: %s\n", format_rom_endianness(menu->load.rom_info.endianness), menu->load.rom_info.title, menu->load.rom_info.game_code[0], menu->load.rom_info.game_code[1], menu->load.rom_info.game_code[2], menu->load.rom_info.game_code[3], @@ -254,10 +258,7 @@ static void draw (menu_t *menu, surface_t *d) { format_rom_save_type(rom_info_get_save_type(&menu->load.rom_info)), format_rom_tv_type(rom_info_get_tv_type(&menu->load.rom_info)), format_rom_expansion_pak_info(menu->load.rom_info.features.expansion_pak), - format_cic_type(rom_info_get_cic_type(&menu->load.rom_info)), - menu->load.rom_info.boot_address, - (menu->load.rom_info.libultra.version / 10.0f), menu->load.rom_info.libultra.revision, - menu->load.rom_info.clock_rate + format_cic_type(rom_info_get_cic_type(&menu->load.rom_info)) ); component_actions_bar_text_draw( @@ -268,12 +269,26 @@ static void draw (menu_t *menu, surface_t *d) { component_actions_bar_text_draw( ALIGN_RIGHT, VALIGN_TOP, - "\n" - "R: Options" + "L|Z: Extra Info\n" + "R: Options" ); component_boxart_draw(boxart); + if (show_extra_info_message) { + component_messagebox_draw( + "EXTRA ROM INFO\n" + "\n" + " Boot address: 0x%08lX\n" + " SDK version: %.1f%c\n" + " Clock Rate: %.2fMHz\n\n\n" + "Press L|Z to return.\n", + menu->load.rom_info.boot_address, + (menu->load.rom_info.libultra.version / 10.0f), menu->load.rom_info.libultra.revision, + menu->load.rom_info.clock_rate + ); + } + component_context_menu_draw(&options_context_menu); } From e7c80d27ab8c019785771dc0545fd2c1e88e8065 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 17 Jul 2024 22:52:24 +0100 Subject: [PATCH 3/5] Rom info improvements (#122) ## Description improves upon #121 ## Motivation and Context ## How Has This Been Tested? ## Screenshots ![image](https://github.com/Polprzewodnikowy/N64FlashcartMenu/assets/11439699/d91185a0-dc39-42d9-aedc-3dbd4b6c965d) ![image](https://github.com/Polprzewodnikowy/N64FlashcartMenu/assets/11439699/13d18d06-d14c-4e2a-8974-1c62ea8863f4) ## Types of changes - [x] Improvement (non-breaking change that adds a new feature) - [ ] Bug fix (fixes an issue) - [ ] Breaking change (breaking change) - [ ] Config and build (change in the configuration and build system, has no impact on code or features) ## Checklist: - [ ] My code follows the code style of this project. - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [ ] I have added tests to cover my changes. - [ ] All new and existing tests passed. Signed-off-by: GITHUB_USER --- src/menu/views/load_rom.c | 49 +++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/src/menu/views/load_rom.c b/src/menu/views/load_rom.c index 5e2f2b70..ee60b4a7 100644 --- a/src/menu/views/load_rom.c +++ b/src/menu/views/load_rom.c @@ -237,34 +237,23 @@ static void draw (menu_t *menu, surface_t *d) { "\n" "\n" "\n" - " Endianness: %s\n" - " Title: %.20s\n" - " Game code: %c%c%c%c\n" - " Media type: %s\n" - " Destination market: %s\n" - " Version: %hhu\n" - " Check code: 0x%016llX\n" - " Save type: %s\n" - " TV type: %s\n" - " Expansion PAK: %s\n" - " CIC: %s\n", - format_rom_endianness(menu->load.rom_info.endianness), - menu->load.rom_info.title, - menu->load.rom_info.game_code[0], menu->load.rom_info.game_code[1], menu->load.rom_info.game_code[2], menu->load.rom_info.game_code[3], - format_rom_media_type(menu->load.rom_info.category_code), - format_rom_destination_market(menu->load.rom_info.destination_code), - menu->load.rom_info.version, - menu->load.rom_info.check_code, + "Description:\n None.\n\n\n\n\n\n\n\n" + "Expansion PAK: %s\n" + "Save type: %s\n" + "TV type: %s\n" + "CIC: %s\n" + "GS/AR Cheats: Off\n" + "Patches: Off\n", + format_rom_expansion_pak_info(menu->load.rom_info.features.expansion_pak), format_rom_save_type(rom_info_get_save_type(&menu->load.rom_info)), format_rom_tv_type(rom_info_get_tv_type(&menu->load.rom_info)), - format_rom_expansion_pak_info(menu->load.rom_info.features.expansion_pak), format_cic_type(rom_info_get_cic_type(&menu->load.rom_info)) ); component_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, "A: Load and run ROM\n" - "B: Exit" + "B: Back" ); component_actions_bar_text_draw( @@ -279,10 +268,24 @@ static void draw (menu_t *menu, surface_t *d) { component_messagebox_draw( "EXTRA ROM INFO\n" "\n" - " Boot address: 0x%08lX\n" - " SDK version: %.1f%c\n" - " Clock Rate: %.2fMHz\n\n\n" + "Endianness: %s\n" + "Title: %.20s\n" + "Game code: %c%c%c%c\n" + "Media type: %s\n" + "Variant: %s\n" + "Version: %hhu\n" + "Check code: 0x%016llX\n" + "Boot address: 0x%08lX\n" + "SDK version: %.1f%c\n" + "Clock Rate: %.2fMHz\n\n\n" "Press L|Z to return.\n", + format_rom_endianness(menu->load.rom_info.endianness), + menu->load.rom_info.title, + menu->load.rom_info.game_code[0], menu->load.rom_info.game_code[1], menu->load.rom_info.game_code[2], menu->load.rom_info.game_code[3], + format_rom_media_type(menu->load.rom_info.category_code), + format_rom_destination_market(menu->load.rom_info.destination_code), + menu->load.rom_info.version, + menu->load.rom_info.check_code, menu->load.rom_info.boot_address, (menu->load.rom_info.libultra.version / 10.0f), menu->load.rom_info.libultra.revision, menu->load.rom_info.clock_rate From f299bdcac913cf55e25219742bab07051341fc97 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 17 Jul 2024 23:01:22 +0100 Subject: [PATCH 4/5] Rom info improvements (controller pak) (#123) ## Description Show whether a ROM supports (or requires) a controller pak Builds on #122 ## Motivation and Context ## How Has This Been Tested? ## Screenshots ![image](https://github.com/Polprzewodnikowy/N64FlashcartMenu/assets/11439699/2a83965e-c92a-408f-bb9e-af693b63f738) ![image](https://github.com/Polprzewodnikowy/N64FlashcartMenu/assets/11439699/e9bb0d12-6ec0-4737-80f8-62bfa75944cb) ![image](https://github.com/Polprzewodnikowy/N64FlashcartMenu/assets/11439699/0897f55f-fb01-4bbe-b6d6-b51aaff6e13c) ## Types of changes - [x] Improvement (non-breaking change that adds a new feature) - [ ] Bug fix (fixes an issue) - [ ] Breaking change (breaking change) - [ ] Config and build (change in the configuration and build system, has no impact on code or features) ## Checklist: - [ ] My code follows the code style of this project. - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [ ] I have added tests to cover my changes. - [ ] All new and existing tests passed. Signed-off-by: GITHUB_USER --- src/menu/views/load_rom.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/menu/views/load_rom.c b/src/menu/views/load_rom.c index ee60b4a7..c408b47c 100644 --- a/src/menu/views/load_rom.c +++ b/src/menu/views/load_rom.c @@ -66,16 +66,16 @@ static const char *format_rom_destination_market (rom_destination_type_t market_ } } -static const char *format_rom_save_type (rom_save_type_t save_type) { +static const char *format_rom_save_type (rom_save_type_t save_type, bool supports_cpak) { switch (save_type) { - case SAVE_TYPE_NONE: return "None"; - case SAVE_TYPE_EEPROM_4KBIT: return "EEPROM 4kbit"; - case SAVE_TYPE_EEPROM_16KBIT: return "EEPROM 16kbit"; - case SAVE_TYPE_SRAM_256KBIT: return "SRAM 256kbit"; - case SAVE_TYPE_SRAM_BANKED: return "SRAM 768kbit / 3 banks"; - case SAVE_TYPE_SRAM_1MBIT: return "SRAM 1Mbit"; - case SAVE_TYPE_FLASHRAM_1MBIT: return "FlashRAM 1Mbit"; - case SAVE_TYPE_FLASHRAM_PKST2: return "FlashRAM (Pokemon Stadium 2)"; + case SAVE_TYPE_NONE: return supports_cpak ? "Controller PAK" : "None"; + case SAVE_TYPE_EEPROM_4KBIT: return supports_cpak ? "EEPROM 4kbit | Controller PAK" : "EEPROM 4kbit"; + case SAVE_TYPE_EEPROM_16KBIT: return supports_cpak ? "EEPROM 16kbit | Controller PAK" : "EEPROM 16kbit"; + case SAVE_TYPE_SRAM_256KBIT: return supports_cpak ? "SRAM 256kbit | Controller PAK" : "SRAM 256kbit"; + case SAVE_TYPE_SRAM_BANKED: return supports_cpak ? "SRAM 768kbit / 3 banks | Controller PAK" : "SRAM 768kbit / 3 banks"; + case SAVE_TYPE_SRAM_1MBIT: return supports_cpak ? "SRAM 1Mbit | Controller PAK" : "SRAM 1Mbit"; + case SAVE_TYPE_FLASHRAM_1MBIT: return supports_cpak ? "FlashRAM 1Mbit | Controller PAK" : "FlashRAM 1Mbit"; + case SAVE_TYPE_FLASHRAM_PKST2: return supports_cpak ? "FlashRAM (Pokemon Stadium 2) | Controller PAK" : "FlashRAM (Pokemon Stadium 2)"; default: return "Unknown"; } } @@ -238,16 +238,16 @@ static void draw (menu_t *menu, surface_t *d) { "\n" "\n" "Description:\n None.\n\n\n\n\n\n\n\n" - "Expansion PAK: %s\n" - "Save type: %s\n" - "TV type: %s\n" - "CIC: %s\n" - "GS/AR Cheats: Off\n" - "Patches: Off\n", + "Expansion PAK: %s\n" + "TV type: %s\n" + "CIC: %s\n" + "GS/AR Cheats: Off\n" + "Patches: Off\n" + "Save type: %s\n", format_rom_expansion_pak_info(menu->load.rom_info.features.expansion_pak), - format_rom_save_type(rom_info_get_save_type(&menu->load.rom_info)), format_rom_tv_type(rom_info_get_tv_type(&menu->load.rom_info)), - format_cic_type(rom_info_get_cic_type(&menu->load.rom_info)) + format_cic_type(rom_info_get_cic_type(&menu->load.rom_info)), + format_rom_save_type(rom_info_get_save_type(&menu->load.rom_info), menu->load.rom_info.features.controller_pak) ); component_actions_bar_text_draw( From 1deb7242fc224e97dab6c17cd4b76d9eb6b36a91 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 17 Jul 2024 23:11:06 +0100 Subject: [PATCH 5/5] Fix ability to set SFX audio without console reboot (#118) ## Description Allow realtime setting changes for SFX in menu. Add note that the PAL60 setting still requires a reboot. ## Motivation and Context The sfx setting previously required a flashcart reboot. ## How Has This Been Tested? ## Screenshots ## Types of changes - [x] Improvement (non-breaking change that adds a new feature) - [ ] Bug fix (fixes an issue) - [ ] Breaking change (breaking change) - [ ] Config and build (change in the configuration and build system, has no impact on code or features) ## Checklist: - [ ] My code follows the code style of this project. - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [ ] I have added tests to cover my changes. - [ ] All new and existing tests passed. Signed-off-by: GITHUB_USER --- src/menu/menu.c | 3 ++- src/menu/sound.c | 8 ++++++++ src/menu/sound.h | 2 ++ src/menu/views/settings_editor.c | 11 ++++++----- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/menu/menu.c b/src/menu/menu.c index 2ec04545..479d9cfd 100644 --- a/src/menu/menu.c +++ b/src/menu/menu.c @@ -119,8 +119,9 @@ static void menu_init (boot_params_t *boot_params) { __boot_tvtype = TV_NTSC; } + sound_init_sfx(); if (menu->settings.sound_enabled) { - sound_init_sfx(); + sound_use_sfx(true); } display_init(RESOLUTION_640x480, DEPTH_16_BPP, 2, GAMMA_NONE, FILTERS_DISABLED); diff --git a/src/menu/sound.c b/src/menu/sound.c index bf950d6c..98d62748 100644 --- a/src/menu/sound.c +++ b/src/menu/sound.c @@ -50,6 +50,14 @@ void sound_init_sfx (void) { sfx_enabled = true; } +void sound_use_sfx(bool state) { + if (state) { + sfx_enabled = true; + } + else { + sfx_enabled = false; + } +} void sound_play_effect(sound_effect_t sfx) { if(sfx_enabled) { diff --git a/src/menu/sound.h b/src/menu/sound.h index cf311519..8752a9b9 100644 --- a/src/menu/sound.h +++ b/src/menu/sound.h @@ -7,6 +7,7 @@ #ifndef SOUND_H__ #define SOUND_H__ +#include #define SOUND_MP3_PLAYER_CHANNEL (0) #define SOUND_SFX_CHANNEL (2) @@ -23,6 +24,7 @@ typedef enum { void sound_init_default (void); void sound_init_mp3_playback (void); void sound_init_sfx (void); +void sound_use_sfx(bool); void sound_play_effect(sound_effect_t sfx); void sound_deinit (void); void sound_poll (void); diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index 4dc2539c..22e3ac30 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -30,6 +30,7 @@ static void set_use_saves_folder_type (menu_t *menu, void *arg) { static void set_sound_enabled_type (menu_t *menu, void *arg) { menu->settings.sound_enabled = (bool) (arg); + sound_use_sfx(menu->settings.sound_enabled); settings_save(&menu->settings); } @@ -134,19 +135,19 @@ static void draw (menu_t *menu, surface_t *d) { component_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n\n" - " Default Directory : %s\n\n" - "To change the menu settings, press 'A'.\n\n" - " PAL60 Mode : %s\n" + " Default Directory : %s\n\n" + "To change the following menu settings, press 'A':\n" + "* PAL60 Mode : %s\n" " Show Hidden Files : %s\n" " Use Saves folder : %s\n" - "* Sound Effects : %s\n" + " Sound Effects : %s\n" #ifdef BETA_SETTINGS " Background Music : %s\n" " Rumble Feedback : %s\n" #endif - "\n\n" "Note: Certain settings have the following caveats:\n\n" "* Requires a flashcart reboot.\n", + "\n", menu->settings.default_directory, format_switch(menu->settings.pal60_enabled), format_switch(menu->settings.show_protected_entries),