mirror of
https://github.com/Lorenzooone/cc3dsfs.git
synced 2026-09-12 18:45:20 -05:00
Add video data type Menu and USB Conflict Resolution Menu
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "ExtraSettingsMenu.hpp"
|
||||
#include "USBConflictResolutionMenu.hpp"
|
||||
|
||||
#define NUM_TOTAL_MENU_OPTIONS (sizeof(pollable_options)/sizeof(pollable_options[0]))
|
||||
|
||||
@@ -10,6 +11,8 @@ struct ExtraSettingsMenuOptionInfo {
|
||||
const bool active_joint_screen;
|
||||
const bool active_top_screen;
|
||||
const bool active_bottom_screen;
|
||||
const bool active_regular;
|
||||
const bool active_mono_app;
|
||||
const ExtraSettingsMenuOutAction out_action;
|
||||
};
|
||||
|
||||
@@ -17,44 +20,58 @@ static const ExtraSettingsMenuOptionInfo warning_option = {
|
||||
.base_name = "Advanced users only!", .is_selectable = false,
|
||||
.active_fullscreen = true, .active_windowed_screen = true,
|
||||
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
|
||||
.active_regular = true, .active_mono_app = true,
|
||||
.out_action = EXTRA_SETTINGS_MENU_NO_ACTION};
|
||||
|
||||
static const ExtraSettingsMenuOptionInfo windowed_option = {
|
||||
.base_name = "Windowed Mode", .is_selectable = true,
|
||||
.active_fullscreen = true, .active_windowed_screen = false,
|
||||
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
|
||||
.active_regular = false, .active_mono_app = true,
|
||||
.out_action = EXTRA_SETTINGS_MENU_FULLSCREEN};
|
||||
|
||||
static const ExtraSettingsMenuOptionInfo fullscreen_option = {
|
||||
.base_name = "Fullscreen Mode", .is_selectable = true,
|
||||
.active_fullscreen = false, .active_windowed_screen = true,
|
||||
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
|
||||
.active_regular = false, .active_mono_app = true,
|
||||
.out_action = EXTRA_SETTINGS_MENU_FULLSCREEN};
|
||||
|
||||
static const ExtraSettingsMenuOptionInfo join_screens_option = {
|
||||
.base_name = "Join Screens", .is_selectable = true,
|
||||
.active_fullscreen = true, .active_windowed_screen = true,
|
||||
.active_joint_screen = false, .active_top_screen = true, .active_bottom_screen = true,
|
||||
.active_regular = false, .active_mono_app = true,
|
||||
.out_action = EXTRA_SETTINGS_MENU_SPLIT};
|
||||
|
||||
static const ExtraSettingsMenuOptionInfo split_screens_option = {
|
||||
.base_name = "Split Screens", .is_selectable = true,
|
||||
.active_fullscreen = true, .active_windowed_screen = true,
|
||||
.active_joint_screen = true, .active_top_screen = false, .active_bottom_screen = false,
|
||||
.active_regular = false, .active_mono_app = true,
|
||||
.out_action = EXTRA_SETTINGS_MENU_SPLIT};
|
||||
|
||||
static const ExtraSettingsMenuOptionInfo quit_option = {
|
||||
.base_name = "Quit Application", .is_selectable = true,
|
||||
.active_fullscreen = true, .active_windowed_screen = true,
|
||||
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
|
||||
.active_regular = false, .active_mono_app = true,
|
||||
.out_action = EXTRA_SETTINGS_MENU_QUIT_APPLICATION};
|
||||
|
||||
static const ExtraSettingsMenuOptionInfo usb_conflict_resolution_menu_option = {
|
||||
.base_name = "USB Conflict Resolution", .is_selectable = true,
|
||||
.active_fullscreen = true, .active_windowed_screen = true,
|
||||
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
|
||||
.active_regular = true, .active_mono_app = true,
|
||||
.out_action = EXTRA_SETTINGS_MENU_USB_CONFLICT_RESOLUTION};
|
||||
|
||||
static const ExtraSettingsMenuOptionInfo* pollable_options[] = {
|
||||
&warning_option,
|
||||
&windowed_option,
|
||||
&fullscreen_option,
|
||||
&join_screens_option,
|
||||
&split_screens_option,
|
||||
&usb_conflict_resolution_menu_option,
|
||||
&quit_option,
|
||||
};
|
||||
|
||||
@@ -84,21 +101,40 @@ void ExtraSettingsMenu::class_setup() {
|
||||
this->show_title = true;
|
||||
}
|
||||
|
||||
void ExtraSettingsMenu::insert_data(ScreenType s_type, bool is_fullscreen) {
|
||||
static bool is_option_valid(const ExtraSettingsMenuOptionInfo* option, ScreenType s_type, bool is_fullscreen, bool is_mono_app) {
|
||||
bool valid = true;
|
||||
if(is_fullscreen)
|
||||
valid = valid && option->active_fullscreen;
|
||||
else
|
||||
valid = valid && option->active_windowed_screen;
|
||||
if(s_type == ScreenType::TOP)
|
||||
valid = valid && option->active_top_screen;
|
||||
else if(s_type == ScreenType::BOTTOM)
|
||||
valid = valid && option->active_bottom_screen;
|
||||
else
|
||||
valid = valid && option->active_joint_screen;
|
||||
if(is_mono_app)
|
||||
valid = valid && option->active_mono_app;
|
||||
else
|
||||
valid = valid && option->active_regular;
|
||||
if(option->out_action == EXTRA_SETTINGS_MENU_USB_CONFLICT_RESOLUTION)
|
||||
valid = valid && (USBConflictResolutionMenu::get_total_possible_selectable_inserted() > 0);
|
||||
return valid;
|
||||
}
|
||||
|
||||
int ExtraSettingsMenu::get_total_possible_selectable_inserted(ScreenType s_type, bool is_fullscreen, bool is_mono_app) {
|
||||
int num_insertable = 0;
|
||||
for(size_t i = 0; i < NUM_TOTAL_MENU_OPTIONS; i++) {
|
||||
if(is_option_valid(pollable_options[i], s_type, is_fullscreen, is_mono_app) && pollable_options[i]->is_selectable)
|
||||
num_insertable++;
|
||||
}
|
||||
return num_insertable;
|
||||
}
|
||||
|
||||
void ExtraSettingsMenu::insert_data(ScreenType s_type, bool is_fullscreen, bool is_mono_app) {
|
||||
this->num_enabled_options = 0;
|
||||
for(size_t i = 0; i < NUM_TOTAL_MENU_OPTIONS; i++) {
|
||||
bool valid = true;
|
||||
if(is_fullscreen)
|
||||
valid = valid && pollable_options[i]->active_fullscreen;
|
||||
else
|
||||
valid = valid && pollable_options[i]->active_windowed_screen;
|
||||
if(s_type == ScreenType::TOP)
|
||||
valid = valid && pollable_options[i]->active_top_screen;
|
||||
else if(s_type == ScreenType::BOTTOM)
|
||||
valid = valid && pollable_options[i]->active_bottom_screen;
|
||||
else
|
||||
valid = valid && pollable_options[i]->active_joint_screen;
|
||||
if(valid) {
|
||||
if(is_option_valid(pollable_options[i], s_type, is_fullscreen, is_mono_app)) {
|
||||
this->options_indexes[this->num_enabled_options] = (int)i;
|
||||
this->num_enabled_options++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user