mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2024-10-28 11:19:36 +01:00
Good enough to release (?)
This commit is contained in:
parent
85fe2b070a
commit
64dad2ad27
11 changed files with 62 additions and 23 deletions
|
@ -1071,7 +1071,7 @@ static void mriBindingExecute() {
|
|||
ruby_init();
|
||||
rb_eval_string("$KCODE='U'");
|
||||
#ifdef __WIN32__
|
||||
if (!conf.editor.debug) {
|
||||
if (!conf.winConsole) {
|
||||
VALUE iostr = rb_str_new2("NUL");
|
||||
// Sysinit isn't a thing yet, so send io to /dev/null instead
|
||||
rb_funcall(rb_gv_get("$stderr"), rb_intern("reopen"), 1, iostr);
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
</CommandLineArguments>
|
||||
<EnvironmentVariables>
|
||||
<EnvironmentVariable
|
||||
key = "MKXPZ_SELECT_PATH"
|
||||
key = "MKXPZ_FOLDER_SELECT"
|
||||
value = "1"
|
||||
isEnabled = "YES">
|
||||
</EnvironmentVariable>
|
||||
|
@ -85,7 +85,7 @@
|
|||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
buildConfiguration = "Debug"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
</CommandLineArguments>
|
||||
<EnvironmentVariables>
|
||||
<EnvironmentVariable
|
||||
key = "MKXPZ_SELECT_PATH"
|
||||
key = "MKXPZ_FOLDER_SELECT"
|
||||
value = "1"
|
||||
isEnabled = "YES">
|
||||
</EnvironmentVariable>
|
||||
|
@ -85,7 +85,7 @@
|
|||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
buildConfiguration = "Debug"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
</BuildableProductRunnable>
|
||||
<EnvironmentVariables>
|
||||
<EnvironmentVariable
|
||||
key = "MKXPZ_SELECT_PATH"
|
||||
key = "MKXPZ_FOLDER_SELECT"
|
||||
value = "1"
|
||||
isEnabled = "YES">
|
||||
</EnvironmentVariable>
|
||||
|
@ -79,7 +79,7 @@
|
|||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
buildConfiguration = "Debug"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
</CommandLineArguments>
|
||||
<EnvironmentVariables>
|
||||
<EnvironmentVariable
|
||||
key = "MKXPZ_SELECT_PATH"
|
||||
key = "MKXPZ_FOLDER_SELECT"
|
||||
value = "1"
|
||||
isEnabled = "YES">
|
||||
</EnvironmentVariable>
|
||||
|
|
|
@ -44,9 +44,10 @@ MKXPZTouchBar *_sharedTouchBar;
|
|||
-(instancetype)init {
|
||||
self = [super init];
|
||||
self.delegate = self;
|
||||
self.defaultItemIdentifiers = @[@"rebind", @"icon", @"fps", NSTouchBarItemIdentifierFlexibleSpace, @"function", NSTouchBarItemIdentifierFlexibleSpace, @"reset"];
|
||||
self.defaultItemIdentifiers = @[@"function", NSTouchBarItemIdentifierFlexibleSpace, @"icon", @"fps", NSTouchBarItemIdentifierFlexibleSpace, @"rebind", @"reset"];
|
||||
|
||||
fpsLabel = [NSTextField labelWithString:@"Loading..."];
|
||||
fpsLabel.alignment = NSTextAlignmentCenter;
|
||||
fpsLabel.font = [NSFont labelFontOfSize:NSFont.smallSystemFontSize];
|
||||
|
||||
functionKeys = [NSSegmentedControl segmentedControlWithLabels:@[@"F5", @"F6", @"F7", @"F8", @"F9"] trackingMode:NSSegmentSwitchTrackingMomentary target:self action:@selector(simFunctionKey)];
|
||||
|
@ -76,7 +77,7 @@ MKXPZTouchBar *_sharedTouchBar;
|
|||
}
|
||||
else if ([identifier isEqualToString:@"icon"]) {
|
||||
NSImage *appIcon = [NSWorkspace.sharedWorkspace iconForFile:NSBundle.mainBundle.bundlePath];
|
||||
appIcon.size = NSSizeFromCGSize(CGSizeMake(30,30));
|
||||
appIcon.size = CGSizeMake(30,30);
|
||||
ret.view = [NSImageView imageViewWithImage:appIcon];
|
||||
|
||||
}
|
||||
|
|
11
mkxp.json
11
mkxp.json
|
@ -9,6 +9,17 @@
|
|||
// -DWORKDIR_CURRENT). All other paths are resolved
|
||||
// relative to gameFolder and ignoring both RTPs and
|
||||
// encrypted archives.
|
||||
|
||||
// Some influential environment variables, set them to either "1" or "0":
|
||||
// "MKXPZ_WINDOWS_CONSOLE"
|
||||
// - Enables/disables the extra console window on Windows. It appears by
|
||||
// default whenever mkxp-z is started in debug mode.
|
||||
// "MKXPZ_MACOS_METAL"
|
||||
// - Setting this to 0 will force the usage of OpenGL over Metal.
|
||||
// Probably not a good idea unless you have some kind of issue.
|
||||
// "MKXPZ_FOLDER_SELECT"
|
||||
// - Allows the manual selection of the game's folder at startup.
|
||||
// Only works on macOS at the moment.
|
||||
|
||||
|
||||
// Specify the RGSS version to run under.
|
||||
|
|
|
@ -83,6 +83,19 @@ bool copyObject(json::value &dest, json::value &src, const char *objectName = ""
|
|||
return true;
|
||||
}
|
||||
|
||||
bool getEnvironmentBool(const char *env, bool defaultValue) {
|
||||
const char *e = SDL_getenv(env);
|
||||
if (!e)
|
||||
return defaultValue;
|
||||
|
||||
if (!strcmp(e, "0"))
|
||||
return false;
|
||||
else if (!strcmp(e, "1"))
|
||||
return true;
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
#define CONF_FILE "mkxp.json"
|
||||
|
||||
Config::Config() {}
|
||||
|
@ -254,14 +267,18 @@ try { exp } catch (...) {}
|
|||
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);
|
||||
winConsole = getEnvironmentBool("MKXPZ_WINDOWS_CONSOLE", editor.debug);
|
||||
|
||||
#ifdef MKXPZ_BUILD_XCODE
|
||||
#ifdef __APPLE__
|
||||
// Determine whether to use the Metal renderer on macOS
|
||||
const char *metalEnv = SDL_getenv("MKXPZ_MACOS_METAL");
|
||||
preferMetalRenderer = (!metalEnv || strcmp(metalEnv, "0")) && isMetalSupported();
|
||||
preferMetalRenderer = isMetalSupported() && getEnvironmentBool("MKXPZ_MACOS_METAL", true);
|
||||
#endif
|
||||
|
||||
// Determine whether to allow manual selection of a game folder on startup
|
||||
// Only works on macOS atm, mainly used to test games located outside of the bundle.
|
||||
// The config is re-read after the window is already created, so some entries
|
||||
// may not take effect
|
||||
manualFolderSelect = getEnvironmentBool("MKXPZ_FOLDER_SELECT", false);
|
||||
}
|
||||
|
||||
static void setupScreenSize(Config &conf) {
|
||||
|
|
|
@ -60,6 +60,8 @@ struct Config {
|
|||
int maxTextureSize;
|
||||
|
||||
std::string gameFolder;
|
||||
bool manualFolderSelect;
|
||||
|
||||
bool anyAltToggleFS;
|
||||
bool enableReset;
|
||||
bool allowSymlinks;
|
||||
|
|
|
@ -229,13 +229,12 @@ struct Movie
|
|||
|
||||
const float *src = item->audio->samples + (item->offset * channels);
|
||||
unsigned int cpy = (item->audio->frames - item->offset) * channels;
|
||||
int i;
|
||||
|
||||
if (cpy > (len / sizeof (Sint16))) {
|
||||
cpy = len / sizeof (Sint16);
|
||||
}
|
||||
|
||||
for (i = 0; i < cpy; i++) {
|
||||
for (unsigned int i = 0; i < cpy; i++) {
|
||||
const float val = (*(src++)) * volume;
|
||||
if (val < -1.0f) {
|
||||
*(dst++) = -32768;
|
||||
|
|
21
src/main.cpp
21
src/main.cpp
|
@ -88,18 +88,27 @@ static inline const char *glGetStringInt(GLenum name) {
|
|||
|
||||
static void printGLInfo() {
|
||||
const std::string renderer(glGetStringInt(GL_RENDERER));
|
||||
const std::string version(glGetStringInt(GL_VERSION));
|
||||
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();
|
||||
|
||||
Debug() << "Backend :" << "Metal";
|
||||
Debug() << "Metal Device :" << matches[2] << "(" + matches[1].str() + ")";
|
||||
Debug() << "Renderer Version :" << matches[3].str();
|
||||
|
||||
std::smatch vmatches;
|
||||
if (std::regex_search(version, vmatches, std::regex("\\(ANGLE (.+) git hash: .+\\)"))) {
|
||||
Debug() << "ANGLE Version :" << vmatches[1].str();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Debug() << "Backend :" << "OpenGL";
|
||||
Debug() << "GL Vendor :" << glGetStringInt(GL_VENDOR);
|
||||
Debug() << "GL Renderer :" << renderer;
|
||||
Debug() << "GL Version :" << glGetStringInt(GL_VERSION);
|
||||
Debug() << "GL Version :" << version;
|
||||
Debug() << "GLSL Version :" << glGetStringInt(GL_SHADING_LANGUAGE_VERSION);
|
||||
}
|
||||
|
||||
|
@ -354,14 +363,14 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
#if defined(MKXPZ_BUILD_XCODE)
|
||||
#define DEBUG_FSELECT_MSG "Select the folder to load game files from. This is the folder containing the INI and/or configuration JSON."
|
||||
#define DEBUG_FSELECT_MSG "Select the folder from which to load game files. This is the folder containing the game's INI."
|
||||
#define DEBUG_FSELECT_PROMPT "Load Game"
|
||||
if (SDL_getenv("MKXPZ_SELECT_PATH")) {
|
||||
if (conf.manualFolderSelect) {
|
||||
std::string dataDirStr = mkxp_fs::selectPath(win, DEBUG_FSELECT_MSG, DEBUG_FSELECT_PROMPT);
|
||||
if (!dataDirStr.empty()) {
|
||||
conf.gameFolder = dataDirStr;
|
||||
mkxp_fs::setCurrentDirectory(dataDirStr.c_str());
|
||||
Debug() << "DEBUG: Current directory set to" << dataDirStr;
|
||||
Debug() << "Current directory set to" << dataDirStr;
|
||||
conf.read(argc, argv);
|
||||
conf.readGameINI();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue