Mouse pointer moved by joystick if auto vk option is off, more keys to bind to buttons in windows port

This commit is contained in:
Fabio Olimpieri 2017-01-10 14:55:08 +01:00
parent e0c62da7a6
commit 513da5147c
5 changed files with 40 additions and 31 deletions

2
README
View File

@ -7,7 +7,7 @@ The code has been ported to Wii and largely improved with many new features by O
FBZX Wii can be found on Github at github.com/Oibaf66/fbzx-wii. FBZX Wii can be found on Github at github.com/Oibaf66/fbzx-wii.
There is also a gamecube port. There are also a windows and a gamecube port.
The program uses the SDL Wii library. The program uses the SDL Wii library.

View File

@ -1,5 +1,6 @@
FBZX Wii was written to run on WII, for testing purpose FBZX Wii was adapted FBZX Wii was written to run on WII, for testing purpose FBZX Wii was adapted
to run also on Windows even if some WII features cannot be used. to run also on Windows. Even if some WII features cannot be used (i.e. rumble),
the emulator is fully usable.
These are the basic instructions: These are the basic instructions:
@ -11,39 +12,29 @@ You can try with higher values for turbo until you hear cracked sound.
The wiimote pointer is emulated by the mouse pointer. The wiimote pointer is emulated by the mouse pointer.
FBZX Wii has two GUIs: one is derived from FBZX and the other one is Wii specific. FBZX Wii has two GUIs: one is derived from the original FBZX and the other one is Wii specific.
************* *************
FBZX WII Menu FBZX WII Menu
************* *************
Menu key (it is the key near CTRL Rigth) or gamepad 7 key to access FBZX Wii menu. Menu key (it is the key near CTRL Rigth) or gamepad button 7 to access FBZX Wii menu.
Left ALT key to toggle Full Screen. Left ALT key to toggle Full Screen.
The virtual keyboard is accessed passing the mouse on the screen or through CTRL Rigth The virtual keyboard is accessed passing the mouse on the screen or through CTRL Rigth
or gamepad button 6 (it depends on the auto virtual ketboard option). or gamepad button 6 (it depends on the auto virtual ketboard option).
* In menu * In menu
Gamepad pad or keyboard keys for menu navigation. Gamepad joystick or keyboard keys for menu navigation.
Gamepad button 1 or Enter key to select. Gamepad button 1 or Enter key to select.
Gamepad button 1 button 2 or ESC key to step back. Gamepad button 2 or ESC key to step back.
* In Game * In Game
Gamepad pad for the yostick emulation. Gamepad joystick for the yostick emulation.
Gamepad button 1 for fire. Gamepad button 1 for fire.
Gamepad button 5 for pause.
Gamepad button 1-4 and 8-12 are configurable.
These are the associations between gamepad and Wii controllers keys:
Gamepad -------- WII
1 Wiimote A Button
2 Wiimote B Button
3 Wiimote 1 Button
4 Wiimote 2 Button
5 Wiimote - Button
6 Wiimote + Button
7 Wiimote HOME Button
8 Nunchuck Z Button
9 Nunchuck C Button
****************** ******************
Original FBZX Menu Original FBZX Menu

View File

@ -108,10 +108,14 @@ void computer_init () { //Called only on start-up
ordenador.joypad_as_joystick[1]= 1; ordenador.joypad_as_joystick[1]= 1;
#ifdef HW_RVL #ifdef HW_RVL
ordenador.vk_auto = 1; //auto Vk ordenador.vk_auto = 1; //auto Vk
#else //HW_DOL - WIN
ordenador.vk_auto = 0; //Vk called by +
#endif
ordenador.vk_rumble = 1; //enabled ordenador.vk_rumble = 1; //enabled
#elif defined(HW_DOL)
ordenador.vk_auto = 0; //Vk called by +
ordenador.vk_rumble = 0; //disabled
#else //WIN
ordenador.vk_auto = 1; //auto Vk
ordenador.vk_rumble = 0; //disabled
#endif
ordenador.rumble[0] = 0; ordenador.rumble[0] = 0;
ordenador.rumble[1] = 0; ordenador.rumble[1] = 0;
ordenador.turbo = 1; //auto turbo ordenador.turbo = 1; //auto turbo
@ -1275,7 +1279,7 @@ inline void read_keyboard () {
#ifdef HW_DOL #ifdef HW_DOL
if (SDL_JoystickGetButton(ordenador.joystick_sdl[0], 7)) //Gamecube button "Start" if (SDL_JoystickGetButton(ordenador.joystick_sdl[0], 7)) //Gamecube button "Start"
{if (ordenador.vk_is_active) virtkey_ir_deactivate();main_menu(); } {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[0], 4)) //Gamecube button "Z"
pause(); pause();
#else //HW_RVL - WIN #else //HW_RVL - WIN
if (SDL_JoystickGetButton(ordenador.joystick_sdl[0], 6) ||//Wii button "Home" if (SDL_JoystickGetButton(ordenador.joystick_sdl[0], 6) ||//Wii button "Home"
@ -1286,12 +1290,15 @@ inline void read_keyboard () {
pause(); pause();
#endif #endif
#ifdef HW_DOL #if defined(HW_RVL) || defined(HW_DOL)
if (!ordenador.vk_auto)
{
int SDL_PrivateMouseMotion(Uint8 buttonstate, int relative, Sint16 x, Sint16 y); 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], 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[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 #endif
for(joy_n=0;joy_n<ordenador.joystick_number;joy_n++) for(joy_n=0;joy_n<ordenador.joystick_number;joy_n++)
@ -1315,7 +1322,7 @@ inline void read_keyboard () {
SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], joybutton_n); SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], joybutton_n);
} }
#ifdef HW_RVL #ifndef HW_DOL // HW_RVL - WIN
for(joybutton_n=7;joybutton_n<17;joybutton_n++) for(joybutton_n=7;joybutton_n<17;joybutton_n++)
{ {
joybutton_matrix[joy_n][(ordenador.joybuttonkey[joy_n][joybutton_n])] = joybutton_matrix[joy_n][(ordenador.joybuttonkey[joy_n][joybutton_n])] =

View File

@ -168,13 +168,21 @@ static const char *input_messages[] = {
/*05*/ "^|Z|C", /*05*/ "^|Z|C",
/*06*/ "Bind key to Classic", /*06*/ "Bind key to Classic",
/*07*/ "^|a|b|x|y|L|R|Zl|Zr|+", /*07*/ "^|a|b|x|y|L|R|Zl|Zr|+",
#else //HW_DOL - WIN #elif defined(HW_DOL)
/*02*/ "Bind key to Controller", /*02*/ "Bind key to button",
/*03*/ "^|A|B|X|Y", /*03*/ "^|A|B|X|Y",
/*04*/ "Unused", /*04*/ "Unused",
/*05*/ "^|----", /*05*/ "^|----",
/*06*/ "Unused", /*06*/ "Unused",
/*07*/ "^|----", /*07*/ "^|----",
#else // WIN
/*02*/ "Bind key to button",
/*03*/ "^|1|2|3|4",
/*04*/ "Bind key to button",
/*05*/ "^|8|9",
/*06*/ "Bind key to button",
/*07*/ "^|10|11|12",
#endif #endif
/*08*/ "Bind key to D-pad", /*08*/ "Bind key to D-pad",
/*09*/ "^|Up|Down|Left|Right", /*09*/ "^|Up|Down|Left|Right",
@ -205,7 +213,7 @@ static const char *tools_messages[] = {
/*04*/ "Files source", /*04*/ "Files source",
#ifdef HW_RVL #ifdef HW_RVL
/*05*/ "^|default|sd|usb|smb|wos", /*05*/ "^|default|sd|usb|smb|wos",
#else //HW_DOL - Wii #else //HW_DOL - WIN
/*05*/ "^|default", /*05*/ "^|default",
#endif #endif
/*06*/ "Manage files", /*06*/ "Manage files",
@ -213,11 +221,11 @@ static const char *tools_messages[] = {
#ifdef HW_DOL #ifdef HW_DOL
/*08*/ "Unused", /*08*/ "Unused",
/*09*/ "^|----", /*09*/ "^|----",
#else //HW_RVL - Wii #else //HW_RVL - WIN
/*08*/ "Auto virtual keyboard", /*08*/ "Auto virtual keyboard",
/*09*/ "^|on|off", /*09*/ "^|on|off",
#endif #endif
/*10*/ "Keyboard rumble", /*10*/ "Virtual keyboard rumble",
/*11*/ "^|on|off", /*11*/ "^|on|off",
/*12*/ "Load poke file", /*12*/ "Load poke file",
/*13*/ "Insert poke", /*13*/ "Insert poke",

View File

@ -1159,12 +1159,15 @@ uint32_t menu_wait_key_press()
static int joy_bottons_last[2][8]; static int joy_bottons_last[2][8];
SDL_JoystickUpdate(); SDL_JoystickUpdate();
#ifdef HW_DOL #if defined(HW_RVL) || defined(HW_DOL)
if (!ordenador.vk_auto)
{
int SDL_PrivateMouseMotion(Uint8 buttonstate, int relative, Sint16 x, Sint16 y); 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], 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[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 #endif
/* Wii-specific, sorry */ /* Wii-specific, sorry */