Added splash support (#2)

Combination of quality of life improvements, bugfixes and splash support:

* unzip_file now works with any file, not just a theme

* Made linked list nodes generic so they work for both splashes and themes

* Fixed bug in previous commit with deleting the zip file once it was unzipped

* All zips in /Splashes/ are now extracted, as with /Themes/

* Splashes are all added to the linked list properly

* Splashes can be installed given a path, but only works on Luma. Undecided as to whether or not I'm going to change this.

TODO:

* Automatically change the luma configuration to enable splash screens

* MAYBE add support for other CFWs (if there's an interest). Maybe set a folder to extract splashes to in some kind of user settings?
This commit is contained in:
Alex Taber
2017-07-21 20:49:17 -04:00
committed by GitHub
parent 217846bca4
commit 37aa9022e1
9 changed files with 212 additions and 46 deletions

View File

@@ -4,47 +4,45 @@
#include <string.h>
#include "theme.h"
#include "splashes.h"
#include "unicode.h"
int main(void)
{
gfxInitDefault();
cfguInit();
srvInit();
hidInit();
fsInit();
ptmSysmInit();
consoleInit(GFX_TOP, NULL);
gfxInitDefault();
cfguInit();
srvInit();
hidInit();
fsInit();
ptmSysmInit();
consoleInit(GFX_TOP, NULL);
while (aptMainLoop())
{
hidScanInput();
u32 kDown = hidKeysDown();
while (aptMainLoop())
{
hidScanInput();
u32 kDown = hidKeysDown();
if (kDown & KEY_A) {
node *first_node = malloc(sizeof(node));
first_node->data = NULL;
first_node->next = NULL;
prepareThemes(first_node);
node *current_node = first_node->next;
while (current_node != NULL)
{
printu(current_node->data->title);
current_node = current_node->next;
}
puts("Done!");
}
if (kDown & KEY_START)
{
closeThemeArchives();
PTMSYSM_ShutdownAsync(0);
ptmSysmExit();
}
gfxFlushBuffers();
gfxSwapBuffers();
gspWaitForVBlank();
}
if (kDown & KEY_A) {
node *theme_node = malloc(sizeof(node));
theme_node->data = NULL;
theme_node->next = NULL;
prepareThemes(theme_node);
node *splashes_node = malloc(sizeof(node));
splashes_node->data = NULL;
splashes_node->next = NULL;
prepare_splashes(splashes_node);
}
if (kDown & KEY_START)
{
closeThemeArchives();
PTMSYSM_ShutdownAsync(0);
ptmSysmExit();
}
gfxFlushBuffers();
gfxSwapBuffers();
gspWaitForVBlank();
}
gfxExit();
return 0;
gfxExit();
return 0;
}