2020-06-23 07:47:46 +00:00
|
|
|
#pragma once
|
2023-09-21 04:43:08 +00:00
|
|
|
#include <Project64-plugin-spec/Input.h>
|
2020-06-23 07:47:46 +00:00
|
|
|
#include "DirectInput.h"
|
|
|
|
#include "N64Controller.h"
|
2022-01-09 11:13:12 +00:00
|
|
|
#include "Shortcuts.h"
|
2021-02-28 21:32:50 +00:00
|
|
|
#include <Common/CriticalSection.h>
|
2020-06-23 07:47:46 +00:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
class CProject64Input
|
|
|
|
{
|
2022-01-09 11:13:12 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
WM_HIDE_CUROSR = WM_USER + 10,
|
|
|
|
WM_MAKE_FOCUS = WM_USER + 17
|
|
|
|
};
|
|
|
|
|
2020-06-23 07:47:46 +00:00
|
|
|
public:
|
|
|
|
CProject64Input(HINSTANCE hinst);
|
|
|
|
~CProject64Input();
|
|
|
|
|
2020-07-15 11:10:20 +00:00
|
|
|
void DevicesChanged(void);
|
2020-07-22 03:43:42 +00:00
|
|
|
void DeviceAdded(void);
|
2020-06-23 07:47:46 +00:00
|
|
|
void InitiateControllers(CONTROL_INFO * ControlInfo);
|
2020-07-01 03:47:36 +00:00
|
|
|
void GetKeys(int32_t Control, BUTTONS * Keys);
|
2020-06-23 07:47:46 +00:00
|
|
|
void StartScanDevices(int32_t DisplayCtrlId);
|
|
|
|
void EndScanDevices(void);
|
|
|
|
CDirectInput::ScanResult ScanDevices(BUTTON & Button);
|
|
|
|
std::wstring ButtonAssignment(BUTTON & Button);
|
2020-07-27 07:33:35 +00:00
|
|
|
std::wstring ControllerDevices(const N64CONTROLLER & Controller);
|
2020-07-01 03:37:55 +00:00
|
|
|
bool SaveController(uint32_t ControlIndex);
|
2020-07-27 07:33:35 +00:00
|
|
|
bool ResetController(uint32_t ControlIndex, CONTROL & ControlInfo, N64CONTROLLER & Controller);
|
2022-01-09 11:13:12 +00:00
|
|
|
void CheckShortcuts();
|
|
|
|
bool SaveShortcuts();
|
|
|
|
bool ResetShortcuts(SHORTCUTS& Shortcuts);
|
|
|
|
void LockMouse();
|
|
|
|
void UnlockMouse();
|
|
|
|
void LockMouseSwitch();
|
|
|
|
bool IsMouseUsed();
|
|
|
|
void LockCursor();
|
2020-06-23 07:47:46 +00:00
|
|
|
|
|
|
|
inline HINSTANCE hInst(void) const { return m_hinst; }
|
|
|
|
inline bool IsScanning(void) const { return m_Scanning; }
|
|
|
|
inline int32_t DisplayCtrlId(void) const { return m_DisplayCtrlId; }
|
|
|
|
inline N64CONTROLLER & Controllers(int32_t Controller) { return m_Controllers[Controller]; }
|
2020-07-07 02:16:08 +00:00
|
|
|
inline CONTROL & ControlInfo(int32_t Controller) { return m_ControlInfo.Controls[Controller]; }
|
2022-01-09 11:13:12 +00:00
|
|
|
inline SHORTCUTS& Shortcuts() { return m_Shortcuts; }
|
2020-06-23 07:47:46 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
CProject64Input();
|
|
|
|
CProject64Input(const CProject64Input&);
|
|
|
|
CProject64Input& operator=(const CProject64Input&);
|
|
|
|
|
2020-07-01 03:37:55 +00:00
|
|
|
CriticalSection m_CS;
|
2020-07-07 02:16:08 +00:00
|
|
|
CONTROL_INFO m_ControlInfo;
|
2020-06-23 07:47:46 +00:00
|
|
|
N64CONTROLLER m_Controllers[4];
|
2022-01-09 11:13:12 +00:00
|
|
|
N64CONTROLLER m_N64Mouse;
|
|
|
|
SHORTCUTS m_Shortcuts;
|
2020-06-23 07:47:46 +00:00
|
|
|
std::unique_ptr<CDirectInput> m_DirectInput;
|
|
|
|
HINSTANCE m_hinst;
|
|
|
|
bool m_Scanning;
|
|
|
|
int32_t m_DisplayCtrlId;
|
2020-07-01 03:47:36 +00:00
|
|
|
int32_t m_iFirstController;
|
2022-01-09 11:13:12 +00:00
|
|
|
bool m_MouseLock;
|
2020-06-23 07:47:46 +00:00
|
|
|
};
|
|
|
|
|
2021-03-27 05:35:42 +00:00
|
|
|
extern CProject64Input * g_InputPlugin;
|