hid: avoid direct pointer access of transfer memory objects

This commit is contained in:
Liam
2023-02-24 12:29:55 -05:00
parent ca8a804a3c
commit de4e5db330
20 changed files with 91 additions and 69 deletions

View File

@ -60,9 +60,15 @@ public:
private:
template <typename T>
void MakeController(HidController controller, u8* shared_memory) {
controllers[static_cast<std::size_t>(controller)] =
std::make_unique<T>(system.HIDCore(), shared_memory);
if constexpr (std::is_constructible_v<T, Core::System&, u8*>) {
controllers[static_cast<std::size_t>(controller)] =
std::make_unique<T>(system, shared_memory);
} else {
controllers[static_cast<std::size_t>(controller)] =
std::make_unique<T>(system.HIDCore(), shared_memory);
}
}
template <typename T>
void MakeControllerWithServiceContext(HidController controller, u8* shared_memory) {
controllers[static_cast<std::size_t>(controller)] =