mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
Modified files for SDL2.
This commit is contained in:
parent
33a0579735
commit
475f218bcd
33 changed files with 436 additions and 136 deletions
|
|
@ -33,6 +33,7 @@ PlatformAssert *PlatformAssert::platformAssert = NULL;
|
|||
PlatformAssert::PlatformAssert()
|
||||
{
|
||||
processing = false;
|
||||
ignoreAll = false;
|
||||
}
|
||||
|
||||
//--------------------------------------
|
||||
|
|
@ -94,47 +95,57 @@ bool PlatformAssert::process(Type assertType,
|
|||
U32 lineNumber,
|
||||
const char *message)
|
||||
{
|
||||
// If we're somehow recursing, just die.
|
||||
if(processing)
|
||||
Platform::debugBreak();
|
||||
|
||||
processing = true;
|
||||
bool ret = true;
|
||||
|
||||
// always dump to the Assert to the Console
|
||||
if (Con::isActive())
|
||||
{
|
||||
if (assertType == Warning)
|
||||
Con::warnf(ConsoleLogEntry::Assert, "%s(%ld) : %s - %s", filename, lineNumber, typeName[assertType], message);
|
||||
else
|
||||
Con::errorf(ConsoleLogEntry::Assert, "%s(%ld) : %s - %s", filename, lineNumber, typeName[assertType], message);
|
||||
}
|
||||
|
||||
// if not a WARNING pop-up a dialog box
|
||||
if (assertType != Warning)
|
||||
{
|
||||
// used for processing navGraphs (an assert won't botch the whole build)
|
||||
if(Con::getBoolVariable("$FP::DisableAsserts", false) == true)
|
||||
Platform::forceShutdown(1);
|
||||
|
||||
char buffer[2048];
|
||||
dSprintf(buffer, 2048, "%s(%ld) : %s", filename, lineNumber, typeName[assertType] );
|
||||
|
||||
#ifdef TORQUE_DEBUG
|
||||
// In debug versions, allow a retry even for ISVs...
|
||||
bool retry = displayMessageBox(buffer, message, true);
|
||||
#else
|
||||
bool retry = displayMessageBox(buffer, message, ((assertType == Fatal) ? true : false) );
|
||||
#endif
|
||||
if(!retry)
|
||||
Platform::forceShutdown(1);
|
||||
|
||||
ret = askToEnterDebugger(message);
|
||||
}
|
||||
|
||||
processing = false;
|
||||
|
||||
return ret;
|
||||
// If we're somehow recursing, just die.
|
||||
if(processing)
|
||||
Platform::debugBreak();
|
||||
|
||||
processing = true;
|
||||
bool ret = false;
|
||||
|
||||
// always dump to the Assert to the Console
|
||||
if (Con::isActive())
|
||||
{
|
||||
if (assertType == Warning)
|
||||
Con::warnf(ConsoleLogEntry::Assert, "%s(%ld,0): {%s} - %s", filename, lineNumber, typeName[assertType], message);
|
||||
else
|
||||
Con::errorf(ConsoleLogEntry::Assert, "%s(%ld,0): {%s} - %s", filename, lineNumber, typeName[assertType], message);
|
||||
}
|
||||
|
||||
// if not a WARNING pop-up a dialog box
|
||||
if (assertType != Warning)
|
||||
{
|
||||
// used for processing navGraphs (an assert won't botch the whole build)
|
||||
if(Con::getBoolVariable("$FP::DisableAsserts", false) == true)
|
||||
Platform::forceShutdown(1);
|
||||
|
||||
char buffer[2048];
|
||||
dSprintf(buffer, 2048, "%s: (%s @ %ld)", typeName[assertType], filename, lineNumber);
|
||||
if( !ignoreAll )
|
||||
{
|
||||
// Display message box with Debug, Ignore, Ignore All, and Exit options
|
||||
switch( Platform::AlertAssert(buffer, message) )
|
||||
{
|
||||
case Platform::ALERT_ASSERT_DEBUG:
|
||||
ret = true;
|
||||
break;
|
||||
case Platform::ALERT_ASSERT_IGNORE:
|
||||
ret = false;
|
||||
break;
|
||||
case Platform::ALERT_ASSERT_IGNORE_ALL:
|
||||
ignoreAll = true;
|
||||
ret = false;
|
||||
break;
|
||||
default:
|
||||
case Platform::ALERT_ASSERT_EXIT:
|
||||
Platform::forceShutdown(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processing = false;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool PlatformAssert::processingAssert()
|
||||
|
|
@ -170,3 +181,11 @@ const char* avar(const char *message, ...)
|
|||
dVsprintf(buffer, sizeof(buffer), message, args);
|
||||
return( buffer );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleFunction( Assert, void, 3, 3, "(condition, message) - Fatal Script Assertion" )
|
||||
{
|
||||
// Process Assertion.
|
||||
AssertISV( dAtob(argv[1]), argv[2] );
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue