mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-17 10:52:46 +00:00
Merge remote-tracking branch 'origin/master' into plString
Conflicts: Sources/Plasma/FeatureLib/pfPython/pyVault.cpp Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSubst.cpp Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.cpp Sources/Plasma/PubUtilLib/plPipeline/plDXDeviceRefs.cpp Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp --HG-- rename : Sources/Plasma/NucleusLib/pnUtils/Private/Unix/pnUtUxStr.cpp => Sources/Plasma/NucleusLib/pnUtils/Unix/pnUtUxStr.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/Unix/pnUtUxSync.cpp => Sources/Plasma/NucleusLib/pnUtils/Unix/pnUtUxSync.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/Unix/pnUtUxUuid.cpp => Sources/Plasma/NucleusLib/pnUtils/Unix/pnUtUxUuid.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/Win32/W32Int.h => Sources/Plasma/NucleusLib/pnUtils/Win32/W32Int.h rename : Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Addr.cpp => Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Addr.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Dll.cpp => Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Dll.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Misc.cpp => Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Misc.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Path.cpp => Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Path.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Str.cpp => Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Str.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Sync.cpp => Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Sync.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Time.cpp => Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Time.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Uuid.cpp => Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Uuid.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtAddr.cpp => Sources/Plasma/NucleusLib/pnUtils/pnUtAddr.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtAddr.h => Sources/Plasma/NucleusLib/pnUtils/pnUtAddr.h rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtAllIncludes.h => Sources/Plasma/NucleusLib/pnUtils/pnUtAllIncludes.h rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.cpp => Sources/Plasma/NucleusLib/pnUtils/pnUtArray.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.h => Sources/Plasma/NucleusLib/pnUtils/pnUtArray.h rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtBase64.cpp => Sources/Plasma/NucleusLib/pnUtils/pnUtBase64.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtBase64.h => Sources/Plasma/NucleusLib/pnUtils/pnUtBase64.h rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtBigNum.cpp => Sources/Plasma/NucleusLib/pnUtils/pnUtBigNum.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtBigNum.h => Sources/Plasma/NucleusLib/pnUtils/pnUtBigNum.h rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCmd.cpp => Sources/Plasma/NucleusLib/pnUtils/pnUtCmd.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCmd.h => Sources/Plasma/NucleusLib/pnUtils/pnUtCmd.h rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCoreLib.h => Sources/Plasma/NucleusLib/pnUtils/pnUtCoreLib.h rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCrypt.cpp => Sources/Plasma/NucleusLib/pnUtils/pnUtCrypt.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCrypt.h => Sources/Plasma/NucleusLib/pnUtils/pnUtCrypt.h rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtHash.cpp => Sources/Plasma/NucleusLib/pnUtils/pnUtHash.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtHash.h => Sources/Plasma/NucleusLib/pnUtils/pnUtHash.h rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtList.cpp => Sources/Plasma/NucleusLib/pnUtils/pnUtList.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtList.h => Sources/Plasma/NucleusLib/pnUtils/pnUtList.h rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtMath.h => Sources/Plasma/NucleusLib/pnUtils/pnUtMath.h rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtMisc.cpp => Sources/Plasma/NucleusLib/pnUtils/pnUtMisc.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtMisc.h => Sources/Plasma/NucleusLib/pnUtils/pnUtMisc.h rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPath.cpp => Sources/Plasma/NucleusLib/pnUtils/pnUtPath.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPath.h => Sources/Plasma/NucleusLib/pnUtils/pnUtPath.h rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPragma.h => Sources/Plasma/NucleusLib/pnUtils/pnUtPragma.h rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPriQ.h => Sources/Plasma/NucleusLib/pnUtils/pnUtPriQ.h rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtRand.cpp => Sources/Plasma/NucleusLib/pnUtils/pnUtRand.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtRand.h => Sources/Plasma/NucleusLib/pnUtils/pnUtRand.h rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtRef.h => Sources/Plasma/NucleusLib/pnUtils/pnUtRef.h rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSort.h => Sources/Plasma/NucleusLib/pnUtils/pnUtSort.h rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSpareList.cpp => Sources/Plasma/NucleusLib/pnUtils/pnUtSpareList.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSpareList.h => Sources/Plasma/NucleusLib/pnUtils/pnUtSpareList.h rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtStr.cpp => Sources/Plasma/NucleusLib/pnUtils/pnUtStr.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtStr.h => Sources/Plasma/NucleusLib/pnUtils/pnUtStr.h rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSync.h => Sources/Plasma/NucleusLib/pnUtils/pnUtSync.h rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtTime.cpp => Sources/Plasma/NucleusLib/pnUtils/pnUtTime.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtTime.h => Sources/Plasma/NucleusLib/pnUtils/pnUtTime.h rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtTls.cpp => Sources/Plasma/NucleusLib/pnUtils/pnUtTls.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtTls.h => Sources/Plasma/NucleusLib/pnUtils/pnUtTls.h rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtUuid.cpp => Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.cpp rename : Sources/Plasma/NucleusLib/pnUtils/Private/pnUtUuid.h => Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h
This commit is contained in:
@ -41,6 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "plResPatcher.h"
|
||||
#include "hsResMgr.h"
|
||||
|
||||
#include "plAgeLoader/plAgeLoader.h"
|
||||
#include "plCompression/plZlibStream.h"
|
||||
@ -50,6 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "pnNetBase/pnNbError.h"
|
||||
#include "plNetGameLib/plNetGameLib.h"
|
||||
#include "plProgressMgr/plProgressMgr.h"
|
||||
#include "plResMgr/plResManager.h"
|
||||
#include "plStatusLog/plStatusLog.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -57,15 +59,28 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
class plResDownloadStream : public plZlibStream
|
||||
{
|
||||
plOperationProgress* fProgress;
|
||||
char* fFilename;
|
||||
bool fIsZipped;
|
||||
|
||||
public:
|
||||
plResDownloadStream(plOperationProgress* prog, const wchar_t* reqFile)
|
||||
: fProgress(prog)
|
||||
: fProgress(prog), fFilename(nil)
|
||||
{
|
||||
fIsZipped = wcscmp(plFileUtils::GetFileExt(reqFile), L"gz") == 0;
|
||||
}
|
||||
|
||||
~plResDownloadStream()
|
||||
{
|
||||
if (fFilename)
|
||||
delete[] fFilename;
|
||||
}
|
||||
|
||||
hsBool Open(const char* filename, const char* mode)
|
||||
{
|
||||
fFilename = hsStrcpy(filename);
|
||||
return plZlibStream::Open(filename, mode);
|
||||
}
|
||||
|
||||
uint32_t Write(uint32_t count, const void* buf)
|
||||
{
|
||||
fProgress->Increment((float)count);
|
||||
@ -74,6 +89,9 @@ public:
|
||||
else
|
||||
return fOutput->Write(count, buf);
|
||||
}
|
||||
|
||||
bool IsZipped() const { return fIsZipped; }
|
||||
void Unlink() const { plFileUtils::RemoveFile(fFilename); }
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -86,15 +104,23 @@ static void FileDownloaded(
|
||||
{
|
||||
plResPatcher* patcher = (plResPatcher*)param;
|
||||
char* name = hsWStringToString(filename);
|
||||
if (((plResDownloadStream*)writer)->IsZipped())
|
||||
plFileUtils::StripExt(name); // Kill off .gz
|
||||
writer->Close();
|
||||
delete writer;
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case kNetSuccess:
|
||||
PatcherLog(kStatus, " Download Complete: %s", name);
|
||||
|
||||
// If this is a PRP, then we need to add it to the ResManager
|
||||
if (stricmp(plFileUtils::GetFileExt(name), "prp") == 0)
|
||||
((plResManager*)hsgResMgr::ResMgr())->AddSinglePage(name);
|
||||
|
||||
// Continue down the warpath
|
||||
patcher->IssueRequest();
|
||||
delete[] name;
|
||||
delete writer;
|
||||
return;
|
||||
case kNetErrFileNotFound:
|
||||
PatcherLog(kError, " Download Failed: %s not found", name);
|
||||
@ -107,8 +133,10 @@ static void FileDownloaded(
|
||||
}
|
||||
|
||||
// Failure case
|
||||
((plResDownloadStream*)writer)->Unlink();
|
||||
patcher->Finish(false);
|
||||
delete[] name;
|
||||
delete writer;
|
||||
}
|
||||
|
||||
static void ManifestDownloaded(
|
||||
@ -215,6 +243,10 @@ void plResPatcher::IssueRequest()
|
||||
PatcherLog(kMajorStatus, " Downloading file... %s", eapSucksString);
|
||||
xtl::format(title, L"Downloading... %s", plFileUtils::GetFileName(req.fFriendlyName.c_str()));
|
||||
|
||||
// If this is a PRP, we need to unload it from the ResManager
|
||||
if (stricmp(plFileUtils::GetFileExt(eapSucksString), "prp") == 0)
|
||||
((plResManager*)hsgResMgr::ResMgr())->RemoveSinglePage(eapSucksString);
|
||||
|
||||
plFileUtils::EnsureFilePathExists(req.fFriendlyName.c_str());
|
||||
plResDownloadStream* stream = new plResDownloadStream(fProgress, req.fFile.c_str());
|
||||
if(stream->Open(eapSucksString, "wb"))
|
||||
|
Reference in New Issue
Block a user