mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-09-10 03:52:55 +02:00
allow enabling/disabling certain options through env
This commit is contained in:
parent
27f7ee78e1
commit
56ef0ed900
6 changed files with 30 additions and 7 deletions
|
@ -266,8 +266,9 @@ static void mriBindingInit() {
|
|||
rb_define_const(mod, "CONFIG", cfg);
|
||||
|
||||
// Set $stdout and its ilk accordingly on Windows
|
||||
// I regret teaching you that word
|
||||
#ifdef __WIN32__
|
||||
if (shState->config().editor.debug)
|
||||
if (shState->config().winConsole)
|
||||
configureWindowsStreams();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -76,6 +76,7 @@ MKXPZTouchBar *_sharedTouchBar;
|
|||
}
|
||||
else if ([identifier isEqualToString:@"icon"]) {
|
||||
NSImage *appIcon = [NSWorkspace.sharedWorkspace iconForFile:NSBundle.mainBundle.bundlePath];
|
||||
appIcon.size = NSSizeFromCGSize(CGSizeMake(30,30));
|
||||
ret.view = [NSImageView imageViewWithImage:appIcon];
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include "util/iniconfig.h"
|
||||
#include "util/encoding.h"
|
||||
|
||||
#include "system/system.h"
|
||||
|
||||
|
||||
namespace json = json5pp;
|
||||
|
||||
|
@ -251,6 +253,14 @@ try { exp } catch (...) {}
|
|||
rgssVersion = clamp(rgssVersion, 0, 3);
|
||||
SE.sourceCount = clamp(SE.sourceCount, 1, 64);
|
||||
|
||||
// Determine whether to open a console window on... Windows
|
||||
const char *consoleEnv = SDL_getenv("MKXPZ_WINDOWS_CONSOLE");
|
||||
winConsole = ((consoleEnv && !strcmp(consoleEnv, "1")) || editor.debug);
|
||||
|
||||
// Determine whether to use the Metal renderer on macOS
|
||||
const char *metalEnv = SDL_getenv("MKXPZ_MACOS_METAL");
|
||||
preferMetalRenderer = (!metalEnv || strcmp(metalEnv, "0")) && isMetalSupported();
|
||||
|
||||
}
|
||||
|
||||
static void setupScreenSize(Config &conf) {
|
||||
|
|
|
@ -35,6 +35,7 @@ struct Config {
|
|||
int rgssVersion;
|
||||
|
||||
bool debugMode;
|
||||
bool winConsole;
|
||||
bool preferMetalRenderer;
|
||||
bool printFPS;
|
||||
|
||||
|
|
18
src/main.cpp
18
src/main.cpp
|
@ -34,6 +34,7 @@
|
|||
#include <string.h>
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
#include <regex>
|
||||
|
||||
#include "binding.h"
|
||||
#include "sharedstate.h"
|
||||
|
@ -86,8 +87,18 @@ static inline const char *glGetStringInt(GLenum name) {
|
|||
}
|
||||
|
||||
static void printGLInfo() {
|
||||
const std::string renderer(glGetStringInt(GL_RENDERER));
|
||||
std::regex rgx("ANGLE \\((.+), ANGLE Metal Renderer: (.+), Version (.+)\\)");
|
||||
|
||||
std::smatch matches;
|
||||
if (std::regex_search(renderer, matches, rgx)) {
|
||||
Debug() << "Metal Device :" << matches[2] << "(" + matches[1].str() + ")";
|
||||
Debug() << "ANGLE Version :" << matches[3].str();
|
||||
return;
|
||||
}
|
||||
|
||||
Debug() << "GL Vendor :" << glGetStringInt(GL_VENDOR);
|
||||
Debug() << "GL Renderer :" << glGetStringInt(GL_RENDERER);
|
||||
Debug() << "GL Renderer :" << renderer;
|
||||
Debug() << "GL Version :" << glGetStringInt(GL_VERSION);
|
||||
Debug() << "GLSL Version :" << glGetStringInt(GL_SHADING_LANGUAGE_VERSION);
|
||||
}
|
||||
|
@ -230,7 +241,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
#if defined(__WIN32__)
|
||||
// Create a debug console in debug mode
|
||||
if (conf.editor.debug) {
|
||||
if (conf.winConsole) {
|
||||
if (setupWindowsConsole()) {
|
||||
reopenWindowsStreams();
|
||||
} else {
|
||||
|
@ -241,7 +252,6 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
conf.readGameINI();
|
||||
|
||||
#ifdef MKXPZ_STEAM
|
||||
|
@ -326,7 +336,7 @@ int main(int argc, char *argv[]) {
|
|||
// Doesn't completely do it though, needs a small patch to SDL
|
||||
#ifdef MKXPZ_BUILD_XCODE
|
||||
// Setting OpenGL only works when building in Release mode due to the config getting re-read later
|
||||
SDL_setenv("ANGLE_DEFAULT_PLATFORM", (conf.preferMetalRenderer && isMetalSupported()) ? "metal" : "opengl", true);
|
||||
SDL_setenv("ANGLE_DEFAULT_PLATFORM", (conf.preferMetalRenderer) ? "metal" : "opengl", true);
|
||||
SDL_GL_LoadLibrary("@rpath/libEGL.dylib");
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -70,10 +70,10 @@ struct VButton
|
|||
BTN_STRING(R),
|
||||
BTN_STRING(A),
|
||||
BTN_STRING(B),
|
||||
BTN_STRING_CUSTOM(ZL, "C"),
|
||||
BTN_STRING(C),
|
||||
BTN_STRING(X),
|
||||
BTN_STRING(Y),
|
||||
BTN_STRING_CUSTOM(ZR, "Z"),
|
||||
BTN_STRING(Z)
|
||||
};
|
||||
|
||||
static elementsN(vButtons);
|
||||
|
|
Loading…
Add table
Reference in a new issue