Beispiel #1
0
void CMainWindow::OnFileOpen()
{
	Framework::Win32::CFileDialog dialog;
	const TCHAR* filter =
	    _T("All Supported Files\0*.zip; *.rar; *.psf; *.minipsf; *.psf2; *.minipsf2; *.psfp; *.minipsfp;*") PLAYLIST_EXTENSION _T("\0") PLAYLIST_FILTER
	        ARCHIVE_FILTER
	            PSF_FILTER
	                PSF2_FILTER
	                    PSFP_FILTER;
	dialog.m_OFN.lpstrFilter = filter;
	if(dialog.SummonOpen(m_hWnd))
	{
		boost::filesystem::path filePath(dialog.GetPath());
		std::wstring fileExtension = filePath.extension().wstring();
		if(!wcsicmp(fileExtension.c_str(), PLAYLIST_EXTENSION))
		{
			LoadPlaylist(filePath);
		}
		else if(!wcsicmp(fileExtension.c_str(), L".rar") || !wcsicmp(fileExtension.c_str(), L".zip"))
		{
			LoadArchive(filePath);
		}
		else
		{
			LoadSingleFile(filePath);
		}
	}
}
Beispiel #2
0
void CMainWindow::RecordAvi()
{
	if(m_recordingAvi)
	{
		m_recordingAvi = false;

		while(1)
		{
			DWORD result = MsgWaitForMultipleObjects(1, &m_recordAviMutex, FALSE, INFINITE, QS_ALLINPUT);
			if(result == WAIT_OBJECT_0) break;
			MSG msg;
			GetMessage(&msg, NULL, 0, 0);
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
		
		{
			m_aviStream.Close();
			delete [] m_recordBuffer;
			m_recordBuffer = NULL;
			m_recordBufferWidth = 0;
			m_recordBufferHeight = 0;
		}
		ReleaseMutex(m_recordAviMutex);

		UpdateUI();
	}
	else
	{
		CScopedVmPauser vmPauser(m_virtualMachine);

		Framework::Win32::CFileDialog d;
		d.m_OFN.lpstrFilter = _T("AVI Movie Files (*.avi)\0*.avi\0All files (*.*)\0*.*\0");
		if(!d.SummonSave(m_hWnd))
		{
			return;
		}

		RECT rc = m_outputWnd->GetWindowRect();
		unsigned int nViewW = rc.right - rc.left;
		unsigned int nViewH = rc.bottom - rc.top;

		m_aviStream.SetSize(nViewW, nViewH);
		if(!m_aviStream.Open(m_hWnd, d.GetPath()))
		{
			MessageBox(m_hWnd, _T("Failed to start AVI recording."), APP_NAME, 16);
			return;
		}

		m_recordBufferWidth = nViewW;
		m_recordBufferHeight = nViewH;
		m_recordBuffer = new uint8[m_recordBufferWidth * m_recordBufferHeight * 4];

		m_recordingAvi = true;
		UpdateUI();
	}
}
Beispiel #3
0
void CCdromSelectionWnd::SelectImage()
{
	Framework::Win32::CFileDialog Dialog;

	Dialog.m_OFN.lpstrFilter = DISKIMAGE_FILTER;

	if(Dialog.SummonOpen(m_hWnd) != IDOK)
	{
		return;
	}

	std::string sPath(string_cast<std::string>(Dialog.GetPath()));
	m_sImagePath = sPath.c_str();
}
Beispiel #4
0
void CMainWindow::OpenELF()
{
	Framework::Win32::CFileDialog d;
	d.m_OFN.lpstrFilter = _T("ELF Executable Files (*.elf)\0*.elf\0All files (*.*)\0*.*\0");

	Enable(FALSE);
	int nRet = d.SummonOpen(m_hWnd);
	Enable(TRUE);
	SetFocus();

	if(nRet == 0) return;

	LoadELF(string_cast<std::string>(d.GetPath()).c_str());
}
Beispiel #5
0
void CMainWindow::OnPlaylistSaveClick()
{
	Framework::Win32::CFileDialog dialog;
	const TCHAR* filter = PLAYLIST_FILTER;
	dialog.m_OFN.lpstrFilter = filter;
	dialog.m_OFN.lpstrDefExt = PLAYLIST_EXTENSION + 1;
	if(dialog.SummonSave(m_hWnd))
	{
		try
		{
			m_playlist.Write(dialog.GetPath());
		}
		catch(const std::exception& except)
		{
			std::tstring errorString = _T("Couldn't save playlist: \r\n\r\n");
			errorString += string_cast<std::tstring>(except.what());
			MessageBox(m_hWnd, errorString.c_str(), NULL, 16);
		}
	}
}
Beispiel #6
0
void CMainWindow::BootDiskImage()
{
	Framework::Win32::CFileDialog d;
	d.m_OFN.lpstrFilter = DISKIMAGE_FILTER;

	Enable(FALSE);
	int nRet = d.SummonOpen(m_hWnd);
	Enable(TRUE);
	SetFocus();

	if(nRet == 0) return;

	CAppConfig::GetInstance().SetPreferenceString(PS2VM_CDROM0PATH, string_cast<std::string>(d.GetPath()).c_str());
	BootCDROM();
}