コード例 #1
0
ファイル: script_engine.cpp プロジェクト: denanden/xray-16
static void finalize_lua_studio		( lua_State* state, cs::lua_studio::world*& world, lua_studio_engine*& engine)
{
    world->remove					(state);

    VERIFY							(world);
    s_destroy_world					(world);
    world							= 0;

    VERIFY							(engine);
    xr_delete						(engine);

    FreeLibrary						(s_script_debugger_handle);
    s_script_debugger_handle		= 0;

    SetLogCB						(s_old_log_callback);
}
コード例 #2
0
ファイル: script_engine.cpp プロジェクト: denanden/xray-16
static void initialize_lua_studio	( lua_State* state, cs::lua_studio::world*& world, lua_studio_engine*& engine)
{
    engine							= 0;
    world							= 0;

    u32 const old_error_mode		= SetErrorMode(SEM_FAILCRITICALERRORS);
    s_script_debugger_handle		= LoadLibrary(CS_LUA_STUDIO_BACKEND_FILE_NAME);
    SetErrorMode					(old_error_mode);
    if (!s_script_debugger_handle) {
        Msg							("! cannot load %s dynamic library", CS_LUA_STUDIO_BACKEND_FILE_NAME);
        return;
    }

    R_ASSERT2						(s_script_debugger_handle, "can't load script debugger library");

    s_create_world					= (create_world_function_type)
        GetProcAddress(
        s_script_debugger_handle,
        "_cs_lua_studio_backend_create_world@12"
        );
    R_ASSERT2						(s_create_world, "can't find function \"cs_lua_studio_backend_create_world\"");

    s_destroy_world					= (destroy_world_function_type)
        GetProcAddress(
        s_script_debugger_handle,
        "_cs_lua_studio_backend_destroy_world@4"
        );
    R_ASSERT2						(s_destroy_world, "can't find function \"cs_lua_studio_backend_destroy_world\" in the library");

    engine							= xr_new<lua_studio_engine>();
    world							= s_create_world( *engine, false, false );
    VERIFY							(world);

    s_old_log_callback				= SetLogCB(&log_callback);

#ifdef USE_LUAJIT_ONE
    jit_command						(state, "debug=2");
    jit_command						(state, "off");
#else
    luaJIT_setmode(lua(), 0, LUAJIT_MODE_ENGINE | LUAJIT_MODE_OFF);
#endif

    world->add						(state);
}
コード例 #3
0
ファイル: script_engine.cpp プロジェクト: 2asoft/xray
static void initialize_lua_studio	( lua_State* state, cs::lua_debugger::world*& world, lua_studio_engine*& engine)
{
	engine							= 0;
	world							= 0;

	u32 const old_error_mode		= SetErrorMode(SEM_FAILCRITICALERRORS);
	s_script_debugger_handle		= LoadLibrary(CS_LUA_DEBUGGER_FILE_NAME);
	SetErrorMode					(old_error_mode);
	if (!s_script_debugger_handle) {
		Msg							("! cannot load %s dynamic library", CS_LUA_DEBUGGER_FILE_NAME);
		return;
	}

	R_ASSERT2						(s_script_debugger_handle, "can't load script debugger library");

	s_create_world					= (create_world_function_type)
		GetProcAddress(
			s_script_debugger_handle,
			"_cs_script_debugger_create_world@4"
		);
	R_ASSERT2						(s_create_world, "can't find function \"create_world\"");

	s_destroy_world					= (destroy_world_function_type)
		GetProcAddress(
			s_script_debugger_handle,
			"_cs_script_debugger_destroy_world@4"
		);
	R_ASSERT2						(s_destroy_world, "can't find function \"destroy_world\" in the library");

	engine							= new lua_studio_engine();
	world							= s_create_world(*engine);
	VERIFY							(world);

	s_old_log_callback				= SetLogCB(&log_callback);

	jit_command						(state, "debug=2");
	jit_command						(state, "off");

	world->add						(state);
}
コード例 #4
0
ファイル: Stats.cpp プロジェクト: AntonioModer/xray-16
void CStats::OnDeviceCreate			()
{
	g_bDisableRedText				= strstr(Core.Params,"-xclsx")?TRUE:FALSE;

//	if (!strstr(Core.Params, "-dedicated"))
#ifndef DEDICATED_SERVER
	pFont	= xr_new<CGameFont>		("stat_font", CGameFont::fsDeviceIndependent);
#endif
	
	if(!pSettings->section_exist("evaluation")
		||!pSettings->line_exist("evaluation","line1")
		||!pSettings->line_exist("evaluation","line2")
		||!pSettings->line_exist("evaluation","line3") )
		FATAL	("");

	eval_line_1 = pSettings->r_string_wb("evaluation","line1");
	eval_line_2 = pSettings->r_string_wb("evaluation","line2");
	eval_line_3 = pSettings->r_string_wb("evaluation","line3");

	// 
#ifdef DEBUG
	if (!g_bDisableRedText)			SetLogCB	(_LogCallback);
#endif
}
コード例 #5
0
ファイル: xrCore.cpp プロジェクト: OLR-xray/OLR-3.0
void xrCore::_initialize	(LPCSTR _ApplicationName, LogCallback cb, BOOL init_fs, LPCSTR fs_fname)
{
	strcpy_s					(ApplicationName,_ApplicationName);
	if (0==init_counter) {
#ifdef XRCORE_STATIC	
		_clear87	();
		_control87	( _PC_53,   MCW_PC );
		_control87	( _RC_CHOP, MCW_RC );
		_control87	( _RC_NEAR, MCW_RC );
		_control87	( _MCW_EM,  MCW_EM );
#endif
		// Init COM so we can use CoCreateInstance
//		HRESULT co_res = 
			CoInitializeEx (NULL, COINIT_MULTITHREADED);

		strcpy_s			(Params,sizeof(Params),GetCommandLine());
		_strlwr_s			(Params,sizeof(Params));

		string_path		fn,dr,di;

		// application path
        GetModuleFileName(GetModuleHandle(MODULE_NAME),fn,sizeof(fn));
        _splitpath		(fn,dr,di,0,0);
        strconcat		(sizeof(ApplicationPath),ApplicationPath,dr,di);
#ifndef _EDITOR
		strcpy_s		(g_application_path,sizeof(g_application_path),ApplicationPath);
#endif

		// working path
        if( strstr(Params,"-wf") )
        {
            string_path				c_name;
            sscanf					(strstr(Core.Params,"-wf ")+4,"%[^ ] ",c_name);
            SetCurrentDirectory     (c_name);

        }
		GetCurrentDirectory(sizeof(WorkingPath),WorkingPath);
		// User/Comp Name
		DWORD	sz_user		= sizeof(UserName);
		GetUserName			(UserName,&sz_user);

		DWORD	sz_comp		= sizeof(CompName);
		GetComputerName		(CompName,&sz_comp);

		// Mathematics & PSI detection
		CPU::Detect			();
		
		Memory._initialize	(strstr(Params,"-mem_debug") ? TRUE : FALSE);
		
		DUMP_PHASE;

		InitLog				();
		_initialize_cpu		();

#ifdef DEBUG
	#ifndef DEDICATED_SERVER
		Debug._initialize	(FALSE);
	#else
		Debug._initialize	(TRUE);
	#endif
#endif
		rtc_initialize		();

		xr_FS				= xr_new<CLocatorAPI>	();

		xr_EFS				= xr_new<EFS_Utils>		();
//.		R_ASSERT			(co_res==S_OK);
	}
	if (init_fs){
		u32 flags			= 0;
		if (0!=strstr(Params,"-build"))	 flags |= CLocatorAPI::flBuildCopy;
		if (0!=strstr(Params,"-ebuild")) flags |= CLocatorAPI::flBuildCopy|CLocatorAPI::flEBuildCopy;
#ifdef DEBUG
		if (strstr(Params,"-cache"))  flags |= CLocatorAPI::flCacheFiles;
		else flags &= ~CLocatorAPI::flCacheFiles;
#endif // DEBUG
#ifdef _EDITOR // for EDITORS - no cache
		flags 				&=~ CLocatorAPI::flCacheFiles;
#endif // _EDITOR
		flags |= CLocatorAPI::flScanAppRoot;

#ifndef	_EDITOR
	#ifndef ELocatorAPIH
		if (0!=strstr(Params,"-file_activity"))	 flags |= CLocatorAPI::flDumpFileActivity;
	#endif
#endif
		FS._initialize		(flags,0,fs_fname);
		Msg					("'%s' build %d, %s\n","xrCore",build_id, build_date);
		EFS._initialize		();
#ifdef DEBUG
    #ifndef	_EDITOR
		Msg					("CRT heap 0x%08x",_get_heap_handle());
		Msg					("Process heap 0x%08x",GetProcessHeap());
    #endif
#endif // DEBUG
	}
	
	SetLogCB				(cb);

	LPAPI_VERSION ver = ImagehlpApiVersion();
	if ( NULL == GetProcAddress ( GetModuleHandle("dbghelp.dll"), "EnumerateLoadedModulesEx") )
	{
		string256 msg;		
		DWORD dwVer[2];
		WORD *v4 = (WORD*) &dwVer;
		CSymbolEngine SE;
		SE.GetInMemoryFileVersion("dbghelp.dll", dwVer[0], dwVer[1]);

		sprintf_s(msg, 256, "”старевший файл dbghelp.dll (%d.%d.%d.%d), его рекомендуетс¤ удалить.", 
								v4[1], v4[0], v4[3], v4[2]);
		MessageBox(NULL, msg, "DebugHlp Warning", MB_OK);
	}

	init_counter++;
}
コード例 #6
0
ファイル: Stats.cpp プロジェクト: AntonioModer/xray-16
void CStats::OnDeviceDestroy		()
{
	SetLogCB(0);
	xr_delete	(pFont);
}