Some more ~~insect~~ bug fixes.

This commit is contained in:
StackZ
2020-11-07 10:03:03 +01:00
parent ddbea3ab36
commit ee2769b294
6 changed files with 33 additions and 7 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ namespace StoreUtils {
/* Side Menu. */
void DrawSideMenu(int currentMenu);
void SideMenuHandle(int &currentMenu, bool &fetch);
void SideMenuHandle(int &currentMenu, bool &fetch, int &lastMenu);
/* Download Entries. */
void DrawDownList(const std::unique_ptr<Store> &store, const std::vector<std::string> &entries, bool fetch);
+2 -1
View File
@@ -105,13 +105,14 @@ void Msg::waitMsg(const std::string &msg) {
Gui::clearTextBufs();
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(Top, TRANSPARENT);
C2D_TargetClear(Bottom, TRANSPARENT);
GFX::DrawTop();
Gui::DrawStringCentered(0, (240 - Gui::GetStringHeight(0.6f, msg)) / 2, 0.6f, TEXT_COLOR, msg, 395);
Gui::Draw_Rect(0, 215, 400, 25, BAR_COLOR);
Gui::Draw_Rect(0, 214, 400, 1, BAR_OUTL_COLOR);
Gui::DrawStringCentered(0, 218, 0.6f, TEXT_COLOR, Lang::get("KEY_CONTINUE"), 390);
GFX::DrawBottom();
C3D_FrameEnd(0);
for (int i = 0; i < 3; i++) gspWaitForVBlank();
+10
View File
@@ -35,6 +35,7 @@
#include <unistd.h>
extern bool checkWifiStatus();
extern void notConnectedMsg();
extern bool touching(touchPosition touch, Structs::ButtonPos button);
static const std::vector<Structs::ButtonPos> mainButtons = {
{ 10, 34, 300, 22 },
@@ -371,6 +372,9 @@ void Overlays::SelectStore(std::unique_ptr<Store> &store, std::vector<std::uniqu
info = GetUniStoreInfo(_STORE_PATH);
}
}
} else {
notConnectedMsg();
}
}
@@ -385,6 +389,9 @@ void Overlays::SelectStore(std::unique_ptr<Store> &store, std::vector<std::uniqu
selection = 0;
info = GetUniStoreInfo(_STORE_PATH);
}
} else {
notConnectedMsg();
}
}
@@ -395,6 +402,9 @@ void Overlays::SelectStore(std::unique_ptr<Store> &store, std::vector<std::uniqu
selection = 0;
info = GetUniStoreInfo(_STORE_PATH);
}
} else {
notConnectedMsg();
}
}
+10 -4
View File
@@ -33,6 +33,7 @@
extern int fadeAlpha;
extern UniStoreInfo GetInfo(const std::string &file, const std::string &fileName);
extern void notConnectedMsg();
/*
MainScreen Constructor.
@@ -68,9 +69,14 @@ MainScreen::MainScreen() {
/* If Universal DB --> Get! */
if (config->lastStore() == "universal-db.unistore" || config->lastStore() == "") {
if (access("sdmc:/3ds/Universal-Updater/stores/universal-db.unistore", F_OK) != 0) {
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");
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();
}
}
}
@@ -137,7 +143,7 @@ void MainScreen::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
config->list() ? StoreUtils::ListLogic(this->store, this->entries, this->storeMode, this->lastMode, this->fetchDown, this->smallDelay) : StoreUtils::GridLogic(this->store, this->entries, this->storeMode, this->lastMode, this->fetchDown, this->smallDelay);
}
StoreUtils::SideMenuHandle(this->storeMode, this->fetchDown);
StoreUtils::SideMenuHandle(this->storeMode, this->fetchDown, this->lastMode);
/* Fetch Download list. */
if (this->fetchDown) {
+5 -1
View File
@@ -68,11 +68,13 @@ void StoreUtils::DrawSideMenu(int currentMenu) {
int &currentMenu: Reference to the Store Mode / Menu.
bool &fetch: Reference of the download fetch variable.. so we know, if we need to fetch the download entries.
int &lastMenu: Reference to the last menu.
*/
void StoreUtils::SideMenuHandle(int &currentMenu, bool &fetch) {
void StoreUtils::SideMenuHandle(int &currentMenu, bool &fetch, int &lastMenu) {
if (hDown & KEY_TOUCH) {
for (int i = 0; i < 5; i++) {
if (touching(touch, sidePos[i])) {
lastMenu = currentMenu;
if (i == 1) fetch = true; // Fetch download list, if 1.
currentMenu = i;
break;
@@ -82,6 +84,7 @@ void StoreUtils::SideMenuHandle(int &currentMenu, bool &fetch) {
if (hRepeat & KEY_R) {
if (currentMenu < 4) {
lastMenu = currentMenu;
if (currentMenu + 1 == 1) fetch = true; // Fetch download list, if 1.
currentMenu++;
}
@@ -89,6 +92,7 @@ void StoreUtils::SideMenuHandle(int &currentMenu, bool &fetch) {
if (hRepeat & KEY_L) {
if (currentMenu > 0) {
lastMenu = currentMenu;
if (currentMenu - 1 == 1) fetch = true; // Fetch download list, if 1.
currentMenu--;
}
+5
View File
@@ -208,6 +208,11 @@ void Store::loadSheets() {
*/
void Store::LoadFromFile(const std::string &file) {
FILE *in = fopen(file.c_str(), "rt");
if (!in) {
this->valid = false;
return;
}
this->storeJson = nlohmann::json::parse(in, nullptr, false);
fclose(in);