From 4bc1e1b5bc5ce774161702c97c2da3799e7a185a Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Sat, 19 Oct 2013 07:48:03 +0000 Subject: [PATCH] fixed crc file loading on windows --- .../platform/common/platform_common.cpp | 30 ++++++++----------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/source/shared_lib/sources/platform/common/platform_common.cpp b/source/shared_lib/sources/platform/common/platform_common.cpp index 92326480..8685cb09 100644 --- a/source/shared_lib/sources/platform/common/platform_common.cpp +++ b/source/shared_lib/sources/platform/common/platform_common.cpp @@ -696,19 +696,6 @@ pair hasCachedFileCRCValue(string crcCacheFile, uint32 &value) { SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Line: %d for Cache file [%s]\n",__FILE__,__FUNCTION__,__LINE__,crcCacheFile.c_str()); } -// string getGameVersion() { -// return gameVersion; -// } -// string getGameSVNVersion() { -// return gameSVNVersion; -// } -// void setGameVersion(string version) { -// gameVersion = version; -// } -// void setGameSVNVersion(string svn) { -// gameSVNVersion = svn; -// } - char gameVer[500]=""; char svnVer[500]=""; char actualFilePath[8096]=""; @@ -820,13 +807,20 @@ void writeCachedFileCRCValue(string crcCacheFile, uint32 &crcValue, string actua char szBuf1[100]=""; strftime(szBuf1,100,"%Y-%m-%d %H:%M:%S",loctime); - fprintf(fp,"%20ld,%20u,%20ld\n%s\n%s\n%s", + string writeGameVer = Shared::PlatformByteOrder::toCommonEndian(gameVersion); + string writeGameSVNVersion = Shared::PlatformByteOrder::toCommonEndian(gameSVNVersion); + string writeActualFileName = Shared::PlatformByteOrder::toCommonEndian(actualFileName); + + fprintf(fp,"%20ld,%20u,%20ld", Shared::PlatformByteOrder::toCommonEndian(refreshDate), Shared::PlatformByteOrder::toCommonEndian(crcValue), - Shared::PlatformByteOrder::toCommonEndian(now), - Shared::PlatformByteOrder::toCommonEndian(gameVersion).c_str(), - Shared::PlatformByteOrder::toCommonEndian(gameSVNVersion).c_str(), - Shared::PlatformByteOrder::toCommonEndian(actualFileName).c_str()); + Shared::PlatformByteOrder::toCommonEndian(now)); + + fprintf(fp,"\n%s\n%s\n%s", + writeGameVer.c_str(), + writeGameSVNVersion.c_str(), + writeActualFileName.c_str()); + fclose(fp); //if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"========== Writing CRC Cache offset [%d] refreshDate = %ld [%s], crcValue = %u, file [%s]\n",offset,refreshDate,szBuf1,crcValue,crcCacheFile.c_str());