Changed: #1051 Create a console-based working patcher

This commit is contained in:
kervala 2010-08-03 23:05:05 +02:00
parent 9acff6c04d
commit 6dec92b54b
10 changed files with 763 additions and 53 deletions

View file

@ -3,9 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C++ Express 2008 # Visual C++ Express 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client", "src\client.vcproj", "{0B58874C-AFD1-4A30-9C43-135D36A0A8C7}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client", "src\client.vcproj", "{0B58874C-AFD1-4A30-9C43-135D36A0A8C7}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{263C0F2E-112D-437F-A6AB-DEA151A7A1F0} = {263C0F2E-112D-437F-A6AB-DEA151A7A1F0}
{44B21233-EFCC-4825-B5E5-3A3BD6CC5516} = {44B21233-EFCC-4825-B5E5-3A3BD6CC5516} {44B21233-EFCC-4825-B5E5-3A3BD6CC5516} = {44B21233-EFCC-4825-B5E5-3A3BD6CC5516}
{9440443B-97BA-43C2-A762-31EEC8958BEE} = {9440443B-97BA-43C2-A762-31EEC8958BEE}
{F74C0046-00DA-4A77-9B4D-D9FE5831E705} = {F74C0046-00DA-4A77-9B4D-D9FE5831E705} {F74C0046-00DA-4A77-9B4D-D9FE5831E705} = {F74C0046-00DA-4A77-9B4D-D9FE5831E705}
{4B320F68-0B9B-4065-A2ED-AF5D4B163006} = {4B320F68-0B9B-4065-A2ED-AF5D4B163006} {4B320F68-0B9B-4065-A2ED-AF5D4B163006} = {4B320F68-0B9B-4065-A2ED-AF5D4B163006}
{9D284C6B-BE12-4549-87E5-2337D64F31BE} = {9D284C6B-BE12-4549-87E5-2337D64F31BE} {9D284C6B-BE12-4549-87E5-2337D64F31BE} = {9D284C6B-BE12-4549-87E5-2337D64F31BE}
@ -16,7 +14,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client", "src\client.vcproj
{4AF7ADB2-DAF8-4F04-9793-F92010001470} = {4AF7ADB2-DAF8-4F04-9793-F92010001470} {4AF7ADB2-DAF8-4F04-9793-F92010001470} = {4AF7ADB2-DAF8-4F04-9793-F92010001470}
{296D8FB5-DB32-48DD-A6AF-10A77A5DEE70} = {296D8FB5-DB32-48DD-A6AF-10A77A5DEE70} {296D8FB5-DB32-48DD-A6AF-10A77A5DEE70} = {296D8FB5-DB32-48DD-A6AF-10A77A5DEE70}
{1DDC11C7-AF79-40F3-A6D4-F84BA8644B5C} = {1DDC11C7-AF79-40F3-A6D4-F84BA8644B5C} {1DDC11C7-AF79-40F3-A6D4-F84BA8644B5C} = {1DDC11C7-AF79-40F3-A6D4-F84BA8644B5C}
{1D9576F6-3321-4036-8C86-B5361CCCD4FB} = {1D9576F6-3321-4036-8C86-B5361CCCD4FB}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "game_share", "..\common\src\game_share\game_share.vcproj", "{4B320F68-0B9B-4065-A2ED-AF5D4B163006}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "game_share", "..\common\src\game_share\game_share.vcproj", "{4B320F68-0B9B-4065-A2ED-AF5D4B163006}"
@ -97,6 +94,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "driver_dsound", "..\..\nel\
{4AF7ADB2-DAF8-4F04-9793-F92010001470} = {4AF7ADB2-DAF8-4F04-9793-F92010001470} {4AF7ADB2-DAF8-4F04-9793-F92010001470} = {4AF7ADB2-DAF8-4F04-9793-F92010001470}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client_patcher", "..\tools\client\client_patcher\client_patcher.vcproj", "{B0323569-5F46-4E7D-A045-56697BEFBF03}"
ProjectSection(ProjectDependencies) = postProject
{44B21233-EFCC-4825-B5E5-3A3BD6CC5516} = {44B21233-EFCC-4825-B5E5-3A3BD6CC5516}
{F74C0046-00DA-4A77-9B4D-D9FE5831E705} = {F74C0046-00DA-4A77-9B4D-D9FE5831E705}
{4B320F68-0B9B-4065-A2ED-AF5D4B163006} = {4B320F68-0B9B-4065-A2ED-AF5D4B163006}
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32 Debug|Win32 = Debug|Win32
@ -232,7 +236,6 @@ Global
{739618D3-04B6-4EB1-BAED-53D3217F5A86}.Release|Win32.ActiveCfg = Release|Win32 {739618D3-04B6-4EB1-BAED-53D3217F5A86}.Release|Win32.ActiveCfg = Release|Win32
{739618D3-04B6-4EB1-BAED-53D3217F5A86}.Release|Win32.Build.0 = Release|Win32 {739618D3-04B6-4EB1-BAED-53D3217F5A86}.Release|Win32.Build.0 = Release|Win32
{739618D3-04B6-4EB1-BAED-53D3217F5A86}.Release|x64.ActiveCfg = Release|x64 {739618D3-04B6-4EB1-BAED-53D3217F5A86}.Release|x64.ActiveCfg = Release|x64
{739618D3-04B6-4EB1-BAED-53D3217F5A86}.Release|x64.Build.0 = Release|x64
{079E2366-3714-4B09-B553-41A44D290F04}.Debug|Win32.ActiveCfg = Debug|Win32 {079E2366-3714-4B09-B553-41A44D290F04}.Debug|Win32.ActiveCfg = Debug|Win32
{079E2366-3714-4B09-B553-41A44D290F04}.Debug|Win32.Build.0 = Debug|Win32 {079E2366-3714-4B09-B553-41A44D290F04}.Debug|Win32.Build.0 = Debug|Win32
{079E2366-3714-4B09-B553-41A44D290F04}.Debug|x64.ActiveCfg = Debug|x64 {079E2366-3714-4B09-B553-41A44D290F04}.Debug|x64.ActiveCfg = Debug|x64
@ -265,6 +268,14 @@ Global
{309F8A55-BFBA-433B-8C3E-CB2223F799C3}.Release|Win32.Build.0 = Release|Win32 {309F8A55-BFBA-433B-8C3E-CB2223F799C3}.Release|Win32.Build.0 = Release|Win32
{309F8A55-BFBA-433B-8C3E-CB2223F799C3}.Release|x64.ActiveCfg = Release|x64 {309F8A55-BFBA-433B-8C3E-CB2223F799C3}.Release|x64.ActiveCfg = Release|x64
{309F8A55-BFBA-433B-8C3E-CB2223F799C3}.Release|x64.Build.0 = Release|x64 {309F8A55-BFBA-433B-8C3E-CB2223F799C3}.Release|x64.Build.0 = Release|x64
{B0323569-5F46-4E7D-A045-56697BEFBF03}.Debug|Win32.ActiveCfg = Debug|Win32
{B0323569-5F46-4E7D-A045-56697BEFBF03}.Debug|Win32.Build.0 = Debug|Win32
{B0323569-5F46-4E7D-A045-56697BEFBF03}.Debug|x64.ActiveCfg = Debug|x64
{B0323569-5F46-4E7D-A045-56697BEFBF03}.Debug|x64.Build.0 = Debug|x64
{B0323569-5F46-4E7D-A045-56697BEFBF03}.Release|Win32.ActiveCfg = Release|Win32
{B0323569-5F46-4E7D-A045-56697BEFBF03}.Release|Win32.Build.0 = Release|Win32
{B0323569-5F46-4E7D-A045-56697BEFBF03}.Release|x64.ActiveCfg = Release|x64
{B0323569-5F46-4E7D-A045-56697BEFBF03}.Release|x64.Build.0 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View file

@ -1,11 +1,11 @@
# These are Windows/MFC apps # These are Windows/MFC apps
IF(WIN32) IF(WIN32)
ADD_SUBDIRECTORY(seven_zip)
ADD_SUBDIRECTORY(bug_report) ADD_SUBDIRECTORY(bug_report)
SET(SEVENZIP_LIBRARY "ryzom_sevenzip") SET(SEVENZIP_LIBRARY "ryzom_sevenzip")
ENDIF(WIN32) ENDIF(WIN32)
ADD_SUBDIRECTORY(client_sheets) ADD_SUBDIRECTORY(client_sheets)
ADD_SUBDIRECTORY(seven_zip)
FILE(GLOB SRC *.cpp *.h motion/*.cpp motion/*.h motion/modes/*.cpp motion/modes/*.h r2/*.h r2/*.cpp r2/dmc/*.h r2/dmc/*.cpp interface_v3/*.h interface_v3/*.cpp) FILE(GLOB SRC *.cpp *.h motion/*.cpp motion/*.h motion/modes/*.cpp motion/modes/*.h r2/*.h r2/*.cpp r2/dmc/*.h r2/dmc/*.cpp interface_v3/*.h interface_v3/*.cpp)

View file

@ -23,6 +23,7 @@
#include "client_sheets/fx_stick_mode.h" #include "client_sheets/fx_stick_mode.h"
#include "nel/misc/smart_ptr.h" #include "nel/misc/smart_ptr.h"
#include "nel/misc/vector.h" #include "nel/misc/vector.h"
#include "nel/3d/animation_time.h"
namespace NL3D namespace NL3D
{ {

View file

@ -79,7 +79,6 @@ static std::vector<std::string> ForceRemovePatchCategories;
// the actual file is updated // the actual file is updated
void tmpFlagMainlandPatchCategories(NLMISC::CConfigFile &cf) void tmpFlagMainlandPatchCategories(NLMISC::CConfigFile &cf)
{ {
#ifdef NL_DEBUG
NLMISC::CConfigFile::CVar *catList = cf.getVarPtr("ForceMainlandPatchCategories"); NLMISC::CConfigFile::CVar *catList = cf.getVarPtr("ForceMainlandPatchCategories");
if (catList) if (catList)
{ {
@ -88,14 +87,12 @@ void tmpFlagMainlandPatchCategories(NLMISC::CConfigFile &cf)
ForceMainlandPatchCategories.push_back(catList->asString(k)); ForceMainlandPatchCategories.push_back(catList->asString(k));
} }
} }
#endif
} }
// TMP for debug : force some category in the patch to be flagged as 'mainland' until // TMP for debug : force some category in the patch to be flagged as 'mainland' until
// the actual file is updated // the actual file is updated
void tmpFlagRemovedPatchCategories(NLMISC::CConfigFile &cf) void tmpFlagRemovedPatchCategories(NLMISC::CConfigFile &cf)
{ {
#ifdef NL_DEBUG
NLMISC::CConfigFile::CVar *catList = cf.getVarPtr("RemovePatchCategories"); NLMISC::CConfigFile::CVar *catList = cf.getVarPtr("RemovePatchCategories");
if (catList) if (catList)
{ {
@ -104,7 +101,6 @@ void tmpFlagRemovedPatchCategories(NLMISC::CConfigFile &cf)
ForceRemovePatchCategories.push_back(catList->asString(k)); ForceRemovePatchCategories.push_back(catList->asString(k));
} }
} }
#endif
} }
@ -191,6 +187,7 @@ public:
}; };
#endif #endif
static std::string ClientRootPath;
// **************************************************************************** // ****************************************************************************
CPatchManager::CPatchManager() : State("t_state"), DataScanState("t_data_scan_state") CPatchManager::CPatchManager() : State("t_state"), DataScanState("t_data_scan_state")
@ -199,8 +196,8 @@ CPatchManager::CPatchManager() : State("t_state"), DataScanState("t_data_scan_st
UpdateBatchFilename = "updt_nl.bat"; UpdateBatchFilename = "updt_nl.bat";
ClientPatchPath = "./unpack/"; // use current directory by default
ClientDataPath = "./data/"; setClientRootPath("./");
VerboseLog = true; VerboseLog = true;
@ -221,6 +218,14 @@ CPatchManager::CPatchManager() : State("t_state"), DataScanState("t_data_scan_st
_StartRyzomAtEnd = true; _StartRyzomAtEnd = true;
} }
// ****************************************************************************
void CPatchManager::setClientRootPath(const std::string& clientRootPath)
{
ClientRootPath = clientRootPath;
ClientPatchPath = ClientRootPath + "unpack/";
ClientDataPath = ClientRootPath + "data/";
}
// **************************************************************************** // ****************************************************************************
void CPatchManager::setErrorMessage(const ucstring &message) void CPatchManager::setErrorMessage(const ucstring &message)
{ {
@ -734,17 +739,23 @@ void CPatchManager::deleteBatchFile()
} }
// **************************************************************************** // ****************************************************************************
void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool wantRyzomRestart) void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool wantRyzomRestart, bool useBatchFile)
{ {
uint nblab = 0; uint nblab = 0;
FILE *fp = NULL;
if (useBatchFile)
{
deleteBatchFile(); deleteBatchFile();
FILE *fp = fopen (UpdateBatchFilename.c_str(), "wt"); fp = fopen (UpdateBatchFilename.c_str(), "wt");
if (fp == 0) if (fp == 0)
{ {
string err = toString("Can't open file '%s' for writing: code=%d %s (error code 29)", UpdateBatchFilename.c_str(), errno, strerror(errno)); string err = toString("Can't open file '%s' for writing: code=%d %s (error code 29)", UpdateBatchFilename.c_str(), errno, strerror(errno));
throw Exception (err); throw Exception (err);
} }
fprintf(fp, "@echo off\n"); fprintf(fp, "@echo off\n");
}
// Unpack files with category ExtractPath non empty // Unpack files with category ExtractPath non empty
const CBNPCategorySet &rDescCats = descFile.getCategories(); const CBNPCategorySet &rDescCats = descFile.getCategories();
@ -767,33 +778,58 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
result = bnpUnpack(rFilename, ClientPatchPath, vFilenames); result = bnpUnpack(rFilename, ClientPatchPath, vFilenames);
} }
catch(...) catch(...)
{
if (useBatchFile)
{ {
fclose(fp); fclose(fp);
}
throw; throw;
} }
if (!result) if (!result)
{ {
//:TODO: handle exception? //:TODO: handle exception?
string err = toString("Error unpacking %s", rFilename.c_str()); string err = toString("Error unpacking %s", rFilename.c_str());
if (useBatchFile)
{
fclose(fp); fclose(fp);
}
throw Exception (err); throw Exception (err);
} }
else else
{ {
for (uint32 fff = 0; fff < vFilenames.size (); fff++) for (uint32 fff = 0; fff < vFilenames.size (); fff++)
{ {
string SrcPath = CPath::standardizeDosPath(ClientPatchPath); string SrcPath = ClientPatchPath;
string SrcName = SrcPath + vFilenames[fff]; string DstPath = rCat.getUnpackTo();
string DstPath = CPath::standardizeDosPath(rCat.getUnpackTo()); NLMISC::CFile::createDirectoryTree(DstPath);
string DstName = DstPath + vFilenames[fff];
NLMISC::CFile::createDirectoryTree(rCat.getUnpackTo());
// this file must be moved // this file must be moved
if (useBatchFile)
{
SrcPath = CPath::standardizeDosPath(SrcPath);
DstPath = CPath::standardizeDosPath(DstPath);
}
std::string SrcName = SrcPath + vFilenames[fff];
std::string DstName = DstPath + vFilenames[fff];
if (useBatchFile)
{
fprintf(fp, ":loop%u\n", nblab); fprintf(fp, ":loop%u\n", nblab);
fprintf(fp, "attrib -r -a -s -h %s\n", DstName.c_str()); fprintf(fp, "attrib -r -a -s -h %s\n", DstName.c_str());
fprintf(fp, "del %s\n", DstName.c_str()); fprintf(fp, "del %s\n", DstName.c_str());
fprintf(fp, "if exist %s goto loop%u\n", DstName.c_str(), nblab); fprintf(fp, "if exist %s goto loop%u\n", DstName.c_str(), nblab);
fprintf(fp, "move %s %s\n", SrcName.c_str(), DstPath.c_str()); fprintf(fp, "move %s %s\n", SrcName.c_str(), DstPath.c_str());
}
else
{
deleteFile(DstName);
CFile::moveFile(DstName.c_str(), SrcName.c_str());
}
nblab++; nblab++;
} }
} }
@ -802,22 +838,44 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
// Finalize batch file // Finalize batch file
if (NLMISC::CFile::isExists("patch") && NLMISC::CFile::isDirectory("patch")) if (NLMISC::CFile::isExists("patch") && NLMISC::CFile::isDirectory("patch"))
{
if (useBatchFile)
{ {
fprintf(fp, ":looppatch\n"); fprintf(fp, ":looppatch\n");
}
vector<string> vFileList; vector<string> vFileList;
CPath::getPathContent ("patch", false, false, true, vFileList, NULL, false); CPath::getPathContent ("patch", false, false, true, vFileList, NULL, false);
for(uint32 i = 0; i < vFileList.size(); ++i) for(uint32 i = 0; i < vFileList.size(); ++i)
{
if (useBatchFile)
{
fprintf(fp, "del %s\n", CPath::standardizeDosPath(vFileList[i]).c_str()); fprintf(fp, "del %s\n", CPath::standardizeDosPath(vFileList[i]).c_str());
}
else
{
CFile::deleteFile(vFileList[i]);
}
}
if (useBatchFile)
{
fprintf(fp, "rd /Q /S patch\n"); fprintf(fp, "rd /Q /S patch\n");
fprintf(fp, "if exist patch goto looppatch\n"); fprintf(fp, "if exist patch goto looppatch\n");
} }
else
{
CFile::deleteDirectory("patch");
}
}
if (useBatchFile)
{
if (wantRyzomRestart) if (wantRyzomRestart)
{ {
fprintf(fp, "start %s %%1 %%2 %%3\n", RyzomFilename.c_str()); fprintf(fp, "start %s %%1 %%2 %%3\n", RyzomFilename.c_str());
} }
bool writeError = ferror(fp) != 0; bool writeError = ferror(fp) != 0;
bool diskFull = ferror(fp) && errno == 28 /* ENOSPC */; bool diskFull = ferror(fp) && errno == 28 /* ENOSPC */;
fclose(fp); fclose(fp);
@ -830,6 +888,7 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
throw NLMISC::EWriteError(UpdateBatchFilename.c_str()); throw NLMISC::EWriteError(UpdateBatchFilename.c_str());
} }
} }
}
// **************************************************************************** // ****************************************************************************
void CPatchManager::executeBatchFile() void CPatchManager::executeBatchFile()
@ -1046,6 +1105,24 @@ void CPatchManager::readDescFile(sint32 nVersion)
throw Exception ("Can't open file '%s'", srcName.c_str ()); throw Exception ("Can't open file '%s'", srcName.c_str ());
uint cat; uint cat;
if (ClientRootPath != "./")
{
// fix relative paths
for (cat = 0; cat < DescFile.getCategories().categoryCount(); ++cat)
{
CBNPCategory &category = const_cast<CBNPCategory &>(DescFile.getCategories().getCategory(cat));
std::string unpackTo = category.getUnpackTo();
if (unpackTo.substr(0, 2) == "./")
{
unpackTo = ClientRootPath + unpackTo.substr(2);
category.setUnpackTo(unpackTo);
}
}
}
// tmp for debug : flag some categories as 'Mainland' // tmp for debug : flag some categories as 'Mainland'
for (cat = 0; cat < DescFile.getCategories().categoryCount(); ++cat) for (cat = 0; cat < DescFile.getCategories().categoryCount(); ++cat)
{ {
@ -1664,7 +1741,7 @@ bool CPatchManager::bnpUnpack(const string &srcBigfile, const string &dstPath, v
// SourceName = ClientPatchPath + srcBigfile; // SourceName = ClientPatchPath + srcBigfile;
if (dstPath.empty()) if (dstPath.empty())
DestPath = "./"; DestPath = ClientRootPath;
else else
DestPath = CPath::standardizePath (dstPath); DestPath = CPath::standardizePath (dstPath);
@ -3315,7 +3392,7 @@ void CDownloadThread::run()
{ {
CPatchManager *pPM = CPatchManager::getInstance(); CPatchManager *pPM = CPatchManager::getInstance();
std::string patchPath = CPath::standardizePath (std::string("./")+TheTmpInstallDirectory)+std::string("patch/"); std::string patchPath = CPath::standardizePath (ClientRootPath+TheTmpInstallDirectory)+"patch/";
static bool _FirstTime = true; static bool _FirstTime = true;
@ -3418,7 +3495,7 @@ void CDownloadThread::run()
void CInstallThread::run() void CInstallThread::run()
{ {
std::string patchPath = CPath::standardizePath (std::string("./")+TheTmpInstallDirectory)+std::string("patch/"); std::string patchPath = CPath::standardizePath (ClientRootPath+TheTmpInstallDirectory)+"patch/";
CPatchManager *pPM = CPatchManager::getInstance(); CPatchManager *pPM = CPatchManager::getInstance();
std::set<std::string> allowed; std::set<std::string> allowed;
@ -3535,7 +3612,7 @@ void CInstallThread::run()
{ {
// remove date from tmp directory (because install is finished) // remove date from tmp directory (because install is finished)
std::string install = CPath::standardizePath (std::string("./")+TheTmpInstallDirectory); std::string install = CPath::standardizePath (ClientRootPath+TheTmpInstallDirectory);
std::vector<std::string> vFiles; std::vector<std::string> vFiles;
// Delete all classic file from tmp directory // Delete all classic file from tmp directory

View file

@ -206,7 +206,7 @@ public:
void forceStopPatchThread(); void forceStopPatchThread();
bool mustLaunchBatFile() const { return MustLaunchBatFile; } bool mustLaunchBatFile() const { return MustLaunchBatFile; }
void createBatchFile(CProductDescriptionForClient &descFile, bool wantRyzomRestart = true); void createBatchFile(CProductDescriptionForClient &descFile, bool wantRyzomRestart = true, bool useBatchFile = true);
void executeBatchFile(); void executeBatchFile();
void deleteBatchFile(); void deleteBatchFile();
void reboot(); void reboot();
@ -257,7 +257,11 @@ public:
// By default the name used is the name of the current executable. // By default the name used is the name of the current executable.
// But for external torrent downloader we must set "client_ryzom_rd.exe" // But for external torrent downloader we must set "client_ryzom_rd.exe"
void setRyzomFilename(const std::string& ryzomFilename) { RyzomFilename = ryzomFilename; } void setRyzomFilename(const std::string& ryzomFilename) { RyzomFilename = ryzomFilename; }
// Use by installation software to download a file only if necessary
// Used when client data is not located in current directory
void setClientRootPath(const std::string& clientRootPath);
// Used by installation software to download a file only if necessary
static bool download(const std::string& patchPath, const std::string& sourcePath, static bool download(const std::string& patchPath, const std::string& sourcePath,
const std::string& tmpDirectory, uint32 timestamp); const std::string& tmpDirectory, uint32 timestamp);
// Used by installation software to create install.bat file (not used) // Used by installation software to create install.bat file (not used)

View file

@ -11,6 +11,7 @@ ADD_SUBDIRECTORY(pdr_util)
ADD_SUBDIRECTORY(stats_scan) ADD_SUBDIRECTORY(stats_scan)
ADD_SUBDIRECTORY(sheets_packer) ADD_SUBDIRECTORY(sheets_packer)
ADD_SUBDIRECTORY(client)
ADD_SUBDIRECTORY(server) ADD_SUBDIRECTORY(server)
# Old stuff that doesn't compile anymore. # Old stuff that doesn't compile anymore.

View file

@ -0,0 +1 @@
ADD_SUBDIRECTORY(client_patcher)

View file

@ -0,0 +1,33 @@
FILE(GLOB SRC *.cpp *.h
${CMAKE_SOURCE_DIR}/client/src/client_cfg.cpp
${CMAKE_SOURCE_DIR}/client/src/login_patch.cpp
${CMAKE_SOURCE_DIR}/client/src/login_xdelta.cpp
)
SET(SEVENZIP_LIBRARY "ryzom_sevenzip")
ADD_EXECUTABLE(ryzom_client_patcher ${SRC})
INCLUDE_DIRECTORIES(
${CMAKE_BINARY_DIR}
${LIBXML2_INCLUDE_DIR}
${NEL_INCLUDE_DIR}
${CURL_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/client/src
)
TARGET_LINK_LIBRARIES(ryzom_client_patcher ${PLATFORM_LINKFLAGS}
${NELMISC_LIBRARY}
ryzom_gameshare
${NELNET_LIBRARY}
${CURL_LIBRARIES}
${SEVENZIP_LIBRARY})
ADD_DEFINITIONS(-DRZ_NO_CLIENT -DNL_USE_SEVENZIP)
IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(ryzom_client_patcher ${CMAKE_SOURCE_DIR}/client/src/stdpch.h ${CMAKE_SOURCE_DIR}/client/src/stdpch.cpp)
ENDIF(WITH_PCH)
INSTALL(TARGETS ryzom_client_patcher RUNTIME DESTINATION ${RYZOM_BIN_PREFIX} COMPONENT client BUNDLE DESTINATION /Applications)

View file

@ -0,0 +1,391 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="client_patcher"
ProjectGUID="{B0323569-5F46-4E7D-A045-56697BEFBF03}"
RootNamespace="client_patcher"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
SmallerTypeCheck="true"
RuntimeLibrary="1"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="bin\$(ProjectName)_d.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="4"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories=".;../../../common/src;../../../client/src"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;CURL_STATICLIB;RZ_NO_CLIENT;NL_USE_SEVENZIP"
MinimalRebuild="true"
BasicRuntimeChecks="3"
SmallerTypeCheck="true"
RuntimeLibrary="3"
PrecompiledHeaderThrough="stdpch.h"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libcurl.lib libeay32.lib ssleay32.lib"
OutputFile="bin\$(ProjectName)_d.exe"
LinkIncremental="2"
IgnoreDefaultLibraryNames="msvcrt.lib"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
UseOfMFC="2"
CharacterSet="2"
WholeProgramOptimization="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
AdditionalIncludeDirectories="../../../client/src;../../../common/src;."
PreprocessorDefinitions="WIN32;NDEBUG;CURL_STATICLIB"
StringPooling="true"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="stdpch.h"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libcurl.lib ssleay32.lib libeay32.lib zlib.lib"
OutputFile="bin\$(ProjectName)_r.exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
UseOfMFC="2"
CharacterSet="2"
WholeProgramOptimization="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
AdditionalIncludeDirectories="../../../client/src;../../../common/src;."
PreprocessorDefinitions="WIN32;NDEBUG;CURL_STATICLIB"
StringPooling="true"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="stdpch.h"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libcurl.lib ssleay32.lib libeay32.lib zlib.lib"
OutputFile="bin\$(ProjectName)_r.exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="src"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\..\client\src\client_cfg.cpp"
>
</File>
<File
RelativePath="..\..\..\client\src\client_cfg.h"
>
</File>
<File
RelativePath="..\..\..\client\src\login_patch.cpp"
>
</File>
<File
RelativePath="..\..\..\client\src\login_patch.h"
>
</File>
<File
RelativePath="..\..\..\client\src\login_xdelta.cpp"
>
</File>
<File
RelativePath="..\..\..\client\src\login_xdelta.h"
>
</File>
<File
RelativePath=".\main.cpp"
>
</File>
</Filter>
<Filter
Name="include"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="res"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,191 @@
#include "stdpch.h"
#include "login_patch.h"
#include "client_cfg.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
using namespace NLMISC;
using namespace std;
// stuff which is defined as extern in other .cpp files
void quitCrashReport()
{
}
/// domain server version for patch
string R2ServerVersion;
/// name of the version (used to alias many version under the same name),
/// the value is used to get the release not if not empty
string VersionName;
string LoginLogin, LoginPassword;
uint32 LoginShardId = 0xFFFFFFFF;
// stuff which is defined in other .cpp files
extern void tmpFlagRemovedPatchCategories(NLMISC::CConfigFile &cf);
int main(int argc, char *argv[])
{
// init the Nel context
CApplicationContext *appContext = new CApplicationContext;
createDebug();
// disable log display on stdout
INelContext::getInstance().getDebugLog()->removeDisplayer("DEFAULT_SD");
INelContext::getInstance().getInfoLog()->removeDisplayer("DEFAULT_SD");
INelContext::getInstance().getWarningLog()->removeDisplayer("DEFAULT_SD");
// if client_default.cfg is not in current directory, use application default directory
if (!CFile::isExists("client_default.cfg"))
{
std::string currentPath = CFile::getApplicationDirectory("Ryzom");
if (!CFile::isExists(currentPath)) CFile::createDirectory(currentPath);
CPath::setCurrentPath(currentPath);
}
ClientCfg.init("client.cfg");
std::string dataPath = "./data/";
std::string rootPath = "./";
if (!ClientCfg.DataPath.empty())
{
dataPath = CPath::standardizePath(ClientCfg.DataPath[0]);
string::size_type pos = dataPath.rfind('/', dataPath.length()-2);
if (pos != string::npos)
rootPath = dataPath.substr(0, pos+1);
}
// add .bnp containing translations
CPath::addSearchBigFile(dataPath + "gamedev.bnp", true, false);
// load translation
CI18N::load(ClientCfg.LanguageCode);
#ifdef NL_OS_UNIX
// don't use cfg, exe and dll from Windows version
CConfigFile::CVar var;
var.Type = CConfigFile::CVar::T_STRING;
std::vector<std::string> cats;
cats.push_back("main_exedll");
cats.push_back("main_cfg");
var.setAsString(cats);
ClientCfg.ConfigFile.insertVar("RemovePatchCategories", var);
// add categories to remove
tmpFlagRemovedPatchCategories(ClientCfg.ConfigFile);
#endif
// initialize patch manager and set the ryzom full path, before it's used
CPatchManager *pPM = CPatchManager::getInstance();
pPM->setClientRootPath(rootPath);
vector<string> patchURLs;
pPM->init(patchURLs, ClientCfg.PatchServer, ClientCfg.PatchVersion);
pPM->startCheckThread(true /* include background patchs */);
ucstring state;
vector<ucstring> log;
bool res = false;
bool finished = false;
while (!finished)
{
nlSleep(100);
finished = pPM->isCheckThreadEnded(res);
if (pPM->getThreadState(state, log))
{
for(uint i = 0; i < log.size(); ++i)
{
printf("%s\n", log[i].toUtf8().c_str());
}
}
if (!res)
{
ucstring errMsg = CI18N::get("uiErrChecking");
if (!pPM->getLastErrorMessage().empty())
{
ucstring errMsg = pPM->getLastErrorMessage();
printf("Error: %s\n", errMsg.toUtf8().c_str());
}
}
}
CPatchManager::SPatchInfo InfoOnPatch;
// Check is good now ask the player if he wants to apply the patch
pPM->getInfoToDisp(InfoOnPatch);
uint AvailablePatchs = InfoOnPatch.getAvailablePatchsBitfield();
// Get the list of optional categories to patch
vector<string> vCategories;
for(uint i = 0; i < InfoOnPatch.OptCat.size(); i++)
{
// Ok for the moment all optional categories must be patched even if the player
// does not want it. Because we cant detect that a continent have to be patched ingame.
vCategories.push_back(InfoOnPatch.OptCat[i].Name);
}
pPM->startPatchThread(vCategories, true);
res = false;
finished = false;
while (!finished)
{
nlSleep(100);
finished = pPM->isPatchThreadEnded(res);
if (pPM->getThreadState(state, log))
{
printf("%s\n", state.toUtf8().c_str());
for(uint i = 0; i < log.size(); ++i)
{
printf("%s\n", log[i].toUtf8().c_str());
}
}
if (!res)
{
ucstring errMsg = CI18N::get("uiErrChecking");
if (!pPM->getLastErrorMessage().empty())
{
ucstring errMsg = pPM->getLastErrorMessage();
printf("Error: %s\n", errMsg.toUtf8().c_str());
}
}
}
if (CPatchManager::getInstance()->mustLaunchBatFile())
{
// move downloaded files to final location
pPM->createBatchFile(pPM->getDescFile(), false, false);
CFile::createEmptyFile("show_eula");
}
/*
// Start Scanning
pPM->startScanDataThread();
// request to stop the thread
pPM->askForStopScanDataThread();
*/
delete appContext;
return 0;
}