summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/Frame.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2014-06-20 20:59:07 -0400
committerLioncash <mathew1800@gmail.com>2014-06-24 16:43:02 -0400
commit10dc1ef135f28b87f759533f94ac52756ed437e0 (patch)
treedd9039babe509e4ec96fcdb3baccfa8dabe2b97f /Source/Core/DolphinWX/Frame.cpp
parent832d0bbdb94472917b111c06b7e54a47f4be4fcf (diff)
Fix crashes when dragging and dropping files outside of the gamelist
Diffstat (limited to 'Source/Core/DolphinWX/Frame.cpp')
-rw-r--r--Source/Core/DolphinWX/Frame.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp
index 442ab2064f..73cf99a3c9 100644
--- a/Source/Core/DolphinWX/Frame.cpp
+++ b/Source/Core/DolphinWX/Frame.cpp
@@ -21,6 +21,7 @@
#include <wx/chartype.h>
#include <wx/defs.h>
#include <wx/event.h>
+#include <wx/filename.h>
#include <wx/frame.h>
#include <wx/gdicmn.h>
#include <wx/icon.h>
@@ -53,6 +54,7 @@
#include "Core/CoreParameter.h"
#include "Core/Movie.h"
#include "Core/State.h"
+#include "Core/HW/DVDInterface.h"
#include "DolphinWX/Frame.h"
#include "DolphinWX/GameListCtrl.h"
@@ -146,10 +148,34 @@ void CRenderFrame::OnDropFiles(wxDropFilesEvent& event)
{
if (event.GetNumberOfFiles() != 1)
return;
- if (File::IsDirectory(event.GetFiles()[0].ToStdString()))
+ if (File::IsDirectory(WxStrToStr(event.GetFiles()[0])))
return;
- State::LoadAs(event.GetFiles()[0].ToStdString());
+ wxFileName file = event.GetFiles()[0];
+
+ if (file.GetExt() == "dtm")
+ {
+ if (Core::IsRunning())
+ return;
+
+ if (!Movie::IsReadOnly())
+ {
+ // let's make the read-only flag consistent at the start of a movie.
+ Movie::SetReadOnly(true);
+ main_frame->GetMenuBar()->FindItem(IDM_RECORDREADONLY)->Check(true);
+ }
+
+ if (Movie::PlayInput(WxStrToStr(file.GetFullPath())))
+ main_frame->BootGame("");
+ }
+ else if (!Core::IsRunning())
+ {
+ main_frame->BootGame(WxStrToStr(file.GetFullPath()));
+ }
+ else
+ {
+ DVDInterface::ChangeDisc(WxStrToStr(file.GetFullPath()));
+ }
}
#ifdef _WIN32