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
This commit is contained in:
Glenn Rice 2010-07-08 23:27:51 +00:00
parent 543bb3ae4c
commit 07973f726e
8 changed files with 26 additions and 12 deletions

View File

@ -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

View File

@ -168,6 +168,8 @@ class CCodeWindow
wxMenuItem* jitpoff;
wxMenuItem* jitsroff;
std::string fontDesc;
CCodeView* codeview;
wxListBox* callstack;
wxListBox* symbols;

View File

@ -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());
}
}

View File

@ -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)

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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

View File

@ -34,6 +34,8 @@ private:
DECLARE_EVENT_TABLE()
wxTimer *m_afterinit;
bool LoadFile;
wxString FileToLoad;
void AfterInit(wxTimerEvent& WXUNUSED(event));
};