mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-03 00:39:02 +00:00
See desc for more.
- Added option, to have a 400x214px custom Image as the Background on a UniStore. - Added a header bar on almost all menus. - Added GUI Settings.
This commit is contained in:
+122
-32
@@ -30,13 +30,13 @@
|
||||
extern bool exiting;
|
||||
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
||||
static const std::vector<Structs::ButtonPos> mainButtons = {
|
||||
{ 54, 4, 262, 22 },
|
||||
{ 54, 34, 262, 22 },
|
||||
{ 54, 64, 262, 22 },
|
||||
{ 54, 94, 262, 22 },
|
||||
{ 54, 124, 262, 22 },
|
||||
{ 54, 154, 262, 22 },
|
||||
{ 54, 184, 262, 22 }
|
||||
{ 54, 32, 262, 22 },
|
||||
{ 54, 62, 262, 22 },
|
||||
{ 54, 92, 262, 22 },
|
||||
{ 54, 122, 262, 22 },
|
||||
{ 54, 152, 262, 22 },
|
||||
{ 54, 182, 262, 22 },
|
||||
{ 54, 212, 262, 22 }
|
||||
};
|
||||
|
||||
static const std::vector<Structs::ButtonPos> toggleAbles = {
|
||||
@@ -45,8 +45,10 @@ static const std::vector<Structs::ButtonPos> toggleAbles = {
|
||||
{ 288, 140, 24, 24 }
|
||||
};
|
||||
|
||||
static const Structs::ButtonPos back = { 52, 0, 24, 24 }; // Back arrow for directory.
|
||||
|
||||
static const std::vector<std::string> mainStrings = { "LANGUAGE", "SELECT_UNISTORE", "AUTO_UPDATE_SETTINGS_BTN", "CHANGE_DIRECTORIES", "CREDITS", "EXIT_APP" };
|
||||
|
||||
static const std::vector<std::string> mainStrings = { "LANGUAGE", "SELECT_UNISTORE", "AUTO_UPDATE_SETTINGS_BTN", "GUI_SETTINGS_BTN", "DIRECTORY_SETTINGS_BTN", "CREDITS", "EXIT_APP" };
|
||||
static const std::vector<std::string> dirStrings = { "CHANGE_3DSX_PATH", "CHANGE_NDS_PATH", "CHANGE_ARCHIVE_PATH" };
|
||||
|
||||
/*
|
||||
@@ -55,7 +57,11 @@ static const std::vector<std::string> dirStrings = { "CHANGE_3DSX_PATH", "CHANGE
|
||||
const int &selection: Const Reference to the Settings Selection.
|
||||
*/
|
||||
static void DrawSettingsMain(const int &selection) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
Gui::Draw_Rect(48, 0, 272, 25, ENTRY_BAR_COLOR);
|
||||
Gui::Draw_Rect(48, 25, 272, 1, ENTRY_BAR_OUTL_COLOR);
|
||||
Gui::DrawStringCentered(25, 2, 0.6, TEXT_COLOR, Lang::get("SETTINGS"), 265);
|
||||
|
||||
for (int i = 0; i < 7; i++) {
|
||||
if (i == selection) GFX::DrawBox(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, false);
|
||||
Gui::DrawStringCentered(30, mainButtons[i].y + 4, 0.45f, TEXT_COLOR, Lang::get(mainStrings[i]), 255);
|
||||
}
|
||||
@@ -67,6 +73,11 @@ static void DrawSettingsMain(const int &selection) {
|
||||
const int &selection: Const Reference to the Settings Selection.
|
||||
*/
|
||||
static void DrawSettingsDir(const int &selection) {
|
||||
Gui::Draw_Rect(48, 0, 272, 25, ENTRY_BAR_COLOR);
|
||||
Gui::Draw_Rect(48, 25, 272, 1, ENTRY_BAR_OUTL_COLOR);
|
||||
GFX::DrawSprite(sprites_arrow_idx, back.x, back.y);
|
||||
Gui::DrawStringCentered(32, 2, 0.6, TEXT_COLOR, Lang::get("DIRECTORY_SETTINGS"), 240);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (i == selection) GFX::DrawBox(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, false);
|
||||
Gui::DrawStringCentered(30, mainButtons[i].y + 4, 0.45f, TEXT_COLOR, Lang::get(dirStrings[i]), 255);
|
||||
@@ -76,7 +87,7 @@ static void DrawSettingsDir(const int &selection) {
|
||||
/*
|
||||
Draw Auto-Update Settings page.
|
||||
*/
|
||||
static void DrawAutoUpdate() {
|
||||
static void DrawAutoUpdate(const int &selection) {
|
||||
Gui::Draw_Rect(48, 0, 272, 36, ENTRY_BAR_COLOR);
|
||||
Gui::Draw_Rect(48, 36, 272, 1, ENTRY_BAR_OUTL_COLOR);
|
||||
GFX::DrawSprite(sprites_arrow_idx, 52, 6);
|
||||
@@ -84,17 +95,30 @@ static void DrawAutoUpdate() {
|
||||
Gui::DrawStringCentered(32, 7, 0.6, TEXT_COLOR, Lang::get("AUTO_UPDATE_SETTINGS"), 240);
|
||||
|
||||
/* Toggle Boxes. */
|
||||
GFX::DrawBox(48, 64, 273, 24, false);
|
||||
Gui::Draw_Rect(48, 64, 273, 24, (selection == 0 ? SIDEBAR_UNSELECTED_COLOR : BOX_INSIDE_COLOR));
|
||||
Gui::DrawString(55, 68, 0.5f, TEXT_COLOR, Lang::get("AUTO_UPDATE_UNISTORE"), 210);
|
||||
GFX::DrawToggle(288, 64, config->autoupdate());
|
||||
Gui::DrawString(55, 95, 0.4f, TEXT_COLOR, Lang::get("AUTO_UPDATE_UNISTORE_DESC"), 265, 0, nullptr, C2D_WordWrap);
|
||||
|
||||
GFX::DrawBox(48, 140, 273, 24, false);
|
||||
Gui::Draw_Rect(48, 140, 273, 24, (selection == 1 ? SIDEBAR_UNSELECTED_COLOR : BOX_INSIDE_COLOR));
|
||||
Gui::DrawString(55, 144, 0.5f, TEXT_COLOR, Lang::get("AUTO_UPDATE_UU"), 210);
|
||||
GFX::DrawToggle(288, 140, config->updatecheck());
|
||||
Gui::DrawString(55, 171, 0.4f, TEXT_COLOR, Lang::get("AUTO_UPDATE_UU_DESC"), 265, 0, nullptr, C2D_WordWrap);
|
||||
}
|
||||
|
||||
static void DrawGUISettings(const int &selection) {
|
||||
Gui::Draw_Rect(48, 0, 272, 36, ENTRY_BAR_COLOR);
|
||||
Gui::Draw_Rect(48, 36, 272, 1, ENTRY_BAR_OUTL_COLOR);
|
||||
GFX::DrawSprite(sprites_arrow_idx, 52, 6);
|
||||
|
||||
Gui::DrawStringCentered(32, 7, 0.6, TEXT_COLOR, Lang::get("GUI_SETTINGS"), 240);
|
||||
|
||||
Gui::Draw_Rect(48, 64, 273, 24, (selection == 0 ? SIDEBAR_UNSELECTED_COLOR : BOX_INSIDE_COLOR));
|
||||
Gui::DrawString(55, 68, 0.5f, TEXT_COLOR, Lang::get("UNISTORE_BG"), 210);
|
||||
GFX::DrawToggle(288, 64, config->usebg());
|
||||
Gui::DrawString(55, 95, 0.4f, TEXT_COLOR, Lang::get("UNISTORE_BG_DESC"), 265, 0, nullptr, C2D_WordWrap);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Settings Main Handle.
|
||||
@@ -124,7 +148,7 @@ static void SettingsHandleMain(u32 hDown, u32 hHeld, touchPosition touch, int &p
|
||||
}
|
||||
|
||||
if (hRepeat & KEY_DOWN) {
|
||||
if (selection < 5) selection++;
|
||||
if (selection < 6) selection++;
|
||||
else selection = 0;
|
||||
}
|
||||
|
||||
@@ -145,7 +169,7 @@ static void SettingsHandleMain(u32 hDown, u32 hHeld, touchPosition touch, int &p
|
||||
|
||||
if (hDown & KEY_TOUCH) {
|
||||
if (touching(touch, mainButtons[0])) {
|
||||
Overlays::SelectLanguage();
|
||||
Overlays::SelectLanguage(store);
|
||||
|
||||
} else if (touching(touch, mainButtons[1])) {
|
||||
Overlays::SelectStore(store, entries, meta);
|
||||
@@ -155,13 +179,17 @@ static void SettingsHandleMain(u32 hDown, u32 hHeld, touchPosition touch, int &p
|
||||
page = 2;
|
||||
|
||||
} else if (touching(touch, mainButtons[3])) {
|
||||
selection = 0;
|
||||
page = 3;
|
||||
|
||||
} else if (touching(touch, mainButtons[4])) {
|
||||
selection = 0;
|
||||
page = 1;
|
||||
|
||||
} else if (touching(touch, mainButtons[4])) {
|
||||
} else if (touching(touch, mainButtons[5])) {
|
||||
Overlays::ShowCredits();
|
||||
|
||||
} else if (touching(touch, mainButtons[5])) {
|
||||
} else if (touching(touch, mainButtons[6])) {
|
||||
exiting = true;
|
||||
}
|
||||
}
|
||||
@@ -169,7 +197,7 @@ static void SettingsHandleMain(u32 hDown, u32 hHeld, touchPosition touch, int &p
|
||||
if (hDown & KEY_A) {
|
||||
switch(selection) {
|
||||
case 0:
|
||||
Overlays::SelectLanguage();
|
||||
Overlays::SelectLanguage(store);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
@@ -183,14 +211,19 @@ static void SettingsHandleMain(u32 hDown, u32 hHeld, touchPosition touch, int &p
|
||||
|
||||
case 3:
|
||||
selection = 0;
|
||||
page = 1;
|
||||
page = 3;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
Overlays::ShowCredits();
|
||||
selection = 0;
|
||||
page = 1;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
Overlays::ShowCredits();
|
||||
break;
|
||||
|
||||
case 6:
|
||||
exiting = true;
|
||||
break;
|
||||
}
|
||||
@@ -210,10 +243,10 @@ static void SettingsHandleMain(u32 hDown, u32 hHeld, touchPosition touch, int &p
|
||||
int &page: Reference to the page.
|
||||
int &selection: Reference to the Selection.
|
||||
*/
|
||||
static void SettingsHandleDir(u32 hDown, u32 hHeld, touchPosition touch, int &page, int &selection) {
|
||||
static void SettingsHandleDir(u32 hDown, u32 hHeld, touchPosition touch, int &page, int &selection, const std::unique_ptr<Store> &store) {
|
||||
if (hDown & KEY_B) {
|
||||
page = 0;
|
||||
selection = 3;
|
||||
selection = 4;
|
||||
}
|
||||
|
||||
if (hRepeat & KEY_DOWN) {
|
||||
@@ -237,16 +270,20 @@ static void SettingsHandleDir(u32 hDown, u32 hHeld, touchPosition touch, int &pa
|
||||
}
|
||||
|
||||
if (hDown & KEY_TOUCH) {
|
||||
if (touching(touch, mainButtons[0])) {
|
||||
const std::string path = Overlays::SelectDir(config->_3dsxPath(), Lang::get("SELECT_DIR"));
|
||||
if (touching(touch, back)) {
|
||||
page = 0;
|
||||
selection = 4;
|
||||
|
||||
} else if (touching(touch, mainButtons[0])) {
|
||||
const std::string path = Overlays::SelectDir(config->_3dsxPath(), Lang::get("SELECT_DIR"), store);
|
||||
if (path != "") config->_3dsxPath(path);
|
||||
|
||||
} else if (touching(touch, mainButtons[1])) {
|
||||
const std::string path = Overlays::SelectDir(config->ndsPath(), Lang::get("SELECT_DIR"));
|
||||
const std::string path = Overlays::SelectDir(config->ndsPath(), Lang::get("SELECT_DIR"), store);
|
||||
if (path != "") config->ndsPath(path);
|
||||
|
||||
} else if (touching(touch, mainButtons[2])) {
|
||||
const std::string path = Overlays::SelectDir(config->archPath(), Lang::get("SELECT_DIR"));
|
||||
const std::string path = Overlays::SelectDir(config->archPath(), Lang::get("SELECT_DIR"), store);
|
||||
if (path != "") config->archPath(path);
|
||||
}
|
||||
}
|
||||
@@ -256,29 +293,37 @@ static void SettingsHandleDir(u32 hDown, u32 hHeld, touchPosition touch, int &pa
|
||||
|
||||
switch(selection) {
|
||||
case 0:
|
||||
path = Overlays::SelectDir(config->_3dsxPath(), Lang::get("SELECT_DIR"));
|
||||
path = Overlays::SelectDir(config->_3dsxPath(), Lang::get("SELECT_DIR"), store);
|
||||
if (path != "") config->_3dsxPath(path);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
path = Overlays::SelectDir(config->ndsPath(), Lang::get("SELECT_DIR"));
|
||||
path = Overlays::SelectDir(config->ndsPath(), Lang::get("SELECT_DIR"), store);
|
||||
if (path != "") config->ndsPath(path);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
path = Overlays::SelectDir(config->archPath(), Lang::get("SELECT_DIR"));
|
||||
path = Overlays::SelectDir(config->archPath(), Lang::get("SELECT_DIR"), store);
|
||||
if (path != "") config->archPath(path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void SettingsToggleLogic(u32 hDown, u32 hHeld, touchPosition touch, int &page, int &selection) {
|
||||
static void AutoUpdateLogic(u32 hDown, u32 hHeld, touchPosition touch, int &page, int &selection) {
|
||||
if (hDown & KEY_B) {
|
||||
page = 0;
|
||||
selection = 2;
|
||||
}
|
||||
|
||||
if (hRepeat & KEY_DOWN) {
|
||||
if (selection < 1) selection++;
|
||||
}
|
||||
|
||||
if (hRepeat & KEY_UP) {
|
||||
if (selection > 0) selection--;
|
||||
}
|
||||
|
||||
if (hDown & KEY_TOUCH) {
|
||||
if (touching(touch, toggleAbles[0])) {
|
||||
page = 0;
|
||||
@@ -291,6 +336,43 @@ static void SettingsToggleLogic(u32 hDown, u32 hHeld, touchPosition touch, int &
|
||||
config->updatecheck(!config->updatecheck());
|
||||
}
|
||||
}
|
||||
|
||||
if (hDown & KEY_A) {
|
||||
switch(selection) {
|
||||
case 0:
|
||||
config->autoupdate(!config->autoupdate());
|
||||
break;
|
||||
|
||||
case 1:
|
||||
config->updatecheck(!config->updatecheck());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void GUISettingsLogic(u32 hDown, u32 hHeld, touchPosition touch, int &page, int &selection, const std::unique_ptr<Store> &store) {
|
||||
if (hDown & KEY_B) {
|
||||
page = 0;
|
||||
selection = 3;
|
||||
}
|
||||
|
||||
if (hDown & KEY_TOUCH) {
|
||||
if (touching(touch, toggleAbles[0])) {
|
||||
page = 0;
|
||||
selection = 3;
|
||||
|
||||
} else if (touching(touch, toggleAbles[1])) {
|
||||
config->usebg(!config->usebg());
|
||||
}
|
||||
}
|
||||
|
||||
if (hDown & KEY_A) {
|
||||
switch(selection) {
|
||||
case 0:
|
||||
config->usebg(!config->usebg());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -310,7 +392,11 @@ void StoreUtils::DrawSettings(const int &page, const int &selection) {
|
||||
break;
|
||||
|
||||
case 2:
|
||||
DrawAutoUpdate();
|
||||
DrawAutoUpdate(selection);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
DrawGUISettings(selection);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -336,11 +422,15 @@ void StoreUtils::SettingsHandle(u32 hDown, u32 hHeld, touchPosition touch, int &
|
||||
break;
|
||||
|
||||
case 1:
|
||||
SettingsHandleDir(hDown, hHeld, touch, page, selection);
|
||||
SettingsHandleDir(hDown, hHeld, touch, page, selection, store);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
SettingsToggleLogic(hDown, hHeld, touch, page, selection);
|
||||
AutoUpdateLogic(hDown, hHeld, touch, page, selection);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
GUISettingsLogic(hDown, hHeld, touch, page, selection, store);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user