Major refactor; see details

* Broke the "prepare" methods up into smaller methods

* Removed the usage of linked lists and replaced them with arrays. Given
that themes won't be added/removed throughout the execution of the
program, we don't need to be able to dynamically add or remove elements
to the list. In addition, once you got to ~50 themes, it took about .2
seconds to iterate through the entire list, which, while it may not
sound like much, is a huge time sink when you're going through a list.
Being able to randomly access any element in the list at the same speed
is hugely beneficial. The downside to this is we need to keep track of
the number of themes/splashes at all times, and, for splashes, have to
do some weird type magic in order to properly iterate over it. However,
these negatives are outweighed by the speed improvements.
This commit is contained in:
2017-07-28 17:41:20 -04:00
parent eb74a8ba02
commit ac69ceda51
7 changed files with 120 additions and 104 deletions

View File

@@ -1,7 +1,6 @@
#pragma once
#include "minizip/unzip.h"
#include "linked_lists.h"
struct theme_data
{
@@ -24,9 +23,12 @@ FS_Archive ArchiveSD;
FS_Archive ArchiveHomeExt;
FS_Archive ArchiveThemeExt;
Result prepare_archives();
int get_number_entries(char*);
Result unzip_file(char*, FS_DirectoryEntry*, u16*);
Result prepareThemes(node*);
Result unzip_themes();
Result prepare_themes(theme_data**);
Result themeInstall(theme_data);
Result shuffle_install(node*);
Result shuffle_install(theme_data**, int);
Result closeThemeArchives();
Result parseSmdh(theme_data*, u16*);