mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-03-30 04:21:16 +00:00
Purely stylistic cleanup of Core/HW/WiimoteEmu/Attachment/* files.
Also cleaned up WiimoteEmu.h as well.
This commit is contained in:
parent
c31a623780
commit
3efb0aa5f7
@ -14,14 +14,14 @@ namespace WiimoteEmu
|
|||||||
class Attachment : public ControllerEmu
|
class Attachment : public ControllerEmu
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Attachment( const char* const _name, WiimoteEmu::ExtensionReg& _reg );
|
Attachment(const char* const _name, WiimoteEmu::ExtensionReg& _reg);
|
||||||
|
|
||||||
virtual void GetState( u8* const data, const bool focus = true ) {}
|
virtual void GetState(u8* const data, const bool focus = true) {}
|
||||||
void Reset();
|
void Reset();
|
||||||
std::string GetName() const override;
|
std::string GetName() const override;
|
||||||
|
|
||||||
const char* const name;
|
const char* const name;
|
||||||
WiimoteEmu::ExtensionReg& reg;
|
WiimoteEmu::ExtensionReg& reg;
|
||||||
|
|
||||||
u8 id[6];
|
u8 id[6];
|
||||||
u8 calibration[0x10];
|
u8 calibration[0x10];
|
||||||
@ -30,7 +30,7 @@ public:
|
|||||||
class None : public Attachment
|
class None : public Attachment
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
None( WiimoteEmu::ExtensionReg& _reg );
|
None(WiimoteEmu::ExtensionReg& _reg);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,34 +11,34 @@ class Classic : public Attachment
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Classic(WiimoteEmu::ExtensionReg& _reg);
|
Classic(WiimoteEmu::ExtensionReg& _reg);
|
||||||
void GetState( u8* const data, const bool focus );
|
void GetState(u8* const data, const bool focus) override;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PAD_RIGHT = 0x80,
|
PAD_RIGHT = 0x80,
|
||||||
PAD_DOWN = 0x40,
|
PAD_DOWN = 0x40,
|
||||||
TRIGGER_L = 0x20,
|
TRIGGER_L = 0x20,
|
||||||
BUTTON_MINUS = 0x10,
|
BUTTON_MINUS = 0x10,
|
||||||
BUTTON_HOME = 0x08,
|
BUTTON_HOME = 0x08,
|
||||||
BUTTON_PLUS = 0x04,
|
BUTTON_PLUS = 0x04,
|
||||||
TRIGGER_R = 0x02,
|
TRIGGER_R = 0x02,
|
||||||
NOTHING = 0x01,
|
NOTHING = 0x01,
|
||||||
BUTTON_ZL = 0x8000,
|
BUTTON_ZL = 0x8000,
|
||||||
BUTTON_B = 0x4000,
|
BUTTON_B = 0x4000,
|
||||||
BUTTON_Y = 0x2000,
|
BUTTON_Y = 0x2000,
|
||||||
BUTTON_A = 0x1000,
|
BUTTON_A = 0x1000,
|
||||||
BUTTON_X = 0x0800,
|
BUTTON_X = 0x0800,
|
||||||
BUTTON_ZR = 0x0400,
|
BUTTON_ZR = 0x0400,
|
||||||
PAD_LEFT = 0x0200,
|
PAD_LEFT = 0x0200,
|
||||||
PAD_UP = 0x0100,
|
PAD_UP = 0x0100,
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Buttons* m_buttons;
|
Buttons* m_buttons;
|
||||||
MixedTriggers* m_triggers;
|
MixedTriggers* m_triggers;
|
||||||
Buttons* m_dpad;
|
Buttons* m_dpad;
|
||||||
AnalogStick* m_left_stick;
|
AnalogStick* m_left_stick;
|
||||||
AnalogStick* m_right_stick;
|
AnalogStick* m_right_stick;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,25 +11,25 @@ class Drums : public Attachment
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Drums(WiimoteEmu::ExtensionReg& _reg);
|
Drums(WiimoteEmu::ExtensionReg& _reg);
|
||||||
void GetState( u8* const data, const bool focus );
|
void GetState(u8* const data, const bool focus) override;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
BUTTON_PLUS = 0x04,
|
BUTTON_PLUS = 0x04,
|
||||||
BUTTON_MINUS = 0x10,
|
BUTTON_MINUS = 0x10,
|
||||||
|
|
||||||
PAD_BASS = 0x0400,
|
PAD_BASS = 0x0400,
|
||||||
PAD_BLUE = 0x0800,
|
PAD_BLUE = 0x0800,
|
||||||
PAD_GREEN = 0x1000,
|
PAD_GREEN = 0x1000,
|
||||||
PAD_YELLOW = 0x2000,
|
PAD_YELLOW = 0x2000,
|
||||||
PAD_RED = 0x4000,
|
PAD_RED = 0x4000,
|
||||||
PAD_ORANGE = 0x8000,
|
PAD_ORANGE = 0x8000,
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Buttons* m_buttons;
|
Buttons* m_buttons;
|
||||||
Buttons* m_pads;
|
Buttons* m_pads;
|
||||||
AnalogStick* m_stick;
|
AnalogStick* m_stick;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,28 +11,28 @@ class Guitar : public Attachment
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Guitar(WiimoteEmu::ExtensionReg& _reg);
|
Guitar(WiimoteEmu::ExtensionReg& _reg);
|
||||||
void GetState( u8* const data, const bool focus ) override;
|
void GetState(u8* const data, const bool focus) override;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
BUTTON_PLUS = 0x04,
|
BUTTON_PLUS = 0x04,
|
||||||
BUTTON_MINUS = 0x10,
|
BUTTON_MINUS = 0x10,
|
||||||
BAR_DOWN = 0x40,
|
BAR_DOWN = 0x40,
|
||||||
|
|
||||||
BAR_UP = 0x0100,
|
BAR_UP = 0x0100,
|
||||||
FRET_YELLOW = 0x0800,
|
FRET_YELLOW = 0x0800,
|
||||||
FRET_GREEN = 0x1000,
|
FRET_GREEN = 0x1000,
|
||||||
FRET_BLUE = 0x2000,
|
FRET_BLUE = 0x2000,
|
||||||
FRET_RED = 0x4000,
|
FRET_RED = 0x4000,
|
||||||
FRET_ORANGE = 0x8000,
|
FRET_ORANGE = 0x8000,
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Buttons* m_buttons;
|
Buttons* m_buttons;
|
||||||
Buttons* m_frets;
|
Buttons* m_frets;
|
||||||
Buttons* m_strum;
|
Buttons* m_strum;
|
||||||
Triggers* m_whammy;
|
Triggers* m_whammy;
|
||||||
AnalogStick* m_stick;
|
AnalogStick* m_stick;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -159,24 +159,24 @@ void Nunchuk::GetState(u8* const data, const bool focus)
|
|||||||
void Nunchuk::LoadDefaults(const ControllerInterface& ciface)
|
void Nunchuk::LoadDefaults(const ControllerInterface& ciface)
|
||||||
{
|
{
|
||||||
// ugly macroooo
|
// ugly macroooo
|
||||||
#define set_control(group, num, str) (group)->controls[num]->control_ref->expression = (str)
|
#define set_control(group, num, str) (group)->controls[num]->control_ref->expression = (str)
|
||||||
|
|
||||||
// Stick
|
// Stick
|
||||||
set_control(m_stick, 0, "W"); // up
|
set_control(m_stick, 0, "W"); // up
|
||||||
set_control(m_stick, 1, "S"); // down
|
set_control(m_stick, 1, "S"); // down
|
||||||
set_control(m_stick, 2, "A"); // left
|
set_control(m_stick, 2, "A"); // left
|
||||||
set_control(m_stick, 3, "D"); // right
|
set_control(m_stick, 3, "D"); // right
|
||||||
|
|
||||||
// Buttons
|
// Buttons
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
set_control(m_buttons, 0, "LCONTROL"); // C
|
set_control(m_buttons, 0, "LCONTROL"); // C
|
||||||
set_control(m_buttons, 1, "LSHIFT"); // Z
|
set_control(m_buttons, 1, "LSHIFT"); // Z
|
||||||
#elif __APPLE__
|
#elif __APPLE__
|
||||||
set_control(m_buttons, 0, "Left Control"); // C
|
set_control(m_buttons, 0, "Left Control"); // C
|
||||||
set_control(m_buttons, 1, "Left Shift"); // Z
|
set_control(m_buttons, 1, "Left Shift"); // Z
|
||||||
#else
|
#else
|
||||||
set_control(m_buttons, 0, "Control_L"); // C
|
set_control(m_buttons, 0, "Control_L"); // C
|
||||||
set_control(m_buttons, 1, "Shift_L"); // Z
|
set_control(m_buttons, 1, "Shift_L"); // Z
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ class Nunchuk : public Attachment
|
|||||||
public:
|
public:
|
||||||
Nunchuk(UDPWrapper * wrp, WiimoteEmu::ExtensionReg& _reg);
|
Nunchuk(UDPWrapper * wrp, WiimoteEmu::ExtensionReg& _reg);
|
||||||
|
|
||||||
virtual void GetState( u8* const data, const bool focus ) override;
|
virtual void GetState(u8* const data, const bool focus) override;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -28,15 +28,15 @@ public:
|
|||||||
void LoadDefaults(const ControllerInterface& ciface) override;
|
void LoadDefaults(const ControllerInterface& ciface) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Tilt* m_tilt;
|
Tilt* m_tilt;
|
||||||
Force* m_swing;
|
Force* m_swing;
|
||||||
|
|
||||||
Buttons* m_shake;
|
Buttons* m_shake;
|
||||||
|
|
||||||
Buttons* m_buttons;
|
Buttons* m_buttons;
|
||||||
AnalogStick* m_stick;
|
AnalogStick* m_stick;
|
||||||
|
|
||||||
u8 m_shake_step[3];
|
u8 m_shake_step[3];
|
||||||
|
|
||||||
UDPWrapper* const m_udpWrap;
|
UDPWrapper* const m_udpWrap;
|
||||||
};
|
};
|
||||||
|
@ -17,23 +17,25 @@ public:
|
|||||||
{
|
{
|
||||||
BUTTON_EUPHORIA = 0x1000,
|
BUTTON_EUPHORIA = 0x1000,
|
||||||
|
|
||||||
BUTTON_L_GREEN = 0x0800,
|
BUTTON_L_GREEN = 0x0800,
|
||||||
BUTTON_L_RED = 0x20,
|
BUTTON_L_RED = 0x20,
|
||||||
BUTTON_L_BLUE = 0x8000,
|
BUTTON_L_BLUE = 0x8000,
|
||||||
|
|
||||||
BUTTON_R_GREEN = 0x2000,
|
BUTTON_R_GREEN = 0x2000,
|
||||||
BUTTON_R_RED = 0x02,
|
BUTTON_R_RED = 0x02,
|
||||||
BUTTON_R_BLUE = 0x0400,
|
BUTTON_R_BLUE = 0x0400,
|
||||||
|
|
||||||
BUTTON_MINUS = 0x10,
|
BUTTON_MINUS = 0x10,
|
||||||
BUTTON_PLUS = 0x04,
|
BUTTON_PLUS = 0x04,
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Buttons* m_buttons;
|
Buttons* m_buttons;
|
||||||
AnalogStick* m_stick;
|
AnalogStick* m_stick;
|
||||||
Triggers *m_effect_dial;
|
Triggers* m_effect_dial;
|
||||||
Slider *m_left_table, *m_right_table, *m_crossfade;
|
Slider* m_left_table;
|
||||||
|
Slider* m_right_table;
|
||||||
|
Slider* m_crossfade;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,11 +18,11 @@
|
|||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
// Registry sizes
|
// Registry sizes
|
||||||
#define WIIMOTE_EEPROM_SIZE (16*1024)
|
#define WIIMOTE_EEPROM_SIZE (16*1024)
|
||||||
#define WIIMOTE_EEPROM_FREE_SIZE 0x1700
|
#define WIIMOTE_EEPROM_FREE_SIZE 0x1700
|
||||||
#define WIIMOTE_REG_SPEAKER_SIZE 10
|
#define WIIMOTE_REG_SPEAKER_SIZE 10
|
||||||
#define WIIMOTE_REG_EXT_SIZE 0x100
|
#define WIIMOTE_REG_EXT_SIZE 0x100
|
||||||
#define WIIMOTE_REG_IR_SIZE 0x34
|
#define WIIMOTE_REG_IR_SIZE 0x34
|
||||||
|
|
||||||
namespace WiimoteReal
|
namespace WiimoteReal
|
||||||
{
|
{
|
||||||
@ -49,26 +49,26 @@ struct ADPCMState
|
|||||||
|
|
||||||
struct ExtensionReg
|
struct ExtensionReg
|
||||||
{
|
{
|
||||||
u8 unknown1[0x08];
|
u8 unknown1[0x08];
|
||||||
|
|
||||||
// address 0x08
|
// address 0x08
|
||||||
u8 controller_data[0x06];
|
u8 controller_data[0x06];
|
||||||
u8 unknown2[0x12];
|
u8 unknown2[0x12];
|
||||||
|
|
||||||
// address 0x20
|
// address 0x20
|
||||||
u8 calibration[0x10];
|
u8 calibration[0x10];
|
||||||
u8 unknown3[0x10];
|
u8 unknown3[0x10];
|
||||||
|
|
||||||
// address 0x40
|
// address 0x40
|
||||||
u8 encryption_key[0x10];
|
u8 encryption_key[0x10];
|
||||||
u8 unknown4[0xA0];
|
u8 unknown4[0xA0];
|
||||||
|
|
||||||
// address 0xF0
|
// address 0xF0
|
||||||
u8 encryption;
|
u8 encryption;
|
||||||
u8 unknown5[0x9];
|
u8 unknown5[0x9];
|
||||||
|
|
||||||
// address 0xFA
|
// address 0xFA
|
||||||
u8 constant_id[6];
|
u8 constant_id[6];
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const ReportFeatures reporting_mode_features[];
|
extern const ReportFeatures reporting_mode_features[];
|
||||||
@ -104,21 +104,21 @@ public:
|
|||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PAD_LEFT = 0x01,
|
PAD_LEFT = 0x01,
|
||||||
PAD_RIGHT = 0x02,
|
PAD_RIGHT = 0x02,
|
||||||
PAD_DOWN = 0x04,
|
PAD_DOWN = 0x04,
|
||||||
PAD_UP = 0x08,
|
PAD_UP = 0x08,
|
||||||
BUTTON_PLUS = 0x10,
|
BUTTON_PLUS = 0x10,
|
||||||
|
|
||||||
BUTTON_TWO = 0x0100,
|
BUTTON_TWO = 0x0100,
|
||||||
BUTTON_ONE = 0x0200,
|
BUTTON_ONE = 0x0200,
|
||||||
BUTTON_B = 0x0400,
|
BUTTON_B = 0x0400,
|
||||||
BUTTON_A = 0x0800,
|
BUTTON_A = 0x0800,
|
||||||
BUTTON_MINUS = 0x1000,
|
BUTTON_MINUS = 0x1000,
|
||||||
BUTTON_HOME = 0x8000,
|
BUTTON_HOME = 0x8000,
|
||||||
};
|
};
|
||||||
|
|
||||||
Wiimote( const unsigned int index );
|
Wiimote(const unsigned int index);
|
||||||
std::string GetName() const;
|
std::string GetName() const;
|
||||||
|
|
||||||
void Update();
|
void Update();
|
||||||
@ -147,9 +147,9 @@ protected:
|
|||||||
private:
|
private:
|
||||||
struct ReadRequest
|
struct ReadRequest
|
||||||
{
|
{
|
||||||
//u16 channel;
|
//u16 channel;
|
||||||
unsigned int address, size, position;
|
u32 address, size, position;
|
||||||
u8* data;
|
u8* data;
|
||||||
};
|
};
|
||||||
|
|
||||||
void Reset();
|
void Reset();
|
||||||
@ -164,88 +164,85 @@ private:
|
|||||||
bool NetPlay_GetWiimoteData(int wiimote, u8* data, u8 size);
|
bool NetPlay_GetWiimoteData(int wiimote, u8* data, u8 size);
|
||||||
|
|
||||||
// control groups
|
// control groups
|
||||||
Buttons *m_buttons, *m_dpad, *m_shake;
|
Buttons *m_buttons, *m_dpad, *m_shake;
|
||||||
Cursor* m_ir;
|
Cursor* m_ir;
|
||||||
Tilt* m_tilt;
|
Tilt* m_tilt;
|
||||||
Force* m_swing;
|
Force* m_swing;
|
||||||
ControlGroup* m_rumble;
|
ControlGroup* m_rumble;
|
||||||
Extension* m_extension;
|
Extension* m_extension;
|
||||||
ControlGroup* m_options;
|
ControlGroup* m_options;
|
||||||
|
|
||||||
// WiiMote accel data
|
// WiiMote accel data
|
||||||
AccelData m_accel;
|
AccelData m_accel;
|
||||||
|
|
||||||
// wiimote index, 0-3
|
// wiimote index, 0-3
|
||||||
const u8 m_index;
|
const u8 m_index;
|
||||||
|
|
||||||
double ir_sin, ir_cos; //for the low pass filter
|
double ir_sin, ir_cos; //for the low pass filter
|
||||||
|
|
||||||
UDPWrapper* m_udp;
|
UDPWrapper* m_udp;
|
||||||
|
|
||||||
bool m_rumble_on;
|
bool m_rumble_on;
|
||||||
bool m_speaker_mute;
|
bool m_speaker_mute;
|
||||||
bool m_motion_plus_present;
|
bool m_motion_plus_present;
|
||||||
bool m_motion_plus_active;
|
bool m_motion_plus_active;
|
||||||
|
|
||||||
bool m_reporting_auto;
|
bool m_reporting_auto;
|
||||||
u8 m_reporting_mode;
|
u8 m_reporting_mode;
|
||||||
u16 m_reporting_channel;
|
u16 m_reporting_channel;
|
||||||
|
|
||||||
u8 m_shake_step[3];
|
u8 m_shake_step[3];
|
||||||
|
|
||||||
bool m_sensor_bar_on_top;
|
bool m_sensor_bar_on_top;
|
||||||
|
|
||||||
wm_status_report m_status;
|
wm_status_report m_status;
|
||||||
|
|
||||||
ADPCMState m_adpcm_state;
|
ADPCMState m_adpcm_state;
|
||||||
|
|
||||||
// read data request queue
|
// read data request queue
|
||||||
// maybe it isn't actually a queue
|
// maybe it isn't actually a queue
|
||||||
// maybe read requests cancel any current requests
|
// maybe read requests cancel any current requests
|
||||||
std::queue< ReadRequest > m_read_requests;
|
std::queue<ReadRequest> m_read_requests;
|
||||||
|
|
||||||
wiimote_key m_ext_key;
|
wiimote_key m_ext_key;
|
||||||
|
|
||||||
u8 m_eeprom[WIIMOTE_EEPROM_SIZE];
|
u8 m_eeprom[WIIMOTE_EEPROM_SIZE];
|
||||||
|
|
||||||
struct MotionPlusReg
|
struct MotionPlusReg
|
||||||
{
|
{
|
||||||
u8 unknown[0xF0];
|
u8 unknown[0xF0];
|
||||||
|
|
||||||
// address 0xF0
|
// address 0xF0
|
||||||
u8 activated;
|
u8 activated;
|
||||||
|
|
||||||
u8 unknown2[9];
|
u8 unknown2[9];
|
||||||
|
|
||||||
// address 0xFA
|
// address 0xFA
|
||||||
u8 ext_identifier[6];
|
u8 ext_identifier[6];
|
||||||
|
} m_reg_motion_plus;
|
||||||
} m_reg_motion_plus;
|
|
||||||
|
|
||||||
struct IrReg
|
struct IrReg
|
||||||
{
|
{
|
||||||
u8 data[0x33];
|
u8 data[0x33];
|
||||||
u8 mode;
|
u8 mode;
|
||||||
|
} m_reg_ir;
|
||||||
} m_reg_ir;
|
|
||||||
|
|
||||||
ExtensionReg m_reg_ext;
|
ExtensionReg m_reg_ext;
|
||||||
|
|
||||||
struct SpeakerReg
|
struct SpeakerReg
|
||||||
{
|
{
|
||||||
u8 unused_0;
|
u8 unused_0;
|
||||||
u8 unk_1;
|
u8 unk_1;
|
||||||
u8 format;
|
u8 format;
|
||||||
// seems to always play at 6khz no matter what this is set to?
|
// seems to always play at 6khz no matter what this is set to?
|
||||||
// or maybe it only applies to pcm input
|
// or maybe it only applies to pcm input
|
||||||
u16 sample_rate;
|
u16 sample_rate;
|
||||||
u8 volume;
|
u8 volume;
|
||||||
u8 unk_6;
|
u8 unk_6;
|
||||||
u8 unk_7;
|
u8 unk_7;
|
||||||
u8 play;
|
u8 play;
|
||||||
u8 unk_9;
|
u8 unk_9;
|
||||||
|
} m_reg_speaker;
|
||||||
} m_reg_speaker;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void Spy(Wiimote* wm_, const void* data_, size_t size_);
|
void Spy(Wiimote* wm_, const void* data_, size_t size_);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user