mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-03 00:39:02 +00:00
Implement Universal-Store [UniStore] 3DS side. (#13)
* WIP App store. ;P * Make the FileBrowse look like Scripts Screen. * Add *all* Script Functions for the App Store. * WIP; Store Selection & Store Screen. To-Do: Big cleanup and remove of duplicate stuff. * Some UniStore work. * :bigBruh:. * Add Spritesheet with Icon support. * Add a Store Prepare message, just in case it takes longer. * ~~Not really Camera stuff, just UniStore work.~~ (#12) * We don't want Nightly builds here. * Add UniStore Icon. * New banner by https://github.com/TotallyNotGuy * Add Buttons for a prompt & update icon. * Update README.md to be more descriptive and stuff * Update README.md * Add updating the spritesheet too. * Only update stores, if needed things exist! * Make Storepath changeable. * Change App Description. * Display `Title` as well. * You can now download .unistore files by entering a URL! Co-authored-by: FlameKat53 <flame9804@yahoo.com> * This should fix all warnings. Also add posX and posY for the Icons in UniStore. * Last changes for UniStore. Co-authored-by: FlameKat53 <flame9804@yahoo.com>
This commit is contained in:
+52
-17
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "screens/screenCommon.hpp"
|
||||
|
||||
#include "utils/common.hpp"
|
||||
#include "utils/config.hpp"
|
||||
#include "utils/fileBrowse.h"
|
||||
#include "utils/structs.hpp"
|
||||
@@ -36,6 +37,7 @@ std::vector<Structs::ButtonPos> buttonPositions = {
|
||||
{80, 220, 50, 15, -1}, // Select.
|
||||
{145, 220, 50, 15, -1}, // Refresh.
|
||||
{210, 220, 50, 15, -1}, // Back.
|
||||
{0, 0, 25, 25, -1}, // ViewMode Change.
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -198,7 +200,10 @@ std::string selectFilePath(std::string selectText, const std::vector<std::string
|
||||
static int keyRepeatDelay = 4;
|
||||
static bool dirChanged = true;
|
||||
static bool fastMode = false;
|
||||
uint screenPos = 0;
|
||||
uint screenPosList = 0;
|
||||
std::vector<DirEntry> dirContents;
|
||||
std::string dirs;
|
||||
|
||||
while (1) {
|
||||
Gui::clearTextBufs();
|
||||
@@ -215,21 +220,28 @@ std::string selectFilePath(std::string selectText, const std::vector<std::string
|
||||
Gui::DrawString((400-(Gui::GetStringWidth(0.60f, path)))/2, 0, 0.60f, Config::TxtColor, path);
|
||||
Gui::DrawStringCentered(0, 218, 0.60f, Config::TxtColor, selectText, 400);
|
||||
}
|
||||
|
||||
std::string dirs;
|
||||
for (uint i=(selectedFile<5) ? 0 : selectedFile-5;i<dirContents.size()&&i<((selectedFile<5) ? 6 : selectedFile+1);i++) {
|
||||
if (i == selectedFile) {
|
||||
dirs += "> " + dirContents[i].name + "\n\n";
|
||||
} else {
|
||||
dirs += dirContents[i].name + "\n\n";
|
||||
Gui::DrawBottom();
|
||||
if (Config::viewMode == 0) {
|
||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)dirContents.size();i++) {
|
||||
dirs = dirContents[screenPos + i].name;
|
||||
if(screenPos + i == selectedFile) {
|
||||
Gui::Draw_Rect(0, 40+(i*57), 320, 45, C2D_Color32(120, 192, 216, 255));
|
||||
} else {
|
||||
Gui::Draw_Rect(0, 40+(i*57), 320, 45, C2D_Color32(77, 118, 132, 255));
|
||||
}
|
||||
Gui::DrawStringCentered(0, 50+(i*57), 0.7f, WHITE, dirs, 320);
|
||||
}
|
||||
} else if (Config::viewMode == 1) {
|
||||
for(int i=0;i<ENTRIES_PER_LIST && i<(int)dirContents.size();i++) {
|
||||
dirs = dirContents[screenPosList + i].name;
|
||||
if(screenPosList + i == selectedFile) {
|
||||
Gui::Draw_Rect(0, (i+1)*27, 320, 25, Config::SelectedColor);
|
||||
} else {
|
||||
Gui::Draw_Rect(0, (i+1)*27, 320, 25, Config::UnselectedColor);
|
||||
}
|
||||
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, Config::TxtColor, dirs, 320);
|
||||
}
|
||||
}
|
||||
for (uint i=0;i<((dirContents.size()<6) ? 6-dirContents.size() : 0);i++) {
|
||||
dirs += "\n\n";
|
||||
}
|
||||
|
||||
Gui::DrawString(26, 32, 0.53f, Config::TxtColor, dirs.c_str());
|
||||
Gui::DrawBottom();
|
||||
|
||||
if (Config::UseBars == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.5f, Config::TxtColor, Lang::get("FILEBROWSE_MSG"), 320);
|
||||
@@ -238,6 +250,7 @@ std::string selectFilePath(std::string selectText, const std::vector<std::string
|
||||
}
|
||||
Gui::DrawArrow(295, -1);
|
||||
Gui::DrawArrow(315, 240, 180.0);
|
||||
Gui::spriteBlend(sprites_view_idx, buttonPositions[6].x, buttonPositions[6].y);
|
||||
|
||||
Gui::Draw_Rect(buttonPositions[2].x, buttonPositions[2].y, buttonPositions[2].w, buttonPositions[2].h, C2D_Color32(0, 0, 0, 190));
|
||||
Gui::Draw_Rect(buttonPositions[3].x, buttonPositions[3].y, buttonPositions[3].w, buttonPositions[3].h, C2D_Color32(0, 0, 0, 190));
|
||||
@@ -267,11 +280,11 @@ std::string selectFilePath(std::string selectText, const std::vector<std::string
|
||||
dirChanged = false;
|
||||
}
|
||||
|
||||
if (hidKeysDown() & KEY_SELECT || hidKeysDown() & KEY_TOUCH && touching(touch, buttonPositions[4])) {
|
||||
if ((hidKeysDown() & KEY_SELECT) || (hidKeysDown() & KEY_TOUCH && touching(touch, buttonPositions[4]))) {
|
||||
dirChanged = true;
|
||||
}
|
||||
|
||||
if (hidKeysDown() & KEY_A || hidKeysDown() & KEY_TOUCH && touching(touch, buttonPositions[2])) {
|
||||
if ((hidKeysDown() & KEY_A) || (hidKeysDown() & KEY_TOUCH && touching(touch, buttonPositions[2]))) {
|
||||
if (dirContents.size() != 0) {
|
||||
if (dirContents[selectedFile].isDirectory) {
|
||||
chdir(dirContents[selectedFile].name.c_str());
|
||||
@@ -310,7 +323,7 @@ std::string selectFilePath(std::string selectText, const std::vector<std::string
|
||||
}
|
||||
}
|
||||
|
||||
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];
|
||||
getcwd(path, PATH_MAX);
|
||||
if(strcmp(path, "sdmc:/") == 0 || strcmp(path, "/") == 0) {
|
||||
@@ -322,7 +335,7 @@ std::string selectFilePath(std::string selectText, const std::vector<std::string
|
||||
}
|
||||
}
|
||||
|
||||
if (hidKeysDown() & KEY_X || hidKeysDown() & KEY_TOUCH && touching(touch, buttonPositions[3])) {
|
||||
if ((hidKeysDown() & KEY_X) || (hidKeysDown() & KEY_TOUCH && touching(touch, buttonPositions[3]))) {
|
||||
char path[PATH_MAX];
|
||||
getcwd(path, PATH_MAX);
|
||||
selectedPath = path;
|
||||
@@ -339,5 +352,27 @@ std::string selectFilePath(std::string selectText, const std::vector<std::string
|
||||
if (hidKeysDown() & KEY_L) {
|
||||
fastMode = false;
|
||||
}
|
||||
// Switch ViewMode.
|
||||
if ((hidKeysDown() & KEY_Y) || (hidKeysDown() & KEY_TOUCH && touching(touch, buttonPositions[6]))) {
|
||||
if (Config::viewMode == 0) {
|
||||
Config::viewMode = 1;
|
||||
} else {
|
||||
Config::viewMode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (Config::viewMode == 0) {
|
||||
if(selectedFile < screenPos) {
|
||||
screenPos = selectedFile;
|
||||
} else if (selectedFile > screenPos + ENTRIES_PER_SCREEN - 1) {
|
||||
screenPos = selectedFile - ENTRIES_PER_SCREEN + 1;
|
||||
}
|
||||
} else if (Config::viewMode == 1) {
|
||||
if(selectedFile < screenPosList) {
|
||||
screenPosList = selectedFile;
|
||||
} else if (selectedFile > screenPosList + ENTRIES_PER_LIST - 1) {
|
||||
screenPosList = selectedFile - ENTRIES_PER_LIST + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user