new pack system

This commit is contained in:
d1str4ught
2025-09-21 05:28:55 +02:00
parent 775cb2f927
commit 5b1d3c6bce
100 changed files with 5269 additions and 5825 deletions

View File

@@ -3,7 +3,7 @@
#include "Packet.h"
#include "PythonNetworkStream.h"
#include "EterBase/tea.h"
#include "EterPack/EterPackManager.h"
#include "PackLib/PackManager.h"
// CHINA_CRYPT_KEY
extern DWORD g_adwEncryptKey[4];
@@ -288,7 +288,6 @@ bool CAccountConnector::__AuthState_RecvPanamaPack()
if (!Recv(sizeof(TPacketGCPanamaPack), &kPacket))
return false;
CEterPackManager::instance().RegisterPack(kPacket.szPackName, "*", kPacket.abIV);
return true;
}
@@ -304,7 +303,6 @@ bool CAccountConnector::__AuthState_RecvHybridCryptKeys(int iTotalSize)
if (!Recv(kPacket.iKeyStreamLen, kPacket.m_pStream))
return false;
CEterPackManager::Instance().RetrieveHybridCryptPackKeys( kPacket.m_pStream );
return true;
}
@@ -320,7 +318,6 @@ bool CAccountConnector::__AuthState_RecvHybridCryptSDB(int iTotalSize)
if (!Recv(kPacket.iSDBStreamLen, kPacket.m_pStream))
return false;
CEterPackManager::Instance().RetrieveHybridCryptPackSDB( kPacket.m_pStream );
return true;
}
@@ -363,7 +360,6 @@ bool CAccountConnector::__AuthState_RecvAuthSuccess()
else
{
DWORD dwPanamaKey = kAuthSuccessPacket.dwLoginKey ^ g_adwEncryptKey[0] ^ g_adwEncryptKey[1] ^ g_adwEncryptKey[2] ^ g_adwEncryptKey[3];
CEterPackManager::instance().DecryptPackIV(dwPanamaKey);
CPythonNetworkStream & rkNet = CPythonNetworkStream::Instance();
rkNet.SetLoginKey(kAuthSuccessPacket.dwLoginKey);

View File

@@ -17,17 +17,18 @@ target_link_libraries(UserInterface
EterImageLib
EterLib
EterLocale
EterPack
EterPythonLib
GameLib
PRTerrainLib
ScriptLib
SpeedTreeLib
SphereLib
PackLib
cryptopp-static
lzo2
libzstd_static
mio
DirectX
Granny

View File

@@ -3,7 +3,6 @@
#include "PythonApplication.h"
#include "resource.h"
#include "EterBase/CRC32.h"
#include "EterPack/EterPackManager.h"
#include "EterLocale/Japanese.h"
#include <windowsx.h>

View File

@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "MarkImage.h"
#include "EterBase/lzo.h"
#include <stb_image.h>
#include <stb_image_write.h>

View File

@@ -2,6 +2,7 @@
#include "Resource.h"
#include "PythonApplication.h"
#include "EterLib/Camera.h"
#include "PackLib/PackManager.h"
#include <stb_image.h>
@@ -339,15 +340,13 @@ PyObject* appGetImageInfo(PyObject* poSelf, PyObject* poArgs)
}
#endif
#include "EterPack/EterPackManager.h"
PyObject* appIsExistFile(PyObject* poSelf, PyObject* poArgs)
{
char* szFileName;
if (!PyTuple_GetString(poArgs, 0, &szFileName))
return Py_BuildException();
bool isExist=CEterPackManager::Instance().isExist(szFileName);
bool isExist=CPackManager::Instance().IsExist(szFileName);
return Py_BuildValue("i", isExist);
}
@@ -1021,12 +1020,11 @@ class CTextLineLoader
public:
CTextLineLoader(const char * c_szFileName)
{
const VOID* pvData;
CMappedFile kFile;
if (!CEterPackManager::Instance().Get(kFile, c_szFileName, &pvData))
TPackFile kFile;
if (!CPackManager::Instance().GetFile(c_szFileName, kFile))
return;
m_kTextFileLoader.Bind(kFile.Size(), pvData);
m_kTextFileLoader.Bind(kFile.size(), kFile.data());
}
DWORD GetLineCount()

View File

@@ -5,7 +5,7 @@
#include "stdafx.h"
#include "EterLib/CullingManager.h"
#include "EterLib/Camera.h"
#include "EterPack/EterPackManager.h"
#include "PackLib/PackManager.h"
#include "GameLib/MapOutDoor.h"
#include "GameLib/PropertyLoader.h"
@@ -241,19 +241,7 @@ void CPythonBackground::Initialize()
void CPythonBackground::__CreateProperty()
{
if (CEterPackManager::SEARCH_FILE_FIRST == CEterPackManager::Instance().GetSearchMode() &&
_access("property", 0) == 0)
{
m_PropertyManager.Initialize(NULL);
CPropertyLoader PropertyLoader;
PropertyLoader.SetPropertyManager(&m_PropertyManager);
PropertyLoader.Create("*.*", "Property");
}
else
{
m_PropertyManager.Initialize("pack/property");
}
m_PropertyManager.Initialize("pack/property.pck");
}
//////////////////////////////////////////////////////////////////////

View File

@@ -2,7 +2,7 @@
#include "PythonEventManager.h"
#include "PythonNetworkStream.h"
#include "PythonNonPlayer.h"
#include "EterPack/EterPackManager.h"
#include "PackLib/PackManager.h"
#include "PythonMiniMap.h"
#include "AbstractApplication.h"
@@ -104,16 +104,14 @@ void CPythonEventManager::__InitEventSet(TEventSet& rEventSet)
int CPythonEventManager::RegisterEventSet(const char * c_szFileName)
{
CMappedFile File;
LPCVOID pMap;
TPackFile File;
if (!CEterPackManager::Instance().Get(File, c_szFileName, &pMap))
if (!CPackManager::Instance().GetFile(c_szFileName, File))
return -1;
std::string strEventString;
strEventString.resize(File.Size()+1);
File.Read(&strEventString[0], File.Size());
strEventString.resize(File.size() + 1);
memcpy(strEventString.data(), File.data(), File.size());
TEventSet * pEventSet = m_EventSetPool.Alloc();
if (!pEventSet)

View File

@@ -2,7 +2,7 @@
#include "EterLib/StateManager.h"
#include "EterLib/GrpSubImage.h"
#include "EterLib/Camera.h"
#include "EterPack/EterPackManager.h"
#include "PackLib/PackManager.h"
#include "PythonMiniMap.h"
#include "PythonBackground.h"
@@ -878,7 +878,7 @@ bool CPythonMiniMap::LoadAtlas()
char atlasFileName[1024+1];
snprintf(atlasFileName, sizeof(atlasFileName), "%s/atlas.sub", rkMap.GetName().c_str());
if (!CEterPackManager::Instance().isExist(atlasFileName))
if (!CPackManager::Instance().IsExist(atlasFileName))
{
snprintf(atlasFileName, sizeof(atlasFileName), "d:/ymir work/ui/atlas/%s/atlas.sub", rkMap.GetName().c_str());
}

View File

@@ -17,7 +17,6 @@
#include "PythonMessenger.h"
#include "PythonApplication.h"
#include "EterPack/EterPackManager.h"
#include "GameLib/ItemManager.h"
#include "AbstractApplication.h"

View File

@@ -2,7 +2,7 @@
#include "PythonNetworkStream.h"
#include "PythonApplication.h"
#include "Packet.h"
#include "EterPack/EterPackManager.h"
#include "PackLib/PackManager.h"
// HandShake ---------------------------------------------------------------------------
void CPythonNetworkStream::HandShakePhase()
@@ -173,7 +173,6 @@ bool CPythonNetworkStream::RecvHybridCryptKeyPacket()
if (!Recv(kPacket.iKeyStreamLen, kPacket.m_pStream))
return false;
CEterPackManager::Instance().RetrieveHybridCryptPackKeys( kPacket.m_pStream );
return true;
}
@@ -193,7 +192,6 @@ bool CPythonNetworkStream::RecvHybridCryptSDBPacket()
if (!Recv(kPacket.iSDBStreamLen, kPacket.m_pStream))
return false;
CEterPackManager::Instance().RetrieveHybridCryptPackSDB( kPacket.m_pStream );
return true;
}

View File

@@ -3,10 +3,8 @@
#include "Packet.h"
#include "PythonApplication.h"
#include "NetworkActorManager.h"
#include "AbstractPlayer.h"
#include "EterPack/EterPackManager.h"
#include "PackLib/PackManager.h"
void CPythonNetworkStream::EnableChatInsultFilter(bool isEnable)
{
@@ -33,13 +31,12 @@ bool CPythonNetworkStream::IsInsultIn(const char* c_szMsg)
bool CPythonNetworkStream::LoadInsultList(const char* c_szInsultListFileName)
{
CMappedFile file;
const VOID* pvData;
if (!CEterPackManager::Instance().Get(file, c_szInsultListFileName, &pvData))
TPackFile file;
if (!CPackManager::Instance().GetFile(c_szInsultListFileName, file))
return false;
CMemoryTextFileLoader kMemTextFileLoader;
kMemTextFileLoader.Bind(file.Size(), pvData);
kMemTextFileLoader.Bind(file.size(), file.data());
m_kInsultChecker.Clear();
for (DWORD dwLineIndex=0; dwLineIndex<kMemTextFileLoader.GetLineCount(); ++dwLineIndex)
@@ -55,9 +52,8 @@ bool CPythonNetworkStream::LoadConvertTable(DWORD dwEmpireID, const char* c_szFi
if (dwEmpireID<1 || dwEmpireID>=4)
return false;
CMappedFile file;
const VOID* pvData;
if (!CEterPackManager::Instance().Get(file, c_szFileName, &pvData))
TPackFile file;
if (!CPackManager::Instance().GetFile(c_szFileName, file))
return false;
DWORD dwEngCount=26;
@@ -65,10 +61,10 @@ bool CPythonNetworkStream::LoadConvertTable(DWORD dwEmpireID, const char* c_szFi
DWORD dwHanSize=dwHanCount*2;
DWORD dwFileSize=dwEngCount*2+dwHanSize;
if (file.Size()<dwFileSize)
if (file.size()<dwFileSize)
return false;
char* pcData=(char*)pvData;
char* pcData=(char*)file.data();
STextConvertTable& rkTextConvTable=m_aTextConvTable[dwEmpireID-1];
memcpy(rkTextConvTable.acUpper, pcData, dwEngCount);pcData+=dwEngCount;

View File

@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "EterPack/EterPackManager.h"
#include "EterBase/lzo.h"
#include "PackLib/PackManager.h"
#include "pythonnonplayer.h"
#include "InstanceBase.h"
#include "PythonCharacterManager.h"
@@ -14,17 +15,15 @@ bool CPythonNonPlayer::LoadNonPlayerData(const char * c_szFileName)
6822045
};
CMappedFile file;
LPCVOID pvData;
TPackFile file;
Tracef("CPythonNonPlayer::LoadNonPlayerData: %s, sizeof(TMobTable)=%u\n", c_szFileName, sizeof(TMobTable));
if (!CEterPackManager::Instance().Get(file, c_szFileName, &pvData))
if (!CPackManager::Instance().GetFile(c_szFileName, file))
return false;
DWORD dwFourCC, dwElements, dwDataSize;
file.Read(&dwFourCC, sizeof(DWORD));
memcpy(&dwFourCC, file.data(), sizeof(DWORD));
if (dwFourCC != MAKEFOURCC('M', 'M', 'P', 'T'))
{
@@ -32,11 +31,11 @@ bool CPythonNonPlayer::LoadNonPlayerData(const char * c_szFileName)
return false;
}
file.Read(&dwElements, sizeof(DWORD));
file.Read(&dwDataSize, sizeof(DWORD));
memcpy(&dwElements, file.data() + sizeof(DWORD), sizeof(DWORD));
memcpy(&dwDataSize, file.data() + sizeof(DWORD) * 2, sizeof(DWORD));
BYTE * pbData = new BYTE[dwDataSize];
file.Read(pbData, dwDataSize);
memcpy(pbData, file.data() + sizeof(DWORD) * 3, dwDataSize);
/////
CLZObject zObj;

View File

@@ -1,5 +1,5 @@
#include "StdAfx.h"
#include "EterPack/EterPackManager.h"
#include "PackLib/PackManager.h"
#include "EterBase/tea.h"
// CHINA_CRYPT_KEY
@@ -45,7 +45,7 @@ PyObject * packExist(PyObject * poSelf, PyObject * poArgs)
if (!PyTuple_GetString(poArgs, 0, &strFileName))
return Py_BuildException();
return Py_BuildValue("i", CEterPackManager::Instance().isExist(strFileName)?1:0);
return Py_BuildValue("i", CPackManager::Instance().IsExist(strFileName) ? 1 : 0);
}
PyObject * packGet(PyObject * poSelf, PyObject * poArgs)
@@ -63,11 +63,9 @@ PyObject * packGet(PyObject * poSelf, PyObject * poArgs)
(stricmp(pcExt, ".pyc") == 0) ||
(stricmp(pcExt, ".txt") == 0))
{
CMappedFile file;
const void * pData = NULL;
if (CEterPackManager::Instance().Get(file,strFileName,&pData))
return Py_BuildValue("s#",pData, file.Size());
TPackFile file;
if (CPackManager::Instance().GetFile(strFileName, file))
return Py_BuildValue("s#",file.data(), file.size());
}
}

View File

@@ -2,7 +2,7 @@
#include "PythonSkill.h"
#include "EterBase/Poly/Poly.h"
#include "EterPack/EterPackManager.h"
#include "PackLib/PackManager.h"
#include "InstanceBase.h"
#include "PythonPlayer.h"
@@ -89,13 +89,12 @@ void string_replace_word(const char* base, int base_len, const char* src, int sr
bool CPythonSkill::RegisterSkillTable(const char * c_szFileName)
{
const VOID* pvData;
CMappedFile kFile;
if (!CEterPackManager::Instance().Get(kFile, c_szFileName, &pvData))
TPackFile kFile;
if (!CPackManager::Instance().GetFile(c_szFileName, kFile))
return false;
CMemoryTextFileLoader textFileLoader;
textFileLoader.Bind(kFile.Size(), pvData);
textFileLoader.Bind(kFile.size(), kFile.data());
// OVERWRITE_SKILLPROTO_POLY
std::string src_poly_rand;
@@ -279,13 +278,12 @@ void CPythonSkill::__RegisterNormalIconImage(TSkillData & rData, const char * c_
extern const DWORD c_iSkillIndex_Riding;
bool CPythonSkill::RegisterSkillDesc(const char * c_szFileName)
{
const VOID* pvData;
CMappedFile kFile;
if (!CEterPackManager::Instance().Get(kFile, c_szFileName, &pvData))
TPackFile kFile;
if (!CPackManager::Instance().GetFile(c_szFileName, kFile))
return false;
CMemoryTextFileLoader textFileLoader;
textFileLoader.Bind(kFile.Size(), pvData);
textFileLoader.Bind(kFile.size(), kFile.data());
CTokenVector TokenVector;
for (DWORD i = 0; i < textFileLoader.GetLineCount(); ++i)

View File

@@ -9,9 +9,12 @@
#include <crtdbg.h>
#endif
#include "eterPack/EterPackManager.h"
#include "eterLib/Util.h"
#include "eterBase/CPostIt.h"
#include "EterBase/lzo.h"
#include "PackLib/PackManager.h"
#include <filesystem>
extern "C" {
extern int _fltused;
@@ -136,73 +139,124 @@ bool PackInitialize(const char * c_pszFolder)
if (_access(c_pszFolder, 0) != 0)
return false;
std::string stFolder(c_pszFolder);
stFolder += "/";
std::vector<std::string> packFiles = {
"patch1",
"season3_eu",
"patch2",
"metin2_patch_snow",
"metin2_patch_snow_dungeon",
"metin2_patch_etc_costume1",
"metin2_patch_pet1",
"metin2_patch_pet2",
"metin2_patch_ramadan_costume",
"metin2_patch_flame",
"metin2_patch_flame_dungeon",
"metin2_patch_w21_etc",
"metin2_patch_w21_mobs",
"metin2_patch_w21_mobs_m",
"metin2_patch_dss_box",
"metin2_patch_costume_soccer",
"metin2_patch_easter1",
"metin2_patch_mineral",
"metin2_patch_w20_sound",
"metin2_patch_ds",
"metin2_patch_5th_armor",
"metin2_patch_w20_etc",
"metin2_patch_dragon_rock",
"metin2_patch_dragon_rock_mobs",
"metin2_patch_etc",
"metin2_patch_xmas",
"metin2_patch_eu3",
"metin2_patch_eu4",
"metin2_patch_mundi",
"metin2_patch_sd",
"metin2_patch_halloween",
"metin2_patch_party",
"metin2_patch_dance",
"pc",
"pc2",
"monster",
"monster2",
"effect",
"zone",
"terrain",
"npc",
"npc2",
"tree",
"guild",
"item",
"textureset",
"property",
"icon",
"season1",
"season2",
"outdoora1",
"outdoora2",
"outdoora3",
"outdoorb1",
"outdoorb3",
"outdoorc1",
"outdoorc3",
"outdoorsnow1",
"outdoordesert1",
"outdoorflame1",
"outdoorfielddungeon1",
"outdoort1",
"outdoort2",
"outdoort3",
"outdoort4",
"outdoorwedding",
"outdoormilgyo1",
"indoorspiderdungeon1",
"indoordeviltower1",
"indoormonkeydungeon1",
"indoormonkeydungeon2",
"indoormonkeydungeon3",
"outdoortrent",
"outdoortrent02",
"outdoorguild1",
"outdoorguild2",
"outdoorguild3",
"outdoorduel",
"outdoorgmguildbuild",
"sound",
"sound_m",
"sound2",
"bgm",
"locale_ca",
"locale_ae",
"locale_de",
"locale_es",
"locale_fr",
"locale_gr",
"locale_it",
"locale_nl",
"locale_pl",
"locale_pt",
"locale_tr",
"locale_uk",
"locale_bg",
"locale_en",
"locale_mx",
"locale_ro",
"locale_ru",
"locale_dk",
"locale_cz",
"locale_hu",
"locale_us",
"locale_pa",
"uiscript",
"ETC",
"uiloading",
};
std::string stFileName(stFolder);
stFileName += "Index";
std::filesystem::path folderPath = c_pszFolder;
CMappedFile file;
LPCVOID pvData;
if (!file.Create(stFileName.c_str(), &pvData, 0, 0))
{
LogBoxf("FATAL ERROR! File not exist: %s", stFileName.c_str());
TraceError("FATAL ERROR! File not exist: %s", stFileName.c_str());
return true;
CPackManager::instance().AddPack((folderPath / "root.pck").generic_string());
for (const std::string& packFileName : packFiles) {
CPackManager::instance().AddPack((folderPath / (packFileName + ".pck")).generic_string());
}
CMemoryTextFileLoader TextLoader;
TextLoader.Bind(file.Size(), pvData);
bool bPackFirst = TRUE;
const std::string& strPackType = TextLoader.GetLineString(0);
if (strPackType.compare("FILE") && strPackType.compare("PACK"))
{
TraceError("Pack/Index has invalid syntax. First line must be 'PACK' or 'FILE'");
return false;
}
#ifdef _DISTRIBUTE
Tracef("알림: 팩 모드입니다.\n");
//if (0 == strPackType.compare("FILE"))
//{
// bPackFirst = FALSE;
// Tracef("알림: 파일 모드입니다.\n");
//}
//else
//{
// Tracef("알림: 팩 모드입니다.\n");
//}
#else
bPackFirst = FALSE;
Tracef("알림: 파일 모드입니다.\n");
#endif
CTextFileLoader::SetCacheMode();
#if defined(USE_RELATIVE_PATH)
CEterPackManager::Instance().SetRelativePathMode();
#endif
CEterPackManager::Instance().SetCacheMode();
CEterPackManager::Instance().SetSearchMode(bPackFirst);
std::string strPackName, strTexCachePackName;
for (DWORD i = 1; i < TextLoader.GetLineCount() - 1; i += 2)
{
const std::string & c_rstFolder = TextLoader.GetLineString(i);
const std::string & c_rstName = TextLoader.GetLineString(i + 1);
strPackName = stFolder + c_rstName;
strTexCachePackName = strPackName + "_texcache";
CEterPackManager::Instance().RegisterPack(strPackName.c_str(), c_rstFolder.c_str());
CEterPackManager::Instance().RegisterPack(strTexCachePackName.c_str(), c_rstFolder.c_str());
}
CEterPackManager::Instance().RegisterRootPack((stFolder + std::string("root")).c_str());
NANOEND
return true;
}
@@ -362,7 +416,7 @@ bool Main(HINSTANCE hInstance, LPSTR lpCmdLine)
#endif
static CLZO lzo;
static CEterPackManager EterPackManager;
CPackManager packMgr;
if (!PackInitialize("pack"))
{