mirror of
https://github.com/Polprzewodnikowy/N64FlashcartMenu.git
synced 2024-11-29 22:14:15 +01:00
Add CPak management view
This commit is contained in:
parent
4bcaced461
commit
a32373edbb
1
Makefile
1
Makefile
@ -71,6 +71,7 @@ SRCS = \
|
|||||||
menu/views/settings_editor.c \
|
menu/views/settings_editor.c \
|
||||||
menu/views/rtc.c \
|
menu/views/rtc.c \
|
||||||
menu/views/flashcart_info.c \
|
menu/views/flashcart_info.c \
|
||||||
|
menu/views/joypad_controller_pak.c \
|
||||||
utils/fs.c
|
utils/fs.c
|
||||||
|
|
||||||
FONTS = \
|
FONTS = \
|
||||||
|
@ -169,6 +169,7 @@ static view_t menu_views[] = {
|
|||||||
{ MENU_MODE_CREDITS, view_credits_init, view_credits_display },
|
{ MENU_MODE_CREDITS, view_credits_init, view_credits_display },
|
||||||
{ MENU_MODE_SETTINGS_EDITOR, view_settings_init, view_settings_display },
|
{ MENU_MODE_SETTINGS_EDITOR, view_settings_init, view_settings_display },
|
||||||
{ MENU_MODE_RTC, view_rtc_init, view_rtc_display },
|
{ MENU_MODE_RTC, view_rtc_init, view_rtc_display },
|
||||||
|
{ MENU_MODE_JOYPAD_CPAK, view_joypad_controller_pak_init, view_joypad_controller_pak_display },
|
||||||
{ MENU_MODE_FLASHCART, view_flashcart_info_init, view_flashcart_info_display },
|
{ MENU_MODE_FLASHCART, view_flashcart_info_init, view_flashcart_info_display },
|
||||||
{ MENU_MODE_LOAD_ROM, view_load_rom_init, view_load_rom_display },
|
{ MENU_MODE_LOAD_ROM, view_load_rom_init, view_load_rom_display },
|
||||||
{ MENU_MODE_LOAD_DISK, view_load_disk_init, view_load_disk_display },
|
{ MENU_MODE_LOAD_DISK, view_load_disk_init, view_load_disk_display },
|
||||||
|
@ -31,6 +31,7 @@ typedef enum {
|
|||||||
MENU_MODE_CREDITS,
|
MENU_MODE_CREDITS,
|
||||||
MENU_MODE_SETTINGS_EDITOR,
|
MENU_MODE_SETTINGS_EDITOR,
|
||||||
MENU_MODE_RTC,
|
MENU_MODE_RTC,
|
||||||
|
MENU_MODE_JOYPAD_CPAK,
|
||||||
MENU_MODE_FLASHCART,
|
MENU_MODE_FLASHCART,
|
||||||
MENU_MODE_LOAD_ROM,
|
MENU_MODE_LOAD_ROM,
|
||||||
MENU_MODE_LOAD_DISK,
|
MENU_MODE_LOAD_DISK,
|
||||||
|
@ -12,7 +12,8 @@ static const char *rom_extensions[] = { "z64", "n64", "v64", "rom", NULL };
|
|||||||
static const char *disk_extensions[] = { "ndd", NULL };
|
static const char *disk_extensions[] = { "ndd", NULL };
|
||||||
static const char *emulator_extensions[] = { "nes", "sfc", "smc", "gb", "gbc", "sms", "gg", "sg", NULL };
|
static const char *emulator_extensions[] = { "nes", "sfc", "smc", "gb", "gbc", "sms", "gg", "sg", NULL };
|
||||||
// TODO: "eep", "sra", "srm", "fla" could be used if transfered from different flashcarts.
|
// TODO: "eep", "sra", "srm", "fla" could be used if transfered from different flashcarts.
|
||||||
static const char *save_extensions[] = { "sav", NULL };
|
static const char *save_extensions[] = { "sav", NULL }; // TODO: "eep", "sra", "srm", "fla" could be used if transfered from different flashcarts.
|
||||||
|
//static const char *joypad_accessory_save_extensions[] = { "cpak", "mpk", NULL };
|
||||||
static const char *image_extensions[] = { "png", NULL };
|
static const char *image_extensions[] = { "png", NULL };
|
||||||
static const char *text_extensions[] = { "txt", "ini", "yml", "yaml", NULL };
|
static const char *text_extensions[] = { "txt", "ini", "yml", "yaml", NULL };
|
||||||
static const char *music_extensions[] = { "mp3", NULL };
|
static const char *music_extensions[] = { "mp3", NULL };
|
||||||
@ -275,6 +276,7 @@ static component_context_menu_t settings_context_menu = {
|
|||||||
{ .text = "Show credits", .action = set_menu_next_mode, .arg = (void *) (MENU_MODE_CREDITS) },
|
{ .text = "Show credits", .action = set_menu_next_mode, .arg = (void *) (MENU_MODE_CREDITS) },
|
||||||
{ .text = "Adjust RTC", .action = set_menu_next_mode, .arg = (void *) (MENU_MODE_RTC) },
|
{ .text = "Adjust RTC", .action = set_menu_next_mode, .arg = (void *) (MENU_MODE_RTC) },
|
||||||
{ .text = "Show cart info", .action = set_menu_next_mode, .arg = (void *) (MENU_MODE_FLASHCART) },
|
{ .text = "Show cart info", .action = set_menu_next_mode, .arg = (void *) (MENU_MODE_FLASHCART) },
|
||||||
|
{ .text = "CPak Management", .action = set_menu_next_mode, .arg = (void *) (MENU_MODE_JOYPAD_CPAK) },
|
||||||
COMPONENT_CONTEXT_MENU_LIST_END,
|
COMPONENT_CONTEXT_MENU_LIST_END,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
61
src/menu/views/joypad_controller_pak.c
Normal file
61
src/menu/views/joypad_controller_pak.c
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
#include "views.h"
|
||||||
|
|
||||||
|
static int accessory_is_cpak[4];
|
||||||
|
|
||||||
|
static void process (menu_t *menu) {
|
||||||
|
|
||||||
|
// check which paks are available
|
||||||
|
JOYPAD_PORT_FOREACH (port) {
|
||||||
|
accessory_is_cpak[port] = joypad_get_accessory_type(port) == JOYPAD_ACCESSORY_TYPE_CONTROLLER_PAK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (menu->actions.enter) {
|
||||||
|
// do something?!
|
||||||
|
}
|
||||||
|
|
||||||
|
if (menu->actions.back) {
|
||||||
|
menu->next_mode = MENU_MODE_BROWSER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void draw (menu_t *menu, surface_t *d) {
|
||||||
|
rdpq_attach(d, NULL);
|
||||||
|
|
||||||
|
component_background_draw();
|
||||||
|
|
||||||
|
component_layout_draw();
|
||||||
|
|
||||||
|
component_main_text_draw(
|
||||||
|
ALIGN_CENTER, VALIGN_TOP,
|
||||||
|
"CONTROLLER PAK MENU\n"
|
||||||
|
"\n"
|
||||||
|
"\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Backup to SD, restore from SD, and/or Repair functions.
|
||||||
|
// Bonus would be to handle individual per game entries!
|
||||||
|
component_main_text_draw(
|
||||||
|
ALIGN_LEFT, VALIGN_TOP,
|
||||||
|
"\n"
|
||||||
|
"\n"
|
||||||
|
"Not yet implemented!\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
component_actions_bar_text_draw(
|
||||||
|
ALIGN_LEFT, VALIGN_TOP,
|
||||||
|
"\n" // "A: Clone PAK to SD Card\n"
|
||||||
|
"B: Back"
|
||||||
|
);
|
||||||
|
|
||||||
|
rdpq_detach_show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void view_joypad_controller_pak_init (menu_t *menu){
|
||||||
|
// Nothing to initialize (yet)
|
||||||
|
}
|
||||||
|
|
||||||
|
void view_joypad_controller_pak_display (menu_t *menu, surface_t *display) {
|
||||||
|
process(menu);
|
||||||
|
draw(menu, display);
|
||||||
|
}
|
@ -47,6 +47,9 @@ void view_settings_display (menu_t *menu, surface_t *display);
|
|||||||
void view_rtc_init (menu_t *menu);
|
void view_rtc_init (menu_t *menu);
|
||||||
void view_rtc_display (menu_t *menu, surface_t *display);
|
void view_rtc_display (menu_t *menu, surface_t *display);
|
||||||
|
|
||||||
|
void view_joypad_controller_pak_init (menu_t *menu);
|
||||||
|
void view_joypad_controller_pak_display (menu_t *menu, surface_t *display);
|
||||||
|
|
||||||
void view_flashcart_info_init (menu_t *menu);
|
void view_flashcart_info_init (menu_t *menu);
|
||||||
void view_flashcart_info_display (menu_t *menu, surface_t *display);
|
void view_flashcart_info_display (menu_t *menu, surface_t *display);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user