Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added improved UI and theme. #168

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/system/variables.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
6 changes: 4 additions & 2 deletions source/sub_app0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions source/sub_app1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
29 changes: 24 additions & 5 deletions source/system/setting_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(&region);
if(result.code == 0)
if(CFGU_SecureInfoGetRegion(&region) == 0)
{
if(region == CFG_REGION_CHN)
var_system_region = 1;
Expand All @@ -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);

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions source/system/util/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions source/system/variables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];