summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-03-03 09:00:50 +0100
committerskal <pascal.massimino@gmail.com>2026-03-03 09:00:50 +0100
commitd572203c41cfff817465fc3cddcdea56d5d7d9f8 (patch)
tree12d55401510fb658416dcd3aead47a14f046061a /tools
parentc229f3c6b5756d5cbbdad6049b4250ebea7aae7a (diff)
feat(assets): replace is_procedural/is_gpu_procedural bools with AssetType enum, add MP3 type
- Add AssetType enum {STATIC, PROC, PROC_GPU, MP3} to AssetRecord - Add GetAssetType() API to asset_manager.h/cc - asset_packer: parse 'MP3' compression keyword in assets.txt - tracker: remove magic-byte is_mp3_asset(); use GetAssetType() instead - assets.txt: NEVER_MP3 now uses 'MP3' compression type - doc/ASSET_SYSTEM.md: rewritten to document new types and API handoff(Gemini): AssetType enum landed; MP3 detection is now explicit via asset metadata.
Diffstat (limited to 'tools')
-rw-r--r--tools/asset_packer.cc32
1 files changed, 17 insertions, 15 deletions
diff --git a/tools/asset_packer.cc b/tools/asset_packer.cc
index 7e186b6..0d48906 100644
--- a/tools/asset_packer.cc
+++ b/tools/asset_packer.cc
@@ -80,9 +80,8 @@ static bool ParseProceduralParams(const std::string& params_str,
// Helper struct to hold all information about an asset during parsing
struct AssetBuildInfo {
std::string name;
- std::string filename; // Original filename for static assets
- bool is_procedural;
- bool is_gpu_procedural;
+ std::string filename; // Original filename for static assets
+ std::string asset_type; // "STATIC", "PROC", "PROC_GPU", "MP3"
std::string proc_func_name; // Function name string
std::vector<float> proc_params; // Parameters for procedural function
@@ -439,21 +438,23 @@ int main(int argc, char* argv[]) {
info.data_array_name = "ASSET_DATA_" + info.name;
info.params_array_name = "ASSET_PROC_PARAMS_" + info.name;
info.func_name_str_name = "ASSET_PROC_FUNC_STR_" + info.name;
- info.is_procedural = false;
- info.is_gpu_procedural = false;
+ info.asset_type = "STATIC";
if (compression_type_str.rfind("PROC_GPU(", 0) == 0) {
- info.is_procedural = true;
- info.is_gpu_procedural = true;
+ info.asset_type = "PROC_GPU";
if (!ParseProceduralFunction(compression_type_str, &info, true)) {
return 1;
}
} else if (compression_type_str.rfind("PROC(", 0) == 0) {
- info.is_procedural = true;
- info.is_gpu_procedural = false;
+ info.asset_type = "PROC";
if (!ParseProceduralFunction(compression_type_str, &info, false)) {
return 1;
}
+ } else if (compression_type_str == "MP3") {
+ info.asset_type = "MP3";
+ } else if (compression_type_str != "NONE") {
+ fprintf(stderr, "Warning: Unknown compression type '%s' for asset: %s\n",
+ compression_type_str.c_str(), info.name.c_str());
}
asset_build_infos.push_back(info);
@@ -479,7 +480,7 @@ int main(int argc, char* argv[]) {
std::fclose(assets_h_file);
for (const auto& info : asset_build_infos) {
- if (!info.is_procedural) {
+ if (info.asset_type != "PROC" && info.asset_type != "PROC_GPU") {
std::string base_dir =
assets_txt_path.substr(0, assets_txt_path.find_last_of("/\\") + 1);
std::filesystem::path base_path = std::filesystem::absolute(base_dir);
@@ -542,15 +543,16 @@ int main(int argc, char* argv[]) {
fprintf(assets_data_cc_file, " static const AssetRecord assets[] = {\n");
for (const auto& info : asset_build_infos) {
fprintf(assets_data_cc_file, " { ");
- if (info.is_procedural) {
- fprintf(assets_data_cc_file, "nullptr, 0, true, %s, %s, %s, %zu",
- info.is_gpu_procedural ? "true" : "false",
+ if (info.asset_type == "PROC" || info.asset_type == "PROC_GPU") {
+ fprintf(assets_data_cc_file, "nullptr, 0, AssetType::%s, %s, %s, %zu",
+ info.asset_type.c_str(),
info.func_name_str_name.c_str(), info.params_array_name.c_str(),
info.proc_params.size());
} else {
fprintf(assets_data_cc_file,
- "%s, ASSET_SIZE_%s, false, false, nullptr, nullptr, 0",
- info.data_array_name.c_str(), info.name.c_str());
+ "%s, ASSET_SIZE_%s, AssetType::%s, nullptr, nullptr, 0",
+ info.data_array_name.c_str(), info.name.c_str(),
+ info.asset_type.c_str());
}
fprintf(assets_data_cc_file, " },\n");
}