From e7ab709b522c0c48aa0c06b38dde2f19c12fde68 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Fri, 29 Nov 2013 00:16:17 -0500 Subject: [PATCH] Client Image Flag This argument works just like it does in Guild Wars. It checks all the files (using Cyan's evil "Internal" and "External" manifests) for changes. Expect this to take a decent amount of time. --- .../Apps/plUruLauncher/plClientLauncher.cpp | 27 ++++++++++++++----- .../Apps/plUruLauncher/plClientLauncher.h | 1 + 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Sources/Plasma/Apps/plUruLauncher/plClientLauncher.cpp b/Sources/Plasma/Apps/plUruLauncher/plClientLauncher.cpp index 4a8b015b..5eb775f5 100644 --- a/Sources/Plasma/Apps/plUruLauncher/plClientLauncher.cpp +++ b/Sources/Plasma/Apps/plUruLauncher/plClientLauncher.cpp @@ -164,6 +164,11 @@ plString plClientLauncher::GetAppArgs() const plStringStream ss; ss << "-ServerIni="; ss << fServerIni.AsString(); + + // optional args + if (hsCheckBits(fFlags, kClientImage)) + ss << " -Image"; + return ss.GetString(); } @@ -195,9 +200,12 @@ void plClientLauncher::PatchClient() patcher->OnCompletion(std::bind(&plClientLauncher::IOnPatchComplete, this, std::placeholders::_1, std::placeholders::_2)); patcher->OnSelfPatch([&](const plFileName& file) { fClientExecutable = file; }); - if (hsCheckBits(fFlags, kHaveSelfPatched)) - patcher->RequestManifest(plManifest::ClientManifest()); - else + if (hsCheckBits(fFlags, kHaveSelfPatched)) { + if (hsCheckBits(fFlags, kClientImage)) + patcher->RequestManifest(plManifest::ClientImageManifest()); + else + patcher->RequestManifest(plManifest::ClientManifest()); + } else patcher->RequestManifest(plManifest::PatcherManifest()); patcher->Start(); } @@ -324,20 +332,27 @@ bool plClientLauncher::LoadServerIni() const void plClientLauncher::ParseArguments() { - enum { kArgServerIni, kArgNoSelfPatch }; +#define APPLY_FLAG(arg, flag) \ + if (cmdParser.GetBool(arg)) \ + fFlags |= flag; + + enum { kArgServerIni, kArgNoSelfPatch, kArgImage }; const CmdArgDef cmdLineArgs[] = { { kCmdArgFlagged | kCmdTypeString, L"ServerIni", kArgServerIni }, { kCmdArgFlagged | kCmdTypeBool, L"NoSelfPatch", kArgNoSelfPatch }, + { kCmdArgFlagged | kCmdTypeBool, L"Image", kArgImage }, }; CCmdParser cmdParser(cmdLineArgs, arrsize(cmdLineArgs)); cmdParser.Parse(); // cache 'em - if (cmdParser.GetBool(kArgNoSelfPatch)) - hsSetBits(fFlags, kHaveSelfPatched); if (cmdParser.IsSpecified(kArgServerIni)) fServerIni = plString::FromWchar(cmdParser.GetString(kArgServerIni)); + APPLY_FLAG(kArgNoSelfPatch, kHaveSelfPatched); + APPLY_FLAG(kArgImage, kClientImage); + +#undef APPLY_FLAG } void plClientLauncher::SetErrorProc(ErrorFunc proc) diff --git a/Sources/Plasma/Apps/plUruLauncher/plClientLauncher.h b/Sources/Plasma/Apps/plUruLauncher/plClientLauncher.h index 13f20a3f..ab97000d 100644 --- a/Sources/Plasma/Apps/plUruLauncher/plClientLauncher.h +++ b/Sources/Plasma/Apps/plUruLauncher/plClientLauncher.h @@ -61,6 +61,7 @@ private: enum Flags { kHaveSelfPatched = 1<<0, + kClientImage = 1<<1, }; uint32_t fFlags;