early-access version 2649

This commit is contained in:
pineappleEA
2022-04-06 05:09:11 +02:00
parent 2ffe9685e5
commit 447daccd21
19 changed files with 103 additions and 19 deletions

View File

@@ -1207,4 +1207,12 @@ void EmulatedController::DeleteCallback(int key) {
}
callback_list.erase(iterator);
}
void EmulatedController::RemoveServiceCallbacks() {
std::lock_guard lock{mutex};
const auto count = std::erase_if(
callback_list, [](const auto& callback) { return callback.second.is_npad_service; });
LOG_DEBUG(Input, "Elements deleted {}", count);
}
} // namespace Core::HID

View File

@@ -335,6 +335,9 @@ public:
*/
void DeleteCallback(int key);
/// Removes all callbacks created from npad services
void RemoveServiceCallbacks();
private:
/// creates input devices from params
void LoadDevices();

View File

@@ -211,4 +211,17 @@ void HIDCore::UnloadInputDevices() {
devices->UnloadInput();
}
void HIDCore::RemoveServiceCallbacks() {
player_1->RemoveServiceCallbacks();
player_2->RemoveServiceCallbacks();
player_3->RemoveServiceCallbacks();
player_4->RemoveServiceCallbacks();
player_5->RemoveServiceCallbacks();
player_6->RemoveServiceCallbacks();
player_7->RemoveServiceCallbacks();
player_8->RemoveServiceCallbacks();
other->RemoveServiceCallbacks();
handheld->RemoveServiceCallbacks();
}
} // namespace Core::HID

View File

@@ -61,6 +61,9 @@ public:
/// Removes all callbacks from input common
void UnloadInputDevices();
/// Removes all callbacks from npad services
void RemoveServiceCallbacks();
/// Number of emulated controllers
static constexpr std::size_t available_controllers{10};