From ca9bf3174f4acd4c9d78ac7c21b6aeaa1430b7ef Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sun, 12 Dec 2021 13:50:18 -0800 Subject: Use HRWrap in remaining locations Note that D3DCommon can't use DX11HRWrap or DX12HRWrap since it's shared between them. --- .../InputCommon/ControllerInterface/Win32/Win32.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'Source/Core/InputCommon/ControllerInterface/Win32/Win32.cpp') diff --git a/Source/Core/InputCommon/ControllerInterface/Win32/Win32.cpp b/Source/Core/InputCommon/ControllerInterface/Win32/Win32.cpp index 21ee1fa425..a6ff77511e 100644 --- a/Source/Core/InputCommon/ControllerInterface/Win32/Win32.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Win32/Win32.cpp @@ -11,6 +11,7 @@ #include #include "Common/Flag.h" +#include "Common/HRWrap.h" #include "Common/Logging/Log.h" #include "Common/ScopeGuard.h" #include "Common/Thread.h" @@ -61,9 +62,10 @@ void ciface::Win32::Init(void* hwnd) HWND message_window = nullptr; Common::ScopeGuard promise_guard([&] { message_window_promise.set_value(message_window); }); - if (FAILED(CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED))) + HRESULT hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); + if (FAILED(hr)) { - ERROR_LOG_FMT(CONTROLLERINTERFACE, "CoInitializeEx failed: {}", GetLastError()); + ERROR_LOG_FMT(CONTROLLERINTERFACE, "CoInitializeEx failed: {}", Common::HRWrap(hr)); return; } Common::ScopeGuard uninit([] { CoUninitialize(); }); @@ -77,12 +79,14 @@ void ciface::Win32::Init(void* hwnd) ATOM window_class = RegisterClassEx(&window_class_info); if (!window_class) { - NOTICE_LOG_FMT(CONTROLLERINTERFACE, "RegisterClassEx failed: {}", GetLastError()); + NOTICE_LOG_FMT(CONTROLLERINTERFACE, "RegisterClassEx failed: {}", + Common::HRWrap(GetLastError())); return; } Common::ScopeGuard unregister([&window_class] { if (!UnregisterClass(MAKEINTATOM(window_class), GetModuleHandle(nullptr))) - ERROR_LOG_FMT(CONTROLLERINTERFACE, "UnregisterClass failed: {}", GetLastError()); + ERROR_LOG_FMT(CONTROLLERINTERFACE, "UnregisterClass failed: {}", + Common::HRWrap(GetLastError())); }); message_window = CreateWindowEx(0, L"Message", nullptr, 0, 0, 0, 0, 0, HWND_MESSAGE, nullptr, @@ -90,12 +94,14 @@ void ciface::Win32::Init(void* hwnd) promise_guard.Exit(); if (!message_window) { - ERROR_LOG_FMT(CONTROLLERINTERFACE, "CreateWindowEx failed: {}", GetLastError()); + ERROR_LOG_FMT(CONTROLLERINTERFACE, "CreateWindowEx failed: {}", + Common::HRWrap(GetLastError())); return; } Common::ScopeGuard destroy([&] { if (!DestroyWindow(message_window)) - ERROR_LOG_FMT(CONTROLLERINTERFACE, "DestroyWindow failed: {}", GetLastError()); + ERROR_LOG_FMT(CONTROLLERINTERFACE, "DestroyWindow failed: {}", + Common::HRWrap(GetLastError())); }); std::array devices; -- cgit v1.2.3