diff --git a/README.md b/README.md index 5f2934f..2a6a5a8 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,7 @@ mkxp reads configuration data from the file "mkxp.conf" contained in the current | fixedFramerate | int | 0 | FPS will be fixed to this amount. Ignored if 0. | | solidFonts | bool | false | Don't use alpha blending for fonts | | gameFolder | string | "." | mkxp will look for all game related files here | +| allowSymlinks | bool | false | Allow symlinks to be followed in the game folder. | | customScript | string | "" | Execute a raw ruby script file instead of an RPG Maker game. | | RTPs | string list | "" | A list of space separated paths to RTPs to be used (See next section) | diff --git a/src/config.cpp b/src/config.cpp index 0b24682..3525b0e 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -39,7 +39,8 @@ Config::Config() defScreenH(480), fixedFramerate(0), solidFonts(false), - gameFolder(".") + gameFolder("."), + allowSymlinks(false) {} void Config::read() @@ -59,6 +60,7 @@ void Config::read() READ_VAL(fixedFramerate, Int); READ_VAL(solidFonts, Bool); READ_VAL(gameFolder, ByteArray); + READ_VAL(allowSymlinks, Bool); READ_VAL(customScript, ByteArray); QStringList _rtps = confFile.value("RTPs").toStringList(); diff --git a/src/config.h b/src/config.h index 29c949e..869b59e 100644 --- a/src/config.h +++ b/src/config.h @@ -45,6 +45,7 @@ struct Config bool solidFonts; QByteArray gameFolder; + bool allowSymlinks; QByteArray customScript; QVector rtps; diff --git a/src/filesystem.cpp b/src/filesystem.cpp index eb6c21a..d4266ca 100644 --- a/src/filesystem.cpp +++ b/src/filesystem.cpp @@ -679,12 +679,16 @@ struct FileSystemPrivate } }; -FileSystem::FileSystem(const char *argv0) +FileSystem::FileSystem(const char *argv0, + bool allowSymlinks) { p = new FileSystemPrivate; PHYSFS_init(argv0); PHYSFS_registerArchiver(&RGSS_Archiver); + + if (allowSymlinks) + PHYSFS_permitSymbolicLinks(1); } FileSystem::~FileSystem() diff --git a/src/filesystem.h b/src/filesystem.h index ecb12bf..8a18a23 100644 --- a/src/filesystem.h +++ b/src/filesystem.h @@ -54,7 +54,8 @@ struct FileSystemPrivate; class FileSystem { public: - FileSystem(const char *argv0); + FileSystem(const char *argv0, + bool allowSymlinks); ~FileSystem(); void addPath(const char *path); diff --git a/src/sharedstate.cpp b/src/sharedstate.cpp index b469c5b..d85dd1f 100644 --- a/src/sharedstate.cpp +++ b/src/sharedstate.cpp @@ -99,7 +99,7 @@ struct SharedStatePrivate SharedStatePrivate(RGSSThreadData *threadData) : bindingData(0), sdlWindow(threadData->window), - fileSystem(threadData->argv0), + fileSystem(threadData->argv0, threadData->config.allowSymlinks), eThread(*threadData->ethread), rtData(*threadData), config(threadData->config),