Changelog: - re-enable use in release build. - remove ftpsrv and untitled from builtin ghdl options, as both packages are available in the appstore. - add image viewer (png, jpg, bmp) - add music player (bfstm, bfwav, mp3, wav, ogg) - add idv3 tag parsing support for mp3. - add "decyption" of GTA Vice City mp3. - add usbdvd support for music playback and file browsing. - add nsz export support (solid, block, ldm). - add xcz export support (same as above). - add nro fs proper mount support (romfs, nacp, icon). - add program nca fs support. - add bfsar fs support. - re-write the usb protocol, still wip. replaces tinfoil protocol. - all threads are now create with pre-emptive support with the proper affinity mask set. - fix oob crash in libpulsar when a bfwav was opened that had more than 2 channels. - bump yyjson version. - bump usbhsfs version. - disable nvjpg. - add support for theme music of any supported playback type (bfstm, bfwav, mp3, wav, ogg). - add support for setting background music. - add async exit to blocking threads (download, nxlink, ftpsrv) to reduce exit time. - add support for dumping to pc via usb. - add null, deflate, zstd hash options, mainly used for benchmarking. - add sidebar slider (currently unused). - file_viwer can now be used with any filesystem. - filebrowser will only ever stat file once. previously it would keep stat'ing until it succeeded. - disabled themezer due to the api breaking and i am not willing to keep maintaining it. - disable zlt handling in usbds as it's not needed for my api's because the size is always known. - remove usbds enums and GetSpeed() as i pr'd it to libnx. - added support for mounting nca's from any source, including files, memory, nsps, xcis etc. - split the lru cache into it's own header as it's now used in multiple places (nsz, all mounted options). - add support for fetching and decrypting es personalised tickets. - fix es common ticket converting where i forgot to also convert the cert chain as well. - remove the download default music option. - improve performance of libpulsar when opening a bfsar by remove the large setvbuf option. instead, use the default 1k buffer and handle large buffers manually in sphaira by using a lru cache (todo: just write my own bfsar parser). - during app init and exit, load times have been halved as i now load/exit async. timestamps have also been added to measure how long everything takes. - download now async loads / exits the etag json file to improve init times. - add custom zip io to dumper to support writing a zip to any dest (such as usb). - dumper now returns a proper error if the transfer was cancelled by the user. - fatfs mount now sets the timestamp for files. - fatfs mount handles folders with the archive bit by reporting them as a file. - ftpsrv config is async loaded to speed up load times. - nxlink now tries attempt to connect/accept by handling blocking rather than just bailing out. - added support for minini floats. - thread_file_transfer now spawns 3 threads rather than 2, to have the middle thread be a optional processor (mainly used for compressing/decompressing). - added spinner to progress box, taken from nvg demo. - progress box disables sleep mode on init. - add gamecard detection to game menu to detect a refresh. - handle xci that have the key area prepended. - change gamecard mount fs to use the xci mount code instead of native fs, that way we can see all the partitions rather than just secure. - reformat the ghdl entries to show the timestamp first. - support for exporting saves to pc via usb. - zip fs now uses lru cache.
180 lines
3.6 KiB
C++
180 lines
3.6 KiB
C++
#if 0
|
|
#pragma once
|
|
|
|
#include "ui/menus/menu_base.hpp"
|
|
#include "ui/scrollable_text.hpp"
|
|
#include "ui/scrolling_text.hpp"
|
|
#include "ui/list.hpp"
|
|
#include "option.hpp"
|
|
#include <span>
|
|
|
|
namespace sphaira::ui::menu::themezer {
|
|
|
|
enum class ImageDownloadState {
|
|
None, // not started
|
|
Progress, // Download started
|
|
Done, // finished downloading
|
|
Failed, // attempted to download but failed
|
|
};
|
|
|
|
struct LazyImage {
|
|
~LazyImage();
|
|
int image{};
|
|
int w{}, h{};
|
|
bool tried_cache{};
|
|
bool cached{};
|
|
ImageDownloadState state{ImageDownloadState::None};
|
|
};
|
|
|
|
enum MenuState {
|
|
MenuState_Normal,
|
|
MenuState_Search,
|
|
MenuState_Creator,
|
|
};
|
|
|
|
enum ListType {
|
|
ListType_Pack, // list complete packs
|
|
ListType_Target, // list types
|
|
};
|
|
|
|
enum class PageLoadState {
|
|
None,
|
|
Loading,
|
|
Done,
|
|
Error,
|
|
};
|
|
|
|
struct Creator {
|
|
std::string id{};
|
|
std::string display_name{};
|
|
};
|
|
|
|
struct Details {
|
|
std::string name{};
|
|
};
|
|
|
|
struct Preview {
|
|
std::string thumb{};
|
|
LazyImage lazy_image{};
|
|
};
|
|
|
|
struct DownloadPack {
|
|
std::string filename{};
|
|
std::string url{};
|
|
std::string mimetype{};
|
|
};
|
|
|
|
using DownloadTheme = DownloadPack;
|
|
|
|
struct ThemeEntry {
|
|
std::string id{};
|
|
Preview preview{};
|
|
};
|
|
|
|
struct PackListEntry {
|
|
std::string id{};
|
|
Creator creator{};
|
|
Details details{};
|
|
std::vector<ThemeEntry> themes{};
|
|
};
|
|
|
|
struct Pagination {
|
|
u64 page{};
|
|
u64 limit{};
|
|
u64 page_count{};
|
|
u64 item_count{};
|
|
};
|
|
|
|
struct PackList {
|
|
std::vector<PackListEntry> packList{};
|
|
Pagination pagination{};
|
|
};
|
|
|
|
struct Config {
|
|
// these index into a string array
|
|
u32 target_index{};
|
|
u32 sort_index{};
|
|
u32 order_index{};
|
|
// search query, if empty, its not used
|
|
std::string query{};
|
|
// this is actually an array of creator ids, but we don't support that feature
|
|
// if empty, its not used
|
|
std::string creator{};
|
|
// defaults
|
|
u32 page{1};
|
|
u32 limit{18};
|
|
bool nsfw{false};
|
|
|
|
void SetQuery(const std::string& new_query) {
|
|
query = new_query;
|
|
}
|
|
|
|
void RemoveQuery() {
|
|
query.clear();
|
|
}
|
|
|
|
void SetCreator(const Creator& new_creator) {
|
|
creator = new_creator.id;
|
|
}
|
|
|
|
void RemoveCreator() {
|
|
creator.clear();
|
|
}
|
|
};
|
|
|
|
struct Menu; // fwd
|
|
|
|
struct PageEntry {
|
|
std::vector<PackListEntry> m_packList{};
|
|
Pagination m_pagination{};
|
|
PageLoadState m_ready{PageLoadState::None};
|
|
};
|
|
|
|
struct Menu final : MenuBase {
|
|
Menu(u32 flags);
|
|
~Menu();
|
|
|
|
auto GetShortTitle() const -> const char* override { return "Themezer"; };
|
|
void Update(Controller* controller, TouchInfo* touch) override;
|
|
void Draw(NVGcontext* vg, Theme* theme) override;
|
|
void OnFocusGained() override;
|
|
|
|
private:
|
|
void SetIndex(s64 index) {
|
|
m_index = index;
|
|
if (!m_index) {
|
|
m_list->SetYoff(0);
|
|
}
|
|
}
|
|
|
|
void InvalidateAllPages();
|
|
void PackListDownload();
|
|
void DisplayOptions();
|
|
|
|
private:
|
|
static constexpr inline const char* INI_SECTION = "themezer";
|
|
static constexpr inline u32 MAX_ON_PAGE = 16; // same as website
|
|
|
|
std::vector<PageEntry> m_pages{};
|
|
s64 m_page_index{};
|
|
s64 m_page_index_max{1};
|
|
|
|
std::string m_search{};
|
|
|
|
s64 m_index{}; // where i am in the array
|
|
std::unique_ptr<List> m_list{};
|
|
|
|
ScrollingText m_scroll_name{};
|
|
ScrollingText m_scroll_author{};
|
|
|
|
// options
|
|
option::OptionLong m_sort{INI_SECTION, "sort", 0};
|
|
option::OptionLong m_order{INI_SECTION, "order", 0};
|
|
option::OptionBool m_nsfw{INI_SECTION, "nsfw", false};
|
|
|
|
bool m_checked_for_nro{};
|
|
};
|
|
|
|
} // namespace sphaira::ui::menu::themezer
|
|
#endif
|