diff --git a/src/Layers/xrRenderPC_R1/FStaticRender.cpp b/src/Layers/xrRenderPC_R1/FStaticRender.cpp index 7e33e0fe97c..d826ed13da7 100644 --- a/src/Layers/xrRenderPC_R1/FStaticRender.cpp +++ b/src/Layers/xrRenderPC_R1/FStaticRender.cpp @@ -660,8 +660,6 @@ void CRender::DumpStatistics(IGameFont &font, IPerformanceAlert *alert) #pragma comment(lib,"d3dx9.lib") -#include - static inline bool match_shader_id ( LPCSTR const debug_shader_id, LPCSTR const full_shader_id, FS_FileSet const& file_set, string_path& result ); //-------------------------------------------------------------------------------------------------------------- @@ -880,16 +878,10 @@ HRESULT CRender::shader_compile ( IReader* file = FS.r_open(file_name); if (file->length()>4) { - u32 crc = 0; - crc = file->r_u32(); - - boost::crc_32_type processor; - processor.process_block ( file->pointer(), ((char*)file->pointer()) + file->elapsed() ); - u32 const real_crc = processor.checksum( ); - - if ( real_crc == crc ) { - _result = create_shader(pTarget, (DWORD*)file->pointer(), file->elapsed(), file_name, result, o.disasm); - } + u32 crc = file->r_u32(); + u32 crcComp = crc32(file->pointer(), file->elapsed()); + if (crcComp==crc) + _result = create_shader(pTarget, (DWORD*)file->pointer(), file->elapsed(), file_name, result, o.disasm); } file->close(); } @@ -905,11 +897,7 @@ HRESULT CRender::shader_compile ( _result = D3DXCompileShader((LPCSTR)pSrcData,SrcDataLen,defines,pInclude,pFunctionName,pTarget,Flags|D3DXSHADER_USE_LEGACY_D3DX9_31_DLL,&pShaderBuf,&pErrorBuf,&pConstants); if (SUCCEEDED(_result)) { IWriter* file = FS.w_open(file_name); - - boost::crc_32_type processor; - processor.process_block ( pShaderBuf->GetBufferPointer(), ((char*)pShaderBuf->GetBufferPointer()) + pShaderBuf->GetBufferSize() ); - u32 const crc = processor.checksum( ); - + u32 crc = crc32(pShaderBuf->GetBufferPointer(), pShaderBuf->GetBufferSize()); file->w_u32 (crc); file->w ( pShaderBuf->GetBufferPointer(), (u32)pShaderBuf->GetBufferSize()); FS.w_close (file); diff --git a/src/Layers/xrRenderPC_R2/r2.cpp b/src/Layers/xrRenderPC_R2/r2.cpp index 16f62f88764..b05e897d62b 100644 --- a/src/Layers/xrRenderPC_R2/r2.cpp +++ b/src/Layers/xrRenderPC_R2/r2.cpp @@ -625,8 +625,6 @@ static HRESULT create_shader ( return _result; } -#include - static inline bool match_shader_id ( LPCSTR const debug_shader_id, LPCSTR const full_shader_id, FS_FileSet const& file_set, string_path& result ); class includer : public ID3DXInclude @@ -997,22 +995,10 @@ HRESULT CRender::shader_compile ( IReader* file = FS.r_open(file_name); if (file->length()>4) { - u32 crc = 0; - crc = file->r_u32(); - - boost::crc_32_type processor; - processor.process_block ( file->pointer(), ((char*)file->pointer()) + file->elapsed() ); - u32 const real_crc = processor.checksum( ); - - if ( real_crc == crc ) { - _result = create_shader(pTarget, (DWORD*)file->pointer(), file->elapsed(), file_name, result, o.disasm); - //if ( !SUCCEEDED(_result) ) { - // Msg ("! create shader failed"); - //} - //else { - // Msg ( "create shaders succeeded" ); - //} - } + u32 crc = file->r_u32(); + u32 crcComp = crc32(file->pointer(), file->elapsed()); + if (crcComp==crc) + _result = create_shader(pTarget, (DWORD*)file->pointer(), file->elapsed(), file_name, result, o.disasm); } file->close(); } @@ -1035,11 +1021,7 @@ HRESULT CRender::shader_compile ( if (SUCCEEDED(_result)) { // Msg ( "shader compilation succeeded" ); IWriter* file = FS.w_open(file_name); - - boost::crc_32_type processor; - processor.process_block ( pShaderBuf->GetBufferPointer(), ((char*)pShaderBuf->GetBufferPointer()) + pShaderBuf->GetBufferSize() ); - u32 const crc = processor.checksum( ); - + u32 crc = crc32(pShaderBuf->GetBufferPointer(), pShaderBuf->GetBufferSize()); file->w_u32 (crc); file->w ( pShaderBuf->GetBufferPointer(), (u32)pShaderBuf->GetBufferSize()); FS.w_close (file); diff --git a/src/Layers/xrRenderPC_R3/r3.cpp b/src/Layers/xrRenderPC_R3/r3.cpp index 3398f8db14d..ba9646b56e4 100644 --- a/src/Layers/xrRenderPC_R3/r3.cpp +++ b/src/Layers/xrRenderPC_R3/r3.cpp @@ -870,8 +870,6 @@ class includer : public ID3DInclude } }; -#include - HRESULT CRender::shader_compile ( LPCSTR name, DWORD const* pSrcData, @@ -1351,16 +1349,10 @@ HRESULT CRender::shader_compile ( IReader* file = FS.r_open(file_name); if (file->length()>4) { - u32 crc = 0; - crc = file->r_u32(); - - boost::crc_32_type processor; - processor.process_block ( file->pointer(), ((char*)file->pointer()) + file->elapsed() ); - u32 const real_crc = processor.checksum( ); - - if ( real_crc == crc ) { - _result = create_shader(pTarget, (DWORD*)file->pointer(), file->elapsed(), file_name, result, o.disasm); - } + u32 crc = file->r_u32(); + u32 crcComp = crc32(file->pointer(), file->elapsed()); + if (crcComp==crc) + _result = create_shader(pTarget, (DWORD*)file->pointer(), file->elapsed(), file_name, result, o.disasm); } file->close(); } @@ -1386,11 +1378,7 @@ HRESULT CRender::shader_compile ( if (SUCCEEDED(_result)) { IWriter* file = FS.w_open(file_name); - - boost::crc_32_type processor; - processor.process_block ( pShaderBuf->GetBufferPointer(), ((char*)pShaderBuf->GetBufferPointer()) + pShaderBuf->GetBufferSize() ); - u32 const crc = processor.checksum( ); - + u32 crc = crc32(pShaderBuf->GetBufferPointer(), pShaderBuf->GetBufferSize()); file->w_u32 (crc); file->w (pShaderBuf->GetBufferPointer(), (u32)pShaderBuf->GetBufferSize()); FS.w_close (file); diff --git a/src/Layers/xrRenderPC_R4/r4.cpp b/src/Layers/xrRenderPC_R4/r4.cpp index 0411b3070ba..1f3aff7ff79 100644 --- a/src/Layers/xrRenderPC_R4/r4.cpp +++ b/src/Layers/xrRenderPC_R4/r4.cpp @@ -972,8 +972,6 @@ class includer : public ID3DInclude } }; -#include - static inline bool match_shader_id ( LPCSTR const debug_shader_id, LPCSTR const full_shader_id, FS_FileSet const& file_set, string_path& result ); HRESULT CRender::shader_compile ( @@ -1489,16 +1487,10 @@ HRESULT CRender::shader_compile ( IReader* file = FS.r_open(file_name); if (file->length()>4) { - u32 crc = 0; - crc = file->r_u32(); - - boost::crc_32_type processor; - processor.process_block ( file->pointer(), ((char*)file->pointer()) + file->elapsed() ); - u32 const real_crc = processor.checksum( ); - - if ( real_crc == crc ) { - _result = create_shader(pTarget, (DWORD*)file->pointer(), file->elapsed(), file_name, result, o.disasm); - } + u32 crc = file->r_u32(); + u32 crcComp = crc32(file->pointer(), file->elapsed()); + if (crcComp==crc) + _result = create_shader(pTarget, (DWORD*)file->pointer(), file->elapsed(), file_name, result, o.disasm); } file->close(); } @@ -1523,11 +1515,7 @@ HRESULT CRender::shader_compile ( if (SUCCEEDED(_result)) { IWriter* file = FS.w_open(file_name); - - boost::crc_32_type processor; - processor.process_block ( pShaderBuf->GetBufferPointer(), ((char*)pShaderBuf->GetBufferPointer()) + pShaderBuf->GetBufferSize() ); - u32 const crc = processor.checksum( ); - + u32 crc = crc32(pShaderBuf->GetBufferPointer(), pShaderBuf->GetBufferSize()); file->w_u32 (crc); file->w (pShaderBuf->GetBufferPointer(), (u32)pShaderBuf->GetBufferSize()); FS.w_close (file); diff --git a/src/xrCore/memory_allocation_stats.cpp b/src/xrCore/memory_allocation_stats.cpp index 3548922a00a..f8f87e572c0 100644 --- a/src/xrCore/memory_allocation_stats.cpp +++ b/src/xrCore/memory_allocation_stats.cpp @@ -1,4 +1,5 @@ #include "stdafx.h" +#include "xrCore.h" #ifdef DEBUG_MEMORY_MANAGER # pragma warning(push) @@ -6,8 +7,6 @@ # include # pragma warning(pop) -# include - extern void BuildStackTrace (); extern char g_stackTrace[100][4096]; @@ -116,10 +115,7 @@ void save_stack_trace () *--J = 0; } - boost::crc_32_type temp; - temp.process_block (string,string + accumulator); - u32 crc = temp.checksum(); - + u32 crc = crc32(string, accumulator); STATS::iterator I = stats.find(crc); STATS::iterator E = stats.end(); for ( ; I != E; ++I) diff --git a/src/xrEngine/main.cpp b/src/xrEngine/main.cpp index a3d314a670b..e94d2025b24 100644 --- a/src/xrEngine/main.cpp +++ b/src/xrEngine/main.cpp @@ -836,8 +836,6 @@ int stack_overflow_exception_filter(int exception_code) return EXCEPTION_CONTINUE_SEARCH; } -#include - int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, char* lpCmdLine, @@ -852,9 +850,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, //u32 const& crc = *(u32*)buffer; - //boost::crc_32_type processor; - //processor.process_block ( buffer + 4, buffer + file_size ); - //u32 const new_crc = processor.checksum( ); + //u32 const new_crc = crc32( buffer + 4, buffer + file_size ); //VERIFY ( new_crc == crc ); //free (buffer); diff --git a/src/xrGame/ai_obstacle.cpp b/src/xrGame/ai_obstacle.cpp index 5b14c3fa2b5..38afa092c88 100644 --- a/src/xrGame/ai_obstacle.cpp +++ b/src/xrGame/ai_obstacle.cpp @@ -12,8 +12,6 @@ #include "xrAICore/Navigation/level_graph.h" #include "GameObject.h" #include "Include/xrRender/Kinematics.h" -#include - #include "xrCore/Animation/Bone.hpp" #pragma warning(push) @@ -262,10 +260,7 @@ void ai_obstacle::compute_impl () m_crc = 0; return; } - - boost::crc_32_type temp; - temp.process_block (&*m_area.begin(),&*m_area.end()); - m_crc = temp.checksum(); + m_crc = crc32(&*m_area.begin(), m_area.size()*sizeof(m_area[0])); } void ai_obstacle::on_move () diff --git a/src/xrNetServer/NET_Compressor.cpp b/src/xrNetServer/NET_Compressor.cpp index 06ef79cdc49..62ce43ee1dc 100644 --- a/src/xrNetServer/NET_Compressor.cpp +++ b/src/xrNetServer/NET_Compressor.cpp @@ -6,11 +6,6 @@ #include "NET_Common.h" #include "NET_Compressor.h" - - - - - #if NET_USE_COMPRESSION # ifdef DEBUG @@ -20,8 +15,6 @@ # pragma warning(pop) # endif // DEBUG -# include - # if NET_USE_LZO_COMPRESSION # define ENCODE rtc9_compress # define DECODE rtc9_decompress @@ -385,10 +378,7 @@ u16 NET_Compressor::Compress(BYTE* dest, const u32 &dest_size, BYTE* src, const *dest = NET_TAG_COMPRESSED; #if NET_USE_COMPRESSION_CRC - boost::crc_32_type temp; - temp.process_block( dest+offset, dest+compressed_size ); - u32 crc = temp.checksum(); - + u32 crc = crc32(dest+offset, compressed_size); *((u32*)(dest + 1)) = crc; #endif // NET_USE_COMPRESSION_CRC @@ -501,9 +491,7 @@ u16 NET_Compressor::Decompress (BYTE* dest, const u32 &dest_size, BYTE* src, con #endif // NET_USE_COMPRESSION_CRC #if NET_USE_COMPRESSION_CRC - boost::crc_32_type temp; - temp.process_block (src + offset,src + count); - u32 crc = temp.checksum(); + u32 crc = crc32(src+offset, count); // Msg ("decompressed %d -> ? [0x%08x]",count,crc); if( crc != *((u32*)(src + 1)) ) Msg( "!CRC mismatch" );