mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-03 00:39:02 +00:00
Universal-Updater Full Rewrite based of UniStore v3.0.0. (#51)
* No Nightlies for the Full-Rewrite. * Initial push, i guess. * Forgot to push the Test UniStore + T3X... * Use C2D flags for wrapping and centering * gitignore t3x correctly * Remove Test Store and hardcode to `sdmc:/3ds/Universal-Updater/stores/Universal-DB.unistore` for now. * Is functional now. * *More special checks and work.* * const <typename T> &. * Universal-DB, not Universal DB. * Derp. * Make 3DSX, NDS & Archive path configurable. * Last fixes + Fade out screen on exit. * See Desc. for more. - Add QR Code scan for downloading UniStores. - Add new Graphics. - Some fixes + improvements. * Fix search filtering, re-sort after search * Fix update check * Clear search items with X, not just reset results * The next progress. * PLEASE tell me, this is the only error.. Co-authored-by: Pk11 <epicpkmn11@outlook.com>
This commit is contained in:
@@ -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> config;
|
||||
|
||||
#define _STORE_PATH "sdmc:/3ds/Universal-Updater/stores/"
|
||||
#define _META_PATH "sdmc:/3ds/Universal-Updater/MetaData.json"
|
||||
inline uint32_t hRepeat;
|
||||
|
||||
#endif
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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
|
||||
+45
-14
@@ -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 <citro2d.h>
|
||||
#include <string>
|
||||
|
||||
extern std::unique_ptr<Config> 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
|
||||
+6
-6
@@ -25,15 +25,15 @@
|
||||
*/
|
||||
|
||||
#ifndef _UNIVERSAL_UPDATER_MSG_HPP
|
||||
#define UNIVERSAL_UPDATER_MSG_HPP
|
||||
#define _UNIVERSAL_UPDATER_MSG_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
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
|
||||
+1
-7
@@ -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
|
||||
@@ -30,9 +30,7 @@
|
||||
#include <string>
|
||||
|
||||
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
|
||||
@@ -1,48 +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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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_LOGGING_HPP
|
||||
#define _UNIVERSAL_UPDATER_LOGGING_HPP
|
||||
|
||||
#include <fstream>
|
||||
#include <stdarg.h>
|
||||
#include <string>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace Logging {
|
||||
// Create the Log File.
|
||||
void createLogFile(void);
|
||||
|
||||
// Write to the Log.
|
||||
void writeToLog(std::string debugText);
|
||||
|
||||
// Other needed stuff. ;P
|
||||
std::string logDate(void);
|
||||
std::string format(const std::string& fmt_str, ...);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -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> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, std::unique_ptr<Meta> &meta);
|
||||
void SelectLanguage();
|
||||
void ShowCredits();
|
||||
std::string SelectDir(const std::string &oldDir, const std::string &msg);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <atomic>
|
||||
#include <3ds.h>
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
class QRCode {
|
||||
public:
|
||||
QRCode();
|
||||
~QRCode();
|
||||
|
||||
void drawThread();
|
||||
void captureThread();
|
||||
void handler(std::vector<u8>& out);
|
||||
bool done() const { return finished; };
|
||||
bool cancelled() const { return cancel; };
|
||||
private:
|
||||
void buffToImage();
|
||||
void finish();
|
||||
std::array<u16, 400 * 240> 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<bool> finished = false;
|
||||
bool capturing = false;
|
||||
bool cancel = false;
|
||||
};
|
||||
|
||||
/*
|
||||
This is, what should get called.
|
||||
*/
|
||||
namespace QR_Scanner {
|
||||
/* Empty == cancelled. */
|
||||
std::vector<u8> scan();
|
||||
std::string GetQRURL();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,165 @@
|
||||
/* quirc -- QR-code recognition library
|
||||
* Copyright (C) 2010-2012 Daniel Beer <dlbeer@gmail.com>
|
||||
*
|
||||
* 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 <stdint.h>
|
||||
|
||||
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
|
||||
@@ -0,0 +1,114 @@
|
||||
/* quirc -- QR-code recognition library
|
||||
* Copyright (C) 2010-2012 Daniel Beer <dlbeer@gmail.com>
|
||||
*
|
||||
* 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
|
||||
@@ -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 <vector>
|
||||
/*
|
||||
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> store = nullptr;
|
||||
std::unique_ptr<Meta> meta = nullptr;
|
||||
std::vector<std::unique_ptr<StoreEntry>> entries;
|
||||
std::vector<std::string> 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<Structs::ButtonPos> arrowPos = {
|
||||
{0, 215, 25, 25}, // Back Arrow.
|
||||
{295, 215, 25, 25} // Next Page.
|
||||
};
|
||||
/* Title, Author, Category, Console. */
|
||||
std::vector<bool> searchIncludes = { false, false, false, false };
|
||||
std::string searchResult = "";
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <vector>
|
||||
|
||||
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<DirEntry> dirContents;
|
||||
void refresh();
|
||||
void downloadAll();
|
||||
|
||||
// Button | Icon struct.
|
||||
const std::vector<Structs::ButtonPos> 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<Structs::ButtonPos> dropPos = {
|
||||
{5, 30, 25, 25}, // Download All.
|
||||
{5, 70, 25, 25}, // Refresh.
|
||||
{5, 110, 25, 25} // ViewMode.
|
||||
};
|
||||
const std::vector<Structs::ButtonPos> dropPos2 = {
|
||||
{0, 28, 140, 30}, // Download All.
|
||||
{0, 68, 140, 30}, // Refresh.
|
||||
{0, 108, 140, 30} // ViewMode.
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <vector>
|
||||
|
||||
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<Structs::ButtonPos> mainButtons = {
|
||||
{90, 40, 140, 35}, // New Script.
|
||||
{90, 100, 140, 35} // Existing Script.
|
||||
};
|
||||
|
||||
// Creator Button Pos.
|
||||
const std::vector<Structs::ButtonPos> 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
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <vector>
|
||||
|
||||
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<ScriptInfo> fileInfo;
|
||||
std::vector<std::string> fileInfo2;
|
||||
std::vector<std::string> 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<DirEntry> dirContents;
|
||||
|
||||
|
||||
// Button | Icon structs.
|
||||
const std::vector<Structs::ButtonPos> 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<Structs::ButtonPos> 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<Structs::ButtonPos> dropPos = {
|
||||
{5, 30, 25, 25}, // Delete.
|
||||
{5, 70, 25, 25} // ViewMode.
|
||||
};
|
||||
const std::vector<Structs::ButtonPos> dropPos2 = {
|
||||
{0, 28, 140, 30}, // Delete.
|
||||
{0, 68, 140, 30} // ViewMode.
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <vector>
|
||||
|
||||
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<Structs::ButtonPos> mainButtons = {
|
||||
{80, 30, 149, 52}, // Language.
|
||||
{80, 90, 149, 52}, // Colors.
|
||||
{80, 150, 149, 52} // Credits.
|
||||
};
|
||||
|
||||
const std::vector<Structs::ButtonPos> 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<Structs::ButtonPos> 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
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <vector>
|
||||
|
||||
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<DirEntry> dirContents;
|
||||
|
||||
// Other stuff.
|
||||
std::vector<StoreInfo> storeInfo; // Store Selection.
|
||||
std::vector<std::string> descLines;
|
||||
std::string storeDesc = "";
|
||||
nlohmann::json JSON;
|
||||
std::string currentStoreFile;
|
||||
|
||||
// Icon | Button Structs.
|
||||
const std::vector<Structs::ButtonPos> 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<Structs::ButtonPos> 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<Structs::ButtonPos> GitHubPos = {
|
||||
{30, 50, 260, 30}, // Owner & Repo.
|
||||
{30, 130, 260, 30}, // Filename.
|
||||
{135, 180, 50, 30} // OK.
|
||||
};
|
||||
|
||||
const std::vector<Structs::ButtonPos> subPos = {
|
||||
{80, 30, 149, 52}, // StoreList.
|
||||
{80, 90, 149, 52}, // storeSearch.
|
||||
{80, 150, 149, 52} // storePathChange.
|
||||
};
|
||||
|
||||
// DropDownMenu.
|
||||
const std::vector<Structs::ButtonPos> dropPos = {
|
||||
{5, 30, 25, 25}, // Delete.
|
||||
{5, 70, 25, 25}, // Update.
|
||||
{5, 110, 25, 25} // ViewMode.
|
||||
};
|
||||
|
||||
const std::vector<Structs::ButtonPos> dropPos2 = {
|
||||
{0, 28, 140, 30}, // Delete.
|
||||
{0, 68, 140, 30}, // Update.
|
||||
{0, 108, 140, 30} // ViewMode.
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <citro2d.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
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<std::string> objects;
|
||||
mutable bool displayInformations = true;
|
||||
void drawBlend(int key, int x, int y) const;
|
||||
void parseObjects();
|
||||
Result execute();
|
||||
|
||||
// Icon | Button Structs.
|
||||
const std::vector<Structs::ButtonPos> 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<Structs::ButtonPos> dropPos = {
|
||||
{5, 30, 140, 30}, // Delete.
|
||||
{5, 70, 140, 30}, // Update.
|
||||
{5, 110, 140, 30} // ViewMode.
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <citro2d.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
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<Store> 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<std::string> 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<Structs::ButtonPos> 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<Structs::ButtonPos> StoreBoxesList = {
|
||||
{20, 35, 360, 50},
|
||||
{20, 95, 360, 50},
|
||||
{20, 155, 360, 50}
|
||||
};
|
||||
|
||||
const std::vector<Structs::ButtonPos> downloadBoxes = {
|
||||
{10, 40, 300, 25},
|
||||
{10, 75, 300, 25},
|
||||
{10, 110, 300, 25},
|
||||
{10, 145, 300, 25},
|
||||
{10, 180, 300, 25}
|
||||
};
|
||||
|
||||
const std::vector<Structs::ButtonPos> iconPos = {
|
||||
{5, 0, 25, 25} // Dropdown Menu.
|
||||
};
|
||||
|
||||
const std::vector<Structs::ButtonPos> dropPos = {
|
||||
{5, 30, 140, 25}, // Theme.
|
||||
{5, 70, 140, 25}, // Style.
|
||||
{5, 110, 140, 25},// Search.
|
||||
{5, 150, 140, 25} // Reset.
|
||||
};
|
||||
|
||||
const std::vector<Structs::ButtonPos> 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<Structs::ButtonPos> 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
|
||||
@@ -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 <string>
|
||||
|
||||
#include <vector>
|
||||
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<Structs::ButtonPos> 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
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <citro2d.h>
|
||||
#include <string>
|
||||
|
||||
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<std::string> GetCategoryIndex(const int &index) const;
|
||||
std::string GetVersionEntry(const int &index) const;
|
||||
std::vector<std::string> 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<std::string> 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<C2D_SpriteSheet> sheets;
|
||||
bool valid = false;
|
||||
int screenIndex = 0, entry = 0, box = 0, downEntry = 0, downIndex = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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> &store, const std::unique_ptr<Meta> &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<std::string> GetCategoryFull() const { return this->FullCategory; };
|
||||
std::vector<std::string> 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<std::string> FullCategory, FullConsole;
|
||||
bool UpdateAvailable;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <vector>
|
||||
|
||||
enum class SortType : uint8_t {
|
||||
TITLE,
|
||||
AUTHOR,
|
||||
LAST_UPDATED
|
||||
};
|
||||
|
||||
namespace StoreUtils {
|
||||
/* Grid. */
|
||||
void DrawGrid(const std::unique_ptr<Store> &store, const std::vector<std::unique_ptr<StoreEntry>> &entries);
|
||||
void GridLogic(u32 hDown, u32 hHeld, touchPosition touch, std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, int ¤tMode, int &lastMode, bool &fetch, int &smallDelay);
|
||||
|
||||
/* Top List. */
|
||||
void DrawList(const std::unique_ptr<Store> &store, const std::vector<std::unique_ptr<StoreEntry>> &entries);
|
||||
void ListLogic(u32 hDown, u32 hHeld, touchPosition touch, std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, int ¤tMode, int &lastMode, bool &fetch, int &smallDelay);
|
||||
|
||||
/* Entry Info. */
|
||||
void DrawEntryInfo(const std::unique_ptr<Store> &store, const std::unique_ptr<StoreEntry> &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> &store, const std::vector<std::string> &entries, const bool &fetch);
|
||||
void DownloadHandle(u32 hDown, u32 hHeld, touchPosition touch, const std::unique_ptr<Store> &store, const std::unique_ptr<StoreEntry> &entry, const std::vector<std::string> &entries, int ¤tMenu, std::unique_ptr<Meta> &meta, const int &lastMode, int &smallDelay);
|
||||
|
||||
/* Search + Favorite Menu. */
|
||||
void DrawSearchMenu(const std::vector<bool> &searchIncludes, const std::string &searchResult, const int &marks, const bool &updateFilter);
|
||||
void SearchHandle(u32 hDown, u32 hHeld, touchPosition touch, std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, std::vector<bool> &searchIncludes, std::unique_ptr<Meta> &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<StoreEntry> &entry, const std::unique_ptr<Store> &store, bool &showMark, std::unique_ptr<Meta> &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> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, std::unique_ptr<Meta> &meta);
|
||||
|
||||
/* Sorting. */
|
||||
void DrawSorting(const bool &asc, const SortType &st);
|
||||
void SortHandle(u32 hDown, u32 hHeld, touchPosition touch, std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, bool &asc, SortType &st);
|
||||
|
||||
bool compareTitleDescending(const std::unique_ptr<StoreEntry> &a, const std::unique_ptr<StoreEntry> &b);
|
||||
bool compareTitleAscending(const std::unique_ptr<StoreEntry> &a, const std::unique_ptr<StoreEntry> &b);
|
||||
|
||||
bool compareAuthorDescending(const std::unique_ptr<StoreEntry> &a, const std::unique_ptr<StoreEntry> &b);
|
||||
bool compareAuthorAscending(const std::unique_ptr<StoreEntry> &a, const std::unique_ptr<StoreEntry> &b);
|
||||
|
||||
bool compareUpdateDescending(const std::unique_ptr<StoreEntry> &a, const std::unique_ptr<StoreEntry> &b);
|
||||
bool compareUpdateAscending(const std::unique_ptr<StoreEntry> &a, const std::unique_ptr<StoreEntry> &b);
|
||||
|
||||
void SortEntries(const bool &Ascending, const SortType &sorttype, std::vector<std::unique_ptr<StoreEntry>> &entries);
|
||||
|
||||
void search(std::vector<std::unique_ptr<StoreEntry>> &entries, const std::string &query, bool title, bool author, bool category, bool console, int selectedMarks, bool updateAvl);
|
||||
|
||||
void FilterUpdateAvailable(std::vector<std::unique_ptr<StoreEntry>> &entries);
|
||||
|
||||
void ResetAll(const std::unique_ptr<Store> &store, const std::unique_ptr<Meta> &meta, std::vector<std::unique_ptr<StoreEntry>> &entries);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -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
|
||||
+29
-3
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <citro2d.h>
|
||||
#include <citro3d.h>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
/**
|
||||
* @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
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <malloc.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#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 <cstdio>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <regex>
|
||||
#include <curl/curl.h>
|
||||
|
||||
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:"
|
||||
+91
-161
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <string>
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <string>
|
||||
|
||||
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
|
||||
|
||||
@@ -1,38 +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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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_H
|
||||
#define _UNIVERSAL_UPDATER_FILES_H
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
Result makeDirs(const char * path);
|
||||
Result openFile(Handle* fileHandle, const char * path, bool write);
|
||||
Result deleteFile(const char * path);
|
||||
Result removeDir(const char * path);
|
||||
Result removeDirRecursive(const char * path);
|
||||
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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
|
||||
+43
-43
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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
|
||||
@@ -32,25 +32,34 @@
|
||||
#include <sys/stat.h>
|
||||
#include <vector>
|
||||
|
||||
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<std::string> extensionList);
|
||||
void getDirectoryContents(std::vector<DirEntry>& dirContents, const std::vector<std::string> extensionList);
|
||||
void getDirectoryContents(std::vector<DirEntry>& 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<std::string> &extensionList);
|
||||
void getDirectoryContents(std::vector<DirEntry> &dirContents, const std::vector<std::string> &extensionList);
|
||||
void getDirectoryContents(std::vector<DirEntry> &dirContents);
|
||||
std::vector<std::string> getContents(const std::string &name, const std::vector<std::string> &extensionList);
|
||||
|
||||
bool returnIfExist(const std::string &path, const std::vector<std::string> &extensionList);
|
||||
std::vector<UniStoreInfo> GetUniStoreInfo(const std::string &path);
|
||||
|
||||
std::string selectFilePath(std::string selectText, std::string initialPath, const std::vector<std::string> &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
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <string>
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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
|
||||
+4028
-3246
File diff suppressed because it is too large
Load Diff
@@ -1,39 +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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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_LANG_HPP
|
||||
#define _UNIVERSAL_UPDATER_LANG_HPP
|
||||
|
||||
#include "json.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Lang {
|
||||
std::string get(const std::string &key);
|
||||
void load(const std::string lang);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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_LANG_HPP
|
||||
#define _UNIVERSAL_UPDATER_LANG_HPP
|
||||
|
||||
#include "json.hpp"
|
||||
#include <string>
|
||||
|
||||
namespace Lang {
|
||||
std::string get(const std::string &key);
|
||||
void load(const std::string &lang);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,86 +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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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_HELPER_HPP
|
||||
#define _UNIVERSAL_UPDATER_SCRIPT_HELPER_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
// Information like Title and Author.
|
||||
struct ScriptInfo {
|
||||
std::string title;
|
||||
std::string author;
|
||||
std::string shortDesc;
|
||||
};
|
||||
|
||||
// Store Information.
|
||||
struct StoreInfo {
|
||||
std::string title;
|
||||
std::string author;
|
||||
std::string description;
|
||||
std::string url;
|
||||
std::string file;
|
||||
std::string storeSheet;
|
||||
std::string sheetURL;
|
||||
int version;
|
||||
};
|
||||
|
||||
enum ScriptState {
|
||||
NONE = 0,
|
||||
FAILED_DOWNLOAD,
|
||||
SCRIPT_CANCELED,
|
||||
SYNTAX_ERROR,
|
||||
COPY_ERROR,
|
||||
MOVE_ERROR,
|
||||
DELETE_ERROR,
|
||||
};
|
||||
|
||||
namespace ScriptHelper {
|
||||
// Get stuff from a JSON.
|
||||
std::string getString(nlohmann::json json, const std::string &key, const std::string &key2);
|
||||
int getNum(nlohmann::json json, const std::string &key, const std::string &key2);
|
||||
|
||||
// Script Functions.
|
||||
Result downloadRelease(std::string repo, std::string file, std::string output, bool includePrereleases, bool showVersions, std::string message);
|
||||
Result downloadFile(std::string file, std::string output, std::string message);
|
||||
|
||||
Result removeFile(std::string file, std::string message);
|
||||
void installFile(std::string file, bool updateSelf, std::string message);
|
||||
void extractFile(std::string file, std::string input, std::string output, std::string message);
|
||||
Result createFile(const char * path);
|
||||
void displayTimeMsg(std::string message, int seconds);
|
||||
|
||||
bool checkIfValid(std::string scriptFile, int mode = 0);
|
||||
|
||||
void bootTitle(const std::string TitleID, bool isNAND, std::string message);
|
||||
|
||||
Result prompt(std::string message);
|
||||
|
||||
Result copyFile(std::string source, std::string destination, std::string message);
|
||||
Result renameFile(std::string oldName, std::string newName, std::string message);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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_UTILS_HPP
|
||||
#define _UNIVERSAL_UPDATER_SCRIPT_UTILS_HPP
|
||||
|
||||
#include "json.hpp"
|
||||
#include <3ds.h>
|
||||
#include <string>
|
||||
|
||||
enum ScriptState {
|
||||
NONE = 0,
|
||||
FAILED_DOWNLOAD,
|
||||
SCRIPT_CANCELED,
|
||||
SYNTAX_ERROR,
|
||||
COPY_ERROR,
|
||||
MOVE_ERROR,
|
||||
DELETE_ERROR
|
||||
};
|
||||
|
||||
namespace ScriptUtils {
|
||||
bool matchPattern(const std::string &pattern, const std::string &tested);
|
||||
|
||||
Result removeFile(const std::string &file, const std::string &message);
|
||||
void bootTitle(const std::string &TitleID, const bool &isNAND, const std::string &message);
|
||||
Result prompt(const std::string &message);
|
||||
Result copyFile(const std::string &source, const std::string &destination, const std::string &message);
|
||||
Result renameFile(const std::string &oldName, const std::string &newName, const std::string &message);
|
||||
Result downloadRelease(const std::string &repo, const std::string &file, const std::string &output, const bool &includePrereleases, const std::string &message);
|
||||
Result downloadFile(const std::string &file, const std::string &output, const std::string &message);
|
||||
void installFile(const std::string &file, const bool &updatingSelf, const std::string &message);
|
||||
void extractFile(const std::string &file, const std::string &input, const std::string &output, const std::string &message);
|
||||
|
||||
Result runFunctions(const nlohmann::json &storeJson, const int &selection, const std::string &entry);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,21 +0,0 @@
|
||||
#ifndef _UNIVERSAL_UPDATER_SOUND_H
|
||||
#define _UNIVERSAL_UPDATER_SOUND_H
|
||||
|
||||
#include <3ds.h>
|
||||
#include <string>
|
||||
|
||||
class sound {
|
||||
public:
|
||||
sound(const std::string& path, int channel = 1, bool toloop = true);
|
||||
~sound();
|
||||
void play();
|
||||
void stop();
|
||||
|
||||
private:
|
||||
u32 dataSize;
|
||||
ndspWaveBuf waveBuf;
|
||||
u8* data = NULL;
|
||||
int chnl;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,99 +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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <3ds.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
struct UniStoreV2Struct {
|
||||
std::string title;
|
||||
std::string author;
|
||||
std::string description;
|
||||
std::string version;
|
||||
std::string category;
|
||||
std::string console;
|
||||
std::string last_updated;
|
||||
int icon_index;
|
||||
int JSONIndex;
|
||||
bool updateAvailable;
|
||||
};
|
||||
|
||||
enum class SortType {
|
||||
TITLE,
|
||||
AUTHOR,
|
||||
LAST_UPDATED
|
||||
};
|
||||
|
||||
class Store {
|
||||
public:
|
||||
Store(nlohmann::json &JS, std::string updateJSON = "NOT_FOUND");
|
||||
|
||||
void writeToFile(int index);
|
||||
void sorting(bool Ascending, SortType sorttype);
|
||||
|
||||
std::string returnTitle(const int index);
|
||||
std::string returnAuthor(const int index);
|
||||
std::string returnDescription(const int index);
|
||||
int returnIconIndex(const int index);
|
||||
int returnJSONIndex(const int index);
|
||||
int getSize();
|
||||
bool getAscending() { return this->ascending; }
|
||||
bool isUpdateAvailable(int index) { return this->sortedStore[index].updateAvailable; }
|
||||
|
||||
// Searching stuff.
|
||||
int searchForEntries(const std::string searchResult);
|
||||
int searchForAuthor(const std::string searchResult);
|
||||
int searchForCategory(const std::string searchResult);
|
||||
int searchForConsole(const std::string searchResult);
|
||||
bool updateAvailable(int index);
|
||||
void reset() { this->sortedStore = this->unsortedStore; }
|
||||
|
||||
const int getSortType() {
|
||||
if (this->sorttype == SortType::TITLE) return 0;
|
||||
else if (this->sorttype == SortType::AUTHOR) return 1;
|
||||
else if (this->sorttype == SortType::LAST_UPDATED) return 2;
|
||||
else return -1; // Should not happen.
|
||||
}
|
||||
|
||||
const std::vector<std::string> getCategories() { return this->availableCategories; }
|
||||
const std::vector<std::string> getAuthors() { return this->availableAuthors; }
|
||||
const std::vector<std::string> getSystems() { return this->availableSystems; }
|
||||
private:
|
||||
std::vector<UniStoreV2Struct> sortedStore, unsortedStore;
|
||||
std::vector<std::string> availableCategories, availableAuthors, availableSystems;
|
||||
std::string updateFile;
|
||||
bool ascending = false;
|
||||
nlohmann::json storeJson, updateJSON;
|
||||
SortType sorttype = SortType::TITLE;
|
||||
|
||||
UniStoreV2Struct getData(const int index);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,12 +1,42 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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_STRING_UTILS_HPP
|
||||
#define _UNIVERSAL_UPDATER_STRING_UTILS_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
bool matchPattern(std::string pattern, std::string tested);
|
||||
#include "meta.hpp"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace StringUtils {
|
||||
std::string format(const std::string& fmt_str, ...);
|
||||
}
|
||||
std::string lower_case(const std::string &str);
|
||||
std::string FetchStringsFromVector(const std::vector<std::string> &fetch);
|
||||
std::string formatBytes(const int bytes);
|
||||
std::string GetMarkString(int marks);
|
||||
std::vector<std::string> GetMarks(int marks);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,12 +0,0 @@
|
||||
#ifndef _UNIVERSAL_UPDATER_THREAD_HPP
|
||||
#define _UNIVERSAL_UPDATER_THREAD_HPP
|
||||
|
||||
#include <3ds.h>
|
||||
#include <vector>
|
||||
|
||||
namespace Threads {
|
||||
void create(ThreadFunc entrypoint);
|
||||
void destroy(void);
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user