Woops, fixes and defines. :P
This commit is contained in:
parent
ee2769b294
commit
0dc8369bff
6 changed files with 32 additions and 12 deletions
|
|
@ -38,6 +38,7 @@ inline std::unique_ptr<Config> config;
|
|||
|
||||
#define _STORE_PATH "sdmc:/3ds/Universal-Updater/stores/"
|
||||
#define _META_PATH "sdmc:/3ds/Universal-Updater/MetaData.json"
|
||||
#define _UNISTORE_VERSION 3
|
||||
inline uint32_t hRepeat, hDown, hHeld;
|
||||
inline touchPosition touch;
|
||||
|
||||
|
|
|
|||
|
|
@ -77,6 +77,20 @@ MainScreen::MainScreen() {
|
|||
} else {
|
||||
notConnectedMsg();
|
||||
}
|
||||
|
||||
} else {
|
||||
const UniStoreInfo info = GetInfo("sdmc:/3ds/Universal-Updater/stores/universal-db.unistore", "universal-db.unistore");
|
||||
|
||||
if (info.Version != _UNISTORE_VERSION) {
|
||||
if (checkWifiStatus()) {
|
||||
std::string tmp = ""; // Just a temp.
|
||||
DownloadUniStore("https://db.universal-team.net/unistore/universal-db.unistore", -1, tmp, true, true);
|
||||
DownloadSpriteSheet("https://db.universal-team.net/unistore/universal-db.t3x", "universal-db.t3x");
|
||||
|
||||
} else {
|
||||
notConnectedMsg();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -103,11 +103,13 @@ void StoreUtils::GridLogic(std::unique_ptr<Store> &store, std::vector<std::uniqu
|
|||
if (store) { // Ensure, store is not a nullptr.
|
||||
if (hRepeat & KEY_DOWN) {
|
||||
if (store->GetBox() > 9) {
|
||||
if (store->GetEntry() + 5 < (int)entries.size()) {
|
||||
if (store->GetEntry() + 5 < (int)entries.size() - 1) {
|
||||
store->SetEntry(store->GetEntry() + 5);
|
||||
|
||||
if (store->GetScreenIndx() < (((int)entries.size() / 5) - 2)) {
|
||||
store->SetScreenIndx(store->GetScreenIndx() + 1);
|
||||
if (entries.size() > 15) {
|
||||
if (store->GetScreenIndx() < (((int)entries.size() / 5) - 2)) {
|
||||
store->SetScreenIndx(store->GetScreenIndx() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
@ -115,8 +117,10 @@ void StoreUtils::GridLogic(std::unique_ptr<Store> &store, std::vector<std::uniqu
|
|||
store->SetEntry(entries.size() - 1);
|
||||
store->SetBox(10 + (store->GetEntry() % 5));
|
||||
|
||||
if (store->GetScreenIndx() < (((int)entries.size() / 5) - 2)) {
|
||||
store->SetScreenIndx(store->GetScreenIndx() + 1);
|
||||
if (entries.size() > 15) {
|
||||
if (store->GetScreenIndx() < (((int)entries.size() / 5) - 2)) {
|
||||
store->SetScreenIndx(store->GetScreenIndx() + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ void StoreUtils::ListLogic(std::unique_ptr<Store> &store, std::vector<std::uniqu
|
|||
|
||||
if (hRepeat & KEY_LEFT) {
|
||||
if (store->GetEntry() - 2 > 0) store->SetEntry(store->GetEntry() - 3);
|
||||
else store->SetEntry(0);
|
||||
}
|
||||
|
||||
if (hRepeat & KEY_UP) {
|
||||
|
|
|
|||
|
|
@ -219,9 +219,9 @@ 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"] > 3) Msg::waitMsg(Lang::get("UNISTORE_TOO_NEW"));
|
||||
this->valid = this->storeJson["storeInfo"]["version"] == 3;
|
||||
if (this->storeJson["storeInfo"]["version"] < _UNISTORE_VERSION) Msg::waitMsg(Lang::get("UNISTORE_TOO_OLD"));
|
||||
else if (this->storeJson["storeInfo"]["version"] > _UNISTORE_VERSION) Msg::waitMsg(Lang::get("UNISTORE_TOO_NEW"));
|
||||
this->valid = this->storeJson["storeInfo"]["version"] == _UNISTORE_VERSION;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -582,9 +582,9 @@ 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 == 3. */
|
||||
/* Ensure, version == _UNISTORE_VERSION. */
|
||||
if (parsedAPI["storeInfo"].contains("version") && parsedAPI["storeInfo"]["version"].is_number()) {
|
||||
if (parsedAPI["storeInfo"]["version"] == 3) {
|
||||
if (parsedAPI["storeInfo"]["version"] == _UNISTORE_VERSION) {
|
||||
if (currentRev > -1) {
|
||||
|
||||
if (parsedAPI["storeInfo"].contains("revision") && parsedAPI["storeInfo"]["revision"].is_number()) {
|
||||
|
|
@ -644,10 +644,10 @@ bool DownloadUniStore(const std::string &URL, int currentRev, std::string &fl, b
|
|||
}
|
||||
}
|
||||
|
||||
} else if (parsedAPI["storeInfo"]["version"] < 3) {
|
||||
} else if (parsedAPI["storeInfo"]["version"] < _UNISTORE_VERSION) {
|
||||
Msg::waitMsg(Lang::get("UNISTORE_TOO_OLD"));
|
||||
|
||||
} else if (parsedAPI["storeInfo"]["version"] > 3) {
|
||||
} else if (parsedAPI["storeInfo"]["version"] > _UNISTORE_VERSION) {
|
||||
Msg::waitMsg(Lang::get("UNISTORE_TOO_NEW"));
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue