Start working on ScreenResizer

This commit is contained in:
Inori 2019-08-03 12:33:35 -04:00 committed by Inori
parent 88cdb903fa
commit fd248709e3
2 changed files with 283 additions and 279 deletions

View file

@ -1,23 +1,23 @@
/* /*
** graphics-binding.cpp ** graphics-binding.cpp
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or ** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** mkxp is distributed in the hope that it will be useful, ** mkxp is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
** **
** You should have received a copy of the GNU General Public License ** You should have received a copy of the GNU General Public License
** along with mkxp. If not, see <http://www.gnu.org/licenses/>. ** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "graphics.h" #include "graphics.h"
#include "sharedstate.h" #include "sharedstate.h"
@ -27,172 +27,172 @@
RB_METHOD(graphicsUpdate) RB_METHOD(graphicsUpdate)
{ {
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
shState->graphics().update(); shState->graphics().update();
return Qnil; return Qnil;
} }
RB_METHOD(graphicsFreeze) RB_METHOD(graphicsFreeze)
{ {
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
shState->graphics().freeze(); shState->graphics().freeze();
return Qnil; return Qnil;
} }
RB_METHOD(graphicsTransition) RB_METHOD(graphicsTransition)
{ {
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
int duration = 8; int duration = 8;
const char *filename = ""; const char *filename = "";
int vague = 40; int vague = 40;
rb_get_args(argc, argv, "|izi", &duration, &filename, &vague RB_ARG_END); rb_get_args(argc, argv, "|izi", &duration, &filename, &vague RB_ARG_END);
GUARD_EXC( shState->graphics().transition(duration, filename, vague); ) GUARD_EXC( shState->graphics().transition(duration, filename, vague); )
return Qnil; return Qnil;
} }
RB_METHOD(graphicsFrameReset) RB_METHOD(graphicsFrameReset)
{ {
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
shState->graphics().frameReset(); shState->graphics().frameReset();
return Qnil; return Qnil;
} }
#define DEF_GRA_PROP_I(PropName) \ #define DEF_GRA_PROP_I(PropName) \
RB_METHOD(graphics##Get##PropName) \ RB_METHOD(graphics##Get##PropName) \
{ \ { \
RB_UNUSED_PARAM; \ RB_UNUSED_PARAM; \
return rb_fix_new(shState->graphics().get##PropName()); \ return rb_fix_new(shState->graphics().get##PropName()); \
} \ } \
RB_METHOD(graphics##Set##PropName) \ RB_METHOD(graphics##Set##PropName) \
{ \ { \
RB_UNUSED_PARAM; \ RB_UNUSED_PARAM; \
int value; \ int value; \
rb_get_args(argc, argv, "i", &value RB_ARG_END); \ rb_get_args(argc, argv, "i", &value RB_ARG_END); \
shState->graphics().set##PropName(value); \ shState->graphics().set##PropName(value); \
return rb_fix_new(value); \ return rb_fix_new(value); \
} }
#define DEF_GRA_PROP_B(PropName) \ #define DEF_GRA_PROP_B(PropName) \
RB_METHOD(graphics##Get##PropName) \ RB_METHOD(graphics##Get##PropName) \
{ \ { \
RB_UNUSED_PARAM; \ RB_UNUSED_PARAM; \
return rb_bool_new(shState->graphics().get##PropName()); \ return rb_bool_new(shState->graphics().get##PropName()); \
} \ } \
RB_METHOD(graphics##Set##PropName) \ RB_METHOD(graphics##Set##PropName) \
{ \ { \
RB_UNUSED_PARAM; \ RB_UNUSED_PARAM; \
bool value; \ bool value; \
rb_get_args(argc, argv, "b", &value RB_ARG_END); \ rb_get_args(argc, argv, "b", &value RB_ARG_END); \
shState->graphics().set##PropName(value); \ shState->graphics().set##PropName(value); \
return rb_bool_new(value); \ return rb_bool_new(value); \
} }
RB_METHOD(graphicsWidth) RB_METHOD(graphicsWidth)
{ {
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
return rb_fix_new(shState->graphics().width()); return rb_fix_new(shState->graphics().width());
} }
RB_METHOD(graphicsHeight) RB_METHOD(graphicsHeight)
{ {
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
return rb_fix_new(shState->graphics().height()); return rb_fix_new(shState->graphics().height());
} }
RB_METHOD(graphicsWait) RB_METHOD(graphicsWait)
{ {
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
int duration; int duration;
rb_get_args(argc, argv, "i", &duration RB_ARG_END); rb_get_args(argc, argv, "i", &duration RB_ARG_END);
shState->graphics().wait(duration); shState->graphics().wait(duration);
return Qnil; return Qnil;
} }
RB_METHOD(graphicsFadeout) RB_METHOD(graphicsFadeout)
{ {
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
int duration; int duration;
rb_get_args(argc, argv, "i", &duration RB_ARG_END); rb_get_args(argc, argv, "i", &duration RB_ARG_END);
shState->graphics().fadeout(duration); shState->graphics().fadeout(duration);
return Qnil; return Qnil;
} }
RB_METHOD(graphicsFadein) RB_METHOD(graphicsFadein)
{ {
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
int duration; int duration;
rb_get_args(argc, argv, "i", &duration RB_ARG_END); rb_get_args(argc, argv, "i", &duration RB_ARG_END);
shState->graphics().fadein(duration); shState->graphics().fadein(duration);
return Qnil; return Qnil;
} }
void bitmapInitProps(Bitmap *b, VALUE self); void bitmapInitProps(Bitmap *b, VALUE self);
RB_METHOD(graphicsSnapToBitmap) RB_METHOD(graphicsSnapToBitmap)
{ {
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
Bitmap *result = 0; Bitmap *result = 0;
GUARD_EXC( result = shState->graphics().snapToBitmap(); ); GUARD_EXC( result = shState->graphics().snapToBitmap(); );
VALUE obj = wrapObject(result, BitmapType); VALUE obj = wrapObject(result, BitmapType);
bitmapInitProps(result, obj); bitmapInitProps(result, obj);
return obj; return obj;
} }
RB_METHOD(graphicsResizeScreen) RB_METHOD(graphicsResizeScreen)
{ {
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
int width, height; int width, height;
rb_get_args(argc, argv, "ii", &width, &height RB_ARG_END); rb_get_args(argc, argv, "ii", &width, &height RB_ARG_END);
shState->graphics().resizeScreen(width, height); shState->graphics().resizeScreen(width, height);
return Qnil; return Qnil;
} }
RB_METHOD(graphicsReset) RB_METHOD(graphicsReset)
{ {
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
shState->graphics().reset(); shState->graphics().reset();
return Qnil; return Qnil;
} }
RB_METHOD(graphicsPlayMovie) RB_METHOD(graphicsPlayMovie)
{ {
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
const char *filename; const char *filename;
rb_get_args(argc, argv, "z", &filename RB_ARG_END); rb_get_args(argc, argv, "z", &filename RB_ARG_END);
shState->graphics().playMovie(filename); shState->graphics().playMovie(filename);
return Qnil; return Qnil;
} }
DEF_GRA_PROP_I(FrameRate) DEF_GRA_PROP_I(FrameRate)
@ -204,42 +204,45 @@ DEF_GRA_PROP_B(ShowCursor)
#define INIT_GRA_PROP_BIND(PropName, prop_name_s) \ #define INIT_GRA_PROP_BIND(PropName, prop_name_s) \
{ \ { \
_rb_define_module_function(module, prop_name_s, graphics##Get##PropName); \ _rb_define_module_function(module, prop_name_s, graphics##Get##PropName); \
_rb_define_module_function(module, prop_name_s "=", graphics##Set##PropName); \ _rb_define_module_function(module, prop_name_s "=", graphics##Set##PropName); \
} }
void graphicsBindingInit() void graphicsBindingInit()
{ {
VALUE module = rb_define_module("Graphics"); VALUE module = rb_define_module("Graphics");
_rb_define_module_function(module, "update", graphicsUpdate); _rb_define_module_function(module, "update", graphicsUpdate);
_rb_define_module_function(module, "freeze", graphicsFreeze); _rb_define_module_function(module, "freeze", graphicsFreeze);
_rb_define_module_function(module, "transition", graphicsTransition); _rb_define_module_function(module, "transition", graphicsTransition);
_rb_define_module_function(module, "frame_reset", graphicsFrameReset); _rb_define_module_function(module, "frame_reset", graphicsFrameReset);
_rb_define_module_function(module, "__reset__", graphicsReset); _rb_define_module_function(module, "__reset__", graphicsReset);
INIT_GRA_PROP_BIND( FrameRate, "frame_rate" ); INIT_GRA_PROP_BIND( FrameRate, "frame_rate" );
INIT_GRA_PROP_BIND( FrameCount, "frame_count" ); INIT_GRA_PROP_BIND( FrameCount, "frame_count" );
#ifndef USE_ESSENTIALS_FIXES
if (rgssVer >= 2) if (rgssVer >= 2)
{ {
_rb_define_module_function(module, "width", graphicsWidth); #endif
_rb_define_module_function(module, "height", graphicsHeight); _rb_define_module_function(module, "width", graphicsWidth);
_rb_define_module_function(module, "wait", graphicsWait); _rb_define_module_function(module, "height", graphicsHeight);
_rb_define_module_function(module, "fadeout", graphicsFadeout); _rb_define_module_function(module, "wait", graphicsWait);
_rb_define_module_function(module, "fadein", graphicsFadein); _rb_define_module_function(module, "fadeout", graphicsFadeout);
_rb_define_module_function(module, "snap_to_bitmap", graphicsSnapToBitmap); _rb_define_module_function(module, "fadein", graphicsFadein);
_rb_define_module_function(module, "resize_screen", graphicsResizeScreen); _rb_define_module_function(module, "snap_to_bitmap", graphicsSnapToBitmap);
_rb_define_module_function(module, "resize_screen", graphicsResizeScreen);
INIT_GRA_PROP_BIND( Brightness, "brightness" );
} INIT_GRA_PROP_BIND( Brightness, "brightness" );
#ifndef USE_ESSENTIALS_FIXES
if (rgssVer >= 3) }
{ #endif
_rb_define_module_function(module, "play_movie", graphicsPlayMovie);
} if (rgssVer >= 3)
{
INIT_GRA_PROP_BIND( Fullscreen, "fullscreen" ); _rb_define_module_function(module, "play_movie", graphicsPlayMovie);
INIT_GRA_PROP_BIND( ShowCursor, "show_cursor" ); }
INIT_GRA_PROP_BIND( Fullscreen, "fullscreen" );
INIT_GRA_PROP_BIND( ShowCursor, "show_cursor" );
} }

View file

@ -4,7 +4,6 @@
#include <ruby.h> #include <ruby.h>
#include <SDL.h> #include <SDL.h>
#if defined(__WIN32__) && defined(USE_ESSENTIALS_FIXES) #if defined(__WIN32__) && defined(USE_ESSENTIALS_FIXES)
#include <SDL_syswm.h>
#include "sharedstate.h" #include "sharedstate.h"
#endif #endif
@ -30,82 +29,82 @@ MiniFFI_initialize(VALUE self, VALUE libname, VALUE func, VALUE imports, VALUE e
{ {
SafeStringValue(libname); SafeStringValue(libname);
SafeStringValue(func); SafeStringValue(func);
void *hlib = SDL_LoadObject(RSTRING_PTR(libname)); void *hlib = SDL_LoadObject(RSTRING_PTR(libname));
if (!hlib) if (!hlib)
rb_raise(rb_eRuntimeError, "Failed to load library %s: %s", RSTRING_PTR(libname), SDL_GetError()); rb_raise(rb_eRuntimeError, "Failed to load library %s: %s", RSTRING_PTR(libname), SDL_GetError());
DATA_PTR(self) = hlib; DATA_PTR(self) = hlib;
void *hfunc = SDL_LoadFunction(hlib, RSTRING_PTR(func)); void *hfunc = SDL_LoadFunction(hlib, RSTRING_PTR(func));
#ifdef __WIN32__ #ifdef __WIN32__
if (!hfunc) if (!hfunc)
{ {
VALUE func_a = rb_str_new3(func); VALUE func_a = rb_str_new3(func);
func_a = rb_str_cat(func_a, "A", 1); func_a = rb_str_cat(func_a, "A", 1);
hfunc = SDL_LoadFunction(hlib, RSTRING_PTR(func_a)); hfunc = SDL_LoadFunction(hlib, RSTRING_PTR(func_a));
} }
#endif #endif
if (!hfunc) if (!hfunc)
rb_raise(rb_eRuntimeError, "Failed to find function %s(A) within %s: %s", RSTRING_PTR(func), RSTRING_PTR(libname), SDL_GetError()); rb_raise(rb_eRuntimeError, "Failed to find function %s(A) within %s: %s", RSTRING_PTR(func), RSTRING_PTR(libname), SDL_GetError());
rb_iv_set(self, "_func", OFFT2NUM((unsigned long)hfunc)); rb_iv_set(self, "_func", OFFT2NUM((unsigned long)hfunc));
rb_iv_set(self, "_funcname", func); rb_iv_set(self, "_funcname", func);
rb_iv_set(self, "_libname", libname); rb_iv_set(self, "_libname", libname);
VALUE ary_imports = rb_ary_new(); VALUE ary_imports = rb_ary_new();
VALUE *entry = RARRAY_PTR(imports); VALUE *entry = RARRAY_PTR(imports);
switch (TYPE(imports)) switch (TYPE(imports))
{ {
case T_NIL: case T_NIL:
break; break;
case T_ARRAY: case T_ARRAY:
for (int i = 0; i < RARRAY_LEN(imports); i++) for (int i = 0; i < RARRAY_LEN(imports); i++)
{ {
SafeStringValue(entry[i]); SafeStringValue(entry[i]);
switch (*(char*)RSTRING_PTR(entry[i])) switch (*(char*)RSTRING_PTR(entry[i]))
{ {
case 'N': case 'n': case 'L': case 'l': case 'N': case 'n': case 'L': case 'l':
rb_ary_push(ary_imports, INT2FIX(_T_NUMBER)); rb_ary_push(ary_imports, INT2FIX(_T_NUMBER));
break; break;
case 'P': case 'p': case 'P': case 'p':
rb_ary_push(ary_imports, INT2FIX(_T_POINTER)); rb_ary_push(ary_imports, INT2FIX(_T_POINTER));
break; break;
case 'I': case 'i': case 'I': case 'i':
rb_ary_push(ary_imports, INT2FIX(_T_INTEGER)); rb_ary_push(ary_imports, INT2FIX(_T_INTEGER));
break; break;
} }
} }
break; break;
default: default:
SafeStringValue(imports); SafeStringValue(imports);
const char *s = RSTRING_PTR(imports); const char *s = RSTRING_PTR(imports);
for (int i = 0; i < RSTRING_LEN(imports); i++) for (int i = 0; i < RSTRING_LEN(imports); i++)
{ {
switch (*s++) switch (*s++)
{ {
case 'N': case 'n': case 'L': case 'l': case 'N': case 'n': case 'L': case 'l':
rb_ary_push(ary_imports, INT2FIX(_T_NUMBER)); rb_ary_push(ary_imports, INT2FIX(_T_NUMBER));
break; break;
case 'P': case 'p': case 'P': case 'p':
rb_ary_push(ary_imports, INT2FIX(_T_POINTER)); rb_ary_push(ary_imports, INT2FIX(_T_POINTER));
break; break;
case 'I': case 'i': case 'I': case 'i':
rb_ary_push(ary_imports, INT2FIX(_T_INTEGER)); rb_ary_push(ary_imports, INT2FIX(_T_INTEGER));
break; break;
} }
} }
break; break;
} }
if (16 < RARRAY_LEN(ary_imports)) if (16 < RARRAY_LEN(ary_imports))
rb_raise(rb_eRuntimeError, "too many parameters: %ld\n", RARRAY_LEN(ary_imports)); rb_raise(rb_eRuntimeError, "too many parameters: %ld\n", RARRAY_LEN(ary_imports));
rb_iv_set(self, "_imports", ary_imports); rb_iv_set(self, "_imports", ary_imports);
int ex; int ex;
if (NIL_P(exports)) if (NIL_P(exports))
@ -117,21 +116,21 @@ MiniFFI_initialize(VALUE self, VALUE libname, VALUE func, VALUE imports, VALUE e
SafeStringValue(exports); SafeStringValue(exports);
switch(*RSTRING_PTR(exports)) switch(*RSTRING_PTR(exports))
{ {
case 'V': case 'v': case 'V': case 'v':
ex = _T_VOID; ex = _T_VOID;
break; break;
case 'N': case 'n': case 'L': case 'l': case 'N': case 'n': case 'L': case 'l':
ex = _T_NUMBER; ex = _T_NUMBER;
break; break;
case 'P': case 'p': case 'P': case 'p':
ex = _T_POINTER; ex = _T_POINTER;
break; break;
case 'I': case 'i': case 'I': case 'i':
ex = _T_INTEGER; ex = _T_INTEGER;
break; break;
} }
} }
rb_iv_set(self, "_exports", INT2FIX(ex)); rb_iv_set(self, "_exports", INT2FIX(ex));
@ -153,78 +152,74 @@ MiniFFI_call(int argc, VALUE *argv, VALUE self)
int items = rb_scan_args(argc, argv, "0*", &args); int items = rb_scan_args(argc, argv, "0*", &args);
int nimport = RARRAY_LEN(own_imports); int nimport = RARRAY_LEN(own_imports);
if (items != nimport) if (items != nimport)
rb_raise(rb_eRuntimeError, "wrong number of parameters: expected %d, got %d", rb_raise(rb_eRuntimeError, "wrong number of parameters: expected %d, got %d",
nimport, items); nimport, items);
for (int i = 0; i < nimport; i++) for (int i = 0; i < nimport; i++)
{ {
VALUE str = rb_ary_entry(args, i); VALUE str = rb_ary_entry(args, i);
unsigned long lParam = 0; unsigned long lParam = 0;
switch(FIX2INT(rb_ary_entry(own_imports, i))) switch(FIX2INT(rb_ary_entry(own_imports, i)))
{ {
case _T_POINTER: case _T_POINTER:
if (NIL_P(str)) if (NIL_P(str))
{ {
lParam = 0; lParam = 0;
} }
else if (FIXNUM_P(str)) else if (FIXNUM_P(str))
{ {
lParam = NUM2OFFT(str); lParam = NUM2OFFT(str);
} }
else else
{ {
StringValue(str); StringValue(str);
rb_str_modify(str); rb_str_modify(str);
lParam = (unsigned long)RSTRING_PTR(str); lParam = (unsigned long)RSTRING_PTR(str);
} }
break; break;
case _T_NUMBER: case _T_INTEGER: default: case _T_NUMBER: case _T_INTEGER: default:
lParam = NUM2OFFT(rb_ary_entry(args, i)); lParam = NUM2OFFT(rb_ary_entry(args, i));
break; break;
} }
params[i] = lParam; params[i] = lParam;
} }
unsigned long ret; unsigned long ret;
#if defined(__WIN32__) && defined(USE_ESSENTIALS_FIXES) #if defined(__WIN32__) && defined(USE_ESSENTIALS_FIXES)
// On Windows, if essentials fixes are enabled, function calls that // On Windows, if essentials fixes are enabled, function calls that
// do not work with MKXP will be intercepted here so that the code // do not work with MKXP will be intercepted here so that the code
// still has its desired effect // still has its desired effect
// GetCurrentThreadId, GetWindowThreadProcessId, FindWindowEx, // GetCurrentThreadId, GetWindowThreadProcessId, FindWindowEx,
// and GetForegroundWindow are used for determining whether to // and GetForegroundWindow are used for determining whether to
// handle input and for positioning // handle input and for positioning
// It's a super janky system, but I must abide by it // It's a super janky system, but I must abide by it
SDL_SysWMinfo wm;
char *fname = RSTRING_PTR(rb_iv_get(self, "_funcname")); char *fname = RSTRING_PTR(rb_iv_get(self, "_funcname"));
#define func_is(x) !strcmp(fname, x) #define func_is(x) !strcmp(fname, x)
#define if_func_is(x) if (func_is(x)) #define if_func_is(x) if (func_is(x))
if (func_is("GetCurrentThreadId") || func_is("GetWindowThreadProcessId")) if (func_is("GetCurrentThreadId") || func_is("GetWindowThreadProcessId"))
{ {
ret = 571; // Dummy ret = 571; // Dummy
} }
else if_func_is("FindWindowEx") else if_func_is("FindWindowEx")
{ {
SDL_GetWindowWMInfo(shState->sdlWindow(), &wm); ret = 571;
ret = (unsigned long)wm.info.win.window;
} }
else if_func_is("GetForegroundWindow") else if_func_is("GetForegroundWindow")
{ {
if (SDL_GetWindowFlags(shState->sdlWindow()) & SDL_WINDOW_INPUT_FOCUS) if (SDL_GetWindowFlags(shState->sdlWindow()) & SDL_WINDOW_INPUT_FOCUS)
{ {
SDL_GetWindowWMInfo(shState->sdlWindow(), &wm); ret = 571;
ret = (unsigned long)wm.info.win.window;
} }
else else
ret = 0; ret = 0;
} }
// Mouse support // Mouse support
else if_func_is("GetCursorPos") else if_func_is("GetCursorPos")
{ {
int *output = (int*)params[0]; int *output = (int*)params[0];
@ -234,33 +229,39 @@ MiniFFI_call(int argc, VALUE *argv, VALUE self)
output[1] = y; output[1] = y;
ret = true; ret = true;
} }
else if_func_is("ScreenToClient") else if_func_is("ScreenToClient")
{ {
int *output = (int*)params[1]; int *output = (int*)params[1];
int x, y; int x, y;
SDL_GetMouseState(&x, &y); SDL_GetMouseState(&x, &y);
output[0] = x; output[0] = x;
output[1] = y; output[1] = y;
ret = true; ret = true;
} }
else if_func_is("SetWindowPos")
{
SDL_SetWindowSize(shState->sdlWindow(),params[4],params[5]-24);
SDL_SetWindowPosition(shState->sdlWindow(),params[2],params[3]);
return true;
}
else else
{ {
ret = (unsigned long)ApiFunction(param); ret = (unsigned long)ApiFunction(param);
} }
#else #else
ret = (unsigned long)ApiFunction(param); ret = (unsigned long)ApiFunction(param);
#endif #endif
switch (FIX2INT(own_exports)) switch (FIX2INT(own_exports))
{ {
case _T_NUMBER: case _T_INTEGER: case _T_NUMBER: case _T_INTEGER:
return OFFT2NUM(ret); return OFFT2NUM(ret);
case _T_POINTER: case _T_POINTER:
return rb_str_new2((char*)ret); return rb_str_new2((char*)ret);
case _T_VOID: default: case _T_VOID: default:
return OFFT2NUM(0); return OFFT2NUM(0);
} }
} }
@ -273,7 +274,7 @@ MiniFFIBindingInit()
rb_define_method(cMiniFFI, "initialize", RUBY_METHOD_FUNC(MiniFFI_initialize), 4); rb_define_method(cMiniFFI, "initialize", RUBY_METHOD_FUNC(MiniFFI_initialize), 4);
rb_define_method(cMiniFFI, "call", RUBY_METHOD_FUNC(MiniFFI_call), -1); rb_define_method(cMiniFFI, "call", RUBY_METHOD_FUNC(MiniFFI_call), -1);
rb_define_alias(cMiniFFI, "Call", "call"); rb_define_alias(cMiniFFI, "Call", "call");
#ifdef __WIN32__ #ifdef __WIN32__
rb_define_const(rb_cObject, "Win32API", cMiniFFI); rb_define_const(rb_cObject, "Win32API", cMiniFFI);
#endif #endif