Skip to content

Commit

Permalink
open disc to behave like open DVD (#2930)
Browse files Browse the repository at this point in the history
  • Loading branch information
adipose authored Jul 18, 2024
1 parent 5ee5779 commit 1ac2b13
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
49 changes: 28 additions & 21 deletions src/mpc-hc/MainFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4968,6 +4968,20 @@ int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData)
return 0;
}

void CMainFrame::OpenDVDOrBD(CStringW path) {
if (!path.IsEmpty()) {
AfxGetAppSettings().strDVDPath = path;
if (!OpenBD(path)) {
CAutoPtr<OpenDVDData> p(DEBUG_NEW OpenDVDData());
p->path = path;
p->path.Replace(_T('/'), _T('\\'));
p->path = ForceTrailingSlash(p->path);

OpenMedia(p);
}
}
}

void CMainFrame::OnFileOpendvd()
{
if ((GetLoadState() == MLS::LOADING) || IsD3DFullScreenMode()) {
Expand All @@ -4993,18 +5007,7 @@ void CMainFrame::OnFileOpendvd()
return;
}
}

if (!path.IsEmpty()) {
s.strDVDPath = path;
if (!OpenBD(path)) {
CAutoPtr<OpenDVDData> p(DEBUG_NEW OpenDVDData());
p->path = path;
p->path.Replace(_T('/'), _T('\\'));
p->path = ForceTrailingSlash(p->path);

OpenMedia(p);
}
}
OpenDVDOrBD(path);
}

void CMainFrame::OnFileOpendevice()
Expand Down Expand Up @@ -5040,7 +5043,8 @@ void CMainFrame::OnFileOpenOpticalDisk(UINT nID)
for (TCHAR drive = _T('A'); drive <= _T('Z'); drive++) {
CAtlList<CString> sl;

switch (GetOpticalDiskType(drive, sl)) {
OpticalDiskType_t discType = GetOpticalDiskType(drive, sl);
switch (discType) {
case OpticalDisk_Audio:
case OpticalDisk_VideoCD:
case OpticalDisk_DVDVideo:
Expand All @@ -5052,16 +5056,19 @@ void CMainFrame::OnFileOpenOpticalDisk(UINT nID)
}

if (nID == 0) {
SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
SetForegroundWindow();

if (IsIconic()) {
ShowWindow(SW_RESTORE);
}
if (OpticalDisk_BD == discType || OpticalDisk_DVDVideo == discType) {
OpenDVDOrBD(CStringW(drive) + L":\\");
} else {
SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
SetForegroundWindow();

m_wndPlaylistBar.Open(sl, true);
OpenCurPlaylistItem();
if (IsIconic()) {
ShowWindow(SW_RESTORE);
}

m_wndPlaylistBar.Open(sl, true);
OpenCurPlaylistItem();
}
break;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/mpc-hc/MainFrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,7 @@ class CMainFrame : public CFrameWnd, public CDropClient
// menu item handlers

INT_PTR DoFileDialogWithLastFolder(CFileDialog& fd, CStringW& lastPath);
void OpenDVDOrBD(CStringW path);

afx_msg void OnFileOpenQuick();
afx_msg void OnFileOpenmedia();
Expand Down

0 comments on commit 1ac2b13

Please sign in to comment.