mirror of
https://github.com/astronautlevel2/Anemone3DS.git
synced 2026-01-24 16:52:43 -05:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 26d8c283b3 | |||
| 4ceac06f0c | |||
| 337693ca13 | |||
| 8ba1fed5d7 | |||
|
|
d99f1c97a0 | ||
|
|
1a1b3e25b0 | ||
| c92c20d4e8 |
@@ -110,8 +110,6 @@ void take_picture(void)
|
|||||||
CAMU_SetReceiving(&event, buf, PORT_CAM1, 240 * 400 * 2, transfer_size);
|
CAMU_SetReceiving(&event, buf, PORT_CAM1, 240 * 400 * 2, transfer_size);
|
||||||
svcWaitSynchronization(event, U64_MAX);
|
svcWaitSynchronization(event, U64_MAX);
|
||||||
svcCloseHandle(event);
|
svcCloseHandle(event);
|
||||||
CAMU_StopCapture(PORT_BOTH);
|
|
||||||
CAMU_Activate(SELECT_NONE);
|
|
||||||
pp2d_begin_draw(GFX_TOP);
|
pp2d_begin_draw(GFX_TOP);
|
||||||
u32 *rgba8_buf = malloc(240 * 400 * sizeof(u32));
|
u32 *rgba8_buf = malloc(240 * 400 * sizeof(u32));
|
||||||
if (rgba8_buf == NULL) return;
|
if (rgba8_buf == NULL) return;
|
||||||
@@ -122,15 +120,29 @@ void take_picture(void)
|
|||||||
pp2d_load_texture_memory(TEXTURE_QR, rgba8_buf, 400, 240);
|
pp2d_load_texture_memory(TEXTURE_QR, rgba8_buf, 400, 240);
|
||||||
pp2d_draw_texture(TEXTURE_QR, 0, 0);
|
pp2d_draw_texture(TEXTURE_QR, 0, 0);
|
||||||
pp2d_draw_rectangle(0, 216, 400, 24, RGBA8(55, 122, 168, 255));
|
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();
|
pp2d_end_draw();
|
||||||
free(rgba8_buf);
|
free(rgba8_buf);
|
||||||
pp2d_free_texture(TEXTURE_QR);
|
pp2d_free_texture(TEXTURE_QR);
|
||||||
|
hidScanInput();
|
||||||
|
u32 kDown = hidKeysDown();
|
||||||
|
if (kDown & KEY_L)
|
||||||
|
{
|
||||||
|
CAMU_StopCapture(PORT_BOTH);
|
||||||
|
CAMU_Activate(SELECT_NONE);
|
||||||
scan_qr(buf);
|
scan_qr(buf);
|
||||||
free(buf);
|
|
||||||
CAMU_Activate(SELECT_OUT1_OUT2);
|
CAMU_Activate(SELECT_OUT1_OUT2);
|
||||||
CAMU_StartCapture(PORT_BOTH);
|
CAMU_StartCapture(PORT_BOTH);
|
||||||
}
|
}
|
||||||
|
if (kDown & KEY_R)
|
||||||
|
{
|
||||||
|
exit_qr();
|
||||||
|
qr_mode = false;
|
||||||
|
}
|
||||||
|
free(buf);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Putting this in camera because I'm too lazy to make a network.c
|
Putting this in camera because I'm too lazy to make a network.c
|
||||||
|
|||||||
@@ -109,8 +109,8 @@ void throw_error(char* error, int error_type) {
|
|||||||
hidScanInput();
|
hidScanInput();
|
||||||
u32 kDown = hidKeysDown();
|
u32 kDown = hidKeysDown();
|
||||||
draw_base_interface();
|
draw_base_interface();
|
||||||
pp2d_draw_text(70, 120, 0.8, 0.8, COLOR_RED, error);
|
pp2d_draw_text_center(GFX_TOP, 120, 0.6, 0.6, COLOR_RED, error);
|
||||||
pp2d_draw_wtext(70, 150, 0.8, 0.8, COLOR_WHITE, L"Press \uE000 to shut down.");
|
pp2d_draw_wtext_center(GFX_TOP, 150, 0.6, 0.6, COLOR_WHITE, L"Press \uE000 to shut down.");
|
||||||
pp2d_end_draw();
|
pp2d_end_draw();
|
||||||
if (kDown & KEY_A) {
|
if (kDown & KEY_A) {
|
||||||
if (homebrew)
|
if (homebrew)
|
||||||
@@ -126,8 +126,8 @@ void throw_error(char* error, int error_type) {
|
|||||||
hidScanInput();
|
hidScanInput();
|
||||||
u32 kDown = hidKeysDown();
|
u32 kDown = hidKeysDown();
|
||||||
draw_base_interface();
|
draw_base_interface();
|
||||||
pp2d_draw_text(70, 120, 0.8, 0.8, COLOR_YELLOW, error);
|
pp2d_draw_text_center(GFX_TOP, 120, 0.6, 0.6, COLOR_YELLOW, error);
|
||||||
pp2d_draw_wtext(70, 150, 0.8, 0.8, COLOR_WHITE, L"Press \uE000 to continue.");
|
pp2d_draw_wtext_center(GFX_TOP, 150, 0.6, 0.6, COLOR_WHITE, L"Press \uE000 to continue.");
|
||||||
pp2d_end_draw();
|
pp2d_end_draw();
|
||||||
if (kDown & KEY_A) break;
|
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)
|
if (themes_list == NULL)
|
||||||
{
|
{
|
||||||
pp2d_begin_draw(GFX_TOP);
|
draw_base_interface();
|
||||||
pp2d_draw_text_center(GFX_TOP, 100, 1, 1, COLOR_WHITE, "NO THEMES FOUND");
|
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();
|
pp2d_end_draw();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -282,8 +284,10 @@ void draw_splash_interface(Splash_s *splashes_list, int splash_count, int select
|
|||||||
{
|
{
|
||||||
if (splashes_list == NULL)
|
if (splashes_list == NULL)
|
||||||
{
|
{
|
||||||
pp2d_begin_draw(GFX_TOP);
|
draw_base_interface();
|
||||||
pp2d_draw_text_center(GFX_TOP, 100, 1, 1, COLOR_WHITE, "NO SPLASHES FOUND");
|
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();
|
pp2d_end_draw();
|
||||||
return;
|
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, 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, 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);
|
pp2d_draw_on(GFX_BOTTOM);
|
||||||
for (int i = 0; i < splash_count; i++) {
|
for (int i = 0; i < splash_count; i++) {
|
||||||
if (splash_count <= THEMES_PER_SCREEN)
|
if (splash_count <= THEMES_PER_SCREEN)
|
||||||
|
|||||||
@@ -68,9 +68,13 @@ Result open_archives(void)
|
|||||||
archive2 = 0x00;
|
archive2 = 0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
retValue = FSUSER_OpenArchive(&ArchiveSD, ARCHIVE_SDMC, fsMakePath(PATH_EMPTY, ""));
|
retValue = FSUSER_OpenArchive(&ArchiveSD, ARCHIVE_SDMC, fsMakePath(PATH_EMPTY, ""));
|
||||||
if(R_FAILED(retValue)) return retValue;
|
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};
|
u32 homeMenuPath[3] = {MEDIATYPE_SD, archive2, 0};
|
||||||
home.type = PATH_BINARY;
|
home.type = PATH_BINARY;
|
||||||
home.size = 0xC;
|
home.size = 0xC;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
#include "themes.h"
|
#include "themes.h"
|
||||||
#include "pp2d/pp2d/pp2d.h"
|
#include "pp2d/pp2d/pp2d.h"
|
||||||
|
#include "draw.h"
|
||||||
|
|
||||||
void load_splash_preview(Splash_s *splash)
|
void load_splash_preview(Splash_s *splash)
|
||||||
{
|
{
|
||||||
@@ -197,11 +198,13 @@ Result get_splashes(Splash_s** splashes_list, int *splash_count)
|
|||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void splash_delete()
|
void splash_delete()
|
||||||
{
|
{
|
||||||
remove("/luma/splash.bin");
|
remove("/luma/splash.bin");
|
||||||
remove("/luma/splashbottom.bin");
|
remove("/luma/splashbottom.bin");
|
||||||
}
|
}
|
||||||
|
|
||||||
void splash_install(Splash_s splash_to_install)
|
void splash_install(Splash_s splash_to_install)
|
||||||
{
|
{
|
||||||
char *screen_buf = NULL;
|
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);
|
size = zip_file_to_buf("splash.bin", splash_to_install.path, &screen_buf);
|
||||||
if (size)
|
if (size)
|
||||||
{
|
{
|
||||||
|
remake_file("/luma/splash.bin", ArchiveSD, sizeof(screen_buf));
|
||||||
buf_to_file(size, "/luma/splash.bin", ArchiveSD, screen_buf);
|
buf_to_file(size, "/luma/splash.bin", ArchiveSD, screen_buf);
|
||||||
free(screen_buf);
|
free(screen_buf);
|
||||||
screen_buf = NULL;
|
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);
|
size = zip_file_to_buf("splashbottom.bin", splash_to_install.path, &screen_buf);
|
||||||
if (size)
|
if (size)
|
||||||
{
|
{
|
||||||
|
remake_file("/luma/splashbottom.bin", ArchiveSD, sizeof(screen_buf));
|
||||||
buf_to_file(size, "/luma/splashbottom.bin", ArchiveSD, screen_buf);
|
buf_to_file(size, "/luma/splashbottom.bin", ArchiveSD, screen_buf);
|
||||||
free(screen_buf);
|
free(screen_buf);
|
||||||
screen_buf = NULL;
|
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);
|
size = file_to_buf(fsMakePath(PATH_UTF16, path), ArchiveSD, &screen_buf);
|
||||||
if (size)
|
if (size)
|
||||||
{
|
{
|
||||||
|
remake_file("/luma/splash.bin", ArchiveSD, sizeof(screen_buf));
|
||||||
buf_to_file(size, "/luma/splash.bin", ArchiveSD, screen_buf);
|
buf_to_file(size, "/luma/splash.bin", ArchiveSD, screen_buf);
|
||||||
free(screen_buf);
|
free(screen_buf);
|
||||||
screen_buf = NULL;
|
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);
|
size = file_to_buf(fsMakePath(PATH_UTF16, path), ArchiveSD, &screen_buf);
|
||||||
if (size)
|
if (size)
|
||||||
{
|
{
|
||||||
|
remake_file("/luma/splashbottom.bin", ArchiveSD, sizeof(screen_buf));
|
||||||
buf_to_file(size, "/luma/splashbottom.bin", ArchiveSD, screen_buf);
|
buf_to_file(size, "/luma/splashbottom.bin", ArchiveSD, screen_buf);
|
||||||
free(screen_buf);
|
free(screen_buf);
|
||||||
screen_buf = NULL;
|
screen_buf = NULL;
|
||||||
size = 0;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user