Mario kart wheel support.

Yes, this is the silly feature of the day: Allow wiimote orientation control
the horizontal joystick control. Useful (well, somewhat) in games such as
stunt car racer. This is also selectable from the menu now
This commit is contained in:
simon.kagstrom 2009-07-11 11:27:22 +00:00
parent ab42558d4d
commit 7f0f11866c
4 changed files with 57 additions and 15 deletions

View File

@ -556,6 +556,10 @@ void save_options (FILE *f, const struct uae_prefs *p, int type)
cfgfile_write (f, "state_replay_buffer=%d\n", p->statecapturebuffersize); cfgfile_write (f, "state_replay_buffer=%d\n", p->statecapturebuffersize);
#endif #endif
#if defined GEKKO
cfgfile_write (f, "wii_use_mario_kart_wheel=%s\n", p->use_wheel_input ? "yes" : "no");
#endif
#ifdef FILESYS #ifdef FILESYS
write_filesys_config (currprefs.mountinfo, UNEXPANDED, prefs_get_attr ("hardfile_path"), f); write_filesys_config (currprefs.mountinfo, UNEXPANDED, prefs_get_attr ("hardfile_path"), f);
if (p->filesys_no_uaefsdb) if (p->filesys_no_uaefsdb)
@ -846,6 +850,11 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value)
return 1; return 1;
#endif #endif
#if defined GEKKO
if (cfgfile_yesno (option, value, "wii_use_mario_kart_wheel", &p->use_wheel_input))
return 1;
#endif
#ifdef DRIVESOUND #ifdef DRIVESOUND
if (cfgfile_intval (option, value, "floppy0sound", &p->dfxclick[0], 1) if (cfgfile_intval (option, value, "floppy0sound", &p->dfxclick[0], 1)
|| cfgfile_intval (option, value, "floppy1sound", &p->dfxclick[1], 1) || cfgfile_intval (option, value, "floppy1sound", &p->dfxclick[1], 1)
@ -2460,6 +2469,10 @@ void default_prefs (struct uae_prefs *p, int type)
p->mountinfo = &options_mountinfo; p->mountinfo = &options_mountinfo;
#endif #endif
#ifdef GEKKO
p->use_wheel_input = 0;
#endif
#ifdef UAE_MINI #ifdef UAE_MINI
default_prefs_mini (p, 0); default_prefs_mini (p, 0);
#endif #endif

View File

@ -30,8 +30,8 @@ static const char *main_menu_messages[] = {
/*04*/ "#1-------------------------------------", /*04*/ "#1-------------------------------------",
/*05*/ "Reset UAE", /*05*/ "Reset UAE",
/*06*/ "Amiga options", /*06*/ "Amiga options",
/*07*/ "Keyboard bindings", /*07*/ "Input options",
/*08*/ "Options", /*08*/ "Other options",
/*09*/ "Help", /*09*/ "Help",
/*10*/ "Quit", /*10*/ "Quit",
/*04*/ "#1-------------------------------------", /*04*/ "#1-------------------------------------",
@ -39,13 +39,15 @@ static const char *main_menu_messages[] = {
NULL NULL
}; };
static const char *keyboard_messages[] = { static const char *input_messages[] = {
/*00*/ "Wiimote", /*00*/ "Bind key to Wiimote",
/*01*/ "^|1|-|+", /*01*/ "^|1|-|+",
/*02*/ "Nunchuk", /*02*/ "Bind key to Nunchuk",
/*03*/ "^|C", /*03*/ "^|C",
/*04*/ "Classic", /*04*/ "Bind key to Classic",
/*05*/ "^|b|x|y|L|R|Zl|Zr|-|+", /*05*/ "^|b|x|y|L|R|Zl|Zr|-|+",
/*06*/ "Mario kart wheel (horizontal only)",
/*07*/ "^|On|Off",
NULL, NULL,
}; };
@ -405,6 +407,7 @@ static void insert_keyboard_map(const char *key, const char *fmt, ...)
fprintf(stderr, "Too long string passed\n"); fprintf(stderr, "Too long string passed\n");
va_end(ap); va_end(ap);
printf("Mibb: %s:%s\n", buf, key);
read_inputdevice_config (&changed_prefs, buf, key); read_inputdevice_config (&changed_prefs, buf, key);
read_inputdevice_config (&currprefs, buf, key); read_inputdevice_config (&currprefs, buf, key);
} }
@ -416,7 +419,7 @@ static void setup_joystick_defaults(int joy)
/* For some reason, the user uaerc removes these. The following /* For some reason, the user uaerc removes these. The following
* lines should be removed when this is properly figured out */ * lines should be removed when this is properly figured out */
for (i = 0; i < 8; i++) for (i = 0; i < 6; i++)
{ {
const char *what = "JOY2_HORIZ"; /* Assume port 1 */ const char *what = "JOY2_HORIZ"; /* Assume port 1 */
@ -434,6 +437,18 @@ static void setup_joystick_defaults(int joy)
insert_keyboard_map(what, insert_keyboard_map(what,
"input.1.joystick.%d.axis.%d", joy, i); "input.1.joystick.%d.axis.%d", joy, i);
} }
#ifdef GEKKO
if (currprefs.use_wheel_input)
insert_keyboard_map(joy == 1 ? "JOY1_HORIZ" : "JOY2_HORIZ",
"input.1.joystick.%d.axis.6", joy);
else /* Just select something which will not affect play! */
insert_keyboard_map("PAR_JOY2_VERT",
"input.1.joystick.%d.axis.6", joy);
#endif
insert_keyboard_map(joy == 1 ? "JOY1_HORIZ" : "JOY2_HORIZ",
"input.1.joystick.%d.axis.9", joy);
insert_keyboard_map(joy == 1 ? "JOY1_VERT" : "JOY2_VERT",
"input.1.joystick.%d.axis.10", joy);
insert_keyboard_map("SPC_ENTERGUI", "input.1.joystick.%d.button.6", joy); insert_keyboard_map("SPC_ENTERGUI", "input.1.joystick.%d.button.6", joy);
insert_keyboard_map("SPC_ENTERGUI", "input.1.joystick.%d.button.19", joy); insert_keyboard_map("SPC_ENTERGUI", "input.1.joystick.%d.button.19", joy);
@ -452,24 +467,33 @@ static void setup_joystick(int joy, const char *key, int sdl_key)
insert_keyboard_map(key, "input.1.joystick.%d.button.%d", joy, sdl_key); insert_keyboard_map(key, "input.1.joystick.%d.button.%d", joy, sdl_key);
} }
static void keyboard_options(void) static void input_options(void)
{ {
const int wiimote_to_sdl[] = {2, 4, 5}; const int wiimote_to_sdl[] = {2, 4, 5};
const int nunchuk_to_sdl[] = {8}; const int nunchuk_to_sdl[] = {8};
const int classic_to_sdl[] = {10, 11, 12, 13, 14, 15, 16, 17, 18}; const int classic_to_sdl[] = {10, 11, 12, 13, 14, 15, 16, 17, 18};
int sdl_key = 1; int sdl_key = 1;
const char *key; const char *key;
int submenus[3]; int submenus[4];
int opt; int opt;
int i; int i;
memset(submenus, 0, sizeof(submenus)); memset(submenus, 0, sizeof(submenus));
submenus[3] = !changed_prefs.use_wheel_input;
opt = menu_select_title("Keyboard menu", opt = menu_select_title("Keyboard menu",
keyboard_messages, submenus); input_messages, submenus);
if (opt < 0) if (opt < 0)
return; return;
/* Translate key to UAE key event name */ /* Translate key to UAE key event name */
if (opt == 6)
{
changed_prefs.use_wheel_input = !submenus[3];
currprefs.use_wheel_input = changed_prefs.use_wheel_input;
prefs_has_changed = 1;
return;
}
key = virtkbd_get_key(); key = virtkbd_get_key();
if (key == NULL) if (key == NULL)
return; return;
@ -484,6 +508,8 @@ static void keyboard_options(void)
default: /* can never happen */ default: /* can never happen */
break; break;
} }
changed_prefs.use_wheel_input = !submenus[3];
currprefs.use_wheel_input = changed_prefs.use_wheel_input;
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
setup_joystick(i, key, sdl_key); setup_joystick(i, key, sdl_key);
@ -752,7 +778,7 @@ void gui_display(int shortcut)
amiga_model_options(); amiga_model_options();
break; break;
case 7: case 7:
keyboard_options(); input_options();
break; break;
case 8: case 8:
general_options(); general_options();

View File

@ -237,6 +237,9 @@ struct uae_prefs {
int statecapturerate, statecapturebuffersize; int statecapturerate, statecapturebuffersize;
#endif #endif
#ifdef GEKKO
int use_wheel_input;
#endif
/* input */ /* input */
int jport0; int jport0;

View File

@ -72,8 +72,8 @@ input.1.joystick.0.axis.3=JOY2_VERT
input.1.joystick.0.axis.4=JOY2_HORIZ input.1.joystick.0.axis.4=JOY2_HORIZ
input.1.joystick.0.axis.5=JOY2_VERT input.1.joystick.0.axis.5=JOY2_VERT
# The "hat" on the wiimote (dpad) # The "hat" on the wiimote (dpad)
input.1.joystick.0.axis.6=JOY2_HORIZ input.1.joystick.0.axis.9=JOY2_HORIZ
input.1.joystick.0.axis.7=JOY2_VERT input.1.joystick.0.axis.10=JOY2_VERT
# 2 on wiimote, Z on nunchuck and a on the classic controller # 2 on wiimote, Z on nunchuck and a on the classic controller
input.1.joystick.0.button.3=JOY2_FIRE_BUTTON input.1.joystick.0.button.3=JOY2_FIRE_BUTTON
@ -88,8 +88,8 @@ input.1.joystick.1.axis.2=JOY1_HORIZ
input.1.joystick.1.axis.3=JOY1_VERT input.1.joystick.1.axis.3=JOY1_VERT
input.1.joystick.1.axis.4=JOY1_HORIZ input.1.joystick.1.axis.4=JOY1_HORIZ
input.1.joystick.1.axis.5=JOY1_VERT input.1.joystick.1.axis.5=JOY1_VERT
input.1.joystick.1.axis.6=JOY1_HORIZ input.1.joystick.1.axis.9=JOY1_HORIZ
input.1.joystick.1.axis.7=JOY1_VERT input.1.joystick.1.axis.10=JOY1_VERT
input.1.joystick.1.button.3=JOY1_FIRE_BUTTON input.1.joystick.1.button.3=JOY1_FIRE_BUTTON
input.1.joystick.1.button.7=JOY1_FIRE_BUTTON input.1.joystick.1.button.7=JOY1_FIRE_BUTTON