Mouse Support (#4673)

* mouse

* (mouse) small fix

* "fix" implicit declaration

* LUS 1.2

* empty commit to force CI re-run

* include new mouse LUS

* deleted:    soh/soh/Enhancements/controls/GameControlEditor.cpp

* [mouse]LUS

* fix input viewer header

* Bump LUS for mouse support

* Mouse Support

* Comment cleanup

* Adding the actual mouse enhancement files

* Fix (?) Windows and Mac builds

* Maybe fix MacOS now

* Why was it compiling with this??

* Mouse input viewer handling

* [Mouse] LUS bump

* [mouse] LUS

* (Mouse) bump LUS for dxgi fix

* F2 mouse notif

* Update soh/soh/Enhancements/controls/Mouse.h

Co-authored-by: Pepe20129 <72659707+Pepe20129@users.noreply.github.com>

* Update soh/soh/Enhancements/controls/Mouse.cpp

Co-authored-by: Pepe20129 <72659707+Pepe20129@users.noreply.github.com>

* Fix mouse shield ranges to match control stick behavior

* Use early returns in Mouse_HandleQuickspin

* newline cleanup

* cleanup

* rename BUTTON_COLOR_MOUSE_BEIGE to BUTTON_COLOR_MOUSE_GRAY

* 'Enable Mouse' tooltip

* Fix includes

* Comments re mouse quickspin

* bullshit

* Hook handler for cursor recentering on shield

* Hook handler for first person mouse aiming

* Hook handlers for mouse quickspin

* Hook handlers for mouse shield control

* Hook registration conditions

* Enable Mouse -> Enable Mouse Controls

---------

Co-authored-by: Pepe20129 <72659707+Pepe20129@users.noreply.github.com>
This commit is contained in:
lilacLunatic
2025-03-24 15:33:55 -03:00
committed by GitHub
parent 26aa36fe7b
commit dc5bc1aa6c
11 changed files with 248 additions and 6 deletions

View File

@@ -3,6 +3,7 @@
#include <string.h>
#include "soh/Enhancements/game-interactor/GameInteractor.h"
#include "soh/Enhancements/controls/Mouse.h"
#include "soh/OTRGlobals.h"
#include "soh/ResourceManagerHelpers.h"
@@ -317,6 +318,8 @@ void PadMgr_HandleRetraceMsg(PadMgr* padMgr) {
osRecvMesg(queue, NULL, OS_MESG_BLOCK);
osContGetReadData(padMgr->pads);
Mouse_UpdateAll();
for (i = 0; i < __osMaxControllers; i++) {
padMgr->padStatus[i].status = Controller_ShouldRumble(i);
}

View File

@@ -7,6 +7,7 @@
#include "overlays/actors/ovl_En_Horse/z_en_horse.h"
#include "soh/frame_interpolation.h"
#include "soh/Enhancements/controls/Mouse.h"
s16 Camera_ChangeSettingFlags(Camera* camera, s16 setting, s16 flags);
s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 flags);
@@ -1422,6 +1423,8 @@ s32 SetCameraManual(Camera* camera) {
f32 newCamX = -D_8015BD7C->state.input[0].cur.right_stick_x * 10.0f;
f32 newCamY = D_8015BD7C->state.input[0].cur.right_stick_y * 10.0f;
Mouse_HandleThirdPerson(&newCamX, &newCamY);
if ((fabsf(newCamX) >= 15.0f || fabsf(newCamY) >= 15.0f) && camera->play->manualCamera == false) {
camera->play->manualCamera = true;
@@ -1485,8 +1488,17 @@ s32 Camera_Free(Camera* camera) {
camera->animState = 0;
f32 newCamX = -D_8015BD7C->state.input[0].cur.right_stick_x * 10.0f * (CVarGetFloat(CVAR_SETTING("FreeLook.CameraSensitivity.X"), 1.0f));
f32 newCamY = D_8015BD7C->state.input[0].cur.right_stick_y * 10.0f * (CVarGetFloat(CVAR_SETTING("FreeLook.CameraSensitivity.Y"), 1.0f));
f32 newCamX = -D_8015BD7C->state.input[0].cur.right_stick_x * 10.0f;
f32 newCamY = +D_8015BD7C->state.input[0].cur.right_stick_y * 10.0f;
/* Disable mouse movement when holding down the shield */
if (!(camera->player->stateFlags1 & 0x400000)) {
Mouse_HandleThirdPerson(&newCamX, &newCamY);
}
newCamX *= (CVarGetFloat(CVAR_SETTING("FreeLook.CameraSensitivity.X"), 1.0f));
newCamY *= (CVarGetFloat(CVAR_SETTING("FreeLook.CameraSensitivity.Y"), 1.0f));
bool invertXAxis = (CVarGetInteger(CVAR_SETTING("FreeLook.InvertXAxis"), 0) && !CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) || (!CVarGetInteger(CVAR_SETTING("FreeLook.InvertXAxis"), 0) && CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0));
camera->play->camX += newCamX * (invertXAxis ? -1 : 1);