Changed: #1051 Create a console-based working patcher
parent
2bc8aa793e
commit
dd0b5df304
@ -0,0 +1 @@
|
||||
ADD_SUBDIRECTORY(client_patcher)
|
@ -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)
|
@ -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>
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue