diff --git a/Source/Core/Core/Src/HW/DVDInterface.cpp b/Source/Core/Core/Src/HW/DVDInterface.cpp index b97d5005ad..4da275e4a8 100644 --- a/Source/Core/Core/Src/HW/DVDInterface.cpp +++ b/Source/Core/Core/Src/HW/DVDInterface.cpp @@ -27,6 +27,7 @@ #include "Thread.h" #include "../VolumeHandler.h" +#include "VolumeCreator.h" // DiscIO namespace DVDInterface { @@ -220,7 +221,21 @@ void SetDiscInside(bool _DiscInside) { g_bDiscInside = _DiscInside; } - +void SwapDisc(const char * fileName) +{ + dvdMem.CoverReg.CVRINT = 1; + dvdMem.CoverReg.CVRINTMASK = 1; + dvdMem.CoverReg.CVR = 1; + UpdateInterrupts(); + // I don't think this is needed, but I am not certain + //DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename("F:/Documents/Games/GameCube/GCM/Super Monkey Ball 2.gcm"); + VolumeHandler::SetVolumeName(fileName); + DVDInterface::SetDiscInside(VolumeHandler::IsValid()); + dvdMem.CoverReg.CVRINT = 0; + dvdMem.CoverReg.CVRINTMASK = 0; + dvdMem.CoverReg.CVR = 0; + UpdateInterrupts(); +} void SetLidOpen(bool _bOpen) { if (_bOpen) diff --git a/Source/Core/Core/Src/HW/DVDInterface.h b/Source/Core/Core/Src/HW/DVDInterface.h index 3fcc9cb805..5f6574d09f 100644 --- a/Source/Core/Core/Src/HW/DVDInterface.h +++ b/Source/Core/Core/Src/HW/DVDInterface.h @@ -29,6 +29,7 @@ void Shutdown(); void DoState(PointerWrap &p); void SetDiscInside(bool _DiscInside); +void SwapDisc(const char * fileName); // Lid Functions void SetLidOpen(bool open); diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 08e03d976e..f9289f7420 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -98,6 +98,7 @@ EVT_MENU(IDM_CONFIG_WIIMOTE_PLUGIN, CFrame::OnPluginWiimote) EVT_MENU(IDM_BROWSE, CFrame::OnBrowse) EVT_MENU(IDM_MEMCARD, CFrame::OnMemcard) EVT_MENU(IDM_CHEATS, CFrame::OnShow_CheatsWindow) +EVT_MENU(IDM_SWAPDISC, CFrame::OnSwapDisc) EVT_MENU(IDM_TOGGLECOVER, CFrame::OnSwapDisc) EVT_MENU(IDM_TOGGLE_FULLSCREEN, CFrame::OnToggleFullscreen) EVT_MENU(IDM_TOGGLE_DUALCORE, CFrame::OnToggleDualCore) @@ -250,7 +251,8 @@ void CFrame::CreateMenu() miscMenu->AppendSeparator(); miscMenu->Append(IDM_MEMCARD, _T("&Memcard manager")); miscMenu->Append(IDM_CHEATS, _T("Action &Replay Manager")); - miscMenu->Append(IDM_TOGGLECOVER, _T("Toggle DVD co&ver is open")); + miscMenu->Append(IDM_SWAPDISC, _T("S&wap Disc")); + //miscMenu->Append(IDM_TOGGLECOVER, _T("Toggle DVD co&ver is open")); m_pMenuBar->Append(miscMenu, _T("&Misc")); // help menu @@ -681,7 +683,27 @@ void CFrame::UpdateGUI() } } -void CFrame::OnSwapDisc(wxCommandEvent& WXUNUSED (event)) +void CFrame::OnSwapDisc(wxCommandEvent& event) { - SetLidOpen(!IsLidOpen()); -} \ No newline at end of file + switch (event.GetId()) + { + case IDM_SWAPDISC: + { + wxString path = wxFileSelector( + _T("Select the Disc to swap"), + wxEmptyString, wxEmptyString, wxEmptyString, + wxString::Format + ( + _T("All GC/Wii files (elf, dol, gcm, iso)|*.elf;*.dol;*.gcm;*.iso;*.gcz|All files (%s)|%s"), + wxFileSelectorDefaultWildcardStr, + wxFileSelectorDefaultWildcardStr + ), + wxFD_OPEN | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST, + this); + SwapDisc(path.c_str()); + break; + } + default: + SetLidOpen(!IsLidOpen()); + } +} diff --git a/Source/Core/DolphinWX/Src/Globals.h b/Source/Core/DolphinWX/Src/Globals.h index bc3dc0be03..f68133bd15 100644 --- a/Source/Core/DolphinWX/Src/Globals.h +++ b/Source/Core/DolphinWX/Src/Globals.h @@ -48,6 +48,7 @@ enum IDM_BROWSE, IDM_MEMCARD, IDM_CHEATS, + IDM_SWAPDISC, IDM_TOGGLECOVER, IDM_PROPERTIES, IDM_OPENCONTAININGFOLDER, diff --git a/Source/Core/DolphinWX/Src/MemcardManager.cpp b/Source/Core/DolphinWX/Src/MemcardManager.cpp index 12659a3708..008fc0ec7d 100644 --- a/Source/Core/DolphinWX/Src/MemcardManager.cpp +++ b/Source/Core/DolphinWX/Src/MemcardManager.cpp @@ -283,7 +283,7 @@ void CMemcardManager::CreateGUIControls() if (strcasecmp(DefaultMemcard[i].c_str(), ".")) { m_MemcardPath[i]->SetPath(wxString::FromAscii(DefaultMemcard[i].c_str())); - i?ChangePath(ID_MEMCARDPATH_B):ChangePath(ID_MEMCARDPATH_A); + ChangePath(ID_MEMCARDPATH_A + i); } } } @@ -585,7 +585,7 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event) } break; case ID_DELETE_A: - slot=SLOT_A; + slot = SLOT_A; index = index_A; case ID_DELETE_B: if (index != wxNOT_FOUND)