Disable home button on theme install

This commit is contained in:
2024-04-24 23:25:20 -04:00
parent 7e2191ad86
commit ecf9dc63ce
6 changed files with 33 additions and 4 deletions

View File

@@ -167,6 +167,15 @@ static void draw_image(int image_id, float x, float y)
C2D_DrawImageAt(C2D_SpriteSheetGetImage(spritesheet, image_id), x, y, 0.6f, NULL, 1.0f, 1.0f);
}
void draw_home(u64 start_time, u64 cur_time)
{
float time_sec = (cur_time - start_time)/1000.0f;
float alpha = fmin(-1.333f * time_sec * time_sec + 2.666f * time_sec, 1.0f); // Quadratic regression to create fade effect
C2D_ImageTint tint = {};
C2D_AlphaImageTint(&tint, alpha);
C2D_DrawImageAt(C2D_SpriteSheetGetImage(spritesheet, sprites_no_home_idx), (320-64)/2, (240-64)/2, 1.0f, &tint, 1.0f, 1.0f);
}
static void get_text_dimensions(const char * text, float scaleX, float scaleY, float * width, float * height)
{
C2D_Text c2d_text;

View File

@@ -408,7 +408,7 @@ renamed:
DEBUG("path: %s\n", path_to_file);
u16 utf16path[0x106] = {0};
utf8_to_utf16(utf16path, path_to_file, 0x106);
utf8_to_utf16(utf16path, (u8 *) path_to_file, 0x106);
FS_Path path = fsMakePath(PATH_UTF16, utf16path);
// check if file already exists, and if it does, prompt the user

View File

@@ -1,6 +1,6 @@
/*
* This file is part of Anemone3DS
* Copyright (C) 2016-2020 Contributors in CONTRIBUTORS.md
* Copyright (C) 2015-2020 Contributors in CONTRIBUTORS.md
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -40,6 +40,8 @@ bool dspfirm = false;
static audio_s * audio = NULL;
static bool homebrew = false;
static bool installed_themes = false;
static bool home_displayed = false;
static u64 time_home_pressed = 0;
static Thread iconLoadingThread = {0};
static Thread_Arg_s iconLoadingThread_arg = {0};
@@ -81,7 +83,6 @@ static void init_services(void)
dspfirm = !ndspInit();
APT_GetAppCpuTimeLimit(&old_time_limit);
APT_SetAppCpuTimeLimit(30);
// aptSetHomeAllowed(false);
httpcInit(0);
archive_result = open_archives();
if(envIsHomebrew())
@@ -380,6 +381,12 @@ int main(void)
return 0;
}
if (aptCheckHomePressRejected() && !home_displayed)
{
time_home_pressed = svcGetSystemTick() / CPU_TICKS_PER_MSEC;
home_displayed = true;
}
#ifndef CITRA_MODE
if(R_FAILED(archive_result) && current_mode == MODE_THEMES)
{
@@ -440,6 +447,13 @@ int main(void)
released = false;
}
if (home_displayed)
{
u64 cur_time = svcGetSystemTick() / CPU_TICKS_PER_MSEC;
draw_home(time_home_pressed, cur_time);
if (cur_time - time_home_pressed > 2000) home_displayed = false;
}
end_frame();
if(kDown & KEY_START) quit = true;
@@ -553,6 +567,7 @@ int main(void)
theme->installed = false;
}
installed_themes = true;
aptSetHomeAllowed(false);
}
}
else if((kDown | kHeld) & KEY_DUP)
@@ -569,6 +584,7 @@ int main(void)
theme->installed = false;
}
installed_themes = true;
aptSetHomeAllowed(false);
}
}
else if((kDown | kHeld) & KEY_DRIGHT)
@@ -585,6 +601,7 @@ int main(void)
theme->installed = false;
}
installed_themes = true;
aptSetHomeAllowed(false);
}
}
else if((kDown | kHeld) & KEY_DDOWN)
@@ -616,6 +633,7 @@ int main(void)
}
current_list->shuffle_count = 0;
installed_themes = true;
aptSetHomeAllowed(false);
}
}
}