diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e4ad965..df8cf5e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,7 @@ name: Build Universal-Updater on: push: - branches-ignore: [translation] + branches-ignore: [translation, full-rewrite] paths-ignore: - 'README.md' pull_request: diff --git a/.gitignore b/.gitignore index 30e611e..0183c25 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ *.lst .vscode/ipch *.DS_Store -3ds/romfs/gfx/*.t3x +romfs/gfx/*.t3x bannertool* makerom* @@ -19,4 +19,3 @@ makerom* *.nso *.nacp build/sprites.h -*.t3x diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..97d6069 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,59 @@ +{ + "files.associations": { + "*.tcc": "cpp", + "cctype": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "exception": "cpp", + "fstream": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "memory": "cpp", + "new": "cpp", + "ostream": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "typeinfo": "cpp", + "valarray": "cpp", + "array": "cpp", + "atomic": "cpp", + "bit": "cpp", + "cstdint": "cpp", + "deque": "cpp", + "forward_list": "cpp", + "map": "cpp", + "unordered_map": "cpp", + "vector": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "iterator": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "optional": "cpp", + "random": "cpp", + "string": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "initializer_list": "cpp", + "bitset": "cpp", + "chrono": "cpp", + "condition_variable": "cpp", + "ratio": "cpp", + "regex": "cpp", + "shared_mutex": "cpp" + } +} \ No newline at end of file diff --git a/Makefile b/Makefile index 2f1ed7b..3e7ce08 100644 --- a/Makefile +++ b/Makefile @@ -44,11 +44,13 @@ BANNERTOOL ?= bannertool endif +CURRENT_VERSION := $(shell git describe --abbrev=0 --tags) + # If on a tagged commit, use the tag instead of the commit ifneq ($(shell echo $(shell git tag -l --points-at HEAD) | head -c 1),) GIT_VER := $(shell git tag -l --points-at HEAD) else -GIT_VER := $(shell git rev-parse --short HEAD) +GIT_VER := $(shell git describe --abbrev=0 --tags)-$(shell git rev-parse --short HEAD) endif #--------------------------------------------------------------------------------- @@ -76,15 +78,16 @@ endif TARGET := Universal-Updater BUILD := build UNIVCORE := Universal-Core -SOURCES := $(UNIVCORE) source source/download source/gui source/lang source/overlays source/screens source/utils +SOURCES := $(UNIVCORE) source source/download source/gui source/lang source/overlays source/qr source/screens \ + source/store source/utils DATA := data -INCLUDES := $(UNIVCORE) include include/download include/gui include/lang include/overlays include/screens include/utils +INCLUDES := $(UNIVCORE) include include/download include/gui include/lang include/overlays include/qr include/screens \ + include/store include/utils GRAPHICS := assets/gfx -#GFXBUILD := $(BUILD) ROMFS := romfs GFXBUILD := $(ROMFS)/gfx APP_AUTHOR := Universal-Team -APP_DESCRIPTION := A multiapp, JSON script-based updater for Nintendo 3DS +APP_DESCRIPTION := A multiapp, JSON script-based updater for Nintendo 3DS ICON := app/icon.png BNR_IMAGE := app/banner.png BNR_AUDIO := app/BannerAudio.wav @@ -97,6 +100,7 @@ ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft CFLAGS := -g -Wall -Wno-psabi -O2 -mword-relocations \ -DV_STRING=\"$(GIT_VER)\" \ + -DC_V=\"$(CURRENT_VERSION)\" \ -fomit-frame-pointer -ffunction-sections \ $(ARCH) @@ -252,7 +256,7 @@ $(OUTPUT).cia : $(OUTPUT).elf $(OUTPUT).smdh $(BANNERTOOL) makesmdh -i "../app/icon.png" -s "$(TARGET)" -l "$(APP_DESCRIPTION)" -p "$(APP_AUTHOR)" -o "../app/icon.bin" - $(MAKEROM) -f cia -target t -exefslogo -o "../Universal-Updater.cia" -elf "../Universal-Updater.elf" -rsf "../app/build-cia.rsf" -banner "../app/banner.bin" -icon "../app/icon.bin" -logo "../app/logo.bcma.lz" -DAPP_ROMFS="$(TOPDIR)/$(ROMFS)" -major $(VERSION_MAJOR) -minor $(VERSION_MINOR) -micro $(VERSION_MICRO) -DAPP_VERSION_MAJOR="$(VERSION_MAJOR)" + $(MAKEROM) -f cia -target t -exefslogo -o "../$(TARGET).cia" -elf "../$(TARGET).elf" -rsf "../app/build-cia.rsf" -banner "../app/banner.bin" -icon "../app/icon.bin" -logo "../app/logo.bcma.lz" -DAPP_ROMFS="$(TOPDIR)/$(ROMFS)" -major $(VERSION_MAJOR) -minor $(VERSION_MINOR) -micro $(VERSION_MICRO) -DAPP_VERSION_MAJOR="$(VERSION_MAJOR)" #--------------------------------------------------------------------------------- # you need a rule like this for each extension you use as binary data #--------------------------------------------------------------------------------- diff --git a/README.md b/README.md index 97ad52d..a9e6cf9 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ To download the source you will need to clone it with submodules, this can be do ``` git clone --recursive https://github.com/Universal-Team/Universal-Updater.git ``` -or if you've already cloned it running +or if you've already cloned it running ``` git submodule update --init --recursive ``` @@ -52,12 +52,9 @@ Simply run `make` in the Universal-Updater source directory. Want to help to translate Universal-Updater? Then feel free to join us on Crowdin [here](https://crwd.in/universal-updater). Is it a new Language which isn't available in Universal-Updater? Then join our [Discord Server](https://discord.gg/KDJCfGF) and ask Evie to add the language to crowdin. -## Contributions +## Credits -[PabloMK7](https://github.com/mariohackandglitch): For improving the Download code. - -## Icon Credits - -Trash icon icon by Icons8 - -Menu icon icon by Icons8 +- [dlbeer](https://github.com/dlbeer) for [quirc](https://github.com/dlbeer/quirc) which i changed to C++. +- [FlagBrew](https://github.com/FlagBrew): For the QR Code Scanner code, which i reworked some bit. +- [Icons8](https://icons8.com/): For the icons. +- [PabloMK7](https://github.com/mariohackandglitch): For improving the Download code. \ No newline at end of file diff --git a/Universal-Core b/Universal-Core index d0d78f2..155058f 160000 --- a/Universal-Core +++ b/Universal-Core @@ -1 +1 @@ -Subproject commit d0d78f2bfbda1e37d1edd93fa9e3644860ed56d5 +Subproject commit 155058f9a14dd376fde8f49e9d5b8666bffc6dec diff --git a/assets/gfx/sprites.t3s b/assets/gfx/sprites.t3s index 7670a83..4e60d64 100644 --- a/assets/gfx/sprites.t3s +++ b/assets/gfx/sprites.t3s @@ -1,26 +1,20 @@ --atlas -f rgba -z auto -sprites/arrow.png -sprites/bottom_screen_bot.png -sprites/bottom_screen_top.png -sprites/button.png +sprites/add.png +sprites/checked.png sprites/delete.png -sprites/dev_by.png -sprites/download_all.png -sprites/dropdown.png +sprites/download.png +sprites/info.png sprites/noIcon.png -sprites/top_screen_bot.png -sprites/top_screen_top.png +sprites/qr_code.png sprites/search.png -sprites/selector.png -sprites/side_arrow.png -sprites/uniStore.png -sprites/uniStore_HD.png +sprites/settings.png +sprites/sort.png +sprites/sort_checked.png +sprites/sort_unchecked.png +sprites/unchecked.png sprites/universal-updater.png +sprites/universal-core.png sprites/update.png -sprites/updateStore.png -sprites/view.png - -sprites/credits/discord.png -sprites/credits/stackZ.png -sprites/credits/universal-core.png \ No newline at end of file +sprites/update_app.png +sprites/update_filter.png \ No newline at end of file diff --git a/assets/gfx/sprites/add.png b/assets/gfx/sprites/add.png new file mode 100644 index 0000000..b972fed Binary files /dev/null and b/assets/gfx/sprites/add.png differ diff --git a/assets/gfx/sprites/arrow.png b/assets/gfx/sprites/arrow.png deleted file mode 100644 index fa910f8..0000000 Binary files a/assets/gfx/sprites/arrow.png and /dev/null differ diff --git a/assets/gfx/sprites/bottom_screen_bot.png b/assets/gfx/sprites/bottom_screen_bot.png deleted file mode 100644 index 961ea84..0000000 Binary files a/assets/gfx/sprites/bottom_screen_bot.png and /dev/null differ diff --git a/assets/gfx/sprites/bottom_screen_top.png b/assets/gfx/sprites/bottom_screen_top.png deleted file mode 100644 index 1520b3b..0000000 Binary files a/assets/gfx/sprites/bottom_screen_top.png and /dev/null differ diff --git a/assets/gfx/sprites/button.png b/assets/gfx/sprites/button.png deleted file mode 100644 index d7e0c77..0000000 Binary files a/assets/gfx/sprites/button.png and /dev/null differ diff --git a/assets/gfx/sprites/checked.png b/assets/gfx/sprites/checked.png new file mode 100644 index 0000000..2c1e7c2 Binary files /dev/null and b/assets/gfx/sprites/checked.png differ diff --git a/assets/gfx/sprites/credits/discord.png b/assets/gfx/sprites/credits/discord.png deleted file mode 100644 index 5935bb8..0000000 Binary files a/assets/gfx/sprites/credits/discord.png and /dev/null differ diff --git a/assets/gfx/sprites/credits/stackZ.png b/assets/gfx/sprites/credits/stackZ.png deleted file mode 100644 index 310703c..0000000 Binary files a/assets/gfx/sprites/credits/stackZ.png and /dev/null differ diff --git a/assets/gfx/sprites/credits/universal-core.png b/assets/gfx/sprites/credits/universal-core.png deleted file mode 100644 index cd18734..0000000 Binary files a/assets/gfx/sprites/credits/universal-core.png and /dev/null differ diff --git a/assets/gfx/sprites/delete.png b/assets/gfx/sprites/delete.png index ad92fd9..2a163d1 100644 Binary files a/assets/gfx/sprites/delete.png and b/assets/gfx/sprites/delete.png differ diff --git a/assets/gfx/sprites/dev_by.png b/assets/gfx/sprites/dev_by.png deleted file mode 100644 index ace84f2..0000000 Binary files a/assets/gfx/sprites/dev_by.png and /dev/null differ diff --git a/assets/gfx/sprites/download.png b/assets/gfx/sprites/download.png new file mode 100644 index 0000000..e9e3168 Binary files /dev/null and b/assets/gfx/sprites/download.png differ diff --git a/assets/gfx/sprites/download_all.png b/assets/gfx/sprites/download_all.png deleted file mode 100644 index 8592c1e..0000000 Binary files a/assets/gfx/sprites/download_all.png and /dev/null differ diff --git a/assets/gfx/sprites/dropdown.png b/assets/gfx/sprites/dropdown.png deleted file mode 100644 index 23d54ce..0000000 Binary files a/assets/gfx/sprites/dropdown.png and /dev/null differ diff --git a/assets/gfx/sprites/info.png b/assets/gfx/sprites/info.png new file mode 100644 index 0000000..628f051 Binary files /dev/null and b/assets/gfx/sprites/info.png differ diff --git a/assets/gfx/sprites/noIcon.png b/assets/gfx/sprites/noIcon.png index 44c43dd..ff5d0f7 100644 Binary files a/assets/gfx/sprites/noIcon.png and b/assets/gfx/sprites/noIcon.png differ diff --git a/assets/gfx/sprites/qr_code.png b/assets/gfx/sprites/qr_code.png new file mode 100644 index 0000000..ea9ffe9 Binary files /dev/null and b/assets/gfx/sprites/qr_code.png differ diff --git a/assets/gfx/sprites/search.png b/assets/gfx/sprites/search.png index 6728de6..fc3252d 100644 Binary files a/assets/gfx/sprites/search.png and b/assets/gfx/sprites/search.png differ diff --git a/assets/gfx/sprites/selector.png b/assets/gfx/sprites/selector.png deleted file mode 100644 index 1cead37..0000000 Binary files a/assets/gfx/sprites/selector.png and /dev/null differ diff --git a/assets/gfx/sprites/settings.png b/assets/gfx/sprites/settings.png new file mode 100644 index 0000000..23c51b8 Binary files /dev/null and b/assets/gfx/sprites/settings.png differ diff --git a/assets/gfx/sprites/side_arrow.png b/assets/gfx/sprites/side_arrow.png deleted file mode 100644 index b9cc7e4..0000000 Binary files a/assets/gfx/sprites/side_arrow.png and /dev/null differ diff --git a/assets/gfx/sprites/sort.png b/assets/gfx/sprites/sort.png new file mode 100644 index 0000000..519d04e Binary files /dev/null and b/assets/gfx/sprites/sort.png differ diff --git a/assets/gfx/sprites/sort_checked.png b/assets/gfx/sprites/sort_checked.png new file mode 100644 index 0000000..bade0fa Binary files /dev/null and b/assets/gfx/sprites/sort_checked.png differ diff --git a/assets/gfx/sprites/sort_unchecked.png b/assets/gfx/sprites/sort_unchecked.png new file mode 100644 index 0000000..7785da4 Binary files /dev/null and b/assets/gfx/sprites/sort_unchecked.png differ diff --git a/assets/gfx/sprites/top_screen_bot.png b/assets/gfx/sprites/top_screen_bot.png deleted file mode 100644 index 1e0e3aa..0000000 Binary files a/assets/gfx/sprites/top_screen_bot.png and /dev/null differ diff --git a/assets/gfx/sprites/top_screen_top.png b/assets/gfx/sprites/top_screen_top.png deleted file mode 100644 index 7e917f9..0000000 Binary files a/assets/gfx/sprites/top_screen_top.png and /dev/null differ diff --git a/assets/gfx/sprites/unchecked.png b/assets/gfx/sprites/unchecked.png new file mode 100644 index 0000000..2c78fc7 Binary files /dev/null and b/assets/gfx/sprites/unchecked.png differ diff --git a/assets/gfx/sprites/uniStore.png b/assets/gfx/sprites/uniStore.png deleted file mode 100644 index 7a971ac..0000000 Binary files a/assets/gfx/sprites/uniStore.png and /dev/null differ diff --git a/assets/gfx/sprites/uniStore_HD.png b/assets/gfx/sprites/uniStore_HD.png deleted file mode 100644 index ad58417..0000000 Binary files a/assets/gfx/sprites/uniStore_HD.png and /dev/null differ diff --git a/assets/gfx/sprites/universal-core.png b/assets/gfx/sprites/universal-core.png new file mode 100644 index 0000000..2c46bae Binary files /dev/null and b/assets/gfx/sprites/universal-core.png differ diff --git a/assets/gfx/sprites/update.png b/assets/gfx/sprites/update.png index 05fc862..ca3c79a 100644 Binary files a/assets/gfx/sprites/update.png and b/assets/gfx/sprites/update.png differ diff --git a/assets/gfx/sprites/updateStore.png b/assets/gfx/sprites/updateStore.png deleted file mode 100644 index a1c4252..0000000 Binary files a/assets/gfx/sprites/updateStore.png and /dev/null differ diff --git a/assets/gfx/sprites/update_app.png b/assets/gfx/sprites/update_app.png new file mode 100644 index 0000000..4fa1707 Binary files /dev/null and b/assets/gfx/sprites/update_app.png differ diff --git a/assets/gfx/sprites/update_filter.png b/assets/gfx/sprites/update_filter.png new file mode 100644 index 0000000..ab32086 Binary files /dev/null and b/assets/gfx/sprites/update_filter.png differ diff --git a/assets/gfx/sprites/view.png b/assets/gfx/sprites/view.png deleted file mode 100644 index e641568..0000000 Binary files a/assets/gfx/sprites/view.png and /dev/null differ diff --git a/include/screens/startup.hpp b/include/common.hpp similarity index 77% rename from include/screens/startup.hpp rename to include/common.hpp index c04780c..ccfade9 100644 --- a/include/screens/startup.hpp +++ b/include/common.hpp @@ -24,19 +24,19 @@ * reasonable ways as different from the original version. */ -#ifndef _UNIVERSAL_UPDATER_STARTUP_HPP -#define _UNIVERSAL_UPDATER_STARTUP_HPP +#ifndef _UNIVERSAL_UPDATER_COMMON_HPP +#define _UNIVERSAL_UPDATER_COMMON_HPP -#include "common.hpp" +#include "config.hpp" +#include "gfx.hpp" +#include "lang.hpp" +#include "msg.hpp" +#include "screenCommon.hpp" -class Startup : public Screen { -public: - void Draw(void) const override; - void Logic(u32 hDown, u32 hHeld, touchPosition touch) override; - Startup(int mode = 0, std::string file = "NOT_USED"); -private: - int mode = 0, delay = 150; - std::string file = "NOT_USED"; -}; +inline std::unique_ptr config; + +#define _STORE_PATH "sdmc:/3ds/Universal-Updater/stores/" +#define _META_PATH "sdmc:/3ds/Universal-Updater/MetaData.json" +inline uint32_t hRepeat; #endif \ No newline at end of file diff --git a/include/download/download.hpp b/include/download/download.hpp deleted file mode 100644 index f8b3e0c..0000000 --- a/include/download/download.hpp +++ /dev/null @@ -1,103 +0,0 @@ -/* -* This file is part of Universal-Updater -* Copyright (C) 2019-2020 Universal-Team -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -* Additional Terms 7.b and 7.c of GPLv3 apply to this file: -* * Requiring preservation of specified reasonable legal notices or -* author attributions in that material or in the Appropriate Legal -* Notices displayed by works containing it. -* * Prohibiting misrepresentation of the origin of that material, -* or requiring that modified versions of such material be marked in -* reasonable ways as different from the original version. -*/ - -#ifndef _UNIVERSAL_UPDATER_DOWNLOAD_HPP -#define _UNIVERSAL_UPDATER_DOWNLOAD_HPP - -#include "common.hpp" - -#define APP_TITLE "Universal-Updater" -#define VERSION_STRING "2.5.1" - -// The Release Fetch struct. -struct ReleaseFetch { - std::string Target; - std::string TagName; - std::string ReleaseName; - std::string Created; - std::string Published; - bool PreRelease; -}; - -enum DownloadError { - DL_ERROR_NONE = 0, - DL_ERROR_WRITEFILE, - DL_ERROR_ALLOC, - DL_ERROR_STATUSCODE, - DL_ERROR_GIT, - DL_CANCEL, // No clue if that's needed tho. -}; - -Result downloadToFile(std::string url, std::string path); -Result downloadFromRelease(std::string url, std::string asset, std::string path, std::string Message, bool includePrereleases, bool showVersions); - -void displayProgressBar(); - -/** - * Check Wi-Fi status. - * @return True if Wi-Fi is connected; false if not. - */ -bool checkWifiStatus(void); - -/** - * Display "Please connect to Wi-Fi" for 2s. - */ -void notConnectedMsg(void); - -/** - * Display "Not Implemented Yet" for 2s. - */ -void notImplemented(void); - -// Display the done msg. -void doneMsg(void); - -/** - * Get info from the GitHub API about a Release. - * repo is where to get from. (Ex. "RocketRobz/TWiLightMenu") - * item is that to get from the API. (Ex. "tag_name") - * @return the string from the API. - */ -std::string getLatestRelease(std::string repo, std::string item); - -/** - * Get info from the GitHub API about a Commit. - * repo is where to get from. (Ex. "RocketRobz/TWiLightMenu") - * item is that to get from the API. (Ex. "sha") - * @return the string from the API. - */ -std::string getLatestCommit(std::string repo, std::string item); - -/** - * Get info from the GitHub API about a Commit. - * repo is where to get from. (Ex. "RocketRobz/TWiLightMenu") - * array is the array the item is in. (Ex. "commit") - * item is that to get from the API. (Ex. "message") - * @return the string from the API. - */ -std::string getLatestCommit(std::string repo, std::string array, std::string item); - -#endif \ No newline at end of file diff --git a/include/gui/gfx.hpp b/include/gui/gfx.hpp index 350ba06..c8aa60f 100644 --- a/include/gui/gfx.hpp +++ b/include/gui/gfx.hpp @@ -27,24 +27,55 @@ #ifndef _UNIVERSAL_UPDATER_GFX_HPP #define _UNIVERSAL_UPDATER_GFX_HPP -#include "colorHelper.hpp" -#include "gui.hpp" +#include "common.hpp" #include "sprites.h" +#include +#include -extern std::unique_ptr config; +/* + Define all used Colors, for easier changes. +*/ + +/* Standard Colors. */ +#define WHITE C2D_Color32(255, 255, 255, 255) +#define BLACK C2D_Color32(0, 0, 0, 255) +#define TRANSPARENT C2D_Color32(0, 0, 0, 0) +#define DIM_COLOR C2D_Color32(0, 0, 0, 190) + +/* Bar, Text, BG Colors. */ +#define TEXT_COLOR WHITE +#define BAR_COLOR C2D_Color32(50, 73, 98, 255) +#define BAR_OUTL_COLOR C2D_Color32(25, 30, 53, 255) +#define BG_COLOR C2D_Color32(38, 44, 77, 255) + +/* Progressbar Colors. */ +#define PROGRESSBAR_OUT_COLOR BLACK +#define PROGRESSBAR_IN_COLOR WHITE + +/* Entry Colors. */ +#define ENTRY_BAR_COLOR BAR_COLOR +#define ENTRY_BAR_OUTL_COLOR BAR_OUTL_COLOR + +/* Entry Box Colors. */ +#define BOX_INSIDE_COLOR C2D_Color32(49, 49, 49, 255) +#define BOX_SELECTED_COLOR C2D_Color32(240, 0, 0, 255) +#define BOX_UNSELECTED_COLOR BLACK + +/* Search Menu Colors. */ +#define SEARCH_BAR_COLOR C2D_Color32(51, 75, 102, 255) +#define SEARCH_BAR_OUTL_COLOR BAR_OUTL_COLOR + +/* Sidebar Colors. */ +#define SIDEBAR_SELECTED_COLOR C2D_Color32(108, 130, 155, 255) +#define SIDEBAR_UNSELECTED_COLOR C2D_Color32(77, 101, 128, 255) namespace GFX { - // Basic GUI. void DrawTop(void); - void DrawBottom(void); - // Draw arrow. - void DrawArrow(int x, int y, float rotation = 0, int arrowSprite = 0); - // Draw Sprites. - void DrawSprite(int img, int x, int y, float ScaleX = 1, float ScaleY = 1); - void DrawSpriteBlend(int img, int x, int y, float ScaleX = 1, float ScaleY = 1); - - void DrawButton(int x, int y, std::string ButtonText = "", u32 color = config->buttonColor()); - void TextFormatted(float x, float y, float size, const char *format, ...); -} + void DrawBottom(); + void DrawSprite(const int &img, const int &x, const int &y, const float &ScaleX = 1, const float &ScaleY = 1); + void drawBox(const float &xPos, const float &yPos, const float &width = 50, const float &height = 50, const bool &selected = false, const uint32_t &clr = BOX_INSIDE_COLOR); + void DrawButton(const float &xPos, const float &yPos, const float &width, const float &height, const bool &selected, const std::string &Text = ""); + void DrawCheckbox(const float &xPos, const float &yPos, const bool &selected); +}; #endif \ No newline at end of file diff --git a/include/gui/msg.hpp b/include/gui/msg.hpp index b013cc1..ab38e99 100644 --- a/include/gui/msg.hpp +++ b/include/gui/msg.hpp @@ -25,15 +25,15 @@ */ #ifndef _UNIVERSAL_UPDATER_MSG_HPP -#define UNIVERSAL_UPDATER_MSG_HPP +#define _UNIVERSAL_UPDATER_MSG_HPP #include namespace Msg { - void DisplayMsg(std::string text); - void DisplayWarnMsg(std::string Text); - bool promptMsg(std::string promptMsg); - void DisplayStartMSG(); -} + void DisplayMsg(const std::string &Text); + void DisplayWarnMsg(const std::string &Text); + bool promptMsg(const std::string &promptMsg); + void waitMsg(const std::string &msg); +}; #endif \ No newline at end of file diff --git a/include/init.hpp b/include/init.hpp index 9b86583..7860e65 100644 --- a/include/init.hpp +++ b/include/init.hpp @@ -30,15 +30,9 @@ #include <3ds.h> namespace Init { - // Init, Mainloop & Exit. Result Initialize(); Result MainLoop(); Result Exit(); - - // Sound / Music stuff. - void loadSoundEffects(void); - void playMusic(void); - void stopMusic(void); -} +}; #endif \ No newline at end of file diff --git a/include/gui/keyboard.hpp b/include/keyboard.hpp similarity index 90% rename from include/gui/keyboard.hpp rename to include/keyboard.hpp index 794b5fe..e6bec44 100644 --- a/include/gui/keyboard.hpp +++ b/include/keyboard.hpp @@ -30,9 +30,7 @@ #include namespace Input { - std::string setkbdString(uint maxLength, std::string Text); - std::uint8_t setu8(std::string Text); - int setInt(int maxValue, std::string Text); -} + std::string setkbdString(const uint &maxLength, const std::string &Text); +}; #endif \ No newline at end of file diff --git a/include/overlays/overlay.hpp b/include/overlays/overlay.hpp index e4b2177..de7e734 100644 --- a/include/overlays/overlay.hpp +++ b/include/overlays/overlay.hpp @@ -28,9 +28,15 @@ #define _UNIVERSAL_UPDATER_OVERLAY_HPP #include "common.hpp" +#include "store.hpp" +#include "storeEntry.hpp" +#include <3ds.h> namespace Overlays { - u32 SelectRGB(u32 oldColor); -} + void SelectStore(std::unique_ptr &store, std::vector> &entries, std::unique_ptr &meta); + void SelectLanguage(); + void ShowCredits(); + std::string SelectDir(const std::string &oldDir, const std::string &msg); +}; #endif \ No newline at end of file diff --git a/include/qr/qrcode.hpp b/include/qr/qrcode.hpp new file mode 100644 index 0000000..7e9738a --- /dev/null +++ b/include/qr/qrcode.hpp @@ -0,0 +1,97 @@ +/* +* This file is part of Universal-Updater +* Copyright (C) 2019-2020 Universal-Team +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +* Additional Terms 7.b and 7.c of GPLv3 apply to this file: +* * Requiring preservation of specified reasonable legal notices or +* author attributions in that material or in the Appropriate Legal +* Notices displayed by works containing it. +* * Prohibiting misrepresentation of the origin of that material, +* or requiring that modified versions of such material be marked in +* reasonable ways as different from the original version. +*/ + +/* + * This file is part of PKSM + * Copyright (C) 2016-2020 Bernardo Giordano, Admiral Fish, piepie62 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Additional Terms 7.b and 7.c of GPLv3 apply to this file: + * * Requiring preservation of specified reasonable legal notices or + * author attributions in that material or in the Appropriate Legal + * Notices displayed by works containing it. + * * Prohibiting misrepresentation of the origin of that material, + * or requiring that modified versions of such material be marked in + * reasonable ways as different from the original version. + */ + +#ifndef _UNIVERSAL_UPDATER_QR_CODE_HPP +#define _UNIVERSAL_UPDATER_QR_CODE_HPP + +#include "common.hpp" +#include "quirc.hpp" +#include +#include <3ds.h> +#include +#include + +class QRCode { +public: + QRCode(); + ~QRCode(); + + void drawThread(); + void captureThread(); + void handler(std::vector& out); + bool done() const { return finished; }; + bool cancelled() const { return cancel; }; +private: + void buffToImage(); + void finish(); + std::array cameraBuffer; + LightLock bufferLock; + C2D_Image image; + LightLock imageLock; + quirc *qrData; + Handle exitEvent; + static constexpr Tex3DS_SubTexture subtex = { 512, 256, 0.0f, 1.0f, 1.0f, 0.0f }; + std::atomic finished = false; + bool capturing = false; + bool cancel = false; +}; + +/* + This is, what should get called. +*/ +namespace QR_Scanner { + /* Empty == cancelled. */ + std::vector scan(); + std::string GetQRURL(); +}; + +#endif \ No newline at end of file diff --git a/include/qr/quirc.hpp b/include/qr/quirc.hpp new file mode 100644 index 0000000..b2f5353 --- /dev/null +++ b/include/qr/quirc.hpp @@ -0,0 +1,165 @@ +/* quirc -- QR-code recognition library + * Copyright (C) 2010-2012 Daniel Beer + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef QUIRC_HPP +#define QUIRC_HPP + +#include + +struct quirc; + +/* Obtain the library version string. */ +const char *quirc_version(void); + +/* Construct a new QR-code recognizer. This function will return NULL + * if sufficient memory could not be allocated. + */ +struct quirc *quirc_new(void); + +/* Destroy a QR-code recognizer. */ +void quirc_destroy(struct quirc *q); + +/* Resize the QR-code recognizer. The size of an image must be + * specified before codes can be analyzed. + * + * This function returns 0 on success, or -1 if sufficient memory could + * not be allocated. + */ +int quirc_resize(struct quirc *q, int w, int h); + +/* These functions are used to process images for QR-code recognition. + * quirc_begin() must first be called to obtain access to a buffer into + * which the input image should be placed. Optionally, the current + * width and height may be returned. + * + * After filling the buffer, quirc_end() should be called to process + * the image for QR-code recognition. The locations and content of each + * code may be obtained using accessor functions described below. + */ +uint8_t *quirc_begin(struct quirc *q, int *w, int *h); +void quirc_end(struct quirc *q); + +/* This structure describes a location in the input image buffer. */ +struct quirc_point { + int x; + int y; +}; + +/* This enum describes the various decoder errors which may occur. */ +typedef enum { + QUIRC_SUCCESS = 0, + QUIRC_ERROR_INVALID_GRID_SIZE, + QUIRC_ERROR_INVALID_VERSION, + QUIRC_ERROR_FORMAT_ECC, + QUIRC_ERROR_DATA_ECC, + QUIRC_ERROR_UNKNOWN_DATA_TYPE, + QUIRC_ERROR_DATA_OVERFLOW, + QUIRC_ERROR_DATA_UNDERFLOW +} quirc_decode_error_t; + +/* Return a string error message for an error code. */ +const char *quirc_strerror(quirc_decode_error_t err); + +/* Limits on the maximum size of QR-codes and their content. */ +#define QUIRC_MAX_BITMAP 3917 +#define QUIRC_MAX_PAYLOAD 8896 + +/* QR-code ECC types. */ +#define QUIRC_ECC_LEVEL_M 0 +#define QUIRC_ECC_LEVEL_L 1 +#define QUIRC_ECC_LEVEL_H 2 +#define QUIRC_ECC_LEVEL_Q 3 + +/* QR-code data types. */ +#define QUIRC_DATA_TYPE_NUMERIC 1 +#define QUIRC_DATA_TYPE_ALPHA 2 +#define QUIRC_DATA_TYPE_BYTE 4 +#define QUIRC_DATA_TYPE_KANJI 8 + +/* Common character encodings */ +#define QUIRC_ECI_ISO_8859_1 1 +#define QUIRC_ECI_IBM437 2 +#define QUIRC_ECI_ISO_8859_2 4 +#define QUIRC_ECI_ISO_8859_3 5 +#define QUIRC_ECI_ISO_8859_4 6 +#define QUIRC_ECI_ISO_8859_5 7 +#define QUIRC_ECI_ISO_8859_6 8 +#define QUIRC_ECI_ISO_8859_7 9 +#define QUIRC_ECI_ISO_8859_8 10 +#define QUIRC_ECI_ISO_8859_9 11 +#define QUIRC_ECI_WINDOWS_874 13 +#define QUIRC_ECI_ISO_8859_13 15 +#define QUIRC_ECI_ISO_8859_15 17 +#define QUIRC_ECI_SHIFT_JIS 20 +#define QUIRC_ECI_UTF_8 26 + +/* This structure is used to return information about detected QR codes + * in the input image. + */ +struct quirc_code { + /* The four corners of the QR-code, from top left, clockwise */ + struct quirc_point corners[4]; + + /* The number of cells across in the QR-code. The cell bitmap + * is a bitmask giving the actual values of cells. If the cell + * at (x, y) is black, then the following bit is set: + * + * cell_bitmap[i << 3] & (1 << (i & 7)) + * + * where i = (y * size) + x. + */ + int size; + uint8_t cell_bitmap[QUIRC_MAX_BITMAP]; +}; + +/* This structure holds the decoded QR-code data */ +struct quirc_data { + /* Various parameters of the QR-code. These can mostly be + * ignored if you only care about the data. + */ + int version; + int ecc_level; + int mask; + + /* This field is the highest-valued data type found in the QR + * code. + */ + int data_type; + + /* Data payload. For the Kanji datatype, payload is encoded as + * Shift-JIS. For all other datatypes, payload is ASCII text. + */ + uint8_t payload[QUIRC_MAX_PAYLOAD]; + int payload_len; + + /* ECI assignment number */ + uint32_t eci; +}; + +/* Return the number of QR-codes identified in the last processed + * image. + */ +int quirc_count(const struct quirc *q); + +/* Extract the QR-code specified by the given index. */ +void quirc_extract(const struct quirc *q, int index, + struct quirc_code *code); + +/* Decode a QR-code, returning the payload data. */ +quirc_decode_error_t quirc_decode(const struct quirc_code *code, + struct quirc_data *data); + +#endif \ No newline at end of file diff --git a/include/qr/quirc_internal.hpp b/include/qr/quirc_internal.hpp new file mode 100644 index 0000000..445acbc --- /dev/null +++ b/include/qr/quirc_internal.hpp @@ -0,0 +1,114 @@ +/* quirc -- QR-code recognition library + * Copyright (C) 2010-2012 Daniel Beer + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef QUIRC_INTERNAL_HPP +#define QUIRC_INTERNAL_HPP + +#include "quirc.hpp" + +#define QUIRC_PIXEL_WHITE 0 +#define QUIRC_PIXEL_BLACK 1 +#define QUIRC_PIXEL_REGION 2 + +#ifndef QUIRC_MAX_REGIONS +#define QUIRC_MAX_REGIONS 254 +#endif +#define QUIRC_MAX_CAPSTONES 32 +#define QUIRC_MAX_GRIDS 8 + +#define QUIRC_PERSPECTIVE_PARAMS 8 + +#if QUIRC_MAX_REGIONS < UINT8_MAX +typedef uint8_t quirc_pixel_t; +#elif QUIRC_MAX_REGIONS < UINT16_MAX +typedef uint16_t quirc_pixel_t; +#else +#error "QUIRC_MAX_REGIONS > 65534 is not supported" +#endif + +struct quirc_region { + struct quirc_point seed; + int count; + int capstone; +}; + +struct quirc_capstone { + int ring; + int stone; + + struct quirc_point corners[4]; + struct quirc_point center; + double c[QUIRC_PERSPECTIVE_PARAMS]; + + int qr_grid; +}; + +struct quirc_grid { + /* Capstone indices */ + int caps[3]; + + /* Alignment pattern region and corner */ + int align_region; + struct quirc_point align; + + /* Timing pattern endpoints */ + struct quirc_point tpep[3]; + int hscan; + int vscan; + + /* Grid size and perspective transform */ + int grid_size; + double c[QUIRC_PERSPECTIVE_PARAMS]; +}; + +struct quirc { + uint8_t *image; + quirc_pixel_t *pixels; + int w; + int h; + + int num_regions; + struct quirc_region regions[QUIRC_MAX_REGIONS]; + + int num_capstones; + struct quirc_capstone capstones[QUIRC_MAX_CAPSTONES]; + + int num_grids; + struct quirc_grid grids[QUIRC_MAX_GRIDS]; +}; + +/************************************************************************ + * QR-code version information database + */ + +#define QUIRC_MAX_VERSION 40 +#define QUIRC_MAX_ALIGNMENT 7 + +struct quirc_rs_params { + int bs; /* Block size */ + int dw; /* Data words */ + int ce; /* Correctable errors */ +}; + +struct quirc_version_info { + int data_bytes; + int apat[QUIRC_MAX_ALIGNMENT]; + struct quirc_rs_params ecc[4]; +}; + +extern const struct quirc_version_info quirc_version_db[QUIRC_MAX_VERSION + 1]; + +#endif \ No newline at end of file diff --git a/include/screens/credits.hpp b/include/screens/mainScreen.hpp similarity index 60% rename from include/screens/credits.hpp rename to include/screens/mainScreen.hpp index 25e1d7c..57880ad 100644 --- a/include/screens/credits.hpp +++ b/include/screens/mainScreen.hpp @@ -24,29 +24,41 @@ * reasonable ways as different from the original version. */ -#ifndef _UNIVERSAL_UPDATER_CREDITS_HPP -#define _UNIVERSAL_UPDATER_CREDITS_HPP +#ifndef _UNIVERSAL_UPDATER_MAIN_SCREEN_HPP +#define _UNIVERSAL_UPDATER_MAIN_SCREEN_HPP #include "common.hpp" -#include "structs.hpp" +#include "store.hpp" +#include "storeEntry.hpp" +#include "storeUtils.hpp" -#include +/* + Modes: -class Credits : public Screen { + 0: Entry Info. + 1: Download List. + 2: Search + Favorites. + 3: Sorting. + 4: Settings / Credits(?). +*/ + +class MainScreen : public Screen { public: + MainScreen(); void Draw(void) const override; void Logic(u32 hDown, u32 hHeld, touchPosition touch) override; private: - void DrawBottom(void) const; - int creditsPage = 0; - int screenPos = 0; - int Selection = 0; - int keyRepeatDelay = 0; + std::unique_ptr store = nullptr; + std::unique_ptr meta = nullptr; + std::vector> entries; + std::vector dwnldList; + bool initialized = false, fetchDown = false, showMarks = false, showSettings = false, ascending = false, updateFilter = false; + int storeMode = 0, marks = 0, markIndex = 0, sPage = 0, lMode = 0, sSelection = 0, lastMode = 0, smallDelay = 0; + SortType sorttype = SortType::LAST_UPDATED; - const std::vector arrowPos = { - {0, 215, 25, 25}, // Back Arrow. - {295, 215, 25, 25} // Next Page. - }; + /* Title, Author, Category, Console. */ + std::vector searchIncludes = { false, false, false, false }; + std::string searchResult = ""; }; #endif \ No newline at end of file diff --git a/include/screens/scriptBrowse.hpp b/include/screens/scriptBrowse.hpp deleted file mode 100644 index a14056a..0000000 --- a/include/screens/scriptBrowse.hpp +++ /dev/null @@ -1,87 +0,0 @@ -/* -* This file is part of Universal-Updater -* Copyright (C) 2019-2020 Universal-Team -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -* Additional Terms 7.b and 7.c of GPLv3 apply to this file: -* * Requiring preservation of specified reasonable legal notices or -* author attributions in that material or in the Appropriate Legal -* Notices displayed by works containing it. -* * Prohibiting misrepresentation of the origin of that material, -* or requiring that modified versions of such material be marked in -* reasonable ways as different from the original version. -*/ - -#ifndef _UNIVERSAL_UPDATER_SCRIPT_BROWSE_HPP -#define _UNIVERSAL_UPDATER_SCRIPT_BROWSE_HPP - -#include "common.hpp" -#include "fileBrowse.hpp" -#include "structs.hpp" - -#include - -class ScriptBrowse : public Screen { -public: - void Draw(void) const override; - void Logic(u32 hDown, u32 hHeld, touchPosition touch) override; - ScriptBrowse(); -private: - // Selection. - mutable int screenPos = 0; - mutable int screenPosList = 0; - mutable int Selection = 0; - int dropSelection = 0; - int mode = 0; - bool dropDownMenu = false; - bool loaded = false; - - // Draws. - void DrawBrowse(void) const; - void DrawGlossary(void) const; - - void DropDownLogic(u32 hDown, u32 hHeld, touchPosition touch); - - nlohmann::json infoJson; - int maxScripts; - - // Browse stuff. - int keyRepeatDelay = 0; - std::vector dirContents; - void refresh(); - void downloadAll(); - - // Button | Icon struct. - const std::vector arrowPos = { - {295, 0, 25, 25}, // Arrow Up. - {295, 215, 25, 25}, // Arrow Down. - {0, 215, 25, 25}, // Back Arrow. - {5, 0, 25, 25} // Dropdown Menu. - }; - - // DropDownMenu. - const std::vector dropPos = { - {5, 30, 25, 25}, // Download All. - {5, 70, 25, 25}, // Refresh. - {5, 110, 25, 25} // ViewMode. - }; - const std::vector dropPos2 = { - {0, 28, 140, 30}, // Download All. - {0, 68, 140, 30}, // Refresh. - {0, 108, 140, 30} // ViewMode. - }; -}; - -#endif \ No newline at end of file diff --git a/include/screens/scriptCreator.hpp b/include/screens/scriptCreator.hpp deleted file mode 100644 index 474dd5d..0000000 --- a/include/screens/scriptCreator.hpp +++ /dev/null @@ -1,113 +0,0 @@ -/* -* This file is part of Universal-Updater -* Copyright (C) 2019-2020 Universal-Team -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -* Additional Terms 7.b and 7.c of GPLv3 apply to this file: -* * Requiring preservation of specified reasonable legal notices or -* author attributions in that material or in the Appropriate Legal -* Notices displayed by works containing it. -* * Prohibiting misrepresentation of the origin of that material, -* or requiring that modified versions of such material be marked in -* reasonable ways as different from the original version. -*/ - -#ifndef _UNIVERSAL_UPDATER_SCRIPT_CREATOR_HPP -#define _UNIVERSAL_UPDATER_SCRIPT_CREATOR_HPP - -#include "common.hpp" -#include "json.hpp" -#include "structs.hpp" - -#include - -class ScriptCreator : public Screen { -public: - void Draw(void) const override; - void Logic(u32 hDown, u32 hHeld, touchPosition touch) override; -private: - std::string entryName = ""; - - // Screen draws. - void DrawSubMenu(void) const; - void DrawScriptScreen(void) const; - - void SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch); - void scriptLogic(u32 hDown, u32 hHeld, touchPosition touch); - - // Selection + Mode. - int Selection = 0; - int mode = 0; - int page = 0; - - // Functions. - void openJson(std::string fileName); - void createNewJson(std::string fileName); - void save(); - void setInfoStuff(void); - - // Creating Functions. -> Page 1. - void createDownloadRelease(); - void createDownloadFile(); - void createDeleteFile(); - void createExtractFile(); - void createInstallCia(); - void createMkDir(); - - // Creating Functions. -> Page 2. - void createRmDir(); - void createMkFile(); - void createTimeMsg(); - void createSaveConfig(); - void createBootTitle(); - void createPromptMessage(); - - // Creating Functions. -> Page 3. - void createCopy(); - void createMove(); - - // - void setBool(const std::string &object, const std::string &key, bool v); - void setBool2(const std::string &object, const std::string &key, const std::string &key2, bool v); - - void setInt(const std::string &object, const std::string &key, int v); - void setInt2(const std::string &object, const std::string &key, const std::string &key2, int v); - - void setString(const std::string &object, const std::string &key, const std::string &v); - void setString2(const std::string &object, const std::string &key, const std::string &key2, const std::string &v); - - void createEntry(const std::string &Entryname); - - std::string jsonFileName; - nlohmann::json editScript; - // Main Pos. - const std::vector mainButtons = { - {90, 40, 140, 35}, // New Script. - {90, 100, 140, 35} // Existing Script. - }; - - // Creator Button Pos. - const std::vector creatorButtons = { - {10, 40, 140, 35}, - {170, 40, 140, 35}, - {10, 100, 140, 35}, - {170, 100, 140, 35}, - {10, 160, 140, 35}, - {170, 160, 140, 35} - }; - -}; - -#endif \ No newline at end of file diff --git a/include/screens/scriptlist.hpp b/include/screens/scriptlist.hpp deleted file mode 100644 index cd5dcf6..0000000 --- a/include/screens/scriptlist.hpp +++ /dev/null @@ -1,115 +0,0 @@ -/* -* This file is part of Universal-Updater -* Copyright (C) 2019-2020 Universal-Team -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -* Additional Terms 7.b and 7.c of GPLv3 apply to this file: -* * Requiring preservation of specified reasonable legal notices or -* author attributions in that material or in the Appropriate Legal -* Notices displayed by works containing it. -* * Prohibiting misrepresentation of the origin of that material, -* or requiring that modified versions of such material be marked in -* reasonable ways as different from the original version. -*/ - -#ifndef _UNIVERSAL_UPDATER_SCRIPT_LIST_HPP -#define _UNIVERSAL_UPDATER_SCRIPT_LIST_HPP - -#include "common.hpp" -#include "fileBrowse.hpp" -#include "scriptHelper.hpp" -#include "structs.hpp" - -#include - -class ScriptList : public Screen { -public: - void Draw(void) const override; - void Logic(u32 hDown, u32 hHeld, touchPosition touch) override; - ScriptList(); // In case of "Autoboot", have a Constructor which handles stuff. -private: - // Screen Mode. - int mode = 0; - int lastMode = 1; - - // Helper functions. - void deleteScript(int selectedScript); - void refreshList(); - nlohmann::json openScriptFile(); - bool checkForValidate(void); - void loadDesc(void); - Result runFunctions(nlohmann::json &json); - - // Draw Functions. - void DrawSubMenu(void) const; - void DrawList(void) const; - void DrawSingleObject(void) const; - void DrawGlossary(void) const; - - // Logic Functions. - void SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch); - void ListSelection(u32 hDown, u32 hHeld, touchPosition touch); - void SelectFunction(u32 hDown, u32 hHeld, touchPosition touch); - - // This is for the Script Creator, so no one can access it for now, until it is stable or so. - bool isTesting = true; - - // Other includes which get destructed automatically. - std::string choice; - std::string currentFile; - std::string selectedTitle; - std::string Desc = ""; - nlohmann::json jsonFile; - std::vector fileInfo; - std::vector fileInfo2; - std::vector lines; - - mutable int screenPos = 0; - mutable int screenPosList = 0; - mutable int Selection = 0; - int dropSelection = 0; - bool dropDownMenu = false; - - // Browse stuff. - int keyRepeatDelay = 0; - std::vector dirContents; - - - // Button | Icon structs. - const std::vector arrowPos = { - {295, 0, 25, 25}, // Arrow Up. - {295, 215, 25, 25}, // Arrow Down. - {0, 215, 25, 25}, // Back Arrow. - {5, 0, 25, 25} // Dropdown Menu. - }; - const std::vector subPos = { - {0, 60, 149, 52}, // Script list. - {162, 60, 149, 52}, // Get Scripts. - {0, 130, 149, 52}, // Script Creator. - {162, 130, 149, 52} // Script path change. - }; - - // DropDownMenu. - const std::vector dropPos = { - {5, 30, 25, 25}, // Delete. - {5, 70, 25, 25} // ViewMode. - }; - const std::vector dropPos2 = { - {0, 28, 140, 30}, // Delete. - {0, 68, 140, 30} // ViewMode. - }; -}; - -#endif \ No newline at end of file diff --git a/include/screens/settings.hpp b/include/screens/settings.hpp deleted file mode 100644 index fc905a3..0000000 --- a/include/screens/settings.hpp +++ /dev/null @@ -1,83 +0,0 @@ -/* -* This file is part of Universal-Updater -* Copyright (C) 2019-2020 Universal-Team -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -* Additional Terms 7.b and 7.c of GPLv3 apply to this file: -* * Requiring preservation of specified reasonable legal notices or -* author attributions in that material or in the Appropriate Legal -* Notices displayed by works containing it. -* * Prohibiting misrepresentation of the origin of that material, -* or requiring that modified versions of such material be marked in -* reasonable ways as different from the original version. -*/ - -#ifndef _UNIVERSAL_UPDATER_SETTINGS_HPP -#define _UNIVERSAL_UPDATER_SETTINGS_HPP - -#include "common.hpp" -#include "fileBrowse.hpp" -#include "structs.hpp" - -#include - -class Settings : public Screen { -public: - void Draw(void) const override; - void Logic(u32 hDown, u32 hHeld, touchPosition touch) override; - Settings(); -private: - int colorMode = 0; - int mode = 0; - int Selection = 0; - bool dropDownMenu = false; - mutable int screenPos = 0; - int colorSelection = 0; - int keyRepeatDelay = 0; - int settingPage = 0; - - // Draws. - void DrawSubMenu(void) const; - void DrawLanguageSelection(void) const; - void DrawColorChanging(void) const; - // Logic's. - void SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch); - void LanguageSelection(u32 hDown, u32 hHeld, touchPosition touch); - void colorChanging(u32 hDown, u32 hHeld, touchPosition touch); - - const std::vector mainButtons = { - {80, 30, 149, 52}, // Language. - {80, 90, 149, 52}, // Colors. - {80, 150, 149, 52} // Credits. - }; - - const std::vector mainButtons2 = { - {0, 60, 149, 52}, // Change Music File. - {162, 60, 149, 52}, // Change bar style. - {0, 130, 149, 52}, // Change Key Delay. - {162, 130, 149, 52} // Toggle animation. - }; - - const std::vector arrowPos = { - {0, 0, 25, 25}, // Previous Arrow. - {295, 0, 25, 25}, // Next Arrow. - {0, 215, 25, 25}, // Back Arrow. - {0, 0, 25, 25}, // Back Arrow top left. - {295, 215, 25, 25}, // Next Page / Misc Arrow. - {5, 0, 25, 25} // Dropdown Menu. - }; -}; - -#endif \ No newline at end of file diff --git a/include/screens/unistore.hpp b/include/screens/unistore.hpp deleted file mode 100644 index 719cd51..0000000 --- a/include/screens/unistore.hpp +++ /dev/null @@ -1,134 +0,0 @@ -/* -* This file is part of Universal-Updater -* Copyright (C) 2019-2020 Universal-Team -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -* Additional Terms 7.b and 7.c of GPLv3 apply to this file: -* * Requiring preservation of specified reasonable legal notices or -* author attributions in that material or in the Appropriate Legal -* Notices displayed by works containing it. -* * Prohibiting misrepresentation of the origin of that material, -* or requiring that modified versions of such material be marked in -* reasonable ways as different from the original version. -*/ - -#ifndef _UNIVERSAL_UPDATER_UNISTORE_HPP -#define _UNIVERSAL_UPDATER_UNISTORE_HPP - -#include "common.hpp" -#include "fileBrowse.hpp" -#include "scriptHelper.hpp" -#include "structs.hpp" - -#include - -class UniStore : public Screen { -public: - void Draw(void) const override; - void Logic(u32 hDown, u32 hHeld, touchPosition touch) override; - UniStore(bool doAutoboot, std::string file); -private: - bool doAutoboot = false; - std::string autobootFile = ""; - void refreshList(); - nlohmann::json openStoreFile(); - void loadStoreDesc(void); - StoreInfo parseStoreInfo(std::string fileName); - void autobootLogic(); - - void DrawSubMenu(void) const; - void DrawStoreList(void) const; - void DrawSearch(void) const; - void DrawFullURLScreen(void) const; - void DrawGitHubScreen(void) const; - - void SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch); - void StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch); - void SearchLogic(u32 hDown, u32 hHeld, touchPosition touch); - void FullURLLogic(u32 hDown, u32 hHeld, touchPosition touch); - void GitHubLogic(u32 hDown, u32 hHeld, touchPosition touch); - - void descript(); - void updateStore(int selectedStore); - void deleteStore(int selectedStore); - bool handleIfDisplayText(); - int mode = 0; - bool displayInformations = true; - - // Stuff for the GitHub Store Search function and Full URL. - std::string OwnerAndRepo = ""; - std::string fileName = ""; - std::string FullURL = ""; - - // Selections. - mutable int Selection = 0; - int screenPos = 0; - mutable int screenPosList = 0; - bool dropDownMenu = false; - int dropSelection = 0; - - // Browse stuff. - int keyRepeatDelay = 0; - std::vector dirContents; - - // Other stuff. - std::vector storeInfo; // Store Selection. - std::vector descLines; - std::string storeDesc = ""; - nlohmann::json JSON; - std::string currentStoreFile; - - // Icon | Button Structs. - const std::vector arrowPos = { - {295, 0, 25, 25}, // Arrow Up. - {295, 215, 25, 25}, // Arrow Down. - {0, 215, 25, 25}, // Back Arrow. - {5, 0, 25, 25} // Dropdown Menu. - }; - - const std::vector URLBtn = { - {0, 60, 149, 52}, // FULL URL. - {162, 60, 149, 52}, // GitHub. - {0, 130, 149, 52}, // TinyDB. - {162, 130, 149, 52} // Universal-DB. - }; - - const std::vector GitHubPos = { - {30, 50, 260, 30}, // Owner & Repo. - {30, 130, 260, 30}, // Filename. - {135, 180, 50, 30} // OK. - }; - - const std::vector subPos = { - {80, 30, 149, 52}, // StoreList. - {80, 90, 149, 52}, // storeSearch. - {80, 150, 149, 52} // storePathChange. - }; - - // DropDownMenu. - const std::vector dropPos = { - {5, 30, 25, 25}, // Delete. - {5, 70, 25, 25}, // Update. - {5, 110, 25, 25} // ViewMode. - }; - - const std::vector dropPos2 = { - {0, 28, 140, 30}, // Delete. - {0, 68, 140, 30}, // Update. - {0, 108, 140, 30} // ViewMode. - }; -}; - -#endif \ No newline at end of file diff --git a/include/screens/unistore_v1.hpp b/include/screens/unistore_v1.hpp deleted file mode 100644 index 8a0f09b..0000000 --- a/include/screens/unistore_v1.hpp +++ /dev/null @@ -1,75 +0,0 @@ -/* -* This file is part of Universal-Updater -* Copyright (C) 2019-2020 Universal-Team -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -* Additional Terms 7.b and 7.c of GPLv3 apply to this file: -* * Requiring preservation of specified reasonable legal notices or -* author attributions in that material or in the Appropriate Legal -* Notices displayed by works containing it. -* * Prohibiting misrepresentation of the origin of that material, -* or requiring that modified versions of such material be marked in -* reasonable ways as different from the original version. -*/ - -#ifndef _UNIVERSAL_UPDATER_UNIVERSAL_STORE_V1_HPP -#define _UNIVERSAL_UPDATER_UNIVERSAL_STORE_V1_HPP - -#include "common.hpp" -#include "json.hpp" -#include "structs.hpp" -#include - -#include - -class UniStoreV1 : public Screen { -public: - void Draw(void) const override; - void Logic(u32 hDown, u32 hHeld, touchPosition touch) override; - UniStoreV1(nlohmann::json &JSON, const std::string sheetPath, bool displayInf); - ~UniStoreV1(); -private: - // Selections. - mutable int Selection = 0; - bool sheetHasLoaded = false; - int screenPos = 0; - mutable int screenPosList = 0; - bool dropDownMenu = false; - int dropSelection = 0; - int keyRepeatDelay = 0; - nlohmann::json storeJson; - C2D_SpriteSheet sheet; - std::vector objects; - mutable bool displayInformations = true; - void drawBlend(int key, int x, int y) const; - void parseObjects(); - Result execute(); - - // Icon | Button Structs. - const std::vector arrowPos = { - {295, 0, 25, 25}, // Arrow Up. - {295, 215, 25, 25}, // Arrow Down. - {0, 215, 25, 25}, // Back Arrow. - {5, 0, 25, 25} // Dropdown Menu. - }; - // DropDownMenu. - const std::vector dropPos = { - {5, 30, 140, 30}, // Delete. - {5, 70, 140, 30}, // Update. - {5, 110, 140, 30} // ViewMode. - }; -}; - -#endif \ No newline at end of file diff --git a/include/screens/unistore_v2.hpp b/include/screens/unistore_v2.hpp deleted file mode 100644 index e794f57..0000000 --- a/include/screens/unistore_v2.hpp +++ /dev/null @@ -1,135 +0,0 @@ -/* -* This file is part of Universal-Updater -* Copyright (C) 2019-2020 Universal-Team -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -* Additional Terms 7.b and 7.c of GPLv3 apply to this file: -* * Requiring preservation of specified reasonable legal notices or -* author attributions in that material or in the Appropriate Legal -* Notices displayed by works containing it. -* * Prohibiting misrepresentation of the origin of that material, -* or requiring that modified versions of such material be marked in -* reasonable ways as different from the original version. -*/ - -#ifndef _UNIVERSAL_UPDATER_UNIVERSAL_STORE_V2_HPP -#define _UNIVERSAL_UPDATER_UNIVERSAL_STORE_V2_HPP - -#include "common.hpp" -#include "json.hpp" -#include "store.hpp" -#include "structs.hpp" -#include - -#include - -class UniStoreV2 : public Screen { -public: - void Draw(void) const override; - void Logic(u32 hDown, u32 hHeld, touchPosition touch) override; - UniStoreV2(nlohmann::json &JSON, const std::string sheetPath, const std::string fileName); - ~UniStoreV2(); -private: - std::unique_ptr sortedStore; - - bool darkMode = true, sheetLoaded = false, canDisplay = false, hasLoaded = false, isDropDown = false; - int selectMenu = 0, selectedObject = 0, selectedBox = 0, lastViewMode = 0, dropSelection = 0, searchSelection = 0, iconAmount = 0, categorySelection = 0, selectedBoxList = 0, selection = -1, storePage = 0, downloadPage = 0, storePageList = 0, mode = 0, subSelection = 0, categoryPage = 0; - nlohmann::json storeJson; - C2D_SpriteSheet sheet; - std::vector objects; - - void DrawSortingMenu(void) const; - void DrawSearchMenu(void) const; - void DrawSelectMenu(int option) const; - - // Base stuff. - void DrawBaseTop(void) const; - void DrawBaseBottom(void) const; - void drawBox(float xPos, float yPos, float width, float height, bool selected) const; - void DrawGrid(void) const; - void DrawDescription(int selection) const; - u32 returnTextColor() const; - void parseObjects(int selection); - Result runFunctions(std::string entry); - void DrawList(void) const; - void displaySelectedEntry(int selection, int storeIndex) const; - void DropLogic(u32 hDown, u32 hHeld, touchPosition touch); - void DropDownMenu(void) const; - - const std::vector StoreBoxesGrid = { - {25, 35, 50, 50}, - {100, 35, 50, 50}, - {175, 35, 50, 50}, - {250, 35, 50, 50}, - {325, 35, 50, 50}, - - {25, 95, 50, 50}, - {100, 95, 50, 50}, - {175, 95, 50, 50}, - {250, 95, 50, 50}, - {325, 95, 50, 50}, - - {25, 155, 50, 50}, - {100, 155, 50, 50}, - {175, 155, 50, 50}, - {250, 155, 50, 50}, - {325, 155, 50, 50} - }; - - const std::vector StoreBoxesList = { - {20, 35, 360, 50}, - {20, 95, 360, 50}, - {20, 155, 360, 50} - }; - - const std::vector downloadBoxes = { - {10, 40, 300, 25}, - {10, 75, 300, 25}, - {10, 110, 300, 25}, - {10, 145, 300, 25}, - {10, 180, 300, 25} - }; - - const std::vector iconPos = { - {5, 0, 25, 25} // Dropdown Menu. - }; - - const std::vector dropPos = { - {5, 30, 140, 25}, // Theme. - {5, 70, 140, 25}, // Style. - {5, 110, 140, 25},// Search. - {5, 150, 140, 25} // Reset. - }; - - const std::vector sortingPos = { - {40, 40, 100, 40}, // Descending. - {180, 40, 100, 40}, // Ascending. - // Now the actual options. - {115, 90, 100, 30}, // Title. - {115, 130, 100, 30}, // Author. - {115, 170, 100, 30} // Last Updated. - }; - - const std::vector searchPos = { - {0, 60, 149, 52}, // Title. - {162, 60, 149, 52}, // Author. - {0, 130, 149, 52}, // Category. - {162, 130, 149, 52} // Console. - }; - - u32 barColorLight, barColorDark, bgColorLight, bgColorDark, textColorLight, textColorDark, boxColorLight, boxColorDark, outlineColorLight, outlineColorDark; -}; - -#endif \ No newline at end of file diff --git a/include/screens/mainMenu.hpp b/include/store/meta.hpp similarity index 58% rename from include/screens/mainMenu.hpp rename to include/store/meta.hpp index 9f529f2..89f3fe2 100644 --- a/include/screens/mainMenu.hpp +++ b/include/store/meta.hpp @@ -24,28 +24,41 @@ * reasonable ways as different from the original version. */ -#ifndef _UNIVERSAL_UPDATER_MAINMENU_HPP -#define _UNIVERSAL_UPDATER_MAINMENU_HPP +#ifndef _UNIVERSAL_UPDATER_META_HPP +#define _UNIVERSAL_UPDATER_META_HPP -#include "common.hpp" -#include "structs.hpp" +#include "json.hpp" +#include -#include +enum favoriteMarks { + STAR = 1 << 0, + HEART = 1 << 1, + DIAMOND = 1 << 2, + CLUBS = 1 << 3, + SPADE = 1 << 4 +}; -class MainMenu : public Screen { +class Meta { public: - void Draw(void) const override; - void Logic(u32 hDown, u32 hHeld, touchPosition touch) override; -private: - int Selection = 0; + Meta(); + ~Meta() { this->SaveCall(); }; - const std::vector mainButtons = { - {0, 60, 149, 52}, // UniStore. - {162, 60, 149, 52}, // Scripts. - {0, 130, 149, 52}, // Settings. - {162, 130, 149, 52}, // FTP. - {0, 215, 25, 25} // Back Arrow. + std::string GetUpdated(std::string unistoreName, std::string entry) const; + int GetMarks(std::string unistoreName, std::string entry) const; + bool UpdateAvailable(std::string unistoreName, std::string entry, std::string updated) const; + + void SetUpdated(std::string unistoreName, std::string entry, std::string updated) { + this->metadataJson[unistoreName][entry]["updated"] = updated; }; + + void SetMarks(std::string unistoreName, std::string entry, int marks) { + this->metadataJson[unistoreName][entry]["marks"] = marks; + }; + + void ImportMetadata(); + void SaveCall(); +private: + nlohmann::json metadataJson = nullptr; }; #endif \ No newline at end of file diff --git a/include/store/store.hpp b/include/store/store.hpp new file mode 100644 index 0000000..618e11c --- /dev/null +++ b/include/store/store.hpp @@ -0,0 +1,86 @@ +/* +* This file is part of Universal-Updater +* Copyright (C) 2019-2020 Universal-Team +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +* Additional Terms 7.b and 7.c of GPLv3 apply to this file: +* * Requiring preservation of specified reasonable legal notices or +* author attributions in that material or in the Appropriate Legal +* Notices displayed by works containing it. +* * Prohibiting misrepresentation of the origin of that material, +* or requiring that modified versions of such material be marked in +* reasonable ways as different from the original version. +*/ + +#ifndef _UNIVERSAL_UPDATER_STORE_HPP +#define _UNIVERSAL_UPDATER_STORE_HPP + +#include "json.hpp" +#include +#include + +class Store { +public: + Store(const std::string &file); + ~Store(); + void LoadFromFile(const std::string &file); + void loadSheets(); + void unloadSheets(); + void update(const std::string &file); + + /* Get Information of the UniStore itself. */ + std::string GetUniStoreTitle() const; + std::string GetUniStoreAuthor() const; + + /* Get Information of the UniStore Entries. */ + std::string GetTitleEntry(const int &index) const; + std::string GetAuthorEntry(const int &index) const; + std::string GetDescriptionEntry(const int &index) const; + std::vector GetCategoryIndex(const int &index) const; + std::string GetVersionEntry(const int &index) const; + std::vector GetConsoleEntry(const int &index) const; + std::string GetLastUpdatedEntry(const int &index) const; + std::string GetLicenseEntry(const int &index) const; + C2D_Image GetIconEntry(const int &index) const; + + std::vector GetDownloadList(const int &index) const; + + int GetStoreSize() const { return (int)this->storeJson["storeContent"].size(); }; + + int GetScreenIndx() const { return this->screenIndex; }; + void SetScreenIndx(int v) { this->screenIndex = v; }; + + int GetEntry() const { return this->entry; }; + void SetEntry(int v) { this->entry = v; }; + + int GetBox() const { return this->box; }; + void SetBox(int v) { this->box = v; }; + + int GetDownloadSIndex() const { return this->downIndex; }; + void SetDownloadSIndex(int v) { this->downIndex = v; }; + + int GetDownloadIndex() const { return this->downEntry; }; + void SetDownloadIndex(int v) { this->downEntry = v; }; + + nlohmann::json &GetJson() { return this->storeJson; }; + bool GetValid() const { return this->valid; }; +private: + nlohmann::json storeJson = nullptr; + std::vector sheets; + bool valid = false; + int screenIndex = 0, entry = 0, box = 0, downEntry = 0, downIndex = 0; +}; + +#endif \ No newline at end of file diff --git a/include/store/storeEntry.hpp b/include/store/storeEntry.hpp new file mode 100644 index 0000000..43664ab --- /dev/null +++ b/include/store/storeEntry.hpp @@ -0,0 +1,72 @@ +/* +* This file is part of Universal-Updater +* Copyright (C) 2019-2020 Universal-Team +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +* Additional Terms 7.b and 7.c of GPLv3 apply to this file: +* * Requiring preservation of specified reasonable legal notices or +* author attributions in that material or in the Appropriate Legal +* Notices displayed by works containing it. +* * Prohibiting misrepresentation of the origin of that material, +* or requiring that modified versions of such material be marked in +* reasonable ways as different from the original version. +*/ + +#ifndef _UNIVERSAL_UPDATER_STORE_ENTRY_HPP +#define _UNIVERSAL_UPDATER_STORE_ENTRY_HPP + +#include "meta.hpp" +#include "store.hpp" +#include "stringutils.hpp" + +class StoreEntry { +public: + StoreEntry(const std::unique_ptr &store, const std::unique_ptr &meta, const int &index); + + std::string GetTitle() const { return this->Title; }; + std::string GetAuthor() const { return this->Author; }; + std::string GetDescription() const { return this->Description; }; + std::string GetCategory() const { return this->Category; }; + std::string GetVersion() const { return this->Version; }; + std::string GetConsole() const { return this->Console; }; + std::string GetLastUpdated() const { return this->LastUpdated; }; + std::string GetLicense() const { return this->License; }; + int GetMarks() const { return this->Marks; }; + + C2D_Image GetIcon() const { return this->Icon; }; + + int GetSheetIndex() const { return this->SheetIndex; }; + int GetEntryIndex() const { return this->EntryIndex; }; + + std::vector GetCategoryFull() const { return this->FullCategory; }; + std::vector GetConsoleFull() const { return this->FullConsole; }; + + bool GetUpdateAvl() const { return this->UpdateAvailable; }; + void SetUpdateAvl(const bool &v) { this->UpdateAvailable = v; }; + + void SetMark(const int &marks) { + this->Marks = marks; + this->MarkString = StringUtils::GetMarkString(this->Marks); + }; + +private: + std::string Title, Author, Description, Category, Version, Console, LastUpdated, License, MarkString; + C2D_Image Icon; + int SheetIndex, EntryIndex, Marks; + std::vector FullCategory, FullConsole; + bool UpdateAvailable; +}; + +#endif \ No newline at end of file diff --git a/include/store/storeUtils.hpp b/include/store/storeUtils.hpp new file mode 100644 index 0000000..b9e48b0 --- /dev/null +++ b/include/store/storeUtils.hpp @@ -0,0 +1,99 @@ +/* +* This file is part of Universal-Updater +* Copyright (C) 2019-2020 Universal-Team +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +* Additional Terms 7.b and 7.c of GPLv3 apply to this file: +* * Requiring preservation of specified reasonable legal notices or +* author attributions in that material or in the Appropriate Legal +* Notices displayed by works containing it. +* * Prohibiting misrepresentation of the origin of that material, +* or requiring that modified versions of such material be marked in +* reasonable ways as different from the original version. +*/ + +#ifndef _UNIVERSAL_UPDATER_STORE_UTILS_HPP +#define _UNIVERSAL_UPDATER_STORE_UTILS_HPP + +#include "common.hpp" +#include "store.hpp" +#include "storeEntry.hpp" +#include + +enum class SortType : uint8_t { + TITLE, + AUTHOR, + LAST_UPDATED +}; + +namespace StoreUtils { + /* Grid. */ + void DrawGrid(const std::unique_ptr &store, const std::vector> &entries); + void GridLogic(u32 hDown, u32 hHeld, touchPosition touch, std::unique_ptr &store, std::vector> &entries, int ¤tMode, int &lastMode, bool &fetch, int &smallDelay); + + /* Top List. */ + void DrawList(const std::unique_ptr &store, const std::vector> &entries); + void ListLogic(u32 hDown, u32 hHeld, touchPosition touch, std::unique_ptr &store, std::vector> &entries, int ¤tMode, int &lastMode, bool &fetch, int &smallDelay); + + /* Entry Info. */ + void DrawEntryInfo(const std::unique_ptr &store, const std::unique_ptr &entry); + void EntryHandle(u32 hDown, u32 hHeld, touchPosition touch, bool &showMark, bool &fetch); + + /* Side Menu. */ + void DrawSideMenu(const int ¤tMenu); + void SideMenuHandle(u32 hDown, touchPosition touch, int ¤tMenu, bool &fetch); + + /* Download Entries. */ + void DrawDownList(const std::unique_ptr &store, const std::vector &entries, const bool &fetch); + void DownloadHandle(u32 hDown, u32 hHeld, touchPosition touch, const std::unique_ptr &store, const std::unique_ptr &entry, const std::vector &entries, int ¤tMenu, std::unique_ptr &meta, const int &lastMode, int &smallDelay); + + /* Search + Favorite Menu. */ + void DrawSearchMenu(const std::vector &searchIncludes, const std::string &searchResult, const int &marks, const bool &updateFilter); + void SearchHandle(u32 hDown, u32 hHeld, touchPosition touch, std::unique_ptr &store, std::vector> &entries, std::vector &searchIncludes, std::unique_ptr &meta, std::string &searchResult, int &marks, bool &updateFilter, bool ascending, SortType sorttype); + + /* Mark Menu. */ + void DisplayMarkBox(const int &marks); + void MarkHandle(u32 hDown, u32 hHeld, touchPosition touch, std::unique_ptr &entry, const std::unique_ptr &store, bool &showMark, std::unique_ptr &meta); + + /* Credits. */ + void DrawCredits(); + + /* Settings. */ + void DrawSettings(const int &page, const int &selection); + void SettingsHandle(u32 hDown, u32 hHeld, touchPosition touch, int &page, bool &dspSettings, int &storeMode, int &selection, std::unique_ptr &store, std::vector> &entries, std::unique_ptr &meta); + + /* Sorting. */ + void DrawSorting(const bool &asc, const SortType &st); + void SortHandle(u32 hDown, u32 hHeld, touchPosition touch, std::unique_ptr &store, std::vector> &entries, bool &asc, SortType &st); + + bool compareTitleDescending(const std::unique_ptr &a, const std::unique_ptr &b); + bool compareTitleAscending(const std::unique_ptr &a, const std::unique_ptr &b); + + bool compareAuthorDescending(const std::unique_ptr &a, const std::unique_ptr &b); + bool compareAuthorAscending(const std::unique_ptr &a, const std::unique_ptr &b); + + bool compareUpdateDescending(const std::unique_ptr &a, const std::unique_ptr &b); + bool compareUpdateAscending(const std::unique_ptr &a, const std::unique_ptr &b); + + void SortEntries(const bool &Ascending, const SortType &sorttype, std::vector> &entries); + + void search(std::vector> &entries, const std::string &query, bool title, bool author, bool category, bool console, int selectedMarks, bool updateAvl); + + void FilterUpdateAvailable(std::vector> &entries); + + void ResetAll(const std::unique_ptr &store, const std::unique_ptr &meta, std::vector> &entries); +}; + +#endif \ No newline at end of file diff --git a/include/animation.hpp b/include/utils/animation.hpp similarity index 90% rename from include/animation.hpp rename to include/utils/animation.hpp index cca4a31..c843f85 100644 --- a/include/animation.hpp +++ b/include/utils/animation.hpp @@ -37,10 +37,7 @@ enum class ProgressBar { }; namespace Animation { - // Progressbar. - void DrawProgressBar(u64 currentProgress, u64 totalProgress); - // Draw Button. - void Button(int x, int y, float speed = .030); -} + void DrawProgressBar(const u64 ¤tProgress, const u64 &totalProgress); +}; #endif \ No newline at end of file diff --git a/include/utils/cia.hpp b/include/utils/cia.hpp index f614aee..8fb7ae3 100644 --- a/include/utils/cia.hpp +++ b/include/utils/cia.hpp @@ -1,3 +1,29 @@ +/* +* This file is part of Universal-Updater +* Copyright (C) 2019-2020 Universal-Team +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +* Additional Terms 7.b and 7.c of GPLv3 apply to this file: +* * Requiring preservation of specified reasonable legal notices or +* author attributions in that material or in the Appropriate Legal +* Notices displayed by works containing it. +* * Prohibiting misrepresentation of the origin of that material, +* or requiring that modified versions of such material be marked in +* reasonable ways as different from the original version. +*/ + #ifndef _UNIVERSAL_UPDATER_CIA_HPP #define _UNIVERSAL_UPDATER_CIA_HPP @@ -5,8 +31,8 @@ #include <3ds.h> -Result CIA_LaunchTitle(u64 titleId, FS_MediaType mediaType); -Result deletePrevious(u64 titleid, FS_MediaType media); -Result installCia(const char * ciaPath, bool updateSelf); +Result CIA_LaunchTitle(const u64 &titleId, const FS_MediaType &mediaType); +Result deletePrevious(const u64 &titleid, const FS_MediaType &media); +Result installCia(const char *ciaPath, const bool &updateSelf); #endif \ No newline at end of file diff --git a/include/utils/colorHelper.hpp b/include/utils/colorHelper.hpp deleted file mode 100644 index 3de2145..0000000 --- a/include/utils/colorHelper.hpp +++ /dev/null @@ -1,60 +0,0 @@ -/* -* This file is part of Universal-Updater -* Copyright (C) 2019-2020 Universal-Team -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -* Additional Terms 7.b and 7.c of GPLv3 apply to this file: -* * Requiring preservation of specified reasonable legal notices or -* author attributions in that material or in the Appropriate Legal -* Notices displayed by works containing it. -* * Prohibiting misrepresentation of the origin of that material, -* or requiring that modified versions of such material be marked in -* reasonable ways as different from the original version. -*/ - -#ifndef _UNIVERSAL_UPDATER_COLOR_HELPER_HPP -#define _UNIVERSAL_UPDATER_COLOR_HELPER_HPP - -#include -#include -#include -#include - -/** - * @brief Creates a 8 byte RGBA color - * @param r red component of the color - * @param g green component of the color - * @param b blue component of the color - * @param a alpha component of the color - */ -#define RGBA8(r, g, b, a) ((((r)&0xFF)<<0) | (((g)&0xFF)<<8) | (((b)&0xFF)<<16) | (((a)&0xFF)<<24)) - -#define BarColor C2D_Color32(57, 84, 114, 255) -#define TopBGColor C2D_Color32(96, 168, 192, 255) -#define BottomBGColor C2D_Color32(38, 44, 77, 255) -#define SelectedColordefault C2D_Color32(120, 192, 216, 255) -#define UnselectedColordefault C2D_Color32(77, 118, 132, 255) -#define BLACK C2D_Color32(0, 0, 0, 255) -#define WHITE C2D_Color32(255, 255, 255, 255) -#define TRANSPARENT C2D_Color32(0, 0, 0, 0) - -typedef u32 Color; - -namespace ColorHelper { - int getColorValue(int color, int bgr); - std::string getColorName(int color, int bgr); -} - -#endif \ No newline at end of file diff --git a/include/utils/common.hpp b/include/utils/common.hpp deleted file mode 100644 index a2037eb..0000000 --- a/include/utils/common.hpp +++ /dev/null @@ -1,76 +0,0 @@ -/* -* This file is part of Universal-Updater -* Copyright (C) 2019-2020 Universal-Team -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -* Additional Terms 7.b and 7.c of GPLv3 apply to this file: -* * Requiring preservation of specified reasonable legal notices or -* author attributions in that material or in the Appropriate Legal -* Notices displayed by works containing it. -* * Prohibiting misrepresentation of the origin of that material, -* or requiring that modified versions of such material be marked in -* reasonable ways as different from the original version. -*/ - -#pragma once - -#include <3ds.h> - -#ifdef __cplusplus -extern "C" { -#endif -#include "files.h" - -#include -#include -#include -#include -#include - -#ifdef __cplusplus -} - -#include "animation.hpp" -#include "config.hpp" -#include "gfx.hpp" -#include "gui.hpp" -#include "json.hpp" -#include "lang.hpp" -#include "msg.hpp" -#include "screenCommon.hpp" -#include "stringutils.hpp" - -#include -#include -#include -#include -#include -#include - -using json = nlohmann::json; - -#endif - -#define WORKING_DIR "/" -#define SCRIPTS_PATH "sdmc:/3ds/Universal-Updater/scripts/" // The Scripts will be here. -#define MUSIC_PATH "sdmc:/3ds/Universal-Updater/Music.wav" // Default Music File / Path. -#define SCRIPT_VERSION 4 -#define STORE_PATH "sdmc:/3ds/Universal-Updater/stores/" // Default Store path. -#define ENTRIES_PER_SCREEN 3 -#define ENTRIES_PER_LIST 7 -#define metaFile "sdmc:/3ds/Universal-Updater/ScriptInfo.json" -#define _3DSX_PATH "sdmc:/3ds" -#define _NDS_PATH "sdmc:" -#define ARCHIVES_DEFAULT "sdmc:" \ No newline at end of file diff --git a/include/utils/config.hpp b/include/utils/config.hpp index aec97d9..f0a9f08 100644 --- a/include/utils/config.hpp +++ b/include/utils/config.hpp @@ -1,161 +1,91 @@ -/* -* This file is part of Universal-Updater -* Copyright (C) 2019-2020 Universal-Team -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -* Additional Terms 7.b and 7.c of GPLv3 apply to this file: -* * Requiring preservation of specified reasonable legal notices or -* author attributions in that material or in the Appropriate Legal -* Notices displayed by works containing it. -* * Prohibiting misrepresentation of the origin of that material, -* or requiring that modified versions of such material be marked in -* reasonable ways as different from the original version. -*/ - -#ifndef _UNIVERSAL_UPDATER_CONFIG_HPP -#define _UNIVERSAL_UPDATER_CONFIG_HPP - -#include "json.hpp" - -#include <3ds.h> -#include - -class Config { -public: - Config(); - void save(); - void initialize(); - void addMissingThings(); - void sysLang(); - - // Bar Color. - u32 barColor() { return this->v_barColor; } - void barColor(u32 v) { this->v_barColor = v; if (!this->changesMade) this->changesMade = true; } - // Top BG Color. - u32 topBG() { return this->v_topBG; } - void topBG(u32 v) { this->v_topBG = v; if (!this->changesMade) this->changesMade = true; } - // Bottom BG Color. - u32 bottomBG() { return this->v_bottomBG; } - void bottomBG(u32 v) { this->v_bottomBG = v; if (!this->changesMade) this->changesMade = true; } - // Text Color. - u32 textColor() { return this->v_textColor; } - void textColor(u32 v) { this->v_textColor = v; if (!this->changesMade) this->changesMade = true; } - // Button Color. - u32 buttonColor() { return this->v_buttonColor; } - void buttonColor(u32 v) { this->v_buttonColor = v; if (!this->changesMade) this->changesMade = true; } - // Selected Color. - u32 selectedColor() { return this->v_selectedColor; } - void selectedColor(u32 v) { this->v_selectedColor = v; if (!this->changesMade) this->changesMade = true; } - // Unselected Color. - u32 unselectedColor() { return this->v_unselectedColor; } - void unselectedColor(u32 v) { this->v_unselectedColor = v; if (!this->changesMade) this->changesMade = true; } - // Script Path. - std::string scriptPath() { return this->v_scriptPath; } - void scriptPath(std::string v) { this->v_scriptPath = v; if (!this->changesMade) this->changesMade = true; } - // Lang Path. - int langPath() { return this->v_langPath; } - void langPath(int v) { this->v_langPath = v; if (!this->changesMade) this->changesMade = true; } - // View Mode. - int viewMode() { return this->v_viewMode; } - void viewMode(int v) { this->v_viewMode = v; if (!this->changesMade) this->changesMade = true; } - // Progressbar Color. - u32 progressbarColor() { return this->v_progressbarColor; } - void progressbarColor(u32 v) { this->v_progressbarColor = v; if (!this->changesMade) this->changesMade = true; } - // Music Path. - std::string musicPath() { return this->v_musicPath; } - void musicPath(std::string v) { this->v_musicPath = v; if (!this->changesMade) this->changesMade = true; } - // Logging. - bool logging() { return this->v_logging; } - void logging(bool v) { this->v_logging = v; if (!this->changesMade) this->changesMade = true; } - // Use bars. - bool useBars() { return this->v_useBars; } - void useBars(bool v) { this->v_useBars = v; if (!this->changesMade) this->changesMade = true; } - // Autoboot. - int autoboot() { return this->v_autoboot; } - void autoboot(int v) { this->v_autoboot = v; if (!this->changesMade) this->changesMade = true; } - // Store Path. - std::string storePath() { return this->v_storePath; } - void storePath(std::string v) { this->v_storePath = v; if (!this->changesMade) this->changesMade = true; } - // Autoboto file. - std::string autobootFile() { return this->v_autobootFile; } - void autobootFile(std::string v) { this->v_autobootFile = v; if (!this->changesMade) this->changesMade = true; } - // Outdated Script Color. - u32 outdatedColor() { return this->v_outdatedColor; } - void outdatedColor(u32 v) { this->v_outdatedColor = v; if (!this->changesMade) this->changesMade = true; } - // Uptodate Script Color. - u32 uptodateColor() { return this->v_uptodateColor; } - void uptodateColor(u32 v) { this->v_uptodateColor = v; if (!this->changesMade) this->changesMade = true; } - // Not found Script Color. - u32 notfoundColor() { return this->v_notfoundColor; } - void notfoundColor(u32 v) { this->v_notfoundColor = v; if (!this->changesMade) this->changesMade = true; } - // Future Script Color. - u32 futureColor() { return this->v_futureColor; } - void futureColor(u32 v) { this->v_futureColor = v; if (!this->changesMade) this->changesMade = true; } - // Keydelay. - int keyDelay() { return this->v_keyDelay; } - void keyDelay(int v) { this->v_keyDelay = v; if (!this->changesMade) this->changesMade = true; } - // Screen Fade. - bool screenFade() { return this->v_screenFade; } - void screenFade(bool v) { this->v_screenFade = v; if (!this->changesMade) this->changesMade = true; } - // Progressbar Display. - bool progressDisplay() { return this->v_progressDisplay; } - void progressDisplay(bool v) { this->v_progressDisplay = v; if (!this->changesMade) this->changesMade = true; } - // Language. - std::string language() { return this->v_language; } - void language(std::string v) { this->v_language = v; if (!this->changesMade) this->changesMade = true; } - // First startup. - bool firstStartup() { return this->v_firstStartup; } - void firstStartup(bool v) { this->v_firstStartup = v; if (!this->changesMade) this->changesMade = true; } - // Use ScriptColors. - bool useScriptColor() { return this->v_useScriptColor; } - void useScriptColor(bool v) { this->v_useScriptColor = v; if (!this->changesMade) this->changesMade = true; } - // Show Downloadspeed. - bool showSpeed() { return this->v_showSpeed; } - void showSpeed(bool v) { this->v_showSpeed = v; if (!this->changesMade) this->changesMade = true; } - // Citra stuff. - bool citra() { return this->v_citra; } - void citra(bool v) { this->v_citra = v; if (!this->changesMade) this->changesMade = true; } - // Variables. - std::string _3dsxpath() { return this->v_3dsx_install_path; } - void _3dsxpath(std::string v) { this->v_3dsx_install_path = v; if (!this->changesMade) this->changesMade = true; } - std::string ndspath() { return this->v_nds_install_path; } - void ndspath(std::string v) { this->v_nds_install_path = v; if (!this->changesMade) this->changesMade = true; } - std::string archivepath() { return this->v_archive_path; } - void archivepath(std::string v) { this->v_archive_path = v; if (!this->changesMade) this->changesMade = true; } - - // Mainly helper. - bool getBool(const std::string &key); - void setBool(const std::string &key, bool v); - int getInt(const std::string &key); - void setInt(const std::string &key, int v); - std::string getString(const std::string &key); - void setString(const std::string &key, const std::string &v); -private: - nlohmann::json json; // Our private JSON file. - bool changesMade = false, initialChanges = false; - int configVersion = 2; - - // Color variables and more. - u32 v_barColor, v_topBG, v_bottomBG, v_textColor, v_buttonColor, v_selectedColor, v_unselectedColor, v_progressbarColor, - v_outdatedColor, v_uptodateColor, v_notfoundColor, v_futureColor; - std::string v_scriptPath, v_musicPath, v_storePath, v_autobootFile, v_language; - int v_langPath, v_viewMode, v_autoboot, v_keyDelay; - bool v_logging, v_useBars, v_screenFade, v_progressDisplay, v_firstStartup, v_useScriptColor, v_showSpeed, v_citra; - - // Some variables. - std::string v_3dsx_install_path, v_nds_install_path, v_archive_path; -}; - -#endif +/* +* This file is part of Universal-Updater +* Copyright (C) 2019-2020 Universal-Team +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +* Additional Terms 7.b and 7.c of GPLv3 apply to this file: +* * Requiring preservation of specified reasonable legal notices or +* author attributions in that material or in the Appropriate Legal +* Notices displayed by works containing it. +* * Prohibiting misrepresentation of the origin of that material, +* or requiring that modified versions of such material be marked in +* reasonable ways as different from the original version. +*/ + +#ifndef _UNIVERSAL_UPDATER_CONFIG_HPP +#define _UNIVERSAL_UPDATER_CONFIG_HPP + +#include "json.hpp" + +#include <3ds.h> +#include + +class Config { +public: + Config(); + void save(); + void initialize(); + void sysLang(); + + /* Language. */ + std::string language() const { return this->v_language; }; + void language(const std::string &v) { this->v_language = v; if (!this->changesMade) this->changesMade = true; }; + + /* Last Store. */ + std::string lastStore() const { return this->v_lastStore; }; + void lastStore(const std::string &v) { this->v_lastStore = v; if (!this->changesMade) this->changesMade = true; }; + + /* Using Top List. */ + bool list() const { return this->v_list; }; + void list(bool v) { this->v_list = v; if (!this->changesMade) this->changesMade = true; }; + + /* Auto update on boot. */ + bool autoupdate() const { return this->v_autoUpdate; }; + void autoupdate(bool v) { this->v_autoUpdate = v; if (!this->changesMade) this->changesMade = true; }; + + std::string _3dsxPath() const { return this->v_3dsxPath; }; + void _3dsxPath(const std::string &v) { this->v_3dsxPath = v; if (!this->changesMade) this->changesMade = true; }; + + std::string ndsPath() const { return this->v_ndsPath; }; + void ndsPath(const std::string &v) { this->v_ndsPath = v; if (!this->changesMade) this->changesMade = true; }; + + std::string archPath() const { return this->v_archivePath; }; + void archPath(const std::string &v) { this->v_archivePath = v; if (!this->changesMade) this->changesMade = true; }; + + /* Fetching old metadata. */ + bool metadata() const { return this->v_metadata; }; + void metadata(bool v) { this->v_metadata = v; if (!this->changesMade) this->changesMade = true; }; + + /* U-U Update check on startup. */ + bool updatecheck() const { return this->v_updateCheck; }; + void updatecheck(bool v) { this->v_updateCheck = v; if (!this->changesMade) this->changesMade = true; }; +private: + /* Mainly helper. */ + bool getBool(const std::string &key); + void setBool(const std::string &key, bool v); + int getInt(const std::string &key); + void setInt(const std::string &key, int v); + std::string getString(const std::string &key); + void setString(const std::string &key, const std::string &v); + + nlohmann::json json; + bool changesMade = false; + + std::string v_language = "en", v_lastStore = "universal-db-beta.unistore", + v_3dsxPath = "sdmc:/3ds", v_ndsPath = "sdmc:", v_archivePath = "sdmc:"; + bool v_list = false, v_autoUpdate = true, v_metadata = true, v_updateCheck = true; +}; + +#endif diff --git a/include/utils/download.hpp b/include/utils/download.hpp new file mode 100644 index 0000000..883d46a --- /dev/null +++ b/include/utils/download.hpp @@ -0,0 +1,75 @@ +/* +* This file is part of Universal-Updater +* Copyright (C) 2019-2020 Universal-Team +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +* Additional Terms 7.b and 7.c of GPLv3 apply to this file: +* * Requiring preservation of specified reasonable legal notices or +* author attributions in that material or in the Appropriate Legal +* Notices displayed by works containing it. +* * Prohibiting misrepresentation of the origin of that material, +* or requiring that modified versions of such material be marked in +* reasonable ways as different from the original version. +*/ + +#ifndef _UNIVERSAL_UPDATER_DOWNLOAD_HPP +#define _UNIVERSAL_UPDATER_DOWNLOAD_HPP + +#include "common.hpp" + +#define APP_TITLE "Universal-Updater" +#define VERSION_STRING "3.0.0" + +enum DownloadError { + DL_ERROR_NONE = 0, + DL_ERROR_WRITEFILE, + DL_ERROR_ALLOC, + DL_ERROR_STATUSCODE, + DL_ERROR_GIT, + DL_CANCEL, // No clue if that's needed tho. +}; + +Result downloadToFile(const std::string &url, const std::string &path); +Result downloadFromRelease(const std::string &url, const std::string &asset, const std::string &path, const bool &includePrereleases); + +/* + Check Wi-Fi status. + @return True if Wi-Fi is connected; false if not. +*/ +bool checkWifiStatus(void); + +/* + Display "Please connect to Wi-Fi" for 2s. +*/ +void notConnectedMsg(void); + +/* + Display "Not Implemented Yet" for 2s. +*/ +void notImplemented(void); + +/* + Display the done msg. +*/ +void doneMsg(void); + +void displayProgressBar(); +bool IsUpdateAvailable(const std::string &URL, const int &revCurrent); +bool DownloadUniStore(const std::string &URL, const int ¤tRev, std::string &fl, const bool &isDownload = false, const bool &isUDB = false); +bool DownloadSpriteSheet(const std::string &URL, const std::string &file); +bool IsUUUpdateAvailable(); +void UpdateAction(); + +#endif \ No newline at end of file diff --git a/include/utils/extract.hpp b/include/utils/extract.hpp index f6ffef3..13b4307 100644 --- a/include/utils/extract.hpp +++ b/include/utils/extract.hpp @@ -1,44 +1,44 @@ -/* -* This file is part of Universal-Updater -* Copyright (C) 2019-2020 Universal-Team -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -* Additional Terms 7.b and 7.c of GPLv3 apply to this file: -* * Requiring preservation of specified reasonable legal notices or -* author attributions in that material or in the Appropriate Legal -* Notices displayed by works containing it. -* * Prohibiting misrepresentation of the origin of that material, -* or requiring that modified versions of such material be marked in -* reasonable ways as different from the original version. -*/ - -#ifndef _UNIVERSAL_UPDATER_EXTRACT_HPP -#define _UNIVERSAL_UPDATER_EXTRACT_HPP - -#include "common.hpp" - -enum ExtractError { - EXTRACT_ERROR_NONE = 0, - EXTRACT_ERROR_ARCHIVE, - EXTRACT_ERROR_ALLOC, - EXTRACT_ERROR_FIND, - EXTRACT_ERROR_READFILE, - EXTRACT_ERROR_OPENFILE, - EXTRACT_ERROR_WRITEFILE, -}; - -Result extractArchive(std::string archivePath, std::string wantedFile, std::string outputPath); - +/* +* This file is part of Universal-Updater +* Copyright (C) 2019-2020 Universal-Team +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +* Additional Terms 7.b and 7.c of GPLv3 apply to this file: +* * Requiring preservation of specified reasonable legal notices or +* author attributions in that material or in the Appropriate Legal +* Notices displayed by works containing it. +* * Prohibiting misrepresentation of the origin of that material, +* or requiring that modified versions of such material be marked in +* reasonable ways as different from the original version. +*/ + +#ifndef _UNIVERSAL_UPDATER_EXTRACT_HPP +#define _UNIVERSAL_UPDATER_EXTRACT_HPP + +#include "common.hpp" + +enum ExtractError { + EXTRACT_ERROR_NONE = 0, + EXTRACT_ERROR_ARCHIVE, + EXTRACT_ERROR_ALLOC, + EXTRACT_ERROR_FIND, + EXTRACT_ERROR_READFILE, + EXTRACT_ERROR_OPENFILE, + EXTRACT_ERROR_WRITEFILE, +}; + +Result extractArchive(const std::string &archivePath, const std::string &wantedFile, const std::string &outputPath); + #endif \ No newline at end of file diff --git a/include/utils/fileBrowse.hpp b/include/utils/fileBrowse.hpp index f7e34be..3812316 100644 --- a/include/utils/fileBrowse.hpp +++ b/include/utils/fileBrowse.hpp @@ -32,25 +32,34 @@ #include #include -using namespace std; - struct DirEntry { std::string name; std::string path; bool isDirectory; - off_t size; }; -bool nameEndsWith(const std::string& name, const std::vector extensionList); -void getDirectoryContents(std::vector& dirContents, const std::vector extensionList); -void getDirectoryContents(std::vector& dirContents); +/* + UniStore Info struct. +*/ +struct UniStoreInfo { + std::string Title; + std::string Author; + std::string URL; + std::string FileName; + std::string Description; + int Version; + int Revision; + int StoreSize; +}; + +bool nameEndsWith(const std::string &name, const std::vector &extensionList); +void getDirectoryContents(std::vector &dirContents, const std::vector &extensionList); +void getDirectoryContents(std::vector &dirContents); std::vector getContents(const std::string &name, const std::vector &extensionList); -bool returnIfExist(const std::string &path, const std::vector &extensionList); +std::vector GetUniStoreInfo(const std::string &path); -std::string selectFilePath(std::string selectText, std::string initialPath, const std::vector &extensionList, int selectionMode = 1); - -void dirCopy(DirEntry* entry, int i, const char *destinationPath, const char *sourcePath); +void dirCopy(DirEntry *entry, const char *destinationPath, const char *sourcePath); int fcopy(const char *sourcePath, const char *destinationPath); #endif \ No newline at end of file diff --git a/include/utils/formatting.hpp b/include/utils/files.hpp similarity index 79% rename from include/utils/formatting.hpp rename to include/utils/files.hpp index 7bedb93..b1e58ca 100644 --- a/include/utils/formatting.hpp +++ b/include/utils/files.hpp @@ -1,34 +1,38 @@ -/* -* This file is part of Universal-Updater -* Copyright (C) 2019-2020 Universal-Team -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -* Additional Terms 7.b and 7.c of GPLv3 apply to this file: -* * Requiring preservation of specified reasonable legal notices or -* author attributions in that material or in the Appropriate Legal -* Notices displayed by works containing it. -* * Prohibiting misrepresentation of the origin of that material, -* or requiring that modified versions of such material be marked in -* reasonable ways as different from the original version. -*/ - -#ifndef _UNIVERSAL_UPDATER_FORMATTING_HPP -#define _UNIVERSAL_UPDATER_FORMATTING_HPP - -#include - -std::string formatBytes(int bytes); - +/* +* This file is part of Universal-Updater +* Copyright (C) 2019-2020 Universal-Team +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +* Additional Terms 7.b and 7.c of GPLv3 apply to this file: +* * Requiring preservation of specified reasonable legal notices or +* author attributions in that material or in the Appropriate Legal +* Notices displayed by works containing it. +* * Prohibiting misrepresentation of the origin of that material, +* or requiring that modified versions of such material be marked in +* reasonable ways as different from the original version. +*/ + +#ifndef _UNIVERSAL_UPDATER_FILES_HPP +#define _UNIVERSAL_UPDATER_FILES_HPP + +#include "common.hpp" + +Result makeDirs(const char *path); +Result openFile(Handle *fileHandle, const char *path, const bool &write); +Result deleteFile(const char *path); +Result removeDir(const char *path); +Result removeDirRecursive(const char *path); + #endif \ No newline at end of file diff --git a/include/utils/json.hpp b/include/utils/json.hpp index cc822a5..a70aaf8 100644 --- a/include/utils/json.hpp +++ b/include/utils/json.hpp @@ -1,7 +1,7 @@ /* __ _____ _____ _____ __| | __| | | | JSON for Modern C++ -| | |__ | | | | | | version 3.8.0 +| | |__ | | | | | | version 3.9.1 |_____|_____|_____|_|___| https://github.com/nlohmann/json Licensed under the MIT License . @@ -31,11 +31,10 @@ SOFTWARE. #define INCLUDE_NLOHMANN_JSON_HPP_ #define NLOHMANN_JSON_VERSION_MAJOR 3 -#define NLOHMANN_JSON_VERSION_MINOR 8 -#define NLOHMANN_JSON_VERSION_PATCH 0 +#define NLOHMANN_JSON_VERSION_MINOR 9 +#define NLOHMANN_JSON_VERSION_PATCH 1 #include // all_of, find, for_each -#include // assert #include // nullptr_t, ptrdiff_t, size_t #include // hash, less #include // initializer_list @@ -67,16 +66,6 @@ SOFTWARE. #include // pair, declval #include // valarray -// #include - - -// Header is removed in C++20. -// See for more information. - -#if __cplusplus <= 201703L - #include // and, not, or -#endif - // #include @@ -2048,7 +2037,11 @@ JSON_HEDLEY_DIAGNOSTIC_POP #endif // C++ language standard detection -#if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 +#if (defined(__cplusplus) && __cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + #define JSON_HAS_CPP_20 + #define JSON_HAS_CPP_17 + #define JSON_HAS_CPP_14 +#elif (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 #define JSON_HAS_CPP_17 #define JSON_HAS_CPP_14 #elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) @@ -2101,6 +2094,12 @@ JSON_HEDLEY_DIAGNOSTIC_POP #define JSON_INTERNAL_CATCH JSON_INTERNAL_CATCH_USER #endif +// allow to override assert +#if !defined(JSON_ASSERT) + #include // assert + #define JSON_ASSERT(x) assert(x) +#endif + /*! @brief macro to briefly define a mapping between an enum and JSON @def NLOHMANN_JSON_SERIALIZE_ENUM @@ -2149,6 +2148,170 @@ JSON_HEDLEY_DIAGNOSTIC_POP NumberIntegerType, NumberUnsignedType, NumberFloatType, \ AllocatorType, JSONSerializer, BinaryType> +// Macros to simplify conversion from/to types + +#define NLOHMANN_JSON_EXPAND( x ) x +#define NLOHMANN_JSON_GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, NAME,...) NAME +#define NLOHMANN_JSON_PASTE(...) NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_GET_MACRO(__VA_ARGS__, \ + NLOHMANN_JSON_PASTE64, \ + NLOHMANN_JSON_PASTE63, \ + NLOHMANN_JSON_PASTE62, \ + NLOHMANN_JSON_PASTE61, \ + NLOHMANN_JSON_PASTE60, \ + NLOHMANN_JSON_PASTE59, \ + NLOHMANN_JSON_PASTE58, \ + NLOHMANN_JSON_PASTE57, \ + NLOHMANN_JSON_PASTE56, \ + NLOHMANN_JSON_PASTE55, \ + NLOHMANN_JSON_PASTE54, \ + NLOHMANN_JSON_PASTE53, \ + NLOHMANN_JSON_PASTE52, \ + NLOHMANN_JSON_PASTE51, \ + NLOHMANN_JSON_PASTE50, \ + NLOHMANN_JSON_PASTE49, \ + NLOHMANN_JSON_PASTE48, \ + NLOHMANN_JSON_PASTE47, \ + NLOHMANN_JSON_PASTE46, \ + NLOHMANN_JSON_PASTE45, \ + NLOHMANN_JSON_PASTE44, \ + NLOHMANN_JSON_PASTE43, \ + NLOHMANN_JSON_PASTE42, \ + NLOHMANN_JSON_PASTE41, \ + NLOHMANN_JSON_PASTE40, \ + NLOHMANN_JSON_PASTE39, \ + NLOHMANN_JSON_PASTE38, \ + NLOHMANN_JSON_PASTE37, \ + NLOHMANN_JSON_PASTE36, \ + NLOHMANN_JSON_PASTE35, \ + NLOHMANN_JSON_PASTE34, \ + NLOHMANN_JSON_PASTE33, \ + NLOHMANN_JSON_PASTE32, \ + NLOHMANN_JSON_PASTE31, \ + NLOHMANN_JSON_PASTE30, \ + NLOHMANN_JSON_PASTE29, \ + NLOHMANN_JSON_PASTE28, \ + NLOHMANN_JSON_PASTE27, \ + NLOHMANN_JSON_PASTE26, \ + NLOHMANN_JSON_PASTE25, \ + NLOHMANN_JSON_PASTE24, \ + NLOHMANN_JSON_PASTE23, \ + NLOHMANN_JSON_PASTE22, \ + NLOHMANN_JSON_PASTE21, \ + NLOHMANN_JSON_PASTE20, \ + NLOHMANN_JSON_PASTE19, \ + NLOHMANN_JSON_PASTE18, \ + NLOHMANN_JSON_PASTE17, \ + NLOHMANN_JSON_PASTE16, \ + NLOHMANN_JSON_PASTE15, \ + NLOHMANN_JSON_PASTE14, \ + NLOHMANN_JSON_PASTE13, \ + NLOHMANN_JSON_PASTE12, \ + NLOHMANN_JSON_PASTE11, \ + NLOHMANN_JSON_PASTE10, \ + NLOHMANN_JSON_PASTE9, \ + NLOHMANN_JSON_PASTE8, \ + NLOHMANN_JSON_PASTE7, \ + NLOHMANN_JSON_PASTE6, \ + NLOHMANN_JSON_PASTE5, \ + NLOHMANN_JSON_PASTE4, \ + NLOHMANN_JSON_PASTE3, \ + NLOHMANN_JSON_PASTE2, \ + NLOHMANN_JSON_PASTE1)(__VA_ARGS__)) +#define NLOHMANN_JSON_PASTE2(func, v1) func(v1) +#define NLOHMANN_JSON_PASTE3(func, v1, v2) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE2(func, v2) +#define NLOHMANN_JSON_PASTE4(func, v1, v2, v3) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE3(func, v2, v3) +#define NLOHMANN_JSON_PASTE5(func, v1, v2, v3, v4) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE4(func, v2, v3, v4) +#define NLOHMANN_JSON_PASTE6(func, v1, v2, v3, v4, v5) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE5(func, v2, v3, v4, v5) +#define NLOHMANN_JSON_PASTE7(func, v1, v2, v3, v4, v5, v6) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE6(func, v2, v3, v4, v5, v6) +#define NLOHMANN_JSON_PASTE8(func, v1, v2, v3, v4, v5, v6, v7) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE7(func, v2, v3, v4, v5, v6, v7) +#define NLOHMANN_JSON_PASTE9(func, v1, v2, v3, v4, v5, v6, v7, v8) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE8(func, v2, v3, v4, v5, v6, v7, v8) +#define NLOHMANN_JSON_PASTE10(func, v1, v2, v3, v4, v5, v6, v7, v8, v9) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE9(func, v2, v3, v4, v5, v6, v7, v8, v9) +#define NLOHMANN_JSON_PASTE11(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE10(func, v2, v3, v4, v5, v6, v7, v8, v9, v10) +#define NLOHMANN_JSON_PASTE12(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE11(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) +#define NLOHMANN_JSON_PASTE13(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE12(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) +#define NLOHMANN_JSON_PASTE14(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE13(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) +#define NLOHMANN_JSON_PASTE15(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE14(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) +#define NLOHMANN_JSON_PASTE16(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE15(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) +#define NLOHMANN_JSON_PASTE17(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE16(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) +#define NLOHMANN_JSON_PASTE18(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE17(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) +#define NLOHMANN_JSON_PASTE19(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE18(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) +#define NLOHMANN_JSON_PASTE20(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE19(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) +#define NLOHMANN_JSON_PASTE21(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE20(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) +#define NLOHMANN_JSON_PASTE22(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE21(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) +#define NLOHMANN_JSON_PASTE23(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE22(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) +#define NLOHMANN_JSON_PASTE24(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE23(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) +#define NLOHMANN_JSON_PASTE25(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE24(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) +#define NLOHMANN_JSON_PASTE26(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE25(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) +#define NLOHMANN_JSON_PASTE27(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE26(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) +#define NLOHMANN_JSON_PASTE28(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE27(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) +#define NLOHMANN_JSON_PASTE29(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE28(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) +#define NLOHMANN_JSON_PASTE30(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE29(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) +#define NLOHMANN_JSON_PASTE31(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE30(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) +#define NLOHMANN_JSON_PASTE32(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE31(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) +#define NLOHMANN_JSON_PASTE33(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE32(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) +#define NLOHMANN_JSON_PASTE34(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE33(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) +#define NLOHMANN_JSON_PASTE35(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE34(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) +#define NLOHMANN_JSON_PASTE36(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE35(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) +#define NLOHMANN_JSON_PASTE37(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE36(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) +#define NLOHMANN_JSON_PASTE38(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE37(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) +#define NLOHMANN_JSON_PASTE39(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE38(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) +#define NLOHMANN_JSON_PASTE40(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE39(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) +#define NLOHMANN_JSON_PASTE41(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE40(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) +#define NLOHMANN_JSON_PASTE42(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE41(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) +#define NLOHMANN_JSON_PASTE43(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE42(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) +#define NLOHMANN_JSON_PASTE44(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE43(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) +#define NLOHMANN_JSON_PASTE45(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE44(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) +#define NLOHMANN_JSON_PASTE46(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE45(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) +#define NLOHMANN_JSON_PASTE47(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE46(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) +#define NLOHMANN_JSON_PASTE48(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE47(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) +#define NLOHMANN_JSON_PASTE49(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE48(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) +#define NLOHMANN_JSON_PASTE50(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE49(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) +#define NLOHMANN_JSON_PASTE51(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE50(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) +#define NLOHMANN_JSON_PASTE52(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE51(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) +#define NLOHMANN_JSON_PASTE53(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE52(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) +#define NLOHMANN_JSON_PASTE54(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE53(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) +#define NLOHMANN_JSON_PASTE55(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE54(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) +#define NLOHMANN_JSON_PASTE56(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE55(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) +#define NLOHMANN_JSON_PASTE57(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE56(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) +#define NLOHMANN_JSON_PASTE58(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE57(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) +#define NLOHMANN_JSON_PASTE59(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE58(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) +#define NLOHMANN_JSON_PASTE60(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE59(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) +#define NLOHMANN_JSON_PASTE61(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE60(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) +#define NLOHMANN_JSON_PASTE62(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE61(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) +#define NLOHMANN_JSON_PASTE63(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE62(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) +#define NLOHMANN_JSON_PASTE64(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE63(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) + +#define NLOHMANN_JSON_TO(v1) nlohmann_json_j[#v1] = nlohmann_json_t.v1; +#define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1); + +/*! +@brief macro +@def NLOHMANN_DEFINE_TYPE_INTRUSIVE +@since version 3.9.0 +*/ +#define NLOHMANN_DEFINE_TYPE_INTRUSIVE(Type, ...) \ + friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE +@since version 3.9.0 +*/ +#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type, ...) \ + inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } + +#ifndef JSON_USE_IMPLICIT_CONVERSIONS + #define JSON_USE_IMPLICIT_CONVERSIONS 1 +#endif + +#if JSON_USE_IMPLICIT_CONVERSIONS + #define JSON_EXPLICIT +#else + #define JSON_EXPLICIT explicit +#endif + namespace nlohmann { @@ -2240,6 +2403,7 @@ json.exception.parse_error.110 | parse error at 1: cannot read 2 bytes from vect json.exception.parse_error.112 | parse error at 1: error reading CBOR; last byte: 0xF8 | Not all types of CBOR or MessagePack are supported. This exception occurs if an unsupported byte was read. json.exception.parse_error.113 | parse error at 2: expected a CBOR string; last byte: 0x98 | While parsing a map key, a value that is not a string has been read. json.exception.parse_error.114 | parse error: Unsupported BSON record type 0x0F | The parsing of the corresponding BSON record type is not implemented (yet). +json.exception.parse_error.115 | parse error at byte 5: syntax error while parsing UBJSON high-precision number: invalid number text: 1A | A UBJSON high-precision number could not be parsed. @note For an input with n bytes, 1 is the index of the first character and n+1 is the index of the terminating null byte or the end of file. This also @@ -2428,7 +2592,7 @@ json.exception.out_of_range.403 | key 'foo' not found | The provided key was not json.exception.out_of_range.404 | unresolved reference token 'foo' | A reference token in a JSON Pointer could not be resolved. json.exception.out_of_range.405 | JSON pointer has no parent | The JSON Patch operations 'remove' and 'add' can not be applied to the root element of the JSON value. json.exception.out_of_range.406 | number overflow parsing '10E1000' | A parsed number could not be stored as without changing it to NaN or INF. -json.exception.out_of_range.407 | number overflow serializing '9223372036854775808' | UBJSON and BSON only support integer numbers up to 9223372036854775807. | +json.exception.out_of_range.407 | number overflow serializing '9223372036854775808' | UBJSON and BSON only support integer numbers up to 9223372036854775807. (until version 3.8.0) | json.exception.out_of_range.408 | excessive array size: 8658170730974374167 | The size (following `#`) of an UBJSON array or object exceeds the maximal capacity. | json.exception.out_of_range.409 | BSON key cannot contain code point U+0000 (at byte 2) | Key identifiers to be serialized to BSON cannot contain code point U+0000, since the key is stored as zero-terminated c-string | @@ -2506,9 +2670,6 @@ class other_error : public exception #include // size_t #include // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type -// #include - - namespace nlohmann { namespace detail @@ -2574,8 +2735,6 @@ constexpr T static_const::value; #include // false_type, is_constructible, is_integral, is_same, true_type #include // declval -// #include - // #include @@ -2588,11 +2747,11 @@ namespace nlohmann { namespace detail { -template struct make_void +template struct make_void { using type = void; }; -template using void_t = typename make_void::type; +template using void_t = typename make_void::type; } // namespace detail } // namespace nlohmann @@ -2603,10 +2762,10 @@ namespace nlohmann { namespace detail { -template +template struct iterator_types {}; -template +template struct iterator_types < It, void_t +template struct iterator_traits { }; -template +template struct iterator_traits < T, enable_if_t < !std::is_pointer::value >> : iterator_types { }; -template +template struct iterator_traits::value>> { using iterator_category = std::random_access_iterator_tag; @@ -2671,39 +2830,39 @@ struct nonesuch void operator=(nonesuch&&) = delete; }; -template class Op, - class... Args> +template class Op, + class... Args> struct detector { using value_t = std::false_type; using type = Default; }; -template class Op, class... Args> +template class Op, class... Args> struct detector>, Op, Args...> { using value_t = std::true_type; using type = Op; }; -template