本文整理汇总了C++中FastFormatUnicode类的典型用法代码示例。如果您正苦于以下问题:C++ FastFormatUnicode类的具体用法?C++ FastFormatUnicode怎么用?C++ FastFormatUnicode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FastFormatUnicode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadBlock
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;
}
}
示例2:
// --------------------------------------------------------------------------------------
// Exception::AccessDenied (implementations)
// --------------------------------------------------------------------------------------
wxString Exception::AccessDenied::FormatDiagnosticMessage() const
{
FastFormatUnicode retval;
retval.Write("Permission denied to file.\n");
_formatDiagMsg(retval);
return retval;
}
示例3: wxGetApp
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);
}
示例4:
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;
}
示例5: wxGetApp
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()
}
示例6: nameparts
// 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 );
}
示例7: ReadSync
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);
}
示例8: pxsPtr
// 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;
}
示例9: wxPanelWithHelpers
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 );
}
示例10: wxGetApp
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());)
}
示例11:
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;
}
示例12: wxPanelWithHelpers
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 );
}
示例13: ToString
// 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;
}
示例14: pxOnAssert
__fi void pxOnAssert( const DiagnosticOrigin& origin, const FastFormatUnicode& msg)
{
pxOnAssert( origin, msg.c_str());
}
示例15: wxGetApp
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);
}