mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-17 18:59:09 +00:00
Game Repair Mode
This adds a license-stopgap "feature" ... You can now update only the game data by using the -Repair argument on the launcher. You'll need to specify a stripped down MOULa server.ini with the GateKeeperSrv keys/host.
This commit is contained in:
@ -161,6 +161,11 @@ plClientLauncher::~plClientLauncher() { }
|
||||
|
||||
plString plClientLauncher::GetAppArgs() const
|
||||
{
|
||||
// If -Repair was specified, there are no args for the next call...
|
||||
if (hsCheckBits(fFlags, kRepairGame)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
plStringStream ss;
|
||||
ss << "-ServerIni=";
|
||||
ss << fServerIni.AsString();
|
||||
@ -190,16 +195,33 @@ void plClientLauncher::IOnPatchComplete(ENetError result, const plString& msg)
|
||||
s_errorProc(result, msg);
|
||||
}
|
||||
|
||||
bool plClientLauncher::IApproveDownload(const plFileName& file)
|
||||
{
|
||||
// So, for a repair, what we want to do is quite simple.
|
||||
// That is: download everything that is NOT in the root directory.
|
||||
plFileName path = file.StripFileName();
|
||||
return !path.AsString().IsEmpty();
|
||||
}
|
||||
|
||||
void plClientLauncher::PatchClient()
|
||||
{
|
||||
if (fStatusFunc)
|
||||
fStatusFunc("Checking for updates...");
|
||||
if (fStatusFunc) {
|
||||
if (hsCheckBits(fFlags, kGameDataOnly))
|
||||
fStatusFunc("Verifying game data...");
|
||||
else
|
||||
fStatusFunc("Checking for updates...");
|
||||
}
|
||||
hsAssert(fPatcherFactory, "why is the patcher factory nil?");
|
||||
|
||||
pfPatcher* patcher = fPatcherFactory();
|
||||
patcher->OnCompletion(std::bind(&plClientLauncher::IOnPatchComplete, this, std::placeholders::_1, std::placeholders::_2));
|
||||
patcher->OnSelfPatch([&](const plFileName& file) { fClientExecutable = file; });
|
||||
|
||||
// If this is a repair, we need to approve the downloads...
|
||||
if (hsCheckBits(fFlags, kGameDataOnly))
|
||||
patcher->OnFileDownloadDesired(std::bind(&plClientLauncher::IApproveDownload, this, std::placeholders::_1));
|
||||
|
||||
// Let's get 'er done.
|
||||
if (hsCheckBits(fFlags, kHaveSelfPatched)) {
|
||||
if (hsCheckBits(fFlags, kClientImage))
|
||||
patcher->RequestManifest(plManifest::ClientImageManifest());
|
||||
@ -336,11 +358,12 @@ void plClientLauncher::ParseArguments()
|
||||
if (cmdParser.GetBool(arg)) \
|
||||
fFlags |= flag;
|
||||
|
||||
enum { kArgServerIni, kArgNoSelfPatch, kArgImage };
|
||||
enum { kArgServerIni, kArgNoSelfPatch, kArgImage, kArgRepairGame };
|
||||
const CmdArgDef cmdLineArgs[] = {
|
||||
{ kCmdArgFlagged | kCmdTypeString, L"ServerIni", kArgServerIni },
|
||||
{ kCmdArgFlagged | kCmdTypeBool, L"NoSelfPatch", kArgNoSelfPatch },
|
||||
{ kCmdArgFlagged | kCmdTypeBool, L"Image", kArgImage },
|
||||
{ kCmdArgFlagged | kCmdTypeBool, L"Repair", kArgRepairGame },
|
||||
};
|
||||
|
||||
CCmdParser cmdParser(cmdLineArgs, arrsize(cmdLineArgs));
|
||||
@ -351,6 +374,11 @@ void plClientLauncher::ParseArguments()
|
||||
fServerIni = plString::FromWchar(cmdParser.GetString(kArgServerIni));
|
||||
APPLY_FLAG(kArgNoSelfPatch, kHaveSelfPatched);
|
||||
APPLY_FLAG(kArgImage, kClientImage);
|
||||
APPLY_FLAG(kArgRepairGame, kRepairGame);
|
||||
|
||||
// last chance setup
|
||||
if (hsCheckBits(fFlags, kRepairGame))
|
||||
fClientExecutable = plManifest::PatcherExecutable();
|
||||
|
||||
#undef APPLY_FLAG
|
||||
}
|
||||
|
@ -62,6 +62,9 @@ private:
|
||||
{
|
||||
kHaveSelfPatched = 1<<0,
|
||||
kClientImage = 1<<1,
|
||||
kGameDataOnly = (1<<2),
|
||||
|
||||
kRepairGame = kHaveSelfPatched | kClientImage | kGameDataOnly,
|
||||
};
|
||||
|
||||
uint32_t fFlags;
|
||||
@ -77,6 +80,7 @@ private:
|
||||
plString GetAppArgs() const;
|
||||
|
||||
void IOnPatchComplete(ENetError result, const plString& msg);
|
||||
bool IApproveDownload(const plFileName& file);
|
||||
|
||||
public:
|
||||
plClientLauncher();
|
||||
|
Reference in New Issue
Block a user