mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-04-21 21:52:04 +02:00
Set Ruby's ARGV based on the command line
This commit is contained in:
parent
0770751e20
commit
7a9d60cdbc
4 changed files with 131 additions and 105 deletions
|
@ -1077,6 +1077,13 @@ static void mriBindingExecute() {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
VALUE rbArgv = rb_get_argv();
|
||||
for (const auto &str : conf.launchArgs)
|
||||
rb_ary_push(rbArgv, rb_utf8_str_new_cstr(str.c_str()));
|
||||
|
||||
// Duplicates get pushed for some reason
|
||||
rb_funcall(rbArgv, rb_intern("uniq!"), 0);
|
||||
|
||||
VALUE lpaths = rb_gv_get(":");
|
||||
if (!conf.rubyLoadpaths.empty()) {
|
||||
/* Setup custom load paths */
|
||||
|
|
12
mkxp.json
12
mkxp.json
|
@ -324,4 +324,16 @@
|
|||
//
|
||||
// "execName": "Game"
|
||||
|
||||
// You can define alternate terminology for the different
|
||||
// inputs recognized by RPG Maker. A, B, C, X, Y, Z, L, and R
|
||||
// can all be set using this dictionary, and will be displayed
|
||||
// on the F1 menu. This is only a cosmetic effect, so it will
|
||||
// have no effect on the game's scripts.
|
||||
//
|
||||
// "bindingNames": {
|
||||
// "c": "Confirm",
|
||||
// "b": "Cancel",
|
||||
// "x": ...
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
@ -236,6 +236,11 @@ try { exp } catch (...) {}
|
|||
editor.debug = true;
|
||||
else if (!strcmp(argv[1], "btest"))
|
||||
editor.battleTest = true;
|
||||
|
||||
for (int i = 1; i < argc; i++) {
|
||||
const char *arg = argv[i];
|
||||
launchArgs.push_back(argv[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (mkxp_fs::fileExists(CONF_FILE)) {
|
||||
|
|
172
src/config.h
172
src/config.h
|
@ -1,23 +1,23 @@
|
|||
/*
|
||||
** config.h
|
||||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** mkxp is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
** config.h
|
||||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** mkxp is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
@ -27,85 +27,87 @@
|
|||
#include <vector>
|
||||
|
||||
struct Config {
|
||||
int rgssVersion;
|
||||
int rgssVersion;
|
||||
|
||||
bool debugMode;
|
||||
bool printFPS;
|
||||
bool debugMode;
|
||||
bool printFPS;
|
||||
|
||||
bool winResizable;
|
||||
bool fullscreen;
|
||||
bool fixedAspectRatio;
|
||||
bool smoothScaling;
|
||||
bool vsync;
|
||||
bool winResizable;
|
||||
bool fullscreen;
|
||||
bool fixedAspectRatio;
|
||||
bool smoothScaling;
|
||||
bool vsync;
|
||||
|
||||
int defScreenW;
|
||||
int defScreenH;
|
||||
std::string windowTitle;
|
||||
int defScreenW;
|
||||
int defScreenH;
|
||||
std::string windowTitle;
|
||||
|
||||
int fixedFramerate;
|
||||
bool frameSkip;
|
||||
bool syncToRefreshrate;
|
||||
int fixedFramerate;
|
||||
bool frameSkip;
|
||||
bool syncToRefreshrate;
|
||||
|
||||
bool solidFonts;
|
||||
bool solidFonts;
|
||||
|
||||
bool subImageFix;
|
||||
bool enableBlitting;
|
||||
int maxTextureSize;
|
||||
bool subImageFix;
|
||||
bool enableBlitting;
|
||||
int maxTextureSize;
|
||||
|
||||
std::string gameFolder;
|
||||
bool anyAltToggleFS;
|
||||
bool enableReset;
|
||||
bool allowSymlinks;
|
||||
bool pathCache;
|
||||
std::string gameFolder;
|
||||
bool anyAltToggleFS;
|
||||
bool enableReset;
|
||||
bool allowSymlinks;
|
||||
bool pathCache;
|
||||
|
||||
std::string dataPathOrg;
|
||||
std::string dataPathApp;
|
||||
std::string dataPathOrg;
|
||||
std::string dataPathApp;
|
||||
|
||||
std::string iconPath;
|
||||
std::string execName;
|
||||
std::string titleLanguage;
|
||||
std::string iconPath;
|
||||
std::string execName;
|
||||
std::string titleLanguage;
|
||||
|
||||
struct {
|
||||
std::string soundFont;
|
||||
bool chorus;
|
||||
bool reverb;
|
||||
} midi;
|
||||
struct {
|
||||
std::string soundFont;
|
||||
bool chorus;
|
||||
bool reverb;
|
||||
} midi;
|
||||
|
||||
struct {
|
||||
int sourceCount;
|
||||
} SE;
|
||||
struct {
|
||||
int sourceCount;
|
||||
} SE;
|
||||
|
||||
bool useScriptNames;
|
||||
bool useScriptNames;
|
||||
|
||||
std::string customScript;
|
||||
std::vector<std::string> preloadScripts;
|
||||
std::vector<std::string> rtps;
|
||||
std::string customScript;
|
||||
|
||||
std::vector<std::string> fontSubs;
|
||||
std::vector<std::string> launchArgs;
|
||||
std::vector<std::string> preloadScripts;
|
||||
std::vector<std::string> rtps;
|
||||
|
||||
std::vector<std::string> rubyLoadpaths;
|
||||
std::vector<std::string> fontSubs;
|
||||
|
||||
/* Editor flags */
|
||||
struct {
|
||||
bool debug;
|
||||
bool battleTest;
|
||||
} editor;
|
||||
std::vector<std::string> rubyLoadpaths;
|
||||
|
||||
/* Game INI contents */
|
||||
struct {
|
||||
std::string scripts;
|
||||
std::string title;
|
||||
} game;
|
||||
/* Editor flags */
|
||||
struct {
|
||||
bool debug;
|
||||
bool battleTest;
|
||||
} editor;
|
||||
|
||||
// JIT Options
|
||||
struct {
|
||||
bool enabled;
|
||||
int verboseLevel;
|
||||
int maxCache;
|
||||
int minCalls;
|
||||
} jit;
|
||||
/* Game INI contents */
|
||||
struct {
|
||||
std::string scripts;
|
||||
std::string title;
|
||||
} game;
|
||||
|
||||
// Keybinding action name mappings
|
||||
// JIT Options
|
||||
struct {
|
||||
bool enabled;
|
||||
int verboseLevel;
|
||||
int maxCache;
|
||||
int minCalls;
|
||||
} jit;
|
||||
|
||||
// Keybinding action name mappings
|
||||
struct {
|
||||
std::string a;
|
||||
std::string b;
|
||||
|
@ -119,14 +121,14 @@ struct Config {
|
|||
std::string r;
|
||||
} kbActionNames;
|
||||
|
||||
/* Internal */
|
||||
std::string customDataPath;
|
||||
std::string commonDataPath;
|
||||
/* Internal */
|
||||
std::string customDataPath;
|
||||
std::string commonDataPath;
|
||||
|
||||
Config();
|
||||
Config();
|
||||
|
||||
void read(int argc, char *argv[]);
|
||||
void readGameINI();
|
||||
void read(int argc, char *argv[]);
|
||||
void readGameINI();
|
||||
};
|
||||
|
||||
#endif // CONFIG_H
|
||||
|
|
Loading…
Add table
Reference in a new issue