mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-29 05:24:41 +00:00
Stash
This commit is contained in:
parent
c9ece44207
commit
c05a5223ca
@ -6,6 +6,7 @@
|
|||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/libraries/kernel/time.h"
|
#include "core/libraries/kernel/time.h"
|
||||||
#include "core/libraries/pad/pad.h"
|
#include "core/libraries/pad/pad.h"
|
||||||
|
#include "core/libraries/system/userservice.h"
|
||||||
#include "input/controller.h"
|
#include "input/controller.h"
|
||||||
|
|
||||||
namespace Input {
|
namespace Input {
|
||||||
@ -239,13 +240,24 @@ void GameController::SetTouchpadState(int touchIndex, bool touchDown, float x, f
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GameControllers::TryOpenSDLControllers(GameControllers& controllers) {
|
void GameControllers::TryOpenSDLControllers(GameControllers& controllers) {
|
||||||
|
using namespace Libraries::UserService;
|
||||||
int controller_count;
|
int controller_count;
|
||||||
SDL_JoystickID* joysticks = SDL_GetGamepads(&controller_count);
|
SDL_JoystickID* joysticks = SDL_GetGamepads(&controller_count);
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
if (i < controller_count) {
|
if (i < controller_count) {
|
||||||
|
SDL_Gamepad** temp = &(controllers[i]->m_sdl_gamepad);
|
||||||
controllers[i]->m_sdl_gamepad = SDL_OpenGamepad(joysticks[i]);
|
controllers[i]->m_sdl_gamepad = SDL_OpenGamepad(joysticks[i]);
|
||||||
|
if (*temp == 0) {
|
||||||
|
AddUserServiceEvent({OrbisUserServiceEventType::Login,
|
||||||
|
SDL_GetGamepadPlayerIndex(controllers[i]->m_sdl_gamepad) + 2});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
SDL_Gamepad** temp = &(controllers[i]->m_sdl_gamepad);
|
||||||
controllers[i]->m_sdl_gamepad = nullptr;
|
controllers[i]->m_sdl_gamepad = nullptr;
|
||||||
|
if (*temp != 0) {
|
||||||
|
AddUserServiceEvent(
|
||||||
|
{OrbisUserServiceEventType::Logout, SDL_GetGamepadPlayerIndex(*temp) + 2});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,6 +270,7 @@ void WindowSDL::OnKeyboardMouseInput(const SDL_Event* event) {
|
|||||||
|
|
||||||
// Handle window controls outside of the input maps
|
// Handle window controls outside of the input maps
|
||||||
if (event->type == SDL_EVENT_KEY_DOWN) {
|
if (event->type == SDL_EVENT_KEY_DOWN) {
|
||||||
|
using namespace Libraries::UserService;
|
||||||
u32 input_id = input_event.input.sdl_id;
|
u32 input_id = input_event.input.sdl_id;
|
||||||
// Reparse kbm inputs
|
// Reparse kbm inputs
|
||||||
if (input_id == SDLK_F8) {
|
if (input_id == SDLK_F8) {
|
||||||
@ -295,6 +296,17 @@ void WindowSDL::OnKeyboardMouseInput(const SDL_Event* event) {
|
|||||||
VideoCore::TriggerCapture();
|
VideoCore::TriggerCapture();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// test controller connect/disconnect
|
||||||
|
else if (input_id == SDLK_F4) {
|
||||||
|
int player_count = Config::GetNumberOfPlayers();
|
||||||
|
AddUserServiceEvent({OrbisUserServiceEventType::Logout, player_count});
|
||||||
|
Config::SetNumberOfPlayers(player_count - 1);
|
||||||
|
}
|
||||||
|
else if (input_id == SDLK_F5) {
|
||||||
|
int player_count = Config::GetNumberOfPlayers();
|
||||||
|
AddUserServiceEvent({OrbisUserServiceEventType::Login, player_count + 1});
|
||||||
|
Config::SetNumberOfPlayers(player_count + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if it's a wheel event, make a timer that turns it off after a set time
|
// if it's a wheel event, make a timer that turns it off after a set time
|
||||||
|
Loading…
Reference in New Issue
Block a user