mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-04 22:15:33 +02:00
Execute/skip scripts based on a platform marker
This commit is contained in:
parent
7ffa03cafe
commit
967fca8daa
1 changed files with 18 additions and 1 deletions
|
@ -479,6 +479,7 @@ static void runRMXPScripts(BacktraceData &btData)
|
||||||
{
|
{
|
||||||
const Config &conf = shState->rtData().config;
|
const Config &conf = shState->rtData().config;
|
||||||
const std::string &scriptPack = conf.game.scripts;
|
const std::string &scriptPack = conf.game.scripts;
|
||||||
|
const char *platform = SDL_GetPlatform();
|
||||||
|
|
||||||
if (scriptPack.empty())
|
if (scriptPack.empty())
|
||||||
{
|
{
|
||||||
|
@ -599,7 +600,23 @@ static void runRMXPScripts(BacktraceData &btData)
|
||||||
|
|
||||||
fname = newStringUTF8(buf, len);
|
fname = newStringUTF8(buf, len);
|
||||||
btData.scriptNames.insert(buf, scriptName);
|
btData.scriptNames.insert(buf, scriptName);
|
||||||
|
|
||||||
|
// if the script name starts with |s|, only execute
|
||||||
|
// it if "s" is the same first letter as the platform
|
||||||
|
// we're running on
|
||||||
|
|
||||||
|
// |W| - Windows, |M| - Mac OS X, |L| - Linux
|
||||||
|
|
||||||
|
if (strlen(scriptName) > 2 &&
|
||||||
|
scriptName[0] == '|' && scriptName[2] == scriptName[0])
|
||||||
|
{
|
||||||
|
if (scriptName[1] != platform[0])
|
||||||
|
{
|
||||||
|
Debug() << RSTRING_PTR(fname) << ": Skipped due to platform check mismatch";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int state;
|
int state;
|
||||||
|
|
||||||
evalString(string, fname, &state);
|
evalString(string, fname, &state);
|
||||||
|
|
Loading…
Add table
Reference in a new issue