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:
2025-11-29 16:24:34 +09:00
commit e067522598
5135 changed files with 1745744 additions and 0 deletions

View File

@@ -0,0 +1,780 @@
// PatchMaker.cpp: implementation of the CPatchMaker class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "NeoPatchMaker.h"
#include "PatchMaker.h"
#include "Crc32Static.h"
#include "afxinet.h"
#include "set"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////////
//
CPatchMaker::CPatchMaker()
{
m_PatchmakerState = PMS_IDLE;
}
CPatchMaker::~CPatchMaker()
{
}
bool CPatchMaker::Go( CEdit* pEditOutput )
{
//////////////////////////////////////////////////////////////////////////
// <20><><EFBFBD><EFBFBD> <20>ʱ<EFBFBD>ȭ
m_ZipArc.Close();
m_arrIndexToUpdateLocalFile.RemoveAll();
m_LocalPatchInfo.Reset();
m_ServerPatchInfo.Reset();
m_strCurrentNewPackageFileName = "";
m_astrFileNameWithSubDirExclusionList.RemoveAll();
m_astrFileNameExclusionList.RemoveAll();
m_astrSubDirExclusionList.RemoveAll();
m_ZipArc.SetCaseSensitivity( false );
//////////////////////////////////////////////////////////////////////////
// <20>ʱⰪ <20><><EFBFBD><EFBFBD>(Test only)
// m_dwPackageMaxSize = 500 * 1024; // 500kbytes, 0.5MB
//
// m_strPackageFilePath = "F:\\FilePatchTest\\";
// m_strLocalFilePath = "F:\\RYL\\Risk Your Life (Test Server Version)\\";
// m_strDestFilePath = "F:\\FilePatchTest\\modified\\";
// m_SourceType = FILE_ON_LOCAL;
// m_DestType = FILE_ON_LOCAL;
// m_dwUpdateVersion = 352;
//
// m_strFTPServerAddr = "211.233.42.245";
// m_strFTPAccount = "ryl";
// m_strFTPPassword = "fldjzk!$";
//////////////////////////////////////////////////////////////////////////
// validity check (path seperator, FTP connectivity)
pEditOutput->SetWindowText( "0. Check validity" );
if( false == CheckValidity( pEditOutput ) )
{
pEditOutput->SetWindowText( "Faild (Check validity)" );
return false;
}
//////////////////////////////////////////////////////////////////////////
// server patch info <20>о<EFBFBD><D0BE><EFBFBD><EFBFBD><EFBFBD>
m_PatchmakerState = PMS_LOAD_SERVER_PATCHINFO_LIST;
pEditOutput->SetWindowText( "1. Loading previous version patchinfo list" );
if( false == LoadServerPatchInfoList() )
{
pEditOutput->SetWindowText( "Faild (Loading previous version patchinfo list)" );
m_PatchmakerState = PMS_IDLE;
return false;
}
//////////////////////////////////////////////////////////////////////////
// local patch info <20>ۼ<EFBFBD>
m_PatchmakerState = PMS_BUILD_LOCAL_PATCHINFO_LIST;
pEditOutput->SetWindowText( "2. Building local patchinfo list" );
if( false == BuildLocalPatchInfoList() )
{
pEditOutput->SetWindowText( "Faild (Building local patchinfo list)" );
m_PatchmakerState = PMS_IDLE;
return false;
}
//////////////////////////////////////////////////////////////////////////
// <20><><EFBFBD><EFBFBD> <20><>Ű<EFBFBD><C5B0> <20><> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <20><> <20><><EFBFBD><EFBFBD> & <20><><EFBFBD><EFBFBD> <20><>Ű<EFBFBD><C5B0>ȭ<EFBFBD>Ǿ<EFBFBD><C7BE><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ۼ<EFBFBD>
m_PatchmakerState = PMS_COLLECT_UPDATE_FILE_LIST;
pEditOutput->SetWindowText( "3. Compare & collecting update file list" );
if( false == CollectUpdateFileList() )
{
pEditOutput->SetWindowText( "Faild (Compare & collecting update file list)" );
m_PatchmakerState = PMS_IDLE;
return false;
}
//////////////////////////////////////////////////////////////////////////
// <20><>Ű<EFBFBD><C5B0> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ & <20>ű<EFBFBD> <20><>Ű<EFBFBD><C5B0> <20>ۼ<EFBFBD>
m_PatchmakerState = PMS_UPDATE_PACKAGE;
pEditOutput->SetWindowText( "4. Updating & creating package(.zip) file" );
if( false == UpdatePackage() )
{
pEditOutput->SetWindowText( "Faild (Updating & creating package(.zip) file)" );
m_PatchmakerState = PMS_IDLE;
return false;
}
//////////////////////////////////////////////////////////////////////////
// PatchInfo <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>&<26><><EFBFBD><EFBFBD>
m_PatchmakerState = PMS_UPDATE_PATCHINFO;
pEditOutput->SetWindowText( "5. Updating patchinfo file" );
if( false == UpdatePatchInfo() )
{
pEditOutput->SetWindowText( "Faild (Updating patchinfo file)" );
m_PatchmakerState = PMS_IDLE;
return false;
}
//////////////////////////////////////////////////////////////////////////
// Clear
pEditOutput->SetWindowText( "-- Finished --" );
return true;
}
//////////////////////////////////////////////////////////////////////////
// validity check (path seperator, FTP connectivity)
bool CPatchMaker::CheckValidity( CEdit* pEditOutput )
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ű<EFBFBD><C5B0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4B8AE> <20><><EFBFBD><EFBFBD> seperator Ȯ<><C8AE>
if( m_strPackageFilePath.GetLength() )
{
if( FILE_ON_FTP == m_SourceType )
{
if( m_strPackageFilePath.Right(1) != "/" )
{
m_strPackageFilePath += "/";
}
}
if( FILE_ON_LOCAL == m_SourceType )
{
if( m_strPackageFilePath.Right(1) != "\\" )
{
m_strPackageFilePath += "\\";
}
}
}
else
{
return false;
}
if( m_strLocalFilePath.GetLength() )
{
if( m_strLocalFilePath.Right(1) != "\\" )
{
m_strLocalFilePath += "\\";
}
}
else
{
return false;
}
if( m_strDestFilePath.GetLength() )
{
if( FILE_ON_FTP == m_DestType )
{
if( m_strDestFilePath.Right(1) != "/" )
{
m_strDestFilePath += "/";
}
}
if( FILE_ON_LOCAL == m_DestType )
{
if( m_strDestFilePath.Right(1) != "\\" )
{
m_strDestFilePath += "\\";
}
}
}
else
{
return false;
}
BOOL bFTPSettingOK = TRUE;
if( FILE_ON_FTP == m_SourceType )
{
CInternetSession isess;
CFtpConnection* pFtp = isess.GetFtpConnection( m_strFTPServerAddr, m_strFTPAccount, m_strFTPPassword, m_nFTPPort, m_bPassiveMode );
bFTPSettingOK = pFtp->SetCurrentDirectory( m_strPackageFilePath );
pFtp->Close();
isess.Close();
}
if( FALSE == bFTPSettingOK )
{
return false;
}
return true;
}
//////////////////////////////////////////////////////////////////////////
// server patch info <20>о<EFBFBD><D0BE><EFBFBD><EFBFBD><EFBFBD>
bool CPatchMaker::LoadServerPatchInfoList()
{
switch( m_SourceType )
{
case FILE_NONE:
return true;
break;
case FILE_ON_FTP:
{
CInternetSession isess;
CFtpConnection* pFtp = isess.GetFtpConnection( m_strFTPServerAddr, m_strFTPAccount, m_strFTPPassword, m_nFTPPort, m_bPassiveMode);
pFtp->SetCurrentDirectory( m_strPackageFilePath );
pFtp->GetFile( "PatchInfoV2.zip", m_strDestFilePath+"PatchInfoV2.zip" );
pFtp->Close();
isess.Close();
}
break;
case FILE_ON_LOCAL:
CopyFile( m_strPackageFilePath+"PatchInfoV2.zip", m_strDestFilePath+"PatchInfoV2.zip", FALSE );
break;
}
// PatchInfo <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
CZipArchive zipArc;
zipArc.Open( m_strDestFilePath+"PatchInfoV2.zip", CZipArchive::zipOpen );
zipArc.ExtractFile( 0, m_strDestFilePath, false, "PatchInfoV2" );
zipArc.Close();
DeleteFile( m_strDestFilePath+"PatchInfoV2.zip" );
// PatchInfo <20>ε<EFBFBD>
m_ServerPatchInfo.Reset();
m_ServerPatchInfo.Load( m_strDestFilePath+"PatchInfoV2" );
DeleteFile( m_strDestFilePath+"PatchInfoV2");
// filename-to-index map <20><><EFBFBD><EFBFBD>
for( size_t i = 0; i < m_ServerPatchInfo.GetList().size(); ++i )
{
long lTmp = m_mapFileName2ServerListIndex.size();
m_mapFileName2ServerListIndex[ m_ServerPatchInfo.GetList()[i].szFileName ] = lTmp;
}
return true;
}
//////////////////////////////////////////////////////////////////////////
// local patch info <20>ۼ<EFBFBD>
bool CPatchMaker::BuildLocalPatchInfoList()
{
WIN32_FIND_DATA w32fd;
HANDLE hFind = FindFirstFile( m_strLocalFilePath+"*.*", &w32fd );
if( INVALID_HANDLE_VALUE == hFind )
{
return false;
}
CString strCurrentSubPath("");
CStringArray astrSubDirList;
while( 1 )
{
if( !IsExcludedFileWithSubDir(strCurrentSubPath+w32fd.cFileName) &&
!IsExcludedFile( w32fd.cFileName ) )
{
if( w32fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
{
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( "<EFBFBD><EFBFBD> <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().push_back( fpir );
//m_mapFileName2LocalListIndex[fpir.szFileName] = m_LocalPatchInfo.GetList().size() - 1;
}
}
if( 0 == FindNextFile( hFind, &w32fd ) )
{
FindClose( hFind );
// sub dir queue <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ٸ<EFBFBD><D9B8><EFBFBD> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>
if( astrSubDirList.GetSize() > 0 )
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
strCurrentSubPath = astrSubDirList[0] + "\\";
astrSubDirList.RemoveAt(0);
hFind = FindFirstFile( m_strLocalFilePath+strCurrentSubPath+"*.*", &w32fd );
}
else
{
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
break;
}
}
}
return true;
}
//////////////////////////////////////////////////////////////////////////
// <20><><EFBFBD><EFBFBD> <20><>Ű<EFBFBD><C5B0> <20><> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <20><> <20><><EFBFBD><EFBFBD> & <20><><EFBFBD><EFBFBD> <20><>Ű<EFBFBD><C5B0>ȭ<EFBFBD>Ǿ<EFBFBD><C7BE><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ۼ<EFBFBD>
bool CPatchMaker::CollectUpdateFileList()
{
size_t i = 0, max = m_LocalPatchInfo.GetList().size();
for( i = 0; i < max; ++i )
{
FilePatchInfoRecord &rLocalItem = m_LocalPatchInfo.GetList()[i];
// bool bFound = false;
// for( j = 0; j < m_ServerPatchInfo.GetList().size(); ++j )
// {
// FilePatchInfoRecord &rServerItem = m_ServerPatchInfo.GetList()[j];
//
// // <20><><EFBFBD><EFBFBD> <20><>Ű<EFBFBD><C5B0><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE><EFBFBD><EFBFBD> <20>߰ߵ<DFB0> <20><><EFBFBD><EFBFBD>)
// if( 0 == stricmp( rLocalItem.szFileName, rServerItem.szFileName ) )
// {
// bFound = true;
// strcpy( rLocalItem.szPackageFileName, rServerItem.szPackageFileName );
//
// // size<7A><65> CRC32 üũ<C3BC><C5A9> <20>ٸ<EFBFBD><D9B8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
// if( rLocalItem.dwCRC32 != rServerItem.dwCRC32 ||
// rLocalItem.dwSize != rServerItem.dwSize )
// {
// m_arrIndexToUpdateLocalFile.Add( i );
//
// rLocalItem.dwVersion = m_dwUpdateVersion;
// }
// else
// {
// rLocalItem.dwVersion = rServerItem.dwVersion;
// }
//
// break;
// }
//
// }
//
// // <20><><EFBFBD><EFBFBD> <20><>Ű<EFBFBD><C5B0><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʴ<EFBFBD> <20><><EFBFBD><EFBFBD>
// if( false == bFound )
// {
// m_arrIndexToUpdateLocalFile.Add( i );
//
// rLocalItem.dwVersion = m_dwUpdateVersion;
// }
std::map< PTR_STRING, int, PTR_STRING_LESS >::iterator it;
it = m_mapFileName2ServerListIndex.find( rLocalItem.szFileName );
if( m_mapFileName2ServerListIndex.end() == it )
{
// <20><><EFBFBD><EFBFBD> <20><>Ű<EFBFBD><C5B0><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʴ<EFBFBD> <20><><EFBFBD><EFBFBD>
m_arrIndexToUpdateLocalFile.Add( i );
rLocalItem.dwVersion = m_dwUpdateVersion;
}
else
{
long lIdx = it->second;
FilePatchInfoRecord &rServerItem = m_ServerPatchInfo.GetList()[it->second];
strcpy( rLocalItem.szPackageFileName, rServerItem.szPackageFileName );
// size<7A><65> CRC32 üũ<C3BC><C5A9> <20>ٸ<EFBFBD><D9B8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
if( rLocalItem.dwCRC32 != rServerItem.dwCRC32 ||
rLocalItem.dwSize != rServerItem.dwSize )
{
m_arrIndexToUpdateLocalFile.Add( i );
rLocalItem.dwVersion = m_dwUpdateVersion;
}
else
{
rLocalItem.dwVersion = rServerItem.dwVersion;
}
}
}
return true;
}
//////////////////////////////////////////////////////////////////////////
// <20><>Ű<EFBFBD><C5B0> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ & <20>ű<EFBFBD> <20><>Ű<EFBFBD><C5B0> <20>ۼ<EFBFBD>
bool CPatchMaker::UpdatePackage()
{
int i;
std::set<CString> setUpdatePackageFileList;
for( i = 0; i < m_arrIndexToUpdateLocalFile.GetSize(); ++i )
{
FilePatchInfoRecord &rFpir = m_LocalPatchInfo.GetList()[ m_arrIndexToUpdateLocalFile[i] ];
if( '\0' != rFpir.szPackageFileName[0] ) // <20><>Ű<EFBFBD><C5B0> <20><><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> <20><> <20><><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD> <20>ƴ<EFBFBD> <20><><EFBFBD><EFBFBD>(<28>̹<EFBFBD> <20><>Ű<EFBFBD><C5B0><EFBFBD><EFBFBD> <20><><EFBFBD><20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD>)
{
// <20>޾ƿ<DEBE> <20><>Ű<EFBFBD><C5B0> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>Ͽ<EFBFBD> <20>̹<EFBFBD> <20><><EFBFBD>ϵǾ<CFB5><C7BE>ִ<EFBFBD><D6B4><EFBFBD> Ȯ<><C8AE>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߰<EFBFBD>)
setUpdatePackageFileList.insert( CString(rFpir.szPackageFileName) );
}
}
// <20><>Ű<EFBFBD><C5B0> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><><C8A4> <20>ٿ<EFBFBD><D9BF>ε<EFBFBD>)
std::set<CString>::iterator it;
switch( m_SourceType )
{
case FILE_ON_LOCAL:
{
// copy packages from src to dest
for(it = setUpdatePackageFileList.begin();
it != setUpdatePackageFileList.end(); ++it )
{
CString &rstr = *it;
CopyFile( m_strPackageFilePath+(*it)+".zip", m_strDestFilePath+(*it)+".zip", FALSE );
}
}
break;
case FILE_ON_FTP:
{
CInternetSession isess;
CFtpConnection* pFtp = isess.GetFtpConnection( m_strFTPServerAddr, m_strFTPAccount, m_strFTPPassword, m_nFTPPort, m_bPassiveMode );
pFtp->SetCurrentDirectory( m_strPackageFilePath );
for(it = setUpdatePackageFileList.begin(); it != setUpdatePackageFileList.end(); ++it )
{
pFtp->GetFile( (*it)+".zip", m_strDestFilePath+(*it)+".zip" );
Sleep(1);
}
pFtp->Close();
isess.Close();
}
break;
}
// package update, Ȥ<><C8A4> <20>ű<EFBFBD> package <20>ۼ<EFBFBD>
for( i = 0; i < m_arrIndexToUpdateLocalFile.GetSize(); ++i )
{
Sleep(1);
FilePatchInfoRecord &rFpir = m_LocalPatchInfo.GetList()[ m_arrIndexToUpdateLocalFile[i] ];
if( '\0' == rFpir.szPackageFileName[0] )
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ű<EFBFBD><C5B0> <20≯<EFBFBD> <20>ʵ尡 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -> <20>ű<EFBFBD> or <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ű<EFBFBD><C5B0><EFBFBD><EFBFBD> <20>߰<EFBFBD>
//
// <20><><EFBFBD><EFBFBD> : <20><>Ű<EFBFBD><C5B0> <20≯<EFBFBD> <20>ʵ尡 <20><><EFBFBD><EFBFBD> <20>ִٰ<D6B4> <20>ؼ<EFBFBD> <20>׻<EFBFBD> <20>ű<EFBFBD> <20><>Ű<EFBFBD><C5B0><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>°<EFBFBD> <20>ƴϴ<C6B4>.
// <20>ֱٿ<D6B1> <20><><EFBFBD><EFBFBD> <20>ű<EFBFBD> <20><>Ű<EFBFBD><C5B0><EFBFBD><EFBFBD> <20><> ä<><C3A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD> <20>ű⿡ <20><><EFBFBD><EFBFBD><EEB0A1> <20><><EFBFBD><EFBFBD>
if( m_strCurrentNewPackageFileName == "" )
{
// <20><>Ű<EFBFBD><C5B0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>űԷ<C5B1> <20><><EFBFBD><EFBFBD><EFBFBD>ų<EFBFBD>
m_strCurrentNewPackageFileName = GetNextPackageFileName();
m_ZipArc.Open( m_strDestFilePath+m_strCurrentNewPackageFileName+".zip", CZipArchive::zipCreate );
}
else
{
// granular <20><EFBFBD><EBB7AE> <20><> ä<><C3A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ű<EFBFBD><C5B0><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>װ<EFBFBD><D7B0><EFBFBD> <20><><EFBFBD><EFBFBD>
m_ZipArc.Open( m_strDestFilePath+m_strCurrentNewPackageFileName+".zip", CZipArchive::zipOpen );
}
m_ZipArc.SetRootPath( m_strLocalFilePath );
CZipAddNewFileInfo zanfi( m_strLocalFilePath+rFpir.szFileName, false );
zanfi.Defaults();
m_ZipArc.AddNewFile( zanfi );
m_ZipArc.Close();
// patchinfo <20><> <20><><EFBFBD>ϵ<EFBFBD> <20><>Ű<EFBFBD><C5B0> <20≯<EFBFBD> <20>ʵ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ
strcpy( rFpir.szPackageFileName, m_strCurrentNewPackageFileName );
DWORD dwPackageSize = GetFileSize( m_strDestFilePath+m_strCurrentNewPackageFileName+".zip" );
// <20><>Ű<EFBFBD><C5B0> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><20>Ѿ<D1BE><EEB0AC> <20><><EFBFBD><EFBFBD> or <20>ܵ<EFBFBD><DCB5><EFBFBD>Ű<EFBFBD><C5B0>ȭ <20>ؾ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD>(Client.exe <20><><EFBFBD><EFBFBD>) <20><> <20><><EFBFBD><EFBFBD>
bool bSoleFile = IsSoleFileWithSubDir( rFpir.szFileName );
if( dwPackageSize > m_dwPackageMaxSize || bSoleFile )
{
m_ZipArc.Open( m_strDestFilePath+m_strCurrentNewPackageFileName+".zip", CZipArchive::zipOpen );
if( 1 == m_ZipArc.GetCount( true ) )
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ϳ<EFBFBD><CFB3><EFBFBD><EFBFBD>ϰ<EFBFBD><CFB0><EFBFBD> <20><>¿<EFBFBD><C2BF> <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD> <20>н<EFBFBD>
m_ZipArc.Close();
}
else
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
int nIdx = m_ZipArc.FindFile( rFpir.szFileName, CZipArchive::ffCaseSens, false );
m_ZipArc.DeleteFile( nIdx );
m_ZipArc.Close();
// ...<2E><> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><>Ű<EFBFBD><C5B0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ű⿡ <20><><EFBFBD><EFBFBD> <20>߰<EFBFBD>
m_strCurrentNewPackageFileName = GetNextPackageFileName();
m_ZipArc.Open( m_strDestFilePath+m_strCurrentNewPackageFileName+".zip", CZipArchive::zipCreate );
m_ZipArc.SetRootPath( m_strLocalFilePath );
CZipAddNewFileInfo zanfi( m_strLocalFilePath+rFpir.szFileName, false );
zanfi.Defaults();
m_ZipArc.AddNewFile( zanfi );
m_ZipArc.Close();
// patchinfo <20><> <20><><EFBFBD>ϵ<EFBFBD> <20><>Ű<EFBFBD><C5B0> <20≯<EFBFBD> <20>ʵ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ
strcpy( rFpir.szPackageFileName, m_strCurrentNewPackageFileName );
}
// <20>ܵ<EFBFBD><DCB5><EFBFBD>Ű<EFBFBD><C5B0>ȭ <20>ؾ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>Ŀ<EFBFBD> <20>߰<EFBFBD><DFB0>Ǵ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
// (current<6E><74>Ű<EFBFBD><C5B0> <20≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD><EFBFBD> -> <20><><EFBFBD><EFBFBD> <20>Ͽ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD>)
if( bSoleFile )
{
/*
m_strCurrentNewPackageFileName = GetNextPackageFileName();
m_ZipArc.Open( m_strDestFilePath+m_strCurrentNewPackageFileName+".zip", CZipArchive::zipCreate );
m_ZipArc.SetRootPath( m_strLocalFilePath );
m_ZipArc.Close();
*/
m_strCurrentNewPackageFileName = "";
}
}
//strcpy( rFpir.szPackageFileName, m_strCurrentNewPackageFileName );
}
else
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ű<EFBFBD><C5B0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ(replace file)
m_ZipArc.Open( m_strDestFilePath+rFpir.szPackageFileName+".zip", CZipArchive::zipOpen );
int nIdx = m_ZipArc.FindFile( rFpir.szFileName, CZipArchive::ffCaseSens, false );
if( -1 == nIdx )
{
CString strErr;
strErr.Format( "%s <20><>Ű<EFBFBD><C5B0> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> %s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>", rFpir.szPackageFileName, rFpir.szFileName );
AfxMessageBox( strErr );
}
else
{
m_ZipArc.DeleteFile( nIdx );
}
m_ZipArc.SetRootPath( m_strLocalFilePath );
CZipAddNewFileInfo zanfi( m_strLocalFilePath+rFpir.szFileName, false );
zanfi.Defaults();
m_ZipArc.AddNewFile( zanfi );
m_ZipArc.Close( CZipArchive::afNoException, true );
}
}
return true;
}
//////////////////////////////////////////////////////////////////////////
// PatchInfo <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>&<26><><EFBFBD><EFBFBD>
bool CPatchMaker::UpdatePatchInfo()
{
// PatchInfo <20><><EFBFBD><EFBFBD>
m_LocalPatchInfo.SetVersion( m_dwUpdateVersion );
m_LocalPatchInfo.Save( m_strDestFilePath+"PatchInfoV2" );
// PatchInfo <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
CZipArchive zipArc;
zipArc.Open( m_strDestFilePath+"PatchInfoV2.zip", CZipArchive::zipCreate );
zipArc.AddNewFile( m_strDestFilePath+"PatchInfoV2", "PatchInfoV2" );
zipArc.Close();
DeleteFile( m_strDestFilePath+"PatchInfoV2");
// CInternetSession isess;
// CFtpConnection* pFtp = isess.GetFtpConnection( "211.233.42.245", "ryl", "fldjzk!$", 21, m_bPassiveMode );
// pFtp->SetCurrentDirectory( m_strPackageFilePath );
// pFtp->GetFile( "PatchInfo.zip", m_strDestFilePath+"PatchInfo.zip" );
// pFtp->Close();
// isess.Close();
return true;
}
//////////////////////////////////////////////////////////////////////////
//
// <20><> <20><>Ű<EFBFBD><C5B0> <20><><EFBFBD><EFBFBD> <20≯<EFBFBD> <20><><EFBFBD><EFBFBD>
// (<28><><EFBFBD><EFBFBD> <20≯<EFBFBD> <20><> Ȯ<><C8AE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>)
const char* CPatchMaker::GetNextPackageFileName()
{
static char szBuff[MAX_PACKAGE_FILE_NAME_LENGTH*2];
CTime t = CTime::GetCurrentTime();
CString strHeader = t.Format( "%Y%m%d_%H%M_" );
int n = 0;
char szTmp[4];
while( n < 1000 )
{
sprintf( szTmp, "%03d", n );
CString strFileName = m_strDestFilePath + strHeader + szTmp + ".zip";
// if( 0xFFFFFFFF == GetFileAttributes( strFileName ) )
// {
// if( ERROR_FILE_NOT_FOUND == GetLastError() )
// {
// strcpy( szBuff, strHeader+szTmp );
// break;
// }
// }
if( !IsFileExist( strFileName ) )
{
strcpy( szBuff, strHeader+szTmp );
break;
}
++n;
}
if( 1000 == n )
{
return NULL;
}
return szBuff;
}
bool CPatchMaker::IsExcludedFile( const char* szFileName )
{
for( int i = 0; i < m_astrFileNameExclusionList.GetSize(); ++i )
{
if( 0 == stricmp( szFileName, m_astrFileNameExclusionList[i] ) )
{
return true;
}
}
// hard-coded exclusion list
if( 0 == stricmp( szFileName, "." ) ) return true;
if( 0 == stricmp( szFileName, ".." ) ) return true;
if( 0 == stricmp( szFileName, "vssver.scc" ) ) return true;
return false;
}
bool CPatchMaker::IsExcludedFileWithSubDir( const char* szFileNameWithSubDir )
{
for( int i = 0; i < m_astrFileNameWithSubDirExclusionList.GetSize(); ++i )
{
if( 0 == stricmp( szFileNameWithSubDir, m_astrFileNameWithSubDirExclusionList[i] ) )
{
return true;
}
}
// hard-coded exclusion list
if( 0 == stricmp( szFileNameWithSubDir, "mp.ini" ) ) return true;
if( 0 == stricmp( szFileNameWithSubDir, "RenderOption.dat" ) ) return true;
if( 0 == stricmp( szFileNameWithSubDir, "ClientOption.dat" ) ) return true;
if( 0 == stricmp( szFileNameWithSubDir, "Patchinfo.pat" ) ) return true;
if( 0 == stricmp( szFileNameWithSubDir, "UpdateFileList.txt" ) ) return true;
if( 0 == stricmp( szFileNameWithSubDir, "VersionInfo.dat" ) ) return true;
if( 0 == stricmp( szFileNameWithSubDir, "Login.dat" ) ) return true;
if( 0 == stricmp( szFileNameWithSubDir, "LoginRes.dll" ) ) return true;
if( 0 == stricmp( szFileNameWithSubDir, "Patchinfo.cache" ) ) return true;
if( 0 == stricmp( szFileNameWithSubDir, "Patchinfo.local" ) ) return true;
if( 0 == stricmp( szFileNameWithSubDir, "LC2.OGG" ) ) return true;
if( 0 == stricmp( szFileNameWithSubDir, "Z3D_SetupDirectX.exe" ) ) return true;
if( 0 == stricmp( szFileNameWithSubDir, "DirectXInstaller.exe" ) ) return true;
if( 0 == stricmp( szFileNameWithSubDir, "FileChecker.exe" ) ) return true;
if( 0 == stricmp( szFileNameWithSubDir, "DSETUP.dll" ) ) return true;
if( 0 == stricmp( szFileNameWithSubDir, "dsetup32.dll" ) ) return true;
return false;
}
bool CPatchMaker::IsExcludedSubDir( const char* szSubDir )
{
for( int i = 0; i < m_astrSubDirExclusionList.GetSize(); ++i )
{
if( 0 == stricmp( szSubDir, m_astrSubDirExclusionList[i] ) )
{
return true;
}
}
// hard-coded exclusion list
//if( 0 == stricmp( szSubDir, "GameGuard" ) ) return true;
if( !m_bCheckNoticeFolder && 0 == stricmp( szSubDir, "Notice" ) ) return true;
//if( 0 == stricmp( szSubDir, "update" ) ) return true;
if( 0 == stricmp( szSubDir, "DirectX" ) ) return true;
return false;
}
// <20><><EFBFBD><EFBFBD> <20><>Ű<EFBFBD><C5B0><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ΰ<EFBFBD>?
bool CPatchMaker::IsSoleFileWithSubDir( const char* szFileNameWithSubDir )
{
// for( int i = 0; i < m_astrSubDirSoleFileList.GetSize(); ++i )
// {
// if( 0 == stricmp( szSubDir, m_astrSubDirSoleFileList[i] ) )
// {
// return true;
// }
// }
// hard-coded sole file list
if( 0 == stricmp( szFileNameWithSubDir, "Client.exe" ) ) return true;
if( 0 == stricmp( szFileNameWithSubDir, "Login.new" ) ) return true;
if( 0 == stricmp( szFileNameWithSubDir, "ItemScript.gsf" ) ) return true;
if( 0 == stricmp( szFileNameWithSubDir, "MonsterProtoType.gsf" ) ) return true;
if( 0 == stricmp( szFileNameWithSubDir, "script1.gsf" ) ) return true;
if( 0 == stricmp( szFileNameWithSubDir, "SkillScript.gsf" ) ) return true;
if( 0 == stricmp( szFileNameWithSubDir, "npcscript.mcf" ) ) return true;
if( 0 == stricmp( szFileNameWithSubDir, "quest.mcf" ) ) return true;
if( 0 == stricmp( szFileNameWithSubDir, "Script.mcf" ) ) return true;
// if( 0 == stricmp( szSubDir, "" ) ) return true;
return false;
}
int CPatchMaker::GetPatchInfoVersion()
{
if( false == LoadServerPatchInfoList() )
{
return -1;
}
return (int)m_ServerPatchInfo.GetVersion();
}