mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-03 00:39:02 +00:00
Fully rewrite config.
This commit is contained in:
+3
-1
@@ -31,6 +31,8 @@
|
|||||||
#include "gui.hpp"
|
#include "gui.hpp"
|
||||||
#include "sprites.h"
|
#include "sprites.h"
|
||||||
|
|
||||||
|
extern std::unique_ptr<Config> config;
|
||||||
|
|
||||||
namespace GFX {
|
namespace GFX {
|
||||||
// Basic GUI.
|
// Basic GUI.
|
||||||
void DrawTop(void);
|
void DrawTop(void);
|
||||||
@@ -41,7 +43,7 @@ namespace GFX {
|
|||||||
void DrawSprite(int img, int x, int y, float ScaleX = 1, float ScaleY = 1);
|
void DrawSprite(int img, int x, int y, float ScaleX = 1, float ScaleY = 1);
|
||||||
void DrawSpriteBlend(int img, int x, int y, float ScaleX = 1, float ScaleY = 1);
|
void DrawSpriteBlend(int img, int x, int y, float ScaleX = 1, float ScaleY = 1);
|
||||||
|
|
||||||
void DrawButton(int x, int y, std::string ButtonText = "", u32 color = Config::Button);
|
void DrawButton(int x, int y, std::string ButtonText = "", u32 color = config->buttonColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+97
-12
@@ -24,28 +24,113 @@
|
|||||||
* reasonable ways as different from the original version.
|
* reasonable ways as different from the original version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CONFIG_HPP
|
#ifndef _UNIVERSAL_UPDATER_CONFIG_HPP
|
||||||
#define CONFIG_HPP
|
#define _UNIVERSAL_UPDATER_CONFIG_HPP
|
||||||
|
|
||||||
|
#include "json.hpp"
|
||||||
|
|
||||||
|
#include <3ds.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace Config {
|
class Config {
|
||||||
extern int LangPath, Color1, Color2, Color3, TxtColor, SelectedColor, UnselectedColor, viewMode, progressbarColor, autoboot, outdated, uptodate, notFound, future, Button, keyDelay;
|
public:
|
||||||
extern std::string lang, ScriptPath, MusicPath, StorePath, AutobootFile;
|
Config();
|
||||||
extern bool Logging, UseBars, fading, progress;
|
|
||||||
|
|
||||||
void load();
|
|
||||||
void save();
|
void save();
|
||||||
void initializeNewConfig();
|
void initialize();
|
||||||
|
|
||||||
|
// Bar Color.
|
||||||
|
u32 barColor() { return this->v_barColor; }
|
||||||
|
void barColor(u32 v) { this->v_barColor = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
// Top BG Color.
|
||||||
|
u32 topBG() { return this->v_topBG; }
|
||||||
|
void topBG(u32 v) { this->v_topBG = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
// Bottom BG Color.
|
||||||
|
u32 bottomBG() { return this->v_bottomBG; }
|
||||||
|
void bottomBG(u32 v) { this->v_bottomBG = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
// Text Color.
|
||||||
|
u32 textColor() { return this->v_textColor; }
|
||||||
|
void textColor(u32 v) { this->v_textColor = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
// Button Color.
|
||||||
|
u32 buttonColor() { return this->v_buttonColor; }
|
||||||
|
void buttonColor(u32 v) { this->v_buttonColor = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
// Selected Color.
|
||||||
|
u32 selectedColor() { return this->v_selectedColor; }
|
||||||
|
void selectedColor(u32 v) { this->v_selectedColor = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
// Unselected Color.
|
||||||
|
u32 unselectedColor() { return this->v_unselectedColor; }
|
||||||
|
void unselectedColor(u32 v) { this->v_unselectedColor = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
// Script Path.
|
||||||
|
std::string scriptPath() { return this->v_scriptPath; }
|
||||||
|
void scriptPath(std::string v) { this->v_scriptPath = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
// Lang Path.
|
||||||
|
int langPath() { return this->v_langPath; }
|
||||||
|
void langPath(int v) { this->v_langPath = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
// View Mode.
|
||||||
|
int viewMode() { return this->v_viewMode; }
|
||||||
|
void viewMode(int v) { this->v_viewMode = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
// Progressbar Color.
|
||||||
|
u32 progressbarColor() { return this->v_progressbarColor; }
|
||||||
|
void progressbarColor(u32 v) { this->v_progressbarColor = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
// Music Path.
|
||||||
|
std::string musicPath() { return this->v_musicPath; }
|
||||||
|
void musicPath(std::string v) { this->v_musicPath = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
// Logging.
|
||||||
|
bool logging() { return this->v_logging; }
|
||||||
|
void logging(bool v) { this->v_logging = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
// Use bars.
|
||||||
|
bool useBars() { return this->v_useBars; }
|
||||||
|
void useBars(bool v) { this->v_useBars = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
// Autoboot.
|
||||||
|
int autoboot() { return this->v_autoboot; }
|
||||||
|
void autoboot(int v) { this->v_autoboot = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
// Store Path.
|
||||||
|
std::string storePath() { return this->v_storePath; }
|
||||||
|
void storePath(std::string v) { this->v_storePath = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
// Autoboto file.
|
||||||
|
std::string autobootFile() { return this->v_autobootFile; }
|
||||||
|
void autobootFile(std::string v) { this->v_autobootFile = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
// Outdated Script Color.
|
||||||
|
u32 outdatedColor() { return this->v_outdatedColor; }
|
||||||
|
void outdatedColor(u32 v) { this->v_outdatedColor = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
// Uptodate Script Color.
|
||||||
|
u32 uptodateColor() { return this->v_uptodateColor; }
|
||||||
|
void uptodateColor(u32 v) { this->v_uptodateColor = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
// Not found Script Color.
|
||||||
|
u32 notfoundColor() { return this->v_notfoundColor; }
|
||||||
|
void notfoundColor(u32 v) { this->v_notfoundColor = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
// Future Script Color.
|
||||||
|
u32 futureColor() { return this->v_futureColor; }
|
||||||
|
void futureColor(u32 v) { this->v_futureColor = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
// Keydelay.
|
||||||
|
int keyDelay() { return this->v_keyDelay; }
|
||||||
|
void keyDelay(int v) { this->v_keyDelay = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
// Screen Fade.
|
||||||
|
bool screenFade() { return this->v_screenFade; }
|
||||||
|
void screenFade(bool v) { this->v_screenFade = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
// Progressbar Display.
|
||||||
|
bool progressDisplay() { return this->v_progressDisplay; }
|
||||||
|
void progressDisplay(bool v) { this->v_progressDisplay = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
// Language.
|
||||||
|
std::string language() { return this->v_language; }
|
||||||
|
void language(std::string v) { this->v_language = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
|
||||||
|
// Mainly helper.
|
||||||
bool getBool(const std::string &key);
|
bool getBool(const std::string &key);
|
||||||
void setBool(const std::string &key, bool v);
|
void setBool(const std::string &key, bool v);
|
||||||
|
|
||||||
int getInt(const std::string &key);
|
int getInt(const std::string &key);
|
||||||
void setInt(const std::string &key, int v);
|
void setInt(const std::string &key, int v);
|
||||||
|
|
||||||
std::string getString(const std::string &key);
|
std::string getString(const std::string &key);
|
||||||
void setString(const std::string &key, const std::string &v);
|
void setString(const std::string &key, const std::string &v);
|
||||||
}
|
private:
|
||||||
|
nlohmann::json json; // Our private JSON file.
|
||||||
|
bool changesMade = false;
|
||||||
|
|
||||||
|
// Color variables and more.
|
||||||
|
u32 v_barColor, v_topBG, v_bottomBG, v_textColor, v_buttonColor, v_selectedColor, v_unselectedColor, v_progressbarColor,
|
||||||
|
v_outdatedColor, v_uptodateColor, v_notfoundColor, v_futureColor;
|
||||||
|
std::string v_scriptPath, v_musicPath, v_storePath, v_autobootFile, v_language;
|
||||||
|
int v_langPath, v_viewMode, v_autoboot, v_keyDelay;
|
||||||
|
bool v_logging, v_useBars, v_screenFade, v_progressDisplay;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+10
-9
@@ -30,44 +30,45 @@ extern bool isScriptSelected;
|
|||||||
extern u32 progressBar;
|
extern u32 progressBar;
|
||||||
extern u32 selected;
|
extern u32 selected;
|
||||||
|
|
||||||
|
extern std::unique_ptr<Config> config;
|
||||||
extern C2D_SpriteSheet sprites;
|
extern C2D_SpriteSheet sprites;
|
||||||
|
|
||||||
// Draws a Rectangle as the progressbar.
|
// Draws a Rectangle as the progressbar.
|
||||||
void Animation::DrawProgressBar(float currentProgress, float totalProgress, int mode) {
|
void Animation::DrawProgressBar(float currentProgress, float totalProgress, int mode) {
|
||||||
if (Config::progress) {
|
if (config->progressDisplay()) {
|
||||||
// Outline of progressbar.
|
// Outline of progressbar.
|
||||||
Gui::Draw_Rect(30, 120, 340, 30, BLACK);
|
Gui::Draw_Rect(30, 120, 340, 30, BLACK);
|
||||||
|
|
||||||
if (mode == 1) {
|
if (mode == 1) {
|
||||||
Gui::Draw_Rect(31, 121, (int)(((float)currentProgress / (float)totalProgress) * 338.0f), 28, progressBar);
|
Gui::Draw_Rect(31, 121, (int)(((float)currentProgress / (float)totalProgress) * 338.0f), 28, progressBar);
|
||||||
} else {
|
} else {
|
||||||
Gui::Draw_Rect(31, 121, (int)(((float)currentProgress / (float)totalProgress) * 338.0f), 28, Config::progressbarColor);
|
Gui::Draw_Rect(31, 121, (int)(((float)currentProgress / (float)totalProgress) * 338.0f), 28, config->progressbarColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Animation::DrawProgressBarInstall(u64 currentProgress, u64 totalProgress, int mode) {
|
void Animation::DrawProgressBarInstall(u64 currentProgress, u64 totalProgress, int mode) {
|
||||||
if (Config::progress) {
|
if (config->progressDisplay()) {
|
||||||
// Outline of progressbar.
|
// Outline of progressbar.
|
||||||
Gui::Draw_Rect(30, 120, 340, 30, BLACK);
|
Gui::Draw_Rect(30, 120, 340, 30, BLACK);
|
||||||
|
|
||||||
if (mode == 1) {
|
if (mode == 1) {
|
||||||
Gui::Draw_Rect(31, 121, (int)(((float)currentProgress / (float)totalProgress) * 338.0f), 28, progressBar);
|
Gui::Draw_Rect(31, 121, (int)(((float)currentProgress / (float)totalProgress) * 338.0f), 28, progressBar);
|
||||||
} else {
|
} else {
|
||||||
Gui::Draw_Rect(31, 121, (int)(((float)currentProgress / (float)totalProgress) * 338.0f), 28, Config::progressbarColor);
|
Gui::Draw_Rect(31, 121, (int)(((float)currentProgress / (float)totalProgress) * 338.0f), 28, config->progressbarColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Animation::DrawProgressBarExtract(u64 currentProgress, u64 totalProgress, int mode) {
|
void Animation::DrawProgressBarExtract(u64 currentProgress, u64 totalProgress, int mode) {
|
||||||
if (Config::progress) {
|
if (config->progressDisplay()) {
|
||||||
// Outline of progressbar.
|
// Outline of progressbar.
|
||||||
Gui::Draw_Rect(30, 140, 340, 30, BLACK);
|
Gui::Draw_Rect(30, 140, 340, 30, BLACK);
|
||||||
|
|
||||||
if (mode == 1) {
|
if (mode == 1) {
|
||||||
Gui::Draw_Rect(31, 141, (int)(((float)currentProgress / (float)totalProgress) * 338.0f), 28, progressBar);
|
Gui::Draw_Rect(31, 141, (int)(((float)currentProgress / (float)totalProgress) * 338.0f), 28, progressBar);
|
||||||
} else {
|
} else {
|
||||||
Gui::Draw_Rect(31, 141, (int)(((float)currentProgress / (float)totalProgress) * 338.0f), 28, Config::progressbarColor);
|
Gui::Draw_Rect(31, 141, (int)(((float)currentProgress / (float)totalProgress) * 338.0f), 28, config->progressbarColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,9 +82,9 @@ void Animation::Button(int x, int y, float speed) {
|
|||||||
g = (selected >> 8) & 0xFF;
|
g = (selected >> 8) & 0xFF;
|
||||||
b = (selected >> 16) & 0xFF;
|
b = (selected >> 16) & 0xFF;
|
||||||
} else {
|
} else {
|
||||||
r = Config::SelectedColor & 0xFF;
|
r = config->selectedColor() & 0xFF;
|
||||||
g = (Config::SelectedColor >> 8) & 0xFF;
|
g = (config->selectedColor() >> 8) & 0xFF;
|
||||||
b = (Config::SelectedColor >> 16) & 0xFF;
|
b = (config->selectedColor() >> 16) & 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 color = C2D_Color32(r + (255 - r) * highlight_multiplier, g + (255 - g) * highlight_multiplier, b + (255 - b) * highlight_multiplier, 255);
|
u32 color = C2D_Color32(r + (255 - r) * highlight_multiplier, g + (255 - g) * highlight_multiplier, b + (255 - b) * highlight_multiplier, 255);
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ static size_t result_written = 0;
|
|||||||
std::vector<std::string> _topText;
|
std::vector<std::string> _topText;
|
||||||
std::string jsonName;
|
std::string jsonName;
|
||||||
|
|
||||||
|
extern std::unique_ptr<Config> config;
|
||||||
extern bool downloadNightlies;
|
extern bool downloadNightlies;
|
||||||
extern int filesExtracted;
|
extern int filesExtracted;
|
||||||
extern std::string extractingFile;
|
extern std::string extractingFile;
|
||||||
@@ -350,7 +351,7 @@ int SelectRelease(std::vector<ReleaseFetch> bruh) {
|
|||||||
C2D_TargetClear(Top, BLACK);
|
C2D_TargetClear(Top, BLACK);
|
||||||
C2D_TargetClear(Bottom, BLACK);
|
C2D_TargetClear(Bottom, BLACK);
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.7f, TextColor, Lang::get("VERSION_SELECT"), 400);
|
Gui::DrawStringCentered(0, 0, 0.7f, TextColor, Lang::get("VERSION_SELECT"), 400);
|
||||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, releaseAmount), 239-Gui::GetStringHeight(0.6f, releaseAmount), 0.6f, TextColor, releaseAmount);
|
Gui::DrawString(397-Gui::GetStringWidth(0.6f, releaseAmount), 239-Gui::GetStringHeight(0.6f, releaseAmount), 0.6f, TextColor, releaseAmount);
|
||||||
} else {
|
} else {
|
||||||
@@ -370,7 +371,7 @@ int SelectRelease(std::vector<ReleaseFetch> bruh) {
|
|||||||
GFX::DrawArrow(295, -1);
|
GFX::DrawArrow(295, -1);
|
||||||
GFX::DrawArrow(315, 240, 180.0);
|
GFX::DrawArrow(315, 240, 180.0);
|
||||||
|
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
for(int i = 0; i < ENTRIES_PER_SCREEN && i < (int)bruh.size(); i++) {
|
for(int i = 0; i < ENTRIES_PER_SCREEN && i < (int)bruh.size(); i++) {
|
||||||
Gui::Draw_Rect(0, 40+(i*57), 320, 45, unselected);
|
Gui::Draw_Rect(0, 40+(i*57), 320, 45, unselected);
|
||||||
line1 = bruh[screenPos + i].TagName;
|
line1 = bruh[screenPos + i].TagName;
|
||||||
@@ -382,7 +383,7 @@ int SelectRelease(std::vector<ReleaseFetch> bruh) {
|
|||||||
Gui::DrawStringCentered(0, 38+(i*57), 0.7f, TextColor, line1, 320);
|
Gui::DrawStringCentered(0, 38+(i*57), 0.7f, TextColor, line1, 320);
|
||||||
Gui::DrawStringCentered(0, 62+(i*57), 0.7f, TextColor, line2, 320);
|
Gui::DrawStringCentered(0, 62+(i*57), 0.7f, TextColor, line2, 320);
|
||||||
}
|
}
|
||||||
} else if (Config::viewMode == 1) {
|
} else if (config->viewMode() == 1) {
|
||||||
for(int i = 0; i < ENTRIES_PER_LIST && i < (int)bruh.size(); i++) {
|
for(int i = 0; i < ENTRIES_PER_LIST && i < (int)bruh.size(); i++) {
|
||||||
Gui::Draw_Rect(0, (i+1)*27, 320, 25, unselected);
|
Gui::Draw_Rect(0, (i+1)*27, 320, 25, unselected);
|
||||||
line1 = bruh[screenPosList + i].TagName;
|
line1 = bruh[screenPosList + i].TagName;
|
||||||
@@ -403,10 +404,10 @@ int SelectRelease(std::vector<ReleaseFetch> bruh) {
|
|||||||
if (keyRepeatDelay) keyRepeatDelay--;
|
if (keyRepeatDelay) keyRepeatDelay--;
|
||||||
|
|
||||||
if (hidKeysDown() & KEY_Y) {
|
if (hidKeysDown() & KEY_Y) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
Config::viewMode = 1;
|
config->viewMode(1);
|
||||||
} else {
|
} else {
|
||||||
Config::viewMode = 0;
|
config->viewMode(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,7 +460,7 @@ int SelectRelease(std::vector<ReleaseFetch> bruh) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_TOUCH) {
|
if (hDown & KEY_TOUCH) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)bruh.size(); i++) {
|
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)bruh.size(); i++) {
|
||||||
if(touch.py > 40+(i*57) && touch.py < 40+(i*57)+45) {
|
if(touch.py > 40+(i*57) && touch.py < 40+(i*57)+45) {
|
||||||
if (bruh.size() != 0) {
|
if (bruh.size() != 0) {
|
||||||
@@ -467,7 +468,7 @@ int SelectRelease(std::vector<ReleaseFetch> bruh) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (Config::viewMode == 1) {
|
} else if (config->viewMode() == 1) {
|
||||||
for(int i=0;i<ENTRIES_PER_LIST && i<(int)bruh.size(); i++) {
|
for(int i=0;i<ENTRIES_PER_LIST && i<(int)bruh.size(); i++) {
|
||||||
if(touch.py > (i+1)*27 && touch.py < (i+2)*27) {
|
if(touch.py > (i+1)*27 && touch.py < (i+2)*27) {
|
||||||
if (bruh.size() != 0) {
|
if (bruh.size() != 0) {
|
||||||
@@ -478,13 +479,13 @@ int SelectRelease(std::vector<ReleaseFetch> bruh) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
if(selectedRelease < screenPos) {
|
if(selectedRelease < screenPos) {
|
||||||
screenPos = selectedRelease;
|
screenPos = selectedRelease;
|
||||||
} else if (selectedRelease > screenPos + ENTRIES_PER_SCREEN - 1) {
|
} else if (selectedRelease > screenPos + ENTRIES_PER_SCREEN - 1) {
|
||||||
screenPos = selectedRelease - ENTRIES_PER_SCREEN + 1;
|
screenPos = selectedRelease - ENTRIES_PER_SCREEN + 1;
|
||||||
}
|
}
|
||||||
} else if (Config::viewMode == 1) {
|
} else if (config->viewMode() == 1) {
|
||||||
if(selectedRelease < screenPosList) {
|
if(selectedRelease < screenPosList) {
|
||||||
screenPosList = selectedRelease;
|
screenPosList = selectedRelease;
|
||||||
} else if (selectedRelease > screenPosList + ENTRIES_PER_LIST - 1) {
|
} else if (selectedRelease > screenPosList + ENTRIES_PER_LIST - 1) {
|
||||||
@@ -881,7 +882,7 @@ void displayProgressBar() {
|
|||||||
if (isScriptSelected == true) {
|
if (isScriptSelected == true) {
|
||||||
Gui::DrawStringCentered(0, 1, 0.7f, TextColor, progressBarMsg, 400);
|
Gui::DrawStringCentered(0, 1, 0.7f, TextColor, progressBarMsg, 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 1, 0.7f, Config::TxtColor, progressBarMsg, 400);
|
Gui::DrawStringCentered(0, 1, 0.7f, config->textColor(), progressBarMsg, 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only display this by downloading.
|
// Only display this by downloading.
|
||||||
@@ -889,7 +890,7 @@ void displayProgressBar() {
|
|||||||
if (isScriptSelected == true) {
|
if (isScriptSelected == true) {
|
||||||
Gui::DrawStringCentered(0, 80, 0.6f, TextColor, str, 400);
|
Gui::DrawStringCentered(0, 80, 0.6f, TextColor, str, 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 80, 0.6f, Config::TxtColor, str, 400);
|
Gui::DrawStringCentered(0, 80, 0.6f, config->textColor(), str, 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isScriptSelected == true) {
|
if (isScriptSelected == true) {
|
||||||
@@ -907,9 +908,9 @@ void displayProgressBar() {
|
|||||||
Gui::DrawStringCentered(0, 100, 0.6f, TextColor, std::to_string(filesExtracted) + " " + (filesExtracted == 1 ? (Lang::get("FILE_EXTRACTED")).c_str() :(Lang::get("FILES_EXTRACTED"))), 400);
|
Gui::DrawStringCentered(0, 100, 0.6f, TextColor, std::to_string(filesExtracted) + " " + (filesExtracted == 1 ? (Lang::get("FILE_EXTRACTED")).c_str() :(Lang::get("FILES_EXTRACTED"))), 400);
|
||||||
Gui::DrawStringCentered(0, 40, 0.6f, TextColor, Lang::get("CURRENTLY_EXTRACTING") + "\n" + extractingFile, 400);
|
Gui::DrawStringCentered(0, 40, 0.6f, TextColor, Lang::get("CURRENTLY_EXTRACTING") + "\n" + extractingFile, 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 180, 0.6f, Config::TxtColor, str, 400);
|
Gui::DrawStringCentered(0, 180, 0.6f, config->textColor(), str, 400);
|
||||||
Gui::DrawStringCentered(0, 100, 0.6f, Config::TxtColor, std::to_string(filesExtracted) + " " + (filesExtracted == 1 ? (Lang::get("FILE_EXTRACTED")).c_str() :(Lang::get("FILES_EXTRACTED"))), 400);
|
Gui::DrawStringCentered(0, 100, 0.6f, config->textColor(), std::to_string(filesExtracted) + " " + (filesExtracted == 1 ? (Lang::get("FILE_EXTRACTED")).c_str() :(Lang::get("FILES_EXTRACTED"))), 400);
|
||||||
Gui::DrawStringCentered(0, 40, 0.6f, Config::TxtColor, Lang::get("CURRENTLY_EXTRACTING") + "\n" + extractingFile, 400);
|
Gui::DrawStringCentered(0, 40, 0.6f, config->textColor(), Lang::get("CURRENTLY_EXTRACTING") + "\n" + extractingFile, 400);
|
||||||
}
|
}
|
||||||
// Progressbar.
|
// Progressbar.
|
||||||
if (isScriptSelected == true) {
|
if (isScriptSelected == true) {
|
||||||
@@ -924,7 +925,7 @@ void displayProgressBar() {
|
|||||||
if (isScriptSelected == true) {
|
if (isScriptSelected == true) {
|
||||||
Gui::DrawStringCentered(0, 80, 0.6f, TextColor, str, 400);
|
Gui::DrawStringCentered(0, 80, 0.6f, TextColor, str, 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 80, 0.6f, Config::TxtColor, str, 400);
|
Gui::DrawStringCentered(0, 80, 0.6f, config->textColor(), str, 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isScriptSelected == true) {
|
if (isScriptSelected == true) {
|
||||||
|
|||||||
+20
-19
@@ -27,6 +27,7 @@
|
|||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
#include "gfx.hpp"
|
#include "gfx.hpp"
|
||||||
|
|
||||||
|
extern std::unique_ptr<Config> config;
|
||||||
extern bool isScriptSelected;
|
extern bool isScriptSelected;
|
||||||
extern u32 barColor;
|
extern u32 barColor;
|
||||||
extern u32 bgTopColor;
|
extern u32 bgTopColor;
|
||||||
@@ -36,10 +37,10 @@ extern u32 TextColor;
|
|||||||
void GFX::DrawTop(void) {
|
void GFX::DrawTop(void) {
|
||||||
Gui::ScreenDraw(Top);
|
Gui::ScreenDraw(Top);
|
||||||
if (isScriptSelected == false) {
|
if (isScriptSelected == false) {
|
||||||
Gui::Draw_Rect(0, 0, 400, 25, Config::Color1);
|
Gui::Draw_Rect(0, 0, 400, 25, config->barColor());
|
||||||
Gui::Draw_Rect(0, 25, 400, 190, Config::Color2);
|
Gui::Draw_Rect(0, 25, 400, 190, config->topBG());
|
||||||
Gui::Draw_Rect(0, 215, 400, 25, Config::Color1);
|
Gui::Draw_Rect(0, 215, 400, 25, config->barColor());
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
DrawSprite(sprites_top_screen_top_idx, 0, 0);
|
DrawSprite(sprites_top_screen_top_idx, 0, 0);
|
||||||
DrawSprite(sprites_top_screen_bot_idx, 0, 215);
|
DrawSprite(sprites_top_screen_bot_idx, 0, 215);
|
||||||
}
|
}
|
||||||
@@ -47,7 +48,7 @@ void GFX::DrawTop(void) {
|
|||||||
Gui::Draw_Rect(0, 0, 400, 30, barColor);
|
Gui::Draw_Rect(0, 0, 400, 30, barColor);
|
||||||
Gui::Draw_Rect(0, 25, 400, 190, bgBottomColor);
|
Gui::Draw_Rect(0, 25, 400, 190, bgBottomColor);
|
||||||
Gui::Draw_Rect(0, 215, 400, 25, barColor);
|
Gui::Draw_Rect(0, 215, 400, 25, barColor);
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
DrawSprite(sprites_top_screen_top_idx, 0, 0);
|
DrawSprite(sprites_top_screen_top_idx, 0, 0);
|
||||||
DrawSprite(sprites_top_screen_bot_idx, 0, 215);
|
DrawSprite(sprites_top_screen_bot_idx, 0, 215);
|
||||||
}
|
}
|
||||||
@@ -57,10 +58,10 @@ void GFX::DrawTop(void) {
|
|||||||
void GFX::DrawBottom(void) {
|
void GFX::DrawBottom(void) {
|
||||||
Gui::ScreenDraw(Bottom);
|
Gui::ScreenDraw(Bottom);
|
||||||
if (isScriptSelected == false) {
|
if (isScriptSelected == false) {
|
||||||
Gui::Draw_Rect(0, 0, 320, 25, Config::Color1);
|
Gui::Draw_Rect(0, 0, 320, 25, config->barColor());
|
||||||
Gui::Draw_Rect(0, 25, 320, 190, Config::Color3);
|
Gui::Draw_Rect(0, 25, 320, 190, config->bottomBG());
|
||||||
Gui::Draw_Rect(0, 215, 320, 25, Config::Color1);
|
Gui::Draw_Rect(0, 215, 320, 25, config->barColor());
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
DrawSprite(sprites_bottom_screen_top_idx, 0, 0);
|
DrawSprite(sprites_bottom_screen_top_idx, 0, 0);
|
||||||
DrawSprite(sprites_bottom_screen_bot_idx, 0, 215);
|
DrawSprite(sprites_bottom_screen_bot_idx, 0, 215);
|
||||||
}
|
}
|
||||||
@@ -68,7 +69,7 @@ void GFX::DrawBottom(void) {
|
|||||||
Gui::Draw_Rect(0, 0, 320, 30, barColor);
|
Gui::Draw_Rect(0, 0, 320, 30, barColor);
|
||||||
Gui::Draw_Rect(0, 25, 320, 190, bgBottomColor);
|
Gui::Draw_Rect(0, 25, 320, 190, bgBottomColor);
|
||||||
Gui::Draw_Rect(0, 215, 320, 25, barColor);
|
Gui::Draw_Rect(0, 215, 320, 25, barColor);
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
DrawSprite(sprites_bottom_screen_top_idx, 0, 0);
|
DrawSprite(sprites_bottom_screen_top_idx, 0, 0);
|
||||||
DrawSprite(sprites_bottom_screen_bot_idx, 0, 215);
|
DrawSprite(sprites_bottom_screen_bot_idx, 0, 215);
|
||||||
}
|
}
|
||||||
@@ -89,10 +90,10 @@ void GFX::DrawSpriteBlend(int img, int x, int y, float ScaleX, float ScaleY) {
|
|||||||
C2D_SetImageTint(&tint, C2D_BotLeft, TextColor, 0.5);
|
C2D_SetImageTint(&tint, C2D_BotLeft, TextColor, 0.5);
|
||||||
C2D_SetImageTint(&tint, C2D_BotRight, TextColor, 0.5);
|
C2D_SetImageTint(&tint, C2D_BotRight, TextColor, 0.5);
|
||||||
} else {
|
} else {
|
||||||
C2D_SetImageTint(&tint, C2D_TopLeft, Config::TxtColor, 0.5);
|
C2D_SetImageTint(&tint, C2D_TopLeft, config->textColor(), 0.5);
|
||||||
C2D_SetImageTint(&tint, C2D_TopRight, Config::TxtColor, 0.5);
|
C2D_SetImageTint(&tint, C2D_TopRight, config->textColor(), 0.5);
|
||||||
C2D_SetImageTint(&tint, C2D_BotLeft, Config::TxtColor, 0.5);
|
C2D_SetImageTint(&tint, C2D_BotLeft, config->textColor(), 0.5);
|
||||||
C2D_SetImageTint(&tint, C2D_BotRight, Config::TxtColor, 0.5);
|
C2D_SetImageTint(&tint, C2D_BotRight, config->textColor(), 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
C2D_DrawImageAt(C2D_SpriteSheetGetImage(sprites, img), x, y, 0.5f, &tint, ScaleX, ScaleY);
|
C2D_DrawImageAt(C2D_SpriteSheetGetImage(sprites, img), x, y, 0.5f, &tint, ScaleX, ScaleY);
|
||||||
@@ -107,10 +108,10 @@ void GFX::DrawArrow(int x, int y, float rotation, int arrowSprite) {
|
|||||||
C2D_SetImageTint(&tint, C2D_BotLeft, TextColor, 0.5);
|
C2D_SetImageTint(&tint, C2D_BotLeft, TextColor, 0.5);
|
||||||
C2D_SetImageTint(&tint, C2D_BotRight, TextColor, 0.5);
|
C2D_SetImageTint(&tint, C2D_BotRight, TextColor, 0.5);
|
||||||
} else {
|
} else {
|
||||||
C2D_SetImageTint(&tint, C2D_TopLeft, Config::TxtColor, 0.5);
|
C2D_SetImageTint(&tint, C2D_TopLeft, config->textColor(), 0.5);
|
||||||
C2D_SetImageTint(&tint, C2D_TopRight, Config::TxtColor, 0.5);
|
C2D_SetImageTint(&tint, C2D_TopRight, config->textColor(), 0.5);
|
||||||
C2D_SetImageTint(&tint, C2D_BotLeft, Config::TxtColor, 0.5);
|
C2D_SetImageTint(&tint, C2D_BotLeft, config->textColor(), 0.5);
|
||||||
C2D_SetImageTint(&tint, C2D_BotRight, Config::TxtColor, 0.5);
|
C2D_SetImageTint(&tint, C2D_BotRight, config->textColor(), 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arrowSprite == 0) {
|
if (arrowSprite == 0) {
|
||||||
@@ -138,6 +139,6 @@ void GFX::DrawButton(int x, int y, std::string ButtonText, u32 color) {
|
|||||||
if (isScriptSelected) {
|
if (isScriptSelected) {
|
||||||
Gui::DrawStringCentered(- (158/2) + x, y + (61/2) - (Gui::GetStringHeight(0.6f, ButtonText) / 2), 0.6f, TextColor, ButtonText, 145, 30);
|
Gui::DrawStringCentered(- (158/2) + x, y + (61/2) - (Gui::GetStringHeight(0.6f, ButtonText) / 2), 0.6f, TextColor, ButtonText, 145, 30);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(- (158/2) + x, y + (61/2) - (Gui::GetStringHeight(0.6f, ButtonText) / 2), 0.6f, Config::TxtColor, ButtonText, 145, 30);
|
Gui::DrawStringCentered(- (158/2) + x, y + (61/2) - (Gui::GetStringHeight(0.6f, ButtonText) / 2), 0.6f, config->textColor(), ButtonText, 145, 30);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+18
-17
@@ -8,6 +8,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
extern std::unique_ptr<Config> config;
|
||||||
extern C3D_RenderTarget* Top;
|
extern C3D_RenderTarget* Top;
|
||||||
extern C3D_RenderTarget* Bottom;
|
extern C3D_RenderTarget* Bottom;
|
||||||
|
|
||||||
@@ -80,21 +81,21 @@ extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
|||||||
|
|
||||||
void Input::DrawNumpad() {
|
void Input::DrawNumpad() {
|
||||||
for(uint i=0;i<(sizeof(NumpadStruct)/sizeof(NumpadStruct[0]));i++) {
|
for(uint i=0;i<(sizeof(NumpadStruct)/sizeof(NumpadStruct[0]));i++) {
|
||||||
Gui::Draw_Rect(NumpadStruct[i].x, NumpadStruct[i].y, 60, 50, Config::Color1);
|
Gui::Draw_Rect(NumpadStruct[i].x, NumpadStruct[i].y, 60, 50, config->barColor());
|
||||||
char c[2] = {NumpadStruct[i].character[0]};
|
char c[2] = {NumpadStruct[i].character[0]};
|
||||||
Gui::DrawString(NumpadStruct[i].x+25, NumpadStruct[i].y+15, 0.72f, Config::TxtColor, c, 50);
|
Gui::DrawString(NumpadStruct[i].x+25, NumpadStruct[i].y+15, 0.72f, config->textColor(), c, 50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Input::drawKeyboard() {
|
void Input::drawKeyboard() {
|
||||||
for(uint i=0;i<(sizeof(keysQWERTY)/sizeof(keysQWERTY[0]));i++) {
|
for(uint i=0;i<(sizeof(keysQWERTY)/sizeof(keysQWERTY[0]));i++) {
|
||||||
C2D_DrawRectSolid(keysQWERTY[i].x, keysQWERTY[i].y+103, 0.5f, 20, 20, Config::Color1 & C2D_Color32(255, 255, 255, 200));
|
C2D_DrawRectSolid(keysQWERTY[i].x, keysQWERTY[i].y+103, 0.5f, 20, 20, config->barColor() & C2D_Color32(255, 255, 255, 200));
|
||||||
if (shift) {
|
if (shift) {
|
||||||
char c[2] = {caps ? (char)toupper(keysQWERTYShift[i].character[0]) : keysQWERTYShift[i].character[0]};
|
char c[2] = {caps ? (char)toupper(keysQWERTYShift[i].character[0]) : keysQWERTYShift[i].character[0]};
|
||||||
Gui::DrawString(keysQWERTYShift[i].x+(10-(Gui::GetStringWidth(0.50, c)/2)), keysQWERTYShift[i].y+103+(10-(Gui::GetStringHeight(0.50, c)/2)), 0.50, Config::TxtColor, c);
|
Gui::DrawString(keysQWERTYShift[i].x+(10-(Gui::GetStringWidth(0.50, c)/2)), keysQWERTYShift[i].y+103+(10-(Gui::GetStringHeight(0.50, c)/2)), 0.50, config->textColor(), c);
|
||||||
} else {
|
} else {
|
||||||
char c[2] = {caps ? (char)toupper(keysQWERTY[i].character[0]) : keysQWERTY[i].character[0]};
|
char c[2] = {caps ? (char)toupper(keysQWERTY[i].character[0]) : keysQWERTY[i].character[0]};
|
||||||
Gui::DrawString(keysQWERTY[i].x+(10-(Gui::GetStringWidth(0.50, c)/2)), keysQWERTY[i].y+103+(10-(Gui::GetStringHeight(0.50, c)/2)), 0.50, Config::TxtColor, c);
|
Gui::DrawString(keysQWERTY[i].x+(10-(Gui::GetStringWidth(0.50, c)/2)), keysQWERTY[i].y+103+(10-(Gui::GetStringHeight(0.50, c)/2)), 0.50, config->textColor(), c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,13 +105,13 @@ void Input::drawKeyboard() {
|
|||||||
std::string backSpace = modifierKeys[0].character;
|
std::string backSpace = modifierKeys[0].character;
|
||||||
std::string caps = modifierKeys[1].character;
|
std::string caps = modifierKeys[1].character;
|
||||||
|
|
||||||
C2D_DrawRectSolid(modifierKeys[i].x, modifierKeys[i].y+103, 0.5f, modifierKeys[i].w, 20, Config::Color1 & C2D_Color32(255, 255, 255, 200));
|
C2D_DrawRectSolid(modifierKeys[i].x, modifierKeys[i].y+103, 0.5f, modifierKeys[i].w, 20, config->barColor() & C2D_Color32(255, 255, 255, 200));
|
||||||
Gui::DrawString(modifierKeys[2].x+5, modifierKeys[2].y+105, 0.50, Config::TxtColor, enter);
|
Gui::DrawString(modifierKeys[2].x+5, modifierKeys[2].y+105, 0.50, config->textColor(), enter);
|
||||||
Gui::DrawString(modifierKeys[3].x+7, modifierKeys[3].y+105, 0.45, Config::TxtColor, arrowUp);
|
Gui::DrawString(modifierKeys[3].x+7, modifierKeys[3].y+105, 0.45, config->textColor(), arrowUp);
|
||||||
Gui::DrawString(modifierKeys[4].x+10, modifierKeys[4].y+105, 0.45, Config::TxtColor, arrowUp);
|
Gui::DrawString(modifierKeys[4].x+10, modifierKeys[4].y+105, 0.45, config->textColor(), arrowUp);
|
||||||
|
|
||||||
Gui::DrawString(modifierKeys[0].x+5, modifierKeys[0].y+105, 0.45, Config::TxtColor, backSpace);
|
Gui::DrawString(modifierKeys[0].x+5, modifierKeys[0].y+105, 0.45, config->textColor(), backSpace);
|
||||||
Gui::DrawString(modifierKeys[1].x+5, modifierKeys[1].y+105, 0.45, Config::TxtColor, caps);
|
Gui::DrawString(modifierKeys[1].x+5, modifierKeys[1].y+105, 0.45, config->textColor(), caps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,11 +131,11 @@ std::string Input::Numpad(uint maxLength, std::string Text) {
|
|||||||
C2D_TargetClear(Top, BLACK);
|
C2D_TargetClear(Top, BLACK);
|
||||||
C2D_TargetClear(Bottom, BLACK);
|
C2D_TargetClear(Bottom, BLACK);
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
Gui::DrawString((400-Gui::GetStringWidth(0.55f, Text))/2, 2, 0.55f, Config::TxtColor, Text, 400);
|
Gui::DrawString((400-Gui::GetStringWidth(0.55f, Text))/2, 2, 0.55f, config->textColor(), Text, 400);
|
||||||
Gui::DrawString(180, 217, 0.8, Config::TxtColor, (string+(cursorBlink-- > 0 ? "_" : "")).c_str(), 400);
|
Gui::DrawString(180, 217, 0.8, config->textColor(), (string+(cursorBlink-- > 0 ? "_" : "")).c_str(), 400);
|
||||||
if (cursorBlink < -20) cursorBlink = 20;
|
if (cursorBlink < -20) cursorBlink = 20;
|
||||||
Gui::ScreenDraw(Bottom);
|
Gui::ScreenDraw(Bottom);
|
||||||
Gui::Draw_Rect(0, 0, 320, 240, Config::Color3);
|
Gui::Draw_Rect(0, 0, 320, 240, config->bottomBG());
|
||||||
DrawNumpad();
|
DrawNumpad();
|
||||||
scanKeys();
|
scanKeys();
|
||||||
hDown = keysDown();
|
hDown = keysDown();
|
||||||
@@ -211,11 +212,11 @@ std::string Input::getString(uint maxLength, std::string Text, float inputTextSi
|
|||||||
Gui::clearTextBufs();
|
Gui::clearTextBufs();
|
||||||
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
|
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
Gui::DrawString((400-Gui::GetStringWidth(0.55f, Text))/2, 2, 0.55f, Config::TxtColor, Text, 400);
|
Gui::DrawString((400-Gui::GetStringWidth(0.55f, Text))/2, 2, 0.55f, config->textColor(), Text, 400);
|
||||||
GFX::DrawBottom();
|
GFX::DrawBottom();
|
||||||
drawKeyboard();
|
drawKeyboard();
|
||||||
C2D_DrawRectSolid(0, 81, 0.5f, 320, 20, Config::Color1 & C2D_Color32(200, 200, 200, 200));
|
C2D_DrawRectSolid(0, 81, 0.5f, 320, 20, config->barColor() & C2D_Color32(200, 200, 200, 200));
|
||||||
Gui::DrawString(2, 82, inputTextSize, Config::TxtColor, (string+(cursorBlink-- > 0 ? "_" : "")).c_str(), 316);
|
Gui::DrawString(2, 82, inputTextSize, config->textColor(), (string+(cursorBlink-- > 0 ? "_" : "")).c_str(), 316);
|
||||||
if (cursorBlink < -20) cursorBlink = 20;
|
if (cursorBlink < -20) cursorBlink = 20;
|
||||||
scanKeys();
|
scanKeys();
|
||||||
hDown = keysDown();
|
hDown = keysDown();
|
||||||
|
|||||||
+16
-15
@@ -27,6 +27,7 @@
|
|||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
#include "msg.hpp"
|
#include "msg.hpp"
|
||||||
|
|
||||||
|
extern std::unique_ptr<Config> config;
|
||||||
extern bool isScriptSelected;
|
extern bool isScriptSelected;
|
||||||
|
|
||||||
extern u32 barColor;
|
extern u32 barColor;
|
||||||
@@ -41,15 +42,15 @@ void Msg::DisplayStartMSG() {
|
|||||||
C2D_TargetClear(Top, BLACK);
|
C2D_TargetClear(Top, BLACK);
|
||||||
C2D_TargetClear(Bottom, BLACK);
|
C2D_TargetClear(Bottom, BLACK);
|
||||||
Gui::ScreenDraw(Top);
|
Gui::ScreenDraw(Top);
|
||||||
Gui::Draw_Rect(0, 0, 400, 25, Config::Color1);
|
Gui::Draw_Rect(0, 0, 400, 25, config->barColor());
|
||||||
Gui::Draw_Rect(0, 25, 400, 190, Config::Color2);
|
Gui::Draw_Rect(0, 25, 400, 190, config->topBG());
|
||||||
Gui::Draw_Rect(0, 215, 400, 25, Config::Color1);
|
Gui::Draw_Rect(0, 215, 400, 25, config->barColor());
|
||||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("STARTING_UNIVERSAL_UPDATER"));
|
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), Lang::get("STARTING_UNIVERSAL_UPDATER"));
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
Gui::ScreenDraw(Bottom);
|
Gui::ScreenDraw(Bottom);
|
||||||
Gui::Draw_Rect(0, 0, 320, 25, Config::Color1);
|
Gui::Draw_Rect(0, 0, 320, 25, config->barColor());
|
||||||
Gui::Draw_Rect(0, 25, 320, 190, Config::Color2);
|
Gui::Draw_Rect(0, 25, 320, 190, config->topBG());
|
||||||
Gui::Draw_Rect(0, 215, 320, 25, Config::Color1);
|
Gui::Draw_Rect(0, 215, 320, 25, config->barColor());
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
C3D_FrameEnd(0);
|
C3D_FrameEnd(0);
|
||||||
}
|
}
|
||||||
@@ -61,7 +62,7 @@ void Msg::DisplayMsg(std::string text) {
|
|||||||
C2D_TargetClear(Bottom, BLACK);
|
C2D_TargetClear(Bottom, BLACK);
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
if (isScriptSelected == false) {
|
if (isScriptSelected == false) {
|
||||||
Gui::DrawStringCentered(0, (240-Gui::GetStringHeight(0.6f, text))/2, 0.6f, Config::TxtColor, text, 395, 70);
|
Gui::DrawStringCentered(0, (240-Gui::GetStringHeight(0.6f, text))/2, 0.6f, config->textColor(), text, 395, 70);
|
||||||
} else if (isScriptSelected == true) {
|
} else if (isScriptSelected == true) {
|
||||||
Gui::DrawStringCentered(0, (240-Gui::GetStringHeight(0.6f, text))/2, 0.6f, TextColor, text, 395, 70);
|
Gui::DrawStringCentered(0, (240-Gui::GetStringHeight(0.6f, text))/2, 0.6f, TextColor, text, 395, 70);
|
||||||
}
|
}
|
||||||
@@ -77,7 +78,7 @@ void Msg::DisplayWarnMsg(std::string Text) {
|
|||||||
C2D_TargetClear(Bottom, BLACK);
|
C2D_TargetClear(Bottom, BLACK);
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
if (isScriptSelected == false) {
|
if (isScriptSelected == false) {
|
||||||
Gui::DrawStringCentered(0, 1, 0.6f, Config::TxtColor, Text, 400);
|
Gui::DrawStringCentered(0, 1, 0.6f, config->textColor(), Text, 400);
|
||||||
} else if (isScriptSelected == true) {
|
} else if (isScriptSelected == true) {
|
||||||
Gui::DrawStringCentered(0, 1, 0.6f, TextColor, Text, 400);
|
Gui::DrawStringCentered(0, 1, 0.6f, TextColor, Text, 400);
|
||||||
}
|
}
|
||||||
@@ -106,8 +107,8 @@ bool Msg::promptMsg(std::string promptMsg) {
|
|||||||
C2D_TargetClear(Bottom, BLACK);
|
C2D_TargetClear(Bottom, BLACK);
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
if (isScriptSelected == false) {
|
if (isScriptSelected == false) {
|
||||||
Gui::DrawStringCentered(0, (240-Gui::GetStringHeight(0.6f, promptMsg))/2, 0.6f, Config::TxtColor, promptMsg, 395, 70);
|
Gui::DrawStringCentered(0, (240-Gui::GetStringHeight(0.6f, promptMsg))/2, 0.6f, config->textColor(), promptMsg, 395, 70);
|
||||||
Gui::DrawStringCentered(0, 217, 0.72f, Config::TxtColor, Lang::get("CONFIRM_OR_CANCEL"), 400);
|
Gui::DrawStringCentered(0, 217, 0.72f, config->textColor(), Lang::get("CONFIRM_OR_CANCEL"), 400);
|
||||||
} else if (isScriptSelected == true) {
|
} else if (isScriptSelected == true) {
|
||||||
Gui::DrawStringCentered(0, (240-Gui::GetStringHeight(0.6f, promptMsg))/2, 0.6f, TextColor, promptMsg, 395, 70);
|
Gui::DrawStringCentered(0, (240-Gui::GetStringHeight(0.6f, promptMsg))/2, 0.6f, TextColor, promptMsg, 395, 70);
|
||||||
Gui::DrawStringCentered(0, 217, 0.72f, TextColor, Lang::get("CONFIRM_OR_CANCEL"), 400);
|
Gui::DrawStringCentered(0, 217, 0.72f, TextColor, Lang::get("CONFIRM_OR_CANCEL"), 400);
|
||||||
@@ -115,10 +116,10 @@ bool Msg::promptMsg(std::string promptMsg) {
|
|||||||
|
|
||||||
GFX::DrawBottom();
|
GFX::DrawBottom();
|
||||||
if (isScriptSelected == false) {
|
if (isScriptSelected == false) {
|
||||||
Gui::Draw_Rect(10, 100, 140, 35, Config::Color1);
|
Gui::Draw_Rect(10, 100, 140, 35, config->barColor());
|
||||||
Gui::Draw_Rect(170, 100, 140, 35, Config::Color1);
|
Gui::Draw_Rect(170, 100, 140, 35, config->barColor());
|
||||||
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("YES")))/2-150+70, 110, 0.6f, Config::TxtColor, Lang::get("YES"), 140);
|
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("YES")))/2-150+70, 110, 0.6f, config->textColor(), Lang::get("YES"), 140);
|
||||||
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("NO")))/2+150-70, 110, 0.6f, Config::TxtColor, Lang::get("NO"), 140);
|
Gui::DrawString((320-Gui::GetStringWidth(0.6f, Lang::get("NO")))/2+150-70, 110, 0.6f, config->textColor(), Lang::get("NO"), 140);
|
||||||
} else if (isScriptSelected == true) {
|
} else if (isScriptSelected == true) {
|
||||||
Gui::Draw_Rect(10, 100, 140, 35, barColor);
|
Gui::Draw_Rect(10, 100, 140, 35, barColor);
|
||||||
Gui::Draw_Rect(170, 100, 140, 35, barColor);
|
Gui::Draw_Rect(170, 100, 140, 35, barColor);
|
||||||
|
|||||||
+19
-23
@@ -51,6 +51,7 @@ bool changesMade = false;
|
|||||||
|
|
||||||
// Include all spritesheet's.
|
// Include all spritesheet's.
|
||||||
C2D_SpriteSheet sprites;
|
C2D_SpriteSheet sprites;
|
||||||
|
std::unique_ptr<Config> config;
|
||||||
|
|
||||||
// If button Position pressed -> Do something.
|
// If button Position pressed -> Do something.
|
||||||
bool touching(touchPosition touch, Structs::ButtonPos button) {
|
bool touching(touchPosition touch, Structs::ButtonPos button) {
|
||||||
@@ -62,8 +63,8 @@ bool touching(touchPosition touch, Structs::ButtonPos button) {
|
|||||||
|
|
||||||
void Init::loadSoundEffects(void) {
|
void Init::loadSoundEffects(void) {
|
||||||
if (dspFound == true) {
|
if (dspFound == true) {
|
||||||
if( access( Config::MusicPath.c_str(), F_OK ) != -1 ) {
|
if (access(config->musicPath().c_str(), F_OK ) != -1) {
|
||||||
bgm = new sound(Config::MusicPath, 1, true);
|
bgm = new sound(config->musicPath(), 1, true);
|
||||||
songIsFound = true;
|
songIsFound = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,52 +97,50 @@ Result Init::Initialize() {
|
|||||||
mkdir("sdmc:/3ds/Universal-Updater/stores", 0777);
|
mkdir("sdmc:/3ds/Universal-Updater/stores", 0777);
|
||||||
|
|
||||||
// We need to make sure, the file exist.
|
// We need to make sure, the file exist.
|
||||||
if (access("sdmc:/3ds/Universal-Updater/Settings.json", F_OK) == -1 ) {
|
config = std::make_unique<Config>();
|
||||||
Config::initializeNewConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
Config::load();
|
Lang::load(config->language());
|
||||||
Lang::load(Config::lang);
|
|
||||||
|
|
||||||
if (Config::fading) {
|
if (config->screenFade()) {
|
||||||
fadein = true;
|
fadein = true;
|
||||||
fadealpha = 255;
|
fadealpha = 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
// In case it takes a bit longer to autoboot a script or so.
|
// In case it takes a bit longer to autoboot a script or so.
|
||||||
Msg::DisplayStartMSG();
|
Msg::DisplayStartMSG();
|
||||||
if (Config::Logging == true) {
|
if (config->logging() == true) {
|
||||||
Logging::createLogFile();
|
Logging::createLogFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
Gui::loadSheet("romfs:/gfx/sprites.t3x", sprites);
|
Gui::loadSheet("romfs:/gfx/sprites.t3x", sprites);
|
||||||
|
|
||||||
AutobootWhat = Config::autoboot;
|
AutobootWhat = config->autoboot();
|
||||||
|
|
||||||
if (Config::autoboot == 1) {
|
if (config->autoboot() == 1) {
|
||||||
if (access(Config::AutobootFile.c_str(), F_OK) == 0) {
|
if (access(config->autobootFile().c_str(), F_OK) == 0) {
|
||||||
Gui::setScreen(std::make_unique<UniStore>(true, Config::AutobootFile), false, true);
|
Gui::setScreen(std::make_unique<UniStore>(true, config->autobootFile()), false, true);
|
||||||
} else {
|
} else {
|
||||||
AutobootWhat = 0;
|
AutobootWhat = 0;
|
||||||
Config::autoboot = 0;
|
config->autoboot(0);
|
||||||
Gui::setScreen(std::make_unique<MainMenu>(), false, true);
|
Gui::setScreen(std::make_unique<MainMenu>(), false, true);
|
||||||
}
|
}
|
||||||
} else if (Config::autoboot == 2) {
|
} else if (config->autoboot() == 2) {
|
||||||
if (access(Config::AutobootFile.c_str(), F_OK) == 0) {
|
if (access(config->autobootFile().c_str(), F_OK) == 0) {
|
||||||
Gui::setScreen(std::make_unique<ScriptList>(), false, true);
|
Gui::setScreen(std::make_unique<ScriptList>(), false, true);
|
||||||
} else {
|
} else {
|
||||||
AutobootWhat = 0;
|
AutobootWhat = 0;
|
||||||
Config::autoboot = 0;
|
config->autoboot(0);
|
||||||
Gui::setScreen(std::make_unique<MainMenu>(), false, true);
|
Gui::setScreen(std::make_unique<MainMenu>(), false, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AutobootWhat = 0;
|
AutobootWhat = 0;
|
||||||
Config::autoboot = 0;
|
config->autoboot(0);
|
||||||
Gui::setScreen(std::make_unique<MainMenu>(), false, true);
|
Gui::setScreen(std::make_unique<MainMenu>(), false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
osSetSpeedupEnable(true); // Enable speed-up for New 3DS users
|
osSetSpeedupEnable(true); // Enable speed-up for New 3DS users
|
||||||
|
|
||||||
if( access( "sdmc:/3ds/dspfirm.cdc", F_OK ) != -1 ) {
|
if ( access( "sdmc:/3ds/dspfirm.cdc", F_OK ) != -1 ) {
|
||||||
ndspInit();
|
ndspInit();
|
||||||
dspFound = true;
|
dspFound = true;
|
||||||
loadSoundEffects();
|
loadSoundEffects();
|
||||||
@@ -188,10 +187,7 @@ Result Init::Exit() {
|
|||||||
ndspExit();
|
ndspExit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only save config, if *any* changes are made. (To reduce SD Writes.)
|
config->save();
|
||||||
if (changesMade) {
|
|
||||||
Config::save();
|
|
||||||
}
|
|
||||||
|
|
||||||
Gui::exit();
|
Gui::exit();
|
||||||
Gui::unloadSheet(sprites);
|
Gui::unloadSheet(sprites);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
extern std::unique_ptr<Config> config;
|
||||||
nlohmann::json appJson;
|
nlohmann::json appJson;
|
||||||
|
|
||||||
std::string Lang::get(const std::string &key) {
|
std::string Lang::get(const std::string &key) {
|
||||||
@@ -17,9 +18,9 @@ std::string langs[] = {"br", "da", "de", "en", "es", "fr", "it", "lt", "pl", "pt
|
|||||||
|
|
||||||
void Lang::load(const std::string lang) {
|
void Lang::load(const std::string lang) {
|
||||||
FILE* values;
|
FILE* values;
|
||||||
if (Config::LangPath == 1) {
|
if (config->langPath() == 1) {
|
||||||
// Check if exist.
|
// Check if exist.
|
||||||
if(access("sdmc:/3ds/Universal-Updater/app.json", F_OK) == 0 ) {
|
if (access("sdmc:/3ds/Universal-Updater/app.json", F_OK) == 0 ) {
|
||||||
values = fopen(("sdmc:/3ds/Universal-Updater/app.json"), "rt");
|
values = fopen(("sdmc:/3ds/Universal-Updater/app.json"), "rt");
|
||||||
appJson = nlohmann::json::parse(values, nullptr, false);
|
appJson = nlohmann::json::parse(values, nullptr, false);
|
||||||
fclose(values);
|
fclose(values);
|
||||||
@@ -34,7 +35,7 @@ void Lang::load(const std::string lang) {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Check if exist.
|
// Check if exist.
|
||||||
if(access(("romfs:/lang/" + lang + "/app.json").c_str(), F_OK) == 0 ) {
|
if (access(("romfs:/lang/" + lang + "/app.json").c_str(), F_OK) == 0 ) {
|
||||||
values = fopen(std::string(("romfs:/lang/" + lang + "/app.json")).c_str(), "rt");
|
values = fopen(std::string(("romfs:/lang/" + lang + "/app.json")).c_str(), "rt");
|
||||||
appJson = nlohmann::json::parse(values, nullptr, false);
|
appJson = nlohmann::json::parse(values, nullptr, false);
|
||||||
fclose(values);
|
fclose(values);
|
||||||
|
|||||||
+4
-3
@@ -24,12 +24,13 @@
|
|||||||
* reasonable ways as different from the original version.
|
* reasonable ways as different from the original version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.hpp"
|
||||||
#include "logging.hpp"
|
#include "logging.hpp"
|
||||||
|
|
||||||
#include "utils/config.hpp"
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
extern std::unique_ptr<Config> config;
|
||||||
|
|
||||||
std::string Logging::format(const std::string& fmt_str, ...) {
|
std::string Logging::format(const std::string& fmt_str, ...) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
char* fp = NULL;
|
char* fp = NULL;
|
||||||
@@ -57,7 +58,7 @@ void Logging::createLogFile(void) {
|
|||||||
|
|
||||||
// Only write to the Log, if it is enabled in the Settings File!
|
// Only write to the Log, if it is enabled in the Settings File!
|
||||||
void Logging::writeToLog(std::string debugText) {
|
void Logging::writeToLog(std::string debugText) {
|
||||||
if (Config::getBool("LOGGING")) {
|
if (config->logging()) {
|
||||||
std::ofstream logFile;
|
std::ofstream logFile;
|
||||||
logFile.open(("sdmc:/3ds/Universal-Updater/Log.log"), std::ofstream::app);
|
logFile.open(("sdmc:/3ds/Universal-Updater/Log.log"), std::ofstream::app);
|
||||||
std::string writeDebug = "[ ";
|
std::string writeDebug = "[ ";
|
||||||
|
|||||||
+28
-26
@@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include "credits.hpp"
|
#include "credits.hpp"
|
||||||
|
|
||||||
|
extern std::unique_ptr<Config> config;
|
||||||
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
||||||
// Language Page 1.
|
// Language Page 1.
|
||||||
const std::vector<std::string> Translators = {
|
const std::vector<std::string> Translators = {
|
||||||
@@ -83,22 +84,23 @@ void Credits::Draw(void) const {
|
|||||||
title += Lang::get("CREDITS");
|
title += Lang::get("CREDITS");
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
if (creditsPage != 3) {
|
if (creditsPage != 3) {
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, title, 400);
|
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), title, 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, title, 400);
|
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), title, 400);
|
||||||
}
|
}
|
||||||
Gui::DrawStringCentered(0, 30, 0.7f, Config::TxtColor, Lang::get("DEVELOPED_BY"), 390);
|
Gui::DrawStringCentered(0, 30, 0.7f, config->textColor(), Lang::get("DEVELOPED_BY"), 390);
|
||||||
Gui::DrawStringCentered(0, 60, 0.7f, Config::TxtColor, Lang::get("MAIN_DEV"), 390);
|
Gui::DrawStringCentered(0, 60, 0.7f, config->textColor(), Lang::get("MAIN_DEV"), 390);
|
||||||
GFX::DrawSprite(sprites_stackie_idx, 5, 85);
|
GFX::DrawSprite(sprites_stackie_idx, 5, 85);
|
||||||
GFX::DrawSprite(sprites_universal_core_idx, 200, 110);
|
GFX::DrawSprite(sprites_universal_core_idx, 200, 110);
|
||||||
std::string currentVersion = Lang::get("CURRENT_VERSION");
|
std::string currentVersion = Lang::get("CURRENT_VERSION");
|
||||||
currentVersion += V_STRING;
|
currentVersion += V_STRING;
|
||||||
Gui::DrawString(395-Gui::GetStringWidth(0.70f, currentVersion), 219, 0.70f, Config::TxtColor, currentVersion, 400);
|
Gui::DrawString(395-Gui::GetStringWidth(0.70f, currentVersion), 219, 0.70f, config->textColor(), currentVersion, 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(0, 0, 0, 190));
|
Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(0, 0, 0, 190));
|
||||||
GFX::DrawSprite(sprites_discord_idx, 115, 35);
|
GFX::DrawSprite(sprites_discord_idx, 115, 35);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
DrawBottom();
|
DrawBottom();
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
@@ -110,41 +112,41 @@ void Credits::DrawBottom(void) const {
|
|||||||
|
|
||||||
GFX::DrawBottom();
|
GFX::DrawBottom();
|
||||||
if (creditsPage == 0) {
|
if (creditsPage == 0) {
|
||||||
Gui::DrawStringCentered(0, -2, 0.7f, Config::TxtColor, Lang::get("TRANSLATORS"), 320);
|
Gui::DrawStringCentered(0, -2, 0.7f, config->textColor(), Lang::get("TRANSLATORS"), 320);
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)Translators.size();i++) {
|
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)Translators.size();i++) {
|
||||||
Gui::Draw_Rect(0, 40+(i*57), 320, 45, Config::UnselectedColor);
|
Gui::Draw_Rect(0, 40+(i*57), 320, 45, config->unselectedColor());
|
||||||
line1 = Translators[screenPos + i];
|
line1 = Translators[screenPos + i];
|
||||||
line2 = Languages[screenPos + i];
|
line2 = Languages[screenPos + i];
|
||||||
if (screenPos + i == Selection) {
|
if (screenPos + i == Selection) {
|
||||||
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, Config::SelectedColor);
|
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, config->selectedColor());
|
||||||
}
|
}
|
||||||
Gui::DrawStringCentered(0, 38+(i*57), 0.7f, Config::TxtColor, line1, 320);
|
Gui::DrawStringCentered(0, 38+(i*57), 0.7f, config->textColor(), line1, 320);
|
||||||
Gui::DrawStringCentered(0, 62+(i*57), 0.7f, Config::TxtColor, line2, 320);
|
Gui::DrawStringCentered(0, 62+(i*57), 0.7f, config->textColor(), line2, 320);
|
||||||
}
|
}
|
||||||
} else if (creditsPage == 1) {
|
} else if (creditsPage == 1) {
|
||||||
Gui::DrawStringCentered(0, -2, 0.7f, Config::TxtColor, "Universal-Team", 320);
|
Gui::DrawStringCentered(0, -2, 0.7f, config->textColor(), "Universal-Team", 320);
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)UniversalTeam.size();i++) {
|
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)UniversalTeam.size();i++) {
|
||||||
Gui::Draw_Rect(0, 40+(i*57), 320, 45, Config::UnselectedColor);
|
Gui::Draw_Rect(0, 40+(i*57), 320, 45, config->unselectedColor());
|
||||||
line1 = UniversalTeam[screenPos + i];
|
line1 = UniversalTeam[screenPos + i];
|
||||||
if (screenPos + i == Selection) {
|
if (screenPos + i == Selection) {
|
||||||
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, Config::SelectedColor);
|
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, config->selectedColor());
|
||||||
}
|
}
|
||||||
Gui::DrawStringCentered(0, 50+(i*57), 0.7f, WHITE, line1, 320);
|
Gui::DrawStringCentered(0, 50+(i*57), 0.7f, config->textColor(), line1, 320);
|
||||||
}
|
}
|
||||||
} else if (creditsPage == 2) {
|
} else if (creditsPage == 2) {
|
||||||
Gui::DrawStringCentered(0, -2, 0.7f, Config::TxtColor, Lang::get("SCRIPTCREATORS"), 320);
|
Gui::DrawStringCentered(0, -2, 0.7f, config->textColor(), Lang::get("SCRIPTCREATORS"), 320);
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)ScriptCreators.size();i++) {
|
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)ScriptCreators.size();i++) {
|
||||||
Gui::Draw_Rect(0, 40+(i*57), 320, 45, Config::UnselectedColor);
|
Gui::Draw_Rect(0, 40+(i*57), 320, 45, config->unselectedColor());
|
||||||
line1 = ScriptCreators[screenPos + i];
|
line1 = ScriptCreators[screenPos + i];
|
||||||
line2 = ScriptAmount[screenPos + i];
|
line2 = ScriptAmount[screenPos + i];
|
||||||
if (screenPos + i == Selection) {
|
if (screenPos + i == Selection) {
|
||||||
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, Config::SelectedColor);
|
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, config->selectedColor());
|
||||||
}
|
}
|
||||||
Gui::DrawStringCentered(0, 38+(i*57), 0.7f, Config::TxtColor, line1, 320);
|
Gui::DrawStringCentered(0, 38+(i*57), 0.7f, config->textColor(), line1, 320);
|
||||||
Gui::DrawStringCentered(0, 62+(i*57), 0.7f, Config::TxtColor, line2, 320);
|
Gui::DrawStringCentered(0, 62+(i*57), 0.7f, config->textColor(), line2, 320);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, -2, 0.55f, Config::TxtColor, Lang::get("LINK"), 320);
|
Gui::DrawStringCentered(0, -2, 0.55f, config->textColor(), Lang::get("LINK"), 320);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +162,7 @@ void Credits::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
Selection = 0;
|
Selection = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
} else if (creditsPage == 1) {
|
} else if (creditsPage == 1) {
|
||||||
if ((hHeld & KEY_DOWN && !keyRepeatDelay)) {
|
if ((hHeld & KEY_DOWN && !keyRepeatDelay)) {
|
||||||
@@ -170,7 +172,7 @@ void Credits::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
Selection = 0;
|
Selection = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
} else if (creditsPage == 2) {
|
} else if (creditsPage == 2) {
|
||||||
if ((hHeld & KEY_DOWN && !keyRepeatDelay)) {
|
if ((hHeld & KEY_DOWN && !keyRepeatDelay)) {
|
||||||
@@ -180,7 +182,7 @@ void Credits::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
Selection = 0;
|
Selection = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +198,7 @@ void Credits::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
Selection = (int)ScriptCreators.size()-1;
|
Selection = (int)ScriptCreators.size()-1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -215,7 +217,7 @@ void Credits::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_B) {
|
if (hDown & KEY_B) {
|
||||||
Gui::screenBack(Config::fading);
|
Gui::screenBack(config->screenFade());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ extern "C" {
|
|||||||
#include "ftp.h"
|
#include "ftp.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern std::unique_ptr<Config> config;
|
||||||
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
||||||
extern touchPosition touch;
|
extern touchPosition touch;
|
||||||
|
|
||||||
@@ -49,10 +50,10 @@ void FTPScreen::Draw(void) const {
|
|||||||
Gui::clearTextBufs();
|
Gui::clearTextBufs();
|
||||||
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
|
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawString((400-Gui::GetStringWidth(0.7f, Lang::get("FTP_MODE")))/2, 0, 0.7f, Config::TxtColor, Lang::get("FTP_MODE"), 400);
|
Gui::DrawString((400-Gui::GetStringWidth(0.7f, Lang::get("FTP_MODE")))/2, 0, 0.7f, config->textColor(), Lang::get("FTP_MODE"), 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawString((400-Gui::GetStringWidth(0.7f, Lang::get("FTP_MODE")))/2, 2, 0.7f, Config::TxtColor, Lang::get("FTP_MODE"), 400);
|
Gui::DrawString((400-Gui::GetStringWidth(0.7f, Lang::get("FTP_MODE")))/2, 2, 0.7f, config->textColor(), Lang::get("FTP_MODE"), 400);
|
||||||
}
|
}
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
GFX::DrawBottom();
|
GFX::DrawBottom();
|
||||||
@@ -60,22 +61,22 @@ void FTPScreen::Draw(void) const {
|
|||||||
ret = ACU_GetWifiStatus(&wifiStatus);
|
ret = ACU_GetWifiStatus(&wifiStatus);
|
||||||
|
|
||||||
if ((wifiStatus != 0) && R_SUCCEEDED(ret)) {
|
if ((wifiStatus != 0) && R_SUCCEEDED(ret)) {
|
||||||
Gui::DrawStringCentered(0, 40, 0.48f, Config::TxtColor, Lang::get("FTP_INITIALIZED"), 320);
|
Gui::DrawStringCentered(0, 40, 0.48f, config->textColor(), Lang::get("FTP_INITIALIZED"), 320);
|
||||||
snprintf(buf, 137, "IP: %s:5000", R_FAILED(ret)? Lang::get("FAILED_GET_IP").c_str() : hostname);
|
snprintf(buf, 137, "IP: %s:5000", R_FAILED(ret)? Lang::get("FAILED_GET_IP").c_str() : hostname);
|
||||||
|
|
||||||
if (strlen(ftp_accepted_connection) != 0)
|
if (strlen(ftp_accepted_connection) != 0)
|
||||||
Gui::DrawStringCentered(0, 80, 0.45f, Config::TxtColor, ftp_accepted_connection, 320);
|
Gui::DrawStringCentered(0, 80, 0.45f, config->textColor(), ftp_accepted_connection, 320);
|
||||||
|
|
||||||
if (strlen(ftp_file_transfer) != 0)
|
if (strlen(ftp_file_transfer) != 0)
|
||||||
Gui::DrawStringCentered(0, 150, 0.45f, Config::TxtColor, ftp_file_transfer, 320);
|
Gui::DrawStringCentered(0, 150, 0.45f, config->textColor(), ftp_file_transfer, 320);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Gui::DrawStringCentered(0, 40, 0.48f, Config::TxtColor, Lang::get("FAILED_INITIALIZE_FTP"), 320);
|
Gui::DrawStringCentered(0, 40, 0.48f, config->textColor(), Lang::get("FAILED_INITIALIZE_FTP"), 320);
|
||||||
snprintf(buf, 18, Lang::get("WIFI_NOT_ENABLED").c_str());
|
snprintf(buf, 18, Lang::get("WIFI_NOT_ENABLED").c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
Gui::DrawStringCentered(0, 60, 0.48, Config::TxtColor, buf, 320);
|
Gui::DrawStringCentered(0, 60, 0.48, config->textColor(), buf, 320);
|
||||||
Gui::DrawStringCentered(0, 222, 0.48f, Config::TxtColor, Lang::get("B_FTP_EXIT"), 320);
|
Gui::DrawStringCentered(0, 222, 0.48f, config->textColor(), Lang::get("B_FTP_EXIT"), 320);
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
Gui::clearTextBufs();
|
Gui::clearTextBufs();
|
||||||
C3D_FrameEnd(0);
|
C3D_FrameEnd(0);
|
||||||
|
|||||||
+15
-14
@@ -32,6 +32,7 @@
|
|||||||
#include "settings.hpp"
|
#include "settings.hpp"
|
||||||
#include "unistore.hpp"
|
#include "unistore.hpp"
|
||||||
|
|
||||||
|
extern std::unique_ptr<Config> config;
|
||||||
extern bool exiting;
|
extern bool exiting;
|
||||||
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
||||||
extern int fadealpha;
|
extern int fadealpha;
|
||||||
@@ -41,12 +42,12 @@ extern u32 TextColor;
|
|||||||
void MainMenu::Draw(void) const {
|
void MainMenu::Draw(void) const {
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
|
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
|
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||||
Gui::DrawString(397-Gui::GetStringWidth(0.5f, V_STRING), 239-Gui::GetStringHeight(0.5f, V_STRING), 0.5f, Config::TxtColor, V_STRING);
|
Gui::DrawString(397-Gui::GetStringWidth(0.5f, V_STRING), 239-Gui::GetStringHeight(0.5f, V_STRING), 0.5f, config->textColor(), V_STRING);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "Universal-Updater", 400);
|
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||||
Gui::DrawString(397-Gui::GetStringWidth(0.5f, V_STRING), 237-Gui::GetStringHeight(0.5f, V_STRING), 0.5f, Config::TxtColor, V_STRING);
|
Gui::DrawString(397-Gui::GetStringWidth(0.5f, V_STRING), 237-Gui::GetStringHeight(0.5f, V_STRING), 0.5f, config->textColor(), V_STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
@@ -73,10 +74,10 @@ void MainMenu::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Navigation.
|
// Navigation.
|
||||||
if(hDown & KEY_UP) {
|
if (hDown & KEY_UP) {
|
||||||
if(Selection > 1) Selection -= 2;
|
if(Selection > 1) Selection -= 2;
|
||||||
} else if(hDown & KEY_DOWN) {
|
} else if (hDown & KEY_DOWN) {
|
||||||
if(Selection < 3 && Selection != 2 && Selection != 3) Selection += 2;
|
if (Selection < 3 && Selection != 2 && Selection != 3) Selection += 2;
|
||||||
} else if (hDown & KEY_LEFT) {
|
} else if (hDown & KEY_LEFT) {
|
||||||
if (Selection%2) Selection--;
|
if (Selection%2) Selection--;
|
||||||
} else if (hDown & KEY_RIGHT) {
|
} else if (hDown & KEY_RIGHT) {
|
||||||
@@ -86,13 +87,13 @@ void MainMenu::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
if (hDown & KEY_A) {
|
if (hDown & KEY_A) {
|
||||||
switch(Selection) {
|
switch(Selection) {
|
||||||
case 0:
|
case 0:
|
||||||
Gui::setScreen(std::make_unique<UniStore>(false, "NOT_USED"), Config::fading, true);
|
Gui::setScreen(std::make_unique<UniStore>(false, "NOT_USED"), config->screenFade(), true);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
Gui::setScreen(std::make_unique<ScriptList>(), Config::fading, true);
|
Gui::setScreen(std::make_unique<ScriptList>(), config->screenFade(), true);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
Gui::setScreen(std::make_unique<Settings>(), Config::fading, true);
|
Gui::setScreen(std::make_unique<Settings>(), config->screenFade(), true);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
Gui::setScreen(std::make_unique<FTPScreen>(), false, true);
|
Gui::setScreen(std::make_unique<FTPScreen>(), false, true);
|
||||||
@@ -102,11 +103,11 @@ void MainMenu::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
|
|
||||||
if (hDown & KEY_TOUCH) {
|
if (hDown & KEY_TOUCH) {
|
||||||
if (touching(touch, mainButtons[0])) {
|
if (touching(touch, mainButtons[0])) {
|
||||||
Gui::setScreen(std::make_unique<UniStore>(false, "NOT_USED"), Config::fading, true);
|
Gui::setScreen(std::make_unique<UniStore>(false, "NOT_USED"), config->screenFade(), true);
|
||||||
} else if (touching(touch, mainButtons[1])) {
|
} else if (touching(touch, mainButtons[1])) {
|
||||||
Gui::setScreen(std::make_unique<ScriptList>(), Config::fading, true);
|
Gui::setScreen(std::make_unique<ScriptList>(), config->screenFade(), true);
|
||||||
} else if (touching(touch, mainButtons[2])) {
|
} else if (touching(touch, mainButtons[2])) {
|
||||||
Gui::setScreen(std::make_unique<Settings>(), Config::fading, true);
|
Gui::setScreen(std::make_unique<Settings>(), config->screenFade(), true);
|
||||||
} else if (touching(touch, mainButtons[3])) {
|
} else if (touching(touch, mainButtons[3])) {
|
||||||
Gui::setScreen(std::make_unique<FTPScreen>(), false, true);
|
Gui::setScreen(std::make_unique<FTPScreen>(), false, true);
|
||||||
}
|
}
|
||||||
|
|||||||
+130
-121
@@ -31,17 +31,18 @@
|
|||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
extern std::unique_ptr<Config> config;
|
||||||
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
||||||
extern void downloadFailed();
|
extern void downloadFailed();
|
||||||
|
|
||||||
void fixInfo(nlohmann::json &json) {
|
void fixInfo(nlohmann::json &json) {
|
||||||
for(uint i=0;i<json.size();i++) {
|
for(uint i = 0; i < json.size(); i++) {
|
||||||
if(!json[i].contains("title")) json[i]["title"] = "TITLE";
|
if (!json[i].contains("title")) json[i]["title"] = "TITLE";
|
||||||
if(!json[i].contains("author")) json[i]["author"] = "AUTHOR";
|
if (!json[i].contains("author")) json[i]["author"] = "AUTHOR";
|
||||||
if(!json[i].contains("shortDesc")) json[i]["shortDesc"] = "SHORTDESC";
|
if (!json[i].contains("shortDesc")) json[i]["shortDesc"] = "SHORTDESC";
|
||||||
if(!json[i].contains("revision")) json[i]["revision"] = 0;
|
if (!json[i].contains("revision")) json[i]["revision"] = 0;
|
||||||
if(!json[i].contains("curRevision")) json[i]["curRevision"] = -1;
|
if (!json[i].contains("curRevision")) json[i]["curRevision"] = -1;
|
||||||
if(!json[i].contains("version")) json[i]["revision"] = -1;
|
if (!json[i].contains("version")) json[i]["revision"] = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,18 +50,17 @@ nlohmann::json infoFromScript(const std::string &path) {
|
|||||||
nlohmann::json in, out;
|
nlohmann::json in, out;
|
||||||
|
|
||||||
FILE* file = fopen(path.c_str(), "r");
|
FILE* file = fopen(path.c_str(), "r");
|
||||||
if(!file) {
|
if (!file) return out;
|
||||||
return out;
|
|
||||||
}
|
|
||||||
in = nlohmann::json::parse(file, nullptr, false);
|
in = nlohmann::json::parse(file, nullptr, false);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
if(in.contains("info")) {
|
if (in.contains("info")) {
|
||||||
if(in["info"].contains("title") && in["info"]["title"].is_string()) out["title"] = in["info"]["title"];
|
if (in["info"].contains("title") && in["info"]["title"].is_string()) out["title"] = in["info"]["title"];
|
||||||
if(in["info"].contains("author") && in["info"]["author"].is_string()) out["author"] = in["info"]["author"];
|
if (in["info"].contains("author") && in["info"]["author"].is_string()) out["author"] = in["info"]["author"];
|
||||||
if(in["info"].contains("shortDesc") && in["info"]["shortDesc"].is_string()) out["shortDesc"] = in["info"]["shortDesc"];
|
if (in["info"].contains("shortDesc") && in["info"]["shortDesc"].is_string()) out["shortDesc"] = in["info"]["shortDesc"];
|
||||||
if(in["info"].contains("version") && in["info"]["version"].is_number()) out["version"] = in["info"]["version"];
|
if (in["info"].contains("version") && in["info"]["version"].is_number()) out["version"] = in["info"]["version"];
|
||||||
if(in["info"].contains("revision") && in["info"]["revision"].is_number()) out["revision"] = in["info"]["revision"];
|
if (in["info"].contains("revision") && in["info"]["revision"].is_number()) out["revision"] = in["info"]["revision"];
|
||||||
}
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
@@ -68,17 +68,18 @@ nlohmann::json infoFromScript(const std::string &path) {
|
|||||||
|
|
||||||
void findExistingFiles(nlohmann::json &json) {
|
void findExistingFiles(nlohmann::json &json) {
|
||||||
nlohmann::json current;
|
nlohmann::json current;
|
||||||
chdir(Config::ScriptPath.c_str());
|
chdir(config->scriptPath().c_str());
|
||||||
std::vector<DirEntry> dirContents;
|
std::vector<DirEntry> dirContents;
|
||||||
getDirectoryContents(dirContents);
|
getDirectoryContents(dirContents);
|
||||||
for(uint i=0;i<dirContents.size();i++) {
|
for(uint i = 0; i < dirContents.size(); i++) {
|
||||||
current[i] = infoFromScript(dirContents[i].name);
|
current[i] = infoFromScript(dirContents[i].name);
|
||||||
}
|
}
|
||||||
|
|
||||||
fixInfo(current);
|
fixInfo(current);
|
||||||
|
|
||||||
for(uint i=0;i<json.size();i++) {
|
for(uint i = 0; i < json.size(); i++) {
|
||||||
for(uint j=0;j<current.size();j++) {
|
for(uint j = 0; j < current.size(); j++) {
|
||||||
if(current[j]["title"] == json[i]["title"]) {
|
if (current[j]["title"] == json[i]["title"]) {
|
||||||
json[i]["curRevision"] = current[j]["revision"];
|
json[i]["curRevision"] = current[j]["revision"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,7 +97,7 @@ ScriptBrowse::ScriptBrowse() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FILE* file = fopen(metaFile, "r");
|
FILE* file = fopen(metaFile, "r");
|
||||||
if(file) {
|
if (file) {
|
||||||
infoJson = nlohmann::json::parse(file, nullptr, false);
|
infoJson = nlohmann::json::parse(file, nullptr, false);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
fixInfo(infoJson);
|
fixInfo(infoJson);
|
||||||
@@ -118,8 +119,9 @@ void ScriptBrowse::refresh() {
|
|||||||
loaded = false;
|
loaded = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE* file = fopen(metaFile, "r");
|
FILE* file = fopen(metaFile, "r");
|
||||||
if(file) {
|
if (file) {
|
||||||
infoJson = nlohmann::json::parse(file, nullptr, false);
|
infoJson = nlohmann::json::parse(file, nullptr, false);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
fixInfo(infoJson);
|
fixInfo(infoJson);
|
||||||
@@ -135,6 +137,7 @@ void ScriptBrowse::refresh() {
|
|||||||
notConnectedMsg();
|
notConnectedMsg();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptBrowse::Draw(void) const {
|
void ScriptBrowse::Draw(void) const {
|
||||||
if (mode == 0) {
|
if (mode == 0) {
|
||||||
DrawBrowse();
|
DrawBrowse();
|
||||||
@@ -150,24 +153,25 @@ void ScriptBrowse::DrawBrowse(void) const {
|
|||||||
revision += " | ";
|
revision += " | ";
|
||||||
revision += std::to_string(int64_t(infoJson[Selection]["revision"]));
|
revision += std::to_string(int64_t(infoJson[Selection]["revision"]));
|
||||||
|
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, revision), 239-Gui::GetStringHeight(0.6f, revision), 0.6f, Config::TxtColor, revision);
|
Gui::DrawString(397-Gui::GetStringWidth(0.6f, revision), 239-Gui::GetStringHeight(0.6f, revision), 0.6f, config->textColor(), revision);
|
||||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, std::string(infoJson[Selection]["title"]), 400);
|
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), std::string(infoJson[Selection]["title"]), 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, revision), 237-Gui::GetStringHeight(0.6f, revision), 0.6f, Config::TxtColor, revision);
|
Gui::DrawString(397-Gui::GetStringWidth(0.6f, revision), 237-Gui::GetStringHeight(0.6f, revision), 0.6f, config->textColor(), revision);
|
||||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, std::string(infoJson[Selection]["title"]), 400);
|
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), std::string(infoJson[Selection]["title"]), 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
Gui::DrawStringCentered(0, 120, 0.6f, Config::TxtColor, std::string(infoJson[Selection]["shortDesc"]), 400);
|
Gui::DrawStringCentered(0, 120, 0.6f, config->textColor(), std::string(infoJson[Selection]["shortDesc"]), 400);
|
||||||
if (infoJson[Selection]["curRevision"] == -1) {
|
if (infoJson[Selection]["curRevision"] == -1) {
|
||||||
Gui::DrawStringCentered(0, 219, 0.7f, Config::TxtColor, Lang::get("SCRIPT_NOT_FOUND"), 370);
|
Gui::DrawStringCentered(0, 219, 0.7f, config->textColor(), Lang::get("SCRIPT_NOT_FOUND"), 370);
|
||||||
} else if(infoJson[Selection]["curRevision"] < infoJson[Selection]["revision"]) {
|
} else if(infoJson[Selection]["curRevision"] < infoJson[Selection]["revision"]) {
|
||||||
Gui::DrawStringCentered(0, 219, 0.7f, Config::TxtColor, Lang::get("OUTDATED_SCRIPT"), 370);
|
Gui::DrawStringCentered(0, 219, 0.7f, config->textColor(), Lang::get("OUTDATED_SCRIPT"), 370);
|
||||||
} else if(infoJson[Selection]["curRevision"] == infoJson[Selection]["revision"]) {
|
} else if(infoJson[Selection]["curRevision"] == infoJson[Selection]["revision"]) {
|
||||||
Gui::DrawStringCentered(0, 219, 0.7f, Config::TxtColor, Lang::get("UP-TO-DATE"), 370);
|
Gui::DrawStringCentered(0, 219, 0.7f, config->textColor(), Lang::get("UP-TO-DATE"), 370);
|
||||||
} else if(infoJson[Selection]["curRevision"] > infoJson[Selection]["revision"]) {
|
} else if(infoJson[Selection]["curRevision"] > infoJson[Selection]["revision"]) {
|
||||||
Gui::DrawStringCentered(0, 219, 0.7f, Config::TxtColor, Lang::get("FUTURE_SCRIPT"), 370);
|
Gui::DrawStringCentered(0, 219, 0.7f, config->textColor(), Lang::get("FUTURE_SCRIPT"), 370);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
GFX::DrawBottom();
|
GFX::DrawBottom();
|
||||||
GFX::DrawArrow(295, -1);
|
GFX::DrawArrow(295, -1);
|
||||||
@@ -176,65 +180,66 @@ void ScriptBrowse::DrawBrowse(void) const {
|
|||||||
|
|
||||||
GFX::DrawSpriteBlend(sprites_dropdown_idx, arrowPos[3].x, arrowPos[3].y);
|
GFX::DrawSpriteBlend(sprites_dropdown_idx, arrowPos[3].x, arrowPos[3].y);
|
||||||
|
|
||||||
Gui::DrawStringCentered(0, 1, 0.6f, Config::TxtColor, std::to_string(Selection + 1) + " | " + std::to_string(maxScripts));
|
Gui::DrawStringCentered(0, 1, 0.6f, config->textColor(), std::to_string(Selection + 1) + " | " + std::to_string(maxScripts));
|
||||||
|
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)infoJson.size();i++) {
|
for(int i = 0; i < ENTRIES_PER_SCREEN && i < (int)infoJson.size(); i++) {
|
||||||
Gui::Draw_Rect(0, 40+(i*57), 320, 45, Config::UnselectedColor);
|
Gui::Draw_Rect(0, 40+(i*57), 320, 45, config->unselectedColor());
|
||||||
if(screenPos + i == Selection) {
|
if (screenPos + i == Selection) {
|
||||||
if (!dropDownMenu) {
|
if (!dropDownMenu) {
|
||||||
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, Config::SelectedColor);
|
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, config->selectedColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (infoJson[screenPos+i]["curRevision"] == -1) {
|
if (infoJson[screenPos+i]["curRevision"] == -1) {
|
||||||
Gui::Draw_Rect(295, 45+(i*59), 20, 20, Config::notFound);
|
Gui::Draw_Rect(295, 45+(i*59), 20, 20, config->notfoundColor());
|
||||||
} else if(infoJson[screenPos+i]["curRevision"] < infoJson[screenPos+i]["revision"]) {
|
} else if (infoJson[screenPos+i]["curRevision"] < infoJson[screenPos+i]["revision"]) {
|
||||||
Gui::Draw_Rect(295, 45+(i*59), 20, 20, Config::outdated);
|
Gui::Draw_Rect(295, 45+(i*59), 20, 20, config->outdatedColor());
|
||||||
} else if(infoJson[screenPos+i]["curRevision"] == infoJson[screenPos+i]["revision"]) {
|
} else if (infoJson[screenPos+i]["curRevision"] == infoJson[screenPos+i]["revision"]) {
|
||||||
Gui::Draw_Rect(295, 45+(i*59), 20, 20, Config::uptodate);
|
Gui::Draw_Rect(295, 45+(i*59), 20, 20, config->uptodateColor());
|
||||||
} else if(infoJson[screenPos+i]["curRevision"] > infoJson[screenPos+i]["revision"]) {
|
} else if (infoJson[screenPos+i]["curRevision"] > infoJson[screenPos+i]["revision"]) {
|
||||||
Gui::Draw_Rect(295, 45+(i*59), 20, 20, Config::future);
|
Gui::Draw_Rect(295, 45+(i*59), 20, 20, config->futureColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
Gui::DrawStringCentered(0, 38+(i*57), 0.7f, Config::TxtColor, infoJson[screenPos+i]["title"], 317);
|
Gui::DrawStringCentered(0, 38+(i*57), 0.7f, config->textColor(), infoJson[screenPos+i]["title"], 317);
|
||||||
Gui::DrawStringCentered(0, 62+(i*57), 0.7f, Config::TxtColor, infoJson[screenPos+i]["author"], 317);
|
Gui::DrawStringCentered(0, 62+(i*57), 0.7f, config->textColor(), infoJson[screenPos+i]["author"], 317);
|
||||||
}
|
}
|
||||||
} else if (Config::viewMode == 1) {
|
} else if (config->viewMode() == 1) {
|
||||||
for(int i=0;i<ENTRIES_PER_LIST && i<(int)infoJson.size();i++) {
|
for(int i = 0; i < ENTRIES_PER_LIST && i < (int)infoJson.size(); i++) {
|
||||||
Gui::Draw_Rect(0, (i+1)*27, 320, 25, Config::UnselectedColor);
|
Gui::Draw_Rect(0, (i+1)*27, 320, 25, config->unselectedColor());
|
||||||
if(screenPosList + i == Selection) {
|
if (screenPosList + i == Selection) {
|
||||||
if (!dropDownMenu) {
|
if (!dropDownMenu) {
|
||||||
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, Config::SelectedColor);
|
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, config->selectedColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Script not found.
|
// Script not found.
|
||||||
if (infoJson[screenPosList+i]["curRevision"] == -1) {
|
if (infoJson[screenPosList+i]["curRevision"] == -1) {
|
||||||
Gui::Draw_Rect(302, ((i+1)*27)+7, 11, 11, Config::notFound);
|
Gui::Draw_Rect(302, ((i+1)*27)+7, 11, 11, config->notfoundColor());
|
||||||
// Script outdaed.
|
// Script outdaed.
|
||||||
} else if(infoJson[screenPosList+i]["curRevision"] < infoJson[screenPosList+i]["revision"]) {
|
} else if (infoJson[screenPosList+i]["curRevision"] < infoJson[screenPosList+i]["revision"]) {
|
||||||
Gui::Draw_Rect(302, ((i+1)*27)+7, 11, 11, Config::outdated);
|
Gui::Draw_Rect(302, ((i+1)*27)+7, 11, 11, config->outdatedColor());
|
||||||
// Script up-to-date.
|
// Script up-to-date.
|
||||||
} else if(infoJson[screenPosList+i]["curRevision"] == infoJson[screenPosList+i]["revision"]) {
|
} else if (infoJson[screenPosList+i]["curRevision"] == infoJson[screenPosList+i]["revision"]) {
|
||||||
Gui::Draw_Rect(302, ((i+1)*27)+7, 11, 11, Config::uptodate);
|
Gui::Draw_Rect(302, ((i+1)*27)+7, 11, 11, config->uptodateColor());
|
||||||
// Future script.
|
// Future script.
|
||||||
} else if(infoJson[screenPosList+i]["curRevision"] > infoJson[screenPosList+i]["revision"]) {
|
} else if (infoJson[screenPosList+i]["curRevision"] > infoJson[screenPosList+i]["revision"]) {
|
||||||
Gui::Draw_Rect(302, ((i+1)*27)+7, 11, 11, Config::future);
|
Gui::Draw_Rect(302, ((i+1)*27)+7, 11, 11, config->futureColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, Config::TxtColor, infoJson[screenPosList+i]["title"], 317);
|
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, config->textColor(), infoJson[screenPosList+i]["title"], 317);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DropDown Menu.
|
// DropDown Menu.
|
||||||
if (dropDownMenu) {
|
if (dropDownMenu) {
|
||||||
// Draw Operation Box.
|
// Draw Operation Box.
|
||||||
Gui::Draw_Rect(0, 25, 140, 130, Config::Color1);
|
Gui::Draw_Rect(0, 25, 140, 130, config->barColor());
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
if (dropSelection == i) {
|
if (dropSelection == i) {
|
||||||
Gui::drawAnimatedSelector(dropPos2[i].x, dropPos2[i].y, dropPos2[i].w, dropPos2[i].h, .090, TRANSPARENT, Config::SelectedColor);
|
Gui::drawAnimatedSelector(dropPos2[i].x, dropPos2[i].y, dropPos2[i].w, dropPos2[i].h, .090, TRANSPARENT, config->selectedColor());
|
||||||
} else {
|
} else {
|
||||||
Gui::Draw_Rect(dropPos2[i].x, dropPos2[i].y, dropPos2[i].w, dropPos2[i].h, Config::UnselectedColor);
|
Gui::Draw_Rect(dropPos2[i].x, dropPos2[i].y, dropPos2[i].w, dropPos2[i].h, config->unselectedColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Draw Dropdown Icons.
|
// Draw Dropdown Icons.
|
||||||
@@ -242,9 +247,9 @@ void ScriptBrowse::DrawBrowse(void) const {
|
|||||||
GFX::DrawSpriteBlend(sprites_update_idx, dropPos[1].x, dropPos[1].y);
|
GFX::DrawSpriteBlend(sprites_update_idx, dropPos[1].x, dropPos[1].y);
|
||||||
GFX::DrawSpriteBlend(sprites_view_idx, dropPos[2].x, dropPos[2].y);
|
GFX::DrawSpriteBlend(sprites_view_idx, dropPos[2].x, dropPos[2].y);
|
||||||
// Dropdown Text.
|
// Dropdown Text.
|
||||||
Gui::DrawString(dropPos[0].x+30, dropPos[0].y+5, 0.4f, Config::TxtColor, Lang::get("DOWNLOAD_ALL_DDM"), 100);
|
Gui::DrawString(dropPos[0].x+30, dropPos[0].y+5, 0.4f, config->textColor(), Lang::get("DOWNLOAD_ALL_DDM"), 100);
|
||||||
Gui::DrawString(dropPos[1].x+30, dropPos[1].y+5, 0.4f, Config::TxtColor, Lang::get("REFRESH_BROWSE_DDM"), 100);
|
Gui::DrawString(dropPos[1].x+30, dropPos[1].y+5, 0.4f, config->textColor(), Lang::get("REFRESH_BROWSE_DDM"), 100);
|
||||||
Gui::DrawString(dropPos[2].x+30, dropPos[2].y+5, 0.4f, Config::TxtColor, Lang::get("VIEW_DDM"), 100);
|
Gui::DrawString(dropPos[2].x+30, dropPos[2].y+5, 0.4f, config->textColor(), Lang::get("VIEW_DDM"), 100);
|
||||||
}
|
}
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
} else {
|
} else {
|
||||||
@@ -257,42 +262,42 @@ void ScriptBrowse::DrawBrowse(void) const {
|
|||||||
void ScriptBrowse::DrawGlossary(void) const {
|
void ScriptBrowse::DrawGlossary(void) const {
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
if (loaded) {
|
if (loaded) {
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("GLOSSARY"), 400);
|
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), Lang::get("GLOSSARY"), 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("GLOSSARY"), 400);
|
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), Lang::get("GLOSSARY"), 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
Gui::Draw_Rect(20, 30, 30, 30, Config::notFound);
|
Gui::Draw_Rect(20, 30, 30, 30, config->notfoundColor());
|
||||||
Gui::DrawString(65, 35, 0.7f, Config::TxtColor, Lang::get("SCRIPT_NOT_FOUND"), 300);
|
Gui::DrawString(65, 35, 0.7f, config->textColor(), Lang::get("SCRIPT_NOT_FOUND"), 300);
|
||||||
|
|
||||||
Gui::Draw_Rect(20, 70, 30, 30, Config::outdated);
|
Gui::Draw_Rect(20, 70, 30, 30, config->outdatedColor());
|
||||||
Gui::DrawString(65, 75, 0.7f, Config::TxtColor, Lang::get("OUTDATED_SCRIPT"), 300);
|
Gui::DrawString(65, 75, 0.7f, config->textColor(), Lang::get("OUTDATED_SCRIPT"), 300);
|
||||||
|
|
||||||
Gui::Draw_Rect(20, 110, 30, 30, Config::uptodate);
|
Gui::Draw_Rect(20, 110, 30, 30, config->uptodateColor());
|
||||||
Gui::DrawString(65, 115, 0.7f, Config::TxtColor, Lang::get("UP-TO-DATE"), 300);
|
Gui::DrawString(65, 115, 0.7f, config->textColor(), Lang::get("UP-TO-DATE"), 300);
|
||||||
|
|
||||||
Gui::Draw_Rect(20, 150, 30, 30, Config::future);
|
Gui::Draw_Rect(20, 150, 30, 30, config->futureColor());
|
||||||
Gui::DrawString(65, 155, 0.7f, Config::TxtColor, Lang::get("FUTURE_SCRIPT"), 300);
|
Gui::DrawString(65, 155, 0.7f, config->textColor(), Lang::get("FUTURE_SCRIPT"), 300);
|
||||||
|
|
||||||
Gui::DrawString(15, 185, 0.7f, Config::TxtColor, std::to_string(int64_t(infoJson[Selection]["curRevision"])) + " | " + std::to_string(int64_t(infoJson[Selection]["revision"])), 40);
|
Gui::DrawString(15, 185, 0.7f, config->textColor(), std::to_string(int64_t(infoJson[Selection]["curRevision"])) + " | " + std::to_string(int64_t(infoJson[Selection]["revision"])), 40);
|
||||||
Gui::DrawString(65, 185, 0.7f, Config::TxtColor, Lang::get("REVISION"), 300);
|
Gui::DrawString(65, 185, 0.7f, config->textColor(), Lang::get("REVISION"), 300);
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
GFX::DrawBottom();
|
GFX::DrawBottom();
|
||||||
GFX::DrawSpriteBlend(sprites_download_all_idx, 20, 25);
|
GFX::DrawSpriteBlend(sprites_download_all_idx, 20, 25);
|
||||||
Gui::DrawString(50, 27, 0.6f, Config::TxtColor, Lang::get("DOWNLOAD_ALL"), 260);
|
Gui::DrawString(50, 27, 0.6f, config->textColor(), Lang::get("DOWNLOAD_ALL"), 260);
|
||||||
GFX::DrawSpriteBlend(sprites_view_idx, 20, 55);
|
GFX::DrawSpriteBlend(sprites_view_idx, 20, 55);
|
||||||
Gui::DrawString(50, 57, 0.6f, Config::TxtColor, Lang::get("CHANGE_VIEW_MODE"), 260);
|
Gui::DrawString(50, 57, 0.6f, config->textColor(), Lang::get("CHANGE_VIEW_MODE"), 260);
|
||||||
GFX::DrawArrow(20, 85);
|
GFX::DrawArrow(20, 85);
|
||||||
Gui::DrawString(50, 87, 0.6f, Config::TxtColor, Lang::get("ENTRY_UP"), 260);
|
Gui::DrawString(50, 87, 0.6f, config->textColor(), Lang::get("ENTRY_UP"), 260);
|
||||||
GFX::DrawArrow(42, 140, 180.0);
|
GFX::DrawArrow(42, 140, 180.0);
|
||||||
Gui::DrawString(50, 117, 0.6f, Config::TxtColor, Lang::get("ENTRY_DOWN"), 260);
|
Gui::DrawString(50, 117, 0.6f, config->textColor(), Lang::get("ENTRY_DOWN"), 260);
|
||||||
GFX::DrawArrow(20, 145, 0, 1);
|
GFX::DrawArrow(20, 145, 0, 1);
|
||||||
Gui::DrawString(50, 147, 0.6f, Config::TxtColor, Lang::get("GO_BACK"), 260);
|
Gui::DrawString(50, 147, 0.6f, config->textColor(), Lang::get("GO_BACK"), 260);
|
||||||
Gui::DrawString(10, 177, 0.6f, Config::TxtColor, std::to_string(Selection + 1) + " | " + std::to_string(maxScripts), 35);
|
Gui::DrawString(10, 177, 0.6f, config->textColor(), std::to_string(Selection + 1) + " | " + std::to_string(maxScripts), 35);
|
||||||
Gui::DrawString(50, 177, 0.6f, Config::TxtColor, Lang::get("ENTRY"), 260);
|
Gui::DrawString(50, 177, 0.6f, config->textColor(), Lang::get("ENTRY"), 260);
|
||||||
GFX::DrawSpriteBlend(sprites_update_idx, 20, 195);
|
GFX::DrawSpriteBlend(sprites_update_idx, 20, 195);
|
||||||
Gui::DrawString(50, 197, 0.6f, Config::TxtColor, Lang::get("REFRESH_SCRIPTBROWSE"), 260);
|
Gui::DrawString(50, 197, 0.6f, config->textColor(), Lang::get("REFRESH_SCRIPTBROWSE"), 260);
|
||||||
GFX::DrawArrow(0, 218, 0, 1);
|
GFX::DrawArrow(0, 218, 0, 1);
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
} else {
|
} else {
|
||||||
@@ -325,10 +330,10 @@ void ScriptBrowse::DropDownLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
refresh();
|
refresh();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
Config::viewMode = 1;
|
config->viewMode(1);
|
||||||
} else {
|
} else {
|
||||||
Config::viewMode = 0;
|
config->viewMode(0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -343,10 +348,10 @@ void ScriptBrowse::DropDownLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
refresh();
|
refresh();
|
||||||
dropDownMenu = false;
|
dropDownMenu = false;
|
||||||
} else if (touching(touch, dropPos2[2])) {
|
} else if (touching(touch, dropPos2[2])) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
Config::viewMode = 1;
|
config->viewMode(1);
|
||||||
} else {
|
} else {
|
||||||
Config::viewMode = 0;
|
config->viewMode(0);
|
||||||
}
|
}
|
||||||
dropDownMenu = false;
|
dropDownMenu = false;
|
||||||
}
|
}
|
||||||
@@ -366,8 +371,9 @@ void ScriptBrowse::downloadAll() {
|
|||||||
titleFix[l] = '-';
|
titleFix[l] = '-';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Msg::DisplayMsg(fileName + " " + std::to_string(current) + " / " + std::to_string(total));
|
Msg::DisplayMsg(fileName + " " + std::to_string(current) + " / " + std::to_string(total));
|
||||||
downloadToFile(infoJson[i]["url"], Config::ScriptPath + titleFix + ".json");
|
downloadToFile(infoJson[i]["url"], config->scriptPath() + titleFix + ".json");
|
||||||
infoJson[i]["curRevision"] = infoJson[i]["revision"];
|
infoJson[i]["curRevision"] = infoJson[i]["revision"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -380,9 +386,10 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
DropDownLogic(hDown, hHeld, touch);
|
DropDownLogic(hDown, hHeld, touch);
|
||||||
} else {
|
} else {
|
||||||
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
||||||
Gui::screenBack(Config::fading);
|
Gui::screenBack(config->screenFade());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == 0) {
|
if (mode == 0) {
|
||||||
if ((hHeld & KEY_DOWN && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[1]))) {
|
if ((hHeld & KEY_DOWN && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[1]))) {
|
||||||
if (Selection < (int)infoJson.size()-1) {
|
if (Selection < (int)infoJson.size()-1) {
|
||||||
@@ -391,11 +398,11 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
Selection = 0;
|
Selection = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hHeld & KEY_RIGHT && !keyRepeatDelay)) {
|
if ((hHeld & KEY_RIGHT && !keyRepeatDelay)) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
if (Selection < (int)infoJson.size()-1-3) {
|
if (Selection < (int)infoJson.size()-1-3) {
|
||||||
Selection += 3;
|
Selection += 3;
|
||||||
} else {
|
} else {
|
||||||
@@ -409,11 +416,11 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hHeld & KEY_LEFT && !keyRepeatDelay)) {
|
if ((hHeld & KEY_LEFT && !keyRepeatDelay)) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
if (Selection > 2) {
|
if (Selection > 2) {
|
||||||
Selection -= 3;
|
Selection -= 3;
|
||||||
} else {
|
} else {
|
||||||
@@ -427,7 +434,7 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hDown & KEY_SELECT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[3]))) {
|
if ((hDown & KEY_SELECT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[3]))) {
|
||||||
@@ -441,13 +448,13 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
Selection = (int)infoJson.size()-1;
|
Selection = (int)infoJson.size()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_TOUCH) {
|
if (hDown & KEY_TOUCH) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)infoJson.size();i++) {
|
for(int i = 0; i < ENTRIES_PER_SCREEN && i < (int)infoJson.size(); i++) {
|
||||||
if(touch.py > 40+(i*57) && touch.py < 40+(i*57)+45) {
|
if (touch.py > 40+(i*57) && touch.py < 40+(i*57)+45) {
|
||||||
if (infoJson.size() != 0) {
|
if (infoJson.size() != 0) {
|
||||||
std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[screenPos + i]["title"]);
|
std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[screenPos + i]["title"]);
|
||||||
std::string titleFix = infoJson[screenPos + i]["title"];
|
std::string titleFix = infoJson[screenPos + i]["title"];
|
||||||
@@ -455,16 +462,17 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
if (titleFix[l] == '/') {
|
if (titleFix[l] == '/') {
|
||||||
titleFix[l] = '-';
|
titleFix[l] = '-';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Msg::DisplayMsg(fileName);
|
Msg::DisplayMsg(fileName);
|
||||||
downloadToFile(infoJson[screenPos + i]["url"], Config::ScriptPath + titleFix + ".json");
|
downloadToFile(infoJson[screenPos + i]["url"], config->scriptPath() + titleFix + ".json");
|
||||||
infoJson[screenPos + i]["curRevision"] = infoJson[screenPos + i]["revision"];
|
infoJson[screenPos + i]["curRevision"] = infoJson[screenPos + i]["revision"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (Config::viewMode == 1) {
|
} else if (config->viewMode() == 1) {
|
||||||
for(int i=0;i<ENTRIES_PER_LIST && i<(int)infoJson.size();i++) {
|
for(int i = 0; i < ENTRIES_PER_LIST && i < (int)infoJson.size(); i++) {
|
||||||
if(touch.py > (i+1)*27 && touch.py < (i+2)*27) {
|
if (touch.py > (i+1)*27 && touch.py < (i+2)*27) {
|
||||||
if (infoJson.size() != 0) {
|
if (infoJson.size() != 0) {
|
||||||
std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[screenPosList + i]["title"]);
|
std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[screenPosList + i]["title"]);
|
||||||
std::string titleFix = infoJson[screenPosList + i]["title"];
|
std::string titleFix = infoJson[screenPosList + i]["title"];
|
||||||
@@ -473,8 +481,9 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
titleFix[l] = '-';
|
titleFix[l] = '-';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Msg::DisplayMsg(fileName);
|
Msg::DisplayMsg(fileName);
|
||||||
downloadToFile(infoJson[screenPosList + i]["url"], Config::ScriptPath + titleFix + ".json");
|
downloadToFile(infoJson[screenPosList + i]["url"], config->scriptPath() + titleFix + ".json");
|
||||||
infoJson[screenPosList + i]["curRevision"] = infoJson[screenPosList + i]["revision"];
|
infoJson[screenPosList + i]["curRevision"] = infoJson[screenPosList + i]["revision"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -486,26 +495,26 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
if (infoJson.size() != 0) {
|
if (infoJson.size() != 0) {
|
||||||
std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[Selection]["title"]);
|
std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[Selection]["title"]);
|
||||||
|
|
||||||
std::string titleFix = infoJson[Selection]["title"];
|
std::string titleFix = infoJson[Selection]["title"];
|
||||||
for (int i = 0; i < (int)titleFix.size(); i++) {
|
for (int i = 0; i < (int)titleFix.size(); i++) {
|
||||||
if (titleFix[i] == '/') {
|
if (titleFix[i] == '/') {
|
||||||
titleFix[i] = '-';
|
titleFix[i] = '-';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Msg::DisplayMsg(fileName);
|
|
||||||
|
|
||||||
downloadToFile(infoJson[Selection]["url"], Config::ScriptPath + titleFix + ".json");
|
Msg::DisplayMsg(fileName);
|
||||||
|
downloadToFile(infoJson[Selection]["url"], config->scriptPath() + titleFix + ".json");
|
||||||
infoJson[Selection]["curRevision"] = infoJson[Selection]["revision"];
|
infoJson[Selection]["curRevision"] = infoJson[Selection]["revision"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
if(Selection < screenPos) {
|
if(Selection < screenPos) {
|
||||||
screenPos = Selection;
|
screenPos = Selection;
|
||||||
} else if (Selection > screenPos + ENTRIES_PER_SCREEN - 1) {
|
} else if (Selection > screenPos + ENTRIES_PER_SCREEN - 1) {
|
||||||
screenPos = Selection - ENTRIES_PER_SCREEN + 1;
|
screenPos = Selection - ENTRIES_PER_SCREEN + 1;
|
||||||
}
|
}
|
||||||
} else if (Config::viewMode == 1) {
|
} else if (config->viewMode() == 1) {
|
||||||
if(Selection < screenPosList) {
|
if(Selection < screenPosList) {
|
||||||
screenPosList = Selection;
|
screenPosList = Selection;
|
||||||
} else if (Selection > screenPosList + ENTRIES_PER_LIST - 1) {
|
} else if (Selection > screenPosList + ENTRIES_PER_LIST - 1) {
|
||||||
@@ -521,7 +530,7 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (hDown & KEY_B) {
|
if (hDown & KEY_B) {
|
||||||
Gui::screenBack(Config::fading);
|
Gui::screenBack(config->screenFade());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
* reasonable ways as different from the original version.
|
* reasonable ways as different from the original version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "utils/fileBrowse.hpp"
|
#include "fileBrowse.hpp"
|
||||||
#include "keyboard.hpp"
|
#include "keyboard.hpp"
|
||||||
#include "logging.hpp"
|
#include "logging.hpp"
|
||||||
#include "scriptCreator.hpp"
|
#include "scriptCreator.hpp"
|
||||||
@@ -32,14 +32,15 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
extern std::unique_ptr<Config> config;
|
||||||
// The to editing script.
|
// The to editing script.
|
||||||
nlohmann::json editScript;
|
nlohmann::json editScript;
|
||||||
std::string entryName = ""; // So we can set to *that* entry.
|
std::string entryName = ""; // So we can set to *that* entry.
|
||||||
|
|
||||||
void ScriptCreator::openJson(std::string fileName) {
|
void ScriptCreator::openJson(std::string fileName) {
|
||||||
std::string scriptFile = Config::ScriptPath + fileName;
|
std::string scriptFile = config->scriptPath() + fileName;
|
||||||
FILE* file = fopen(scriptFile.c_str(), "r");
|
FILE* file = fopen(scriptFile.c_str(), "r");
|
||||||
if(file) editScript = nlohmann::json::parse(file, nullptr, false);
|
if (file) editScript = nlohmann::json::parse(file, nullptr, false);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,71 +79,73 @@ void ScriptCreator::Draw(void) const {
|
|||||||
|
|
||||||
void ScriptCreator::DrawSubMenu(void) const {
|
void ScriptCreator::DrawSubMenu(void) const {
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("SCRIPTCREATOR"), 400);
|
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), Lang::get("SCRIPTCREATOR"), 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("SCRIPTCREATOR"), 400);
|
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), Lang::get("SCRIPTCREATOR"), 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
GFX::DrawBottom();
|
GFX::DrawBottom();
|
||||||
|
|
||||||
for (int i = 0; i < 2; 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 {
|
||||||
Gui::Draw_Rect(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, Config::UnselectedColor);
|
Gui::Draw_Rect(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, config->unselectedColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "New script"))/2, mainButtons[0].y+10, 0.6f, Config::TxtColor, "New script", 140);
|
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "New script"))/2, mainButtons[0].y+10, 0.6f, config->textColor(), "New script", 140);
|
||||||
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "Existing script"))/2, mainButtons[1].y+10, 0.6f, Config::TxtColor, "Existing script", 140);
|
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "Existing script"))/2, mainButtons[1].y+10, 0.6f, config->textColor(), "Existing script", 140);
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptCreator::DrawScriptScreen(void) const {
|
void ScriptCreator::DrawScriptScreen(void) const {
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Selected Entry: " + entryName, 400);
|
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), "Selected Entry: " + entryName, 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "Selected Entry: " + entryName, 400);
|
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), "Selected Entry: " + entryName, 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
GFX::DrawBottom();
|
GFX::DrawBottom();
|
||||||
|
|
||||||
// Draw Page.
|
// Draw Page.
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
if (i == page) {
|
if (i == page) {
|
||||||
Gui::DrawString(260, 3, 0.6f, Config::TxtColor, std::to_string(i+1) + " / 2", 140);
|
Gui::DrawString(260, 3, 0.6f, config->textColor(), std::to_string(i+1) + " / 2", 140);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (page == 0) {
|
if (page == 0) {
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
if (Selection == i) {
|
if (Selection == i) {
|
||||||
Gui::Draw_Rect(creatorButtons[i].x, creatorButtons[i].y, creatorButtons[i].w, creatorButtons[i].h, Config::SelectedColor);
|
Gui::Draw_Rect(creatorButtons[i].x, creatorButtons[i].y, creatorButtons[i].w, creatorButtons[i].h, config->selectedColor());
|
||||||
} else {
|
} else {
|
||||||
Gui::Draw_Rect(creatorButtons[i].x, creatorButtons[i].y, creatorButtons[i].w, creatorButtons[i].h, Config::UnselectedColor);
|
Gui::Draw_Rect(creatorButtons[i].x, creatorButtons[i].y, creatorButtons[i].w, creatorButtons[i].h, config->unselectedColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "downloadRelease"))/2-150+70, creatorButtons[0].y+10, 0.6f, Config::TxtColor, "downloadRelease", 140);
|
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "downloadRelease"))/2-150+70, creatorButtons[0].y+10, 0.6f, config->textColor(), "downloadRelease", 140);
|
||||||
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "downloadFile"))/2+150-70, creatorButtons[1].y+10, 0.6f, Config::TxtColor, "downloadFile", 140);
|
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "downloadFile"))/2+150-70, creatorButtons[1].y+10, 0.6f, config->textColor(), "downloadFile", 140);
|
||||||
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "deleteFile"))/2-150+70, creatorButtons[2].y+10, 0.6f, Config::TxtColor, "deleteFile", 140);
|
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "deleteFile"))/2-150+70, creatorButtons[2].y+10, 0.6f, config->textColor(), "deleteFile", 140);
|
||||||
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "extractFile"))/2+150-70, creatorButtons[3].y+10, 0.6f, Config::TxtColor, "extractFile", 140);
|
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "extractFile"))/2+150-70, creatorButtons[3].y+10, 0.6f, config->textColor(), "extractFile", 140);
|
||||||
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "installCia"))/2-150+70, creatorButtons[4].y+10, 0.6f, Config::TxtColor, "installCia", 140);
|
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "installCia"))/2-150+70, creatorButtons[4].y+10, 0.6f, config->textColor(), "installCia", 140);
|
||||||
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "mkdir"))/2+150-70, creatorButtons[5].y+10, 0.6f, Config::TxtColor, "mkdir", 140);
|
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "mkdir"))/2+150-70, creatorButtons[5].y+10, 0.6f, config->textColor(), "mkdir", 140);
|
||||||
} else if (page == 1) {
|
} else if (page == 1) {
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
if (Selection == i) {
|
if (Selection == i) {
|
||||||
Gui::Draw_Rect(creatorButtons[i].x, creatorButtons[i].y, creatorButtons[i].w, creatorButtons[i].h, Config::SelectedColor);
|
Gui::Draw_Rect(creatorButtons[i].x, creatorButtons[i].y, creatorButtons[i].w, creatorButtons[i].h, config->selectedColor());
|
||||||
} else {
|
} else {
|
||||||
Gui::Draw_Rect(creatorButtons[i].x, creatorButtons[i].y, creatorButtons[i].w, creatorButtons[i].h, Config::UnselectedColor);
|
Gui::Draw_Rect(creatorButtons[i].x, creatorButtons[i].y, creatorButtons[i].w, creatorButtons[i].h, config->unselectedColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "rmdir"))/2-150+70, creatorButtons[0].y+10, 0.6f, Config::TxtColor, "rmdir", 140);
|
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "rmdir"))/2-150+70, creatorButtons[0].y+10, 0.6f, config->textColor(), "rmdir", 140);
|
||||||
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "mkfile"))/2+150-70, creatorButtons[1].y+10, 0.6f, Config::TxtColor, "mkfile", 140);
|
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "mkfile"))/2+150-70, creatorButtons[1].y+10, 0.6f, config->textColor(), "mkfile", 140);
|
||||||
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "TimeMsg"))/2-150+70, creatorButtons[2].y+10, 0.6f, Config::TxtColor, "TimeMsg", 140);
|
Gui::DrawString((320-Gui::GetStringWidth(0.6f, "TimeMsg"))/2-150+70, creatorButtons[2].y+10, 0.6f, config->textColor(), "TimeMsg", 140);
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -286,14 +289,14 @@ void ScriptCreator::setInfoStuff(void) {
|
|||||||
|
|
||||||
void ScriptCreator::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
void ScriptCreator::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
if (hDown & KEY_B) {
|
if (hDown & KEY_B) {
|
||||||
Gui::screenBack(Config::fading);
|
Gui::screenBack(config->screenFade());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_A) {
|
if (hDown & KEY_A) {
|
||||||
switch(Selection) {
|
switch(Selection) {
|
||||||
case 0:
|
case 0:
|
||||||
jsonFileName = Config::ScriptPath;
|
jsonFileName = config->scriptPath();
|
||||||
jsonFileName += Input::getString(20, "Enter the name of the JSON file.");
|
jsonFileName += Input::getString(20, "Enter the name of the JSON file.");
|
||||||
if (jsonFileName != "") {
|
if (jsonFileName != "") {
|
||||||
jsonFileName += ".json";
|
jsonFileName += ".json";
|
||||||
@@ -305,7 +308,7 @@ void ScriptCreator::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
std::string tempScript = selectFilePath("Select the Script file.", Config::ScriptPath, {"json"}, 2);
|
std::string tempScript = selectFilePath("Select the Script file.", config->scriptPath(), {"json"}, 2);
|
||||||
if (tempScript != "") {
|
if (tempScript != "") {
|
||||||
jsonFileName = tempScript;
|
jsonFileName = tempScript;
|
||||||
if(access(jsonFileName.c_str(), F_OK) != -1 ) {
|
if(access(jsonFileName.c_str(), F_OK) != -1 ) {
|
||||||
@@ -339,27 +342,34 @@ void ScriptCreator::scriptLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
// Page 1.
|
// Page 1.
|
||||||
if (page == 0) {
|
if (page == 0) {
|
||||||
if (hDown & KEY_UP) {
|
if (hDown & KEY_UP) {
|
||||||
if(Selection > 1) Selection -= 2;
|
if (Selection > 1) Selection -= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_DOWN) {
|
if (hDown & KEY_DOWN) {
|
||||||
if(Selection < 4) Selection += 2;
|
if (Selection < 4) Selection += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_LEFT) {
|
if (hDown & KEY_LEFT) {
|
||||||
if (Selection%2) Selection--;
|
if (Selection%2) Selection--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_RIGHT) {
|
if (hDown & KEY_RIGHT) {
|
||||||
if (!(Selection%2)) Selection++;
|
if (!(Selection%2)) Selection++;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (page == 1) {
|
} else if (page == 1) {
|
||||||
if (hDown & KEY_UP) {
|
if (hDown & KEY_UP) {
|
||||||
if (Selection == 2) Selection = 0;
|
if (Selection == 2) Selection = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_RIGHT) {
|
if (hDown & KEY_RIGHT) {
|
||||||
if (Selection == 0) Selection = 1;
|
if (Selection == 0) Selection = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_LEFT) {
|
if (hDown & KEY_LEFT) {
|
||||||
if (Selection == 1) Selection = 0;
|
if (Selection == 1) Selection = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_DOWN) {
|
if (hDown & KEY_DOWN) {
|
||||||
if (Selection == 0) Selection = 2;
|
if (Selection == 0) Selection = 2;
|
||||||
}
|
}
|
||||||
|
|||||||
+221
-208
@@ -35,6 +35,7 @@
|
|||||||
#include <regex>
|
#include <regex>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
extern std::unique_ptr<Config> config;
|
||||||
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
||||||
extern bool checkWifiStatus(void);
|
extern bool checkWifiStatus(void);
|
||||||
extern void notImplemented(void);
|
extern void notImplemented(void);
|
||||||
@@ -45,10 +46,11 @@ extern bool changesMade;
|
|||||||
// Parse the script for the list.
|
// Parse the script for the list.
|
||||||
ScriptInfo parseInfo(std::string fileName) {
|
ScriptInfo parseInfo(std::string fileName) {
|
||||||
FILE* file = fopen(fileName.c_str(), "rt");
|
FILE* file = fopen(fileName.c_str(), "rt");
|
||||||
if(!file) {
|
if (!file) {
|
||||||
printf("File not found\n");
|
printf("File not found.\n");
|
||||||
return {"", ""};
|
return {"", ""};
|
||||||
}
|
}
|
||||||
|
|
||||||
nlohmann::json json = nlohmann::json::parse(file, nullptr, false);
|
nlohmann::json json = nlohmann::json::parse(file, nullptr, false);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
@@ -74,7 +76,7 @@ void ScriptList::checkForValidate(void) {
|
|||||||
nlohmann::json ScriptList::openScriptFile() {
|
nlohmann::json ScriptList::openScriptFile() {
|
||||||
FILE* file = fopen(currentFile.c_str(), "rt");
|
FILE* file = fopen(currentFile.c_str(), "rt");
|
||||||
nlohmann::json jsonFile;
|
nlohmann::json jsonFile;
|
||||||
if(file) jsonFile = nlohmann::json::parse(file, nullptr, false);
|
if (file) jsonFile = nlohmann::json::parse(file, nullptr, false);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
return jsonFile;
|
return jsonFile;
|
||||||
}
|
}
|
||||||
@@ -82,19 +84,21 @@ nlohmann::json ScriptList::openScriptFile() {
|
|||||||
// Parse the objects from a script.
|
// Parse the objects from a script.
|
||||||
std::vector<std::string> parseObjects(std::string fileName) {
|
std::vector<std::string> parseObjects(std::string fileName) {
|
||||||
FILE* file = fopen(fileName.c_str(), "rt");
|
FILE* file = fopen(fileName.c_str(), "rt");
|
||||||
if(!file) {
|
if (!file) {
|
||||||
printf("File not found\n");
|
printf("File not found.\n");
|
||||||
return {{""}};
|
return {{""}};
|
||||||
}
|
}
|
||||||
|
|
||||||
nlohmann::json json = nlohmann::json::parse(file, nullptr, false);
|
nlohmann::json json = nlohmann::json::parse(file, nullptr, false);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
std::vector<std::string> objs;
|
std::vector<std::string> objs;
|
||||||
for(auto it = json.begin();it != json.end(); it++) {
|
for(auto it = json.begin(); it != json.end(); it++) {
|
||||||
if(it.key() != "info") {
|
if (it.key() != "info") {
|
||||||
objs.push_back(it.key());
|
objs.push_back(it.key());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return objs;
|
return objs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +113,7 @@ std::string Description(nlohmann::json &json) {
|
|||||||
|
|
||||||
// Return the color for the script.
|
// Return the color for the script.
|
||||||
u32 getColor(std::string colorString) {
|
u32 getColor(std::string colorString) {
|
||||||
if(colorString.length() < 7 || std::regex_search(colorString.substr(1), std::regex("[^0-9a-f]"))) { // invalid color
|
if (colorString.length() < 7 || std::regex_search(colorString.substr(1), std::regex("[^0-9a-f]"))) { // invalid color
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,34 +136,35 @@ u32 progressBar;
|
|||||||
void loadColors(nlohmann::json &json) {
|
void loadColors(nlohmann::json &json) {
|
||||||
u32 colorTemp;
|
u32 colorTemp;
|
||||||
colorTemp = getColor(ScriptHelper::getString(json, "info", "barColor"));
|
colorTemp = getColor(ScriptHelper::getString(json, "info", "barColor"));
|
||||||
barColor = colorTemp == 0 ? Config::Color1 : colorTemp;
|
barColor = colorTemp == 0 ? config->barColor() : colorTemp;
|
||||||
|
|
||||||
colorTemp = getColor(ScriptHelper::getString(json, "info", "bgTopColor"));
|
colorTemp = getColor(ScriptHelper::getString(json, "info", "bgTopColor"));
|
||||||
bgTopColor = colorTemp == 0 ? Config::Color2 : colorTemp;
|
bgTopColor = colorTemp == 0 ? config->topBG() : colorTemp;
|
||||||
|
|
||||||
colorTemp = getColor(ScriptHelper::getString(json, "info", "bgBottomColor"));
|
colorTemp = getColor(ScriptHelper::getString(json, "info", "bgBottomColor"));
|
||||||
bgBottomColor = colorTemp == 0 ? Config::Color3 : colorTemp;
|
bgBottomColor = colorTemp == 0 ? config->bottomBG() : colorTemp;
|
||||||
|
|
||||||
colorTemp = getColor(ScriptHelper::getString(json, "info", "textColor"));
|
colorTemp = getColor(ScriptHelper::getString(json, "info", "textColor"));
|
||||||
TextColor = colorTemp == 0 ? Config::TxtColor : colorTemp;
|
TextColor = colorTemp == 0 ? config->textColor() : colorTemp;
|
||||||
|
|
||||||
colorTemp = getColor(ScriptHelper::getString(json, "info", "selectedColor"));
|
colorTemp = getColor(ScriptHelper::getString(json, "info", "selectedColor"));
|
||||||
selected = colorTemp == 0 ? Config::SelectedColor : colorTemp;
|
selected = colorTemp == 0 ? config->selectedColor() : colorTemp;
|
||||||
|
|
||||||
colorTemp = getColor(ScriptHelper::getString(json, "info", "unselectedColor"));
|
colorTemp = getColor(ScriptHelper::getString(json, "info", "unselectedColor"));
|
||||||
unselected = colorTemp == 0 ? Config::UnselectedColor : colorTemp;
|
unselected = colorTemp == 0 ? config->unselectedColor() : colorTemp;
|
||||||
|
|
||||||
colorTemp = getColor(ScriptHelper::getString(json, "info", "progressbarColor"));
|
colorTemp = getColor(ScriptHelper::getString(json, "info", "progressbarColor"));
|
||||||
progressBar = colorTemp == 0 ? Config::progressbarColor : colorTemp;
|
progressBar = colorTemp == 0 ? config->progressbarColor() : colorTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptList::DrawSubMenu(void) const {
|
void ScriptList::DrawSubMenu(void) const {
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("SCRIPTS_SUBMENU"), 400);
|
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), Lang::get("SCRIPTS_SUBMENU"), 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("SCRIPTS_SUBMENU"), 400);
|
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), Lang::get("SCRIPTS_SUBMENU"), 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
GFX::DrawBottom();
|
GFX::DrawBottom();
|
||||||
GFX::DrawArrow(0, 218, 0, 1);
|
GFX::DrawArrow(0, 218, 0, 1);
|
||||||
@@ -168,6 +173,7 @@ void ScriptList::DrawSubMenu(void) const {
|
|||||||
GFX::DrawButton(subPos[1].x, subPos[1].y, Lang::get("GET_SCRIPTS"));
|
GFX::DrawButton(subPos[1].x, subPos[1].y, Lang::get("GET_SCRIPTS"));
|
||||||
GFX::DrawButton(subPos[2].x, subPos[2].y, Lang::get("SCRIPTCREATOR"));
|
GFX::DrawButton(subPos[2].x, subPos[2].y, Lang::get("SCRIPTCREATOR"));
|
||||||
GFX::DrawButton(subPos[3].x, subPos[3].y, Lang::get("CHANGE_SCRIPTPATH"));
|
GFX::DrawButton(subPos[3].x, subPos[3].y, Lang::get("CHANGE_SCRIPTPATH"));
|
||||||
|
|
||||||
// Selector.
|
// Selector.
|
||||||
Animation::Button(subPos[Selection].x, subPos[Selection].y, .060);
|
Animation::Button(subPos[Selection].x, subPos[Selection].y, .060);
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
@@ -180,6 +186,7 @@ void ScriptList::loadDesc(void) {
|
|||||||
lines.push_back(Desc.substr(0, Desc.find('\n')));
|
lines.push_back(Desc.substr(0, Desc.find('\n')));
|
||||||
Desc = Desc.substr(Desc.find('\n')+1);
|
Desc = Desc.substr(Desc.find('\n')+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
lines.push_back(Desc.substr(0, Desc.find('\n')));
|
lines.push_back(Desc.substr(0, Desc.find('\n')));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,15 +197,15 @@ bool changeBackHandle = false;
|
|||||||
ScriptList::ScriptList() {
|
ScriptList::ScriptList() {
|
||||||
if (AutobootWhat == 2) {
|
if (AutobootWhat == 2) {
|
||||||
// If Script isn't found, go to MainMenu.
|
// If Script isn't found, go to MainMenu.
|
||||||
if (access(Config::AutobootFile.c_str(), F_OK) != 0) {
|
if (access(config->autobootFile().c_str(), F_OK) != 0) {
|
||||||
AutobootWhat = 0;
|
AutobootWhat = 0;
|
||||||
changeBackHandle = true;
|
changeBackHandle = true;
|
||||||
Gui::setScreen(std::make_unique<MainMenu>(), Config::fading, true);
|
Gui::setScreen(std::make_unique<MainMenu>(), config->screenFade(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ScriptHelper::checkIfValid(Config::AutobootFile) == true) {
|
if (ScriptHelper::checkIfValid(config->autobootFile()) == true) {
|
||||||
ScriptInfo fI = parseInfo(Config::AutobootFile);
|
ScriptInfo fI = parseInfo(config->autobootFile());
|
||||||
currentFile = Config::AutobootFile;
|
currentFile = config->autobootFile();
|
||||||
selectedTitle = fI.title;
|
selectedTitle = fI.title;
|
||||||
jsonFile = openScriptFile();
|
jsonFile = openScriptFile();
|
||||||
Desc = Description(jsonFile);
|
Desc = Description(jsonFile);
|
||||||
@@ -214,7 +221,7 @@ ScriptList::ScriptList() {
|
|||||||
} else {
|
} else {
|
||||||
AutobootWhat = 0;
|
AutobootWhat = 0;
|
||||||
changeBackHandle = true;
|
changeBackHandle = true;
|
||||||
Gui::setScreen(std::make_unique<MainMenu>(), Config::fading, true);
|
Gui::setScreen(std::make_unique<MainMenu>(), config->screenFade(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -224,16 +231,17 @@ void ScriptList::DrawList(void) const {
|
|||||||
std::string line2;
|
std::string line2;
|
||||||
std::string scriptAmount = std::to_string(Selection +1) + " | " + std::to_string(fileInfo.size());
|
std::string scriptAmount = std::to_string(Selection +1) + " | " + std::to_string(fileInfo.size());
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
|
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, scriptAmount), 239-Gui::GetStringHeight(0.6f, scriptAmount), 0.6f, Config::TxtColor, scriptAmount);
|
Gui::DrawString(397-Gui::GetStringWidth(0.6f, scriptAmount), 239-Gui::GetStringHeight(0.6f, scriptAmount), 0.6f, config->textColor(), scriptAmount);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "Universal-Updater", 400);
|
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, scriptAmount), 237-Gui::GetStringHeight(0.6f, scriptAmount), 0.6f, Config::TxtColor, scriptAmount);
|
Gui::DrawString(397-Gui::GetStringWidth(0.6f, scriptAmount), 237-Gui::GetStringHeight(0.6f, scriptAmount), 0.6f, config->textColor(), scriptAmount);
|
||||||
}
|
}
|
||||||
Gui::DrawStringCentered(0, 80, 0.7f, Config::TxtColor, Lang::get("TITLE") + std::string(fileInfo[Selection].title), 400);
|
|
||||||
Gui::DrawStringCentered(0, 100, 0.7f, Config::TxtColor, Lang::get("AUTHOR") + std::string(fileInfo[Selection].author), 400);
|
Gui::DrawStringCentered(0, 80, 0.7f, config->textColor(), Lang::get("TITLE") + std::string(fileInfo[Selection].title), 400);
|
||||||
Gui::DrawStringCentered(0, 120, 0.6f, Config::TxtColor, std::string(fileInfo[Selection].shortDesc), 400);
|
Gui::DrawStringCentered(0, 100, 0.7f, config->textColor(), Lang::get("AUTHOR") + std::string(fileInfo[Selection].author), 400);
|
||||||
|
Gui::DrawStringCentered(0, 120, 0.6f, config->textColor(), std::string(fileInfo[Selection].shortDesc), 400);
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
GFX::DrawBottom();
|
GFX::DrawBottom();
|
||||||
GFX::DrawArrow(295, -1);
|
GFX::DrawArrow(295, -1);
|
||||||
@@ -241,49 +249,49 @@ void ScriptList::DrawList(void) const {
|
|||||||
GFX::DrawArrow(0, 218, 0, 1);
|
GFX::DrawArrow(0, 218, 0, 1);
|
||||||
GFX::DrawSpriteBlend(sprites_dropdown_idx, arrowPos[3].x, arrowPos[3].y);
|
GFX::DrawSpriteBlend(sprites_dropdown_idx, arrowPos[3].x, arrowPos[3].y);
|
||||||
|
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)fileInfo.size();i++) {
|
for(int i = 0; i < ENTRIES_PER_SCREEN && i < (int)fileInfo.size(); i++) {
|
||||||
Gui::Draw_Rect(0, 40+(i*57), 320, 45, Config::UnselectedColor);
|
Gui::Draw_Rect(0, 40+(i*57), 320, 45, config->unselectedColor());
|
||||||
line1 = fileInfo[screenPos + i].title;
|
line1 = fileInfo[screenPos + i].title;
|
||||||
line2 = fileInfo[screenPos + i].author;
|
line2 = fileInfo[screenPos + i].author;
|
||||||
if(screenPos + i == Selection) {
|
if (screenPos + i == Selection) {
|
||||||
if (!dropDownMenu) {
|
if (!dropDownMenu) {
|
||||||
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, Config::SelectedColor);
|
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, config->selectedColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Gui::DrawStringCentered(0, 38+(i*57), 0.7f, Config::TxtColor, line1, 320);
|
Gui::DrawStringCentered(0, 38+(i*57), 0.7f, config->textColor(), line1, 320);
|
||||||
Gui::DrawStringCentered(0, 62+(i*57), 0.7f, Config::TxtColor, line2, 320);
|
Gui::DrawStringCentered(0, 62+(i*57), 0.7f, config->textColor(), line2, 320);
|
||||||
}
|
}
|
||||||
} else if (Config::viewMode == 1) {
|
} else if (config->viewMode() == 1) {
|
||||||
for(int i=0;i<ENTRIES_PER_LIST && i<(int)fileInfo.size();i++) {
|
for(int i = 0; i < ENTRIES_PER_LIST && i < (int)fileInfo.size();i++) {
|
||||||
Gui::Draw_Rect(0, (i+1)*27, 320, 25, Config::UnselectedColor);
|
Gui::Draw_Rect(0, (i+1)*27, 320, 25, config->unselectedColor());
|
||||||
line1 = fileInfo[screenPosList + i].title;
|
line1 = fileInfo[screenPosList + i].title;
|
||||||
if(screenPosList + i == Selection) {
|
if (screenPosList + i == Selection) {
|
||||||
if (!dropDownMenu) {
|
if (!dropDownMenu) {
|
||||||
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, Config::SelectedColor);
|
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, config->selectedColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, Config::TxtColor, line1, 320);
|
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, config->textColor(), line1, 320);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DropDown Menu.
|
// DropDown Menu.
|
||||||
if (dropDownMenu) {
|
if (dropDownMenu) {
|
||||||
// Draw Operation Box.
|
// Draw Operation Box.
|
||||||
Gui::Draw_Rect(0, 25, 140, 87, Config::Color1);
|
Gui::Draw_Rect(0, 25, 140, 87, config->barColor());
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
if (dropSelection == i) {
|
if (dropSelection == i) {
|
||||||
Gui::drawAnimatedSelector(dropPos2[i].x, dropPos2[i].y, dropPos2[i].w, dropPos2[i].h, .090, TRANSPARENT, Config::SelectedColor);
|
Gui::drawAnimatedSelector(dropPos2[i].x, dropPos2[i].y, dropPos2[i].w, dropPos2[i].h, .090, TRANSPARENT, config->selectedColor());
|
||||||
} else {
|
} else {
|
||||||
Gui::Draw_Rect(dropPos2[i].x, dropPos2[i].y, dropPos2[i].w, dropPos2[i].h, Config::UnselectedColor);
|
Gui::Draw_Rect(dropPos2[i].x, dropPos2[i].y, dropPos2[i].w, dropPos2[i].h, config->unselectedColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Draw Dropdown Icons.
|
// Draw Dropdown Icons.
|
||||||
GFX::DrawSpriteBlend(sprites_delete_idx, dropPos[0].x, dropPos[0].y);
|
GFX::DrawSpriteBlend(sprites_delete_idx, dropPos[0].x, dropPos[0].y);
|
||||||
GFX::DrawSpriteBlend(sprites_view_idx, dropPos[1].x, dropPos[1].y);
|
GFX::DrawSpriteBlend(sprites_view_idx, dropPos[1].x, dropPos[1].y);
|
||||||
// Dropdown Text.
|
// Dropdown Text.
|
||||||
Gui::DrawString(dropPos[0].x+30, dropPos[0].y+5, 0.4f, Config::TxtColor, Lang::get("DELETE_DDM"), 100);
|
Gui::DrawString(dropPos[0].x+30, dropPos[0].y+5, 0.4f, config->textColor(), Lang::get("DELETE_DDM"), 100);
|
||||||
Gui::DrawString(dropPos[1].x+30, dropPos[1].y+5, 0.4f, Config::TxtColor, Lang::get("VIEW_DDM"), 100);
|
Gui::DrawString(dropPos[1].x+30, dropPos[1].y+5, 0.4f, config->textColor(), Lang::get("VIEW_DDM"), 100);
|
||||||
}
|
}
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
}
|
}
|
||||||
@@ -304,16 +312,19 @@ void ScriptList::DrawSingleObject(void) const {
|
|||||||
std::string info;
|
std::string info;
|
||||||
std::string entryAmount = std::to_string(Selection+1) + " | " + std::to_string(fileInfo2.size());
|
std::string entryAmount = std::to_string(Selection+1) + " | " + std::to_string(fileInfo2.size());
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
if (Config::UseBars == true) {
|
|
||||||
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.7f, TextColor, selectedTitle, 400);
|
Gui::DrawStringCentered(0, 0, 0.7f, TextColor, selectedTitle, 400);
|
||||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), 239-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, Config::TxtColor, entryAmount);
|
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), 239-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, TextColor, entryAmount);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 2, 0.7f, TextColor, selectedTitle, 400);
|
Gui::DrawStringCentered(0, 2, 0.7f, TextColor, selectedTitle, 400);
|
||||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), 237-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, Config::TxtColor, entryAmount);
|
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), 237-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, TextColor, entryAmount);
|
||||||
}
|
}
|
||||||
for(uint i=0;i<lines.size();i++) {
|
|
||||||
|
for(uint i = 0; i < lines.size(); i++) {
|
||||||
Gui::DrawStringCentered(0, 120-((lines.size()*20)/2)+i*20, 0.6f, TextColor, lines[i], 400);
|
Gui::DrawStringCentered(0, 120-((lines.size()*20)/2)+i*20, 0.6f, TextColor, lines[i], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
GFX::DrawBottom();
|
GFX::DrawBottom();
|
||||||
GFX::DrawArrow(295, -1);
|
GFX::DrawArrow(295, -1);
|
||||||
@@ -321,11 +332,11 @@ void ScriptList::DrawSingleObject(void) const {
|
|||||||
GFX::DrawArrow(0, 218, 0, 1);
|
GFX::DrawArrow(0, 218, 0, 1);
|
||||||
GFX::DrawSpriteBlend(sprites_dropdown_idx, arrowPos[3].x, arrowPos[3].y);
|
GFX::DrawSpriteBlend(sprites_dropdown_idx, arrowPos[3].x, arrowPos[3].y);
|
||||||
|
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)fileInfo2.size();i++) {
|
for(int i = 0; i < ENTRIES_PER_SCREEN && i < (int)fileInfo2.size(); i++) {
|
||||||
Gui::Draw_Rect(0, 40+(i*57), 320, 45, unselected);
|
Gui::Draw_Rect(0, 40+(i*57), 320, 45, unselected);
|
||||||
info = fileInfo2[screenPos + i];
|
info = fileInfo2[screenPos + i];
|
||||||
if(screenPos + i == Selection) {
|
if (screenPos + i == Selection) {
|
||||||
if (!dropDownMenu) {
|
if (!dropDownMenu) {
|
||||||
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, selected);
|
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, selected);
|
||||||
}
|
}
|
||||||
@@ -333,11 +344,11 @@ void ScriptList::DrawSingleObject(void) const {
|
|||||||
Gui::DrawStringCentered(0, 50+(i*57), 0.7f, TextColor, info, 320);
|
Gui::DrawStringCentered(0, 50+(i*57), 0.7f, TextColor, info, 320);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (Config::viewMode == 1) {
|
} else if (config->viewMode() == 1) {
|
||||||
for(int i=0;i<ENTRIES_PER_LIST && i<(int)fileInfo2.size();i++) {
|
for(int i = 0; i < ENTRIES_PER_LIST && i < (int)fileInfo2.size(); i++) {
|
||||||
Gui::Draw_Rect(0, (i+1)*27, 320, 25, unselected);
|
Gui::Draw_Rect(0, (i+1)*27, 320, 25, unselected);
|
||||||
info = fileInfo2[screenPosList + i];
|
info = fileInfo2[screenPosList + i];
|
||||||
if(screenPosList + i == Selection) {
|
if (screenPosList + i == Selection) {
|
||||||
if (!dropDownMenu) {
|
if (!dropDownMenu) {
|
||||||
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, selected);
|
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, selected);
|
||||||
}
|
}
|
||||||
@@ -350,25 +361,27 @@ void ScriptList::DrawSingleObject(void) const {
|
|||||||
if (dropDownMenu) {
|
if (dropDownMenu) {
|
||||||
// Draw Operation Box.
|
// Draw Operation Box.
|
||||||
Gui::Draw_Rect(0, 25, 140, 44, barColor);
|
Gui::Draw_Rect(0, 25, 140, 44, barColor);
|
||||||
Gui::drawAnimatedSelector(dropPos2[0].x, dropPos2[0].y, dropPos2[0].w, dropPos2[0].h, .090, TRANSPARENT, Config::SelectedColor);
|
Gui::drawAnimatedSelector(dropPos2[0].x, dropPos2[0].y, dropPos2[0].w, dropPos2[0].h, .090, TRANSPARENT, selected);
|
||||||
// Draw Dropdown Icons.
|
// Draw Dropdown Icons.
|
||||||
GFX::DrawSpriteBlend(sprites_view_idx, dropPos[0].x, dropPos[0].y);
|
GFX::DrawSpriteBlend(sprites_view_idx, dropPos[0].x, dropPos[0].y);
|
||||||
// Dropdown Text.
|
// Dropdown Text.
|
||||||
Gui::DrawString(dropPos[0].x+30, dropPos[0].y+5, 0.4f, Config::TxtColor, Lang::get("VIEW_DDM"), 100);
|
Gui::DrawString(dropPos[0].x+30, dropPos[0].y+5, 0.4f, TextColor, Lang::get("VIEW_DDM"), 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptList::refreshList() {
|
void ScriptList::refreshList() {
|
||||||
if (returnIfExist(Config::ScriptPath, {"json"}) == true) {
|
if (returnIfExist(config->scriptPath(), {"json"}) == true) {
|
||||||
Msg::DisplayMsg(Lang::get("REFRESHING_LIST"));
|
Msg::DisplayMsg(Lang::get("REFRESHING_LIST"));
|
||||||
dirContents.clear();
|
dirContents.clear();
|
||||||
fileInfo.clear();
|
fileInfo.clear();
|
||||||
chdir(Config::ScriptPath.c_str());
|
chdir(config->scriptPath().c_str());
|
||||||
getDirectoryContents(dirContents, {"json"});
|
getDirectoryContents(dirContents, {"json"});
|
||||||
for(uint i=0;i<dirContents.size();i++) {
|
for(uint i = 0; i < dirContents.size(); i++) {
|
||||||
fileInfo.push_back(parseInfo(dirContents[i].name));
|
fileInfo.push_back(parseInfo(dirContents[i].name));
|
||||||
}
|
}
|
||||||
|
|
||||||
Selection = 0;
|
Selection = 0;
|
||||||
mode = 1;
|
mode = 1;
|
||||||
} else {
|
} else {
|
||||||
@@ -381,18 +394,18 @@ void ScriptList::refreshList() {
|
|||||||
void ScriptList::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
void ScriptList::SubMenuLogic(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]))) {
|
||||||
if (changeBackHandle) {
|
if (changeBackHandle) {
|
||||||
Gui::setScreen(std::make_unique<MainMenu>(), Config::fading, true);
|
Gui::setScreen(std::make_unique<MainMenu>(), config->screenFade(), true);
|
||||||
} else {
|
} else {
|
||||||
Gui::screenBack(Config::fading);
|
Gui::screenBack(config->screenFade());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Navigation.
|
// Navigation.
|
||||||
if(hDown & KEY_UP) {
|
if (hDown & KEY_UP) {
|
||||||
if(Selection > 1) Selection -= 2;
|
if (Selection > 1) Selection -= 2;
|
||||||
} else if(hDown & KEY_DOWN) {
|
} else if (hDown & KEY_DOWN) {
|
||||||
if(Selection < 3 && Selection != 2 && Selection != 3) Selection += 2;
|
if (Selection < 3 && Selection != 2 && Selection != 3) Selection += 2;
|
||||||
} else if (hDown & KEY_LEFT) {
|
} else if (hDown & KEY_LEFT) {
|
||||||
if (Selection%2) Selection--;
|
if (Selection%2) Selection--;
|
||||||
} else if (hDown & KEY_RIGHT) {
|
} else if (hDown & KEY_RIGHT) {
|
||||||
@@ -402,10 +415,10 @@ void ScriptList::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
if (hDown & KEY_A) {
|
if (hDown & KEY_A) {
|
||||||
switch(Selection) {
|
switch(Selection) {
|
||||||
case 0:
|
case 0:
|
||||||
if (returnIfExist(Config::ScriptPath, {"json"}) == true) {
|
if (returnIfExist(config->scriptPath(), {"json"}) == true) {
|
||||||
Msg::DisplayMsg(Lang::get("REFRESHING_LIST"));
|
Msg::DisplayMsg(Lang::get("REFRESHING_LIST"));
|
||||||
dirContents.clear();
|
dirContents.clear();
|
||||||
chdir(Config::ScriptPath.c_str());
|
chdir(config->scriptPath().c_str());
|
||||||
getDirectoryContents(dirContents, {"json"});
|
getDirectoryContents(dirContents, {"json"});
|
||||||
for(uint i=0;i<dirContents.size();i++) {
|
for(uint i=0;i<dirContents.size();i++) {
|
||||||
fileInfo.push_back(parseInfo(dirContents[i].name));
|
fileInfo.push_back(parseInfo(dirContents[i].name));
|
||||||
@@ -417,22 +430,22 @@ void ScriptList::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (checkWifiStatus() == true) {
|
if (checkWifiStatus() == true) {
|
||||||
Gui::setScreen(std::make_unique<ScriptBrowse>(), Config::fading, true);
|
Gui::setScreen(std::make_unique<ScriptBrowse>(), config->screenFade(), true);
|
||||||
} else {
|
} else {
|
||||||
notConnectedMsg();
|
notConnectedMsg();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (isTesting == true) {
|
if (isTesting == true) {
|
||||||
Gui::setScreen(std::make_unique<ScriptCreator>(), Config::fading, true);
|
Gui::setScreen(std::make_unique<ScriptCreator>(), config->screenFade(), true);
|
||||||
} else {
|
} else {
|
||||||
notImplemented();
|
notImplemented();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
std::string tempScript = selectFilePath(Lang::get("SELECT_SCRIPT_PATH"), Config::ScriptPath, {});
|
std::string tempScript = selectFilePath(Lang::get("SELECT_SCRIPT_PATH"), config->scriptPath(), {});
|
||||||
if (tempScript != "") {
|
if (tempScript != "") {
|
||||||
Config::ScriptPath = tempScript;
|
config->scriptPath(tempScript);
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -441,12 +454,12 @@ void ScriptList::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
|
|
||||||
if (hDown & KEY_TOUCH) {
|
if (hDown & KEY_TOUCH) {
|
||||||
if (touching(touch, subPos[0])) {
|
if (touching(touch, subPos[0])) {
|
||||||
if (returnIfExist(Config::ScriptPath, {"json"}) == true) {
|
if (returnIfExist(config->scriptPath(), {"json"}) == true) {
|
||||||
Msg::DisplayMsg(Lang::get("REFRESHING_LIST"));
|
Msg::DisplayMsg(Lang::get("REFRESHING_LIST"));
|
||||||
dirContents.clear();
|
dirContents.clear();
|
||||||
chdir(Config::ScriptPath.c_str());
|
chdir(config->scriptPath().c_str());
|
||||||
getDirectoryContents(dirContents, {"json"});
|
getDirectoryContents(dirContents, {"json"});
|
||||||
for(uint i=0;i<dirContents.size();i++) {
|
for(uint i = 0; i < dirContents.size(); i++) {
|
||||||
fileInfo.push_back(parseInfo(dirContents[i].name));
|
fileInfo.push_back(parseInfo(dirContents[i].name));
|
||||||
}
|
}
|
||||||
mode = 1;
|
mode = 1;
|
||||||
@@ -455,20 +468,20 @@ void ScriptList::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
} else if (touching(touch, subPos[1])) {
|
} else if (touching(touch, subPos[1])) {
|
||||||
if (checkWifiStatus() == true) {
|
if (checkWifiStatus() == true) {
|
||||||
Gui::setScreen(std::make_unique<ScriptBrowse>(), Config::fading, true);
|
Gui::setScreen(std::make_unique<ScriptBrowse>(), config->screenFade(), true);
|
||||||
} else {
|
} else {
|
||||||
notConnectedMsg();
|
notConnectedMsg();
|
||||||
}
|
}
|
||||||
} else if (touching(touch, subPos[2])) {
|
} else if (touching(touch, subPos[2])) {
|
||||||
if (isTesting == true) {
|
if (isTesting == true) {
|
||||||
Gui::setScreen(std::make_unique<ScriptCreator>(), Config::fading, true);
|
Gui::setScreen(std::make_unique<ScriptCreator>(), config->screenFade(), true);
|
||||||
} else {
|
} else {
|
||||||
notImplemented();
|
notImplemented();
|
||||||
}
|
}
|
||||||
} else if (touching(touch, subPos[3])) {
|
} else if (touching(touch, subPos[3])) {
|
||||||
std::string tempScript = selectFilePath(Lang::get("SELECT_SCRIPT_PATH"), Config::ScriptPath, {});
|
std::string tempScript = selectFilePath(Lang::get("SELECT_SCRIPT_PATH"), config->scriptPath(), {});
|
||||||
if (tempScript != "") {
|
if (tempScript != "") {
|
||||||
Config::ScriptPath = tempScript;
|
config->scriptPath(tempScript);
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -476,7 +489,7 @@ void ScriptList::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ScriptList::deleteScript(int selectedScript) {
|
void ScriptList::deleteScript(int selectedScript) {
|
||||||
std::string path = Config::ScriptPath;
|
std::string path = config->scriptPath();
|
||||||
path += dirContents[selectedScript].name;
|
path += dirContents[selectedScript].name;
|
||||||
deleteFile(path.c_str());
|
deleteFile(path.c_str());
|
||||||
// Refresh the list.
|
// Refresh the list.
|
||||||
@@ -484,11 +497,12 @@ void ScriptList::deleteScript(int selectedScript) {
|
|||||||
Selection = 0;
|
Selection = 0;
|
||||||
dirContents.clear();
|
dirContents.clear();
|
||||||
fileInfo.clear();
|
fileInfo.clear();
|
||||||
chdir(Config::ScriptPath.c_str());
|
chdir(config->scriptPath().c_str());
|
||||||
getDirectoryContents(dirContents, {"json"});
|
getDirectoryContents(dirContents, {"json"});
|
||||||
for(uint i=0;i<dirContents.size();i++) {
|
for(uint i = 0; i < dirContents.size(); i++) {
|
||||||
fileInfo.push_back(parseInfo(dirContents[i].name));
|
fileInfo.push_back(parseInfo(dirContents[i].name));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dirContents.size() == 0) {
|
if (dirContents.size() == 0) {
|
||||||
dirContents.clear();
|
dirContents.clear();
|
||||||
fileInfo.clear();
|
fileInfo.clear();
|
||||||
@@ -518,10 +532,10 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
Config::viewMode = 1;
|
config->viewMode(1);
|
||||||
} else {
|
} else {
|
||||||
Config::viewMode = 0;
|
config->viewMode(0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -535,10 +549,10 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
dropDownMenu = false;
|
dropDownMenu = false;
|
||||||
} else if (touching(touch, dropPos2[1])) {
|
} else if (touching(touch, dropPos2[1])) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
Config::viewMode = 1;
|
config->viewMode(1);
|
||||||
} else {
|
} else {
|
||||||
Config::viewMode = 0;
|
config->viewMode(0);
|
||||||
}
|
}
|
||||||
dropDownMenu = false;
|
dropDownMenu = false;
|
||||||
}
|
}
|
||||||
@@ -556,10 +570,10 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_START) {
|
if (hDown & KEY_START) {
|
||||||
if (Config::autoboot == 2) {
|
if (config->autoboot() == 2) {
|
||||||
if (Msg::promptMsg(Lang::get("DISABLE_AUTOBOOT"))) {
|
if (Msg::promptMsg(Lang::get("DISABLE_AUTOBOOT"))) {
|
||||||
Config::autoboot = 0;
|
config->autoboot(0);
|
||||||
Config::AutobootFile = "";
|
config->autobootFile("");
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -567,8 +581,8 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
} else if (fileInfo.size() != 0) {
|
} else if (fileInfo.size() != 0) {
|
||||||
if (ScriptHelper::checkIfValid(dirContents[Selection].name) == true) {
|
if (ScriptHelper::checkIfValid(dirContents[Selection].name) == true) {
|
||||||
if (Msg::promptMsg(Lang::get("AUTOBOOT_SCRIPT"))) {
|
if (Msg::promptMsg(Lang::get("AUTOBOOT_SCRIPT"))) {
|
||||||
Config::AutobootFile = Config::ScriptPath + dirContents[Selection].name;
|
config->autobootFile(config->scriptPath() + dirContents[Selection].name);
|
||||||
Config::autoboot = 2;
|
config->autoboot(2);
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -583,7 +597,7 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
Selection = 0;
|
Selection = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hHeld & KEY_UP && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))) {
|
if ((hHeld & KEY_UP && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))) {
|
||||||
@@ -593,11 +607,11 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
Selection = (int)fileInfo.size()-1;
|
Selection = (int)fileInfo.size()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hHeld & KEY_RIGHT && !keyRepeatDelay)) {
|
if ((hHeld & KEY_RIGHT && !keyRepeatDelay)) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
if (Selection < (int)fileInfo.size()-1-3) {
|
if (Selection < (int)fileInfo.size()-1-3) {
|
||||||
Selection += 3;
|
Selection += 3;
|
||||||
} else {
|
} else {
|
||||||
@@ -611,11 +625,11 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hHeld & KEY_LEFT && !keyRepeatDelay)) {
|
if ((hHeld & KEY_LEFT && !keyRepeatDelay)) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
if (Selection > 2) {
|
if (Selection > 2) {
|
||||||
Selection -= 3;
|
Selection -= 3;
|
||||||
} else {
|
} else {
|
||||||
@@ -629,15 +643,14 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_TOUCH) {
|
if (hDown & KEY_TOUCH) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)fileInfo.size(); i++) {
|
for(int i = 0; i < ENTRIES_PER_SCREEN && i < (int)fileInfo.size(); i++) {
|
||||||
if(touch.py > 40+(i*57) && touch.py < 40+(i*57)+45) {
|
if (touch.py > 40+(i*57) && touch.py < 40+(i*57)+45) {
|
||||||
if (dirContents[screenPos + i].isDirectory) {
|
if (!dirContents[screenPos + i].isDirectory && fileInfo.size() != 0) {
|
||||||
} else if (fileInfo.size() != 0) {
|
|
||||||
if (ScriptHelper::checkIfValid(dirContents[screenPos + i].name) == true) {
|
if (ScriptHelper::checkIfValid(dirContents[screenPos + i].name) == true) {
|
||||||
currentFile = dirContents[screenPos + i].name;
|
currentFile = dirContents[screenPos + i].name;
|
||||||
selectedTitle = fileInfo[screenPos + i].title;
|
selectedTitle = fileInfo[screenPos + i].title;
|
||||||
@@ -654,11 +667,10 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (Config::viewMode == 1) {
|
} else if (config->viewMode() == 1) {
|
||||||
for(int i=0;i<ENTRIES_PER_LIST && i<(int)fileInfo.size(); i++) {
|
for(int i = 0; i < ENTRIES_PER_LIST && i < (int)fileInfo.size(); i++) {
|
||||||
if(touch.py > (i+1)*27 && touch.py < (i+2)*27) {
|
if (touch.py > (i+1)*27 && touch.py < (i+2)*27) {
|
||||||
if (dirContents[screenPosList + i].isDirectory) {
|
if (!dirContents[screenPosList + i].isDirectory && fileInfo.size() != 0) {
|
||||||
} else if (fileInfo.size() != 0) {
|
|
||||||
if (ScriptHelper::checkIfValid(dirContents[screenPosList + i].name) == true) {
|
if (ScriptHelper::checkIfValid(dirContents[screenPosList + i].name) == true) {
|
||||||
currentFile = dirContents[screenPosList + i].name;
|
currentFile = dirContents[screenPosList + i].name;
|
||||||
selectedTitle = fileInfo[screenPosList + i].title;
|
selectedTitle = fileInfo[screenPosList + i].title;
|
||||||
@@ -697,14 +709,14 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
if(Selection < screenPos) {
|
if (Selection < screenPos) {
|
||||||
screenPos = Selection;
|
screenPos = Selection;
|
||||||
} else if (Selection > screenPos + ENTRIES_PER_SCREEN - 1) {
|
} else if (Selection > screenPos + ENTRIES_PER_SCREEN - 1) {
|
||||||
screenPos = Selection - ENTRIES_PER_SCREEN + 1;
|
screenPos = Selection - ENTRIES_PER_SCREEN + 1;
|
||||||
}
|
}
|
||||||
} else if (Config::viewMode == 1) {
|
} else if (config->viewMode() == 1) {
|
||||||
if(Selection < screenPosList) {
|
if (Selection < screenPosList) {
|
||||||
screenPosList = Selection;
|
screenPosList = Selection;
|
||||||
} else if (Selection > screenPosList + ENTRIES_PER_LIST - 1) {
|
} else if (Selection > screenPosList + ENTRIES_PER_LIST - 1) {
|
||||||
screenPosList = Selection - ENTRIES_PER_LIST + 1;
|
screenPosList = Selection - ENTRIES_PER_LIST + 1;
|
||||||
@@ -723,20 +735,20 @@ void ScriptList::SelectFunction(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_A) {
|
if (hDown & KEY_A) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
Config::viewMode = 1;
|
config->viewMode(1);
|
||||||
} else {
|
} else {
|
||||||
Config::viewMode = 0;
|
config->viewMode(0);
|
||||||
}
|
}
|
||||||
dropDownMenu = false;
|
dropDownMenu = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_TOUCH) {
|
if (hDown & KEY_TOUCH) {
|
||||||
if (touching(touch, dropPos2[0])) {
|
if (touching(touch, dropPos2[0])) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
Config::viewMode = 1;
|
config->viewMode(1);
|
||||||
} else {
|
} else {
|
||||||
Config::viewMode = 0;
|
config->viewMode(0);
|
||||||
}
|
}
|
||||||
dropDownMenu = false;
|
dropDownMenu = false;
|
||||||
}
|
}
|
||||||
@@ -761,7 +773,7 @@ void ScriptList::SelectFunction(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
Selection = 0;
|
Selection = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hHeld & KEY_UP && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))) {
|
if ((hHeld & KEY_UP && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))) {
|
||||||
@@ -771,12 +783,12 @@ void ScriptList::SelectFunction(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
Selection = (int)fileInfo2.size()-1;
|
Selection = (int)fileInfo2.size()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((hHeld & KEY_RIGHT && !keyRepeatDelay)) {
|
if ((hHeld & KEY_RIGHT && !keyRepeatDelay)) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
if (Selection < (int)fileInfo2.size()-1-3) {
|
if (Selection < (int)fileInfo2.size()-1-3) {
|
||||||
Selection += 3;
|
Selection += 3;
|
||||||
} else {
|
} else {
|
||||||
@@ -790,11 +802,11 @@ void ScriptList::SelectFunction(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hHeld & KEY_LEFT && !keyRepeatDelay)) {
|
if ((hHeld & KEY_LEFT && !keyRepeatDelay)) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
if (Selection > 2) {
|
if (Selection > 2) {
|
||||||
Selection -= 3;
|
Selection -= 3;
|
||||||
} else {
|
} else {
|
||||||
@@ -808,13 +820,13 @@ void ScriptList::SelectFunction(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_TOUCH) {
|
if (hDown & KEY_TOUCH) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)fileInfo2.size(); i++) {
|
for(int i = 0; i < ENTRIES_PER_SCREEN && i < (int)fileInfo2.size(); i++) {
|
||||||
if(touch.py > 40+(i*57) && touch.py < 40+(i*57)+45) {
|
if (touch.py > 40+(i*57) && touch.py < 40+(i*57)+45) {
|
||||||
if (fileInfo2.size() != 0) {
|
if (fileInfo2.size() != 0) {
|
||||||
choice = fileInfo2[screenPos + i];
|
choice = fileInfo2[screenPos + i];
|
||||||
if (Msg::promptMsg(Lang::get("EXECUTE_SCRIPT") + "\n\n" + choice)) {
|
if (Msg::promptMsg(Lang::get("EXECUTE_SCRIPT") + "\n\n" + choice)) {
|
||||||
@@ -823,9 +835,9 @@ void ScriptList::SelectFunction(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (Config::viewMode == 1) {
|
} else if (config->viewMode() == 1) {
|
||||||
for(int i=0;i<ENTRIES_PER_LIST && i<(int)fileInfo2.size(); i++) {
|
for(int i = 0; i < ENTRIES_PER_LIST && i < (int)fileInfo2.size(); i++) {
|
||||||
if(touch.py > (i+1)*27 && touch.py < (i+2)*27) {
|
if (touch.py > (i+1)*27 && touch.py < (i+2)*27) {
|
||||||
if (fileInfo2.size() != 0) {
|
if (fileInfo2.size() != 0) {
|
||||||
choice = fileInfo2[screenPosList + i];
|
choice = fileInfo2[screenPosList + i];
|
||||||
if (Msg::promptMsg(Lang::get("EXECUTE_SCRIPT") + "\n\n" + choice)) {
|
if (Msg::promptMsg(Lang::get("EXECUTE_SCRIPT") + "\n\n" + choice)) {
|
||||||
@@ -847,23 +859,23 @@ void ScriptList::SelectFunction(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_SELECT) {
|
if (hDown & KEY_SELECT) {
|
||||||
Config::Color1 = barColor;
|
config->barColor(barColor);
|
||||||
Config::Color2 = bgTopColor;
|
config->topBG(bgTopColor);
|
||||||
Config::Color3 = bgBottomColor;
|
config->bottomBG(bgBottomColor);
|
||||||
Config::TxtColor = TextColor;
|
config->textColor(TextColor);
|
||||||
Config::SelectedColor = selected;
|
config->selectedColor(selected);
|
||||||
Config::UnselectedColor = unselected;
|
config->unselectedColor(unselected);
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
if(Selection < screenPos) {
|
if (Selection < screenPos) {
|
||||||
screenPos = Selection;
|
screenPos = Selection;
|
||||||
} else if (Selection > screenPos + ENTRIES_PER_SCREEN - 1) {
|
} else if (Selection > screenPos + ENTRIES_PER_SCREEN - 1) {
|
||||||
screenPos = Selection - ENTRIES_PER_SCREEN + 1;
|
screenPos = Selection - ENTRIES_PER_SCREEN + 1;
|
||||||
}
|
}
|
||||||
} else if (Config::viewMode == 1) {
|
} else if (config->viewMode() == 1) {
|
||||||
if(Selection < screenPosList) {
|
if (Selection < screenPosList) {
|
||||||
screenPosList = Selection;
|
screenPosList = Selection;
|
||||||
} else if (Selection > screenPosList + ENTRIES_PER_LIST - 1) {
|
} else if (Selection > screenPosList + ENTRIES_PER_LIST - 1) {
|
||||||
screenPosList = Selection - ENTRIES_PER_LIST + 1;
|
screenPosList = Selection - ENTRIES_PER_LIST + 1;
|
||||||
@@ -896,121 +908,122 @@ void ScriptList::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
|
|
||||||
void ScriptList::DrawGlossary(void) const {
|
void ScriptList::DrawGlossary(void) const {
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("GLOSSARY"), 400);
|
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), Lang::get("GLOSSARY"), 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("GLOSSARY"), 400);
|
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), Lang::get("GLOSSARY"), 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastMode == 1) {
|
if (lastMode == 1) {
|
||||||
Gui::DrawString(15, 35, 0.7f, Config::TxtColor, std::to_string(Selection +1) + " | " + std::to_string(fileInfo.size()), 40);
|
Gui::DrawString(15, 35, 0.7f, config->textColor(), std::to_string(Selection +1) + " | " + std::to_string(fileInfo.size()), 40);
|
||||||
Gui::DrawString(65, 35, 0.7f, Config::TxtColor, Lang::get("ENTRY"), 300);
|
Gui::DrawString(65, 35, 0.7f, config->textColor(), Lang::get("ENTRY"), 300);
|
||||||
} else if (lastMode == 2) {
|
} else if (lastMode == 2) {
|
||||||
Gui::DrawString(15, 35, 0.7f, Config::TxtColor, std::to_string(Selection+1) + " | " + std::to_string(fileInfo2.size()), 40);
|
Gui::DrawString(15, 35, 0.7f, config->textColor(), std::to_string(Selection+1) + " | " + std::to_string(fileInfo2.size()), 40);
|
||||||
Gui::DrawString(65, 35, 0.7f, Config::TxtColor, Lang::get("ENTRY"), 300);
|
Gui::DrawString(65, 35, 0.7f, config->textColor(), Lang::get("ENTRY"), 300);
|
||||||
}
|
}
|
||||||
GFX::DrawBottom();
|
GFX::DrawBottom();
|
||||||
|
|
||||||
GFX::DrawSpriteBlend(sprites_view_idx, 20, 40);
|
GFX::DrawSpriteBlend(sprites_view_idx, 20, 40);
|
||||||
Gui::DrawString(50, 42, 0.6f, Config::TxtColor, Lang::get("CHANGE_VIEW_MODE"), 260);
|
Gui::DrawString(50, 42, 0.6f, config->textColor(), Lang::get("CHANGE_VIEW_MODE"), 260);
|
||||||
|
|
||||||
GFX::DrawArrow(20, 70);
|
GFX::DrawArrow(20, 70);
|
||||||
Gui::DrawString(50, 72, 0.6f, Config::TxtColor, Lang::get("ENTRY_UP"), 260);
|
Gui::DrawString(50, 72, 0.6f, config->textColor(), Lang::get("ENTRY_UP"), 260);
|
||||||
GFX::DrawArrow(42, 125, 180.0);
|
GFX::DrawArrow(42, 125, 180.0);
|
||||||
Gui::DrawString(50, 102, 0.6f, Config::TxtColor, Lang::get("ENTRY_DOWN"), 260);
|
Gui::DrawString(50, 102, 0.6f, config->textColor(), Lang::get("ENTRY_DOWN"), 260);
|
||||||
GFX::DrawArrow(20, 130, 0, 1);
|
GFX::DrawArrow(20, 130, 0, 1);
|
||||||
Gui::DrawString(50, 132, 0.6f, Config::TxtColor, Lang::get("GO_BACK"), 260);
|
Gui::DrawString(50, 132, 0.6f, config->textColor(), Lang::get("GO_BACK"), 260);
|
||||||
if (lastMode == 1) {
|
if (lastMode == 1) {
|
||||||
GFX::DrawSpriteBlend(sprites_delete_idx, 20, 160);
|
GFX::DrawSpriteBlend(sprites_delete_idx, 20, 160);
|
||||||
Gui::DrawString(50, 162, 0.6f, Config::TxtColor, Lang::get("DELETE_SCRIPT2"), 260);
|
Gui::DrawString(50, 162, 0.6f, config->textColor(), Lang::get("DELETE_SCRIPT2"), 260);
|
||||||
}
|
}
|
||||||
|
|
||||||
GFX::DrawArrow(0, 218, 0, 1);
|
GFX::DrawArrow(0, 218, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute | run the script.
|
// Execute | run the script.
|
||||||
Result ScriptList::runFunctions(nlohmann::json &json) {
|
Result ScriptList::runFunctions(nlohmann::json &json) {
|
||||||
Result ret = NONE; // No Error as of yet.
|
Result ret = NONE; // No Error as of yet.
|
||||||
for(int i=0;i<(int)json.at(choice).size();i++) {
|
for(int i = 0; i < (int)json.at(choice).size(); i++) {
|
||||||
if (ret == NONE) {
|
if (ret == NONE) {
|
||||||
std::string type = json.at(choice).at(i).at("type");
|
std::string type = json.at(choice).at(i).at("type");
|
||||||
|
|
||||||
if(type == "deleteFile") {
|
if (type == "deleteFile") {
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
std::string file, message;
|
std::string file, message;
|
||||||
if(json.at(choice).at(i).contains("file")) file = json.at(choice).at(i).at("file");
|
if (json.at(choice).at(i).contains("file")) file = json.at(choice).at(i).at("file");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(json.at(choice).at(i).contains("message")) message = json.at(choice).at(i).at("message");
|
if (json.at(choice).at(i).contains("message")) message = json.at(choice).at(i).at("message");
|
||||||
if(!missing) ret = ScriptHelper::removeFile(file, message);
|
if (!missing) ret = ScriptHelper::removeFile(file, message);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if(type == "downloadFile") {
|
} else if (type == "downloadFile") {
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
std::string file, output, message;
|
std::string file, output, message;
|
||||||
if(json.at(choice).at(i).contains("file")) file = json.at(choice).at(i).at("file");
|
if (json.at(choice).at(i).contains("file")) file = json.at(choice).at(i).at("file");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(json.at(choice).at(i).contains("output")) output = json.at(choice).at(i).at("output");
|
if (json.at(choice).at(i).contains("output")) output = json.at(choice).at(i).at("output");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(json.at(choice).at(i).contains("message")) message = json.at(choice).at(i).at("message");
|
if (json.at(choice).at(i).contains("message")) message = json.at(choice).at(i).at("message");
|
||||||
if(!missing) ret = ScriptHelper::downloadFile(file, output, message);
|
if (!missing) ret = ScriptHelper::downloadFile(file, output, message);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if(type == "downloadRelease") {
|
} else if (type == "downloadRelease") {
|
||||||
bool missing = false, includePrereleases = false, showVersions = false;
|
bool missing = false, includePrereleases = false, showVersions = false;
|
||||||
std::string repo, file, output, message;
|
std::string repo, file, output, message;
|
||||||
if(json.at(choice).at(i).contains("repo")) repo = json.at(choice).at(i).at("repo");
|
if (json.at(choice).at(i).contains("repo")) repo = json.at(choice).at(i).at("repo");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(json.at(choice).at(i).contains("file")) file = json.at(choice).at(i).at("file");
|
if (json.at(choice).at(i).contains("file")) file = json.at(choice).at(i).at("file");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(json.at(choice).at(i).contains("output")) output = json.at(choice).at(i).at("output");
|
if (json.at(choice).at(i).contains("output")) output = json.at(choice).at(i).at("output");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(json.at(choice).at(i).contains("includePrereleases") && json.at(choice).at(i).at("includePrereleases").is_boolean())
|
if (json.at(choice).at(i).contains("includePrereleases") && json.at(choice).at(i).at("includePrereleases").is_boolean())
|
||||||
includePrereleases = json.at(choice).at(i).at("includePrereleases");
|
includePrereleases = json.at(choice).at(i).at("includePrereleases");
|
||||||
if(json.at(choice).at(i).contains("showVersions") && json.at(choice).at(i).at("showVersions").is_boolean())
|
if (json.at(choice).at(i).contains("showVersions") && json.at(choice).at(i).at("showVersions").is_boolean())
|
||||||
showVersions = json.at(choice).at(i).at("showVersions");
|
showVersions = json.at(choice).at(i).at("showVersions");
|
||||||
if(json.at(choice).at(i).contains("message")) message = json.at(choice).at(i).at("message");
|
if (json.at(choice).at(i).contains("message")) message = json.at(choice).at(i).at("message");
|
||||||
if(!missing) ret = ScriptHelper::downloadRelease(repo, file, output, includePrereleases, showVersions, message);
|
if (!missing) ret = ScriptHelper::downloadRelease(repo, file, output, includePrereleases, showVersions, message);
|
||||||
|
|
||||||
} else if(type == "extractFile") {
|
} else if (type == "extractFile") {
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
std::string file, input, output, message;
|
std::string file, input, output, message;
|
||||||
if(json.at(choice).at(i).contains("file")) file = json.at(choice).at(i).at("file");
|
if (json.at(choice).at(i).contains("file")) file = json.at(choice).at(i).at("file");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(json.at(choice).at(i).contains("input")) input = json.at(choice).at(i).at("input");
|
if (json.at(choice).at(i).contains("input")) input = json.at(choice).at(i).at("input");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(json.at(choice).at(i).contains("output")) output = json.at(choice).at(i).at("output");
|
if (json.at(choice).at(i).contains("output")) output = json.at(choice).at(i).at("output");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(json.at(choice).at(i).contains("message")) message = json.at(choice).at(i).at("message");
|
if (json.at(choice).at(i).contains("message")) message = json.at(choice).at(i).at("message");
|
||||||
if(!missing) ScriptHelper::extractFile(file, input, output, message);
|
if (!missing) ScriptHelper::extractFile(file, input, output, message);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if(type == "installCia") {
|
} else if (type == "installCia") {
|
||||||
bool missing = false, updateSelf = false;
|
bool missing = false, updateSelf = false;
|
||||||
std::string file, message;
|
std::string file, message;
|
||||||
if(json.at(choice).at(i).contains("file")) file = json.at(choice).at(i).at("file");
|
if (json.at(choice).at(i).contains("file")) file = json.at(choice).at(i).at("file");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(json.at(choice).at(i).contains("updateSelf") && json.at(choice).at(i).at("updateSelf").is_boolean()) {
|
if (json.at(choice).at(i).contains("updateSelf") && json.at(choice).at(i).at("updateSelf").is_boolean()) {
|
||||||
updateSelf = json.at(choice).at(i).at("updateSelf");
|
updateSelf = json.at(choice).at(i).at("updateSelf");
|
||||||
}
|
}
|
||||||
if(json.at(choice).at(i).contains("message")) message = json.at(choice).at(i).at("message");
|
if (json.at(choice).at(i).contains("message")) message = json.at(choice).at(i).at("message");
|
||||||
if(!missing) ScriptHelper::installFile(file, updateSelf, message);
|
if (!missing) ScriptHelper::installFile(file, updateSelf, message);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if (type == "mkdir") {
|
} else if (type == "mkdir") {
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
std::string directory, message;
|
std::string directory, message;
|
||||||
if(json.at(choice).at(i).contains("directory")) directory = json.at(choice).at(i).at("directory");
|
if (json.at(choice).at(i).contains("directory")) directory = json.at(choice).at(i).at("directory");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(!missing) makeDirs(directory.c_str());
|
if (!missing) makeDirs(directory.c_str());
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if (type == "rmdir") {
|
} else if (type == "rmdir") {
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
std::string directory, message, promptmsg;
|
std::string directory, message, promptmsg;
|
||||||
if(json.at(choice).at(i).contains("directory")) directory = json.at(choice).at(i).at("directory");
|
if (json.at(choice).at(i).contains("directory")) directory = json.at(choice).at(i).at("directory");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
promptmsg = Lang::get("DELETE_PROMPT") + "\n" + directory;
|
promptmsg = Lang::get("DELETE_PROMPT") + "\n" + directory;
|
||||||
if(!missing) {
|
if (!missing) {
|
||||||
if(access(directory.c_str(), F_OK) != 0 ) {
|
if (access(directory.c_str(), F_OK) != 0 ) {
|
||||||
ret = DELETE_ERROR;
|
ret = DELETE_ERROR;
|
||||||
} else {
|
} else {
|
||||||
if (Msg::promptMsg(promptmsg)) {
|
if (Msg::promptMsg(promptmsg)) {
|
||||||
@@ -1023,63 +1036,63 @@ Result ScriptList::runFunctions(nlohmann::json &json) {
|
|||||||
} else if (type == "mkfile") {
|
} else if (type == "mkfile") {
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
std::string file;
|
std::string file;
|
||||||
if(json.at(choice).at(i).contains("file")) file = json.at(choice).at(i).at("file");
|
if (json.at(choice).at(i).contains("file")) file = json.at(choice).at(i).at("file");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(!missing) ScriptHelper::createFile(file.c_str());
|
if (!missing) ScriptHelper::createFile(file.c_str());
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if (type == "timeMsg") {
|
} else if (type == "timeMsg") {
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
std::string message;
|
std::string message;
|
||||||
int seconds;
|
int seconds;
|
||||||
if(json.at(choice).at(i).contains("message")) message = json.at(choice).at(i).at("message");
|
if (json.at(choice).at(i).contains("message")) message = json.at(choice).at(i).at("message");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(json.at(choice).at(i).contains("seconds") && json.at(choice).at(i).at("seconds").is_number())
|
if (json.at(choice).at(i).contains("seconds") && json.at(choice).at(i).at("seconds").is_number())
|
||||||
seconds = json.at(choice).at(i).at("seconds");
|
seconds = json.at(choice).at(i).at("seconds");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(!missing) ScriptHelper::displayTimeMsg(message, seconds);
|
if (!missing) ScriptHelper::displayTimeMsg(message, seconds);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if (type == "saveConfig") {
|
} else if (type == "saveConfig") {
|
||||||
Config::save();
|
config->save();
|
||||||
|
|
||||||
} else if (type == "bootTitle") {
|
} else if (type == "bootTitle") {
|
||||||
std::string TitleID = "";
|
std::string TitleID = "";
|
||||||
std::string message = "";
|
std::string message = "";
|
||||||
bool isNAND = false, missing = false;
|
bool isNAND = false, missing = false;
|
||||||
if(json.at(choice).at(i).contains("TitleID")) TitleID = json.at(choice).at(i).at("TitleID");
|
if (json.at(choice).at(i).contains("TitleID")) TitleID = json.at(choice).at(i).at("TitleID");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if (json.at(choice).at(i).contains("NAND") && json.at(choice).at(i).at("NAND").is_boolean()) isNAND = json.at(choice).at(i).at("NAND");
|
if (json.at(choice).at(i).contains("NAND") && json.at(choice).at(i).at("NAND").is_boolean()) isNAND = json.at(choice).at(i).at("NAND");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(json.at(choice).at(i).contains("message")) message = json.at(choice).at(i).at("message");
|
if (json.at(choice).at(i).contains("message")) message = json.at(choice).at(i).at("message");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(!missing) ScriptHelper::bootTitle(TitleID, isNAND, message);
|
if (!missing) ScriptHelper::bootTitle(TitleID, isNAND, message);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if (type == "promptMessage") {
|
} else if (type == "promptMessage") {
|
||||||
std::string Message = "";
|
std::string Message = "";
|
||||||
if(json.at(choice).at(i).contains("message")) Message = json.at(choice).at(i).at("message");
|
if (json.at(choice).at(i).contains("message")) Message = json.at(choice).at(i).at("message");
|
||||||
ret = ScriptHelper::prompt(Message);
|
ret = ScriptHelper::prompt(Message);
|
||||||
|
|
||||||
} else if (type == "copy") {
|
} else if (type == "copy") {
|
||||||
std::string Message = "", source = "", destination = "";
|
std::string Message = "", source = "", destination = "";
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
if(json.at(choice).at(i).contains("source")) source = json.at(choice).at(i).at("source");
|
if (json.at(choice).at(i).contains("source")) source = json.at(choice).at(i).at("source");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(json.at(choice).at(i).contains("destination")) destination = json.at(choice).at(i).at("destination");
|
if (json.at(choice).at(i).contains("destination")) destination = json.at(choice).at(i).at("destination");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(json.at(choice).at(i).contains("message")) Message = json.at(choice).at(i).at("message");
|
if (json.at(choice).at(i).contains("message")) Message = json.at(choice).at(i).at("message");
|
||||||
if (!missing) ret = ScriptHelper::copyFile(source, destination, Message);
|
if (!missing) ret = ScriptHelper::copyFile(source, destination, Message);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if (type == "move") {
|
} else if (type == "move") {
|
||||||
std::string Message = "", oldFile = "", newFile = "";
|
std::string Message = "", oldFile = "", newFile = "";
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
if(json.at(choice).at(i).contains("old")) oldFile = json.at(choice).at(i).at("old");
|
if (json.at(choice).at(i).contains("old")) oldFile = json.at(choice).at(i).at("old");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(json.at(choice).at(i).contains("new")) newFile = json.at(choice).at(i).at("new");
|
if (json.at(choice).at(i).contains("new")) newFile = json.at(choice).at(i).at("new");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(json.at(choice).at(i).contains("message")) Message = json.at(choice).at(i).at("message");
|
if (json.at(choice).at(i).contains("message")) Message = json.at(choice).at(i).at("message");
|
||||||
if (!missing) ret = ScriptHelper::renameFile(oldFile, newFile, Message);
|
if (!missing) ret = ScriptHelper::renameFile(oldFile, newFile, Message);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
+141
-137
@@ -29,13 +29,12 @@
|
|||||||
#include "settings.hpp"
|
#include "settings.hpp"
|
||||||
|
|
||||||
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
||||||
|
extern std::unique_ptr<Config> config;
|
||||||
|
|
||||||
int selectedLang;
|
int selectedLang;
|
||||||
extern bool changesMade;
|
extern bool changesMade;
|
||||||
|
|
||||||
Settings::Settings() {
|
Settings::Settings() { selectedLang = 0; }
|
||||||
selectedLang = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Settings::Draw(void) const {
|
void Settings::Draw(void) const {
|
||||||
if (mode == 0) {
|
if (mode == 0) {
|
||||||
@@ -52,11 +51,12 @@ void Settings::Draw(void) const {
|
|||||||
|
|
||||||
void Settings::DrawSubMenu(void) const {
|
void Settings::DrawSubMenu(void) const {
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
|
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "Universal-Updater", 400);
|
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
GFX::DrawBottom();
|
GFX::DrawBottom();
|
||||||
GFX::DrawArrow(0, 218, 0, 1);
|
GFX::DrawArrow(0, 218, 0, 1);
|
||||||
@@ -88,21 +88,23 @@ const std::vector<std::string> languages = {
|
|||||||
void Settings::DrawLanguageSelection(void) const {
|
void Settings::DrawLanguageSelection(void) const {
|
||||||
std::string line1;
|
std::string line1;
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("SELECT_LANG"), 400);
|
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), Lang::get("SELECT_LANG"), 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("SELECT_LANG"), 400);
|
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), Lang::get("SELECT_LANG"), 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
GFX::DrawBottom();
|
GFX::DrawBottom();
|
||||||
|
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)languages.size();i++) {
|
for(int i = 0; i < ENTRIES_PER_SCREEN && i < (int)languages.size(); i++) {
|
||||||
Gui::Draw_Rect(0, 40+(i*57), 320, 45, Config::UnselectedColor);
|
Gui::Draw_Rect(0, 40+(i*57), 320, 45, config->unselectedColor());
|
||||||
line1 = languages[screenPos + i];
|
line1 = languages[screenPos + i];
|
||||||
if (screenPos + i == selectedLang) {
|
if (screenPos + i == selectedLang) {
|
||||||
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, Config::SelectedColor);
|
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, config->selectedColor());
|
||||||
}
|
}
|
||||||
Gui::DrawStringCentered(0, 50+(i*57), 0.7f, WHITE, line1, 320);
|
|
||||||
|
Gui::DrawStringCentered(0, 50+(i*57), 0.7f, config->textColor(), line1, 320);
|
||||||
}
|
}
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
}
|
}
|
||||||
@@ -126,32 +128,32 @@ const std::vector<std::string> colorList = {
|
|||||||
void Settings::DrawColorChanging(void) const {
|
void Settings::DrawColorChanging(void) const {
|
||||||
std::string line1;
|
std::string line1;
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
|
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "Universal-Updater", 400);
|
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dropDownMenu) {
|
if (!dropDownMenu) {
|
||||||
if (colorMode == 3) {
|
if (colorMode == 3) {
|
||||||
Gui::Draw_Rect(0, 40, 400, 45, Config::SelectedColor);
|
Gui::Draw_Rect(0, 40, 400, 45, config->selectedColor());
|
||||||
Gui::DrawStringCentered(0, 45, 0.7f, Config::TxtColor, Lang::get("TEXT_COLOR"), 320);
|
Gui::DrawStringCentered(0, 45, 0.7f, config->textColor(), Lang::get("TEXT_COLOR"), 320);
|
||||||
} else if (colorMode == 4) {
|
} else if (colorMode == 4) {
|
||||||
Gui::Draw_Rect(0, 40, 400, 45, Config::SelectedColor);
|
Gui::Draw_Rect(0, 40, 400, 45, config->selectedColor());
|
||||||
Gui::DrawStringCentered(0, 45, 0.7f, Config::TxtColor, Lang::get("SELECTED_COLOR"), 320);
|
Gui::DrawStringCentered(0, 45, 0.7f, config->textColor(), Lang::get("SELECTED_COLOR"), 320);
|
||||||
} else if (colorMode == 5) {
|
} else if (colorMode == 5) {
|
||||||
Gui::Draw_Rect(0, 40, 400, 45, Config::UnselectedColor);
|
Gui::Draw_Rect(0, 40, 400, 45, config->unselectedColor());
|
||||||
Gui::DrawStringCentered(0, 45, 0.7f, Config::TxtColor, Lang::get("UNSELECTED_COLOR"), 320);
|
Gui::DrawStringCentered(0, 45, 0.7f, config->textColor(), Lang::get("UNSELECTED_COLOR"), 320);
|
||||||
} else if (colorMode == 6) {
|
} else if (colorMode == 6) {
|
||||||
Gui::Draw_Rect(31, 121, (int)(((float)100/(float)100) * 338.0f), 28, Config::progressbarColor);
|
Gui::Draw_Rect(31, 121, (int)(((float)100/(float)100) * 338.0f), 28, config->progressbarColor());
|
||||||
} else if (colorMode == 7) {
|
} else if (colorMode == 7) {
|
||||||
Gui::Draw_Rect(31, 121, (int)(((float)100/(float)100) * 338.0f), 28, Config::notFound);
|
Gui::Draw_Rect(31, 121, (int)(((float)100/(float)100) * 338.0f), 28, config->notfoundColor());
|
||||||
} else if (colorMode == 8) {
|
} else if (colorMode == 8) {
|
||||||
Gui::Draw_Rect(31, 121, (int)(((float)100/(float)100) * 338.0f), 28, Config::outdated);
|
Gui::Draw_Rect(31, 121, (int)(((float)100/(float)100) * 338.0f), 28, config->outdatedColor());
|
||||||
} else if (colorMode == 9) {
|
} else if (colorMode == 9) {
|
||||||
Gui::Draw_Rect(31, 121, (int)(((float)100/(float)100) * 338.0f), 28, Config::uptodate);
|
Gui::Draw_Rect(31, 121, (int)(((float)100/(float)100) * 338.0f), 28, config->uptodateColor());
|
||||||
} else if (colorMode == 10) {
|
} else if (colorMode == 10) {
|
||||||
Gui::Draw_Rect(31, 121, (int)(((float)100/(float)100) * 338.0f), 28, Config::future);
|
Gui::Draw_Rect(31, 121, (int)(((float)100/(float)100) * 338.0f), 28, config->futureColor());
|
||||||
} else if (colorMode == 11) {
|
} else if (colorMode == 11) {
|
||||||
GFX::DrawButton(100, 100, "");
|
GFX::DrawButton(100, 100, "");
|
||||||
}
|
}
|
||||||
@@ -167,63 +169,63 @@ void Settings::DrawColorChanging(void) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dropDownMenu) {
|
if (dropDownMenu) {
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)colorList.size();i++) {
|
for(int i = 0; i < ENTRIES_PER_SCREEN && i < (int)colorList.size(); i++) {
|
||||||
Gui::Draw_Rect(0, 40+(i*57), 320, 45, Config::UnselectedColor);
|
Gui::Draw_Rect(0, 40+(i*57), 320, 45, config->unselectedColor());
|
||||||
line1 = Lang::get(colorList[screenPos + i]);
|
line1 = Lang::get(colorList[screenPos + i]);
|
||||||
if(screenPos + i == colorSelection) {
|
if (screenPos + i == colorSelection) {
|
||||||
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, Config::SelectedColor);
|
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, config->selectedColor());
|
||||||
}
|
}
|
||||||
Gui::DrawStringCentered(0, 50+(i*57), 0.7f, Config::TxtColor, line1, 320);
|
Gui::DrawStringCentered(0, 50+(i*57), 0.7f, config->textColor(), line1, 320);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (colorMode == 0) {
|
if (colorMode == 0) {
|
||||||
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, ColorHelper::getColorName(Config::Color1, 2).c_str(), C2D_Color32(255, 0, 0, 255));
|
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, ColorHelper::getColorName(config->barColor(), 2).c_str(), C2D_Color32(255, 0, 0, 255));
|
||||||
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, ColorHelper::getColorName(Config::Color1, 1).c_str(), C2D_Color32(0, 255, 0, 255));
|
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, ColorHelper::getColorName(config->barColor(), 1).c_str(), C2D_Color32(0, 255, 0, 255));
|
||||||
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(Config::Color1, 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(config->barColor(), 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
||||||
} else if (colorMode == 1) {
|
} else if (colorMode == 1) {
|
||||||
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, ColorHelper::getColorName(Config::Color2, 2).c_str(), C2D_Color32(255, 0, 0, 255));
|
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, ColorHelper::getColorName(config->topBG(), 2).c_str(), C2D_Color32(255, 0, 0, 255));
|
||||||
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, ColorHelper::getColorName(Config::Color2, 1).c_str(), C2D_Color32(0, 255, 0, 255));
|
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, ColorHelper::getColorName(config->topBG(), 1).c_str(), C2D_Color32(0, 255, 0, 255));
|
||||||
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(Config::Color2, 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(config->topBG(), 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
||||||
} else if (colorMode == 2) {
|
} else if (colorMode == 2) {
|
||||||
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, ColorHelper::getColorName(Config::Color3, 2).c_str(), C2D_Color32(255, 0, 0, 255));
|
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, ColorHelper::getColorName(config->bottomBG(), 2).c_str(), C2D_Color32(255, 0, 0, 255));
|
||||||
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, ColorHelper::getColorName(Config::Color3, 1).c_str(), C2D_Color32(0, 255, 0, 255));
|
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, ColorHelper::getColorName(config->bottomBG(), 1).c_str(), C2D_Color32(0, 255, 0, 255));
|
||||||
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(Config::Color3, 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(config->bottomBG(), 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
||||||
} else if (colorMode == 3) {
|
} else if (colorMode == 3) {
|
||||||
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, ColorHelper::getColorName(Config::TxtColor, 2).c_str(), C2D_Color32(255, 0, 0, 255));
|
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, ColorHelper::getColorName(config->textColor(), 2).c_str(), C2D_Color32(255, 0, 0, 255));
|
||||||
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, ColorHelper::getColorName(Config::TxtColor, 1).c_str(), C2D_Color32(0, 255, 0, 255));
|
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, ColorHelper::getColorName(config->textColor(), 1).c_str(), C2D_Color32(0, 255, 0, 255));
|
||||||
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(Config::TxtColor, 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(config->textColor(), 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
||||||
} else if (colorMode == 4) {
|
} else if (colorMode == 4) {
|
||||||
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, ColorHelper::getColorName(Config::SelectedColor, 2).c_str(), C2D_Color32(255, 0, 0, 255));
|
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, ColorHelper::getColorName(config->selectedColor(), 2).c_str(), C2D_Color32(255, 0, 0, 255));
|
||||||
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, ColorHelper::getColorName(Config::SelectedColor, 1).c_str(), C2D_Color32(0, 255, 0, 255));
|
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, ColorHelper::getColorName(config->selectedColor(), 1).c_str(), C2D_Color32(0, 255, 0, 255));
|
||||||
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(Config::SelectedColor, 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(config->selectedColor(), 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
||||||
} else if (colorMode == 5) {
|
} else if (colorMode == 5) {
|
||||||
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, ColorHelper::getColorName(Config::UnselectedColor, 2).c_str(), C2D_Color32(255, 0, 0, 255));
|
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, ColorHelper::getColorName(config->unselectedColor(), 2).c_str(), C2D_Color32(255, 0, 0, 255));
|
||||||
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, ColorHelper::getColorName(Config::UnselectedColor, 1).c_str(), C2D_Color32(0, 255, 0, 255));
|
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, ColorHelper::getColorName(config->unselectedColor(), 1).c_str(), C2D_Color32(0, 255, 0, 255));
|
||||||
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(Config::UnselectedColor, 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(config->unselectedColor(), 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
||||||
} else if (colorMode == 6) {
|
} else if (colorMode == 6) {
|
||||||
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, ColorHelper::getColorName(Config::progressbarColor, 2).c_str(), C2D_Color32(255, 0, 0, 255));
|
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, ColorHelper::getColorName(config->progressbarColor(), 2).c_str(), C2D_Color32(255, 0, 0, 255));
|
||||||
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, ColorHelper::getColorName(Config::progressbarColor, 1).c_str(), C2D_Color32(0, 255, 0, 255));
|
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, ColorHelper::getColorName(config->progressbarColor(), 1).c_str(), C2D_Color32(0, 255, 0, 255));
|
||||||
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(Config::progressbarColor, 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(config->progressbarColor(), 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
||||||
} else if (colorMode == 7) {
|
} else if (colorMode == 7) {
|
||||||
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, ColorHelper::getColorName(Config::notFound, 2).c_str(), C2D_Color32(255, 0, 0, 255));
|
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, ColorHelper::getColorName(config->notfoundColor(), 2).c_str(), C2D_Color32(255, 0, 0, 255));
|
||||||
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, ColorHelper::getColorName(Config::notFound, 1).c_str(), C2D_Color32(0, 255, 0, 255));
|
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, ColorHelper::getColorName(config->notfoundColor(), 1).c_str(), C2D_Color32(0, 255, 0, 255));
|
||||||
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(Config::notFound, 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(config->notfoundColor(), 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
||||||
} else if (colorMode == 8) {
|
} else if (colorMode == 8) {
|
||||||
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, ColorHelper::getColorName(Config::outdated, 2).c_str(), C2D_Color32(255, 0, 0, 255));
|
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, ColorHelper::getColorName(config->outdatedColor(), 2).c_str(), C2D_Color32(255, 0, 0, 255));
|
||||||
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, ColorHelper::getColorName(Config::outdated, 1).c_str(), C2D_Color32(0, 255, 0, 255));
|
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, ColorHelper::getColorName(config->outdatedColor(), 1).c_str(), C2D_Color32(0, 255, 0, 255));
|
||||||
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(Config::outdated, 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(config->outdatedColor(), 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
||||||
} else if (colorMode == 9) {
|
} else if (colorMode == 9) {
|
||||||
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, ColorHelper::getColorName(Config::uptodate, 2).c_str(), C2D_Color32(255, 0, 0, 255));
|
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, ColorHelper::getColorName(config->uptodateColor(), 2).c_str(), C2D_Color32(255, 0, 0, 255));
|
||||||
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, ColorHelper::getColorName(Config::uptodate, 1).c_str(), C2D_Color32(0, 255, 0, 255));
|
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, ColorHelper::getColorName(config->uptodateColor(), 1).c_str(), C2D_Color32(0, 255, 0, 255));
|
||||||
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(Config::uptodate, 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(config->uptodateColor(), 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
||||||
} else if (colorMode == 10) {
|
} else if (colorMode == 10) {
|
||||||
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, ColorHelper::getColorName(Config::future, 2).c_str(), C2D_Color32(255, 0, 0, 255));
|
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, ColorHelper::getColorName(config->futureColor(), 2).c_str(), C2D_Color32(255, 0, 0, 255));
|
||||||
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, ColorHelper::getColorName(Config::future, 1).c_str(), C2D_Color32(0, 255, 0, 255));
|
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, ColorHelper::getColorName(config->futureColor(), 1).c_str(), C2D_Color32(0, 255, 0, 255));
|
||||||
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(Config::future, 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(config->futureColor(), 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
||||||
} else if (colorMode == 11) {
|
} else if (colorMode == 11) {
|
||||||
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, ColorHelper::getColorName(Config::Button, 2).c_str(), C2D_Color32(255, 0, 0, 255));
|
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, ColorHelper::getColorName(config->buttonColor(), 2).c_str(), C2D_Color32(255, 0, 0, 255));
|
||||||
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, ColorHelper::getColorName(Config::Button, 1).c_str(), C2D_Color32(0, 255, 0, 255));
|
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, ColorHelper::getColorName(config->buttonColor(), 1).c_str(), C2D_Color32(0, 255, 0, 255));
|
||||||
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(Config::Button, 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(config->buttonColor(), 0).c_str(), C2D_Color32(0, 0, 255, 255));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
@@ -231,11 +233,12 @@ void Settings::DrawColorChanging(void) const {
|
|||||||
|
|
||||||
void Settings::DrawMiscSettings(void) const {
|
void Settings::DrawMiscSettings(void) const {
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
|
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "Universal-Updater", 400);
|
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), "Universal-Updater", 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
GFX::DrawBottom();
|
GFX::DrawBottom();
|
||||||
GFX::DrawArrow(0, 218, 0, 1);
|
GFX::DrawArrow(0, 218, 0, 1);
|
||||||
@@ -255,26 +258,26 @@ void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
if (Selection == 0) {
|
if (Selection == 0) {
|
||||||
std::string tempMusic = selectFilePath(Lang::get("SELECT_MUSIC_FILE"), "sdmc:/", {"wav"}, 2);
|
std::string tempMusic = selectFilePath(Lang::get("SELECT_MUSIC_FILE"), "sdmc:/", {"wav"}, 2);
|
||||||
if (tempMusic != "") {
|
if (tempMusic != "") {
|
||||||
Config::MusicPath = tempMusic;
|
config->musicPath(tempMusic);
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
}
|
}
|
||||||
} else if (Selection == 1) {
|
} else if (Selection == 1) {
|
||||||
if (Config::UseBars == true) Config::UseBars = false;
|
if (config->useBars() == true) config->useBars(false);
|
||||||
else if (Config::UseBars == false) Config::UseBars = true;
|
else if (config->useBars() == false) config->useBars(true);
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
} else if (Selection == 2) {
|
} else if (Selection == 2) {
|
||||||
Config::keyDelay = Input::getUint(255, Lang::get("ENTER_KEY_DELAY"));
|
config->keyDelay(Input::getUint(255, Lang::get("ENTER_KEY_DELAY")));
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
} else if (Selection == 3) {
|
} else if (Selection == 3) {
|
||||||
if (Config::fading) {
|
if (config->screenFade()) {
|
||||||
if (Msg::promptMsg(Lang::get("TOGGLE_FADE_DISABLE"))) {
|
if (Msg::promptMsg(Lang::get("TOGGLE_FADE_DISABLE"))) {
|
||||||
Config::fading = false;
|
config->screenFade(false);
|
||||||
Msg::DisplayWarnMsg(Lang::get("DISABLED"));
|
Msg::DisplayWarnMsg(Lang::get("DISABLED"));
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Msg::promptMsg(Lang::get("TOGGLE_FADE_ENABLE"))) {
|
if (Msg::promptMsg(Lang::get("TOGGLE_FADE_ENABLE"))) {
|
||||||
Config::fading = true;
|
config->screenFade(true);
|
||||||
Msg::DisplayWarnMsg(Lang::get("ENABLED"));
|
Msg::DisplayWarnMsg(Lang::get("ENABLED"));
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
}
|
}
|
||||||
@@ -286,26 +289,26 @@ void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
if (touching(touch, mainButtons2[0])) {
|
if (touching(touch, mainButtons2[0])) {
|
||||||
std::string tempMusic = selectFilePath(Lang::get("SELECT_MUSIC_FILE"), "sdmc:/", {"wav"}, 2);
|
std::string tempMusic = selectFilePath(Lang::get("SELECT_MUSIC_FILE"), "sdmc:/", {"wav"}, 2);
|
||||||
if (tempMusic != "") {
|
if (tempMusic != "") {
|
||||||
Config::MusicPath = tempMusic;
|
config->musicPath(tempMusic);
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
}
|
}
|
||||||
} else if (touching(touch, mainButtons2[1])) {
|
} else if (touching(touch, mainButtons2[1])) {
|
||||||
if (Config::UseBars == true) Config::UseBars = false;
|
if (config->useBars() == true) config->useBars(false);
|
||||||
else if (Config::UseBars == false) Config::UseBars = true;
|
else if (config->useBars() == false) config->useBars(true);
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
} else if (touching(touch, mainButtons2[2])) {
|
} else if (touching(touch, mainButtons2[2])) {
|
||||||
Config::keyDelay = Input::getUint(255, Lang::get("ENTER_KEY_DELAY"));
|
config->keyDelay(Input::getUint(255, Lang::get("ENTER_KEY_DELAY")));
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
} else if (touching(touch, mainButtons2[3])) {
|
} else if (touching(touch, mainButtons2[3])) {
|
||||||
if (Config::fading) {
|
if (config->screenFade()) {
|
||||||
if (Msg::promptMsg(Lang::get("TOGGLE_FADE_DISABLE"))) {
|
if (Msg::promptMsg(Lang::get("TOGGLE_FADE_DISABLE"))) {
|
||||||
Config::fading = false;
|
config->screenFade(false);
|
||||||
Msg::DisplayWarnMsg(Lang::get("DISABLED"));
|
Msg::DisplayWarnMsg(Lang::get("DISABLED"));
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Msg::promptMsg(Lang::get("TOGGLE_FADE_ENABLE"))) {
|
if (Msg::promptMsg(Lang::get("TOGGLE_FADE_ENABLE"))) {
|
||||||
Config::fading = true;
|
config->screenFade(true);
|
||||||
Msg::DisplayWarnMsg(Lang::get("ENABLED"));
|
Msg::DisplayWarnMsg(Lang::get("ENABLED"));
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
}
|
}
|
||||||
@@ -320,15 +323,15 @@ void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
|
|
||||||
// No idea where to place the button for it, so do it here for now.
|
// No idea where to place the button for it, so do it here for now.
|
||||||
if (hDown & KEY_SELECT) {
|
if (hDown & KEY_SELECT) {
|
||||||
if (Config::progress) {
|
if (config->progressDisplay()) {
|
||||||
if (Msg::promptMsg(Lang::get("PROGRESS_BAR_DISABLE"))) {
|
if (Msg::promptMsg(Lang::get("PROGRESS_BAR_DISABLE"))) {
|
||||||
Config::progress = false;
|
config->progressDisplay(false);
|
||||||
Msg::DisplayWarnMsg(Lang::get("DISABLED"));
|
Msg::DisplayWarnMsg(Lang::get("DISABLED"));
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Msg::promptMsg(Lang::get("PROGRESS_BAR_ENABLE"))) {
|
if (Msg::promptMsg(Lang::get("PROGRESS_BAR_ENABLE"))) {
|
||||||
Config::progress = true;
|
config->progressDisplay(true);
|
||||||
Msg::DisplayWarnMsg(Lang::get("ENABLED"));
|
Msg::DisplayWarnMsg(Lang::get("ENABLED"));
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
}
|
}
|
||||||
@@ -350,11 +353,11 @@ void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
|
|
||||||
void Settings::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
void Settings::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
if (hDown & KEY_UP) {
|
if (hDown & KEY_UP) {
|
||||||
if(Selection > 0) Selection--;
|
if (Selection > 0) Selection--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_DOWN) {
|
if (hDown & KEY_DOWN) {
|
||||||
if(Selection < 2) Selection++;
|
if (Selection < 2) Selection++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_A) {
|
if (hDown & KEY_A) {
|
||||||
@@ -369,7 +372,7 @@ void Settings::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
mode = 2;
|
mode = 2;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
Gui::setScreen(std::make_unique<Credits>(), Config::fading, true);
|
Gui::setScreen(std::make_unique<Credits>(), config->screenFade(), true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -383,12 +386,12 @@ void Settings::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
screenPos = 0;
|
screenPos = 0;
|
||||||
mode = 2;
|
mode = 2;
|
||||||
} else if (touching(touch, mainButtons[2])) {
|
} else if (touching(touch, mainButtons[2])) {
|
||||||
Gui::setScreen(std::make_unique<Credits>(), Config::fading, true);
|
Gui::setScreen(std::make_unique<Credits>(), config->screenFade(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
||||||
Gui::screenBack(Config::fading);
|
Gui::screenBack(config->screenFade());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -409,7 +412,7 @@ void Settings::LanguageSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
selectedLang = 0;
|
selectedLang = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hHeld & KEY_UP && !keyRepeatDelay)) {
|
if ((hHeld & KEY_UP && !keyRepeatDelay)) {
|
||||||
@@ -419,12 +422,12 @@ void Settings::LanguageSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
selectedLang = (int)languages.size()-1;
|
selectedLang = (int)languages.size()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_A) {
|
if (hDown & KEY_A) {
|
||||||
Config::lang = langsTemp[selectedLang];
|
config->language(langsTemp[selectedLang]);
|
||||||
Lang::load(Config::lang);
|
Lang::load(config->language());
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
mode = 0;
|
mode = 0;
|
||||||
}
|
}
|
||||||
@@ -432,6 +435,7 @@ void Settings::LanguageSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
if ((hDown & KEY_B)) {
|
if ((hDown & KEY_B)) {
|
||||||
mode = 0;
|
mode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedLang < screenPos) {
|
if (selectedLang < screenPos) {
|
||||||
screenPos = selectedLang;
|
screenPos = selectedLang;
|
||||||
} else if (selectedLang > screenPos + ENTRIES_PER_SCREEN - 1) {
|
} else if (selectedLang > screenPos + ENTRIES_PER_SCREEN - 1) {
|
||||||
@@ -459,7 +463,7 @@ void Settings::colorChanging(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
colorSelection = 0;
|
colorSelection = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hHeld & KEY_UP && !keyRepeatDelay)) {
|
if ((hHeld & KEY_UP && !keyRepeatDelay)) {
|
||||||
@@ -469,7 +473,7 @@ void Settings::colorChanging(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
colorSelection = (int)colorList.size()-1;
|
colorSelection = (int)colorList.size()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -484,11 +488,11 @@ void Settings::colorChanging(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((hDown & KEY_L || hDown & KEY_LEFT)) {
|
if ((hDown & KEY_L || hDown & KEY_LEFT)) {
|
||||||
if(colorMode > 0) colorMode--;
|
if (colorMode > 0) colorMode--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hDown & KEY_R || hDown & KEY_RIGHT)) {
|
if ((hDown & KEY_R || hDown & KEY_RIGHT)) {
|
||||||
if(colorMode < 11) colorMode++;
|
if (colorMode < 11) colorMode++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_TOUCH) {
|
if (hDown & KEY_TOUCH) {
|
||||||
@@ -497,29 +501,29 @@ void Settings::colorChanging(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
if(temp != -1) {
|
if(temp != -1) {
|
||||||
red = temp;
|
red = temp;
|
||||||
if (colorMode == 0) {
|
if (colorMode == 0) {
|
||||||
Config::Color1 = RGBA8(red, ColorHelper::getColorValue(Config::Color1, 1), ColorHelper::getColorValue(Config::Color1, 0), 255);
|
config->barColor(RGBA8(red, ColorHelper::getColorValue(config->barColor(), 1), ColorHelper::getColorValue(config->barColor(), 0), 255));
|
||||||
} else if (colorMode == 1) {
|
} else if (colorMode == 1) {
|
||||||
Config::Color2 = RGBA8(red, ColorHelper::getColorValue(Config::Color2, 1), ColorHelper::getColorValue(Config::Color2, 0), 255);
|
config->topBG(RGBA8(red, ColorHelper::getColorValue(config->topBG(), 1), ColorHelper::getColorValue(config->topBG(), 0), 255));
|
||||||
} else if (colorMode == 2) {
|
} else if (colorMode == 2) {
|
||||||
Config::Color3 = RGBA8(red, ColorHelper::getColorValue(Config::Color3, 1), ColorHelper::getColorValue(Config::Color3, 0), 255);
|
config->bottomBG(RGBA8(red, ColorHelper::getColorValue(config->bottomBG(), 1), ColorHelper::getColorValue(config->bottomBG(), 0), 255));
|
||||||
} else if (colorMode == 3) {
|
} else if (colorMode == 3) {
|
||||||
Config::TxtColor = RGBA8(red, ColorHelper::getColorValue(Config::TxtColor, 1), ColorHelper::getColorValue(Config::TxtColor, 0), 255);
|
config->textColor(RGBA8(red, ColorHelper::getColorValue(config->textColor(), 1), ColorHelper::getColorValue(config->textColor(), 0), 255));
|
||||||
} else if (colorMode == 4) {
|
} else if (colorMode == 4) {
|
||||||
Config::SelectedColor = RGBA8(red, ColorHelper::getColorValue(Config::SelectedColor, 1), ColorHelper::getColorValue(Config::SelectedColor, 0), 255);
|
config->selectedColor(RGBA8(red, ColorHelper::getColorValue(config->selectedColor(), 1), ColorHelper::getColorValue(config->selectedColor(), 0), 255));
|
||||||
} else if (colorMode == 5) {
|
} else if (colorMode == 5) {
|
||||||
Config::UnselectedColor = RGBA8(red, ColorHelper::getColorValue(Config::UnselectedColor, 1), ColorHelper::getColorValue(Config::UnselectedColor, 0), 255);
|
config->unselectedColor(RGBA8(red, ColorHelper::getColorValue(config->unselectedColor(), 1), ColorHelper::getColorValue(config->unselectedColor(), 0), 255));
|
||||||
} else if (colorMode == 6) {
|
} else if (colorMode == 6) {
|
||||||
Config::progressbarColor = RGBA8(red, ColorHelper::getColorValue(Config::progressbarColor, 1), ColorHelper::getColorValue(Config::progressbarColor, 0), 255);
|
config->progressbarColor(RGBA8(red, ColorHelper::getColorValue(config->progressbarColor(), 1), ColorHelper::getColorValue(config->progressbarColor(), 0), 255));
|
||||||
} else if (colorMode == 7) {
|
} else if (colorMode == 7) {
|
||||||
Config::notFound = RGBA8(red, ColorHelper::getColorValue(Config::notFound, 1), ColorHelper::getColorValue(Config::notFound, 0), 255);
|
config->notfoundColor(RGBA8(red, ColorHelper::getColorValue(config->notfoundColor(), 1), ColorHelper::getColorValue(config->notfoundColor(), 0), 255));
|
||||||
} else if (colorMode == 8) {
|
} else if (colorMode == 8) {
|
||||||
Config::outdated = RGBA8(red, ColorHelper::getColorValue(Config::outdated, 1), ColorHelper::getColorValue(Config::outdated, 0), 255);
|
config->outdatedColor(RGBA8(red, ColorHelper::getColorValue(config->outdatedColor(), 1), ColorHelper::getColorValue(config->outdatedColor(), 0), 255));
|
||||||
} else if (colorMode == 9) {
|
} else if (colorMode == 9) {
|
||||||
Config::uptodate = RGBA8(red, ColorHelper::getColorValue(Config::uptodate, 1), ColorHelper::getColorValue(Config::uptodate, 0), 255);
|
config->uptodateColor(RGBA8(red, ColorHelper::getColorValue(config->uptodateColor(), 1), ColorHelper::getColorValue(config->uptodateColor(), 0), 255));
|
||||||
} else if (colorMode == 10) {
|
} else if (colorMode == 10) {
|
||||||
Config::future = RGBA8(red, ColorHelper::getColorValue(Config::future, 1), ColorHelper::getColorValue(Config::future, 0), 255);
|
config->futureColor(RGBA8(red, ColorHelper::getColorValue(config->futureColor(), 1), ColorHelper::getColorValue(config->futureColor(), 0), 255));
|
||||||
} else if (colorMode == 11) {
|
} else if (colorMode == 11) {
|
||||||
Config::Button = RGBA8(red, ColorHelper::getColorValue(Config::Button, 1), ColorHelper::getColorValue(Config::Button, 0), 255);
|
config->buttonColor(RGBA8(red, ColorHelper::getColorValue(config->buttonColor(), 1), ColorHelper::getColorValue(config->buttonColor(), 0), 255));
|
||||||
}
|
}
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
}
|
}
|
||||||
@@ -528,29 +532,29 @@ void Settings::colorChanging(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
if(temp != -1) {
|
if(temp != -1) {
|
||||||
green = temp;
|
green = temp;
|
||||||
if (colorMode == 0) {
|
if (colorMode == 0) {
|
||||||
Config::Color1 = RGBA8(ColorHelper::getColorValue(Config::Color1, 2), green, ColorHelper::getColorValue(Config::Color1, 0), 255);
|
config->barColor(RGBA8(ColorHelper::getColorValue(config->barColor(), 2), green, ColorHelper::getColorValue(config->barColor(), 0), 255));
|
||||||
} else if (colorMode == 1) {
|
} else if (colorMode == 1) {
|
||||||
Config::Color2 = RGBA8(ColorHelper::getColorValue(Config::Color2, 2), green, ColorHelper::getColorValue(Config::Color2, 0), 255);
|
config->topBG(RGBA8(ColorHelper::getColorValue(config->topBG(), 2), green, ColorHelper::getColorValue(config->topBG(), 0), 255));
|
||||||
} else if (colorMode == 2) {
|
} else if (colorMode == 2) {
|
||||||
Config::Color3 = RGBA8(ColorHelper::getColorValue(Config::Color3, 2), green, ColorHelper::getColorValue(Config::Color3, 0), 255);
|
config->bottomBG(RGBA8(ColorHelper::getColorValue(config->bottomBG(), 2), green, ColorHelper::getColorValue(config->bottomBG(), 0), 255));
|
||||||
} else if (colorMode == 3) {
|
} else if (colorMode == 3) {
|
||||||
Config::TxtColor = RGBA8(ColorHelper::getColorValue(Config::TxtColor, 2), green, ColorHelper::getColorValue(Config::TxtColor, 0), 255);
|
config->textColor(RGBA8(ColorHelper::getColorValue(config->textColor(), 2), green, ColorHelper::getColorValue(config->textColor(), 0), 255));
|
||||||
} else if (colorMode == 4) {
|
} else if (colorMode == 4) {
|
||||||
Config::SelectedColor = RGBA8(ColorHelper::getColorValue(Config::SelectedColor, 2), green, ColorHelper::getColorValue(Config::SelectedColor, 0), 255);
|
config->selectedColor(RGBA8(ColorHelper::getColorValue(config->selectedColor(), 2), green, ColorHelper::getColorValue(config->selectedColor(), 0), 255));
|
||||||
} else if (colorMode == 5) {
|
} else if (colorMode == 5) {
|
||||||
Config::UnselectedColor = RGBA8(ColorHelper::getColorValue(Config::UnselectedColor, 2), green, ColorHelper::getColorValue(Config::UnselectedColor, 0), 255);
|
config->unselectedColor(RGBA8(ColorHelper::getColorValue(config->unselectedColor(), 2), green, ColorHelper::getColorValue(config->unselectedColor(), 0), 255));
|
||||||
} else if (colorMode == 6) {
|
} else if (colorMode == 6) {
|
||||||
Config::progressbarColor = RGBA8(ColorHelper::getColorValue(Config::progressbarColor, 2), green, ColorHelper::getColorValue(Config::progressbarColor, 0), 255);
|
config->progressbarColor(RGBA8(ColorHelper::getColorValue(config->progressbarColor(), 2), green, ColorHelper::getColorValue(config->progressbarColor(), 0), 255));
|
||||||
} else if (colorMode == 7) {
|
} else if (colorMode == 7) {
|
||||||
Config::notFound = RGBA8(ColorHelper::getColorValue(Config::notFound, 2), green, ColorHelper::getColorValue(Config::notFound, 0), 255);
|
config->notfoundColor(RGBA8(ColorHelper::getColorValue(config->notfoundColor(), 2), green, ColorHelper::getColorValue(config->notfoundColor(), 0), 255));
|
||||||
} else if (colorMode == 8) {
|
} else if (colorMode == 8) {
|
||||||
Config::outdated = RGBA8(ColorHelper::getColorValue(Config::outdated, 2), green, ColorHelper::getColorValue(Config::outdated, 0), 255);
|
config->outdatedColor(RGBA8(ColorHelper::getColorValue(config->outdatedColor(), 2), green, ColorHelper::getColorValue(config->outdatedColor(), 0), 255));
|
||||||
} else if (colorMode == 9) {
|
} else if (colorMode == 9) {
|
||||||
Config::uptodate = RGBA8(ColorHelper::getColorValue(Config::uptodate, 2), green, ColorHelper::getColorValue(Config::uptodate, 0), 255);
|
config->uptodateColor(RGBA8(ColorHelper::getColorValue(config->uptodateColor(), 2), green, ColorHelper::getColorValue(config->uptodateColor(), 0), 255));
|
||||||
} else if (colorMode == 10) {
|
} else if (colorMode == 10) {
|
||||||
Config::future = RGBA8(ColorHelper::getColorValue(Config::future, 2), green, ColorHelper::getColorValue(Config::future, 0), 255);
|
config->futureColor(RGBA8(ColorHelper::getColorValue(config->futureColor(), 2), green, ColorHelper::getColorValue(config->futureColor(), 0), 255));
|
||||||
} else if (colorMode == 11) {
|
} else if (colorMode == 11) {
|
||||||
Config::Button = RGBA8(ColorHelper::getColorValue(Config::Button, 2), green, ColorHelper::getColorValue(Config::Button, 0), 255);
|
config->buttonColor(RGBA8(ColorHelper::getColorValue(config->buttonColor(), 2), green, ColorHelper::getColorValue(config->buttonColor(), 0), 255));
|
||||||
}
|
}
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
}
|
}
|
||||||
@@ -559,29 +563,29 @@ void Settings::colorChanging(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
if(temp != -1) {
|
if(temp != -1) {
|
||||||
blue = temp;
|
blue = temp;
|
||||||
if (colorMode == 0) {
|
if (colorMode == 0) {
|
||||||
Config::Color1 = RGBA8(ColorHelper::getColorValue(Config::Color1, 2), ColorHelper::getColorValue(Config::Color1, 1), blue, 255);
|
config->barColor(RGBA8(ColorHelper::getColorValue(config->barColor(), 2), ColorHelper::getColorValue(config->barColor(), 1), blue, 255));
|
||||||
} else if (colorMode == 1) {
|
} else if (colorMode == 1) {
|
||||||
Config::Color2 = RGBA8(ColorHelper::getColorValue(Config::Color2, 2), ColorHelper::getColorValue(Config::Color2, 1), blue, 255);
|
config->topBG(RGBA8(ColorHelper::getColorValue(config->topBG(), 2), ColorHelper::getColorValue(config->topBG(), 1), blue, 255));
|
||||||
} else if (colorMode == 2) {
|
} else if (colorMode == 2) {
|
||||||
Config::Color3 = RGBA8(ColorHelper::getColorValue(Config::Color3, 2), ColorHelper::getColorValue(Config::Color3, 1), blue, 255);
|
config->bottomBG(RGBA8(ColorHelper::getColorValue(config->bottomBG(), 2), ColorHelper::getColorValue(config->bottomBG(), 1), blue, 255));
|
||||||
} else if (colorMode == 3) {
|
} else if (colorMode == 3) {
|
||||||
Config::TxtColor = RGBA8(ColorHelper::getColorValue(Config::TxtColor, 2), ColorHelper::getColorValue(Config::TxtColor, 1), blue, 255);
|
config->textColor(RGBA8(ColorHelper::getColorValue(config->textColor(), 2), ColorHelper::getColorValue(config->textColor(), 1), blue, 255));
|
||||||
} else if (colorMode == 4) {
|
} else if (colorMode == 4) {
|
||||||
Config::SelectedColor = RGBA8(ColorHelper::getColorValue(Config::SelectedColor, 2), ColorHelper::getColorValue(Config::SelectedColor, 1), blue, 255);
|
config->selectedColor(RGBA8(ColorHelper::getColorValue(config->selectedColor(), 2), ColorHelper::getColorValue(config->selectedColor(), 1), blue, 255));
|
||||||
} else if (colorMode == 5) {
|
} else if (colorMode == 5) {
|
||||||
Config::UnselectedColor = RGBA8(ColorHelper::getColorValue(Config::UnselectedColor, 2), ColorHelper::getColorValue(Config::UnselectedColor, 1), blue, 255);
|
config->unselectedColor(RGBA8(ColorHelper::getColorValue(config->unselectedColor(), 2), ColorHelper::getColorValue(config->unselectedColor(), 1), blue, 255));
|
||||||
} else if (colorMode == 6) {
|
} else if (colorMode == 6) {
|
||||||
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 (colorMode == 7) {
|
} else if (colorMode == 7) {
|
||||||
Config::notFound = RGBA8(ColorHelper::getColorValue(Config::notFound, 2), ColorHelper::getColorValue(Config::notFound, 1), blue, 255);
|
config->notfoundColor(RGBA8(ColorHelper::getColorValue(config->notfoundColor(), 2), ColorHelper::getColorValue(config->notfoundColor(), 1), blue, 255));
|
||||||
} else if (colorMode == 8) {
|
} else if (colorMode == 8) {
|
||||||
Config::outdated = RGBA8(ColorHelper::getColorValue(Config::outdated, 2), ColorHelper::getColorValue(Config::outdated, 1), blue, 255);
|
config->outdatedColor(RGBA8(ColorHelper::getColorValue(config->outdatedColor(), 2), ColorHelper::getColorValue(config->outdatedColor(), 1), blue, 255));
|
||||||
} else if (colorMode == 9) {
|
} else if (colorMode == 9) {
|
||||||
Config::uptodate = RGBA8(ColorHelper::getColorValue(Config::uptodate, 2), ColorHelper::getColorValue(Config::uptodate, 1), blue, 255);
|
config->uptodateColor(RGBA8(ColorHelper::getColorValue(config->uptodateColor(), 2), ColorHelper::getColorValue(config->uptodateColor(), 1), blue, 255));
|
||||||
} else if (colorMode == 10) {
|
} else if (colorMode == 10) {
|
||||||
Config::future = RGBA8(ColorHelper::getColorValue(Config::future, 2), ColorHelper::getColorValue(Config::future, 1), blue, 255);
|
config->futureColor(RGBA8(ColorHelper::getColorValue(config->futureColor(), 2), ColorHelper::getColorValue(config->futureColor(), 1), blue, 255));
|
||||||
} else if (colorMode == 11) {
|
} else if (colorMode == 11) {
|
||||||
Config::Button = RGBA8(ColorHelper::getColorValue(Config::Button, 2), ColorHelper::getColorValue(Config::Button, 1), blue, 255);
|
config->buttonColor(RGBA8(ColorHelper::getColorValue(config->buttonColor(), 2), ColorHelper::getColorValue(config->buttonColor(), 1), blue, 255));
|
||||||
}
|
}
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
}
|
}
|
||||||
|
|||||||
+119
-116
@@ -40,6 +40,7 @@ extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
|||||||
extern bool changesMade;
|
extern bool changesMade;
|
||||||
bool specialHandling = false;
|
bool specialHandling = false;
|
||||||
bool didAutoboot = false;
|
bool didAutoboot = false;
|
||||||
|
extern std::unique_ptr<Config> config;
|
||||||
|
|
||||||
UniStore::UniStore(bool doAutoboot, std::string file) {
|
UniStore::UniStore(bool doAutoboot, std::string file) {
|
||||||
this->doAutoboot = doAutoboot;
|
this->doAutoboot = doAutoboot;
|
||||||
@@ -75,9 +76,9 @@ void UniStore::autobootLogic() {
|
|||||||
displayInformations = handleIfDisplayText();
|
displayInformations = handleIfDisplayText();
|
||||||
const std::string sheetURL = storeInfo[0].storeSheet;
|
const std::string sheetURL = storeInfo[0].storeSheet;
|
||||||
if (storeInfo[0].version == 0) {
|
if (storeInfo[0].version == 0) {
|
||||||
Gui::setScreen(std::make_unique<UniStoreV1>(JSON, sheetURL, displayInformations), Config::fading, true);
|
Gui::setScreen(std::make_unique<UniStoreV1>(JSON, sheetURL, displayInformations), config->screenFade(), true);
|
||||||
} else if (storeInfo[0].version == 1) {
|
} else if (storeInfo[0].version == 1) {
|
||||||
Gui::setScreen(std::make_unique<UniStoreV2>(JSON, sheetURL), Config::fading, true);
|
Gui::setScreen(std::make_unique<UniStoreV2>(JSON, sheetURL), config->screenFade(), true);
|
||||||
} else {
|
} else {
|
||||||
Msg::DisplayWarnMsg(Lang::get("UNISTORE_NOT_SUPPORTED"));
|
Msg::DisplayWarnMsg(Lang::get("UNISTORE_NOT_SUPPORTED"));
|
||||||
}
|
}
|
||||||
@@ -93,7 +94,7 @@ void UniStore::autobootLogic() {
|
|||||||
StoreInfo UniStore::parseStoreInfo(std::string fileName) {
|
StoreInfo UniStore::parseStoreInfo(std::string fileName) {
|
||||||
FILE* file = fopen(fileName.c_str(), "rt");
|
FILE* file = fopen(fileName.c_str(), "rt");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
printf("File not found\n");
|
printf("File not found.\n");
|
||||||
return {"", ""};
|
return {"", ""};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,10 +142,10 @@ void UniStore::loadStoreDesc(void) {
|
|||||||
|
|
||||||
void UniStore::DrawSubMenu(void) const {
|
void UniStore::DrawSubMenu(void) const {
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("UNISTORE_SUBMENU"), 400);
|
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), Lang::get("UNISTORE_SUBMENU"), 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("UNISTORE_SUBMENU"), 400);
|
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), Lang::get("UNISTORE_SUBMENU"), 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
GFX::DrawSprite(sprites_uniStore_HD_idx, 140, 50, 0.2, 0.2);
|
GFX::DrawSprite(sprites_uniStore_HD_idx, 140, 50, 0.2, 0.2);
|
||||||
@@ -155,6 +156,7 @@ void UniStore::DrawSubMenu(void) const {
|
|||||||
GFX::DrawButton(subPos[0].x, subPos[0].y,Lang::get("STORE_LIST"));
|
GFX::DrawButton(subPos[0].x, subPos[0].y,Lang::get("STORE_LIST"));
|
||||||
GFX::DrawButton(subPos[1].x, subPos[1].y, Lang::get("STORE_SEARCH"));
|
GFX::DrawButton(subPos[1].x, subPos[1].y, Lang::get("STORE_SEARCH"));
|
||||||
GFX::DrawButton(subPos[2].x, subPos[2].y, Lang::get("CHANGE_STOREPATH"));
|
GFX::DrawButton(subPos[2].x, subPos[2].y, Lang::get("CHANGE_STOREPATH"));
|
||||||
|
|
||||||
// Selector.
|
// Selector.
|
||||||
Animation::Button(subPos[Selection].x, subPos[Selection].y, .060);
|
Animation::Button(subPos[Selection].x, subPos[Selection].y, .060);
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
@@ -167,18 +169,18 @@ void UniStore::DrawStoreList(void) const {
|
|||||||
std::string line2;
|
std::string line2;
|
||||||
std::string storeAmount = std::to_string(Selection +1) + " | " + std::to_string(storeInfo.size());
|
std::string storeAmount = std::to_string(Selection +1) + " | " + std::to_string(storeInfo.size());
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, storeInfo[Selection].title, 400);
|
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), storeInfo[Selection].title, 400);
|
||||||
Gui::DrawString(5, 220, 0.6f, Config::TxtColor, Lang::get("UNISTORE_VERSION") + std::to_string(storeInfo[Selection].version + 1), 400);
|
Gui::DrawString(5, 220, 0.6f, config->textColor(), Lang::get("UNISTORE_VERSION") + std::to_string(storeInfo[Selection].version + 1), 400);
|
||||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, storeAmount), 239-Gui::GetStringHeight(0.6f, storeAmount), 0.6f, Config::TxtColor, storeAmount);
|
Gui::DrawString(397-Gui::GetStringWidth(0.6f, storeAmount), 239-Gui::GetStringHeight(0.6f, storeAmount), 0.6f, config->textColor(), storeAmount);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, storeInfo[Selection].title, 400);
|
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), storeInfo[Selection].title, 400);
|
||||||
Gui::DrawString(5, 218, 0.6f, Config::TxtColor, Lang::get("UNISTORE_VERSION") + std::to_string(storeInfo[Selection].version + 1), 400);
|
Gui::DrawString(5, 218, 0.6f, config->textColor(), Lang::get("UNISTORE_VERSION") + std::to_string(storeInfo[Selection].version + 1), 400);
|
||||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, storeAmount), 237-Gui::GetStringHeight(0.6f, storeAmount), 0.6f, Config::TxtColor, storeAmount);
|
Gui::DrawString(397-Gui::GetStringWidth(0.6f, storeAmount), 237-Gui::GetStringHeight(0.6f, storeAmount), 0.6f, config->textColor(), storeAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(uint i = 0; i < descLines.size(); i++) {
|
for(uint i = 0; i < descLines.size(); i++) {
|
||||||
Gui::DrawStringCentered(0, 120-((descLines.size()*20)/2)+i*20, 0.6f, Config::TxtColor, descLines[i], 400);
|
Gui::DrawStringCentered(0, 120-((descLines.size()*20)/2)+i*20, 0.6f, config->textColor(), descLines[i], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
@@ -188,43 +190,43 @@ void UniStore::DrawStoreList(void) const {
|
|||||||
GFX::DrawArrow(0, 218, 0, 1);
|
GFX::DrawArrow(0, 218, 0, 1);
|
||||||
GFX::DrawSpriteBlend(sprites_dropdown_idx, arrowPos[3].x, arrowPos[3].y);
|
GFX::DrawSpriteBlend(sprites_dropdown_idx, arrowPos[3].x, arrowPos[3].y);
|
||||||
|
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)storeInfo.size();i++) {
|
for(int i = 0; i < ENTRIES_PER_SCREEN && i < (int)storeInfo.size(); i++) {
|
||||||
Gui::Draw_Rect(0, 40+(i*57), 320, 45, Config::UnselectedColor);
|
Gui::Draw_Rect(0, 40+(i*57), 320, 45, config->unselectedColor());
|
||||||
line1 = storeInfo[screenPos + i].title;
|
line1 = storeInfo[screenPos + i].title;
|
||||||
line2 = storeInfo[screenPos + i].author;
|
line2 = storeInfo[screenPos + i].author;
|
||||||
if (screenPos + i == Selection) {
|
if (screenPos + i == Selection) {
|
||||||
if (!dropDownMenu) {
|
if (!dropDownMenu) {
|
||||||
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, Config::SelectedColor);
|
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, config->selectedColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Gui::DrawStringCentered(0, 38+(i*57), 0.7f, Config::TxtColor, line1, 320);
|
Gui::DrawStringCentered(0, 38+(i*57), 0.7f, config->textColor(), line1, 320);
|
||||||
Gui::DrawStringCentered(0, 62+(i*57), 0.7f, Config::TxtColor, line2, 320);
|
Gui::DrawStringCentered(0, 62+(i*57), 0.7f, config->textColor(), line2, 320);
|
||||||
}
|
}
|
||||||
} else if (Config::viewMode == 1) {
|
} else if (config->viewMode() == 1) {
|
||||||
for(int i=0;i<ENTRIES_PER_LIST && i<(int)storeInfo.size();i++) {
|
for(int i = 0; i < ENTRIES_PER_LIST && i < (int)storeInfo.size(); i++) {
|
||||||
Gui::Draw_Rect(0, (i+1)*27, 320, 25, Config::UnselectedColor);
|
Gui::Draw_Rect(0, (i+1)*27, 320, 25, config->unselectedColor());
|
||||||
line1 = storeInfo[screenPosList + i].title;
|
line1 = storeInfo[screenPosList + i].title;
|
||||||
if (screenPosList + i == Selection) {
|
if (screenPosList + i == Selection) {
|
||||||
if (!dropDownMenu) {
|
if (!dropDownMenu) {
|
||||||
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, Config::SelectedColor);
|
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, config->selectedColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, Config::TxtColor, line1, 320);
|
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, config->textColor(), line1, 320);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DropDown Menu.
|
// DropDown Menu.
|
||||||
if (dropDownMenu) {
|
if (dropDownMenu) {
|
||||||
// Draw Operation Box.
|
// Draw Operation Box.
|
||||||
Gui::Draw_Rect(0, 25, 140, 130, Config::Color1);
|
Gui::Draw_Rect(0, 25, 140, 130, config->barColor());
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
if (dropSelection == i) {
|
if (dropSelection == i) {
|
||||||
Gui::drawAnimatedSelector(dropPos2[i].x, dropPos2[i].y, dropPos2[i].w, dropPos2[i].h, .090, TRANSPARENT, Config::SelectedColor);
|
Gui::drawAnimatedSelector(dropPos2[i].x, dropPos2[i].y, dropPos2[i].w, dropPos2[i].h, .090, TRANSPARENT, config->selectedColor());
|
||||||
} else {
|
} else {
|
||||||
Gui::Draw_Rect(dropPos2[i].x, dropPos2[i].y, dropPos2[i].w, dropPos2[i].h, Config::UnselectedColor);
|
Gui::Draw_Rect(dropPos2[i].x, dropPos2[i].y, dropPos2[i].w, dropPos2[i].h, config->unselectedColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,9 +235,9 @@ void UniStore::DrawStoreList(void) const {
|
|||||||
GFX::DrawSpriteBlend(sprites_update_idx, dropPos[1].x, dropPos[1].y);
|
GFX::DrawSpriteBlend(sprites_update_idx, dropPos[1].x, dropPos[1].y);
|
||||||
GFX::DrawSpriteBlend(sprites_view_idx, dropPos[2].x, dropPos[2].y);
|
GFX::DrawSpriteBlend(sprites_view_idx, dropPos[2].x, dropPos[2].y);
|
||||||
// Dropdown Text.
|
// Dropdown Text.
|
||||||
Gui::DrawString(dropPos[0].x+30, dropPos[0].y+5, 0.4f, Config::TxtColor, Lang::get("DELETE_DDM"), 100);
|
Gui::DrawString(dropPos[0].x+30, dropPos[0].y+5, 0.4f, config->textColor(), Lang::get("DELETE_DDM"), 100);
|
||||||
Gui::DrawString(dropPos[1].x+30, dropPos[1].y+5, 0.4f, Config::TxtColor, Lang::get("UPDATE_DDM"), 100);
|
Gui::DrawString(dropPos[1].x+30, dropPos[1].y+5, 0.4f, config->textColor(), Lang::get("UPDATE_DDM"), 100);
|
||||||
Gui::DrawString(dropPos[2].x+30, dropPos[2].y+5, 0.4f, Config::TxtColor, Lang::get("VIEW_DDM"), 100);
|
Gui::DrawString(dropPos[2].x+30, dropPos[2].y+5, 0.4f, config->textColor(), Lang::get("VIEW_DDM"), 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
@@ -272,9 +274,9 @@ void UniStore::updateStore(int selectedStore) {
|
|||||||
Msg::DisplayMsg(Lang::get("REFRESHING_LIST"));
|
Msg::DisplayMsg(Lang::get("REFRESHING_LIST"));
|
||||||
dirContents.clear();
|
dirContents.clear();
|
||||||
storeInfo.clear();
|
storeInfo.clear();
|
||||||
chdir(Config::StorePath.c_str());
|
chdir(config->storePath().c_str());
|
||||||
getDirectoryContents(dirContents, {"unistore"});
|
getDirectoryContents(dirContents, {"unistore"});
|
||||||
for(uint i=0;i<dirContents.size();i++) {
|
for(uint i = 0; i < dirContents.size(); i++) {
|
||||||
storeInfo.push_back(parseStoreInfo(dirContents[i].name));
|
storeInfo.push_back(parseStoreInfo(dirContents[i].name));
|
||||||
descript();
|
descript();
|
||||||
loadStoreDesc();
|
loadStoreDesc();
|
||||||
@@ -284,13 +286,13 @@ void UniStore::updateStore(int selectedStore) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UniStore::refreshList() {
|
void UniStore::refreshList() {
|
||||||
if (returnIfExist(Config::StorePath, {"unistore"}) == true) {
|
if (returnIfExist(config->storePath(), {"unistore"}) == true) {
|
||||||
Msg::DisplayMsg(Lang::get("REFRESHING_LIST"));
|
Msg::DisplayMsg(Lang::get("REFRESHING_LIST"));
|
||||||
dirContents.clear();
|
dirContents.clear();
|
||||||
storeInfo.clear();
|
storeInfo.clear();
|
||||||
chdir(Config::StorePath.c_str());
|
chdir(config->storePath().c_str());
|
||||||
getDirectoryContents(dirContents, {"unistore"});
|
getDirectoryContents(dirContents, {"unistore"});
|
||||||
for(uint i=0;i<dirContents.size();i++) {
|
for(uint i = 0; i < dirContents.size(); i++) {
|
||||||
storeInfo.push_back(parseStoreInfo(dirContents[i].name));
|
storeInfo.push_back(parseStoreInfo(dirContents[i].name));
|
||||||
descript();
|
descript();
|
||||||
loadStoreDesc();
|
loadStoreDesc();
|
||||||
@@ -306,9 +308,9 @@ void UniStore::refreshList() {
|
|||||||
void UniStore::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
void UniStore::SubMenuLogic(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]))) {
|
||||||
if (specialHandling) {
|
if (specialHandling) {
|
||||||
Gui::setScreen(std::make_unique<MainMenu>(), true, true);
|
Gui::setScreen(std::make_unique<MainMenu>(), config->screenFade(), true);
|
||||||
} else {
|
} else {
|
||||||
Gui::screenBack(Config::fading);
|
Gui::screenBack(config->screenFade());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -323,17 +325,18 @@ void UniStore::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
if (hDown & KEY_A) {
|
if (hDown & KEY_A) {
|
||||||
switch(Selection) {
|
switch(Selection) {
|
||||||
case 0:
|
case 0:
|
||||||
if (returnIfExist(Config::StorePath, {"unistore"}) == true) {
|
if (returnIfExist(config->storePath(), {"unistore"}) == true) {
|
||||||
Msg::DisplayMsg(Lang::get("REFRESHING_LIST"));
|
Msg::DisplayMsg(Lang::get("REFRESHING_LIST"));
|
||||||
dirContents.clear();
|
dirContents.clear();
|
||||||
storeInfo.clear();
|
storeInfo.clear();
|
||||||
chdir(Config::StorePath.c_str());
|
chdir(config->storePath().c_str());
|
||||||
getDirectoryContents(dirContents, {"unistore"});
|
getDirectoryContents(dirContents, {"unistore"});
|
||||||
for(uint i=0;i<dirContents.size();i++) {
|
for(uint i = 0; i < dirContents.size(); i++) {
|
||||||
storeInfo.push_back(parseStoreInfo(dirContents[i].name));
|
storeInfo.push_back(parseStoreInfo(dirContents[i].name));
|
||||||
descript();
|
descript();
|
||||||
loadStoreDesc();
|
loadStoreDesc();
|
||||||
}
|
}
|
||||||
|
|
||||||
Selection = 0;
|
Selection = 0;
|
||||||
mode = 1;
|
mode = 1;
|
||||||
} else {
|
} else {
|
||||||
@@ -349,9 +352,9 @@ void UniStore::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
std::string tempStore = selectFilePath(Lang::get("SELECT_STORE_PATH"), Config::StorePath, {});
|
std::string tempStore = selectFilePath(Lang::get("SELECT_STORE_PATH"), config->storePath(), {});
|
||||||
if (tempStore != "") {
|
if (tempStore != "") {
|
||||||
Config::StorePath = tempStore;
|
config->storePath(tempStore);
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -360,17 +363,18 @@ void UniStore::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
|
|
||||||
if (hDown & KEY_TOUCH) {
|
if (hDown & KEY_TOUCH) {
|
||||||
if (touching(touch, subPos[0])) {
|
if (touching(touch, subPos[0])) {
|
||||||
if (returnIfExist(Config::StorePath, {"unistore"}) == true) {
|
if (returnIfExist(config->storePath(), {"unistore"}) == true) {
|
||||||
Msg::DisplayMsg(Lang::get("REFRESHING_LIST"));
|
Msg::DisplayMsg(Lang::get("REFRESHING_LIST"));
|
||||||
dirContents.clear();
|
dirContents.clear();
|
||||||
storeInfo.clear();
|
storeInfo.clear();
|
||||||
chdir(Config::StorePath.c_str());
|
chdir(config->storePath().c_str());
|
||||||
getDirectoryContents(dirContents, {"unistore"});
|
getDirectoryContents(dirContents, {"unistore"});
|
||||||
for(uint i=0;i<dirContents.size();i++) {
|
for(uint i = 0; i < dirContents.size(); i++) {
|
||||||
storeInfo.push_back(parseStoreInfo(dirContents[i].name));
|
storeInfo.push_back(parseStoreInfo(dirContents[i].name));
|
||||||
descript();
|
descript();
|
||||||
loadStoreDesc();
|
loadStoreDesc();
|
||||||
}
|
}
|
||||||
|
|
||||||
Selection = 0;
|
Selection = 0;
|
||||||
mode = 1;
|
mode = 1;
|
||||||
} else {
|
} else {
|
||||||
@@ -384,9 +388,9 @@ void UniStore::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
notConnectedMsg();
|
notConnectedMsg();
|
||||||
}
|
}
|
||||||
} else if (touching(touch, subPos[2])) {
|
} else if (touching(touch, subPos[2])) {
|
||||||
std::string tempStore = selectFilePath(Lang::get("SELECT_STORE_PATH"), Config::StorePath, {});
|
std::string tempStore = selectFilePath(Lang::get("SELECT_STORE_PATH"), config->storePath(), {});
|
||||||
if (tempStore != "") {
|
if (tempStore != "") {
|
||||||
Config::StorePath = tempStore;
|
config->storePath(tempStore);
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -394,7 +398,7 @@ void UniStore::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UniStore::deleteStore(int selectedStore) {
|
void UniStore::deleteStore(int selectedStore) {
|
||||||
std::string path = Config::StorePath;
|
std::string path = config->storePath();
|
||||||
path += dirContents[selectedStore].name;
|
path += dirContents[selectedStore].name;
|
||||||
deleteFile(path.c_str());
|
deleteFile(path.c_str());
|
||||||
// Refresh the list.
|
// Refresh the list.
|
||||||
@@ -402,9 +406,9 @@ void UniStore::deleteStore(int selectedStore) {
|
|||||||
Selection = 0;
|
Selection = 0;
|
||||||
dirContents.clear();
|
dirContents.clear();
|
||||||
storeInfo.clear();
|
storeInfo.clear();
|
||||||
chdir(Config::StorePath.c_str());
|
chdir(config->storePath().c_str());
|
||||||
getDirectoryContents(dirContents, {"unistore"});
|
getDirectoryContents(dirContents, {"unistore"});
|
||||||
for(uint i=0;i<dirContents.size();i++) {
|
for(uint i = 0; i < dirContents.size(); i++) {
|
||||||
storeInfo.push_back(parseStoreInfo(dirContents[i].name));
|
storeInfo.push_back(parseStoreInfo(dirContents[i].name));
|
||||||
descript();
|
descript();
|
||||||
loadStoreDesc();
|
loadStoreDesc();
|
||||||
@@ -459,10 +463,10 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
updateStore(Selection);
|
updateStore(Selection);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
Config::viewMode = 1;
|
config->viewMode(1);
|
||||||
} else {
|
} else {
|
||||||
Config::viewMode = 0;
|
config->viewMode(0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -479,10 +483,10 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
updateStore(Selection);
|
updateStore(Selection);
|
||||||
dropDownMenu = false;
|
dropDownMenu = false;
|
||||||
} else if (touching(touch, dropPos2[2])) {
|
} else if (touching(touch, dropPos2[2])) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
Config::viewMode = 1;
|
config->viewMode(1);
|
||||||
} else {
|
} else {
|
||||||
Config::viewMode = 0;
|
config->viewMode(0);
|
||||||
}
|
}
|
||||||
dropDownMenu = false;
|
dropDownMenu = false;
|
||||||
}
|
}
|
||||||
@@ -510,7 +514,7 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
loadStoreDesc();
|
loadStoreDesc();
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hHeld & KEY_UP && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))) {
|
if ((hHeld & KEY_UP && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))) {
|
||||||
@@ -524,11 +528,11 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
loadStoreDesc();
|
loadStoreDesc();
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hHeld & KEY_RIGHT && !keyRepeatDelay)) {
|
if ((hHeld & KEY_RIGHT && !keyRepeatDelay)) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
if (Selection < (int)storeInfo.size()-1-3) {
|
if (Selection < (int)storeInfo.size()-1-3) {
|
||||||
Selection += 3;
|
Selection += 3;
|
||||||
descript();
|
descript();
|
||||||
@@ -550,11 +554,11 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hHeld & KEY_LEFT && !keyRepeatDelay)) {
|
if ((hHeld & KEY_LEFT && !keyRepeatDelay)) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
if (Selection > 2) {
|
if (Selection > 2) {
|
||||||
Selection -= 3;
|
Selection -= 3;
|
||||||
descript();
|
descript();
|
||||||
@@ -576,12 +580,11 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_A) {
|
if (hDown & KEY_A) {
|
||||||
if (dirContents[Selection].isDirectory) {
|
if (!dirContents[Selection].isDirectory && storeInfo.size() != 0) {
|
||||||
} else if (storeInfo.size() != 0) {
|
|
||||||
if (ScriptHelper::checkIfValid(dirContents[Selection].name, 1) == true) {
|
if (ScriptHelper::checkIfValid(dirContents[Selection].name, 1) == true) {
|
||||||
updateStore(Selection);
|
updateStore(Selection);
|
||||||
currentStoreFile = dirContents[Selection].name;
|
currentStoreFile = dirContents[Selection].name;
|
||||||
@@ -591,9 +594,9 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
const std::string sheetURL = storeInfo[Selection].storeSheet;
|
const std::string sheetURL = storeInfo[Selection].storeSheet;
|
||||||
|
|
||||||
if (storeInfo[Selection].version == 0) {
|
if (storeInfo[Selection].version == 0) {
|
||||||
Gui::setScreen(std::make_unique<UniStoreV1>(JSON, sheetURL, displayInformations), Config::fading, true);
|
Gui::setScreen(std::make_unique<UniStoreV1>(JSON, sheetURL, displayInformations), config->screenFade(), true);
|
||||||
} else if (storeInfo[Selection].version == 1) {
|
} else if (storeInfo[Selection].version == 1) {
|
||||||
Gui::setScreen(std::make_unique<UniStoreV2>(JSON, sheetURL), Config::fading, true);
|
Gui::setScreen(std::make_unique<UniStoreV2>(JSON, sheetURL), config->screenFade(), true);
|
||||||
} else {
|
} else {
|
||||||
Msg::DisplayWarnMsg(Lang::get("UNISTORE_NOT_SUPPORTED"));
|
Msg::DisplayWarnMsg(Lang::get("UNISTORE_NOT_SUPPORTED"));
|
||||||
}
|
}
|
||||||
@@ -601,13 +604,13 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
if(Selection < screenPos) {
|
if(Selection < screenPos) {
|
||||||
screenPos = Selection;
|
screenPos = Selection;
|
||||||
} else if (Selection > screenPos + ENTRIES_PER_SCREEN - 1) {
|
} else if (Selection > screenPos + ENTRIES_PER_SCREEN - 1) {
|
||||||
screenPos = Selection - ENTRIES_PER_SCREEN + 1;
|
screenPos = Selection - ENTRIES_PER_SCREEN + 1;
|
||||||
}
|
}
|
||||||
} else if (Config::viewMode == 1) {
|
} else if (config->viewMode() == 1) {
|
||||||
if(Selection < screenPosList) {
|
if(Selection < screenPosList) {
|
||||||
screenPosList = Selection;
|
screenPosList = Selection;
|
||||||
} else if (Selection > screenPosList + ENTRIES_PER_LIST - 1) {
|
} else if (Selection > screenPosList + ENTRIES_PER_LIST - 1) {
|
||||||
@@ -616,9 +619,9 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_TOUCH) {
|
if (hDown & KEY_TOUCH) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)storeInfo.size();i++) {
|
for(int i = 0; i < ENTRIES_PER_SCREEN && i < (int)storeInfo.size(); i++) {
|
||||||
if(touch.py > 40+(i*57) && touch.py < 40+(i*57)+45) {
|
if (touch.py > 40+(i*57) && touch.py < 40+(i*57)+45) {
|
||||||
if (ScriptHelper::checkIfValid(dirContents[screenPos + i].name, 1) == true) {
|
if (ScriptHelper::checkIfValid(dirContents[screenPos + i].name, 1) == true) {
|
||||||
updateStore(screenPos + i);
|
updateStore(screenPos + i);
|
||||||
currentStoreFile = dirContents[screenPos + i].name;
|
currentStoreFile = dirContents[screenPos + i].name;
|
||||||
@@ -627,17 +630,17 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
displayInformations = handleIfDisplayText();
|
displayInformations = handleIfDisplayText();
|
||||||
const std::string sheetURL = storeInfo[screenPos + i].storeSheet;
|
const std::string sheetURL = storeInfo[screenPos + i].storeSheet;
|
||||||
if (storeInfo[screenPos + i].version == 0) {
|
if (storeInfo[screenPos + i].version == 0) {
|
||||||
Gui::setScreen(std::make_unique<UniStoreV1>(JSON, sheetURL, displayInformations), Config::fading, true);
|
Gui::setScreen(std::make_unique<UniStoreV1>(JSON, sheetURL, displayInformations), config->screenFade(), true);
|
||||||
} else if (storeInfo[screenPos + i].version == 1) {
|
} else if (storeInfo[screenPos + i].version == 1) {
|
||||||
Gui::setScreen(std::make_unique<UniStoreV2>(JSON, sheetURL), Config::fading, true);
|
Gui::setScreen(std::make_unique<UniStoreV2>(JSON, sheetURL), config->screenFade(), true);
|
||||||
} else {
|
} else {
|
||||||
Msg::DisplayWarnMsg(Lang::get("UNISTORE_NOT_SUPPORTED"));
|
Msg::DisplayWarnMsg(Lang::get("UNISTORE_NOT_SUPPORTED"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (Config::viewMode == 1) {
|
} else if (config->viewMode() == 1) {
|
||||||
for(int i=0;i<ENTRIES_PER_LIST && i<(int)storeInfo.size();i++) {
|
for(int i = 0; i < ENTRIES_PER_LIST && i < (int)storeInfo.size(); i++) {
|
||||||
if (touch.py > (i+1)*27 && touch.py < (i+2)*27) {
|
if (touch.py > (i+1)*27 && touch.py < (i+2)*27) {
|
||||||
if (ScriptHelper::checkIfValid(dirContents[screenPosList + i].name, 1) == true) {
|
if (ScriptHelper::checkIfValid(dirContents[screenPosList + i].name, 1) == true) {
|
||||||
updateStore(screenPosList + i);
|
updateStore(screenPosList + i);
|
||||||
@@ -648,9 +651,9 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
displayInformations = handleIfDisplayText();
|
displayInformations = handleIfDisplayText();
|
||||||
const std::string sheetURL = storeInfo[screenPosList + i].storeSheet;
|
const std::string sheetURL = storeInfo[screenPosList + i].storeSheet;
|
||||||
if (storeInfo[screenPosList + i].version == 0) {
|
if (storeInfo[screenPosList + i].version == 0) {
|
||||||
Gui::setScreen(std::make_unique<UniStoreV1>(JSON, sheetURL, displayInformations), Config::fading, true);
|
Gui::setScreen(std::make_unique<UniStoreV1>(JSON, sheetURL, displayInformations), config->screenFade(), true);
|
||||||
} else if (storeInfo[screenPosList + i].version == 1) {
|
} else if (storeInfo[screenPosList + i].version == 1) {
|
||||||
Gui::setScreen(std::make_unique<UniStoreV2>(JSON, sheetURL), Config::fading, true);
|
Gui::setScreen(std::make_unique<UniStoreV2>(JSON, sheetURL), config->screenFade(), true);
|
||||||
} else {
|
} else {
|
||||||
Msg::DisplayWarnMsg(Lang::get("UNISTORE_NOT_SUPPORTED"));
|
Msg::DisplayWarnMsg(Lang::get("UNISTORE_NOT_SUPPORTED"));
|
||||||
}
|
}
|
||||||
@@ -661,19 +664,18 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_START) {
|
if (hDown & KEY_START) {
|
||||||
if (Config::autoboot == 1) {
|
if (config->autoboot() == 1) {
|
||||||
if (Msg::promptMsg(Lang::get("DISABLE_AUTOBOOT"))) {
|
if (Msg::promptMsg(Lang::get("DISABLE_AUTOBOOT"))) {
|
||||||
Config::autoboot = 0;
|
config->autoboot(0);
|
||||||
Config::AutobootFile = "";
|
config->autobootFile("");
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (dirContents[Selection].isDirectory) {
|
if (!dirContents[Selection].isDirectory && storeInfo.size() != 0) {
|
||||||
} else if (storeInfo.size() != 0) {
|
|
||||||
if (ScriptHelper::checkIfValid(dirContents[Selection].name, 1) == true) {
|
if (ScriptHelper::checkIfValid(dirContents[Selection].name, 1) == true) {
|
||||||
if (Msg::promptMsg(Lang::get("AUTOBOOT_STORE"))) {
|
if (Msg::promptMsg(Lang::get("AUTOBOOT_STORE"))) {
|
||||||
Config::AutobootFile = Config::StorePath + dirContents[Selection].name;
|
config->autoboot(1);
|
||||||
Config::autoboot = 1;
|
config->autobootFile(config->storePath() + dirContents[Selection].name);
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -701,10 +703,10 @@ void UniStore::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
|
|
||||||
void UniStore::DrawSearch(void) const {
|
void UniStore::DrawSearch(void) const {
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("UNISTORE_SEARCH"), 400);
|
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), Lang::get("UNISTORE_SEARCH"), 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("UNISTORE_SEARCH"), 400);
|
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), Lang::get("UNISTORE_SEARCH"), 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
GFX::DrawSprite(sprites_uniStore_HD_idx, 140, 50, 0.2, 0.2);
|
GFX::DrawSprite(sprites_uniStore_HD_idx, 140, 50, 0.2, 0.2);
|
||||||
@@ -715,6 +717,7 @@ void UniStore::DrawSearch(void) const {
|
|||||||
GFX::DrawButton(URLBtn[1].x, URLBtn[1].y, Lang::get("GITHUB"));
|
GFX::DrawButton(URLBtn[1].x, URLBtn[1].y, Lang::get("GITHUB"));
|
||||||
GFX::DrawButton(URLBtn[2].x, URLBtn[2].y, "TinyDB");
|
GFX::DrawButton(URLBtn[2].x, URLBtn[2].y, "TinyDB");
|
||||||
GFX::DrawButton(URLBtn[3].x, URLBtn[3].y, "Universal DB");
|
GFX::DrawButton(URLBtn[3].x, URLBtn[3].y, "Universal DB");
|
||||||
|
|
||||||
// Selector.
|
// Selector.
|
||||||
Animation::Button(URLBtn[Selection].x, URLBtn[Selection].y, .060);
|
Animation::Button(URLBtn[Selection].x, URLBtn[Selection].y, .060);
|
||||||
}
|
}
|
||||||
@@ -752,9 +755,9 @@ void UniStore::SearchLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
Selection = 0;
|
Selection = 0;
|
||||||
mode = 4;
|
mode = 4;
|
||||||
} else if (Selection == 2) {
|
} else if (Selection == 2) {
|
||||||
ScriptHelper::downloadFile("https://tinydb.eiphax.tech/api/tinydb.unistore", Config::StorePath + "TinyDB.unistore", Lang::get("DOWNLOADING") + "TinyDB");
|
ScriptHelper::downloadFile("https://tinydb.eiphax.tech/api/tinydb.unistore", config->storePath() + "TinyDB.unistore", Lang::get("DOWNLOADING") + "TinyDB");
|
||||||
} else if (Selection == 3) {
|
} else if (Selection == 3) {
|
||||||
ScriptHelper::downloadFile("https://db.universal-team.net/unistore/universal-db.unistore", Config::StorePath + "Universal-DB.unistore", Lang::get("DOWNLOADING") + "Universal DB");
|
ScriptHelper::downloadFile("https://db.universal-team.net/unistore/universal-db.unistore", config->storePath() + "Universal-DB.unistore", Lang::get("DOWNLOADING") + "Universal DB");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -765,35 +768,35 @@ void UniStore::SearchLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
Selection = 0;
|
Selection = 0;
|
||||||
mode = 4;
|
mode = 4;
|
||||||
} else if (hDown & KEY_TOUCH && touching(touch, URLBtn[2])) {
|
} else if (hDown & KEY_TOUCH && touching(touch, URLBtn[2])) {
|
||||||
ScriptHelper::downloadFile("https://tinydb.eiphax.tech/api/tinydb.unistore", Config::StorePath + "TinyDB.unistore", Lang::get("DOWNLOADING") + "TinyDB");
|
ScriptHelper::downloadFile("https://tinydb.eiphax.tech/api/tinydb.unistore", config->storePath() + "TinyDB.unistore", Lang::get("DOWNLOADING") + "TinyDB");
|
||||||
} else if (hDown & KEY_TOUCH && touching(touch, URLBtn[3])) {
|
} else if (hDown & KEY_TOUCH && touching(touch, URLBtn[3])) {
|
||||||
ScriptHelper::downloadFile("https://db.universal-team.net/unistore/universal-db.unistore", Config::StorePath + "Universal-DB.unistore", Lang::get("DOWNLOADING") + "Universal DB");
|
ScriptHelper::downloadFile("https://db.universal-team.net/unistore/universal-db.unistore", config->storePath() + "Universal-DB.unistore", Lang::get("DOWNLOADING") + "Universal DB");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UniStore::DrawGitHubScreen(void) const {
|
void UniStore::DrawGitHubScreen(void) const {
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("GITHUB"), 400);
|
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), Lang::get("GITHUB"), 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("GITHUB"), 400);
|
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), Lang::get("GITHUB"), 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
GFX::DrawSprite(sprites_uniStore_HD_idx, 140, 50, 0.2, 0.2);
|
GFX::DrawSprite(sprites_uniStore_HD_idx, 140, 50, 0.2, 0.2);
|
||||||
GFX::DrawBottom();
|
GFX::DrawBottom();
|
||||||
GFX::DrawArrow(0, 218, 0, 1);
|
GFX::DrawArrow(0, 218, 0, 1);
|
||||||
|
|
||||||
Gui::DrawStringCentered(0, 28, 0.7f, Config::TxtColor, Lang::get("OWNER_AND_REPO"), 300);
|
Gui::DrawStringCentered(0, 28, 0.7f, config->textColor(), Lang::get("OWNER_AND_REPO"), 300);
|
||||||
Gui::DrawStringCentered(0, 108, 0.7f, Config::TxtColor, Lang::get("FILENAME"), 300);
|
Gui::DrawStringCentered(0, 108, 0.7f, config->textColor(), Lang::get("FILENAME"), 300);
|
||||||
|
|
||||||
Gui::Draw_Rect(GitHubPos[0].x, GitHubPos[0].y, GitHubPos[0].w, GitHubPos[0].h, Config::Color1);
|
Gui::Draw_Rect(GitHubPos[0].x, GitHubPos[0].y, GitHubPos[0].w, GitHubPos[0].h, config->barColor());
|
||||||
Gui::Draw_Rect(GitHubPos[1].x, GitHubPos[1].y, GitHubPos[1].w, GitHubPos[1].h, Config::Color1);
|
Gui::Draw_Rect(GitHubPos[1].x, GitHubPos[1].y, GitHubPos[1].w, GitHubPos[1].h, config->barColor());
|
||||||
Gui::Draw_Rect(GitHubPos[2].x, GitHubPos[2].y, GitHubPos[2].w, GitHubPos[2].h, Config::Color1);
|
Gui::Draw_Rect(GitHubPos[2].x, GitHubPos[2].y, GitHubPos[2].w, GitHubPos[2].h, config->barColor());
|
||||||
|
|
||||||
Gui::DrawStringCentered(0, 185, 0.7f, Config::TxtColor, Lang::get("OK"), 40);
|
Gui::DrawStringCentered(0, 185, 0.7f, config->textColor(), Lang::get("OK"), 40);
|
||||||
|
|
||||||
Gui::DrawStringCentered(0, 57, 0.5f, Config::TxtColor, OwnerAndRepo, 250);
|
Gui::DrawStringCentered(0, 57, 0.5f, config->textColor(), OwnerAndRepo, 250);
|
||||||
Gui::DrawStringCentered(0, 137, 0.5f, Config::TxtColor, fileName, 250);
|
Gui::DrawStringCentered(0, 137, 0.5f, config->textColor(), fileName, 250);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UniStore::GitHubLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
void UniStore::GitHubLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
@@ -811,7 +814,7 @@ void UniStore::GitHubLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
URL += OwnerAndRepo;
|
URL += OwnerAndRepo;
|
||||||
URL += "/raw/master/unistore/";
|
URL += "/raw/master/unistore/";
|
||||||
URL += fileName;
|
URL += fileName;
|
||||||
ScriptHelper::downloadFile(URL, Config::StorePath + fileName, Lang::get("DOWNLOADING") + fileName);
|
ScriptHelper::downloadFile(URL, config->storePath() + fileName, Lang::get("DOWNLOADING") + fileName);
|
||||||
} else {
|
} else {
|
||||||
notConnectedMsg();
|
notConnectedMsg();
|
||||||
}
|
}
|
||||||
@@ -828,27 +831,27 @@ void UniStore::GitHubLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
|
|
||||||
void UniStore::DrawFullURLScreen(void) const {
|
void UniStore::DrawFullURLScreen(void) const {
|
||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("FULL_URL"), 400);
|
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), Lang::get("FULL_URL"), 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("FULL_URL"), 400);
|
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), Lang::get("FULL_URL"), 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
GFX::DrawSprite(sprites_uniStore_HD_idx, 140, 50, 0.2, 0.2);
|
GFX::DrawSprite(sprites_uniStore_HD_idx, 140, 50, 0.2, 0.2);
|
||||||
GFX::DrawBottom();
|
GFX::DrawBottom();
|
||||||
GFX::DrawArrow(0, 218, 0, 1);
|
GFX::DrawArrow(0, 218, 0, 1);
|
||||||
|
|
||||||
Gui::DrawStringCentered(0, 28, 0.7f, Config::TxtColor, Lang::get("FULL_URL"), 320);
|
Gui::DrawStringCentered(0, 28, 0.7f, config->textColor(), Lang::get("FULL_URL"), 320);
|
||||||
Gui::DrawStringCentered(0, 108, 0.7f, Config::TxtColor, Lang::get("FILENAME"), 320);
|
Gui::DrawStringCentered(0, 108, 0.7f, config->textColor(), Lang::get("FILENAME"), 320);
|
||||||
|
|
||||||
Gui::Draw_Rect(GitHubPos[0].x, GitHubPos[0].y, GitHubPos[0].w, GitHubPos[0].h, Config::Color1);
|
Gui::Draw_Rect(GitHubPos[0].x, GitHubPos[0].y, GitHubPos[0].w, GitHubPos[0].h, config->barColor());
|
||||||
Gui::Draw_Rect(GitHubPos[1].x, GitHubPos[1].y, GitHubPos[1].w, GitHubPos[1].h, Config::Color1);
|
Gui::Draw_Rect(GitHubPos[1].x, GitHubPos[1].y, GitHubPos[1].w, GitHubPos[1].h, config->barColor());
|
||||||
Gui::Draw_Rect(GitHubPos[2].x, GitHubPos[2].y, GitHubPos[2].w, GitHubPos[2].h, Config::Color1);
|
Gui::Draw_Rect(GitHubPos[2].x, GitHubPos[2].y, GitHubPos[2].w, GitHubPos[2].h, config->barColor());
|
||||||
|
|
||||||
Gui::DrawStringCentered(0, 185, 0.7f, Config::TxtColor, Lang::get("OK"), 40);
|
Gui::DrawStringCentered(0, 185, 0.7f, config->textColor(), Lang::get("OK"), 40);
|
||||||
|
|
||||||
Gui::DrawStringCentered(0, 57, 0.45f, Config::TxtColor, FullURL, 250);
|
Gui::DrawStringCentered(0, 57, 0.45f, config->textColor(), FullURL, 250);
|
||||||
Gui::DrawStringCentered(0, 137, 0.45f, Config::TxtColor, fileName, 250);
|
Gui::DrawStringCentered(0, 137, 0.45f, config->textColor(), fileName, 250);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UniStore::FullURLLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
void UniStore::FullURLLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
@@ -862,7 +865,7 @@ void UniStore::FullURLLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
|
|
||||||
if (hDown & KEY_TOUCH && touching(touch, GitHubPos[2])) {
|
if (hDown & KEY_TOUCH && touching(touch, GitHubPos[2])) {
|
||||||
if (checkWifiStatus() == true) {
|
if (checkWifiStatus() == true) {
|
||||||
ScriptHelper::downloadFile(FullURL, Config::StorePath + fileName, Lang::get("DOWNLOADING") + fileName);
|
ScriptHelper::downloadFile(FullURL, config->storePath() + fileName, Lang::get("DOWNLOADING") + fileName);
|
||||||
} else {
|
} else {
|
||||||
notConnectedMsg();
|
notConnectedMsg();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include "unistore_v1.hpp"
|
#include "unistore_v1.hpp"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
extern std::unique_ptr<Config> config;
|
||||||
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
||||||
extern u32 getColor(std::string colorString);
|
extern u32 getColor(std::string colorString);
|
||||||
extern bool isScriptSelected;
|
extern bool isScriptSelected;
|
||||||
@@ -57,25 +58,25 @@ UniStoreV1::UniStoreV1(nlohmann::json &JSON, const std::string sheetPath, bool d
|
|||||||
|
|
||||||
u32 colorTemp;
|
u32 colorTemp;
|
||||||
colorTemp = getColor(ScriptHelper::getString(this->storeJson, "storeInfo", "barColor"));
|
colorTemp = getColor(ScriptHelper::getString(this->storeJson, "storeInfo", "barColor"));
|
||||||
barColor = colorTemp == 0 ? Config::Color1 : colorTemp;
|
barColor = colorTemp == 0 ? config->barColor() : colorTemp;
|
||||||
|
|
||||||
colorTemp = getColor(ScriptHelper::getString(this->storeJson, "storeInfo", "bgTopColor"));
|
colorTemp = getColor(ScriptHelper::getString(this->storeJson, "storeInfo", "bgTopColor"));
|
||||||
bgTopColor = colorTemp == 0 ? Config::Color2 : colorTemp;
|
bgTopColor = colorTemp == 0 ? config->topBG() : colorTemp;
|
||||||
|
|
||||||
colorTemp = getColor(ScriptHelper::getString(this->storeJson, "storeInfo", "bgBottomColor"));
|
colorTemp = getColor(ScriptHelper::getString(this->storeJson, "storeInfo", "bgBottomColor"));
|
||||||
bgBottomColor = colorTemp == 0 ? Config::Color3 : colorTemp;
|
bgBottomColor = colorTemp == 0 ? config->bottomBG() : colorTemp;
|
||||||
|
|
||||||
colorTemp = getColor(ScriptHelper::getString(this->storeJson, "storeInfo", "textColor"));
|
colorTemp = getColor(ScriptHelper::getString(this->storeJson, "storeInfo", "textColor"));
|
||||||
TextColor = colorTemp == 0 ? Config::TxtColor : colorTemp;
|
TextColor = colorTemp == 0 ? config->textColor() : colorTemp;
|
||||||
|
|
||||||
colorTemp = getColor(ScriptHelper::getString(this->storeJson, "storeInfo", "selectedColor"));
|
colorTemp = getColor(ScriptHelper::getString(this->storeJson, "storeInfo", "selectedColor"));
|
||||||
selected = colorTemp == 0 ? Config::SelectedColor : colorTemp;
|
selected = colorTemp == 0 ? config->selectedColor() : colorTemp;
|
||||||
|
|
||||||
colorTemp = getColor(ScriptHelper::getString(this->storeJson, "storeInfo", "unselectedColor"));
|
colorTemp = getColor(ScriptHelper::getString(this->storeJson, "storeInfo", "unselectedColor"));
|
||||||
unselected = colorTemp == 0 ? Config::UnselectedColor : colorTemp;
|
unselected = colorTemp == 0 ? config->unselectedColor() : colorTemp;
|
||||||
|
|
||||||
colorTemp = getColor(ScriptHelper::getString(this->storeJson, "storeInfo", "progressbarColor"));
|
colorTemp = getColor(ScriptHelper::getString(this->storeJson, "storeInfo", "progressbarColor"));
|
||||||
progressBar = colorTemp == 0 ? Config::progressbarColor : colorTemp;
|
progressBar = colorTemp == 0 ? config->progressbarColor() : colorTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UniStoreV1::drawBlend(int key, int x, int y) const {
|
void UniStoreV1::drawBlend(int key, int x, int y) const {
|
||||||
@@ -122,7 +123,7 @@ void UniStoreV1::Draw(void) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (displayInformations != false) {
|
if (displayInformations != false) {
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.7f, TextColor, std::string(this->storeJson["storeInfo"]["title"]), 400);
|
Gui::DrawStringCentered(0, 0, 0.7f, TextColor, std::string(this->storeJson["storeInfo"]["title"]), 400);
|
||||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), 239-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, TextColor, entryAmount);
|
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), 239-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, TextColor, entryAmount);
|
||||||
} else {
|
} else {
|
||||||
@@ -160,7 +161,7 @@ void UniStoreV1::Draw(void) const {
|
|||||||
GFX::DrawArrow(0, 218, 0, 1);
|
GFX::DrawArrow(0, 218, 0, 1);
|
||||||
GFX::DrawSpriteBlend(sprites_dropdown_idx, arrowPos[3].x, arrowPos[3].y);
|
GFX::DrawSpriteBlend(sprites_dropdown_idx, arrowPos[3].x, arrowPos[3].y);
|
||||||
|
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
for(int i = 0; i < ENTRIES_PER_SCREEN && i < (int)this->storeJson.at("storeContent").size(); i++) {
|
for(int i = 0; i < ENTRIES_PER_SCREEN && i < (int)this->storeJson.at("storeContent").size(); i++) {
|
||||||
info = this->storeJson["storeContent"][screenPos + i]["info"]["title"];
|
info = this->storeJson["storeContent"][screenPos + i]["info"]["title"];
|
||||||
if (screenPos + i == Selection) {
|
if (screenPos + i == Selection) {
|
||||||
@@ -180,10 +181,10 @@ void UniStoreV1::Draw(void) const {
|
|||||||
}
|
}
|
||||||
Gui::DrawStringCentered(0, 50+(i*57), 0.7f, TextColor, info, 320);
|
Gui::DrawStringCentered(0, 50+(i*57), 0.7f, TextColor, info, 320);
|
||||||
}
|
}
|
||||||
} else if (Config::viewMode == 1) {
|
} else if (config->viewMode() == 1) {
|
||||||
for(int i = 0; i < ENTRIES_PER_LIST && i < (int)this->storeJson.at("storeContent").size(); i++) {
|
for(int i = 0; i < ENTRIES_PER_LIST && i < (int)this->storeJson.at("storeContent").size(); i++) {
|
||||||
info = this->storeJson["storeContent"][screenPosList + i]["info"]["title"];
|
info = this->storeJson["storeContent"][screenPosList + i]["info"]["title"];
|
||||||
if(screenPosList + i == Selection) {
|
if (screenPosList + i == Selection) {
|
||||||
if (this->storeJson.at("storeInfo").contains("buttonSmall") && sheetHasLoaded == true) {
|
if (this->storeJson.at("storeInfo").contains("buttonSmall") && sheetHasLoaded == true) {
|
||||||
Gui::DrawSprite(this->sheet, this->storeJson["storeInfo"]["buttonSmall"], 0, (i+1)*27);
|
Gui::DrawSprite(this->sheet, this->storeJson["storeInfo"]["buttonSmall"], 0, (i+1)*27);
|
||||||
} else {
|
} else {
|
||||||
@@ -206,11 +207,11 @@ void UniStoreV1::Draw(void) const {
|
|||||||
if (dropDownMenu) {
|
if (dropDownMenu) {
|
||||||
// Draw Operation Box.
|
// Draw Operation Box.
|
||||||
Gui::Draw_Rect(0, 25, 140, 44, barColor);
|
Gui::Draw_Rect(0, 25, 140, 44, barColor);
|
||||||
Gui::drawAnimatedSelector(dropPos[0].x, dropPos[0].y, dropPos[0].w, dropPos[0].h, .090, TRANSPARENT, Config::SelectedColor);
|
Gui::drawAnimatedSelector(dropPos[0].x, dropPos[0].y, dropPos[0].w, dropPos[0].h, .090, TRANSPARENT, selected);
|
||||||
// Draw Dropdown Icons.
|
// Draw Dropdown Icons.
|
||||||
GFX::DrawSpriteBlend(sprites_view_idx, dropPos[0].x, dropPos[0].y);
|
GFX::DrawSpriteBlend(sprites_view_idx, dropPos[0].x, dropPos[0].y);
|
||||||
// Dropdown Text.
|
// Dropdown Text.
|
||||||
Gui::DrawString(dropPos[0].x+30, dropPos[0].y+5, 0.4f, Config::TxtColor, Lang::get("VIEW_DDM"), 100);
|
Gui::DrawString(dropPos[0].x+30, dropPos[0].y+5, 0.4f, TextColor, Lang::get("VIEW_DDM"), 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
@@ -230,21 +231,22 @@ void UniStoreV1::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
if (hDown & KEY_UP) {
|
if (hDown & KEY_UP) {
|
||||||
if (dropSelection > 0) dropSelection--;
|
if (dropSelection > 0) dropSelection--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_A) {
|
if (hDown & KEY_A) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
Config::viewMode = 1;
|
config->viewMode(1);
|
||||||
} else {
|
} else {
|
||||||
Config::viewMode = 0;
|
config->viewMode(0);
|
||||||
}
|
}
|
||||||
dropDownMenu = false;
|
dropDownMenu = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_TOUCH) {
|
if (hDown & KEY_TOUCH) {
|
||||||
if (touching(touch, dropPos[0])) {
|
if (touching(touch, dropPos[0])) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
Config::viewMode = 1;
|
config->viewMode(1);
|
||||||
} else {
|
} else {
|
||||||
Config::viewMode = 0;
|
config->viewMode(0);
|
||||||
}
|
}
|
||||||
dropDownMenu = false;
|
dropDownMenu = false;
|
||||||
}
|
}
|
||||||
@@ -257,7 +259,7 @@ void UniStoreV1::Logic(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]))) {
|
||||||
if (!didAutoboot) didAutoboot = true;
|
if (!didAutoboot) didAutoboot = true;
|
||||||
Gui::screenBack(Config::fading);
|
Gui::screenBack(config->screenFade());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,7 +271,7 @@ void UniStoreV1::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
Selection = (int)this->storeJson.at("storeContent").size()-1;
|
Selection = (int)this->storeJson.at("storeContent").size()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Go one entry down.
|
// Go one entry down.
|
||||||
@@ -280,11 +282,11 @@ void UniStoreV1::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
Selection = 0;
|
Selection = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hHeld & KEY_RIGHT && !keyRepeatDelay)) {
|
if ((hHeld & KEY_RIGHT && !keyRepeatDelay)) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
if (Selection < (int)this->storeJson.at("storeContent").size()-1-3) {
|
if (Selection < (int)this->storeJson.at("storeContent").size()-1-3) {
|
||||||
Selection += 3;
|
Selection += 3;
|
||||||
} else {
|
} else {
|
||||||
@@ -298,11 +300,11 @@ void UniStoreV1::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hHeld & KEY_LEFT && !keyRepeatDelay)) {
|
if ((hHeld & KEY_LEFT && !keyRepeatDelay)) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
if (Selection > 2) {
|
if (Selection > 2) {
|
||||||
Selection -= 3;
|
Selection -= 3;
|
||||||
} else {
|
} else {
|
||||||
@@ -316,13 +318,13 @@ void UniStoreV1::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
keyRepeatDelay = Config::keyDelay;
|
keyRepeatDelay = config->keyDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute touched Entry.
|
// Execute touched Entry.
|
||||||
if (hDown & KEY_TOUCH) {
|
if (hDown & KEY_TOUCH) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)this->storeJson.at("storeContent").size();i++) {
|
for(int i = 0; i < ENTRIES_PER_SCREEN && i < (int)this->storeJson.at("storeContent").size(); i++) {
|
||||||
if (touch.py > 40+(i*57) && touch.py < 40+(i*57)+45) {
|
if (touch.py > 40+(i*57) && touch.py < 40+(i*57)+45) {
|
||||||
Selection = screenPos + i;
|
Selection = screenPos + i;
|
||||||
std::string info = this->storeJson["storeContent"][Selection]["info"]["title"];
|
std::string info = this->storeJson["storeContent"][Selection]["info"]["title"];
|
||||||
@@ -331,8 +333,8 @@ void UniStoreV1::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (Config::viewMode == 1) {
|
} else if (config->viewMode() == 1) {
|
||||||
for(int i=0;i<ENTRIES_PER_LIST && i<(int)this->storeJson.at("storeContent").size();i++) {
|
for(int i = 0; i < ENTRIES_PER_LIST && i < (int)this->storeJson.at("storeContent").size(); i++) {
|
||||||
if (touch.py > (i+1)*27 && touch.py < (i+2)*27) {
|
if (touch.py > (i+1)*27 && touch.py < (i+2)*27) {
|
||||||
Selection = screenPosList + i;
|
Selection = screenPosList + i;
|
||||||
std::string info = this->storeJson["storeContent"][Selection]["info"]["title"];
|
std::string info = this->storeJson["storeContent"][Selection]["info"]["title"];
|
||||||
@@ -351,14 +353,14 @@ void UniStoreV1::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
if(Selection < screenPos) {
|
if (Selection < screenPos) {
|
||||||
screenPos = Selection;
|
screenPos = Selection;
|
||||||
} else if (Selection > screenPos + ENTRIES_PER_SCREEN - 1) {
|
} else if (Selection > screenPos + ENTRIES_PER_SCREEN - 1) {
|
||||||
screenPos = Selection - ENTRIES_PER_SCREEN + 1;
|
screenPos = Selection - ENTRIES_PER_SCREEN + 1;
|
||||||
}
|
}
|
||||||
} else if (Config::viewMode == 1) {
|
} else if (config->viewMode() == 1) {
|
||||||
if(Selection < screenPosList) {
|
if (Selection < screenPosList) {
|
||||||
screenPosList = Selection;
|
screenPosList = Selection;
|
||||||
} else if (Selection > screenPosList + ENTRIES_PER_LIST - 1) {
|
} else if (Selection > screenPosList + ENTRIES_PER_LIST - 1) {
|
||||||
screenPosList = Selection - ENTRIES_PER_LIST + 1;
|
screenPosList = Selection - ENTRIES_PER_LIST + 1;
|
||||||
@@ -371,87 +373,87 @@ void UniStoreV1::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
// Execute Entry.
|
// Execute Entry.
|
||||||
Result UniStoreV1::execute() {
|
Result UniStoreV1::execute() {
|
||||||
Result ret = NONE; // No Error has been occured now.
|
Result ret = NONE; // No Error has been occured now.
|
||||||
for(int i=0;i<(int)this->storeJson.at("storeContent").at(Selection).at("script").size();i++) {
|
for(int i = 0; i < (int)this->storeJson.at("storeContent").at(Selection).at("script").size(); i++) {
|
||||||
if (ret == NONE) {
|
if (ret == NONE) {
|
||||||
std::string type = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("type");
|
std::string type = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("type");
|
||||||
if(type == "deleteFile") {
|
if (type == "deleteFile") {
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
std::string file, message;
|
std::string file, message;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("file")) file = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("file");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("file")) file = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("file");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("message");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("message");
|
||||||
if(!missing) ret = ScriptHelper::removeFile(file, message);
|
if (!missing) ret = ScriptHelper::removeFile(file, message);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if(type == "downloadFile") {
|
} else if (type == "downloadFile") {
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
std::string file, output, message;
|
std::string file, output, message;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("file")) file = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("file");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("file")) file = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("file");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("output")) output = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("output");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("output")) output = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("output");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("message");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("message");
|
||||||
if(!missing) ret = ScriptHelper::downloadFile(file, output, message);
|
if (!missing) ret = ScriptHelper::downloadFile(file, output, message);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if(type == "downloadRelease") {
|
} else if (type == "downloadRelease") {
|
||||||
bool missing = false, includePrereleases = false, showVersions = false;
|
bool missing = false, includePrereleases = false, showVersions = false;
|
||||||
std::string repo, file, output, message;
|
std::string repo, file, output, message;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("repo")) repo = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("repo");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("repo")) repo = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("repo");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("file")) file = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("file");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("file")) file = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("file");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("output")) output = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("output");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("output")) output = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("output");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("includePrereleases") && this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("includePrereleases").is_boolean())
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("includePrereleases") && this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("includePrereleases").is_boolean())
|
||||||
includePrereleases = this->storeJson.at(Selection).at("script").at(i).at("includePrereleases");
|
includePrereleases = this->storeJson.at(Selection).at("script").at(i).at("includePrereleases");
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("showVersions") && this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("showVersions").is_boolean())
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("showVersions") && this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("showVersions").is_boolean())
|
||||||
showVersions = this->storeJson.at(Selection).at("script").at(i).at("showVersions");
|
showVersions = this->storeJson.at(Selection).at("script").at(i).at("showVersions");
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("message");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("message");
|
||||||
if(!missing) ret = ScriptHelper::downloadRelease(repo, file, output, includePrereleases, showVersions, message);
|
if (!missing) ret = ScriptHelper::downloadRelease(repo, file, output, includePrereleases, showVersions, message);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if(type == "extractFile") {
|
} else if (type == "extractFile") {
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
std::string file, input, output, message;
|
std::string file, input, output, message;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("file")) file = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("file");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("file")) file = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("file");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("input")) input = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("input");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("input")) input = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("input");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("output")) output = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("output");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("output")) output = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("output");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("message");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("message");
|
||||||
if(!missing) ScriptHelper::extractFile(file, input, output, message);
|
if (!missing) ScriptHelper::extractFile(file, input, output, message);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if(type == "installCia") {
|
} else if (type == "installCia") {
|
||||||
bool missing = false, updateSelf = false;
|
bool missing = false, updateSelf = false;
|
||||||
std::string file, message;
|
std::string file, message;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("file")) file = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("file");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("file")) file = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("file");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("updateSelf") && this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("updateSelf").is_boolean()) {
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("updateSelf") && this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("updateSelf").is_boolean()) {
|
||||||
updateSelf = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("updateSelf");
|
updateSelf = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("updateSelf");
|
||||||
}
|
}
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("message");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("message");
|
||||||
if(!missing) ScriptHelper::installFile(file, updateSelf, message);
|
if (!missing) ScriptHelper::installFile(file, updateSelf, message);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if (type == "mkdir") {
|
} else if (type == "mkdir") {
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
std::string directory, message;
|
std::string directory, message;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("directory")) directory = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("directory");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("directory")) directory = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("directory");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(!missing) makeDirs(directory.c_str());
|
if (!missing) makeDirs(directory.c_str());
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if (type == "rmdir") {
|
} else if (type == "rmdir") {
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
std::string directory, message, promptmsg;
|
std::string directory, message, promptmsg;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("directory")) directory = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("directory");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("directory")) directory = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("directory");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
promptmsg = Lang::get("DELETE_PROMPT") + "\n" + directory;
|
promptmsg = Lang::get("DELETE_PROMPT") + "\n" + directory;
|
||||||
if(!missing) {
|
if (!missing) {
|
||||||
if(access(directory.c_str(), F_OK) != 0 ) {
|
if (access(directory.c_str(), F_OK) != 0 ) {
|
||||||
ret = DELETE_ERROR;
|
ret = DELETE_ERROR;
|
||||||
} else {
|
} else {
|
||||||
if (Msg::promptMsg(promptmsg)) {
|
if (Msg::promptMsg(promptmsg)) {
|
||||||
@@ -464,25 +466,25 @@ Result UniStoreV1::execute() {
|
|||||||
} else if (type == "mkfile") {
|
} else if (type == "mkfile") {
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
std::string file;
|
std::string file;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("file")) file = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("file");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("file")) file = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("file");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(!missing) ScriptHelper::createFile(file.c_str());
|
if (!missing) ScriptHelper::createFile(file.c_str());
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if (type == "timeMsg") {
|
} else if (type == "timeMsg") {
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
std::string message;
|
std::string message;
|
||||||
int seconds;
|
int seconds;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("message");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("message");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("seconds") && this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("seconds").is_number())
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("seconds") && this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("seconds").is_number())
|
||||||
seconds = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("seconds");
|
seconds = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("seconds");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(!missing) ScriptHelper::displayTimeMsg(message, seconds);
|
if (!missing) ScriptHelper::displayTimeMsg(message, seconds);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if (type == "saveConfig") {
|
} else if (type == "saveConfig") {
|
||||||
Config::save();
|
config->save();
|
||||||
|
|
||||||
} else if (type == "notImplemented") {
|
} else if (type == "notImplemented") {
|
||||||
notImplemented();
|
notImplemented();
|
||||||
@@ -491,39 +493,39 @@ Result UniStoreV1::execute() {
|
|||||||
std::string TitleID = "";
|
std::string TitleID = "";
|
||||||
std::string message = "";
|
std::string message = "";
|
||||||
bool isNAND = false, missing = false;
|
bool isNAND = false, missing = false;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("TitleID")) TitleID = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("TitleID");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("TitleID")) TitleID = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("TitleID");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("NAND") && this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("NAND").is_boolean()) isNAND = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("NAND");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("NAND") && this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("NAND").is_boolean()) isNAND = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("NAND");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("message");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("message");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(!missing) ScriptHelper::bootTitle(TitleID, isNAND, message);
|
if (!missing) ScriptHelper::bootTitle(TitleID, isNAND, message);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if (type == "promptMessage") {
|
} else if (type == "promptMessage") {
|
||||||
std::string Message = "";
|
std::string Message = "";
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) Message = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("message");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) Message = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("message");
|
||||||
ret = ScriptHelper::prompt(Message);
|
ret = ScriptHelper::prompt(Message);
|
||||||
|
|
||||||
} else if (type == "copy") {
|
} else if (type == "copy") {
|
||||||
std::string Message = "", source = "", destination = "";
|
std::string Message = "", source = "", destination = "";
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("source")) source = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("source");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("source")) source = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("source");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("destination")) destination = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("destination");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("destination")) destination = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("destination");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) Message = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("message");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) Message = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("message");
|
||||||
if (!missing) ret = ScriptHelper::copyFile(source, destination, Message);
|
if (!missing) ret = ScriptHelper::copyFile(source, destination, Message);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if (type == "move") {
|
} else if (type == "move") {
|
||||||
std::string Message = "", oldFile = "", newFile = "";
|
std::string Message = "", oldFile = "", newFile = "";
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("old")) oldFile = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("old");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("old")) oldFile = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("old");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("new")) newFile = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("new");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("new")) newFile = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("new");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) Message = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("message");
|
if (this->storeJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) Message = this->storeJson.at("storeContent").at(Selection).at("script").at(i).at("message");
|
||||||
if (!missing) ret = ScriptHelper::renameFile(oldFile, newFile, Message);
|
if (!missing) ret = ScriptHelper::renameFile(oldFile, newFile, Message);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
extern std::unique_ptr<Config> config;
|
||||||
extern u32 getColor(std::string colorString);
|
extern u32 getColor(std::string colorString);
|
||||||
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
||||||
#define STORE_ENTRIES 15
|
#define STORE_ENTRIES 15
|
||||||
@@ -92,7 +93,7 @@ void UniStoreV2::DrawBaseTop(void) const {
|
|||||||
Gui::Draw_Rect(0, 0, 400, 25, this->darkMode ? this->barColorDark : this->barColorLight);
|
Gui::Draw_Rect(0, 0, 400, 25, this->darkMode ? this->barColorDark : this->barColorLight);
|
||||||
Gui::Draw_Rect(0, 25, 400, 190, this->darkMode ? this->bgColorDark : this->bgColorLight);
|
Gui::Draw_Rect(0, 25, 400, 190, this->darkMode ? this->bgColorDark : this->bgColorLight);
|
||||||
Gui::Draw_Rect(0, 215, 400, 25, this->darkMode ? this->barColorDark : this->barColorLight);
|
Gui::Draw_Rect(0, 215, 400, 25, this->darkMode ? this->barColorDark : this->barColorLight);
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
GFX::DrawSprite(sprites_top_screen_top_idx, 0, 0);
|
GFX::DrawSprite(sprites_top_screen_top_idx, 0, 0);
|
||||||
GFX::DrawSprite(sprites_top_screen_bot_idx, 0, 215);
|
GFX::DrawSprite(sprites_top_screen_bot_idx, 0, 215);
|
||||||
}
|
}
|
||||||
@@ -103,7 +104,7 @@ void UniStoreV2::DrawBaseBottom(void) const {
|
|||||||
Gui::Draw_Rect(0, 0, 320, 25, this->darkMode ? this->barColorDark : this->barColorLight);
|
Gui::Draw_Rect(0, 0, 320, 25, this->darkMode ? this->barColorDark : this->barColorLight);
|
||||||
Gui::Draw_Rect(0, 25, 320, 190, this->darkMode ? this->bgColorDark : this->bgColorLight);
|
Gui::Draw_Rect(0, 25, 320, 190, this->darkMode ? this->bgColorDark : this->bgColorLight);
|
||||||
Gui::Draw_Rect(0, 215, 320, 25, this->darkMode ? this->barColorDark : this->barColorLight);
|
Gui::Draw_Rect(0, 215, 320, 25, this->darkMode ? this->barColorDark : this->barColorLight);
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
GFX::DrawSprite(sprites_top_screen_top_idx, 0, 0);
|
GFX::DrawSprite(sprites_top_screen_top_idx, 0, 0);
|
||||||
GFX::DrawSprite(sprites_top_screen_bot_idx, 0, 215);
|
GFX::DrawSprite(sprites_top_screen_bot_idx, 0, 215);
|
||||||
}
|
}
|
||||||
@@ -230,7 +231,7 @@ void UniStoreV2::parseObjects(int selection) {
|
|||||||
|
|
||||||
void UniStoreV2::DrawSearchMenu(void) const {
|
void UniStoreV2::DrawSearchMenu(void) const {
|
||||||
this->DrawBaseTop();
|
this->DrawBaseTop();
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.7f, this->returnTextColor(), Lang::get("SEARCH_MENU"), 400);
|
Gui::DrawStringCentered(0, 0, 0.7f, this->returnTextColor(), Lang::get("SEARCH_MENU"), 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 2, 0.7f, this->returnTextColor(), Lang::get("SEARCH_MENU"), 400);
|
Gui::DrawStringCentered(0, 2, 0.7f, this->returnTextColor(), Lang::get("SEARCH_MENU"), 400);
|
||||||
@@ -279,13 +280,13 @@ void UniStoreV2::displaySelectedEntry(int selection) const {
|
|||||||
Gui::DrawStringCentered(0, 218, 0.7f, this->returnTextColor(), std::to_string(this->downloadPage + 1) + " | " + std::to_string(1 + (this->objects.size() / DOWNLOAD_ENTRIES)));
|
Gui::DrawStringCentered(0, 218, 0.7f, this->returnTextColor(), std::to_string(this->downloadPage + 1) + " | " + std::to_string(1 + (this->objects.size() / DOWNLOAD_ENTRIES)));
|
||||||
|
|
||||||
if (this->storeJson.at("storeContent").at(selection).at("info").contains("title")) {
|
if (this->storeJson.at("storeContent").at(selection).at("info").contains("title")) {
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.7f, this->returnTextColor(), (std::string)this->storeJson.at("storeContent").at(selection).at("info").at("title"), 400);
|
Gui::DrawStringCentered(0, 0, 0.7f, this->returnTextColor(), (std::string)this->storeJson.at("storeContent").at(selection).at("info").at("title"), 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 2, 0.7f, this->returnTextColor(), (std::string)this->storeJson.at("storeContent").at(selection).at("info").at("title"), 400);
|
Gui::DrawStringCentered(0, 2, 0.7f, this->returnTextColor(), (std::string)this->storeJson.at("storeContent").at(selection).at("info").at("title"), 400);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.7f, this->returnTextColor(), "?", 400);
|
Gui::DrawStringCentered(0, 0, 0.7f, this->returnTextColor(), "?", 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 2, 0.7f, this->returnTextColor(), "?", 400);
|
Gui::DrawStringCentered(0, 2, 0.7f, this->returnTextColor(), "?", 400);
|
||||||
@@ -350,7 +351,7 @@ void UniStoreV2::Draw(void) const {
|
|||||||
if (this->mode == 0) {
|
if (this->mode == 0) {
|
||||||
this->DrawBaseTop();
|
this->DrawBaseTop();
|
||||||
|
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.6f, this->returnTextColor(), (std::string)this->storeJson.at("storeInfo").at("title"), 400);
|
Gui::DrawStringCentered(0, 0, 0.6f, this->returnTextColor(), (std::string)this->storeJson.at("storeInfo").at("title"), 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 2, 0.6f, this->returnTextColor(), (std::string)this->storeJson.at("storeInfo").at("title"), 400);
|
Gui::DrawStringCentered(0, 2, 0.6f, this->returnTextColor(), (std::string)this->storeJson.at("storeInfo").at("title"), 400);
|
||||||
@@ -368,7 +369,7 @@ void UniStoreV2::Draw(void) const {
|
|||||||
} else if (this->mode == 1) {
|
} else if (this->mode == 1) {
|
||||||
this->DrawBaseTop();
|
this->DrawBaseTop();
|
||||||
|
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.6f, this->returnTextColor(), (std::string)this->storeJson.at("storeInfo").at("title"), 400);
|
Gui::DrawStringCentered(0, 0, 0.6f, this->returnTextColor(), (std::string)this->storeJson.at("storeInfo").at("title"), 400);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 2, 0.6f, this->returnTextColor(), (std::string)this->storeJson.at("storeInfo").at("title"), 400);
|
Gui::DrawStringCentered(0, 2, 0.6f, this->returnTextColor(), (std::string)this->storeJson.at("storeInfo").at("title"), 400);
|
||||||
@@ -470,7 +471,7 @@ void UniStoreV2::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
if (this->mode == 0) {
|
if (this->mode == 0) {
|
||||||
if (hDown & KEY_B) {
|
if (hDown & KEY_B) {
|
||||||
if (!didAutoboot) didAutoboot = true;
|
if (!didAutoboot) didAutoboot = true;
|
||||||
Gui::screenBack(Config::fading);
|
Gui::screenBack(config->screenFade());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -554,7 +555,7 @@ void UniStoreV2::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
} else if (this->mode == 1) {
|
} else if (this->mode == 1) {
|
||||||
if (hDown & KEY_B) {
|
if (hDown & KEY_B) {
|
||||||
if (!didAutoboot) didAutoboot = true;
|
if (!didAutoboot) didAutoboot = true;
|
||||||
Gui::screenBack(Config::fading);
|
Gui::screenBack(config->screenFade());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -827,87 +828,87 @@ void UniStoreV2::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
// Execute | run the script.
|
// Execute | run the script.
|
||||||
Result UniStoreV2::runFunctions(std::string entry) {
|
Result UniStoreV2::runFunctions(std::string entry) {
|
||||||
Result ret = NONE; // No Error as of yet.
|
Result ret = NONE; // No Error as of yet.
|
||||||
for(int i=0;i<(int)this->storeJson.at("storeContent").at(this->selection).at(entry).size();i++) {
|
for(int i = 0; i < (int)this->storeJson.at("storeContent").at(this->selection).at(entry).size(); i++) {
|
||||||
if (ret == NONE) {
|
if (ret == NONE) {
|
||||||
std::string type = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("type");
|
std::string type = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("type");
|
||||||
|
|
||||||
if (type == "deleteFile") {
|
if (type == "deleteFile") {
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
std::string file, message;
|
std::string file, message;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("file")) file = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("file");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("file")) file = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("file");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("message")) message = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("message");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("message")) message = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("message");
|
||||||
if(!missing) ret = ScriptHelper::removeFile(file, message);
|
if (!missing) ret = ScriptHelper::removeFile(file, message);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if(type == "downloadFile") {
|
} else if (type == "downloadFile") {
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
std::string file, output, message;
|
std::string file, output, message;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("file")) file = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("file");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("file")) file = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("file");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("output")) output = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("output");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("output")) output = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("output");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("message")) message = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("message");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("message")) message = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("message");
|
||||||
if(!missing) ret = ScriptHelper::downloadFile(file, output, message);
|
if (!missing) ret = ScriptHelper::downloadFile(file, output, message);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if(type == "downloadRelease") {
|
} else if (type == "downloadRelease") {
|
||||||
bool missing = false, includePrereleases = false, showVersions = false;
|
bool missing = false, includePrereleases = false, showVersions = false;
|
||||||
std::string repo, file, output, message;
|
std::string repo, file, output, message;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("repo")) repo = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("repo");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("repo")) repo = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("repo");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("file")) file = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("file");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("file")) file = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("file");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("output")) output = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("output");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("output")) output = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("output");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("includePrereleases") && this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("includePrereleases").is_boolean())
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("includePrereleases") && this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("includePrereleases").is_boolean())
|
||||||
includePrereleases = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("includePrereleases");
|
includePrereleases = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("includePrereleases");
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("showVersions") && this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("showVersions").is_boolean())
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("showVersions") && this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("showVersions").is_boolean())
|
||||||
showVersions = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("showVersions");
|
showVersions = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("showVersions");
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("message")) message = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("message");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("message")) message = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("message");
|
||||||
if(!missing) ret = ScriptHelper::downloadRelease(repo, file, output, includePrereleases, showVersions, message);
|
if (!missing) ret = ScriptHelper::downloadRelease(repo, file, output, includePrereleases, showVersions, message);
|
||||||
|
|
||||||
} else if(type == "extractFile") {
|
} else if (type == "extractFile") {
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
std::string file, input, output, message;
|
std::string file, input, output, message;
|
||||||
if(this->storeJson.at("storeContent").at("storeContent").at(this->selection).at(entry).at(i).contains("file")) file = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("file");
|
if (this->storeJson.at("storeContent").at("storeContent").at(this->selection).at(entry).at(i).contains("file")) file = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("file");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("input")) input = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("input");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("input")) input = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("input");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("output")) output = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("output");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("output")) output = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("output");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("message")) message = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("message");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("message")) message = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("message");
|
||||||
if(!missing) ScriptHelper::extractFile(file, input, output, message);
|
if (!missing) ScriptHelper::extractFile(file, input, output, message);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if(type == "installCia") {
|
} else if (type == "installCia") {
|
||||||
bool missing = false, updateSelf = false;
|
bool missing = false, updateSelf = false;
|
||||||
std::string file, message;
|
std::string file, message;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("file")) file = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("file");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("file")) file = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("file");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("updateSelf") && this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("updateSelf").is_boolean()) {
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("updateSelf") && this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("updateSelf").is_boolean()) {
|
||||||
updateSelf = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("updateSelf");
|
updateSelf = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("updateSelf");
|
||||||
}
|
}
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("message")) message = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("message");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("message")) message = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("message");
|
||||||
if(!missing) ScriptHelper::installFile(file, updateSelf, message);
|
if (!missing) ScriptHelper::installFile(file, updateSelf, message);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if (type == "mkdir") {
|
} else if (type == "mkdir") {
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
std::string directory, message;
|
std::string directory, message;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("directory")) directory = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("directory");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("directory")) directory = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("directory");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(!missing) makeDirs(directory.c_str());
|
if (!missing) makeDirs(directory.c_str());
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if (type == "rmdir") {
|
} else if (type == "rmdir") {
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
std::string directory, message, promptmsg;
|
std::string directory, message, promptmsg;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("directory")) directory = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("directory");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("directory")) directory = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("directory");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
promptmsg = Lang::get("DELETE_PROMPT") + "\n" + directory;
|
promptmsg = Lang::get("DELETE_PROMPT") + "\n" + directory;
|
||||||
if(!missing) {
|
if (!missing) {
|
||||||
if(access(directory.c_str(), F_OK) != 0 ) {
|
if (access(directory.c_str(), F_OK) != 0 ) {
|
||||||
ret = DELETE_ERROR;
|
ret = DELETE_ERROR;
|
||||||
} else {
|
} else {
|
||||||
if (Msg::promptMsg(promptmsg)) {
|
if (Msg::promptMsg(promptmsg)) {
|
||||||
@@ -920,63 +921,63 @@ Result UniStoreV2::runFunctions(std::string entry) {
|
|||||||
} else if (type == "mkfile") {
|
} else if (type == "mkfile") {
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
std::string file;
|
std::string file;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("file")) file = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("file");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("file")) file = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("file");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(!missing) ScriptHelper::createFile(file.c_str());
|
if (!missing) ScriptHelper::createFile(file.c_str());
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if (type == "timeMsg") {
|
} else if (type == "timeMsg") {
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
std::string message;
|
std::string message;
|
||||||
int seconds;
|
int seconds;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("message")) message = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("message");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("message")) message = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("message");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("seconds") && this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("seconds").is_number())
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("seconds") && this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("seconds").is_number())
|
||||||
seconds = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("seconds");
|
seconds = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("seconds");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(!missing) ScriptHelper::displayTimeMsg(message, seconds);
|
if (!missing) ScriptHelper::displayTimeMsg(message, seconds);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if (type == "saveConfig") {
|
} else if (type == "saveConfig") {
|
||||||
Config::save();
|
config->save();
|
||||||
|
|
||||||
} else if (type == "bootTitle") {
|
} else if (type == "bootTitle") {
|
||||||
std::string TitleID = "";
|
std::string TitleID = "";
|
||||||
std::string message = "";
|
std::string message = "";
|
||||||
bool isNAND = false, missing = false;
|
bool isNAND = false, missing = false;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("TitleID")) TitleID = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("TitleID");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("TitleID")) TitleID = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("TitleID");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("NAND") && this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("NAND").is_boolean()) isNAND = this->storeJson.at(this->selection).at(entry).at(i).at("NAND");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("NAND") && this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("NAND").is_boolean()) isNAND = this->storeJson.at(this->selection).at(entry).at(i).at("NAND");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("message")) message = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("message");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("message")) message = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("message");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(!missing) ScriptHelper::bootTitle(TitleID, isNAND, message);
|
if (!missing) ScriptHelper::bootTitle(TitleID, isNAND, message);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if (type == "promptMessage") {
|
} else if (type == "promptMessage") {
|
||||||
std::string Message = "";
|
std::string Message = "";
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("message")) Message = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("message");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("message")) Message = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("message");
|
||||||
ret = ScriptHelper::prompt(Message);
|
ret = ScriptHelper::prompt(Message);
|
||||||
|
|
||||||
} else if (type == "copy") {
|
} else if (type == "copy") {
|
||||||
std::string Message = "", source = "", destination = "";
|
std::string Message = "", source = "", destination = "";
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("source")) source = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("source");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("source")) source = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("source");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("destination")) destination = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("destination");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("destination")) destination = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("destination");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("message")) Message = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("message");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("message")) Message = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("message");
|
||||||
if (!missing) ret = ScriptHelper::copyFile(source, destination, Message);
|
if (!missing) ret = ScriptHelper::copyFile(source, destination, Message);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if (type == "move") {
|
} else if (type == "move") {
|
||||||
std::string Message = "", oldFile = "", newFile = "";
|
std::string Message = "", oldFile = "", newFile = "";
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("old")) oldFile = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("old");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("old")) oldFile = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("old");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("new")) newFile = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("new");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("new")) newFile = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("new");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("message")) Message = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("message");
|
if (this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).contains("message")) Message = this->storeJson.at("storeContent").at(this->selection).at(entry).at(i).at("message");
|
||||||
if (!missing) ret = ScriptHelper::renameFile(oldFile, newFile, Message);
|
if (!missing) ret = ScriptHelper::renameFile(oldFile, newFile, Message);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
+244
-290
@@ -26,323 +26,277 @@
|
|||||||
|
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "gui.hpp"
|
#include "colorHelper.hpp"
|
||||||
#include "json.hpp"
|
#include <citro2d.h>
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
std::string Config::lang; // Current Language.
|
// In case it doesn't exist.
|
||||||
int Config::Color1;
|
void Config::initialize() {
|
||||||
int Config::Color2;
|
// Create through fopen "Write".
|
||||||
int Config::Color3;
|
FILE *file = fopen("sdmc:/3ds/Universal-Updater/Settings.json", "w");
|
||||||
int Config::TxtColor;
|
|
||||||
int Config::SelectedColor;
|
// Set default values.
|
||||||
int Config::UnselectedColor;
|
this->setInt("BARCOLOR", BarColor);
|
||||||
int Config::viewMode;
|
this->setInt("TOPBGCOLOR", TopBGColor);
|
||||||
int Config::progressbarColor;
|
this->setInt("BOTTOMBGCOLOR", BottomBGColor);
|
||||||
std::string Config::ScriptPath;
|
this->setInt("TEXTCOLOR", WHITE);
|
||||||
std::string Config::MusicPath;
|
this->setInt("BUTTON", C2D_Color32(0, 0, 50, 255));
|
||||||
bool Config::Logging;
|
this->setInt("SELECTEDCOLOR", SelectedColordefault);
|
||||||
bool Config::UseBars;
|
this->setInt("UNSELECTEDCOLOR", UnselectedColordefault);
|
||||||
std::string Config::StorePath;
|
this->setString("SCRIPTPATH", SCRIPTS_PATH);
|
||||||
int Config::LangPath;
|
this->setInt("LANGPATH", 0);
|
||||||
int Config::autoboot = 0;
|
this->setInt("VIEWMODE", 0);
|
||||||
std::string Config::AutobootFile = "";
|
this->setInt("PROGRESSBARCOLOR", WHITE);
|
||||||
int Config::outdated;
|
this->setString("MUSICPATH", MUSIC_PATH);
|
||||||
int Config::uptodate;
|
this->setBool("LOGGING", false);
|
||||||
int Config::notFound;
|
this->setBool("BARS", true);
|
||||||
int Config::future;
|
this->setInt("AUTOBOOT", 0);
|
||||||
int Config::Button;
|
this->setString("STOREPATH", STORE_PATH);
|
||||||
int Config::keyDelay = 5;
|
this->setString("AUTOBOOT_FILE", "");
|
||||||
bool Config::fading = false;
|
this->setInt("OUTDATED", C2D_Color32(0xfb, 0x5b, 0x5b, 255));
|
||||||
bool Config::progress = true;
|
this->setInt("UPTODATE", C2D_Color32(0xa5, 0xdd, 0x81, 255));
|
||||||
nlohmann::json configJson;
|
this->setInt("NOTFOUND", C2D_Color32(255, 128, 0, 255));
|
||||||
extern bool changesMade;
|
this->setInt("FUTURE", C2D_Color32(255, 255, 0, 255));
|
||||||
|
this->setInt("KEY_DELAY", 5);
|
||||||
|
this->setBool("SCREEN_FADE", false);
|
||||||
|
this->setBool("PROGRESS_DISPLAY", true);
|
||||||
|
this->setString("LANGUAGE", "en");
|
||||||
|
|
||||||
|
// Write to file.
|
||||||
|
fwrite(this->json.dump(1, '\t').c_str(), 1, this->json.dump(1, '\t').size(), file);
|
||||||
|
fclose(file); // Now we have the file and can properly access it.
|
||||||
|
}
|
||||||
|
|
||||||
|
Config::Config() {
|
||||||
|
if (access("sdmc:/3ds/Universal-Updater/Settings.json", F_OK) != 0 ) {
|
||||||
|
this->initialize();
|
||||||
|
}
|
||||||
|
|
||||||
void Config::load() {
|
|
||||||
FILE* file = fopen("sdmc:/3ds/Universal-Updater/Settings.json", "r");
|
FILE* file = fopen("sdmc:/3ds/Universal-Updater/Settings.json", "r");
|
||||||
if(file) {
|
this->json = nlohmann::json::parse(file, nullptr, false);
|
||||||
configJson = nlohmann::json::parse(file, nullptr, false);
|
fclose(file);
|
||||||
|
|
||||||
if(!configJson.contains("BARCOLOR")) {
|
// Here we get the initial settings.
|
||||||
Color1 = BarColor;
|
|
||||||
} else {
|
|
||||||
Color1 = getInt("BARCOLOR");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("TOPBGCOLOR")) {
|
if (!this->json.contains("Bar_Color")) {
|
||||||
Color2 = TopBGColor;
|
this->barColor(BarColor);
|
||||||
} else {
|
|
||||||
Color2 = getInt("TOPBGCOLOR");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("BOTTOMBGCOLOR")) {
|
|
||||||
Color3 = BottomBGColor;
|
|
||||||
} else {
|
|
||||||
Color3 = getInt("BOTTOMBGCOLOR");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("TEXTCOLOR")) {
|
|
||||||
TxtColor = WHITE;
|
|
||||||
} else {
|
|
||||||
TxtColor = getInt("TEXTCOLOR");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("UNSELECTEDCOLOR")) {
|
|
||||||
UnselectedColor = UnselectedColordefault;
|
|
||||||
} else {
|
|
||||||
UnselectedColor = getInt("UNSELECTEDCOLOR");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("SELECTEDCOLOR")) {
|
|
||||||
SelectedColor = SelectedColordefault;
|
|
||||||
} else {
|
|
||||||
SelectedColor = getInt("SELECTEDCOLOR");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("SCRIPTPATH")) {
|
|
||||||
ScriptPath = SCRIPTS_PATH;
|
|
||||||
} else {
|
|
||||||
ScriptPath = getString("SCRIPTPATH");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("LANGPATH")) {
|
|
||||||
LangPath = 0;
|
|
||||||
} else {
|
|
||||||
LangPath = getInt("LANGPATH");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Conversion to string.
|
|
||||||
if (configJson.contains("LANGUAGE") && configJson.at("LANGUAGE").is_number()) {
|
|
||||||
setString("LANGUAGE", "en");
|
|
||||||
changesMade = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("LANGUAGE")) {
|
|
||||||
lang = "en";
|
|
||||||
} else {
|
|
||||||
lang = getString("LANGUAGE");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("VIEWMODE")) {
|
|
||||||
viewMode = 0;
|
|
||||||
} else {
|
|
||||||
viewMode = getInt("VIEWMODE");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("PROGRESSBARCOLOR")) {
|
|
||||||
progressbarColor = WHITE;
|
|
||||||
} else {
|
|
||||||
progressbarColor = getInt("PROGRESSBARCOLOR");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("MUSICPATH")) {
|
|
||||||
MusicPath = MUSIC_PATH;
|
|
||||||
} else {
|
|
||||||
MusicPath = getString("MUSICPATH");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("LOGGING")) {
|
|
||||||
Logging = false;
|
|
||||||
} else {
|
|
||||||
Logging = getBool("LOGGING");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("BARS")) {
|
|
||||||
UseBars = true;
|
|
||||||
} else {
|
|
||||||
UseBars = getBool("BARS");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("STOREPATH")) {
|
|
||||||
StorePath = STORE_PATH;
|
|
||||||
} else {
|
|
||||||
StorePath = getString("STOREPATH");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("AUTOBOOT")) {
|
|
||||||
autoboot = 0;
|
|
||||||
} else {
|
|
||||||
autoboot = getInt("AUTOBOOT");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("AUTOBOOT_FILE")) {
|
|
||||||
AutobootFile = "";
|
|
||||||
} else {
|
|
||||||
AutobootFile = getString("AUTOBOOT_FILE");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("OUTDATED")) {
|
|
||||||
outdated = C2D_Color32(0xfb, 0x5b, 0x5b, 255);
|
|
||||||
} else {
|
|
||||||
outdated = getInt("OUTDATED");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("UPTODATE")) {
|
|
||||||
uptodate = C2D_Color32(0xa5, 0xdd, 0x81, 255);
|
|
||||||
} else {
|
|
||||||
uptodate = getInt("UPTODATE");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("NOTFOUND")) {
|
|
||||||
notFound = C2D_Color32(255, 128, 0, 255);
|
|
||||||
} else {
|
|
||||||
notFound = getInt("NOTFOUND");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("FUTURE")) {
|
|
||||||
future = C2D_Color32(255, 255, 0, 255);
|
|
||||||
} else {
|
|
||||||
future = getInt("FUTURE");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("BUTTON")) {
|
|
||||||
Button = C2D_Color32(0, 0, 50, 255);
|
|
||||||
} else {
|
|
||||||
Button = getInt("BUTTON");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("KEY_DELAY")) {
|
|
||||||
keyDelay = 5;
|
|
||||||
} else {
|
|
||||||
keyDelay = getInt("KEY_DELAY");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("SCREEN_FADE")) {
|
|
||||||
fading = false;
|
|
||||||
} else {
|
|
||||||
fading = getBool("SCREEN_FADE");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("PROGRESS_DISPLAY")) {
|
|
||||||
progress = true;
|
|
||||||
} else {
|
|
||||||
progress = getBool("PROGRESS_DISPLAY");
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(file);
|
|
||||||
} else {
|
} else {
|
||||||
Color1 = BarColor;
|
this->barColor(this->getInt("BARCOLOR"));
|
||||||
Color2 = TopBGColor;
|
}
|
||||||
Color3 = BottomBGColor;
|
|
||||||
TxtColor = WHITE;
|
if (!this->json.contains("TOPBGCOLOR")) {
|
||||||
SelectedColor = SelectedColordefault;
|
this->topBG(TopBGColor);
|
||||||
UnselectedColor = UnselectedColordefault;
|
} else {
|
||||||
ScriptPath = SCRIPTS_PATH;
|
this->topBG(this->getInt("TOPBGCOLOR"));
|
||||||
LangPath = 0;
|
}
|
||||||
lang = "en";
|
|
||||||
viewMode = 0;
|
if (!this->json.contains("BOTTOMBGCOLOR")) {
|
||||||
progressbarColor = WHITE;
|
this->bottomBG(BottomBGColor);
|
||||||
MusicPath = MUSIC_PATH;
|
} else {
|
||||||
Logging = false;
|
this->bottomBG(this->getInt("BOTTOMBGCOLOR"));
|
||||||
UseBars = true;
|
}
|
||||||
StorePath = STORE_PATH;
|
|
||||||
autoboot = 0;
|
if (!this->json.contains("TEXTCOLOR")) {
|
||||||
AutobootFile = "";
|
this->textColor(WHITE);
|
||||||
outdated = C2D_Color32(0xfb, 0x5b, 0x5b, 255);
|
} else {
|
||||||
uptodate = C2D_Color32(0xa5, 0xdd, 0x81, 255);
|
this->textColor(this->getInt("TEXTCOLOR"));
|
||||||
notFound = C2D_Color32(255, 128, 0, 255);
|
}
|
||||||
future = C2D_Color32(255, 255, 0, 255);
|
|
||||||
Button = C2D_Color32(0, 0, 50, 255);
|
if (!this->json.contains("BUTTON")) {
|
||||||
keyDelay = 5;
|
this->buttonColor(C2D_Color32(0, 0, 50, 255));
|
||||||
fading = false;
|
} else {
|
||||||
progress = true;
|
this->buttonColor(this->getInt("BUTTON"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->json.contains("SELECTEDCOLOR")) {
|
||||||
|
this->selectedColor(SelectedColordefault);
|
||||||
|
} else {
|
||||||
|
this->selectedColor(this->getInt("SELECTEDCOLOR"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->json.contains("UNSELECTEDCOLOR")) {
|
||||||
|
this->unselectedColor(UnselectedColordefault);
|
||||||
|
} else {
|
||||||
|
this->unselectedColor(this->getInt("UNSELECTEDCOLOR"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->json.contains("SCRIPTPATH")) {
|
||||||
|
this->scriptPath(SCRIPTS_PATH);
|
||||||
|
} else {
|
||||||
|
this->scriptPath(this->getString("SCRIPTPATH"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->json.contains("LANGPATH")) {
|
||||||
|
this->langPath(0);
|
||||||
|
} else {
|
||||||
|
this->langPath(this->getInt("LANGPATH"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->json.contains("VIEWMODE")) {
|
||||||
|
this->viewMode(0);
|
||||||
|
} else {
|
||||||
|
this->viewMode(this->getInt("VIEWMODE"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->json.contains("PROGRESSBARCOLOR")) {
|
||||||
|
this->progressbarColor(WHITE);
|
||||||
|
} else {
|
||||||
|
this->progressbarColor(this->getInt("PROGRESSBARCOLOR"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->json.contains("MUSICPATH")) {
|
||||||
|
this->musicPath(MUSIC_PATH);
|
||||||
|
} else {
|
||||||
|
this->musicPath(this->getString("MUSICPATH"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->json.contains("LOGGING")) {
|
||||||
|
this->logging(false);
|
||||||
|
} else {
|
||||||
|
this->logging(this->getBool("LOGGING"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->json.contains("BARS")) {
|
||||||
|
this->useBars(true);
|
||||||
|
} else {
|
||||||
|
this->useBars(this->getBool("BARS"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->json.contains("AUTOBOOT")) {
|
||||||
|
this->autoboot(0);
|
||||||
|
} else {
|
||||||
|
this->viewMode(this->getInt("AUTOBOOT"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->json.contains("STOREPATH")) {
|
||||||
|
this->storePath(STORE_PATH);
|
||||||
|
} else {
|
||||||
|
this->storePath(this->getString("STOREPATH"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->json.contains("AUTOBOOT_FILE")) {
|
||||||
|
this->autobootFile("");
|
||||||
|
} else {
|
||||||
|
this->autobootFile(this->getString("AUTOBOOT_FILE"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->json.contains("OUTDATED")) {
|
||||||
|
this->outdatedColor(C2D_Color32(0xfb, 0x5b, 0x5b, 255));
|
||||||
|
} else {
|
||||||
|
this->outdatedColor(this->getInt("OUTDATED"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->json.contains("UPTODATE")) {
|
||||||
|
this->uptodateColor(C2D_Color32(0xa5, 0xdd, 0x81, 255));
|
||||||
|
} else {
|
||||||
|
this->uptodateColor(this->getInt("UPTODATE"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->json.contains("NOTFOUND")) {
|
||||||
|
this->notfoundColor(C2D_Color32(255, 128, 0, 255));
|
||||||
|
} else {
|
||||||
|
this->notfoundColor(this->getInt("NOTFOUND"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->json.contains("FUTURE")) {
|
||||||
|
this->futureColor(C2D_Color32(255, 255, 0, 255));
|
||||||
|
} else {
|
||||||
|
this->futureColor(this->getInt("FUTURE"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->json.contains("KEY_DELAY")) {
|
||||||
|
this->keyDelay(5);
|
||||||
|
} else {
|
||||||
|
this->keyDelay(this->getInt("KEY_DELAY"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->json.contains("SCREEN_FADE")) {
|
||||||
|
this->screenFade(false);
|
||||||
|
} else {
|
||||||
|
this->screenFade(this->getBool("SCREEN_FADE"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->json.contains("PROGRESS_DISPLAY")) {
|
||||||
|
this->progressDisplay(true);
|
||||||
|
} else {
|
||||||
|
this->progressDisplay(this->getBool("PROGRESS_DISPLAY"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->json.contains("LANGUAGE")) {
|
||||||
|
this->language("en");
|
||||||
|
} else {
|
||||||
|
this->language(this->getString("LANGUAGE"));
|
||||||
|
}
|
||||||
|
|
||||||
|
this->changesMade = false; // No changes made yet.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write to config if changesMade.
|
||||||
|
void Config::save() {
|
||||||
|
if (this->changesMade) {
|
||||||
|
FILE *file = fopen("sdmc:/3ds/Universal-Updater/Settings.json", "w");
|
||||||
|
// Set values.
|
||||||
|
this->setInt("BARCOLOR", this->barColor());
|
||||||
|
this->setInt("TOPBGCOLOR", this->topBG());
|
||||||
|
this->setInt("BOTTOMBGCOLOR", this->bottomBG());
|
||||||
|
this->setInt("TEXTCOLOR", this->textColor());
|
||||||
|
this->setInt("BUTTON", this->buttonColor());
|
||||||
|
this->setInt("SELECTEDCOLOR", this->selectedColor());
|
||||||
|
this->setInt("UNSELECTEDCOLOR", this->unselectedColor());
|
||||||
|
this->setString("SCRIPTPATH", this->scriptPath());
|
||||||
|
this->setInt("LANGPATH", this->langPath());
|
||||||
|
this->setInt("VIEWMODE", this->viewMode());
|
||||||
|
this->setInt("PROGRESSBARCOLOR", this->progressbarColor());
|
||||||
|
this->setString("MUSICPATH", this->musicPath());
|
||||||
|
this->setBool("LOGGING", this->logging());
|
||||||
|
this->setBool("BARS", this->useBars());
|
||||||
|
this->setInt("AUTOBOOT", this->autoboot());
|
||||||
|
this->setString("STOREPATH", this->storePath());
|
||||||
|
this->setString("AUTOBOOT_FILE", this->autobootFile());
|
||||||
|
this->setInt("OUTDATED", this->outdatedColor());
|
||||||
|
this->setInt("UPTODATE", this->uptodateColor());
|
||||||
|
this->setInt("NOTFOUND", this->notfoundColor());
|
||||||
|
this->setInt("FUTURE", this->futureColor());
|
||||||
|
this->setInt("KEY_DELAY", this->keyDelay());
|
||||||
|
this->setBool("SCREEN_FADE", this->screenFade());
|
||||||
|
this->setBool("PROGRESS_DISPLAY", this->progressDisplay());
|
||||||
|
this->setString("LANGUAGE", this->language());
|
||||||
|
// Write changes to file.
|
||||||
|
fwrite(this->json.dump(1, '\t').c_str(), 1, this->json.dump(1, '\t').size(), file);
|
||||||
|
fclose(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Config::save() {
|
// Helper functions.
|
||||||
setInt("BARCOLOR", Color1);
|
|
||||||
setInt("TOPBGCOLOR", Color2);
|
|
||||||
setInt("BOTTOMBGCOLOR", Color3);
|
|
||||||
setInt("TEXTCOLOR", TxtColor);
|
|
||||||
setInt("SELECTEDCOLOR", SelectedColor);
|
|
||||||
setInt("UNSELECTEDCOLOR", UnselectedColor);
|
|
||||||
setString("SCRIPTPATH", ScriptPath);
|
|
||||||
setInt("LANGPATH", LangPath);
|
|
||||||
setString("LANGUAGE", lang);
|
|
||||||
setInt("VIEWMODE", viewMode);
|
|
||||||
setInt("PROGRESSBARCOLOR", progressbarColor);
|
|
||||||
setString("MUSICPATH", MusicPath);
|
|
||||||
setBool("LOGGING", Logging);
|
|
||||||
setBool("BARS", UseBars);
|
|
||||||
setString("STOREPATH", StorePath);
|
|
||||||
setInt("AUTOBOOT", autoboot);
|
|
||||||
setString("AUTOBOOT_FILE", AutobootFile);
|
|
||||||
setInt("OUTDATED", outdated);
|
|
||||||
setInt("UPTODATE", uptodate);
|
|
||||||
setInt("NOTFOUND", notFound);
|
|
||||||
setInt("FUTURE", future);
|
|
||||||
setInt("BUTTON", Button);
|
|
||||||
setInt("KEY_DELAY", keyDelay);
|
|
||||||
setBool("SCREEN_FADE", fading);
|
|
||||||
setBool("PROGRESS_DISPLAY", progress);
|
|
||||||
|
|
||||||
FILE* file = fopen("sdmc:/3ds/Universal-Updater/Settings.json", "w");
|
|
||||||
if(file) fwrite(configJson.dump(1, '\t').c_str(), 1, configJson.dump(1, '\t').size(), file);
|
|
||||||
fclose(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Config::initializeNewConfig() {
|
|
||||||
FILE* file = fopen("sdmc:/3ds/Universal-Updater/Settings.json", "r");
|
|
||||||
if(file) configJson = nlohmann::json::parse(file, nullptr, false);
|
|
||||||
|
|
||||||
setInt("BARCOLOR", BarColor);
|
|
||||||
setInt("TOPBGCOLOR", TopBGColor);
|
|
||||||
setInt("BOTTOMBGCOLOR", BottomBGColor);
|
|
||||||
setInt("TEXTCOLOR", WHITE);
|
|
||||||
setInt("SELECTEDCOLOR", SelectedColordefault);
|
|
||||||
setInt("UNSELECTEDCOLOR", UnselectedColordefault);
|
|
||||||
setString("SCRIPTPATH", SCRIPTS_PATH);
|
|
||||||
setInt("LANGPATH", 0);
|
|
||||||
setString("LANGUAGE", "en");
|
|
||||||
setInt("VIEWMODE", 0);
|
|
||||||
setInt("PROGRESSBARCOLOR", WHITE);
|
|
||||||
setString("MUSICPATH", MUSIC_PATH);
|
|
||||||
setBool("LOGGING", false);
|
|
||||||
setBool("BARS", true);
|
|
||||||
setString("STOREPATH", STORE_PATH);
|
|
||||||
setInt("AUTOBOOT", 0);
|
|
||||||
setString("AUTOBOOT_FILE", "");
|
|
||||||
setInt("OUTDATED", C2D_Color32(0xfb, 0x5b, 0x5b, 255));
|
|
||||||
setInt("UPTODATE", C2D_Color32(0xa5, 0xdd, 0x81, 255));
|
|
||||||
setInt("NOTFOUND", C2D_Color32(255, 128, 0, 255));
|
|
||||||
setInt("FUTURE", C2D_Color32(255, 255, 0, 255));
|
|
||||||
setInt("BUTTON", C2D_Color32(0, 0, 50, 255));
|
|
||||||
setInt("KEY_DELAY", 5);
|
|
||||||
setBool("SCREEN_FADE", false);
|
|
||||||
setBool("PROGRESS_DISPLAY", true);
|
|
||||||
|
|
||||||
if(file) fwrite(configJson.dump(1, '\t').c_str(), 1, configJson.dump(1, '\t').size(), file);
|
|
||||||
fclose(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Config::getBool(const std::string &key) {
|
bool Config::getBool(const std::string &key) {
|
||||||
if(!configJson.contains(key)) {
|
if (!this->json.contains(key)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return configJson.at(key).get_ref<const bool&>();
|
|
||||||
|
return this->json.at(key).get_ref<const bool&>();
|
||||||
}
|
}
|
||||||
void Config::setBool(const std::string &key, bool v) {
|
void Config::setBool(const std::string &key, bool v) {
|
||||||
configJson[key] = v;
|
this->json[key] = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Config::getInt(const std::string &key) {
|
int Config::getInt(const std::string &key) {
|
||||||
if(!configJson.contains(key)) {
|
if (!this->json.contains(key)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return configJson.at(key).get_ref<const int64_t&>();
|
|
||||||
|
return this->json.at(key).get_ref<const int64_t&>();
|
||||||
}
|
}
|
||||||
void Config::setInt(const std::string &key, int v) {
|
void Config::setInt(const std::string &key, int v) {
|
||||||
configJson[key] = v;
|
this->json[key] = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Config::getString(const std::string &key) {
|
std::string Config::getString(const std::string &key) {
|
||||||
if(!configJson.contains(key)) {
|
if (!this->json.contains(key)) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
return configJson.at(key).get_ref<const std::string&>();
|
|
||||||
|
return this->json.at(key).get_ref<const std::string&>();
|
||||||
}
|
}
|
||||||
void Config::setString(const std::string &key, const std::string &v) {
|
void Config::setString(const std::string &key, const std::string &v) {
|
||||||
configJson[key] = v;
|
this->json[key] = v;
|
||||||
}
|
}
|
||||||
+69
-61
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
int file_count = 0;
|
int file_count = 0;
|
||||||
|
|
||||||
extern bool continueNdsScan;
|
extern std::unique_ptr<Config> config;
|
||||||
extern uint selectedFile;
|
extern uint selectedFile;
|
||||||
extern int keyRepeatDelay;
|
extern int keyRepeatDelay;
|
||||||
extern bool dirChanged;
|
extern bool dirChanged;
|
||||||
@@ -36,11 +36,10 @@ std::vector<Structs::ButtonPos> buttonPositions = {
|
|||||||
{80, 220, 50, 15}, // Select.
|
{80, 220, 50, 15}, // Select.
|
||||||
{145, 220, 50, 15}, // Refresh.
|
{145, 220, 50, 15}, // Refresh.
|
||||||
{210, 220, 50, 15}, // Back.
|
{210, 220, 50, 15}, // Back.
|
||||||
{0, 0, 25, 25}, // ViewMode Change.
|
{0, 0, 25, 25} // ViewMode Change.
|
||||||
};
|
};
|
||||||
|
|
||||||
off_t getFileSize(const char *fileName)
|
off_t getFileSize(const char *fileName) {
|
||||||
{
|
|
||||||
FILE* fp = fopen(fileName, "rb");
|
FILE* fp = fopen(fileName, "rb");
|
||||||
off_t fsize = 0;
|
off_t fsize = 0;
|
||||||
if (fp) {
|
if (fp) {
|
||||||
@@ -48,32 +47,36 @@ off_t getFileSize(const char *fileName)
|
|||||||
fsize = ftell(fp); // Get source file's size
|
fsize = ftell(fp); // Get source file's size
|
||||||
fseek(fp, 0, SEEK_SET);
|
fseek(fp, 0, SEEK_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
return fsize;
|
return fsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nameEndsWith(const std::string& name, const std::vector<std::string> extensionList) {
|
bool nameEndsWith(const std::string& name, const std::vector<std::string> extensionList) {
|
||||||
if(name.substr(0, 2) == "._") return false;
|
if (name.substr(0, 2) == "._") return false;
|
||||||
|
|
||||||
if(name.size() == 0) return false;
|
if (name.size() == 0) return false;
|
||||||
|
|
||||||
if(extensionList.size() == 0) return true;
|
if (extensionList.size() == 0) return true;
|
||||||
|
|
||||||
for(int i = 0; i <(int)extensionList.size(); i++) {
|
for(int i = 0; i < (int)extensionList.size(); i++) {
|
||||||
const std::string ext = extensionList.at(i);
|
const std::string ext = extensionList.at(i);
|
||||||
if(strcasecmp(name.c_str() + name.size() - ext.size(), ext.c_str()) == 0) return true;
|
if (strcasecmp(name.c_str() + name.size() - ext.size(), ext.c_str()) == 0) return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dirEntryPredicate(const DirEntry& lhs, const DirEntry& rhs) {
|
bool dirEntryPredicate(const DirEntry& lhs, const DirEntry& rhs) {
|
||||||
if(!lhs.isDirectory && rhs.isDirectory) {
|
if (!lhs.isDirectory && rhs.isDirectory) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(lhs.isDirectory && !rhs.isDirectory) {
|
|
||||||
|
if (lhs.isDirectory && !rhs.isDirectory) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return strcasecmp(lhs.name.c_str(), rhs.name.c_str()) < 0;
|
return strcasecmp(lhs.name.c_str(), rhs.name.c_str()) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,26 +87,28 @@ void getDirectoryContents(std::vector<DirEntry>& dirContents, const std::vector<
|
|||||||
|
|
||||||
DIR *pdir = opendir(".");
|
DIR *pdir = opendir(".");
|
||||||
|
|
||||||
if(pdir == NULL) {
|
if (pdir == NULL) {
|
||||||
Msg::DisplayMsg("Unable to open the directory.");
|
Msg::DisplayMsg("Unable to open the directory.");
|
||||||
for(int i=0;i<120;i++) gspWaitForVBlank();
|
for(int i = 0; i < 120; i++) gspWaitForVBlank();
|
||||||
} else {
|
} else {
|
||||||
while(true) {
|
while(true) {
|
||||||
DirEntry dirEntry;
|
DirEntry dirEntry;
|
||||||
|
|
||||||
struct dirent* pent = readdir(pdir);
|
struct dirent* pent = readdir(pdir);
|
||||||
if(pent == NULL) break;
|
if (pent == NULL) break;
|
||||||
|
|
||||||
stat(pent->d_name, &st);
|
stat(pent->d_name, &st);
|
||||||
dirEntry.name = pent->d_name;
|
dirEntry.name = pent->d_name;
|
||||||
dirEntry.isDirectory = (st.st_mode & S_IFDIR) ? true : false;
|
dirEntry.isDirectory = (st.st_mode & S_IFDIR) ? true : false;
|
||||||
|
|
||||||
if(dirEntry.name.compare(".") != 0 && (dirEntry.isDirectory || nameEndsWith(dirEntry.name, extensionList))) {
|
if (dirEntry.name.compare(".") != 0 && (dirEntry.isDirectory || nameEndsWith(dirEntry.name, extensionList))) {
|
||||||
dirContents.push_back(dirEntry);
|
dirContents.push_back(dirEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir(pdir);
|
closedir(pdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
sort(dirContents.begin(), dirContents.end(), dirEntryPredicate);
|
sort(dirContents.begin(), dirContents.end(), dirEntryPredicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,9 +121,10 @@ std::vector<std::string> getContents(const std::string &name, const std::vector<
|
|||||||
DIR* pdir = opendir(name.c_str());
|
DIR* pdir = opendir(name.c_str());
|
||||||
struct dirent *pent;
|
struct dirent *pent;
|
||||||
while ((pent = readdir(pdir)) != NULL) {
|
while ((pent = readdir(pdir)) != NULL) {
|
||||||
if(nameEndsWith(pent->d_name, extensionList))
|
if (nameEndsWith(pent->d_name, extensionList))
|
||||||
dirContents.push_back(pent->d_name);
|
dirContents.push_back(pent->d_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir(pdir);
|
closedir(pdir);
|
||||||
return dirContents;
|
return dirContents;
|
||||||
}
|
}
|
||||||
@@ -129,12 +135,14 @@ bool returnIfExist(const std::string &path, const std::vector<std::string> &exte
|
|||||||
chdir(path.c_str());
|
chdir(path.c_str());
|
||||||
std::vector<DirEntry> dirContentsTemp;
|
std::vector<DirEntry> dirContentsTemp;
|
||||||
getDirectoryContents(dirContentsTemp, extensionList);
|
getDirectoryContents(dirContentsTemp, extensionList);
|
||||||
for(uint i=0;i<dirContentsTemp.size();i++) {
|
for(uint i = 0; i < dirContentsTemp.size(); i++) {
|
||||||
dirContents.push_back(dirContentsTemp[i]);
|
dirContents.push_back(dirContentsTemp[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dirContents.size() == 0) {
|
if (dirContents.size() == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,7 +165,7 @@ std::string selectFilePath(std::string selectText, std::string initialPath, cons
|
|||||||
chdir(initialPath.c_str());
|
chdir(initialPath.c_str());
|
||||||
std::vector<DirEntry> dirContentsTemp;
|
std::vector<DirEntry> dirContentsTemp;
|
||||||
getDirectoryContents(dirContentsTemp, extensionList);
|
getDirectoryContents(dirContentsTemp, extensionList);
|
||||||
for(uint i=0;i<dirContentsTemp.size();i++) {
|
for(uint i = 0; i < dirContentsTemp.size(); i++) {
|
||||||
dirContents.push_back(dirContentsTemp[i]);
|
dirContents.push_back(dirContentsTemp[i]);
|
||||||
}
|
}
|
||||||
selectedFile = 0;
|
selectedFile = 0;
|
||||||
@@ -170,38 +178,38 @@ std::string selectFilePath(std::string selectText, std::string initialPath, cons
|
|||||||
GFX::DrawTop();
|
GFX::DrawTop();
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
getcwd(path, PATH_MAX);
|
getcwd(path, PATH_MAX);
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawString((400-(Gui::GetStringWidth(0.60f, path)))/2, 2, 0.60f, Config::TxtColor, path, 390);
|
Gui::DrawString((400-(Gui::GetStringWidth(0.60f, path)))/2, 2, 0.60f, config->textColor(), path, 390);
|
||||||
Gui::DrawStringCentered(0, 220, 0.60f, Config::TxtColor, selectText, 390);
|
Gui::DrawStringCentered(0, 220, 0.60f, config->textColor(), selectText, 390);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawString((400-(Gui::GetStringWidth(0.60f, path)))/2, 0, 0.60f, Config::TxtColor, path, 390);
|
Gui::DrawString((400-(Gui::GetStringWidth(0.60f, path)))/2, 0, 0.60f, config->textColor(), path, 390);
|
||||||
Gui::DrawStringCentered(0, 218, 0.60f, Config::TxtColor, selectText, 390);
|
Gui::DrawStringCentered(0, 218, 0.60f, config->textColor(), selectText, 390);
|
||||||
}
|
}
|
||||||
GFX::DrawBottom();
|
GFX::DrawBottom();
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)dirContents.size();i++) {
|
for(int i = 0; i < ENTRIES_PER_SCREEN && i < (int)dirContents.size(); i++) {
|
||||||
Gui::Draw_Rect(0, 40+(i*57), 320, 45, Config::UnselectedColor);
|
Gui::Draw_Rect(0, 40+(i*57), 320, 45, config->unselectedColor());
|
||||||
dirs = dirContents[screenPos + i].name;
|
dirs = dirContents[screenPos + i].name;
|
||||||
if(screenPos + i == selectedFile) {
|
if (screenPos + i == selectedFile) {
|
||||||
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, Config::SelectedColor);
|
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, config->selectedColor());
|
||||||
}
|
}
|
||||||
Gui::DrawStringCentered(0, 50+(i*57), 0.7f, WHITE, dirs, 320);
|
Gui::DrawStringCentered(0, 50+(i*57), 0.7f, config->textColor(), dirs, 320);
|
||||||
}
|
}
|
||||||
} else if (Config::viewMode == 1) {
|
} else if (config->viewMode() == 1) {
|
||||||
for(int i=0;i<ENTRIES_PER_LIST && i<(int)dirContents.size();i++) {
|
for(int i = 0; i < ENTRIES_PER_LIST && i < (int)dirContents.size(); i++) {
|
||||||
Gui::Draw_Rect(0, (i+1)*27, 320, 25, Config::UnselectedColor);
|
Gui::Draw_Rect(0, (i+1)*27, 320, 25, config->unselectedColor());
|
||||||
dirs = dirContents[screenPosList + i].name;
|
dirs = dirContents[screenPosList + i].name;
|
||||||
if(screenPosList + i == selectedFile) {
|
if (screenPosList + i == selectedFile) {
|
||||||
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, Config::SelectedColor);
|
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, config->selectedColor());
|
||||||
}
|
}
|
||||||
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, Config::TxtColor, dirs, 320);
|
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, config->textColor(), dirs, 320);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config::UseBars == true) {
|
if (config->useBars() == true) {
|
||||||
Gui::DrawStringCentered(0, 0, 0.45f, Config::TxtColor, Lang::get("FILEBROWSE_MSG"), 260);
|
Gui::DrawStringCentered(0, 0, 0.45f, config->textColor(), Lang::get("FILEBROWSE_MSG"), 260);
|
||||||
} else {
|
} else {
|
||||||
Gui::DrawStringCentered(0, 2, 0.45f, Config::TxtColor, Lang::get("FILEBROWSE_MSG"), 260);
|
Gui::DrawStringCentered(0, 2, 0.45f, config->textColor(), Lang::get("FILEBROWSE_MSG"), 260);
|
||||||
}
|
}
|
||||||
GFX::DrawArrow(295, -1);
|
GFX::DrawArrow(295, -1);
|
||||||
GFX::DrawArrow(315, 240, 180.0);
|
GFX::DrawArrow(315, 240, 180.0);
|
||||||
@@ -212,10 +220,10 @@ std::string selectFilePath(std::string selectText, std::string initialPath, cons
|
|||||||
Gui::Draw_Rect(buttonPositions[4].x, buttonPositions[4].y, buttonPositions[4].w, buttonPositions[4].h, C2D_Color32(0, 0, 0, 190));
|
Gui::Draw_Rect(buttonPositions[4].x, buttonPositions[4].y, buttonPositions[4].w, buttonPositions[4].h, C2D_Color32(0, 0, 0, 190));
|
||||||
Gui::Draw_Rect(buttonPositions[5].x, buttonPositions[5].y, buttonPositions[5].w, buttonPositions[5].h, C2D_Color32(0, 0, 0, 190));
|
Gui::Draw_Rect(buttonPositions[5].x, buttonPositions[5].y, buttonPositions[5].w, buttonPositions[5].h, C2D_Color32(0, 0, 0, 190));
|
||||||
|
|
||||||
Gui::DrawStringCentered(-120, 222, 0.4, Config::TxtColor, Lang::get("OPEN"), 40);
|
Gui::DrawStringCentered(-120, 222, 0.4, config->textColor(), Lang::get("OPEN"), 40);
|
||||||
Gui::DrawStringCentered(-55, 222, 0.4, Config::TxtColor, Lang::get("SELECT"), 40);
|
Gui::DrawStringCentered(-55, 222, 0.4, config->textColor(), Lang::get("SELECT"), 40);
|
||||||
Gui::DrawStringCentered(10, 222, 0.4, Config::TxtColor, Lang::get("REFRESH"), 40);
|
Gui::DrawStringCentered(10, 222, 0.4, config->textColor(), Lang::get("REFRESH"), 40);
|
||||||
Gui::DrawStringCentered(75, 222, 0.4, Config::TxtColor, Lang::get("BACK"), 40);
|
Gui::DrawStringCentered(75, 222, 0.4, config->textColor(), Lang::get("BACK"), 40);
|
||||||
C3D_FrameEnd(0);
|
C3D_FrameEnd(0);
|
||||||
|
|
||||||
// The input part.
|
// The input part.
|
||||||
@@ -228,7 +236,7 @@ std::string selectFilePath(std::string selectText, std::string initialPath, cons
|
|||||||
dirContents.clear();
|
dirContents.clear();
|
||||||
std::vector<DirEntry> dirContentsTemp;
|
std::vector<DirEntry> dirContentsTemp;
|
||||||
getDirectoryContents(dirContentsTemp, extensionList);
|
getDirectoryContents(dirContentsTemp, extensionList);
|
||||||
for(uint i=0;i<dirContentsTemp.size();i++) {
|
for(uint i = 0; i < dirContentsTemp.size(); i++) {
|
||||||
dirContents.push_back(dirContentsTemp[i]);
|
dirContents.push_back(dirContentsTemp[i]);
|
||||||
}
|
}
|
||||||
dirChanged = false;
|
dirChanged = false;
|
||||||
@@ -280,7 +288,7 @@ std::string selectFilePath(std::string selectText, std::string initialPath, cons
|
|||||||
if ((hidKeysDown() & KEY_B) || (hidKeysDown() & KEY_TOUCH && touching(touch, buttonPositions[5]))) {
|
if ((hidKeysDown() & KEY_B) || (hidKeysDown() & KEY_TOUCH && touching(touch, buttonPositions[5]))) {
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
getcwd(path, PATH_MAX);
|
getcwd(path, PATH_MAX);
|
||||||
if(strcmp(path, "sdmc:/") == 0 || strcmp(path, "/") == 0) {
|
if (strcmp(path, "sdmc:/") == 0 || strcmp(path, "/") == 0) {
|
||||||
return "";
|
return "";
|
||||||
} else {
|
} else {
|
||||||
chdir("..");
|
chdir("..");
|
||||||
@@ -308,21 +316,21 @@ std::string selectFilePath(std::string selectText, std::string initialPath, cons
|
|||||||
}
|
}
|
||||||
// Switch ViewMode.
|
// Switch ViewMode.
|
||||||
if ((hidKeysDown() & KEY_Y) || (hidKeysDown() & KEY_TOUCH && touching(touch, buttonPositions[6]))) {
|
if ((hidKeysDown() & KEY_Y) || (hidKeysDown() & KEY_TOUCH && touching(touch, buttonPositions[6]))) {
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
Config::viewMode = 1;
|
config->viewMode(1);
|
||||||
} else {
|
} else {
|
||||||
Config::viewMode = 0;
|
config->viewMode(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config::viewMode == 0) {
|
if (config->viewMode() == 0) {
|
||||||
if(selectedFile < screenPos) {
|
if (selectedFile < screenPos) {
|
||||||
screenPos = selectedFile;
|
screenPos = selectedFile;
|
||||||
} else if (selectedFile > screenPos + ENTRIES_PER_SCREEN - 1) {
|
} else if (selectedFile > screenPos + ENTRIES_PER_SCREEN - 1) {
|
||||||
screenPos = selectedFile - ENTRIES_PER_SCREEN + 1;
|
screenPos = selectedFile - ENTRIES_PER_SCREEN + 1;
|
||||||
}
|
}
|
||||||
} else if (Config::viewMode == 1) {
|
} else if (config->viewMode() == 1) {
|
||||||
if(selectedFile < screenPosList) {
|
if (selectedFile < screenPosList) {
|
||||||
screenPosList = selectedFile;
|
screenPosList = selectedFile;
|
||||||
} else if (selectedFile > screenPosList + ENTRIES_PER_LIST - 1) {
|
} else if (selectedFile > screenPosList + ENTRIES_PER_LIST - 1) {
|
||||||
screenPosList = selectedFile - ENTRIES_PER_LIST + 1;
|
screenPosList = selectedFile - ENTRIES_PER_LIST + 1;
|
||||||
@@ -338,16 +346,16 @@ u32 copyBuf[copyBufSize];
|
|||||||
void dirCopy(DirEntry* entry, int i, const char *destinationPath, const char *sourcePath) {
|
void dirCopy(DirEntry* entry, int i, const char *destinationPath, const char *sourcePath) {
|
||||||
std::vector<DirEntry> dirContents;
|
std::vector<DirEntry> dirContents;
|
||||||
dirContents.clear();
|
dirContents.clear();
|
||||||
if(entry->isDirectory) chdir((sourcePath + ("/" + entry->name)).c_str());
|
if (entry->isDirectory) chdir((sourcePath + ("/" + entry->name)).c_str());
|
||||||
getDirectoryContents(dirContents);
|
getDirectoryContents(dirContents);
|
||||||
if(((int)dirContents.size()) == 1) mkdir((destinationPath + ("/" + entry->name)).c_str(), 0777);
|
if (((int)dirContents.size()) == 1) mkdir((destinationPath + ("/" + entry->name)).c_str(), 0777);
|
||||||
if(((int)dirContents.size()) != 1) fcopy((sourcePath + ("/" + entry->name)).c_str(), (destinationPath + ("/" + entry->name)).c_str());
|
if (((int)dirContents.size()) != 1) fcopy((sourcePath + ("/" + entry->name)).c_str(), (destinationPath + ("/" + entry->name)).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
int fcopy(const char *sourcePath, const char *destinationPath) {
|
int fcopy(const char *sourcePath, const char *destinationPath) {
|
||||||
DIR *isDir = opendir(sourcePath);
|
DIR *isDir = opendir(sourcePath);
|
||||||
|
|
||||||
if(isDir != NULL) {
|
if (isDir != NULL) {
|
||||||
closedir(isDir);
|
closedir(isDir);
|
||||||
|
|
||||||
// Source path is a directory
|
// Source path is a directory
|
||||||
@@ -372,7 +380,7 @@ int fcopy(const char *sourcePath, const char *destinationPath) {
|
|||||||
// Source path is a file
|
// Source path is a file
|
||||||
FILE* sourceFile = fopen(sourcePath, "rb");
|
FILE* sourceFile = fopen(sourcePath, "rb");
|
||||||
off_t fsize = 0;
|
off_t fsize = 0;
|
||||||
if(sourceFile) {
|
if (sourceFile) {
|
||||||
fseek(sourceFile, 0, SEEK_END);
|
fseek(sourceFile, 0, SEEK_END);
|
||||||
fsize = ftell(sourceFile); // Get source file's size
|
fsize = ftell(sourceFile); // Get source file's size
|
||||||
fseek(sourceFile, 0, SEEK_SET);
|
fseek(sourceFile, 0, SEEK_SET);
|
||||||
@@ -382,7 +390,7 @@ int fcopy(const char *sourcePath, const char *destinationPath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FILE* destinationFile = fopen(destinationPath, "wb");
|
FILE* destinationFile = fopen(destinationPath, "wb");
|
||||||
//if(destinationFile) {
|
//if (destinationFile) {
|
||||||
fseek(destinationFile, 0, SEEK_SET);
|
fseek(destinationFile, 0, SEEK_SET);
|
||||||
/*} else {
|
/*} else {
|
||||||
fclose(sourceFile);
|
fclose(sourceFile);
|
||||||
@@ -392,16 +400,16 @@ int fcopy(const char *sourcePath, const char *destinationPath) {
|
|||||||
|
|
||||||
off_t offset = 0;
|
off_t offset = 0;
|
||||||
int numr;
|
int numr;
|
||||||
while(1)
|
while(1) {
|
||||||
{
|
|
||||||
scanKeys();
|
scanKeys();
|
||||||
if(keysHeld() & KEY_B) {
|
if (keysHeld() & KEY_B) {
|
||||||
// Cancel copying
|
// Cancel copying
|
||||||
fclose(sourceFile);
|
fclose(sourceFile);
|
||||||
fclose(destinationFile);
|
fclose(destinationFile);
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\x1b[16;0H");
|
printf("\x1b[16;0H");
|
||||||
printf("Progress:\n");
|
printf("Progress:\n");
|
||||||
printf("%i/%i Bytes ", (int)offset, (int)fsize);
|
printf("%i/%i Bytes ", (int)offset, (int)fsize);
|
||||||
@@ -411,7 +419,7 @@ int fcopy(const char *sourcePath, const char *destinationPath) {
|
|||||||
fwrite(copyBuf, 2, numr, destinationFile);
|
fwrite(copyBuf, 2, numr, destinationFile);
|
||||||
offset += copyBufSize;
|
offset += copyBufSize;
|
||||||
|
|
||||||
if(offset > fsize) {
|
if (offset > fsize) {
|
||||||
fclose(sourceFile);
|
fclose(sourceFile);
|
||||||
fclose(destinationFile);
|
fclose(destinationFile);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user