From 8fbd85b0fc893ce60c16cf16ad5c90177d88de3b Mon Sep 17 00:00:00 2001 From: ZedB0T <89345505+Zedb0T@users.noreply.github.com> Date: Sun, 22 Jun 2025 20:07:43 -0400 Subject: [PATCH] Fail building custom level if long_name is too long (#3966) If long_name is too long, it will result in the level being invisible but the collide loading, lets detect this and point the user in correct direction to solve it with a clear error message. --------- Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com> --- custom_assets/jak1/levels/test-zone/test-zone.jsonc | 1 + custom_assets/jak2/levels/test-zone/test-zone.jsonc | 1 + custom_assets/jak3/levels/test-zone/test-zone.jsonc | 1 + goalc/build_level/jak1/build_level.cpp | 3 +++ goalc/build_level/jak2/build_level.cpp | 3 +++ goalc/build_level/jak3/build_level.cpp | 3 +++ 6 files changed, 12 insertions(+) diff --git a/custom_assets/jak1/levels/test-zone/test-zone.jsonc b/custom_assets/jak1/levels/test-zone/test-zone.jsonc index a08d1b62ee..3e7bd77a05 100644 --- a/custom_assets/jak1/levels/test-zone/test-zone.jsonc +++ b/custom_assets/jak1/levels/test-zone/test-zone.jsonc @@ -1,6 +1,7 @@ { // The "in-game" name of the level. Should be lower case, with dashes (GOAL symbol name) // the name of this file, and the folder this file is in must have the same name. + // The long_name must also be 10 characters or fewer. "long_name": "test-zone", // The file name, should be upper case and 8 characters or less. "iso_name": "TESTZONE", diff --git a/custom_assets/jak2/levels/test-zone/test-zone.jsonc b/custom_assets/jak2/levels/test-zone/test-zone.jsonc index 78dce59c8f..5953484bd8 100644 --- a/custom_assets/jak2/levels/test-zone/test-zone.jsonc +++ b/custom_assets/jak2/levels/test-zone/test-zone.jsonc @@ -1,6 +1,7 @@ { // The "in-game" name of the level. Should be lower case, with dashes (GOAL symbol name) // the name of this file, and the folder this file is in must have the same name. + // The long_name must also be 10 characters or fewer. "long_name": "test-zone", // The file name, should be upper case and 8 characters or less. "iso_name": "TESTZONE", diff --git a/custom_assets/jak3/levels/test-zone/test-zone.jsonc b/custom_assets/jak3/levels/test-zone/test-zone.jsonc index cd852780df..af145a51b1 100644 --- a/custom_assets/jak3/levels/test-zone/test-zone.jsonc +++ b/custom_assets/jak3/levels/test-zone/test-zone.jsonc @@ -1,6 +1,7 @@ { // The "in-game" name of the level. Should be lower case, with dashes (GOAL symbol name) // the name of this file, and the folder this file is in must have the same name. + // The long_name must also be 10 characters or fewer. "long_name": "test-zone", // The file name, should be upper case and 8 characters or less. "iso_name": "TESTZONE", diff --git a/goalc/build_level/jak1/build_level.cpp b/goalc/build_level/jak1/build_level.cpp index 9513bf5596..52d6fa2ee1 100644 --- a/goalc/build_level/jak1/build_level.cpp +++ b/goalc/build_level/jak1/build_level.cpp @@ -48,6 +48,9 @@ bool run_build_level(const std::string& input_file, // unk zero // name file.name = level_json.at("long_name").get(); + ASSERT_MSG(file.name.size() <= 10, + fmt::format("long_name over 10 characters ({} characters): '{}'", file.name.size(), + file.name)); // nick file.nickname = level_json.at("nickname").get(); // vis infos diff --git a/goalc/build_level/jak2/build_level.cpp b/goalc/build_level/jak2/build_level.cpp index 7a65489e8c..b350ffac9a 100644 --- a/goalc/build_level/jak2/build_level.cpp +++ b/goalc/build_level/jak2/build_level.cpp @@ -42,6 +42,9 @@ bool run_build_level(const std::string& input_file, // unk zero // name file.name = level_json.at("long_name").get(); + ASSERT_MSG(file.name.size() <= 10, + fmt::format("long_name over 10 characters ({} characters): '{}'", file.name.size(), + file.name)); // nick file.nickname = level_json.at("nickname").get(); // vis infos diff --git a/goalc/build_level/jak3/build_level.cpp b/goalc/build_level/jak3/build_level.cpp index e83e220760..932ae679ff 100644 --- a/goalc/build_level/jak3/build_level.cpp +++ b/goalc/build_level/jak3/build_level.cpp @@ -40,6 +40,9 @@ bool run_build_level(const std::string& input_file, // unk zero // name file.name = level_json.at("long_name").get(); + ASSERT_MSG(file.name.size() <= 10, + fmt::format("long_name over 10 characters ({} characters): '{}'", file.name.size(), + file.name)); // nick file.nickname = level_json.at("nickname").get(); // vis infos