Implementation fixes, ref #179

--HG--
branch : feature-streamed-package
hg/feature/streamed-package
kaetemi 10 years ago
parent 105ecbff90
commit e6a327fb1a

@ -230,17 +230,19 @@ namespace NLMISC
private:
#define NLMISC_SAFE_RELEASABLE_SINGLETON_DECL(className) \
NLMISC_SAFE_SINGLETON_DECL(className); \
\
void className::releaseInstance() \
{ \
if (_Instance) \
NLMISC_SAFE_SINGLETON_DECL(className); \
\
public: \
static void className::releaseInstance() \
{ \
NLMISC::INelContext::getInstance().releaseSingletonPointer(#className, _Instance); \
delete _Instance; \
_Instance = NULL; \
if (_Instance) \
{ \
NLMISC::INelContext::getInstance().releaseSingletonPointer(#className, _Instance); \
delete _Instance; \
_Instance = NULL; \
} \
} \
} \
private:
/** The same as above, but generate a getInstance method that

@ -213,7 +213,7 @@ bool CIFile::open(const std::string &path, bool text)
_BigFileOffset = 0;
_AlwaysOpened = false;
std::string filePath;
if (CStreamedPackageManager::getInstance().getFile (filePath, path))
if (CStreamedPackageManager::getInstance().getFile (filePath, path.substr(pos+1)))
{
_F = fopen (filePath.c_str(), mode);
if (_F != NULL)

@ -1736,7 +1736,8 @@ void CFileContainer::memoryCompress()
while (it != _Files.end())
{
string sTmp = SSMpath.get(it->second.idPath);
if ((sTmp.find("@@") == string::npos) && (sTmp.find('@') != string::npos) && !it->second.Remapped)
nldebug("A: %s", sTmp.c_str());
if ((sTmp.find("@@") == string::npos) && (sTmp.find('@') != string::npos) && (sTmp.find("snp@") == string::npos) && !it->second.Remapped)
{
// This is a file included in a bigfile (so the name is in the bigfile manager)
}
@ -1759,7 +1760,8 @@ void CFileContainer::memoryCompress()
{
CFileEntry &rFE = it->second;
string sTmp = SSMpath.get(rFE.idPath);
if (sTmp.find("@") == string::npos || sTmp.find("@@") != string::npos || rFE.Remapped)
nldebug("B: %s", sTmp.c_str());
if ((sTmp.find("@") == string::npos) || (sTmp.find("@@") != string::npos) || (sTmp.find("snp@") != string::npos) || rFE.Remapped)
{
strcpy(_AllFileNames+nSize, rFE.Name.c_str());
_MCFiles[nNb].Name = _AllFileNames+nSize;
@ -1784,8 +1786,12 @@ void CFileContainer::memoryCompress()
it++;
}
nldebug("Passed");
contReset(_Files);
_MemoryCompressed = true;
nldebug("Done");
}
void CPath::memoryUncompress()
@ -2054,7 +2060,7 @@ uint32 CFile::getFileSize (const std::string &filename)
if (pos > 3 && filename[pos-3] == 's' && filename[pos-2] == 'n' && filename[pos-1] == 'p')
{
uint32 fs = 0;
CStreamedPackageManager::getInstance().getFileSize (fs, filename);
CStreamedPackageManager::getInstance().getFileSize (fs, filename.substr(pos+1));
return fs;
}
else

@ -47,6 +47,9 @@ printLog(log, "")
for category in InstallClientData:
printLog(log, "CATEGORY " + category["Name"])
packExt = ".bnp"
if (category["StreamedPackages"]):
packExt = ".snp"
if (category["UnpackTo"] != None):
targetPath = ClientInstallDirectory
if (category["UnpackTo"] != ""):
@ -62,8 +65,8 @@ for category in InstallClientData:
mkPath(log, targetPath)
for package in category["Packages"]:
printLog(log, "PACKAGE " + package[0])
sourceBnp = sourcePath + "/" + package[0] + ".bnp"
targetBnp = targetPath + "/" + package[0] + ".bnp"
sourceBnp = sourcePath + "/" + package[0] + packExt
targetBnp = targetPath + "/" + package[0] + packExt
if (len(package[1]) > 0):
sourceBnp = sourcePath + "/" + package[1][0]
targetBnp = targetPath + "/" + package[1][0]

@ -28,6 +28,7 @@
#include "nel/misc/thread.h"
#include "nel/misc/big_file.h"
#include "nel/misc/system_utils.h"
#include "nel/misc/streamed_package_manager.h"
#include "nel/net/tcp_sock.h"
#include "nel/3d/u_driver.h"
@ -1614,6 +1615,7 @@ void initPatch()
CBGDownloaderAccess::getInstance().startTask(taskDesc, string(), true /* showDownloader */); // no command line since bg downloader should already be started
// release lock on bnp, so that they can be written
NLMISC::CBigFile::getInstance().removeAll();
NLMISC::CStreamedPackageManager::getInstance().unloadAll();
}
NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_PATCHING);

@ -25,6 +25,7 @@
#include "nel/misc/debug.h"
#include "nel/misc/async_file_manager.h"
#include "nel/misc/system_utils.h"
#include "nel/misc/streamed_package_manager.h"
// 3D Interface.
#include "nel/3d/bloom_effect.h"
#include "nel/3d/fxaa.h"
@ -644,6 +645,7 @@ void release()
R2::CObjectSerializer::releaseInstance();
NLMISC::CBigFile::getInstance().removeAll();
NLMISC::CBigFile::releaseInstance();
NLMISC::CStreamedPackageManager::releaseInstance();
NL3D::CFastHLSModifier::releaseInstance();
CLandscapePolyDrawer::releaseInstance();
NL3D::CParticleSystemShape::releaseInstance();

@ -295,7 +295,7 @@ void CScreenshotIslands::searchIslandsBorders()
zonelFiles.clear();
string bnpFileName = itCont->first + ".bnp";
CBigFile::getInstance().list(bnpFileName.c_str(), filenames);
CBigFile::getInstance().list(bnpFileName.c_str(), filenames); // FIXME FIXME NOT READING FROM BNP!
for(uint i=0; i<filenames.size(); i++)
{

@ -1433,6 +1433,7 @@ public:
NLMISC::CAsyncFileManager::terminate();
NL3D::CParticleSystemManager::release();
NLMISC::CBigFile::releaseInstance();
NLMISC::CStreamedPackageManager::releaseInstance();
NLMISC::CClassRegistry::release();
delete &NLMISC::CObjectArenaAllocator::getDefaultAllocator();
cf_delete_buffer(_CfBufferState); _CfBufferState = NULL;

Loading…
Cancel
Save