Browse Source

Merge pull request #285 from Hoikas/skip-preload

Patcher Fixes
Michael Hansen 12 years ago
parent
commit
46dd7eeb78
  1. 8
      Sources/Plasma/Apps/plClient/winmain.cpp
  2. 9
      Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.cpp
  3. 13
      Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp

8
Sources/Plasma/Apps/plClient/winmain.cpp

@ -97,18 +97,21 @@ bool gHasMouse = false;
ITaskbarList3* gTaskbarList = nil; // NT 6.1+ taskbar stuff ITaskbarList3* gTaskbarList = nil; // NT 6.1+ taskbar stuff
extern bool gDataServerLocal; extern bool gDataServerLocal;
extern bool gSkipPreload;
enum enum
{ {
kArgSkipLoginDialog, kArgSkipLoginDialog,
kArgServerIni, kArgServerIni,
kArgLocalData, kArgLocalData,
kArgSkipPreload
}; };
static const CmdArgDef s_cmdLineArgs[] = { static const CmdArgDef s_cmdLineArgs[] = {
{ kCmdArgFlagged | kCmdTypeBool, L"SkipLoginDialog", kArgSkipLoginDialog }, { kCmdArgFlagged | kCmdTypeBool, L"SkipLoginDialog", kArgSkipLoginDialog },
{ kCmdArgFlagged | kCmdTypeString, L"ServerIni", kArgServerIni }, { kCmdArgFlagged | kCmdTypeString, L"ServerIni", kArgServerIni },
{ kCmdArgFlagged | kCmdTypeBool, L"LocalData", kArgLocalData }, { 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 /// Made globals now, so we can set them to zero if we take the border and
@ -1202,7 +1205,12 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
if (cmdParser.IsSpecified(kArgSkipLoginDialog)) if (cmdParser.IsSpecified(kArgSkipLoginDialog))
doIntroDialogs = false; doIntroDialogs = false;
if (cmdParser.IsSpecified(kArgLocalData)) if (cmdParser.IsSpecified(kArgLocalData))
{
gDataServerLocal = true; gDataServerLocal = true;
gSkipPreload = true;
}
if (cmdParser.IsSpecified(kArgSkipPreload))
gSkipPreload = true;
#endif #endif
plFileName serverIni = "server.ini"; plFileName serverIni = "server.ini";

9
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 "plMessage/plPreloaderMsg.h"
#include "plProgressMgr/plProgressMgr.h" #include "plProgressMgr/plProgressMgr.h"
extern bool gDataServerLocal; bool gSkipPreload = false;
pfSecurePreloader* pfSecurePreloader::fInstance = nil; pfSecurePreloader* pfSecurePreloader::fInstance = nil;
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
@ -261,8 +261,9 @@ void pfSecurePreloader::Init()
void pfSecurePreloader::Start() void pfSecurePreloader::Start()
{ {
#ifndef PLASMA_EXTERNAL_RELEASE #ifndef PLASMA_EXTERNAL_RELEASE
// Using local data? Move along, move along... // Finer grained control of the preloader allows us to have synched data but our own python/SDL
if (gDataServerLocal) // This is useful on outdated/black-box shards like MOULa
if (gSkipPreload)
{ {
Finish(); Finish();
return; return;
@ -272,7 +273,7 @@ void pfSecurePreloader::Start()
NetCliAuthGetEncryptionKey(fEncryptionKey, 4); NetCliAuthGetEncryptionKey(fEncryptionKey, 4);
// TODO: Localize // 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. // 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 // We're basically reimplementing plResPatcher here, except preferring to keep everything in memory, then flush to disk

13
Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp

@ -83,6 +83,7 @@ public:
return fOutput->Write(count, buf); return fOutput->Write(count, buf);
} }
plFileName GetFileName() const { return fFilename; }
bool IsZipped() const { return fIsZipped; } bool IsZipped() const { return fIsZipped; }
void Unlink() const { plFileSystem::Unlink(fFilename); } void Unlink() const { plFileSystem::Unlink(fFilename); }
}; };
@ -104,16 +105,22 @@ static void FileDownloaded(
switch (result) switch (result)
{ {
case kNetSuccess: case kNetSuccess:
{
PatcherLog(kStatus, " Download Complete: %s", file.AsString().c_str()); PatcherLog(kStatus, " Download Complete: %s", file.AsString().c_str());
// If this is a PRP, then we need to add it to the ResManager // If this is a PRP, then we need to add it to the ResManager
if (file.AsString().CompareI("prp") == 0) plFileName clientPath = static_cast<plResDownloadStream*>(writer)->GetFileName();
((plResManager*)hsgResMgr::ResMgr())->AddSinglePage(file); if (clientPath.GetFileExt().CompareI("prp") == 0)
{
plResManager* clientResMgr = static_cast<plResManager*>(hsgResMgr::ResMgr());
clientResMgr->AddSinglePage(clientPath);
}
// Continue down the warpath // Continue down the warpath
patcher->IssueRequest(); patcher->IssueRequest();
delete writer; delete writer;
return; return;
}
case kNetErrFileNotFound: case kNetErrFileNotFound:
PatcherLog(kError, " Download Failed: %s not found", file.AsString().c_str()); PatcherLog(kError, " Download Failed: %s not found", file.AsString().c_str());
break; break;
@ -125,7 +132,7 @@ static void FileDownloaded(
} }
// Failure case // Failure case
((plResDownloadStream*)writer)->Unlink(); static_cast<plResDownloadStream*>(writer)->Unlink();
patcher->Finish(false); patcher->Finish(false);
delete writer; delete writer;
} }

Loading…
Cancel
Save