Implementation fixes, ref #179

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

@ -232,7 +232,8 @@ namespace NLMISC
#define NLMISC_SAFE_RELEASABLE_SINGLETON_DECL(className) \ #define NLMISC_SAFE_RELEASABLE_SINGLETON_DECL(className) \
NLMISC_SAFE_SINGLETON_DECL(className); \ NLMISC_SAFE_SINGLETON_DECL(className); \
\ \
void className::releaseInstance() \ public: \
static void className::releaseInstance() \
{ \ { \
if (_Instance) \ if (_Instance) \
{ \ { \
@ -241,6 +242,7 @@ namespace NLMISC
_Instance = NULL; \ _Instance = NULL; \
} \ } \
} \ } \
private:
/** The same as above, but generate a getInstance method that /** 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; _BigFileOffset = 0;
_AlwaysOpened = false; _AlwaysOpened = false;
std::string filePath; std::string filePath;
if (CStreamedPackageManager::getInstance().getFile (filePath, path)) if (CStreamedPackageManager::getInstance().getFile (filePath, path.substr(pos+1)))
{ {
_F = fopen (filePath.c_str(), mode); _F = fopen (filePath.c_str(), mode);
if (_F != NULL) if (_F != NULL)

@ -1736,7 +1736,8 @@ void CFileContainer::memoryCompress()
while (it != _Files.end()) while (it != _Files.end())
{ {
string sTmp = SSMpath.get(it->second.idPath); 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) // 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; CFileEntry &rFE = it->second;
string sTmp = SSMpath.get(rFE.idPath); 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()); strcpy(_AllFileNames+nSize, rFE.Name.c_str());
_MCFiles[nNb].Name = _AllFileNames+nSize; _MCFiles[nNb].Name = _AllFileNames+nSize;
@ -1784,8 +1786,12 @@ void CFileContainer::memoryCompress()
it++; it++;
} }
nldebug("Passed");
contReset(_Files); contReset(_Files);
_MemoryCompressed = true; _MemoryCompressed = true;
nldebug("Done");
} }
void CPath::memoryUncompress() 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') if (pos > 3 && filename[pos-3] == 's' && filename[pos-2] == 'n' && filename[pos-1] == 'p')
{ {
uint32 fs = 0; uint32 fs = 0;
CStreamedPackageManager::getInstance().getFileSize (fs, filename); CStreamedPackageManager::getInstance().getFileSize (fs, filename.substr(pos+1));
return fs; return fs;
} }
else else

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

@ -28,6 +28,7 @@
#include "nel/misc/thread.h" #include "nel/misc/thread.h"
#include "nel/misc/big_file.h" #include "nel/misc/big_file.h"
#include "nel/misc/system_utils.h" #include "nel/misc/system_utils.h"
#include "nel/misc/streamed_package_manager.h"
#include "nel/net/tcp_sock.h" #include "nel/net/tcp_sock.h"
#include "nel/3d/u_driver.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 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 // release lock on bnp, so that they can be written
NLMISC::CBigFile::getInstance().removeAll(); NLMISC::CBigFile::getInstance().removeAll();
NLMISC::CStreamedPackageManager::getInstance().unloadAll();
} }
NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_PATCHING); NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_PATCHING);

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

@ -295,7 +295,7 @@ void CScreenshotIslands::searchIslandsBorders()
zonelFiles.clear(); zonelFiles.clear();
string bnpFileName = itCont->first + ".bnp"; 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++) for(uint i=0; i<filenames.size(); i++)
{ {

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

Loading…
Cancel
Save