diff --git a/binding/binding-mri.cpp b/binding/binding-mri.cpp index d0a26a25..f92a2709 100644 --- a/binding/binding-mri.cpp +++ b/binding/binding-mri.cpp @@ -62,7 +62,10 @@ extern const char module_rpg2[]; extern const char module_rpg3[]; // Scripts to run at some point during Ruby execution + +#ifdef EASY_POKE #include "EssentialsTilemapHack.rb.xxd" +#endif static void mriBindingExecute(); static void mriBindingTerminate(); @@ -581,8 +584,10 @@ static void runRMXPScripts(BacktraceData &btData) { return; #endif +#ifdef EASY_POKE // Used to try and fix Essentials garbage later if it's detected int minimonsters = 0; +#endif while (true) { #if RAPI_FULL < 200 && defined(NO_CONSOLE) @@ -610,9 +615,11 @@ static void runRMXPScripts(BacktraceData &btData) { fname = newStringUTF8(buf, len); btData.scriptNames.insert(buf, scriptName); +#ifdef EASY_POKE // There is 0 reason for anything other than Essentials to have this class if (minimonsters == 0 && rb_const_defined(rb_cObject, rb_intern("PokemonMapMetadata"))) minimonsters = 1; +#endif // Before checking to see if the next script should be skipped, // make sure to check whether it's the last one or not and run @@ -621,10 +628,12 @@ static void runRMXPScripts(BacktraceData &btData) { #define SCRIPT(name) rb_str_new((const char*)&___scripts_##name##_rb, ___scripts_##name##_rb_len), #name " (Internal)" #define EVALFILE(name) if (!evalScript(SCRIPT(name))) break; if (i + 2 == scriptCount){ +#ifdef EASY_POKE if (minimonsters > 0 && !RTEST(rb_gv_get("Z_NOPOKEFIX"))){ EVALFILE(EssentialsTilemapHack); + minimonsters = -1; } - minimonsters = -1; +#endif } // if the script name starts with |s|, only execute @@ -740,7 +749,7 @@ static void mriBindingExecute() { rb_eval_string("$KCODE='U'"); #endif -#if defined(USE_FAKEAPI) && !defined(__WIN32__) +#if defined(EASY_POKE) && !defined(__WIN32__) char *tmpdir = getenv("TMPDIR"); if (tmpdir) setenv("TEMP", tmpdir, false); diff --git a/binding/miniffi-binding.cpp b/binding/miniffi-binding.cpp index 02900bab..30fa015c 100644 --- a/binding/miniffi-binding.cpp +++ b/binding/miniffi-binding.cpp @@ -46,7 +46,7 @@ DEF_ALLOCFUNC_CUSTOMFREE(MiniFFI, SDL_UnloadObject); #endif static void *MiniFFI_GetFunctionHandle(void *libhandle, const char *func) { -#ifdef USE_FAKEAPI +#ifdef EASY_POKE #define CAPTURE(n) \ if (!strcmp(#n, func)) \ return (void *)&MKXP_##n diff --git a/meson.build b/meson.build index 2bfd651c..405f1266 100644 --- a/meson.build +++ b/meson.build @@ -98,8 +98,8 @@ if get_option('independent_appimage') global_args += '-DINDEPENDENT_APPIMAGE' endif -if get_option('use_fakeapi') == true and miniffi == true - global_args += '-DUSE_FAKEAPI' +if get_option('easypoke') == true and miniffi == true + global_args += '-DEASY_POKE' endif if not get_option('console') diff --git a/meson_options.txt b/meson_options.txt index 2797338a..c5dddbad 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -11,7 +11,7 @@ option('threaded_gl_init', type: 'boolean', value: true, description: 'Init GL o option('shared_fluid', type: 'boolean', value: false, description: 'Dynamically link fluidsynth at build time') option('cjk_fallback_font', type: 'boolean', value: false, description: 'Use WenQuanYi Micro Hei as the fallback font') option('use_miniffi', type: 'boolean', value: true, description: 'Enable MiniFFI Ruby module (Win32API)') -option('use_fakeapi', type: 'boolean', value: false, description: 'Attempt to repair Win32API calls that do not work with MKXP. Requires MiniFFI') +option('easypoke', type: 'boolean', value: false, description: 'Attempt to repair Win32API calls that do not work with MKXP. Requires MiniFFI') option('default_framerate', type: 'boolean', value: false, description: 'Disable syncToRefreshrate and fixedFramerate configuration options') option('no_preload_scripts', type: 'boolean', value: false, description: 'Disable the preloadScript configuration option') option('workdir_current', type: 'boolean', value: false, description: 'Keep current directory on startup') diff --git a/src/fake-api.h b/src/fake-api.h index 5b0d7714..a8ad414e 100644 --- a/src/fake-api.h +++ b/src/fake-api.h @@ -16,7 +16,7 @@ #define PREFABI #endif -#ifdef USE_FAKEAPI +#ifdef EASY_POKE #include #ifdef __WIN32__ diff --git a/src/meson.build b/src/meson.build index 3d94fc72..f7ff907b 100644 --- a/src/meson.build +++ b/src/meson.build @@ -111,7 +111,7 @@ main_source = files( 'lang-fun.mm' ) -if get_option('use_fakeapi') == true and miniffi == true +if get_option('easypoke') == true and miniffi == true main_source += files('fake-api.mm') endif