mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-19 11:49:09 +00:00
Print out exception details in some places where it may be useful
This commit is contained in:
@ -61,6 +61,9 @@ int main(int argc, char* argv[])
|
|||||||
plResManager* resMgr = new plResManager;
|
plResManager* resMgr = new plResManager;
|
||||||
hsgResMgr::Init(resMgr);
|
hsgResMgr::Init(resMgr);
|
||||||
#ifndef _DEBUG
|
#ifndef _DEBUG
|
||||||
|
} catch (std::exception &e) {
|
||||||
|
printf(" ***crashed on init: %s\n", e.what());
|
||||||
|
return 2;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
puts(" ***crashed on init");
|
puts(" ***crashed on init");
|
||||||
return 2;
|
return 2;
|
||||||
@ -75,6 +78,10 @@ int main(int argc, char* argv[])
|
|||||||
optimizer.Optimize();
|
optimizer.Optimize();
|
||||||
}
|
}
|
||||||
#ifndef _DEBUG
|
#ifndef _DEBUG
|
||||||
|
catch (std::exception &e) {
|
||||||
|
printf(" ***crashed on optimizing: %s\n", e.what());
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
puts(" ***crashed on optimizing");
|
puts(" ***crashed on optimizing");
|
||||||
return 2;
|
return 2;
|
||||||
@ -92,6 +99,9 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
hsgResMgr::Shutdown();
|
hsgResMgr::Shutdown();
|
||||||
#ifndef _DEBUG
|
#ifndef _DEBUG
|
||||||
|
} catch (std::exception &e) {
|
||||||
|
printf(" ***crashed on shutdown: %s\n", e.what());
|
||||||
|
return 2;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
puts(" ***crashed on shutdown");
|
puts(" ***crashed on shutdown");
|
||||||
return 2;
|
return 2;
|
||||||
|
@ -150,7 +150,13 @@ bool plEAXListener::Init( void )
|
|||||||
|
|
||||||
SetGlobalEAXProperty(DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_ROOM, &lRoom, sizeof( unsigned int ));
|
SetGlobalEAXProperty(DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_ROOM, &lRoom, sizeof( unsigned int ));
|
||||||
}
|
}
|
||||||
catch ( ... )
|
catch (std::exception &e)
|
||||||
|
{
|
||||||
|
plStatusLog::AddLineS("audio.log", "Unable to set EAX Property Set (%s), disabling EAX...", e.what());
|
||||||
|
plgAudioSys::EnableEAX(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
{
|
{
|
||||||
plStatusLog::AddLineS("audio.log", "Unable to set EAX Property Set, disabling EAX...");
|
plStatusLog::AddLineS("audio.log", "Unable to set EAX Property Set, disabling EAX...");
|
||||||
plgAudioSys::EnableEAX(false);
|
plgAudioSys::EnableEAX(false);
|
||||||
|
@ -158,14 +158,16 @@ bool plAvBrainHuman::Apply(double timeNow, float elapsed)
|
|||||||
fWalkingStrategy->SetTurnStrength(IGetTurnStrength(timeNow));
|
fWalkingStrategy->SetTurnStrength(IGetTurnStrength(timeNow));
|
||||||
RunStandardBehaviors(timeNow, elapsed);
|
RunStandardBehaviors(timeNow, elapsed);
|
||||||
fWalkingStrategy->RecalcVelocity(timeNow, elapsed, (fPreconditions & plHBehavior::kBehaviorTypeNeedsRecalcMask));
|
fWalkingStrategy->RecalcVelocity(timeNow, elapsed, (fPreconditions & plHBehavior::kBehaviorTypeNeedsRecalcMask));
|
||||||
|
|
||||||
plArmatureBrain::Apply(timeNow, elapsed);
|
plArmatureBrain::Apply(timeNow, elapsed);
|
||||||
#ifndef _DEBUG
|
#ifndef _DEBUG
|
||||||
} catch (...)
|
} catch (std::exception &e) {
|
||||||
{
|
plStatusLog *log = plAvatarMgr::GetInstance()->GetLog();
|
||||||
|
log->AddLineF("plAvBrainHuman::Apply - exception caught: %s", e.what());
|
||||||
|
} catch (...) {
|
||||||
// just catch all the crashes on exit...
|
// just catch all the crashes on exit...
|
||||||
plStatusLog *log = plAvatarMgr::GetInstance()->GetLog();
|
plStatusLog *log = plAvatarMgr::GetInstance()->GetLog();
|
||||||
log->AddLine("plAvBrainHuman::Apply - crash caught");
|
log->AddLine("plAvBrainHuman::Apply - exception caught");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1475,7 +1475,13 @@ bool plFont::LoadFromFNTStream( hsStream *stream )
|
|||||||
ICalcFontAscent();
|
ICalcFontAscent();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch( ... )
|
catch (std::exception &e)
|
||||||
|
{
|
||||||
|
printf("Exception caught in plFont::LoadFromFNTStream: %s\n", e.what());
|
||||||
|
IClear();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
{
|
{
|
||||||
// Somehow we crashed converting!
|
// Somehow we crashed converting!
|
||||||
IClear();
|
IClear();
|
||||||
@ -2092,7 +2098,14 @@ bool plFont::LoadFromBDF( const plFileName &path, plBDFConvertCallback *callb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( ... )
|
catch (std::exception &e)
|
||||||
|
{
|
||||||
|
printf("Exception caught in plFont::LoadFromBDF: %s\n", e.what());
|
||||||
|
IClear();
|
||||||
|
fclose(fp);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
{
|
{
|
||||||
IClear();
|
IClear();
|
||||||
fclose( fp );
|
fclose( fp );
|
||||||
|
@ -73,7 +73,7 @@ static char jpegmsg[JMSG_LENGTH_MAX];
|
|||||||
static void plJPEG_error_exit( j_common_ptr cinfo )
|
static void plJPEG_error_exit( j_common_ptr cinfo )
|
||||||
{
|
{
|
||||||
(*cinfo->err->format_message) ( cinfo, jpegmsg );
|
(*cinfo->err->format_message) ( cinfo, jpegmsg );
|
||||||
throw ( false );
|
throw false;
|
||||||
}
|
}
|
||||||
static void plJPEG_emit_message( j_common_ptr cinfo, int msg_level )
|
static void plJPEG_emit_message( j_common_ptr cinfo, int msg_level )
|
||||||
{
|
{
|
||||||
@ -134,7 +134,7 @@ plMipmap *plJPEG::IRead( hsStream *inStream )
|
|||||||
|
|
||||||
/// Read in the JPEG header
|
/// Read in the JPEG header
|
||||||
if ( inStream->GetEOF() == 0 )
|
if ( inStream->GetEOF() == 0 )
|
||||||
throw( false );
|
throw false;
|
||||||
|
|
||||||
/// Wonderful limitation of mixing our streams with IJL--it wants either a filename
|
/// Wonderful limitation of mixing our streams with IJL--it wants either a filename
|
||||||
/// or a memory buffer. Since we can't give it the former, we have to read the entire
|
/// or a memory buffer. Since we can't give it the former, we have to read the entire
|
||||||
@ -142,11 +142,6 @@ plMipmap *plJPEG::IRead( hsStream *inStream )
|
|||||||
/// have to write/read a length of said buffer. Such is life, I guess...
|
/// have to write/read a length of said buffer. Such is life, I guess...
|
||||||
jpegSourceSize = inStream->ReadLE32();
|
jpegSourceSize = inStream->ReadLE32();
|
||||||
jpegSourceBuffer = new uint8_t[ jpegSourceSize ];
|
jpegSourceBuffer = new uint8_t[ jpegSourceSize ];
|
||||||
if( jpegSourceBuffer == nil )
|
|
||||||
{
|
|
||||||
// waah.
|
|
||||||
ERREXIT1( &cinfo, JERR_OUT_OF_MEMORY, 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
inStream->Read( jpegSourceSize, jpegSourceBuffer );
|
inStream->Read( jpegSourceSize, jpegSourceBuffer );
|
||||||
jpeg_mem_src( &cinfo, jpegSourceBuffer, jpegSourceSize );
|
jpeg_mem_src( &cinfo, jpegSourceBuffer, jpegSourceSize );
|
||||||
@ -183,11 +178,6 @@ plMipmap *plJPEG::IRead( hsStream *inStream )
|
|||||||
/// Construct a new mipmap to hold everything
|
/// Construct a new mipmap to hold everything
|
||||||
newMipmap = new plMipmap( cinfo.output_width, cinfo.output_height, plMipmap::kRGB32Config, 1, plMipmap::kJPEGCompression );
|
newMipmap = new plMipmap( cinfo.output_width, cinfo.output_height, plMipmap::kRGB32Config, 1, plMipmap::kJPEGCompression );
|
||||||
|
|
||||||
if( newMipmap == nil || newMipmap->GetImage() == nil )
|
|
||||||
{
|
|
||||||
ERREXIT1( &cinfo, JERR_OUT_OF_MEMORY, 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Set up to read in to that buffer we now have
|
/// Set up to read in to that buffer we now have
|
||||||
JSAMPROW jbuffer;
|
JSAMPROW jbuffer;
|
||||||
int row_stride = cinfo.output_width * cinfo.output_components;
|
int row_stride = cinfo.output_width * cinfo.output_components;
|
||||||
@ -216,7 +206,7 @@ plMipmap *plJPEG::IRead( hsStream *inStream )
|
|||||||
// Sometimes life just sucks
|
// Sometimes life just sucks
|
||||||
ISwapRGBAComponents( (uint32_t *)newMipmap->GetImage(), newMipmap->GetWidth() * newMipmap->GetHeight() );
|
ISwapRGBAComponents( (uint32_t *)newMipmap->GetImage(), newMipmap->GetWidth() * newMipmap->GetHeight() );
|
||||||
}
|
}
|
||||||
catch( ... )
|
catch (...)
|
||||||
{
|
{
|
||||||
delete newMipmap;
|
delete newMipmap;
|
||||||
newMipmap = nil;
|
newMipmap = nil;
|
||||||
@ -282,10 +272,6 @@ bool plJPEG::IWrite( plMipmap *source, hsStream *outStream )
|
|||||||
// Create a buffer to hold the data
|
// Create a buffer to hold the data
|
||||||
jpgBufferSize = source->GetWidth() * source->GetHeight() * 3;
|
jpgBufferSize = source->GetWidth() * source->GetHeight() * 3;
|
||||||
jpgBuffer = new uint8_t[ jpgBufferSize ];
|
jpgBuffer = new uint8_t[ jpgBufferSize ];
|
||||||
if( jpgBuffer == nil )
|
|
||||||
{
|
|
||||||
ERREXIT1( &cinfo, JERR_OUT_OF_MEMORY, 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t *bufferAddr = jpgBuffer;
|
uint8_t *bufferAddr = jpgBuffer;
|
||||||
unsigned long bufferSize = jpgBufferSize;
|
unsigned long bufferSize = jpgBufferSize;
|
||||||
@ -338,7 +324,7 @@ bool plJPEG::IWrite( plMipmap *source, hsStream *outStream )
|
|||||||
outStream->WriteLE32( bufferSize );
|
outStream->WriteLE32( bufferSize );
|
||||||
outStream->Write( bufferSize, bufferAddr );
|
outStream->Write( bufferSize, bufferAddr );
|
||||||
}
|
}
|
||||||
catch( ... )
|
catch (...)
|
||||||
{
|
{
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
|
@ -95,21 +95,21 @@ plMipmap* plPNG::IRead(hsStream* inStream)
|
|||||||
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||||
|
|
||||||
if (!png_ptr) {
|
if (!png_ptr) {
|
||||||
throw(false);
|
throw false;
|
||||||
}
|
}
|
||||||
|
|
||||||
info_ptr = png_create_info_struct(png_ptr);
|
info_ptr = png_create_info_struct(png_ptr);
|
||||||
|
|
||||||
if (!info_ptr) {
|
if (!info_ptr) {
|
||||||
png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL);
|
png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL);
|
||||||
throw(false);
|
throw false;
|
||||||
}
|
}
|
||||||
|
|
||||||
end_info = png_create_info_struct(png_ptr);
|
end_info = png_create_info_struct(png_ptr);
|
||||||
|
|
||||||
if (!end_info) {
|
if (!end_info) {
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
|
||||||
throw(false);
|
throw false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assign delegate function for reading from hsStream
|
// Assign delegate function for reading from hsStream
|
||||||
@ -169,10 +169,8 @@ plMipmap* plPNG::IRead(hsStream* inStream)
|
|||||||
delete [] row_ptrs;
|
delete [] row_ptrs;
|
||||||
}
|
}
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
if (newMipmap != NULL) {
|
delete newMipmap;
|
||||||
delete newMipmap;
|
newMipmap = nullptr;
|
||||||
newMipmap = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return newMipmap;
|
return newMipmap;
|
||||||
@ -200,14 +198,14 @@ bool plPNG::IWrite(plMipmap* source, hsStream* outStream)
|
|||||||
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||||
|
|
||||||
if (!png_ptr) {
|
if (!png_ptr) {
|
||||||
throw(false);
|
throw false;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_infop info_ptr = png_create_info_struct(png_ptr);
|
png_infop info_ptr = png_create_info_struct(png_ptr);
|
||||||
|
|
||||||
if (!info_ptr) {
|
if (!info_ptr) {
|
||||||
png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
|
png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
|
||||||
throw(false);
|
throw false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assign delegate function for writing to hsStream
|
// Assign delegate function for writing to hsStream
|
||||||
|
@ -191,7 +191,19 @@ int plSDLMgr::Read(hsStream* s, plSDL::DescriptorList* dl)
|
|||||||
delete sd; // well that sucked
|
delete sd; // well that sucked
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(...)
|
catch (std::exception &e)
|
||||||
|
{
|
||||||
|
if (fNetApp)
|
||||||
|
{
|
||||||
|
hsLogEntry(fNetApp->DebugMsg("Something bad happened while reading SDLMgr data: %s", e.what()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DebugMsg("Something bad happened while reading SDLMgr data: %s", e.what());
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
{
|
{
|
||||||
if (fNetApp)
|
if (fNetApp)
|
||||||
{
|
{
|
||||||
|
@ -274,9 +274,16 @@ bool plStateDataRecord::Read(hsStream* s, float timeConvert, uint32_t readOption
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(...)
|
catch (std::exception &e)
|
||||||
{
|
{
|
||||||
hsAssert( false,
|
hsAssert(false,
|
||||||
|
plFormat("Something bad happened ({}) while reading simple var data, desc:{}",
|
||||||
|
e.what(), fDescriptor ? fDescriptor->GetName() : "?").c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
hsAssert(false,
|
||||||
plFormat("Something bad happened while reading simple var data, desc:{}",
|
plFormat("Something bad happened while reading simple var data, desc:{}",
|
||||||
fDescriptor ? fDescriptor->GetName() : "?").c_str());
|
fDescriptor ? fDescriptor->GetName() : "?").c_str());
|
||||||
return false;
|
return false;
|
||||||
@ -308,9 +315,16 @@ bool plStateDataRecord::Read(hsStream* s, float timeConvert, uint32_t readOption
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(...)
|
catch (std::exception &e)
|
||||||
{
|
{
|
||||||
hsAssert( false,
|
hsAssert(false,
|
||||||
|
plFormat("Something bad happened ({}) while reading nested var data, desc:{}",
|
||||||
|
e.what(), fDescriptor ? fDescriptor->GetName() : "?").c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
hsAssert(false,
|
||||||
plFormat("Something bad happened while reading nested var data, desc:{}",
|
plFormat("Something bad happened while reading nested var data, desc:{}",
|
||||||
fDescriptor ? fDescriptor->GetName() : "?").c_str());
|
fDescriptor ? fDescriptor->GetName() : "?").c_str());
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user