mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-25 12:56:59 +01:00
Added Wiimote Rumble support
Moved "reset c64" to main menu Moved "Help" to main main menu
This commit is contained in:
parent
41d0826a4a
commit
8653c75399
@ -21,6 +21,7 @@
|
||||
#include "sysdeps.h"
|
||||
#if defined(GEKKO)
|
||||
# include <ogc/system.h>
|
||||
# include <wiiuse/wpad.h>
|
||||
#endif
|
||||
|
||||
#include "Display.h"
|
||||
@ -977,6 +978,54 @@ uint8 C64::poll_joystick_buttons(int port, uint8 *table, bool *has_event)
|
||||
if (kc == JOY_NONE)
|
||||
continue;
|
||||
|
||||
#ifdef GEKKO
|
||||
//Wiimote Rumble
|
||||
static Uint32 last_ticks[2];
|
||||
Uint32 cur_ticks;
|
||||
static bool rumble_on[2];
|
||||
static bool fire_pressed[2];
|
||||
static int joystickbutton_fire[2]={-1,-1};
|
||||
|
||||
|
||||
if (!Gui::gui->is_active && !Gui::gui->kbd && ThePrefs.Rumble)
|
||||
|
||||
{
|
||||
cur_ticks = SDL_GetTicks();
|
||||
|
||||
if (cur && (kc == 0x50) && !rumble_on[port] && !fire_pressed[port])
|
||||
{
|
||||
WPAD_Rumble(port, true);
|
||||
last_ticks[port]= cur_ticks;
|
||||
rumble_on[port]=true;
|
||||
fire_pressed[port]=true;
|
||||
joystickbutton_fire[port]=i;
|
||||
}
|
||||
|
||||
if (joystickbutton_fire[port] == i)
|
||||
{
|
||||
if (!cur && (kc == 0x50) && rumble_on[port] && fire_pressed[port])
|
||||
{
|
||||
rumble_on[port]=true;
|
||||
fire_pressed[port]=false;
|
||||
}
|
||||
|
||||
if (((cur_ticks - last_ticks[port] > 150) && rumble_on[port] && !fire_pressed[port]) ||(!cur && (kc == 0x50) && !rumble_on[port] && fire_pressed[port]))
|
||||
{
|
||||
WPAD_Rumble(port, false);
|
||||
rumble_on[port]=false;
|
||||
fire_pressed[port]=false;
|
||||
joystickbutton_fire[port]=-1;
|
||||
}
|
||||
if ((cur_ticks - last_ticks[port] > 150) && rumble_on[port] && fire_pressed[port])
|
||||
{
|
||||
WPAD_Rumble(port, false);
|
||||
rumble_on[port]=false;
|
||||
fire_pressed[port]=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (table[kc] == 0)
|
||||
table[kc] = cur ? 2 : 1;
|
||||
/* Special case for joysticks: Each button can be pressed multiple times */
|
||||
|
@ -109,6 +109,7 @@ Prefs::Prefs()
|
||||
SystemKeys = true;
|
||||
ShowLEDs = true;
|
||||
Usbport = false;
|
||||
Rumble = false;
|
||||
|
||||
this->SetupJoystickDefaults();
|
||||
|
||||
@ -530,6 +531,8 @@ void Prefs::Load(const char *filename)
|
||||
CursorKeysForJoystick = !strcmp(value, "TRUE");
|
||||
else if (!strcmp(keyword, "Usbport"))
|
||||
Usbport = !strcmp(value, "TRUE");
|
||||
else if (!strcmp(keyword, "Rumble"))
|
||||
Rumble = !strcmp(value, "TRUE");
|
||||
}
|
||||
}
|
||||
fclose(file);
|
||||
@ -644,6 +647,7 @@ bool Prefs::Save(const char *filename)
|
||||
maybe_write(file, strcmp(Theme, TheDefaultPrefs.Theme) != 0, "Theme = %s\n", Theme);
|
||||
maybe_write(file, CursorKeysForJoystick != TheDefaultPrefs.CursorKeysForJoystick, "CursorKeysForJoystick = %s\n", CursorKeysForJoystick ? "TRUE" : "FALSE");
|
||||
maybe_write(file, Usbport != TheDefaultPrefs.Usbport, "Usbport = %s\n", Usbport ? "TRUE" : "FALSE");
|
||||
maybe_write(file, Rumble != TheDefaultPrefs.Rumble, "Rumble = %s\n", Rumble ? "TRUE" : "FALSE");
|
||||
fclose(file);
|
||||
ThePrefsOnDisk = *this;
|
||||
return true;
|
||||
@ -654,7 +658,7 @@ bool Prefs::Save(const char *filename)
|
||||
/*
|
||||
* Save game preferences to file
|
||||
* true: success, false: error
|
||||
* Save only drivepath, displaytype, joystikswap, emule 1541, joystickbutton, cursorkeys for joystick
|
||||
* Save only drivepath, displaytype, joystikswap, emule 1541, joystickbutton, cursorkeys for joystick,rumble
|
||||
*/
|
||||
|
||||
|
||||
@ -676,7 +680,7 @@ bool Prefs::Save_game(const char *filename)
|
||||
for (int i = 0; i < MAX_JOYSTICK_BUTTONS; i++)
|
||||
maybe_write(file, true, "JoystickButtons%d = %d\n", i, JoystickButtons[i]);
|
||||
maybe_write(file, true, "CursorKeysForJoystick = %s\n", CursorKeysForJoystick ? "TRUE" : "FALSE");
|
||||
|
||||
maybe_write(file, true, "Rumble = %s\n", Rumble ? "TRUE" : "FALSE");
|
||||
fclose(file);
|
||||
ThePrefsOnDisk = *this;
|
||||
return true;
|
||||
|
@ -156,6 +156,7 @@ public:
|
||||
bool SystemKeys; // Enable system keys and menu keys (Win32)
|
||||
bool ShowLEDs; // Show LEDs (Win32)
|
||||
bool Usbport; // Load from usb port
|
||||
bool Rumble; // Enable Rumble for WII
|
||||
|
||||
uint32 MsPerFrame;
|
||||
|
||||
|
@ -113,18 +113,26 @@ public:
|
||||
case 7: /* Game info */
|
||||
Gui::gui->pushView(Gui::gui->giv);
|
||||
break;
|
||||
case 8: /* Networking */
|
||||
case 8: /* Help */
|
||||
Gui::gui->pushDialogueBox(new DialogueBox(frodo_help));
|
||||
break;
|
||||
case 9: /* Networking */
|
||||
Gui::gui->pushView(Gui::gui->nv);
|
||||
break;
|
||||
case 9: /* Options */
|
||||
case 10: /* Options */
|
||||
Gui::gui->pushView(Gui::gui->ov);
|
||||
break;
|
||||
case 10: /* Save Prefs */
|
||||
case 11: /* Save Prefs */
|
||||
ThePrefs = *Gui::gui->np;
|
||||
ThePrefs.Save(ThePrefs.PrefsPath);
|
||||
Gui::gui->pushDialogueBox(new DialogueBox(save_prefs_done));
|
||||
break;
|
||||
case 11: /* Exit */
|
||||
case 12: /* Reset c64 */
|
||||
Gui::gui->status_bar->queueMessage("Resetting the C64");
|
||||
Gui::gui->exitMenu();
|
||||
TheC64->Reset();
|
||||
break;
|
||||
case 13: /* Exit */
|
||||
DialogueBox *exit_dialogue = new DialogueBox(exit_dialogue_messages);
|
||||
exit_dialogue->registerListener(new ExitListener());
|
||||
Gui::gui->pushDialogueBox(exit_dialogue);
|
||||
|
@ -138,7 +138,7 @@ const char *frodo_help[11] = {
|
||||
};
|
||||
|
||||
|
||||
const char *main_menu_messages[13] = {
|
||||
const char *main_menu_messages[15] = {
|
||||
/*00*/ "File",
|
||||
/*01*/ "^|Start|Insert",
|
||||
/*02*/ "States",
|
||||
@ -147,14 +147,16 @@ const char *main_menu_messages[13] = {
|
||||
/*05*/ "^|Type|Bind|Toggle crsr",
|
||||
/*06*/ " ",
|
||||
/*07*/ "Game info",
|
||||
/*08*/ "Networking",
|
||||
/*09*/ "Options",
|
||||
/*10*/ "Save prefs",
|
||||
/*11*/ "Quit",
|
||||
/*08*/ "Help",
|
||||
/*09*/ "Networking",
|
||||
/*10*/ "Options",
|
||||
/*11*/ "Save prefs",
|
||||
/*12*/ "Reset",
|
||||
/*13*/ "Quit",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char **main_menu_help[13] = {
|
||||
const char **main_menu_help[15] = {
|
||||
(const char*[]){
|
||||
"Insert a disc/tape or",
|
||||
"start it",
|
||||
@ -183,6 +185,11 @@ const char **main_menu_help[13] = {
|
||||
"screenshots etc)",
|
||||
NULL,
|
||||
},
|
||||
(const char*[]){
|
||||
"Help and keyboard.",
|
||||
"shortcuts",
|
||||
NULL,
|
||||
},
|
||||
(const char*[]){
|
||||
"Network setup for playing",
|
||||
"C64 games against other",
|
||||
@ -197,6 +204,10 @@ const char **main_menu_help[13] = {
|
||||
"Save general preferences",
|
||||
NULL,
|
||||
},
|
||||
(const char*[]){
|
||||
"Reset the C=64",
|
||||
NULL,
|
||||
},
|
||||
(const char*[]){
|
||||
"Quit Frodo",
|
||||
NULL,
|
||||
@ -206,20 +217,20 @@ const char **main_menu_help[13] = {
|
||||
|
||||
|
||||
const char *options_menu_messages[15] = {
|
||||
/*00*/ "Help",
|
||||
/*01*/ " ",
|
||||
/*02*/ "Map Controller 1 to:",
|
||||
/*03*/ "^|Port 1|Port 2",
|
||||
/*04*/ "True 1541 emulation",
|
||||
/*05*/ "^|ON|OFF",
|
||||
/*06*/ "Display",
|
||||
/*07*/ "^|window|fullscreen",
|
||||
/*08*/ "Speed (approx. %)",
|
||||
/*09*/ "^|95|100|110",
|
||||
/*10*/ "Usb port",
|
||||
/*00*/ "Map Controller 1 to:",
|
||||
/*01*/ "^|Port 1|Port 2",
|
||||
/*02*/ "True 1541 emulation",
|
||||
/*03*/ "^|ON|OFF",
|
||||
/*04*/ "Display",
|
||||
/*05*/ "^|window|fullscreen",
|
||||
/*06*/ "Speed (approx. %)",
|
||||
/*07*/ "^|95|100|110",
|
||||
/*08*/ "Usb port",
|
||||
/*09*/ "^|ON|OFF",
|
||||
/*10*/ "Rumble",
|
||||
/*11*/ "^|ON|OFF",
|
||||
/*12*/ "Setup GUI theme",
|
||||
/*13*/ "Reset the C=64",
|
||||
/*12*/ " ",
|
||||
/*13*/ "Setup GUI theme",
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -236,12 +247,7 @@ const char *bind_key_menu_messages[9] = {
|
||||
};
|
||||
|
||||
const char **options_menu_help[15] = {
|
||||
(const char*[]){
|
||||
"Help and keyboard.",
|
||||
"shortcuts",
|
||||
NULL,
|
||||
},
|
||||
NULL,
|
||||
|
||||
(const char*[]){
|
||||
"Switch controller to",
|
||||
"C64 joystick port",
|
||||
@ -280,12 +286,14 @@ const char **options_menu_help[15] = {
|
||||
},
|
||||
NULL,
|
||||
(const char*[]){
|
||||
"Setup theme for the Frodo",
|
||||
"menus.",
|
||||
"Enable wiimote rumble",
|
||||
NULL,
|
||||
},
|
||||
NULL,
|
||||
NULL,
|
||||
(const char*[]){
|
||||
"Reset the c64.",
|
||||
"Setup theme for the Frodo",
|
||||
"menus.",
|
||||
NULL,
|
||||
},
|
||||
NULL,
|
||||
|
@ -23,20 +23,9 @@ public:
|
||||
|
||||
virtual void selectCallback(int which)
|
||||
{
|
||||
if (which == 0)
|
||||
{
|
||||
Gui::gui->pushDialogueBox(new DialogueBox(frodo_help));
|
||||
return;
|
||||
}
|
||||
else if (which == 13)
|
||||
{
|
||||
Gui::gui->status_bar->queueMessage("Resetting the C64");
|
||||
Gui::gui->exitMenu();
|
||||
TheC64->Reset();
|
||||
return;
|
||||
}
|
||||
/* Select theme */
|
||||
else if (which == 12)
|
||||
|
||||
if (which == 13)
|
||||
{
|
||||
Gui::gui->tv->setDirectory(Gui::gui->theme_base_path);
|
||||
Gui::gui->pushView(Gui::gui->tv);
|
||||
@ -77,11 +66,13 @@ public:
|
||||
panic("Impossible submenu value: %d\n", this->p_submenus[3].sel);
|
||||
}
|
||||
Gui::gui->np->Usbport = !this->p_submenus[4].sel;
|
||||
Gui::gui->np->Rumble = !this->p_submenus[5].sel;
|
||||
|
||||
}
|
||||
|
||||
void updateSubmenus()
|
||||
{
|
||||
int submenu_defs[5];
|
||||
int submenu_defs[6];
|
||||
|
||||
submenu_defs[0] = Gui::gui->np->JoystickSwap == true ? 0 : 1;
|
||||
submenu_defs[1] = !Gui::gui->np->Emul1541Proc;
|
||||
@ -99,6 +90,7 @@ public:
|
||||
}
|
||||
|
||||
submenu_defs[4] = !Gui::gui->np->Usbport;
|
||||
submenu_defs[5] = !Gui::gui->np->Rumble;
|
||||
this->setText(options_menu_messages, submenu_defs);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user