diff --git a/code/nel/include/nel/misc/app_context.h b/code/nel/include/nel/misc/app_context.h index 2388dffe1..3ab77aada 100644 --- a/code/nel/include/nel/misc/app_context.h +++ b/code/nel/include/nel/misc/app_context.h @@ -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 diff --git a/code/nel/src/misc/file.cpp b/code/nel/src/misc/file.cpp index a542a3dc2..e2168def6 100644 --- a/code/nel/src/misc/file.cpp +++ b/code/nel/src/misc/file.cpp @@ -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) diff --git a/code/nel/src/misc/path.cpp b/code/nel/src/misc/path.cpp index 7ed6cb54f..b7d58df51 100644 --- a/code/nel/src/misc/path.cpp +++ b/code/nel/src/misc/path.cpp @@ -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 diff --git a/code/nel/tools/build_gamedata/d2_client_install.py b/code/nel/tools/build_gamedata/d2_client_install.py index febaef656..bb399447f 100755 --- a/code/nel/tools/build_gamedata/d2_client_install.py +++ b/code/nel/tools/build_gamedata/d2_client_install.py @@ -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] diff --git a/code/ryzom/client/src/login.cpp b/code/ryzom/client/src/login.cpp index 091e24a80..e4d9b18b5 100644 --- a/code/ryzom/client/src/login.cpp +++ b/code/ryzom/client/src/login.cpp @@ -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); diff --git a/code/ryzom/client/src/release.cpp b/code/ryzom/client/src/release.cpp index f88849197..403b654e9 100644 --- a/code/ryzom/client/src/release.cpp +++ b/code/ryzom/client/src/release.cpp @@ -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(); diff --git a/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp b/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp index 4f167ea9c..d678c0b17 100644 --- a/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp +++ b/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp @@ -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