mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 13:20:27 -06:00
InputCommon: replace SerialInterface log with ControllerInterface
where appropriate. SerialInterface was a leftover from the past, and makes no sense to be used on actual/real controllers.
This commit is contained in:
@ -237,7 +237,7 @@ void ControllerInterface::AddDevice(std::shared_ptr<ciface::Core::Device> device
|
||||
device->SetId(id);
|
||||
}
|
||||
|
||||
NOTICE_LOG_FMT(SERIALINTERFACE, "Added device: {}", device->GetQualifiedName());
|
||||
NOTICE_LOG_FMT(CONTROLLERINTERFACE, "Added device: {}", device->GetQualifiedName());
|
||||
m_devices.emplace_back(std::move(device));
|
||||
}
|
||||
|
||||
@ -252,7 +252,7 @@ void ControllerInterface::RemoveDevice(std::function<bool(const ciface::Core::De
|
||||
auto it = std::remove_if(m_devices.begin(), m_devices.end(), [&callback](const auto& dev) {
|
||||
if (callback(dev.get()))
|
||||
{
|
||||
NOTICE_LOG_FMT(SERIALINTERFACE, "Removed device: {}", dev->GetQualifiedName());
|
||||
NOTICE_LOG_FMT(CONTROLLERINTERFACE, "Removed device: {}", dev->GetQualifiedName());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -205,7 +205,7 @@ static bool IsSameController(const Proto::MessageType::PortInfo& a,
|
||||
static void HotplugThreadFunc()
|
||||
{
|
||||
Common::SetCurrentThreadName("DualShockUDPClient Hotplug Thread");
|
||||
INFO_LOG_FMT(SERIALINTERFACE, "DualShockUDPClient hotplug thread started");
|
||||
INFO_LOG_FMT(CONTROLLERINTERFACE, "DualShockUDPClient hotplug thread started");
|
||||
|
||||
while (s_hotplug_thread_running.IsSet())
|
||||
{
|
||||
@ -225,7 +225,7 @@ static void HotplugThreadFunc()
|
||||
if (server.m_socket.send(&list_ports, sizeof list_ports, server.m_address, server.m_port) !=
|
||||
sf::Socket::Status::Done)
|
||||
{
|
||||
ERROR_LOG_FMT(SERIALINTERFACE, "DualShockUDPClient HotplugThreadFunc send failed");
|
||||
ERROR_LOG_FMT(CONTROLLERINTERFACE, "DualShockUDPClient HotplugThreadFunc send failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -277,7 +277,7 @@ static void HotplugThreadFunc()
|
||||
}
|
||||
}
|
||||
}
|
||||
INFO_LOG_FMT(SERIALINTERFACE, "DualShockUDPClient hotplug thread stopped");
|
||||
INFO_LOG_FMT(CONTROLLERINTERFACE, "DualShockUDPClient hotplug thread stopped");
|
||||
}
|
||||
|
||||
static void StartHotplugThread()
|
||||
@ -310,7 +310,7 @@ static void StopHotplugThread()
|
||||
|
||||
static void Restart()
|
||||
{
|
||||
INFO_LOG_FMT(SERIALINTERFACE, "DualShockUDPClient Restart");
|
||||
INFO_LOG_FMT(CONTROLLERINTERFACE, "DualShockUDPClient Restart");
|
||||
|
||||
StopHotplugThread();
|
||||
|
||||
@ -394,7 +394,7 @@ void Init()
|
||||
|
||||
void PopulateDevices()
|
||||
{
|
||||
INFO_LOG_FMT(SERIALINTERFACE, "DualShockUDPClient PopulateDevices");
|
||||
INFO_LOG_FMT(CONTROLLERINTERFACE, "DualShockUDPClient PopulateDevices");
|
||||
|
||||
// s_servers has already been updated so we can't use it to know which devices we removed,
|
||||
// also it's good to remove all of them before adding new ones so that their id will be set
|
||||
@ -510,7 +510,7 @@ void Device::UpdateInput()
|
||||
if (m_socket.send(&data_req, sizeof(data_req), m_server_address, m_server_port) !=
|
||||
sf::Socket::Status::Done)
|
||||
{
|
||||
ERROR_LOG_FMT(SERIALINTERFACE, "DualShockUDPClient UpdateInput send failed");
|
||||
ERROR_LOG_FMT(CONTROLLERINTERFACE, "DualShockUDPClient UpdateInput send failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,7 @@ struct Message
|
||||
if (crc32_in_header != crc32_calculated)
|
||||
{
|
||||
NOTICE_LOG_FMT(
|
||||
SERIALINTERFACE,
|
||||
CONTROLLERINTERFACE,
|
||||
"DualShockUDPClient Received message with bad CRC in header: got {:08x}, expected {:08x}",
|
||||
crc32_in_header, crc32_calculated);
|
||||
return std::nullopt;
|
||||
|
@ -178,11 +178,11 @@ void Init(void* window)
|
||||
|
||||
HIDManager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
|
||||
if (!HIDManager)
|
||||
ERROR_LOG_FMT(SERIALINTERFACE, "Failed to create HID Manager reference");
|
||||
ERROR_LOG_FMT(CONTROLLERINTERFACE, "Failed to create HID Manager reference");
|
||||
|
||||
IOHIDManagerSetDeviceMatching(HIDManager, nullptr);
|
||||
if (IOHIDManagerOpen(HIDManager, kIOHIDOptionsTypeNone) != kIOReturnSuccess)
|
||||
ERROR_LOG_FMT(SERIALINTERFACE, "Failed to open HID Manager");
|
||||
ERROR_LOG_FMT(CONTROLLERINTERFACE, "Failed to open HID Manager");
|
||||
|
||||
// Callbacks for acquisition or loss of a matching device
|
||||
IOHIDManagerRegisterDeviceMatchingCallback(HIDManager, DeviceMatchingCallback, nullptr);
|
||||
@ -198,7 +198,7 @@ void Init(void* window)
|
||||
// Enable hotplugging
|
||||
s_hotplug_thread = std::thread([] {
|
||||
Common::SetCurrentThreadName("IOHIDManager Hotplug Thread");
|
||||
NOTICE_LOG_FMT(SERIALINTERFACE, "IOHIDManager hotplug thread started");
|
||||
NOTICE_LOG_FMT(CONTROLLERINTERFACE, "IOHIDManager hotplug thread started");
|
||||
|
||||
IOHIDManagerScheduleWithRunLoop(HIDManager, CFRunLoopGetCurrent(), OurRunLoop);
|
||||
s_stopper.AddToRunLoop(CFRunLoopGetCurrent(), OurRunLoop);
|
||||
@ -206,7 +206,7 @@ void Init(void* window)
|
||||
s_stopper.RemoveFromRunLoop(CFRunLoopGetCurrent(), OurRunLoop);
|
||||
IOHIDManagerUnscheduleFromRunLoop(HIDManager, CFRunLoopGetCurrent(), OurRunLoop);
|
||||
|
||||
NOTICE_LOG_FMT(SERIALINTERFACE, "IOHIDManager hotplug thread stopped");
|
||||
NOTICE_LOG_FMT(CONTROLLERINTERFACE, "IOHIDManager hotplug thread stopped");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -109,8 +109,9 @@ void Joystick::AddElements(CFArrayRef elements, std::set<IOHIDElementCookie>& co
|
||||
break;
|
||||
}
|
||||
|
||||
NOTICE_LOG_FMT(SERIALINTERFACE, "Unknown IOHIDElement, ignoring (Usage: {:x}, Type: {:x})",
|
||||
usage, IOHIDElementGetType(e));
|
||||
NOTICE_LOG_FMT(CONTROLLERINTERFACE,
|
||||
"Unknown IOHIDElement, ignoring (Usage: {:x}, Type: {:x})", usage,
|
||||
IOHIDElementGetType(e));
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ void Init()
|
||||
{
|
||||
#if !SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
if (SDL_Init(SDL_INIT_JOYSTICK) != 0)
|
||||
ERROR_LOG_FMT(SERIALINTERFACE, "SDL failed to initialize");
|
||||
ERROR_LOG_FMT(CONTROLLERINTERFACE, "SDL failed to initialize");
|
||||
return;
|
||||
#else
|
||||
s_hotplug_thread = std::thread([] {
|
||||
@ -95,14 +95,14 @@ void Init()
|
||||
|
||||
if (SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC) != 0)
|
||||
{
|
||||
ERROR_LOG_FMT(SERIALINTERFACE, "SDL failed to initialize");
|
||||
ERROR_LOG_FMT(CONTROLLERINTERFACE, "SDL failed to initialize");
|
||||
return;
|
||||
}
|
||||
|
||||
const Uint32 custom_events_start = SDL_RegisterEvents(2);
|
||||
if (custom_events_start == static_cast<Uint32>(-1))
|
||||
{
|
||||
ERROR_LOG_FMT(SERIALINTERFACE, "SDL failed to register custom events");
|
||||
ERROR_LOG_FMT(CONTROLLERINTERFACE, "SDL failed to register custom events");
|
||||
return;
|
||||
}
|
||||
s_stop_event_type = custom_events_start;
|
||||
|
@ -53,7 +53,7 @@ void ciface::Win32::Init(void* hwnd)
|
||||
|
||||
if (FAILED(CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED)))
|
||||
{
|
||||
ERROR_LOG_FMT(SERIALINTERFACE, "CoInitializeEx failed: {}", GetLastError());
|
||||
ERROR_LOG_FMT(CONTROLLERINTERFACE, "CoInitializeEx failed: {}", GetLastError());
|
||||
return;
|
||||
}
|
||||
Common::ScopeGuard uninit([] { CoUninitialize(); });
|
||||
@ -67,12 +67,12 @@ void ciface::Win32::Init(void* hwnd)
|
||||
ATOM window_class = RegisterClassEx(&window_class_info);
|
||||
if (!window_class)
|
||||
{
|
||||
NOTICE_LOG_FMT(SERIALINTERFACE, "RegisterClassEx failed: {}", GetLastError());
|
||||
NOTICE_LOG_FMT(CONTROLLERINTERFACE, "RegisterClassEx failed: {}", GetLastError());
|
||||
return;
|
||||
}
|
||||
Common::ScopeGuard unregister([&window_class] {
|
||||
if (!UnregisterClass(MAKEINTATOM(window_class), GetModuleHandle(nullptr)))
|
||||
ERROR_LOG_FMT(SERIALINTERFACE, "UnregisterClass failed: {}", GetLastError());
|
||||
ERROR_LOG_FMT(CONTROLLERINTERFACE, "UnregisterClass failed: {}", GetLastError());
|
||||
});
|
||||
|
||||
message_window = CreateWindowEx(0, L"Message", nullptr, 0, 0, 0, 0, 0, HWND_MESSAGE, nullptr,
|
||||
@ -80,12 +80,12 @@ void ciface::Win32::Init(void* hwnd)
|
||||
promise_guard.Exit();
|
||||
if (!message_window)
|
||||
{
|
||||
ERROR_LOG_FMT(SERIALINTERFACE, "CreateWindowEx failed: {}", GetLastError());
|
||||
ERROR_LOG_FMT(CONTROLLERINTERFACE, "CreateWindowEx failed: {}", GetLastError());
|
||||
return;
|
||||
}
|
||||
Common::ScopeGuard destroy([&] {
|
||||
if (!DestroyWindow(message_window))
|
||||
ERROR_LOG_FMT(SERIALINTERFACE, "DestroyWindow failed: {}", GetLastError());
|
||||
ERROR_LOG_FMT(CONTROLLERINTERFACE, "DestroyWindow failed: {}", GetLastError());
|
||||
});
|
||||
|
||||
std::array<RAWINPUTDEVICE, 2> devices;
|
||||
@ -103,7 +103,7 @@ void ciface::Win32::Init(void* hwnd)
|
||||
if (!RegisterRawInputDevices(devices.data(), static_cast<UINT>(devices.size()),
|
||||
static_cast<UINT>(sizeof(decltype(devices)::value_type))))
|
||||
{
|
||||
ERROR_LOG_FMT(SERIALINTERFACE, "RegisterRawInputDevices failed: {}", GetLastError());
|
||||
ERROR_LOG_FMT(CONTROLLERINTERFACE, "RegisterRawInputDevices failed: {}", GetLastError());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -128,18 +128,18 @@ void ciface::Win32::PopulateDevices(void* hwnd)
|
||||
s_done_populating.Reset();
|
||||
PostMessage(s_message_window, WM_INPUT_DEVICE_CHANGE, 0, 0);
|
||||
if (!s_done_populating.WaitFor(std::chrono::seconds(10)))
|
||||
ERROR_LOG_FMT(SERIALINTERFACE, "win32 timed out when trying to populate devices");
|
||||
ERROR_LOG_FMT(CONTROLLERINTERFACE, "win32 timed out when trying to populate devices");
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG_FMT(SERIALINTERFACE,
|
||||
ERROR_LOG_FMT(CONTROLLERINTERFACE,
|
||||
"win32 asked to populate devices, but device thread isn't running");
|
||||
}
|
||||
}
|
||||
|
||||
void ciface::Win32::DeInit()
|
||||
{
|
||||
NOTICE_LOG_FMT(SERIALINTERFACE, "win32 DeInit");
|
||||
NOTICE_LOG_FMT(CONTROLLERINTERFACE, "win32 DeInit");
|
||||
if (s_thread.joinable())
|
||||
{
|
||||
PostMessage(s_message_window, WM_DOLPHIN_STOP, 0, 0);
|
||||
|
@ -253,7 +253,7 @@ static void AddDeviceNode(const char* devnode)
|
||||
auto evdev_device = FindDeviceWithUniqueIDAndPhysicalLocation(uniq, phys);
|
||||
if (evdev_device)
|
||||
{
|
||||
NOTICE_LOG_FMT(SERIALINTERFACE,
|
||||
NOTICE_LOG_FMT(CONTROLLERINTERFACE,
|
||||
"evdev combining devices with unique id: {}, physical location: {}", uniq, phys);
|
||||
|
||||
evdev_device->AddNode(devnode, fd, dev);
|
||||
@ -282,7 +282,7 @@ static void AddDeviceNode(const char* devnode)
|
||||
static void HotplugThreadFunc()
|
||||
{
|
||||
Common::SetCurrentThreadName("evdev Hotplug Thread");
|
||||
NOTICE_LOG_FMT(SERIALINTERFACE, "evdev hotplug thread started");
|
||||
NOTICE_LOG_FMT(CONTROLLERINTERFACE, "evdev hotplug thread started");
|
||||
|
||||
udev* const udev = udev_new();
|
||||
Common::ScopeGuard udev_guard([udev] { udev_unref(udev); });
|
||||
@ -337,7 +337,7 @@ static void HotplugThreadFunc()
|
||||
AddDeviceNode(devnode);
|
||||
}
|
||||
}
|
||||
NOTICE_LOG_FMT(SERIALINTERFACE, "evdev hotplug thread stopped");
|
||||
NOTICE_LOG_FMT(CONTROLLERINTERFACE, "evdev hotplug thread stopped");
|
||||
}
|
||||
|
||||
static void StartHotplugThread()
|
||||
|
Reference in New Issue
Block a user