From f2e739992d64330e4bd77b873872d4c276c08853 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Mon, 8 Jul 2013 12:35:08 +0200 Subject: [PATCH] More mousewheel support --- Common/KeyMap.cpp | 10 ++++++++-- UI/MainScreen.cpp | 6 ++++++ UI/MainScreen.h | 1 + UI/MenuScreens.cpp | 4 ++-- Windows/WndMainWindow.cpp | 22 +++++++++++++++++++++- native | 2 +- 6 files changed, 39 insertions(+), 6 deletions(-) diff --git a/Common/KeyMap.cpp b/Common/KeyMap.cpp index 967d863e0e..1030beb051 100644 --- a/Common/KeyMap.cpp +++ b/Common/KeyMap.cpp @@ -341,6 +341,12 @@ const KeyMap_IntStrPair key_names[] = { {KEYCODE_NUMPAD_7, "Num7"}, {KEYCODE_NUMPAD_8, "Num8"}, {KEYCODE_NUMPAD_9, "Num9"}, + + {KEYCODE_EXT_MOUSEBUTTON_1, "MB1"}, + {KEYCODE_EXT_MOUSEBUTTON_2, "MB2"}, + {KEYCODE_EXT_MOUSEBUTTON_3, "MB3"}, + {KEYCODE_EXT_MOUSEWHEEL_UP, "MWheelU"}, + {KEYCODE_EXT_MOUSEWHEEL_DOWN, "MWheelD"}, }; const KeyMap_IntStrPair axis_names[] = { @@ -355,10 +361,10 @@ const KeyMap_IntStrPair axis_names[] = { {JOYSTICK_AXIS_ORIENTATION, "Orient"}, {JOYSTICK_AXIS_VSCROLL, "Vert Scroll"}, {JOYSTICK_AXIS_HSCROLL, "Horiz Scroll"}, - {JOYSTICK_AXIS_Z, "Z Axis"}, + {JOYSTICK_AXIS_Z, "Z Axis"}, // Also used as second stick X on many controllers - rename? {JOYSTICK_AXIS_RX, "X Rotation"}, {JOYSTICK_AXIS_RY, "Y Rotation"}, - {JOYSTICK_AXIS_RZ, "Z Rotation"}, + {JOYSTICK_AXIS_RZ, "Z Rotation"}, // Also used as second stick Y on many controllers - rename? {JOYSTICK_AXIS_HAT_X, "X HAT"}, {JOYSTICK_AXIS_HAT_Y, "Y HAT"}, {JOYSTICK_AXIS_LTRIGGER, "TriggerL"}, diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index ea69222f83..6c71ee10d2 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -340,6 +340,12 @@ void MainScreen::CreateViews() { rightColumnItems->Add(new Choice("Support PPSSPP"))->OnClick.Handle(this, &MainScreen::OnSupport); } +void MainScreen::sendMessage(const char *message, const char *value) { + if (!strcmp(message, "boot")) { + screenManager()->switchScreen(new EmuScreen(value)); + } +} + void DrawBackground(float alpha); void MainScreen::DrawBackground(UIContext &dc) { diff --git a/UI/MainScreen.h b/UI/MainScreen.h index 0d049615fc..ec784b8de0 100644 --- a/UI/MainScreen.h +++ b/UI/MainScreen.h @@ -31,6 +31,7 @@ public: protected: virtual void CreateViews(); virtual void DrawBackground(UIContext &dc); + virtual void sendMessage(const char *message, const char *value); private: UI::EventReturn OnGameSelected(UI::EventParams &e); diff --git a/UI/MenuScreens.cpp b/UI/MenuScreens.cpp index 1fb517f7cd..25e4ca4a5c 100644 --- a/UI/MenuScreens.cpp +++ b/UI/MenuScreens.cpp @@ -243,8 +243,8 @@ void MenuScreen::render() { g_Config.Save(); screenManager()->switchScreen(new EmuScreen(fileName.toStdString())); } -#elif _WIN32 - MainWindow::BrowseAndBoot(""); +//#elif _WIN32 +// MainWindow::BrowseAndBoot(""); #else FileSelectScreenOptions options; options.allowChooseDirectory = true; diff --git a/Windows/WndMainWindow.cpp b/Windows/WndMainWindow.cpp index 44fa52e560..b8d5f83a0a 100644 --- a/Windows/WndMainWindow.cpp +++ b/Windows/WndMainWindow.cpp @@ -12,6 +12,7 @@ #include "commctrl.h" #include "input/input_state.h" +#include "input/keycodes.h" #include "Core/Debugger/SymbolMap.h" #include "Windows/OpenGLBase.h" #include "Windows/Debugger/Debugger_Disasm.h" @@ -403,7 +404,6 @@ namespace MainWindow } break; - // Actual touch! Unfinished case WM_TOUCH: @@ -500,6 +500,26 @@ namespace MainWindow } break; + // For some reason, need to catch this here rather than in DisplayProc. + case WM_MOUSEWHEEL: + { + int wheelDelta = (short)(wParam >> 16); + KeyInput key; + key.deviceId = DEVICE_ID_MOUSE; + + if (wheelDelta < 0) { + key.keyCode = KEYCODE_EXT_MOUSEWHEEL_DOWN; + wheelDelta = -wheelDelta; + } else { + key.keyCode = KEYCODE_EXT_MOUSEWHEEL_UP; + } + // There's no separate keyup event for mousewheel events, let's pass them both together. + // This also means it really won't work great for key mapping :( Need to build a 1 frame delay or something. + key.flags = KEY_DOWN | KEY_UP | KEY_HASWHEELDELTA | (wheelDelta << 16); + NativeKey(key); + break; + } + case WM_COMMAND: { if (!EmuThread_Ready()) diff --git a/native b/native index 57d3fa0134..28fb341cb2 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit 57d3fa01345d447cad3d943838a74c71e4e08a7e +Subproject commit 28fb341cb2a43fbab66ac7c4baa3abaca7cbe7aa