Merge pull request #107 from WaywardHeart/patches

Add a "patches" option to the config.
This commit is contained in:
Splendide Imaginarius 2023-11-22 21:55:56 +00:00 committed by GitHub
commit 5ed8fd7986
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 0 deletions

View file

@ -331,6 +331,14 @@
// "/path/to/rtp2.zip", // "/path/to/rtp2.zip",
// "/path/to/game.rgssad"], // "/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 // Use the script's name as filename in warnings and error messages
// (default: enabled) // (default: enabled)

View file

@ -180,6 +180,7 @@ void Config::read(int argc, char *argv[]) {
{"useScriptNames", true}, {"useScriptNames", true},
{"preloadScript", json::array({})}, {"preloadScript", json::array({})},
{"RTP", json::array({})}, {"RTP", json::array({})},
{"patches", json::array({})},
{"fontSub", json::array({})}, {"fontSub", json::array({})},
{"rubyLoadpath", json::array({})}, {"rubyLoadpath", json::array({})},
{"JITEnable", false}, {"JITEnable", false},
@ -298,6 +299,7 @@ try { exp } catch (...) {}
fillStringVec(opts["preloadScript"], preloadScripts); fillStringVec(opts["preloadScript"], preloadScripts);
fillStringVec(opts["RTP"], rtps); fillStringVec(opts["RTP"], rtps);
fillStringVec(opts["patches"], patches);
fillStringVec(opts["fontSub"], fontSubs); fillStringVec(opts["fontSub"], fontSubs);
for (std::string & fontSub : fontSubs) for (std::string & fontSub : fontSubs)
std::transform(fontSub.begin(), fontSub.end(), fontSub.begin(), std::transform(fontSub.begin(), fontSub.end(), fontSub.begin(),

View file

@ -106,6 +106,7 @@ struct Config {
std::vector<std::string> launchArgs; std::vector<std::string> launchArgs;
std::vector<std::string> preloadScripts; std::vector<std::string> preloadScripts;
std::vector<std::string> rtps; std::vector<std::string> rtps;
std::vector<std::string> patches;
std::vector<std::string> fontSubs; std::vector<std::string> fontSubs;

View file

@ -125,6 +125,9 @@ struct SharedStatePrivate
std::string archPath = config.execName + gameArchExt(); 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 */ /* Check if a game archive exists */
FILE *tmp = fopen(archPath.c_str(), "rb"); FILE *tmp = fopen(archPath.c_str(), "rb");
if (tmp) if (tmp)