mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-22 11:29:24 +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"
|
#include "sysdeps.h"
|
||||||
#if defined(GEKKO)
|
#if defined(GEKKO)
|
||||||
# include <ogc/system.h>
|
# include <ogc/system.h>
|
||||||
|
# include <wiiuse/wpad.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
@ -976,6 +977,54 @@ uint8 C64::poll_joystick_buttons(int port, uint8 *table, bool *has_event)
|
|||||||
}
|
}
|
||||||
if (kc == JOY_NONE)
|
if (kc == JOY_NONE)
|
||||||
continue;
|
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)
|
if (table[kc] == 0)
|
||||||
table[kc] = cur ? 2 : 1;
|
table[kc] = cur ? 2 : 1;
|
||||||
|
@ -109,6 +109,7 @@ Prefs::Prefs()
|
|||||||
SystemKeys = true;
|
SystemKeys = true;
|
||||||
ShowLEDs = true;
|
ShowLEDs = true;
|
||||||
Usbport = false;
|
Usbport = false;
|
||||||
|
Rumble = false;
|
||||||
|
|
||||||
this->SetupJoystickDefaults();
|
this->SetupJoystickDefaults();
|
||||||
|
|
||||||
@ -529,7 +530,9 @@ void Prefs::Load(const char *filename)
|
|||||||
else if (!strcmp(keyword, "CursorKeysForJoystick"))
|
else if (!strcmp(keyword, "CursorKeysForJoystick"))
|
||||||
CursorKeysForJoystick = !strcmp(value, "TRUE");
|
CursorKeysForJoystick = !strcmp(value, "TRUE");
|
||||||
else if (!strcmp(keyword, "Usbport"))
|
else if (!strcmp(keyword, "Usbport"))
|
||||||
Usbport = !strcmp(value, "TRUE");
|
Usbport = !strcmp(value, "TRUE");
|
||||||
|
else if (!strcmp(keyword, "Rumble"))
|
||||||
|
Rumble = !strcmp(value, "TRUE");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(file);
|
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, strcmp(Theme, TheDefaultPrefs.Theme) != 0, "Theme = %s\n", Theme);
|
||||||
maybe_write(file, CursorKeysForJoystick != TheDefaultPrefs.CursorKeysForJoystick, "CursorKeysForJoystick = %s\n", CursorKeysForJoystick ? "TRUE" : "FALSE");
|
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, Usbport != TheDefaultPrefs.Usbport, "Usbport = %s\n", Usbport ? "TRUE" : "FALSE");
|
||||||
|
maybe_write(file, Rumble != TheDefaultPrefs.Rumble, "Rumble = %s\n", Rumble ? "TRUE" : "FALSE");
|
||||||
fclose(file);
|
fclose(file);
|
||||||
ThePrefsOnDisk = *this;
|
ThePrefsOnDisk = *this;
|
||||||
return true;
|
return true;
|
||||||
@ -654,7 +658,7 @@ bool Prefs::Save(const char *filename)
|
|||||||
/*
|
/*
|
||||||
* Save game preferences to file
|
* Save game preferences to file
|
||||||
* true: success, false: error
|
* 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++)
|
for (int i = 0; i < MAX_JOYSTICK_BUTTONS; i++)
|
||||||
maybe_write(file, true, "JoystickButtons%d = %d\n", i, JoystickButtons[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, "CursorKeysForJoystick = %s\n", CursorKeysForJoystick ? "TRUE" : "FALSE");
|
||||||
|
maybe_write(file, true, "Rumble = %s\n", Rumble ? "TRUE" : "FALSE");
|
||||||
fclose(file);
|
fclose(file);
|
||||||
ThePrefsOnDisk = *this;
|
ThePrefsOnDisk = *this;
|
||||||
return true;
|
return true;
|
||||||
|
@ -156,6 +156,7 @@ public:
|
|||||||
bool SystemKeys; // Enable system keys and menu keys (Win32)
|
bool SystemKeys; // Enable system keys and menu keys (Win32)
|
||||||
bool ShowLEDs; // Show LEDs (Win32)
|
bool ShowLEDs; // Show LEDs (Win32)
|
||||||
bool Usbport; // Load from usb port
|
bool Usbport; // Load from usb port
|
||||||
|
bool Rumble; // Enable Rumble for WII
|
||||||
|
|
||||||
uint32 MsPerFrame;
|
uint32 MsPerFrame;
|
||||||
|
|
||||||
|
@ -112,19 +112,27 @@ public:
|
|||||||
break;
|
break;
|
||||||
case 7: /* Game info */
|
case 7: /* Game info */
|
||||||
Gui::gui->pushView(Gui::gui->giv);
|
Gui::gui->pushView(Gui::gui->giv);
|
||||||
|
break;
|
||||||
|
case 8: /* Help */
|
||||||
|
Gui::gui->pushDialogueBox(new DialogueBox(frodo_help));
|
||||||
break;
|
break;
|
||||||
case 8: /* Networking */
|
case 9: /* Networking */
|
||||||
Gui::gui->pushView(Gui::gui->nv);
|
Gui::gui->pushView(Gui::gui->nv);
|
||||||
break;
|
break;
|
||||||
case 9: /* Options */
|
case 10: /* Options */
|
||||||
Gui::gui->pushView(Gui::gui->ov);
|
Gui::gui->pushView(Gui::gui->ov);
|
||||||
break;
|
break;
|
||||||
case 10: /* Save Prefs */
|
case 11: /* Save Prefs */
|
||||||
ThePrefs = *Gui::gui->np;
|
ThePrefs = *Gui::gui->np;
|
||||||
ThePrefs.Save(ThePrefs.PrefsPath);
|
ThePrefs.Save(ThePrefs.PrefsPath);
|
||||||
Gui::gui->pushDialogueBox(new DialogueBox(save_prefs_done));
|
Gui::gui->pushDialogueBox(new DialogueBox(save_prefs_done));
|
||||||
break;
|
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);
|
DialogueBox *exit_dialogue = new DialogueBox(exit_dialogue_messages);
|
||||||
exit_dialogue->registerListener(new ExitListener());
|
exit_dialogue->registerListener(new ExitListener());
|
||||||
Gui::gui->pushDialogueBox(exit_dialogue);
|
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",
|
/*00*/ "File",
|
||||||
/*01*/ "^|Start|Insert",
|
/*01*/ "^|Start|Insert",
|
||||||
/*02*/ "States",
|
/*02*/ "States",
|
||||||
@ -147,14 +147,16 @@ const char *main_menu_messages[13] = {
|
|||||||
/*05*/ "^|Type|Bind|Toggle crsr",
|
/*05*/ "^|Type|Bind|Toggle crsr",
|
||||||
/*06*/ " ",
|
/*06*/ " ",
|
||||||
/*07*/ "Game info",
|
/*07*/ "Game info",
|
||||||
/*08*/ "Networking",
|
/*08*/ "Help",
|
||||||
/*09*/ "Options",
|
/*09*/ "Networking",
|
||||||
/*10*/ "Save prefs",
|
/*10*/ "Options",
|
||||||
/*11*/ "Quit",
|
/*11*/ "Save prefs",
|
||||||
|
/*12*/ "Reset",
|
||||||
|
/*13*/ "Quit",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
const char **main_menu_help[13] = {
|
const char **main_menu_help[15] = {
|
||||||
(const char*[]){
|
(const char*[]){
|
||||||
"Insert a disc/tape or",
|
"Insert a disc/tape or",
|
||||||
"start it",
|
"start it",
|
||||||
@ -183,6 +185,11 @@ const char **main_menu_help[13] = {
|
|||||||
"screenshots etc)",
|
"screenshots etc)",
|
||||||
NULL,
|
NULL,
|
||||||
},
|
},
|
||||||
|
(const char*[]){
|
||||||
|
"Help and keyboard.",
|
||||||
|
"shortcuts",
|
||||||
|
NULL,
|
||||||
|
},
|
||||||
(const char*[]){
|
(const char*[]){
|
||||||
"Network setup for playing",
|
"Network setup for playing",
|
||||||
"C64 games against other",
|
"C64 games against other",
|
||||||
@ -196,6 +203,10 @@ const char **main_menu_help[13] = {
|
|||||||
(const char*[]){
|
(const char*[]){
|
||||||
"Save general preferences",
|
"Save general preferences",
|
||||||
NULL,
|
NULL,
|
||||||
|
},
|
||||||
|
(const char*[]){
|
||||||
|
"Reset the C=64",
|
||||||
|
NULL,
|
||||||
},
|
},
|
||||||
(const char*[]){
|
(const char*[]){
|
||||||
"Quit Frodo",
|
"Quit Frodo",
|
||||||
@ -206,20 +217,20 @@ const char **main_menu_help[13] = {
|
|||||||
|
|
||||||
|
|
||||||
const char *options_menu_messages[15] = {
|
const char *options_menu_messages[15] = {
|
||||||
/*00*/ "Help",
|
/*00*/ "Map Controller 1 to:",
|
||||||
/*01*/ " ",
|
/*01*/ "^|Port 1|Port 2",
|
||||||
/*02*/ "Map Controller 1 to:",
|
/*02*/ "True 1541 emulation",
|
||||||
/*03*/ "^|Port 1|Port 2",
|
/*03*/ "^|ON|OFF",
|
||||||
/*04*/ "True 1541 emulation",
|
/*04*/ "Display",
|
||||||
/*05*/ "^|ON|OFF",
|
/*05*/ "^|window|fullscreen",
|
||||||
/*06*/ "Display",
|
/*06*/ "Speed (approx. %)",
|
||||||
/*07*/ "^|window|fullscreen",
|
/*07*/ "^|95|100|110",
|
||||||
/*08*/ "Speed (approx. %)",
|
/*08*/ "Usb port",
|
||||||
/*09*/ "^|95|100|110",
|
/*09*/ "^|ON|OFF",
|
||||||
/*10*/ "Usb port",
|
/*10*/ "Rumble",
|
||||||
/*11*/ "^|ON|OFF",
|
/*11*/ "^|ON|OFF",
|
||||||
/*12*/ "Setup GUI theme",
|
/*12*/ " ",
|
||||||
/*13*/ "Reset the C=64",
|
/*13*/ "Setup GUI theme",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -236,12 +247,7 @@ const char *bind_key_menu_messages[9] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char **options_menu_help[15] = {
|
const char **options_menu_help[15] = {
|
||||||
(const char*[]){
|
|
||||||
"Help and keyboard.",
|
|
||||||
"shortcuts",
|
|
||||||
NULL,
|
|
||||||
},
|
|
||||||
NULL,
|
|
||||||
(const char*[]){
|
(const char*[]){
|
||||||
"Switch controller to",
|
"Switch controller to",
|
||||||
"C64 joystick port",
|
"C64 joystick port",
|
||||||
@ -280,12 +286,14 @@ const char **options_menu_help[15] = {
|
|||||||
},
|
},
|
||||||
NULL,
|
NULL,
|
||||||
(const char*[]){
|
(const char*[]){
|
||||||
"Setup theme for the Frodo",
|
"Enable wiimote rumble",
|
||||||
"menus.",
|
|
||||||
NULL,
|
NULL,
|
||||||
},
|
},
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
(const char*[]){
|
(const char*[]){
|
||||||
"Reset the c64.",
|
"Setup theme for the Frodo",
|
||||||
|
"menus.",
|
||||||
NULL,
|
NULL,
|
||||||
},
|
},
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -22,21 +22,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void selectCallback(int which)
|
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 */
|
/* Select theme */
|
||||||
else if (which == 12)
|
|
||||||
|
if (which == 13)
|
||||||
{
|
{
|
||||||
Gui::gui->tv->setDirectory(Gui::gui->theme_base_path);
|
Gui::gui->tv->setDirectory(Gui::gui->theme_base_path);
|
||||||
Gui::gui->pushView(Gui::gui->tv);
|
Gui::gui->pushView(Gui::gui->tv);
|
||||||
@ -77,11 +66,13 @@ public:
|
|||||||
panic("Impossible submenu value: %d\n", this->p_submenus[3].sel);
|
panic("Impossible submenu value: %d\n", this->p_submenus[3].sel);
|
||||||
}
|
}
|
||||||
Gui::gui->np->Usbport = !this->p_submenus[4].sel;
|
Gui::gui->np->Usbport = !this->p_submenus[4].sel;
|
||||||
|
Gui::gui->np->Rumble = !this->p_submenus[5].sel;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateSubmenus()
|
void updateSubmenus()
|
||||||
{
|
{
|
||||||
int submenu_defs[5];
|
int submenu_defs[6];
|
||||||
|
|
||||||
submenu_defs[0] = Gui::gui->np->JoystickSwap == true ? 0 : 1;
|
submenu_defs[0] = Gui::gui->np->JoystickSwap == true ? 0 : 1;
|
||||||
submenu_defs[1] = !Gui::gui->np->Emul1541Proc;
|
submenu_defs[1] = !Gui::gui->np->Emul1541Proc;
|
||||||
@ -99,6 +90,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
submenu_defs[4] = !Gui::gui->np->Usbport;
|
submenu_defs[4] = !Gui::gui->np->Usbport;
|
||||||
|
submenu_defs[5] = !Gui::gui->np->Rumble;
|
||||||
this->setText(options_menu_messages, submenu_defs);
|
this->setText(options_menu_messages, submenu_defs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user