Skip to content
Permalink
Browse files

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.
  • Loading branch information...
lioncash committed May 31, 2019
1 parent bcdc5b5 commit d89ea8bf410d204c9c5c05a4564cd7c927d390d5
Showing with 3 additions and 6 deletions.
  1. +2 −5 Source/Core/Core/IOS/USB/USB_KBD.cpp
  2. +1 −1 Source/Core/Core/IOS/USB/USB_KBD.h
@@ -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;
@@ -54,7 +54,7 @@ class USB_KBD : public Device
std::array<bool, 256> m_OldKeyBuffer{};
u8 m_OldModifiers = 0;

virtual bool IsKeyPressed(int _Key);
bool IsKeyPressed(int key) const;

// This stuff should probably die
enum

0 comments on commit d89ea8b

Please sign in to comment.
You can’t perform that action at this time.