Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patcher Fixes #285

Merged
merged 2 commits into from
Feb 3, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Sources/Plasma/Apps/plClient/winmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down
13 changes: 10 additions & 3 deletions Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class plResDownloadStream : public plZlibStream
return fOutput->Write(count, buf);
}

plFileName GetFileName() const { return fFilename; }
bool IsZipped() const { return fIsZipped; }
void Unlink() const { plFileSystem::Unlink(fFilename); }
};
Expand All @@ -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<plResDownloadStream*>(writer)->GetFileName();
if (clientPath.GetFileExt().CompareI("prp") == 0)
{
plResManager* clientResMgr = static_cast<plResManager*>(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;
Expand All @@ -125,7 +132,7 @@ static void FileDownloaded(
}

// Failure case
((plResDownloadStream*)writer)->Unlink();
static_cast<plResDownloadStream*>(writer)->Unlink();
patcher->Finish(false);
delete writer;
}
Expand Down