Detect and display flashcart features correctly

This commit is contained in:
Robin Jones 2024-10-25 14:48:21 +01:00
parent 819e27784b
commit 6eb6991ca0

View File

@ -1,11 +1,31 @@
#include "views.h" #include "views.h"
#include "../sound.h" #include "../sound.h"
#include <libcart/cart.h>
static inline const char *format_boolean_type (bool bool_value) { static inline const char *format_boolean_type (bool bool_value) {
return bool_value ? "Supported" : "Unsupported"; return bool_value ? "Supported" : "Unsupported";
} }
static const char *format_cart_type () {
switch (cart_type) {
case CART_CI:
return "64drive";
case CART_EDX:
return "Series X EverDrive-64";
case CART_ED:
return "Series V EverDrive-64";
case CART_SC:
return "SummerCart64";
default: // Probably emulator
return "Emulator?";
}
}
static void process (menu_t *menu) { static void process (menu_t *menu) {
if (menu->actions.back) { if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER; menu->next_mode = MENU_MODE_BROWSER;
@ -42,21 +62,15 @@ static void draw (menu_t *menu, surface_t *d) {
" CIC Detection: %s.\n" " CIC Detection: %s.\n"
" Region Detection: %s.\n" " Region Detection: %s.\n"
"\n\n", "\n\n",
"SummerCart64", format_cart_type(),
"V?.?.?", "Not Available",
format_boolean_type(true), format_boolean_type(flashcart_has_feature(FLASHCART_FEATURE_64DD)),
format_boolean_type(true), format_boolean_type(flashcart_has_feature(FLASHCART_FEATURE_RTC)),
format_boolean_type(true), format_boolean_type(flashcart_has_feature(FLASHCART_FEATURE_USB)),
format_boolean_type(true), format_boolean_type(flashcart_has_feature(FLASHCART_FEATURE_AUTO_CIC)),
format_boolean_type(true) format_boolean_type(flashcart_has_feature(FLASHCART_FEATURE_AUTO_REGION))
); );
// FIXME: Display:
// * cart_type
// * Firmware version
// * supported features (flashcart_features_t)
component_actions_bar_text_draw( component_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"\n" "\n"