From 513da5147c039011d24e56af382b3edacacc3870 Mon Sep 17 00:00:00 2001 From: Fabio Olimpieri Date: Tue, 10 Jan 2017 14:55:08 +0100 Subject: [PATCH] Mouse pointer moved by joystick if auto vk option is off, more keys to bind to buttons in windows port --- README | 2 +- README_WIN.txt | 27 +++++++++------------------ src/computer.c | 19 +++++++++++++------ src/gui_sdl.c | 18 +++++++++++++----- src/menu_sdl.c | 5 ++++- 5 files changed, 40 insertions(+), 31 deletions(-) diff --git a/README b/README index e4826c4..a6b0529 100644 --- a/README +++ b/README @@ -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. -There is also a gamecube port. +There are also a windows and a gamecube port. The program uses the SDL Wii library. diff --git a/README_WIN.txt b/README_WIN.txt index 3d11443..fe94660 100644 --- a/README_WIN.txt +++ b/README_WIN.txt @@ -1,5 +1,6 @@ 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: @@ -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. -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 ************* -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. 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). * 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 button 2 or ESC key to step back. +Gamepad button 2 or ESC key to step back. * In Game -Gamepad pad for the yostick emulation. +Gamepad joystick for the yostick emulation. 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 diff --git a/src/computer.c b/src/computer.c index 5f3777c..4dc0011 100644 --- a/src/computer.c +++ b/src/computer.c @@ -108,10 +108,14 @@ void computer_init () { //Called only on start-up ordenador.joypad_as_joystick[1]= 1; #ifdef HW_RVL ordenador.vk_auto = 1; //auto Vk -#else //HW_DOL - WIN - ordenador.vk_auto = 0; //Vk called by + -#endif 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[1] = 0; ordenador.turbo = 1; //auto turbo @@ -1275,7 +1279,7 @@ inline void read_keyboard () { #ifdef HW_DOL if (SDL_JoystickGetButton(ordenador.joystick_sdl[0], 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[0], 4)) //Gamecube button "Z" pause(); #else //HW_RVL - WIN if (SDL_JoystickGetButton(ordenador.joystick_sdl[0], 6) ||//Wii button "Home" @@ -1286,12 +1290,15 @@ inline void read_keyboard () { pause(); #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); 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 for(joy_n=0;joy_n 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 /* Wii-specific, sorry */