mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
Add and Remove PRPs from the ResManager appropriately
This commit is contained in:
@ -41,6 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
*==LICENSE==*/
|
*==LICENSE==*/
|
||||||
|
|
||||||
#include "plResPatcher.h"
|
#include "plResPatcher.h"
|
||||||
|
#include "hsResMgr.h"
|
||||||
|
|
||||||
#include "plAgeLoader/plAgeLoader.h"
|
#include "plAgeLoader/plAgeLoader.h"
|
||||||
#include "plCompression/plZlibStream.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 "pnNetBase/pnNbError.h"
|
||||||
#include "plNetGameLib/plNetGameLib.h"
|
#include "plNetGameLib/plNetGameLib.h"
|
||||||
#include "plProgressMgr/plProgressMgr.h"
|
#include "plProgressMgr/plProgressMgr.h"
|
||||||
|
#include "plResMgr/plResManager.h"
|
||||||
#include "plStatusLog/plStatusLog.h"
|
#include "plStatusLog/plStatusLog.h"
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
@ -74,6 +76,8 @@ public:
|
|||||||
else
|
else
|
||||||
return fOutput->Write(count, buf);
|
return fOutput->Write(count, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsZipped() const { return fIsZipped; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
@ -86,6 +90,8 @@ static void FileDownloaded(
|
|||||||
{
|
{
|
||||||
plResPatcher* patcher = (plResPatcher*)param;
|
plResPatcher* patcher = (plResPatcher*)param;
|
||||||
char* name = hsWStringToString(filename);
|
char* name = hsWStringToString(filename);
|
||||||
|
if (((plResDownloadStream*)writer)->IsZipped())
|
||||||
|
plFileUtils::StripExt(name); // Kill off .gz
|
||||||
writer->Close();
|
writer->Close();
|
||||||
delete writer;
|
delete writer;
|
||||||
|
|
||||||
@ -93,6 +99,12 @@ static void FileDownloaded(
|
|||||||
{
|
{
|
||||||
case kNetSuccess:
|
case kNetSuccess:
|
||||||
PatcherLog(kStatus, " Download Complete: %s", name);
|
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();
|
patcher->IssueRequest();
|
||||||
delete[] name;
|
delete[] name;
|
||||||
return;
|
return;
|
||||||
@ -215,6 +227,10 @@ void plResPatcher::IssueRequest()
|
|||||||
PatcherLog(kMajorStatus, " Downloading file... %s", eapSucksString);
|
PatcherLog(kMajorStatus, " Downloading file... %s", eapSucksString);
|
||||||
xtl::format(title, L"Downloading... %s", plFileUtils::GetFileName(req.fFriendlyName.c_str()));
|
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());
|
plFileUtils::EnsureFilePathExists(req.fFriendlyName.c_str());
|
||||||
plResDownloadStream* stream = new plResDownloadStream(fProgress, req.fFile.c_str());
|
plResDownloadStream* stream = new plResDownloadStream(fProgress, req.fFile.c_str());
|
||||||
if(stream->Open(eapSucksString, "wb"))
|
if(stream->Open(eapSucksString, "wb"))
|
||||||
|
Reference in New Issue
Block a user