From f8be9ffe4cebe3bd544c8fb8271f246766217333 Mon Sep 17 00:00:00 2001 From: Wayward Heart <91356680+WaywardHeart@users.noreply.github.com> Date: Thu, 26 Oct 2023 21:44:42 -0500 Subject: [PATCH] Add a "patches" option to the config. --- mkxp.json | 8 ++++++++ src/config.cpp | 2 ++ src/config.h | 1 + src/sharedstate.cpp | 3 +++ 4 files changed, 14 insertions(+) diff --git a/mkxp.json b/mkxp.json index 8a3649c7..4e9efce9 100644 --- a/mkxp.json +++ b/mkxp.json @@ -332,6 +332,14 @@ // "/path/to/rtp2.zip", // "/path/to/game.rgssad"], + // Similar to the RTP option, except items are loaded before + // the game archive and folder, for incremental game updates + // or modding. + // (default: none) + // + // "patches": ["/path/to/patch1.zip", + // "/path/to/patch2"], + // Use the script's name as filename in warnings and error messages // (default: enabled) diff --git a/src/config.cpp b/src/config.cpp index 58932abc..b66bebf9 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -181,6 +181,7 @@ void Config::read(int argc, char *argv[]) { {"useScriptNames", 1}, {"preloadScript", json::array({})}, {"RTP", json::array({})}, + {"patches", json::array({})}, {"fontSub", json::array({})}, {"rubyLoadpath", json::array({})}, {"JITEnable", false}, @@ -297,6 +298,7 @@ try { exp } catch (...) {} fillStringVec(opts["preloadScript"], preloadScripts); fillStringVec(opts["RTP"], rtps); + fillStringVec(opts["patches"], patches); fillStringVec(opts["fontSub"], fontSubs); fillStringVec(opts["rubyLoadpath"], rubyLoadpaths); diff --git a/src/config.h b/src/config.h index 328df348..9f7273be 100644 --- a/src/config.h +++ b/src/config.h @@ -107,6 +107,7 @@ struct Config { std::vector launchArgs; std::vector preloadScripts; std::vector rtps; + std::vector patches; std::vector fontSubs; diff --git a/src/sharedstate.cpp b/src/sharedstate.cpp index c1ee14ab..f11153ec 100644 --- a/src/sharedstate.cpp +++ b/src/sharedstate.cpp @@ -125,6 +125,9 @@ struct SharedStatePrivate std::string archPath = config.execName + gameArchExt(); + for (size_t i = 0; i < config.patches.size(); ++i) + fileSystem.addPath(config.patches[i].c_str()); + /* Check if a game archive exists */ FILE *tmp = fopen(archPath.c_str(), "rb"); if (tmp)