mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-18 01:09:16 +01:00
db6517256e
Some menus or buttons might not work. (Thanks Airline38) L3+R3 to shutdown the pad. * Added PS3 controller support over USB, requires loader's IOS set to IOS58. Button mapped as Classic Controller. * Added a WiiU Auto aspect fixer based on current WiiU setting. * Added a WiiU Widescreen switcher in Features menu. Nintendont: * Fixed detection for nintendont v2.263+ issue 2294 * Added a WiiU Widescreen setting. issue 2296 Default value based on current WiiU aspect ratio settings. * Added a setting to choose Nincfg.bin behavior at launch issue 2297 Always delete; Always create; No change. * Removed unused game specific settings section (MGS2) * Renamed MCEmu ON setting to Multi * Added Disc launching feature * Added user prompt to select where MCEmu should be located when using Disc launching. The device is auto-detected if Gamecube source setting is set to SD or Main(USB) only. * Changed prompt type to warning if Nintendont version detection fails. Thanks to Airline38 for the WiiU pro base patch.
98 lines
1.4 KiB
C
98 lines
1.4 KiB
C
#include <stdio.h>
|
|
#include <ogcsys.h>
|
|
#include <ogc/pad.h>
|
|
|
|
#include "sys.h"
|
|
#include "wpad.h"
|
|
|
|
/* Constants */
|
|
#define MAX_WIIMOTES 4
|
|
|
|
extern u8 shutdown;
|
|
|
|
void __Wpad_PowerCallback(s32 chan)
|
|
{
|
|
/* Poweroff console */
|
|
shutdown = 1;
|
|
}
|
|
|
|
s32 Wpad_Init(void)
|
|
{
|
|
WUPC_Init();
|
|
s32 ret;
|
|
|
|
/* Initialize Wiimote subsystem */
|
|
ret = WPAD_Init();
|
|
if (ret < 0) return ret;
|
|
|
|
/* Set POWER button callback */
|
|
WPAD_SetPowerButtonCallback(__Wpad_PowerCallback);
|
|
|
|
return ret;
|
|
}
|
|
|
|
void Wpad_Disconnect(void)
|
|
{
|
|
u32 cnt;
|
|
|
|
/* Disconnect Wiimotes */
|
|
for (cnt = 0; cnt < MAX_WIIMOTES; cnt++)
|
|
WPAD_Disconnect(cnt);
|
|
|
|
/* Shutdown Wiimote subsystem */
|
|
WUPC_Shutdown();
|
|
WPAD_Shutdown();
|
|
}
|
|
|
|
bool IsWpadConnected()
|
|
{
|
|
int i = 0;
|
|
u32 test = 0;
|
|
int notconnected = 0;
|
|
for (i = 0; i < 4; i++)
|
|
{
|
|
if (WPAD_Probe(i, &test) == WPAD_ERR_NO_CONTROLLER)
|
|
{
|
|
notconnected++;
|
|
}
|
|
}
|
|
if (notconnected < 4)
|
|
return true;
|
|
else return false;
|
|
}
|
|
|
|
u32 ButtonsHold(void)
|
|
{
|
|
|
|
int i;
|
|
u32 buttons = 0;
|
|
WUPC_UpdateButtonStats();
|
|
WPAD_ScanPads();
|
|
PAD_ScanPads();
|
|
|
|
for (i = 3; i >= 0; i--)
|
|
{
|
|
buttons |= WUPC_ButtonsHeld(i);
|
|
buttons |= PAD_ButtonsHeld(i);
|
|
buttons |= WPAD_ButtonsHeld(i);
|
|
}
|
|
return buttons;
|
|
}
|
|
|
|
u32 ButtonsPressed(void)
|
|
{
|
|
int i;
|
|
u32 buttons = 0;
|
|
WUPC_UpdateButtonStats();
|
|
WPAD_ScanPads();
|
|
PAD_ScanPads();
|
|
|
|
for (i = 3; i >= 0; i--)
|
|
{
|
|
buttons |= WUPC_ButtonsDown(i);
|
|
buttons |= PAD_ButtonsDown(i);
|
|
buttons |= WPAD_ButtonsDown(i);
|
|
}
|
|
return buttons;
|
|
}
|