From 07973f726ee1a7e1b6504e7a18e6d0de0c006ee4 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Thu, 8 Jul 2010 23:27:51 +0000 Subject: [PATCH] Fix a segfault when the debugger is used and dolphin exits. Put the filename back into the "Saving settings ..." notice log (soren don't remove this again.) Added a "batch" mode command line option. Now dolphin will not exit with the emulator if a file is run from the command line unless you also use the "batch" option. For example in linux "dolphin-emu -b -e filename". git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5859 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/ConfigManager.cpp | 2 +- Source/Core/DebuggerWX/Src/CodeWindow.h | 2 ++ Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp | 6 ++++-- Source/Core/DolphinWX/Src/Frame.cpp | 5 +++-- Source/Core/DolphinWX/Src/Frame.h | 2 ++ Source/Core/DolphinWX/Src/FrameTools.cpp | 6 ++---- Source/Core/DolphinWX/Src/Main.cpp | 13 ++++++++++--- Source/Core/DolphinWX/Src/Main.h | 2 ++ 8 files changed, 26 insertions(+), 12 deletions(-) diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index 80aadbb480..f63b0aad1a 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -68,7 +68,7 @@ SConfig::~SConfig() void SConfig::SaveSettings() { - NOTICE_LOG(BOOT, "Saving settings"); + NOTICE_LOG(BOOT, "Saving settings to %s", File::GetUserPath(F_DOLPHINCONFIG_IDX)); IniFile ini; ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); // load first to not kill unknown stuff diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.h b/Source/Core/DebuggerWX/Src/CodeWindow.h index 11c79256e9..62834528a8 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindow.h +++ b/Source/Core/DebuggerWX/Src/CodeWindow.h @@ -168,6 +168,8 @@ class CCodeWindow wxMenuItem* jitpoff; wxMenuItem* jitsroff; + std::string fontDesc; + CCodeView* codeview; wxListBox* callstack; wxListBox* symbols; diff --git a/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp b/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp index f8c1310aee..29e3d87554 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp +++ b/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp @@ -87,7 +87,6 @@ void CCodeWindow::Load() ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX)); // The font to override DebuggerFont with - std::string fontDesc; ini.Get("ShowOnStart", "DebuggerFont", &fontDesc); if (!fontDesc.empty()) DebuggerFont.SetNativeFontInfoUserDesc(wxString::FromAscii(fontDesc.c_str())); @@ -135,7 +134,7 @@ void CCodeWindow::Save() IniFile ini; ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX)); - ini.Set("ShowOnStart", "DebuggerFont", std::string(DebuggerFont.GetNativeFontInfoUserDesc().mb_str())); + ini.Set("ShowOnStart", "DebuggerFont", fontDesc); // Boot to pause or not ini.Set("ShowOnStart", "AutomaticStart", GetMenuBar()->IsChecked(IDM_AUTOMATICSTART)); @@ -427,7 +426,10 @@ void CCodeWindow::OnChangeFont(wxCommandEvent& event) wxFontDialog dialog(this, data); if ( dialog.ShowModal() == wxID_OK ) + { DebuggerFont = dialog.GetFontData().GetChosenFont(); + fontDesc = std::string(DebuggerFont.GetNativeFontInfoUserDesc().mb_str()); + } } diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 69d1ae6369..d1d9db6004 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -342,6 +342,7 @@ CFrame::CFrame(wxFrame* parent, const wxPoint& pos, const wxSize& size, bool _UseDebugger, + bool _BatchMode, bool ShowLogWindow, long style) : CRenderFrame(parent, id, title, pos, size, style) @@ -352,8 +353,8 @@ CFrame::CFrame(wxFrame* parent, , bFloatLogWindow(false), bFloatConsoleWindow(false) , m_pStatusBar(NULL), m_GameListCtrl(NULL), m_Panel(NULL) , m_RenderFrame(NULL), m_RenderParent(NULL) - , m_LogWindow(NULL) - , UseDebugger(_UseDebugger), m_bEdit(false), m_bTabSplit(false), m_bNoDocking(false) + , m_LogWindow(NULL), UseDebugger(_UseDebugger) + , m_bBatchMode(_BatchMode), m_bEdit(false), m_bTabSplit(false), m_bNoDocking(false) , m_bControlsCreated(false), m_bGameLoading(false), m_StopDlg(NULL) #if wxUSE_TIMER , m_timer(this) diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index d01c4b812b..a1eee4e294 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -95,6 +95,7 @@ class CFrame : public CRenderFrame const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, bool _UseDebugger = false, + bool _BatchMode = false, bool ShowLogWindow = false, long style = wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE); @@ -233,6 +234,7 @@ class CFrame : public CRenderFrame wxToolBarToolBase* m_ToolPlay; CLogWindow* m_LogWindow; bool UseDebugger; + bool m_bBatchMode; bool m_bEdit; bool m_bTabSplit; bool m_bNoDocking; diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 74fb924d41..6297eb3855 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -904,10 +904,8 @@ void CFrame::DoStop() // Clean framerate indications from the status bar. m_pStatusBar->SetStatusText(wxT(" "), 0); - extern bool LoadFile; - - // If an executable was specified on the command-line, exit now. - if (LoadFile) + // If batch mode was specified on the command-line, exit now. + if (m_bBatchMode) Close(true); } } diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index abf2ec3533..e4b6d917ab 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -55,8 +55,6 @@ END_EVENT_TABLE() bool wxMsgAlert(const char*, const char*, bool, int); CFrame* main_frame = NULL; -bool LoadFile = false; -static wxString FileToLoad; #ifdef WIN32 //Has no error handling. @@ -92,6 +90,7 @@ bool DolphinApp::OnInit() { // Declarations and definitions bool UseDebugger = false; + bool BatchMode = false; bool UseLogger = false; bool selectVideoPlugin = false; bool selectAudioPlugin = false; @@ -119,6 +118,9 @@ bool DolphinApp::OnInit() wxCMD_LINE_OPTION, "e", "exec", "Loads the specified file (DOL, ELF, WAD, GCM, ISO)", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, + { + wxCMD_LINE_SWITCH, "b", "batch", "Exit Dolphin with emulator" + }, { wxCMD_LINE_OPTION, "V", "video_plugin","Specify a video plugin", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL @@ -153,6 +155,9 @@ bool DolphinApp::OnInit() wxCMD_LINE_OPTION, _("e"), _("exec"), wxT("Loads the specified file (DOL, ELF, WAD, GCM, ISO)"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, + { + wxCMD_LINE_SWITCH, _("b"), _("batch"), wxT("Exit Dolphin with emulator") + }, { wxCMD_LINE_OPTION, _("V"), _("video_plugin"), wxT("Specify a video plugin"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL @@ -181,10 +186,12 @@ bool DolphinApp::OnInit() UseDebugger = parser.Found("debugger"); UseLogger = parser.Found("logger"); LoadFile = parser.Found("exec", &FileToLoad); + BatchMode = parser.Found("batch"); #else UseDebugger = parser.Found(wxT("debugger")); UseLogger = parser.Found(wxT("logger")); LoadFile = parser.Found(wxT("exec"), &FileToLoad); + BatchMode = parser.Found(wxT("batch")); #endif #if wxCHECK_VERSION(2, 9, 0) @@ -368,7 +375,7 @@ bool DolphinApp::OnInit() main_frame = new CFrame((wxFrame*)NULL, wxID_ANY, wxString::FromAscii(svn_rev_str), wxPoint(x, y), wxSize(w, h), - UseDebugger, UseLogger); + UseDebugger, BatchMode, UseLogger); SetTopWindow(main_frame); #if defined HAVE_X11 && HAVE_X11 diff --git a/Source/Core/DolphinWX/Src/Main.h b/Source/Core/DolphinWX/Src/Main.h index 2d51c6a863..d5458303fb 100644 --- a/Source/Core/DolphinWX/Src/Main.h +++ b/Source/Core/DolphinWX/Src/Main.h @@ -34,6 +34,8 @@ private: DECLARE_EVENT_TABLE() wxTimer *m_afterinit; + bool LoadFile; + wxString FileToLoad; void AfterInit(wxTimerEvent& WXUNUSED(event)); };