From d89ea8bf410d204c9c5c05a4564cd7c927d390d5 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 31 May 2019 08:40:41 -0400 Subject: [PATCH] IOS/USB_KBD: Make IsKeyPressed() a non-virtual const member function No other class inherits the USB_KBD class, and this function doesn't actually modify instance state, so it can be made a const member function. --- Source/Core/Core/IOS/USB/USB_KBD.cpp | 7 ++----- Source/Core/Core/IOS/USB/USB_KBD.h | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Source/Core/Core/IOS/USB/USB_KBD.cpp b/Source/Core/Core/IOS/USB/USB_KBD.cpp index ac006c1444..63b41cb230 100644 --- a/Source/Core/Core/IOS/USB/USB_KBD.cpp +++ b/Source/Core/Core/IOS/USB/USB_KBD.cpp @@ -219,13 +219,10 @@ IPCCommandResult USB_KBD::IOCtl(const IOCtlRequest& request) return GetDefaultReply(IPC_SUCCESS); } -bool USB_KBD::IsKeyPressed(int _Key) +bool USB_KBD::IsKeyPressed(int key) const { #ifdef _WIN32 - if (GetAsyncKeyState(_Key) & 0x8000) - return true; - else - return false; + return (GetAsyncKeyState(key) & 0x8000) != 0; #else // TODO: do it for non-Windows platforms return false; diff --git a/Source/Core/Core/IOS/USB/USB_KBD.h b/Source/Core/Core/IOS/USB/USB_KBD.h index d0039d4ba7..0936a697d5 100644 --- a/Source/Core/Core/IOS/USB/USB_KBD.h +++ b/Source/Core/Core/IOS/USB/USB_KBD.h @@ -54,7 +54,7 @@ private: std::array m_OldKeyBuffer{}; u8 m_OldModifiers = 0; - virtual bool IsKeyPressed(int _Key); + bool IsKeyPressed(int key) const; // This stuff should probably die enum