diff --git a/project/vs2013_mfc/VBA2013.vcxproj b/project/vs2013_mfc/VBA2013.vcxproj
index c332ca09..340e9fbc 100644
--- a/project/vs2013_mfc/VBA2013.vcxproj
+++ b/project/vs2013_mfc/VBA2013.vcxproj
@@ -201,7 +201,7 @@
-
+
@@ -259,7 +259,7 @@
-
+
_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
diff --git a/src/wx/cmdevents.cpp b/src/wx/cmdevents.cpp
index 63b9ab39..10d567ee 100644
--- a/src/wx/cmdevents.cpp
+++ b/src/wx/cmdevents.cpp
@@ -92,7 +92,7 @@ static wxString open_dir;
EVT_HANDLER(wxID_OPEN, "Open ROM...")
{
- open_dir = gopts.gba_rom_dir;
+ open_dir = wxGetApp().GetAbsolutePath(gopts.gba_rom_dir);
// FIXME: ignore if non-existent or not a dir
wxString pats = _(
"GameBoy Advance Files (*.agb;*.gba;*.bin;*.elf;*.mb;*.zip;*.7z;*.rar)|"
@@ -122,7 +122,7 @@ EVT_HANDLER(wxID_OPEN, "Open ROM...")
EVT_HANDLER(OpenGB, "Open GB...")
{
- open_dir = gopts.gb_rom_dir;
+ open_dir = wxGetApp().GetAbsolutePath(gopts.gb_rom_dir);
// FIXME: ignore if non-existent or not a dir
wxString pats = _(
"GameBoy Files (*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|"
@@ -147,7 +147,7 @@ EVT_HANDLER(OpenGB, "Open GB...")
EVT_HANDLER(OpenGBC, "Open GBC...")
{
- open_dir = gopts.gbc_rom_dir;
+ open_dir = wxGetApp().GetAbsolutePath(gopts.gbc_rom_dir);
// FIXME: ignore if non-existent or not a dir
wxString pats = _(
"GameBoy Color Files (*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|"
@@ -844,7 +844,7 @@ EVT_HANDLER_MASK(SaveDotCodeFile, "Save e-Reader Dot Code...", CMDEN_GBA)
return;
savedotcodefile_path = dlg.GetPath();
- SetLoadDotCodeFile(savedotcodefile_path.mb_str(wxConvUTF8));
+ SetSaveDotCodeFile(savedotcodefile_path.mb_str(wxConvUTF8));
}
static wxString batimp_path;
@@ -1133,23 +1133,7 @@ EVT_HANDLER_MASK(ExportGamesharkSnapshot, "Export GameShark snapshot...", CMDEN_
EVT_HANDLER_MASK(ScreenCapture, "Screen capture...", CMDEN_GB | CMDEN_GBA)
{
- static wxString scap_path;
-
- if (!scap_path.size())
- {
- scap_path = gopts.scrshot_dir;
-
- if (scap_path.size())
- {
- wxFileName sp(scap_path, wxEmptyString);
-
- if (!sp.IsAbsolute())
- scap_path = panel->game_dir() + wxT('/') + gopts.scrshot_dir;
-
- wxFileName::Mkdir(scap_path, 0777, wxPATH_MKDIR_FULL);
- }
- }
-
+ wxString scap_path = GetGamePath(gopts.scrshot_dir);
wxString def_name = panel->game_name();
if (captureFormat == 0)
@@ -1230,23 +1214,7 @@ EVT_HANDLER_MASK(RecordSoundStartRecording, "Start sound recording...", CMDEN_NS
sound_extno = extno;
}
- if (!sound_path.size())
- {
- if (!gopts.recording_dir.size())
- sound_path = panel->game_dir();
- else
- {
- wxFileName sp(gopts.recording_dir, wxEmptyString);
-
- if (sp.IsAbsolute())
- sound_path = gopts.recording_dir;
- else
- sound_path = panel->game_dir() + wxT('/') + gopts.recording_dir;
- }
-
- wxFileName::Mkdir(sound_path, 0777, wxPATH_MKDIR_FULL);
- }
-
+ sound_path = GetGamePath(gopts.recording_dir);
wxString def_name = panel->game_name();
const wxChar* extoff = sound_exts.c_str();
@@ -1322,23 +1290,7 @@ EVT_HANDLER_MASK(RecordAVIStartRecording, "Start video recording...", CMDEN_NVRE
vid_extno = extno;
}
- if (!vid_path.size())
- {
- if (!gopts.recording_dir.size())
- vid_path = panel->game_dir();
- else
- {
- wxFileName sp(gopts.recording_dir, wxEmptyString);
-
- if (sp.IsAbsolute())
- vid_path = gopts.recording_dir;
- else
- vid_path = panel->game_dir() + wxT('/') + gopts.recording_dir;
- }
-
- wxFileName::Mkdir(vid_path, 0777, wxPATH_MKDIR_FULL);
- }
-
+ vid_path = GetGamePath(gopts.recording_dir);
wxString def_name = panel->game_name();
const wxChar* extoff = vid_exts.c_str();
@@ -1375,23 +1327,7 @@ static wxString mov_path;
EVT_HANDLER_MASK(RecordMovieStartRecording, "Start game recording...", CMDEN_NGREC)
{
- if (!mov_path.size())
- {
- if (!gopts.recording_dir.size())
- mov_path = panel->game_dir();
- else
- {
- wxFileName sp(gopts.recording_dir, wxEmptyString);
-
- if (sp.IsAbsolute())
- mov_path = gopts.recording_dir;
- else
- mov_path = panel->game_dir() + wxT('/') + gopts.recording_dir;
- }
-
- wxFileName::Mkdir(mov_path, 0777, wxPATH_MKDIR_FULL);
- }
-
+ mov_path = GetGamePath(gopts.recording_dir);
wxString def_name = panel->game_name() + wxT(".vmv");
wxFileDialog dlg(this, _("Select output file"), mov_path, def_name,
_("VBA Movie files|*.vmv"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
@@ -1411,24 +1347,7 @@ EVT_HANDLER_MASK(RecordMovieStopRecording, "Stop game recording", CMDEN_GREC)
EVT_HANDLER_MASK(PlayMovieStartPlaying, "Start playing movie...", CMDEN_NGREC | CMDEN_NGPLAY)
{
- if (!mov_path.size())
- {
- if (!gopts.recording_dir.size())
- mov_path = panel->game_dir();
- else
- {
- wxFileName sp(gopts.recording_dir, wxEmptyString);
-
- if (sp.IsAbsolute())
- mov_path = gopts.recording_dir;
- else
- mov_path = panel->game_dir() + wxT('/') + gopts.recording_dir;
- }
-
- if (!wxFileName::DirExists(mov_path))
- mov_path = wxFileName::GetCwd();
- }
-
+ mov_path = GetGamePath(gopts.recording_dir);
systemStopGamePlayback();
wxString def_name = panel->game_name() + wxT(".vmv");
wxFileDialog dlg(this, _("Select file"), mov_path, def_name,
@@ -1951,9 +1870,7 @@ EVT_HANDLER_MASK(Disassemble, "Disassemble...", CMDEN_GB | CMDEN_GBA)
Disassemble();
}
-// only GBA generates the log messages this handles
-// you could view them even w/o a gba cart, but why?
-EVT_HANDLER_MASK(Logging, "Logging...", CMDEN_GBA)
+EVT_HANDLER(Logging, "Logging...")
{
wxDialog* dlg = wxGetApp().frame->logdlg;
dlg->SetWindowStyle(wxCAPTION | wxRESIZE_BORDER);
@@ -2310,7 +2227,7 @@ EVT_HANDLER(GameBoyAdvanceConfigure, "Game Boy Advance options...")
if (chg)
{
wxString vba_over;
- wxFileName fn(wxStandardPaths::Get().GetUserDataDir(), wxT("vba-over.ini"));
+ wxFileName fn(wxGetApp().GetConfigurationPath(), wxT("vba-over.ini"));
if (fn.FileExists())
{
@@ -2587,7 +2504,7 @@ EVT_HANDLER(wxID_ABOUT, "About...")
wxAboutDialogInfo ai;
ai.SetName(wxT("VisualBoyAdvance-M"));
wxString version = wxT("");
-#ifdef FINAL_BUILD
+#ifndef FINAL_BUILD
version = version + wxT("-") + wxT(SVN_REV_STR);
#endif
ai.SetVersion(version);
diff --git a/src/wx/panel.cpp b/src/wx/panel.cpp
index faa66830..6bc375c2 100644
--- a/src/wx/panel.cpp
+++ b/src/wx/panel.cpp
@@ -45,21 +45,21 @@ void GameArea::LoadGame(const wxString &name)
wxString rp = fnfn.GetPath();
// can't really decide which dir to use, so try GBA first, then GB
- if (!gopts.gba_rom_dir.empty())
+ if (!wxGetApp().GetAbsolutePath(gopts.gba_rom_dir).empty())
{
- fnfn.SetPath(gopts.gba_rom_dir + wxT('/') + rp);
+ fnfn.SetPath(wxGetApp().GetAbsolutePath(gopts.gba_rom_dir) + wxT('/') + rp);
badfile = !fnfn.IsFileReadable();
}
- if (badfile && !gopts.gb_rom_dir.empty())
+ if (badfile && !wxGetApp().GetAbsolutePath(gopts.gb_rom_dir).empty())
{
- fnfn.SetPath(gopts.gb_rom_dir + wxT('/') + rp);
+ fnfn.SetPath(wxGetApp().GetAbsolutePath(gopts.gb_rom_dir) + wxT('/') + rp);
badfile = !fnfn.IsFileReadable();
}
- if (badfile && !gopts.gbc_rom_dir.empty())
+ if (badfile && !wxGetApp().GetAbsolutePath(gopts.gbc_rom_dir).empty())
{
- fnfn.SetPath(gopts.gbc_rom_dir + wxT('/') + rp);
+ fnfn.SetPath(wxGetApp().GetAbsolutePath(gopts.gbc_rom_dir) + wxT('/') + rp);
badfile = !fnfn.IsFileReadable();
}
}
@@ -450,7 +450,7 @@ void GameArea::SetFrameTitle()
}
tit.append(wxT("VisualBoyAdvance-M "));
-#ifdef FINAL_BUILD
+#ifndef FINAL_BUILD
tit.append(_(SVN_REV_STR));
#endif
#ifndef NO_LINK
@@ -471,26 +471,30 @@ void GameArea::recompute_dirs()
batdir = gopts.battery_dir;
if (!batdir.size())
- batdir = wxStandardPaths::Get().GetUserLocalDataDir();
+ {
+ batdir = loaded_game.GetPathWithSep();
+ }
else
{
- wxFileName bp(batdir, wxEmptyString);
-
- if (!bp.IsAbsolute())
- batdir = loaded_game.GetPathWithSep() + batdir;
+ batdir = wxGetApp().GetAbsolutePath(gopts.battery_dir);
}
statedir = gopts.state_dir;
if (!statedir.size())
- statedir = batdir;
+ {
+ statedir = loaded_game.GetPathWithSep();
+ }
else
{
- wxFileName sp(statedir, wxEmptyString);
-
- if (!sp.IsAbsolute())
- statedir = batdir + wxT('/') + statedir;
+ statedir = wxGetApp().GetAbsolutePath(gopts.state_dir);
}
+
+ if (!wxIsWritable(batdir))
+ batdir = wxGetApp().GetConfigurationPath();
+
+ if (!wxIsWritable(statedir))
+ statedir = wxGetApp().GetConfigurationPath();
}
void GameArea::UnloadGame(bool destruct)
diff --git a/src/wx/sys.cpp b/src/wx/sys.cpp
index 5ce74d85..f69d0aa6 100644
--- a/src/wx/sys.cpp
+++ b/src/wx/sys.cpp
@@ -454,18 +454,7 @@ void systemFrame()
void systemScreenCapture(int num)
{
GameArea* panel = wxGetApp().frame->GetPanel();
- wxFileName fn;
-
- if (!gopts.scrshot_dir.size())
- fn = wxFileName(panel->game_dir(), wxEmptyString);
- else
- {
- fn = wxFileName(gopts.scrshot_dir, wxEmptyString);
-
- if (!fn.IsAbsolute())
- fn = wxFileName(panel->game_dir() + wxT('/') +
- gopts.scrshot_dir, wxEmptyString);
- }
+ wxFileName fn = wxFileName(wxGetApp().frame->GetGamePath(gopts.scrshot_dir), wxEmptyString);
do
{
@@ -1048,19 +1037,7 @@ void systemGbPrint(u8* data, int len, int pages, int feed, int pal, int cont)
if (gopts.print_screen_cap)
{
- wxFileName fn;
-
- if (!gopts.scrshot_dir.size())
- fn = wxFileName(panel->game_dir(), wxEmptyString);
- else
- {
- fn = wxFileName(gopts.scrshot_dir, wxEmptyString);
-
- if (!fn.IsAbsolute())
- fn = wxFileName(panel->game_dir() + wxT('/') +
- gopts.scrshot_dir, wxEmptyString);
- }
-
+ wxFileName fn = wxFileName(wxGetApp().frame->GetGamePath(gopts.scrshot_dir), wxEmptyString);
int num = 1;
do
@@ -1130,16 +1107,19 @@ void systemGbPrint(u8* data, int len, int pages, int feed, int pal, int cont)
void systemScreenMessage(const wxString &msg)
{
- wxPuts(msg);
- MainFrame* f = wxGetApp().frame;
- GameArea* panel = f->GetPanel();
+ if (wxGetApp().frame && wxGetApp().frame->IsShown())
+ {
+ wxPuts(msg);
+ MainFrame* f = wxGetApp().frame;
+ GameArea* panel = f->GetPanel();
- if (!panel->osdtext.empty())
- f->PopStatusText();
+ if (!panel->osdtext.empty())
+ f->PopStatusText();
- f->PushStatusText(msg);
- panel->osdtext = msg;
- panel->osdtime = systemGetClock();
+ f->PushStatusText(msg);
+ panel->osdtext = msg;
+ panel->osdtime = systemGetClock();
+ }
}
void systemScreenMessage(const char* msg)
@@ -1403,21 +1383,7 @@ bool debugWaitSocket()
void log(const char* defaultMsg, ...)
{
static FILE* out = NULL;
-
- if (out == NULL)
- {
- // FIXME: this should be an option
- wxFileName trace_log(wxStandardPaths::Get().GetUserLocalDataDir(), wxT("trace.log"));
- out = fopen(trace_log.GetFullPath().mb_str(), "w");
-
- if (!out)
- return;
- }
-
va_list valist;
- va_start(valist, defaultMsg);
- vfprintf(out, defaultMsg, valist);
- va_end(valist);
char buf[2048];
va_start(valist, defaultMsg);
vsnprintf(buf, 2048, defaultMsg, valist);
@@ -1428,7 +1394,25 @@ void log(const char* defaultMsg, ...)
{
LogDialog* d = wxGetApp().frame->logdlg;
- if (d)
+ if (d && d->IsShown())
+ {
d->Update();
+ }
+
+ systemScreenMessage(buf);
}
+
+ if (out == NULL)
+ {
+ // FIXME: this should be an option
+ wxFileName trace_log(wxGetApp().GetConfigurationPath(), wxT("trace.log"));
+ out = fopen(trace_log.GetFullPath().mb_str(), "w");
+
+ if (!out)
+ return;
+ }
+
+ va_start(valist, defaultMsg);
+ vfprintf(out, defaultMsg, valist);
+ va_end(valist);
}
diff --git a/src/wx/viewsupt.cpp b/src/wx/viewsupt.cpp
index 1a6ecf47..ada650e2 100644
--- a/src/wx/viewsupt.cpp
+++ b/src/wx/viewsupt.cpp
@@ -1212,20 +1212,7 @@ void GfxViewer::StretchTog(wxCommandEvent &ev)
void GfxViewer::SaveBMP(wxCommandEvent &ev)
{
GameArea* panel = wxGetApp().frame->GetPanel();
-
- if (bmp_save_dir.empty())
- {
- bmp_save_dir = gopts.scrshot_dir;
-
- if (bmp_save_dir.size())
- {
- wxFileName sp(bmp_save_dir, wxEmptyString);
-
- if (!sp.IsAbsolute())
- bmp_save_dir = panel->game_dir() + wxT('/') + gopts.scrshot_dir;
- }
- }
-
+ bmp_save_dir = wxGetApp().frame->GetGamePath(gopts.scrshot_dir);
// no attempt is made here to translate the dialog type name
// it's just a suggested name, anyway
wxString def_name = panel->game_name() + wxT('-') + dname;
diff --git a/src/wx/wxvbam.cpp b/src/wx/wxvbam.cpp
index f2a9907e..170b2dbd 100644
--- a/src/wx/wxvbam.cpp
+++ b/src/wx/wxvbam.cpp
@@ -40,13 +40,13 @@ static void get_config_path(wxPathList &path, bool exists = true)
path.Add(s); \
} while(0)
// NOTE: this does not support XDG (freedesktop.org) paths
+ add_path(GetPluginsDir());
add_path(GetUserLocalDataDir());
add_path(GetUserDataDir());
add_path(GetLocalizedResourcesDir(wxGetApp().locale.GetCanonicalName()));
add_path(GetResourcesDir());
add_path(GetDataDir());
add_path(GetLocalDataDir());
- add_path(GetPluginsDir());
}
static void tack_full_path(wxString &s, const wxString &app = wxEmptyString)
@@ -59,6 +59,47 @@ static void tack_full_path(wxString &s, const wxString &app = wxEmptyString)
s += wxT("\n\t") + full_config_path[i] + app;
}
+wxString wxvbamApp::GetConfigurationPath()
+{
+ if (data_path.empty())
+ {
+ get_config_path(config_path);
+
+ for (int i = 0; i < config_path.size(); i++)
+ {
+ wxFileName fn(config_path[i], wxT("vbam.ini"));
+
+ if (fn.FileExists() && fn.IsFileWritable())
+ {
+ data_path = config_path[i];
+ break;
+ }
+ // Check if path is writeable
+ else if (wxIsWritable(config_path[i]))
+ {
+ data_path = config_path[i];
+ break;
+ }
+ }
+ }
+
+ return data_path;
+}
+
+wxString wxvbamApp::GetAbsolutePath(wxString path)
+{
+ wxFileName dir(path);
+
+ if (dir.IsRelative())
+ {
+ wxFileName fn(GetConfigurationPath(), path);
+ fn.Normalize();
+ return fn.GetFullPath();
+ }
+
+ return path;
+}
+
bool wxvbamApp::OnInit()
{
// use consistent names for config
@@ -103,9 +144,9 @@ bool wxvbamApp::OnInit()
xr->Load(wxT("*.xrs"));
}
- wxString xrcDir = wxStandardPaths::Get().GetPluginsDir() + wxT("\\xrc");
+ wxFileName xrcDir(GetConfigurationPath() + wxT("//xrc"), wxEmptyString);
- if (wxDirExists(xrcDir) && wxSetWorkingDirectory(xrcDir) && !wxFindFirstFile(wxT("*.xrc")).empty())
+ if (xrcDir.DirExists() && wxSetWorkingDirectory(xrcDir.GetFullPath()) && !wxFindFirstFile(wxT("*.xrc")).empty())
{
xr->Load(wxT("*.xrc"));
}
@@ -121,8 +162,9 @@ bool wxvbamApp::OnInit()
// but subdir flag behaves differently 2.8 vs. 2.9. Oh well.
// NOTE: this does not support XDG (freedesktop.org) paths
#ifdef __WXMSW__
+ wxFileName vbamconf(GetConfigurationPath(), _T("vbam.ini"));
cfg = new wxFileConfig(wxT("vbam"), wxEmptyString,
- wxStandardPaths::Get().GetPluginsDir() + _T("\\vbam.ini"),
+ vbamconf.GetFullPath(),
wxEmptyString, wxCONFIG_USE_LOCAL_FILE);
#else
cfg = new wxFileConfig(wxEmptyString, wxEmptyString, wxEmptyString,
@@ -139,9 +181,9 @@ bool wxvbamApp::OnInit()
// logic, so do it at run-time
// wxFileConfig *f = wxDynamicCast(cfg, wxFileConfig);
// wxConfigBase does not derive from wxObject!!! so no wxDynamicCast
- wxFileConfig* f = dynamic_cast(cfg);
+ wxFileConfig* fc = dynamic_cast(cfg);
- if (f)
+ if (fc)
{
wxFileName s(wxFileConfig::GetLocalFileName(GetAppName()));
// at least up to 2.8.12, GetLocalFileName returns the dir if
@@ -153,7 +195,7 @@ bool wxvbamApp::OnInit()
// only the path part gets created
// note that 0777 is default (assumes umask will do og-w)
s.Mkdir(0777, wxPATH_MKDIR_FULL);
- s = wxStandardPaths::Get().GetUserLocalDataDir();
+ s = GetConfigurationPath();
s.AppendDir(s.GetFullName());
s.Mkdir(0777, wxPATH_MKDIR_FULL);
}
@@ -201,41 +243,37 @@ bool wxvbamApp::OnInit()
overrides->Write(s + wxT("/comment"), cmt);
}
- for (int i = config_path.size() - 1; i >= 0 ; i--)
+ wxFileName fn(GetConfigurationPath(), wxT("vba-over.ini"));
+ wxFileName rdb(GetConfigurationPath(), wxT("Nintendo - Game Boy Advance*.dat"));
+ wxFileName scene_rdb(GetConfigurationPath(), wxT("Nintendo - Game Boy Advance (Scene)*.dat"));
+ wxFileName nointro_rdb(GetConfigurationPath(), wxT("Official No-Intro Nintendo Gameboy Advance Number (Date).xml"));
+ wxString f = wxFindFirstFile(nointro_rdb.GetFullPath(), wxFILE);
+
+ if (!f.empty() && wxFileName(f).IsFileReadable())
+ rom_database_nointro = f;
+
+ f = wxFindFirstFile(scene_rdb.GetFullPath(), wxFILE);
+
+ if (!f.empty() && wxFileName(f).IsFileReadable())
+ rom_database_scene = f;
+
+ f = wxFindFirstFile(rdb.GetFullPath(), wxFILE);
+
+ while (!f.empty())
{
- wxFileName fn(config_path[i], wxT("vba-over.ini"));
- wxFileName rdb(config_path[i], wxT("Nintendo - Game Boy Advance*.dat"));
- wxFileName scene_rdb(config_path[i], wxT("Nintendo - Game Boy Advance (Scene)*.dat"));
- wxFileName nointro_rdb(config_path[i], wxT("Official No-Intro Nintendo Gameboy Advance Number (Date).xml"));
- wxString f = wxFindFirstFile(nointro_rdb.GetFullPath(), wxFILE);
-
- if (!f.empty() && wxFileName(f).IsFileReadable())
- rom_database_nointro = f;
-
- f = wxFindFirstFile(scene_rdb.GetFullPath(), wxFILE);
-
- if (!f.empty() && wxFileName(f).IsFileReadable())
- rom_database_scene = f;
-
- f = wxFindFirstFile(rdb.GetFullPath(), wxFILE);
-
- while (!f.empty())
+ if (f == rom_database_scene.GetFullPath())
{
- if (f == rom_database_scene.GetFullPath())
- {
- f = wxFindNextFile();
- }
- else if (wxFileName(f).IsFileReadable())
- {
- rom_database = f;
- break;
- }
+ f = wxFindNextFile();
}
+ else if (wxFileName(f).IsFileReadable())
+ {
+ rom_database = f;
+ break;
+ }
+ }
- if (!fn.IsFileReadable())
- continue;
-
- data_path = config_path[i];
+ if (fn.FileExists())
+ {
wxStringOutputStream sos;
wxFileInputStream fis(fn.GetFullPath());
// not the most efficient thing to do: read entire file into a string
@@ -252,7 +290,7 @@ bool wxvbamApp::OnInit()
overrides->DeleteGroup(s);
overrides->SetPath(s);
ov.SetPath(s);
- overrides->Write(wxT("path"), config_path[i]);
+ overrides->Write(wxT("path"), GetConfigurationPath());
// apparently even MacOSX sometimes uses \r by itself
wxString cmt(CMT_RE_START);
cmt += s + wxT("\\]");
@@ -623,6 +661,29 @@ void MainFrame::DownloadFile(wxString host, wxString url)
get.Close();
}
+wxString MainFrame::GetGamePath(wxString path)
+{
+ wxString game_path = path;
+
+ if (game_path.size())
+ {
+ game_path = wxGetApp().GetAbsolutePath(game_path);
+ }
+ else
+ {
+ game_path = panel->game_dir();
+ wxFileName::Mkdir(game_path, 0777, wxPATH_MKDIR_FULL);
+ }
+
+ if (!wxFileName::DirExists(game_path))
+ game_path = wxFileName::GetCwd();
+
+ if (!wxIsWritable(game_path))
+ game_path = wxGetApp().GetConfigurationPath();
+
+ return game_path;
+}
+
void MainFrame::SetJoystick()
{
bool anyjoy = false;
diff --git a/src/wx/wxvbam.h b/src/wx/wxvbam.h
index 6b0e9556..27132fd9 100644
--- a/src/wx/wxvbam.h
+++ b/src/wx/wxvbam.h
@@ -60,6 +60,8 @@ public:
virtual bool OnInit();
virtual void OnInitCmdLine(wxCmdLineParser &);
virtual bool OnCmdLineParsed(wxCmdLineParser &);
+ wxString GetConfigurationPath();
+ wxString GetAbsolutePath(wxString path);
// name of a file to load at earliest opportunity
wxString pending_load;
// list of options to set after config file loaded
@@ -192,6 +194,8 @@ public:
GameArea* GetPanel() { return panel; }
+ wxString GetGamePath(wxString path);
+
// wxMSW pauses the game for menu popups and modal dialogs, but wxGTK
// does not. It's probably desirable to pause the game. To do this for
// dialogs, use this function instead of dlg->ShowModal()
diff --git a/src/wx/wxvbam.rc b/src/wx/wxvbam.rc
index e7128ad2..dd5c7002 100644
--- a/src/wx/wxvbam.rc
+++ b/src/wx/wxvbam.rc
@@ -8,8 +8,8 @@ IDI_MAINICON ICON "../win32/res/VBA.ico"
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,8,0,0
- PRODUCTVERSION 1,8,0,0
+ FILEVERSION 2,0,0,0
+ PRODUCTVERSION 2,0,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -27,12 +27,12 @@ BEGIN
VALUE "Comments", "VBA-M comes with NO WARRANTY. Use it at your own risk."
VALUE "CompanyName", "http://vba-m.com/"
VALUE "FileDescription", "VisualBoyAdvance-M"
- VALUE "FileVersion", "1, 8, 0, 0"
+ VALUE "FileVersion", "2, 0, 0, 0"
VALUE "InternalName", "VBA-M"
VALUE "LegalCopyright", "Copyright © 2008-2015 VBA-M development team"
VALUE "OriginalFilename", "VisualBoyAdvance-M.exe"
- VALUE "ProductName", "GB/C/A emulator for Windows"
- VALUE "ProductVersion", "1, 8, 0, 0"
+ VALUE "ProductName", "VisualBoyAdvance-M"
+ VALUE "ProductVersion", "2, 0, 0, 0"
END
END
BLOCK "VarFileInfo"