mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 22:29:39 -06:00
Move in-game keybinding handling to a central location
Instead of handling it separately in every backend.
This commit is contained in:
@ -8,7 +8,6 @@
|
||||
#include "EmuWindow.h"
|
||||
#include "Fifo.h"
|
||||
#include "VertexShaderManager.h"
|
||||
#include "RenderBase.h"
|
||||
#include "VideoBackendBase.h"
|
||||
#include "Core.h"
|
||||
#include "Host.h"
|
||||
@ -42,28 +41,8 @@ HWND GetParentWnd()
|
||||
return m_hParent;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// KeyDown events
|
||||
// -------------
|
||||
void OnKeyDown(WPARAM wParam)
|
||||
{
|
||||
switch (LOWORD( wParam ))
|
||||
{
|
||||
case '3': // OSD keys
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
if (g_Config.bOSDHotKey)
|
||||
OSDMenu(wParam);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
void FreeLookInput( UINT iMsg, WPARAM wParam )
|
||||
{
|
||||
static float debugSpeed = 1.0f;
|
||||
static bool mouseLookEnabled = false;
|
||||
static bool mouseMoveEnabled = false;
|
||||
static float lastMouse[2];
|
||||
@ -71,34 +50,6 @@ void FreeLookInput( UINT iMsg, WPARAM wParam )
|
||||
|
||||
switch(iMsg)
|
||||
{
|
||||
case WM_USER_KEYDOWN:
|
||||
case WM_KEYDOWN:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case '9':
|
||||
debugSpeed /= 2.0f;
|
||||
break;
|
||||
case '0':
|
||||
debugSpeed *= 2.0f;
|
||||
break;
|
||||
case 'W':
|
||||
VertexShaderManager::TranslateView(0.0f, debugSpeed);
|
||||
break;
|
||||
case 'S':
|
||||
VertexShaderManager::TranslateView(0.0f, -debugSpeed);
|
||||
break;
|
||||
case 'A':
|
||||
VertexShaderManager::TranslateView(debugSpeed, 0.0f);
|
||||
break;
|
||||
case 'D':
|
||||
VertexShaderManager::TranslateView(-debugSpeed, 0.0f);
|
||||
break;
|
||||
case 'R':
|
||||
VertexShaderManager::ResetView();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
if (mouseLookEnabled)
|
||||
{
|
||||
@ -190,11 +141,6 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
||||
break;
|
||||
|
||||
case WM_USER:
|
||||
if (wParam == WM_USER_KEYDOWN)
|
||||
{
|
||||
OnKeyDown(lParam);
|
||||
FreeLookInput((u32)wParam, lParam);
|
||||
}
|
||||
break;
|
||||
|
||||
// Called when a screensaver wants to show up while this window is active
|
||||
@ -224,51 +170,6 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// OSD Menu
|
||||
// -------------
|
||||
// Let's begin with 3 since 1 and 2 are default Wii keys
|
||||
// -------------
|
||||
void OSDMenu(WPARAM wParam)
|
||||
{
|
||||
switch( LOWORD( wParam ))
|
||||
{
|
||||
case '3':
|
||||
OSDChoice = 1;
|
||||
// Toggle native resolution
|
||||
g_Config.iEFBScale = g_Config.iEFBScale + 1;
|
||||
if (g_Config.iEFBScale > SCALE_4X) g_Config.iEFBScale = SCALE_AUTO;
|
||||
break;
|
||||
case '4':
|
||||
OSDChoice = 2;
|
||||
// Toggle aspect ratio
|
||||
g_Config.iAspectRatio = (g_Config.iAspectRatio + 1) & 3;
|
||||
break;
|
||||
case '5':
|
||||
OSDChoice = 3;
|
||||
// Toggle EFB copy
|
||||
if (!g_Config.bEFBCopyEnable)
|
||||
{
|
||||
g_Config.bEFBCopyEnable = true;
|
||||
g_Config.bCopyEFBToTexture = false;
|
||||
}
|
||||
else if (!g_Config.bCopyEFBToTexture)
|
||||
{
|
||||
g_Config.bCopyEFBToTexture = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_Config.bEFBCopyEnable = false;
|
||||
g_Config.bCopyEFBToTexture = false;
|
||||
}
|
||||
break;
|
||||
case '6':
|
||||
OSDChoice = 4;
|
||||
g_Config.bDisableFog = !g_Config.bDisableFog;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const TCHAR *title)
|
||||
{
|
||||
wndClass.cbSize = sizeof( wndClass );
|
||||
|
Reference in New Issue
Block a user