14 Commits

Author SHA1 Message Date
24810a48ad Make sure that the buffer text is copied into is properly null-terminated 2017-09-29 21:56:44 -04:00
Dylan G
5d2119344a Getting ever closer to fixing the SMDH bug 2017-09-30 02:10:33 +01:00
Dylan G
492ea13ef6 Fixing a bad fix of mine '_>' 2017-09-30 02:00:00 +01:00
Helloman892
f99f744000 fixed theme extdata corruption when installing shuffle themes after
scanning a qr code
2017-09-16 17:48:47 +01:00
4fb10029bb Merge branch 'master' of github.com:3dsfug/Anemone3DS 2017-09-11 09:49:03 -04:00
7644974705 Add check for WiFi when scanning with QR code 2017-09-11 09:48:52 -04:00
Dylan G
b7379af2f3 added trello link 2017-09-10 14:57:26 +01:00
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
9 changed files with 86 additions and 28 deletions

View File

@@ -1,6 +1,7 @@
![# Anemone3DS](https://github.com/astronautlevel2/Anemone3DS/blob/master/meta/banner.png)
A Theme and Splashscreen Manager for the Nintendo3DS, written in C.
A Theme and Splashscreen Manager for the Nintendo 3DS, written in C.\
To-do list here: https://trello.com/b/F1YSa1VK
# Dependencies
* zlib, which can be retrieved from the [3ds_portlibs](https://github.com/devkitPro/3ds_portlibs).

View File

@@ -48,6 +48,7 @@ static const int THEMES_PER_SCREEN = 4;
bool homebrew;
bool splash_mode;
int shuffle_theme_count;
enum TextureID {
TEXTURE_FONT_RESERVED = 0, //used by pp2d for the font

View File

@@ -30,9 +30,9 @@
#include "common.h"
typedef struct {
u16 name[0x40];
u16 desc[0x80];
u16 author[0x40];
u16 name[0x41];
u16 desc[0x81];
u16 author[0x41];
u32 placeholder_color;
ssize_t icon_id;

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);
scan_qr(buf);
hidScanInput();
u32 kDown = hidKeysDown();
if (kDown & KEY_L)
{
CAMU_StopCapture(PORT_BOTH);
CAMU_Activate(SELECT_NONE);
scan_qr(buf);
CAMU_Activate(SELECT_OUT1_OUT2);
CAMU_StartCapture(PORT_BOTH);
}
if (kDown & KEY_R)
{
exit_qr();
qr_mode = false;
}
free(buf);
CAMU_Activate(SELECT_OUT1_OUT2);
CAMU_StartCapture(PORT_BOTH);
}
/*

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;
}
@@ -185,15 +187,15 @@ void draw_theme_interface(Theme_s * themes_list, int theme_count, int selected_t
{
draw_base_interface();
pp2d_draw_text_center(GFX_TOP, 4, 0.5, 0.5, COLOR_WHITE, "Theme mode");
wchar_t title[0x40] = {0};
wchar_t title[0x41] = {0};
utf16_to_utf32((u32*)title, current_theme.name, 0x40);
pp2d_draw_wtext_wrap(20, 30, 0.7, 0.7, COLOR_WHITE, 380, title);
wchar_t author[0x40] = {0};
wchar_t author[0x41] = {0};
utf16_to_utf32((u32*)author, current_theme.author, 0x40);
pp2d_draw_text(20, 50, 0.5, 0.5, COLOR_WHITE, "By: ");
pp2d_draw_wtext_wrap(44, 50, 0.5, 0.5, COLOR_WHITE, 380, author);
wchar_t description[0xa6] = {0};
utf16_to_utf32((u32*)description, current_theme.desc, 0xb0);
wchar_t description[0x81] = {0};
utf16_to_utf32((u32*)description, current_theme.desc, 0x80);
pp2d_draw_wtext_wrap(20, 65, 0.5, 0.5, COLOR_WHITE, 363, description);
pp2d_draw_wtext(20, 150, 0.6, 0.6, COLOR_WHITE, L"\uE046 Install Shuffle Theme");
@@ -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

@@ -39,6 +39,7 @@ int init_services(void)
{
cfguInit();
ptmuInit();
acInit();
httpcInit(0);
archive_result = open_archives();
homebrew = true;
@@ -62,6 +63,7 @@ int exit_services(void)
cfguExit();
ptmuExit();
httpcExit();
acExit();
return 0;
}
@@ -94,7 +96,7 @@ int main(void)
int selected_splash = 0;
int selected_theme = 0;
int previously_selected = 0;
int shuffle_theme_count = 0;
shuffle_theme_count = 0;
bool preview_mode = false;
while(aptMainLoop())
@@ -137,10 +139,18 @@ int main(void)
if (preview_mode) {
continue;
} else {
qr_mode = !qr_mode;
if (qr_mode) init_qr();
else exit_qr();
continue;
u32 out;
ACU_GetWifiStatus(&out);
if (out)
{
qr_mode = !qr_mode;
if (qr_mode) init_qr();
else exit_qr();
continue;
} else {
throw_error("Please connect to Wi-Fi before scanning QR", WARNING);
continue;
}
}
}
@@ -200,7 +210,11 @@ int main(void)
draw_theme_install(SINGLE_INSTALL);
single_install(*current_theme);
}
//these two are here just so I don't forget how to implement them - HM
//these are here just so I don't forget how to implement them - HM
//if (current_theme->in_shuffle) {
// shuffle_theme_count--;
// current_theme->in_shuffle = false;
//}
//del_theme(current_theme->path);
//get_themes(&themes_list, &theme_count);
}

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);
}
}
}

View File

@@ -152,6 +152,7 @@ static void parse_smdh(Theme_s *theme, ssize_t textureID, u16 *dir_name)
Result get_themes(Theme_s **themes_list, int *theme_count)
{
shuffle_theme_count = 0;
Result res = 0;
Handle dir_handle;
res = FSUSER_OpenDirectory(&dir_handle, ArchiveSD, fsMakePath(PATH_ASCII, THEMES_PATH));