diff --git a/include/devicecapture.hpp b/include/devicecapture.hpp index e798102..88510dc 100755 --- a/include/devicecapture.hpp +++ b/include/devicecapture.hpp @@ -30,4 +30,5 @@ bool get_device_3d_implemented(CaptureStatus* capture_status); bool is_usb_speed_of_device_enough_3d(CaptureStatus* capture_status); bool get_3d_enabled(CaptureStatus* capture_status, bool skip_requested_3d_check = false); bool update_3d_enabled(CaptureStatus* capture_status); +bool set_3d_enabled(CaptureStatus* capture_status, bool new_value); #endif diff --git a/source/cc3dsfs.cpp b/source/cc3dsfs.cpp index 7c9e42e..6cb14f1 100755 --- a/source/cc3dsfs.cpp +++ b/source/cc3dsfs.cpp @@ -146,6 +146,7 @@ static bool load_shared(const std::string path, const std::string name, SharedDa static bool load(const std::string path, const std::string name, ScreenInfo &top_info, ScreenInfo &bottom_info, ScreenInfo &joint_info, DisplayData &display_data, AudioData *audio_data, OutTextData &out_text_data, CaptureStatus* capture_status) { std::ifstream file(path + name); std::string line; + bool loaded_3d_request = false; if((!file) || (!file.is_open()) || (!file.good())) { UpdateOutText(out_text_data, "File " + path + name + " load failed.\nDefaults re-loaded.", "Load failed\nDefaults re-loaded", TEXT_KIND_ERROR); @@ -180,7 +181,8 @@ static bool load(const std::string path, const std::string name, ScreenInfo &top } if(key == "requested_3d") { - capture_status->requested_3d = std::stoi(value); + set_3d_enabled(capture_status, std::stoi(value)); + loaded_3d_request = true; continue; } @@ -225,6 +227,8 @@ static bool load(const std::string path, const std::string name, ScreenInfo &top } } } + if(!loaded_3d_request) + set_3d_enabled(capture_status, false); } catch(...) { UpdateOutText(out_text_data, "File " + path + name + " load failed.\nDefaults re-loaded.", "Load failed\nDefaults re-loaded", TEXT_KIND_ERROR); @@ -236,7 +240,6 @@ static bool load(const std::string path, const std::string name, ScreenInfo &top } static void defaults_reload(FrontendData *frontend_data, AudioData* audio_data, CaptureStatus* capture_status) { - capture_status->requested_3d = false; capture_status->capture_type = CAPTURE_SCREENS_BOTH; capture_status->capture_speed = CAPTURE_SPEEDS_FULL; capture_status->battery_percentage = 100; @@ -259,6 +262,7 @@ static void load_layout_file(int load_index, FrontendData *frontend_data, AudioD defaults_reload(frontend_data, audio_data, capture_status); if(load_index == SIMPLE_RESET_DATA_INDEX) { + set_3d_enabled(capture_status, false); reset_shared_data(&frontend_data->shared_data); UpdateOutText(out_text_data, "Reset detected. Defaults re-loaded", "Reset detected\nDefaults re-loaded", TEXT_KIND_WARNING); return; @@ -274,8 +278,10 @@ static void load_layout_file(int load_index, FrontendData *frontend_data, AudioD std::string load_name = load_layout_name(load_index, created_proper_folder, name_load_success); UpdateOutText(out_text_data, "Layout loaded from: " + layout_path + layout_name, "Layout " + load_name + " loaded", TEXT_KIND_SUCCESS); } - else if(!op_success) + else if(!op_success) { defaults_reload(frontend_data, audio_data, capture_status); + set_3d_enabled(capture_status, false); + } sanitize_enabled_info(frontend_data->joint_screen->m_info, frontend_data->top_screen->m_info, frontend_data->bot_screen->m_info); if(!is_first_load) return; diff --git a/source/devicecapture.cpp b/source/devicecapture.cpp index 93f78a5..1533a8d 100755 --- a/source/devicecapture.cpp +++ b/source/devicecapture.cpp @@ -315,14 +315,18 @@ bool get_3d_enabled(CaptureStatus* capture_status, bool skip_requested_3d_check) return true; } -bool update_3d_enabled(CaptureStatus* capture_status) { +bool set_3d_enabled(CaptureStatus* capture_status, bool new_value) { bool would_3d_be_enabled = get_3d_enabled(capture_status, true); - if(would_3d_be_enabled && (capture_status->cooldown_curr_in < FIX_PARTIAL_FIRST_FRAME_NUM)) + if(would_3d_be_enabled && (new_value != capture_status->requested_3d) && (capture_status->cooldown_curr_in < FIX_PARTIAL_FIRST_FRAME_NUM)) capture_status->cooldown_curr_in = FIX_PARTIAL_FIRST_FRAME_NUM; - capture_status->requested_3d = !capture_status->requested_3d; + capture_status->requested_3d = new_value; return would_3d_be_enabled; } +bool update_3d_enabled(CaptureStatus* capture_status) { + return set_3d_enabled(capture_status, !capture_status->requested_3d); +} + void capture_init() { #ifdef USE_DS_3DS_USB usb_ds_3ds_init();