Remove 'console' build option

This commit is contained in:
Struma 2021-03-15 23:13:25 -04:00 committed by Roza
parent 524dff4346
commit 02cc1a0630
3 changed files with 16 additions and 28 deletions

View file

@ -59,12 +59,6 @@ extern "C" {
#include <SDL_filesystem.h> #include <SDL_filesystem.h>
#include <SDL_power.h> #include <SDL_power.h>
#ifdef __WIN32__
#define NULL_IO "NUL"
#else
#define NULL_IO "/dev/null"
#endif
#define MACRO_STRINGIFY(x) #x #define MACRO_STRINGIFY(x) #x
extern const char module_rpg1[]; extern const char module_rpg1[];
@ -226,8 +220,10 @@ static void mriBindingInit() {
rb_gv_set("BTEST", rb_bool_new(shState->config().editor.battleTest)); rb_gv_set("BTEST", rb_bool_new(shState->config().editor.battleTest));
// Set $stdout and its ilk accordingly on Windows // Set $stdout and its ilk accordingly on Windows
#ifdef __WIN32__
if (shState->config().editor.debug) if (shState->config().editor.debug)
configureWindowsStreams(); configureWindowsStreams();
#endif
// Load zlib, if it's present. Requires --with-static-linked-ext or zlib.so. // Load zlib, if it's present. Requires --with-static-linked-ext or zlib.so.
// It's okay if it fails, normally it wouldn't be defined anyway. // It's okay if it fails, normally it wouldn't be defined anyway.
@ -684,18 +680,7 @@ static void runRMXPScripts(BacktraceData &btData) {
if (exc != Qnil) if (exc != Qnil)
return; return;
#ifdef MKXPZ_ESSENTIALS_DEBUG
// Used to try and fix Essentials garbage later if it's detected
int minimonsters = 0;
#endif
while (true) { while (true) {
#if RAPI_FULL < 200 && defined(MKXPZ_DISABLE_CONSOLE)
VALUE iostr = rb_str_new2(NULL_IO);
// Sysinit isn't a thing yet, so send io to /dev/null instead
rb_funcall(rb_gv_get("$stderr"), rb_intern("reopen"), 1, iostr);
rb_funcall(rb_gv_get("$stdout"), rb_intern("reopen"), 1, iostr);
#endif
for (long i = 0; i < scriptCount; ++i) { for (long i = 0; i < scriptCount; ++i) {
VALUE script = rb_ary_entry(scriptArray, i); VALUE script = rb_ary_entry(scriptArray, i);
VALUE scriptDecoded = rb_ary_entry(script, 3); VALUE scriptDecoded = rb_ary_entry(script, 3);
@ -758,8 +743,8 @@ static void runRMXPScripts(BacktraceData &btData) {
// Attempts to set $stdout and $stdin accordingly on Windows. Only // Attempts to set $stdout and $stdin accordingly on Windows. Only
// called when debug mode is on, since that's when the console // called when debug mode is on, since that's when the console
// should be active. // should be active.
#ifdef __WIN32__
static void configureWindowsStreams() { static void configureWindowsStreams() {
#ifdef __WINDOWS__
#define HANDLE_VALID(handle) handle && handle != INVALID_HANDLE_VALUE #define HANDLE_VALID(handle) handle && handle != INVALID_HANDLE_VALUE
const HANDLE outputHandle = GetStdHandle(STD_OUTPUT_HANDLE); const HANDLE outputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
@ -787,8 +772,8 @@ static void configureWindowsStreams() {
} }
#undef HANDLE_VALID #undef HANDLE_VALID
#endif // #ifdef __WINDOWS__
} }
#endif // #ifdef __WINDOWS__
static void showExc(VALUE exc, const BacktraceData &btData) { static void showExc(VALUE exc, const BacktraceData &btData) {
VALUE bt = rb_funcall2(exc, rb_intern("backtrace"), 0, NULL); VALUE bt = rb_funcall2(exc, rb_intern("backtrace"), 0, NULL);
@ -919,6 +904,14 @@ static void mriBindingExecute() {
#else #else
ruby_init(); ruby_init();
rb_eval_string("$KCODE='U'"); rb_eval_string("$KCODE='U'");
#ifdef __WIN32__
if (!conf.editor.debug) {
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);
rb_funcall(rb_gv_get("$stdout"), rb_intern("reopen"), 1, iostr);
}
#endif
#endif #endif
#if defined(MKXPZ_ESSENTIALS_DEBUG) && !defined(__WIN32__) #if defined(MKXPZ_ESSENTIALS_DEBUG) && !defined(__WIN32__)

View file

@ -107,10 +107,6 @@ if get_option('cxx11_experimental') == true
global_args += '-DMKXPZ_EXP_FS' global_args += '-DMKXPZ_EXP_FS'
endif endif
if not get_option('console')
global_args += '-DMKXPZ_DISABLE_CONSOLE'
endif
if get_option('force32') == true if get_option('force32') == true
global_args += '-m32' global_args += '-m32'
endif endif
@ -159,7 +155,7 @@ if steamworks == true
shim_args += '-DSTEAM_APPID=' + get_option('steam_appid') shim_args += '-DSTEAM_APPID=' + get_option('steam_appid')
endif endif
if get_option('console') == true if get_option('steamshim_debug') == true
shim_args += '-DSTEAMSHIM_DEBUG' shim_args += '-DSTEAMSHIM_DEBUG'
endif endif
@ -169,7 +165,7 @@ if steamworks == true
include_directories: (steamworks_path + '/public'), include_directories: (steamworks_path + '/public'),
cpp_args: shim_args, cpp_args: shim_args,
link_args: la.split(), link_args: la.split(),
gui_app: (get_option('console') == false), gui_app: (get_option('steamshim_debug') == false),
install: (host_system != 'windows')) install: (host_system != 'windows'))
endif endif
@ -186,6 +182,6 @@ executable(exe_name,
cpp_args: global_args, cpp_args: global_args,
objc_args: global_args, objc_args: global_args,
objcpp_args: global_args, objcpp_args: global_args,
gui_app: (get_option('console') == false), gui_app: true,
install: (host_system != 'windows') install: (host_system != 'windows')
) )

View file

@ -2,8 +2,6 @@ option('mri_version', type: 'string', value: '3.0', description: 'Version of MRI
option('mri_includes', type: 'string', value: '', description: 'Ruby manual include path') option('mri_includes', type: 'string', value: '', description: 'Ruby manual include path')
option('mri_libpath', type: 'string', value: '', description: 'Ruby manual lib path') option('mri_libpath', type: 'string', value: '', description: 'Ruby manual lib path')
option('mri_library', type: 'string', value: '', description: 'Ruby manual link name') option('mri_library', type: 'string', value: '', description: 'Ruby manual link name')
option('console', type: 'boolean', value: false, description: 'Whether to debug information in the console')
option('macos_min_version', type: 'string', value: '', description: 'Minimum macOS system version to support (does not affect dependencies)') option('macos_min_version', type: 'string', value: '', description: 'Minimum macOS system version to support (does not affect dependencies)')
option('force32', type: 'boolean', value: false, description: 'Force compiler to build a 32-bit executable') option('force32', type: 'boolean', value: false, description: 'Force compiler to build a 32-bit executable')
@ -22,5 +20,6 @@ option('appimagekit_path', type: 'string', value: '', description: 'Path to AppI
option('appimage', type: 'boolean', value: false, description: 'Whether to install to an AppImage or just copy everything') option('appimage', type: 'boolean', value: false, description: 'Whether to install to an AppImage or just copy everything')
option('steamworks_path', type: 'string', value: '', description: 'Path to Steamshim') option('steamworks_path', type: 'string', value: '', description: 'Path to Steamshim')
option('steam_appid', type: 'string', value: '', description: 'Steam AppID. Set this to use SteamAPI_RestartAppIfNecessary') option('steam_appid', type: 'string', value: '', description: 'Steam AppID. Set this to use SteamAPI_RestartAppIfNecessary')
option('steamshim_debug', type: 'boolean', value: false, description: 'Whether to show Steamshim debug messages in the console')
option('gfx_backend', type: 'combo', value: 'gl', choices: ['gl', 'gles'], description: 'Graphics rendering API to use.') option('gfx_backend', type: 'combo', value: 'gl', choices: ['gl', 'gles'], description: 'Graphics rendering API to use.')