second commit lion review

This commit is contained in:
german77 2021-11-01 14:17:53 -06:00 committed by Narr the Reg
parent 730f078302
commit 77fa4d4bf6
28 changed files with 73 additions and 42 deletions

View file

@ -209,10 +209,11 @@ int EmulatedConsole::SetCallback(ConsoleUpdateCallback update_callback) {
void EmulatedConsole::DeleteCallback(int key) {
std::lock_guard lock{mutex};
if (!callback_list.contains(key)) {
const auto& iterator = callback_list.find(key);
if (iterator == callback_list.end()) {
LOG_ERROR(Input, "Tried to delete non-existent callback {}", key);
return;
}
callback_list.erase(key);
callback_list.erase(iterator);
}
} // namespace Core::HID

View file

@ -993,10 +993,11 @@ int EmulatedController::SetCallback(ControllerUpdateCallback update_callback) {
void EmulatedController::DeleteCallback(int key) {
std::lock_guard lock{mutex};
if (!callback_list.contains(key)) {
const auto& iterator = callback_list.find(key);
if (iterator == callback_list.end()) {
LOG_ERROR(Input, "Tried to delete non-existent callback {}", key);
return;
}
callback_list.erase(key);
callback_list.erase(iterator);
}
} // namespace Core::HID

View file

@ -362,10 +362,11 @@ int EmulatedDevices::SetCallback(InterfaceUpdateCallback update_callback) {
void EmulatedDevices::DeleteCallback(int key) {
std::lock_guard lock{mutex};
if (!callback_list.contains(key)) {
const auto& iterator = callback_list.find(key);
if (iterator == callback_list.end()) {
LOG_ERROR(Input, "Tried to delete non-existent callback {}", key);
return;
}
callback_list.erase(key);
callback_list.erase(iterator);
}
} // namespace Core::HID

View file

@ -3,6 +3,9 @@
// Refer to the license.txt file included.
#include "common/assert.h"
#include "core/hid/emulated_console.h"
#include "core/hid/emulated_controller.h"
#include "core/hid/emulated_devices.h"
#include "core/hid/hid_core.h"
namespace Core::HID {

View file

@ -6,9 +6,13 @@
#include <memory>
#include "core/hid/emulated_console.h"
#include "core/hid/emulated_controller.h"
#include "core/hid/emulated_devices.h"
#include "core/hid/hid_types.h"
namespace Core::HID {
class EmulatedConsole;
class EmulatedController;
class EmulatedDevices;
} // namespace Core::HID
namespace Core::HID {

View file

@ -4,9 +4,17 @@
#pragma once
namespace Input {
namespace Common::Input {
struct CallbackStatus;
};
enum class BatteryLevel : u32;
using BatteryStatus = BatteryLevel;
struct AnalogStatus;
struct ButtonStatus;
struct MotionStatus;
struct StickStatus;
struct TouchStatus;
struct TriggerStatus;
}; // namespace Common::Input
namespace Core::HID {