pcsx2|utilities; Revert ambiguous wxString related commits

This reverts
93d5b52df3
f3e78b8267
55155ca7f1.

Unfortunately wxString stuff is a PITA to deal with. Breaks FreeBSD
compile, but there are probably more issues that just haven't been
reported yet...
This commit is contained in:
Jonathan Li 2018-09-04 21:40:27 +01:00
parent d520f3852b
commit a977f1e6c1
7 changed files with 33 additions and 18 deletions

View File

@ -185,6 +185,9 @@ extern pxDoAssertFnType *pxDoAssert;
#define IndexBoundsAssumeDev(objname, idx, sze) pxAssumeDev((uint)(idx) < (uint)(sze), \ #define IndexBoundsAssumeDev(objname, idx, sze) pxAssumeDev((uint)(idx) < (uint)(sze), \
pxsFmt(L"Array index out of bounds accessing object '%s' (index=%d, size=%d)", objname, (idx), (sze))) pxsFmt(L"Array index out of bounds accessing object '%s' (index=%d, size=%d)", objname, (idx), (sze)))
extern void pxOnAssert(const DiagnosticOrigin &origin, const wxChar *msg = NULL);
extern void pxOnAssert(const DiagnosticOrigin &origin, const char *msg);
extern void pxOnAssert(const DiagnosticOrigin &origin, const wxString &msg); extern void pxOnAssert(const DiagnosticOrigin &origin, const wxString &msg);
extern void pxOnAssert(const DiagnosticOrigin &origin, const FastFormatUnicode &msg); extern void pxOnAssert(const DiagnosticOrigin &origin, const FastFormatUnicode &msg);

View File

@ -200,7 +200,6 @@ protected:
void _ThreadCleanup(); void _ThreadCleanup();
static void *_internal_callback(void *func); static void *_internal_callback(void *func);
static void internal_callback_helper(void *func);
static void _pt_callback_cleanup(void *handle); static void _pt_callback_cleanup(void *handle);
}; };

View File

@ -680,7 +680,8 @@ protected:
wxPoint m_curpos; wxPoint m_curpos;
int m_leading; int m_leading;
virtual void _DoWriteLn(const wxString &msg); virtual void _DoWriteLn(const wxChar *msg);
void _DoWriteLn(const wxString msg);
void _DoWrite(const wxChar *msg); void _DoWrite(const wxChar *msg);
public: public:

View File

@ -95,7 +95,7 @@ bool pxAssertImpl_LogIt(const DiagnosticOrigin &origin, const wxChar *msg)
} }
DEVASSERT_INLINE void pxOnAssert(const DiagnosticOrigin &origin, const wxString &msg) DEVASSERT_INLINE void pxOnAssert(const DiagnosticOrigin &origin, const wxChar *msg)
{ {
// Recursion guard: Allow at least one recursive call. This is useful because sometimes // Recursion guard: Allow at least one recursive call. This is useful because sometimes
// we get meaningless assertions while unwinding stack traces after exceptions have occurred. // we get meaningless assertions while unwinding stack traces after exceptions have occurred.
@ -114,9 +114,9 @@ DEVASSERT_INLINE void pxOnAssert(const DiagnosticOrigin &origin, const wxString
if (pxDoAssert == NULL) { if (pxDoAssert == NULL) {
// Note: Format uses MSVC's syntax for output window hotlinking. // Note: Format uses MSVC's syntax for output window hotlinking.
trapit = pxAssertImpl_LogIt(origin, msg.wc_str()); trapit = pxAssertImpl_LogIt(origin, msg);
} else { } else {
trapit = pxDoAssert(origin, msg.wc_str()); trapit = pxDoAssert(origin, msg);
} }
if (trapit) { if (trapit) {
@ -124,6 +124,16 @@ DEVASSERT_INLINE void pxOnAssert(const DiagnosticOrigin &origin, const wxString
} }
} }
__fi void pxOnAssert(const DiagnosticOrigin &origin, const char *msg)
{
pxOnAssert(origin, fromUTF8(msg));
}
__fi void pxOnAssert(const DiagnosticOrigin &origin, const wxString &msg)
{
pxOnAssert(origin, msg.wc_str());
}
__fi void pxOnAssert(const DiagnosticOrigin &origin, const FastFormatUnicode &msg) __fi void pxOnAssert(const DiagnosticOrigin &origin, const FastFormatUnicode &msg)
{ {
pxOnAssert(origin, msg.c_str()); pxOnAssert(origin, msg.c_str());

View File

@ -685,21 +685,12 @@ void *Threading::pxThread::_internal_callback(void *itsme)
{ {
if (!pxAssertDev(itsme != NULL, wxNullChar)) if (!pxAssertDev(itsme != NULL, wxNullChar))
return NULL; return NULL;
pxThread &owner = *((pxThread *)itsme);
internal_callback_helper(itsme);
return NULL;
}
// __try is used in pthread_cleanup_push when CLEANUP_SEH is used as the cleanup model.
// That can't be used in a function that has objects that require unwinding (compile
// error C2712), so move it into a separate function.
void Threading::pxThread::internal_callback_helper(void *itsme)
{
pxThread &owner = *static_cast<pxThread *>(itsme);
pthread_cleanup_push(_pt_callback_cleanup, itsme); pthread_cleanup_push(_pt_callback_cleanup, itsme);
owner._internal_execute(); owner._internal_execute();
pthread_cleanup_pop(true); pthread_cleanup_pop(true);
return NULL;
} }
void Threading::pxThread::_DoSetThreadName(const wxString &name) void Threading::pxThread::_DoSetThreadName(const wxString &name)

View File

@ -84,7 +84,7 @@ pxWindowTextWriter &pxWindowTextWriter::MoveY(int ydelta)
return *this; return *this;
} }
void pxWindowTextWriter::_DoWriteLn(const wxString &msg) void pxWindowTextWriter::_DoWriteLn(const wxChar *msg)
{ {
pxAssert(msg); pxAssert(msg);
@ -103,6 +103,11 @@ void pxWindowTextWriter::_DoWriteLn(const wxString &msg)
m_curpos.y += tHeight + m_leading; m_curpos.y += tHeight + m_leading;
} }
void pxWindowTextWriter::_DoWriteLn(const wxString msg)
{
_DoWriteLn(msg.wc_str());
}
// Splits incoming multi-line strings into pieces, and dispatches each line individually // Splits incoming multi-line strings into pieces, and dispatches each line individually
// to the text writer. // to the text writer.
void pxWindowTextWriter::_DoWrite(const wxChar *msg) void pxWindowTextWriter::_DoWrite(const wxChar *msg)

View File

@ -227,7 +227,7 @@ public:
ConsoleLogFromVM( const TraceLogDescriptor* desc ) : _parent( desc ) {} ConsoleLogFromVM( const TraceLogDescriptor* desc ) : _parent( desc ) {}
bool Write( const wxString &msg ) const bool Write( const wxChar* msg ) const
{ {
ConsoleColorScope cs(conColor); ConsoleColorScope cs(conColor);
Console.WriteRaw( msg ); Console.WriteRaw( msg );
@ -239,6 +239,12 @@ public:
return false; return false;
} }
bool Write( const wxString msg ) const
{
return Write(msg.wc_str());
}
}; };
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------