GhosteShop -> Darkstore Part 1

This commit is contained in:
dark98
2021-06-07 01:12:36 +01:00
parent 789891cbc8
commit e88b82bf05
43 changed files with 322 additions and 370 deletions
+9 -9
View File
@@ -93,8 +93,8 @@ bool touching(touchPosition touch, Structs::ButtonPos button) {
void Init::LoadFont() {
if (config->customfont()) {
if (!needUnloadFont) {
if (access("sdmc:/3ds/GhosteShop/font.bcfnt", F_OK) == 0) {
Gui::loadFont(font, "sdmc:/3ds/GhosteShop/font.bcfnt");
if (access("sdmc:/3ds/DarkStore/font.bcfnt", F_OK) == 0) {
Gui::loadFont(font, "sdmc:/3ds/DarkStore/font.bcfnt");
needUnloadFont = true;
}
}
@@ -113,7 +113,7 @@ void Init::UnloadFont() {
}
/*
Initialiser Ghost eShop.
Initialiser DarkStore.
*/
Result Init::Initialize() {
gfxInitDefault();
@@ -132,9 +132,9 @@ Result Init::Initialize() {
/* Créer des répertoires, sil manque. */
mkdir("sdmc:/3ds", 0777);
mkdir("sdmc:/3ds/GhosteShop", 0777);
mkdir("sdmc:/3ds/GhosteShop/stores", 0777);
mkdir("sdmc:/3ds/GhosteShop/shortcuts", 0777);
mkdir("sdmc:/3ds/DarkStore", 0777);
mkdir("sdmc:/3ds/DarkStore/stores", 0777);
mkdir("sdmc:/3ds/DarkStore/shortcuts", 0777);
config = std::make_unique<Config>();
Lang::load(config->language());
@@ -159,7 +159,7 @@ Result Init::Initialize() {
}
/*
MainLoop de Ghost eShop.
MainLoop de DarkStore.
*/
Result Init::MainLoop() {
bool fullExit = false;
@@ -199,7 +199,7 @@ Result Init::MainLoop() {
}
/*
Fermer Ghost eShop.
Fermer DarkStore.
*/
Result Init::Exit() {
Gui::exit();
@@ -217,4 +217,4 @@ Result Init::Exit() {
romfsExit();
return 0;
}
}
+4 -4
View File
@@ -46,9 +46,9 @@ static void InitForARG() {
/* Créer des répertoires, sil manque. */
mkdir("sdmc:/3ds", 0777);
mkdir("sdmc:/3ds/GhosteShop", 0777);
mkdir("sdmc:/3ds/GhosteShop/stores", 0777);
mkdir("sdmc:/3ds/GhosteShop/shortcuts", 0777);
mkdir("sdmc:/3ds/DarkStore", 0777);
mkdir("sdmc:/3ds/DarkStore/stores", 0777);
mkdir("sdmc:/3ds/DarkStore/shortcuts", 0777);
config = std::make_unique<Config>();
Lang::load(config->language());
@@ -90,4 +90,4 @@ int main(int argc, char *argv[]) {
}
return Init::MainLoop();
}
}
+2 -2
View File
@@ -52,13 +52,13 @@ Meta::Meta() {
Importez les anciennes métadonnées du fichier 'updates.json'.
*/
void Meta::ImportMetadata() {
if (access("sdmc:/3ds/GhosteShop/updates.json", F_OK) != 0) {
if (access("sdmc:/3ds/DarkStore/updates.json", F_OK) != 0) {
config->metadata(false);
return; // Introuvables.
}
Msg::DisplayMsg(Lang::get("FETCHING_METADATA"));
FILE *old = fopen("sdmc:/3ds/GhosteShop/updates.json", "r");
FILE *old = fopen("sdmc:/3ds/DarkStore/updates.json", "r");
nlohmann::json oldJson = nlohmann::json::parse(old, nullptr, false);
fclose(old);
+2 -2
View File
@@ -67,7 +67,7 @@ void StoreUtils::ReleaseNotesLogic(int &scrollIndex, int &storeMode) {
/*
I place it temporarely here for now.
Display Release changelog for Ghost eShop.
Display Release changelog for DarkStore.
*/
void DisplayChangelog() {
if (config->changelog()) {
@@ -89,7 +89,7 @@ void DisplayChangelog() {
Gui::DrawString(5, 25 - scrollIndex, 0.5f, TEXT_COLOR, notes, 390, 0, font, C2D_WordWrap);
Gui::Draw_Rect(0, 0, 400, 25, BAR_COLOR);
Gui::Draw_Rect(0, 25, 400, 1, BAR_OUTL_COLOR);
Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, "Ghost eShop", 390, 0, font);
Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, "DarkStore", 390, 0, font);
Gui::Draw_Rect(0, 215, 400, 25, BAR_COLOR);
Gui::Draw_Rect(0, 214, 400, 1, BAR_OUTL_COLOR);
Gui::DrawStringCentered(0, 217, 0.7f, TEXT_COLOR, C_V, 390, 0, font);
+10 -10
View File
@@ -135,9 +135,9 @@ static void DrawAutoUpdate(int selection) {
Gui::DrawString(47, 95, 0.4f, TEXT_COLOR, Lang::get("AUTO_UPDATE_ESHOP_DESC"), 265, 0, font, C2D_WordWrap);
Gui::Draw_Rect(40, 140, 273, 24, (selection == 1 ? SIDEBAR_UNSELECTED_COLOR : BOX_INSIDE_COLOR));
Gui::DrawString(47, 144, 0.5f, TEXT_COLOR, Lang::get("AUTO_UPDATE_GE"), 210, 0, font);
Gui::DrawString(47, 144, 0.5f, TEXT_COLOR, Lang::get("AUTO_UPDATE_DS"), 210, 0, font);
GFX::DrawToggle(280, 140, config->updatecheck());
Gui::DrawString(47, 171, 0.4f, TEXT_COLOR, Lang::get("AUTO_UPDATE_GE_DESC"), 265, 0, font, C2D_WordWrap);
Gui::DrawString(47, 171, 0.4f, TEXT_COLOR, Lang::get("AUTO_UPDATE_DS_DESC"), 265, 0, font, C2D_WordWrap);
}
/*
@@ -170,7 +170,7 @@ static void DrawGUISettings(int selection) {
- Access the eShop Manage Handle.
- Enable eShop auto update on boot.
- Show the Credits.
- Exit Ghost eShop.
- Exit DarkStore.
int &page: Reference to the page.
bool &dspSettings: Reference to the display Settings.
int &storeMode: Reference to the Store Mode.
@@ -358,7 +358,7 @@ static void SettingsHandleDir(int &page, int &selection, const std::unique_ptr<S
Logic of the Auto-Update Settings.
Here you can..
- Enable / Disable Automatically updating the eShop on boot.
- Enable / Disable Automatically check for Ghost eShop updates on boot.
- Enable / Disable Automatically check for DarkStore updates on boot.
int &page: Reference to the page.
int &selection: Reference to the Selection.
*/
@@ -493,8 +493,8 @@ static void LanguageLogic(int &page, int &selection, int &sPos) {
/* Check if is "uk". */
if (l == "uk") {
if (access("sdmc:/3ds/GhosteShop/font.bcfnt", F_OK) != 0) {
ScriptUtils::downloadFile("https://cdn.ghosteshop.com/script/ghosteshop.bcfnt", "sdmc:/3ds/GhosteShop/font.bcfnt", Lang::get("DOWNLOADING_COMPATIBLE_FONT"));
if (access("sdmc:/3ds/DarkStore/font.bcfnt", F_OK) != 0) {
ScriptUtils::downloadFile("https://darkstore.ml/assets/darkstore.bcfnt", "sdmc:/3ds/DarkStore/font.bcfnt", Lang::get("DOWNLOADING_COMPATIBLE_FONT"));
}
config->customfont(true);
@@ -516,8 +516,8 @@ static void LanguageLogic(int &page, int &selection, int &sPos) {
/* Check if is "uk". */
if (l == "uk") {
if (access("sdmc:/3ds/GhosteShop/font.bcfnt", F_OK) != 0) {
ScriptUtils::downloadFile("https://cdn.ghosteshop.com/script/ghosteshop.bcfnt", "sdmc:/3ds/GhosteShop/font.bcfnt", Lang::get("DOWNLOADING_COMPATIBLE_FONT"));
if (access("sdmc:/3ds/DarkStore/font.bcfnt", F_OK) != 0) {
ScriptUtils::downloadFile("https://darkstore.ml/darkstore.bcfnt", "sdmc:/3ds/DarkStore/font.bcfnt", Lang::get("DOWNLOADING_COMPATIBLE_FONT"));
}
config->customfont(true);
@@ -537,7 +537,7 @@ static void LanguageLogic(int &page, int &selection, int &sPos) {
if (hDown & KEY_TOUCH) {
if (touching(touch, langButtons[6])) {
/* Télécharger la police. */
ScriptUtils::downloadFile("https://cdn.ghosteshop.com/script/ghosteshop.bcfnt", "sdmc:/3ds/GhosteShop/font.bcfnt", Lang::get("DOWNLOADING_COMPATIBLE_FONT"));
ScriptUtils::downloadFile("https://darkstore/assets/darkstore.bcfnt", "sdmc:/3ds/DarkStore/font.bcfnt", Lang::get("DOWNLOADING_COMPATIBLE_FONT"));
config->customfont(true);
Init::LoadFont();
}
@@ -608,4 +608,4 @@ void StoreUtils::SettingsHandle(int &page, bool &dspSettings, int &storeMode, in
LanguageLogic(page, selection, sPos);
break;
}
}
}
+4 -4
View File
@@ -39,10 +39,10 @@ void Overlays::ShowCredits() {
C2D_TargetClear(Bottom, TRANSPARENT);
GFX::DrawTop();
GFX::DrawSprite(sprites_GhosteShop_idx, 240, 30);
Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, "Ghost eShop - " + Lang::get("CREDITS"), 395, 0, font);
GFX::DrawSprite(sprites_DarkStore_idx, 240, 30);
Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, "DarkStore - " + Lang::get("CREDITS"), 395, 0, font);
Gui::DrawString(10, 30, 0.5f, TEXT_COLOR, "- Ghost eShop Team", 0, 0, font);
Gui::DrawString(10, 30, 0.5f, TEXT_COLOR, "- DarkStore Team", 0, 0, font);
Gui::DrawString(10, 50, 0.5f, TEXT_COLOR, "- " + Lang::get("FILES_HOSTING_ANONYKU"), 0, 0, font);
Gui::DrawString(10, 70, 0.5f, TEXT_COLOR, "- " + Lang::get("CITRA_BIGN_ICON"), 0, 0, font);
Gui::DrawString(10, 90, 0.5f, TEXT_COLOR, "- https://hshop.erista.me/", 0, 0, font);
@@ -56,7 +56,7 @@ void Overlays::ShowCredits() {
Gui::DrawStringCentered(0, 218, 0.6f, TEXT_COLOR, Lang::get("CURRENT_VERSION") + std::string(V_STRING), 390, 0, font);
GFX::DrawBottom();
GFX::DrawSprite(sprites_GhosteShop_core_idx, 0, 0);
GFX::DrawSprite(sprites_DarkStore_core_idx, 0, 0);
C3D_FrameEnd(0);
hidScanInput();
+18 -18
View File
@@ -40,57 +40,57 @@ extern void DisplayChangelog();
/*
MainScreen Constructor.
Initialized Meta, Store and StoreEntry class and:
- Downloads ghosteshop.eshop.. in case nothing exist.
- Downloads darkstore-homebrew.eshop.. in case nothing exist.
*/
MainScreen::MainScreen() {
this->meta = std::make_unique<Meta>();
/* Check if lastStore is accessible. */
if (config->lastStore() != "ghosteshop.eshop" || config->lastStore() != "") {
if (config->lastStore() != "darkstore-homebrew.eshop" || config->lastStore() != "") {
if (access((std::string(_STORE_PATH) + config->lastStore()).c_str(), F_OK) != 0) {
config->lastStore("ghosteshop.eshop");
config->lastStore("darkstore-homebrew.eshop");
} else {
/* check version and file here. */
const EshopInfo info = GetInfo((std::string(_STORE_PATH) + config->lastStore()), config->lastStore());
if (info.Version != 3 && info.Version != _ESHOP_VERSION) {
config->lastStore("ghosteshop.eshop");
config->lastStore("darkstore-homebrew.eshop");
}
if (info.File != "") { // Ensure to check for this.
if ((info.File.find("/") != std::string::npos)) {
config->lastStore("ghosteshop.eshop"); // It does contain a '/' which is invalid.
config->lastStore("darkstore-homebrew.eshop"); // It does contain a '/' which is invalid.
}
}
}
}
/* If ghosteshop.eshop --> Get! */
if (config->lastStore() == "ghosteshop.eshop" || config->lastStore() == "") {
if (access("sdmc:/3ds/GhosteShop/stores/ghosteshop.eshop", F_OK) != 0) {
/* If darkstore-homebrew.eshop --> Get! */
if (config->lastStore() == "darkstore-homebrew.eshop" || config->lastStore() == "") {
if (access("sdmc:/3ds/DarkStore/stores/darkstore-homebrew.eshop", F_OK) != 0) {
if (checkWifiStatus()) {
std::string tmp = ""; // Juste une intérimaire.
DownloadEshop("https://cdn.ghosteshop.com/script/ghosteshop.eshop", -1, tmp, true, true);
DownloadSpriteSheet("https://cdn.ghosteshop.com/script/icon.t3x", "icon.t3x");
DownloadSpriteSheet("https://cdn.ghosteshop.com/script/icon_1.t3x", "icon_1.t3x");
DownloadSpriteSheet("https://cdn.ghosteshop.com/script/icon_2.t3x", "icon_2.t3x");
DownloadEshop("https://darkstore.ml/assets/darkstore-homebrew.eshop", -1, tmp, true, true);
DownloadSpriteSheet("https://darkstore.ml/assets/icon.t3x", "icon.t3x");
DownloadSpriteSheet("https://darkstore.ml/assets/icon_1.t3x", "icon_1.t3x");
DownloadSpriteSheet("https://darkstore.ml/assets/icon_2.t3x", "icon_2.t3x");
} else {
notConnectedMsg();
}
} else {
const EshopInfo info = GetInfo("sdmc:/3ds/GhosteShop/stores/ghosteshop.eshop", "ghosteshop.eshop");
const EshopInfo info = GetInfo("sdmc:/3ds/DarkStore/stores/darkstore-homebrew.eshop", "darkstore-homebrew.eshop");
if (info.Version != 3 && info.Version != _ESHOP_VERSION) {
Msg::waitMsg("Not passing the check!");
if (checkWifiStatus()) {
std::string tmp = ""; // Juste une intérimaire.
DownloadEshop("https://cdn.ghosteshop.com/script/ghosteshop.eshop", -1, tmp, true, true);
DownloadSpriteSheet("https://cdn.ghosteshop.com/script/icon.t3x", "icon.t3x");
DownloadSpriteSheet("https://cdn.ghosteshop.com/script/icon_1.t3x", "icon_1.t3x");
DownloadSpriteSheet("https://cdn.ghosteshop.com/script/icon_2.t3x", "icon_2.t3x");
DownloadEshop("https://darkstore.ml/assets/darkstore-homebrew.eshop", -1, tmp, true, true);
DownloadSpriteSheet("https://darkstore.ml/assets/icon.t3x", "icon.t3x");
DownloadSpriteSheet("https://darkstore.ml/assets/icon_1.t3x", "icon_1.t3x");
DownloadSpriteSheet("https://darkstore.ml/assets/icon_2.t3x", "icon_2.t3x");
} else {
notConnectedMsg();
@@ -268,4 +268,4 @@ void MainScreen::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
break;
}
}
}
}
+1 -1
View File
@@ -564,4 +564,4 @@ std::string Store::GetReleaseNotes(int index) const {
}
return "";
}
}
+5 -5
View File
@@ -92,7 +92,7 @@ void Config::sysLang() {
Au cas où ça nexiste pas.
*/
void Config::initialize() {
FILE *temp = fopen("sdmc:/3ds/GhosteShop/Config.json", "w");
FILE *temp = fopen("sdmc:/3ds/DarkStore/Config.json", "w");
char tmp[2] = { '{', '}' };
fwrite(tmp, sizeof(tmp), 1, temp);
fclose(temp);
@@ -102,11 +102,11 @@ void Config::initialize() {
Constructeur de la configuration.
*/
Config::Config() {
if (access("sdmc:/3ds/GhosteShop/Config.json", F_OK) != 0) {
if (access("sdmc:/3ds/DarkStore/Config.json", F_OK) != 0) {
this->initialize();
}
FILE *file = fopen("sdmc:/3ds/GhosteShop/Config.json", "r");
FILE *file = fopen("sdmc:/3ds/DarkStore/Config.json", "r");
this->json = nlohmann::json::parse(file, nullptr, false);
fclose(file);
@@ -135,7 +135,7 @@ Config::Config() {
/* Ecrivez à config si changesMade. */
void Config::save() {
if (this->changesMade) {
FILE *file = fopen("sdmc:/3ds/GhosteShop/Config.json", "w");
FILE *file = fopen("sdmc:/3ds/DarkStore/Config.json", "w");
/* Valeurs Théoriques. */
this->setString("Language", this->language());
@@ -180,4 +180,4 @@ std::string Config::getString(const std::string &key) {
return this->json.at(key).get_ref<const std::string &>();
}
void Config::setString(const std::string &key, const std::string &v) { this->json[key] = v; };
void Config::setString(const std::string &key, const std::string &v) { this->json[key] = v; };
+17 -17
View File
@@ -528,7 +528,7 @@ bool IsUpdateAvailable(const std::string &URL, int revCurrent) {
int currentRev : Const Référence à la révision en cours. (-1 si inutilisée)
std::string &fl : Sortie du chemin de fichier.
bool isDownload : Si téléchargement ou mise à jour.
bool isUDB : Si téléchargement ghosteshop.eshop ou non.
bool isUDB : Si téléchargement darkstore.eshop ou non.
*/
bool DownloadEshop(const std::string &URL, int currentRev, std::string &fl, bool isDownload, bool isUDB) {
if (isUDB) Msg::DisplayMsg(Lang::get("DOWNLOADING_ESHOP_DB"));
@@ -585,7 +585,7 @@ bool DownloadEshop(const std::string &URL, int currentRev, std::string &fl, bool
if (parsedAPI.contains("storeInfo") && parsedAPI.contains("storeContent")) {
/* Vérifier, version == _ESHOP_VERSION. */
if (parsedAPI["storeInfo"].contains("version") && parsedAPI["storeInfo"]["version"].is_number()) {
if (parsedAPI["storeInfo"]["version"] == 3 || parsedAPI["storeInfo"]["version"] == 4) {
if (parsedAPI["storeInfo"]["version"] >= 1) {
if (currentRev > -1) {
if (parsedAPI["storeInfo"].contains("revision") && parsedAPI["storeInfo"]["revision"].is_number()) {
@@ -645,7 +645,7 @@ bool DownloadEshop(const std::string &URL, int currentRev, std::string &fl, bool
}
}
} else if (parsedAPI["storeInfo"]["version"] < 3) {
} else if (parsedAPI["storeInfo"]["version"] < 0) {
Msg::waitMsg(Lang::get("ESHOP_TOO_OLD"));
} else if (parsedAPI["storeInfo"]["version"] > _ESHOP_VERSION) {
@@ -750,12 +750,12 @@ bool DownloadSpriteSheet(const std::string &URL, const std::string &file) {
}
/*
Vérifier les mises à jour de Ghost eShop
Vérifier les mises à jour de DarkStore
*/
GEUpdate IsGEUpdateAvailable() {
DSUpdate IsDSUpdateAvailable() {
if (!checkWifiStatus()) return { false, "", "" };
Msg::DisplayMsg(Lang::get("CHECK_GE_UPDATES"));
Msg::DisplayMsg(Lang::get("CHECK_DS_UPDATES"));
Result ret = 0;
void *socubuf = memalign(0x1000, 0x100000);
@@ -802,7 +802,7 @@ GEUpdate IsGEUpdateAvailable() {
nlohmann::json parsedAPI = nlohmann::json::parse(result_buf);
if (parsedAPI.contains("tag_name") && parsedAPI["tag_name"].is_string()) {
GEUpdate update = { false, "", "" };
DSUpdate update = { false, "", "" };
update.Version = parsedAPI["tag_name"];
socExit();
@@ -833,10 +833,10 @@ extern bool is3DSX, exiting;
extern std::string _3dsxPath;
/*
Exécuter laction de mise à jour Ghost eShop.
Exécuter laction de mise à jour DarkStore.
*/
void UpdateAction() {
GEUpdate res = IsGEUpdateAvailable();
DSUpdate res = IsDSUpdateAvailable();
if (res.Available) {
bool confirmed = false;
int scrollIndex = 0;
@@ -852,7 +852,7 @@ void UpdateAction() {
Gui::DrawString(5, 25 - scrollIndex, 0.5f, TEXT_COLOR, res.Notes, 390, 0, font, C2D_WordWrap);
Gui::Draw_Rect(0, 0, 400, 25, BAR_COLOR);
Gui::Draw_Rect(0, 25, 400, 1, BAR_OUTL_COLOR);
Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, "Ghost eShop", 390, 0, font);
Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, "DarkStore", 390, 0, font);
Gui::Draw_Rect(0, 215, 400, 25, BAR_COLOR);
Gui::Draw_Rect(0, 214, 400, 1, BAR_OUTL_COLOR);
Gui::DrawStringCentered(0, 217, 0.7f, TEXT_COLOR, res.Version, 390, 0, font);
@@ -879,9 +879,9 @@ void UpdateAction() {
if ((down & KEY_A) || (down & KEY_B) || (down & KEY_START) || (down & KEY_TOUCH)) confirmed = true;
}
if (ScriptUtils::downloadRelease("Bot-Ghost/GHA", (is3DSX ? "GhostEshop.3dsx" : "GhostEshop.cia"),
(is3DSX ? _3dsxPath : "sdmc:/GhostEshop.cia"),
false, Lang::get("DOWNLOADING_GHOST_ESHOP")) == 0) {
if (ScriptUtils::downloadRelease("Bot-Ghost/GHA", (is3DSX ? "DarkStore.3dsx" : "DarkStore.cia"),
(is3DSX ? _3dsxPath : "sdmc:/DarkStore.cia"),
false, Lang::get("DOWNLOADING_DARKSTORE")) == 0) {
if (is3DSX) {
Msg::waitMsg(Lang::get("UPDATE_DONE"));
@@ -889,8 +889,8 @@ void UpdateAction() {
return;
}
ScriptUtils::installFile("sdmc:/GhostEshop.cia", false, Lang::get("INSTALL_GHOST_ESHOP"));
ScriptUtils::removeFile("sdmc:/GhostEshop.cia", Lang::get("DELETE_UNNEEDED_FILE"));
ScriptUtils::installFile("sdmc:/DarkStore.cia", false, Lang::get("INSTALL_DARKSTORE"));
ScriptUtils::removeFile("sdmc:/DarkStore.cia", Lang::get("DELETE_UNNEEDED_FILE"));
Msg::waitMsg(Lang::get("UPDATE_DONE"));
exiting = true;
}
@@ -928,7 +928,7 @@ std::vector<StoreList> FetchStores() {
CURL *hnd = curl_easy_init();
ret = setupContext(hnd, "https://cdn.ghosteshop.com/script/eShop.json");
ret = setupContext(hnd, "https://darkstore.ml/assets/eShop.json");
if (ret != 0) {
socExit();
free(result_buf);
@@ -1110,4 +1110,4 @@ std::string GetChangelog() {
result_written = 0;
return "";
}
}