Help me please,
My client dosn't read packed data files
I am using the compiled 1.18.201 client source code.
mapeditor and regentool are read packed data successfully,
but only my client dosn't read it
I think that the Unicode character set cause this problem
mapeditor and regentool are using Multibyte character set
If someone have knolodge about this problem, plz hel me
----------------------------- FilePackSystem.cpp --------------------------------
bool cFilePackSystem::Init()
{
/// 파일 팩을 검색
cFileFinder fileFinder;
cStringT findPath;
cStringT packName;
cStringT pathName;
for( unsigned int i = FOLDER_DATA; i < FOLDER_COUNT; ++i )
{
findPath.Format( _T("%s*.pack"), gFolderNames );
if( fileFinder.FindFirst( findPath.Cstr() ) == false )
continue;
do
{
cFilePack* pack = new cFilePack;
/// 파일 팩을 엶
packName.Format( _T("%s%s"), gFolderNames, fileFinder.GetFileName() );
if( pack->Open( packName.Cstr(), cFilePack::OPEN_READONLY ) == false )
{
delete pack;
MessageBox(NULL, _T("Failed Open pack file.. reinstall client."), _T("Error"), MB_OK | MB_ICONEXCLAMATION );
continue;
}
/// 패스워드를 설정
//pack->SetPassword( PACK_PASSWORD );
pack->SetPasswordEx( g_packKey.GetKey(), g_packKey.GetKeyLenth() );
/// 파일 팩을 추가
unsigned int packIndex = mFilePackArray.GetSize();
unsigned int fileIndex;
mFilePackArray.PushBack( pack );
/// 파일 인덱스를 맵에 추가
cFileInPackInfo fipi;
for( unsigned int j = 0, jend = pack->GetNumFiles(); j < jend; ++j )
{
pack->GetFileInfo( &fipi, j );
if( fipi.IsDirectory() )
continue;
fileIndex = j;
fileIndex <<= 8;
fileIndex += packIndex;
#ifdef _UNICODE
///
char cstr[MAX_PATH] = {0,};
ConvertToAscii( fipi.GetPathName().Cstr(), cstr, MAX_PATH );
cString tempName = cstr;
cStringW tempNameW = fipi.GetPathName().Cstr();
#else
///
wchar_t cstr[MAX_PATH] = {0,};
ConvertToUnicode( fipi.GetPathName().Cstr(), cstr, MAX_PATH );
cString tempName = fipi.GetPathName().Cstr();
cStringW tempNameW = cstr;
#endif
tempName.ToLower();
tempNameW.ToLower();
/// 명확성 검사. fipi.pathname 과 filename을 비교하여 현재 맞는 경로에 있는 pack 파일을 열었는지 검사.
/// 게임 설치 폴더 안에 pack 파일이 다른 곳으로 옮겨 졌거나, 다른 이름으로 저장되었다면 현재 pack 파일 무시.
if( _tcsnicmp( packName.Cstr(), fipi.GetPathName().Cstr(), _tcslen(packName.Cstr()) - 5 ) != 0 )
break;
mFileIndexMap.Insert( tempName, fileIndex );
mFileIndexMapW.Insert( tempNameW, fileIndex );
}
}
while( fileFinder.FindNext() );
}
fileFinder.Close();
return true;
}