mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-06 08:39:07 +00:00
~~Cleanup~~ Changes. (#14)
* No builds allowed here as always on other branches, lmao. * Changes. ;)
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
trigger:
|
trigger:
|
||||||
branches:
|
branches:
|
||||||
include: ['*']
|
include: ['*']
|
||||||
exclude: [translation, App-Store, Camera]
|
exclude: [translation, cleanup]
|
||||||
tags:
|
tags:
|
||||||
include: ['*']
|
include: ['*']
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
#include "utils/structs.hpp"
|
#include "utils/structs.hpp"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
class FTPScreen : public screen
|
class FTPScreen : public screen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -29,7 +29,6 @@
|
|||||||
|
|
||||||
#include "screens/screen.hpp"
|
#include "screens/screen.hpp"
|
||||||
|
|
||||||
#include "utils/fileBrowse.h"
|
|
||||||
#include "utils/structs.hpp"
|
#include "utils/structs.hpp"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -40,17 +39,13 @@ public:
|
|||||||
void Draw(void) const override;
|
void Draw(void) const override;
|
||||||
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
|
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
|
||||||
private:
|
private:
|
||||||
bool returnScriptState();
|
|
||||||
bool returnStoreState();
|
|
||||||
int Selection = 0;
|
int Selection = 0;
|
||||||
std::vector<DirEntry> dirContents; // To return Script/Store state.
|
|
||||||
std::vector<Structs::ButtonPos> mainButtons = {
|
std::vector<Structs::ButtonPos> mainButtons = {
|
||||||
{10, 40, 140, 35, -1}, // Scriptlist.
|
{10, 70, 140, 40, -1}, // Scripts.
|
||||||
{170, 40, 140, 35, -1}, // ScriptBrowse.
|
{170, 70, 140, 40, -1}, // UniStore.
|
||||||
{10, 100, 140, 35, -1}, // TinyDB.
|
{10, 145, 140, 40, -1}, // Settings.
|
||||||
{170, 100, 140, 35, -1}, // ScriptCreator.
|
{170, 145, 140, 40, -1}, // FTP.
|
||||||
{10, 160, 140, 35, -1}, // Language.
|
|
||||||
{170, 160, 140, 35, -1}, // Colors.
|
|
||||||
{0, 215, 25, 25, -1}, // Back Arrow.
|
{0, 215, 25, 25, -1}, // Back Arrow.
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -38,16 +38,17 @@ class ScriptList : public screen
|
|||||||
public:
|
public:
|
||||||
void Draw(void) const override;
|
void Draw(void) const override;
|
||||||
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
|
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
|
||||||
ScriptList();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void DrawSubMenu(void) const;
|
||||||
void DrawList(void) const;
|
void DrawList(void) const;
|
||||||
void DrawSingleObject(void) const;
|
void DrawSingleObject(void) const;
|
||||||
|
|
||||||
|
void SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch);
|
||||||
void ListSelection(u32 hDown, u32 hHeld, touchPosition touch);
|
void ListSelection(u32 hDown, u32 hHeld, touchPosition touch);
|
||||||
void SelectFunction(u32 hDown, u32 hHeld, touchPosition touch);
|
void SelectFunction(u32 hDown, u32 hHeld, touchPosition touch);
|
||||||
|
|
||||||
int mode = 0;
|
int mode = 0;
|
||||||
|
int SubSelection = 0;
|
||||||
std::vector<DirEntry> dirContents;
|
std::vector<DirEntry> dirContents;
|
||||||
mutable int screenPos = 0;
|
mutable int screenPos = 0;
|
||||||
mutable int screenPosList = 0;
|
mutable int screenPosList = 0;
|
||||||
@@ -64,6 +65,14 @@ private:
|
|||||||
{295, 215, 25, 25, -1}, // Arrow Down.
|
{295, 215, 25, 25, -1}, // Arrow Down.
|
||||||
{0, 215, 25, 25, -1}, // Back Arrow.
|
{0, 215, 25, 25, -1}, // Back Arrow.
|
||||||
{5, 0, 25, 25, -1}, // viewMode Change
|
{5, 0, 25, 25, -1}, // viewMode Change
|
||||||
|
{45, 0, 25, 25, -1}, // Search.
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<Structs::ButtonPos> subPos = {
|
||||||
|
{10, 70, 140, 40, -1}, // Script list.
|
||||||
|
{170, 70, 140, 40, -1}, // Get Scripts.
|
||||||
|
{10, 145, 140, 40, -1}, // Script Creator.
|
||||||
|
{170, 145, 140, 40, -1}, // Script path change.
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -38,13 +38,13 @@ class UniStore : public screen
|
|||||||
public:
|
public:
|
||||||
void Draw(void) const override;
|
void Draw(void) const override;
|
||||||
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
|
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
|
||||||
UniStore();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void DrawSubMenu(void) const;
|
||||||
void DrawStoreList(void) const;
|
void DrawStoreList(void) const;
|
||||||
void DrawStore(void) const;
|
void DrawStore(void) const;
|
||||||
void DrawSearch(void) const;
|
void DrawSearch(void) const;
|
||||||
|
|
||||||
|
void SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch);
|
||||||
void StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch);
|
void StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch);
|
||||||
void StoreLogic(u32 hDown, u32 hHeld, touchPosition touch);
|
void StoreLogic(u32 hDown, u32 hHeld, touchPosition touch);
|
||||||
void SearchLogic(u32 hDown, u32 hHeld, touchPosition touch);
|
void SearchLogic(u32 hDown, u32 hHeld, touchPosition touch);
|
||||||
@@ -61,6 +61,7 @@ private:
|
|||||||
mutable int screenPosList2 = 0;
|
mutable int screenPosList2 = 0;
|
||||||
|
|
||||||
int searchSelection = 0;
|
int searchSelection = 0;
|
||||||
|
int subSelection = 0;
|
||||||
|
|
||||||
int keyRepeatDelay = 0;
|
int keyRepeatDelay = 0;
|
||||||
int fastMode = false;
|
int fastMode = false;
|
||||||
@@ -79,6 +80,12 @@ private:
|
|||||||
{10, 100, 140, 35, -1}, // FULL URL.
|
{10, 100, 140, 35, -1}, // FULL URL.
|
||||||
{170, 100, 140, 35, -1}, // Github.
|
{170, 100, 140, 35, -1}, // Github.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::vector<Structs::ButtonPos> subPos = {
|
||||||
|
{90, 40, 140, 35, -1}, // StoreList.
|
||||||
|
{90, 100, 140, 35, -1}, // storeSearch.
|
||||||
|
{90, 160, 140, 35, -1}, // storePathChange.
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -28,6 +28,8 @@ void getDirectoryContents(std::vector<DirEntry>& dirContents, const std::vector<
|
|||||||
void getDirectoryContents(std::vector<DirEntry>& dirContents);
|
void getDirectoryContents(std::vector<DirEntry>& dirContents);
|
||||||
std::vector<std::string> getContents(const std::string &name, const std::vector<std::string> &extensionList);
|
std::vector<std::string> getContents(const std::string &name, const std::vector<std::string> &extensionList);
|
||||||
|
|
||||||
|
bool returnIfExist(const std::string &path, const std::vector<std::string> &extensionList);
|
||||||
|
|
||||||
std::string selectFilePath(std::string selectText, const std::vector<std::string> &extensionList, int selectionMode = 1);
|
std::string selectFilePath(std::string selectText, const std::vector<std::string> &extensionList, int selectionMode = 1);
|
||||||
|
|
||||||
#endif //FILE_BROWSE_H
|
#endif //FILE_BROWSE_H
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
"FILES_EXTRACTED": "files extracted.",
|
"FILES_EXTRACTED": "files extracted.",
|
||||||
|
|
||||||
"SCRIPTLIST": "Script list",
|
"SCRIPTLIST": "Script list",
|
||||||
|
"SCRIPTS": "Scripts",
|
||||||
"SETTINGS": "Settings",
|
"SETTINGS": "Settings",
|
||||||
"LANGUAGE": "Language",
|
"LANGUAGE": "Language",
|
||||||
"COLORS": "Colors",
|
"COLORS": "Colors",
|
||||||
@@ -81,7 +82,7 @@
|
|||||||
"FILEBROWSE_MSG": "Press X to select, Select to refresh.",
|
"FILEBROWSE_MSG": "Press X to select, Select to refresh.",
|
||||||
"SELECT_SCRIPT_PATH": "Select the Script Path.",
|
"SELECT_SCRIPT_PATH": "Select the Script Path.",
|
||||||
|
|
||||||
"USE_BARS": "Use bar images:",
|
"CHANGE_BAR_STYLE": "Change bar style",
|
||||||
"CHANGE_SCRIPTPATH": "Change Script path",
|
"CHANGE_SCRIPTPATH": "Change Script path",
|
||||||
"CHANGE_MUSICFILE": "Change Music file",
|
"CHANGE_MUSICFILE": "Change Music file",
|
||||||
"SELECT_MUSIC_FILE": "Select the Music file.",
|
"SELECT_MUSIC_FILE": "Select the Music file.",
|
||||||
@@ -101,5 +102,9 @@
|
|||||||
"UNISTORE_SEARCH": "UniStore search",
|
"UNISTORE_SEARCH": "UniStore search",
|
||||||
"FULL_URL": "Full URL",
|
"FULL_URL": "Full URL",
|
||||||
"GITHUB": "GitHub",
|
"GITHUB": "GitHub",
|
||||||
"ENTER_FULL_URL": "Enter the full URL."
|
"ENTER_FULL_URL": "Enter the full URL.",
|
||||||
|
"SCRIPTS_SUBMENU": "Scripts Submenu",
|
||||||
|
"STORE_LIST": "Store list",
|
||||||
|
"STORE_SEARCH": "Store search",
|
||||||
|
"UNISTORE_SUBMENU": "UniStore SubMenu"
|
||||||
}
|
}
|
||||||
|
|||||||
+23
-125
@@ -24,29 +24,18 @@
|
|||||||
* reasonable ways as different from the original version.
|
* reasonable ways as different from the original version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "download/download.hpp"
|
|
||||||
|
|
||||||
#include "screens/ftpScreen.hpp"
|
#include "screens/ftpScreen.hpp"
|
||||||
#include "screens/mainMenu.hpp"
|
#include "screens/mainMenu.hpp"
|
||||||
#include "screens/scriptBrowse.hpp"
|
|
||||||
#include "screens/scriptCreator.hpp"
|
|
||||||
#include "screens/scriptlist.hpp"
|
#include "screens/scriptlist.hpp"
|
||||||
#include "screens/settings.hpp"
|
#include "screens/settings.hpp"
|
||||||
#include "screens/unistore.hpp"
|
#include "screens/unistore.hpp"
|
||||||
|
|
||||||
#include "utils/config.hpp"
|
#include "utils/config.hpp"
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
extern bool exiting;
|
extern bool exiting;
|
||||||
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
||||||
extern bool checkWifiStatus(void);
|
|
||||||
extern int fadealpha;
|
extern int fadealpha;
|
||||||
extern bool fadein;
|
extern bool fadein;
|
||||||
extern void notImplemented(void);
|
|
||||||
|
|
||||||
// This is for the Script Creator, so no one can access it for now, until it is stable or so.
|
|
||||||
bool isTesting = false;
|
|
||||||
|
|
||||||
void MainMenu::Draw(void) const {
|
void MainMenu::Draw(void) const {
|
||||||
Gui::DrawTop();
|
Gui::DrawTop();
|
||||||
@@ -63,7 +52,7 @@ void MainMenu::Draw(void) const {
|
|||||||
Gui::DrawBottom();
|
Gui::DrawBottom();
|
||||||
Gui::DrawArrow(0, 218, 0, 1);
|
Gui::DrawArrow(0, 218, 0, 1);
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
if (Selection == i) {
|
if (Selection == i) {
|
||||||
Gui::Draw_Rect(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, Config::SelectedColor);
|
Gui::Draw_Rect(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, Config::SelectedColor);
|
||||||
} else {
|
} else {
|
||||||
@@ -71,149 +60,58 @@ void MainMenu::Draw(void) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "UniStore"))/2-150+70+10, mainButtons[0].y+12, 0.6f, Config::TxtColor, "UniStore", 140);
|
||||||
|
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("SCRIPTS")))/2+150-70, mainButtons[1].y+12, 0.6f, Config::TxtColor, Lang::get("SCRIPTS"), 140);
|
||||||
|
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("SETTINGS")))/2-150+70, mainButtons[2].y+12, 0.6f, Config::TxtColor, Lang::get("SETTINGS"), 140);
|
||||||
|
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "FTP"))/2+150-70, mainButtons[3].y+12, 0.6f, Config::TxtColor, "FTP", 140);
|
||||||
|
|
||||||
// Draw UniStore Icon. ;P
|
// Draw UniStore Icon. ;P
|
||||||
Gui::sprite(sprites_uniStore_idx, 15, 95);
|
Gui::sprite(sprites_uniStore_idx, 10, 65);
|
||||||
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("SCRIPTLIST")))/2-150+70, mainButtons[0].y+10, 0.6f, Config::TxtColor, Lang::get("SCRIPTLIST"), 140);
|
|
||||||
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("GET_SCRIPTS")))/2+150-70, mainButtons[1].y+10, 0.6f, Config::TxtColor, Lang::get("GET_SCRIPTS"), 140);
|
|
||||||
Gui::DrawString(80, mainButtons[2].y+10, 0.6f, Config::TxtColor, "UniStore", 140);
|
|
||||||
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("SCRIPTCREATOR")))/2+150-70, mainButtons[3].y+10, 0.6f, Config::TxtColor, Lang::get("SCRIPTCREATOR"), 140);
|
|
||||||
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("SETTINGS")))/2-150+70, mainButtons[4].y+10, 0.6f, Config::TxtColor, Lang::get("SETTINGS"), 140);
|
|
||||||
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "FTP"))/2+150-70, mainButtons[5].y+10, 0.6f, Config::TxtColor, "FTP", 140);
|
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(0, 0, 0, fadealpha)); // Fade in out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(0, 0, 0, fadealpha)); // Fade in out effect
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainMenu::returnScriptState() {
|
|
||||||
dirContents.clear();
|
|
||||||
chdir(Config::ScriptPath.c_str());
|
|
||||||
std::vector<DirEntry> dirContentsTemp;
|
|
||||||
getDirectoryContents(dirContentsTemp, {"json"});
|
|
||||||
for(uint i=0;i<dirContentsTemp.size();i++) {
|
|
||||||
dirContents.push_back(dirContentsTemp[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dirContents.size() == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MainMenu::returnStoreState() {
|
|
||||||
dirContents.clear();
|
|
||||||
chdir(Config::StorePath.c_str());
|
|
||||||
std::vector<DirEntry> dirContentsTemp;
|
|
||||||
getDirectoryContents(dirContentsTemp, {"unistore"});
|
|
||||||
for(uint i=0;i<dirContentsTemp.size();i++) {
|
|
||||||
dirContents.push_back(dirContentsTemp[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dirContents.size() == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainMenu::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
void MainMenu::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
if (hDown & KEY_START) {
|
if ((hDown & KEY_START) || (hDown & KEY_TOUCH && touching(touch, mainButtons[4]))) {
|
||||||
exiting = true;
|
exiting = true;
|
||||||
}
|
}
|
||||||
if (hDown & KEY_UP) {
|
|
||||||
|
// Navigation.
|
||||||
|
if(hDown & KEY_UP) {
|
||||||
if(Selection > 1) Selection -= 2;
|
if(Selection > 1) Selection -= 2;
|
||||||
}
|
} else if(hDown & KEY_DOWN) {
|
||||||
if (hDown & KEY_DOWN) {
|
if(Selection < 3 && Selection != 2 && Selection != 3) Selection += 2;
|
||||||
if(Selection < 4) Selection += 2;
|
} else if (hDown & KEY_LEFT) {
|
||||||
}
|
|
||||||
if (hDown & KEY_LEFT) {
|
|
||||||
if (Selection%2) Selection--;
|
if (Selection%2) Selection--;
|
||||||
}
|
} else if (hDown & KEY_RIGHT) {
|
||||||
if (hDown & KEY_RIGHT) {
|
|
||||||
if (!(Selection%2)) Selection++;
|
if (!(Selection%2)) Selection++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_A) {
|
if (hDown & KEY_A) {
|
||||||
switch(Selection) {
|
switch(Selection) {
|
||||||
case 0:
|
case 0:
|
||||||
if (returnScriptState() == true) {
|
Screen::set(std::make_unique<UniStore>());
|
||||||
Screen::set(std::make_unique<ScriptList>());
|
|
||||||
} else {
|
|
||||||
Gui::DisplayWarnMsg(Lang::get("GET_SCRIPTS_FIRST"));
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (checkWifiStatus() == true) {
|
Screen::set(std::make_unique<ScriptList>());
|
||||||
Screen::set(std::make_unique<ScriptBrowse>());
|
|
||||||
} else {
|
|
||||||
notConnectedMsg();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (returnStoreState() == true) {
|
|
||||||
Screen::set(std::make_unique<UniStore>());
|
|
||||||
} else {
|
|
||||||
Gui::DisplayWarnMsg(Lang::get("GET_STORES_FIRST"));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
if (isTesting == true) {
|
|
||||||
Screen::set(std::make_unique<ScriptCreator>());
|
|
||||||
} else {
|
|
||||||
notImplemented();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
Screen::set(std::make_unique<Settings>());
|
Screen::set(std::make_unique<Settings>());
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 3:
|
||||||
if (checkWifiStatus() == true) {
|
Screen::set(std::make_unique<FTPScreen>());
|
||||||
Screen::set(std::make_unique<FTPScreen>());
|
|
||||||
} else {
|
|
||||||
notConnectedMsg();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_X) {
|
|
||||||
if (checkWifiStatus() == true) {
|
|
||||||
Screen::set(std::make_unique<FTPScreen>());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (hDown & KEY_TOUCH) {
|
if (hDown & KEY_TOUCH) {
|
||||||
if (touching(touch, mainButtons[0])) {
|
if (touching(touch, mainButtons[0])) {
|
||||||
if (returnScriptState() == true) {
|
Screen::set(std::make_unique<UniStore>());
|
||||||
Screen::set(std::make_unique<ScriptList>());
|
|
||||||
} else {
|
|
||||||
Gui::DisplayWarnMsg(Lang::get("GET_SCRIPTS_FIRST"));
|
|
||||||
}
|
|
||||||
} else if (touching(touch, mainButtons[1])) {
|
} else if (touching(touch, mainButtons[1])) {
|
||||||
if (checkWifiStatus() == true) {
|
Screen::set(std::make_unique<ScriptList>());
|
||||||
Screen::set(std::make_unique<ScriptBrowse>());
|
|
||||||
} else {
|
|
||||||
notConnectedMsg();
|
|
||||||
}
|
|
||||||
} else if (touching(touch, mainButtons[2])) {
|
} else if (touching(touch, mainButtons[2])) {
|
||||||
if (returnStoreState() == true) {
|
|
||||||
Screen::set(std::make_unique<UniStore>());
|
|
||||||
} else {
|
|
||||||
Gui::DisplayWarnMsg(Lang::get("GET_STORES_FIRST"));
|
|
||||||
}
|
|
||||||
} else if (touching(touch, mainButtons[3])) {
|
|
||||||
if (isTesting == true) {
|
|
||||||
Screen::set(std::make_unique<ScriptCreator>());
|
|
||||||
} else {
|
|
||||||
notImplemented();
|
|
||||||
}
|
|
||||||
} else if (touching(touch, mainButtons[4])) {
|
|
||||||
Screen::set(std::make_unique<Settings>());
|
Screen::set(std::make_unique<Settings>());
|
||||||
} else if (touching(touch, mainButtons[5])) {
|
} else if (touching(touch, mainButtons[3])) {
|
||||||
if (checkWifiStatus() == true) {
|
Screen::set(std::make_unique<FTPScreen>());
|
||||||
Screen::set(std::make_unique<FTPScreen>());
|
|
||||||
} else {
|
|
||||||
notConnectedMsg();
|
|
||||||
}
|
|
||||||
} else if (touching(touch, mainButtons[6])) {
|
|
||||||
exiting = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+132
-15
@@ -26,6 +26,8 @@
|
|||||||
|
|
||||||
#include "download/download.hpp"
|
#include "download/download.hpp"
|
||||||
|
|
||||||
|
#include "screens/scriptBrowse.hpp"
|
||||||
|
#include "screens/scriptCreator.hpp"
|
||||||
#include "screens/scriptlist.hpp"
|
#include "screens/scriptlist.hpp"
|
||||||
|
|
||||||
#include "utils/config.hpp"
|
#include "utils/config.hpp"
|
||||||
@@ -37,6 +39,11 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
||||||
|
extern bool checkWifiStatus(void);
|
||||||
|
extern void notImplemented(void);
|
||||||
|
|
||||||
|
// This is for the Script Creator, so no one can access it for now, until it is stable or so.
|
||||||
|
bool isTesting = false;
|
||||||
|
|
||||||
bool isScriptSelected = false;
|
bool isScriptSelected = false;
|
||||||
|
|
||||||
@@ -262,15 +269,32 @@ void loadColors(nlohmann::json &json) {
|
|||||||
progressBar = colorTemp == 0 ? Config::progressbarColor : colorTemp;
|
progressBar = colorTemp == 0 ? Config::progressbarColor : colorTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptList::ScriptList() {
|
void ScriptList::DrawSubMenu(void) const {
|
||||||
dirContents.clear();
|
Gui::DrawTop();
|
||||||
chdir(Config::ScriptPath.c_str());
|
if (Config::UseBars == true) {
|
||||||
getDirectoryContents(dirContents, {"json"});
|
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("SCRIPTS_SUBMENU"), 400);
|
||||||
for(uint i=0;i<dirContents.size();i++) {
|
} else {
|
||||||
fileInfo.push_back(parseInfo(dirContents[i].name));
|
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("SCRIPTS_SUBMENU"), 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Gui::DrawBottom();
|
||||||
|
Gui::DrawArrow(0, 218, 0, 1);
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
if (SubSelection == i) {
|
||||||
|
Gui::Draw_Rect(subPos[i].x, subPos[i].y, subPos[i].w, subPos[i].h, Config::SelectedColor);
|
||||||
|
} else {
|
||||||
|
Gui::Draw_Rect(subPos[i].x, subPos[i].y, subPos[i].w, subPos[i].h, Config::UnselectedColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("SCRIPTLIST")))/2-150+70, subPos[0].y+12, 0.6f, Config::TxtColor, Lang::get("SCRIPTLIST"), 140);
|
||||||
|
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("GET_SCRIPTS")))/2+150-70, subPos[1].y+12, 0.6f, Config::TxtColor, Lang::get("GET_SCRIPTS"), 140);
|
||||||
|
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("SCRIPTCREATOR")))/2-150+70, subPos[2].y+12, 0.6f, Config::TxtColor, Lang::get("SCRIPTCREATOR"), 140);
|
||||||
|
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("CHANGE_SCRIPTPATH")))/2+150-70, subPos[3].y+12, 0.6f, Config::TxtColor, Lang::get("CHANGE_SCRIPTPATH"), 140);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ScriptList::DrawList(void) const {
|
void ScriptList::DrawList(void) const {
|
||||||
std::string line1;
|
std::string line1;
|
||||||
std::string line2;
|
std::string line2;
|
||||||
@@ -319,9 +343,11 @@ void ScriptList::DrawList(void) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ScriptList::Draw(void) const {
|
void ScriptList::Draw(void) const {
|
||||||
if (mode == 0){
|
if (mode == 0) {
|
||||||
DrawList();
|
DrawSubMenu();
|
||||||
} else if (mode == 1) {
|
} else if (mode == 1) {
|
||||||
|
DrawList();
|
||||||
|
} else if (mode == 2) {
|
||||||
DrawSingleObject();
|
DrawSingleObject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -379,13 +405,102 @@ void ScriptList::DrawSingleObject(void) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ScriptList::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
|
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
||||||
|
Screen::back();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Navigation.
|
||||||
|
if(hDown & KEY_UP) {
|
||||||
|
if(SubSelection > 1) SubSelection -= 2;
|
||||||
|
} else if(hDown & KEY_DOWN) {
|
||||||
|
if(SubSelection < 3 && SubSelection != 2 && SubSelection != 3) SubSelection += 2;
|
||||||
|
} else if (hDown & KEY_LEFT) {
|
||||||
|
if (SubSelection%2) SubSelection--;
|
||||||
|
} else if (hDown & KEY_RIGHT) {
|
||||||
|
if (!(SubSelection%2)) SubSelection++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_A) {
|
||||||
|
switch(SubSelection) {
|
||||||
|
case 0:
|
||||||
|
if (returnIfExist(Config::ScriptPath, {"json"}) == true) {
|
||||||
|
dirContents.clear();
|
||||||
|
chdir(Config::ScriptPath.c_str());
|
||||||
|
getDirectoryContents(dirContents, {"json"});
|
||||||
|
for(uint i=0;i<dirContents.size();i++) {
|
||||||
|
fileInfo.push_back(parseInfo(dirContents[i].name));
|
||||||
|
}
|
||||||
|
mode = 1;
|
||||||
|
} else {
|
||||||
|
Gui::DisplayWarnMsg(Lang::get("GET_SCRIPTS_FIRST"));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (checkWifiStatus() == true) {
|
||||||
|
Screen::set(std::make_unique<ScriptBrowse>());
|
||||||
|
} else {
|
||||||
|
notConnectedMsg();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (isTesting == true) {
|
||||||
|
Screen::set(std::make_unique<ScriptCreator>());
|
||||||
|
} else {
|
||||||
|
notImplemented();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
std::string tempScript = selectFilePath(Lang::get("SELECT_SCRIPT_PATH"), {});
|
||||||
|
if (tempScript != "") {
|
||||||
|
Config::ScriptPath = tempScript;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_TOUCH) {
|
||||||
|
if (touching(touch, subPos[0])) {
|
||||||
|
if (returnIfExist(Config::ScriptPath, {"json"}) == true) {
|
||||||
|
dirContents.clear();
|
||||||
|
chdir(Config::ScriptPath.c_str());
|
||||||
|
getDirectoryContents(dirContents, {"json"});
|
||||||
|
for(uint i=0;i<dirContents.size();i++) {
|
||||||
|
fileInfo.push_back(parseInfo(dirContents[i].name));
|
||||||
|
}
|
||||||
|
mode = 1;
|
||||||
|
} else {
|
||||||
|
Gui::DisplayWarnMsg(Lang::get("GET_SCRIPTS_FIRST"));
|
||||||
|
}
|
||||||
|
} else if (touching(touch, subPos[1])) {
|
||||||
|
if (checkWifiStatus() == true) {
|
||||||
|
Screen::set(std::make_unique<ScriptBrowse>());
|
||||||
|
} else {
|
||||||
|
notConnectedMsg();
|
||||||
|
}
|
||||||
|
} else if (touching(touch, subPos[2])) {
|
||||||
|
if (isTesting == true) {
|
||||||
|
Screen::set(std::make_unique<ScriptCreator>());
|
||||||
|
} else {
|
||||||
|
notImplemented();
|
||||||
|
}
|
||||||
|
} else if (touching(touch, subPos[3])) {
|
||||||
|
std::string tempScript = selectFilePath(Lang::get("SELECT_SCRIPT_PATH"), {});
|
||||||
|
if (tempScript != "") {
|
||||||
|
Config::ScriptPath = tempScript;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
if (keyRepeatDelay) keyRepeatDelay--;
|
if (keyRepeatDelay) keyRepeatDelay--;
|
||||||
|
|
||||||
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
||||||
fileInfo.clear();
|
fileInfo.clear();
|
||||||
Screen::back();
|
mode = 0;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hHeld & KEY_DOWN && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[1]))) {
|
if ((hHeld & KEY_DOWN && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[1]))) {
|
||||||
@@ -431,7 +546,7 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
loadDesc();
|
loadDesc();
|
||||||
isScriptSelected = true;
|
isScriptSelected = true;
|
||||||
selection = 0;
|
selection = 0;
|
||||||
mode = 1;
|
mode = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -452,7 +567,7 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
loadDesc();
|
loadDesc();
|
||||||
isScriptSelected = true;
|
isScriptSelected = true;
|
||||||
selection = 0;
|
selection = 0;
|
||||||
mode = 1;
|
mode = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -474,7 +589,7 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
loadDesc();
|
loadDesc();
|
||||||
isScriptSelected = true;
|
isScriptSelected = true;
|
||||||
selection = 0;
|
selection = 0;
|
||||||
mode = 1;
|
mode = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -509,7 +624,7 @@ void ScriptList::SelectFunction(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
selection2 = 0;
|
selection2 = 0;
|
||||||
fileInfo2.clear();
|
fileInfo2.clear();
|
||||||
isScriptSelected = false;
|
isScriptSelected = false;
|
||||||
mode = 0;
|
mode = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hHeld & KEY_DOWN && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[1]))) {
|
if ((hHeld & KEY_DOWN && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[1]))) {
|
||||||
@@ -603,8 +718,10 @@ void ScriptList::SelectFunction(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
|
|
||||||
void ScriptList::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
void ScriptList::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
if (mode == 0) {
|
if (mode == 0) {
|
||||||
ListSelection(hDown, hHeld, touch);
|
SubMenuLogic(hDown, hHeld, touch);
|
||||||
} else if (mode == 1) {
|
} else if (mode == 1) {
|
||||||
|
ListSelection(hDown, hHeld, touch);
|
||||||
|
} else if (mode == 2) {
|
||||||
SelectFunction(hDown, hHeld, touch);
|
SelectFunction(hDown, hHeld, touch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+17
-43
@@ -137,23 +137,19 @@ void Settings::DrawColorChanging(void) const {
|
|||||||
Gui::DrawArrow(0, 0, 0, 1);
|
Gui::DrawArrow(0, 0, 0, 1);
|
||||||
Gui::DrawArrow(318, 22, 180.0, 1);
|
Gui::DrawArrow(318, 22, 180.0, 1);
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 7; i++) {
|
||||||
if (colorMode == i) {
|
if (colorMode == i) {
|
||||||
Gui::Draw_Rect(54 + i * 25, 2, 16, 16, C2D_Color32(140, 140, 140, 255));
|
Gui::Draw_Rect(54 + i * 25, 2, 16, 16, C2D_Color32(140, 140, 140, 255));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 7; i++) {
|
||||||
Gui::DrawString(58 + i * 25, 2, 0.5f, WHITE, std::to_string(i+1), 400);
|
Gui::DrawString(58 + i * 25, 2, 0.5f, WHITE, std::to_string(i+1), 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (colorMode != 7) {
|
Gui::Draw_Rect(buttons[0].x, buttons[0].y, 95, 41, C2D_Color32(255, 0, 0, 255));
|
||||||
Gui::Draw_Rect(buttons[0].x, buttons[0].y, 95, 41, C2D_Color32(255, 0, 0, 255));
|
Gui::Draw_Rect(buttons[1].x, buttons[1].y, 95, 41, C2D_Color32(0, 255, 0, 255));
|
||||||
Gui::Draw_Rect(buttons[1].x, buttons[1].y, 95, 41, C2D_Color32(0, 255, 0, 255));
|
Gui::Draw_Rect(buttons[2].x, buttons[2].y, 95, 41, C2D_Color32(0, 0, 255, 255));
|
||||||
Gui::Draw_Rect(buttons[2].x, buttons[2].y, 95, 41, C2D_Color32(0, 0, 255, 255));
|
|
||||||
} else {
|
|
||||||
Gui::Draw_Rect(buttons[1].x, buttons[1].y, 95, 41, Config::Color1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (colorMode == 0) {
|
if (colorMode == 0) {
|
||||||
Gui::DrawStringCentered(0, 60, 0.7f, Config::TxtColor, Lang::get("BAR_COLOR"), 320);
|
Gui::DrawStringCentered(0, 60, 0.7f, Config::TxtColor, Lang::get("BAR_COLOR"), 320);
|
||||||
@@ -190,10 +186,6 @@ void Settings::DrawColorChanging(void) const {
|
|||||||
Gui::DrawString(40, 98, 0.7f, WHITE, ColorHelper::getColorName(Config::progressbarColor, 2).c_str(), 400);
|
Gui::DrawString(40, 98, 0.7f, WHITE, ColorHelper::getColorName(Config::progressbarColor, 2).c_str(), 400);
|
||||||
Gui::DrawString(140, 98, 0.7f, WHITE, ColorHelper::getColorName(Config::progressbarColor, 1).c_str(), 400);
|
Gui::DrawString(140, 98, 0.7f, WHITE, ColorHelper::getColorName(Config::progressbarColor, 1).c_str(), 400);
|
||||||
Gui::DrawString(245, 98, 0.7f, WHITE, ColorHelper::getColorName(Config::progressbarColor, 0).c_str(), 400);
|
Gui::DrawString(245, 98, 0.7f, WHITE, ColorHelper::getColorName(Config::progressbarColor, 0).c_str(), 400);
|
||||||
} else if (colorMode == 7) {
|
|
||||||
Gui::DrawStringCentered(0, 60, 0.7f, Config::TxtColor, Lang::get("USE_BARS"), 320);
|
|
||||||
if (Config::UseBars == true) Gui::DrawString(140, 98, 0.7f, WHITE, Lang::get("YES"), 400);
|
|
||||||
else if (Config::UseBars == false) Gui::DrawString(140, 98, 0.7f, WHITE, Lang::get("NO"), 400);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,7 +237,7 @@ void Settings::DrawMiscSettings(void) const {
|
|||||||
Gui::DrawBottom();
|
Gui::DrawBottom();
|
||||||
Gui::DrawArrow(0, 218, 0, 1);
|
Gui::DrawArrow(0, 218, 0, 1);
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
if (Selection == i) {
|
if (Selection == i) {
|
||||||
Gui::Draw_Rect(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, Config::SelectedColor);
|
Gui::Draw_Rect(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, Config::SelectedColor);
|
||||||
} else {
|
} else {
|
||||||
@@ -253,9 +245,8 @@ void Settings::DrawMiscSettings(void) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Gui::DrawStringCentered(0, mainButtons[0].y+10, 0.6f, Config::TxtColor, Lang::get("CHANGE_STOREPATH"), 140);
|
Gui::DrawStringCentered(0, mainButtons[0].y+10, 0.6f, Config::TxtColor, Lang::get("CHANGE_MUSICFILE"), 140);
|
||||||
Gui::DrawStringCentered(0, mainButtons[1].y+10, 0.6f, Config::TxtColor, Lang::get("CHANGE_SCRIPTPATH"), 140);
|
Gui::DrawStringCentered(0, mainButtons[1].y+10, 0.6f, Config::TxtColor, Lang::get("CHANGE_BAR_STYLE"), 140);
|
||||||
Gui::DrawStringCentered(0, mainButtons[2].y+10, 0.6f, Config::TxtColor, Lang::get("CHANGE_MUSICFILE"), 140);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
@@ -264,44 +255,30 @@ void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_DOWN) {
|
if (hDown & KEY_DOWN) {
|
||||||
if (Selection < 2) Selection++;
|
if (Selection < 1) Selection++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_A) {
|
if (hDown & KEY_A) {
|
||||||
if (Selection == 0) {
|
if (Selection == 0) {
|
||||||
std::string tempStore = selectFilePath(Lang::get("SELECT_STORE_PATH"), {});
|
|
||||||
if (tempStore != "") {
|
|
||||||
Config::StorePath = tempStore;
|
|
||||||
}
|
|
||||||
} else if (Selection == 1) {
|
|
||||||
std::string tempScript = selectFilePath(Lang::get("SELECT_SCRIPT_PATH"), {});
|
|
||||||
if (tempScript != "") {
|
|
||||||
Config::ScriptPath = tempScript;
|
|
||||||
}
|
|
||||||
} else if (Selection == 2) {
|
|
||||||
std::string tempMusic = selectFilePath(Lang::get("SELECT_MUSIC_FILE"), {"wav"}, 2);
|
std::string tempMusic = selectFilePath(Lang::get("SELECT_MUSIC_FILE"), {"wav"}, 2);
|
||||||
if (tempMusic != "") {
|
if (tempMusic != "") {
|
||||||
Config::MusicPath = tempMusic;
|
Config::MusicPath = tempMusic;
|
||||||
}
|
}
|
||||||
|
} else if (Selection == 1) {
|
||||||
|
if (Config::UseBars == true) Config::UseBars = false;
|
||||||
|
else if (Config::UseBars == false) Config::UseBars = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_TOUCH) {
|
if (hDown & KEY_TOUCH) {
|
||||||
if (touching(touch, mainButtons[0])) {
|
if (touching(touch, mainButtons[0])) {
|
||||||
std::string tempStore = selectFilePath(Lang::get("SELECT_STORE_PATH"), {});
|
|
||||||
if (tempStore != "") {
|
|
||||||
Config::StorePath = tempStore;
|
|
||||||
}
|
|
||||||
} else if (touching(touch, mainButtons[1])) {
|
|
||||||
std::string tempScript = selectFilePath(Lang::get("SELECT_SCRIPT_PATH"), {});
|
|
||||||
if (tempScript != "") {
|
|
||||||
Config::ScriptPath = tempScript;
|
|
||||||
}
|
|
||||||
} else if (touching(touch, mainButtons[2])) {
|
|
||||||
std::string tempMusic = selectFilePath(Lang::get("SELECT_MUSIC_FILE"), {"wav"}, 2);
|
std::string tempMusic = selectFilePath(Lang::get("SELECT_MUSIC_FILE"), {"wav"}, 2);
|
||||||
if (tempMusic != "") {
|
if (tempMusic != "") {
|
||||||
Config::MusicPath = tempMusic;
|
Config::MusicPath = tempMusic;
|
||||||
}
|
}
|
||||||
|
} else if (touching(touch, mainButtons[1])) {
|
||||||
|
if (Config::UseBars == true) Config::UseBars = false;
|
||||||
|
else if (Config::UseBars == false) Config::UseBars = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,7 +378,7 @@ void Settings::colorChanging(u32 hDown, touchPosition touch) {
|
|||||||
int blue;
|
int blue;
|
||||||
|
|
||||||
if (hDown & KEY_TOUCH) {
|
if (hDown & KEY_TOUCH) {
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 7; i++) {
|
||||||
if(touch.px > 54 + i * 25 && touch.px < 54 + i * 25+16 && touch.py > 2 && touch.py < 2+16) {
|
if(touch.px > 54 + i * 25 && touch.px < 54 + i * 25+16 && touch.py > 2 && touch.py < 2+16) {
|
||||||
colorMode = i;
|
colorMode = i;
|
||||||
}
|
}
|
||||||
@@ -418,7 +395,7 @@ void Settings::colorChanging(u32 hDown, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((hDown & KEY_R || hDown & KEY_RIGHT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[1]))) {
|
if ((hDown & KEY_R || hDown & KEY_RIGHT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[1]))) {
|
||||||
if(colorMode < 7) colorMode++;
|
if(colorMode < 6) colorMode++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_TOUCH) {
|
if (hDown & KEY_TOUCH) {
|
||||||
@@ -484,9 +461,6 @@ void Settings::colorChanging(u32 hDown, touchPosition touch) {
|
|||||||
Config::progressbarColor = RGBA8(ColorHelper::getColorValue(Config::progressbarColor, 2), ColorHelper::getColorValue(Config::progressbarColor, 1), blue, 255);
|
Config::progressbarColor = RGBA8(ColorHelper::getColorValue(Config::progressbarColor, 2), ColorHelper::getColorValue(Config::progressbarColor, 1), blue, 255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (touching(touch, buttons[1]) && colorMode == 7) {
|
|
||||||
if (Config::UseBars == true) Config::UseBars = false;
|
|
||||||
else if (Config::UseBars == false) Config::UseBars = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+119
-37
@@ -147,17 +147,6 @@ void loadStoreDesc(void) {
|
|||||||
descLines.push_back(storeDesc.substr(0, storeDesc.find('\n')));
|
descLines.push_back(storeDesc.substr(0, storeDesc.find('\n')));
|
||||||
}
|
}
|
||||||
|
|
||||||
UniStore::UniStore() {
|
|
||||||
dirContents.clear();
|
|
||||||
chdir(Config::StorePath.c_str());
|
|
||||||
getDirectoryContents(dirContents, {"unistore"});
|
|
||||||
for(uint i=0;i<dirContents.size();i++) {
|
|
||||||
storeInfo.push_back(parseStoreInfo(dirContents[i].name));
|
|
||||||
}
|
|
||||||
descript();
|
|
||||||
loadStoreDesc();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Store colors.
|
// Store colors.
|
||||||
void loadStoreColors(nlohmann::json &json) {
|
void loadStoreColors(nlohmann::json &json) {
|
||||||
u32 colorTemp;
|
u32 colorTemp;
|
||||||
@@ -183,6 +172,32 @@ void loadStoreColors(nlohmann::json &json) {
|
|||||||
progressBar = colorTemp == 0 ? Config::progressbarColor : colorTemp;
|
progressBar = colorTemp == 0 ? Config::progressbarColor : colorTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UniStore::DrawSubMenu(void) const {
|
||||||
|
Gui::DrawTop();
|
||||||
|
if (Config::UseBars == true) {
|
||||||
|
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("UNISTORE_SUBMENU"), 400);
|
||||||
|
} else {
|
||||||
|
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("UNISTORE_SUBMENU"), 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
Gui::sprite(sprites_uniStore_HD_idx, 140, 50, 0.2, 0.2);
|
||||||
|
Gui::DrawBottom();
|
||||||
|
Gui::DrawArrow(0, 218, 0, 1);
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
if (subSelection == i) {
|
||||||
|
Gui::Draw_Rect(subPos[i].x, subPos[i].y, subPos[i].w, subPos[i].h, Config::SelectedColor);
|
||||||
|
} else {
|
||||||
|
Gui::Draw_Rect(subPos[i].x, subPos[i].y, subPos[i].w, subPos[i].h, Config::UnselectedColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("STORE_LIST")))/2, subPos[0].y+10, 0.6f, Config::TxtColor, Lang::get("STORE_LIST"), 140);
|
||||||
|
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("STORE_SEARCH")))/2, subPos[1].y+10, 0.6f, Config::TxtColor, Lang::get("STORE_SEARCH"), 140);
|
||||||
|
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("CHANGE_STOREPATH")))/2, subPos[2].y+10, 0.6f, Config::TxtColor, Lang::get("CHANGE_STOREPATH"), 140);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// First Screen -> Storelist.
|
// First Screen -> Storelist.
|
||||||
void UniStore::DrawStoreList(void) const {
|
void UniStore::DrawStoreList(void) const {
|
||||||
std::string line1;
|
std::string line1;
|
||||||
@@ -302,26 +317,101 @@ void UniStore::DrawStore(void) const {
|
|||||||
|
|
||||||
void UniStore::Draw(void) const {
|
void UniStore::Draw(void) const {
|
||||||
if (mode == 0) {
|
if (mode == 0) {
|
||||||
DrawStoreList();
|
DrawSubMenu();
|
||||||
} else if (mode == 1) {
|
} else if (mode == 1) {
|
||||||
DrawStore();
|
DrawStoreList();
|
||||||
} else if (mode == 2) {
|
} else if (mode == 2) {
|
||||||
|
DrawStore();
|
||||||
|
} else if (mode == 3) {
|
||||||
DrawSearch();
|
DrawSearch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UniStore::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
|
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
||||||
|
Screen::back();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_UP) {
|
||||||
|
if(subSelection > 0) subSelection--;
|
||||||
|
}
|
||||||
|
if (hDown & KEY_DOWN) {
|
||||||
|
if(subSelection < 2) subSelection++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_A) {
|
||||||
|
switch(subSelection) {
|
||||||
|
case 0:
|
||||||
|
if (returnIfExist(Config::StorePath, {"unistore"}) == true) {
|
||||||
|
dirContents.clear();
|
||||||
|
storeInfo.clear();
|
||||||
|
chdir(Config::StorePath.c_str());
|
||||||
|
getDirectoryContents(dirContents, {"unistore"});
|
||||||
|
for(uint i=0;i<dirContents.size();i++) {
|
||||||
|
storeInfo.push_back(parseStoreInfo(dirContents[i].name));
|
||||||
|
descript();
|
||||||
|
loadStoreDesc();
|
||||||
|
}
|
||||||
|
mode = 1;
|
||||||
|
} else {
|
||||||
|
Gui::DisplayWarnMsg(Lang::get("GET_STORES_FIRST"));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (checkWifiStatus() == true) {
|
||||||
|
mode = 3;
|
||||||
|
} else {
|
||||||
|
notConnectedMsg();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
std::string tempStore = selectFilePath(Lang::get("SELECT_STORE_PATH"), {});
|
||||||
|
if (tempStore != "") {
|
||||||
|
Config::StorePath = tempStore;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_TOUCH) {
|
||||||
|
if (touching(touch, subPos[0])) {
|
||||||
|
if (returnIfExist(Config::StorePath, {"unistore"}) == true) {
|
||||||
|
dirContents.clear();
|
||||||
|
storeInfo.clear();
|
||||||
|
chdir(Config::StorePath.c_str());
|
||||||
|
getDirectoryContents(dirContents, {"unistore"});
|
||||||
|
for(uint i=0;i<dirContents.size();i++) {
|
||||||
|
storeInfo.push_back(parseStoreInfo(dirContents[i].name));
|
||||||
|
descript();
|
||||||
|
loadStoreDesc();
|
||||||
|
}
|
||||||
|
mode = 1;
|
||||||
|
} else {
|
||||||
|
Gui::DisplayWarnMsg(Lang::get("GET_STORES_FIRST"));
|
||||||
|
}
|
||||||
|
} else if (touching(touch, subPos[1])) {
|
||||||
|
if (checkWifiStatus() == true) {
|
||||||
|
mode = 3;
|
||||||
|
} else {
|
||||||
|
notConnectedMsg();
|
||||||
|
}
|
||||||
|
} else if (touching(touch, subPos[2])) {
|
||||||
|
std::string tempStore = selectFilePath(Lang::get("SELECT_STORE_PATH"), {});
|
||||||
|
if (tempStore != "") {
|
||||||
|
Config::StorePath = tempStore;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
if (keyRepeatDelay) keyRepeatDelay--;
|
if (keyRepeatDelay) keyRepeatDelay--;
|
||||||
|
|
||||||
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
||||||
storeInfo.clear();
|
storeInfo.clear();
|
||||||
Screen::back();
|
mode = 0;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Download / search screen.
|
|
||||||
if (hDown & KEY_TOUCH && touching(touch, arrowPos[4])) {
|
|
||||||
mode = 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hHeld & KEY_DOWN && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[1]))) {
|
if ((hHeld & KEY_DOWN && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[1]))) {
|
||||||
@@ -396,7 +486,7 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
loadStoreColors(appStoreJson);
|
loadStoreColors(appStoreJson);
|
||||||
selectedOptionAppStore = appStoreList[0];
|
selectedOptionAppStore = appStoreList[0];
|
||||||
isScriptSelected = true;
|
isScriptSelected = true;
|
||||||
mode = 1;
|
mode = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -440,7 +530,7 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
loadStoreColors(appStoreJson);
|
loadStoreColors(appStoreJson);
|
||||||
selectedOptionAppStore = appStoreList[0];
|
selectedOptionAppStore = appStoreList[0];
|
||||||
isScriptSelected = true;
|
isScriptSelected = true;
|
||||||
mode = 1;
|
mode = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -460,7 +550,7 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
loadStoreColors(appStoreJson);
|
loadStoreColors(appStoreJson);
|
||||||
selectedOptionAppStore = appStoreList[0];
|
selectedOptionAppStore = appStoreList[0];
|
||||||
isScriptSelected = true;
|
isScriptSelected = true;
|
||||||
mode = 1;
|
mode = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -472,7 +562,7 @@ void UniStore::StoreLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
if (keyRepeatDelay) keyRepeatDelay--;
|
if (keyRepeatDelay) keyRepeatDelay--;
|
||||||
|
|
||||||
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
||||||
mode = 0;
|
mode = 1;
|
||||||
appStoreList.clear();
|
appStoreList.clear();
|
||||||
isScriptSelected = false;
|
isScriptSelected = false;
|
||||||
selection2 = 0;
|
selection2 = 0;
|
||||||
@@ -563,15 +653,17 @@ void UniStore::StoreLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
|
|
||||||
void UniStore::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
void UniStore::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
if (mode == 0) {
|
if (mode == 0) {
|
||||||
StoreSelectionLogic(hDown, hHeld, touch);
|
SubMenuLogic(hDown, hHeld, touch);
|
||||||
} else if (mode == 1) {
|
} else if (mode == 1) {
|
||||||
StoreLogic(hDown, hHeld, touch);
|
StoreSelectionLogic(hDown, hHeld, touch);
|
||||||
} else if (mode == 2) {
|
} else if (mode == 2) {
|
||||||
|
StoreLogic(hDown, hHeld, touch);
|
||||||
|
} else if (mode == 3) {
|
||||||
SearchLogic(hDown, hHeld, touch);
|
SearchLogic(hDown, hHeld, touch);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch ViewMode.
|
// Switch ViewMode.
|
||||||
if (((mode != 2) && (hDown & KEY_X)) || ((mode != 2) && (hDown & KEY_TOUCH && touching(touch, arrowPos[3])))) {
|
if (((mode != 0 || mode != 3) && (hDown & KEY_X)) || ((mode != 0 || mode != 3) && (hDown & KEY_TOUCH && touching(touch, arrowPos[3])))) {
|
||||||
if (Config::viewMode == 0) {
|
if (Config::viewMode == 0) {
|
||||||
Config::viewMode = 1;
|
Config::viewMode = 1;
|
||||||
} else {
|
} else {
|
||||||
@@ -706,16 +798,6 @@ void UniStore::DrawSearch(void) const {
|
|||||||
|
|
||||||
void UniStore::SearchLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
void UniStore::SearchLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
||||||
// Refresh the list.
|
|
||||||
dirContents.clear();
|
|
||||||
storeInfo.clear();
|
|
||||||
chdir(Config::StorePath.c_str());
|
|
||||||
getDirectoryContents(dirContents, {"unistore"});
|
|
||||||
for(uint i=0;i<dirContents.size();i++) {
|
|
||||||
storeInfo.push_back(parseStoreInfo(dirContents[i].name));
|
|
||||||
descript();
|
|
||||||
loadStoreDesc();
|
|
||||||
}
|
|
||||||
mode = 0;
|
mode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ extern bool continueNdsScan;
|
|||||||
extern uint selectedFile;
|
extern uint selectedFile;
|
||||||
extern int keyRepeatDelay;
|
extern int keyRepeatDelay;
|
||||||
extern bool dirChanged;
|
extern bool dirChanged;
|
||||||
extern std::vector<DirEntry> dirContents;
|
std::vector<DirEntry> dirContents;
|
||||||
|
|
||||||
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
||||||
extern touchPosition touch;
|
extern touchPosition touch;
|
||||||
@@ -191,6 +191,21 @@ std::vector<std::string> getContents(const std::string &name, const std::vector<
|
|||||||
return dirContents;
|
return dirContents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Directory exist?
|
||||||
|
bool returnIfExist(const std::string &path, const std::vector<std::string> &extensionList) {
|
||||||
|
dirContents.clear();
|
||||||
|
chdir(path.c_str());
|
||||||
|
std::vector<DirEntry> dirContentsTemp;
|
||||||
|
getDirectoryContents(dirContentsTemp, extensionList);
|
||||||
|
for(uint i=0;i<dirContentsTemp.size();i++) {
|
||||||
|
dirContents.push_back(dirContentsTemp[i]);
|
||||||
|
}
|
||||||
|
if (dirContents.size() == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// returns a Path or file to 'std::string'.
|
// returns a Path or file to 'std::string'.
|
||||||
// selectText is the Text which is displayed on the bottom bar of the top screen.
|
// selectText is the Text which is displayed on the bottom bar of the top screen.
|
||||||
// selectionMode is how you select it. 1 -> Path, 2 -> File.
|
// selectionMode is how you select it. 1 -> Path, 2 -> File.
|
||||||
|
|||||||
Reference in New Issue
Block a user