diff --git a/src/editors/ECore/Editor/ELog.cpp b/src/editors/ECore/Editor/ELog.cpp index b52cb739598..c78afd834ce 100644 --- a/src/editors/ECore/Editor/ELog.cpp +++ b/src/editors/ECore/Editor/ELog.cpp @@ -23,7 +23,7 @@ #ifdef _LW_EXPORT #include extern "C" LWMessageFuncs *g_msg; - void ELogCallback(LPCSTR txt) + void ELogCallback(void *context, LPCSTR txt) { if (0==txt[0]) return; bool bDlg = ('#'==txt[0])||((0!=txt[1])&&('#'==txt[1])); @@ -38,7 +38,7 @@ #endif #ifdef _MAX_EXPORT #include "NetDeviceLog.h" - void ELogCallback(LPCSTR txt) + void ELogCallback(void *context, LPCSTR txt) { if (0!=txt[0]){ if (txt[0]=='!')EConsole.print(mtError,txt+1); @@ -47,7 +47,7 @@ } #endif #ifdef _MAYA_PLUGIN - void ELogCallback(LPCSTR txt) + void ELogCallback(void *context, LPCSTR txt) { if (0!=txt[0]){ if (txt[0]=='!')std::cerr << "XR-Error: " << txt+1 << "\n"; diff --git a/src/editors/ECore/Editor/ELog.h b/src/editors/ECore/Editor/ELog.h index 1b4f1aa7c99..bef7f68670f 100644 --- a/src/editors/ECore/Editor/ELog.h +++ b/src/editors/ECore/Editor/ELog.h @@ -15,7 +15,7 @@ class ECORE_API CLog{ int DlgMsg (TMsgDlgType mt, TMsgDlgButtons btn, LPCSTR _Format, ...); }; -void ECORE_API ELogCallback(LPCSTR txt); +void ECORE_API ELogCallback(void *context, LPCSTR txt); extern ECORE_API CLog ELog; diff --git a/src/engine.sln b/src/engine.sln index 465da24b2b1..ea1c85bcf90 100644 --- a/src/engine.sln +++ b/src/engine.sln @@ -22,8 +22,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenAL32", "3rd party\opena EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrD3D9-Null", "xrD3D9-Null\xrD3D9-Null.vcxproj", "{0899B131-F1D4-4876-9BA1-67AC821DB9E1}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrCoreStatic", "xrCore\xrCoreStatic.vcxproj", "{F1066EAC-EE25-4C7A-9023-5957A6F7BA27}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CompressionTest", "utils\CompressionTest\CompressionTest.vcxproj", "{C961EA19-716C-4A6D-BB13-689F8FB78B01}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ctool", "utils\ctool\ctool.vcxproj", "{2FAAC8BA-369F-465E-B465-2235963FD377}" @@ -216,27 +214,6 @@ Global {0899B131-F1D4-4876-9BA1-67AC821DB9E1}.Release|Mixed Platforms.Build.0 = Release|Win32 {0899B131-F1D4-4876-9BA1-67AC821DB9E1}.Release|Win32.ActiveCfg = Release|Win32 {0899B131-F1D4-4876-9BA1-67AC821DB9E1}.Release|Win32.Build.0 = Release|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Debug_Dedicated|Mixed Platforms.ActiveCfg = Debug|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Debug_Dedicated|Mixed Platforms.Build.0 = Debug|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Debug|Win32.ActiveCfg = Debug|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Debug|Win32.Build.0 = Debug|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Mixed_Dedicated|Mixed Platforms.ActiveCfg = Mixed|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Mixed_Dedicated|Mixed Platforms.Build.0 = Mixed|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Mixed_Dedicated|Win32.ActiveCfg = Mixed|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Mixed|Mixed Platforms.ActiveCfg = Mixed|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Mixed|Mixed Platforms.Build.0 = Mixed|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Mixed|Win32.ActiveCfg = Mixed|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Mixed|Win32.Build.0 = Mixed|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Release_Dedicated|Mixed Platforms.ActiveCfg = Release|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Release_Dedicated|Mixed Platforms.Build.0 = Release|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Release|Mixed Platforms.Build.0 = Release|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Release|Win32.ActiveCfg = Release|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Release|Win32.Build.0 = Release|Win32 {C961EA19-716C-4A6D-BB13-689F8FB78B01}.Debug_Dedicated|Mixed Platforms.ActiveCfg = Debug|Win32 {C961EA19-716C-4A6D-BB13-689F8FB78B01}.Debug_Dedicated|Mixed Platforms.Build.0 = Debug|Win32 {C961EA19-716C-4A6D-BB13-689F8FB78B01}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 @@ -1348,7 +1325,6 @@ Global {1BF75FEB-87DD-486C-880B-227987D191C2} = {2BFC806B-CE92-4EA4-8FE8-5F2EA54BA348} {566551F4-4EF1-4CB4-A131-F982E7606907} = {2BFC806B-CE92-4EA4-8FE8-5F2EA54BA348} {0899B131-F1D4-4876-9BA1-67AC821DB9E1} = {3FC858CB-4888-42FF-ABC5-82DAECB59C2C} - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27} = {A074ECE0-24F4-497F-99BD-AD45D5C51382} {C961EA19-716C-4A6D-BB13-689F8FB78B01} = {89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B} {2FAAC8BA-369F-465E-B465-2235963FD377} = {89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B} {65CBB9D0-FBC6-41A4-8316-F5E9B5D7FB33} = {89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B} diff --git a/src/plugins/Max/Export/MeshExpPlugin.cpp b/src/plugins/Max/Export/MeshExpPlugin.cpp index 006d79af3c3..de81929fec0 100644 --- a/src/plugins/Max/Export/MeshExpPlugin.cpp +++ b/src/plugins/Max/Export/MeshExpPlugin.cpp @@ -34,7 +34,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) if ( !controlsInit ) { controlsInit = TRUE; - Core._initialize("S.T.A.L.K.E.R.Plugin",ELogCallback,FALSE); + Core._initialize("S.T.A.L.K.E.R.Plugin", LogCallback(ELogCallback, nullptr), FALSE, nullptr, true); FS._initialize (CLocatorAPI::flScanAppRoot,NULL,"xray_path.ltx"); FPU::m64r (); // ����� ����� ���� �� ��������� ���������� � 0 InitCustomControls(hInstance); diff --git a/src/plugins/Max/Export/Stdafx.h b/src/plugins/Max/Export/Stdafx.h index 1c10a84fef3..ba0c0cf31ed 100644 --- a/src/plugins/Max/Export/Stdafx.h +++ b/src/plugins/Max/Export/Stdafx.h @@ -12,6 +12,8 @@ #include "Max.h" #include "xrCore/xrCore.h" +#pragma comment(lib, "xrCore.lib") +#define _BCL #undef _MIN #undef _MAX diff --git a/src/plugins/Max/MAX_Export60.vcxproj b/src/plugins/Max/MAX_Export60.vcxproj index d1fc40bc70a..9f79cf2d5cb 100644 --- a/src/plugins/Max/MAX_Export60.vcxproj +++ b/src/plugins/Max/MAX_Export60.vcxproj @@ -90,7 +90,7 @@ Disabled $(DXSDK_DIR)Include;$(SolutionDir);$(XRAY_16X_LIBS)3dsmax/ver-6.0/include;$(XRAY_16X_LIBS)3dsmax/ver-6.0/cssdk/include;$(SolutionDir)plugins\shared;%(AdditionalIncludeDirectories) - DEBUG;WIN32;_WINDOWS;_USRDLL;_EXPORT;_MAX_EXPORT;_MAX_PLUGIN;XRCORE_STATIC;%(PreprocessorDefinitions) + DEBUG;WIN32;_WINDOWS;_USRDLL;_EXPORT;_MAX_EXPORT;_MAX_PLUGIN;%(PreprocessorDefinitions) true Sync EnableFastChecks @@ -112,7 +112,7 @@ /MACHINE:I386 %(AdditionalOptions) - mesh.lib;geom.lib;gfx.lib;maxutil.lib;core.lib;paramblk2.lib;comctl32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;xrcorestatic.lib;%(AdditionalDependencies) + mesh.lib;geom.lib;gfx.lib;maxutil.lib;core.lib;paramblk2.lib;comctl32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;%(AdditionalDependencies) $(OutDir)xray_export.dlu true $(XRAY_16X_LIBS)\bugtrap\bin;$(DXSDK_DIR)Lib\x86;$(XRAY_16X_LIBS)3dsmax/ver-6.0/lib;$(xrLibDir);$(xrSdkDir)libraries;%(AdditionalLibraryDirectories) @@ -135,7 +135,7 @@ AnySuitable true $(DXSDK_DIR)Include;$(SolutionDir);$(XRAY_16X_LIBS)3dsmax/ver-6.0/include;$(XRAY_16X_LIBS)3dsmax/ver-6.0/cssdk/include;$(SolutionDir)plugins\shared;%(AdditionalIncludeDirectories) - UTILITY_EXPORTS;WIN32;_WINDOWS;_USRDLL;_MAX_EXPORT;_MAX_PLUGIN;XRCORE_STATIC;%(PreprocessorDefinitions) + UTILITY_EXPORTS;WIN32;_WINDOWS;_USRDLL;_MAX_EXPORT;_MAX_PLUGIN;%(PreprocessorDefinitions) true false @@ -158,7 +158,7 @@ /MACHINE:I386 %(AdditionalOptions) - mesh.lib;geom.lib;gfx.lib;maxutil.lib;core.lib;paramblk2.lib;comctl32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;xrcorestatic.lib;%(AdditionalDependencies) + mesh.lib;geom.lib;gfx.lib;maxutil.lib;core.lib;paramblk2.lib;comctl32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;%(AdditionalDependencies) $(OutDir)xray_export.dlu true $(XRAY_16X_LIBS)\bugtrap\bin;$(DXSDK_DIR)Lib\x86;$(XRAY_16X_LIBS)3dsmax/ver-6.0/lib;$(xrLibDir);$(xrSdkDir)libraries;%(AdditionalLibraryDirectories) @@ -268,9 +268,8 @@ - - {f1066eac-ee25-4c7a-9023-5957a6f7ba27} - false + + {a0f7d1fb-59a7-4717-a7e4-96f37e91998e} diff --git a/src/plugins/Max/MAX_Material60.vcxproj b/src/plugins/Max/MAX_Material60.vcxproj index 6a55794e1e9..1838898666f 100644 --- a/src/plugins/Max/MAX_Material60.vcxproj +++ b/src/plugins/Max/MAX_Material60.vcxproj @@ -65,7 +65,7 @@ /LD %(AdditionalOptions) Disabled $(SolutionDir);$(XRAY_16X_LIBS)3dsmax/ver-6.0/include;$(XRAY_16X_LIBS)3dsmax/ver-6.0/cssdk/include;%(AdditionalIncludeDirectories) - DEBUG;WIN32;_WINDOWS;_USRDLL;_MAX_MATERIAL;_MAX_PLUGIN;XRCORE_STATIC;%(PreprocessorDefinitions) + DEBUG;WIN32;_WINDOWS;_USRDLL;_MAX_MATERIAL;_MAX_PLUGIN;%(PreprocessorDefinitions) true Sync MultiThreadedDLL @@ -85,7 +85,7 @@ /MACHINE:I386 %(AdditionalOptions) - Winmm.lib;comctl32.lib;bmm.lib;core.lib;geom.lib;gfx.lib;mesh.lib;maxutil.lib;maxscrpt.lib;manipsys.lib;paramblk2.lib;xrcorestatic.lib;%(AdditionalDependencies) + Winmm.lib;comctl32.lib;bmm.lib;core.lib;geom.lib;gfx.lib;mesh.lib;maxutil.lib;maxscrpt.lib;manipsys.lib;paramblk2.lib;%(AdditionalDependencies) $(OutDir)xray_material.dlt true $(DXSDK_DIR)Lib\x86;$(XRAY_16X_LIBS)BugTrap\Bin;$(XRAY_16X_LIBS)3dsmax/ver-6.0/lib;$(xrLibDir);$(xrSdkDir)libraries;%(AdditionalLibraryDirectories) @@ -109,7 +109,7 @@ /LD %(AdditionalOptions) OnlyExplicitInline $(SolutionDir);$(XRAY_16X_LIBS)3dsmax/ver-6.0/include;$(XRAY_16X_LIBS)3dsmax/ver-6.0/cssdk/include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;_MAX_MATERIAL;_MAX_PLUGIN;XRCORE_STATIC;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;_MAX_MATERIAL;_MAX_PLUGIN;%(PreprocessorDefinitions) true false @@ -131,7 +131,7 @@ /MACHINE:I386 %(AdditionalOptions) - Winmm.lib;comctl32.lib;core.lib;geom.lib;gfx.lib;mesh.lib;maxutil.lib;maxscrpt.lib;manipsys.lib;paramblk2.lib;xrcorestatic.lib;%(AdditionalDependencies) + Winmm.lib;comctl32.lib;core.lib;geom.lib;gfx.lib;mesh.lib;maxutil.lib;maxscrpt.lib;manipsys.lib;paramblk2.lib;%(AdditionalDependencies) $(OutDir)xray_material.dlt true $(DXSDK_DIR)Lib\x86;$(XRAY_16X_LIBS)BugTrap\Bin;$(XRAY_16X_LIBS)3dsmax/ver-6.0/lib;$(xrLibDir);$(xrSdkDir)libraries;%(AdditionalLibraryDirectories) @@ -177,9 +177,8 @@ - - {f1066eac-ee25-4c7a-9023-5957a6f7ba27} - false + + {a0f7d1fb-59a7-4717-a7e4-96f37e91998e} diff --git a/src/plugins/Max/Material/DllEntry.cpp b/src/plugins/Max/Material/DllEntry.cpp index dfe518580c3..39c4d72d9d7 100644 --- a/src/plugins/Max/Material/DllEntry.cpp +++ b/src/plugins/Max/Material/DllEntry.cpp @@ -18,7 +18,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, if(!controlsInit) { controlsInit = TRUE; - Core._initialize("S.T.A.L.K.E.R.Plugin",0,FALSE); + Core._initialize("S.T.A.L.K.E.R.Plugin", 0, FALSE, nullptr, true); FS._initialize (CLocatorAPI::flScanAppRoot,NULL,"xray_path.ltx"); FPU::m64r (); // ����� ����� ���� �� ��������� ���������� � 0 InitCustomControls(hInstance); // Initialize MAX's custom controls diff --git a/src/plugins/Max/Material/Stdafx.h b/src/plugins/Max/Material/Stdafx.h index 1c10a84fef3..1f5aa661389 100644 --- a/src/plugins/Max/Material/Stdafx.h +++ b/src/plugins/Max/Material/Stdafx.h @@ -12,6 +12,7 @@ #include "Max.h" #include "xrCore/xrCore.h" +#pragma comment(lib, "xrCore.lib") #undef _MIN #undef _MAX diff --git a/src/plugins/Maya/Export/Stdafx.h b/src/plugins/Maya/Export/Stdafx.h index 1f4804b5d4b..0a329284631 100644 --- a/src/plugins/Maya/Export/Stdafx.h +++ b/src/plugins/Maya/Export/Stdafx.h @@ -9,12 +9,14 @@ #define ENGINE_API #define _WIN32_WINNT 0x0500 #include "xrCore/xrCore.h" +#pragma comment(lib, "xrCore.lib") #pragma warning(push) #pragma warning(disable:4995) #include #define REQUIRE_IOSTREAM +#define _BCL #include #include #include diff --git a/src/plugins/Maya/Export/XRayExport.cpp b/src/plugins/Maya/Export/XRayExport.cpp index 0e1a8439f61..c7ccf35d0c1 100644 --- a/src/plugins/Maya/Export/XRayExport.cpp +++ b/src/plugins/Maya/Export/XRayExport.cpp @@ -47,9 +47,8 @@ void uninitialize(void*) MStatus initializePlugin( MObject obj ) { INIT_OBJ = obj; - Core._initialize("XRayMayaPlugin",ELogCallback,FALSE); + Core._initialize("XRayMayaPlugin", LogCallback(ELogCallback, nullptr), FALSE, nullptr, true); FS._initialize (CLocatorAPI::flScanAppRoot,NULL,"xray_path.ltx"); - R_ASSERT2(0!=Memory.mem_fill,"Incorrect xrCore.dll version."); MFnPlugin plugin( obj, "GSC Game World", "1.00", "Any"); diff --git a/src/plugins/Maya/Material/Stdafx.h b/src/plugins/Maya/Material/Stdafx.h index 25888a10313..5fb7ab59bf0 100644 --- a/src/plugins/Maya/Material/Stdafx.h +++ b/src/plugins/Maya/Material/Stdafx.h @@ -8,6 +8,7 @@ #define _WIN32_WINNT 0x0500 #include "xrCore/xrCore.h" +#pragma comment(lib, "xrCore.lib") #include #pragma warning(push) diff --git a/src/plugins/Maya/Material/lambertShader.cpp b/src/plugins/Maya/Material/lambertShader.cpp index 450a3689619..65763f424a4 100644 --- a/src/plugins/Maya/Material/lambertShader.cpp +++ b/src/plugins/Maya/Material/lambertShader.cpp @@ -1026,9 +1026,8 @@ MStatus initializePlugin( MObject obj ) INIT_OBJ = obj; const MString UserClassify( "shader/surface" ); - Core._initialize("XRayMayaPlugin",ELogCallback,FALSE); + Core._initialize("XRayMayaPlugin", LogCallback(ELogCallback, nullptr), FALSE, nullptr, true); FS._initialize (CLocatorAPI::flScanAppRoot,NULL,"xray_path.ltx"); - R_ASSERT2(0!=Memory.mem_fill,"Incorrect xrCore.dll version."); MString command( "if( `window -exists createRenderNodeWindow` ) {refreshCreateRenderNodeWindow(\"" ); diff --git a/src/plugins/Maya/Maya_Export2008.vcxproj b/src/plugins/Maya/Maya_Export2008.vcxproj index 77a5756d824..41dca22021a 100644 --- a/src/plugins/Maya/Maya_Export2008.vcxproj +++ b/src/plugins/Maya/Maya_Export2008.vcxproj @@ -84,7 +84,7 @@ /MACHINE:I386 /export:initializePlugin /export:uninitializePlugin %(AdditionalOptions) - odbc32.lib;odbccp32.lib;Foundation.lib;OpenMaya.lib;OpenMayaAnim.lib;xrcorestatic.lib;%(AdditionalDependencies) + odbc32.lib;odbccp32.lib;Foundation.lib;OpenMaya.lib;OpenMayaAnim.lib;%(AdditionalDependencies) $(OutDir)xrayMaya_export.mll true $(DXSDK_DIR)Lib\x86;$(XRAY_16X_LIBS)maya/ver-2008/lib;$(XRAY_16X_LIBS)BugTrap\Bin;$(xrLibDir);$(xrSdkDir)libraries;%(AdditionalLibraryDirectories) @@ -126,7 +126,7 @@ /MACHINE:I386 /export:initializePlugin /export:uninitializePlugin %(AdditionalOptions) - odbc32.lib;odbccp32.lib;Foundation.lib;OpenMaya.lib;OpenMayaAnim.lib;xrcorestatic.lib;%(AdditionalDependencies) + odbc32.lib;odbccp32.lib;Foundation.lib;OpenMaya.lib;OpenMayaAnim.lib;%(AdditionalDependencies) $(OutDir)xrayMaya_export.mll true $(DXSDK_DIR)Lib\x86;$(XRAY_16X_LIBS)maya/ver-2008/lib;$(XRAY_16X_LIBS)BugTrap\Bin;$(xrLibDir);$(xrSdkDir)libraries;%(AdditionalLibraryDirectories) @@ -268,6 +268,11 @@ + + + {a0f7d1fb-59a7-4717-a7e4-96f37e91998e} + + diff --git a/src/plugins/Maya/Maya_Export2009.vcxproj b/src/plugins/Maya/Maya_Export2009.vcxproj index 6cbae573fb6..8a9935f2d5c 100644 --- a/src/plugins/Maya/Maya_Export2009.vcxproj +++ b/src/plugins/Maya/Maya_Export2009.vcxproj @@ -85,7 +85,7 @@ /MACHINE:I386 /export:initializePlugin /export:uninitializePlugin %(AdditionalOptions) - odbc32.lib;odbccp32.lib;Foundation.lib;OpenMaya.lib;OpenMayaAnim.lib;xrcorestatic.lib;%(AdditionalDependencies) + odbc32.lib;odbccp32.lib;Foundation.lib;OpenMaya.lib;OpenMayaAnim.lib;%(AdditionalDependencies) $(OutDir)xrayMaya_export.mll true $(DXSDK_DIR)Lib\x86;$(XRAY_16X_LIBS)maya/ver-2009/lib;$(XRAY_16X_LIBS)BugTrap\Bin;$(xrLibDir);$(xrSdkDir)libraries;%(AdditionalLibraryDirectories) @@ -127,7 +127,7 @@ /MACHINE:I386 /export:initializePlugin /export:uninitializePlugin %(AdditionalOptions) - odbc32.lib;odbccp32.lib;Foundation.lib;OpenMaya.lib;OpenMayaAnim.lib;xrcorestatic.lib;%(AdditionalDependencies) + odbc32.lib;odbccp32.lib;Foundation.lib;OpenMaya.lib;OpenMayaAnim.lib;%(AdditionalDependencies) $(OutDir)xrayMaya_export.mll true $(DXSDK_DIR)Lib\x86;$(XRAY_16X_LIBS)maya/ver-2009/lib;$(XRAY_16X_LIBS)BugTrap\Bin;$(xrLibDir);$(xrSdkDir)libraries;%(AdditionalLibraryDirectories) @@ -266,6 +266,11 @@ + + + {a0f7d1fb-59a7-4717-a7e4-96f37e91998e} + + diff --git a/src/plugins/Maya/Maya_Material2008.vcxproj b/src/plugins/Maya/Maya_Material2008.vcxproj index 678bc99edde..be0a1a98c5f 100644 --- a/src/plugins/Maya/Maya_Material2008.vcxproj +++ b/src/plugins/Maya/Maya_Material2008.vcxproj @@ -158,6 +158,11 @@ + + + {a0f7d1fb-59a7-4717-a7e4-96f37e91998e} + + diff --git a/src/plugins/Maya/Maya_Material2009.vcxproj b/src/plugins/Maya/Maya_Material2009.vcxproj index 33f0f102765..6d4d8954ba5 100644 --- a/src/plugins/Maya/Maya_Material2009.vcxproj +++ b/src/plugins/Maya/Maya_Material2009.vcxproj @@ -64,7 +64,7 @@ Disabled $(SolutionDir);$(XRAY_16X_LIBS)maya/ver-2009/include;%(AdditionalIncludeDirectories) - DEBUG;WIN32;_WINDOWS;NT_PLUGIN;_MAYA_MATERIAL;_MAYA_PLUGIN;XRCORE_STATIC;%(PreprocessorDefinitions) + DEBUG;WIN32;_WINDOWS;NT_PLUGIN;_MAYA_MATERIAL;_MAYA_PLUGIN;%(PreprocessorDefinitions) true Sync MultiThreadedDLL @@ -106,7 +106,7 @@ OnlyExplicitInline $(SolutionDir);$(XRAY_16X_LIBS)maya/ver-2009/include;%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_WINDOWS;NT_PLUGIN;_MAYA_MATERIAL;_MAYA_PLUGIN;XRCORE_STATIC;%(PreprocessorDefinitions) + NDEBUG;WIN32;_WINDOWS;NT_PLUGIN;_MAYA_MATERIAL;_MAYA_PLUGIN;%(PreprocessorDefinitions) true false @@ -158,6 +158,11 @@ + + + {a0f7d1fb-59a7-4717-a7e4-96f37e91998e} + + diff --git a/src/plugins/Shared/ELog.cpp b/src/plugins/Shared/ELog.cpp index 9a938152e07..be2bb5a8fc5 100644 --- a/src/plugins/Shared/ELog.cpp +++ b/src/plugins/Shared/ELog.cpp @@ -23,7 +23,7 @@ #ifdef _LW_EXPORT #include extern "C" LWMessageFuncs *g_msg; - void ELogCallback(LPCSTR txt) + void ELogCallback(void *context, LPCSTR txt) { if (0==txt[0]) return; bool bDlg = ('#'==txt[0])||((0!=txt[1])&&('#'==txt[1])); @@ -38,7 +38,7 @@ #endif #ifdef _MAX_EXPORT #include "plugins/Max/Export/NetDeviceLog.h" - void ELogCallback(LPCSTR txt) + void ELogCallback(void *context, LPCSTR txt) { if (0!=txt[0]){ if (txt[0]=='!')EConsole.print(mtError,txt+1); @@ -47,7 +47,7 @@ } #endif #ifdef _MAYA_PLUGIN - void ELogCallback(LPCSTR txt) + void ELogCallback(void *context, LPCSTR txt) { if (0!=txt[0]){ if (txt[0]=='!')std::cerr << "XR-Error: " << txt+1 << "\n"; diff --git a/src/plugins/Shared/ELog.h b/src/plugins/Shared/ELog.h index 1b4f1aa7c99..bef7f68670f 100644 --- a/src/plugins/Shared/ELog.h +++ b/src/plugins/Shared/ELog.h @@ -15,7 +15,7 @@ class ECORE_API CLog{ int DlgMsg (TMsgDlgType mt, TMsgDlgButtons btn, LPCSTR _Format, ...); }; -void ECORE_API ELogCallback(LPCSTR txt); +void ECORE_API ELogCallback(void *context, LPCSTR txt); extern ECORE_API CLog ELog; diff --git a/src/plugins/lw/Export/LW_export_keys.cpp b/src/plugins/lw/Export/LW_export_keys.cpp index 59b4da405cb..0363286dabf 100644 --- a/src/plugins/lw/Export/LW_export_keys.cpp +++ b/src/plugins/lw/Export/LW_export_keys.cpp @@ -69,7 +69,7 @@ extern "C" { //----------------------------------------------------------------------------------------- void __cdecl SaveSkeletonMotion(GlobalFunc *global) { - Core._initialize("XRayPlugin",ELogCallback,FALSE); + Core._initialize("XRayPlugin", LogCallback(ELogCallback, nullptr), FALSE, nullptr, true); FS._initialize (CLocatorAPI::flScanAppRoot,NULL,"xray_path.ltx"); // get bone ID LWItemID object; diff --git a/src/plugins/lw/Export/LW_export_motion.cpp b/src/plugins/lw/Export/LW_export_motion.cpp index 4fe3654f6fc..d5fefb0cd20 100644 --- a/src/plugins/lw/Export/LW_export_motion.cpp +++ b/src/plugins/lw/Export/LW_export_motion.cpp @@ -27,7 +27,7 @@ extern "C" { //----------------------------------------------------------------------------------------- void __cdecl SaveObjectMotion(GlobalFunc *global) { - Core._initialize("XRayPlugin",ELogCallback,FALSE); + Core._initialize("XRayPlugin", LogCallback(ELogCallback, nullptr), FALSE, nullptr, true); FS._initialize (CLocatorAPI::flScanAppRoot,NULL,"xray_path.ltx"); // get bone ID bool bErr = false; diff --git a/src/plugins/lw/Export/LW_export_object.cpp b/src/plugins/lw/Export/LW_export_object.cpp index a4d466ee0a1..9c33f58777a 100644 --- a/src/plugins/lw/Export/LW_export_object.cpp +++ b/src/plugins/lw/Export/LW_export_object.cpp @@ -99,7 +99,7 @@ extern "C" { //----------------------------------------------------------------------------------------- void __cdecl SaveObject(GlobalFunc *global) { - Core._initialize("XRayPlugin",ELogCallback,FALSE); + Core._initialize("XRayPlugin", LogCallback(ELogCallback, nullptr), FALSE, nullptr, true); FS._initialize (CLocatorAPI::flScanAppRoot,NULL,"xray_path.ltx"); // get bone ID diff --git a/src/plugins/lw/Export/stdafx.h b/src/plugins/lw/Export/stdafx.h index 8bef5f10166..ab5be739ff7 100644 --- a/src/plugins/lw/Export/stdafx.h +++ b/src/plugins/lw/Export/stdafx.h @@ -8,7 +8,9 @@ #pragma once #include "xrCore/xrCore.h" +#pragma comment(lib, "xrCore.lib") +#define _BCL #define ENGINE_API enum TMsgDlgType { mtWarning, mtError, mtInformation, mtConfirmation, mtCustom }; diff --git a/src/plugins/lw/LW_Export80.vcxproj b/src/plugins/lw/LW_Export80.vcxproj index 9c65d71ca20..a1e9c40e22d 100644 --- a/src/plugins/lw/LW_Export80.vcxproj +++ b/src/plugins/lw/LW_Export80.vcxproj @@ -65,7 +65,7 @@ OnlyExplicitInline $(SolutionDir);$(XRAY_16X_LIBS)lightwave/ver-8.0/include;$(XRAY_16X_LIBS)lightwave/ver-8.0/include/lwsdk;../Shared;$(ProjectDir)export;%(AdditionalIncludeDirectories) - NDEBUG;_X86_;_WIN32;WIN32;_WINDOWS;_USRDLL;_LW_PLUGIN;_LW_EXPORT;XRCORE_STATIC;%(PreprocessorDefinitions) + NDEBUG;_X86_;_WIN32;WIN32;_WINDOWS;_USRDLL;_LW_PLUGIN;_LW_EXPORT;%(PreprocessorDefinitions) true MultiThreadedDLL @@ -90,7 +90,7 @@ /MACHINE:I386 %(AdditionalOptions) - odbc32.lib;odbccp32.lib;lw_server.lib;xrcorestatic.lib;%(AdditionalDependencies) + odbc32.lib;odbccp32.lib;lw_server.lib;%(AdditionalDependencies) $(OutDir)xray_export.p true $(DXSDK_DIR)Lib\x86;$(XRAY_16X_LIBS)BugTrap\Bin;Server\$(Configuration);$(xrLibDir);%(AdditionalLibraryDirectories) @@ -111,7 +111,7 @@ Disabled $(SolutionDir);$(XRAY_16X_LIBS)lightwave/ver-8.0/include;$(XRAY_16X_LIBS)lightwave/ver-8.0/include/lwsdk;../Shared;$(ProjectDir)export;%(AdditionalIncludeDirectories) - DEBUG;_X86_;_WIN32;WIN32;_WINDOWS;_USRDLL;_LW_PLUGIN;_LW_EXPORT;XRCORE_STATIC;%(PreprocessorDefinitions) + DEBUG;_X86_;_WIN32;WIN32;_WINDOWS;_USRDLL;_LW_PLUGIN;_LW_EXPORT;%(PreprocessorDefinitions) true Sync EnableFastChecks @@ -135,7 +135,7 @@ /MACHINE:I386 %(AdditionalOptions) - odbc32.lib;odbccp32.lib;lw_server.lib;xrcorestatic.lib;%(AdditionalDependencies) + odbc32.lib;odbccp32.lib;lw_server.lib;%(AdditionalDependencies) $(OutDir)xray_export.p true $(DXSDK_DIR)Lib\x86;$(XRAY_16X_LIBS)BugTrap\Bin;Server\$(Configuration);$(xrLibDir);%(AdditionalLibraryDirectories) @@ -324,9 +324,8 @@ - - {f1066eac-ee25-4c7a-9023-5957a6f7ba27} - false + + {a0f7d1fb-59a7-4717-a7e4-96f37e91998e} {6ba3121a-acbc-4685-9246-4549ca1efffd} diff --git a/src/plugins/lw/LW_Server.vcxproj b/src/plugins/lw/LW_Server.vcxproj index 62773a2e500..8faf5609f73 100644 --- a/src/plugins/lw/LW_Server.vcxproj +++ b/src/plugins/lw/LW_Server.vcxproj @@ -113,12 +113,6 @@ - - - {f1066eac-ee25-4c7a-9023-5957a6f7ba27} - false - - diff --git a/src/plugins/lw/LW_Shader80.vcxproj b/src/plugins/lw/LW_Shader80.vcxproj index ca65d906801..bf6863b7bf3 100644 --- a/src/plugins/lw/LW_Shader80.vcxproj +++ b/src/plugins/lw/LW_Shader80.vcxproj @@ -65,7 +65,7 @@ OnlyExplicitInline $(SolutionDir);$(XRAY_16X_LIBS)lightwave/ver-8.0/include;$(XRAY_16X_LIBS)lightwave/ver-8.0/include/lwsdk;../Shared;%(AdditionalIncludeDirectories) - NDEBUG;_X86_;_WIN32;WIN32;_WINDOWS;_USRDLL;_LW_PLUGIN;_LW_SHADER;XRCORE_STATIC;%(PreprocessorDefinitions) + NDEBUG;_X86_;_WIN32;WIN32;_WINDOWS;_USRDLL;_LW_PLUGIN;_LW_SHADER;%(PreprocessorDefinitions) true MultiThreadedDLL @@ -86,7 +86,7 @@ /MACHINE:I386 %(AdditionalOptions) - odbc32.lib;odbccp32.lib;lw_server.lib;xrcorestatic.lib;%(AdditionalDependencies) + odbc32.lib;odbccp32.lib;lw_server.lib;%(AdditionalDependencies) $(OutDir)xray_shader.p true $(DXSDK_DIR)Lib\x86;$(XRAY_16X_LIBS)BugTrap\Bin;$(xrLibDir);%(AdditionalLibraryDirectories) @@ -105,7 +105,7 @@ Disabled $(SolutionDir);$(XRAY_16X_LIBS)lightwave/ver-8.0/include;$(XRAY_16X_LIBS)lightwave/ver-8.0/include/lwsdk;../Shared;%(AdditionalIncludeDirectories) - DEBUG;_X86_;WIN32;_WINDOWS;_USRDLL;_EXPORT;_LW_SHADER;XRCORE_STATIC;%(PreprocessorDefinitions) + DEBUG;_X86_;WIN32;_WINDOWS;_USRDLL;_EXPORT;_LW_SHADER;%(PreprocessorDefinitions) true true Sync @@ -129,7 +129,7 @@ /MACHINE:I386 %(AdditionalOptions) - odbc32.lib;odbccp32.lib;lw_server.lib;xrcorestatic.lib;%(AdditionalDependencies) + odbc32.lib;odbccp32.lib;lw_server.lib;%(AdditionalDependencies) $(OutDir)xray_shader.p true $(DXSDK_DIR)Lib\x86;$(XRAY_16X_LIBS)BugTrap\Bin;$(xrLibDir);%(AdditionalLibraryDirectories) @@ -176,9 +176,8 @@ - - {f1066eac-ee25-4c7a-9023-5957a6f7ba27} - false + + {a0f7d1fb-59a7-4717-a7e4-96f37e91998e} {6ba3121a-acbc-4685-9246-4549ca1efffd} diff --git a/src/plugins/lw/Shader/LW_Shader.cpp b/src/plugins/lw/Shader/LW_Shader.cpp index 57ddf8b4a1d..fb6fedcc159 100644 --- a/src/plugins/lw/Shader/LW_Shader.cpp +++ b/src/plugins/lw/Shader/LW_Shader.cpp @@ -7,7 +7,7 @@ extern "C" { EShaderList ENShaders; EShaderList LCShaders; EShaderList GameMtls; extern "C" { void __cdecl LoadShaders() { - Core._initialize("XRayPlugin",0,FALSE); + Core._initialize("XRayPlugin", 0, FALSE, nullptr, true); FS._initialize (CLocatorAPI::flScanAppRoot,NULL,"xray_path.ltx"); LPSTRVec lst; ENShaders.count=LoadBlenderList(lst); diff --git a/src/plugins/lw/Shader/stdafx.h b/src/plugins/lw/Shader/stdafx.h index 5fb7cb5ae0b..d38c83cb670 100644 --- a/src/plugins/lw/Shader/stdafx.h +++ b/src/plugins/lw/Shader/stdafx.h @@ -8,6 +8,7 @@ #pragma once #include "xrCore/xrCore.h" +#pragma comment(lib, "xrCore.lib") #define ENGINE_API diff --git a/src/xrCore/ELocatorAPI.cpp b/src/xrCore/ELocatorAPI.cpp deleted file mode 100644 index 2a4309e1aaf..00000000000 --- a/src/xrCore/ELocatorAPI.cpp +++ /dev/null @@ -1,595 +0,0 @@ -// LocatorAPI.cpp: implementation of the CLocatorAPI class. -// -////////////////////////////////////////////////////////////////////// - -#include "stdafx.h" -#pragma hdrstop - -#pragma warning(disable:4995) -#include -#include -#include -#include -#pragma warning(default:4995) - -#include "FS_internal.h" - -CLocatorAPI* xr_FS = NULL; - -#ifdef _EDITOR -#define FSLTX "fs.ltx" -#else -#define FSLTX "fsgame.ltx" -#endif - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// -CLocatorAPI::CLocatorAPI() -{ - m_Flags.zero(); - // get page size - SYSTEM_INFO sys_inf; - GetSystemInfo(&sys_inf); - dwAllocGranularity = sys_inf.dwAllocationGranularity; - dwOpenCounter = 0; -} - -CLocatorAPI::~CLocatorAPI() -{ -} - -void CLocatorAPI::_initialize(u32 flags, LPCSTR target_folder, LPCSTR fs_fname) -{ - char _delimiter = '|'; //',' - if (m_Flags.is(flReady))return; - - Log("Initializing File System..."); - m_Flags.set(flags, TRUE); - - append_path("$fs_root$", "", 0, FALSE); - - // append application path - - if (m_Flags.is(flScanAppRoot)) - { - append_path("$app_root$", Core.ApplicationPath, 0, FALSE); - } - if (m_Flags.is(flTargetFolderOnly)) - { - append_path("$target_folder$", target_folder, 0, TRUE); - } - else - { - IReader* F = r_open((fs_fname&&fs_fname[0]) ? fs_fname : FSLTX); - if (!F&&m_Flags.is(flScanAppRoot)) - F = r_open("$app_root$", (fs_fname&&fs_fname[0]) ? fs_fname : FSLTX); - R_ASSERT3(F, "Can't open file:", (fs_fname&&fs_fname[0]) ? fs_fname : FSLTX); - // append all pathes - string_path buf; - string_path id, temp, root, add, def, capt; - LPCSTR lp_add, lp_def, lp_capt; - string16 b_v; - while (!F->eof()) - { - F->r_string(buf, sizeof(buf)); - _GetItem(buf, 0, id, '='); - if (id[0] == ';') continue; - _GetItem(buf, 1, temp, '='); - int cnt = _GetItemCount(temp, _delimiter); - R_ASSERT(cnt >= 3); - u32 fl = 0; - _GetItem(temp, 0, b_v, _delimiter); - if (CInifile::IsBOOL(b_v)) fl |= FS_Path::flRecurse; - _GetItem(temp, 1, b_v, _delimiter); - if (CInifile::IsBOOL(b_v)) fl |= FS_Path::flNotif; - _GetItem(temp, 2, root, _delimiter); - _GetItem(temp, 3, add, _delimiter); - _GetItem(temp, 4, def, _delimiter); - _GetItem(temp, 5, capt, _delimiter); - xr_strlwr(id); - if (!m_Flags.is(flBuildCopy) && (0 == xr_strcmp(id, "$build_copy$"))) continue; - xr_strlwr(root); - lp_add = (cnt >= 4) ? xr_strlwr(add) : 0; - lp_def = (cnt >= 5) ? def : 0; - lp_capt = (cnt >= 6) ? capt : 0; - PathPairIt p_it = pathes.find(root); - std::pair I; - FS_Path* P = xr_new((p_it != pathes.end()) ? p_it->second->m_Path : root, lp_add, lp_def, lp_capt, fl); - I = pathes.insert(mk_pair(xr_strdup(id), P)); - - R_ASSERT(I.second); - } - r_close(F); - }; - - m_Flags.set(flReady, TRUE); - - CreateLog(0 != strstr(Core.Params, "-nolog")); -} - -void CLocatorAPI::_destroy() -{ - CloseLog(); - - for (PathPairIt p_it = pathes.begin(); p_it != pathes.end(); p_it++) - { - char* str = LPSTR(p_it->first); - xr_free(str); - xr_delete(p_it->second); - } - pathes.clear(); -} - -BOOL CLocatorAPI::file_find(LPCSTR full_name, FS_File& f) -{ - intptr_t hFile; - _FINDDATA_T sFile; - // find all files - if (-1 != (hFile = _findfirst((LPSTR)full_name, &sFile))) - { - f = FS_File(sFile); - _findclose(hFile); - return TRUE; - } - else - { - return FALSE; - } -} - -BOOL CLocatorAPI::exist(const char* fn) -{ - return ::GetFileAttributes(fn) != u32(-1); -} - -BOOL CLocatorAPI::exist(const char* path, const char* name) -{ - string_path temp; - update_path(temp, path, name); - return exist(temp); -} - -BOOL CLocatorAPI::exist(string_path& fn, const char* path, const char* name) -{ - update_path(fn, path, name); - return exist(fn); -} - -BOOL CLocatorAPI::exist(string_path& fn, const char* path, const char* name, const char* ext) -{ - string_path nm; - strconcat(sizeof(nm), nm, name, ext); - update_path(fn, path, nm); - return exist(fn); -} - -bool ignore_name(const char* _name) -{ - // ignore processing ".svn" folders - return (_name[0] == '.' && _name[1] == 's' && _name[2] == 'v' && _name[3] == 'n' && _name[4] == 0); -} - -typedef void(__stdcall* TOnFind) (_finddata_t&, void*); -void Recurse(LPCSTR, bool, TOnFind, void*); -void ProcessOne(LPCSTR path, _finddata_t& F, bool root_only, TOnFind on_find_cb, void* data) -{ - string_path N; - strcpy(N, path); - strcat(N, F.name); - xr_strlwr(N); - - if (ignore_name(N)) return; - - if (F.attrib&_A_HIDDEN) return; - - if (F.attrib&_A_SUBDIR) - { - if (root_only) return; - if (0 == xr_strcmp(F.name, ".")) return; - if (0 == xr_strcmp(F.name, "..")) return; - strcat(N, "\\"); - strcpy(F.name, N); - on_find_cb(F, data); - Recurse(F.name, root_only, on_find_cb, data); - } - else - { - strcpy(F.name, N); - on_find_cb(F, data); - } -} - -void Recurse(LPCSTR path, bool root_only, TOnFind on_find_cb, void* data) -{ - xr_string fpath = path; - fpath += "*.*"; - - // begin search - _finddata_t sFile; - intptr_t hFile; - - // find all files - if (-1 == (hFile = _findfirst((LPSTR)fpath.c_str(), &sFile))) - return; - do - { - ProcessOne(path, sFile, root_only, on_find_cb, data); - } - while (_findnext(hFile, &sFile) == 0); - _findclose(hFile); -} - -struct file_list_cb_data -{ - size_t base_len; - u32 flags; - SStringVec* masks; - FS_FileSet* dest; -}; - -void __stdcall file_list_cb(_finddata_t& entry, void* data) -{ - file_list_cb_data* D = (file_list_cb_data*)data; - - LPCSTR end_symbol = entry.name + xr_strlen(entry.name) - 1; - if ((*end_symbol) != '\\') - { - // file - if ((D->flags&FS_ListFiles) == 0) return; - LPCSTR entry_begin = entry.name + D->base_len; - if ((D->flags&FS_RootOnly) && strstr(entry_begin, "\\")) return; // folder in folder - // check extension - if (D->masks) - { - bool bOK = false; - for (SStringVecIt it = D->masks->begin(); it != D->masks->end(); it++) - if (PatternMatch(entry_begin, it->c_str())) { bOK = true; break; } - if (!bOK) return; - } - xr_string fn = entry_begin; - // insert file entry - if (D->flags&FS_ClampExt) fn = EFS.ChangeFileExt(fn, ""); - D->dest->insert(FS_File(fn, entry)); - } - else - { - // folder - if ((D->flags&FS_ListFolders) == 0) return; - LPCSTR entry_begin = entry.name + D->base_len; - D->dest->insert(FS_File(entry_begin, entry)); - } -} - -int CLocatorAPI::file_list(FS_FileSet& dest, LPCSTR path, u32 flags, LPCSTR mask) -{ - R_ASSERT(path); - VERIFY(flags); - - string_path fpath; - if (path_exist(path)) - update_path(fpath, path, ""); - else - strcpy(fpath, path); - - // build mask - SStringVec masks; - _SequenceToList(masks, mask); - - file_list_cb_data data; - data.base_len = xr_strlen(fpath); - data.flags = flags; - data.masks = masks.empty() ? 0 : &masks; - data.dest = &dest; - - Recurse(fpath, !!(flags&FS_RootOnly), file_list_cb, &data); - return dest.size(); -} - -IReader* CLocatorAPI::r_open(LPCSTR path, LPCSTR _fname) -{ - IReader* R = 0; - - // correct path - string_path fname; - strcpy(fname, _fname); - xr_strlwr(fname); - if (path&&path[0]) update_path(fname, path, fname); - - // Search entry - FS_File desc; - if (!file_find(fname, desc)) return NULL; - - dwOpenCounter++; - - LPCSTR source_name = &fname[0]; - - // open file - if (desc.size < 256 * 1024) R = xr_new(fname); - else R = xr_new(fname); - -#ifdef DEBUG - if (R && m_Flags.is(flBuildCopy | flReady)) - { - string_path cpy_name; - string_path e_cpy_name; - FS_Path* P; - if (source_name == strstr(source_name, (P = get_path("$server_root$"))->m_Path) || - source_name == strstr(source_name, (P = get_path("$server_data_root$"))->m_Path)) - { - update_path(cpy_name, "$build_copy$", source_name + xr_strlen(P->m_Path)); - IWriter* W = w_open(cpy_name); - if (W) - { - W->w(R->pointer(), R->length()); - w_close(W); - set_file_age(cpy_name, get_file_age(source_name)); - if (m_Flags.is(flEBuildCopy)) - { - LPCSTR ext = strext(cpy_name); - if (ext) - { - IReader* R = 0; - if (0 == xr_strcmp(ext, ".dds")) - { - P = get_path("$game_textures$"); - update_path(e_cpy_name, "$textures$", source_name + xr_strlen(P->m_Path)); - // tga - *strext(e_cpy_name) = 0; - strcat(e_cpy_name, ".tga"); - r_close(R = r_open(e_cpy_name)); - // thm - *strext(e_cpy_name) = 0; - strcat(e_cpy_name, ".thm"); - r_close(R = r_open(e_cpy_name)); - } - else if (0 == xr_strcmp(ext, ".ogg")) - { - P = get_path("$game_sounds$"); - update_path(e_cpy_name, "$sounds$", source_name + xr_strlen(P->m_Path)); - // wav - *strext(e_cpy_name) = 0; - strcat(e_cpy_name, ".wav"); - r_close(R = r_open(e_cpy_name)); - // thm - *strext(e_cpy_name) = 0; - strcat(e_cpy_name, ".thm"); - r_close(R = r_open(e_cpy_name)); - } - else if (0 == xr_strcmp(ext, ".object")) - { - strcpy(e_cpy_name, source_name); - // object thm - *strext(e_cpy_name) = 0; - strcat(e_cpy_name, ".thm"); - R = r_open(e_cpy_name); - if (R) r_close(R); - } - } - } - } - else - { - Log("!Can't build:", source_name); - } - } - } -#endif // DEBUG - return R; -} - -void CLocatorAPI::r_close(IReader*& fs) -{ - xr_delete(fs); -} - -IWriter* CLocatorAPI::w_open(LPCSTR path, LPCSTR _fname) -{ - string_path fname; - xr_strlwr(strcpy(fname, _fname));//,".$"); - if (path&&path[0]) update_path(fname, path, fname); - CFileWriter* W = xr_new(fname, false); -#ifdef _EDITOR - if (!W->valid()) xr_delete(W); -#endif - return W; -} - -IWriter* CLocatorAPI::w_open_ex(LPCSTR path, LPCSTR _fname) -{ - string_path fname; - xr_strlwr(strcpy(fname, _fname));//,".$"); - if (path&&path[0]) update_path(fname, path, fname); - CFileWriter* W = xr_new(fname, true); -#ifdef _EDITOR - if (!W->valid()) xr_delete(W); -#endif - return W; -} - -void CLocatorAPI::w_close(IWriter*& S) -{ - if (S) - { - R_ASSERT(S->fName.size()); - xr_delete(S); - } -} - -struct dir_delete_cb_data -{ - FS_FileSet* folders; - BOOL remove_files; -}; - -void __stdcall dir_delete_cb(_finddata_t& entry, void* data) -{ - dir_delete_cb_data* D = (dir_delete_cb_data*)data; - - if (entry.attrib&_A_SUBDIR) D->folders->insert(FS_File(entry)); - else if (D->remove_files) FS.file_delete(entry.name); -} - -BOOL CLocatorAPI::dir_delete(LPCSTR initial, LPCSTR nm, BOOL remove_files) -{ - string_path fpath; - if (initial&&initial[0]) - update_path(fpath, initial, nm); - else - strcpy(fpath, nm); - - FS_FileSet folders; - folders.insert(FS_File(fpath)); - - // recurse find - dir_delete_cb_data data; - data.folders = &folders; - data.remove_files = remove_files; - Recurse(fpath, false, dir_delete_cb, &data); - - // remove folders - FS_FileSet::reverse_iterator r_it = folders.rbegin(); - for (; r_it != folders.rend(); r_it++) - _rmdir(r_it->name.c_str()); - return TRUE; -} - -void CLocatorAPI::file_delete(LPCSTR path, LPCSTR nm) -{ - string_path fname; - if (path&&path[0]) - update_path(fname, path, nm); - else - strcpy(fname, nm); - unlink(fname); -} - -void CLocatorAPI::file_copy(LPCSTR src, LPCSTR dest) -{ - if (exist(src)) - { - IReader* S = r_open(src); - if (S) - { - IWriter* D = w_open(dest); - if (D) - { - D->w(S->pointer(), S->length()); - w_close(D); - } - r_close(S); - } - } -} - -void CLocatorAPI::file_rename(LPCSTR src, LPCSTR dest, bool bOwerwrite) -{ - if (bOwerwrite&&exist(dest)) unlink(dest); - // physically rename file - VerifyPath(dest); - rename(src, dest); -} - -int CLocatorAPI::file_length(LPCSTR src) -{ - FS_File F; - return (file_find(src, F)) ? F.size : -1; -} - -BOOL CLocatorAPI::path_exist(LPCSTR path) -{ - PathPairIt P = pathes.find(path); - return (P != pathes.end()); -} - -FS_Path* CLocatorAPI::append_path(LPCSTR path_alias, LPCSTR root, LPCSTR add, BOOL recursive) -{ - VERIFY(root/*&&root[0]*/); - VERIFY(false == path_exist(path_alias)); - FS_Path* P = xr_new(root, add, LPCSTR(0), LPCSTR(0), 0); - pathes.insert(mk_pair(xr_strdup(path_alias), P)); - return P; -} - -FS_Path* CLocatorAPI::get_path(LPCSTR path) -{ - PathPairIt P = pathes.find(path); - R_ASSERT2(P != pathes.end(), path); - return P->second; -} - -LPCSTR CLocatorAPI::update_path(string_path& dest, LPCSTR initial, LPCSTR src) -{ - return get_path(initial)->_update(dest, src); -} -/* -void CLocatorAPI::update_path(xr_string& dest, LPCSTR initial, LPCSTR src) -{ -return get_path(initial)->_update(dest,src); -} */ - -time_t CLocatorAPI::get_file_age(LPCSTR nm) -{ - FS_File F; - return (file_find(nm, F)) ? F.time_write : -1; -} - -void CLocatorAPI::set_file_age(LPCSTR nm, time_t age) -{ - // set file - _utimbuf tm; - tm.actime = age; - tm.modtime = age; - int res = _utime(nm, &tm); - if (0 != res) Msg("!Can't set file age: '%s'. Error: '%s'", nm, _sys_errlist[errno]); -} - -BOOL CLocatorAPI::can_write_to_folder(LPCSTR path) -{ - if (path&&path[0]) - { - string_path temp; - LPCSTR fn = "$!#%TEMP%#!$.$$$"; - strconcat(sizeof(temp), temp, path, path[xr_strlen(path) - 1] != '\\' ? "\\" : "", fn); - FILE* hf = fopen(temp, "wb"); - if (hf == 0) return FALSE; - else - { - fclose(hf); - unlink(temp); - return TRUE; - } - } - else - { - return FALSE; - } -} - -BOOL CLocatorAPI::can_write_to_alias(LPCSTR path) -{ - string_path temp; - update_path(temp, path, ""); - return can_write_to_folder(temp); -} - -BOOL CLocatorAPI::can_modify_file(LPCSTR fname) -{ - FILE* hf = fopen(fname, "r+b"); - if (hf) - { - fclose(hf); - return TRUE; - } - else - { - return FALSE; - } -} - -BOOL CLocatorAPI::can_modify_file(LPCSTR path, LPCSTR name) -{ - string_path temp; - update_path(temp, path, name); - return can_modify_file(temp); -} diff --git a/src/xrCore/ELocatorAPI.h b/src/xrCore/ELocatorAPI.h deleted file mode 100644 index dee8df4fa51..00000000000 --- a/src/xrCore/ELocatorAPI.h +++ /dev/null @@ -1,85 +0,0 @@ -// LocatorAPI.h: interface for the CLocatorAPI class. -// -////////////////////////////////////////////////////////////////////// - -#ifndef ELocatorAPIH -#define ELocatorAPIH -#pragma once - -#include "LocatorAPI_defs.h" - -class XRCORE_API CLocatorAPI -{ - friend class FS_Path; -public: -private: - DEFINE_MAP_PRED(LPCSTR, FS_Path*, PathMap, PathPairIt, pred_str); - PathMap pathes; -public: - enum - { - flNeedRescan = (1 << 0), - flBuildCopy = (1 << 1), - flReady = (1 << 2), - flEBuildCopy = (1 << 3), - //. flEventNotificator = (1<<4), - flTargetFolderOnly = (1 << 5), - flCacheFiles = (1 << 6), - flScanAppRoot = (1 << 7), - }; - Flags32 m_Flags; - u32 dwAllocGranularity; - u32 dwOpenCounter; -public: - CLocatorAPI(); - ~CLocatorAPI(); - void _initialize(u32 flags, LPCSTR target_folder = 0, LPCSTR fs_fname = 0); - void _destroy(); - - IReader* r_open(LPCSTR initial, LPCSTR N); - IC IReader* r_open(LPCSTR N) { return r_open(0, N); } - void r_close(IReader*& S); - - IWriter* w_open(LPCSTR initial, LPCSTR N); - IWriter* w_open_ex(LPCSTR initial, LPCSTR N); - IC IWriter* w_open(LPCSTR N) { return w_open(0, N); } - IC IWriter* w_open_ex(LPCSTR N) { return w_open_ex(0, N); } - void w_close(IWriter*& S); - - BOOL exist(LPCSTR N); - BOOL exist(LPCSTR path, LPCSTR name); - BOOL exist(string_path& fn, LPCSTR path, LPCSTR name); - BOOL exist(string_path& fn, LPCSTR path, LPCSTR name, LPCSTR ext); - - BOOL can_write_to_folder(LPCSTR path); - BOOL can_write_to_alias(LPCSTR path); - BOOL can_modify_file(LPCSTR fname); - BOOL can_modify_file(LPCSTR path, LPCSTR name); - - BOOL dir_delete(LPCSTR initial, LPCSTR N, BOOL remove_files); - BOOL dir_delete(LPCSTR full_path, BOOL remove_files) { return dir_delete(0, full_path, remove_files); } - void file_delete(LPCSTR path, LPCSTR nm); - void file_delete(LPCSTR full_path) { file_delete(0, full_path); } - void file_copy(LPCSTR src, LPCSTR dest); - void file_rename(LPCSTR src, LPCSTR dest, bool bOwerwrite = true); - int file_length(LPCSTR src); - - time_t get_file_age(LPCSTR nm); - void set_file_age(LPCSTR nm, time_t age); - - BOOL path_exist(LPCSTR path); - FS_Path* get_path(LPCSTR path); - FS_Path* append_path(LPCSTR path_alias, LPCSTR root, LPCSTR add, BOOL recursive); - LPCSTR update_path(string_path& dest, LPCSTR initial, LPCSTR src); - - BOOL file_find(LPCSTR full_name, FS_File& f); - - int file_list(FS_FileSet& dest, LPCSTR path, u32 flags = FS_ListFiles, LPCSTR mask = 0); - //. void update_path (xr_string& dest, LPCSTR initial, LPCSTR src); -}; - -extern XRCORE_API CLocatorAPI* xr_FS; -#define FS (*xr_FS) - -#endif // ELocatorAPIH - diff --git a/src/xrCore/LocatorAPI.cpp b/src/xrCore/LocatorAPI.cpp index a1dceffce21..b03a2e4e606 100644 --- a/src/xrCore/LocatorAPI.cpp +++ b/src/xrCore/LocatorAPI.cpp @@ -1466,11 +1466,13 @@ CLocatorAPI::files_it CLocatorAPI::file_find_it(LPCSTR fname) return (I); } -BOOL CLocatorAPI::dir_delete(LPCSTR path, LPCSTR nm, BOOL remove_files) +BOOL CLocatorAPI::dir_delete(LPCSTR initial, LPCSTR nm, BOOL remove_files) { string_path fpath; - if (path&&path[0]) update_path(fpath, path, nm); - else xr_strcpy(fpath, sizeof(fpath), nm); + if (initial&&initial[0]) + update_path(fpath, initial, nm); + else + xr_strcpy(fpath, sizeof(fpath), nm); files_set folders; files_it I; diff --git a/src/xrCore/LocatorAPI.h b/src/xrCore/LocatorAPI.h index 9c5facec6b6..9563e2dbf9f 100644 --- a/src/xrCore/LocatorAPI.h +++ b/src/xrCore/LocatorAPI.h @@ -1,9 +1,3 @@ -// LocatorAPI.h: interface for the CLocatorAPI class. -// -////////////////////////////////////////////////////////////////////// - -#ifndef LocatorAPIH -#define LocatorAPIH #pragma once #pragma warning(push) @@ -213,5 +207,3 @@ class XRCORE_API CLocatorAPI extern XRCORE_API CLocatorAPI* xr_FS; #define FS (*xr_FS) -#endif // LocatorAPIH - diff --git a/src/xrCore/_math.cpp b/src/xrCore/_math.cpp index 785111d8291..fedc218acc8 100644 --- a/src/xrCore/_math.cpp +++ b/src/xrCore/_math.cpp @@ -124,12 +124,8 @@ void initialize() _control87(_RC_NEAR, MCW_RC); _64r = getFPUsw(); // 64, rounding -#ifndef XRCORE_STATIC - - m24r(); - -#endif //XRCORE_STATIC - + if (!Core.PluginMode) + m24r(); ::Random.seed(u32(CPU::GetCLK() % (1i64 << 32i64))); } }; @@ -301,10 +297,8 @@ void debug_on_thread_spawn(); void _initialize_cpu_thread() { debug_on_thread_spawn(); -#ifndef XRCORE_STATIC - // fpu & sse - FPU::m24r(); -#endif // XRCORE_STATIC + if (!Core.PluginMode) + FPU::m24r(); if (CPU::ID.feature&_CPU_FEATURE_SSE) { //_mm_setcsr ( _mm_getcsr() | (_MM_FLUSH_ZERO_ON+_MM_DENORMALS_ZERO_ON) ); diff --git a/src/xrCore/xrCore.cpp b/src/xrCore/xrCore.cpp index 4d9fcb923bf..72e6ff4fc9b 100644 --- a/src/xrCore/xrCore.cpp +++ b/src/xrCore/xrCore.cpp @@ -30,18 +30,12 @@ extern char g_application_path[256]; //. extern xr_vector* LogFile; -void xrCore::_initialize(LPCSTR _ApplicationName, LogCallback cb, BOOL init_fs, LPCSTR fs_fname) +void xrCore::_initialize(LPCSTR _ApplicationName, LogCallback cb, BOOL init_fs, LPCSTR fs_fname, bool plugin) { xr_strcpy(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 + PluginMode = plugin; // Init COM so we can use CoCreateInstance // HRESULT co_res = Params = xr_strdup(GetCommandLine()); @@ -159,8 +153,6 @@ void xrCore::_destroy() } } -#ifndef XRCORE_STATIC - //. why ??? #ifdef _EDITOR BOOL WINAPI DllEntryPoint(HINSTANCE hinstDLL, DWORD ul_reason_for_call, LPVOID lpvReserved) @@ -194,5 +186,4 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD ul_reason_for_call, LPVOID lpvRese break; } return TRUE; -} -#endif // XRCORE_STATIC \ No newline at end of file +} \ No newline at end of file diff --git a/src/xrCore/xrCore.h b/src/xrCore/xrCore.h index b98e6837611..95a67107728 100644 --- a/src/xrCore/xrCore.h +++ b/src/xrCore/xrCore.h @@ -83,7 +83,6 @@ #include #include - #ifndef DEBUG #ifdef _DEBUG #define DEBUG @@ -93,14 +92,6 @@ #endif #endif -#ifdef XRCORE_STATIC -# define NO_FS_SCAN -#endif - -#ifdef _EDITOR -# define NO_FS_SCAN -#endif - // inline control - redefine to use compiler's heuristics ONLY // it seems "IC" is misused in many places which cause code-bloat // ...and VC7.1 really don't miss opportunities for inline :) @@ -200,14 +191,10 @@ #pragma warning (disable : 4100 ) // unreferenced formal parameter // Our headers -#ifdef XRCORE_STATIC -# define XRCORE_API +#ifdef XRCORE_EXPORTS +#define XRCORE_API __declspec(dllexport) #else -# ifdef XRCORE_EXPORTS -# define XRCORE_API __declspec(dllexport) -# else -# define XRCORE_API __declspec(dllimport) -# endif +#define XRCORE_API __declspec(dllimport) #endif #include "xrDebug.h" @@ -308,9 +295,9 @@ class XRCORE_API xrCore string64 CompName; char* Params; DWORD dwFrame; - + bool PluginMode; public: - void _initialize(LPCSTR ApplicationName, LogCallback cb = 0, BOOL init_fs = TRUE, LPCSTR fs_fname = 0); + void _initialize(LPCSTR ApplicationName, LogCallback cb = 0, BOOL init_fs = TRUE, LPCSTR fs_fname = 0, bool plugin = false); void _destroy(); }; diff --git a/src/xrCore/xrCoreStatic.vcxproj b/src/xrCore/xrCoreStatic.vcxproj deleted file mode 100644 index a33b435ef05..00000000000 --- a/src/xrCore/xrCoreStatic.vcxproj +++ /dev/null @@ -1,496 +0,0 @@ - - - - - Debug - Win32 - - - Mixed - Win32 - - - Release - Win32 - - - - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27} - xrCoreStatic - Win32Proj - - - - StaticLibrary - v120 - MultiByte - - - StaticLibrary - v120 - MultiByte - true - - - StaticLibrary - v120 - MultiByte - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(xrLibDir) - $(xrIntDir)$(ProjectName)\ - - - $(xrLibDir) - $(xrIntDir)$(ProjectName)\ - - - $(xrLibDir) - $(xrIntDir)$(ProjectName)\ - - - - Disabled - false - Neither - true - .;$(SolutionDir);$(DXSDK_DIR)Include;$(XRAY_16X_LIBS);$(xrSdkDir)include;%(AdditionalIncludeDirectories) - GM_NON_GAME;DEBUG;XRCORE_STATIC;WIN32;_WINDOWS;_USRDLL;XRCORE_EXPORTS;%(PreprocessorDefinitions) - true - true - Sync - EnableFastChecks - true - MultiThreadedDLL - true - Fast - false - true - Use - - Level4 - true - ProgramDatabase - - - xrAPI.lib - $(xrLibDir);%(AdditionalLibraryDirectories) - - - - - Full - AnySuitable - true - Speed - true - true - .;$(SolutionDir);$(DXSDK_DIR)Include;$(XRAY_16X_LIBS);$(xrSdkDir)include;%(AdditionalIncludeDirectories) - GM_NON_GAME;XRCORE_STATIC;WIN32;NDEBUG;_WINDOWS;_USRDLL;XRCORE_EXPORTS;%(PreprocessorDefinitions) - true - true - - MultiThreadedDLL - false - StreamingSIMDExtensions2 - Fast - false - true - Use - - Level4 - ProgramDatabase - - - xrAPI.lib - $(xrLibDir);%(AdditionalLibraryDirectories) - - - - - Full - AnySuitable - true - Speed - false - true - .;$(SolutionDir);$(DXSDK_DIR)Include;$(XRAY_16X_LIBS);$(xrSdkDir)include;%(AdditionalIncludeDirectories) - GM_NON_GAME;XRCORE_STATIC;MIXED;WIN32;NDEBUG;_WINDOWS;_USRDLL;XRCORE_EXPORTS;%(PreprocessorDefinitions) - true - true - Sync - MultiThreadedDLL - true - false - Fast - false - true - Use - - Level4 - ProgramDatabase - - - xrAPI.lib - $(xrLibDir);%(AdditionalLibraryDirectories) - - - - - - - - - - - - TurnOffAllWarnings - - - TurnOffAllWarnings - - - TurnOffAllWarnings - - - - - TurnOffAllWarnings - - - TurnOffAllWarnings - - - TurnOffAllWarnings - - - - - TurnOffAllWarnings - - - TurnOffAllWarnings - - - TurnOffAllWarnings - - - - - TurnOffAllWarnings - true - - - TurnOffAllWarnings - true - - - TurnOffAllWarnings - - - - - TurnOffAllWarnings - - - TurnOffAllWarnings - - - TurnOffAllWarnings - - - - - TurnOffAllWarnings - - - TurnOffAllWarnings - - - TurnOffAllWarnings - - - - - TurnOffAllWarnings - - - TurnOffAllWarnings - - - TurnOffAllWarnings - - - - - $(IntDir)%(Filename)1.obj - - - $(IntDir)%(Filename)1.obj - - - $(IntDir)%(Filename)1.obj - - - - - TurnOffAllWarnings - - - TurnOffAllWarnings - - - TurnOffAllWarnings - - - - - - - - - - - - - - - - - - - - - true - true - true - - - - - - - TurnOffAllWarnings - - - TurnOffAllWarnings - - - TurnOffAllWarnings - - - - - - - - - - - - - - - true - Create - true - Create - false - true - Create - - - - - - - - - Create - Create - Create - - - - - - - - AssemblyAndSourceCode - - - - - - - - true - true - true - - - - - - - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/xrCore/xrCoreStatic.vcxproj.filters b/src/xrCore/xrCoreStatic.vcxproj.filters deleted file mode 100644 index 723c21e0ecc..00000000000 --- a/src/xrCore/xrCoreStatic.vcxproj.filters +++ /dev/null @@ -1,682 +0,0 @@ - - - - - {b3c618b3-d198-4063-99bf-c243a6d16679} - - - {ce8acfc5-d2c8-45b2-b8db-de9fa6936f09} - - - {1cb96d8d-42dd-4018-aee8-e2d0163086c7} - - - {d75429a1-8c2e-44ce-9771-e55690ec370d} - - - {914b169d-497b-4f71-9b7e-05d0e311f71d} - - - {4a787cdd-080a-4c0f-a2cb-98b23dfac201} - - - {ac5c031a-0ce0-4395-a965-479266cd6ba5} - - - {cbc77540-646f-4827-8059-69988f2521f2} - - - {3591d458-2185-4b95-a2f1-8f27e653021a} - - - {8e800879-38b7-4d47-a2f3-c4d6bc2ccb32} - - - {4695eac1-e8ff-440d-9b52-2cda631653ec} - - - {d36453ab-9176-4e20-b592-54b1f51c648a} - - - {8178d25b-03a1-494b-9982-bb107cc423ab} - - - {7c324654-b0fe-4eb6-a4c5-94415ac28d13} - - - {9f9119cc-2dc7-41a4-b75c-05259e85f3b4} - - - {2b4a6b2b-2724-46ad-bc7e-d652c8793d39} - - - {9b5fb419-912e-4382-9281-099464fd0417} - - - {90afc968-ebed-49d5-910e-79d7cb52df8d} - - - {80bd8066-bc33-46ee-bc77-c5f648450a0b} - - - {3d953702-a9ec-454c-adfc-bf156d0ebb99} - - - {9c0544a8-4f66-4f24-bd42-a1e2c0495c1e} - - - {9950fc79-e57a-4dc2-9b29-4e7fee40ffff} - - - {006bc114-34a3-4904-8547-4e17994b2258} - - - {f6022e16-616b-4dde-8d60-c400d6f0e855} - - - {0c4bb9ca-d95b-488e-bcf6-7e4c78761622} - - - {899095e5-c12f-4b6e-b698-cd0b01c99a6b} - - - {90109cda-1ebf-485f-bfd5-42442150fa12} - - - {858cbfe3-ebe9-4773-96e7-25af5e39b12f} - - - {a627771e-7b78-4ba7-9df1-30adb4cfe747} - - - {fa415d9c-b2e6-466f-b26b-c9472c639219} - - - {9315a107-070f-4430-b3ba-96144d698c79} - - - {36b70269-aa0e-4038-b5a9-7aa6e4c0a082} - - - - - Kernel - - - Kernel - - - Kernel - - - Math - - - Math - - - Math - - - Math\CPU - - - Math\Extensions - - - Math\Extensions - - - Math\Extensions - - - FS - - - FS - - - FS - - - FS - - - FS - - - FS - - - FS - - - FS\stream_reader - - - FS\file_stream_reader - - - Memory manager - - - Memory manager - - - Memory manager - - - Memory manager - - - Memory manager - - - Memory manager - - - Memory manager - - - Memory manager - - - Memory manager - - - Memory manager - - - Memory manager - - - Debug core - - - Debug core\BlackBox - - - Debug core\BlackBox - - - Debug core\BlackBox - - - Debug core\BlackBox - - - Debug core\BlackBox - - - Debug core\BlackBox - - - Debug core\BlackBox - - - Debug core\BlackBox - - - Debug core\BlackBox - - - shared memory/string library - - - shared memory/string library - - - shared memory/string library - - - shared memory/string library - - - memory_monitor - - - Compression\ppmd - - - Compression\ppmd\core - - - Compression\lzo - - - Compression\lzo - - - Compression\lzo - - - Compression\lzo - - - Compression\lzo - - - Compression\lzo - - - Compression\lz - - - Compression\rt - - - Compression\rt - - - string_concatenations - - - Animation - - - Animation - - - Animation - - - Animation - - - FMesh - - - Animation - - - PostProcess - - - PostProcess - - - OS - - - Threading - - - Math - - - Math - - - Math - - - Math - - - Media - - - Text - - - Threading - - - Threading - - - - - Kernel - - - Kernel - - - Kernel - - - Kernel - - - Kernel - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math\CPU - - - Math\STLext - - - Math\STLext - - - Math\STLext - - - Math\STLext - - - Math\Extensions - - - Math\Extensions - - - Math\Extensions - - - Math\Extensions - - - Math\Extensions - - - Math\Extensions - - - FS - - - FS - - - FS - - - FS - - - FS - - - FS - - - FS\stream_reader - - - FS\stream_reader - - - FS\file_stream_reader - - - Memory manager - - - Memory manager - - - Memory manager - - - Memory manager - - - Memory manager - - - Memory manager - - - Memory manager - - - Debug core - - - Debug core - - - Debug core\BlackBox - - - Debug core\BlackBox - - - Debug core\BlackBox - - - Debug core\BlackBox - - - Debug core\BlackBox - - - Debug core\BlackBox - - - Debug core\BlackBox - - - Debug core\BlackBox - - - shared memory/string library - - - shared memory/string library - - - shared memory/string library - - - shared memory/string library - - - intrusive_ptr - - - intrusive_ptr - - - memory_monitor - - - Compression\ppmd - - - Compression\ppmd\common - - - Compression\ppmd\common - - - Compression\ppmd\core - - - Compression\ppmd\core\allocator - - - Compression\ppmd\stream - - - Compression\ppmd\stream - - - Compression\lzo - - - Compression\lzo - - - Compression\lzo - - - Compression\lzo - - - Compression\lzo - - - Compression\lzo - - - Compression\lzo - - - Compression\lzo - - - Compression\lzo - - - Compression\lz - - - Compression\rt - - - string_concatenations - - - string_concatenations - - - Animation - - - Animation - - - Animation - - - FMesh - - - Animation - - - Animation - - - PostProcess - - - PostProcess - - - Kernel - - - OS - - - Threading - - - Math - - - Math - - - Math - - - Math - - - Media - - - Containers - - - Containers - - - Containers - - - Containers - - - Text - - - Threading - - - Threading - - - - - Kernel - - - - - FS - - - \ No newline at end of file diff --git a/src/xrCore/xrDebugNew.cpp b/src/xrCore/xrDebugNew.cpp index 5c2fe44df98..82328d59a21 100644 --- a/src/xrCore/xrDebugNew.cpp +++ b/src/xrCore/xrDebugNew.cpp @@ -212,50 +212,50 @@ void xrDebug::backend(const char* expression, const char* description, const cha FlushLog(); -#ifdef XRCORE_STATIC - MessageBox (NULL,assertion_info,"X-Ray error",MB_OK|MB_ICONERROR|MB_SYSTEMMODAL); -#else -# ifdef USE_OWN_ERROR_MESSAGE_WINDOW - int result = - MessageBox( + if (Core.PluginMode) + MessageBox (NULL,assertion_info,"X-Ray error",MB_OK|MB_ICONERROR|MB_SYSTEMMODAL); + else + { +#ifdef USE_OWN_ERROR_MESSAGE_WINDOW + int result = + MessageBox( GetTopWindow(NULL), assertion_info, "Fatal Error", MB_CANCELTRYCONTINUE | MB_ICONERROR | MB_SYSTEMMODAL - ); + ); - switch (result) - { - case IDCANCEL: - { + switch (result) + { + case IDCANCEL: + { # ifdef USE_BUG_TRAP - BT_SetUserMessage(assertion_info); + BT_SetUserMessage(assertion_info); # endif // USE_BUG_TRAP + DEBUG_INVOKE; + break; + } + case IDTRYAGAIN: + { + error_after_dialog = false; + break; + } + case IDCONTINUE: + { + error_after_dialog = false; + ignore_always = true; + break; + } + default: + DEBUG_INVOKE; + } +#else // USE_OWN_ERROR_MESSAGE_WINDOW +#ifdef USE_BUG_TRAP + BT_SetUserMessage (assertion_info); +#endif // USE_BUG_TRAP DEBUG_INVOKE; - break; - } - case IDTRYAGAIN: - { - error_after_dialog = false; - break; - } - case IDCONTINUE: - { - error_after_dialog = false; - ignore_always = true; - break; - } - default: - DEBUG_INVOKE; +#endif // USE_OWN_ERROR_MESSAGE_WINDOW } -# else // USE_OWN_ERROR_MESSAGE_WINDOW -# ifdef USE_BUG_TRAP - BT_SetUserMessage (assertion_info); -# endif // USE_BUG_TRAP - DEBUG_INVOKE; -# endif // USE_OWN_ERROR_MESSAGE_WINDOW -#endif - if (get_on_dialog()) get_on_dialog() (false); diff --git a/src/xrCore/xrMemory_pure.h b/src/xrCore/xrMemory_pure.h index 8039f8d83ee..def475bfaa6 100644 --- a/src/xrCore/xrMemory_pure.h +++ b/src/xrCore/xrMemory_pure.h @@ -1,12 +1,3 @@ -#ifndef XRMEMORY_PURE_H -#define XRMEMORY_PURE_H +#pragma once -#ifdef XRCORE_STATIC #define PURE_ALLOC -#else // XRCORE_STATIC -#ifdef DEBUG -#define PURE_ALLOC -#endif // DEBUG -#endif // XRCORE_STATIC - -#endif // XRMEMORY_PURE_H \ No newline at end of file diff --git a/src/xrCore/xrMemory_subst_msvc.cpp b/src/xrCore/xrMemory_subst_msvc.cpp index 4c577bc5cad..47c86b547e6 100644 --- a/src/xrCore/xrMemory_subst_msvc.cpp +++ b/src/xrCore/xrMemory_subst_msvc.cpp @@ -1,85 +1,69 @@ #include "stdafx.h" -#pragma hdrstop - #include "xrMemory_align.h" #include "xrMemory_pure.h" #ifndef __BORLANDC__ #ifndef DEBUG_MEMORY_MANAGER -# define debug_mode 0 -#endif // DEBUG_MEMORY_MANAGER - -#ifdef DEBUG_MEMORY_MANAGER -XRCORE_API void* g_globalCheckAddr = NULL; -#endif // DEBUG_MEMORY_MANAGER +#define debug_mode 0 +#endif #ifdef DEBUG_MEMORY_MANAGER +XRCORE_API void *g_globalCheckAddr = nullptr; extern void save_stack_trace(); -#endif // DEBUG_MEMORY_MANAGER +#endif MEMPOOL mem_pools[mem_pools_count]; // MSVC -ICF u8* acc_header(void* P) { u8* _P = (u8*)P; return _P - 1; } +ICF u8* acc_header(void* P) { return (u8*)P-1; } ICF u32 get_header(void* P) { return (u32)*acc_header(P); } ICF u32 get_pool(size_t size) { - u32 pid = u32(size / mem_pools_ebase); - if (pid >= mem_pools_count) return mem_generic; - else return pid; + u32 pid = u32(size/mem_pools_ebase); + if (pid>=mem_pools_count) + return mem_generic; + return pid; } #ifdef PURE_ALLOC -bool g_use_pure_alloc = false; -#endif // PURE_ALLOC +static bool g_use_pure_alloc = false; +#endif -void* xrMemory::mem_alloc(size_t size -# ifdef DEBUG_MEMORY_NAME - , const char* _name -# endif // DEBUG_MEMORY_NAME - ) +#ifdef DEBUG_MEMORY_NAME +void *xrMemory::mem_alloc(size_t size, const char *_name) +#else +void *xrMemory::mem_alloc(size_t size) +#endif { stat_calls++; - #ifdef PURE_ALLOC static bool g_use_pure_alloc_initialized = false; if (!g_use_pure_alloc_initialized) { - g_use_pure_alloc_initialized = true; - g_use_pure_alloc = -# ifdef XRCORE_STATIC - true -# else // XRCORE_STATIC - !!strstr(GetCommandLine(), "-pure_alloc") -# endif // XRCORE_STATIC - ; + g_use_pure_alloc_initialized = true; + g_use_pure_alloc = Core.PluginMode || strstr(GetCommandLine(), "-pure_alloc"); } - if (g_use_pure_alloc) { void* result = malloc(size); #ifdef USE_MEMORY_MONITOR memory_monitor::monitor_alloc(result, size, _name); -#endif // USE_MEMORY_MONITOR - return (result); +#endif + return result; } -#endif // PURE_ALLOC +#endif #ifdef DEBUG_MEMORY_MANAGER - if (mem_initialized) debug_cs.Enter(); -#endif // DEBUG_MEMORY_MANAGER - + if (mem_initialized) + debug_cs.Enter(); +#endif u32 _footer = debug_mode ? 4 : 0; void* _ptr = 0; - - // - if (!mem_initialized /*|| debug_mode*/) + if (!mem_initialized) { // generic - // Igor: Reserve 1 byte for xrMemory header void* _real = xr_aligned_offset_malloc(1 + size + _footer, 16, 0x1); - //void* _real = xr_aligned_offset_malloc (size + _footer, 16, 0x1); _ptr = (void*)(((u8*)_real) + 1); *acc_header(_ptr) = mem_generic; } @@ -87,25 +71,19 @@ void* xrMemory::mem_alloc(size_t size { #ifdef DEBUG_MEMORY_MANAGER save_stack_trace(); -#endif // DEBUG +#endif // accelerated - // Igor: Reserve 1 byte for xrMemory header u32 pool = get_pool(1 + size + _footer); - //u32 pool = get_pool (size+_footer); if (mem_generic == pool) { // generic - // Igor: Reserve 1 byte for xrMemory header void* _real = xr_aligned_offset_malloc(1 + size + _footer, 16, 0x1); - //void* _real = xr_aligned_offset_malloc (size + _footer,16,0x1); _ptr = (void*)(((u8*)_real) + 1); *acc_header(_ptr) = mem_generic; } else { // pooled - // Igor: Reserve 1 byte for xrMemory header - // Already reserved when getting pool id void* _real = mem_pools[pool].create(); _ptr = (void*)(((u8*)_real) + 1); *acc_header(_ptr) = (u8)pool; @@ -113,48 +91,40 @@ void* xrMemory::mem_alloc(size_t size } #ifdef DEBUG_MEMORY_MANAGER - if (debug_mode) dbg_register(_ptr, size, _name); - if (mem_initialized) debug_cs.Leave(); - //if(g_globalCheckAddr==_ptr){ - // __asm int 3; - //} - //if (_name && (0==strcmp(_name,"class ISpatial *")) && (size==376)) - //{ - // __asm int 3; - //} -#endif // DEBUG_MEMORY_MANAGER + if (debug_mode) + dbg_register(_ptr, size, _name); + if (mem_initialized) + debug_cs.Leave(); +#endif #ifdef USE_MEMORY_MONITOR memory_monitor::monitor_alloc(_ptr, size, _name); -#endif // USE_MEMORY_MONITOR +#endif return _ptr; } -void xrMemory::mem_free(void* P) +void xrMemory::mem_free(void *P) { stat_calls++; #ifdef USE_MEMORY_MONITOR memory_monitor::monitor_free(P); -#endif // USE_MEMORY_MONITOR - +#endif #ifdef PURE_ALLOC if (g_use_pure_alloc) { free(P); return; } -#endif // PURE_ALLOC - +#endif #ifdef DEBUG_MEMORY_MANAGER - if (g_globalCheckAddr == P) + if (g_globalCheckAddr==P) __asm int 3; -#endif // DEBUG_MEMORY_MANAGER - -#ifdef DEBUG_MEMORY_MANAGER - if (mem_initialized) debug_cs.Enter(); -#endif // DEBUG_MEMORY_MANAGER - if (debug_mode) dbg_unregister(P); + if (mem_initialized) + debug_cs.Enter(); +#endif + if (debug_mode) + dbg_unregister(P); u32 pool = get_header(P); - void* _real = (void*)(((u8*)P) - 1); + void* _real = (void*)((u8*)P-1); if (mem_generic == pool) { // generic @@ -167,63 +137,60 @@ void xrMemory::mem_free(void* P) mem_pools[pool].destroy(_real); } #ifdef DEBUG_MEMORY_MANAGER - if (mem_initialized) debug_cs.Leave(); -#endif // DEBUG_MEMORY_MANAGER + if (mem_initialized) + debug_cs.Leave(); +#endif } extern BOOL g_bDbgFillMemory; -void* xrMemory::mem_realloc(void* P, size_t size #ifdef DEBUG_MEMORY_NAME - , const char* _name -#endif // DEBUG_MEMORY_NAME - ) +void* xrMemory::mem_realloc(void* P, size_t size, const char* _name) +#else +void* xrMemory::mem_realloc(void* P, size_t size) +#endif { stat_calls++; #ifdef PURE_ALLOC if (g_use_pure_alloc) { void* result = realloc(P, size); -# ifdef USE_MEMORY_MONITOR +#ifdef USE_MEMORY_MONITOR memory_monitor::monitor_free(P); memory_monitor::monitor_alloc(result, size, _name); -# endif // USE_MEMORY_MONITOR - return (result); +#endif + return result; } -#endif // PURE_ALLOC - if (0 == P) +#endif + if (!P) { - return mem_alloc(size -# ifdef DEBUG_MEMORY_NAME - , _name -# endif // DEBUG_MEMORY_NAME - ); +#ifdef DEBUG_MEMORY_NAME + return mem_alloc(size, _name); +#else + return mem_alloc(size); +#endif } - #ifdef DEBUG_MEMORY_MANAGER - if (g_globalCheckAddr == P) + if (g_globalCheckAddr==P) __asm int 3; -#endif // DEBUG_MEMORY_MANAGER - -#ifdef DEBUG_MEMORY_MANAGER - if (mem_initialized) debug_cs.Enter(); -#endif // DEBUG_MEMORY_MANAGER + if (mem_initialized) + debug_cs.Enter(); +#endif u32 p_current = get_header(P); - // Igor: Reserve 1 byte for xrMemory header u32 p_new = get_pool(1 + size + (debug_mode ? 4 : 0)); - //u32 p_new = get_pool (size+(debug_mode?4:0)); u32 p_mode; - - if (mem_generic == p_current) + if (mem_generic==p_current) { - if (p_new < p_current) p_mode = 2; - else p_mode = 0; + if (p_new < p_current) + p_mode = 2; + else + p_mode = 0; } - else p_mode = 1; - - void* _real = (void*)(((u8*)P) - 1); + else + p_mode = 1; + void* _real = (void*)((u8*)P - 1); void* _ptr = NULL; - if (0 == p_mode) + if (!p_mode) { u32 _footer = debug_mode ? 4 : 0; #ifdef DEBUG_MEMORY_MANAGER @@ -233,62 +200,57 @@ void* xrMemory::mem_realloc(void* P, size_t size dbg_unregister(P); g_bDbgFillMemory = true; } -#endif // DEBUG_MEMORY_MANAGER - // Igor: Reserve 1 byte for xrMemory header +#endif void* _real2 = xr_aligned_offset_realloc(_real, 1 + size + _footer, 16, 0x1); - //void* _real2 = xr_aligned_offset_realloc (_real,size+_footer,16,0x1); - _ptr = (void*)(((u8*)_real2) + 1); + _ptr = (void*)((u8*)_real2 + 1); *acc_header(_ptr) = mem_generic; #ifdef DEBUG_MEMORY_MANAGER - if (debug_mode) dbg_register(_ptr, size, _name); -#endif // DEBUG_MEMORY_MANAGER + if (debug_mode) + dbg_register(_ptr, size, _name); +#endif #ifdef USE_MEMORY_MONITOR memory_monitor::monitor_free(P); memory_monitor::monitor_alloc(_ptr, size, _name); -#endif // USE_MEMORY_MONITOR +#endif } - else if (1 == p_mode) + else if (p_mode==1) { // pooled realloc - R_ASSERT2(p_current < mem_pools_count, "Memory corruption"); + R_ASSERT2(p_current