2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-14 02:27:40 -04:00

Redist Updating

This is the crowning feature: the whole point of this exercise. You can
now update redists from the client launcher itself. To activate this
functionality, you will need to flag the file 0x10 in the manifest. I
recommend listing your redists in the patcher manifests.
This commit is contained in:
2013-11-29 20:25:52 -05:00
parent d855d86475
commit 1bcd17c850
5 changed files with 219 additions and 45 deletions

View File

@ -90,9 +90,12 @@ struct pfPatcherWorker : public hsThread
// Any file
kFlagZipped = 1<<3,
// Executable flags
kRedistUpdate = 1<<4,
// Begin internal flags
kLastManifestFlag = 1<<4,
kSelfPatch = 1<<5,
kLastManifestFlag = 1<<5,
kSelfPatch = 1<<6,
};
std::deque<Request> fRequests;
@ -108,6 +111,7 @@ struct pfPatcherWorker : public hsThread
pfPatcher::FileDownloadFunc fFileDownloaded;
pfPatcher::GameCodeDiscoverFunc fGameCodeDiscovered;
pfPatcher::ProgressTickFunc fProgressTick;
pfPatcher::FileDownloadFunc fRedistUpdateDownloaded;
pfPatcher::FileDownloadFunc fSelfPatch;
pfPatcher* fParent;
@ -205,6 +209,7 @@ public:
void Begin() { fDLStartTime = hsTimer::GetSysSeconds(); }
plFileName GetFileName() const { return fFilename; }
bool IsRedistUpdate() const { return hsCheckBits(fFlags, pfPatcherWorker::kRedistUpdate); }
bool IsSelfPatch() const { return hsCheckBits(fFlags, pfPatcherWorker::kSelfPatch); }
void Unlink() const { plFileSystem::Unlink(fFilename); }
};
@ -315,6 +320,8 @@ static void IFileThingDownloadCB(ENetError result, void* param, const plFileName
patcher->WhitelistFile(stream->GetFileName(), true);
if (patcher->fSelfPatch && stream->IsSelfPatch())
patcher->fSelfPatch(stream->GetFileName());
if (patcher->fRedistUpdateDownloaded && stream->IsRedistUpdate())
patcher->fRedistUpdateDownloaded(stream->GetFileName());
patcher->IssueRequest();
} else {
PatcherLogRed("\tDownloaded Failed: File '%s'", stream->GetFileName().AsString().c_str());
@ -594,6 +601,11 @@ void pfPatcher::OnProgressTick(ProgressTickFunc cb)
fWorker->fProgressTick = cb;
}
void pfPatcher::OnRedistUpdate(FileDownloadFunc cb)
{
fWorker->fRedistUpdateDownloaded = cb;
}
void pfPatcher::OnSelfPatch(FileDownloadFunc cb)
{
fWorker->fSelfPatch = cb;

View File

@ -121,6 +121,12 @@ public:
*/
void OnProgressTick(ProgressTickFunc cb);
/** Set a callback that will be fired when the patcher downloads an updated redistributable. Such as
* the Visual C++ runtime (vcredist_x86.exe). You are responsible for installing it.
* \remarks This will be called from the network thread.
*/
void OnRedistUpdate(FileDownloadFunc cb);
/** This is called when the current application has been updated. */
void OnSelfPatch(FileDownloadFunc cb);