7 Commits

Author SHA1 Message Date
26d8c283b3 Add warning about splashes being disabled 2017-09-09 20:19:30 -04:00
4ceac06f0c improve no splashes interface 2017-09-09 20:12:10 -04:00
337693ca13 Improve no themes interface and create folders on boot 2017-09-09 20:10:36 -04:00
8ba1fed5d7 Change QR reader behavior, speed up 2017-09-09 11:33:54 -04:00
Helloman892
d99f1c97a0 fixes splash install
If splash.bin and/or splashbottom.bin didn't already exist, splashes would not install.

Also added a line break to separate splash_delete(), for consistency.
2017-09-09 13:07:31 +01:00
ZetaDesigns
1a1b3e25b0 Quick fix II - The sequel 2017-09-09 11:54:50 +02:00
c92c20d4e8 Quick fix 2017-09-09 00:26:40 -04:00
4 changed files with 55 additions and 14 deletions

View File

@@ -110,8 +110,6 @@ void take_picture(void)
CAMU_SetReceiving(&event, buf, PORT_CAM1, 240 * 400 * 2, transfer_size);
svcWaitSynchronization(event, U64_MAX);
svcCloseHandle(event);
CAMU_StopCapture(PORT_BOTH);
CAMU_Activate(SELECT_NONE);
pp2d_begin_draw(GFX_TOP);
u32 *rgba8_buf = malloc(240 * 400 * sizeof(u32));
if (rgba8_buf == NULL) return;
@@ -122,14 +120,28 @@ void take_picture(void)
pp2d_load_texture_memory(TEXTURE_QR, rgba8_buf, 400, 240);
pp2d_draw_texture(TEXTURE_QR, 0, 0);
pp2d_draw_rectangle(0, 216, 400, 24, RGBA8(55, 122, 168, 255));
pp2d_draw_text_center(GFX_TOP, 220, 0.5, 0.5, RGBA8(255, 255, 255, 255), "Hold \uE005 To Quit");
pp2d_draw_text_center(GFX_TOP, 220, 0.5, 0.5, RGBA8(255, 255, 255, 255), "Press \uE005 To Quit");
pp2d_draw_rectangle(0, 0, 400, 24, RGBA8(55, 122, 168, 255));
pp2d_draw_text_center(GFX_TOP, 4, 0.5, 0.5, RGBA8(255, 255, 255, 255), "Press \uE004 To Scan");
pp2d_end_draw();
free(rgba8_buf);
pp2d_free_texture(TEXTURE_QR);
hidScanInput();
u32 kDown = hidKeysDown();
if (kDown & KEY_L)
{
CAMU_StopCapture(PORT_BOTH);
CAMU_Activate(SELECT_NONE);
scan_qr(buf);
free(buf);
CAMU_Activate(SELECT_OUT1_OUT2);
CAMU_StartCapture(PORT_BOTH);
}
if (kDown & KEY_R)
{
exit_qr();
qr_mode = false;
}
free(buf);
}
/*

View File

@@ -109,8 +109,8 @@ void throw_error(char* error, int error_type) {
hidScanInput();
u32 kDown = hidKeysDown();
draw_base_interface();
pp2d_draw_text(70, 120, 0.8, 0.8, COLOR_RED, error);
pp2d_draw_wtext(70, 150, 0.8, 0.8, COLOR_WHITE, L"Press \uE000 to shut down.");
pp2d_draw_text_center(GFX_TOP, 120, 0.6, 0.6, COLOR_RED, error);
pp2d_draw_wtext_center(GFX_TOP, 150, 0.6, 0.6, COLOR_WHITE, L"Press \uE000 to shut down.");
pp2d_end_draw();
if (kDown & KEY_A) {
if (homebrew)
@@ -126,8 +126,8 @@ void throw_error(char* error, int error_type) {
hidScanInput();
u32 kDown = hidKeysDown();
draw_base_interface();
pp2d_draw_text(70, 120, 0.8, 0.8, COLOR_YELLOW, error);
pp2d_draw_wtext(70, 150, 0.8, 0.8, COLOR_WHITE, L"Press \uE000 to continue.");
pp2d_draw_text_center(GFX_TOP, 120, 0.6, 0.6, COLOR_YELLOW, error);
pp2d_draw_wtext_center(GFX_TOP, 150, 0.6, 0.6, COLOR_WHITE, L"Press \uE000 to continue.");
pp2d_end_draw();
if (kDown & KEY_A) break;
}
@@ -163,8 +163,10 @@ void draw_theme_interface(Theme_s * themes_list, int theme_count, int selected_t
if (themes_list == NULL)
{
pp2d_begin_draw(GFX_TOP);
pp2d_draw_text_center(GFX_TOP, 100, 1, 1, COLOR_WHITE, "NO THEMES FOUND");
draw_base_interface();
pp2d_draw_text_center(GFX_TOP, 80, 0.7, 0.7, COLOR_YELLOW, "No themes found!");
pp2d_draw_text_center(GFX_TOP, 110, 0.7, 0.7, COLOR_YELLOW, "Press \uE005 to download from QR");
pp2d_draw_text_center(GFX_TOP, 140, 0.7, 0.7, COLOR_YELLOW, "Or \uE045 to quit");
pp2d_end_draw();
return;
}
@@ -282,8 +284,10 @@ void draw_splash_interface(Splash_s *splashes_list, int splash_count, int select
{
if (splashes_list == NULL)
{
pp2d_begin_draw(GFX_TOP);
pp2d_draw_text_center(GFX_TOP, 100, 1, 1, COLOR_WHITE, "NO SPLASHES FOUND");
draw_base_interface();
pp2d_draw_text_center(GFX_TOP, 80, 0.7, 0.7, COLOR_YELLOW, "No splashes found!");
pp2d_draw_text_center(GFX_TOP, 110, 0.7, 0.7, COLOR_YELLOW, "Press \uE005 to download from QR");
pp2d_draw_text_center(GFX_TOP, 140, 0.7, 0.7, COLOR_YELLOW, "Or \uE045 to quit");
pp2d_end_draw();
return;
}
@@ -310,6 +314,9 @@ void draw_splash_interface(Splash_s *splashes_list, int splash_count, int select
pp2d_draw_wtext_center(GFX_TOP, 180, 0.7, 0.7, COLOR_WHITE, L"\uE000 Install Splash \uE004 Switch to Themes");
pp2d_draw_wtext_center(GFX_TOP, 210, 0.7, 0.7, COLOR_WHITE, L"\uE002 Delete current Splash");
pp2d_draw_wtext_center(GFX_TOP, 150, 0.7, 0.7, COLOR_WHITE, L"\uE003 Preview Splash \uE005 Scan QRCode");
pp2d_draw_wtext(130, 120, 0.6, 0.6, COLOR_WHITE, L"");
pp2d_draw_on(GFX_BOTTOM);
for (int i = 0; i < splash_count; i++) {
if (splash_count <= THEMES_PER_SCREEN)

View File

@@ -68,9 +68,13 @@ Result open_archives(void)
archive2 = 0x00;
}
retValue = FSUSER_OpenArchive(&ArchiveSD, ARCHIVE_SDMC, fsMakePath(PATH_EMPTY, ""));
if(R_FAILED(retValue)) return retValue;
FSUSER_CreateDirectory(ArchiveSD, fsMakePath(PATH_ASCII, "/Themes"), FS_ATTRIBUTE_DIRECTORY);
FSUSER_CreateDirectory(ArchiveSD, fsMakePath(PATH_ASCII, "/Splashes"), FS_ATTRIBUTE_DIRECTORY);
u32 homeMenuPath[3] = {MEDIATYPE_SD, archive2, 0};
home.type = PATH_BINARY;
home.size = 0xC;

View File

@@ -28,6 +28,7 @@
#include "fs.h"
#include "themes.h"
#include "pp2d/pp2d/pp2d.h"
#include "draw.h"
void load_splash_preview(Splash_s *splash)
{
@@ -197,11 +198,13 @@ Result get_splashes(Splash_s** splashes_list, int *splash_count)
return res;
}
void splash_delete()
{
remove("/luma/splash.bin");
remove("/luma/splashbottom.bin");
}
void splash_install(Splash_s splash_to_install)
{
char *screen_buf = NULL;
@@ -211,6 +214,7 @@ void splash_install(Splash_s splash_to_install)
size = zip_file_to_buf("splash.bin", splash_to_install.path, &screen_buf);
if (size)
{
remake_file("/luma/splash.bin", ArchiveSD, sizeof(screen_buf));
buf_to_file(size, "/luma/splash.bin", ArchiveSD, screen_buf);
free(screen_buf);
screen_buf = NULL;
@@ -220,6 +224,7 @@ void splash_install(Splash_s splash_to_install)
size = zip_file_to_buf("splashbottom.bin", splash_to_install.path, &screen_buf);
if (size)
{
remake_file("/luma/splashbottom.bin", ArchiveSD, sizeof(screen_buf));
buf_to_file(size, "/luma/splashbottom.bin", ArchiveSD, screen_buf);
free(screen_buf);
screen_buf = NULL;
@@ -232,6 +237,7 @@ void splash_install(Splash_s splash_to_install)
size = file_to_buf(fsMakePath(PATH_UTF16, path), ArchiveSD, &screen_buf);
if (size)
{
remake_file("/luma/splash.bin", ArchiveSD, sizeof(screen_buf));
buf_to_file(size, "/luma/splash.bin", ArchiveSD, screen_buf);
free(screen_buf);
screen_buf = NULL;
@@ -243,10 +249,22 @@ void splash_install(Splash_s splash_to_install)
size = file_to_buf(fsMakePath(PATH_UTF16, path), ArchiveSD, &screen_buf);
if (size)
{
remake_file("/luma/splashbottom.bin", ArchiveSD, sizeof(screen_buf));
buf_to_file(size, "/luma/splashbottom.bin", ArchiveSD, screen_buf);
free(screen_buf);
screen_buf = NULL;
size = 0;
}
}
char *config_buf;
size = file_to_buf(fsMakePath(PATH_ASCII, "/luma/config.bin"), ArchiveSD, &config_buf);
if (size)
{
if (config_buf[0xC] == 0)
{
free(config_buf);
throw_error("WARNING: Splashes are disabled in Luma Config", WARNING);
}
}
}