|
From: <axl...@us...> - 2010-01-15 21:54:07
|
Revision: 663
http://hgengine.svn.sourceforge.net/hgengine/?rev=663&view=rev
Author: axlecrusher
Date: 2010-01-15 21:53:59 +0000 (Fri, 15 Jan 2010)
Log Message:
-----------
add more debugging options
Modified Paths:
--------------
Mercury2/src/Mercury2.cpp
Modified: Mercury2/src/Mercury2.cpp
===================================================================
--- Mercury2/src/Mercury2.cpp 2010-01-15 21:52:17 UTC (rev 662)
+++ Mercury2/src/Mercury2.cpp 2010-01-15 21:53:59 UTC (rev 663)
@@ -21,6 +21,13 @@
#include <MercuryLog.h>
+#ifdef WIN32DBGMEM
+#define _CRTDBG_MAP_ALLOC
+#include <stdlib.h>
+#include <crtdbg.h>
+#endif
+
+
#define MULTIPASS
bool SHOWBOUNDINGVOLUME = false;
@@ -42,9 +49,9 @@
{
char buffer[2048];
LOG.Write(ssprintf( "Fatal error encountered in Mercury 2: %s", cn_get_crash_description( signal ) ));
- cnget_backtrace( 1, buffer, 2047 );
-
- //XXX: Sometimes we produce a crash, we get the crash report, and the next line doesn't work... This should be examined.
+ cnget_backtrace( 1, buffer, 2047 );
+
+ //XXX: Sometimes we produce a crash, we get the crash report, and the next line doesn't work... This should be examined.
LOG.Write( buffer );
return 0; //Continue regular crash.
@@ -95,15 +102,20 @@
int main( int argc, char** argv)
{
+#ifdef WIN32DBGMEM
+ _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
+#endif
unsigned long m_count = 0;
g_SceneGraphToLoad = "FILE:scenegraph.xml";
+#ifndef NOCRAHSHANDLE
cnset_execute_on_crash( SignalHandler );
+#endif
HandleCommandLineParameters( argc, argv );
-
- //Sound first.
- SOUNDMAN->Init( "" );
+
+ //Sound first.
+ SOUNDMAN->Init( "" );
MercuryWindow* w = MercuryWindow::MakeWindow();
#ifdef WIN32
@@ -168,19 +180,19 @@
float batches = MercuryVBO::ResetBatchCount()/(float)m_count;
float VBinds = MercuryVBO::ResetBindCount()/(float)m_count;
float Tbinds = Texture::ReadAndResetBindCount()/(float)m_count;
- LOG.Write( ssprintf("FPS: %f, VBO batches %f, TBinds %f, VBinds %f", m_count/fpsTimer.Age(), batches, Tbinds, VBinds) );
+ LOG.Write( ssprintf("FPS: %f, VBO batches %f, TBinds %f, VBinds %f", m_count/fpsTimer.Age(), batches, Tbinds, VBinds) );
#ifdef GL_PROFILE
float GLcalls = GLCALLCOUNT/(float)m_count;
GLCALLCOUNT = 0;
- LOG.Write( ssprintf("GL/f: %f", GLcalls) );
+ LOG.Write( ssprintf("GL/f: %f", GLcalls) );
#endif
m_count = 0;
fpsTimer = timer;
- }
-
-//Uncomment to enable scenegraph saving.
-// MString st;
-// root->SaveToXML( st );
+ }
+
+//Uncomment to enable scenegraph saving.
+// MString st;
+// root->SaveToXML( st );
// StringToFile( "test.xml", st );
}
while ( w->PumpMessages() );
@@ -199,30 +211,30 @@
// printf("Render wait %%%f\n", (RenderWaited/double(totalWaited))*100.0f);
return 0;
-}
-
-
-
-
-
-///XXXXXXXX STUB CODE XXXXXXXXXXX THIS CODE SHOULD BE REMOVED AS SOON AS TESTING OF THE VARIABLE SYSTEM IS COMPLETE
-class TestMouse
-{
-public:
- TestMouse()
- {
- MESSAGEMAN.GetValue( "TestMode" )->AttachModifyDelegate( (ValueDelegate)&TestMouse::ChangeX, (MessageHandler*)this );
- }
-
- void ChangeX( MValue * v )
- {
- printf( "Changed: %s\n", v->GetString().c_str() );
- }
-} TM;
-///XXXXXXX REMOVE THIS CODE BEFORE ANY RELEASE XXXXXXXXXXx
-
+}
+
+
+
+///XXXXXXXX STUB CODE XXXXXXXXXXX THIS CODE SHOULD BE REMOVED AS SOON AS TESTING OF THE VARIABLE SYSTEM IS COMPLETE
+class TestMouse
+{
+public:
+ TestMouse()
+ {
+ MESSAGEMAN.GetValue( "TestMode" )->AttachModifyDelegate( (ValueDelegate)&TestMouse::ChangeX, (MessageHandler*)this );
+ }
+
+ void ChangeX( MValue * v )
+ {
+ printf( "Changed: %s\n", v->GetString().c_str() );
+ }
+} TM;
+///XXXXXXX REMOVE THIS CODE BEFORE ANY RELEASE XXXXXXXXXXx
+
+
+
/* Copyright (c) 2008, Joshua Allen
* All rights reserved.
*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|