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

BIN
assets/no_home.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -15,6 +15,7 @@ download.png
exit.png exit.png
installed.png installed.png
list.png list.png
no_home.png
preview.png preview.png
select.png select.png
shuffle.png shuffle.png

View File

@@ -174,6 +174,7 @@ void draw_text(float x, float y, float z, float scaleX, float scaleY, Color colo
void draw_text_wrap(float x, float y, float z, float scaleX, float scaleY, Color color, const char * text, float max_width); void draw_text_wrap(float x, float y, float z, float scaleX, float scaleY, Color color, const char * text, float max_width);
void draw_text_wrap_scaled(float x, float y, float z, Color color, const char * text, float max_scale, float min_scale, float max_width); void draw_text_wrap_scaled(float x, float y, float z, Color color, const char * text, float max_scale, float min_scale, float max_width);
void draw_text_center(gfxScreen_t target, float y, float z, float scaleX, float scaleY, Color color, const char * text); void draw_text_center(gfxScreen_t target, float y, float z, float scaleX, float scaleY, Color color, const char * text);
void draw_home(u64 start_time, u64 cur_time);
void draw_base_interface(void); void draw_base_interface(void);
void draw_grid_interface(Entry_List_s* list, Instructions_s instructions); void draw_grid_interface(Entry_List_s* list, Instructions_s instructions);

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); 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) static void get_text_dimensions(const char * text, float scaleX, float scaleY, float * width, float * height)
{ {
C2D_Text c2d_text; C2D_Text c2d_text;

View File

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

View File

@@ -1,6 +1,6 @@
/* /*
* This file is part of Anemone3DS * 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 * 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 * 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 audio_s * audio = NULL;
static bool homebrew = false; static bool homebrew = false;
static bool installed_themes = false; static bool installed_themes = false;
static bool home_displayed = false;
static u64 time_home_pressed = 0;
static Thread iconLoadingThread = {0}; static Thread iconLoadingThread = {0};
static Thread_Arg_s iconLoadingThread_arg = {0}; static Thread_Arg_s iconLoadingThread_arg = {0};
@@ -81,7 +83,6 @@ static void init_services(void)
dspfirm = !ndspInit(); dspfirm = !ndspInit();
APT_GetAppCpuTimeLimit(&old_time_limit); APT_GetAppCpuTimeLimit(&old_time_limit);
APT_SetAppCpuTimeLimit(30); APT_SetAppCpuTimeLimit(30);
// aptSetHomeAllowed(false);
httpcInit(0); httpcInit(0);
archive_result = open_archives(); archive_result = open_archives();
if(envIsHomebrew()) if(envIsHomebrew())
@@ -380,6 +381,12 @@ int main(void)
return 0; return 0;
} }
if (aptCheckHomePressRejected() && !home_displayed)
{
time_home_pressed = svcGetSystemTick() / CPU_TICKS_PER_MSEC;
home_displayed = true;
}
#ifndef CITRA_MODE #ifndef CITRA_MODE
if(R_FAILED(archive_result) && current_mode == MODE_THEMES) if(R_FAILED(archive_result) && current_mode == MODE_THEMES)
{ {
@@ -440,6 +447,13 @@ int main(void)
released = false; 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(); end_frame();
if(kDown & KEY_START) quit = true; if(kDown & KEY_START) quit = true;
@@ -553,6 +567,7 @@ int main(void)
theme->installed = false; theme->installed = false;
} }
installed_themes = true; installed_themes = true;
aptSetHomeAllowed(false);
} }
} }
else if((kDown | kHeld) & KEY_DUP) else if((kDown | kHeld) & KEY_DUP)
@@ -569,6 +584,7 @@ int main(void)
theme->installed = false; theme->installed = false;
} }
installed_themes = true; installed_themes = true;
aptSetHomeAllowed(false);
} }
} }
else if((kDown | kHeld) & KEY_DRIGHT) else if((kDown | kHeld) & KEY_DRIGHT)
@@ -585,6 +601,7 @@ int main(void)
theme->installed = false; theme->installed = false;
} }
installed_themes = true; installed_themes = true;
aptSetHomeAllowed(false);
} }
} }
else if((kDown | kHeld) & KEY_DDOWN) else if((kDown | kHeld) & KEY_DDOWN)
@@ -616,6 +633,7 @@ int main(void)
} }
current_list->shuffle_count = 0; current_list->shuffle_count = 0;
installed_themes = true; installed_themes = true;
aptSetHomeAllowed(false);
} }
} }
} }