mods: give the 8 MB RAM builtin a current-schema manifest and parse-test every builtin

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matthew Stanley
2026-09-26 06:43:12 -07:00
parent c564ccd1f1
commit cd8135406b
3 changed files with 91 additions and 2 deletions
@@ -1,14 +1,23 @@
format_version = 5
id = "psx.enhancement.8mb-ram"
version = "1.0.0"
name = "8 MB Main RAM"
author = "psxrecomp"
description = "Enables an opt-in 8 MB main RAM map for patches that require expanded PS1 memory. Disabled by default."
resolver = "declarative"
save_compatibility = "shared"
# Main-RAM geometry is a property of the emulated machine, not of any one disc.
# Only patches written for an 8 MB (development-kit sized) RAM need it; stock
# games keep retail 2 MB mirroring with this off.
[[target]]
game_id = "*"
[[feature]]
id = "8mb-ram"
name = "8 MB Main RAM"
description = "Use expanded 8 MB main RAM instead of stock 2 MB mirroring. Both netplay peers must use the same setting."
category = "enhancement"
description = "Use expanded 8 MB main RAM instead of stock 2 MB mirroring. Savestates record the active size, so states from one setting do not load under the other. Both netplay peers must use the same setting."
group = "Advanced"
default_enabled = false
hidden = true
+12
View File
@@ -429,6 +429,18 @@ if(BUILD_TESTING)
../recompiler/lib/toml11)
add_test(NAME mod_packages_test COMMAND mod_packages_test)
add_executable(builtin_mod_manifests_test
tests/test_builtin_mod_manifests.cpp
src/mod_packages.cpp
src/crc32.c
src/psx_sha256.c)
target_include_directories(builtin_mod_manifests_test PRIVATE
include
../recompiler/lib/toml11)
add_test(NAME builtin_mod_manifests_test
COMMAND builtin_mod_manifests_test
"${CMAKE_CURRENT_SOURCE_DIR}/../mods/builtin/packages")
add_executable(text_xlate_fix_only_test
tests/test_text_xlate_fix_only.cpp
src/text_xlate.cpp
@@ -0,0 +1,68 @@
/* Every framework-builtin mod package must parse under the current manifest
* schema. A builtin that fails to parse is silently dropped from the catalog
* at runtime ("mod manifest ignored"), which for an activation package such as
* psx.enhancement.8mb-ram makes the feature impossible to enable while every
* other test stays green.
*
* Usage: builtin_mod_manifests_test <mods/builtin/packages dir> */
#include "mod_packages.h"
#include <filesystem>
#include <iostream>
#include <string>
namespace fs = std::filesystem;
using namespace PSXRecompV4;
static int failures;
static void check(bool value, const std::string& message) {
if (!value) {
std::cerr << "FAIL: " << message << "\n";
failures++;
}
}
int main(int argc, char** argv) {
if (argc != 2) {
std::cerr << "usage: builtin_mod_manifests_test <packages dir>\n";
return 2;
}
const fs::path root(argv[1]);
int parsed = 0;
bool saw_8mb = false;
for (const auto& entry : fs::recursive_directory_iterator(root)) {
if (!entry.is_regular_file() || entry.path().filename() != "manifest.toml")
continue;
ModPackage package;
std::string error;
const bool ok = ModPackageManager::read_manifest(entry.path(), package, &error);
check(ok, entry.path().string() + ": " + error);
if (!ok) continue;
parsed++;
const fs::path version_dir = entry.path().parent_path();
check(package.version == version_dir.filename().string(),
entry.path().string() + ": version does not match its directory");
check(package.id == version_dir.parent_path().filename().string(),
entry.path().string() + ": id does not match its directory");
if (package.id == "psx.enhancement.8mb-ram") {
saw_8mb = true;
check(package.features.size() == 1 && package.features[0].id == "8mb-ram",
"8 MB package exposes exactly the 8mb-ram feature");
check(!package.features.empty() && !package.features[0].default_enabled,
"8 MB RAM is opt-in (default disabled)");
check(!package.features.empty() && package.features[0].hidden,
"8 MB RAM is hidden by default");
check(package.plugins.size() == 1 && package.plugins[0].id == "psx.8mb-ram" &&
package.plugins[0].feature_id == "8mb-ram",
"8 MB feature activates the psx.8mb-ram plugin");
check(package.targets.size() == 1 && package.targets[0].game_id == "*",
"8 MB package applies to every game");
}
}
check(parsed > 0, "no builtin manifests found under " + root.string());
check(saw_8mb, "psx.enhancement.8mb-ram builtin package missing");
if (failures == 0)
std::cout << "PASS builtin mod manifests (" << parsed << " packages)\n";
return failures ? 1 : 0;
}