mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-27 12:34:37 +00:00
Initialize the first controller for the keyboard even if no controllers are connected
This commit is contained in:
parent
c962e70fd8
commit
f29d79ec40
@ -586,8 +586,8 @@ s32 PS4_SYSV_ABI sceUserServiceGetLoginUserIdList(OrbisUserServiceLoginUserIdLis
|
||||
return ORBIS_USER_SERVICE_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
// TODO only first user, do the others as well
|
||||
for (int i = 0; i < 4; i++) {
|
||||
auto controllers = *Common::Singleton<Input::GameControllers>::Instance();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
userIdList->user_id[i] = controllers[i]->user_id;
|
||||
}
|
||||
return ORBIS_OK;
|
||||
|
@ -240,6 +240,8 @@ void GameController::SetTouchpadState(int touchIndex, bool touchDown, float x, f
|
||||
}
|
||||
}
|
||||
|
||||
bool is_first_check = true;
|
||||
|
||||
void GameControllers::TryOpenSDLControllers(GameControllers& controllers) {
|
||||
using namespace Libraries::UserService;
|
||||
int controller_count;
|
||||
@ -313,6 +315,13 @@ void GameControllers::TryOpenSDLControllers(GameControllers& controllers) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_first_check) [[unlikely]] {
|
||||
is_first_check = false;
|
||||
if (controller_count == 0) {
|
||||
controllers[0]->user_id = 1;
|
||||
AddUserServiceEvent({OrbisUserServiceEventType::Login, 1});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u32 GameController::Poll() {
|
||||
|
@ -143,7 +143,7 @@ WindowSDL::WindowSDL(s32 width_, s32 height_, Input::GameControllers* controller
|
||||
// input handler init-s
|
||||
Input::ControllerOutput::LinkJoystickAxes();
|
||||
Input::ParseInputConfig(std::string(Common::ElfInfo::Instance().GameSerial()));
|
||||
// default login
|
||||
Input::GameControllers::TryOpenSDLControllers(controllers);
|
||||
using namespace Libraries::UserService;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user