Initial commit: ROW Client source code
Game client codebase including: - CharacterActionControl: Character and creature management - GlobalScript: Network, items, skills, quests, utilities - RYLClient: Main client application with GUI and event handlers - Engine: 3D rendering engine (RYLGL) - MemoryManager: Custom memory allocation - Library: Third-party dependencies (DirectX, boost, etc.) - Tools: Development utilities 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
115
Tools/PatchCommon/FileEnumerator.cpp
Normal file
115
Tools/PatchCommon/FileEnumerator.cpp
Normal file
@@ -0,0 +1,115 @@
|
||||
// FileEnumerator.cpp: implementation of the CFileEnumerator class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "FileEnumerator.h"
|
||||
#include <string>
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CFileEnumerator::CFileEnumerator()
|
||||
{
|
||||
m_szRootPath[0] = 0;
|
||||
}
|
||||
|
||||
CFileEnumerator::~CFileEnumerator()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
|
||||
void CFileEnumerator::Clear()
|
||||
{
|
||||
m_szRootPath[0] = 0;
|
||||
|
||||
for( int i = 0; i < m_vecEnumeratedFiles.size(); ++i )
|
||||
{
|
||||
SAFE_DELETEA( m_vecEnumeratedFiles[i] );
|
||||
}
|
||||
}
|
||||
|
||||
const char* CFileEnumerator::GetRootPath()
|
||||
{
|
||||
return m_szRootPath;
|
||||
}
|
||||
|
||||
|
||||
bool CFileEnumerator::Enumerate( const char* szRootPath )
|
||||
{
|
||||
Clear();
|
||||
|
||||
// if( false == IsDirectoryExist( szRootPath ) )
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// strcpy( m_szRootPath, szRootPath );
|
||||
//
|
||||
// char szTmp[MAX_PATH];
|
||||
//
|
||||
// WIN32_FIND_DATA w32fd;
|
||||
//
|
||||
// wsprintf( szTmp, "%s\\*.*", m_szRootPath );
|
||||
// HANDLE hFind = FindFirstFile( szTmp, &w32fd );
|
||||
//
|
||||
// if( INVALID_HANDLE_VALUE == hFind )
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// std::string strCurrentSubPath("");
|
||||
// std::vector< std::string > vecSubDirList;
|
||||
//
|
||||
// while(1)
|
||||
// {
|
||||
// if( w32fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
|
||||
// {
|
||||
// if( 0 == stricmp( ".", w32fd.cFileName ) ||
|
||||
// 0 == stricmp( "..", w32fd.cFileName ) )
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// wsprintf( szTmp, "%s%s", strCurrentSubPath.c_str(), w32fd.cFileName );
|
||||
//
|
||||
// m_vecSubPathName.push_back( w32fd.cFileName );
|
||||
//
|
||||
//
|
||||
//
|
||||
// CString strTmp;
|
||||
// strTmp.Format( "%s%s", strCurrentSubPath, w32fd.cFileName );
|
||||
// if( !IsExcludedSubDir( strTmp ) )
|
||||
// {
|
||||
// astrSubDirList.Add( strTmp );
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// FilePatchInfoRecord fpir;
|
||||
//
|
||||
//
|
||||
// strcpy( fpir.szFileName, strCurrentSubPath+w32fd.cFileName );
|
||||
// CString strFullPathName = m_strLocalFilePath+strCurrentSubPath+w32fd.cFileName;
|
||||
//
|
||||
// m_strStateInfoString.Format( "<22><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>˻<EFBFBD><CBBB><EFBFBD>", strFullPathName );
|
||||
//
|
||||
// CCrc32Static::FileCrc32Assembly( strFullPathName, fpir.dwCRC32 );
|
||||
// HANDLE hFile = CreateFile( strFullPathName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
// NULL, OPEN_EXISTING, 0, 0 );
|
||||
// fpir.dwSize = GetFileSize ( hFile, NULL );
|
||||
// CloseHandle( hFile );
|
||||
//
|
||||
// m_LocalPatchInfo.GetList().Add( fpir );
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
35
Tools/PatchCommon/FileEnumerator.h
Normal file
35
Tools/PatchCommon/FileEnumerator.h
Normal file
@@ -0,0 +1,35 @@
|
||||
// FileEnumerator.h: interface for the CFileEnumerator class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_FILEENUMERATOR_H__B396030E_8C51_4F11_AA0E_B71B678B7B9F__INCLUDED_)
|
||||
#define AFX_FILEENUMERATOR_H__B396030E_8C51_4F11_AA0E_B71B678B7B9F__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "Patch_Util.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <vector>
|
||||
|
||||
|
||||
class CFileEnumerator
|
||||
{
|
||||
public:
|
||||
CFileEnumerator();
|
||||
~CFileEnumerator();
|
||||
|
||||
bool Enumerate( const char* szRootPath );
|
||||
|
||||
const char* GetRootPath();
|
||||
|
||||
private:
|
||||
char m_szRootPath[MAX_PATH];
|
||||
std::vector< char* > m_vecEnumeratedFiles;
|
||||
|
||||
void Clear();
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_FILEENUMERATOR_H__B396030E_8C51_4F11_AA0E_B71B678B7B9F__INCLUDED_)
|
||||
119
Tools/PatchCommon/LogCtrl.cpp
Normal file
119
Tools/PatchCommon/LogCtrl.cpp
Normal file
@@ -0,0 +1,119 @@
|
||||
// LogCtrl.cpp: implementation of the CLogCtrl class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "LogCtrl.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CLogCtrl::CLogCtrl()
|
||||
{
|
||||
m_hwndEdit = NULL;
|
||||
|
||||
m_ptPosition.x = 0;
|
||||
m_ptPosition.y = 0;
|
||||
|
||||
m_ptSize.x = 0;
|
||||
m_ptSize.y = 0;
|
||||
}
|
||||
|
||||
|
||||
CLogCtrl::~CLogCtrl()
|
||||
{
|
||||
if( m_hwndEdit )
|
||||
{
|
||||
DestroyWindow( m_hwndEdit );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CLogCtrl::Init( long x, long y, long width, long height, HWND hwndParent )
|
||||
{
|
||||
//CreateFont( )
|
||||
|
||||
if( NULL == m_hwndEdit )
|
||||
{
|
||||
m_hwndEdit = CreateWindow( "EDIT", "", WS_VISIBLE | WS_CHILD | WS_BORDER | ES_READONLY | ES_MULTILINE | WS_VSCROLL | ES_AUTOVSCROLL,
|
||||
x, y, width, height, hwndParent, NULL, NULL, 0 );
|
||||
|
||||
m_ptPosition.x = x;
|
||||
m_ptPosition.y = y;
|
||||
|
||||
m_ptSize.x = width;
|
||||
m_ptSize.y = height;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetParent( m_hwndEdit, hwndParent );
|
||||
|
||||
SetPosition( x, y );
|
||||
SetSize( width, height );
|
||||
}
|
||||
}
|
||||
|
||||
void CLogCtrl::SetPosition( long x, long y )
|
||||
{
|
||||
m_ptPosition.x = x;
|
||||
m_ptPosition.y = y;
|
||||
|
||||
if( m_hwndEdit )
|
||||
{
|
||||
SetWindowPos( m_hwndEdit, NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER );
|
||||
}
|
||||
}
|
||||
|
||||
void CLogCtrl::SetSize( long width, long height )
|
||||
{
|
||||
m_ptSize.x = width;
|
||||
m_ptSize.y = height;
|
||||
|
||||
if( m_hwndEdit )
|
||||
{
|
||||
SetWindowPos( m_hwndEdit, NULL, 0, 0, width, height, SWP_NOMOVE | SWP_NOZORDER );
|
||||
}
|
||||
}
|
||||
|
||||
void CLogCtrl::OutputMessage( const char* szMsg )
|
||||
{
|
||||
if( NULL == m_hwndEdit )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
long lSelBegin, lSelEnd;
|
||||
long lTextLen;
|
||||
|
||||
static char szTmp[300];
|
||||
|
||||
int nCnt = 0, nDestCnt = 0;
|
||||
while( '\0' != szMsg[nCnt] && nDestCnt < 299 )
|
||||
{
|
||||
if( '\n' == szMsg[nCnt] )
|
||||
{
|
||||
szTmp[nDestCnt++] = '\r';
|
||||
|
||||
if( nDestCnt == 299 )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
szTmp[nDestCnt++] = szMsg[nCnt++];
|
||||
}
|
||||
szTmp[nDestCnt] = '\0';
|
||||
|
||||
|
||||
// get current selection
|
||||
SendMessage( m_hwndEdit, EM_GETSEL, (WPARAM)&lSelBegin, (LPARAM)&lSelEnd );
|
||||
|
||||
// set selection at the end of the text
|
||||
lTextLen = SendMessage( m_hwndEdit, WM_GETTEXTLENGTH, 0, 0 );
|
||||
SendMessage( m_hwndEdit, EM_SETSEL, lTextLen, lTextLen );
|
||||
// add text(replace selection) at the end of the tex
|
||||
SendMessage( m_hwndEdit, EM_REPLACESEL, FALSE, (LPARAM)szTmp );
|
||||
|
||||
// restore the selection
|
||||
SendMessage( m_hwndEdit, EM_SETSEL, lSelBegin, lSelEnd );
|
||||
}
|
||||
35
Tools/PatchCommon/LogCtrl.h
Normal file
35
Tools/PatchCommon/LogCtrl.h
Normal file
@@ -0,0 +1,35 @@
|
||||
// LogCtrl.h: interface for the CLogCtrl class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_LOGCTRL_H__7E6E1A8A_01C1_48A0_8F45_E61E730E1D51__INCLUDED_)
|
||||
#define AFX_LOGCTRL_H__7E6E1A8A_01C1_48A0_8F45_E61E730E1D51__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
class CLogCtrl
|
||||
{
|
||||
public:
|
||||
CLogCtrl();
|
||||
~CLogCtrl();
|
||||
|
||||
void Init( long x, long y, long width, long height, HWND hwndParent );
|
||||
|
||||
void SetPosition( long x, long y );
|
||||
void SetSize( long width, long height );
|
||||
|
||||
void OutputMessage( const char* szMsg );
|
||||
|
||||
private:
|
||||
HWND m_hwndEdit;
|
||||
HFONT m_hFont;
|
||||
POINT m_ptPosition;
|
||||
POINT m_ptSize;
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_LOGCTRL_H__7E6E1A8A_01C1_48A0_8F45_E61E730E1D51__INCLUDED_)
|
||||
233
Tools/PatchCommon/PatchCommon.vcproj
Normal file
233
Tools/PatchCommon/PatchCommon.vcproj
Normal file
@@ -0,0 +1,233 @@
|
||||
<?xml version="1.0" encoding="ks_c_5601-1987"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="PatchCommon"
|
||||
ProjectGUID="{69C31401-5A6B-4288-9DD5-72566AF594CD}"
|
||||
SccProjectName=""
|
||||
SccLocalPath="">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Debug/PatchCommon.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile=".\Debug\PatchCommon.lib"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1042"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Release/PatchCommon.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile=".\Release\PatchCommon.lib"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1042"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
||||
<File
|
||||
RelativePath="FileEnumerator.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="LogCtrl.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Patch_Util.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="PatchInfoList.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="PatchInfoListV1.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl">
|
||||
<File
|
||||
RelativePath="FileEnumerator.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="LogCtrl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Patch_Util.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="PatchInfoList.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="PatchInfoListV1.h">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
150
Tools/PatchCommon/PatchCommon.vcxproj
Normal file
150
Tools/PatchCommon/PatchCommon.vcxproj
Normal file
@@ -0,0 +1,150 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{69C31401-5A6B-4288-9DD5-72566AF594CD}</ProjectGuid>
|
||||
<SccProjectName />
|
||||
<SccLocalPath />
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</IntDir>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<PrecompiledHeaderOutputFile>.\Debug/PatchCommon.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\Debug/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>.\Debug\PatchCommon.lib</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Lib>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0412</Culture>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<PrecompiledHeaderOutputFile>.\Release/PatchCommon.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\Release/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\Release/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>.\Release\PatchCommon.lib</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Lib>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0412</Culture>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="FileEnumerator.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LogCtrl.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Patch_Util.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PatchInfoList.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PatchInfoListV1.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="FileEnumerator.h" />
|
||||
<ClInclude Include="LogCtrl.h" />
|
||||
<ClInclude Include="Patch_Util.h" />
|
||||
<ClInclude Include="PatchInfoList.h" />
|
||||
<ClInclude Include="PatchInfoListV1.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
47
Tools/PatchCommon/PatchCommon.vcxproj.filters
Normal file
47
Tools/PatchCommon/PatchCommon.vcxproj.filters
Normal file
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{d8e63496-d3c9-427c-8a63-acd08aff31f1}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{91eadc2f-953b-47a3-8657-ffa992ae3c8c}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="FileEnumerator.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LogCtrl.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Patch_Util.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PatchInfoList.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PatchInfoListV1.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="FileEnumerator.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="LogCtrl.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Patch_Util.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PatchInfoList.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PatchInfoListV1.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
151
Tools/PatchCommon/PatchInfoList.cpp
Normal file
151
Tools/PatchCommon/PatchInfoList.cpp
Normal file
@@ -0,0 +1,151 @@
|
||||
#include "PatchInfoList.h"
|
||||
#include "PatchInfoListV1.h"
|
||||
|
||||
|
||||
const char* CPatchInfoList::ms_cszHeaderString = "PAT2";
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
bool CPatchInfoList::Load( const char* szFileName )
|
||||
{
|
||||
FILE* fp = fopen(szFileName, "rb");
|
||||
|
||||
if( NULL == fp )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// check header
|
||||
char acTmp[4] = { 0, };
|
||||
fread( acTmp, 4, sizeof(char), fp );
|
||||
if( acTmp[0] != ms_cszHeaderString[0] ||
|
||||
acTmp[1] != ms_cszHeaderString[1] ||
|
||||
acTmp[2] != ms_cszHeaderString[2] ||
|
||||
acTmp[3] != ms_cszHeaderString[3]
|
||||
)
|
||||
{
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
|
||||
// read version
|
||||
fread( &m_dwVersion, sizeof(DWORD), 1, fp );
|
||||
|
||||
// read count
|
||||
long lCount;
|
||||
fread( &lCount, sizeof(long), 1, fp );
|
||||
|
||||
// read data
|
||||
m_vecPatchInfo.resize( lCount );
|
||||
|
||||
if( lCount !=
|
||||
(long)fread( &(m_vecPatchInfo[0]), sizeof(FilePatchInfoRecord), lCount, fp ) )
|
||||
{
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
|
||||
FilePatchInfoRecord info = m_vecPatchInfo[0];
|
||||
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CPatchInfoList::Save( const char* szFileName )
|
||||
{
|
||||
FILE* fp = fopen(szFileName, "wb");
|
||||
|
||||
if( NULL == fp )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// write header
|
||||
fwrite( ms_cszHeaderString, 4, sizeof(char), fp );
|
||||
|
||||
// write version
|
||||
fwrite( &m_dwVersion, sizeof(DWORD), 1, fp );
|
||||
|
||||
// write count
|
||||
long lCount = m_vecPatchInfo.size();
|
||||
fwrite( &lCount, sizeof(long), 1, fp );
|
||||
|
||||
// write data
|
||||
fwrite( &(m_vecPatchInfo[0]), sizeof(FilePatchInfoRecord), lCount, fp );
|
||||
|
||||
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CPatchInfoList::Reset()
|
||||
{
|
||||
m_dwVersion = 0;
|
||||
m_vecPatchInfo.clear();
|
||||
}
|
||||
|
||||
|
||||
bool CPatchInfoList::LoadV1( const char* szFileName )
|
||||
{
|
||||
FILE* fp = fopen(szFileName, "rb");
|
||||
|
||||
if( NULL == fp )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// check header
|
||||
char acTmp[4] = { 0, };
|
||||
fread( acTmp, 4, sizeof(char), fp );
|
||||
if( acTmp[0] != 'P' ||
|
||||
acTmp[1] != 'A' ||
|
||||
acTmp[2] != 'T' ||
|
||||
acTmp[3] != '1'
|
||||
)
|
||||
{
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
|
||||
// read version
|
||||
fread( &m_dwVersion, sizeof(DWORD), 1, fp );
|
||||
|
||||
// read count
|
||||
long lCount;
|
||||
fread( &lCount, sizeof(long), 1, fp );
|
||||
|
||||
// read data
|
||||
std::vector< FilePatchInfoRecordV1 > vecV1;
|
||||
|
||||
vecV1.resize( lCount );
|
||||
|
||||
if( lCount !=
|
||||
(long)fread( &(vecV1[0]), sizeof(FilePatchInfoRecordV1), lCount, fp ) )
|
||||
{
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
m_vecPatchInfo.resize( lCount );
|
||||
|
||||
for( int i = 0; i < lCount; ++i )
|
||||
{
|
||||
strcpy( m_vecPatchInfo[i].szFileName, vecV1[i].szFileName );
|
||||
strcpy( m_vecPatchInfo[i].szPackageFileName, vecV1[i].szPackageFileName );
|
||||
m_vecPatchInfo[i].dwCRC32 = vecV1[i].dwCRC32;
|
||||
m_vecPatchInfo[i].dwSize = vecV1[i].dwSize;
|
||||
|
||||
//m_vecPatchInfo[i].dwVersion = 100;
|
||||
m_vecPatchInfo[i].dwVersion = m_dwVersion;
|
||||
}
|
||||
|
||||
vecV1.clear();
|
||||
|
||||
return true;
|
||||
}
|
||||
95
Tools/PatchCommon/PatchInfoList.h
Normal file
95
Tools/PatchCommon/PatchInfoList.h
Normal file
@@ -0,0 +1,95 @@
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#pragma pack(push)
|
||||
#pragma pack(4)
|
||||
|
||||
#define MAX_PACKAGE_FILE_NAME_LENGTH 50
|
||||
#define MAX_FILE_NAME_LENGTH 200
|
||||
|
||||
struct FilePatchInfoRecord
|
||||
{
|
||||
char szFileName[MAX_FILE_NAME_LENGTH]; // (<28><><EFBFBD>ӷ<EFBFBD>Ʈ<EFBFBD>κ<EFBFBD><CEBA><EFBFBD><EFBFBD><EFBFBD>)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+<2B><><EFBFBD>ϸ<EFBFBD>
|
||||
char szPackageFileName[MAX_PACKAGE_FILE_NAME_LENGTH]; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD>ú<EFBFBD>_nnn (Ȯ<><C8AE><EFBFBD><EFBFBD> ".zip" <20><><EFBFBD><EFBFBD>)
|
||||
DWORD dwSize;
|
||||
DWORD dwCRC32;
|
||||
DWORD dwVersion;
|
||||
|
||||
FilePatchInfoRecord()
|
||||
{
|
||||
szFileName[0] = '\0';
|
||||
szPackageFileName[0] = '\0';
|
||||
dwSize = 0;
|
||||
dwCRC32 = 0;
|
||||
dwVersion = 100;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct PTR_STRING
|
||||
{
|
||||
char* m_pStr;
|
||||
|
||||
PTR_STRING( char* p )
|
||||
{
|
||||
m_pStr = p;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct PTR_STRING_LESS
|
||||
{
|
||||
bool operator()( const PTR_STRING ps1, const PTR_STRING ps2 ) const
|
||||
{
|
||||
return ( stricmp( ps1.m_pStr , ps2.m_pStr ) < 0 );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class CPatchInfoList
|
||||
{
|
||||
public:
|
||||
bool Load( const char* szFileName );
|
||||
bool Save( const char* szFileName );
|
||||
|
||||
void Reset();
|
||||
|
||||
void SetVersion( DWORD dwVer )
|
||||
{
|
||||
m_dwVersion = dwVer;
|
||||
}
|
||||
|
||||
DWORD GetVersion()
|
||||
{
|
||||
return m_dwVersion;
|
||||
}
|
||||
|
||||
std::vector<FilePatchInfoRecord> &GetList()
|
||||
{
|
||||
return m_vecPatchInfo;
|
||||
}
|
||||
|
||||
bool LoadV1( const char* szFileName );
|
||||
|
||||
|
||||
protected:
|
||||
DWORD m_dwVersion;
|
||||
|
||||
std::vector<FilePatchInfoRecord> m_vecPatchInfo;
|
||||
|
||||
static const char* ms_cszHeaderString;
|
||||
};
|
||||
|
||||
|
||||
#pragma pack(pop)
|
||||
89
Tools/PatchCommon/PatchInfoListV1.cpp
Normal file
89
Tools/PatchCommon/PatchInfoListV1.cpp
Normal file
@@ -0,0 +1,89 @@
|
||||
#include "PatchInfoListV1.h"
|
||||
|
||||
const char* CPatchInfoListV1::ms_cszHeaderString = "PAT1";
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
bool CPatchInfoListV1::Load( const char* szFileName )
|
||||
{
|
||||
FILE* fp = fopen(szFileName, "rb");
|
||||
|
||||
if( NULL == fp )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// check header
|
||||
char acTmp[4] = { 0, };
|
||||
fread( acTmp, 4, sizeof(char), fp );
|
||||
if( acTmp[0] != ms_cszHeaderString[0] ||
|
||||
acTmp[1] != ms_cszHeaderString[1] ||
|
||||
acTmp[2] != ms_cszHeaderString[2] ||
|
||||
acTmp[3] != ms_cszHeaderString[3]
|
||||
)
|
||||
{
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
|
||||
// read version
|
||||
fread( &m_dwVersion, sizeof(DWORD), 1, fp );
|
||||
|
||||
// read count
|
||||
long lCount;
|
||||
fread( &lCount, sizeof(long), 1, fp );
|
||||
|
||||
// read data
|
||||
m_vecPatchInfo.resize( lCount );
|
||||
|
||||
if( lCount !=
|
||||
(long)fread( &(m_vecPatchInfo[0]), sizeof(FilePatchInfoRecordV1),
|
||||
lCount, fp ) )
|
||||
{
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CPatchInfoListV1::Save( const char* szFileName )
|
||||
{
|
||||
FILE* fp = fopen(szFileName, "wb");
|
||||
|
||||
if( NULL == fp )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// write header
|
||||
fwrite( ms_cszHeaderString, 4, sizeof(char), fp );
|
||||
|
||||
// write version
|
||||
fwrite( &m_dwVersion, sizeof(DWORD), 1, fp );
|
||||
|
||||
// write count
|
||||
long lCount = m_vecPatchInfo.size();
|
||||
fwrite( &lCount, sizeof(long), 1, fp );
|
||||
|
||||
// write data
|
||||
fwrite( &(m_vecPatchInfo[0]), sizeof(FilePatchInfoRecordV1),
|
||||
lCount, fp );
|
||||
|
||||
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CPatchInfoListV1::Reset()
|
||||
{
|
||||
m_dwVersion = 0;
|
||||
m_vecPatchInfo.clear();
|
||||
}
|
||||
|
||||
67
Tools/PatchCommon/PatchInfoListV1.h
Normal file
67
Tools/PatchCommon/PatchInfoListV1.h
Normal file
@@ -0,0 +1,67 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#pragma pack(push)
|
||||
#pragma pack(4)
|
||||
|
||||
#define MAX_PACKAGE_FILE_NAME_LENGTH 50
|
||||
#define MAX_FILE_NAME_LENGTH 200
|
||||
|
||||
struct FilePatchInfoRecordV1
|
||||
{
|
||||
DWORD dwSize;
|
||||
DWORD dwCRC32;
|
||||
char szFileName[MAX_FILE_NAME_LENGTH]; // (<28><><EFBFBD>ӷ<EFBFBD>Ʈ<EFBFBD>κ<EFBFBD><CEBA><EFBFBD><EFBFBD><EFBFBD>)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+<2B><><EFBFBD>ϸ<EFBFBD>
|
||||
char szPackageFileName[MAX_PACKAGE_FILE_NAME_LENGTH]; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD>ú<EFBFBD>_nnn (Ȯ<><C8AE><EFBFBD><EFBFBD> ".zip" <20><><EFBFBD><EFBFBD>)
|
||||
|
||||
FilePatchInfoRecordV1()
|
||||
{
|
||||
dwSize = 0;
|
||||
dwCRC32 = 0;
|
||||
szFileName[0] = '\0';
|
||||
szPackageFileName[0] = '\0';
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class CPatchInfoListV1
|
||||
{
|
||||
public:
|
||||
bool Load( const char* szFileName );
|
||||
bool Save( const char* szFileName );
|
||||
|
||||
void Reset();
|
||||
|
||||
void SetVersion( DWORD dwVer )
|
||||
{
|
||||
m_dwVersion = dwVer;
|
||||
}
|
||||
|
||||
DWORD GetVersion()
|
||||
{
|
||||
return m_dwVersion;
|
||||
}
|
||||
|
||||
std::vector<FilePatchInfoRecordV1> &GetList()
|
||||
{
|
||||
return m_vecPatchInfo;
|
||||
}
|
||||
|
||||
protected:
|
||||
DWORD m_dwVersion;
|
||||
|
||||
std::vector<FilePatchInfoRecordV1> m_vecPatchInfo;
|
||||
|
||||
static const char* ms_cszHeaderString;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#pragma pack(pop)
|
||||
49
Tools/PatchCommon/Patch_Util.cpp
Normal file
49
Tools/PatchCommon/Patch_Util.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
#include "Patch_Util.h"
|
||||
|
||||
|
||||
DWORD GetFileSize( const char* szFileName )
|
||||
{
|
||||
HANDLE hFile = CreateFile( szFileName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
NULL, OPEN_EXISTING, 0, 0 );
|
||||
if( INVALID_HANDLE_VALUE == hFile )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD dwFileSize = GetFileSize ( hFile, NULL );
|
||||
CloseHandle( hFile );
|
||||
|
||||
return dwFileSize;
|
||||
}
|
||||
|
||||
bool IsFileExist( const char* szFileName )
|
||||
{
|
||||
HANDLE hFile = CreateFile( szFileName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
NULL, OPEN_EXISTING, 0, 0 );
|
||||
if( INVALID_HANDLE_VALUE == hFile )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CloseHandle( hFile );
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsDirectoryExist( const char* szDirName )
|
||||
{
|
||||
DWORD dwAttr = GetFileAttributes( szDirName );
|
||||
|
||||
if( INVALID_FILE_ATTRIBUTES == dwAttr )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( FILE_ATTRIBUTE_DIRECTORY & dwAttr )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
18
Tools/PatchCommon/Patch_Util.h
Normal file
18
Tools/PatchCommon/Patch_Util.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
#ifndef SAFE_DELETE
|
||||
#define SAFE_DELETE(p) { if(NULL != p) { delete p; p = NULL; } }
|
||||
#endif
|
||||
|
||||
#ifndef SAFE_DELETEA
|
||||
#define SAFE_DELETEA(p) { if(NULL != p) { delete [] p; p = NULL; } }
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
DWORD GetFileSize( const char* szFileName );
|
||||
bool IsFileExist( const char* szFileName );
|
||||
bool IsDirectoryExist( const char* szDirName );
|
||||
Reference in New Issue
Block a user