Skip to content

Commit

Permalink
Add server and client only flags
Browse files Browse the repository at this point in the history
Allow creating paks without client only data, still work in progress as the static model vertex group buffer needs to be in a CLIENT only chunk.
  • Loading branch information
Mauler125 committed Dec 17, 2024
1 parent 667f47b commit 780c37a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
5 changes: 4 additions & 1 deletion src/common/const.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@

#define DEFAULT_RPAK_NAME "new"
#define DEFAULT_RPAK_PATH "build/"
#define PF_KEEP_DEV 1 << 0 // whether or not to keep debugging information

#define PF_KEEP_DEV 1 << 0 // whether or not to keep debugging information
#define PF_KEEP_SERVER 1 << 1 // whether or not to keep server only data
#define PF_KEEP_CLIENT 1 << 2 // whether or not to keep client only data
21 changes: 15 additions & 6 deletions src/logic/pakfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,22 @@ void CPakFile::AddAsset(const rapidjson::Value& file)
if (!assetPath)
Error("No path provided for an asset of type '%.4s'.\n", assetType);

HANDLE_ASSET_TYPE("txtr", assetType, assetPath, file, Assets::AddTextureAsset_v8, Assets::AddTextureAsset_v8);
HANDLE_ASSET_TYPE("uimg", assetType, assetPath, file, Assets::AddUIImageAsset_v10, Assets::AddUIImageAsset_v10);
HANDLE_ASSET_TYPE("matl", assetType, assetPath, file, Assets::AddMaterialAsset_v12, Assets::AddMaterialAsset_v15);
//if (IsFlagSet(PF_KEEP_CLIENT))
{
HANDLE_ASSET_TYPE("txtr", assetType, assetPath, file, Assets::AddTextureAsset_v8, Assets::AddTextureAsset_v8);
HANDLE_ASSET_TYPE("uimg", assetType, assetPath, file, Assets::AddUIImageAsset_v10, Assets::AddUIImageAsset_v10);
HANDLE_ASSET_TYPE("matl", assetType, assetPath, file, Assets::AddMaterialAsset_v12, Assets::AddMaterialAsset_v15);

HANDLE_ASSET_TYPE("shds", assetType, assetPath, file, Assets::AddShaderSetAsset_v8, Assets::AddShaderSetAsset_v11);
HANDLE_ASSET_TYPE("shdr", assetType, assetPath, file, Assets::AddShaderAsset_v8, Assets::AddShaderAsset_v12);
}

HANDLE_ASSET_TYPE("dtbl", assetType, assetPath, file, Assets::AddDataTableAsset, Assets::AddDataTableAsset);

HANDLE_ASSET_TYPE("mdl_", assetType, assetPath, file, nullptr, Assets::AddModelAsset_v9);
HANDLE_ASSET_TYPE("aseq", assetType, assetPath, file, nullptr, Assets::AddAnimSeqAsset_v7);
HANDLE_ASSET_TYPE("arig", assetType, assetPath, file, nullptr, Assets::AddAnimRigAsset_v4);

HANDLE_ASSET_TYPE("shds", assetType, assetPath, file, Assets::AddShaderSetAsset_v8, Assets::AddShaderSetAsset_v11);
HANDLE_ASSET_TYPE("shdr", assetType, assetPath, file, Assets::AddShaderAsset_v8, Assets::AddShaderAsset_v12);

HANDLE_ASSET_TYPE("Ptch", assetType, assetPath, file, Assets::AddPatchAsset, Assets::AddPatchAsset);

// If the function has not returned by this point, we have an unhandled asset type.
Expand Down Expand Up @@ -918,6 +921,12 @@ void CPakFile::BuildFromMap(const string& mapPath)
if (JSON_GetValueOrDefault(doc, "keepDevOnly", false))
AddFlags(PF_KEEP_DEV);

if (JSON_GetValueOrDefault(doc, "keepServerOnly", true))
AddFlags(PF_KEEP_SERVER);

if (JSON_GetValueOrDefault(doc, "keepClientOnly", true))
AddFlags(PF_KEEP_CLIENT);

// create file stream from path created above
BinaryIO out;
if (!out.Open(m_Path, BinaryIO::Mode_e::ReadWriteCreate))
Expand Down

0 comments on commit 780c37a

Please sign in to comment.