diff --git a/include/system/variables.hpp b/include/system/variables.hpp index 62605ab9..3eda2a9d 100644 --- a/include/system/variables.hpp +++ b/include/system/variables.hpp @@ -32,4 +32,5 @@ extern char var_status[128]; extern std::string var_clipboard; extern std::string var_connected_ssid; extern std::string var_lang; +extern std::string var_model; extern C2D_Image var_square_image[1]; \ No newline at end of file diff --git a/source/sub_app0.cpp b/source/sub_app0.cpp index aa628b73..0886d452 100644 --- a/source/sub_app0.cpp +++ b/source/sub_app0.cpp @@ -236,7 +236,7 @@ void Sapp0_decode_thread(void* arg) osTickCounterUpdate(&counter[1]); vid_audio_time = osTickCounterRead(&counter[1]); - if(!has_video) + if(!has_video && !std::isnan(pos) && !std::isinf(pos)) vid_current_pos = pos; if(result.code == 0) @@ -280,7 +280,9 @@ void Sapp0_decode_thread(void* arg) osTickCounterUpdate(&counter[0]); vid_video_time = osTickCounterRead(&counter[0]); - vid_current_pos = pos; + if(!std::isnan(pos) && !std::isinf(pos)) + vid_current_pos = pos; + if(result.code == 0) vid_convert_request = true; else diff --git a/source/sub_app1.cpp b/source/sub_app1.cpp index 8b532b58..d866cb29 100644 --- a/source/sub_app1.cpp +++ b/source/sub_app1.cpp @@ -246,9 +246,9 @@ void Sapp1_decode_thread(void* arg) osTickCounterUpdate(&counter[1]); vid_mvd_audio_time = osTickCounterRead(&counter[1]); - if(!has_video) + if(!has_video && !std::isnan(pos) && !std::isinf(pos)) vid_mvd_current_pos = pos; - + if(result.code == 0) { while(true) @@ -290,7 +290,9 @@ void Sapp1_decode_thread(void* arg) osTickCounterUpdate(&counter[0]); vid_mvd_video_time = osTickCounterRead(&counter[0]); - vid_mvd_current_pos = pos; + if(!std::isnan(pos) && !std::isinf(pos)) + vid_mvd_current_pos = pos; + if(result.code == 0) vid_mvd_convert_request = true; else diff --git a/source/system/setting_menu.cpp b/source/system/setting_menu.cpp index 6f3d1b37..88ace4d4 100644 --- a/source/system/setting_menu.cpp +++ b/source/system/setting_menu.cpp @@ -71,13 +71,13 @@ void Sem_init(void) Util_log_save(DEF_SEM_INIT_STR, "Initializing..."); bool wifi_state = true; u8 region; + u8 model; u8* cache = (u8*)malloc(0x1000); u32 read_size = 0; std::string data[10]; Result_with_string result; - result.code = CFGU_SecureInfoGetRegion(®ion); - if(result.code == 0) + if(CFGU_SecureInfoGetRegion(®ion) == 0) { if(region == CFG_REGION_CHN) var_system_region = 1; @@ -89,6 +89,22 @@ void Sem_init(void) var_system_region = 0; } + if(CFGU_GetSystemModel(&model)) + { + if(model == 0) + var_model = "OLD 3DS"; + else if(model == 1) + var_model = "OLD 3DS XL"; + else if(model == 2) + var_model = "NEW 3DS"; + else if(model == 3) + var_model = "OLD 2DS"; + else if(model == 4) + var_model = "NEW 3DS XL"; + else if(model == 5) + var_model = "NEW 2DS XL"; + } + result = Util_file_load_from_file("settings.txt", DEF_MAIN_DIR, cache, 0x1000, &read_size); Util_log_save(DEF_SEM_INIT_STR , "Util_file_load_from_file()..." + result.string + result.error_description, result.code); @@ -119,6 +135,9 @@ void Sem_init(void) var_num_of_app_start = 0; } + if(var_model == "OLD 2DS")//OLD 2DS doesn't support high resolution mode + var_high_resolution_mode = false; + sem_thread_run = true; sem_update_thread = threadCreate(Sem_update_thread, (void*)(""), DEF_STACKSIZE, DEF_THREAD_PRIORITY_NORMAL, 0, false); sem_worker_thread = threadCreate(Sem_worker_thread, (void*)(""), DEF_STACKSIZE, DEF_THREAD_PRIORITY_NORMAL, 0, false); @@ -294,12 +313,12 @@ void Sem_main(void) if (var_flash_mode) cache_color[2] = DEF_DRAW_RED; - if(sem_record_request && var_night_mode) + if((sem_record_request || var_model == "OLD 2DS") && var_night_mode) { cache_color[3] = DEF_DRAW_WEAK_WHITE; cache_color[4] = DEF_DRAW_WEAK_WHITE; } - else if(sem_record_request) + else if(sem_record_request || var_model == "OLD 2DS") { cache_color[3] = DEF_DRAW_WEAK_BLACK; cache_color[4] = DEF_DRAW_WEAK_BLACK; @@ -796,7 +815,7 @@ void Sem_main(void) sem_bar_selected[0] = true; else if (key.p_touch && key.touch_x >= 10 && key.touch_x <= 309 && key.touch_y >= 120 && key.touch_y <= 139) sem_bar_selected[1] = true; - if (key.p_touch && key.touch_x >= 10 && key.touch_x <= 99 && key.touch_y >= 160 && key.touch_y <= 179 && !sem_record_request) + if (key.p_touch && key.touch_x >= 10 && key.touch_x <= 99 && key.touch_y >= 160 && key.touch_y <= 179 && !sem_record_request && var_model != "OLD 2DS") { var_high_resolution_mode = true; Draw_reinit(var_high_resolution_mode); diff --git a/source/system/util/util.cpp b/source/system/util/util.cpp index d43bfbf4..4e1dc415 100644 --- a/source/system/util/util.cpp +++ b/source/system/util/util.cpp @@ -39,6 +39,9 @@ std::string Util_convert_seconds_to_time(double input_seconds) long count = 0; std::string time = ""; + if(std::isnan(input_seconds) || std::isinf(input_seconds)) + input_seconds = 0; + for(count = 0; count < (int)input_seconds; count++) { if(seconds + 1 >= 60) diff --git a/source/system/variables.cpp b/source/system/variables.cpp index 081415a1..f6b2f9b5 100644 --- a/source/system/variables.cpp +++ b/source/system/variables.cpp @@ -32,4 +32,5 @@ char var_status[128]; std::string var_clipboard = ""; std::string var_connected_ssid = ""; std::string var_lang = "en"; +std::string var_model = "Unknown"; C2D_Image var_square_image[1];