Merge branch 'develop' into cpak-management

This commit is contained in:
Robin Jones 2024-07-07 18:33:05 +01:00
commit 078780574d
5 changed files with 138 additions and 23 deletions

View File

@ -68,10 +68,9 @@ A known set of PNG files using 2 letter ID's can be downloaded [here](https://me
Emulators should be added to the `/menu/emulators` directory on the SD card. Emulators should be added to the `/menu/emulators` directory on the SD card.
Menu currently supports the following emulators and associated ROM file names: Menu currently supports the following emulators and associated ROM file names:
- **NES**: [neon64v2](https://github.com/hcs64/neon64v2) by *hcs64* - `neon64bu.rom` - **NES**: [neon64v2](https://github.com/hcs64/neon64v2/releases) by *hcs64* - `neon64bu.rom`
- **SNES**: [sodium64](https://github.com/Hydr8gon/sodium64) by *Hydr8gon* - `sodium64.z64` - **SNES**: [sodium64](https://github.com/Hydr8gon/sodium64/releases) by *Hydr8gon* - `sodium64.z64`
- **Game Boy** / **GB Color**: [gb64](https://lambertjamesd.github.io/gb64/romwrapper/romwrapper.html) by *lambertjamesd* - `gb.v64` / `gbc.v64` - **Game Boy** / **GB Color**: [gb64](https://lambertjamesd.github.io/gb64/romwrapper/romwrapper.html) by *lambertjamesd* - `gb.v64` / `gbc.v64` ("Download Emulator" button)
- **Sega Master System** / **Sega Game Gear** / **Sg1000**: [TotalSMS](https://github.com/ITotalJustice/TotalSMS) - `TotalSMS.z64` (Currently broken)
### Menu Settings ### Menu Settings
The Menu creates a `config.ini` file in `sd:/menu/` which contains various settings that are used by the menu. The Menu creates a `config.ini` file in `sd:/menu/` which contains various settings that are used by the menu.

@ -1 +1 @@
Subproject commit 536df10ad65614f519bea40482b6e2657b9c4c84 Subproject commit 4d4449aac2af2ba8306cd4e61974ac682f1ea400

View File

@ -67,6 +67,10 @@ static void menu_init (boot_params_t *boot_params) {
sound_init_default(); sound_init_default();
JOYPAD_PORT_FOREACH (port) {
joypad_set_rumble_active(port, false);
}
menu = calloc(1, sizeof(menu_t)); menu = calloc(1, sizeof(menu_t));
assert(menu != NULL); assert(menu != NULL);

View File

@ -36,7 +36,7 @@ static void draw (menu_t *menu, surface_t *d) {
"\n" "\n"
"\n" "\n"
"To set the date and time, please use the PC terminal\n" "To set the date and time, please use the PC terminal\n"
"application and set via USB.\n\n" "application and set via USB or a game that uses it.\n\n"
"Current date & time: %s\n", "Current date & time: %s\n",
menu->current_time >= 0 ? ctime(&menu->current_time) : "Unknown\n" menu->current_time >= 0 ? ctime(&menu->current_time) : "Unknown\n"
); );

View File

@ -1,4 +1,6 @@
#include <stdbool.h>
#include "../sound.h" #include "../sound.h"
#include "../settings.h"
#include "views.h" #include "views.h"
@ -9,9 +11,108 @@ static const char *format_switch (bool state) {
} }
} }
static void set_pal60_type (menu_t *menu, void *arg) {
menu->settings.pal60_enabled = (bool) (arg);
settings_save(&menu->settings);
}
static void set_protected_entries_type (menu_t *menu, void *arg) {
menu->settings.show_protected_entries = (bool) (arg);
settings_save(&menu->settings);
menu->browser.reload = true;
}
static void set_use_saves_folder_type (menu_t *menu, void *arg) {
menu->settings.use_saves_folder = (bool) (arg);
settings_save(&menu->settings);
}
static void set_sound_enabled_type (menu_t *menu, void *arg) {
menu->settings.sound_enabled = (bool) (arg);
settings_save(&menu->settings);
}
#ifdef BETA_SETTINGS
static void set_bgm_enabled_type (menu_t *menu, void *arg) {
menu->settings.bgm_enabled = (bool) (arg);
settings_save(&menu->settings);
}
static void set_rumble_enabled_type (menu_t *menu, void *arg) {
menu->settings.rumble_enabled = (bool) (arg);
settings_save(&menu->settings);
}
// static void set_use_default_settings (menu_t *menu, void *arg) {
// // FIXME: add implementation
// menu->browser.reload = true;
// }
#endif
static component_context_menu_t set_pal60_type_context_menu = { .list = {
{.text = "On", .action = set_pal60_type, .arg = (void *) (true) },
{.text = "Off", .action = set_pal60_type, .arg = (void *) (false) },
COMPONENT_CONTEXT_MENU_LIST_END,
}};
static component_context_menu_t set_protected_entries_type_context_menu = { .list = {
{.text = "On", .action = set_protected_entries_type, .arg = (void *) (true) },
{.text = "Off", .action = set_protected_entries_type, .arg = (void *) (false) },
COMPONENT_CONTEXT_MENU_LIST_END,
}};
static component_context_menu_t set_sound_enabled_type_context_menu = { .list = {
{.text = "On", .action = set_sound_enabled_type, .arg = (void *) (true) },
{.text = "Off", .action = set_sound_enabled_type, .arg = (void *) (false) },
COMPONENT_CONTEXT_MENU_LIST_END,
}};
static component_context_menu_t set_use_saves_folder_type_context_menu = { .list = {
{.text = "On", .action = set_use_saves_folder_type, .arg = (void *) (true) },
{.text = "Off", .action = set_use_saves_folder_type, .arg = (void *) (false) },
COMPONENT_CONTEXT_MENU_LIST_END,
}};
#ifdef BETA_SETTINGS
static component_context_menu_t set_bgm_enabled_type_context_menu = { .list = {
{.text = "On", .action = set_bgm_enabled_type, .arg = (void *) (true) },
{.text = "Off", .action = set_bgm_enabled_type, .arg = (void *) (false) },
COMPONENT_CONTEXT_MENU_LIST_END,
}};
static component_context_menu_t set_rumble_enabled_type_context_menu = { .list = {
{.text = "On", .action = set_rumble_enabled_type, .arg = (void *) (true) },
{.text = "Off", .action = set_rumble_enabled_type, .arg = (void *) (false) },
COMPONENT_CONTEXT_MENU_LIST_END,
}};
#endif
static component_context_menu_t options_context_menu = { .list = {
{ .text = "PAL60 Mode", .submenu = &set_pal60_type_context_menu },
{ .text = "Show Hidden Files", .submenu = &set_protected_entries_type_context_menu },
{ .text = "Sound Effects", .submenu = &set_sound_enabled_type_context_menu },
{ .text = "Use Saves Folder", .submenu = &set_use_saves_folder_type_context_menu },
#ifdef BETA_SETTINGS
{ .text = "Background Music", .submenu = &set_bgm_enabled_type_context_menu },
{ .text = "Rumble Feedback", .submenu = &set_rumble_enabled_type_context_menu },
// { .text = "Restore Defaults", .action = set_use_default_settings },
#endif
COMPONENT_CONTEXT_MENU_LIST_END,
}};
static void process (menu_t *menu) { static void process (menu_t *menu) {
if (menu->actions.back) { if (component_context_menu_process(menu, &options_context_menu)) {
return;
}
if (menu->actions.enter) {
component_context_menu_show(&options_context_menu);
sound_play_effect(SFX_SETTING);
} else if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER; menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT); sound_play_effect(SFX_EXIT);
} }
@ -26,44 +127,55 @@ static void draw (menu_t *menu, surface_t *d) {
component_main_text_draw( component_main_text_draw(
ALIGN_CENTER, VALIGN_TOP, ALIGN_CENTER, VALIGN_TOP,
"SETTINGS EDITOR\n" "MENU SETTINGS EDITOR\n"
"\n" "\n"
); );
component_main_text_draw( component_main_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"\n" "\n\n"
"\n" " Default Directory : %s\n\n"
"To change the settings, please adjust them\n" "To change the menu settings, press 'A'.\n\n"
"directly in the 'menu/config.ini' file.\n\n" " PAL60 Mode : %s\n"
"pal60_enabled: %s\n" " Show Hidden Files : %s\n"
"show_protected_entries: %s\n" " Use Saves folder : %s\n"
"default_directory: %s\n" "* Sound Effects : %s\n"
"use_saves_folder: %s\n" #ifdef BETA_SETTINGS
"bgm_enabled: %s\n" " Background Music : %s\n"
"sound_enabled: %s\n" " Rumble Feedback : %s\n"
"rumble_enabled: %s\n", #endif
"\n\n"
"Note: Certain settings have the following caveats:\n\n"
"* Requires a flashcart reboot.\n",
menu->settings.default_directory,
format_switch(menu->settings.pal60_enabled), format_switch(menu->settings.pal60_enabled),
format_switch(menu->settings.show_protected_entries), format_switch(menu->settings.show_protected_entries),
menu->settings.default_directory,
format_switch(menu->settings.use_saves_folder), format_switch(menu->settings.use_saves_folder),
format_switch(menu->settings.sound_enabled)
#ifdef BETA_SETTINGS
,
format_switch(menu->settings.bgm_enabled), format_switch(menu->settings.bgm_enabled),
format_switch(menu->settings.sound_enabled),
format_switch(menu->settings.rumble_enabled) format_switch(menu->settings.rumble_enabled)
#endif
); );
component_actions_bar_text_draw( component_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"\n" "A: Change\n"
"B: Back" "B: Back"
); );
component_context_menu_draw(&options_context_menu);
rdpq_detach_show(); rdpq_detach_show();
} }
void view_settings_init (menu_t *menu) { void view_settings_init (menu_t *menu) {
// Nothing to initialize (yet)
component_context_menu_init(&options_context_menu);
} }
void view_settings_display (menu_t *menu, surface_t *display) { void view_settings_display (menu_t *menu, surface_t *display) {