rename fake_api easypoke

Really the only reason it even exists at this point is
Pokemon Essentials, so I might as well stick all the dumb Essentials
fixes together
This commit is contained in:
Roza 2020-04-23 02:19:24 -04:00
parent 932f5795c5
commit 2775a5a8e2
6 changed files with 17 additions and 8 deletions

View file

@ -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);

View file

@ -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

View file

@ -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')

View file

@ -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')

View file

@ -16,7 +16,7 @@
#define PREFABI
#endif
#ifdef USE_FAKEAPI
#ifdef EASY_POKE
#include <stddef.h>
#ifdef __WIN32__

View file

@ -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