mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-06 16:49:11 +00:00
Properly refresh SelectFilePath(...);.
This commit is contained in:
@@ -22,7 +22,7 @@ std::vector<std::string> getContents(const std::string &name, const std::vector<
|
|||||||
|
|
||||||
bool returnIfExist(const std::string &path, const std::vector<std::string> &extensionList);
|
bool returnIfExist(const std::string &path, const std::vector<std::string> &extensionList);
|
||||||
|
|
||||||
std::string selectFilePath(std::string selectText, const std::vector<std::string> &extensionList, int selectionMode = 1);
|
std::string selectFilePath(std::string selectText, std::string initialPath, const std::vector<std::string> &extensionList, int selectionMode = 1);
|
||||||
|
|
||||||
void dirCopy(DirEntry* entry, int i, const char *destinationPath, const char *sourcePath);
|
void dirCopy(DirEntry* entry, int i, const char *destinationPath, const char *sourcePath);
|
||||||
int fcopy(const char *sourcePath, const char *destinationPath);
|
int fcopy(const char *sourcePath, const char *destinationPath);
|
||||||
|
|||||||
@@ -303,7 +303,7 @@ void ScriptCreator::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
std::string tempScript = selectFilePath("Select the Script file.", {"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 ) {
|
||||||
|
|||||||
@@ -431,7 +431,7 @@ void ScriptList::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
std::string tempScript = selectFilePath(Lang::get("SELECT_SCRIPT_PATH"), {});
|
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;
|
||||||
@@ -467,7 +467,7 @@ void ScriptList::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
notImplemented();
|
notImplemented();
|
||||||
}
|
}
|
||||||
} else if (touching(touch, subPos[3])) {
|
} else if (touching(touch, subPos[3])) {
|
||||||
std::string tempScript = selectFilePath(Lang::get("SELECT_SCRIPT_PATH"), {});
|
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;
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
|
|
||||||
if (hDown & KEY_A) {
|
if (hDown & KEY_A) {
|
||||||
if (Selection == 0) {
|
if (Selection == 0) {
|
||||||
std::string tempMusic = selectFilePath(Lang::get("SELECT_MUSIC_FILE"), {"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;
|
||||||
@@ -264,7 +264,7 @@ void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
|
|
||||||
if (hDown & KEY_TOUCH) {
|
if (hDown & KEY_TOUCH) {
|
||||||
if (touching(touch, mainButtons[0])) {
|
if (touching(touch, mainButtons[0])) {
|
||||||
std::string tempMusic = selectFilePath(Lang::get("SELECT_MUSIC_FILE"), {"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;
|
||||||
|
|||||||
@@ -549,7 +549,7 @@ void UniStore::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
std::string tempStore = selectFilePath(Lang::get("SELECT_STORE_PATH"), {});
|
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;
|
||||||
@@ -584,7 +584,7 @@ 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"), {});
|
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;
|
||||||
|
|||||||
@@ -141,17 +141,27 @@ bool returnIfExist(const std::string &path, const std::vector<std::string> &exte
|
|||||||
// returns a Path or file to 'std::string'.
|
// returns a Path or file to 'std::string'.
|
||||||
// selectText is the Text which is displayed on the bottom bar of the top screen.
|
// selectText is the Text which is displayed on the bottom bar of the top screen.
|
||||||
// selectionMode is how you select it. 1 -> Path, 2 -> File.
|
// selectionMode is how you select it. 1 -> Path, 2 -> File.
|
||||||
std::string selectFilePath(std::string selectText, const std::vector<std::string> &extensionList, int selectionMode) {
|
std::string selectFilePath(std::string selectText, std::string initialPath, const std::vector<std::string> &extensionList, int selectionMode) {
|
||||||
static uint selectedFile = 0;
|
uint selectedFile = 0;
|
||||||
std::string selectedPath = "";
|
std::string selectedPath = "";
|
||||||
static int keyRepeatDelay = 4;
|
int keyRepeatDelay = 4;
|
||||||
static bool dirChanged = true;
|
bool dirChanged = true;
|
||||||
static bool fastMode = false;
|
bool fastMode = false;
|
||||||
uint screenPos = 0;
|
uint screenPos = 0;
|
||||||
uint screenPosList = 0;
|
uint screenPosList = 0;
|
||||||
std::vector<DirEntry> dirContents;
|
std::vector<DirEntry> dirContents;
|
||||||
std::string dirs;
|
std::string dirs;
|
||||||
|
|
||||||
|
// Initial dir change.
|
||||||
|
dirContents.clear();
|
||||||
|
chdir(initialPath.c_str());
|
||||||
|
std::vector<DirEntry> dirContentsTemp;
|
||||||
|
getDirectoryContents(dirContentsTemp, extensionList);
|
||||||
|
for(uint i=0;i<dirContentsTemp.size();i++) {
|
||||||
|
dirContents.push_back(dirContentsTemp[i]);
|
||||||
|
}
|
||||||
|
selectedFile = 0;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
Gui::clearTextBufs();
|
Gui::clearTextBufs();
|
||||||
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
|
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
|
||||||
|
|||||||
Reference in New Issue
Block a user