Change Disc functionality:

* Fixed the "Change disc..." command.  The filename of the disc was being lost between functions.
* Split the ChangeDisc function into two functions: EjectDisc and InsertDisc
* Moved the "Change disc..." command to the File menu.
* Removed some log messages that caused the debug build to crash when loaded with release build plug-ins.

Fixes issue 3036.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6206 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
skidau 2010-09-15 12:30:56 +00:00
parent 73adab0ce1
commit a3b59f6845
5 changed files with 30 additions and 42 deletions

View File

@ -122,7 +122,6 @@ bool Initialize()
return false;
}
NOTICE_LOG(COMMON, "Initialized OpenCL!");
g_bInitialized = true;
return true;
#else

View File

@ -208,8 +208,10 @@ static unsigned char media_buffer[0x40];
// (both requests can happen at the same time, audio takes precedence)
Common::CriticalSection dvdread_section;
static int changeDisc;
void ChangeDiscCallback(u64 userdata, int cyclesLate);
static int ejectDisc;
void EjectDiscCallback(u64 userdata, int cyclesLate);
static int insertDisc;
void InsertDiscCallback(u64 userdata, int cyclesLate);
void UpdateInterrupts();
void GenerateDIInterrupt(DI_InterruptType _DVDInterrupt);
@ -253,7 +255,8 @@ void Init()
AudioPos = 0;
AudioLength = 0;
changeDisc = CoreTiming::RegisterEvent("ChangeDisc", ChangeDiscCallback);
ejectDisc = CoreTiming::RegisterEvent("EjectDisc", EjectDiscCallback);
insertDisc = CoreTiming::RegisterEvent("InsertDisc", InsertDiscCallback);
}
void Shutdown()
@ -274,44 +277,35 @@ bool IsDiscInside()
// We want this in the "backend", NOT the gui
// any !empty string will be deleted to ensure
// that the userdata string exists when called
void ChangeDiscCallback(u64 userdata, int cyclesLate)
void EjectDiscCallback(u64 userdata, int cyclesLate)
{
std::string FileName((const char*)userdata);
// Empty the drive
SetDiscInside(false);
SetLidOpen();
std::string& SavedFileName = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strFilename;
if (FileName.empty())
{
// Empty the drive
VolumeHandler::EjectVolume();
}
else
{
if (VolumeHandler::SetVolumeName(FileName))
{
// Save the new ISO file name
SavedFileName = FileName;
}
else
{
PanicAlert("Invalid file \n %s", FileName.c_str());
// Put back the old one
VolumeHandler::SetVolumeName(SavedFileName);
}
}
SetLidOpen(false);
SetDiscInside(VolumeHandler::IsValid());
VolumeHandler::EjectVolume();
}
void ChangeDisc(const char* _FileName)
void InsertDiscCallback(u64 userdata, int cyclesLate)
{
const char* NoDisc = "";
CoreTiming::ScheduleEvent_Threadsafe(0, changeDisc, (u64)NoDisc);
CoreTiming::ScheduleEvent_Threadsafe(500000000, changeDisc, (u64)_FileName);
std::string& SavedFileName = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strFilename;
std::string *_FileName = (std::string *)userdata;
if (!VolumeHandler::SetVolumeName(*_FileName))
{
// Put back the old one
VolumeHandler::SetVolumeName(SavedFileName);
PanicAlert("Invalid file");
}
SetLidOpen(false);
SetDiscInside(VolumeHandler::IsValid());
delete _FileName;
}
void ChangeDisc(const char* _newFileName)
{
std::string* _FileName = new std::string(_newFileName);
CoreTiming::ScheduleEvent_Threadsafe(0, ejectDisc);
CoreTiming::ScheduleEvent_Threadsafe(500000000, insertDisc, (u64)_FileName);
}
void SetLidOpen(bool _bOpen)

View File

@ -105,6 +105,7 @@ void CFrame::CreateMenu()
// file menu
wxMenu* fileMenu = new wxMenu;
fileMenu->Append(wxID_OPEN, _T("&Open...\tCtrl+O"));
fileMenu->Append(IDM_CHANGEDISC, _T("Change &Disc..."));
wxMenu *externalDrive = new wxMenu;
fileMenu->Append(IDM_DRIVES, _T("&Boot from DVD Drive..."), externalDrive);
@ -135,7 +136,6 @@ void CFrame::CreateMenu()
emulationMenu->Append(IDM_PLAYRECORD, _T("P&lay Recording..."));
emulationMenu->Append(IDM_RECORDEXPORT, _T("Export Recording..."));
emulationMenu->AppendSeparator();
emulationMenu->Append(IDM_CHANGEDISC, _T("Change &Disc"));
emulationMenu->Append(IDM_FRAMESTEP, _T("&Frame Stepping"), wxEmptyString, wxITEM_CHECK);

View File

@ -80,10 +80,6 @@ HRESULT Create(HWND wnd)
NOTICE_LOG(VIDEO, "Successfully loaded d3dx11_42.dll. If you're having trouble, try updating your DX runtime first.");
}
}
else
{
NOTICE_LOG(VIDEO, "Successfully loaded %s.", StringFromFormat("d3dx11_%d.dll", D3DX11_SDK_VERSION).c_str());
}
PD3DX11CompileFromMemory = (D3DX11COMPILEFROMMEMORYTYPE)GetProcAddress(hD3DXDll, "D3DX11CompileFromMemory");
if (PD3DX11CompileFromMemory == NULL) MessageBoxA(NULL, "GetProcAddress failed for D3DX11CompileFromMemory!", "Critical error", MB_OK | MB_ICONERROR);

View File

@ -265,7 +265,6 @@ HRESULT LoadD3DX9()
hD3DXDll = LoadLibraryA(StringFromFormat("d3dx9_%d.dll", D3DX_SDK_VERSION).c_str());
if (hD3DXDll != NULL)
{
NOTICE_LOG(VIDEO, "Successfully loaded %s.", StringFromFormat("d3dx9_%d.dll", D3DX_SDK_VERSION).c_str());
hr = S_OK;
}
else