[Project64-input] N64 Mouse Support (#2160)
* [Project64-input] Unpolished Mouse Support (Use Present value as Device Type) * [Project64-input] Use Forced N64 Mouse config (using System Mouse) * [Project64-input] Disable Mouse Scanning * [Project64-input] Polish UI by adding Mouse image + Prevent Controller setup when using N64 Mouse * [Project64-input] Revert Controller Save/Load changes * [Project64-input] Seperate N64 Mouse into its own configuration * [Project64-input] Add Mouse Locking + Shortcut System * [Project64-input] Make Cursor invisible when locked * [Project64-input] Make sure to unlock mouse when opening config * [Project64-input] Working Lock/Unlock Shortcut + Only emulate mouse when locked * [Project64-input] Use ClipCursor instead of DirectInput Exclusive Level * [Project64-input] Add Mouse Sensitivity option + Change to SetCursorPos * [Project64-input] Add WM_KillFocus and EmulationPaused functions * [Project64-core] Move EmulationPaused call to really make sure it is called in all cases
This commit is contained in:
parent
40683ecf79
commit
5d82837984
|
@ -460,18 +460,29 @@ void CPifRam::ProcessControllerCommand(int32_t Control, uint8_t * Command)
|
||||||
g_Notify->DisplayError("What am I meant to do with this controller command?");
|
g_Notify->DisplayError("What am I meant to do with this controller command?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Controllers[Control].Present != 0)
|
if (Controllers[Control].Present != PRESENT_NONE)
|
||||||
{
|
{
|
||||||
Command[3] = 0x05;
|
if (Controllers[Control].Present != PRESENT_MOUSE)
|
||||||
Command[4] = 0x00;
|
|
||||||
switch (Controllers[Control].Plugin)
|
|
||||||
{
|
{
|
||||||
case PLUGIN_TANSFER_PAK:
|
//N64 Controller
|
||||||
case PLUGIN_RUMBLE_PAK:
|
Command[3] = 0x05;
|
||||||
case PLUGIN_MEMPAK:
|
Command[4] = 0x00;
|
||||||
case PLUGIN_RAW:
|
switch (Controllers[Control].Plugin)
|
||||||
Command[5] = 1; break;
|
{
|
||||||
default: Command[5] = 0; break;
|
case PLUGIN_TANSFER_PAK:
|
||||||
|
case PLUGIN_RUMBLE_PAK:
|
||||||
|
case PLUGIN_MEMPAK:
|
||||||
|
case PLUGIN_RAW:
|
||||||
|
Command[5] = 1; break;
|
||||||
|
default: Command[5] = 0; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else //if (Controllers[Control].Present == PRESENT_MOUSE)
|
||||||
|
{
|
||||||
|
//N64 Mouse
|
||||||
|
Command[3] = 0x02;
|
||||||
|
Command[4] = 0x00;
|
||||||
|
Command[5] = 0x00;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -487,7 +498,7 @@ void CPifRam::ProcessControllerCommand(int32_t Control, uint8_t * Command)
|
||||||
g_Notify->DisplayError("What am I meant to do with this controller command?");
|
g_Notify->DisplayError("What am I meant to do with this controller command?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Controllers[Control].Present == false)
|
if (Controllers[Control].Present == PRESENT_NONE)
|
||||||
{
|
{
|
||||||
Command[1] |= 0x80;
|
Command[1] |= 0x80;
|
||||||
}
|
}
|
||||||
|
@ -504,7 +515,7 @@ void CPifRam::ProcessControllerCommand(int32_t Control, uint8_t * Command)
|
||||||
g_Notify->DisplayError("What am I meant to do with this controller command?");
|
g_Notify->DisplayError("What am I meant to do with this controller command?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Controllers[Control].Present != 0)
|
if (Controllers[Control].Present != PRESENT_NONE)
|
||||||
{
|
{
|
||||||
uint32_t address = (Command[3] << 8) | (Command[4] & 0xE0);
|
uint32_t address = (Command[3] << 8) | (Command[4] & 0xE0);
|
||||||
uint8_t* data = &Command[5];
|
uint8_t* data = &Command[5];
|
||||||
|
@ -545,7 +556,7 @@ void CPifRam::ProcessControllerCommand(int32_t Control, uint8_t * Command)
|
||||||
g_Notify->DisplayError("What am I meant to do with this controller command?");
|
g_Notify->DisplayError("What am I meant to do with this controller command?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Controllers[Control].Present != 0)
|
if (Controllers[Control].Present != PRESENT_NONE)
|
||||||
{
|
{
|
||||||
uint32_t address = (Command[3] << 8) | (Command[4] & 0xE0);
|
uint32_t address = (Command[3] << 8) | (Command[4] & 0xE0);
|
||||||
uint8_t* data = &Command[5];
|
uint8_t* data = &Command[5];
|
||||||
|
@ -587,7 +598,7 @@ void CPifRam::ReadControllerCommand(int32_t Control, uint8_t * Command)
|
||||||
switch (Command[2])
|
switch (Command[2])
|
||||||
{
|
{
|
||||||
case 0x01: // Read controller
|
case 0x01: // Read controller
|
||||||
if (Controllers[Control].Present != 0)
|
if (Controllers[Control].Present != PRESENT_NONE)
|
||||||
{
|
{
|
||||||
if (bShowPifRamErrors())
|
if (bShowPifRamErrors())
|
||||||
{
|
{
|
||||||
|
@ -599,7 +610,7 @@ void CPifRam::ReadControllerCommand(int32_t Control, uint8_t * Command)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x02: // Read from controller pak
|
case 0x02: // Read from controller pak
|
||||||
if (Controllers[Control].Present != 0)
|
if (Controllers[Control].Present != PRESENT_NONE)
|
||||||
{
|
{
|
||||||
switch (Controllers[Control].Plugin)
|
switch (Controllers[Control].Plugin)
|
||||||
{
|
{
|
||||||
|
@ -608,7 +619,7 @@ void CPifRam::ReadControllerCommand(int32_t Control, uint8_t * Command)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x03: // Write controller pak
|
case 0x03: // Write controller pak
|
||||||
if (Controllers[Control].Present != 0)
|
if (Controllers[Control].Present != PRESENT_NONE)
|
||||||
{
|
{
|
||||||
switch (Controllers[Control].Plugin)
|
switch (Controllers[Control].Plugin)
|
||||||
{
|
{
|
||||||
|
|
|
@ -768,6 +768,9 @@ void CN64System::EndEmulation(void)
|
||||||
|
|
||||||
void CN64System::Pause()
|
void CN64System::Pause()
|
||||||
{
|
{
|
||||||
|
if (g_Plugins && g_Plugins->Control()->EmulationPaused) {
|
||||||
|
g_Plugins->Control()->EmulationPaused();
|
||||||
|
}
|
||||||
if (m_EndEmulation)
|
if (m_EndEmulation)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -34,6 +34,8 @@ bool CControl_Plugin::LoadFunctions(void)
|
||||||
LoadFunction(WM_KeyDown);
|
LoadFunction(WM_KeyDown);
|
||||||
LoadFunction(WM_KeyUp);
|
LoadFunction(WM_KeyUp);
|
||||||
LoadFunction(RumbleCommand);
|
LoadFunction(RumbleCommand);
|
||||||
|
LoadFunction(WM_KillFocus);
|
||||||
|
LoadFunction(EmulationPaused);
|
||||||
|
|
||||||
// Make sure DLL had all needed functions
|
// Make sure DLL had all needed functions
|
||||||
if (InitiateControllers == nullptr) { UnloadPlugin(); return false; }
|
if (InitiateControllers == nullptr) { UnloadPlugin(); return false; }
|
||||||
|
@ -58,7 +60,7 @@ bool CControl_Plugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
|
|
||||||
for (int32_t i = 0; i < 4; i++)
|
for (int32_t i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
m_PluginControllers[i].Present = false;
|
m_PluginControllers[i].Present = PRESENT_NONE;
|
||||||
m_PluginControllers[i].RawData = false;
|
m_PluginControllers[i].RawData = false;
|
||||||
m_PluginControllers[i].Plugin = PLUGIN_NONE;
|
m_PluginControllers[i].Plugin = PLUGIN_NONE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,13 @@ enum PluginType
|
||||||
PLUGIN_RAW = 5, // The controller plugin is passed in raw data
|
PLUGIN_RAW = 5, // The controller plugin is passed in raw data
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum PresentType
|
||||||
|
{
|
||||||
|
PRESENT_NONE = 0,
|
||||||
|
PRESENT_CONT = 1,
|
||||||
|
PRESENT_MOUSE = 2,
|
||||||
|
};
|
||||||
|
|
||||||
class CControl_Plugin;
|
class CControl_Plugin;
|
||||||
|
|
||||||
class CCONTROL
|
class CCONTROL
|
||||||
|
@ -96,6 +103,8 @@ public:
|
||||||
|
|
||||||
void(CALL *WM_KeyDown) (uint32_t wParam, uint32_t lParam);
|
void(CALL *WM_KeyDown) (uint32_t wParam, uint32_t lParam);
|
||||||
void(CALL *WM_KeyUp) (uint32_t wParam, uint32_t lParam);
|
void(CALL *WM_KeyUp) (uint32_t wParam, uint32_t lParam);
|
||||||
|
void(CALL *WM_KillFocus) (uint32_t wParam, uint32_t lParam);
|
||||||
|
void(CALL *EmulationPaused) ();
|
||||||
void(CALL *RumbleCommand) (int32_t Control, int32_t bRumble);
|
void(CALL *RumbleCommand) (int32_t Control, int32_t bRumble);
|
||||||
fnGetKeys GetKeys;
|
fnGetKeys GetKeys;
|
||||||
void(CALL *ReadController) (int32_t Control, uint8_t * Command);
|
void(CALL *ReadController) (int32_t Control, uint8_t * Command);
|
||||||
|
|
|
@ -8,7 +8,8 @@ CProject64Input::CProject64Input(HINSTANCE hinst) :
|
||||||
m_hinst(hinst),
|
m_hinst(hinst),
|
||||||
m_Scanning(false),
|
m_Scanning(false),
|
||||||
m_DisplayCtrlId(0),
|
m_DisplayCtrlId(0),
|
||||||
m_iFirstController(-1)
|
m_iFirstController(-1),
|
||||||
|
m_MouseLock(false)
|
||||||
{
|
{
|
||||||
memset(m_Controllers, 0, sizeof(m_Controllers));
|
memset(m_Controllers, 0, sizeof(m_Controllers));
|
||||||
}
|
}
|
||||||
|
@ -45,11 +46,17 @@ void CProject64Input::InitiateControllers(CONTROL_INFO * ControlInfo)
|
||||||
{
|
{
|
||||||
g_Settings->LoadController(i, m_ControlInfo.Controls[i], m_Controllers[i]);
|
g_Settings->LoadController(i, m_ControlInfo.Controls[i], m_Controllers[i]);
|
||||||
m_DirectInput->MapControllerDevice(m_Controllers[i]);
|
m_DirectInput->MapControllerDevice(m_Controllers[i]);
|
||||||
if (m_ControlInfo.Controls[i].Present != 0 && m_iFirstController < 0)
|
if (m_ControlInfo.Controls[i].Present != PRESENT_NONE && m_iFirstController < 0)
|
||||||
{
|
{
|
||||||
m_iFirstController = i;
|
m_iFirstController = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_Settings->GetControllerMouse(m_N64Mouse);
|
||||||
|
m_DirectInput->MapControllerDevice(m_N64Mouse);
|
||||||
|
|
||||||
|
g_Settings->LoadShortcuts(m_Shortcuts);
|
||||||
|
m_DirectInput->MapShortcutDevice(m_Shortcuts);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CProject64Input::GetKeys(int32_t Control, BUTTONS * Keys)
|
void CProject64Input::GetKeys(int32_t Control, BUTTONS * Keys)
|
||||||
|
@ -62,23 +69,53 @@ void CProject64Input::GetKeys(int32_t Control, BUTTONS * Keys)
|
||||||
if (Control == m_iFirstController)
|
if (Control == m_iFirstController)
|
||||||
{
|
{
|
||||||
m_DirectInput->UpdateDeviceData();
|
m_DirectInput->UpdateDeviceData();
|
||||||
|
CheckShortcuts();
|
||||||
}
|
}
|
||||||
N64CONTROLLER & Controller = m_Controllers[Control];
|
if (m_ControlInfo.Controls[Control].Present == PRESENT_MOUSE)
|
||||||
Keys->R_DPAD = m_DirectInput->IsButtonPressed(Controller.R_DPAD);
|
{
|
||||||
Keys->L_DPAD = m_DirectInput->IsButtonPressed(Controller.L_DPAD);
|
//Mouse
|
||||||
Keys->D_DPAD = m_DirectInput->IsButtonPressed(Controller.D_DPAD);
|
if (m_MouseLock)
|
||||||
Keys->U_DPAD = m_DirectInput->IsButtonPressed(Controller.U_DPAD);
|
{
|
||||||
Keys->START_BUTTON = m_DirectInput->IsButtonPressed(Controller.START_BUTTON);
|
LockCursor();
|
||||||
Keys->Z_TRIG = m_DirectInput->IsButtonPressed(Controller.Z_TRIG);
|
m_N64Mouse.Sensitivity = m_Controllers[Control].Sensitivity;
|
||||||
Keys->B_BUTTON = m_DirectInput->IsButtonPressed(Controller.B_BUTTON);
|
Keys->R_DPAD = m_DirectInput->IsButtonPressed(m_N64Mouse.R_DPAD);
|
||||||
Keys->A_BUTTON = m_DirectInput->IsButtonPressed(Controller.A_BUTTON);
|
Keys->L_DPAD = m_DirectInput->IsButtonPressed(m_N64Mouse.L_DPAD);
|
||||||
Keys->R_CBUTTON = m_DirectInput->IsButtonPressed(Controller.R_CBUTTON);
|
Keys->D_DPAD = m_DirectInput->IsButtonPressed(m_N64Mouse.D_DPAD);
|
||||||
Keys->L_CBUTTON = m_DirectInput->IsButtonPressed(Controller.L_CBUTTON);
|
Keys->U_DPAD = m_DirectInput->IsButtonPressed(m_N64Mouse.U_DPAD);
|
||||||
Keys->D_CBUTTON = m_DirectInput->IsButtonPressed(Controller.D_CBUTTON);
|
Keys->START_BUTTON = m_DirectInput->IsButtonPressed(m_N64Mouse.START_BUTTON);
|
||||||
Keys->U_CBUTTON = m_DirectInput->IsButtonPressed(Controller.U_CBUTTON);
|
Keys->Z_TRIG = m_DirectInput->IsButtonPressed(m_N64Mouse.Z_TRIG);
|
||||||
Keys->R_TRIG = m_DirectInput->IsButtonPressed(Controller.R_TRIG);
|
Keys->B_BUTTON = m_DirectInput->IsButtonPressed(m_N64Mouse.B_BUTTON);
|
||||||
Keys->L_TRIG = m_DirectInput->IsButtonPressed(Controller.L_TRIG);
|
Keys->A_BUTTON = m_DirectInput->IsButtonPressed(m_N64Mouse.A_BUTTON);
|
||||||
m_DirectInput->GetAxis(Controller, Keys);
|
Keys->R_CBUTTON = m_DirectInput->IsButtonPressed(m_N64Mouse.R_CBUTTON);
|
||||||
|
Keys->L_CBUTTON = m_DirectInput->IsButtonPressed(m_N64Mouse.L_CBUTTON);
|
||||||
|
Keys->D_CBUTTON = m_DirectInput->IsButtonPressed(m_N64Mouse.D_CBUTTON);
|
||||||
|
Keys->U_CBUTTON = m_DirectInput->IsButtonPressed(m_N64Mouse.U_CBUTTON);
|
||||||
|
Keys->R_TRIG = m_DirectInput->IsButtonPressed(m_N64Mouse.R_TRIG);
|
||||||
|
Keys->L_TRIG = m_DirectInput->IsButtonPressed(m_N64Mouse.L_TRIG);
|
||||||
|
m_DirectInput->GetAxis(m_N64Mouse, Keys);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Controller
|
||||||
|
N64CONTROLLER& Controller = m_Controllers[Control];
|
||||||
|
Keys->R_DPAD = m_DirectInput->IsButtonPressed(Controller.R_DPAD);
|
||||||
|
Keys->L_DPAD = m_DirectInput->IsButtonPressed(Controller.L_DPAD);
|
||||||
|
Keys->D_DPAD = m_DirectInput->IsButtonPressed(Controller.D_DPAD);
|
||||||
|
Keys->U_DPAD = m_DirectInput->IsButtonPressed(Controller.U_DPAD);
|
||||||
|
Keys->START_BUTTON = m_DirectInput->IsButtonPressed(Controller.START_BUTTON);
|
||||||
|
Keys->Z_TRIG = m_DirectInput->IsButtonPressed(Controller.Z_TRIG);
|
||||||
|
Keys->B_BUTTON = m_DirectInput->IsButtonPressed(Controller.B_BUTTON);
|
||||||
|
Keys->A_BUTTON = m_DirectInput->IsButtonPressed(Controller.A_BUTTON);
|
||||||
|
Keys->R_CBUTTON = m_DirectInput->IsButtonPressed(Controller.R_CBUTTON);
|
||||||
|
Keys->L_CBUTTON = m_DirectInput->IsButtonPressed(Controller.L_CBUTTON);
|
||||||
|
Keys->D_CBUTTON = m_DirectInput->IsButtonPressed(Controller.D_CBUTTON);
|
||||||
|
Keys->U_CBUTTON = m_DirectInput->IsButtonPressed(Controller.U_CBUTTON);
|
||||||
|
Keys->R_TRIG = m_DirectInput->IsButtonPressed(Controller.R_TRIG);
|
||||||
|
Keys->L_TRIG = m_DirectInput->IsButtonPressed(Controller.L_TRIG);
|
||||||
|
m_DirectInput->GetAxis(Controller, Keys);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CProject64Input::StartScanDevices(int32_t DisplayCtrlId)
|
void CProject64Input::StartScanDevices(int32_t DisplayCtrlId)
|
||||||
|
@ -141,3 +178,75 @@ bool CProject64Input::ResetController(uint32_t ControlIndex, CONTROL & ControlIn
|
||||||
m_DirectInput->MapControllerDevice(Controller);
|
m_DirectInput->MapControllerDevice(Controller);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CProject64Input::CheckShortcuts()
|
||||||
|
{
|
||||||
|
bool isPressed = m_DirectInput->IsButtonPressed(m_Shortcuts.LOCKMOUSE);
|
||||||
|
if ((isPressed == true) && (m_Shortcuts.LOCKMOUSE_PRESSED == false))
|
||||||
|
{
|
||||||
|
LockMouseSwitch();
|
||||||
|
}
|
||||||
|
m_Shortcuts.LOCKMOUSE_PRESSED = isPressed;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CProject64Input::SaveShortcuts()
|
||||||
|
{
|
||||||
|
CGuard guard(m_CS);
|
||||||
|
|
||||||
|
g_Settings->SaveShortcuts(m_Shortcuts);
|
||||||
|
m_DirectInput->MapShortcutDevice(m_Shortcuts);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CProject64Input::ResetShortcuts(SHORTCUTS& Shortcuts)
|
||||||
|
{
|
||||||
|
g_Settings->ResetShortcuts(Shortcuts);
|
||||||
|
m_DirectInput->MapShortcutDevice(Shortcuts);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProject64Input::LockMouse()
|
||||||
|
{
|
||||||
|
if (IsMouseUsed() == false) return UnlockMouse();
|
||||||
|
if (m_MouseLock == true) return;
|
||||||
|
PostMessage((HWND)m_ControlInfo.hwnd, WM_HIDE_CUROSR, false, 0);
|
||||||
|
m_MouseLock = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProject64Input::UnlockMouse()
|
||||||
|
{
|
||||||
|
if (m_MouseLock == false) return;
|
||||||
|
PostMessage((HWND)m_ControlInfo.hwnd, WM_HIDE_CUROSR, true, 0);
|
||||||
|
m_MouseLock = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProject64Input::LockMouseSwitch()
|
||||||
|
{
|
||||||
|
if (m_MouseLock == true)
|
||||||
|
{
|
||||||
|
UnlockMouse();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LockMouse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CProject64Input::IsMouseUsed()
|
||||||
|
{
|
||||||
|
for (uint32_t i = 0, n = sizeof(m_Controllers) / sizeof(m_Controllers[0]); i < n; i++)
|
||||||
|
{
|
||||||
|
if (m_ControlInfo.Controls[i].Present == PRESENT_MOUSE)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProject64Input::LockCursor()
|
||||||
|
{
|
||||||
|
RECT rect;
|
||||||
|
GetWindowRect((HWND)m_ControlInfo.hwnd, &rect);
|
||||||
|
SetCursorPos((rect.left + rect.right) / 2, (rect.top + rect.bottom) / 2);
|
||||||
|
}
|
||||||
|
|
|
@ -2,11 +2,18 @@
|
||||||
#include "ControllerSpec1.1.h"
|
#include "ControllerSpec1.1.h"
|
||||||
#include "DirectInput.h"
|
#include "DirectInput.h"
|
||||||
#include "N64Controller.h"
|
#include "N64Controller.h"
|
||||||
|
#include "Shortcuts.h"
|
||||||
#include <Common/CriticalSection.h>
|
#include <Common/CriticalSection.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
class CProject64Input
|
class CProject64Input
|
||||||
{
|
{
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
WM_HIDE_CUROSR = WM_USER + 10,
|
||||||
|
WM_MAKE_FOCUS = WM_USER + 17
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CProject64Input(HINSTANCE hinst);
|
CProject64Input(HINSTANCE hinst);
|
||||||
~CProject64Input();
|
~CProject64Input();
|
||||||
|
@ -22,12 +29,21 @@ public:
|
||||||
std::wstring ControllerDevices(const N64CONTROLLER & Controller);
|
std::wstring ControllerDevices(const N64CONTROLLER & Controller);
|
||||||
bool SaveController(uint32_t ControlIndex);
|
bool SaveController(uint32_t ControlIndex);
|
||||||
bool ResetController(uint32_t ControlIndex, CONTROL & ControlInfo, N64CONTROLLER & Controller);
|
bool ResetController(uint32_t ControlIndex, CONTROL & ControlInfo, N64CONTROLLER & Controller);
|
||||||
|
void CheckShortcuts();
|
||||||
|
bool SaveShortcuts();
|
||||||
|
bool ResetShortcuts(SHORTCUTS& Shortcuts);
|
||||||
|
void LockMouse();
|
||||||
|
void UnlockMouse();
|
||||||
|
void LockMouseSwitch();
|
||||||
|
bool IsMouseUsed();
|
||||||
|
void LockCursor();
|
||||||
|
|
||||||
inline HINSTANCE hInst(void) const { return m_hinst; }
|
inline HINSTANCE hInst(void) const { return m_hinst; }
|
||||||
inline bool IsScanning(void) const { return m_Scanning; }
|
inline bool IsScanning(void) const { return m_Scanning; }
|
||||||
inline int32_t DisplayCtrlId(void) const { return m_DisplayCtrlId; }
|
inline int32_t DisplayCtrlId(void) const { return m_DisplayCtrlId; }
|
||||||
inline N64CONTROLLER & Controllers(int32_t Controller) { return m_Controllers[Controller]; }
|
inline N64CONTROLLER & Controllers(int32_t Controller) { return m_Controllers[Controller]; }
|
||||||
inline CONTROL & ControlInfo(int32_t Controller) { return m_ControlInfo.Controls[Controller]; }
|
inline CONTROL & ControlInfo(int32_t Controller) { return m_ControlInfo.Controls[Controller]; }
|
||||||
|
inline SHORTCUTS& Shortcuts() { return m_Shortcuts; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CProject64Input();
|
CProject64Input();
|
||||||
|
@ -37,11 +53,14 @@ private:
|
||||||
CriticalSection m_CS;
|
CriticalSection m_CS;
|
||||||
CONTROL_INFO m_ControlInfo;
|
CONTROL_INFO m_ControlInfo;
|
||||||
N64CONTROLLER m_Controllers[4];
|
N64CONTROLLER m_Controllers[4];
|
||||||
|
N64CONTROLLER m_N64Mouse;
|
||||||
|
SHORTCUTS m_Shortcuts;
|
||||||
std::unique_ptr<CDirectInput> m_DirectInput;
|
std::unique_ptr<CDirectInput> m_DirectInput;
|
||||||
HINSTANCE m_hinst;
|
HINSTANCE m_hinst;
|
||||||
bool m_Scanning;
|
bool m_Scanning;
|
||||||
int32_t m_DisplayCtrlId;
|
int32_t m_DisplayCtrlId;
|
||||||
int32_t m_iFirstController;
|
int32_t m_iFirstController;
|
||||||
|
bool m_MouseLock;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern CProject64Input * g_InputPlugin;
|
extern CProject64Input * g_InputPlugin;
|
||||||
|
|
|
@ -27,6 +27,13 @@ enum
|
||||||
PLUGIN_RAW = 5,
|
PLUGIN_RAW = 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PRESENT_NONE = 0,
|
||||||
|
PRESENT_CONT = 1,
|
||||||
|
PRESENT_MOUSE = 2,
|
||||||
|
};
|
||||||
|
|
||||||
// Structures
|
// Structures
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -212,6 +219,16 @@ Output: None
|
||||||
|
|
||||||
EXPORT void CALL RomOpen(void);
|
EXPORT void CALL RomOpen(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Function: EmulationPaused
|
||||||
|
Purpose: This function is called when the emulation is paused. (from the
|
||||||
|
emulation thread)
|
||||||
|
Input: None
|
||||||
|
Output: None
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPORT void CALL EmulationPaused(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Function: WM_KeyDown
|
Function: WM_KeyDown
|
||||||
Purpose: To pass the WM_KeyDown message from the emulator to the
|
Purpose: To pass the WM_KeyDown message from the emulator to the
|
||||||
|
@ -231,3 +248,13 @@ Output: None
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EXPORT void CALL WM_KeyUp(uint32_t wParam, uint32_t lParam);
|
EXPORT void CALL WM_KeyUp(uint32_t wParam, uint32_t lParam);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Function: WM_KillFocus
|
||||||
|
Purpose: To pass the WM_KILLFOCUS message from the emulator to the
|
||||||
|
plugin.
|
||||||
|
Input: wParam and lParam of the WM_KILLFOCUS message.
|
||||||
|
Output: None
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPORT void CALL WM_KillFocus(uint32_t wParam, uint32_t lParam);
|
||||||
|
|
|
@ -90,6 +90,28 @@ void CDirectInput::MapControllerDevice(N64CONTROLLER & Controller)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CDirectInput::MapShortcutDevice(SHORTCUTS& Shortcuts)
|
||||||
|
{
|
||||||
|
BUTTON* Buttons[] =
|
||||||
|
{
|
||||||
|
&Shortcuts.LOCKMOUSE,
|
||||||
|
};
|
||||||
|
|
||||||
|
CGuard Guard(m_DeviceCS);
|
||||||
|
for (size_t i = 0, n = sizeof(Buttons) / sizeof(Buttons[0]); i < n; i++)
|
||||||
|
{
|
||||||
|
DEVICE_MAP::iterator itr = m_Devices.find(Buttons[i]->DeviceGuid);
|
||||||
|
if (itr != m_Devices.end())
|
||||||
|
{
|
||||||
|
Buttons[i]->Device = &itr->second;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Buttons[i]->Device = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BOOL CDirectInput::stEnumMakeDeviceList(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef)
|
BOOL CDirectInput::stEnumMakeDeviceList(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef)
|
||||||
{
|
{
|
||||||
return ((CDirectInput *)pvRef)->EnumMakeDeviceList(lpddi);
|
return ((CDirectInput *)pvRef)->EnumMakeDeviceList(lpddi);
|
||||||
|
@ -231,6 +253,13 @@ std::wstring CDirectInput::ButtonAssignment(BUTTON & Button)
|
||||||
" \\/",
|
" \\/",
|
||||||
" <"
|
" <"
|
||||||
};
|
};
|
||||||
|
static const char* iMouse[] =
|
||||||
|
{
|
||||||
|
"X-axis",
|
||||||
|
"Y-axis",
|
||||||
|
"Z-axis",
|
||||||
|
"Button"
|
||||||
|
};
|
||||||
|
|
||||||
if (Button.BtnType == BTNTYPE_JOYBUTTON)
|
if (Button.BtnType == BTNTYPE_JOYBUTTON)
|
||||||
{
|
{
|
||||||
|
@ -278,6 +307,24 @@ std::wstring CDirectInput::ButtonAssignment(BUTTON & Button)
|
||||||
return L"Keyboard: ???";
|
return L"Keyboard: ???";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (Button.BtnType == BTNTYPE_MOUSEAXE)
|
||||||
|
{
|
||||||
|
stdstr_f Offset("%u", Button.Offset);
|
||||||
|
if (Button.Offset < (sizeof(iMouse) / sizeof(iMouse[0])))
|
||||||
|
{
|
||||||
|
Offset = iMouse[Button.Offset];
|
||||||
|
}
|
||||||
|
stdstr_f AxisId(" %u", Button.AxisID);
|
||||||
|
if (Button.AxisID < (sizeof(AxeID) / sizeof(AxeID[0])))
|
||||||
|
{
|
||||||
|
AxisId = AxeID[Button.AxisID];
|
||||||
|
}
|
||||||
|
return stdstr_f("%s%s", Offset.c_str(), AxisId.c_str()).ToUTF16();
|
||||||
|
}
|
||||||
|
if (Button.BtnType == BTNTYPE_MOUSEBUTTON)
|
||||||
|
{
|
||||||
|
return stdstr_f("Button %u", Button.Offset).ToUTF16();
|
||||||
|
}
|
||||||
if (Button.BtnType == BTNTYPE_UNASSIGNED)
|
if (Button.BtnType == BTNTYPE_UNASSIGNED)
|
||||||
{
|
{
|
||||||
return L"";
|
return L"";
|
||||||
|
@ -361,11 +408,15 @@ bool CDirectInput::IsButtonPressed(BUTTON & Button)
|
||||||
return (Device.State.Keyboard[Button.Offset] & 0x80) != 0;
|
return (Device.State.Keyboard[Button.Offset] & 0x80) != 0;
|
||||||
case BTNTYPE_JOYBUTTON:
|
case BTNTYPE_JOYBUTTON:
|
||||||
return (Device.State.Joy.rgbButtons[Button.Offset] & 0x80) != 0;
|
return (Device.State.Joy.rgbButtons[Button.Offset] & 0x80) != 0;
|
||||||
|
case BTNTYPE_MOUSEBUTTON:
|
||||||
|
return (Device.State.Mouse.rgbButtons[Button.Offset] & 0x80) != 0;
|
||||||
case BTNTYPE_JOYPOV:
|
case BTNTYPE_JOYPOV:
|
||||||
return JoyPadPovPressed((AI_POV)Button.AxisID, ((uint32_t *)&Device.State.Joy)[Button.Offset]);
|
return JoyPadPovPressed((AI_POV)Button.AxisID, ((uint32_t *)&Device.State.Joy)[Button.Offset]);
|
||||||
case BTNTYPE_JOYSLIDER:
|
case BTNTYPE_JOYSLIDER:
|
||||||
case BTNTYPE_JOYAXE:
|
case BTNTYPE_JOYAXE:
|
||||||
return Button.AxisID ? ((uint32_t*)&Device.State.Joy)[Button.Offset] > AXIS_BOTTOM_VALUE : ((uint32_t *)&Device.State.Joy)[Button.Offset] < AXIS_TOP_VALUE;
|
return Button.AxisID ? ((uint32_t*)&Device.State.Joy)[Button.Offset] > AXIS_BOTTOM_VALUE : ((uint32_t *)&Device.State.Joy)[Button.Offset] < AXIS_TOP_VALUE;
|
||||||
|
case BTNTYPE_MOUSEAXE:
|
||||||
|
return Button.AxisID ? ((uint32_t*)&Device.State.Mouse)[Button.Offset] > AXIS_BOTTOM_VALUE : ((uint32_t*)&Device.State.Mouse)[Button.Offset] < AXIS_TOP_VALUE;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -413,6 +464,7 @@ void CDirectInput::GetAxis(N64CONTROLLER & Controller, BUTTONS * Keys)
|
||||||
}
|
}
|
||||||
DEVICE & Device = *(DEVICE *)Button.Device;
|
DEVICE & Device = *(DEVICE *)Button.Device;
|
||||||
LPLONG plRawState = (LPLONG)&Device.State.Joy;
|
LPLONG plRawState = (LPLONG)&Device.State.Joy;
|
||||||
|
LPLONG plRawStateMouse = (LPLONG)&Device.State.Mouse;
|
||||||
|
|
||||||
switch (Button.BtnType)
|
switch (Button.BtnType)
|
||||||
{
|
{
|
||||||
|
@ -420,6 +472,20 @@ void CDirectInput::GetAxis(N64CONTROLLER & Controller, BUTTONS * Keys)
|
||||||
case BTNTYPE_JOYAXE:
|
case BTNTYPE_JOYAXE:
|
||||||
l_Value = (plRawState[Button.Offset] - MAX_AXIS_VALUE) * -1;
|
l_Value = (plRawState[Button.Offset] - MAX_AXIS_VALUE) * -1;
|
||||||
|
|
||||||
|
if (Button.AxisID == AI_AXE_NEGATIVE)
|
||||||
|
{
|
||||||
|
fNegInput = !fNegInput;
|
||||||
|
b_Value = (l_Value < 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
b_Value = (l_Value > 0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case BTNTYPE_MOUSEAXE:
|
||||||
|
l_Value = (plRawStateMouse[Button.Offset]) * -1;
|
||||||
|
l_Value *= Controller.Sensitivity * MOUSESCALEVALUE;
|
||||||
|
|
||||||
if (Button.AxisID == AI_AXE_NEGATIVE)
|
if (Button.AxisID == AI_AXE_NEGATIVE)
|
||||||
{
|
{
|
||||||
fNegInput = !fNegInput;
|
fNegInput = !fNegInput;
|
||||||
|
@ -444,6 +510,13 @@ void CDirectInput::GetAxis(N64CONTROLLER & Controller, BUTTONS * Keys)
|
||||||
l_Value = MAX_AXIS_VALUE;
|
l_Value = MAX_AXIS_VALUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case BTNTYPE_MOUSEBUTTON:
|
||||||
|
b_Value = (Device.State.Mouse.rgbButtons[Button.Offset] & 0x80) != 0;
|
||||||
|
if (b_Value)
|
||||||
|
{
|
||||||
|
l_Value = MAX_AXIS_VALUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case BTNTYPE_JOYPOV:
|
case BTNTYPE_JOYPOV:
|
||||||
b_Value = JoyPadPovPressed((AI_POV)Button.AxisID, ((uint32_t *)&Device.State.Joy)[Button.Offset]);
|
b_Value = JoyPadPovPressed((AI_POV)Button.AxisID, ((uint32_t *)&Device.State.Joy)[Button.Offset]);
|
||||||
if (b_Value)
|
if (b_Value)
|
||||||
|
@ -705,6 +778,93 @@ CDirectInput::ScanResult CDirectInput::ScanGamePad(const GUID & DeviceGuid, LPDI
|
||||||
return SCAN_FAILED;
|
return SCAN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CDirectInput::ScanResult CDirectInput::ScanMouse(const GUID& DeviceGuid, LPDIRECTINPUTDEVICE8 didHandle, DIMOUSESTATE2& BaseState, BUTTON& pButton)
|
||||||
|
{
|
||||||
|
DIJOYSTATE MouseState = { 0 };
|
||||||
|
HRESULT hr = didHandle->GetDeviceState(sizeof(DIMOUSESTATE2), &MouseState);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
didHandle->Acquire();
|
||||||
|
return SCAN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t Mouse[][2] =
|
||||||
|
{
|
||||||
|
{ DIMOFS_X / sizeof(uint32_t), BTNTYPE_MOUSEAXE },
|
||||||
|
{ DIMOFS_Y / sizeof(uint32_t), BTNTYPE_MOUSEAXE },
|
||||||
|
{ DIMOFS_Z / sizeof(uint32_t), BTNTYPE_MOUSEAXE }
|
||||||
|
};
|
||||||
|
|
||||||
|
uint8_t bAxeDirection = 0;
|
||||||
|
int32_t foundJoyPad = -1;
|
||||||
|
|
||||||
|
for (int32_t i = 0, n = sizeof(Mouse) / sizeof(Mouse[0]); i < n; i++)
|
||||||
|
{
|
||||||
|
uint32_t lValue = ((int32_t*)&MouseState)[Mouse[i][0]];
|
||||||
|
uint32_t BaseValue = ((int32_t*)&BaseState)[Mouse[i][0]];
|
||||||
|
|
||||||
|
if (Mouse[i][1] == BTNTYPE_MOUSEAXE)
|
||||||
|
{
|
||||||
|
if ((lValue < AXIS_TOP_VALUE && BaseValue < AXIS_TOP_VALUE) || (lValue > AXIS_BOTTOM_VALUE && BaseValue > AXIS_BOTTOM_VALUE))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
((int32_t*)&(BaseState))[Mouse[i][0]] = lValue;
|
||||||
|
if (lValue < AXIS_TOP_VALUE)
|
||||||
|
{
|
||||||
|
bAxeDirection = AI_AXE_POSITIVE;
|
||||||
|
foundJoyPad = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (lValue > AXIS_BOTTOM_VALUE)
|
||||||
|
{
|
||||||
|
bAxeDirection = AI_AXE_NEGATIVE;
|
||||||
|
foundJoyPad = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (lValue == BaseValue)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
((int32_t*)&(BaseState))[Mouse[i][0]] = lValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foundJoyPad >= 0)
|
||||||
|
{
|
||||||
|
pButton.Offset = (uint8_t)Mouse[foundJoyPad][0];
|
||||||
|
pButton.AxisID = (uint8_t)bAxeDirection;
|
||||||
|
pButton.BtnType = (BtnType)Mouse[foundJoyPad][1];
|
||||||
|
pButton.DeviceGuid = DeviceGuid;
|
||||||
|
pButton.Device = nullptr;
|
||||||
|
return SCAN_SUCCEED;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint8_t i = 0, n = sizeof(MouseState.rgbButtons) / sizeof(MouseState.rgbButtons[0]); i < n; i++)
|
||||||
|
{
|
||||||
|
if (BaseState.rgbButtons[i] == MouseState.rgbButtons[i])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
BaseState.rgbButtons[i] = MouseState.rgbButtons[i];
|
||||||
|
|
||||||
|
if ((MouseState.rgbButtons[i] & 0x80) == 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pButton.Offset = i;
|
||||||
|
pButton.AxisID = 0;
|
||||||
|
pButton.BtnType = BTNTYPE_MOUSEBUTTON;
|
||||||
|
pButton.DeviceGuid = DeviceGuid;
|
||||||
|
pButton.Device = nullptr;
|
||||||
|
return SCAN_SUCCEED;
|
||||||
|
}
|
||||||
|
return SCAN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
bool CDirectInput::AcquireDevice(LPDIRECTINPUTDEVICE8 lpDirectInputDevice)
|
bool CDirectInput::AcquireDevice(LPDIRECTINPUTDEVICE8 lpDirectInputDevice)
|
||||||
{
|
{
|
||||||
HRESULT hResult = lpDirectInputDevice->Acquire();
|
HRESULT hResult = lpDirectInputDevice->Acquire();
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "Button.h"
|
#include "Button.h"
|
||||||
#include "DeviceNotification.h"
|
#include "DeviceNotification.h"
|
||||||
#include "N64Controller.h"
|
#include "N64Controller.h"
|
||||||
|
#include "Shortcuts.h"
|
||||||
#include <Common/CriticalSection.h>
|
#include <Common/CriticalSection.h>
|
||||||
#define DIRECTINPUT_VERSION 0x0800
|
#define DIRECTINPUT_VERSION 0x0800
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
@ -23,6 +24,7 @@ class CDirectInput
|
||||||
AI_AXE_POSITIVE = 0,
|
AI_AXE_POSITIVE = 0,
|
||||||
AI_AXE_NEGATIVE = 1,
|
AI_AXE_NEGATIVE = 1,
|
||||||
THRESHOLD = 50,
|
THRESHOLD = 50,
|
||||||
|
MOUSESCALEVALUE = 10,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum AI_POV
|
enum AI_POV
|
||||||
|
@ -46,6 +48,7 @@ public:
|
||||||
|
|
||||||
void Initiate(CONTROL_INFO * ControlInfo);
|
void Initiate(CONTROL_INFO * ControlInfo);
|
||||||
void MapControllerDevice(N64CONTROLLER & Controller);
|
void MapControllerDevice(N64CONTROLLER & Controller);
|
||||||
|
void MapShortcutDevice(SHORTCUTS& Shortcuts);
|
||||||
ScanResult ScanDevices(BUTTON & Button);
|
ScanResult ScanDevices(BUTTON & Button);
|
||||||
std::wstring ButtonAssignment(BUTTON & Button);
|
std::wstring ButtonAssignment(BUTTON & Button);
|
||||||
std::wstring ControllerDevices(const N64CONTROLLER & Controller);
|
std::wstring ControllerDevices(const N64CONTROLLER & Controller);
|
||||||
|
@ -63,6 +66,7 @@ private:
|
||||||
BOOL EnumMakeDeviceList(LPCDIDEVICEINSTANCE lpddi);
|
BOOL EnumMakeDeviceList(LPCDIDEVICEINSTANCE lpddi);
|
||||||
ScanResult ScanKeyboard(const GUID & DeviceGuid, LPDIRECTINPUTDEVICE8 didHandle, uint8_t * KeyboardState, BUTTON & pButton);
|
ScanResult ScanKeyboard(const GUID & DeviceGuid, LPDIRECTINPUTDEVICE8 didHandle, uint8_t * KeyboardState, BUTTON & pButton);
|
||||||
ScanResult ScanGamePad(const GUID & DeviceGuid, LPDIRECTINPUTDEVICE8 didHandle, DIJOYSTATE & BaseState, BUTTON & pButton);
|
ScanResult ScanGamePad(const GUID & DeviceGuid, LPDIRECTINPUTDEVICE8 didHandle, DIJOYSTATE & BaseState, BUTTON & pButton);
|
||||||
|
ScanResult ScanMouse(const GUID& DeviceGuid, LPDIRECTINPUTDEVICE8 didHandle, DIMOUSESTATE2& BaseState, BUTTON& pButton);
|
||||||
bool AcquireDevice(LPDIRECTINPUTDEVICE8 lpDirectInputDevice);
|
bool AcquireDevice(LPDIRECTINPUTDEVICE8 lpDirectInputDevice);
|
||||||
void RefreshDeviceList(void);
|
void RefreshDeviceList(void);
|
||||||
bool JoyPadPovPressed(AI_POV Pov, int32_t Angle);
|
bool JoyPadPovPressed(AI_POV Pov, int32_t Angle);
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "wtl-BitmapPicture.h"
|
#include "wtl-BitmapPicture.h"
|
||||||
#include "wtl-ScanButton.h"
|
#include "wtl-ScanButton.h"
|
||||||
#include "OptionsUI.h"
|
#include "OptionsUI.h"
|
||||||
|
#include "ShortcutsUI.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <Common/StdString.h>
|
#include <Common/StdString.h>
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
@ -30,7 +31,8 @@ public:
|
||||||
COMMAND_HANDLER_EX(IDC_BTN_DEFAULTS, BN_CLICKED, DefaultBtnClicked)
|
COMMAND_HANDLER_EX(IDC_BTN_DEFAULTS, BN_CLICKED, DefaultBtnClicked)
|
||||||
COMMAND_HANDLER_EX(IDC_BTN_SETUP, BN_CLICKED, SetupBtnClicked)
|
COMMAND_HANDLER_EX(IDC_BTN_SETUP, BN_CLICKED, SetupBtnClicked)
|
||||||
COMMAND_HANDLER_EX(IDC_BTN_OPTIONS, BN_CLICKED, OptionsBtnClicked)
|
COMMAND_HANDLER_EX(IDC_BTN_OPTIONS, BN_CLICKED, OptionsBtnClicked)
|
||||||
COMMAND_HANDLER_EX(IDC_CHK_PLUGGED_IN, BN_CLICKED, PluggedInChanged)
|
COMMAND_HANDLER_EX(IDC_BTN_SHORTCUT, BN_CLICKED, ShortcutsBtnClicked)
|
||||||
|
COMMAND_HANDLER_EX(IDC_DEVICETYPE, CBN_SELCHANGE, PluggedInChanged)
|
||||||
NOTIFY_HANDLER_EX(IDC_TACK_RANGE, NM_RELEASEDCAPTURE, ItemChangedNotify);
|
NOTIFY_HANDLER_EX(IDC_TACK_RANGE, NM_RELEASEDCAPTURE, ItemChangedNotify);
|
||||||
MESSAGE_HANDLER(WM_HSCROLL, OnScroll)
|
MESSAGE_HANDLER(WM_HSCROLL, OnScroll)
|
||||||
MESSAGE_HANDLER(CScanButton::WM_SCAN_SUCCESS, OnScanSuccess)
|
MESSAGE_HANDLER(CScanButton::WM_SCAN_SUCCESS, OnScanSuccess)
|
||||||
|
@ -51,11 +53,13 @@ private:
|
||||||
void DefaultBtnClicked(UINT Code, int id, HWND ctl);
|
void DefaultBtnClicked(UINT Code, int id, HWND ctl);
|
||||||
void SetupBtnClicked(UINT Code, int id, HWND ctl);
|
void SetupBtnClicked(UINT Code, int id, HWND ctl);
|
||||||
void OptionsBtnClicked(UINT Code, int id, HWND ctl);
|
void OptionsBtnClicked(UINT Code, int id, HWND ctl);
|
||||||
|
void ShortcutsBtnClicked(UINT Code, int id, HWND ctl);
|
||||||
void PluggedInChanged(UINT Code, int id, HWND ctl);
|
void PluggedInChanged(UINT Code, int id, HWND ctl);
|
||||||
LRESULT ItemChangedNotify(NMHDR* /*pNMHDR*/);
|
LRESULT ItemChangedNotify(NMHDR* /*pNMHDR*/);
|
||||||
|
void DisplayControllerImage(void);
|
||||||
void DisplayController(void);
|
void DisplayController(void);
|
||||||
void ButtonChannged(const BUTTON & Button);
|
void ButtonChannged(const BUTTON & Button);
|
||||||
void EnablePage(bool Enable);
|
void EnablePage(int32_t Present);
|
||||||
static void stButtonChanged(size_t data, const BUTTON & Button) { ((CControllerSettings *)data)->ButtonChannged(Button); }
|
static void stButtonChanged(size_t data, const BUTTON & Button) { ((CControllerSettings *)data)->ButtonChannged(Button); }
|
||||||
|
|
||||||
std::wstring m_Title;
|
std::wstring m_Title;
|
||||||
|
@ -73,6 +77,8 @@ private:
|
||||||
CScanButton m_ButtonA, m_ButtonB, m_ButtonStart;
|
CScanButton m_ButtonA, m_ButtonB, m_ButtonStart;
|
||||||
CScanButton m_ButtonZtrigger, m_ButtonRTrigger, m_ButtonLTrigger;
|
CScanButton m_ButtonZtrigger, m_ButtonRTrigger, m_ButtonLTrigger;
|
||||||
CScanButton m_ButtonAnalogU, m_ButtonAnalogD, m_ButtonAnalogL, m_ButtonAnalogR;
|
CScanButton m_ButtonAnalogU, m_ButtonAnalogD, m_ButtonAnalogL, m_ButtonAnalogR;
|
||||||
|
CComboBox m_DeviceType;
|
||||||
|
SHORTCUTS m_Shortcuts;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CInputConfigUI :
|
class CInputConfigUI :
|
||||||
|
@ -96,6 +102,7 @@ CControllerSettings::CControllerSettings(uint32_t ControllerNumber) :
|
||||||
m_SetupIndex(-1),
|
m_SetupIndex(-1),
|
||||||
m_Controller(g_InputPlugin->Controllers(ControllerNumber)),
|
m_Controller(g_InputPlugin->Controllers(ControllerNumber)),
|
||||||
m_ControlInfo(g_InputPlugin->ControlInfo(ControllerNumber)),
|
m_ControlInfo(g_InputPlugin->ControlInfo(ControllerNumber)),
|
||||||
|
m_Shortcuts(g_InputPlugin->Shortcuts()),
|
||||||
m_ButtonUDPad(m_Controller.U_DPAD, IDC_EDIT_DIGITIAL_UP, IDC_BTN_DIGITIAL_UP),
|
m_ButtonUDPad(m_Controller.U_DPAD, IDC_EDIT_DIGITIAL_UP, IDC_BTN_DIGITIAL_UP),
|
||||||
m_ButtonDDPad(m_Controller.D_DPAD, IDC_EDIT_DIGITIAL_DOWN, IDC_BTN_DIGITIAL_DOWN),
|
m_ButtonDDPad(m_Controller.D_DPAD, IDC_EDIT_DIGITIAL_DOWN, IDC_BTN_DIGITIAL_DOWN),
|
||||||
m_ButtonLDPad(m_Controller.L_DPAD, IDC_EDIT_DIGITIAL_LEFT, IDC_BTN_DIGITIAL_LEFT),
|
m_ButtonLDPad(m_Controller.L_DPAD, IDC_EDIT_DIGITIAL_LEFT, IDC_BTN_DIGITIAL_LEFT),
|
||||||
|
@ -130,9 +137,10 @@ BOOL CControllerSettings::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam
|
||||||
m_Range.SetRangeMin(1);
|
m_Range.SetRangeMin(1);
|
||||||
m_Range.SetRangeMax(100);
|
m_Range.SetRangeMax(100);
|
||||||
m_PluggedIn.Attach(GetDlgItem(IDC_CHK_PLUGGED_IN));
|
m_PluggedIn.Attach(GetDlgItem(IDC_CHK_PLUGGED_IN));
|
||||||
|
m_DeviceType.Attach(GetDlgItem(IDC_DEVICETYPE));
|
||||||
|
|
||||||
m_ControllerImg.SubclassWindow(GetDlgItem(IDC_BMP_CONTROLLER));
|
m_ControllerImg.SubclassWindow(GetDlgItem(IDC_BMP_CONTROLLER));
|
||||||
m_ControllerImg.SetBitmap(MAKEINTRESOURCE(IDB_CONTROLLER));
|
|
||||||
CScanButton * Buttons[] = {
|
CScanButton * Buttons[] = {
|
||||||
&m_ButtonUDPad, &m_ButtonDDPad, &m_ButtonLDPad, &m_ButtonRDPad, &m_ButtonA, &m_ButtonB,
|
&m_ButtonUDPad, &m_ButtonDDPad, &m_ButtonLDPad, &m_ButtonRDPad, &m_ButtonA, &m_ButtonB,
|
||||||
&m_ButtonCUp, &m_ButtonCDown, &m_ButtonCLeft, &m_ButtonCRight, &m_ButtonStart,
|
&m_ButtonCUp, &m_ButtonCDown, &m_ButtonCLeft, &m_ButtonCRight, &m_ButtonStart,
|
||||||
|
@ -145,8 +153,16 @@ BOOL CControllerSettings::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam
|
||||||
Buttons[i]->SubclassWindow(m_hWnd);
|
Buttons[i]->SubclassWindow(m_hWnd);
|
||||||
Buttons[i]->SetChangeCallback(stButtonChanged, (size_t)this);
|
Buttons[i]->SetChangeCallback(stButtonChanged, (size_t)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Index = m_DeviceType.AddString(L"None");
|
||||||
|
m_DeviceType.SetItemData(Index, PRESENT_NONE);
|
||||||
|
Index = m_DeviceType.AddString(L"N64 Controller");
|
||||||
|
m_DeviceType.SetItemData(Index, PRESENT_CONT);
|
||||||
|
Index = m_DeviceType.AddString(L"N64 Mouse");
|
||||||
|
m_DeviceType.SetItemData(Index, PRESENT_MOUSE);
|
||||||
|
|
||||||
DisplayController();
|
DisplayController();
|
||||||
EnablePage(m_PluggedIn.GetCheck() == BST_CHECKED);
|
EnablePage(m_DeviceType.GetItemData(m_DeviceType.GetCurSel()));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +186,7 @@ LRESULT CControllerSettings::OnApply()
|
||||||
Controller.Range = (uint8_t)m_Range.GetPos();
|
Controller.Range = (uint8_t)m_Range.GetPos();
|
||||||
Controller.DeadZone = (uint8_t)m_DeadZone.GetPos();
|
Controller.DeadZone = (uint8_t)m_DeadZone.GetPos();
|
||||||
CONTROL & ControlInfo = g_InputPlugin->ControlInfo(m_ControllerNumber);
|
CONTROL & ControlInfo = g_InputPlugin->ControlInfo(m_ControllerNumber);
|
||||||
ControlInfo.Present = (m_PluggedIn.GetCheck() == BST_CHECKED) ? 1 : 0;
|
ControlInfo.Present = m_DeviceType.GetItemData(m_DeviceType.GetCurSel());
|
||||||
ControlInfo.Plugin = m_ControlInfo.Plugin;
|
ControlInfo.Plugin = m_ControlInfo.Plugin;
|
||||||
return g_InputPlugin->SaveController(m_ControllerNumber) ? PSNRET_NOERROR : PSNRET_INVALID_NOCHANGEPAGE;
|
return g_InputPlugin->SaveController(m_ControllerNumber) ? PSNRET_NOERROR : PSNRET_INVALID_NOCHANGEPAGE;
|
||||||
}
|
}
|
||||||
|
@ -238,10 +254,16 @@ void CControllerSettings::OptionsBtnClicked(UINT /*Code*/, int /*id*/, HWND /*ct
|
||||||
ConfigOption(m_ControllerNumber, m_ControlInfo, m_Controller);
|
ConfigOption(m_ControllerNumber, m_ControlInfo, m_Controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CControllerSettings::ShortcutsBtnClicked(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
|
||||||
|
{
|
||||||
|
ConfigShortcut(m_Shortcuts);
|
||||||
|
}
|
||||||
|
|
||||||
void CControllerSettings::PluggedInChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
|
void CControllerSettings::PluggedInChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
|
||||||
{
|
{
|
||||||
SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
|
SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
|
||||||
EnablePage(m_PluggedIn.GetCheck() == BST_CHECKED);
|
EnablePage(m_DeviceType.GetItemData(m_DeviceType.GetCurSel()));
|
||||||
|
DisplayControllerImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CControllerSettings::ItemChangedNotify(NMHDR* /*pNMHDR*/)
|
LRESULT CControllerSettings::ItemChangedNotify(NMHDR* /*pNMHDR*/)
|
||||||
|
@ -250,9 +272,34 @@ LRESULT CControllerSettings::ItemChangedNotify(NMHDR* /*pNMHDR*/)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CControllerSettings::DisplayControllerImage(void)
|
||||||
|
{
|
||||||
|
if (m_DeviceType.GetItemData(m_DeviceType.GetCurSel()) != PRESENT_MOUSE)
|
||||||
|
{
|
||||||
|
m_ControllerImg.SetBitmap(MAKEINTRESOURCE(IDB_CONTROLLER));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_ControllerImg.SetBitmap(MAKEINTRESOURCE(IDB_MOUSE));
|
||||||
|
}
|
||||||
|
m_ControllerImg.Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
void CControllerSettings::DisplayController(void)
|
void CControllerSettings::DisplayController(void)
|
||||||
{
|
{
|
||||||
m_PluggedIn.SetCheck(m_ControlInfo.Present != 0 ? BST_CHECKED : BST_UNCHECKED);
|
int32_t index = 0;
|
||||||
|
m_DeviceType.SetCurSel(0);
|
||||||
|
for (index = 0; index < m_DeviceType.GetCount(); index++)
|
||||||
|
{
|
||||||
|
if (m_DeviceType.GetItemData(index) == m_ControlInfo.Present)
|
||||||
|
{
|
||||||
|
m_DeviceType.SetCurSel(index);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DisplayControllerImage();
|
||||||
|
|
||||||
m_Range.SetPos(m_Controller.Range);
|
m_Range.SetPos(m_Controller.Range);
|
||||||
m_DeadZone.SetPos(m_Controller.DeadZone);
|
m_DeadZone.SetPos(m_Controller.DeadZone);
|
||||||
CWindow(GetDlgItem(IDC_LABEL_RANGE)).SetWindowText(stdstr_f("%d%%", m_Range.GetPos()).ToUTF16().c_str());
|
CWindow(GetDlgItem(IDC_LABEL_RANGE)).SetWindowText(stdstr_f("%d%%", m_Range.GetPos()).ToUTF16().c_str());
|
||||||
|
@ -281,8 +328,9 @@ void CControllerSettings::ButtonChannged(const BUTTON & Button)
|
||||||
CPropertySheetWindow(GetParent()).SetModified(m_hWnd);
|
CPropertySheetWindow(GetParent()).SetModified(m_hWnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CControllerSettings::EnablePage(bool Enable)
|
void CControllerSettings::EnablePage(int32_t Present)
|
||||||
{
|
{
|
||||||
|
bool Enable = Present == PRESENT_CONT;
|
||||||
GetDlgItem(IDC_SLIDE_DEADZONE).EnableWindow(Enable);
|
GetDlgItem(IDC_SLIDE_DEADZONE).EnableWindow(Enable);
|
||||||
GetDlgItem(IDC_SLIDER_RANGE).EnableWindow(Enable);
|
GetDlgItem(IDC_SLIDER_RANGE).EnableWindow(Enable);
|
||||||
GetDlgItem(IDC_EDIT_LTRIGGER).EnableWindow(Enable);
|
GetDlgItem(IDC_EDIT_LTRIGGER).EnableWindow(Enable);
|
||||||
|
@ -322,6 +370,8 @@ void CControllerSettings::EnablePage(bool Enable)
|
||||||
GetDlgItem(IDC_BTN_BUTTON_START).EnableWindow(Enable);
|
GetDlgItem(IDC_BTN_BUTTON_START).EnableWindow(Enable);
|
||||||
GetDlgItem(IDC_BTN_BUTTON_Z).EnableWindow(Enable);
|
GetDlgItem(IDC_BTN_BUTTON_Z).EnableWindow(Enable);
|
||||||
GetDlgItem(IDC_BTN_SETUP).EnableWindow(Enable);
|
GetDlgItem(IDC_BTN_SETUP).EnableWindow(Enable);
|
||||||
|
|
||||||
|
Enable = Present != PRESENT_NONE;
|
||||||
GetDlgItem(IDC_BTN_DEFAULTS).EnableWindow(Enable);
|
GetDlgItem(IDC_BTN_DEFAULTS).EnableWindow(Enable);
|
||||||
GetDlgItem(IDC_BTN_OPTIONS).EnableWindow(Enable);
|
GetDlgItem(IDC_BTN_OPTIONS).EnableWindow(Enable);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,10 @@ Output: None
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
EXPORT void CALL DllConfig(void * hParent)
|
EXPORT void CALL DllConfig(void * hParent)
|
||||||
{
|
{
|
||||||
|
if (g_InputPlugin != nullptr)
|
||||||
|
{
|
||||||
|
g_InputPlugin->UnlockMouse();
|
||||||
|
}
|
||||||
ConfigInput(hParent);
|
ConfigInput(hParent);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -154,6 +158,10 @@ Output: None
|
||||||
|
|
||||||
EXPORT void CALL RomClosed(void)
|
EXPORT void CALL RomClosed(void)
|
||||||
{
|
{
|
||||||
|
if (g_InputPlugin != nullptr)
|
||||||
|
{
|
||||||
|
g_InputPlugin->UnlockMouse();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -166,6 +174,26 @@ Output: None
|
||||||
|
|
||||||
EXPORT void CALL RomOpen(void)
|
EXPORT void CALL RomOpen(void)
|
||||||
{
|
{
|
||||||
|
if (g_InputPlugin != nullptr)
|
||||||
|
{
|
||||||
|
g_InputPlugin->LockMouse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Function: EmulationPaused
|
||||||
|
Purpose: This function is called when the emulation is paused. (from the
|
||||||
|
emulation thread)
|
||||||
|
Input: None
|
||||||
|
Output: None
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPORT void CALL EmulationPaused(void)
|
||||||
|
{
|
||||||
|
if (g_InputPlugin != nullptr)
|
||||||
|
{
|
||||||
|
g_InputPlugin->UnlockMouse();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -192,6 +220,22 @@ EXPORT void CALL WM_KeyUp(uint32_t /*wParam*/, uint32_t /*lParam*/)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Function: WM_KillFocus
|
||||||
|
Purpose: To pass the WM_KILLFOCUS message from the emulator to the
|
||||||
|
plugin.
|
||||||
|
Input: wParam and lParam of the WM_KILLFOCUS message.
|
||||||
|
Output: None
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPORT void CALL WM_KillFocus(uint32_t /*wParam*/, uint32_t /*lParam*/)
|
||||||
|
{
|
||||||
|
if (g_InputPlugin != nullptr)
|
||||||
|
{
|
||||||
|
g_InputPlugin->UnlockMouse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EXPORT void CALL PluginLoaded(void)
|
EXPORT void CALL PluginLoaded(void)
|
||||||
{
|
{
|
||||||
SetupInputSettings();
|
SetupInputSettings();
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
CInputSettings * g_Settings = nullptr;
|
CInputSettings * g_Settings = nullptr;
|
||||||
|
|
||||||
|
/* Default First N64 Controller Setup */
|
||||||
static char * Control0_U_DPAD_Default = "{6F1D2B61-D5A0-11CF-BFC7-444553540000} 17 0 5";
|
static char * Control0_U_DPAD_Default = "{6F1D2B61-D5A0-11CF-BFC7-444553540000} 17 0 5";
|
||||||
static char * Control0_D_DPAD_Default = "{6F1D2B61-D5A0-11CF-BFC7-444553540000} 25 0 5";
|
static char * Control0_D_DPAD_Default = "{6F1D2B61-D5A0-11CF-BFC7-444553540000} 25 0 5";
|
||||||
static char * Control0_L_DPAD_Default = "{6F1D2B61-D5A0-11CF-BFC7-444553540000} 24 0 5";
|
static char * Control0_L_DPAD_Default = "{6F1D2B61-D5A0-11CF-BFC7-444553540000} 24 0 5";
|
||||||
|
@ -25,10 +26,28 @@ static char * Control0_L_ANALOG_Default = "{6F1D2B61-D5A0-11CF-BFC7-444553540000
|
||||||
static char * Control0_R_ANALOG_Default = "{6F1D2B61-D5A0-11CF-BFC7-444553540000} CD 0 5";
|
static char * Control0_R_ANALOG_Default = "{6F1D2B61-D5A0-11CF-BFC7-444553540000} CD 0 5";
|
||||||
static const uint32_t Default_DeadZone = 25;
|
static const uint32_t Default_DeadZone = 25;
|
||||||
static const uint32_t Default_Range = 100;
|
static const uint32_t Default_Range = 100;
|
||||||
|
static const uint32_t Default_Sensitivity = 100;
|
||||||
static const uint32_t Default_Plugin = PLUGIN_MEMPAK;
|
static const uint32_t Default_Plugin = PLUGIN_MEMPAK;
|
||||||
static const bool Default_RealN64Range = true;
|
static const bool Default_RealN64Range = true;
|
||||||
static const bool Default_RemoveDuplicate = true;
|
static const bool Default_RemoveDuplicate = true;
|
||||||
|
|
||||||
|
/* Default Mouse Setup (Forced) */
|
||||||
|
static char* Mouse_A_BUTTON_Default = "{6F1D2B60-D5A0-11CF-BFC7-444553540000} 00 0 6";
|
||||||
|
static char* Mouse_B_BUTTON_Default = "{6F1D2B60-D5A0-11CF-BFC7-444553540000} 01 0 6";
|
||||||
|
static char* Mouse_U_ANALOG_Default = "{6F1D2B60-D5A0-11CF-BFC7-444553540000} 01 0 7";
|
||||||
|
static char* Mouse_D_ANALOG_Default = "{6F1D2B60-D5A0-11CF-BFC7-444553540000} 01 1 7";
|
||||||
|
static char* Mouse_L_ANALOG_Default = "{6F1D2B60-D5A0-11CF-BFC7-444553540000} 00 0 7";
|
||||||
|
static char* Mouse_R_ANALOG_Default = "{6F1D2B60-D5A0-11CF-BFC7-444553540000} 00 1 7";
|
||||||
|
static const uint32_t DefaultMouse_DeadZone = 1;
|
||||||
|
static const uint32_t DefaultMouse_Range = 100;
|
||||||
|
static const uint32_t DefaultMouse_Plugin = PLUGIN_NONE;
|
||||||
|
static const uint32_t DefaultMouse_Sensitivity = 100;
|
||||||
|
static const bool DefaultMouse_RealN64Range = false;
|
||||||
|
static const bool DefaultMouse_RemoveDuplicate = true;
|
||||||
|
|
||||||
|
/* Default Shortcuts Setup */
|
||||||
|
static char* Shortcuts_LOCKMOUSE_Default = "{6F1D2B61-D5A0-11CF-BFC7-444553540000} 0F 0 5";
|
||||||
|
|
||||||
CInputSettings::CInputSettings()
|
CInputSettings::CInputSettings()
|
||||||
{
|
{
|
||||||
RegisterSettings();
|
RegisterSettings();
|
||||||
|
@ -40,12 +59,18 @@ CInputSettings::~CInputSettings()
|
||||||
|
|
||||||
void CInputSettings::LoadController(uint32_t ControlIndex, CONTROL & ControllerInfo, N64CONTROLLER & Controller)
|
void CInputSettings::LoadController(uint32_t ControlIndex, CONTROL & ControllerInfo, N64CONTROLLER & Controller)
|
||||||
{
|
{
|
||||||
struct
|
InputSettingID PresentSettings[] = { Set_Control0_Present, Set_Control1_Present, Set_Control2_Present, Set_Control3_Present };
|
||||||
|
InputSettingID PluginSettings[] = { Set_Control0_Plugin, Set_Control1_Plugin, Set_Control2_Plugin, Set_Control3_Plugin };
|
||||||
|
|
||||||
|
ControllerInfo.Present = ControlIndex < (sizeof(PresentSettings) / sizeof(PresentSettings[0])) ? GetSetting((short)PresentSettings[ControlIndex]) : PRESENT_NONE;
|
||||||
|
ControllerInfo.Plugin = ControlIndex < (sizeof(PluginSettings) / sizeof(PluginSettings[0])) ? GetSetting((short)PluginSettings[ControlIndex]) : Default_Plugin;
|
||||||
|
|
||||||
|
struct
|
||||||
{
|
{
|
||||||
BUTTON & Button;
|
BUTTON& Button;
|
||||||
InputSettingID SettingId;
|
InputSettingID SettingId;
|
||||||
uint32_t ControlIndex;
|
uint32_t ControlIndex;
|
||||||
}
|
}
|
||||||
Buttons[] =
|
Buttons[] =
|
||||||
{
|
{
|
||||||
{ Controller.U_DPAD, Set_Control0_U_DPAD, 0 },
|
{ Controller.U_DPAD, Set_Control0_U_DPAD, 0 },
|
||||||
|
@ -135,26 +160,37 @@ void CInputSettings::LoadController(uint32_t ControlIndex, CONTROL & ControllerI
|
||||||
Buttons[i].Button = StrToButton(GetSettingSz((short)Buttons[i].SettingId, Buffer, sizeof(Buffer) / sizeof(Buffer[0])));
|
Buttons[i].Button = StrToButton(GetSettingSz((short)Buttons[i].SettingId, Buffer, sizeof(Buffer) / sizeof(Buffer[0])));
|
||||||
}
|
}
|
||||||
|
|
||||||
InputSettingID PresentSettings[] = { Set_Control0_Present, Set_Control1_Present, Set_Control2_Present, Set_Control3_Present };
|
|
||||||
InputSettingID PluginSettings[] = { Set_Control0_Plugin, Set_Control1_Plugin, Set_Control2_Plugin, Set_Control3_Plugin };
|
|
||||||
InputSettingID RangeSettings[] = { Set_Control0_Range, Set_Control1_Range, Set_Control2_Range, Set_Control3_Range };
|
InputSettingID RangeSettings[] = { Set_Control0_Range, Set_Control1_Range, Set_Control2_Range, Set_Control3_Range };
|
||||||
InputSettingID DeadZoneSettings[] = { Set_Control0_Deadzone, Set_Control1_Deadzone, Set_Control2_Deadzone,Set_Control3_Deadzone };
|
InputSettingID DeadZoneSettings[] = { Set_Control0_Deadzone, Set_Control1_Deadzone, Set_Control2_Deadzone,Set_Control3_Deadzone };
|
||||||
|
InputSettingID SensitivitySettings[] = { Set_Control0_Sensitivity, Set_Control1_Sensitivity, Set_Control2_Sensitivity, Set_Control3_Sensitivity };
|
||||||
InputSettingID RealN64RangeSettings[] = { Set_Control0_RealN64Range, Set_Control1_RealN64Range, Set_Control2_RealN64Range, Set_Control3_RealN64Range };
|
InputSettingID RealN64RangeSettings[] = { Set_Control0_RealN64Range, Set_Control1_RealN64Range, Set_Control2_RealN64Range, Set_Control3_RealN64Range };
|
||||||
InputSettingID RemoveDuplicateSettings[] = { Set_Control0_RemoveDuplicate, Set_Control1_RemoveDuplicate, Set_Control2_RemoveDuplicate, Set_Control3_RemoveDuplicate };
|
InputSettingID RemoveDuplicateSettings[] = { Set_Control0_RemoveDuplicate, Set_Control1_RemoveDuplicate, Set_Control2_RemoveDuplicate, Set_Control3_RemoveDuplicate };
|
||||||
|
|
||||||
ControllerInfo.Present = ControlIndex < (sizeof(PresentSettings) / sizeof(PresentSettings[0])) ? GetSetting((short)PresentSettings[ControlIndex]) != 0 : 0;
|
|
||||||
ControllerInfo.Plugin = ControlIndex < (sizeof(PluginSettings) / sizeof(PluginSettings[0])) ? GetSetting((short)PluginSettings[ControlIndex]) : Default_Plugin;
|
|
||||||
Controller.Range = (uint8_t)(ControlIndex < (sizeof(RangeSettings) / sizeof(RangeSettings[0])) ? GetSetting((short)RangeSettings[ControlIndex]) : Default_Range);
|
Controller.Range = (uint8_t)(ControlIndex < (sizeof(RangeSettings) / sizeof(RangeSettings[0])) ? GetSetting((short)RangeSettings[ControlIndex]) : Default_Range);
|
||||||
if (Controller.Range == 0) { Controller.Range = 1; }
|
if (Controller.Range == 0) { Controller.Range = 1; }
|
||||||
if (Controller.Range > 100) { Controller.Range = 100; }
|
if (Controller.Range > 100) { Controller.Range = 100; }
|
||||||
Controller.DeadZone = (uint8_t)(ControlIndex < (sizeof(DeadZoneSettings) / sizeof(DeadZoneSettings[0])) ? GetSetting((short)DeadZoneSettings[ControlIndex]) : Default_DeadZone);
|
Controller.DeadZone = (uint8_t)(ControlIndex < (sizeof(DeadZoneSettings) / sizeof(DeadZoneSettings[0])) ? GetSetting((short)DeadZoneSettings[ControlIndex]) : Default_DeadZone);
|
||||||
if (Controller.DeadZone > 100) { Controller.DeadZone = 100; }
|
if (Controller.DeadZone > 100) { Controller.DeadZone = 100; }
|
||||||
|
Controller.Sensitivity = (uint8_t)(ControlIndex < (sizeof(SensitivitySettings) / sizeof(SensitivitySettings[0])) ? GetSetting((short)SensitivitySettings[ControlIndex]) : Default_Sensitivity);
|
||||||
|
if (Controller.Sensitivity > 100) { Controller.Sensitivity = 100; }
|
||||||
Controller.RealN64Range = (ControlIndex < (sizeof(RealN64RangeSettings) / sizeof(RealN64RangeSettings[0])) ? GetSetting((short)RealN64RangeSettings[ControlIndex]) != 0 : Default_RealN64Range);
|
Controller.RealN64Range = (ControlIndex < (sizeof(RealN64RangeSettings) / sizeof(RealN64RangeSettings[0])) ? GetSetting((short)RealN64RangeSettings[ControlIndex]) != 0 : Default_RealN64Range);
|
||||||
Controller.RemoveDuplicate = (ControlIndex < (sizeof(RemoveDuplicateSettings) / sizeof(RemoveDuplicateSettings[0])) ? GetSetting((short)RemoveDuplicateSettings[ControlIndex]) != 0 : Default_RemoveDuplicate);
|
Controller.RemoveDuplicate = (ControlIndex < (sizeof(RemoveDuplicateSettings) / sizeof(RemoveDuplicateSettings[0])) ? GetSetting((short)RemoveDuplicateSettings[ControlIndex]) != 0 : Default_RemoveDuplicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputSettings::SaveController(uint32_t ControlIndex, const CONTROL & ControllerInfo, const N64CONTROLLER & Controller)
|
void CInputSettings::SaveController(uint32_t ControlIndex, const CONTROL & ControllerInfo, const N64CONTROLLER & Controller)
|
||||||
{
|
{
|
||||||
|
InputSettingID PresentSettings[] = { Set_Control0_Present, Set_Control1_Present, Set_Control2_Present, Set_Control3_Present };
|
||||||
|
InputSettingID PluginSettings[] = { Set_Control0_Plugin, Set_Control1_Plugin, Set_Control2_Plugin, Set_Control3_Plugin };
|
||||||
|
|
||||||
|
if (ControlIndex < (sizeof(PresentSettings) / sizeof(PresentSettings[0])))
|
||||||
|
{
|
||||||
|
SetSetting((short)PresentSettings[ControlIndex], ControllerInfo.Present);
|
||||||
|
}
|
||||||
|
if (ControlIndex < (sizeof(PluginSettings) / sizeof(PluginSettings[0])))
|
||||||
|
{
|
||||||
|
SetSetting((short)PluginSettings[ControlIndex], ControllerInfo.Plugin);
|
||||||
|
}
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
const BUTTON & Button;
|
const BUTTON & Button;
|
||||||
|
@ -181,6 +217,7 @@ void CInputSettings::SaveController(uint32_t ControlIndex, const CONTROL & Contr
|
||||||
{ Controller.D_ANALOG, Set_Control0_D_ANALOG, 0 },
|
{ Controller.D_ANALOG, Set_Control0_D_ANALOG, 0 },
|
||||||
{ Controller.L_ANALOG, Set_Control0_L_ANALOG, 0 },
|
{ Controller.L_ANALOG, Set_Control0_L_ANALOG, 0 },
|
||||||
{ Controller.R_ANALOG, Set_Control0_R_ANALOG, 0 },
|
{ Controller.R_ANALOG, Set_Control0_R_ANALOG, 0 },
|
||||||
|
|
||||||
{ Controller.U_DPAD, Set_Control1_U_DPAD, 1 },
|
{ Controller.U_DPAD, Set_Control1_U_DPAD, 1 },
|
||||||
{ Controller.D_DPAD, Set_Control1_D_DPAD, 1 },
|
{ Controller.D_DPAD, Set_Control1_D_DPAD, 1 },
|
||||||
{ Controller.L_DPAD, Set_Control1_L_DPAD, 1 },
|
{ Controller.L_DPAD, Set_Control1_L_DPAD, 1 },
|
||||||
|
@ -239,10 +276,9 @@ void CInputSettings::SaveController(uint32_t ControlIndex, const CONTROL & Contr
|
||||||
{ Controller.R_ANALOG, Set_Control3_R_ANALOG, 3 },
|
{ Controller.R_ANALOG, Set_Control3_R_ANALOG, 3 },
|
||||||
};
|
};
|
||||||
|
|
||||||
InputSettingID PresentSettings[] = { Set_Control0_Present, Set_Control1_Present, Set_Control2_Present, Set_Control3_Present };
|
|
||||||
InputSettingID PluginSettings[] = { Set_Control0_Plugin, Set_Control1_Plugin, Set_Control2_Plugin, Set_Control3_Plugin };
|
|
||||||
InputSettingID RangeSettings[] = { Set_Control0_Range, Set_Control1_Range, Set_Control2_Range, Set_Control3_Range };
|
InputSettingID RangeSettings[] = { Set_Control0_Range, Set_Control1_Range, Set_Control2_Range, Set_Control3_Range };
|
||||||
InputSettingID DeadZoneSettings[] = { Set_Control0_Deadzone, Set_Control1_Deadzone, Set_Control2_Deadzone,Set_Control3_Deadzone };
|
InputSettingID DeadZoneSettings[] = { Set_Control0_Deadzone, Set_Control1_Deadzone, Set_Control2_Deadzone,Set_Control3_Deadzone };
|
||||||
|
InputSettingID SensitivitySettings[] = { Set_Control0_Sensitivity, Set_Control1_Sensitivity, Set_Control2_Sensitivity, Set_Control3_Sensitivity };
|
||||||
InputSettingID RealN64RangeSettings[] = { Set_Control0_RealN64Range, Set_Control1_RealN64Range, Set_Control2_RealN64Range, Set_Control3_RealN64Range };
|
InputSettingID RealN64RangeSettings[] = { Set_Control0_RealN64Range, Set_Control1_RealN64Range, Set_Control2_RealN64Range, Set_Control3_RealN64Range };
|
||||||
InputSettingID RemoveDuplicateSettings[] = { Set_Control0_RemoveDuplicate, Set_Control1_RemoveDuplicate, Set_Control2_RemoveDuplicate, Set_Control3_RemoveDuplicate };
|
InputSettingID RemoveDuplicateSettings[] = { Set_Control0_RemoveDuplicate, Set_Control1_RemoveDuplicate, Set_Control2_RemoveDuplicate, Set_Control3_RemoveDuplicate };
|
||||||
|
|
||||||
|
@ -255,15 +291,6 @@ void CInputSettings::SaveController(uint32_t ControlIndex, const CONTROL & Contr
|
||||||
SetSettingSz((short)Buttons[i].SettingId, ButtonToStr(Buttons[i].Button).c_str());
|
SetSettingSz((short)Buttons[i].SettingId, ButtonToStr(Buttons[i].Button).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ControlIndex < (sizeof(PresentSettings) / sizeof(PresentSettings[0])))
|
|
||||||
{
|
|
||||||
SetSetting((short)PresentSettings[ControlIndex], ControllerInfo.Present);
|
|
||||||
}
|
|
||||||
if (ControlIndex < (sizeof(PluginSettings) / sizeof(PluginSettings[0])))
|
|
||||||
{
|
|
||||||
SetSetting((short)PluginSettings[ControlIndex], ControllerInfo.Plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ControlIndex < (sizeof(RangeSettings) / sizeof(RangeSettings[0])))
|
if (ControlIndex < (sizeof(RangeSettings) / sizeof(RangeSettings[0])))
|
||||||
{
|
{
|
||||||
SetSetting((short)RangeSettings[ControlIndex], Controller.Range);
|
SetSetting((short)RangeSettings[ControlIndex], Controller.Range);
|
||||||
|
@ -273,6 +300,10 @@ void CInputSettings::SaveController(uint32_t ControlIndex, const CONTROL & Contr
|
||||||
{
|
{
|
||||||
SetSetting((short)DeadZoneSettings[ControlIndex], Controller.DeadZone);
|
SetSetting((short)DeadZoneSettings[ControlIndex], Controller.DeadZone);
|
||||||
}
|
}
|
||||||
|
if (ControlIndex < (sizeof(SensitivitySettings) / sizeof(SensitivitySettings[0])))
|
||||||
|
{
|
||||||
|
SetSetting((short)SensitivitySettings[ControlIndex], Controller.Sensitivity);
|
||||||
|
}
|
||||||
if (ControlIndex < (sizeof(RealN64RangeSettings) / sizeof(RealN64RangeSettings[0])))
|
if (ControlIndex < (sizeof(RealN64RangeSettings) / sizeof(RealN64RangeSettings[0])))
|
||||||
{
|
{
|
||||||
SetSetting((short)RealN64RangeSettings[ControlIndex], Controller.RealN64Range ? 1 : 0);
|
SetSetting((short)RealN64RangeSettings[ControlIndex], Controller.RealN64Range ? 1 : 0);
|
||||||
|
@ -381,10 +412,110 @@ void CInputSettings::ResetController(uint32_t ControlIndex, CONTROL & Controller
|
||||||
}
|
}
|
||||||
Controller.Range = Default_Range;
|
Controller.Range = Default_Range;
|
||||||
Controller.DeadZone = Default_DeadZone;
|
Controller.DeadZone = Default_DeadZone;
|
||||||
ControllerInfo.Present = ControlIndex == 0 ? 1 : 0;
|
Controller.Sensitivity = Default_Sensitivity;
|
||||||
|
ControllerInfo.Present = ControlIndex == 0 ? PRESENT_CONT : PRESENT_NONE;
|
||||||
ControllerInfo.Plugin = Default_Plugin;
|
ControllerInfo.Plugin = Default_Plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CInputSettings::GetControllerMouse(N64CONTROLLER& Controller)
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
BUTTON& Button;
|
||||||
|
const char* DefaultValue;
|
||||||
|
}
|
||||||
|
Buttons[] =
|
||||||
|
{
|
||||||
|
{ Controller.U_DPAD, "" },
|
||||||
|
{ Controller.D_DPAD, "" },
|
||||||
|
{ Controller.L_DPAD, "" },
|
||||||
|
{ Controller.R_DPAD, "" },
|
||||||
|
{ Controller.A_BUTTON, Mouse_A_BUTTON_Default },
|
||||||
|
{ Controller.B_BUTTON, Mouse_B_BUTTON_Default },
|
||||||
|
{ Controller.U_CBUTTON, "" },
|
||||||
|
{ Controller.D_CBUTTON, "" },
|
||||||
|
{ Controller.L_CBUTTON, "" },
|
||||||
|
{ Controller.R_CBUTTON, "" },
|
||||||
|
{ Controller.START_BUTTON, "" },
|
||||||
|
{ Controller.Z_TRIG, "" },
|
||||||
|
{ Controller.R_TRIG, "" },
|
||||||
|
{ Controller.L_TRIG, "" },
|
||||||
|
{ Controller.U_ANALOG, Mouse_U_ANALOG_Default },
|
||||||
|
{ Controller.D_ANALOG, Mouse_D_ANALOG_Default },
|
||||||
|
{ Controller.L_ANALOG, Mouse_L_ANALOG_Default },
|
||||||
|
{ Controller.R_ANALOG, Mouse_R_ANALOG_Default },
|
||||||
|
};
|
||||||
|
|
||||||
|
for (size_t i = 0, n = sizeof(Buttons) / sizeof(Buttons[0]); i < n; i++)
|
||||||
|
{
|
||||||
|
Buttons[i].Button = StrToButton(Buttons[i].DefaultValue);
|
||||||
|
}
|
||||||
|
Controller.Range = DefaultMouse_Range;
|
||||||
|
Controller.DeadZone = DefaultMouse_DeadZone;
|
||||||
|
Controller.Sensitivity = DefaultMouse_Sensitivity;
|
||||||
|
Controller.RealN64Range = DefaultMouse_RealN64Range;
|
||||||
|
Controller.RemoveDuplicate = DefaultMouse_RemoveDuplicate;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CInputSettings::LoadShortcuts(SHORTCUTS& Shortcuts)
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
BUTTON& Button;
|
||||||
|
InputSettingID SettingId;
|
||||||
|
}
|
||||||
|
Buttons[] =
|
||||||
|
{
|
||||||
|
{ Shortcuts.LOCKMOUSE, Set_Shortcut_LOCKMOUSE },
|
||||||
|
};
|
||||||
|
|
||||||
|
char Buffer[400];
|
||||||
|
for (size_t i = 0, n = sizeof(Buttons) / sizeof(Buttons[0]); i < n; i++)
|
||||||
|
{
|
||||||
|
Buttons[i].Button = StrToButton(GetSettingSz((short)Buttons[i].SettingId, Buffer, sizeof(Buffer) / sizeof(Buffer[0])));
|
||||||
|
}
|
||||||
|
|
||||||
|
Shortcuts.LOCKMOUSE_PRESSED = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CInputSettings::SaveShortcuts(SHORTCUTS& Shortcuts)
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
const BUTTON& Button;
|
||||||
|
InputSettingID SettingId;
|
||||||
|
}
|
||||||
|
Buttons[] =
|
||||||
|
{
|
||||||
|
{ Shortcuts.LOCKMOUSE, Set_Shortcut_LOCKMOUSE },
|
||||||
|
};
|
||||||
|
|
||||||
|
for (size_t i = 0, n = sizeof(Buttons) / sizeof(Buttons[0]); i < n; i++)
|
||||||
|
{
|
||||||
|
SetSettingSz((short)Buttons[i].SettingId, ButtonToStr(Buttons[i].Button).c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CInputSettings::ResetShortcuts(SHORTCUTS& Shortcuts)
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
BUTTON& Button;
|
||||||
|
const char* DefaultValue;
|
||||||
|
}
|
||||||
|
Buttons[] =
|
||||||
|
{
|
||||||
|
{ Shortcuts.LOCKMOUSE, Shortcuts_LOCKMOUSE_Default },
|
||||||
|
};
|
||||||
|
|
||||||
|
for (size_t i = 0, n = sizeof(Buttons) / sizeof(Buttons[0]); i < n; i++)
|
||||||
|
{
|
||||||
|
Buttons[i].Button = StrToButton(Buttons[i].DefaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
Shortcuts.LOCKMOUSE_PRESSED = false;
|
||||||
|
}
|
||||||
|
|
||||||
BUTTON CInputSettings::StrToButton(const char * Buffer)
|
BUTTON CInputSettings::StrToButton(const char * Buffer)
|
||||||
{
|
{
|
||||||
BUTTON Button = { 0 };
|
BUTTON Button = { 0 };
|
||||||
|
@ -419,6 +550,7 @@ void CInputSettings::RegisterSettings(void)
|
||||||
RegisterSetting(Set_Control0_Plugin, Data_DWORD_General, "Plugin", "Controller 1", Default_Plugin, nullptr);
|
RegisterSetting(Set_Control0_Plugin, Data_DWORD_General, "Plugin", "Controller 1", Default_Plugin, nullptr);
|
||||||
RegisterSetting(Set_Control0_Range, Data_DWORD_General, "Range", "Controller 1", Default_Range, nullptr);
|
RegisterSetting(Set_Control0_Range, Data_DWORD_General, "Range", "Controller 1", Default_Range, nullptr);
|
||||||
RegisterSetting(Set_Control0_Deadzone, Data_DWORD_General, "Deadzone", "Controller 1", Default_DeadZone, nullptr);
|
RegisterSetting(Set_Control0_Deadzone, Data_DWORD_General, "Deadzone", "Controller 1", Default_DeadZone, nullptr);
|
||||||
|
RegisterSetting(Set_Control0_Sensitivity, Data_DWORD_General, "Sensitivity", "Controller 1", Default_Sensitivity, nullptr);
|
||||||
RegisterSetting(Set_Control0_RealN64Range, Data_DWORD_General, "RealN64Range", "Controller 1", Default_RealN64Range, nullptr);
|
RegisterSetting(Set_Control0_RealN64Range, Data_DWORD_General, "RealN64Range", "Controller 1", Default_RealN64Range, nullptr);
|
||||||
RegisterSetting(Set_Control0_RemoveDuplicate, Data_DWORD_General, "Remove Duplicate", "Controller 1", Default_RemoveDuplicate, nullptr);
|
RegisterSetting(Set_Control0_RemoveDuplicate, Data_DWORD_General, "Remove Duplicate", "Controller 1", Default_RemoveDuplicate, nullptr);
|
||||||
RegisterSetting(Set_Control0_U_DPAD, Data_String_General, "DPadUp", "Controller 1", 0, Control0_U_DPAD_Default);
|
RegisterSetting(Set_Control0_U_DPAD, Data_String_General, "DPadUp", "Controller 1", 0, Control0_U_DPAD_Default);
|
||||||
|
@ -444,6 +576,7 @@ void CInputSettings::RegisterSettings(void)
|
||||||
RegisterSetting(Set_Control1_Plugin, Data_DWORD_General, "Plugin", "Controller 2", Default_Plugin, nullptr);
|
RegisterSetting(Set_Control1_Plugin, Data_DWORD_General, "Plugin", "Controller 2", Default_Plugin, nullptr);
|
||||||
RegisterSetting(Set_Control1_Range, Data_DWORD_General, "Range", "Controller 2", Default_Range, nullptr);
|
RegisterSetting(Set_Control1_Range, Data_DWORD_General, "Range", "Controller 2", Default_Range, nullptr);
|
||||||
RegisterSetting(Set_Control1_Deadzone, Data_DWORD_General, "Deadzone", "Controller 2", Default_DeadZone, nullptr);
|
RegisterSetting(Set_Control1_Deadzone, Data_DWORD_General, "Deadzone", "Controller 2", Default_DeadZone, nullptr);
|
||||||
|
RegisterSetting(Set_Control1_Sensitivity, Data_DWORD_General, "Sensitivity", "Controller 2", Default_Sensitivity, nullptr);
|
||||||
RegisterSetting(Set_Control1_RealN64Range, Data_DWORD_General, "RealN64Range", "Controller 2", Default_RealN64Range, nullptr);
|
RegisterSetting(Set_Control1_RealN64Range, Data_DWORD_General, "RealN64Range", "Controller 2", Default_RealN64Range, nullptr);
|
||||||
RegisterSetting(Set_Control1_RemoveDuplicate, Data_DWORD_General, "Remove Duplicate", "Controller 2", Default_RemoveDuplicate, nullptr);
|
RegisterSetting(Set_Control1_RemoveDuplicate, Data_DWORD_General, "Remove Duplicate", "Controller 2", Default_RemoveDuplicate, nullptr);
|
||||||
RegisterSetting(Set_Control1_U_DPAD, Data_String_General, "DPadUp", "Controller 2", 0, "");
|
RegisterSetting(Set_Control1_U_DPAD, Data_String_General, "DPadUp", "Controller 2", 0, "");
|
||||||
|
@ -469,6 +602,7 @@ void CInputSettings::RegisterSettings(void)
|
||||||
RegisterSetting(Set_Control2_Plugin, Data_DWORD_General, "Plugin", "Controller 3", Default_Plugin, nullptr);
|
RegisterSetting(Set_Control2_Plugin, Data_DWORD_General, "Plugin", "Controller 3", Default_Plugin, nullptr);
|
||||||
RegisterSetting(Set_Control2_Range, Data_DWORD_General, "Range", "Controller 3", Default_Range, nullptr);
|
RegisterSetting(Set_Control2_Range, Data_DWORD_General, "Range", "Controller 3", Default_Range, nullptr);
|
||||||
RegisterSetting(Set_Control2_Deadzone, Data_DWORD_General, "Deadzone", "Controller 3", Default_DeadZone, nullptr);
|
RegisterSetting(Set_Control2_Deadzone, Data_DWORD_General, "Deadzone", "Controller 3", Default_DeadZone, nullptr);
|
||||||
|
RegisterSetting(Set_Control2_Sensitivity, Data_DWORD_General, "Sensitivity", "Controller 3", Default_Sensitivity, nullptr);
|
||||||
RegisterSetting(Set_Control2_RealN64Range, Data_DWORD_General, "RealN64Range", "Controller 3", Default_RealN64Range, nullptr);
|
RegisterSetting(Set_Control2_RealN64Range, Data_DWORD_General, "RealN64Range", "Controller 3", Default_RealN64Range, nullptr);
|
||||||
RegisterSetting(Set_Control2_RemoveDuplicate, Data_DWORD_General, "Remove Duplicate", "Controller 3", Default_RemoveDuplicate, nullptr);
|
RegisterSetting(Set_Control2_RemoveDuplicate, Data_DWORD_General, "Remove Duplicate", "Controller 3", Default_RemoveDuplicate, nullptr);
|
||||||
RegisterSetting(Set_Control2_U_DPAD, Data_String_General, "DPadUp", "Controller 3", 0, "");
|
RegisterSetting(Set_Control2_U_DPAD, Data_String_General, "DPadUp", "Controller 3", 0, "");
|
||||||
|
@ -494,6 +628,7 @@ void CInputSettings::RegisterSettings(void)
|
||||||
RegisterSetting(Set_Control3_Plugin, Data_DWORD_General, "Plugin", "Controller 4", Default_Plugin, nullptr);
|
RegisterSetting(Set_Control3_Plugin, Data_DWORD_General, "Plugin", "Controller 4", Default_Plugin, nullptr);
|
||||||
RegisterSetting(Set_Control3_Range, Data_DWORD_General, "Range", "Controller 4", Default_Range, nullptr);
|
RegisterSetting(Set_Control3_Range, Data_DWORD_General, "Range", "Controller 4", Default_Range, nullptr);
|
||||||
RegisterSetting(Set_Control3_Deadzone, Data_DWORD_General, "Deadzone", "Controller 4", Default_DeadZone, nullptr);
|
RegisterSetting(Set_Control3_Deadzone, Data_DWORD_General, "Deadzone", "Controller 4", Default_DeadZone, nullptr);
|
||||||
|
RegisterSetting(Set_Control3_Sensitivity, Data_DWORD_General, "Sensitivity", "Controller 4", Default_Sensitivity, nullptr);
|
||||||
RegisterSetting(Set_Control3_RealN64Range, Data_DWORD_General, "RealN64Range", "Controller 4", Default_RealN64Range, nullptr);
|
RegisterSetting(Set_Control3_RealN64Range, Data_DWORD_General, "RealN64Range", "Controller 4", Default_RealN64Range, nullptr);
|
||||||
RegisterSetting(Set_Control3_RemoveDuplicate, Data_DWORD_General, "Remove Duplicate", "Controller 4", Default_RemoveDuplicate, nullptr);
|
RegisterSetting(Set_Control3_RemoveDuplicate, Data_DWORD_General, "Remove Duplicate", "Controller 4", Default_RemoveDuplicate, nullptr);
|
||||||
RegisterSetting(Set_Control3_U_DPAD, Data_String_General, "DPadUp", "Controller 4", 0, "");
|
RegisterSetting(Set_Control3_U_DPAD, Data_String_General, "DPadUp", "Controller 4", 0, "");
|
||||||
|
@ -514,6 +649,8 @@ void CInputSettings::RegisterSettings(void)
|
||||||
RegisterSetting(Set_Control3_D_ANALOG, Data_String_General, "AnalogDown", "Controller 4", 0, "");
|
RegisterSetting(Set_Control3_D_ANALOG, Data_String_General, "AnalogDown", "Controller 4", 0, "");
|
||||||
RegisterSetting(Set_Control3_L_ANALOG, Data_String_General, "AnalogLeft", "Controller 4", 0, "");
|
RegisterSetting(Set_Control3_L_ANALOG, Data_String_General, "AnalogLeft", "Controller 4", 0, "");
|
||||||
RegisterSetting(Set_Control3_R_ANALOG, Data_String_General, "AnalogRight", "Controller 4", 0, "");
|
RegisterSetting(Set_Control3_R_ANALOG, Data_String_General, "AnalogRight", "Controller 4", 0, "");
|
||||||
|
|
||||||
|
RegisterSetting(Set_Shortcut_LOCKMOUSE, Data_String_General, "LockMouse", "Shortcuts", 0, Shortcuts_LOCKMOUSE_Default);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupInputSettings(void)
|
void SetupInputSettings(void)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "N64Controller.h"
|
#include "N64Controller.h"
|
||||||
|
#include "Shortcuts.h"
|
||||||
#include "ControllerSpec1.1.h"
|
#include "ControllerSpec1.1.h"
|
||||||
|
|
||||||
class CInputSettings
|
class CInputSettings
|
||||||
|
@ -13,6 +14,11 @@ public:
|
||||||
void LoadController(uint32_t ControlIndex, CONTROL & ControllerInfo, N64CONTROLLER & Controller);
|
void LoadController(uint32_t ControlIndex, CONTROL & ControllerInfo, N64CONTROLLER & Controller);
|
||||||
void SaveController(uint32_t ControlIndex, const CONTROL & ControllerInfo, const N64CONTROLLER & Controller);
|
void SaveController(uint32_t ControlIndex, const CONTROL & ControllerInfo, const N64CONTROLLER & Controller);
|
||||||
void ResetController(uint32_t ControlIndex, CONTROL & ControllerInfo, N64CONTROLLER & Controller);
|
void ResetController(uint32_t ControlIndex, CONTROL & ControllerInfo, N64CONTROLLER & Controller);
|
||||||
|
void GetControllerMouse(N64CONTROLLER& Controller);
|
||||||
|
|
||||||
|
void LoadShortcuts(SHORTCUTS& Shortcuts);
|
||||||
|
void SaveShortcuts(SHORTCUTS& Shortcuts);
|
||||||
|
void ResetShortcuts(SHORTCUTS& Shortcuts);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CInputSettings(const CInputSettings&);
|
CInputSettings(const CInputSettings&);
|
||||||
|
|
|
@ -6,6 +6,7 @@ enum InputSettingID
|
||||||
Set_Control0_Plugin,
|
Set_Control0_Plugin,
|
||||||
Set_Control0_Range,
|
Set_Control0_Range,
|
||||||
Set_Control0_Deadzone,
|
Set_Control0_Deadzone,
|
||||||
|
Set_Control0_Sensitivity,
|
||||||
Set_Control0_RealN64Range,
|
Set_Control0_RealN64Range,
|
||||||
Set_Control0_RemoveDuplicate,
|
Set_Control0_RemoveDuplicate,
|
||||||
Set_Control0_U_DPAD,
|
Set_Control0_U_DPAD,
|
||||||
|
@ -31,6 +32,7 @@ enum InputSettingID
|
||||||
Set_Control1_Plugin,
|
Set_Control1_Plugin,
|
||||||
Set_Control1_Range,
|
Set_Control1_Range,
|
||||||
Set_Control1_Deadzone,
|
Set_Control1_Deadzone,
|
||||||
|
Set_Control1_Sensitivity,
|
||||||
Set_Control1_RealN64Range,
|
Set_Control1_RealN64Range,
|
||||||
Set_Control1_RemoveDuplicate,
|
Set_Control1_RemoveDuplicate,
|
||||||
Set_Control1_U_DPAD,
|
Set_Control1_U_DPAD,
|
||||||
|
@ -56,6 +58,7 @@ enum InputSettingID
|
||||||
Set_Control2_Plugin,
|
Set_Control2_Plugin,
|
||||||
Set_Control2_Range,
|
Set_Control2_Range,
|
||||||
Set_Control2_Deadzone,
|
Set_Control2_Deadzone,
|
||||||
|
Set_Control2_Sensitivity,
|
||||||
Set_Control2_RealN64Range,
|
Set_Control2_RealN64Range,
|
||||||
Set_Control2_RemoveDuplicate,
|
Set_Control2_RemoveDuplicate,
|
||||||
Set_Control2_U_DPAD,
|
Set_Control2_U_DPAD,
|
||||||
|
@ -81,6 +84,7 @@ enum InputSettingID
|
||||||
Set_Control3_Plugin,
|
Set_Control3_Plugin,
|
||||||
Set_Control3_Range,
|
Set_Control3_Range,
|
||||||
Set_Control3_Deadzone,
|
Set_Control3_Deadzone,
|
||||||
|
Set_Control3_Sensitivity,
|
||||||
Set_Control3_RealN64Range,
|
Set_Control3_RealN64Range,
|
||||||
Set_Control3_RemoveDuplicate,
|
Set_Control3_RemoveDuplicate,
|
||||||
Set_Control3_U_DPAD,
|
Set_Control3_U_DPAD,
|
||||||
|
@ -101,4 +105,6 @@ enum InputSettingID
|
||||||
Set_Control3_D_ANALOG,
|
Set_Control3_D_ANALOG,
|
||||||
Set_Control3_L_ANALOG,
|
Set_Control3_L_ANALOG,
|
||||||
Set_Control3_R_ANALOG,
|
Set_Control3_R_ANALOG,
|
||||||
|
|
||||||
|
Set_Shortcut_LOCKMOUSE,
|
||||||
};
|
};
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 83 KiB |
|
@ -23,6 +23,7 @@ typedef struct
|
||||||
BUTTON R_ANALOG;
|
BUTTON R_ANALOG;
|
||||||
uint8_t Range;
|
uint8_t Range;
|
||||||
uint8_t DeadZone;
|
uint8_t DeadZone;
|
||||||
|
uint8_t Sensitivity;
|
||||||
bool RealN64Range;
|
bool RealN64Range;
|
||||||
bool RemoveDuplicate;
|
bool RemoveDuplicate;
|
||||||
} N64CONTROLLER;
|
} N64CONTROLLER;
|
||||||
|
|
|
@ -11,6 +11,7 @@ public:
|
||||||
|
|
||||||
BEGIN_MSG_MAP(COptionsDlg)
|
BEGIN_MSG_MAP(COptionsDlg)
|
||||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||||
|
MESSAGE_HANDLER(WM_HSCROLL, OnScroll)
|
||||||
COMMAND_ID_HANDLER(IDOK, OnOkCmd)
|
COMMAND_ID_HANDLER(IDOK, OnOkCmd)
|
||||||
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
|
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
|
||||||
END_MSG_MAP()
|
END_MSG_MAP()
|
||||||
|
@ -29,6 +30,13 @@ public:
|
||||||
CButton(GetDlgItem(IDC_REAL_N64_RANGE)).SetCheck(m_Controller.RealN64Range ? BST_CHECKED : BST_UNCHECKED);
|
CButton(GetDlgItem(IDC_REAL_N64_RANGE)).SetCheck(m_Controller.RealN64Range ? BST_CHECKED : BST_UNCHECKED);
|
||||||
CButton(GetDlgItem(IDC_REMOVE_DUPLICATE)).SetCheck(m_Controller.RemoveDuplicate ? BST_CHECKED : BST_UNCHECKED);
|
CButton(GetDlgItem(IDC_REMOVE_DUPLICATE)).SetCheck(m_Controller.RemoveDuplicate ? BST_CHECKED : BST_UNCHECKED);
|
||||||
|
|
||||||
|
m_Sensitivity.Attach(GetDlgItem(IDC_SLIDE_SENSITIVITY));
|
||||||
|
m_Sensitivity.SetTicFreq(1);
|
||||||
|
m_Sensitivity.SetRangeMin(1);
|
||||||
|
m_Sensitivity.SetRangeMax(100);
|
||||||
|
m_Sensitivity.SetPos(m_Controller.Sensitivity);
|
||||||
|
CWindow(GetDlgItem(IDC_TXT_SENSITIVITY)).SetWindowText(stdstr_f("Mouse Sensitivity: %d%%", m_Sensitivity.GetPos()).ToUTF16().c_str());
|
||||||
|
|
||||||
CComboBox ControllerPak(GetDlgItem(IDC_PAKTYPE));
|
CComboBox ControllerPak(GetDlgItem(IDC_PAKTYPE));
|
||||||
int Index = ControllerPak.AddString(L"None");
|
int Index = ControllerPak.AddString(L"None");
|
||||||
ControllerPak.SetItemData(Index, PLUGIN_NONE);
|
ControllerPak.SetItemData(Index, PLUGIN_NONE);
|
||||||
|
@ -67,6 +75,13 @@ public:
|
||||||
bChanged = true;
|
bChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t Sensitivity = (uint8_t)m_Sensitivity.GetPos();
|
||||||
|
if (Sensitivity != m_Controller.Sensitivity)
|
||||||
|
{
|
||||||
|
m_Controller.Sensitivity = Sensitivity;
|
||||||
|
bChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
CComboBox ControllerPak(GetDlgItem(IDC_PAKTYPE));
|
CComboBox ControllerPak(GetDlgItem(IDC_PAKTYPE));
|
||||||
DWORD_PTR Pak = ControllerPak.GetItemData(ControllerPak.GetCurSel());
|
DWORD_PTR Pak = ControllerPak.GetItemData(ControllerPak.GetCurSel());
|
||||||
if (Pak != m_ControlInfo.Plugin)
|
if (Pak != m_ControlInfo.Plugin)
|
||||||
|
@ -87,9 +102,19 @@ public:
|
||||||
EndDialog(wID);
|
EndDialog(wID);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
LRESULT OnScroll(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/)
|
||||||
|
{
|
||||||
|
LONG SliderId = CWindow((HWND)lParam).GetWindowLong(GWL_ID);
|
||||||
|
if (SliderId == IDC_SLIDE_SENSITIVITY)
|
||||||
|
{
|
||||||
|
CWindow(GetDlgItem(IDC_TXT_SENSITIVITY)).SetWindowText(stdstr_f("Mouse Sensitivity: %d%%", m_Sensitivity.GetPos()).ToUTF16().c_str());
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
uint32_t m_ControlIndex;
|
uint32_t m_ControlIndex;
|
||||||
CONTROL & m_ControlInfo;
|
CONTROL & m_ControlInfo;
|
||||||
N64CONTROLLER & m_Controller;
|
N64CONTROLLER & m_Controller;
|
||||||
|
CTrackBarCtrl m_Sensitivity;
|
||||||
};
|
};
|
||||||
|
|
||||||
void ConfigOption(uint32_t ControlIndex, CONTROL & ControlInfo, N64CONTROLLER & Controller)
|
void ConfigOption(uint32_t ControlIndex, CONTROL & ControlInfo, N64CONTROLLER & Controller)
|
||||||
|
|
Binary file not shown.
|
@ -60,6 +60,7 @@
|
||||||
<ClCompile Include="CProject64Input.cpp" />
|
<ClCompile Include="CProject64Input.cpp" />
|
||||||
<ClCompile Include="InputSettings.cpp" />
|
<ClCompile Include="InputSettings.cpp" />
|
||||||
<ClCompile Include="OptionsUI.cpp" />
|
<ClCompile Include="OptionsUI.cpp" />
|
||||||
|
<ClCompile Include="ShortcutsUI.cpp" />
|
||||||
<ClCompile Include="wtl-BitmapPicture.cpp" />
|
<ClCompile Include="wtl-BitmapPicture.cpp" />
|
||||||
<ClCompile Include="wtl-ScanButton.cpp" />
|
<ClCompile Include="wtl-ScanButton.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -75,6 +76,8 @@
|
||||||
<ClInclude Include="CProject64Input.h" />
|
<ClInclude Include="CProject64Input.h" />
|
||||||
<ClInclude Include="OptionsUI.h" />
|
<ClInclude Include="OptionsUI.h" />
|
||||||
<ClInclude Include="resource.h" />
|
<ClInclude Include="resource.h" />
|
||||||
|
<ClInclude Include="Shortcuts.h" />
|
||||||
|
<ClInclude Include="ShortcutsUI.h" />
|
||||||
<ClInclude Include="wtl-BitmapPicture.h" />
|
<ClInclude Include="wtl-BitmapPicture.h" />
|
||||||
<ClInclude Include="wtl-ScanButton.h" />
|
<ClInclude Include="wtl-ScanButton.h" />
|
||||||
<ClInclude Include="wtl.h" />
|
<ClInclude Include="wtl.h" />
|
||||||
|
@ -87,6 +90,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Image Include="Controller.bmp" />
|
<Image Include="Controller.bmp" />
|
||||||
|
<Image Include="Mouse.bmp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Common\Common.vcxproj">
|
<ProjectReference Include="..\Common\Common.vcxproj">
|
||||||
|
|
|
@ -42,6 +42,9 @@
|
||||||
<ClCompile Include="OptionsUI.cpp">
|
<ClCompile Include="OptionsUI.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="ShortcutsUI.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="ControllerSpec1.1.h">
|
<ClInclude Include="ControllerSpec1.1.h">
|
||||||
|
@ -86,6 +89,12 @@
|
||||||
<ClInclude Include="OptionsUI.h">
|
<ClInclude Include="OptionsUI.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="Shortcuts.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="ShortcutsUI.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Version.h.in">
|
<None Include="Version.h.in">
|
||||||
|
@ -101,5 +110,8 @@
|
||||||
<Image Include="Controller.bmp">
|
<Image Include="Controller.bmp">
|
||||||
<Filter>Resource Files</Filter>
|
<Filter>Resource Files</Filter>
|
||||||
</Image>
|
</Image>
|
||||||
|
<Image Include="Mouse.bmp">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</Image>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -0,0 +1,9 @@
|
||||||
|
#pragma once
|
||||||
|
#include "Button.h"
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
BUTTON LOCKMOUSE;
|
||||||
|
|
||||||
|
bool LOCKMOUSE_PRESSED;
|
||||||
|
} SHORTCUTS;
|
|
@ -0,0 +1,132 @@
|
||||||
|
#include "ShortcutsUI.h"
|
||||||
|
#include "CProject64Input.h"
|
||||||
|
#include "wtl.h"
|
||||||
|
#include "wtl-ScanButton.h"
|
||||||
|
#include "resource.h"
|
||||||
|
#include <Common/StdString.h>
|
||||||
|
|
||||||
|
class CShortcutsDlg :
|
||||||
|
public CDialogImpl<CShortcutsDlg>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum { IDD = IDD_Shortcuts };
|
||||||
|
|
||||||
|
BEGIN_MSG_MAP(CShortcutsDlg)
|
||||||
|
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||||
|
COMMAND_ID_HANDLER(IDOK, OnOkCmd)
|
||||||
|
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
|
||||||
|
MESSAGE_HANDLER(CScanButton::WM_SCAN_SUCCESS, OnScanSuccess)
|
||||||
|
MESSAGE_HANDLER(CScanButton::WM_SCAN_CANCELED, OnScanCanceled)
|
||||||
|
END_MSG_MAP()
|
||||||
|
|
||||||
|
CShortcutsDlg(SHORTCUTS & Shortcuts) :
|
||||||
|
m_Shortcuts(Shortcuts),
|
||||||
|
m_SetupIndex(-1),
|
||||||
|
m_ButtonLockMouse(m_Shortcuts.LOCKMOUSE, IDC_EDIT_LOCKMOUSE, IDC_BTN_LOCKMOUSE)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||||
|
{
|
||||||
|
CenterWindow(GetParent());
|
||||||
|
SetWindowText(stdstr_f("Shortcuts").ToUTF16().c_str());
|
||||||
|
|
||||||
|
CScanButton* Buttons[] = {
|
||||||
|
&m_ButtonLockMouse
|
||||||
|
};
|
||||||
|
|
||||||
|
for (size_t i = 0, n = sizeof(Buttons) / sizeof(Buttons[0]); i < n; i++)
|
||||||
|
{
|
||||||
|
Buttons[i]->SubclassWindow(m_hWnd);
|
||||||
|
Buttons[i]->SetChangeCallback(stButtonChanged, (size_t)this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT OnOkCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||||
|
{
|
||||||
|
SHORTCUTS& Shortcuts = g_InputPlugin->Shortcuts();
|
||||||
|
Shortcuts = m_Shortcuts;
|
||||||
|
g_InputPlugin->SaveShortcuts();
|
||||||
|
EndDialog(wID);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||||
|
{
|
||||||
|
EndDialog(wID);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
SHORTCUTS& m_Shortcuts;
|
||||||
|
CScanButton m_ButtonLockMouse;
|
||||||
|
int32_t m_SetupIndex;
|
||||||
|
|
||||||
|
static void stButtonChanged(size_t data, const BUTTON& Button) { ((CShortcutsDlg*)data)->ButtonChannged(Button); }
|
||||||
|
|
||||||
|
void ButtonChannged(const BUTTON& Button)
|
||||||
|
{
|
||||||
|
BUTTON EmptyButton = { 0 };
|
||||||
|
BUTTON* buttons[] =
|
||||||
|
{
|
||||||
|
&m_Shortcuts.LOCKMOUSE,
|
||||||
|
};
|
||||||
|
|
||||||
|
bool Changed = false;
|
||||||
|
for (size_t b = 0; b < (sizeof(buttons) / sizeof(buttons[0])); b++)
|
||||||
|
{
|
||||||
|
if (buttons[b]->Offset == Button.Offset &&
|
||||||
|
buttons[b]->AxisID == Button.AxisID &&
|
||||||
|
buttons[b]->BtnType == Button.BtnType &&
|
||||||
|
memcmp(&buttons[b]->DeviceGuid, &Button.DeviceGuid, sizeof(Button.DeviceGuid)) == 0)
|
||||||
|
{
|
||||||
|
*buttons[b] = EmptyButton;
|
||||||
|
Changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Changed)
|
||||||
|
{
|
||||||
|
CScanButton* ScanButtons[] = {
|
||||||
|
&m_ButtonLockMouse,
|
||||||
|
};
|
||||||
|
|
||||||
|
for (size_t i = 0, n = sizeof(ScanButtons) / sizeof(ScanButtons[0]); i < n; i++)
|
||||||
|
{
|
||||||
|
ScanButtons[i]->DisplayButton();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CPropertySheetWindow(GetParent()).SetModified(m_hWnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT OnScanSuccess(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||||
|
{
|
||||||
|
if (m_SetupIndex < 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CScanButton* Buttons[] = {
|
||||||
|
&m_ButtonLockMouse
|
||||||
|
};
|
||||||
|
|
||||||
|
m_SetupIndex += 1;
|
||||||
|
if (m_SetupIndex < (sizeof(Buttons) / sizeof(Buttons[0])))
|
||||||
|
{
|
||||||
|
Buttons[m_SetupIndex]->DetectKey();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT OnScanCanceled(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||||
|
{
|
||||||
|
m_SetupIndex = -1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void ConfigShortcut(SHORTCUTS & Shortcuts)
|
||||||
|
{
|
||||||
|
CShortcutsDlg(Shortcuts).DoModal();
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
#pragma once
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "ControllerSpec1.1.h"
|
||||||
|
#include "Shortcuts.h"
|
||||||
|
|
||||||
|
void ConfigShortcut(SHORTCUTS & Shortcuts);
|
Binary file not shown.
|
@ -823,11 +823,18 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_this->m_bMainWindow && bCPURunning() && bAutoSleep())
|
if (_this->m_bMainWindow && bCPURunning())
|
||||||
{
|
{
|
||||||
if (g_BaseSystem)
|
if (g_BaseSystem)
|
||||||
{
|
{
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_AppLostFocus);
|
if (bAutoSleep())
|
||||||
|
{
|
||||||
|
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_AppLostFocus);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_Plugins && g_Plugins->Control()->WM_KillFocus) {
|
||||||
|
g_Plugins->Control()->WM_KillFocus(wParam, lParam);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue