From 4bf95e61f1af92b351323ac2e5ea1321a5a7b9f8 Mon Sep 17 00:00:00 2001 From: luigiblood Date: Tue, 26 Jan 2016 16:43:44 +0100 Subject: [PATCH] Open ROM/Drag&Drop Error fixed, delete g_DDRom if normal N64 ROM play --- Source/Project64/UserInterface/GuiClass.cpp | 9 ++++++++- Source/Project64/UserInterface/MainMenuClass.cpp | 9 ++++++++- Source/Project64/UserInterface/RomBrowserClass.cpp | 4 ++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Source/Project64/UserInterface/GuiClass.cpp b/Source/Project64/UserInterface/GuiClass.cpp index 288e03147..018d4d1c4 100644 --- a/Source/Project64/UserInterface/GuiClass.cpp +++ b/Source/Project64/UserInterface/GuiClass.cpp @@ -1142,7 +1142,14 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO DragQueryFile(hDrop, 0, filename, sizeof(filename)); DragFinish(hDrop); - if (!CN64System::RunFileImage(filename)) + stdstr ext = CPath(filename).GetExtension(); + if (!(_stricmp(ext.c_str(), "ndd") == 0)) + { + delete g_DDRom; + g_DDRom = NULL; + CN64System::RunFileImage(filename); + } + else { // Open Disk if (CN64System::RunDiskImage(filename)) diff --git a/Source/Project64/UserInterface/MainMenuClass.cpp b/Source/Project64/UserInterface/MainMenuClass.cpp index f4321443d..9cd63e182 100644 --- a/Source/Project64/UserInterface/MainMenuClass.cpp +++ b/Source/Project64/UserInterface/MainMenuClass.cpp @@ -119,7 +119,14 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI stdstr File = ChooseFileToOpen(hWnd); if (File.length() > 0) { - if (!g_BaseSystem->RunFileImage(File.c_str())) + stdstr ext = CPath(File).GetExtension(); + if (!(_stricmp(ext.c_str(), "ndd") == 0)) + { + delete g_DDRom; + g_DDRom = NULL; + g_BaseSystem->RunFileImage(File.c_str()); + } + else { // Open Disk if (g_BaseSystem->RunDiskImage(File.c_str())) diff --git a/Source/Project64/UserInterface/RomBrowserClass.cpp b/Source/Project64/UserInterface/RomBrowserClass.cpp index d01abf1d5..735072bdb 100644 --- a/Source/Project64/UserInterface/RomBrowserClass.cpp +++ b/Source/Project64/UserInterface/RomBrowserClass.cpp @@ -1472,6 +1472,10 @@ void CRomBrowser::RomList_OpenRom(uint32_t /*pnmh*/) if (!pRomInfo) { return; } m_StopRefresh = true; + + delete g_DDRom; + g_DDRom = NULL; + CN64System::RunFileImage(pRomInfo->szFullFileName); }