Disable home button on theme install
This commit is contained in:
BIN
assets/no_home.png
Normal file
BIN
assets/no_home.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
@@ -15,9 +15,10 @@ download.png
|
||||
exit.png
|
||||
installed.png
|
||||
list.png
|
||||
no_home.png
|
||||
preview.png
|
||||
select.png
|
||||
shuffle.png
|
||||
shuffle_no_bgm.png
|
||||
sort.png
|
||||
start.png
|
||||
start.png
|
||||
|
||||
@@ -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_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_home(u64 start_time, u64 cur_time);
|
||||
|
||||
void draw_base_interface(void);
|
||||
void draw_grid_interface(Entry_List_s* list, Instructions_s instructions);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user