Universal-Updater -> DarkStore Part 2

Renamed Strings For DarkStore
Made .store Files Useable
This commit is contained in:
dark98
2021-09-09 16:23:22 +01:00
parent 76b41884c5
commit c894ff9924
61 changed files with 650 additions and 648 deletions
+5 -5
View File
@@ -64,10 +64,10 @@ static const std::vector<Structs::ButtonPos> installedPos = {
const std::string &entryName: The name of the Entry. AKA: The Title Name.
int index: The Download index.
const std::string &unistoreName: The name of the UniStore filename.
const std::string &storeName: The name of the Store filename.
const std::string &author: The author of the app.
*/
static bool CreateShortcut(const std::string &entryName, int index, const std::string &unistoreName, const std::string &author) {
static bool CreateShortcut(const std::string &entryName, int index, const std::string &storeName, const std::string &author) {
std::string sName = Input::setkbdString(30, Lang::get("ENTER_SHORTCUT_FILENAME"), {});
if (sName == "") return false; // Just cancel.
std::ofstream out(config->shortcut() + "/" + sName + ".xml", std::ios::binary);
@@ -79,7 +79,7 @@ static bool CreateShortcut(const std::string &entryName, int index, const std::s
out << " <executable>" << executable << "</executable>" << std::endl;
/* Arguments. */
out << " <arg>\"" << unistoreName << "\" \"" << entryName << "\" \"" << std::to_string(index) << "\"" << "</arg>" << std::endl;
out << " <arg>\"" << storeName << "\" \"" << entryName << "\" \"" << std::to_string(index) << "\"" << "</arg>" << std::endl;
/* Title. */
const std::string title = Input::setkbdString(30, Lang::get("ENTER_TITLE_SHORTCUT"), {});
@@ -223,7 +223,7 @@ void StoreUtils::DownloadHandle(const std::unique_ptr<StoreEntry> &entry, const
if (touching(touch, installedPos[i])) {
if (i + StoreUtils::store->GetDownloadSIndex() < (int)entries.size()) {
if (installs[i + StoreUtils::store->GetDownloadSIndex()]) {
StoreUtils::meta->RemoveInstalled(StoreUtils::store->GetUniStoreTitle(), entry->GetTitle(), entries[i + StoreUtils::store->GetDownloadSIndex()]);
StoreUtils::meta->RemoveInstalled(StoreUtils::store->GetStoreTitle(), entry->GetTitle(), entries[i + StoreUtils::store->GetDownloadSIndex()]);
installs[i + StoreUtils::store->GetDownloadSIndex()] = false;
}
}
@@ -241,7 +241,7 @@ void StoreUtils::DownloadHandle(const std::unique_ptr<StoreEntry> &entry, const
if (hDown & KEY_X && !entries.empty()) {
if (installs[StoreUtils::store->GetDownloadIndex()]) {
StoreUtils::meta->RemoveInstalled(StoreUtils::store->GetUniStoreTitle(), entry->GetTitle(), entries[StoreUtils::store->GetDownloadIndex()]);
StoreUtils::meta->RemoveInstalled(StoreUtils::store->GetStoreTitle(), entry->GetTitle(), entries[StoreUtils::store->GetDownloadIndex()]);
installs[StoreUtils::store->GetDownloadIndex()] = false;
}
}
+15 -15
View File
@@ -91,34 +91,34 @@ void StoreUtils::MarkHandle(std::unique_ptr<StoreEntry> &entry, bool &showMark)
if (hidKeysDown() & KEY_TOUCH) {
/* Star. */
if (touching(t, markBox[0])) {
StoreUtils::meta->SetMarks(StoreUtils::store->GetUniStoreTitle(), entry->GetTitle(),
StoreUtils::meta->GetMarks(StoreUtils::store->GetUniStoreTitle(), entry->GetTitle()) ^ favoriteMarks::STAR);
entry->SetMark(StoreUtils::meta->GetMarks(StoreUtils::store->GetUniStoreTitle(), entry->GetTitle()));
StoreUtils::meta->SetMarks(StoreUtils::store->GetStoreTitle(), entry->GetTitle(),
StoreUtils::meta->GetMarks(StoreUtils::store->GetStoreTitle(), entry->GetTitle()) ^ favoriteMarks::STAR);
entry->SetMark(StoreUtils::meta->GetMarks(StoreUtils::store->GetStoreTitle(), entry->GetTitle()));
/* Heart. */
} else if (touching(t, markBox[1])) {
StoreUtils::meta->SetMarks(StoreUtils::store->GetUniStoreTitle(), entry->GetTitle(),
StoreUtils::meta->GetMarks(StoreUtils::store->GetUniStoreTitle(), entry->GetTitle()) ^ favoriteMarks::HEART);
entry->SetMark(StoreUtils::meta->GetMarks(StoreUtils::store->GetUniStoreTitle(), entry->GetTitle()));
StoreUtils::meta->SetMarks(StoreUtils::store->GetStoreTitle(), entry->GetTitle(),
StoreUtils::meta->GetMarks(StoreUtils::store->GetStoreTitle(), entry->GetTitle()) ^ favoriteMarks::HEART);
entry->SetMark(StoreUtils::meta->GetMarks(StoreUtils::store->GetStoreTitle(), entry->GetTitle()));
/* Diamond. */
} else if (touching(t, markBox[2])) {
StoreUtils::meta->SetMarks(StoreUtils::store->GetUniStoreTitle(), entry->GetTitle(),
StoreUtils::meta->GetMarks(StoreUtils::store->GetUniStoreTitle(), entry->GetTitle()) ^ favoriteMarks::DIAMOND);
entry->SetMark(StoreUtils::meta->GetMarks(StoreUtils::store->GetUniStoreTitle(), entry->GetTitle()));
StoreUtils::meta->SetMarks(StoreUtils::store->GetStoreTitle(), entry->GetTitle(),
StoreUtils::meta->GetMarks(StoreUtils::store->GetStoreTitle(), entry->GetTitle()) ^ favoriteMarks::DIAMOND);
entry->SetMark(StoreUtils::meta->GetMarks(StoreUtils::store->GetStoreTitle(), entry->GetTitle()));
/* Clubs. */
} else if (touching(t, markBox[3])) {
StoreUtils::meta->SetMarks(StoreUtils::store->GetUniStoreTitle(), entry->GetTitle(),
StoreUtils::meta->GetMarks(StoreUtils::store->GetUniStoreTitle(), entry->GetTitle()) ^ favoriteMarks::CLUBS);
entry->SetMark(StoreUtils::meta->GetMarks(StoreUtils::store->GetUniStoreTitle(), entry->GetTitle()));
StoreUtils::meta->SetMarks(StoreUtils::store->GetStoreTitle(), entry->GetTitle(),
StoreUtils::meta->GetMarks(StoreUtils::store->GetStoreTitle(), entry->GetTitle()) ^ favoriteMarks::CLUBS);
entry->SetMark(StoreUtils::meta->GetMarks(StoreUtils::store->GetStoreTitle(), entry->GetTitle()));
/* Spade. */
} else if (touching(t, markBox[4])) {
StoreUtils::meta->SetMarks(StoreUtils::store->GetUniStoreTitle(), entry->GetTitle(),
StoreUtils::meta->GetMarks(StoreUtils::store->GetUniStoreTitle(), entry->GetTitle()) ^ favoriteMarks::SPADE);
StoreUtils::meta->SetMarks(StoreUtils::store->GetStoreTitle(), entry->GetTitle(),
StoreUtils::meta->GetMarks(StoreUtils::store->GetStoreTitle(), entry->GetTitle()) ^ favoriteMarks::SPADE);
entry->SetMark(StoreUtils::meta->GetMarks(StoreUtils::store->GetUniStoreTitle(), entry->GetTitle()));
entry->SetMark(StoreUtils::meta->GetMarks(StoreUtils::store->GetStoreTitle(), entry->GetTitle()));
}
}
}
+1 -1
View File
@@ -131,7 +131,7 @@ void StoreUtils::DrawSearchMenu(const std::vector<bool> &searchIncludes, const s
Here you can..
- Filter your apps for the marks.
- Search the UniStore.
- Search the Store.
- Include stuff into the search.
std::vector<bool> &searchIncludes: Reference to the searchIncludes.
+10 -10
View File
@@ -81,7 +81,7 @@ static const Structs::ButtonPos back = { 45, 0, 24, 24 }; // Back arrow for dire
static const Structs::ButtonPos Theme = { 40, 196, 280, 24 }; // Themes.
static const std::vector<std::string> mainStrings = { "LANGUAGE", "SELECT_UNISTORE", "AUTO_UPDATE_SETTINGS_BTN", "GUI_SETTINGS_BTN", "DIRECTORY_SETTINGS_BTN", "CREDITS", "EXIT_APP" };
static const std::vector<std::string> mainStrings = { "LANGUAGE", "SELECT_STORE", "AUTO_UPDATE_SETTINGS_BTN", "GUI_SETTINGS_BTN", "DIRECTORY_SETTINGS_BTN", "CREDITS", "EXIT_APP" };
static const std::vector<std::string> dirStrings = { "CHANGE_3DSX_PATH", "3DSX_IN_FOLDER", "CHANGE_NDS_PATH", "CHANGE_ARCHIVE_PATH", "CHANGE_SHORTCUT_PATH", "CHANGE_FIRM_PATH" };
extern std::vector<std::pair<std::string, std::string>> Themes;
@@ -163,14 +163,14 @@ static void DrawAutoUpdate(int selection) {
/* Toggle Boxes. */
Gui::Draw_Rect(40, 44, 280, 24, (selection == 0 ? UIThemes->MarkSelected() : UIThemes->MarkUnselected()));
Gui::DrawString(47, 48, 0.5f, UIThemes->TextColor(), Lang::get("AUTO_UPDATE_UNISTORE"), 210, 0, font);
Gui::DrawString(47, 48, 0.5f, UIThemes->TextColor(), Lang::get("AUTO_UPDATE_STORE"), 210, 0, font);
GFX::DrawToggle(toggleAbles[0].x, toggleAbles[0].y, config->autoupdate());
Gui::DrawString(47, 75, 0.4f, UIThemes->TextColor(), Lang::get("AUTO_UPDATE_UNISTORE_DESC"), 265, 0, font, C2D_WordWrap);
Gui::DrawString(47, 75, 0.4f, UIThemes->TextColor(), Lang::get("AUTO_UPDATE_STORE_DESC"), 265, 0, font, C2D_WordWrap);
Gui::Draw_Rect(40, 120, 280, 24, (selection == 1 ? UIThemes->MarkSelected() : UIThemes->MarkUnselected()));
Gui::DrawString(47, 124, 0.5f, UIThemes->TextColor(), Lang::get("AUTO_UPDATE_UU"), 210, 0, font);
Gui::DrawString(47, 124, 0.5f, UIThemes->TextColor(), Lang::get("AUTO_UPDATE_DS"), 210, 0, font);
GFX::DrawToggle(toggleAbles[1].x, toggleAbles[1].y, config->updatecheck());
Gui::DrawString(47, 151, 0.4f, UIThemes->TextColor(), Lang::get("AUTO_UPDATE_UU_DESC"), 265, 0, font, C2D_WordWrap);
Gui::DrawString(47, 151, 0.4f, UIThemes->TextColor(), Lang::get("AUTO_UPDATE_DS_DESC"), 265, 0, font, C2D_WordWrap);
}
/*
@@ -186,9 +186,9 @@ static void DrawGUISettings(int selection) {
Gui::DrawStringCentered(20, 2, 0.6, UIThemes->TextColor(), Lang::get("GUI_SETTINGS"), 248, 0, font);
Gui::Draw_Rect(40, 44, 280, 24, (selection == 0 ? UIThemes->MarkSelected() : UIThemes->MarkUnselected()));
Gui::DrawString(47, 48, 0.5f, UIThemes->TextColor(), Lang::get("UNISTORE_BG"), 210, 0, font);
Gui::DrawString(47, 48, 0.5f, UIThemes->TextColor(), Lang::get("STORE_BG"), 210, 0, font);
GFX::DrawToggle(toggleAbles[0].x, toggleAbles[0].y, config->usebg());
Gui::DrawString(47, 75, 0.4f, UIThemes->TextColor(), Lang::get("UNISTORE_BG_DESC"), 265, 0, font, C2D_WordWrap);
Gui::DrawString(47, 75, 0.4f, UIThemes->TextColor(), Lang::get("STORE_BG_DESC"), 265, 0, font, C2D_WordWrap);
Gui::Draw_Rect(40, 120, 280, 24, (selection == 1 ? UIThemes->MarkSelected() : UIThemes->MarkUnselected()));
Gui::DrawString(47, 124, 0.5f, UIThemes->TextColor(), Lang::get("CUSTOM_FONT"), 210, 0, font);
@@ -207,8 +207,8 @@ static void DrawGUISettings(int selection) {
Here you can..
- Change the Language.
- Access the UniStore Manage Handle.
- Enable UniStore auto update on boot.
- Access the Store Manage Handle.
- Enable Store auto update on boot.
- Show the Credits.
- Exit DarkStore.
@@ -425,7 +425,7 @@ static void SettingsHandleDir(int &page, int &selection) {
Here you can..
- Enable / Disable Automatically updating the UniStore on boot.
- Enable / Disable Automatically updating the Store on boot.
- Enable / Disable Automatically check for DarkStore updates on boot.
int &page: Reference to the page.
+25 -25
View File
@@ -56,7 +56,7 @@ static const std::vector<Structs::ButtonPos> mainButtons = {
/*
Delete a store.. including the Spritesheets, if found.
const std::string &file: The file of the UniStore.
const std::string &file: The file of the Store.
*/
static void DeleteStore(const std::string &file) {
nlohmann::json storeJson;
@@ -68,7 +68,7 @@ static void DeleteStore(const std::string &file) {
if (storeJson.is_discarded())
storeJson = {};
/* Check, if Spritesheet exist on UniStore. */
/* Check, if Spritesheet exist on Store. */
if (storeJson["storeInfo"].contains("sheet") && storeJson["storeInfo"]["sheet"].is_array()) {
const std::vector<std::string> sht = storeJson["storeInfo"]["sheet"].get<std::vector<std::string>>();
@@ -96,7 +96,7 @@ static void DeleteStore(const std::string &file) {
}
}
deleteFile((std::string(_STORE_PATH) + file).c_str()); // Now delete UniStore.
deleteFile((std::string(_STORE_PATH) + file).c_str()); // Now delete Store.
}
/*
@@ -107,7 +107,7 @@ static bool DownloadStore() {
std::string file = "";
const std::string URL = QR_Scanner::StoreHandle();
if (URL != "") doSheet = DownloadUniStore(URL, -1, file, true);
if (URL != "") doSheet = DownloadStore(URL, -1, file, true);
if (doSheet) {
nlohmann::json storeJson;
@@ -163,7 +163,7 @@ static bool UpdateStore(const std::string &URL) {
bool doSheet = false;
std::string file = "";
if (URL != "") doSheet = DownloadUniStore(URL, -1, file, false);
if (URL != "") doSheet = DownloadStore(URL, -1, file, false);
if (doSheet) {
nlohmann::json storeJson;
@@ -215,19 +215,19 @@ static bool UpdateStore(const std::string &URL) {
}
/*
This is the UniStore Manage Handle.
This is the Store Manage Handle.
Here you can..
- Delete a UniStore.
- Download / Add a UniStore.
- Check for Updates for a UniStore.
- Switch the UniStore.
- Delete a Store.
- Download / Add a Store.
- Check for Updates for a Store.
- Switch the Store.
*/
void Overlays::SelectStore() {
bool doOut = false;
int selection = 0, sPos = 0;
std::vector<UniStoreInfo> info = GetUniStoreInfo(_STORE_PATH);
std::vector<StoreInfo> info = GetStoreInfo(_STORE_PATH);
while(!doOut) {
Gui::clearTextBufs();
@@ -252,7 +252,7 @@ void Overlays::SelectStore() {
Gui::DrawStringCentered(0, 70, 0.5f, UIThemes->TextColor(), info[selection].Description, 380, 130, font, C2D_WordWrap);
} else {
Gui::DrawStringCentered(0, 1, 0.7f, UIThemes->TextColor(), Lang::get("INVALID_UNISTORE"), 390, 0, font);
Gui::DrawStringCentered(0, 1, 0.7f, UIThemes->TextColor(), Lang::get("INVALID_STORE"), 390, 0, font);
}
Gui::DrawString(10, 200, 0.4, UIThemes->TextColor(), "- " + Lang::get("ENTRIES") + ": " + std::to_string(info[selection].StoreSize), 150, 0, font);
@@ -265,7 +265,7 @@ void Overlays::SelectStore() {
Gui::Draw_Rect(0, 0, 320, 25, UIThemes->BarColor());
Gui::Draw_Rect(0, 25, 320, 1, UIThemes->BarOutline());
GFX::DrawIcon(sprites_arrow_idx, mainButtons[9].x, mainButtons[9].y, UIThemes->TextColor());
Gui::DrawStringCentered(0, 2, 0.6, UIThemes->TextColor(), Lang::get("SELECT_UNISTORE_2"), 310, 0, font);
Gui::DrawStringCentered(0, 2, 0.6, UIThemes->TextColor(), Lang::get("SELECT_STORE_2"), 310, 0, font);
for(int i = 0; i < 6 && i < (int)info.size(); i++) {
if (sPos + i == selection) Gui::Draw_Rect(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, UIThemes->MarkSelected());
@@ -311,9 +311,9 @@ void Overlays::SelectStore() {
if (info[selection].File != "") { // Ensure to check for this.
if (!(info[selection].File.find("/") != std::string::npos)) {
/* Load selected one. */
if (info[selection].Version == -1) Msg::waitMsg(Lang::get("UNISTORE_INVALID_ERROR"));
else if (info[selection].Version < 3) Msg::waitMsg(Lang::get("UNISTORE_TOO_OLD"));
else if (info[selection].Version > _UNISTORE_VERSION) Msg::waitMsg(Lang::get("UNISTORE_TOO_NEW"));
if (info[selection].Version == -1) Msg::waitMsg(Lang::get("STORE_INVALID_ERROR"));
else if (info[selection].Version < 3) Msg::waitMsg(Lang::get("STORE_TOO_OLD"));
else if (info[selection].Version > _STORE_VERSION) Msg::waitMsg(Lang::get("STORE_TOO_NEW"));
else {
config->lastStore(info[selection].FileName);
StoreUtils::store = std::make_unique<Store>(_STORE_PATH + info[selection].FileName, info[selection].FileName);
@@ -333,9 +333,9 @@ void Overlays::SelectStore() {
if (touching(touch, mainButtons[i])) {
if (i + sPos < (int)info.size() && info[i + sPos].File != "") { // Ensure to check for this.
if (!(info[i + sPos].File.find("/") != std::string::npos)) {
if (info[i + sPos].Version == -1) Msg::waitMsg(Lang::get("UNISTORE_INVALID_ERROR"));
else if (info[i + sPos].Version < 3) Msg::waitMsg(Lang::get("UNISTORE_TOO_OLD"));
else if (info[i + sPos].Version > _UNISTORE_VERSION) Msg::waitMsg(Lang::get("UNISTORE_TOO_NEW"));
if (info[i + sPos].Version == -1) Msg::waitMsg(Lang::get("STORE_INVALID_ERROR"));
else if (info[i + sPos].Version < 3) Msg::waitMsg(Lang::get("STORE_TOO_OLD"));
else if (info[i + sPos].Version > _STORE_VERSION) Msg::waitMsg(Lang::get("STORE_TOO_NEW"));
else {
config->lastStore(info[i + sPos].FileName);
StoreUtils::store = std::make_unique<Store>(_STORE_PATH + info[i + sPos].FileName, info[i + sPos].FileName);
@@ -352,22 +352,22 @@ void Overlays::SelectStore() {
}
}
/* Delete UniStore. */
/* Delete Store. */
if ((hidKeysDown() & KEY_X) || (hidKeysDown() & KEY_TOUCH && touching(touch, mainButtons[6]))) {
if (info[selection].FileName != "") {
DeleteStore(info[selection].FileName);
selection = 0;
info = GetUniStoreInfo(_STORE_PATH);
info = GetStoreInfo(_STORE_PATH);
}
}
/* Download latest UniStore. */
/* Download latest Store. */
if ((hidKeysDown() & KEY_START) || (hidKeysDown() & KEY_TOUCH && touching(touch, mainButtons[7]))) {
if (checkWifiStatus()) {
if (info[selection].URL != "") {
if (UpdateStore(info[selection].URL)) {
selection = 0;
info = GetUniStoreInfo(_STORE_PATH);
info = GetStoreInfo(_STORE_PATH);
}
}
@@ -380,12 +380,12 @@ void Overlays::SelectStore() {
else if (selection > sPos + 6 - 1) sPos = selection - 6 + 1;
}
/* UniStore QR Code / URL Download. */
/* Store QR Code / URL Download. */
if ((hidKeysDown() & KEY_Y) || (hidKeysDown() & KEY_TOUCH && touching(touch, mainButtons[8]))) {
if (checkWifiStatus()) {
if (DownloadStore()) {
selection = 0;
info = GetUniStoreInfo(_STORE_PATH);
info = GetStoreInfo(_STORE_PATH);
}
} else {
+1 -1
View File
@@ -168,7 +168,7 @@ void QRCode::drawThread() {
GFX::DrawBottom();
Gui::Draw_Rect(0, 0, 320, 25, UIThemes->EntryBar());
Gui::Draw_Rect(0, 25, 320, 1, UIThemes->EntryOutline());
Gui::DrawStringCentered(0, 2, 0.6, UIThemes->TextColor(), Lang::get("RECOMMENDED_UNISTORES"), 310, 0, font);
Gui::DrawStringCentered(0, 2, 0.6, UIThemes->TextColor(), Lang::get("RECOMMENDED_STORES"), 310, 0, font);
for(int i = 0; i < 6 && i < (int)this->stores.size(); i++) {
if (this->sPos + i == this->selectedStore) Gui::Draw_Rect(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, UIThemes->MarkSelected());
+10 -10
View File
@@ -35,7 +35,7 @@
extern int fadeAlpha;
extern UniStoreInfo GetInfo(const std::string &file, const std::string &fileName);
extern StoreInfo GetInfo(const std::string &file, const std::string &fileName);
extern void notConnectedMsg();
extern void DisplayChangelog();
@@ -56,9 +56,9 @@ MainScreen::MainScreen() {
} else {
/* check version and file here. */
const UniStoreInfo info = GetInfo((_STORE_PATH + config->lastStore()), config->lastStore());
const StoreInfo info = GetInfo((_STORE_PATH + config->lastStore()), config->lastStore());
if (info.Version != 3 && info.Version != _UNISTORE_VERSION) {
if (info.Version != 3 && info.Version != _STORE_VERSION) {
config->lastStore("darkstore-homebrew.unistore");
}
@@ -75,7 +75,7 @@ MainScreen::MainScreen() {
if (access("sdmc:/3ds/DarkStore/stores/darkstore-homebrew.unistore", F_OK) != 0) {
if (checkWifiStatus()) {
std::string tmp = ""; // Just a temp.
DownloadUniStore("https://darkstore.ml/app/darkstore-homebrew.unistore", -1, tmp, true, true);
DownloadStore("https://darkstore.ml/app/darkstore-homebrew.unistore", -1, tmp, true, true);
DownloadSpriteSheet("https://darkstore.ml/app/darkstore-homebrew.t3x", "darkstore-homebrew.t3x");
} else {
@@ -83,12 +83,12 @@ MainScreen::MainScreen() {
}
} else {
const UniStoreInfo info = GetInfo("sdmc:/3ds/DarkStore/stores/darkstore-homebrew.unistore", "darkstore-homebrew.unistore");
const StoreInfo info = GetInfo("sdmc:/3ds/DarkStore/stores/darkstore-homebrew.unistore", "darkstore-homebrew.unistore");
if (info.Version != 3 && info.Version != _UNISTORE_VERSION) {
if (info.Version != 3 && info.Version != _STORE_VERSION) {
if (checkWifiStatus()) {
std::string tmp = ""; // Just a temp.
DownloadUniStore("https://darkstore.ml/app/darkstore-homebrew.unistore", -1, tmp, true, true);
DownloadStore("https://darkstore.ml/app/darkstore-homebrew.unistore", -1, tmp, true, true);
DownloadSpriteSheet("https://darkstore.ml/app/darkstore-homebrew.t3x", "darkstore-homebrew.t3x");
} else {
@@ -125,8 +125,8 @@ void MainScreen::Draw(void) const {
Gui::Draw_Rect(0, 0, 400, 25, UIThemes->BarColor());
Gui::Draw_Rect(0, 25, 400, 1, UIThemes->BarOutline());
if (StoreUtils::store && StoreUtils::store->GetValid()) Gui::DrawStringCentered(0, 1, 0.7f, UIThemes->TextColor(), StoreUtils::store->GetUniStoreTitle(), 360, 0, font);
else Gui::DrawStringCentered(0, 1, 0.7f, UIThemes->TextColor(), Lang::get("INVALID_UNISTORE"), 370, 0, font);
if (StoreUtils::store && StoreUtils::store->GetValid()) Gui::DrawStringCentered(0, 1, 0.7f, UIThemes->TextColor(), StoreUtils::store->GetStoreTitle(), 360, 0, font);
else Gui::DrawStringCentered(0, 1, 0.7f, UIThemes->TextColor(), Lang::get("INVALID_STORE"), 370, 0, font);
config->list() ? StoreUtils::DrawList() : StoreUtils::DrawGrid();
GFX::DrawTime();
GFX::DrawBattery();
@@ -237,7 +237,7 @@ void MainScreen::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
this->dwnldSizes.clear();
if (StoreUtils::store && StoreUtils::store->GetValid()) {
const std::vector<std::string> installedNames = StoreUtils::meta->GetInstalled(StoreUtils::store->GetUniStoreTitle(), StoreUtils::entries[StoreUtils::store->GetEntry()]->GetTitle());
const std::vector<std::string> installedNames = StoreUtils::meta->GetInstalled(StoreUtils::store->GetStoreTitle(), StoreUtils::entries[StoreUtils::store->GetEntry()]->GetTitle());
StoreUtils::store->SetDownloadIndex(0); // Reset to 0.
StoreUtils::store->SetDownloadSIndex(0);
+23 -23
View File
@@ -73,7 +73,7 @@ void Meta::ImportMetadata() {
if (oldJson.is_discarded())
oldJson = { };
std::vector<UniStoreInfo> info = GetUniStoreInfo(_STORE_PATH); // Fetch UniStores.
std::vector<StoreInfo> info = GetStoreInfo(_STORE_PATH); // Fetch Stores.
for (int i = 0; i < (int)info.size(); i++) {
if (info[i].Title != "" && oldJson.contains(info[i].FileName)) {
@@ -89,49 +89,49 @@ void Meta::ImportMetadata() {
/*
Get Last Updated.
const std::string &unistoreName: The UniStore name.
const std::string &storeName: The Store name.
const std::string &entry: The Entry name.
*/
std::string Meta::GetUpdated(const std::string &unistoreName, const std::string &entry) const {
if (!this->metadataJson.contains(unistoreName)) return ""; // UniStore Name does not exist.
std::string Meta::GetUpdated(const std::string &storeName, const std::string &entry) const {
if (!this->metadataJson.contains(storeName)) return ""; // Store Name does not exist.
if (!this->metadataJson[unistoreName].contains(entry)) return ""; // Entry does not exist.
if (!this->metadataJson[storeName].contains(entry)) return ""; // Entry does not exist.
if (!this->metadataJson[unistoreName][entry].contains("updated")) return ""; // updated does not exist.
if (!this->metadataJson[storeName][entry].contains("updated")) return ""; // updated does not exist.
if (this->metadataJson[unistoreName][entry]["updated"].is_string()) return this->metadataJson[unistoreName][entry]["updated"];
if (this->metadataJson[storeName][entry]["updated"].is_string()) return this->metadataJson[storeName][entry]["updated"];
return "";
}
/*
Get the marks.
const std::string &unistoreName: The UniStore name.
const std::string &storeName: The Store name.
const std::string &entry: The Entry name.
*/
int Meta::GetMarks(const std::string &unistoreName, const std::string &entry) const {
int Meta::GetMarks(const std::string &storeName, const std::string &entry) const {
int temp = 0;
if (!this->metadataJson.contains(unistoreName)) return temp; // UniStore Name does not exist.
if (!this->metadataJson.contains(storeName)) return temp; // Store Name does not exist.
if (!this->metadataJson[unistoreName].contains(entry)) return temp; // Entry does not exist.
if (!this->metadataJson[storeName].contains(entry)) return temp; // Entry does not exist.
if (!this->metadataJson[unistoreName][entry].contains("marks")) return temp; // marks does not exist.
if (!this->metadataJson[storeName][entry].contains("marks")) return temp; // marks does not exist.
if (this->metadataJson[unistoreName][entry]["marks"].is_number()) return this->metadataJson[unistoreName][entry]["marks"];
if (this->metadataJson[storeName][entry]["marks"].is_number()) return this->metadataJson[storeName][entry]["marks"];
return temp;
}
/*
Return, if update available.
const std::string &unistoreName: The UniStore name.
const std::string &storeName: The Store name.
const std::string &entry: The Entry name.
const std::string &updated: Compare for the update.
*/
bool Meta::UpdateAvailable(const std::string &unistoreName, const std::string &entry, const std::string &updated) const {
if (this->GetUpdated(unistoreName, entry) != "" && updated != "") {
return strcasecmp(updated.c_str(), this->GetUpdated(unistoreName, entry).c_str()) > 0;
bool Meta::UpdateAvailable(const std::string &storeName, const std::string &entry, const std::string &updated) const {
if (this->GetUpdated(storeName, entry) != "" && updated != "") {
return strcasecmp(updated.c_str(), this->GetUpdated(storeName, entry).c_str()) > 0;
}
return false;
@@ -140,17 +140,17 @@ bool Meta::UpdateAvailable(const std::string &unistoreName, const std::string &e
/*
Get the marks.
const std::string &unistoreName: The UniStore name.
const std::string &storeName: The Store name.
const std::string &entry: The Entry name.
*/
std::vector<std::string> Meta::GetInstalled(const std::string &unistoreName, const std::string &entry) const {
if (!this->metadataJson.contains(unistoreName)) return { }; // UniStore Name does not exist.
std::vector<std::string> Meta::GetInstalled(const std::string &storeName, const std::string &entry) const {
if (!this->metadataJson.contains(storeName)) return { }; // Store Name does not exist.
if (!this->metadataJson[unistoreName].contains(entry)) return { }; // Entry does not exist.
if (!this->metadataJson[storeName].contains(entry)) return { }; // Entry does not exist.
if (!this->metadataJson[unistoreName][entry].contains("installed")) return { }; // marks does not exist.
if (!this->metadataJson[storeName][entry].contains("installed")) return { }; // marks does not exist.
if (this->metadataJson[unistoreName][entry]["installed"].is_array()) return this->metadataJson[unistoreName][entry]["installed"];
if (this->metadataJson[storeName][entry]["installed"].is_array()) return this->metadataJson[storeName][entry]["installed"];
return { };
}
+12 -12
View File
@@ -38,8 +38,8 @@ static bool firstStart = true;
/*
Initialize a Store.
const std::string &file: The UniStore file.
const std::string &file2: The UniStore file.. without full path.
const std::string &file: The Store file.
const std::string &file2: The Store file.. without full path.
bool ARGMode: If Argument mode.
*/
Store::Store(const std::string &file, const std::string &file2, bool ARGMode) {
@@ -62,7 +62,7 @@ Store::Store(const std::string &file, const std::string &file2, bool ARGMode) {
};
/*
Update an UniStore, including SpriteSheet, if revision increased.
Update an Store, including SpriteSheet, if revision increased.
const std::string &file: Const Reference to the fileName.
*/
@@ -100,7 +100,7 @@ void Store::update(const std::string &file) {
if (URL != "") {
std::string tmp = "";
doSheet = DownloadUniStore(URL, rev, tmp);
doSheet = DownloadStore(URL, rev, tmp);
}
} else {
@@ -218,9 +218,9 @@ void Store::loadSheets() {
/*
Load a UniStore from a file.
Load a Store from a file.
const std::string &file: The file of the UniStore.
const std::string &file: The file of the Store.
*/
void Store::LoadFromFile(const std::string &file) {
FILE *in = fopen(file.c_str(), "rt");
@@ -237,22 +237,22 @@ void Store::LoadFromFile(const std::string &file) {
/* Check, if valid. */
if (this->storeJson.contains("storeInfo") && this->storeJson.contains("storeContent")) {
if (this->storeJson["storeInfo"].contains("version") && this->storeJson["storeInfo"]["version"].is_number()) {
if (this->storeJson["storeInfo"]["version"] < 3) Msg::waitMsg(Lang::get("UNISTORE_TOO_OLD"));
else if (this->storeJson["storeInfo"]["version"] > _UNISTORE_VERSION) Msg::waitMsg(Lang::get("UNISTORE_TOO_NEW"));
else if (this->storeJson["storeInfo"]["version"] == 3 || this->storeJson["storeInfo"]["version"] == _UNISTORE_VERSION) {
if (this->storeJson["storeInfo"]["version"] < 3) Msg::waitMsg(Lang::get("STORE_TOO_OLD"));
else if (this->storeJson["storeInfo"]["version"] > _STORE_VERSION) Msg::waitMsg(Lang::get("STORE_TOO_NEW"));
else if (this->storeJson["storeInfo"]["version"] == 3 || this->storeJson["storeInfo"]["version"] == _STORE_VERSION) {
this->valid = true;
}
}
} else {
Msg::waitMsg(Lang::get("UNISTORE_INVALID_ERROR"));
Msg::waitMsg(Lang::get("STORE_INVALID_ERROR"));
}
}
/*
Return the Title of the UniStore.
Return the Title of the Store.
*/
std::string Store::GetUniStoreTitle() const {
std::string Store::GetStoreTitle() const {
if (this->valid) {
if (this->storeJson["storeInfo"].contains("title")) return this->storeJson["storeInfo"]["title"];
}
+3 -3
View File
@@ -44,7 +44,7 @@ StoreEntry::StoreEntry(const std::unique_ptr<Store> &store, const std::unique_pt
this->Console = StringUtils::FetchStringsFromVector(store->GetConsoleEntry(index));
this->LastUpdated = store->GetLastUpdatedEntry(index);
this->License = store->GetLicenseEntry(index);
this->MarkString = StringUtils::GetMarkString(meta->GetMarks(store->GetUniStoreTitle(), this->Title));
this->MarkString = StringUtils::GetMarkString(meta->GetMarks(store->GetStoreTitle(), this->Title));
this->Icon = store->GetIconEntry(index);
this->SheetIndex = 0;
@@ -53,8 +53,8 @@ StoreEntry::StoreEntry(const std::unique_ptr<Store> &store, const std::unique_pt
this->FullCategory = store->GetCategoryIndex(index);
this->FullConsole = store->GetConsoleEntry(index);
this->UpdateAvailable = meta->UpdateAvailable(store->GetUniStoreTitle(), this->Title, store->GetLastUpdatedEntry(index));
this->Marks = meta->GetMarks(store->GetUniStoreTitle(), this->Title);
this->UpdateAvailable = meta->UpdateAvailable(store->GetStoreTitle(), this->Title, store->GetLastUpdatedEntry(index));
this->Marks = meta->GetMarks(store->GetStoreTitle(), this->Title);
const std::vector<std::string> entries = store->GetDownloadList(index);
+3 -3
View File
@@ -181,7 +181,7 @@ void StoreUtils::ResetAll() {
void StoreUtils::RefreshUpdateAVL() {
for (int i = 0; i < (int)StoreUtils::entries.size(); i++) {
if (StoreUtils::entries[i]) {
StoreUtils::entries[i]->SetUpdateAvl(StoreUtils::meta->UpdateAvailable(StoreUtils::store->GetUniStoreTitle(), StoreUtils::entries[i]->GetTitle(), StoreUtils::entries[i]->GetLastUpdated()));
StoreUtils::entries[i]->SetUpdateAvl(StoreUtils::meta->UpdateAvailable(StoreUtils::store->GetStoreTitle(), StoreUtils::entries[i]->GetTitle(), StoreUtils::entries[i]->GetLastUpdated()));
}
}
}
@@ -209,7 +209,7 @@ void StoreUtils::AddToQueue(int index, const std::string &entry, const std::stri
}
}
QueueSystem::AddToQueue(Script, StoreUtils::store->GetIconEntry(index), entry, StoreUtils::store->GetUniStoreTitle(), entryName, lUpdated); // Here we add this to the Queue at the end.
QueueSystem::AddToQueue(Script, StoreUtils::store->GetIconEntry(index), entry, StoreUtils::store->GetStoreTitle(), entryName, lUpdated); // Here we add this to the Queue at the end.
}
/*
@@ -221,7 +221,7 @@ void StoreUtils::AddAllToQueue() {
if (StoreUtils::entries[storeEntry]) { // Ensure pointer is valid.
const std::vector<std::string> entryNames = StoreUtils::store->GetDownloadList(StoreUtils::entries[storeEntry]->GetEntryIndex()); // Return a vector of all Download Entries.
const std::vector<std::string> installedNames = StoreUtils::meta->GetInstalled(StoreUtils::store->GetUniStoreTitle(), StoreUtils::entries[storeEntry]->GetTitle()); // Return a vector from all installed entries.
const std::vector<std::string> installedNames = StoreUtils::meta->GetInstalled(StoreUtils::store->GetStoreTitle(), StoreUtils::entries[storeEntry]->GetTitle()); // Return a vector from all installed entries.
if (!entryNames.empty() && !installedNames.empty()) { // Ensure both aren't empty.
for (int i = 0; i < (int)entryNames.size(); i++) {
+1 -1
View File
@@ -47,7 +47,7 @@ ArgumentParser::ArgumentParser(const std::string &file, const std::string &entry
}
/*
Prepare UniStore and get valid state.
Prepare Store and get valid state.
*/
void ArgumentParser::Load() {
if (access((std::string(_STORE_PATH) + this->file).c_str(), F_OK) != 0) return;
+25 -25
View File
@@ -463,11 +463,11 @@ void notConnectedMsg(void) { Msg::waitMsg(Lang::get("CONNECT_WIFI")); }
/*
Return, if an update is available.
const std::string &URL: Const Reference to the URL of the UniStore.
const std::string &URL: Const Reference to the URL of the Store.
int revCurrent: The current Revision. (-1 if unused)
*/
bool IsUpdateAvailable(const std::string &URL, int revCurrent) {
Msg::DisplayMsg(Lang::get("CHECK_UNISTORE_UPDATES"));
Msg::DisplayMsg(Lang::get("CHECK_STORE_UPDATES"));
Result ret = 0;
void *socubuf = memalign(0x1000, 0x100000);
@@ -539,19 +539,19 @@ bool IsUpdateAvailable(const std::string &URL, int revCurrent) {
}
/*
Download a UniStore and return, if revision is higher than current.
Download a Store and return, if revision is higher than current.
const std::string &URL: Const Reference to the URL of the UniStore.
const std::string &URL: Const Reference to the URL of the Store.
int currentRev: Const Reference to the current Revision. (-1 if unused)
std::string &fl: Output for the filepath.
bool isDownload: If download or updating.
bool isUDB: If Universal-DB download or not.
bool isDS: If Default store download or not.
*/
bool DownloadUniStore(const std::string &URL, int currentRev, std::string &fl, bool isDownload, bool isUDB) {
if (isUDB) Msg::DisplayMsg(Lang::get("DOWNLOADING_UNIVERSAL_DB"));
bool DownloadStore(const std::string &URL, int currentRev, std::string &fl, bool isDownload, bool isDS) {
if (isDS) Msg::DisplayMsg(Lang::get("DOWNLOADING_DEFAULT_STORE"));
else {
if (currentRev > -1) Msg::DisplayMsg(Lang::get("CHECK_UNISTORE_UPDATES"));
else Msg::DisplayMsg((isDownload ? Lang::get("DOWNLOADING_UNISTORE") : Lang::get("UPDATING_UNISTORE")));
if (currentRev > -1) Msg::DisplayMsg(Lang::get("CHECK_STORE_UPDATES"));
else Msg::DisplayMsg((isDownload ? Lang::get("DOWNLOADING_STORE") : Lang::get("UPDATING_STORE")));
}
if (URL.length() > 4) {
@@ -605,7 +605,7 @@ bool DownloadUniStore(const std::string &URL, int currentRev, std::string &fl, b
nlohmann::json parsedAPI = nlohmann::json::parse(result_buf);
if (parsedAPI.contains("storeInfo") && parsedAPI.contains("storeContent")) {
/* Ensure, version == _UNISTORE_VERSION. */
/* Ensure, version == _STORE_VERSION. */
if (parsedAPI["storeInfo"].contains("version") && parsedAPI["storeInfo"]["version"].is_number()) {
if (parsedAPI["storeInfo"]["version"] == 3 || parsedAPI["storeInfo"]["version"] == 4) {
if (currentRev > -1) {
@@ -614,7 +614,7 @@ bool DownloadUniStore(const std::string &URL, int currentRev, std::string &fl, b
const int rev = parsedAPI["storeInfo"]["revision"];
if (rev > currentRev) {
Msg::DisplayMsg(Lang::get("UPDATING_UNISTORE"));
Msg::DisplayMsg(Lang::get("UPDATING_STORE"));
if (parsedAPI["storeInfo"].contains("file") && parsedAPI["storeInfo"]["file"].is_string()) {
fl = parsedAPI["storeInfo"]["file"];
@@ -668,16 +668,16 @@ bool DownloadUniStore(const std::string &URL, int currentRev, std::string &fl, b
}
} else if (parsedAPI["storeInfo"]["version"] < 3) {
Msg::waitMsg(Lang::get("UNISTORE_TOO_OLD"));
Msg::waitMsg(Lang::get("STORE_TOO_OLD"));
} else if (parsedAPI["storeInfo"]["version"] > _UNISTORE_VERSION) {
Msg::waitMsg(Lang::get("UNISTORE_TOO_NEW"));
} else if (parsedAPI["storeInfo"]["version"] > _STORE_VERSION) {
Msg::waitMsg(Lang::get("STORE_TOO_NEW"));
}
}
} else {
Msg::waitMsg(Lang::get("UNISTORE_INVALID_ERROR"));
Msg::waitMsg(Lang::get("STORE_INVALID_ERROR"));
}
}
}
@@ -775,12 +775,12 @@ bool DownloadSpriteSheet(const std::string &URL, const std::string &file) {
}
/*
Checks for U-U updates.
Checks for DarkStore updates.
*/
UUUpdate IsUUUpdateAvailable() {
DSUpdate IsDSUpdateAvailable() {
if (!checkWifiStatus()) return { false, "", "" };
Msg::DisplayMsg(Lang::get("CHECK_UU_UPDATES"));
Msg::DisplayMsg(Lang::get("CHECK_DS_UPDATES"));
Result ret = 0;
void *socubuf = memalign(0x1000, 0x100000);
@@ -827,7 +827,7 @@ UUUpdate IsUUUpdateAvailable() {
nlohmann::json parsedAPI = nlohmann::json::parse(result_buf);
if (parsedAPI.contains("tag_name") && parsedAPI["tag_name"].is_string()) {
UUUpdate update = { false, "", "" };
DSUpdate update = { false, "", "" };
update.Version = parsedAPI["tag_name"];
socExit();
@@ -858,10 +858,10 @@ extern bool is3DSX, exiting;
extern std::string _3dsxPath;
/*
Execute U-U update action.
Execute DarkStore update action.
*/
void UpdateAction() {
UUUpdate res = IsUUUpdateAvailable();
DSUpdate res = IsDSUpdateAvailable();
if (res.Available) {
bool confirmed = false;
int scrollIndex = 0;
@@ -906,7 +906,7 @@ void UpdateAction() {
if (ScriptUtils::downloadRelease("DarkStore-3DS/DarkStore", (is3DSX ? "DarkStore.3dsx" : "DarkStore.cia"),
(is3DSX ? _3dsxPath : "sdmc:/DarkStore.cia"),
false, Lang::get("DONLOADING_UNIVERSAL_UPDATER"), true) == 0) {
false, Lang::get("DONLOADING_DARKSTORE"), true) == 0) {
if (is3DSX) {
Msg::waitMsg(Lang::get("UPDATE_DONE"));
@@ -914,7 +914,7 @@ void UpdateAction() {
return;
}
ScriptUtils::installFile("sdmc:/DarkStore.cia", false, Lang::get("INSTALL_UNIVERSAL_UPDATER"), true);
ScriptUtils::installFile("sdmc:/DarkStore.cia", false, Lang::get("INSTALL_DARKSTORE"), true);
ScriptUtils::removeFile("sdmc:/DarkStore.cia", Lang::get("DELETE_UNNEEDED_FILE"), true);
Msg::waitMsg(Lang::get("UPDATE_DONE"));
exiting = true;
@@ -934,10 +934,10 @@ static StoreList fetch(const std::string &entry, nlohmann::json &js) {
return store;
}
/*
Fetch store list for available UniStores.
Fetch store list for available Stores.
*/
std::vector<StoreList> FetchStores() {
Msg::DisplayMsg(Lang::get("FETCHING_RECOMMENDED_UNISTORES"));
Msg::DisplayMsg(Lang::get("FETCHING_RECOMMENDED_STORES"));
std::vector<StoreList> stores = { };
Result ret = 0;
+10 -8
View File
@@ -89,13 +89,13 @@ void getDirectoryContents(std::vector<DirEntry> &dirContents) {
}
/*
Return UniStore info.
Return Store info.
const std::string &file: Const Reference to the path of the file.
const std::string &fieName: Const Reference to the filename, without path.
*/
UniStoreInfo GetInfo(const std::string &file, const std::string &fileName) {
UniStoreInfo Temp = { "", "", "", "", fileName, "", -1, -1, -1 }; // Title, Author, URL, File (to check if no slash exist), FileName, Desc, Version, Revision, entries.
StoreInfo GetInfo(const std::string &file, const std::string &fileName) {
StoreInfo Temp = { "", "", "", "", fileName, "", -1, -1, -1 }; // Title, Author, URL, File (to check if no slash exist), FileName, Desc, Version, Revision, entries.
if (fileName.length() > 4) {
if(*(u32*)(fileName.c_str() + fileName.length() - 4) == (1886349435 & ~(1 << 3))) return Temp;
@@ -147,23 +147,25 @@ UniStoreInfo GetInfo(const std::string &file, const std::string &fileName) {
}
/*
Return UniStore info vector.
Return Store info vector.
const std::string &path: Const Reference to the path, where to check.
*/
std::vector<UniStoreInfo> GetUniStoreInfo(const std::string &path) {
std::vector<UniStoreInfo> info;
std::vector<StoreInfo> GetStoreInfo(const std::string &path) {
std::vector<StoreInfo> info;
std::vector<DirEntry> dirContents;
if (access(path.c_str(), F_OK) != 0) return {}; // Folder does not exist.
chdir(path.c_str());
getDirectoryContents(dirContents, { "unistore" });
getDirectoryContents(dirContents, { "store", "unistore" });
for(uint i = 0; i < dirContents.size(); i++) {
/* Make sure to ONLY push .unistores, and no folders. Avoids crashes in that case too. */
/* Make sure to ONLY push .store & .unistore, and no folders. Avoids crashes in that case too. */
if ((path + dirContents[i].name).find(".unistore") != std::string::npos) {
info.push_back( GetInfo(path + dirContents[i].name, dirContents[i].name) );
} else if ((path + dirContents[i].name).find(".store") != std::string::npos) {
info.push_back( GetInfo(path + dirContents[i].name, dirContents[i].name) );
}
}
+2 -2
View File
@@ -376,8 +376,8 @@ void QueueSystem::QueueHandle() {
if (queueEntries[0]->status == QueueStatus::Done) { // ONLY update, if successful.
if (StoreUtils::meta) {
StoreUtils::meta->SetUpdated(queueEntries[0]->unistoreName, queueEntries[0]->entryName, queueEntries[0]->lastUpdated);
StoreUtils::meta->SetInstalled(queueEntries[0]->unistoreName, queueEntries[0]->entryName, queueEntries[0]->name);
StoreUtils::meta->SetUpdated(queueEntries[0]->storeName, queueEntries[0]->entryName, queueEntries[0]->lastUpdated);
StoreUtils::meta->SetInstalled(queueEntries[0]->storeName, queueEntries[0]->entryName, queueEntries[0]->name);
StoreUtils::RefreshUpdateAVL();
}
}