mirror of
https://github.com/Oibaf66/fbzx-wii.git
synced 2024-11-24 09:09:20 +01:00
Virtual keyboard and pause button also for the second controller
This commit is contained in:
parent
513da5147c
commit
228d0b06e6
@ -175,13 +175,14 @@ struct virtkey *get_key_internal()
|
||||
int key_h = 64/RATIO;
|
||||
int border_x = VirtualKeyboard.sel_x/RATIO;
|
||||
int border_y = VirtualKeyboard.sel_y/RATIO;
|
||||
int joy_n=0;
|
||||
|
||||
draw_vk();
|
||||
SDL_Flip(VirtualKeyboard.screen);
|
||||
|
||||
SDL_ShowCursor(SDL_ENABLE);
|
||||
|
||||
k = menu_wait_key_press();
|
||||
k = menu_wait_key_press(&joy_n);
|
||||
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
|
||||
@ -198,15 +199,15 @@ struct virtkey *get_key_internal()
|
||||
i = y/key_h*KEY_COLS + x/key_w;
|
||||
|
||||
#ifdef HW_RVL
|
||||
if (ordenador.vk_rumble) WPAD_Rumble(0, 1);
|
||||
if (ordenador.vk_rumble) WPAD_Rumble(joy_n, 1);
|
||||
SDL_Delay(90);
|
||||
if (ordenador.vk_rumble) WPAD_Rumble(0, 0);
|
||||
if (ordenador.vk_rumble) WPAD_Rumble(joy_n, 0);
|
||||
#endif
|
||||
|
||||
#ifdef HW_DOL
|
||||
if (ordenador.vk_rumble) PAD_ControlMotor(0,PAD_MOTOR_RUMBLE);
|
||||
if (ordenador.vk_rumble) PAD_ControlMotor(joy_n,PAD_MOTOR_RUMBLE);
|
||||
SDL_Delay(90);
|
||||
if (ordenador.vk_rumble) PAD_ControlMotor(0,PAD_MOTOR_STOP);
|
||||
if (ordenador.vk_rumble) PAD_ControlMotor(joy_n,PAD_MOTOR_STOP);
|
||||
#endif
|
||||
|
||||
virtkey_t *key = &keys[i];
|
||||
@ -248,47 +249,52 @@ void virtkey_ir_run(void)
|
||||
int border_x = VirtualKeyboard.sel_x/RATIO;
|
||||
int border_y = VirtualKeyboard.sel_y/RATIO;
|
||||
int key_sel = 0;
|
||||
int joy_n;
|
||||
SDL_Joystick *joy;
|
||||
static int joy_bottons_last[5];
|
||||
static char countdown_rumble=0;
|
||||
static int joy_bottons_last[2][5];
|
||||
static char countdown_rumble[2];
|
||||
|
||||
for(joy_n=0;joy_n<ordenador.joystick_number;joy_n++)
|
||||
{
|
||||
key_sel = 0;
|
||||
|
||||
#ifdef HW_RVL
|
||||
if (countdown_rumble > 0) {countdown_rumble--; if ((countdown_rumble==0)&&(ordenador.vk_rumble)) WPAD_Rumble(0, 0);}
|
||||
if (countdown_rumble[joy_n] > 0) {countdown_rumble[joy_n]--; if ((countdown_rumble[joy_n]==0)&&(ordenador.vk_rumble)) WPAD_Rumble(joy_n, 0);}
|
||||
#endif
|
||||
|
||||
#ifdef HW_DOL
|
||||
if (countdown_rumble > 0) {countdown_rumble--; if ((countdown_rumble==0)&&(ordenador.vk_rumble)) PAD_ControlMotor(0,PAD_MOTOR_STOP);}
|
||||
if (countdown_rumble[joy_n] > 0) {countdown_rumble[joy_n]--; if ((countdown_rumble[joy_n]==0)&&(ordenador.vk_rumble)) PAD_ControlMotor(joy_n,PAD_MOTOR_STOP);}
|
||||
#endif
|
||||
|
||||
joy = ordenador.joystick_sdl[0];
|
||||
joy = ordenador.joystick_sdl[joy_n];
|
||||
|
||||
if ((SDL_JoystickGetButton(joy, 0) && !joy_bottons_last[0]) || /* A */
|
||||
(SDL_JoystickGetButton(joy, 3) && !joy_bottons_last[1]) || /* 2 */
|
||||
(SDL_JoystickGetButton(joy, 9) && !joy_bottons_last[2]) || /* CA */
|
||||
(SDL_JoystickGetButton(joy, 10) && !joy_bottons_last[3]) /* CB */
|
||||
if ((SDL_JoystickGetButton(joy, 0) && !joy_bottons_last[joy_n][0]) || /* A */
|
||||
(SDL_JoystickGetButton(joy, 3) && !joy_bottons_last[joy_n][1]) || /* 2 */
|
||||
(SDL_JoystickGetButton(joy, 9) && !joy_bottons_last[joy_n][2]) || /* CA */
|
||||
(SDL_JoystickGetButton(joy, 10) && !joy_bottons_last[joy_n][3]) /* CB */
|
||||
#ifndef GEKKO //Win
|
||||
||((SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1))&& !joy_bottons_last[4])//mouse left button
|
||||
||(!joy_n && (SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1))&& !joy_bottons_last[0][4])//mouse left button
|
||||
#endif
|
||||
) key_sel = KEY_SELECT;
|
||||
|
||||
|
||||
if ((!SDL_JoystickGetButton(joy, 0) && joy_bottons_last[0]) || /* A */
|
||||
(!SDL_JoystickGetButton(joy, 3) && joy_bottons_last[1]) || /* 2 */
|
||||
(!SDL_JoystickGetButton(joy, 9) && joy_bottons_last[2]) || /* CA */
|
||||
(!SDL_JoystickGetButton(joy, 10) && joy_bottons_last[3]) /* CB */
|
||||
if ((!SDL_JoystickGetButton(joy, 0) && joy_bottons_last[joy_n][0]) || /* A */
|
||||
(!SDL_JoystickGetButton(joy, 3) && joy_bottons_last[joy_n][1]) || /* 2 */
|
||||
(!SDL_JoystickGetButton(joy, 9) && joy_bottons_last[joy_n][2]) || /* CA */
|
||||
(!SDL_JoystickGetButton(joy, 10) && joy_bottons_last[joy_n][3]) /* CB */
|
||||
#ifndef GEKKO //Win
|
||||
||(!(SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1)) && joy_bottons_last[4]) //mouse left button
|
||||
||(!joy_n && !(SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1)) && joy_bottons_last[0][4]) //mouse left button
|
||||
#endif
|
||||
) key_sel = KEY_DESELECT;
|
||||
|
||||
|
||||
|
||||
joy_bottons_last[0]=SDL_JoystickGetButton(joy, 0) ; /* A */
|
||||
joy_bottons_last[1] =SDL_JoystickGetButton(joy, 3) ; /* 2 */
|
||||
joy_bottons_last[2] =SDL_JoystickGetButton(joy, 9) ; /* CA */
|
||||
joy_bottons_last[3] =SDL_JoystickGetButton(joy, 10) ; /* CB */
|
||||
joy_bottons_last[joy_n][0] =SDL_JoystickGetButton(joy, 0) ; /* A */
|
||||
joy_bottons_last[joy_n][1] =SDL_JoystickGetButton(joy, 3) ; /* 2 */
|
||||
joy_bottons_last[joy_n][2] =SDL_JoystickGetButton(joy, 9) ; /* CA */
|
||||
joy_bottons_last[joy_n][3] =SDL_JoystickGetButton(joy, 10) ; /* CB */
|
||||
#ifndef GEKKO //Win
|
||||
joy_bottons_last[4] =SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1); //mouse left button
|
||||
if (!joy_n) joy_bottons_last[0][4] =SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1); //mouse left button
|
||||
#endif
|
||||
|
||||
if (key_sel==KEY_SELECT)
|
||||
@ -299,14 +305,14 @@ void virtkey_ir_run(void)
|
||||
if ((x>0)&&(x< KEY_COLS*key_w)&&(y>0)&&(y< KEY_ROWS*key_h))
|
||||
{
|
||||
#ifdef HW_RVL
|
||||
if (ordenador.vk_rumble) WPAD_Rumble(0, 1);
|
||||
if (ordenador.vk_rumble) WPAD_Rumble(joy_n, 1);
|
||||
#endif
|
||||
|
||||
#ifdef HW_DOL
|
||||
if (ordenador.vk_rumble) PAD_ControlMotor(0,PAD_MOTOR_RUMBLE);
|
||||
if (ordenador.vk_rumble) PAD_ControlMotor(joy_n,PAD_MOTOR_RUMBLE);
|
||||
#endif
|
||||
|
||||
countdown_rumble=5;
|
||||
countdown_rumble[joy_n]=5;
|
||||
|
||||
i = y/key_h*KEY_COLS + x/key_w;
|
||||
|
||||
@ -356,6 +362,7 @@ void virtkey_ir_run(void)
|
||||
|
||||
key_code=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void virtkey_ir_activate(void)
|
||||
|
@ -1184,7 +1184,8 @@ inline void paint_one_pixel(unsigned char *colour,unsigned char *address ) {
|
||||
inline void pause() {
|
||||
unsigned int temporal_io;
|
||||
SDL_Event evento,*pevento;
|
||||
unsigned char minus_pressed=2;
|
||||
unsigned char minus_pressed[2]={2,2};
|
||||
int joy_n;
|
||||
|
||||
pevento=&evento;
|
||||
printf("Pause\n");
|
||||
@ -1193,19 +1194,21 @@ inline void pause() {
|
||||
{
|
||||
SDL_JoystickUpdate();
|
||||
|
||||
for(joy_n=0;joy_n<ordenador.joystick_number;joy_n++)
|
||||
{
|
||||
#ifdef HW_DOL //Gamecube button "Z"
|
||||
if (!SDL_JoystickGetButton(ordenador.joystick_sdl[0], 4 ) && minus_pressed==2 ) minus_pressed = 1; //Released
|
||||
if (SDL_JoystickGetButton(ordenador.joystick_sdl[0], 4 ) && minus_pressed==1) minus_pressed = 0; //Pressed
|
||||
if (!SDL_JoystickGetButton(ordenador.joystick_sdl[0], 4 ) && minus_pressed==0 ) return; //Released
|
||||
if (!SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], 4 ) && minus_pressed[joy_n]==2) minus_pressed[joy_n] = 1; //Released
|
||||
if (SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], 4 ) && minus_pressed[joy_n]==1) minus_pressed[joy_n] = 0; //Pressed
|
||||
if (!SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], 4 ) && minus_pressed[joy_n]==0) return; //Released
|
||||
#else //HW_RVL - WIN // Wii button "-"
|
||||
if (!SDL_JoystickGetButton(ordenador.joystick_sdl[0], 4) &&
|
||||
!SDL_JoystickGetButton(ordenador.joystick_sdl[0], 17) && minus_pressed==2 ) minus_pressed=1; //Released
|
||||
if ((SDL_JoystickGetButton(ordenador.joystick_sdl[0], 4) ||
|
||||
SDL_JoystickGetButton(ordenador.joystick_sdl[0], 17)) && minus_pressed==1) minus_pressed = 0; //Pressed
|
||||
if (!SDL_JoystickGetButton(ordenador.joystick_sdl[0], 4) &&
|
||||
!SDL_JoystickGetButton(ordenador.joystick_sdl[0], 17) && minus_pressed==0 ) return; //Released
|
||||
if (!SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], 4) &&
|
||||
!SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], 17) && minus_pressed[joy_n]==2) minus_pressed[joy_n]=1; //Released
|
||||
if ((SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], 4) ||
|
||||
SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], 17)) && minus_pressed[joy_n]==1) minus_pressed[joy_n] = 0; //Pressed
|
||||
if (!SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], 4) &&
|
||||
!SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], 17) && minus_pressed[joy_n]==0) return; //Released
|
||||
#endif
|
||||
|
||||
}
|
||||
memset(&evento,0, sizeof(SDL_Event));
|
||||
SDL_PollEvent (&evento);
|
||||
|
||||
@ -1276,17 +1279,19 @@ inline void read_keyboard () {
|
||||
|
||||
SDL_JoystickUpdate();
|
||||
|
||||
for(joy_n=0;joy_n<ordenador.joystick_number;joy_n++)
|
||||
{
|
||||
#ifdef HW_DOL
|
||||
if (SDL_JoystickGetButton(ordenador.joystick_sdl[0], 7)) //Gamecube button "Start"
|
||||
if (SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], 7)) //Gamecube button "Start"
|
||||
{if (ordenador.vk_is_active) virtkey_ir_deactivate();main_menu(); }
|
||||
if (SDL_JoystickGetButton(ordenador.joystick_sdl[0], 4)) //Gamecube button "Z"
|
||||
if (SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], 4)) //Gamecube button "Z"
|
||||
pause();
|
||||
#else //HW_RVL - WIN
|
||||
if (SDL_JoystickGetButton(ordenador.joystick_sdl[0], 6) ||//Wii button "Home"
|
||||
SDL_JoystickGetButton(ordenador.joystick_sdl[0], 19))
|
||||
if (SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], 6) ||//Wii button "Home"
|
||||
SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], 19))
|
||||
{if (ordenador.vk_is_active) virtkey_ir_deactivate();main_menu(); }
|
||||
if (SDL_JoystickGetButton(ordenador.joystick_sdl[0], 4) ||//Wii button "-"
|
||||
SDL_JoystickGetButton(ordenador.joystick_sdl[0], 17))
|
||||
if (SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], 4) ||//Wii button "-"
|
||||
SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], 17))
|
||||
pause();
|
||||
#endif
|
||||
|
||||
@ -1294,15 +1299,13 @@ inline void read_keyboard () {
|
||||
if (!ordenador.vk_auto)
|
||||
{
|
||||
int SDL_PrivateMouseMotion(Uint8 buttonstate, int relative, Sint16 x, Sint16 y);
|
||||
if (SDL_JoystickGetAxis(ordenador.joystick_sdl[0], 2) > 16384) SDL_PrivateMouseMotion(0,1,4/RATIO,0); //C-stick Horizontal axix
|
||||
if (SDL_JoystickGetAxis(ordenador.joystick_sdl[0], 2) < -16384) SDL_PrivateMouseMotion(0,1,-4/RATIO,0); //C-stick Horizontal axix
|
||||
if (SDL_JoystickGetAxis(ordenador.joystick_sdl[0], 3) > 16384) SDL_PrivateMouseMotion(0,1,0,4/RATIO); //C-stick vertical axix
|
||||
if (SDL_JoystickGetAxis(ordenador.joystick_sdl[0], 3) < -16384) SDL_PrivateMouseMotion(0,1,0,-4/RATIO); //C-stick vertical axix
|
||||
if (SDL_JoystickGetAxis(ordenador.joystick_sdl[joy_n], 2) > 16384) SDL_PrivateMouseMotion(0,1,4/RATIO,0); //C-stick Horizontal axix
|
||||
if (SDL_JoystickGetAxis(ordenador.joystick_sdl[joy_n], 2) < -16384) SDL_PrivateMouseMotion(0,1,-4/RATIO,0); //C-stick Horizontal axix
|
||||
if (SDL_JoystickGetAxis(ordenador.joystick_sdl[joy_n], 3) > 16384) SDL_PrivateMouseMotion(0,1,0,4/RATIO); //C-stick vertical axix
|
||||
if (SDL_JoystickGetAxis(ordenador.joystick_sdl[joy_n], 3) < -16384) SDL_PrivateMouseMotion(0,1,0,-4/RATIO); //C-stick vertical axix
|
||||
}
|
||||
#endif
|
||||
|
||||
for(joy_n=0;joy_n<ordenador.joystick_number;joy_n++)
|
||||
{
|
||||
joy_axis_x[joy_n] = SDL_JoystickGetAxis(ordenador.joystick_sdl[joy_n], 0);
|
||||
joy_axis_y[joy_n] = SDL_JoystickGetAxis(ordenador.joystick_sdl[joy_n], 1);
|
||||
|
||||
@ -1777,24 +1780,31 @@ inline void read_keyboard () {
|
||||
|
||||
//VK activation/deactivation
|
||||
|
||||
static char old_plus_button;
|
||||
char plus_button;
|
||||
|
||||
plus_button= SDL_JoystickGetButton(ordenador.joystick_sdl[0], 5) || //Wii button "+" - Gamecube "R"
|
||||
SDL_JoystickGetButton(ordenador.joystick_sdl[0], 18);
|
||||
static char old_plus_button[2];
|
||||
char plus_button[2];
|
||||
|
||||
|
||||
if (!ordenador.vk_auto && plus_button && !old_plus_button)
|
||||
if (!ordenador.vk_auto)
|
||||
for(joy_n=0;joy_n<ordenador.joystick_number;joy_n++)
|
||||
{
|
||||
plus_button[joy_n] = SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], 5) || //Wii button "+" - Gamecube "R"
|
||||
SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], 18);
|
||||
|
||||
if (plus_button[joy_n] && !old_plus_button[joy_n])
|
||||
{if (!ordenador.vk_is_active) virtkey_ir_activate(); else virtkey_ir_deactivate();}
|
||||
|
||||
if (ordenador.vk_auto)
|
||||
|
||||
old_plus_button[joy_n] = plus_button[joy_n];
|
||||
}
|
||||
|
||||
else //Auto VK
|
||||
{
|
||||
#ifdef HW_RVL
|
||||
WPADData *wd;
|
||||
wd = WPAD_Data(0); //only wiimote 0
|
||||
if ((wd->ir.valid)&&(!ordenador.vk_is_active)) virtkey_ir_activate();
|
||||
if ((!wd->ir.valid)&&(ordenador.vk_is_active)) virtkey_ir_deactivate();
|
||||
#else //WH_DOL - Win
|
||||
WPADData *wd0, *wd1;
|
||||
wd0 = WPAD_Data(0); //wiimote 0
|
||||
wd1 = WPAD_Data(1); //wiimote 1
|
||||
if (((wd0->ir.valid)||(wd1->ir.valid))&&(!ordenador.vk_is_active)) virtkey_ir_activate();
|
||||
if ((!wd0->ir.valid)&&(!wd1->ir.valid)&&(ordenador.vk_is_active)) virtkey_ir_deactivate();
|
||||
#else //Win
|
||||
int x=0,y=0 ;
|
||||
SDL_GetMouseState(&x,&y);
|
||||
if ((x>64/RATIO)&&(x<576/RATIO)&&(y>90/RATIO)&&(y<390/RATIO))
|
||||
@ -1807,7 +1817,6 @@ inline void read_keyboard () {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
old_plus_button = plus_button;
|
||||
|
||||
if (ordenador.vk_is_active) virtkey_ir_run();
|
||||
|
||||
|
@ -559,6 +559,7 @@ if (sound_type==SOUND_SDL)
|
||||
if(SDL_NumJoysticks()>0){
|
||||
// Open joystick
|
||||
ordenador.joystick_number = SDL_NumJoysticks();
|
||||
printf("Found %d joysticks \n", ordenador.joystick_number);
|
||||
if (ordenador.joystick_number>2) ordenador.joystick_number = 2; //Open max 2 joysticks
|
||||
printf("Try to open %d joysticks \n", ordenador.joystick_number);
|
||||
for (bucle=0;bucle<ordenador.joystick_number;bucle++) {
|
||||
|
@ -1638,7 +1638,7 @@ int parse_poke (const char *filename)
|
||||
k=0;
|
||||
|
||||
while (!((k & KEY_ESCAPE)||(k & KEY_SELECT)))
|
||||
{k = menu_wait_key_press();}
|
||||
{k = menu_wait_key_press(NULL);}
|
||||
|
||||
SDL_FillRect(screen, &banner, SDL_MapRGB(screen->format, 0, 0, 0));
|
||||
|
||||
@ -1709,7 +1709,7 @@ int parse_poke (const char *filename)
|
||||
k=0;
|
||||
|
||||
while (!(k & KEY_ESCAPE)&&(ritorno==0))
|
||||
{k = menu_wait_key_press();}
|
||||
{k = menu_wait_key_press(NULL);}
|
||||
play_click(2);
|
||||
|
||||
fclose(fpoke);
|
||||
|
@ -156,7 +156,7 @@ int msgInfo(char *text, int duration, SDL_Rect *irc)
|
||||
SDL_FillRect(real_screen, &brc, SDL_MapRGB(real_screen->format, 0x00, 0x80, 0x00));
|
||||
menu_print_font(real_screen, 0,0,0, FULL_DISPLAY_X/2-w, Y+h*2, "OK",FONT_NORM,64);
|
||||
SDL_UpdateRect(real_screen, brc.x, brc.y, brc.w, brc.h);
|
||||
while (!(KEY_SELECT & menu_wait_key_press())) {}
|
||||
while (!(KEY_SELECT & menu_wait_key_press(NULL))) {}
|
||||
|
||||
}
|
||||
|
||||
@ -232,7 +232,7 @@ int msgYesNo(char *text, int default_opt, int x, int y)
|
||||
SDL_UpdateRect(real_screen, brc.x, brc.y, brc.w,brc.h);
|
||||
|
||||
//SDL_Flip(real_screen);
|
||||
key = menu_wait_key_press();
|
||||
key = menu_wait_key_press(NULL);
|
||||
if (key & KEY_SELECT)
|
||||
{
|
||||
play_click(1);
|
||||
@ -1145,7 +1145,7 @@ static void menu_fini(menu_t *p_menu)
|
||||
free(p_menu->p_submenus);
|
||||
}
|
||||
|
||||
uint32_t menu_wait_key_press()
|
||||
uint32_t menu_wait_key_press(int *joy_n_p)
|
||||
{
|
||||
SDL_Event ev;
|
||||
uint32_t keys = 0;
|
||||
@ -1157,18 +1157,8 @@ uint32_t menu_wait_key_press()
|
||||
static int joy_keys_changed;
|
||||
static int joy_keys_last;
|
||||
static int joy_bottons_last[2][8];
|
||||
SDL_JoystickUpdate();
|
||||
|
||||
#if defined(HW_RVL) || defined(HW_DOL)
|
||||
if (!ordenador.vk_auto)
|
||||
{
|
||||
int SDL_PrivateMouseMotion(Uint8 buttonstate, int relative, Sint16 x, Sint16 y);
|
||||
if (SDL_JoystickGetAxis(ordenador.joystick_sdl[0], 2) > 16384) SDL_PrivateMouseMotion(0,1,4/RATIO,0); //C-stick Horizontal axix
|
||||
if (SDL_JoystickGetAxis(ordenador.joystick_sdl[0], 2) < -16384) SDL_PrivateMouseMotion(0,1,-4/RATIO,0); //C-stick Horizontal axix
|
||||
if (SDL_JoystickGetAxis(ordenador.joystick_sdl[0], 3) > 16384) SDL_PrivateMouseMotion(0,1,0,4/RATIO); //C-stick vertical axix
|
||||
if (SDL_JoystickGetAxis(ordenador.joystick_sdl[0], 3) < -16384) SDL_PrivateMouseMotion(0,1,0,-4/RATIO); //C-stick vertical axix
|
||||
}
|
||||
#endif
|
||||
SDL_JoystickUpdate();
|
||||
|
||||
/* Wii-specific, sorry */
|
||||
for (nr = 0; nr < ordenador.joystick_number; nr++) {
|
||||
@ -1176,6 +1166,16 @@ uint32_t menu_wait_key_press()
|
||||
if (!joy)
|
||||
continue;
|
||||
|
||||
#if defined(HW_RVL) || defined(HW_DOL)
|
||||
if (!ordenador.vk_auto)
|
||||
{
|
||||
int SDL_PrivateMouseMotion(Uint8 buttonstate, int relative, Sint16 x, Sint16 y);
|
||||
if (SDL_JoystickGetAxis(ordenador.joystick_sdl[nr], 2) > 16384) SDL_PrivateMouseMotion(0,1,4/RATIO,0); //C-stick Horizontal axix
|
||||
if (SDL_JoystickGetAxis(ordenador.joystick_sdl[nr], 2) < -16384) SDL_PrivateMouseMotion(0,1,-4/RATIO,0); //C-stick Horizontal axix
|
||||
if (SDL_JoystickGetAxis(ordenador.joystick_sdl[nr], 3) > 16384) SDL_PrivateMouseMotion(0,1,0,4/RATIO); //C-stick vertical axix
|
||||
if (SDL_JoystickGetAxis(ordenador.joystick_sdl[nr], 3) < -16384) SDL_PrivateMouseMotion(0,1,0,-4/RATIO); //C-stick vertical axix
|
||||
}
|
||||
#endif
|
||||
hats = SDL_JoystickNumHats (joy);
|
||||
for (i = 0; i < hats; i++) {
|
||||
Uint8 v = SDL_JoystickGetHat (joy, i);
|
||||
@ -1225,9 +1225,16 @@ uint32_t menu_wait_key_press()
|
||||
joy_bottons_last[nr][5] =SDL_JoystickGetButton(joy, 11) ; /* CX */
|
||||
joy_bottons_last[nr][6] =SDL_JoystickGetButton(joy, 12) ; /* CY */
|
||||
joy_bottons_last[nr][7] =SDL_JoystickGetButton(joy, 1) ; /* B */
|
||||
}
|
||||
|
||||
joy_keys_changed = keys != joy_keys_last;
|
||||
|
||||
if (joy_keys_changed&&keys)
|
||||
{
|
||||
if (joy_n_p) *joy_n_p = nr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
joy_keys_last = keys;
|
||||
if (!joy_keys_changed)
|
||||
keys = 0;
|
||||
@ -1333,7 +1340,7 @@ static int menu_select_internal(SDL_Surface *screen,
|
||||
menu_draw(screen, p_menu, 0, font_type, draw_scr);
|
||||
SDL_Flip(screen);
|
||||
|
||||
keys = menu_wait_key_press();
|
||||
keys = menu_wait_key_press(NULL);
|
||||
|
||||
quit_thread = 1;
|
||||
|
||||
|
@ -58,7 +58,7 @@ const char *menu_select_file(char *dir_path,const char *selected_file, int draw_
|
||||
const char *menu_select_browser(unsigned int tape_pos);
|
||||
const char *menu_select_browser_rzx();
|
||||
|
||||
uint32_t menu_wait_key_press();
|
||||
uint32_t menu_wait_key_press(int *joy_n_p);
|
||||
|
||||
void msgKill(SDL_Rect *rc);
|
||||
int msgInfo(char *text, int duration, SDL_Rect *rc);
|
||||
|
Loading…
Reference in New Issue
Block a user