mirror of https://github.com/PCSX2/pcsx2.git
newHostVM: MSVC compilation fix.
git-svn-id: http://pcsx2.googlecode.com/svn/branches/newHostVM@4028 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
0692ab1bc5
commit
b10a6d5271
|
@ -82,6 +82,9 @@ extern bool TryParse( wxPoint& dest, const wxString& src, const wxPoint& defval=
|
||||||
extern bool TryParse( wxSize& dest, const wxString& src, const wxSize& defval=wxDefaultSize, const wxString& separators=L",");
|
extern bool TryParse( wxSize& dest, const wxString& src, const wxSize& defval=wxDefaultSize, const wxString& separators=L",");
|
||||||
extern bool TryParse( wxRect& dest, const wxString& src, const wxRect& defval=wxDefaultRect, const wxString& separators=L",");
|
extern bool TryParse( wxRect& dest, const wxString& src, const wxRect& defval=wxDefaultRect, const wxString& separators=L",");
|
||||||
|
|
||||||
|
const wxChar* pxPtrToString( void* ptr );
|
||||||
|
const wxChar* pxPtrToString( uptr ptr );
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------
|
||||||
// ParsedAssignmentString
|
// ParsedAssignmentString
|
||||||
// --------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#include "PrecompiledHeader.h"
|
#include "PrecompiledHeader.h"
|
||||||
#include <wx/gdicmn.h> // for wxPoint/wxRect stuff
|
#include <wx/gdicmn.h> // for wxPoint/wxRect stuff
|
||||||
|
|
||||||
|
#include "TlsVariable.inl"
|
||||||
|
|
||||||
__fi wxString fromUTF8( const char* src )
|
__fi wxString fromUTF8( const char* src )
|
||||||
{
|
{
|
||||||
// IMPORTANT: We cannot use wxString::FromUTF8 because it *stupidly* relies on a C++ global instance of
|
// IMPORTANT: We cannot use wxString::FromUTF8 because it *stupidly* relies on a C++ global instance of
|
||||||
|
@ -118,6 +120,37 @@ wxString JoinString( const wxChar** src, const wxString& separator )
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template< uint T >
|
||||||
|
struct pxMiniCharBuffer
|
||||||
|
{
|
||||||
|
wxChar chars[T];
|
||||||
|
pxMiniCharBuffer() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Rational for this function: %p behavior is undefined, and not well-implemented in most cases.
|
||||||
|
// MSVC doesn't prefix 0x, and Linux doesn't pad with zeros. (furthermore, 64-bit formatting is unknown
|
||||||
|
// and has even more room for variation and confusion). As is typical, we need portability, and so this
|
||||||
|
// isn't really acceptable. So here's a portable version!
|
||||||
|
const wxChar* pxPtrToString( void* ptr )
|
||||||
|
{
|
||||||
|
static Threading::TlsVariable< pxMiniCharBuffer < 32 > > buffer;
|
||||||
|
|
||||||
|
#ifdef __x86_64__
|
||||||
|
wxSnprintf( buffer->chars, 31, wxT("0x%08X.%08X"), ptr );
|
||||||
|
#else
|
||||||
|
wxSnprintf( buffer->chars, 31, wxT("0x%08X"), ptr );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return buffer->chars;
|
||||||
|
}
|
||||||
|
|
||||||
|
const wxChar* pxPtrToString( uptr ptr )
|
||||||
|
{
|
||||||
|
return pxPtrToString( (void*)ptr );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Attempts to parse and return a value for the given template type, and throws a ParseError
|
// Attempts to parse and return a value for the given template type, and throws a ParseError
|
||||||
// exception if the parse fails. The template type can be anything that is supported/
|
// exception if the parse fails. The template type can be anything that is supported/
|
||||||
// implemented via one of the TryParse() method overloads.
|
// implemented via one of the TryParse() method overloads.
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
|
|
||||||
#include "EventSource.inl"
|
#include "EventSource.inl"
|
||||||
#include "MemsetFast.inl"
|
#include "MemsetFast.inl"
|
||||||
#include "TlsVariable.inl"
|
|
||||||
|
|
||||||
template class EventSource< IEventListener_PageFault >;
|
template class EventSource< IEventListener_PageFault >;
|
||||||
|
|
||||||
|
@ -102,35 +101,6 @@ VirtualMemoryReserve& VirtualMemoryReserve::SetPageAccessOnCommit( const PagePro
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template< uint T >
|
|
||||||
struct pxMiniCharBuffer
|
|
||||||
{
|
|
||||||
wxChar chars[T];
|
|
||||||
pxMiniCharBuffer() {}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Rational for this function: %p behavior is undefined, and not well-implemented in most cases.
|
|
||||||
// MSVC doesn't prefix 0x, and Linux doesn't pad with zeros. (furthermore, 64-bit formatting is unknown
|
|
||||||
// and has even more room for variation and confusion). As is typical, we need portability, and so this
|
|
||||||
// isn't really acceptable. So here's a portable version!
|
|
||||||
const wxChar* pxPtrToString( void* ptr )
|
|
||||||
{
|
|
||||||
static Threading::TlsVariable< pxMiniCharBuffer < 32 > > buffer;
|
|
||||||
|
|
||||||
#ifdef __x86_64__
|
|
||||||
wxSnprintf( buffer->chars, 31, wxT("0x%08X.%08X"), ptr );
|
|
||||||
#else
|
|
||||||
wxSnprintf( buffer->chars, 31, wxT("0x%08X"), ptr );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return buffer->chars;
|
|
||||||
}
|
|
||||||
|
|
||||||
const wxChar* pxPtrToString( uptr ptr )
|
|
||||||
{
|
|
||||||
pxPtrToString( (void*)ptr );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Notes:
|
// Notes:
|
||||||
// * This method should be called if the object is already in an released (unreserved) state.
|
// * 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.
|
// Subsequent calls will be ignored, and the existing reserve will be returned.
|
||||||
|
|
Loading…
Reference in New Issue