Esempio n. 1
0
void isoFile::ReadBlock(u8* dst, uint lsn)
{
	if (lsn > m_blocks)
	{
		FastFormatUnicode msg;
		msg.Write("isoFile error: Block index is past the end of file! (%u > %u).", lsn, m_blocks);

		pxAssertDev(false, msg);
		Console.Error(msg);

		// [TODO] : Throw exception?
		//  Typically an error like this is bad; indicating an invalid dump or corrupted
		//  iso file.

		return;
	}

	if (m_flags == ISOFLAGS_BLOCKDUMP_V2)
		_ReadBlockD(dst, lsn);
	else
		_ReadBlock(dst, lsn);

	if (m_type == ISOTYPE_CD)
	{
		lsn_to_msf(dst + 12, lsn);
		dst[15] = 2;
	}
}
Esempio n. 2
0
// --------------------------------------------------------------------------------------
//  Exception::AccessDenied  (implementations)
// --------------------------------------------------------------------------------------
wxString Exception::AccessDenied::FormatDiagnosticMessage() const
{
	FastFormatUnicode retval;
	retval.Write("Permission denied to file.\n");
	_formatDiagMsg(retval);
	return retval;
}
Esempio n. 3
0
// --------------------------------------------------------------------------------------
//  Exception::EndOfStream  (implementations)
// --------------------------------------------------------------------------------------
wxString Exception::EndOfStream::FormatDiagnosticMessage() const
{
	FastFormatUnicode retval;
	retval.Write("Unexpected end of file or stream.\n");
	_formatDiagMsg(retval);
	return retval;
}
Esempio n. 4
0
// --------------------------------------------------------------------------------------
//  Exception::CannotCreateStream  (implementations)
// --------------------------------------------------------------------------------------
wxString Exception::CannotCreateStream::FormatDiagnosticMessage() const
{
	FastFormatUnicode retval;
	retval.Write("File could not be created.");
	_formatDiagMsg(retval);
	return retval;
}
Esempio n. 5
0
// --------------------------------------------------------------------------------------
//  Exception::FileNotFound  (implementations)
// --------------------------------------------------------------------------------------
wxString Exception::FileNotFound::FormatDiagnosticMessage() const
{
	FastFormatUnicode retval;
	retval.Write("File not found.\n");
	_formatDiagMsg(retval);
	return retval;
}
Esempio n. 6
0
void GSFrame::OnUpdateTitle( wxTimerEvent& evt )
{
#ifdef __linux__
	// Important Linux note: When the title is set in fullscreen the window is redrawn. Unfortunately
	// an intermediate white screen appears too which leads to a very annoying flickering.
	if (IsFullScreen()) return;
#endif
	AppConfig::UiTemplateOptions& templates = g_Conf->Templates;

	double fps = wxGetApp().FpsManager.GetFramerate();
	// The "not PAL" case covers both Region_NTSC and Region_NTSC_PROGRESSIVE
	float per = gsRegionMode == Region_PAL ? (fps * 100) / EmuConfig.GS.FrameratePAL.ToFloat() : (fps * 100) / EmuConfig.GS.FramerateNTSC.ToFloat();

	char gsDest[128];
	gsDest[0] = 0; // No need to set whole array to NULL.
	GSgetTitleInfo2( gsDest, sizeof(gsDest) );

	wxString limiterStr = templates.LimiterUnlimited;

	if( g_Conf->EmuOptions.GS.FrameLimitEnable )
	{
		switch( g_LimiterMode )
		{
			case Limit_Nominal:	limiterStr = templates.LimiterNormal; break;
			case Limit_Turbo:	limiterStr = templates.LimiterTurbo; break;
			case Limit_Slomo:	limiterStr = templates.LimiterSlowmo; break;
		}
	}

	FastFormatUnicode cpuUsage;
	if (m_CpuUsage.IsImplemented()) {
		m_CpuUsage.UpdateStats();

		cpuUsage.Write(L"EE: %3d%%", m_CpuUsage.GetEEcorePct());
		cpuUsage.Write(L" | GS: %3d%%", m_CpuUsage.GetGsPct());

		if (THREAD_VU1)
			cpuUsage.Write(L" | VU: %3d%%", m_CpuUsage.GetVUPct());

		pxNonReleaseCode(cpuUsage.Write(L" | UI: %3d%%", m_CpuUsage.GetGuiPct()));
	}

	const u64& smode2 = *(u64*)PS2GS_BASE(GS_SMODE2);
	wxString omodef = (smode2 & 2) ? templates.OutputFrame : templates.OutputField;
	wxString omodei = (smode2 & 1) ? templates.OutputInterlaced : templates.OutputProgressive;

	wxString title = templates.TitleTemplate;
	title.Replace(L"${slot}",		pxsFmt(L"%d", States_GetCurrentSlot()));
	title.Replace(L"${limiter}",	limiterStr);
	title.Replace(L"${speed}",		pxsFmt(L"%3d%%", lround(per)));
	title.Replace(L"${vfps}",		pxsFmt(L"%.02f", fps));
	title.Replace(L"${cpuusage}",	cpuUsage);
	title.Replace(L"${omodef}",		omodef);
	title.Replace(L"${omodei}",		omodei);
	title.Replace(L"${gsdx}",		fromUTF8(gsDest));
	if (CoreThread.IsPaused())
		title = templates.Paused + title;

	SetTitle(title);
}
Esempio n. 7
0
wxString Exception::EndOfStream::FormatDisplayMessage() const
{
	FastFormatUnicode retval;
	retval.Write(_("Unexpected end of file or stream encountered.  File is probably truncated or corrupted."));
	retval.Write("\n");
	_formatUserMsg(retval);
	return retval;
}
Esempio n. 8
0
wxString u128::ToString8() const
{
	FastFormatUnicode result;
	result.Write( L"0x%02X.%02X", _u8[0], _u8[1] );
	for (uint i=2; i<16; i+=2)
		result.Write( L".%02X.%02X", _u8[i], _u8[i+1] );
	return result;
}
Esempio n. 9
0
wxString Exception::FileNotFound::FormatDisplayMessage() const
{
	FastFormatUnicode retval;
	retval.Write(_("File not found."));
	retval.Write("\n");
	_formatUserMsg(retval);
	return retval;
}
Esempio n. 10
0
wxString Exception::AccessDenied::FormatDisplayMessage() const
{
	FastFormatUnicode retval;
	retval.Write(_("Permission denied while trying to open file, likely due to insufficient user account rights."));
	retval.Write("\n");
	_formatUserMsg(retval);
	return retval;
}
Esempio n. 11
0
wxString Exception::CannotCreateStream::FormatDisplayMessage() const
{
	FastFormatUnicode retval;
	retval.Write(_("A file could not be created."));
	retval.Write("\n");
	_formatUserMsg(retval);
	return retval;
}
Esempio n. 12
0
void GSFrame::OnUpdateTitle( wxTimerEvent& evt )
{
#ifdef __linux__
    // Important Linux note: When the title is set in fullscreen the window is redrawn. Unfortunately
    // an intermediate white screen appears too which leads to a very annoying flickering.
    if (IsFullScreen()) return;
#endif

    double fps = wxGetApp().FpsManager.GetFramerate();

    char gsDest[128];
    GSgetTitleInfo2( gsDest, sizeof(gsDest) );

    const wxChar* limiterStr = L"None";

    if( g_Conf->EmuOptions.GS.FrameLimitEnable )
    {
        switch( g_LimiterMode )
        {
        case Limit_Nominal:
            limiterStr = L"Normal";
            break;
        case Limit_Turbo:
            limiterStr = L"Turbo";
            break;
        case Limit_Slomo:
            limiterStr = L"Slomo";
            break;
        }
    }

    FastFormatUnicode cpuUsage;
    if (m_CpuUsage.IsImplemented()) {
        m_CpuUsage.UpdateStats();
        if (THREAD_VU1) { // Display VU thread's usage
            cpuUsage.Write(L" | EE: %3d%% | GS: %3d%% | VU: %3d%% | UI: %3d%%",
                           m_CpuUsage.GetEEcorePct(),	m_CpuUsage.GetGsPct(),
                           m_CpuUsage.GetVUPct(),		m_CpuUsage.GetGuiPct());
        }
        else {
            cpuUsage.Write(L" | EE: %3d%% | GS: %3d%% | UI: %3d%%",
                           m_CpuUsage.GetEEcorePct(),	m_CpuUsage.GetGsPct(),
                           m_CpuUsage.GetGuiPct());
        }
    }

    const u64& smode2 = *(u64*)PS2GS_BASE(GS_SMODE2);

    SetTitle( pxsFmt( L"%s | %ls (%ls) | Limiter: %ls | fps: %6.02f%ls | State %d",
                      WX_STR(fromUTF8(gsDest)),
                      (smode2 & 1) ? L"Interlaced" : L"Progressive",
                      (smode2 & 2) ? L"frame" : L"field",
                      limiterStr, fps, cpuUsage.c_str(), States_GetCurrentSlot() )
            );

    //States_GetCurrentSlot()
}
Esempio n. 13
0
wxString Exception::OutOfMemory::FormatDisplayMessage() const
{
	FastFormatUnicode retmsg;
	retmsg.Write( L"%s", _("Oh noes! Out of memory!") );

	if (!m_message_user.IsEmpty())
		retmsg.Write(L"\n\n%s", WX_STR(m_message_user));

	return retmsg;
}
Esempio n. 14
0
void Exception::BadStream::_formatUserMsg( FastFormatUnicode& dest ) const
{
	dest.Write( _("Path: ") );
	if (!StreamName.IsEmpty())
		dest.Write( L"%s", WX_STR(StreamName) );
	else
		dest.Write( _("[Unnamed or unknown]") );

	if (!m_message_user.IsEmpty())
		dest.Write(L"\n%s", WX_STR(m_message_user));
}
Esempio n. 15
0
wxString Exception::VirtualMemoryMapConflict::FormatDiagnosticMessage() const
{
	FastFormatUnicode retmsg;
	retmsg.Write(L"Virtual memory map failed");
	if (!AllocDescription.IsEmpty())
		retmsg.Write(L" while reserving '%s'", WX_STR(AllocDescription));

	if (!m_message_diag.IsEmpty())
		retmsg.Write(L":\n%s", WX_STR(m_message_diag));
		
	return retmsg;
}
Esempio n. 16
0
wxString Exception::OutOfMemory::FormatDiagnosticMessage() const
{
	FastFormatUnicode retmsg;
	retmsg.Write(L"Out of memory");
	if (!AllocDescription.IsEmpty())
		retmsg.Write(L" while allocating '%s'", WX_STR(AllocDescription));

	if (!m_message_diag.IsEmpty())
		retmsg.Write(L":\n%s", WX_STR(m_message_diag));
	
	return retmsg;
}
Esempio n. 17
0
wxString Exception::VirtualMemoryMapConflict::FormatDisplayMessage() const
{
	FastFormatUnicode retmsg;
	retmsg.Write( L"%s",
		pxE( L"There is not enough virtual memory available, or necessary virtual memory mappings have already been reserved by other processes, services, or DLLs."
		)
	);

	if (!m_message_diag.IsEmpty())
		retmsg.Write(L"\n\n%s", WX_STR(m_message_diag));

	return retmsg;
}
Esempio n. 18
0
// multi-part ISO support is provided for FAT32 compatibility; so that large 4GB+ isos
// can be split into multiple smaller files.
//
// Returns TRUE if multiple parts for the ISO are found.  Returns FALSE if only one
// part is found.
void isoFile::FindParts()
{
	wxFileName nameparts( m_filename );
	wxString curext( nameparts.GetExt() );
	wxChar prefixch = wxTolower(curext[0]);

	// Multi-part rules!
	//  * The first part can either be the proper extension (ISO, MDF, etc) or the numerical
	//    extension (I00, I01, M00, M01, etc).
	//  * Numerical extensions MUST begin at 00 (I00 etc), regardless of if the first part
	//    is proper or numerical.

	uint i = 0;

	if ((curext.Length() == 3) && (curext[1] == L'0') && (curext[2] == L'0'))
	{
		// First file is an OO, so skip 0 in the loop below:
		i = 1;
	}

	FastFormatUnicode extbuf;

	extbuf.Write( L"%c%02u", prefixch, i );
	nameparts.SetExt( extbuf );
	if (!pxFileExists_WithExt(nameparts, extbuf)) return;

	DevCon.WriteLn( Color_Blue, "isoFile: multi-part %s detected...", curext.Upper().c_str() );
	ConsoleIndentScope indent;

	for (; i < MaxSplits; ++i)
	{
		extbuf.Clear();
		extbuf.Write( L"%c%02u", prefixch, i );
		if (!pxFileExists_WithExt(nameparts, extbuf)) break;

		_IsoPart& thispart( m_parts[m_numparts] );

		thispart.handle = new wxFileInputStream( nameparts.GetFullPath() );
		pxStream_OpenCheck( *thispart.handle, nameparts.GetFullPath(), L"reading" );

		m_blocks += thispart.CalculateBlocks( m_blocks, m_blocksize );

		DevCon.WriteLn( Color_Blue, L"\tblocks %u - %u in: %s",
			thispart.slsn, thispart.elsn,
			nameparts.GetFullPath().c_str()
		);
		++m_numparts;
	}

	//Console.WriteLn( Color_Blue, "isoFile: multi-part ISO loaded (%u parts found)", m_numparts );
}
Esempio n. 19
0
int InputIsoFile::ReadSync(u8* dst, uint lsn)
{
	if (lsn > m_blocks)
	{
		FastFormatUnicode msg;
		msg.Write("isoFile error: Block index is past the end of file! (%u > %u).", lsn, m_blocks);

		pxAssertDev(false, msg);
		Console.Error(msg.c_str());
		return -1;
	}

	return m_reader->ReadSync(dst+m_blockofs, lsn, 1);
}
Esempio n. 20
0
// Notes:
//  * This method should be called if the object is already in an released (unreserved) state.
//    Subsequent calls will be ignored, and the existing reserve will be returned.
//
// Parameters:
//   size - size of the reserve, in bytes. (optional)
//     If not specified (or zero), then the default size specified in the constructor for the
//     object instance is used.
//
//   upper_bounds - criteria that must be met for the allocation to be valid.
//     If the OS refuses to allocate the memory below the specified address, the
//     object will fail to initialize and an exception will be thrown.
void* VirtualMemoryReserve::Reserve( size_t size, uptr base, uptr upper_bounds )
{
	if (!pxAssertDev( m_baseptr == NULL, "(VirtualMemoryReserve) Invalid object state; object has already been reserved." ))
		return m_baseptr;

	if (!size) size = m_defsize;
	if (!size) return NULL;

	m_pages_reserved = (size + __pagesize-4) / __pagesize;
	uptr reserved_bytes = m_pages_reserved * __pagesize;

	m_baseptr = (void*)HostSys::MmapReserve(base, reserved_bytes);

	if (!m_baseptr || (upper_bounds != 0 && (((uptr)m_baseptr + reserved_bytes) > upper_bounds)))
	{
		DevCon.Warning( L"%s: host memory @ %s -> %s is unavailable; attempting to map elsewhere...",
			m_name.c_str(), pxsPtr(base), pxsPtr(base + size) );

		SafeSysMunmap(m_baseptr, reserved_bytes);

		if (base)
		{
			// Let's try again at an OS-picked memory area, and then hope it meets needed
			// boundschecking criteria below.
			m_baseptr = HostSys::MmapReserve( 0, reserved_bytes );
		}
	}

	if ((upper_bounds != 0) && (((uptr)m_baseptr + reserved_bytes) > upper_bounds))
	{
		SafeSysMunmap(m_baseptr, reserved_bytes);
		// returns null, caller should throw an exception or handle appropriately.
	}

	if (!m_baseptr) return NULL;

	FastFormatUnicode mbkb;
	uint mbytes = reserved_bytes / _1mb;
	if (mbytes)
		mbkb.Write( "[%umb]", mbytes );
	else
		mbkb.Write( "[%ukb]", reserved_bytes / 1024 );

	DevCon.WriteLn( Color_Gray, L"%-32s @ %s -> %s %s", m_name.c_str(),
		pxsPtr(m_baseptr), pxsPtr((uptr)m_baseptr+reserved_bytes), mbkb.c_str());

	return m_baseptr;
}
Esempio n. 21
0
Panels::FirstTimeIntroPanel::FirstTimeIntroPanel( wxWindow* parent )
	: wxPanelWithHelpers( parent, wxVERTICAL )
{
	SetMinWidth( 600 );

	FastFormatUnicode faqFile;
#ifndef DOC_DIR_COMPILATION
	faqFile.Write( L"file:///%s/Docs/PCSX2_FAQ.pdf", WX_STR(InstallFolder.ToString()) );
#else
	// Each linux distributions have his rules for path so we give them the possibility to
	// change it with compilation flags. -- Gregory
#define xDOC_str(s) DOC_str(s)
#define DOC_str(s) #s
	faqFile.Write( L"file://%s/PCSX2_FAQ.pdf", WX_STR(wxDirName(xDOC_str(DOC_DIR_COMPILATION)).ToString()) );
#endif

	wxStaticBoxSizer& langSel	= *new wxStaticBoxSizer( wxVERTICAL, this, _("Language selector") );

	langSel += new Panels::LanguageSelectionPanel( this ) | StdCenter();
	langSel += Heading(_("Change the language only if you need to.\nThe system default should be fine for most operating systems."));
	langSel += 8;

	*this += langSel | StdExpand();
	*this += GetCharHeight() * 2;

	*this += Heading(_("Welcome to PCSX2!")).Bold() | StdExpand();
	*this += GetCharHeight();

	*this += Heading(AddAppName(
		pxE( L"This wizard will help guide you through configuring plugins, memory cards, and BIOS.  It is recommended if this is your first time installing %s that you view the readme and configuration guide."
		) )
	);

	*this += GetCharHeight() * 2;

	*this	+= new wxHyperlinkCtrl( this, wxID_ANY,
		_("Configuration Guides (online)"), L"http://www.pcsx2.net/guide.php"
	) | pxCenter.Border( wxALL, 5 );
		
	*this	+= new wxHyperlinkCtrl( this, wxID_ANY,
		_("Readme / FAQ (Offline/PDF)"), faqFile.c_str()
	) | pxCenter.Border( wxALL, 5 );

}
Esempio n. 22
0
void GSFrame::OnUpdateTitle( wxTimerEvent& evt )
{
#ifdef __linux__
	// Important Linux note: When the title is set in fullscreen the window is redrawn. Unfortunately
	// an intermediate white screen appears too which leads to a very annoying flickering.
	if (IsFullScreen()) return;
#endif
	AppConfig::UiTemplateOptions& templates = g_Conf->Templates;

	double fps = wxGetApp().FpsManager.GetFramerate();
	// The "not PAL" case covers both Region_NTSC and Region_NTSC_PROGRESSIVE
	float per = gsRegionMode == Region_PAL ? (fps * 100) / EmuConfig.GS.FrameratePAL.ToFloat() : (fps * 100) / EmuConfig.GS.FramerateNTSC.ToFloat();

	char gsDest[128];
	gsDest[0] = 0; // No need to set whole array to NULL.
	GSgetTitleInfo2( gsDest, sizeof(gsDest) );

	const wxChar* limiterStr = templates.LimiterUnlimited;

	if( g_Conf->EmuOptions.GS.FrameLimitEnable )
	{
		switch( g_LimiterMode )
		{
			case Limit_Nominal:	limiterStr = templates.LimiterNormal; break;
			case Limit_Turbo:	limiterStr = templates.LimiterTurbo; break;
			case Limit_Slomo:	limiterStr = templates.LimiterSlowmo; break;
		}
	}

	FastFormatUnicode cpuUsage;
	if (m_CpuUsage.IsImplemented()) {
		m_CpuUsage.UpdateStats();

		cpuUsage.Write(L"EE: %3d%%", m_CpuUsage.GetEEcorePct());
		cpuUsage.Write(L" | GS: %3d%%", m_CpuUsage.GetGsPct());

		if (THREAD_VU1)
			cpuUsage.Write(L" | VU: %3d%%", m_CpuUsage.GetVUPct());

		pxNonReleaseCode(cpuUsage.Write(L" | UI: %3d%%", m_CpuUsage.GetEEcorePct());)
	}
Esempio n. 23
0
void InputIsoFile::BeginRead2(uint lsn)
{
	if (lsn > m_blocks)
	{
		FastFormatUnicode msg;
		msg.Write("isoFile error: Block index is past the end of file! (%u > %u).", lsn, m_blocks);

		pxAssertDev(false, msg);
		Console.Error(msg.c_str());

		// [TODO] : Throw exception?
		//  Typically an error like this is bad; indicating an invalid dump or corrupted
		//  iso file.

		m_current_lsn = -1;
		return;
	}
	
	m_current_lsn = lsn;

	if(lsn >= m_read_lsn && lsn < (m_read_lsn+m_read_count))
	{
		// Already buffered
		return;
	}

	m_read_lsn = lsn;
	m_read_count = 1;

	if(ReadUnit > 1)
	{
		//m_read_lsn   = lsn - (lsn % ReadUnit);

		m_read_count = std::min(ReadUnit, m_blocks - m_read_lsn);
	}

	m_reader->BeginRead(m_readbuffer, m_read_lsn, m_read_count);
	m_read_inprogress = true;
}
Esempio n. 24
0
Panels::FirstTimeIntroPanel::FirstTimeIntroPanel( wxWindow* parent )
	: wxPanelWithHelpers( parent, wxVERTICAL )
{
	SetMinWidth( 600 );

	FastFormatUnicode faqFile;
	faqFile.Write( L"file:///%s/Docs/PCSX2_FAQ.pdf",
		InstallFolder.ToString().c_str() );

	wxStaticBoxSizer& langSel	= *new wxStaticBoxSizer( wxVERTICAL, this, _("Language selector") );

	langSel += new Panels::LanguageSelectionPanel( this ) | StdCenter();
	langSel += Heading(_("Change the language only if you need to.\nThe system default should be fine for most operating systems."));
	langSel += 8;

	*this += langSel | StdExpand();
	*this += GetCharHeight() * 2;

	*this += Heading(_("Welcome to PCSX2!")).Bold() | StdExpand();
	*this += GetCharHeight();

	*this += Heading(AddAppName(
		pxE( L"This wizard will help guide you through configuring plugins, memory cards, and BIOS.  It is recommended if this is your first time installing %s that you view the readme and configuration guide."
		) )
	);

	*this += GetCharHeight() * 2;

	*this	+= new wxHyperlinkCtrl( this, wxID_ANY,
		_("Configuration Guides (online)"), L"http://www.pcsx2.net/guide.php"
	) | pxCenter.Border( wxALL, 5 );
		
	*this	+= new wxHyperlinkCtrl( this, wxID_ANY,
		_("Readme / FAQ (Offline/PDF)"), faqFile.c_str()
	) | pxCenter.Border( wxALL, 5 );

}
Esempio n. 25
0
// make life easier for people using VC++ IDE by using this format, which allows double-click
// response times from the Output window...
wxString DiagnosticOrigin::ToString( const wxChar* msg ) const
{
	FastFormatUnicode message;

	message.Write( L"%ls(%d) : assertion failed:\n", srcfile, line );

	if( function != NULL )
		message.Write( "    Function:  %s\n", function );

		message.Write(L"    Thread:    %s\n", WX_STR(Threading::pxGetCurrentThreadName()) );

	if( condition != NULL )
		message.Write(L"    Condition: %ls\n", condition);

	if( msg != NULL )
		message.Write(L"    Message:   %ls\n", msg);

	return message;
}
Esempio n. 26
0
__fi void pxOnAssert( const DiagnosticOrigin& origin, const FastFormatUnicode& msg)
{
	pxOnAssert( origin, msg.c_str());
}
Esempio n. 27
0
void GSFrame::OnUpdateTitle( wxTimerEvent& evt )
{
	// Update the title only after the completion of at least a single Vsync, it's pointless to display the fps
	// when there are have been no frames rendered and SMODE2 register seems to fresh start with 0 on all the bitfields which
	// leads to the value of INT bit as 0 initially and the games are mentioned as progressive which is a bit misleading,
	// to prevent such issues, let's update the title after the actual frame rendering starts.
	if (g_FrameCount == 0)
		return;

	double fps = wxGetApp().FpsManager.GetFramerate();

	FastFormatUnicode cpuUsage;
	if (m_CpuUsage.IsImplemented()) {
		m_CpuUsage.UpdateStats();

		if (!IsFullScreen()) {
			cpuUsage.Write(L"EE: %3d%%", m_CpuUsage.GetEEcorePct());
			cpuUsage.Write(L" | GS: %3d%%", m_CpuUsage.GetGsPct());

			if (THREAD_VU1)
				cpuUsage.Write(L" | VU: %3d%%", m_CpuUsage.GetVUPct());

			pxNonReleaseCode(cpuUsage.Write(L" | UI: %3d%%", m_CpuUsage.GetGuiPct()));
		}

		if (THREAD_VU1)
			OSDmonitor(Color_StrongGreen, "VU:", std::to_string(m_CpuUsage.GetVUPct()).c_str());

		OSDmonitor(Color_StrongGreen, "EE:", std::to_string(m_CpuUsage.GetEEcorePct()).c_str());
		OSDmonitor(Color_StrongGreen, "GS:", std::to_string(m_CpuUsage.GetGsPct()).c_str());
		pxNonReleaseCode(OSDmonitor(Color_StrongGreen, "UI:", std::to_string(m_CpuUsage.GetGuiPct()).c_str()));
	}

	std::ostringstream out;
	out << std::fixed << std::setprecision(2) << fps;
	OSDmonitor(Color_StrongGreen, "FPS:", out.str());

#ifdef __linux__
	// Important Linux note: When the title is set in fullscreen the window is redrawn. Unfortunately
	// an intermediate white screen appears too which leads to a very annoying flickering.
	if (IsFullScreen()) return;
#endif

	AppConfig::UiTemplateOptions& templates = g_Conf->Templates;

	float percentage = (fps * 100) / GetVerticalFrequency().ToFloat();

	char gsDest[128];
	gsDest[0] = 0; // No need to set whole array to NULL.
	GSgetTitleInfo2( gsDest, sizeof(gsDest) );

	wxString limiterStr = templates.LimiterUnlimited;

	if( g_Conf->EmuOptions.GS.FrameLimitEnable )
	{
		switch( g_LimiterMode )
		{
			case Limit_Nominal:	limiterStr = templates.LimiterNormal; break;
			case Limit_Turbo:	limiterStr = templates.LimiterTurbo; break;
			case Limit_Slomo:	limiterStr = templates.LimiterSlowmo; break;
		}
	}

	const u64& smode2 = *(u64*)PS2GS_BASE(GS_SMODE2);
	wxString omodef = (smode2 & 2) ? templates.OutputFrame : templates.OutputField;
	wxString omodei = (smode2 & 1) ? templates.OutputInterlaced : templates.OutputProgressive;

	wxString title = templates.TitleTemplate;
	title.Replace(L"${slot}",		pxsFmt(L"%d", States_GetCurrentSlot()));
	title.Replace(L"${limiter}",	limiterStr);
	title.Replace(L"${speed}",		pxsFmt(L"%3d%%", lround(percentage)));
	title.Replace(L"${vfps}",		pxsFmt(L"%.02f", fps));
	title.Replace(L"${cpuusage}",	cpuUsage);
	title.Replace(L"${omodef}",		omodef);
	title.Replace(L"${omodei}",		omodei);
	title.Replace(L"${gsdx}",		fromUTF8(gsDest));
	title.Replace(L"${videomode}",	ReportVideoMode());
	if (CoreThread.IsPaused())
		title = templates.Paused + title;

	SetTitle(title);
}
void MultipartFileReader::FindParts()
{
	wxFileName nameparts( m_filename );
	wxString curext( nameparts.GetExt() );
	wxChar prefixch = wxTolower(curext[0]);

	// Multi-part rules!
	//  * The first part can either be the proper extension (ISO, MDF, etc) or the numerical
	//    extension (I00, I01, M00, M01, etc).
	//  * Numerical extensions MUST begin at 00 (I00 etc), regardless of if the first part
	//    is proper or numerical.

	uint i = 0;

	if ((curext.Length() == 3) && (curext[1] == L'0') && (curext[2] == L'0'))
	{
		// First file is an OO, so skip 0 in the loop below:
		i = 1;
	}

	FastFormatUnicode extbuf;

	extbuf.Write( L"%c%02u", prefixch, i );
	nameparts.SetExt( extbuf );
	if (!pxFileExists_WithExt(nameparts, extbuf))
		return;

	DevCon.WriteLn( Color_Blue, "isoFile: multi-part %s detected...", WX_STR(curext.Upper()) );
	ConsoleIndentScope indent;

	int bsize = m_parts[0].reader->GetBlockSize();
	int blocks = m_parts[0].end;

	m_numparts = 1;

	for (; i < MaxParts; ++i)
	{
		extbuf.Clear();
		extbuf.Write( L"%c%02u", prefixch, i );
		nameparts.SetExt( extbuf );
		if (!pxFileExists_WithExt(nameparts, extbuf))
			break;

		Part* thispart = m_parts + m_numparts;
		AsyncFileReader* thisreader = thispart->reader = new FlatFileReader();

		wxString name = nameparts.GetFullPath();

		thisreader->Open(name);
		thisreader->SetBlockSize(bsize);

		thispart->start = blocks;

		uint bcount =  thisreader->GetBlockCount();
		blocks += bcount;

		thispart->end = blocks;

		DevCon.WriteLn( Color_Blue, L"\tblocks %u - %u in: %s",
			thispart->start, thispart->end,
			WX_STR(nameparts.GetFullPath())
		);

		++m_numparts;
	}

	//Console.WriteLn( Color_Blue, "isoFile: multi-part ISO loaded (%u parts found)", m_numparts );
}
Esempio n. 29
0
void GSFrame::OnUpdateTitle( wxTimerEvent& evt )
{
	double fps = wxGetApp().FpsManager.GetFramerate();

	FastFormatUnicode cpuUsage;
	if (m_CpuUsage.IsImplemented()) {
		m_CpuUsage.UpdateStats();

		if (!IsFullScreen()) {
			cpuUsage.Write(L"EE: %3d%%", m_CpuUsage.GetEEcorePct());
			cpuUsage.Write(L" | GS: %3d%%", m_CpuUsage.GetGsPct());

			if (THREAD_VU1)
				cpuUsage.Write(L" | VU: %3d%%", m_CpuUsage.GetVUPct());

			pxNonReleaseCode(cpuUsage.Write(L" | UI: %3d%%", m_CpuUsage.GetGuiPct()));
		}

		if (THREAD_VU1)
			OSDmonitor(Color_StrongGreen, "VU:", std::to_string(m_CpuUsage.GetVUPct()).c_str());

		OSDmonitor(Color_StrongGreen, "EE:", std::to_string(m_CpuUsage.GetEEcorePct()).c_str());
		OSDmonitor(Color_StrongGreen, "GS:", std::to_string(m_CpuUsage.GetGsPct()).c_str());
		pxNonReleaseCode(OSDmonitor(Color_StrongGreen, "UI:", std::to_string(m_CpuUsage.GetGuiPct()).c_str()));
	}

	std::ostringstream out;
	out << std::fixed << std::setprecision(2) << fps;
	OSDmonitor(Color_StrongGreen, "FPS:", out.str());

	// Important Linux note: When the title is set in fullscreen the window is redrawn. Unfortunately
	// an intermediate white screen appears too which leads to a very annoying flickering.
	if (IsFullScreen()) return;

	AppConfig::UiTemplateOptions& templates = g_Conf->Templates;

	float percentage = (fps * 100) / GetVerticalFrequency().ToFloat();

	char gsDest[128];
	gsDest[0] = 0; // No need to set whole array to NULL.
	GSgetTitleInfo2( gsDest, sizeof(gsDest) );

	wxString limiterStr = templates.LimiterUnlimited;

	if( g_Conf->EmuOptions.GS.FrameLimitEnable )
	{
		switch( g_LimiterMode )
		{
			case Limit_Nominal:	limiterStr = templates.LimiterNormal; break;
			case Limit_Turbo:	limiterStr = templates.LimiterTurbo; break;
			case Limit_Slomo:	limiterStr = templates.LimiterSlowmo; break;
		}
	}

	const u64& smode2 = *(u64*)PS2GS_BASE(GS_SMODE2);
	wxString omodef = (smode2 & 2) ? templates.OutputFrame : templates.OutputField;
	wxString omodei = (smode2 & 1) ? templates.OutputInterlaced : templates.OutputProgressive;

	wxString title = templates.TitleTemplate;
	title.Replace(L"${slot}",		pxsFmt(L"%d", States_GetCurrentSlot()));
	title.Replace(L"${limiter}",	limiterStr);
	title.Replace(L"${speed}",		pxsFmt(L"%3d%%", lround(percentage)));
	title.Replace(L"${vfps}",		pxsFmt(L"%.02f", fps));
	title.Replace(L"${cpuusage}",	cpuUsage);
	title.Replace(L"${omodef}",		omodef);
	title.Replace(L"${omodei}",		omodei);
	title.Replace(L"${gsdx}",		fromUTF8(gsDest));
	if (CoreThread.IsPaused())
		title = templates.Paused + title;

	SetTitle(title);
}