2016-01-27 09:11:59 +00:00
|
|
|
#pragma once
|
|
|
|
#include <Project64-core/Plugins/PluginBase.h>
|
2022-06-27 10:02:38 +00:00
|
|
|
#include <Project64-plugin-spec/Input.h>
|
2022-01-09 11:13:12 +00:00
|
|
|
|
2016-01-27 09:11:59 +00:00
|
|
|
class CControl_Plugin;
|
|
|
|
|
|
|
|
class CCONTROL
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CCONTROL(int32_t &Present, int32_t &RawData, int32_t &PlugType);
|
2020-07-07 02:06:10 +00:00
|
|
|
inline bool Present(void) const { return m_Present != 0; }
|
2016-01-27 09:11:59 +00:00
|
|
|
inline uint32_t Buttons(void) const { return m_Buttons.Value; }
|
|
|
|
inline PluginType Plugin(void) const { return static_cast<PluginType>(m_PlugType); }
|
|
|
|
private:
|
2021-04-13 00:07:11 +00:00
|
|
|
friend class CControl_Plugin;
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
int32_t & m_Present;
|
|
|
|
int32_t & m_RawData;
|
2020-07-07 02:06:10 +00:00
|
|
|
int32_t & m_PlugType;
|
|
|
|
BUTTONS m_Buttons;
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2021-04-13 00:07:11 +00:00
|
|
|
CCONTROL(void);
|
|
|
|
CCONTROL(const CCONTROL&);
|
|
|
|
CCONTROL& operator=(const CCONTROL&);
|
2016-01-27 09:11:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CControl_Plugin : public CPlugin
|
|
|
|
{
|
|
|
|
public:
|
2021-06-15 05:00:38 +00:00
|
|
|
typedef void(CALL * fnGetKeys) (int32_t Control, BUTTONS * Keys);
|
|
|
|
|
2016-01-27 09:11:59 +00:00
|
|
|
CControl_Plugin(void);
|
|
|
|
~CControl_Plugin();
|
|
|
|
|
|
|
|
bool Initiate(CN64System * System, RenderWindow * Window);
|
|
|
|
void SetControl(CControl_Plugin const * const Plugin);
|
|
|
|
void UpdateKeys(void);
|
|
|
|
|
2021-04-13 00:07:11 +00:00
|
|
|
void(CALL *WM_KeyDown) (uint32_t wParam, uint32_t lParam);
|
|
|
|
void(CALL *WM_KeyUp) (uint32_t wParam, uint32_t lParam);
|
2022-01-09 11:13:12 +00:00
|
|
|
void(CALL *WM_KillFocus) (uint32_t wParam, uint32_t lParam);
|
|
|
|
void(CALL *EmulationPaused) ();
|
2021-04-13 00:07:11 +00:00
|
|
|
void(CALL *RumbleCommand) (int32_t Control, int32_t bRumble);
|
2021-06-15 05:00:38 +00:00
|
|
|
fnGetKeys GetKeys;
|
2021-04-13 00:07:11 +00:00
|
|
|
void(CALL *ReadController) (int32_t Control, uint8_t * Command);
|
|
|
|
void(CALL *ControllerCommand) (int32_t Control, uint8_t * Command);
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
inline CCONTROL const * Controller(int32_t control) { return m_Controllers[control]; }
|
|
|
|
inline CONTROL * PluginControllers(void) { return m_PluginControllers; }
|
|
|
|
|
|
|
|
private:
|
2021-04-13 00:07:11 +00:00
|
|
|
CControl_Plugin(const CControl_Plugin&);
|
|
|
|
CControl_Plugin& operator=(const CControl_Plugin&);
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
virtual int32_t GetDefaultSettingStartRange() const { return FirstCtrlDefaultSet; }
|
|
|
|
virtual int32_t GetSettingStartRange() const { return FirstCtrlSettings; }
|
|
|
|
PLUGIN_TYPE type() { return PLUGIN_TYPE_CONTROLLER; }
|
|
|
|
bool LoadFunctions(void);
|
|
|
|
void UnloadPluginDetails(void);
|
|
|
|
|
2021-04-13 00:07:11 +00:00
|
|
|
bool m_AllocatedControllers;
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
CONTROL m_PluginControllers[4];
|
|
|
|
CCONTROL * m_Controllers[4];
|
|
|
|
};
|