mirror of
https://github.com/Lorenzooone/cc3dsfs.git
synced 2026-04-24 23:17:43 -05:00
Add IS TWL specific menu options
This commit is contained in:
parent
5c3b79b85e
commit
b11ec5cf28
|
|
@ -16,6 +16,7 @@ uint64_t usb_is_device_get_video_in_size(CaptureData* capture_data);
|
|||
uint64_t usb_is_device_get_video_in_size(CaptureStatus* capture_status);
|
||||
bool is_device_is_capture(CaptureDevice* device);
|
||||
bool is_device_is_nitro(CaptureDevice* device);
|
||||
bool is_device_is_twl(CaptureDevice* device);
|
||||
void usb_is_device_init();
|
||||
void usb_is_device_close();
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ enum MainMenuOutAction{
|
|||
MAIN_MENU_SHUTDOWN,
|
||||
//MAIN_MENU_SHORTCUT_SETTINGS,
|
||||
MAIN_MENU_ISN_SETTINGS,
|
||||
MAIN_MENU_IST_SETTINGS,
|
||||
MAIN_MENU_INPUT_SETTINGS,
|
||||
};
|
||||
|
||||
|
|
@ -34,7 +35,7 @@ public:
|
|||
MainMenu(bool font_load_success, sf::Font &text_font);
|
||||
~MainMenu();
|
||||
void prepare(float scaling_factor, int view_size_x, int view_size_y, bool connected);
|
||||
void insert_data(ScreenType s_type, bool is_fullscreen, bool mono_app_mode, CaptureConnectionType cc_type, bool connected);
|
||||
void insert_data(ScreenType s_type, bool is_fullscreen, bool mono_app_mode, CaptureDevice* device, bool connected);
|
||||
MainMenuOutAction selected_index = MainMenuOutAction::MAIN_MENU_NO_ACTION;
|
||||
void reset_output_option();
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -475,15 +475,26 @@ void usb_is_device_acquisition_cleanup(CaptureData* capture_data) {
|
|||
}
|
||||
|
||||
bool is_device_is_capture(CaptureDevice* device) {
|
||||
if(device->cc_type != CAPTURE_CONN_IS_NITRO)
|
||||
return false;
|
||||
const is_device_usb_device* usb_device_info = (const is_device_usb_device*)device->descriptor;
|
||||
return usb_device_info->device_type != IS_NITRO_EMULATOR_DEVICE;
|
||||
return (usb_device_info->device_type == IS_TWL_CAPTURE_DEVICE) || (usb_device_info->device_type == IS_NITRO_CAPTURE_DEVICE);
|
||||
}
|
||||
|
||||
bool is_device_is_nitro(CaptureDevice* device) {
|
||||
if(device->cc_type != CAPTURE_CONN_IS_NITRO)
|
||||
return false;
|
||||
const is_device_usb_device* usb_device_info = (const is_device_usb_device*)device->descriptor;
|
||||
return (usb_device_info->device_type == IS_NITRO_EMULATOR_DEVICE) || (usb_device_info->device_type == IS_NITRO_CAPTURE_DEVICE);
|
||||
}
|
||||
|
||||
bool is_device_is_twl(CaptureDevice* device) {
|
||||
if(device->cc_type != CAPTURE_CONN_IS_NITRO)
|
||||
return false;
|
||||
const is_device_usb_device* usb_device_info = (const is_device_usb_device*)device->descriptor;
|
||||
return (usb_device_info->device_type == IS_TWL_CAPTURE_DEVICE);
|
||||
}
|
||||
|
||||
void usb_is_device_init() {
|
||||
return usb_init();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ struct ISNitroMenuOptionInfo {
|
|||
const bool is_selectable;
|
||||
const bool is_capture_valid;
|
||||
const bool is_emulator_valid;
|
||||
const bool is_nitro_valid;
|
||||
const bool is_twl_valid;
|
||||
const bool is_inc;
|
||||
const std::string dec_str;
|
||||
const std::string inc_str;
|
||||
|
|
@ -19,24 +21,28 @@ struct ISNitroMenuOptionInfo {
|
|||
static const ISNitroMenuOptionInfo is_nitro_delay_option = {
|
||||
.base_name = "Delay", .false_name = "", .is_selectable = false,
|
||||
.is_capture_valid = false, .is_emulator_valid = true,
|
||||
.is_nitro_valid = true, .is_twl_valid = false,
|
||||
.is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = ISN_MENU_NO_ACTION,
|
||||
.out_action = ISN_MENU_DELAY};
|
||||
|
||||
static const ISNitroMenuOptionInfo is_nitro_type_option = {
|
||||
.base_name = "Capture", .false_name = "", .is_selectable = true,
|
||||
.is_capture_valid = true, .is_emulator_valid = true,
|
||||
.is_nitro_valid = true, .is_twl_valid = false,
|
||||
.is_inc = true, .dec_str = "<", .inc_str = ">", .inc_out_action = ISN_MENU_TYPE_INC,
|
||||
.out_action = ISN_MENU_TYPE_DEC};
|
||||
|
||||
static const ISNitroMenuOptionInfo is_nitro_speed_option = {
|
||||
.base_name = "Speed", .false_name = "", .is_selectable = true,
|
||||
.is_capture_valid = true, .is_emulator_valid = true,
|
||||
.is_nitro_valid = true, .is_twl_valid = true,
|
||||
.is_inc = true, .dec_str = "<", .inc_str = ">", .inc_out_action = ISN_MENU_SPEED_INC,
|
||||
.out_action = ISN_MENU_SPEED_DEC};
|
||||
|
||||
static const ISNitroMenuOptionInfo is_nitro_reset_option = {
|
||||
.base_name = "Reset Hardware", .false_name = "", .is_selectable = true,
|
||||
.is_capture_valid = true, .is_emulator_valid = false,
|
||||
.is_nitro_valid = true, .is_twl_valid = true,
|
||||
.is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = ISN_MENU_NO_ACTION,
|
||||
.out_action = ISN_MENU_RESET};
|
||||
|
||||
|
|
@ -75,8 +81,12 @@ void ISNitroMenu::class_setup() {
|
|||
|
||||
void ISNitroMenu::insert_data(CaptureDevice* device) {
|
||||
bool is_capture = false;
|
||||
bool is_nitro = false;
|
||||
bool is_twl = false;
|
||||
#ifdef USE_IS_DEVICES_USB
|
||||
is_capture = is_device_is_capture(device);
|
||||
is_nitro = is_device_is_nitro(device);
|
||||
is_twl = is_device_is_twl(device);
|
||||
#endif
|
||||
this->num_enabled_options = 0;
|
||||
for(int i = 0; i < NUM_TOTAL_MENU_OPTIONS; i++) {
|
||||
|
|
@ -85,11 +95,19 @@ void ISNitroMenu::insert_data(CaptureDevice* device) {
|
|||
valid = valid && pollable_options[i]->is_capture_valid;
|
||||
else
|
||||
valid = valid && pollable_options[i]->is_emulator_valid;
|
||||
if(is_nitro)
|
||||
valid = valid && pollable_options[i]->is_nitro_valid;
|
||||
if(is_twl)
|
||||
valid = valid && pollable_options[i]->is_twl_valid;
|
||||
if(valid) {
|
||||
this->options_indexes[this->num_enabled_options] = i;
|
||||
this->num_enabled_options++;
|
||||
}
|
||||
}
|
||||
if(is_nitro)
|
||||
this->title = "IS Nitro Settings";
|
||||
if(is_twl)
|
||||
this->title = "IS TWL Settings";
|
||||
this->prepare_options();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include "MainMenu.hpp"
|
||||
#include "usb_is_device_acquisition.hpp"
|
||||
|
||||
#define NUM_TOTAL_MENU_OPTIONS (sizeof(pollable_options)/sizeof(pollable_options[0]))
|
||||
|
||||
|
|
@ -131,12 +132,19 @@ static const MainMenuOptionInfo shutdown_option = {
|
|||
.out_action = MAIN_MENU_SHUTDOWN};
|
||||
|
||||
static const MainMenuOptionInfo isn_settings_option = {
|
||||
.base_name = "Is Nitro Settings", .false_name = "",
|
||||
.base_name = "IS Nitro Settings", .false_name = "",
|
||||
.active_fullscreen = true, .active_windowed_screen = true,
|
||||
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
|
||||
.enabled_normal_mode = true, .enabled_mono_mode = true, .is_cc_specific = true,
|
||||
.out_action = MAIN_MENU_ISN_SETTINGS};
|
||||
|
||||
static const MainMenuOptionInfo ist_settings_option = {
|
||||
.base_name = "IS TWL Settings", .false_name = "",
|
||||
.active_fullscreen = true, .active_windowed_screen = true,
|
||||
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
|
||||
.enabled_normal_mode = true, .enabled_mono_mode = true, .is_cc_specific = true,
|
||||
.out_action = MAIN_MENU_IST_SETTINGS};
|
||||
|
||||
static const MainMenuOptionInfo* pollable_options[] = {
|
||||
&connect_option,
|
||||
&windowed_option,
|
||||
|
|
@ -151,6 +159,7 @@ static const MainMenuOptionInfo* pollable_options[] = {
|
|||
//&shortcut_option,
|
||||
&status_option,
|
||||
&isn_settings_option,
|
||||
&ist_settings_option,
|
||||
&licenses_option,
|
||||
&extra_settings_option,
|
||||
&quit_option,
|
||||
|
|
@ -183,13 +192,17 @@ void MainMenu::class_setup() {
|
|||
this->show_title = true;
|
||||
}
|
||||
|
||||
static bool check_cc_specific_option(const MainMenuOptionInfo* option, CaptureConnectionType cc_type) {
|
||||
if((option->out_action == MAIN_MENU_ISN_SETTINGS) && (cc_type == CAPTURE_CONN_IS_NITRO))
|
||||
static bool check_cc_specific_option(const MainMenuOptionInfo* option, CaptureDevice* device) {
|
||||
#ifdef USE_IS_DEVICES_USB
|
||||
if((option->out_action == MAIN_MENU_ISN_SETTINGS) && is_device_is_nitro(device))
|
||||
return true;
|
||||
if((option->out_action == MAIN_MENU_IST_SETTINGS) && is_device_is_twl(device))
|
||||
return true;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
void MainMenu::insert_data(ScreenType s_type, bool is_fullscreen, bool mono_app_mode, CaptureConnectionType cc_type, bool connected) {
|
||||
void MainMenu::insert_data(ScreenType s_type, bool is_fullscreen, bool mono_app_mode, CaptureDevice* device, bool connected) {
|
||||
this->num_enabled_options = 0;
|
||||
for(int i = 0; i < NUM_TOTAL_MENU_OPTIONS; i++) {
|
||||
bool valid = true;
|
||||
|
|
@ -208,7 +221,7 @@ void MainMenu::insert_data(ScreenType s_type, bool is_fullscreen, bool mono_app_
|
|||
else
|
||||
valid = valid && pollable_options[i]->enabled_normal_mode;
|
||||
if(pollable_options[i]->is_cc_specific)
|
||||
valid = valid && connected && check_cc_specific_option(pollable_options[i], cc_type);
|
||||
valid = valid && connected && check_cc_specific_option(pollable_options[i], device);
|
||||
//if((pollable_options[i]->out_action == MAIN_MENU_SHORTCUT_SETTINGS) && (!enable_shortcut))
|
||||
// valid = false;
|
||||
if(valid) {
|
||||
|
|
|
|||
|
|
@ -684,7 +684,7 @@ void WindowScreen::setup_main_menu(bool reset_data, bool skip_setup_check) {
|
|||
this->curr_menu = MAIN_MENU_TYPE;
|
||||
if(reset_data)
|
||||
this->main_menu->reset_data();
|
||||
this->main_menu->insert_data(this->m_stype, this->m_info.is_fullscreen, this->display_data->mono_app_mode, this->capture_status->device.cc_type, this->capture_status->connected);
|
||||
this->main_menu->insert_data(this->m_stype, this->m_info.is_fullscreen, this->display_data->mono_app_mode, &this->capture_status->device, this->capture_status->connected);
|
||||
this->last_menu_change_time = std::chrono::high_resolution_clock::now();
|
||||
}
|
||||
}
|
||||
|
|
@ -1346,6 +1346,7 @@ void WindowScreen::poll(bool do_everything) {
|
|||
this->setup_input_menu();
|
||||
done = true;
|
||||
break;
|
||||
case MAIN_MENU_IST_SETTINGS:
|
||||
case MAIN_MENU_ISN_SETTINGS:
|
||||
this->setup_is_nitro_menu();
|
||||
done = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user