mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-26 20:31:41 +00:00
Fix indentation
This commit is contained in:
parent
95d491762f
commit
a404f16333
1 changed files with 85 additions and 86 deletions
|
|
@ -45,15 +45,15 @@ public:
|
||||||
{
|
{
|
||||||
switch (GetControllerType())
|
switch (GetControllerType())
|
||||||
{
|
{
|
||||||
case SDL_CONTROLLER_TYPE_PS3:
|
case SDL_CONTROLLER_TYPE_PS3:
|
||||||
case SDL_CONTROLLER_TYPE_PS4:
|
case SDL_CONTROLLER_TYPE_PS4:
|
||||||
case SDL_CONTROLLER_TYPE_PS5:
|
case SDL_CONTROLLER_TYPE_PS5:
|
||||||
return hid::EInputDevice::PlayStation;
|
return hid::EInputDevice::PlayStation;
|
||||||
case SDL_CONTROLLER_TYPE_XBOX360:
|
case SDL_CONTROLLER_TYPE_XBOX360:
|
||||||
case SDL_CONTROLLER_TYPE_XBOXONE:
|
case SDL_CONTROLLER_TYPE_XBOXONE:
|
||||||
return hid::EInputDevice::Xbox;
|
return hid::EInputDevice::Xbox;
|
||||||
default:
|
default:
|
||||||
return hid::EInputDevice::Unknown;
|
return hid::EInputDevice::Unknown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -222,99 +222,99 @@ int HID_OnSDLEvent(void*, SDL_Event* event)
|
||||||
{
|
{
|
||||||
switch (event->type)
|
switch (event->type)
|
||||||
{
|
{
|
||||||
case SDL_CONTROLLERDEVICEADDED:
|
case SDL_CONTROLLERDEVICEADDED:
|
||||||
{
|
|
||||||
const auto freeIndex = FindFreeController();
|
|
||||||
|
|
||||||
if (freeIndex != -1)
|
|
||||||
{
|
{
|
||||||
auto controller = Controller(event->cdevice.which);
|
const auto freeIndex = FindFreeController();
|
||||||
|
|
||||||
g_controllers[freeIndex] = controller;
|
if (freeIndex != -1)
|
||||||
|
{
|
||||||
|
auto controller = Controller(event->cdevice.which);
|
||||||
|
|
||||||
SetControllerTimeOfDayLED(controller, App::s_isWerehog);
|
g_controllers[freeIndex] = controller;
|
||||||
|
|
||||||
|
SetControllerTimeOfDayLED(controller, App::s_isWerehog);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
case SDL_CONTROLLERDEVICEREMOVED:
|
||||||
}
|
|
||||||
|
|
||||||
case SDL_CONTROLLERDEVICEREMOVED:
|
|
||||||
{
|
|
||||||
auto* controller = FindController(event->cdevice.which);
|
|
||||||
|
|
||||||
if (controller)
|
|
||||||
controller->Close();
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case SDL_CONTROLLERBUTTONDOWN:
|
|
||||||
case SDL_CONTROLLERBUTTONUP:
|
|
||||||
case SDL_CONTROLLERAXISMOTION:
|
|
||||||
case SDL_CONTROLLERTOUCHPADDOWN:
|
|
||||||
{
|
|
||||||
auto* controller = FindController(event->cdevice.which);
|
|
||||||
|
|
||||||
if (!controller)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (event->type == SDL_CONTROLLERAXISMOTION)
|
|
||||||
{
|
{
|
||||||
if (abs(event->caxis.value) > 8000)
|
auto* controller = FindController(event->cdevice.which);
|
||||||
|
|
||||||
|
if (controller)
|
||||||
|
controller->Close();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case SDL_CONTROLLERBUTTONDOWN:
|
||||||
|
case SDL_CONTROLLERBUTTONUP:
|
||||||
|
case SDL_CONTROLLERAXISMOTION:
|
||||||
|
case SDL_CONTROLLERTOUCHPADDOWN:
|
||||||
|
{
|
||||||
|
auto* controller = FindController(event->cdevice.which);
|
||||||
|
|
||||||
|
if (!controller)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (event->type == SDL_CONTROLLERAXISMOTION)
|
||||||
|
{
|
||||||
|
if (abs(event->caxis.value) > 8000)
|
||||||
|
{
|
||||||
|
SDL_ShowCursor(SDL_DISABLE);
|
||||||
|
SetControllerInputDevice(controller);
|
||||||
|
}
|
||||||
|
|
||||||
|
controller->PollAxis();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
SDL_ShowCursor(SDL_DISABLE);
|
SDL_ShowCursor(SDL_DISABLE);
|
||||||
SetControllerInputDevice(controller);
|
SetControllerInputDevice(controller);
|
||||||
|
|
||||||
|
controller->Poll();
|
||||||
}
|
}
|
||||||
|
|
||||||
controller->PollAxis();
|
break;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SDL_ShowCursor(SDL_DISABLE);
|
|
||||||
SetControllerInputDevice(controller);
|
|
||||||
|
|
||||||
controller->Poll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
case SDL_KEYDOWN:
|
||||||
}
|
case SDL_KEYUP:
|
||||||
|
hid::g_inputDevice = hid::EInputDevice::Keyboard;
|
||||||
|
break;
|
||||||
|
|
||||||
case SDL_KEYDOWN:
|
case SDL_MOUSEMOTION:
|
||||||
case SDL_KEYUP:
|
case SDL_MOUSEBUTTONDOWN:
|
||||||
hid::g_inputDevice = hid::EInputDevice::Keyboard;
|
case SDL_MOUSEBUTTONUP:
|
||||||
break;
|
{
|
||||||
|
if (!GameWindow::IsFullscreen() || GameWindow::s_isFullscreenCursorVisible)
|
||||||
case SDL_MOUSEMOTION:
|
SDL_ShowCursor(SDL_ENABLE);
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
|
||||||
case SDL_MOUSEBUTTONUP:
|
hid::g_inputDevice = hid::EInputDevice::Mouse;
|
||||||
{
|
|
||||||
if (!GameWindow::IsFullscreen() || GameWindow::s_isFullscreenCursorVisible)
|
break;
|
||||||
SDL_ShowCursor(SDL_ENABLE);
|
}
|
||||||
|
|
||||||
hid::g_inputDevice = hid::EInputDevice::Mouse;
|
case SDL_WINDOWEVENT:
|
||||||
|
{
|
||||||
break;
|
if (event->window.event == SDL_WINDOWEVENT_FOCUS_LOST)
|
||||||
}
|
{
|
||||||
|
// Stop vibrating controllers on focus lost.
|
||||||
case SDL_WINDOWEVENT:
|
for (auto& controller : g_controllers)
|
||||||
{
|
controller.SetVibration({ 0, 0 });
|
||||||
if (event->window.event == SDL_WINDOWEVENT_FOCUS_LOST)
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case SDL_USER_EVILSONIC:
|
||||||
{
|
{
|
||||||
// Stop vibrating controllers on focus lost.
|
|
||||||
for (auto& controller : g_controllers)
|
for (auto& controller : g_controllers)
|
||||||
controller.SetVibration({ 0, 0 });
|
SetControllerTimeOfDayLED(controller, event->user.code);
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case SDL_USER_EVILSONIC:
|
|
||||||
{
|
|
||||||
for (auto& controller : g_controllers)
|
|
||||||
SetControllerTimeOfDayLED(controller, event->user.code);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -339,7 +339,6 @@ void hid::Init()
|
||||||
SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER);
|
SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t hid::GetState(uint32_t dwUserIndex, XAMINPUT_STATE* pState)
|
uint32_t hid::GetState(uint32_t dwUserIndex, XAMINPUT_STATE* pState)
|
||||||
{
|
{
|
||||||
static uint32_t packet;
|
static uint32_t packet;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue