Wii: Untested USB mouse support

This commit is contained in:
UnknownShadow200 2024-09-14 23:15:04 +10:00
parent 1f7125cc9c
commit f425e865dd
2 changed files with 34 additions and 3 deletions

View file

@ -14,12 +14,14 @@
#include "VirtualKeyboard.h"
#include <gccore.h>
#if defined HW_RVL
#include <ogc/usbmouse.h>
#include <wiiuse/wpad.h>
#include <wiikeyboard/keyboard.h>
#endif
static cc_bool needsFBUpdate;
static cc_bool launcherMode;
static int mouseSupported;
#include "VirtualCursor.h"
static void* xfb;
static GXRModeObj* rmode;
@ -86,6 +88,7 @@ void Window_Init(void) {
#if defined HW_RVL
KEYBOARD_Init(NULL);
mouseSupported = MOUSE_Init() >= 0;
#endif
}
@ -168,7 +171,7 @@ static void ProcessPADInputs(float delta) {
/*########################################################################################################################*
*--------------------------------------------------Kebyaord processing----------------------------------------------------*
*--------------------------------------------------Keyboard processing----------------------------------------------------*
*#########################################################################################################################*/
#if defined HW_RVL
static const cc_uint8 key_map[] = {
@ -231,6 +234,35 @@ static void ProcessKeyboardInput(void) {
#endif
/*########################################################################################################################*
*---------------------------------------------------Mouse processing------------------------------------------------------*
*#########################################################################################################################*/
#if defined HW_RVL
static void ProcessMouseInput(float delta) {
if (!mouseSupported) return;
if (!MOUSE_IsConnected()) return;
mouse_event event;
if (MOUSE_GetEvent(&event) == 0) return;
Input_SetNonRepeatable(CCMOUSE_L, event.button & 4);
Input_SetNonRepeatable(CCMOUSE_R, event.button & 1);
Input_SetNonRepeatable(CCMOUSE_M, event.button & 2);
Mouse_ScrollVWheel(event.rz * 0.5f);
if (!vc_hooked) {
Pointer_SetPosition(0, Window_Main.Width / 2, Window_Main.Height / 2);
}
VirtualCursor_SetPosition(Pointers[0].x + event.rx, Pointers[0].y + event.ry);
if (!Input.RawMode) return;
float scale = (delta * 60.0) / 2.0f;
Event_RaiseRawMove(&PointerEvents.RawMoved,
event.rx * scale, event.ry * scale);
}
#endif
/*########################################################################################################################*
*----------------------------------------------------Input processing-----------------------------------------------------*
*#########################################################################################################################*/
@ -241,6 +273,7 @@ static cc_bool dragActive;
void Window_ProcessEvents(float delta) {
ProcessKeyboardInput();
ProcessMouseInput(delta);
}
static void GetIRPos(int res, int* x, int* y) {

View file

@ -2,7 +2,5 @@ arm_iop/debug
arm_iop/release
arm_host/debug
arm_host/release
include/dswifi_version.h
include/dsiwifi_version.h
lib
*.bz2