<commit_before>
#include "stdafx.h"

#include "foundation/PxAssert.h"
#include "RendererConfig.h"
#include "SampleCommandLine.h"
#include "RendererMemoryMacros.h"
#include "SampleAllocator.h"
#include "PhysXSampleApplication.h"
#include "PsFile.h"
#include "EvolvedVirtualCreatures.h"
extern SDbgConfig *g_pDbgConfig;

//#include "vld/vld.h"
MEMORYMONITOR_INNER_PROCESS();



using namespace SampleFramework;

static PhysXSampleApplication* gApp = NULL;
static SampleSetup gSettings;
static SampleCommandLine* gSampleCommandLine = NULL;

#define SEPARATE_EVENT_LOOP 1


void mainInitialize()
{
	PX_ASSERT(gSampleCommandLine);
	const SampleCommandLine& cmdline = *gSampleCommandLine;
	initSampleAllocator();
	gApp = SAMPLE_NEW(PhysXSampleApplication)(cmdline);

	gApp->customizeSample(gSettings);
	gSettings.mName = "Evolved Virtual Creature";

	if (gApp->isOpen())
		gApp->close();

	gApp->open(gSettings.mWidth, gSettings.mHeight, gSettings.mName, gSettings.mFullscreen);

#if SEPARATE_EVENT_LOOP
	gApp->start(Ps::Thread::getDefaultStackSize());
#else
	if(gApp->isOpen()) gApp->onOpen();
#endif

	class PxAssertHandler2 : public PxAssertHandler
	{
		virtual void operator()(const char* exp, const char* file, int line, bool& ignore) {
			assert(exp);
		}
	};
	static PxAssertHandler2 assertHandler;
	physx::PxSetAssertHandler( assertHandler );

	if (!memmonitor::Init(memmonitor::INNER_PROCESS,(HINSTANCE)::GetModuleHandle(0),"config_evc.json" ))
	//if (!memmonitor::Init(memmonitor::INNER_PROCESS, NULL,"config_evc.json" ))
	{
	//	MessageBoxA(NULL, memmonitor::GetLastError().c_str(), "ERROR", MB_OK);
		//assert(0);
	}
}

void mainTerminate()
{
	memmonitor::Cleanup();
	DELETESINGLE(gApp);
	DELETESINGLE(gSampleCommandLine);
	releaseSampleAllocator();	
}


bool mainContinue()
{
	if (gApp->isOpen() && !gApp->isCloseRequested())
	{
		if(gApp->getInputMutex().trylock())<commit_msg>init wxMemMonitor by compiler option<commit_after>
#include "stdafx.h"

#include "foundation/PxAssert.h"
#include "RendererConfig.h"
#include "SampleCommandLine.h"
#include "RendererMemoryMacros.h"
#include "SampleAllocator.h"
#include "PhysXSampleApplication.h"
#include "PsFile.h"
#include "EvolvedVirtualCreatures.h"
extern SDbgConfig *g_pDbgConfig;

//#include "vld/vld.h"
MEMORYMONITOR_INNER_PROCESS();



using namespace SampleFramework;

static PhysXSampleApplication* gApp = NULL;
static SampleSetup gSettings;
static SampleCommandLine* gSampleCommandLine = NULL;

#define SEPARATE_EVENT_LOOP 1


void mainInitialize()
{
	PX_ASSERT(gSampleCommandLine);
	const SampleCommandLine& cmdline = *gSampleCommandLine;
	initSampleAllocator();
	gApp = SAMPLE_NEW(PhysXSampleApplication)(cmdline);

	gApp->customizeSample(gSettings);
	gSettings.mName = "Evolved Virtual Creature";

	if (gApp->isOpen())
		gApp->close();

	gApp->open(gSettings.mWidth, gSettings.mHeight, gSettings.mName, gSettings.mFullscreen);

#if SEPARATE_EVENT_LOOP
	gApp->start(Ps::Thread::getDefaultStackSize());
#else
	if(gApp->isOpen()) gApp->onOpen();
#endif

	class PxAssertHandler2 : public PxAssertHandler
	{
		virtual void operator()(const char* exp, const char* file, int line, bool& ignore) {
			assert(exp);
		}
	};
	static PxAssertHandler2 assertHandler;
	physx::PxSetAssertHandler( assertHandler );

#ifdef PX_CHECKED
	string configFileName = "config_evc_checked.json";
#elif PX_DEBUG
	string configFileName = "config_evc_debug.json";
#endif

	if (!memmonitor::Init(memmonitor::INNER_PROCESS,(HINSTANCE)::GetModuleHandle(0), configFileName))
	//if (!memmonitor::Init(memmonitor::INNER_PROCESS, NULL,"config_evc.json" ))
	{
	//	MessageBoxA(NULL, memmonitor::GetLastError().c_str(), "ERROR", MB_OK);
		//assert(0);
	}


}

void mainTerminate()
{
	memmonitor::Cleanup();
	DELETESINGLE(gApp);
	DELETESINGLE(gSampleCommandLine);
	releaseSampleAllocator();	
}


bool mainContinue()
{
	if (gApp->isOpen() && !gApp->isCloseRequested())
	{
		if(gApp->getInputMutex().trylock())
{'fraction_non_alphanumeric': 0.13882532418001525, 'fraction_numerical': 0.0025425883549453345, 'mean_word_length': 6.995934959349594, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4531336', 'n_tokens_mistral': 1432, 'n_tokens_neox': 1394, 'n_words': 245}