summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Robbbert <Robbbert@users.noreply.github.com>2017-06-01 22:46:39 +1000
committer Robbbert <Robbbert@users.noreply.github.com>2017-06-01 22:46:39 +1000
commitcc9a0e699fd16e5c7245ae018e61fb6f18e9ccac (patch)
tree96fd474866d4d2adf8bbc9ef7c17b84616b9e2cf
parent889fff01a20e4e8f14f8c60c6368cfc179d8ffd6 (diff)
Windows debugger: image menu: Mount File/Create default to swpath instead of randomness.
-rw-r--r--src/osd/modules/debugger/win/consolewininfo.cpp42
1 files changed, 39 insertions, 3 deletions
diff --git a/src/osd/modules/debugger/win/consolewininfo.cpp b/src/osd/modules/debugger/win/consolewininfo.cpp
index f80d2873e6b..f094a47e28f 100644
--- a/src/osd/modules/debugger/win/consolewininfo.cpp
+++ b/src/osd/modules/debugger/win/consolewininfo.cpp
@@ -258,7 +258,7 @@ bool consolewin_info::handle_command(WPARAM wparam, LPARAM lparam)
std::string opt_name = img->instance_name();
std::string as = slmap.find(opt_name)->second;
- /* Make sure a folder was specified in the tab, and that it exists */
+ /* Make sure a folder was specified, and that it exists */
if ((!osd::directory::open(as.c_str())) || (as.find(':') == std::string::npos))
{
/* Default to emu directory */
@@ -318,6 +318,24 @@ bool consolewin_info::handle_command(WPARAM wparam, LPARAM lparam)
t_filter[i] = '\0';
}
+ char buf[400];
+ std::string as;
+ strcpy(buf, machine().options().emu_options::sw_path());
+ // This pulls out the first path from a multipath field
+ const char* t1 = strtok(buf, ";");
+ if (t1)
+ as = t1; // the first path of many
+ else
+ as = buf; // the only path
+
+ /* Make sure a folder was specified, and that it exists */
+ if ((!osd::directory::open(as.c_str())) || (as.find(':') == std::string::npos))
+ {
+ /* Default to emu directory */
+ osd_get_full_path(as, ".");
+ }
+ osd::text::tstring t_dir = osd::text::to_tstring(as);
+
TCHAR selectedFilename[MAX_PATH];
selectedFilename[0] = '\0';
OPENFILENAME ofn;
@@ -331,7 +349,7 @@ bool consolewin_info::handle_command(WPARAM wparam, LPARAM lparam)
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = nullptr;
ofn.nMaxFileTitle = 0;
- ofn.lpstrInitialDir = nullptr;
+ ofn.lpstrInitialDir = t_dir.c_str();
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (GetOpenFileName(&ofn))
@@ -355,6 +373,24 @@ bool consolewin_info::handle_command(WPARAM wparam, LPARAM lparam)
t_filter[i] = '\0';
}
+ char buf[400];
+ std::string as;
+ strcpy(buf, machine().options().emu_options::sw_path());
+ // This pulls out the first path from a multipath field
+ const char* t1 = strtok(buf, ";");
+ if (t1)
+ as = t1; // the first path of many
+ else
+ as = buf; // the only path
+
+ /* Make sure a folder was specified, and that it exists */
+ if ((!osd::directory::open(as.c_str())) || (as.find(':') == std::string::npos))
+ {
+ /* Default to emu directory */
+ osd_get_full_path(as, ".");
+ }
+ osd::text::tstring t_dir = osd::text::to_tstring(as);
+
TCHAR selectedFilename[MAX_PATH];
selectedFilename[0] = '\0';
OPENFILENAME ofn;
@@ -368,7 +404,7 @@ bool consolewin_info::handle_command(WPARAM wparam, LPARAM lparam)
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = nullptr;
ofn.nMaxFileTitle = 0;
- ofn.lpstrInitialDir = nullptr;
+ ofn.lpstrInitialDir = t_dir.c_str();
ofn.Flags = OFN_PATHMUSTEXIST;
if (GetSaveFileName(&ofn))