Set default keys for input on first run.
We use the following key input if the config `vbam.ini` does not exist: input | keyboard A | A B | S L | Q R | W SELECT | Z START | X We also set a joystick default, using the XBOX 360 controller as a base. - Fix #463.
This commit is contained in:
parent
9bc8f33c40
commit
3dc738b5c5
|
@ -144,8 +144,8 @@ const wxString joynames[NUM_KEYS] = {
|
||||||
|
|
||||||
wxJoyKeyBinding defkeys_keyboard[NUM_KEYS] = {
|
wxJoyKeyBinding defkeys_keyboard[NUM_KEYS] = {
|
||||||
WJKB(WXK_UP), WJKB(WXK_DOWN), WJKB(WXK_LEFT), WJKB(WXK_RIGHT),
|
WJKB(WXK_UP), WJKB(WXK_DOWN), WJKB(WXK_LEFT), WJKB(WXK_RIGHT),
|
||||||
WJKB(wxT('Z')), WJKB(wxT('X')), WJKB(wxT('A')), WJKB(wxT('S')),
|
WJKB(wxT('A')), WJKB(wxT('S')), WJKB(wxT('Q')), WJKB(wxT('W')),
|
||||||
WJKB(wxT('C')), WJKB(wxT('V')),
|
WJKB(wxT('Z')), WJKB(wxT('X')),
|
||||||
WJKB(0), WJKB(0), WJKB(0), WJKB(0),
|
WJKB(0), WJKB(0), WJKB(0), WJKB(0),
|
||||||
WJKB(0), WJKB(0), WJKB(0), WJKB(0),
|
WJKB(0), WJKB(0), WJKB(0), WJKB(0),
|
||||||
WJKB(WXK_SPACE), WJKB(0), WJKB(0)
|
WJKB(WXK_SPACE), WJKB(0), WJKB(0)
|
||||||
|
@ -153,8 +153,8 @@ wxJoyKeyBinding defkeys_keyboard[NUM_KEYS] = {
|
||||||
|
|
||||||
wxJoyKeyBinding defkeys_joystick[NUM_KEYS] = {
|
wxJoyKeyBinding defkeys_joystick[NUM_KEYS] = {
|
||||||
WJKB(1, WXJB_AXIS_MINUS, 1), WJKB(1, WXJB_AXIS_PLUS, 1), WJKB(0, WXJB_AXIS_MINUS, 1), WJKB(0, WXJB_AXIS_PLUS, 1),
|
WJKB(1, WXJB_AXIS_MINUS, 1), WJKB(1, WXJB_AXIS_PLUS, 1), WJKB(0, WXJB_AXIS_MINUS, 1), WJKB(0, WXJB_AXIS_PLUS, 1),
|
||||||
WJKB(0, WXJB_BUTTON, 1), WJKB(1, WXJB_BUTTON, 1), WJKB(2, WXJB_BUTTON, 1), WJKB(3, WXJB_BUTTON, 1),
|
WJKB(0, WXJB_BUTTON, 1), WJKB(1, WXJB_BUTTON, 1), WJKB(4, WXJB_BUTTON, 1), WJKB(5, WXJB_BUTTON, 1),
|
||||||
WJKB(4, WXJB_BUTTON, 1), WJKB(5, WXJB_BUTTON, 1),
|
WJKB(6, WXJB_BUTTON, 1), WJKB(7, WXJB_BUTTON, 1),
|
||||||
WJKB(0), WJKB(0), WJKB(0), WJKB(0),
|
WJKB(0), WJKB(0), WJKB(0), WJKB(0),
|
||||||
WJKB(0), WJKB(0), WJKB(0), WJKB(0),
|
WJKB(0), WJKB(0), WJKB(0), WJKB(0),
|
||||||
WJKB(0), WJKB(0), WJKB(0)
|
WJKB(0), WJKB(0), WJKB(0)
|
||||||
|
@ -346,13 +346,6 @@ opts_t::opts_t()
|
||||||
bilinear = true;
|
bilinear = true;
|
||||||
default_stick = 1;
|
default_stick = 1;
|
||||||
|
|
||||||
for (int i = 0; i < NUM_KEYS; i++) {
|
|
||||||
if (defkeys_keyboard[i].key)
|
|
||||||
joykey_bindings[0][i].push_back(defkeys_keyboard[i]);
|
|
||||||
if (defkeys_joystick[i].key)
|
|
||||||
joykey_bindings[0][i].push_back(defkeys_joystick[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
recent = new wxFileHistory(10);
|
recent = new wxFileHistory(10);
|
||||||
autofire_rate = 1;
|
autofire_rate = 1;
|
||||||
print_auto_page = true;
|
print_auto_page = true;
|
||||||
|
@ -368,6 +361,17 @@ bool opt_lt(const opt_desc& opt1, const opt_desc& opt2)
|
||||||
return wxStrcmp(opt1.opt, opt2.opt) < 0;
|
return wxStrcmp(opt1.opt, opt2.opt) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set default input keys
|
||||||
|
void set_default_keys()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < NUM_KEYS; i++) {
|
||||||
|
if (defkeys_keyboard[i].key)
|
||||||
|
gopts.joykey_bindings[0][i].push_back(defkeys_keyboard[i]);
|
||||||
|
if (defkeys_joystick[i].joy)
|
||||||
|
gopts.joykey_bindings[0][i].push_back(defkeys_joystick[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: simulate MakeInstanceFilename(vbam.ini) using subkeys (Slave%d/*)
|
// FIXME: simulate MakeInstanceFilename(vbam.ini) using subkeys (Slave%d/*)
|
||||||
void load_opts()
|
void load_opts()
|
||||||
{
|
{
|
||||||
|
|
|
@ -115,6 +115,8 @@ extern const int num_opts;
|
||||||
extern const wxAcceleratorEntry default_accels[];
|
extern const wxAcceleratorEntry default_accels[];
|
||||||
extern const int num_def_accels;
|
extern const int num_def_accels;
|
||||||
|
|
||||||
|
// call to setup default keys.
|
||||||
|
void set_default_keys();
|
||||||
// call to load config (once)
|
// call to load config (once)
|
||||||
// will write defaults for options not present and delete bad opts
|
// will write defaults for options not present and delete bad opts
|
||||||
// will also initialize opts[] array translations
|
// will also initialize opts[] array translations
|
||||||
|
|
|
@ -165,6 +165,8 @@ wxString wxvbamApp::GetConfigurationPath()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// use default keys for input.
|
||||||
|
set_default_keys();
|
||||||
}
|
}
|
||||||
|
|
||||||
return data_path;
|
return data_path;
|
||||||
|
@ -488,7 +490,7 @@ void wxvbamApp::OnInitCmdLine(wxCmdLineParser& cl)
|
||||||
N_("Print configuration path and exit"),
|
N_("Print configuration path and exit"),
|
||||||
wxCMD_LINE_VAL_NONE, 0 },
|
wxCMD_LINE_VAL_NONE, 0 },
|
||||||
{ wxCMD_LINE_SWITCH, t("f"), t("fullscreen"),
|
{ wxCMD_LINE_SWITCH, t("f"), t("fullscreen"),
|
||||||
N_("Start in full-screen mode"),
|
N_("Start in full-screen mode"),
|
||||||
wxCMD_LINE_VAL_NONE, 0 },
|
wxCMD_LINE_VAL_NONE, 0 },
|
||||||
#if !defined(NO_LINK) && !defined(__WXMSW__)
|
#if !defined(NO_LINK) && !defined(__WXMSW__)
|
||||||
{ wxCMD_LINE_SWITCH, t("s"), t("delete-shared-state"),
|
{ wxCMD_LINE_SWITCH, t("s"), t("delete-shared-state"),
|
||||||
|
|
Loading…
Reference in New Issue