Skip to content
Snippets Groups Projects
Select Git revision
  • a2c7425bbbb56313fcc57de59249636f129fe6eb
  • branchX default protected
  • Inventory
  • UIControls
  • fsv2
  • tonetest
  • from_nb
  • tonemapping
  • opt-shadows
  • BX-634
  • xCSG
  • hc
  • gizmos
  • gui2CSSLexer
  • msExporter
  • gui2
  • gui2Fix
  • master protected
  • pk
  • mesh_optimize
  • light_wip
  • version_X.11.2 protected
  • version_X.11.1 protected
  • version_X.11.1-dev protected
  • version_X.11.0-dev protected
  • version_X.10.1 protected
  • version_X.10.1-dev protected
  • version_X.10.0-dev protected
  • version_X.9.5 protected
  • version_X.9.4 protected
  • version_X.9.3 protected
  • version_X.9.3-dev protected
  • version_X.9.2-dev protected
  • version_X.9.1-dev protected
  • version_X.9.0-dev protected
  • version_X.8.2 protected
  • version_X.8.2-dev protected
  • version_X.8.1-dev protected
  • version_X.8.0-dev protected
  • version_X.7.1 protected
  • version_X.7.0 protected
41 results

Engine.cpp

Blame
  • Engine.cpp 18.09 KiB
    #include "Engine.h"
    #include <core/task.h>
    #include <GRegisterIndex.h>
    
    #include <core/taskmanager.h>
    
    #include "SkyXEngine.h"
    
    #include <xcommon/IXSoundSystem.h>
    
    #ifdef _DEBUG
    #	pragma comment(lib, "sxcore_d.lib")
    #else
    #	pragma comment(lib, "sxcore.lib")
    #endif
    
    #ifdef USE_BREAKPAD
    #	pragma comment(lib, "crash_generation_client.lib")
    #	pragma comment(lib, "exception_handler.lib")
    #	pragma comment(lib, "common.lib")
    #endif
    
    class CMainLoopTask: public ITaskImpl<ITask>
    {
    public:
    	CMainLoopTask(CEngine *pEngine):
    		m_pEngine(pEngine),
    		ITaskImpl(CORE_TASK_FLAG_MAINTHREAD_REPEATING)
    	{
    	}
    
    	void run() override
    	{
    		if(!m_pEngine->runFrame())
    		{
    			XCoreStop();
    		}
    	}
    
    protected:
    	CEngine *m_pEngine;
    };
    
    //##########################################################################
    
    #ifdef USE_BREAKPAD
    static bool HandleCrashDump(const wchar_t *wszDumpPath, const wchar_t* wszMinidumpId, void* pContext, EXCEPTION_POINTERS* pExInfo, MDRawAssertionInfo* pAssertion, bool isSucceeded)
    {
    	wchar_t *pCrashReporter = (wchar_t*)pContext;
    	if(isSucceeded)
    	{
    		wcscat(pCrashReporter, wszMinidumpId);
    		STARTUPINFOW info = {sizeof(info)};
    		PROCESS_INFORMATION processInfo;
    		if(CreateProcessW(NULL, pCrashReporter, NULL, NULL, TRUE, 0, NULL, NULL, &info, &processInfo))
    		{
    			CloseHandle(processInfo.hProcess);
    			CloseHandle(processInfo.hThread);
    		}
    	}
    	else
    	{
    		MessageBoxW(NULL, L"Program has crashed. Failed to write crashdump.", L"Crashed!", MB_OK | MB_ICONSTOP);
    	}
    	//MessageBoxW(NULL, wszMinidumpId, pCrashReporter, MB_OK | MB_ICONSTOP);
    	return(true);
    }
    #endif
    
    //##########################################################################