From 98dff8d8e5df3dc2e52528f17d3acf4c6a6579f1 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 30 Jan 2013 15:22:19 -0500 Subject: [PATCH 1/2] More granular control of the SecurePreloader --- Sources/Plasma/Apps/plClient/winmain.cpp | 12 ++++++++++-- .../pfSecurePreloader/pfSecurePreloader.cpp | 9 +++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Sources/Plasma/Apps/plClient/winmain.cpp b/Sources/Plasma/Apps/plClient/winmain.cpp index a4c0e5a7..01ffde5d 100644 --- a/Sources/Plasma/Apps/plClient/winmain.cpp +++ b/Sources/Plasma/Apps/plClient/winmain.cpp @@ -98,18 +98,21 @@ bool gHasMouse = false; ITaskbarList3* gTaskbarList = nil; // NT 6.1+ taskbar stuff extern bool gDataServerLocal; +extern bool gSkipPreload; enum { kArgSkipLoginDialog, kArgServerIni, kArgLocalData, + kArgSkipPreload }; static const CmdArgDef s_cmdLineArgs[] = { { kCmdArgFlagged | kCmdTypeBool, L"SkipLoginDialog", kArgSkipLoginDialog }, { kCmdArgFlagged | kCmdTypeString, L"ServerIni", kArgServerIni }, { kCmdArgFlagged | kCmdTypeBool, L"LocalData", kArgLocalData }, + { kCmdArgFlagged | kCmdTypeBool, L"SkipPreload", kArgSkipPreload }, }; /// Made globals now, so we can set them to zero if we take the border and @@ -1200,10 +1203,15 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC bool doIntroDialogs = true; #ifndef PLASMA_EXTERNAL_RELEASE - if(cmdParser.IsSpecified(kArgSkipLoginDialog)) + if (cmdParser.IsSpecified(kArgSkipLoginDialog)) doIntroDialogs = false; - if(cmdParser.IsSpecified(kArgLocalData)) + if (cmdParser.IsSpecified(kArgLocalData)) + { gDataServerLocal = true; + gSkipPreload = true; + } + if (cmdParser.IsSpecified(kArgSkipPreload)) + gSkipPreload = true; #endif plFileName serverIni = "server.ini"; diff --git a/Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.cpp b/Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.cpp index d7cbbac8..a7e86ec1 100644 --- a/Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.cpp +++ b/Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.cpp @@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plMessage/plPreloaderMsg.h" #include "plProgressMgr/plProgressMgr.h" -extern bool gDataServerLocal; +bool gSkipPreload = false; pfSecurePreloader* pfSecurePreloader::fInstance = nil; ///////////////////////////////////////////////////////////////////// @@ -261,8 +261,9 @@ void pfSecurePreloader::Init() void pfSecurePreloader::Start() { #ifndef PLASMA_EXTERNAL_RELEASE - // Using local data? Move along, move along... - if (gDataServerLocal) + // Finer grained control of the preloader allows us to have synched data but our own python/SDL + // This is useful on outdated/black-box shards like MOULa + if (gSkipPreload) { Finish(); return; @@ -272,7 +273,7 @@ void pfSecurePreloader::Start() NetCliAuthGetEncryptionKey(fEncryptionKey, 4); // TODO: Localize - fProgress = plProgressMgr::GetInstance()->RegisterOperation(0.0f, "Checking for Updates", plProgressMgr::kUpdateText, false, true); + fProgress = plProgressMgr::GetInstance()->RegisterOperation(0.0f, "Checking for updates", plProgressMgr::kUpdateText, false, true); // Now, we need to fetch the "SecurePreloader" manifest from the file server, which will contain the python and SDL files. // We're basically reimplementing plResPatcher here, except preferring to keep everything in memory, then flush to disk From 3638f1a2661d12e39126b7fe2eb3329e1c99b5b3 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 30 Jan 2013 15:40:41 -0500 Subject: [PATCH 2/2] Fix patching on MOULa --- .../Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp b/Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp index 7f05f657..ea532ca5 100644 --- a/Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp +++ b/Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp @@ -83,6 +83,7 @@ public: return fOutput->Write(count, buf); } + plFileName GetFileName() const { return fFilename; } bool IsZipped() const { return fIsZipped; } void Unlink() const { plFileSystem::Unlink(fFilename); } }; @@ -104,16 +105,22 @@ static void FileDownloaded( switch (result) { case kNetSuccess: + { PatcherLog(kStatus, " Download Complete: %s", file.AsString().c_str()); // If this is a PRP, then we need to add it to the ResManager - if (file.AsString().CompareI("prp") == 0) - ((plResManager*)hsgResMgr::ResMgr())->AddSinglePage(file); + plFileName clientPath = static_cast(writer)->GetFileName(); + if (clientPath.GetFileExt().CompareI("prp") == 0) + { + plResManager* clientResMgr = static_cast(hsgResMgr::ResMgr()); + clientResMgr->AddSinglePage(clientPath); + } // Continue down the warpath patcher->IssueRequest(); delete writer; return; + } case kNetErrFileNotFound: PatcherLog(kError, " Download Failed: %s not found", file.AsString().c_str()); break; @@ -125,7 +132,7 @@ static void FileDownloaded( } // Failure case - ((plResDownloadStream*)writer)->Unlink(); + static_cast(writer)->Unlink(); patcher->Finish(false); delete writer; }