mirror of
https://github.com/Oibaf66/uae-wii.git
synced 2024-11-22 02:29:17 +01:00
Rumble option for single wiimote and moved in Wiimote menu
This commit is contained in:
parent
bb958079b8
commit
aa1bb0055c
@ -557,7 +557,8 @@ void save_options (FILE *f, const struct uae_prefs *p, int type)
|
||||
#if defined GEKKO
|
||||
//cfgfile_write (f, "wii_use_mario_kart_wheel=%s\n", p->use_wheel_input ? "yes" : "no");
|
||||
cfgfile_write (f, "wii_port=%d\n", p->Port);
|
||||
cfgfile_write (f, "rumble=%s\n", p->rumble? "true" : "false");
|
||||
cfgfile_write (f, "rumble1=%s\n", p->rumble[0]? "true" : "false");
|
||||
cfgfile_write (f, "rumble2=%s\n", p->rumble[1]? "true" : "false");
|
||||
cfgfile_write (f, "gfx_correct_ratio=%d\n", p->gfx_correct_ratio);
|
||||
#endif
|
||||
|
||||
@ -875,7 +876,8 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value)
|
||||
//return 1;
|
||||
if (cfgfile_intval (option, value, "wii_port", &p->Port, 1)) return 1;
|
||||
if (cfgfile_yesno (option, value, "smb_enable", &p->smb_enable)) return 1;
|
||||
if (cfgfile_yesno (option, value, "rumble", &p->rumble)) return 1;
|
||||
if (cfgfile_yesno (option, value, "rumble1", &p->rumble[0])) return 1;
|
||||
if (cfgfile_yesno (option, value, "rumble2", &p->rumble[1])) return 1;
|
||||
if (cfgfile_string (option, value, "user", p->SmbUser, 32)
|
||||
|| cfgfile_string (option, value, "password", p->SmbPwd,32)
|
||||
|| cfgfile_string (option, value, "share_name", p->SmbShare, 32)
|
||||
@ -2519,7 +2521,8 @@ void default_prefs (struct uae_prefs *p, int type)
|
||||
strcpy (p->SmbShare, "Share");
|
||||
strcpy (p->SmbIp, "192.168.0.1");
|
||||
p->Port= PORT_DEFAULT;
|
||||
p->rumble= 0;
|
||||
p->rumble[0]= 0;
|
||||
p->rumble[1]= 0;
|
||||
p->gfx_correct_ratio = 100;
|
||||
p->write_logfile= 0;
|
||||
#endif
|
||||
|
@ -63,18 +63,16 @@ static const char *main_menu_messages[] = {
|
||||
static const char *input_messages[] = {
|
||||
/*00*/ "Bind key to Wiimote",
|
||||
/*01*/ "^|1|2|-",
|
||||
/*02*/ " ",
|
||||
/*03*/ "Bind key to Nunchuk",
|
||||
/*04*/ "^|Z|C",
|
||||
/*05*/ " ",
|
||||
/*06*/ "Bind key to Classic",
|
||||
/*07*/ "^|a|b|x|y|L|R|Zl|Zr|-",
|
||||
/*08*/ " ",
|
||||
/*09*/ "Mario kart wheel (horizontal only)",
|
||||
/*10*/ "^|On|Off",
|
||||
/*11*/ " ",
|
||||
/*12*/ "Mouse emulation",
|
||||
/*13*/ "^|On|Off",
|
||||
/*02*/ "Bind key to Nunchuk",
|
||||
/*03*/ "^|Z|C",
|
||||
/*04*/ "Bind key to Classic",
|
||||
/*05*/ "^|a|b|x|y|L|R|Zl|Zr|-",
|
||||
/*06*/ "Mario kart wheel (horizontal only)",
|
||||
/*07*/ "^|On|Off",
|
||||
/*08*/ "Mouse emulation",
|
||||
/*09*/ "^|On|Off",
|
||||
/*10*/ "Rumble",
|
||||
/*11*/ "^|on|off",
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -189,8 +187,6 @@ static const char *other_messages[] = {
|
||||
/*11*/ "^|on|off",
|
||||
/*12*/ "Port",
|
||||
/*13*/ "^|DEFAULT|SD|USB|SMB",
|
||||
/*14*/ "Rumble",
|
||||
/*15*/ "^|on|off",
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -1127,7 +1123,8 @@ cfgfile_load(&changed_prefs, user_options, 0);
|
||||
fix_options_menu_sdl(0);
|
||||
currprefs.Port = changed_prefs.Port;
|
||||
currprefs.leds_on_screen = changed_prefs.leds_on_screen;
|
||||
currprefs.rumble = changed_prefs.rumble;
|
||||
currprefs.rumble[0] = changed_prefs.rumble[0];
|
||||
currprefs.rumble[1] = changed_prefs.rumble[1];
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1263,7 +1260,7 @@ extern int screen_is_picasso;
|
||||
|
||||
static void other_options(void)
|
||||
{
|
||||
int submenus[8];
|
||||
int submenus[7];
|
||||
int opt, floppy_n, old_sub_3;
|
||||
|
||||
memset(submenus, 0, sizeof(submenus));
|
||||
@ -1277,7 +1274,6 @@ static void other_options(void)
|
||||
submenus[4] = !(changed_prefs.gfx_linedbl == 2) ;
|
||||
submenus[5] = !changed_prefs.leds_on_screen;
|
||||
submenus[6] = changed_prefs.Port;
|
||||
submenus[7] = !changed_prefs.rumble;
|
||||
|
||||
opt = menu_select_title("Other options menu",
|
||||
other_messages, submenus);
|
||||
@ -1295,9 +1291,8 @@ static void other_options(void)
|
||||
if (changed_prefs.gfx_width_win == 640) changed_prefs.gfx_linedbl = submenus[4] ? 1 : 2;
|
||||
changed_prefs.leds_on_screen = !submenus[5];
|
||||
set_Port(submenus[6]);
|
||||
changed_prefs.rumble = !submenus[7];
|
||||
|
||||
currprefs.leds_on_screen = changed_prefs.leds_on_screen;
|
||||
currprefs.rumble = changed_prefs.rumble;
|
||||
|
||||
fix_options_menu_sdl(1);
|
||||
|
||||
@ -1417,21 +1412,21 @@ static void input_options(int joy)
|
||||
const int classic_to_sdl[] = {9, 10, 11, 12, 13, 14, 15, 16, 17, 18};
|
||||
int sdl_key = 1;
|
||||
const char *key;
|
||||
int submenus[5];
|
||||
int submenus[6];
|
||||
int opt;
|
||||
struct virtkey *virtualkey;
|
||||
|
||||
memset(submenus, 0, sizeof(submenus));
|
||||
submenus[3] = !changed_prefs.joystick_settings[1][joy].eventid[ID_AXIS_OFFSET + 6][0];
|
||||
submenus[4] = (changed_prefs.mouse_settings[1][joy].enabled == 0);
|
||||
submenus[5] = !changed_prefs.rumble[joy];
|
||||
|
||||
opt = menu_select_title("Input menu",
|
||||
input_messages, submenus);
|
||||
if (opt < 0)
|
||||
return;
|
||||
/* Translate key to UAE key event name */
|
||||
|
||||
if (opt == 9)
|
||||
if (opt == 6) //Mario Kart Wheel
|
||||
{
|
||||
if (!submenus[3]){
|
||||
if (!joy) insert_keyboard_map("JOY2_HORIZ","input.1.joystick.%d.axis.6", 0);
|
||||
@ -1443,7 +1438,7 @@ static void input_options(int joy)
|
||||
return;
|
||||
}
|
||||
|
||||
if (opt == 12)
|
||||
if (opt == 8) //Mouse emulation
|
||||
{
|
||||
if (submenus[4])
|
||||
{
|
||||
@ -1457,6 +1452,13 @@ static void input_options(int joy)
|
||||
return;
|
||||
}
|
||||
|
||||
if (opt == 10) //Rumble
|
||||
{
|
||||
changed_prefs.rumble[joy] = !submenus[5];
|
||||
currprefs.rumble[joy] = changed_prefs.rumble[joy];
|
||||
return;
|
||||
}
|
||||
|
||||
virtualkey = virtkbd_get_key();
|
||||
if (virtualkey == NULL)
|
||||
return;
|
||||
@ -1466,9 +1468,9 @@ static void input_options(int joy)
|
||||
{
|
||||
case 0: /* wiimote */
|
||||
sdl_key = wiimote_to_sdl[submenus[0]]; break;
|
||||
case 3: /* nunchuk */
|
||||
case 2: /* nunchuk */
|
||||
sdl_key = nunchuk_to_sdl[submenus[1]]; break;
|
||||
case 6: /* classic */
|
||||
case 4: /* classic */
|
||||
sdl_key = classic_to_sdl[submenus[2]]; break;
|
||||
default: /* can never happen */
|
||||
break;
|
||||
@ -1790,7 +1792,7 @@ void gui_display(int shortcut)
|
||||
break;
|
||||
case 15:
|
||||
if (msgYesNo("Are you sure to quit?", 0, FULL_DISPLAY_X /2-138/RATIO, FULL_DISPLAY_Y /2-48/RATIO))
|
||||
{currprefs.rumble=0; uae_quit(); exit = 1;}
|
||||
{currprefs.rumble[0]=0; currprefs.rumble[1]=0;uae_quit(); exit = 1;}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -520,7 +520,7 @@ static void menu_draw(SDL_Surface *screen, menu_t *p_menu, int sel, int font_siz
|
||||
|
||||
|
||||
SDL_FillRect(screen, &r_ext, SDL_MapRGB(screen->format, 116, 117, 206));
|
||||
SDL_BlitSurface(image_window, &r_int, real_screen, &r_int);
|
||||
SDL_BlitSurface(image_window, &r_int, screen, &r_int);
|
||||
|
||||
if ( p_menu->n_entries * line_height > p_menu->y2 )
|
||||
y_start = p_menu->y1 + line_height;
|
||||
|
@ -253,7 +253,7 @@ struct uae_prefs {
|
||||
char SmbShare[32];
|
||||
char SmbIp[32];
|
||||
int Port; //SD, USB or SMB
|
||||
int rumble;
|
||||
int rumble[2];
|
||||
int gfx_correct_ratio;
|
||||
#endif
|
||||
|
||||
|
@ -37,13 +37,15 @@ struct joyinfo joys[MAX_INPUT_DEVICES];
|
||||
#ifdef GEKKO
|
||||
void Rumble(unsigned int nr, unsigned int i, int bs)
|
||||
{
|
||||
static Uint32 last_ticks[MAX_INPUT_DEVICES];
|
||||
static Uint32 last_ticks[2];
|
||||
Uint32 cur_ticks;
|
||||
static bool rumble_on[MAX_INPUT_DEVICES];
|
||||
static bool fire_pressed[MAX_INPUT_DEVICES];
|
||||
static int joystickbutton_fire[MAX_INPUT_DEVICES]={-1,-1,-1,-1,-1,-1};
|
||||
static bool rumble_on[2];
|
||||
static bool fire_pressed[2];
|
||||
static int joystickbutton_fire[2]={-1,-1,-1,-1,-1,-1};
|
||||
int kc;
|
||||
|
||||
if (nr>1) return;
|
||||
|
||||
cur_ticks = SDL_GetTicks();
|
||||
|
||||
kc = currprefs.joystick_settings[1][nr].eventid[i][0];
|
||||
@ -123,7 +125,11 @@ static void read_joy (unsigned int nr)
|
||||
int bs = SDL_JoystickGetButton (joy, i) ? 1 : 0;
|
||||
setjoybuttonstate (nr, i, bs);
|
||||
#ifdef GEKKO
|
||||
if (!gui_is_active && currprefs.rumble) Rumble (nr,i, bs);
|
||||
if (!gui_is_active)
|
||||
{
|
||||
if ((nr==0) && (currprefs.rumble[0])) Rumble (0,i, bs);
|
||||
if ((nr==1) && (currprefs.rumble[1])) Rumble (1,i, bs);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user