From 9d303b2a9a69c2ea936fe39c21c1f75163eede4e Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 2 Jun 2021 12:46:57 +0800 Subject: [PATCH] Preload data in dev client as well, ref kaetemi/ryzomclassic#168 --- nel/tools/build_gamedata/b1_client_dev.py | 3 ++- ryzom/client/src/client_cfg.cpp | 3 +++ ryzom/client/src/client_cfg.h | 2 ++ ryzom/client/src/init_main_loop.cpp | 28 +++++++++++++++++------ 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/nel/tools/build_gamedata/b1_client_dev.py b/nel/tools/build_gamedata/b1_client_dev.py index a23ee693c..3e9a5d488 100755 --- a/nel/tools/build_gamedata/b1_client_dev.py +++ b/nel/tools/build_gamedata/b1_client_dev.py @@ -50,8 +50,9 @@ if not os.path.isfile(ClientDevDirectory + "/client.cfg"): cfg = open(ClientDevDirectory + "/client.cfg", "w") cfg.write("RootConfigFilename = \"client_default.cfg\";\n") cfg.write("PreDataPath = {\n") - cfg.write("\t\"" + InstallDirectory + "\", \"user\", \"patch\", \"data\", \"examples\" \n") + cfg.write("\t\"user\", \"patch\", \"" + DataCommonDirectory + "\", \"" + GamedevDirectory + "\", \"" + LeveldesignDirectory + "/translation/translated\", \"" + InstallDirectory + "\", \"data\", \"examples\" \n") cfg.write("};\n") + cfg.write("PreLoadPath = \"" + InstallDirectory + "\";\n") cfg.write("PatchWanted = 0;\n") cfg.write("DisplayLuaDebugInfo = 1;\n") cfg.write("AllowDebugLua = 1;\n") diff --git a/ryzom/client/src/client_cfg.cpp b/ryzom/client/src/client_cfg.cpp index db38c1177..f67c4e1db 100644 --- a/ryzom/client/src/client_cfg.cpp +++ b/ryzom/client/src/client_cfg.cpp @@ -1314,6 +1314,9 @@ void CClientConfig::setValues() // Data Path no recurse. READ_STRINGVECTOR_FV(DataPathNoRecurse); + // Pre-load path + READ_STRING_DEV(PreLoadPath); + // Streamed package path READ_STRING_FV(StreamedPackagePath); diff --git a/ryzom/client/src/client_cfg.h b/ryzom/client/src/client_cfg.h index 28d42a45d..22fe46f61 100644 --- a/ryzom/client/src/client_cfg.h +++ b/ryzom/client/src/client_cfg.h @@ -391,6 +391,8 @@ struct CClientConfig std::vector DataPath; /// Data Path no recurse. std::vector DataPathNoRecurse; + /// Pre-load path + std::string PreLoadPath; /// Streamed package path std::string StreamedPackagePath; /// Streamed package hosts diff --git a/ryzom/client/src/init_main_loop.cpp b/ryzom/client/src/init_main_loop.cpp index 8d5badcd2..9d1ebf784 100644 --- a/ryzom/client/src/init_main_loop.cpp +++ b/ryzom/client/src/init_main_loop.cpp @@ -1071,14 +1071,18 @@ void initMainLoop() ProgressBar.pushCropedValues (0, 0.25f); if(!DBG_DisablePreloadShape) { - Driver->getShapeBank()->preLoadShapesFromDirectory(PreLoadCacheName, "data/3d/common/characters/shapes", "*.shape", false, &ProgressBar); + Driver->getShapeBank()->preLoadShapesFromDirectory(PreLoadCacheName, + ClientCfg.PreLoadPath.empty() ? "data/3d/common/characters/shapes" : ClientCfg.PreLoadPath + "/characters_shapes", + "*.shape", false, &ProgressBar); } ProgressBar.popCropedValues (); ProgressBar.progress (0.25f); ProgressBar.pushCropedValues (0.25f,0.5f); if(!DBG_DisablePreloadShape) { - Driver->getShapeBank()->preLoadShapesFromDirectory(PreLoadCacheName, "data/3d/common/characters/skeletons", "*.skel", false, &ProgressBar); + Driver->getShapeBank()->preLoadShapesFromDirectory(PreLoadCacheName, + ClientCfg.PreLoadPath.empty() ? "data/3d/common/characters/skeletons" : ClientCfg.PreLoadPath + "/characters_skeletons", + "*.skel", false, &ProgressBar); } ProgressBar.popCropedValues (); } @@ -1126,14 +1130,18 @@ void initMainLoop() ProgressBar.pushCropedValues (0.5f, 0.75f); if(!DBG_DisablePreloadShape) { - Driver->getShapeBank()->preLoadShapesFromDirectory(PreLoadCacheName, "data/3d/common/fauna/shapes", "*.shape", false, &ProgressBar); + Driver->getShapeBank()->preLoadShapesFromDirectory(PreLoadCacheName, + ClientCfg.PreLoadPath.empty() ? "data/3d/common/fauna/shapes" : ClientCfg.PreLoadPath + "/fauna_shapes", + "*.shape", false, &ProgressBar); } ProgressBar.popCropedValues (); ProgressBar.progress (0.75f); ProgressBar.pushCropedValues (0.75f,1); if(!DBG_DisablePreloadShape) { - Driver->getShapeBank()->preLoadShapesFromDirectory(PreLoadCacheName, "data/3d/common/fauna/skeletons", "*.skel", false, &ProgressBar); + Driver->getShapeBank()->preLoadShapesFromDirectory(PreLoadCacheName, + ClientCfg.PreLoadPath.empty() ? "data/3d/common/fauna/skeletons" : ClientCfg.PreLoadPath + "/fauna_skeletons", + "*.skel", false, &ProgressBar); } ProgressBar.popCropedValues (); } @@ -1174,14 +1182,18 @@ void initMainLoop() ProgressBar.pushCropedValues (0.0f, 0.5f); if(!DBG_DisablePreloadShape) { - Driver->getShapeBank()->preLoadShapesFromDirectory(PreLoadCacheNameFX, "data/3d/common/sfx", "*.ps", true, &ProgressBar, preloadFXTextures); + Driver->getShapeBank()->preLoadShapesFromDirectory(PreLoadCacheNameFX, + ClientCfg.PreLoadPath.empty() ? "data/3d/common/sfx" : ClientCfg.PreLoadPath + "/sfx", + "*.ps", true, &ProgressBar, preloadFXTextures); } ProgressBar.popCropedValues (); ProgressBar.progress (0.5f); ProgressBar.pushCropedValues (0.5f,1); if(!DBG_DisablePreloadShape) { - Driver->getShapeBank()->preLoadShapesFromDirectory(PreLoadCacheNameFX, "data/3d/common/sfx", "*.shape", true, &ProgressBar, preloadFXTextures); + Driver->getShapeBank()->preLoadShapesFromDirectory(PreLoadCacheNameFX, + ClientCfg.PreLoadPath.empty() ? "data/3d/common/sfx" : ClientCfg.PreLoadPath + "/sfx", + "*.shape", true, &ProgressBar, preloadFXTextures); } ProgressBar.popCropedValues (); } @@ -1214,7 +1226,9 @@ void initMainLoop() ProgressBar.pushCropedValues (0.0f, 1.f); if(!DBG_DisablePreloadShape) { - Driver->getShapeBank()->preLoadShapesFromDirectory(PreLoadCacheNameObjects, "data/3d/common/objects", "*.shape", true, &ProgressBar, preloadObjectTextures); + Driver->getShapeBank()->preLoadShapesFromDirectory(PreLoadCacheNameObjects, + ClientCfg.PreLoadPath.empty() ? "data/3d/common/objects" : ClientCfg.PreLoadPath + "/objects", + "*.shape", true, &ProgressBar, preloadObjectTextures); } ProgressBar.popCropedValues (); }