diff --git a/binding/binding-mri.cpp b/binding/binding-mri.cpp index 39d2bb26..af607037 100644 --- a/binding/binding-mri.cpp +++ b/binding/binding-mri.cpp @@ -175,7 +175,7 @@ static void mriBindingInit() else assert(!"unreachable"); - VALUE mod = rb_define_module("MKXP"); + VALUE mod = rb_define_module("System"); _rb_define_module_function(mod, "data_directory", mkxpDataDirectory); _rb_define_module_function(mod, "set_window_title", mkxpSetTitle); _rb_define_module_function(mod, "show_settings", mkxpSettingsMenu); @@ -484,6 +484,7 @@ struct BacktraceData BoostHash scriptNames; }; +#ifndef MARIN #define SCRIPT_SECTION_FMT (rgssVer >= 3 ? "{%04ld}" : "Section%03ld") static void runRMXPScripts(BacktraceData &btData) @@ -656,6 +657,7 @@ static void runRMXPScripts(BacktraceData &btData) processReset(); } } +#endif static void showExc(VALUE exc, const BacktraceData &btData) { @@ -740,11 +742,10 @@ static void mriBindingExecute() Config &conf = shState->rtData().config; + VALUE lpaths = rb_gv_get(":"); if (!conf.rubyLoadpaths.empty()) { /* Setup custom load paths */ - VALUE lpaths = rb_gv_get(":"); - for (size_t i = 0; i < conf.rubyLoadpaths.size(); ++i) { std::string &path = conf.rubyLoadpaths[i]; @@ -753,6 +754,13 @@ static void mriBindingExecute() rb_ary_push(lpaths, pathv); } } +#ifdef MARIN + else + { + rb_ary_push(lpaths, rb_str_new_cstr("ruby/extensions/2.5.0")); + rb_ary_push(lpaths, rb_str_new_cstr("ruby/extensions/2.5.0/i386-mingw32")); + } +#endif RbData rbData; shState->setBindingData(&rbData); @@ -764,7 +772,11 @@ static void mriBindingExecute() if (!customScript.empty()) runCustomScript(customScript); else +#ifdef MARIN + runCustomScript("ruby/scripts/requires.rb"); +#else runRMXPScripts(btData); +#endif #ifndef OLD_RUBY VALUE exc = rb_errinfo(); diff --git a/binding/input-binding.cpp b/binding/input-binding.cpp index 2eddd147..07325e23 100644 --- a/binding/input-binding.cpp +++ b/binding/input-binding.cpp @@ -334,13 +334,23 @@ static buttonCodes[] = { "LEFT", Input::Left }, { "RIGHT", Input::Right }, { "UP", Input::Up }, + +#ifdef MARIN + { "CONFIRM", Input::A }, + { "CANCEL", Input::B }, + { "MENU", Input::X }, + { "OPTION", Input::Y }, + { "ZL", Input::ZL }, + { "ZR", Input::ZR }, +#else + { "C", Input::ZL }, + { "Z", Input::ZR }, +#endif { "A", Input::A }, { "B", Input::B }, - { "C", Input::C }, { "X", Input::X }, { "Y", Input::Y }, - { "Z", Input::Z }, { "L", Input::L }, { "R", Input::R }, diff --git a/meson.build b/meson.build index 62bec666..13e3fc50 100644 --- a/meson.build +++ b/meson.build @@ -44,6 +44,10 @@ if not get_option('console') add_project_arguments('-DNO_CONSOLE', language: 'cpp') endif +if get_option('mk') + add_project_arguments('-DMARIN', language: 'cpp') +endif + subdir('src') subdir('binding') subdir('shader') diff --git a/meson_options.txt b/meson_options.txt index be9fb909..e79a20f3 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,4 +1,5 @@ option('mri_version', type: 'string', value: '1.8', description: 'Version of MRI to link with') +option('mk', type: 'boolean', value: false, description: 'Build to fit Marin\'s MK standard') option('ruby_lib', type: 'string', value: 'ruby', description: 'Name of the Ruby library') option('console', type: 'boolean', value: true, description: 'Whether to debug information in the console') option('macos_min_version', type: 'string', value: '10.10', description: 'Minimum macOS system version to support') diff --git a/src/graphics.cpp b/src/graphics.cpp index 1db4c280..8a8a648e 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -53,8 +53,13 @@ #include #include +#ifdef MARIN +#define DEF_SCREEN_W 480 +#define DEF_SCREEN_H 320 +#else #define DEF_SCREEN_W (rgssVer == 1 ? 640 : 544) #define DEF_SCREEN_H (rgssVer == 1 ? 480 : 416) +#endif #define DEF_FRAMERATE (rgssVer == 1 ? 40 : 60) struct PingPong diff --git a/src/input.h b/src/input.h index e0bff17c..7b0b8b12 100644 --- a/src/input.h +++ b/src/input.h @@ -40,8 +40,8 @@ public: Down = 2, Left = 4, Right = 6, Up = 8, - A = 11, B = 12, C = 13, - X = 14, Y = 15, Z = 16, + A = 11, B = 12, ZL = 13, + X = 14, Y = 15, ZR = 16, L = 17, R = 18, Shift = 21, Ctrl = 22, Alt = 23, diff --git a/src/keybindings.cpp b/src/keybindings.cpp index 49d2a718..6f196c96 100644 --- a/src/keybindings.cpp +++ b/src/keybindings.cpp @@ -71,46 +71,63 @@ static const KbBindingData defaultKbBindings[] = { SDL_SCANCODE_RIGHT, Input::Right }, { SDL_SCANCODE_UP, Input::Up }, { SDL_SCANCODE_DOWN, Input::Down }, - { SDL_SCANCODE_SPACE, Input::C }, - { SDL_SCANCODE_RETURN, Input::C }, + +#ifndef MARIN + { SDL_SCANCODE_SPACE, Input::ZL }, + { SDL_SCANCODE_RETURN, Input::ZL }, { SDL_SCANCODE_ESCAPE, Input::B }, { SDL_SCANCODE_KP_0, Input::B }, { SDL_SCANCODE_LSHIFT, Input::A }, { SDL_SCANCODE_X, Input::B }, - { SDL_SCANCODE_D, Input::Z }, + { SDL_SCANCODE_D, Input::ZR }, { SDL_SCANCODE_Q, Input::L }, { SDL_SCANCODE_W, Input::R }, { SDL_SCANCODE_A, Input::X }, { SDL_SCANCODE_S, Input::Y } +#else + { SDL_SCANCODE_E, Input::ZL }, + { SDL_SCANCODE_D, Input::ZR }, + { SDL_SCANCODE_Q, Input::L }, + { SDL_SCANCODE_W, Input::R }, + { SDL_SCANCODE_X, Input::A }, + { SDL_SCANCODE_Z, Input::B }, + { SDL_SCANCODE_A, Input::X }, + { SDL_SCANCODE_S, Input::Y } +#endif }; +#ifndef MARIN /* RGSS1 */ static const KbBindingData defaultKbBindings1[] = { { SDL_SCANCODE_Z, Input::A }, - { SDL_SCANCODE_C, Input::C }, + { SDL_SCANCODE_C, Input::ZL }, }; /* RGSS2 and higher */ static const KbBindingData defaultKbBindings2[] = { - { SDL_SCANCODE_Z, Input::C } + { SDL_SCANCODE_Z, Input::ZL } }; +#endif static elementsN(defaultKbBindings); + +#ifndef MARIN static elementsN(defaultKbBindings1); static elementsN(defaultKbBindings2); +#endif static const JsBindingData defaultJsBindings[] = { - { 0, Input::A }, - { 1, Input::B }, - { 2, Input::C }, - { 3, Input::X }, - { 4, Input::Y }, - { 5, Input::Z }, - { 6, Input::L }, - { 7, Input::R } + { 0, Input::A }, + { 1, Input::B }, + { 2, Input::ZL }, + { 3, Input::X }, + { 4, Input::Y }, + { 5, Input::ZR }, + { 6, Input::L }, + { 7, Input::R } }; static elementsN(defaultJsBindings); @@ -149,14 +166,14 @@ BDescVec genDefaultBindings(const Config &conf) for (size_t i = 0; i < defaultKbBindingsN; ++i) defaultKbBindings[i].add(d); - +#ifndef MARIN if (conf.rgssVersion == 1) for (size_t i = 0; i < defaultKbBindings1N; ++i) defaultKbBindings1[i].add(d); else for (size_t i = 0; i < defaultKbBindings2N; ++i) defaultKbBindings2[i].add(d); - +#endif for (size_t i = 0; i < defaultJsBindingsN; ++i) defaultJsBindings[i].add(d); @@ -239,8 +256,8 @@ static bool verifyDesc(const BindingDesc &desc) { Input::None, Input::Down, Input::Left, Input::Right, Input::Up, - Input::A, Input::B, Input::C, - Input::X, Input::Y, Input::Z, + Input::A, Input::B, Input::ZL, + Input::X, Input::Y, Input::ZR, Input::L, Input::R, Input::Shift, Input::Ctrl, Input::Alt, Input::F5, Input::F6, Input::F7, Input::F8, Input::F9 diff --git a/src/settingsmenu.cpp b/src/settingsmenu.cpp index 6518d7f4..33deba4b 100644 --- a/src/settingsmenu.cpp +++ b/src/settingsmenu.cpp @@ -37,7 +37,7 @@ #include #include -const Vec2i winSize(540, 356); +const Vec2i winSize(640, 356); const uint8_t cBgNorm = 50; const uint8_t cBgDark = 20; @@ -54,7 +54,8 @@ static bool pointInRect(const SDL_Rect &r, int x, int y) typedef SettingsMenuPrivate SMP; -#define BTN_STRING(btn) { Input:: btn, #btn } +#define BTN_STRING_CUSTOM(btn, name) { Input:: btn, name } +#define BTN_STRING(btn) BTN_STRING_CUSTOM(btn, #btn) struct VButton { Input::ButtonCode code; @@ -69,10 +70,18 @@ struct VButton BTN_STRING(R), BTN_STRING(A), BTN_STRING(B), - BTN_STRING(C), +#ifdef MARIN + BTN_STRING(ZL), +#else + BTN_STRING_CUSTOM(ZL, "C"), +#endif BTN_STRING(X), BTN_STRING(Y), - BTN_STRING(Z) +#ifdef MARIN + BTN_STRING(ZR), +#else + BTN_STRING_CUSTOM(ZL, "Z"), +#endif }; static elementsN(vButtons);