mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-20 05:45:49 +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
|
else
|
||||||
assert(!"unreachable");
|
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, "data_directory", mkxpDataDirectory);
|
||||||
_rb_define_module_function(mod, "set_window_title", mkxpSetTitle);
|
_rb_define_module_function(mod, "set_window_title", mkxpSetTitle);
|
||||||
_rb_define_module_function(mod, "show_settings", mkxpSettingsMenu);
|
_rb_define_module_function(mod, "show_settings", mkxpSettingsMenu);
|
||||||
|
@ -484,6 +484,7 @@ struct BacktraceData
|
||||||
BoostHash<std::string, std::string> scriptNames;
|
BoostHash<std::string, std::string> scriptNames;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef MARIN
|
||||||
#define SCRIPT_SECTION_FMT (rgssVer >= 3 ? "{%04ld}" : "Section%03ld")
|
#define SCRIPT_SECTION_FMT (rgssVer >= 3 ? "{%04ld}" : "Section%03ld")
|
||||||
|
|
||||||
static void runRMXPScripts(BacktraceData &btData)
|
static void runRMXPScripts(BacktraceData &btData)
|
||||||
|
@ -656,6 +657,7 @@ static void runRMXPScripts(BacktraceData &btData)
|
||||||
processReset();
|
processReset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void showExc(VALUE exc, const BacktraceData &btData)
|
static void showExc(VALUE exc, const BacktraceData &btData)
|
||||||
{
|
{
|
||||||
|
@ -740,11 +742,10 @@ static void mriBindingExecute()
|
||||||
|
|
||||||
Config &conf = shState->rtData().config;
|
Config &conf = shState->rtData().config;
|
||||||
|
|
||||||
|
VALUE lpaths = rb_gv_get(":");
|
||||||
if (!conf.rubyLoadpaths.empty())
|
if (!conf.rubyLoadpaths.empty())
|
||||||
{
|
{
|
||||||
/* Setup custom load paths */
|
/* Setup custom load paths */
|
||||||
VALUE lpaths = rb_gv_get(":");
|
|
||||||
|
|
||||||
for (size_t i = 0; i < conf.rubyLoadpaths.size(); ++i)
|
for (size_t i = 0; i < conf.rubyLoadpaths.size(); ++i)
|
||||||
{
|
{
|
||||||
std::string &path = conf.rubyLoadpaths[i];
|
std::string &path = conf.rubyLoadpaths[i];
|
||||||
|
@ -753,6 +754,13 @@ static void mriBindingExecute()
|
||||||
rb_ary_push(lpaths, pathv);
|
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;
|
RbData rbData;
|
||||||
shState->setBindingData(&rbData);
|
shState->setBindingData(&rbData);
|
||||||
|
@ -764,7 +772,11 @@ static void mriBindingExecute()
|
||||||
if (!customScript.empty())
|
if (!customScript.empty())
|
||||||
runCustomScript(customScript);
|
runCustomScript(customScript);
|
||||||
else
|
else
|
||||||
|
#ifdef MARIN
|
||||||
|
runCustomScript("ruby/scripts/requires.rb");
|
||||||
|
#else
|
||||||
runRMXPScripts(btData);
|
runRMXPScripts(btData);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef OLD_RUBY
|
#ifndef OLD_RUBY
|
||||||
VALUE exc = rb_errinfo();
|
VALUE exc = rb_errinfo();
|
||||||
|
|
|
@ -335,12 +335,22 @@ static buttonCodes[] =
|
||||||
{ "RIGHT", Input::Right },
|
{ "RIGHT", Input::Right },
|
||||||
{ "UP", Input::Up },
|
{ "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 },
|
{ "A", Input::A },
|
||||||
{ "B", Input::B },
|
{ "B", Input::B },
|
||||||
{ "C", Input::C },
|
|
||||||
{ "X", Input::X },
|
{ "X", Input::X },
|
||||||
{ "Y", Input::Y },
|
{ "Y", Input::Y },
|
||||||
{ "Z", Input::Z },
|
|
||||||
{ "L", Input::L },
|
{ "L", Input::L },
|
||||||
{ "R", Input::R },
|
{ "R", Input::R },
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,10 @@ if not get_option('console')
|
||||||
add_project_arguments('-DNO_CONSOLE', language: 'cpp')
|
add_project_arguments('-DNO_CONSOLE', language: 'cpp')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if get_option('mk')
|
||||||
|
add_project_arguments('-DMARIN', language: 'cpp')
|
||||||
|
endif
|
||||||
|
|
||||||
subdir('src')
|
subdir('src')
|
||||||
subdir('binding')
|
subdir('binding')
|
||||||
subdir('shader')
|
subdir('shader')
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
option('mri_version', type: 'string', value: '1.8', description: 'Version of MRI to link with')
|
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('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('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')
|
option('macos_min_version', type: 'string', value: '10.10', description: 'Minimum macOS system version to support')
|
||||||
|
|
|
@ -53,8 +53,13 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <algorithm>
|
#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_W (rgssVer == 1 ? 640 : 544)
|
||||||
#define DEF_SCREEN_H (rgssVer == 1 ? 480 : 416)
|
#define DEF_SCREEN_H (rgssVer == 1 ? 480 : 416)
|
||||||
|
#endif
|
||||||
#define DEF_FRAMERATE (rgssVer == 1 ? 40 : 60)
|
#define DEF_FRAMERATE (rgssVer == 1 ? 40 : 60)
|
||||||
|
|
||||||
struct PingPong
|
struct PingPong
|
||||||
|
|
|
@ -40,8 +40,8 @@ public:
|
||||||
|
|
||||||
Down = 2, Left = 4, Right = 6, Up = 8,
|
Down = 2, Left = 4, Right = 6, Up = 8,
|
||||||
|
|
||||||
A = 11, B = 12, C = 13,
|
A = 11, B = 12, ZL = 13,
|
||||||
X = 14, Y = 15, Z = 16,
|
X = 14, Y = 15, ZR = 16,
|
||||||
L = 17, R = 18,
|
L = 17, R = 18,
|
||||||
|
|
||||||
Shift = 21, Ctrl = 22, Alt = 23,
|
Shift = 21, Ctrl = 22, Alt = 23,
|
||||||
|
|
|
@ -71,44 +71,61 @@ static const KbBindingData defaultKbBindings[] =
|
||||||
{ SDL_SCANCODE_RIGHT, Input::Right },
|
{ SDL_SCANCODE_RIGHT, Input::Right },
|
||||||
{ SDL_SCANCODE_UP, Input::Up },
|
{ SDL_SCANCODE_UP, Input::Up },
|
||||||
{ SDL_SCANCODE_DOWN, Input::Down },
|
{ 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_ESCAPE, Input::B },
|
||||||
{ SDL_SCANCODE_KP_0, Input::B },
|
{ SDL_SCANCODE_KP_0, Input::B },
|
||||||
{ SDL_SCANCODE_LSHIFT, Input::A },
|
{ SDL_SCANCODE_LSHIFT, Input::A },
|
||||||
{ SDL_SCANCODE_X, Input::B },
|
{ SDL_SCANCODE_X, Input::B },
|
||||||
{ SDL_SCANCODE_D, Input::Z },
|
{ SDL_SCANCODE_D, Input::ZR },
|
||||||
{ SDL_SCANCODE_Q, Input::L },
|
{ SDL_SCANCODE_Q, Input::L },
|
||||||
{ SDL_SCANCODE_W, Input::R },
|
{ SDL_SCANCODE_W, Input::R },
|
||||||
{ SDL_SCANCODE_A, Input::X },
|
{ SDL_SCANCODE_A, Input::X },
|
||||||
{ SDL_SCANCODE_S, Input::Y }
|
{ 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 */
|
/* RGSS1 */
|
||||||
static const KbBindingData defaultKbBindings1[] =
|
static const KbBindingData defaultKbBindings1[] =
|
||||||
{
|
{
|
||||||
{ SDL_SCANCODE_Z, Input::A },
|
{ SDL_SCANCODE_Z, Input::A },
|
||||||
{ SDL_SCANCODE_C, Input::C },
|
{ SDL_SCANCODE_C, Input::ZL },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* RGSS2 and higher */
|
/* RGSS2 and higher */
|
||||||
static const KbBindingData defaultKbBindings2[] =
|
static const KbBindingData defaultKbBindings2[] =
|
||||||
{
|
{
|
||||||
{ SDL_SCANCODE_Z, Input::C }
|
{ SDL_SCANCODE_Z, Input::ZL }
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
static elementsN(defaultKbBindings);
|
static elementsN(defaultKbBindings);
|
||||||
|
|
||||||
|
#ifndef MARIN
|
||||||
static elementsN(defaultKbBindings1);
|
static elementsN(defaultKbBindings1);
|
||||||
static elementsN(defaultKbBindings2);
|
static elementsN(defaultKbBindings2);
|
||||||
|
#endif
|
||||||
|
|
||||||
static const JsBindingData defaultJsBindings[] =
|
static const JsBindingData defaultJsBindings[] =
|
||||||
{
|
{
|
||||||
{ 0, Input::A },
|
{ 0, Input::A },
|
||||||
{ 1, Input::B },
|
{ 1, Input::B },
|
||||||
{ 2, Input::C },
|
{ 2, Input::ZL },
|
||||||
{ 3, Input::X },
|
{ 3, Input::X },
|
||||||
{ 4, Input::Y },
|
{ 4, Input::Y },
|
||||||
{ 5, Input::Z },
|
{ 5, Input::ZR },
|
||||||
{ 6, Input::L },
|
{ 6, Input::L },
|
||||||
{ 7, Input::R }
|
{ 7, Input::R }
|
||||||
};
|
};
|
||||||
|
@ -149,14 +166,14 @@ BDescVec genDefaultBindings(const Config &conf)
|
||||||
|
|
||||||
for (size_t i = 0; i < defaultKbBindingsN; ++i)
|
for (size_t i = 0; i < defaultKbBindingsN; ++i)
|
||||||
defaultKbBindings[i].add(d);
|
defaultKbBindings[i].add(d);
|
||||||
|
#ifndef MARIN
|
||||||
if (conf.rgssVersion == 1)
|
if (conf.rgssVersion == 1)
|
||||||
for (size_t i = 0; i < defaultKbBindings1N; ++i)
|
for (size_t i = 0; i < defaultKbBindings1N; ++i)
|
||||||
defaultKbBindings1[i].add(d);
|
defaultKbBindings1[i].add(d);
|
||||||
else
|
else
|
||||||
for (size_t i = 0; i < defaultKbBindings2N; ++i)
|
for (size_t i = 0; i < defaultKbBindings2N; ++i)
|
||||||
defaultKbBindings2[i].add(d);
|
defaultKbBindings2[i].add(d);
|
||||||
|
#endif
|
||||||
for (size_t i = 0; i < defaultJsBindingsN; ++i)
|
for (size_t i = 0; i < defaultJsBindingsN; ++i)
|
||||||
defaultJsBindings[i].add(d);
|
defaultJsBindings[i].add(d);
|
||||||
|
|
||||||
|
@ -239,8 +256,8 @@ static bool verifyDesc(const BindingDesc &desc)
|
||||||
{
|
{
|
||||||
Input::None,
|
Input::None,
|
||||||
Input::Down, Input::Left, Input::Right, Input::Up,
|
Input::Down, Input::Left, Input::Right, Input::Up,
|
||||||
Input::A, Input::B, Input::C,
|
Input::A, Input::B, Input::ZL,
|
||||||
Input::X, Input::Y, Input::Z,
|
Input::X, Input::Y, Input::ZR,
|
||||||
Input::L, Input::R,
|
Input::L, Input::R,
|
||||||
Input::Shift, Input::Ctrl, Input::Alt,
|
Input::Shift, Input::Ctrl, Input::Alt,
|
||||||
Input::F5, Input::F6, Input::F7, Input::F8, Input::F9
|
Input::F5, Input::F6, Input::F7, Input::F8, Input::F9
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
const Vec2i winSize(540, 356);
|
const Vec2i winSize(640, 356);
|
||||||
|
|
||||||
const uint8_t cBgNorm = 50;
|
const uint8_t cBgNorm = 50;
|
||||||
const uint8_t cBgDark = 20;
|
const uint8_t cBgDark = 20;
|
||||||
|
@ -54,7 +54,8 @@ static bool pointInRect(const SDL_Rect &r, int x, int y)
|
||||||
|
|
||||||
typedef SettingsMenuPrivate SMP;
|
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
|
struct VButton
|
||||||
{
|
{
|
||||||
Input::ButtonCode code;
|
Input::ButtonCode code;
|
||||||
|
@ -69,10 +70,18 @@ struct VButton
|
||||||
BTN_STRING(R),
|
BTN_STRING(R),
|
||||||
BTN_STRING(A),
|
BTN_STRING(A),
|
||||||
BTN_STRING(B),
|
BTN_STRING(B),
|
||||||
BTN_STRING(C),
|
#ifdef MARIN
|
||||||
|
BTN_STRING(ZL),
|
||||||
|
#else
|
||||||
|
BTN_STRING_CUSTOM(ZL, "C"),
|
||||||
|
#endif
|
||||||
BTN_STRING(X),
|
BTN_STRING(X),
|
||||||
BTN_STRING(Y),
|
BTN_STRING(Y),
|
||||||
BTN_STRING(Z)
|
#ifdef MARIN
|
||||||
|
BTN_STRING(ZR),
|
||||||
|
#else
|
||||||
|
BTN_STRING_CUSTOM(ZL, "Z"),
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static elementsN(vButtons);
|
static elementsN(vButtons);
|
||||||
|
|
Loading…
Add table
Reference in a new issue