mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-03 00:39:02 +00:00
First
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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 _GHOST_ESHOP_COMMON_HPP
|
||||
#define _GHOST_ESHOP_COMMON_HPP
|
||||
|
||||
#include <3ds.h>
|
||||
#include "config.hpp"
|
||||
#include "gfx.hpp"
|
||||
#include "lang.hpp"
|
||||
#include "msg.hpp"
|
||||
#include "screenCommon.hpp"
|
||||
|
||||
#define _STORE_PATH "sdmc:/3ds/GhosteShop/stores/"
|
||||
#define _META_PATH "sdmc:/3ds/GhosteShop/MetaData.json"
|
||||
#define _ESHOP_VERSION 4
|
||||
|
||||
inline std::unique_ptr<Config> config;
|
||||
inline uint32_t hRepeat, hDown, hHeld;
|
||||
inline touchPosition touch;
|
||||
inline C2D_Font font;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* 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 _GHOST_ESHOP_GFX_HPP
|
||||
#define _GHOST_ESHOP_GFX_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
#include "sprites.h"
|
||||
#include <citro2d.h>
|
||||
#include <string>
|
||||
|
||||
/*
|
||||
Définissez toutes les couleurs utilisées, pour des changements plus faciles.
|
||||
*/
|
||||
|
||||
/* Couleurs Standard. */
|
||||
#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)
|
||||
|
||||
/* Barres, Textes, BG Couleurs. */
|
||||
#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(255, 125, 0, 255)
|
||||
|
||||
/* Entrée Des Couleurs. */
|
||||
#define ENTRY_BAR_COLOR BAR_COLOR
|
||||
#define ENTRY_BAR_OUTL_COLOR BAR_OUTL_COLOR
|
||||
|
||||
/* Entrée Des Couleurs De La Boîte. */
|
||||
#define BOX_INSIDE_COLOR C2D_Color32(28, 33, 58, 255)
|
||||
#define BOX_SELECTED_COLOR C2D_Color32(108, 130, 155, 255)
|
||||
#define BOX_UNSELECTED_COLOR BLACK
|
||||
|
||||
/* Couleurs De La Barre De Progression. */
|
||||
#define PROGRESSBAR_OUT_COLOR BOX_INSIDE_COLOR
|
||||
#define PROGRESSBAR_IN_COLOR SIDEBAR_UNSELECTED_COLOR
|
||||
|
||||
/* Couleurs du menu de recherche. */
|
||||
#define SEARCH_BAR_COLOR C2D_Color32(51, 75, 102, 255)
|
||||
#define SEARCH_BAR_OUTL_COLOR BAR_OUTL_COLOR
|
||||
|
||||
/* Sidebar Couleurs. */
|
||||
#define SIDEBAR_SELECTED_COLOR C2D_Color32(108, 130, 155, 255)
|
||||
#define SIDEBAR_UNSELECTED_COLOR C2D_Color32(77, 101, 128, 255)
|
||||
|
||||
namespace GFX {
|
||||
void DrawTop(void);
|
||||
void DrawBottom();
|
||||
void DrawSprite(int img, int x, int y, float ScaleX = 1, float ScaleY = 1);
|
||||
void DrawBox(float xPos, float yPos, float width = 50, float height = 50, bool selected = false, uint32_t clr = BOX_INSIDE_COLOR);
|
||||
void DrawCheckbox(float xPos, float yPos, bool selected);
|
||||
void DrawToggle(float xPos, float yPos, bool toggled);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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 _GHOST_ESHOP_MSG_HPP
|
||||
#define _GHOST_ESHOP_MSG_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Msg {
|
||||
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
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 _GHOST_ESHOP_INIT_HPP
|
||||
#define _GHOST_ESHOP_INIT_HPP
|
||||
|
||||
#include <3ds.h>
|
||||
|
||||
namespace Init {
|
||||
Result Initialize();
|
||||
Result MainLoop();
|
||||
Result Exit();
|
||||
|
||||
void LoadFont();
|
||||
void UnloadFont();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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 _GHOST_ESHOP_KEYBOARD_HPP
|
||||
#define _GHOST_ESHOP_KEYBOARD_HPP
|
||||
|
||||
#include "storeEntry.hpp"
|
||||
#include <string>
|
||||
|
||||
namespace Input {
|
||||
std::string setkbdString(uint maxLength, const std::string &Text, const std::vector<std::unique_ptr<StoreEntry>> &entries);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +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 _GHOST_ESHOP_OVERLAY_HPP
|
||||
#define _GHOST_ESHOP_OVERLAY_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
#include "store.hpp"
|
||||
#include "storeEntry.hpp"
|
||||
#include <3ds.h>
|
||||
|
||||
namespace Overlays {
|
||||
void SelectStore(std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, std::unique_ptr<Meta> &meta);
|
||||
void SelectLanguage(const std::unique_ptr<Store> &store);
|
||||
void ShowCredits();
|
||||
std::string SelectDir(const std::string &oldDir, const std::string &msg, const std::unique_ptr<Store> &store);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* 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 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 _GHOST_ESHOP_QR_CODE_HPP
|
||||
#define _GHOST_ESHOP_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::string &result);
|
||||
bool done() const { return this->finished; };
|
||||
bool cancelled() const { return this->cancel; };
|
||||
void List(bool v) { this->displayList = v; };
|
||||
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;
|
||||
bool displayList = false;
|
||||
int selectedStore = 0, sPos = 0;
|
||||
std::vector<StoreList> stores = { };
|
||||
std::vector<u8> out;
|
||||
};
|
||||
|
||||
/*
|
||||
This is, what should get called.
|
||||
*/
|
||||
namespace QR_Scanner {
|
||||
std::string StoreHandle();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,191 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* 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,140 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* 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
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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 _GHOST_ESHOP_MAIN_SCREEN_HPP
|
||||
#define _GHOST_ESHOP_MAIN_SCREEN_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
#include "store.hpp"
|
||||
#include "storeEntry.hpp"
|
||||
#include "storeUtils.hpp"
|
||||
|
||||
/*
|
||||
Modes:
|
||||
|
||||
0: Entry Info.
|
||||
1: Download List.
|
||||
2: Queue.
|
||||
3: Search + Favorites.
|
||||
4: Sorting.
|
||||
5: Settings / Credits(?).
|
||||
6: Screenshot Menu.
|
||||
7: Release Notes.
|
||||
*/
|
||||
|
||||
class MainScreen : public Screen {
|
||||
public:
|
||||
MainScreen();
|
||||
void Draw(void) const override;
|
||||
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
|
||||
private:
|
||||
std::unique_ptr<Store> store = nullptr;
|
||||
std::unique_ptr<Meta> meta = nullptr;
|
||||
std::vector<std::unique_ptr<StoreEntry>> entries;
|
||||
std::vector<std::string> dwnldList, dwnldSizes;
|
||||
|
||||
bool initialized = false, fetchDown = false, showMarks = false, showSettings = false,
|
||||
ascending = false, updateFilter = false, screenshotFetch = false, canDisplay = false;
|
||||
|
||||
int storeMode = 0, marks = 0, markIndex = 0, sPage = 0, lMode = 0, sSelection = 0,
|
||||
lastMode = 0, smallDelay = 0, sPos = 0, screenshotIndex = 0, sSize = 0, zoom = 0, scrollIndex = 0, queueIndex = 0;
|
||||
|
||||
SortType sorttype = SortType::LAST_UPDATED;
|
||||
|
||||
/* Titre, Auteur, Catégorie, Console. */
|
||||
std::vector<bool> searchIncludes = { false, false, false, false };
|
||||
std::string searchResult = "", screenshotName = "";
|
||||
|
||||
C2D_Image Screenshot = { nullptr, nullptr };
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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 _GHOST_ESHOP_META_HPP
|
||||
#define _GHOST_ESHOP_META_HPP
|
||||
|
||||
#include "json.hpp"
|
||||
#include <string>
|
||||
|
||||
enum favoriteMarks {
|
||||
STAR = 1 << 0,
|
||||
HEART = 1 << 1,
|
||||
DIAMOND = 1 << 2,
|
||||
CLUBS = 1 << 3,
|
||||
SPADE = 1 << 4
|
||||
};
|
||||
|
||||
class Meta {
|
||||
public:
|
||||
Meta();
|
||||
~Meta() { this->SaveCall(); };
|
||||
|
||||
std::string GetUpdated(const std::string &EshopName, const std::string &entry) const;
|
||||
int GetMarks(const std::string &EshopName, const std::string &entry) const;
|
||||
bool UpdateAvailable(const std::string &EshopName, const std::string &entry, const std::string &updated) const;
|
||||
|
||||
void SetUpdated(const std::string &EshopName, const std::string &entry, const std::string &updated) {
|
||||
this->metadataJson[EshopName][entry]["updated"] = updated;
|
||||
};
|
||||
|
||||
void SetMarks(const std::string &EshopName, const std::string &entry, int marks) {
|
||||
this->metadataJson[EshopName][entry]["marks"] = marks;
|
||||
};
|
||||
|
||||
void ImportMetadata();
|
||||
void SaveCall();
|
||||
private:
|
||||
nlohmann::json metadataJson = nullptr;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* 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 _GHOST_ESHOP_STORE_HPP
|
||||
#define _GHOST_ESHOP_STORE_HPP
|
||||
|
||||
#include "json.hpp"
|
||||
#include <citro2d.h>
|
||||
#include <string>
|
||||
|
||||
class Store {
|
||||
public:
|
||||
Store(const std::string &file, const std::string &file2, bool ARGMode = false);
|
||||
~Store();
|
||||
void LoadFromFile(const std::string &file);
|
||||
void loadSheets();
|
||||
void unloadSheets();
|
||||
void update(const std::string &file);
|
||||
|
||||
/* Obtenir des informations sur l’eShop lui-même. */
|
||||
std::string GetEshopTitle() const;
|
||||
std::string GetEshopAuthor() const;
|
||||
|
||||
/* Obtenir des informations sur les entrées eShop. */
|
||||
std::string GetTitleEntry(int index) const;
|
||||
std::string GetAuthorEntry(int index) const;
|
||||
std::string GetDescriptionEntry(int index) const;
|
||||
std::vector<std::string> GetCategoryIndex(int index) const;
|
||||
std::string GetVersionEntry(int index) const;
|
||||
std::vector<std::string> GetConsoleEntry(int index) const;
|
||||
std::string GetLastUpdatedEntry(int index) const;
|
||||
std::string GetSizeEntry(int index) const;
|
||||
std::string GetAdditionalcontentEntry(int index) const;
|
||||
C2D_Image GetIconEntry(int index) const;
|
||||
std::string GetFileSizes(int index, const std::string &entry) const;
|
||||
std::vector<std::string> GetScreenshotList(int index) const;
|
||||
std::vector<std::string> GetScreenshotNames(int index) const;
|
||||
std::string GetReleaseNotes(int index) const;
|
||||
|
||||
std::vector<std::string> GetDownloadList(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; };
|
||||
|
||||
/* Ces deux choses sont utilisées pour le support BG personnalisé. */
|
||||
C2D_Image GetStoreImg() const { return this->storeBG; };
|
||||
bool customBG() const { return this->hasCustomBG; };
|
||||
|
||||
/* Renvoie le nom du fichier eShop. */
|
||||
std::string GetFileName() const { return this->fileName; };
|
||||
private:
|
||||
void SetC2DBGImage();
|
||||
nlohmann::json storeJson = nullptr;
|
||||
std::vector<C2D_SpriteSheet> sheets;
|
||||
C2D_Image storeBG = { nullptr };
|
||||
bool valid = false, hasSheet = false, hasCustomBG = false;
|
||||
int screenIndex = 0, entry = 0, box = 0, downEntry = 0, downIndex = 0;
|
||||
std::string fileName = "";
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* 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 _GHOST_ESHOP_STORE_ENTRY_HPP
|
||||
#define _GHOST_ESHOP_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, 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 GetSize() const { return this->Size; };
|
||||
std::string GetAdditionalcontent() const { return this->Additional; };
|
||||
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; };
|
||||
std::vector<std::string> GetSizes() const { return this->Sizes; };
|
||||
std::vector<std::string> GetScreenshots() const { return this->Screenshots; };
|
||||
std::vector<std::string> GetScreenshotNames() const { return this->ScreenshotNames; };
|
||||
std::string GetReleaseNotes() const { return this->ReleaseNotes; };
|
||||
|
||||
bool GetUpdateAvl() const { return this->UpdateAvailable; };
|
||||
void SetUpdateAvl(bool v) { this->UpdateAvailable = v; };
|
||||
|
||||
void SetMark(int marks) {
|
||||
this->Marks = marks;
|
||||
this->MarkString = StringUtils::GetMarkString(this->Marks);
|
||||
};
|
||||
|
||||
private:
|
||||
std::string Title, Author, Description, Category, Version, Console, LastUpdated, Size, MarkString, Additional, ReleaseNotes;
|
||||
C2D_Image Icon;
|
||||
int SheetIndex, EntryIndex, Marks;
|
||||
std::vector<std::string> FullCategory, FullConsole, Sizes, Screenshots, ScreenshotNames;
|
||||
bool UpdateAvailable;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* 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 _GHOST_ESHOP_STORE_UTILS_HPP
|
||||
#define _GHOST_ESHOP_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 {
|
||||
/* Grille. */
|
||||
void DrawGrid(const std::unique_ptr<Store> &store, const std::vector<std::unique_ptr<StoreEntry>> &entries);
|
||||
void GridLogic(std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, int ¤tMode, int &lastMode, bool &fetch, int &smallDelay);
|
||||
|
||||
/* Top Liste. */
|
||||
void DrawList(const std::unique_ptr<Store> &store, const std::vector<std::unique_ptr<StoreEntry>> &entries);
|
||||
void ListLogic(std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, int ¤tMode, int &lastMode, bool &fetch, int &smallDelay);
|
||||
|
||||
/* Infos Sur L'Entrée. */
|
||||
void DrawEntryInfo(const std::unique_ptr<Store> &store, const std::unique_ptr<StoreEntry> &entry);
|
||||
void EntryHandle(bool &showMark, bool &fetch, bool &sFetch, int &mode, const std::unique_ptr<StoreEntry> &entry);
|
||||
|
||||
/* Menu Latéral. */
|
||||
void DrawSideMenu(int currentMenu);
|
||||
void SideMenuHandle(int ¤tMenu, bool &fetch, int &lastMenu);
|
||||
|
||||
/* Entrées Des Téléchargements. */
|
||||
void DrawDownList(const std::unique_ptr<Store> &store, const std::vector<std::string> &entries, bool fetch, const std::unique_ptr<StoreEntry> &entry, const std::vector<std::string> &sizes);
|
||||
void DownloadHandle(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);
|
||||
|
||||
/* Queue System. */
|
||||
void DrawQueueMenu(const int queueIndex);
|
||||
void QueueMenuHandle(int &queueIndex);
|
||||
|
||||
/* Recherche + Menu Favoris. */
|
||||
void DrawSearchMenu(const std::vector<bool> &searchIncludes, const std::string &searchResult, int marks, bool updateFilter);
|
||||
void SearchHandle(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);
|
||||
|
||||
/* Menu Marquer. */
|
||||
void DisplayMarkBox(int marks);
|
||||
void MarkHandle(std::unique_ptr<StoreEntry> &entry, const std::unique_ptr<Store> &store, bool &showMark, std::unique_ptr<Meta> &meta);
|
||||
|
||||
/* Crédits. */
|
||||
void DrawCredits();
|
||||
|
||||
/* Screenshot menu. */
|
||||
void DrawScreenshotMenu(const C2D_Image &img, const int sIndex, const bool sFetch, const int screenshotSize, const std::string &name, const int zoom, const bool canDisplay);
|
||||
void ScreenshotMenu(C2D_Image &img, int &sIndex, bool &sFetch, int &storeMode, const int screenshotSize, int &zoom, bool &canDisplay);
|
||||
|
||||
/* Paramètres. */
|
||||
void DrawSettings(int page, int selection, int sPos);
|
||||
void SettingsHandle(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, int &sPos);
|
||||
|
||||
/* Trie. */
|
||||
void DrawSorting(bool asc, SortType st);
|
||||
void SortHandle(std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, bool &asc, SortType &st);
|
||||
|
||||
/* Release Notes. */
|
||||
void DrawReleaseNotes(const int &scrollIndex, const std::unique_ptr<StoreEntry> &entry, const std::unique_ptr<Store> &store);
|
||||
void ReleaseNotesLogic(int &scrollIndex, int &storeMode);
|
||||
|
||||
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(bool Ascending, 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
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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 _GHOST_ESHOP_ANIMATION_HPP
|
||||
#define _GHOST_ESHOP_ANIMATION_HPP
|
||||
|
||||
#include <3ds.h>
|
||||
#include <string>
|
||||
|
||||
enum class ProgressBar {
|
||||
Downloading,
|
||||
Extracting,
|
||||
Installing,
|
||||
Copying
|
||||
};
|
||||
|
||||
namespace Animation {
|
||||
void DrawProgressBar(u64 currentProgress, u64 totalProgress);
|
||||
void displayProgressBar();
|
||||
|
||||
void DrawQueue(int x, int y);
|
||||
void QueueAnimHandle();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* 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 _GHOST_ESHOP_ARGUMENT_PARSER_HPP
|
||||
#define _GHOST_ESHOP_ARGUMENT_PARSER_HPP
|
||||
|
||||
#include "json.hpp"
|
||||
#include "store.hpp"
|
||||
#include <string>
|
||||
|
||||
class ArgumentParser {
|
||||
public:
|
||||
ArgumentParser(const std::string &file, const std::string &entry, int dlIndex);
|
||||
void Load();
|
||||
void Execute();
|
||||
bool GetValid() const { return this->isValid; };
|
||||
private:
|
||||
std::unique_ptr<Store> store = nullptr;
|
||||
bool isValid = false;
|
||||
std::string file = "", executeEntry = "", entry = "";
|
||||
int dlIndex = -1, entryIndex = -1;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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 _GHOST_ESHOP_CIA_HPP
|
||||
#define _GHOST_ESHOP_CIA_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
#include <3ds.h>
|
||||
|
||||
namespace Title {
|
||||
Result Launch(u64 titleId, FS_MediaType mediaType);
|
||||
Result DeletePrevious(u64 titleid, FS_MediaType media);
|
||||
Result Install(const char *ciaPath, bool updateSelf);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* 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 _GHOST_ESHOP_CONFIG_HPP
|
||||
#define _GHOST_ESHOP_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; };
|
||||
|
||||
/* Dernier Magasin. */
|
||||
std::string lastStore() const { return this->v_lastStore; };
|
||||
void lastStore(const std::string &v) { this->v_lastStore = v; if (!this->changesMade) this->changesMade = true; };
|
||||
|
||||
/* Utilisation De La Liste Supérieure. */
|
||||
bool list() const { return this->v_list; };
|
||||
void list(bool v) { this->v_list = v; if (!this->changesMade) this->changesMade = true; };
|
||||
|
||||
/* Mise à Jour Automatique Au Démarrage. */
|
||||
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; };
|
||||
|
||||
/* Récupération d'anciennes métadonnées. */
|
||||
bool metadata() const { return this->v_metadata; };
|
||||
void metadata(bool v) { this->v_metadata = v; if (!this->changesMade) this->changesMade = true; };
|
||||
|
||||
/* Vérification des Mises à Jour de Ghost eShop au Démarrage. */
|
||||
bool updatecheck() const { return this->v_updateCheck; };
|
||||
void updatecheck(bool v) { this->v_updateCheck = v; if (!this->changesMade) this->changesMade = true; };
|
||||
|
||||
/* Vérification des Mises à Jour de Ghost eShop au Démarrage. */
|
||||
bool usebg() const { return this->v_showBg; };
|
||||
void usebg(bool v) { this->v_showBg = v; if (!this->changesMade) this->changesMade = true; };
|
||||
|
||||
/* Si vous utilisez une police personnalisée. */
|
||||
bool customfont() const { return this->v_customFont; };
|
||||
void customfont(bool v) { this->v_customFont = v; if (!this->changesMade) this->changesMade = true; };
|
||||
|
||||
/* Le chemin du raccourci. */
|
||||
std::string shortcut() const { return this->v_shortcutPath; };
|
||||
void shortcut(const std::string &v) { this->v_shortcutPath = v; if (!this->changesMade) this->changesMade = true; };
|
||||
|
||||
/* If displaying changelog. */
|
||||
bool changelog() const { return this->v_changelog; };
|
||||
void changelog(bool v) { this->v_changelog = v; if (!this->changesMade) this->changesMade = true; };
|
||||
private:
|
||||
/* Principalement aide. */
|
||||
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 = "ghosteshop.eshop",
|
||||
v_3dsxPath = "sdmc:/3ds", v_ndsPath = "sdmc:", v_archivePath = "sdmc:",
|
||||
v_shortcutPath = "sdmc:/3ds/GhosteShop/shortcuts";
|
||||
|
||||
bool v_list = false, v_autoUpdate = true, v_metadata = true, v_updateCheck = true,
|
||||
v_showBg = false, v_customFont = false, v_changelog = true;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* 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 _GHOST_ESHOP_DOWNLOAD_HPP
|
||||
#define _GHOST_ESHOP_DOWNLOAD_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
#define APP_TITLE "Ghost eShop"
|
||||
#define VERSION_STRING "12.0"
|
||||
|
||||
enum DownloadError {
|
||||
DL_ERROR_NONE = 0,
|
||||
DL_ERROR_WRITEFILE,
|
||||
DL_ERROR_ALLOC,
|
||||
DL_ERROR_STATUSCODE,
|
||||
DL_ERROR_GIT,
|
||||
DL_CANCEL, // Aucune idée si c’est nécessaire.
|
||||
};
|
||||
|
||||
struct StoreList {
|
||||
std::string Title;
|
||||
std::string Author;
|
||||
std::string URL;
|
||||
std::string Description;
|
||||
};
|
||||
|
||||
struct GEUpdate {
|
||||
bool Available = false;
|
||||
std::string Notes = "";
|
||||
std::string Version = "";
|
||||
};
|
||||
|
||||
Result downloadToFile(const std::string &url, const std::string &path);
|
||||
Result downloadFromRelease(const std::string &url, const std::string &asset, const std::string &path, bool includePrereleases);
|
||||
|
||||
/*
|
||||
Vérifiez l’état du Wi-Fi.
|
||||
@return True si le Wi-Fi est connecté ; false si non.
|
||||
*/
|
||||
bool checkWifiStatus(void);
|
||||
|
||||
/*
|
||||
Afficher "Veuillez vous connecter au Wi-Fi" pour 2s.
|
||||
*/
|
||||
void notConnectedMsg(void);
|
||||
|
||||
/*
|
||||
Affiche "Not Implemented Yet" pour 2s.
|
||||
*/
|
||||
void notImplemented(void);
|
||||
|
||||
/*
|
||||
Afficher le msg done.
|
||||
*/
|
||||
void doneMsg(void);
|
||||
|
||||
bool IsUpdateAvailable(const std::string &URL, int revCurrent);
|
||||
bool DownloadEshop(const std::string &URL, int currentRev, std::string &fl, bool isDownload = false, bool isUDB = false);
|
||||
bool DownloadSpriteSheet(const std::string &URL, const std::string &file);
|
||||
GEUpdate IsGEUpdateAvailable();
|
||||
void UpdateAction();
|
||||
std::vector<StoreList> FetchStores();
|
||||
C2D_Image FetchScreenshot(const std::string &URL);
|
||||
std::string GetChangelog();
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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 _GHOST_ESHOP_EXTRACT_HPP
|
||||
#define _GHOST_ESHOP_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 getExtractedSize(const std::string &archivePath, const std::string &wantedFile);
|
||||
|
||||
Result extractArchive(const std::string &archivePath, const std::string &wantedFile, const std::string &outputPath);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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 _GHOST_ESHOP_FILE_BROWSE_HPP
|
||||
#define _GHOST_ESHOP_FILE_BROWSE_HPP
|
||||
|
||||
#include <dirent.h>
|
||||
#include <string>
|
||||
#include <sys/stat.h>
|
||||
#include <vector>
|
||||
|
||||
struct DirEntry {
|
||||
std::string name;
|
||||
std::string path;
|
||||
bool isDirectory;
|
||||
};
|
||||
|
||||
/*
|
||||
Information de la structure de l'eShop
|
||||
*/
|
||||
struct EshopInfo {
|
||||
std::string Title;
|
||||
std::string Author;
|
||||
std::string URL;
|
||||
std::string File; // Permet de vérifier si le fichier ne contient PAS de barre oblique.
|
||||
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);
|
||||
|
||||
std::vector<EshopInfo> GetEshopInfo(const std::string &path);
|
||||
|
||||
void dirCopy(DirEntry *entry, const char *destinationPath, const char *sourcePath);
|
||||
int fcopy(const char *sourcePath, const char *destinationPath);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +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 _GHOST_ESHOP_FILES_HPP
|
||||
#define _GHOST_ESHOP_FILES_HPP
|
||||
|
||||
#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);
|
||||
|
||||
#endif
|
||||
+25473
File diff suppressed because it is too large
Load Diff
@@ -0,0 +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 _GHOST_ESHOP_LANG_HPP
|
||||
#define _GHOST_ESHOP_LANG_HPP
|
||||
|
||||
#include "json.hpp"
|
||||
#include <string>
|
||||
|
||||
namespace Lang {
|
||||
std::string get(const std::string &key);
|
||||
void load(const std::string &lang);
|
||||
};
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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 _GHOST_ESHOP_QUEUE_SYSTEM_HPP
|
||||
#define _GHOST_ESHOP_QUEUE_SYSTEM_HPP
|
||||
|
||||
#include "json.hpp"
|
||||
#include <citro2d.h>
|
||||
#include <deque>
|
||||
#include <memory>
|
||||
|
||||
/*
|
||||
Extend this, if more statuses are neccessary.
|
||||
*/
|
||||
enum class QueueStatus {
|
||||
None,
|
||||
Downloading,
|
||||
Extracting,
|
||||
Installing,
|
||||
Failed,
|
||||
Done
|
||||
};
|
||||
|
||||
class Queue {
|
||||
public:
|
||||
Queue(nlohmann::json object, C2D_Image img, std::string name) : obj(object), icn(img), name(name) { };
|
||||
QueueStatus status = QueueStatus::None;
|
||||
nlohmann::json obj;
|
||||
C2D_Image icn;
|
||||
int total, current;
|
||||
std::string name = "";
|
||||
};
|
||||
|
||||
/*
|
||||
Of course also a namespace to that part, so we can do that in a Thread.
|
||||
*/
|
||||
namespace QueueSystem {
|
||||
void QueueHandle(); // Handles the Queue.
|
||||
void AddToQueue(nlohmann::json obj, C2D_Image icn, std::string name); // Adds to Queue.
|
||||
void ClearQueue(); // Clears the Queue.
|
||||
|
||||
extern LightLock lock;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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 _GHOST_ESHOP_SCREENSHOT_HPP
|
||||
#define _GHOST_ESHOP_SCREENSHOT_HPP
|
||||
|
||||
#include <citro2d.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Screenshot {
|
||||
C2D_Image Convert(const std::string &filename);
|
||||
C2D_Image ConvertFromBuffer(const std::vector<u8> &buffer);
|
||||
};
|
||||
|
||||
#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 _GHOST_ESHOP_SCRIPT_UTILS_HPP
|
||||
#define _GHOST_ESHOP_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, 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, bool isARG = false);
|
||||
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, bool includePrereleases, const std::string &message, bool isARG = false);
|
||||
Result downloadFile(const std::string &file, const std::string &output, const std::string &message, bool isARG = false);
|
||||
void installFile(const std::string &file, bool updatingSelf, const std::string &message, bool isARG = false);
|
||||
void extractFile(const std::string &file, const std::string &input, const std::string &output, const std::string &message, bool isARG = false);
|
||||
|
||||
Result runFunctions(nlohmann::json storeJson, int selection, const std::string &entry);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* 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 _GHOST_ESHOP_SOUND_HPP
|
||||
#define _GHOST_ESHOP_SOUND_HPP
|
||||
|
||||
#include <3ds.h>
|
||||
#include <string>
|
||||
|
||||
class Sound {
|
||||
public:
|
||||
Sound(const std::string &path, const int channel = 1, const bool toloop = true);
|
||||
~Sound();
|
||||
void play();
|
||||
void stop();
|
||||
private:
|
||||
u32 dataSize;
|
||||
bool good = true;
|
||||
ndspWaveBuf waveBuf;
|
||||
u8 *data = nullptr;
|
||||
int chnl;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +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 _GHOST_ESHOP_STRING_UTILS_HPP
|
||||
#define _GHOST_ESHOP_STRING_UTILS_HPP
|
||||
|
||||
#include "meta.hpp"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace StringUtils {
|
||||
std::string lower_case(const std::string &str);
|
||||
std::string FetchStringsFromVector(const std::vector<std::string> &fetch);
|
||||
std::string formatBytes(int bytes);
|
||||
std::string GetMarkString(int marks);
|
||||
std::vector<std::string> GetMarks(int marks);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user