mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-07-03 15:15:17 +02:00
Play nice with Marin's experiments
This commit is contained in:
parent
6421f445ab
commit
a6f8bc4268
8 changed files with 86 additions and 28 deletions
|
@ -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<std::string, std::string> 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();
|
||||
|
|
|
@ -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 },
|
||||
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -53,8 +53,13 @@
|
|||
#include <errno.h>
|
||||
#include <algorithm>
|
||||
|
||||
#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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
|
||||
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);
|
||||
|
|
Loading…
Add table
Reference in a new issue