mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-30 10:42:47 +01:00
Wip
This commit is contained in:
parent
85b0d9a7be
commit
98b760c645
2 changed files with 23 additions and 3 deletions
|
@ -287,15 +287,31 @@ Controller_NPad::NPadType Controller_NPad::GetSupportedStyleSet() const {
|
||||||
|
|
||||||
void Controller_NPad::SetSupportedNPadIdTypes(u8* data, std::size_t length) {
|
void Controller_NPad::SetSupportedNPadIdTypes(u8* data, std::size_t length) {
|
||||||
ASSERT(length > 0 && (length % sizeof(u32)) == 0);
|
ASSERT(length > 0 && (length % sizeof(u32)) == 0);
|
||||||
|
supported_npad_id_types.clear();
|
||||||
supported_npad_id_types.resize(length / sizeof(u32));
|
supported_npad_id_types.resize(length / sizeof(u32));
|
||||||
std::memcpy(supported_npad_id_types.data(), data, length);
|
std::memcpy(supported_npad_id_types.data(), data, length);
|
||||||
CheckForHandheldVariant();
|
CheckForHandheldVariant();
|
||||||
}
|
}
|
||||||
|
#pragma optimize("", off)
|
||||||
void Controller_NPad::CheckForHandheldVariant() {
|
void Controller_NPad::CheckForHandheldVariant() {
|
||||||
// As some games expect us to use the variant of handheld mode and some games don't. It's
|
// As some games expect us to use the variant of handheld mode and some games don't. It's
|
||||||
// consistent that games set the npad ids in order of priority. We can just swap the controller
|
// consistent that games set the npad ids in order of priority. We can just swap the controller
|
||||||
// ids on the fly then if we're in handheld mode
|
// ids on the fly then if we're in handheld mode
|
||||||
|
if (std::find(supported_npad_id_types.begin(), supported_npad_id_types.end(), 32) !=
|
||||||
|
supported_npad_id_types.end()) {
|
||||||
|
const auto& first_controller = connected_controllers.front();
|
||||||
|
if (first_controller.is_connected &&
|
||||||
|
first_controller.type == NPadControllerType::Handheld) {
|
||||||
|
DisconnectNPad(0);
|
||||||
|
AddNewController(NPadControllerType::Handheld, true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (connected_controllers[8].is_connected) {
|
||||||
|
DisconnectNPad(8);
|
||||||
|
AddNewController(NPadControllerType::Handheld);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
if (supported_npad_id_types.size() > 0) {
|
if (supported_npad_id_types.size() > 0) {
|
||||||
const auto& first_controller = supported_npad_id_types.front();
|
const auto& first_controller = supported_npad_id_types.front();
|
||||||
if (first_controller == 32 && !connected_controllers[8].is_connected) {
|
if (first_controller == 32 && !connected_controllers[8].is_connected) {
|
||||||
|
@ -311,7 +327,7 @@ void Controller_NPad::CheckForHandheldVariant() {
|
||||||
AddNewController(NPadControllerType::Handheld);
|
AddNewController(NPadControllerType::Handheld);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
const void Controller_NPad::GetSupportedNpadIdTypes(u32* data, std::size_t max_length) {
|
const void Controller_NPad::GetSupportedNpadIdTypes(u32* data, std::size_t max_length) {
|
||||||
|
|
|
@ -284,7 +284,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<IAppletResource> applet_resource;
|
std::shared_ptr<IAppletResource> applet_resource;
|
||||||
|
#pragma optimize("", off)
|
||||||
void CreateAppletResource(Kernel::HLERequestContext& ctx) {
|
void CreateAppletResource(Kernel::HLERequestContext& ctx) {
|
||||||
if (applet_resource == nullptr) {
|
if (applet_resource == nullptr) {
|
||||||
applet_resource = std::make_shared<IAppletResource>();
|
applet_resource = std::make_shared<IAppletResource>();
|
||||||
|
@ -405,6 +405,8 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void AcquireNpadStyleSetUpdateEventHandle(Kernel::HLERequestContext& ctx) {
|
void AcquireNpadStyleSetUpdateEventHandle(Kernel::HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
auto npad_id = rp.PopRaw<u32>();
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 1};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushCopyObjects(applet_resource->GetController<Controller_NPad>(HidController::NPad)
|
rb.PushCopyObjects(applet_resource->GetController<Controller_NPad>(HidController::NPad)
|
||||||
|
@ -454,6 +456,8 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetNpadJoyAssignmentModeSingleByDefault(Kernel::HLERequestContext& ctx) {
|
void SetNpadJoyAssignmentModeSingleByDefault(Kernel::HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
auto npad_id = rp.PopRaw<u32>();
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
LOG_WARNING(Service_HID, "(STUBBED) called");
|
LOG_WARNING(Service_HID, "(STUBBED) called");
|
||||||
|
|
Loading…
Reference in a new issue