16 Commits

Author SHA1 Message Date
9afbe22df7 Merge branch 'master' of github.com:3dsfug/Anemone3DS 2017-09-02 17:26:10 -04:00
448a9ceb8a Fix no-smdh case 2017-09-02 17:25:59 -04:00
Laine
25aa02008e Update README.md (#25)
* fix readme

* fix?

* fix?

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md
2017-09-02 15:59:55 -04:00
49e6c6f827 Add splash uninstall screen 2017-09-02 12:16:17 -04:00
365ae87477 Merge branch 'master' of github.com:3dsfug/Anemone3DS 2017-09-02 11:57:18 -04:00
f461b3b5b5 Remove GPIO error on reboot, change battery % indicator to battery graphics 2017-09-02 11:57:02 -04:00
Nils P
6ea3904682 Adding splash deletion feature (#24)
* Adding splash deletion feature

* Add Mention for deleting splashes
2017-09-02 11:45:56 -04:00
aac093f466 Resolved merge conflicts 2017-09-02 10:08:52 -04:00
9442afb608 Change stuff with MCUHWC, reboot functionality 2017-09-02 10:05:42 -04:00
Helloman892
91f54ff22e Start button functionality (#21)
* srvPublishToSubscriber

Pressing Start from the app now sends the user to the Power Off screen.

* *hax check

As per Sono, checks whether the current environment is *hax. If it isn't, it goes to the home screen; otherwise, it restarts the console.

* Bugfixes

This may work?

* Revert "Bugfixes"

This reverts commit 7c382d719a.
2017-09-02 10:05:18 -04:00
pokecraft98
aa593c61a6 Added invite to theme plaza discord (#23) 2017-09-02 10:05:10 -04:00
Nils P
2a8e3176a8 Readme Overhaul (#20)
* Readme Overhaul

* Linking to Project_CTR for makerom
2017-09-02 09:23:48 -04:00
thedax
c84f40cf57 3dstool isn't really needed for romfs generation. (#19) 2017-09-01 19:33:24 -04:00
Alex Taber
45cbf0761b Add dependencies 2017-09-01 15:07:27 -04:00
8c7c409bca Update pp2d 2017-09-01 12:51:47 -04:00
d9ddd68d2e Change to using the homebrew logo I guess 2017-09-01 12:51:25 -04:00
17 changed files with 92 additions and 68 deletions

View File

@@ -167,9 +167,9 @@ MAKEROM ?= makerom
MAKEROM_ARGS := -elf "$(OUTPUT).elf" -rsf "$(RSF_PATH)" -banner "$(BUILD)/banner.bnr" -icon "$(BUILD)/icon.icn" -DAPP_TITLE="$(APP_TITLE)" -DAPP_PRODUCT_CODE="$(PRODUCT_CODE)" -DAPP_UNIQUE_ID="$(UNIQUE_ID)" MAKEROM_ARGS := -elf "$(OUTPUT).elf" -rsf "$(RSF_PATH)" -banner "$(BUILD)/banner.bnr" -icon "$(BUILD)/icon.icn" -DAPP_TITLE="$(APP_TITLE)" -DAPP_PRODUCT_CODE="$(PRODUCT_CODE)" -DAPP_UNIQUE_ID="$(UNIQUE_ID)"
ifneq ($(strip $(ROMFS)),) #ifneq ($(strip $(ROMFS)),)
MAKEROM_ARGS += -romfs "$(BUILD)/romfs.bin" # MAKEROM_ARGS += -romfs "$(BUILD)/romfs.bin"
endif #endif
ifneq ($(strip $(LOGO)),) ifneq ($(strip $(LOGO)),)
MAKEROM_ARGS += -logo "$(LOGO)" MAKEROM_ARGS += -logo "$(LOGO)"
endif endif
@@ -178,7 +178,7 @@ ifeq ($(strip $(ROMFS)),)
$(OUTPUT).cia: $(OUTPUT).elf $(BUILD)/banner.bnr $(BUILD)/icon.icn $(OUTPUT).cia: $(OUTPUT).elf $(BUILD)/banner.bnr $(BUILD)/icon.icn
$(MAKEROM) -f cia -o "$@" -target t -exefslogo $(MAKEROM_ARGS) $(MAKEROM) -f cia -o "$@" -target t -exefslogo $(MAKEROM_ARGS)
else else
$(OUTPUT).cia: $(OUTPUT).elf $(BUILD)/romfs.bin $(BUILD)/banner.bnr $(BUILD)/icon.icn $(OUTPUT).cia: $(OUTPUT).elf $(BUILD)/banner.bnr $(BUILD)/icon.icn
$(MAKEROM) -f cia -o "$@" -target t -exefslogo $(MAKEROM_ARGS) $(MAKEROM) -f cia -o "$@" -target t -exefslogo $(MAKEROM_ARGS)
endif endif
@@ -204,11 +204,6 @@ $(BUILD)/icon.icn : $(APP_ICON)
$(BANNERTOOL) makesmdh -s "$(APP_TITLE)" -l "$(APP_DESCRIPTION)" -p "$(APP_AUTHOR)" -i "$(APP_ICON)" -f "$(ICON_FLAGS)" -o "$@" $(BANNERTOOL) makesmdh -s "$(APP_TITLE)" -l "$(APP_DESCRIPTION)" -p "$(APP_AUTHOR)" -i "$(APP_ICON)" -f "$(ICON_FLAGS)" -o "$@"
3DSTOOL ?= 3dstool
$(BUILD)/romfs.bin : $(ROMFS)
$(3DSTOOL) -ctf romfs "$@" --romfs-dir "$(ROMFS)"
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
else else

View File

@@ -1,27 +1,30 @@
# Anemone3DS ![# Anemone3DS](https://github.com/astronautlevel2/Anemone3DS/blob/master/meta/banner.png)
A Theme Manager for the Nintendo3DS, written in C
A Theme and Splashscreen Manager for the Nintendo3DS, written in C
# Dependencies # Dependencies
This depends on zlib. Get it from portlibs. * zlib, which can be retrieved from the [3ds_portlibs](https://github.com/devkitPro/3ds_portlibs)
* [makerom](https://github.com/profi200/Project_CTR) and [bannertool](https://github.com/Steveice10/buildtools), which can be retrieved from [SteveIce10's](https://github.com/Steveice10) buildtools repo. These must be added to your PATH.
* [pp2d](https://github.com/BernardoGiordano/pp2d), which is included in the repo if you do a git clone --recursive.
# License # License
This project is licensed under the GNU GPLv3. See LICENSE.md for details. Additional terms 7b and 7c apply to this project. This project is licensed under the GNU GPLv3. See LICENSE.md for details. Additional terms 7b and 7c apply to this project.
# Credits # Credits
The following people contributed to Anemone3DS in some way. Without these people, Anemone3DS wouldn't exist, or wouldn't be as good as it is: The following people contributed to Anemone3DS in some way. Without these people, Anemone3DS wouldn't exist, or wouldn't be as good as it is:
* Daedreth, who wrote the initial implementation of theme application code and SMDH parsing * [Daedreth](https://github.com/daedreth), who wrote the initial implementation of theme application code and SMDH parsing.
* LiquidFenrir, who refactored a lot of my messy GUI code and wrote the image preview from zip code, as well as the icon code * [LiquidFenrir](https://github.com/LiquidFenrir), who refactored a lot of my messy GUI code and wrote the image preview from zip code, as well as the icon code.
* Sono, who wrote the BCSTM playback code * [Sono](https://github.com/MarcuzD), who wrote the BCSTM playback code.
* Kenn (mattkenster) for designing the GUI, a number of sprites used in the application, and drawing the banner and icon. * [Kenn (mattkenster)](https://github.com/mattkenster), for designing the GUI, a number of sprites used in the application, and drawing the banner and icon.
Special thanks go to these people who, while not directly contributing, helped immensely: Special thanks go to these people who, while not directly contributing, helped immensely:
* Rinnegatamante, whose code served as reference on theme installation. * [Rinnegatamante](https://github.com/Rinnegatamante), whose code served as reference on theme installation.
* BernardoGiordano for making pp2d, and being super responsive to feature requests and just general help * [BernardoGiordano](https://github.com/BernardoGiordano) for making pp2d, and being super responsive to feature requests and just general help
* yellows8 for his home menu extdump tool, which was invaluable in debugging. * [yellows8](https://github.com/yellows8) for his home menu extdump tool, which was invaluable in debugging.
* the folks on #dev of Nintendo Homebrew, who helped with unicode shenanigans (especially Stary2001, Fenrir, and DanielKO). * the folks on #dev of Nintendo Homebrew, who helped with unicode shenanigans (especially [Stary2001](https://github.com/Stary2001), [Fenrir](https://github.com/FenrirWolf), and DanielKO).
* the maintainers for all used libraries, including ctrulib, zlib, citro3d, pp2d and minizip. * the maintainers for all used libraries, including ctrulib, zlib, citro3d, pp2d and minizip.
* all the people who helped keep me going and motivated me to work. This includes, but is definitely not limited to: * all the people who helped keep me going and motivated me to work. This includes, but is definitely not limited to:
* The members of the Nintendo Homebrew Discord
* The members of the Secret Shack Service Discord + The members of the [Nintendo Homebrew Discord](https://discord.gg/C29hYvh)
* The members of the ThemePlaza Discord + The members of the __Secret Shack Service Discord__
+ The members of the [ThemePlaza Discord](https://discord.gg/2hUQwXz)

View File

@@ -35,9 +35,11 @@
#define THEMES_PATH "/Themes/" #define THEMES_PATH "/Themes/"
#define SPLASHES_PATH "/Splashes/" #define SPLASHES_PATH "/Splashes/"
#define SINGLE_INSTALL 0 #define SINGLE_INSTALL 0
#define SHUFFLE_INSTALL 1 #define SHUFFLE_INSTALL 1
#define BGM_INSTALL 2 #define BGM_INSTALL 2
#define UNINSTALL 3
static const int THEMES_PER_SCREEN = 4; static const int THEMES_PER_SCREEN = 4;
@@ -45,6 +47,12 @@ enum TextureID {
TEXTURE_FONT_RESERVED = 0, //used by pp2d for the font TEXTURE_FONT_RESERVED = 0, //used by pp2d for the font
TEXTURE_ARROW, TEXTURE_ARROW,
TEXTURE_SHUFFLE, TEXTURE_SHUFFLE,
TEXTURE_BATTERY_1,
TEXTURE_BATTERY_2,
TEXTURE_BATTERY_3,
TEXTURE_BATTERY_4,
TEXTURE_BATTERY_5,
TEXTURE_BATTERY_CHARGE,
TEXTURE_PREVIEW, TEXTURE_PREVIEW,
}; };

View File

@@ -35,7 +35,7 @@ void exit_screens(void);
void draw_theme_install(int install_type); void draw_theme_install(int install_type);
void draw_theme_interface(Theme_s * themes_list, int theme_count, int selected_theme, bool preview_mode); void draw_theme_interface(Theme_s * themes_list, int theme_count, int selected_theme, bool preview_mode);
void draw_splash_install(void); void draw_splash_install(int install_type);
void draw_splash_interface(Splash_s *splashes_list, int splash_count, int selected_splash, bool preview_mode); void draw_splash_interface(Splash_s *splashes_list, int splash_count, int selected_splash, bool preview_mode);
#endif #endif

View File

@@ -37,5 +37,5 @@ typedef struct{
Result get_splashes(Splash_s** splashes_list, int *splash_count); Result get_splashes(Splash_s** splashes_list, int *splash_count);
void splash_install(Splash_s splash_to_install); void splash_install(Splash_s splash_to_install);
void splash_delete();
#endif #endif

View File

@@ -3,7 +3,7 @@ BasicInfo:
CompanyCode : "00" CompanyCode : "00"
ProductCode : "CTR-P-ANEM" ProductCode : "CTR-P-ANEM"
ContentType : Application ContentType : Application
Logo : Nintendo # Nintendo / Licensed / Distributed / iQue / iQueForSystem Logo : Homebrew # Nintendo / Licensed / Distributed / iQue / iQueForSystem
TitleInfo: TitleInfo:
UniqueId : 0xAFEN UniqueId : 0xAFEN
@@ -33,6 +33,9 @@ SystemControlInfo:
RemasterVersion: 7 RemasterVersion: 7
StackSize: 0x40000 StackSize: 0x40000
RomFs:
RootPath : romfs
# DO NOT EDIT BELOW HERE OR PROGRAMS WILL NOT LAUNCH (most likely) # DO NOT EDIT BELOW HERE OR PROGRAMS WILL NOT LAUNCH (most likely)
AccessControlInfo: AccessControlInfo:

BIN
romfs/battery1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 610 B

BIN
romfs/battery2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

BIN
romfs/battery3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

BIN
romfs/battery4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

BIN
romfs/battery5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

BIN
romfs/charging.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 800 B

View File

@@ -47,6 +47,12 @@ void init_screens(void)
pp2d_load_texture_png(TEXTURE_ARROW, "romfs:/arrow.png"); pp2d_load_texture_png(TEXTURE_ARROW, "romfs:/arrow.png");
pp2d_load_texture_png(TEXTURE_SHUFFLE, "romfs:/shuffle.png"); pp2d_load_texture_png(TEXTURE_SHUFFLE, "romfs:/shuffle.png");
pp2d_load_texture_png(TEXTURE_BATTERY_1, "romfs:/battery1.png");
pp2d_load_texture_png(TEXTURE_BATTERY_2, "romfs:/battery2.png");
pp2d_load_texture_png(TEXTURE_BATTERY_3, "romfs:/battery3.png");
pp2d_load_texture_png(TEXTURE_BATTERY_4, "romfs:/battery4.png");
pp2d_load_texture_png(TEXTURE_BATTERY_5, "romfs:/battery5.png");
pp2d_load_texture_png(TEXTURE_BATTERY_CHARGE, "romfs:/charging.png");
} }
void exit_screens(void) void exit_screens(void)
@@ -54,21 +60,6 @@ void exit_screens(void)
pp2d_exit(); pp2d_exit();
} }
static Result MCUHWC_GetBatteryLevel(u8 *out) // Code taken from daedreth's fork of lpp-3ds
{
#define TRY(expr) if(R_FAILED(res = (expr))) { svcCloseHandle(mcuhwcHandle); return res; }
Result res;
Handle mcuhwcHandle;
TRY(srvGetServiceHandle(&mcuhwcHandle, "mcu::HWC"));
u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = 0x50000;
TRY(svcSendSyncRequest(mcuhwcHandle));
*out = (u8) cmdbuf[2];
svcCloseHandle(mcuhwcHandle);
return cmdbuf[1];
#undef TRY
}
static int theme_vertical_scroll = 0; static int theme_vertical_scroll = 0;
static int splash_vertical_scroll = 0; static int splash_vertical_scroll = 0;
@@ -84,9 +75,14 @@ void draw_base_interface(void)
pp2d_draw_text(28, 2, 0.6, 0.6, COLOR_WHITE, (tm.tm_sec % 2 == 1) ? ":" : " "); pp2d_draw_text(28, 2, 0.6, 0.6, COLOR_WHITE, (tm.tm_sec % 2 == 1) ? ":" : " ");
pp2d_draw_textf(34, 2, 0.6, 0.6, COLOR_WHITE, "%.2i", tm.tm_min); pp2d_draw_textf(34, 2, 0.6, 0.6, COLOR_WHITE, "%.2i", tm.tm_min);
u8 battery_val = 0; u8 battery_charging;
MCUHWC_GetBatteryLevel(&battery_val); PTMU_GetBatteryChargeState(&battery_charging);
pp2d_draw_textf(350, 2, 0.6, 0.6, COLOR_WHITE, "%i%%", battery_val); u8 battery_status;
PTMU_GetBatteryLevel(&battery_status);
pp2d_draw_texture(2 + battery_status, 357, 2);
if (battery_charging)
pp2d_draw_texture(TEXTURE_BATTERY_CHARGE, 357, 2);
pp2d_draw_on(GFX_BOTTOM); pp2d_draw_on(GFX_BOTTOM);
pp2d_draw_rectangle(0, 0, 320, 24, COLOR_ACCENT); pp2d_draw_rectangle(0, 0, 320, 24, COLOR_ACCENT);
@@ -213,10 +209,20 @@ void draw_theme_interface(Theme_s * themes_list, int theme_count, int selected_t
pp2d_end_draw(); pp2d_end_draw();
} }
void draw_splash_install(void) void draw_splash_install(int install_type)
{ {
draw_base_interface(); draw_base_interface();
switch (install_type)
{
case SINGLE_INSTALL:
pp2d_draw_textf(20, 30, 0.7, 0.7, COLOR_WHITE, "Installing a splash..."); pp2d_draw_textf(20, 30, 0.7, 0.7, COLOR_WHITE, "Installing a splash...");
break;
case UNINSTALL:
pp2d_draw_textf(20, 30, 0.7, 0.7, COLOR_WHITE, "Uninstalling a splash...");
break;
default:
break;
}
pp2d_end_draw(); pp2d_end_draw();
} }
@@ -239,8 +245,8 @@ void draw_splash_interface(Splash_s *splashes_list, int splash_count, int select
draw_base_interface(); draw_base_interface();
pp2d_draw_text_center(GFX_TOP, 4, 0.5, 0.5, COLOR_WHITE, "Splash mode"); pp2d_draw_text_center(GFX_TOP, 4, 0.5, 0.5, COLOR_WHITE, "Splash mode");
pp2d_draw_wtext_center(GFX_TOP, 210, 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_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)

View File

@@ -28,12 +28,13 @@
#include "themes.h" #include "themes.h"
#include "splashes.h" #include "splashes.h"
#include "draw.h" #include "draw.h"
#include "common.h"
int init_services(void) int init_services(void)
{ {
cfguInit(); cfguInit();
ptmuInit();
open_archives(); open_archives();
ptmSysmInit();
return 0; return 0;
} }
@@ -41,6 +42,7 @@ int exit_services(void)
{ {
close_archives(); close_archives();
cfguExit(); cfguExit();
ptmuExit();
return 0; return 0;
} }
@@ -49,7 +51,6 @@ int main(void)
init_services(); init_services();
init_screens(); init_screens();
int theme_count = 0; int theme_count = 0;
Theme_s * themes_list = NULL; Theme_s * themes_list = NULL;
Result res = get_themes(&themes_list, &theme_count); Result res = get_themes(&themes_list, &theme_count);
@@ -86,10 +87,7 @@ int main(void)
if (kDown & KEY_START) if (kDown & KEY_START)
{ {
exit_screens(); APT_HardwareResetAsync();
exit_services();
PTMSYSM_RebootAsync(0);
ptmSysmExit();
} }
else if (kDown & KEY_L) else if (kDown & KEY_L)
{ {
@@ -125,14 +123,19 @@ int main(void)
// Actions // Actions
else if (kDown & KEY_X) else if (kDown & KEY_X)
{ {
if (splash_mode) {
draw_splash_install(UNINSTALL);
splash_delete();
} else {
draw_theme_install(BGM_INSTALL); draw_theme_install(BGM_INSTALL);
bgm_install(*current_theme); bgm_install(*current_theme);
} }
}
else if (kDown & KEY_A) else if (kDown & KEY_A)
{ {
if (splash_mode) if (splash_mode)
{ {
draw_splash_install(); draw_splash_install(SINGLE_INSTALL);
splash_install(*current_splash); splash_install(*current_splash);
svcSleepThread(5e8); svcSleepThread(5e8);
} else { } else {
@@ -232,8 +235,4 @@ int main(void)
previously_selected = selected_theme; previously_selected = selected_theme;
} }
} }
free(themes_list);
return 0;
} }

View File

@@ -86,7 +86,11 @@ Result get_splashes(Splash_s** splashes_list, int *splash_count)
return res; return res;
} }
void splash_delete()
{
remove("/luma/splash.bin");
remove("/luma/splashbottom.bin");
}
void splash_install(Splash_s splash_to_install) void splash_install(Splash_s splash_to_install)
{ {
char *screen_buf; char *screen_buf;

View File

@@ -87,7 +87,7 @@ void load_theme_preview(Theme_s *theme)
free(preview_buffer); free(preview_buffer);
} }
static void parse_smdh(Theme_s *theme, ssize_t textureID) static void parse_smdh(Theme_s *theme, ssize_t textureID, u16 *dir_name)
{ {
char *info_buffer = NULL; char *info_buffer = NULL;
u64 size = 0; u64 size = 0;
@@ -105,6 +105,12 @@ static void parse_smdh(Theme_s *theme, ssize_t textureID)
if (!size) if (!size)
{ {
free(info_buffer); free(info_buffer);
memset(theme->name, 0, 0x80);
memset(theme->desc, 0, 0x100);
memset(theme->author, 0, 0x80);
memcpy(theme->name, dir_name, 0x80);
utf8_to_utf16(theme->desc, (u8*)"No description", 0x100);
utf8_to_utf16(theme->author, (u8*)"Unknown author", 0x80);
return; return;
} }
@@ -181,7 +187,7 @@ Result get_themes(Theme_s **themes_list, int *theme_count)
current_theme->is_zip = !strcmp(entry.shortExt, "ZIP"); current_theme->is_zip = !strcmp(entry.shortExt, "ZIP");
ssize_t iconID = TEXTURE_PREVIEW + *theme_count; ssize_t iconID = TEXTURE_PREVIEW + *theme_count;
parse_smdh(current_theme, iconID); parse_smdh(current_theme, iconID, entry.name);
} }
FSDIR_Close(dir_handle); FSDIR_Close(dir_handle);