diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Attachment.h b/Source/Core/Core/HW/WiimoteEmu/Attachment/Attachment.h index e965261d21..4ddb5e86f0 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Attachment.h +++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Attachment.h @@ -14,14 +14,14 @@ namespace WiimoteEmu class Attachment : public ControllerEmu { 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(); std::string GetName() const override; - const char* const name; - WiimoteEmu::ExtensionReg& reg; + const char* const name; + WiimoteEmu::ExtensionReg& reg; u8 id[6]; u8 calibration[0x10]; @@ -30,7 +30,7 @@ public: class None : public Attachment { public: - None( WiimoteEmu::ExtensionReg& _reg ); + None(WiimoteEmu::ExtensionReg& _reg); }; } diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Classic.h b/Source/Core/Core/HW/WiimoteEmu/Attachment/Classic.h index ac68b2ad77..75452d58c0 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Classic.h +++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Classic.h @@ -11,34 +11,34 @@ class Classic : public Attachment { public: Classic(WiimoteEmu::ExtensionReg& _reg); - void GetState( u8* const data, const bool focus ); + void GetState(u8* const data, const bool focus) override; enum { - PAD_RIGHT = 0x80, - PAD_DOWN = 0x40, - TRIGGER_L = 0x20, + PAD_RIGHT = 0x80, + PAD_DOWN = 0x40, + TRIGGER_L = 0x20, BUTTON_MINUS = 0x10, - BUTTON_HOME = 0x08, - BUTTON_PLUS = 0x04, - TRIGGER_R = 0x02, - NOTHING = 0x01, - BUTTON_ZL = 0x8000, - BUTTON_B = 0x4000, - BUTTON_Y = 0x2000, - BUTTON_A = 0x1000, - BUTTON_X = 0x0800, - BUTTON_ZR = 0x0400, - PAD_LEFT = 0x0200, - PAD_UP = 0x0100, + BUTTON_HOME = 0x08, + BUTTON_PLUS = 0x04, + TRIGGER_R = 0x02, + NOTHING = 0x01, + BUTTON_ZL = 0x8000, + BUTTON_B = 0x4000, + BUTTON_Y = 0x2000, + BUTTON_A = 0x1000, + BUTTON_X = 0x0800, + BUTTON_ZR = 0x0400, + PAD_LEFT = 0x0200, + PAD_UP = 0x0100, }; private: - Buttons* m_buttons; - MixedTriggers* m_triggers; - Buttons* m_dpad; - AnalogStick* m_left_stick; - AnalogStick* m_right_stick; + Buttons* m_buttons; + MixedTriggers* m_triggers; + Buttons* m_dpad; + AnalogStick* m_left_stick; + AnalogStick* m_right_stick; }; diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Drums.h b/Source/Core/Core/HW/WiimoteEmu/Attachment/Drums.h index 3771140f10..0ed6a540fa 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Drums.h +++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Drums.h @@ -11,25 +11,25 @@ class Drums : public Attachment { public: Drums(WiimoteEmu::ExtensionReg& _reg); - void GetState( u8* const data, const bool focus ); + void GetState(u8* const data, const bool focus) override; enum { - BUTTON_PLUS = 0x04, + BUTTON_PLUS = 0x04, BUTTON_MINUS = 0x10, - PAD_BASS = 0x0400, - PAD_BLUE = 0x0800, - PAD_GREEN = 0x1000, - PAD_YELLOW = 0x2000, - PAD_RED = 0x4000, - PAD_ORANGE = 0x8000, + PAD_BASS = 0x0400, + PAD_BLUE = 0x0800, + PAD_GREEN = 0x1000, + PAD_YELLOW = 0x2000, + PAD_RED = 0x4000, + PAD_ORANGE = 0x8000, }; private: - Buttons* m_buttons; - Buttons* m_pads; - AnalogStick* m_stick; + Buttons* m_buttons; + Buttons* m_pads; + AnalogStick* m_stick; }; diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Guitar.h b/Source/Core/Core/HW/WiimoteEmu/Attachment/Guitar.h index 1e33830a14..952fcde165 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Guitar.h +++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Guitar.h @@ -11,28 +11,28 @@ class Guitar : public Attachment { public: Guitar(WiimoteEmu::ExtensionReg& _reg); - void GetState( u8* const data, const bool focus ) override; + void GetState(u8* const data, const bool focus) override; enum { - BUTTON_PLUS = 0x04, + BUTTON_PLUS = 0x04, BUTTON_MINUS = 0x10, - BAR_DOWN = 0x40, + BAR_DOWN = 0x40, - BAR_UP = 0x0100, - FRET_YELLOW = 0x0800, - FRET_GREEN = 0x1000, - FRET_BLUE = 0x2000, - FRET_RED = 0x4000, - FRET_ORANGE = 0x8000, + BAR_UP = 0x0100, + FRET_YELLOW = 0x0800, + FRET_GREEN = 0x1000, + FRET_BLUE = 0x2000, + FRET_RED = 0x4000, + FRET_ORANGE = 0x8000, }; private: - Buttons* m_buttons; - Buttons* m_frets; - Buttons* m_strum; - Triggers* m_whammy; - AnalogStick* m_stick; + Buttons* m_buttons; + Buttons* m_frets; + Buttons* m_strum; + Triggers* m_whammy; + AnalogStick* m_stick; }; diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.cpp b/Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.cpp index bad48c0241..89c8d09ecc 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.cpp @@ -159,24 +159,24 @@ void Nunchuk::GetState(u8* const data, const bool focus) void Nunchuk::LoadDefaults(const ControllerInterface& ciface) { // 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 - set_control(m_stick, 0, "W"); // up - set_control(m_stick, 1, "S"); // down - set_control(m_stick, 2, "A"); // left - set_control(m_stick, 3, "D"); // right + set_control(m_stick, 0, "W"); // up + set_control(m_stick, 1, "S"); // down + set_control(m_stick, 2, "A"); // left + set_control(m_stick, 3, "D"); // right // Buttons #ifdef _WIN32 - set_control(m_buttons, 0, "LCONTROL"); // C - set_control(m_buttons, 1, "LSHIFT"); // Z + set_control(m_buttons, 0, "LCONTROL"); // C + set_control(m_buttons, 1, "LSHIFT"); // Z #elif __APPLE__ - set_control(m_buttons, 0, "Left Control"); // C - set_control(m_buttons, 1, "Left Shift"); // Z + set_control(m_buttons, 0, "Left Control"); // C + set_control(m_buttons, 1, "Left Shift"); // Z #else - set_control(m_buttons, 0, "Control_L"); // C - set_control(m_buttons, 1, "Shift_L"); // Z + set_control(m_buttons, 0, "Control_L"); // C + set_control(m_buttons, 1, "Shift_L"); // Z #endif } diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.h b/Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.h index 975e1fbfee..13d85ba889 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.h +++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.h @@ -17,7 +17,7 @@ class Nunchuk : public Attachment public: 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 { @@ -28,15 +28,15 @@ public: void LoadDefaults(const ControllerInterface& ciface) override; private: - Tilt* m_tilt; - Force* m_swing; + Tilt* m_tilt; + Force* m_swing; - Buttons* m_shake; + Buttons* m_shake; - Buttons* m_buttons; - AnalogStick* m_stick; + Buttons* m_buttons; + AnalogStick* m_stick; - u8 m_shake_step[3]; + u8 m_shake_step[3]; UDPWrapper* const m_udpWrap; }; diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Turntable.h b/Source/Core/Core/HW/WiimoteEmu/Attachment/Turntable.h index c416d69cfc..b593b89cae 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Turntable.h +++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Turntable.h @@ -17,23 +17,25 @@ public: { BUTTON_EUPHORIA = 0x1000, - BUTTON_L_GREEN = 0x0800, - BUTTON_L_RED = 0x20, - BUTTON_L_BLUE = 0x8000, + BUTTON_L_GREEN = 0x0800, + BUTTON_L_RED = 0x20, + BUTTON_L_BLUE = 0x8000, - BUTTON_R_GREEN = 0x2000, - BUTTON_R_RED = 0x02, - BUTTON_R_BLUE = 0x0400, + BUTTON_R_GREEN = 0x2000, + BUTTON_R_RED = 0x02, + BUTTON_R_BLUE = 0x0400, - BUTTON_MINUS = 0x10, - BUTTON_PLUS = 0x04, + BUTTON_MINUS = 0x10, + BUTTON_PLUS = 0x04, }; private: - Buttons* m_buttons; - AnalogStick* m_stick; - Triggers *m_effect_dial; - Slider *m_left_table, *m_right_table, *m_crossfade; + Buttons* m_buttons; + AnalogStick* m_stick; + Triggers* m_effect_dial; + Slider* m_left_table; + Slider* m_right_table; + Slider* m_crossfade; }; diff --git a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.h b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.h index 356f7aab2d..674b33fd62 100644 --- a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.h +++ b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.h @@ -18,11 +18,11 @@ #include // Registry sizes -#define WIIMOTE_EEPROM_SIZE (16*1024) -#define WIIMOTE_EEPROM_FREE_SIZE 0x1700 -#define WIIMOTE_REG_SPEAKER_SIZE 10 -#define WIIMOTE_REG_EXT_SIZE 0x100 -#define WIIMOTE_REG_IR_SIZE 0x34 +#define WIIMOTE_EEPROM_SIZE (16*1024) +#define WIIMOTE_EEPROM_FREE_SIZE 0x1700 +#define WIIMOTE_REG_SPEAKER_SIZE 10 +#define WIIMOTE_REG_EXT_SIZE 0x100 +#define WIIMOTE_REG_IR_SIZE 0x34 namespace WiimoteReal { @@ -49,26 +49,26 @@ struct ADPCMState struct ExtensionReg { - u8 unknown1[0x08]; + u8 unknown1[0x08]; // address 0x08 - u8 controller_data[0x06]; - u8 unknown2[0x12]; + u8 controller_data[0x06]; + u8 unknown2[0x12]; // address 0x20 - u8 calibration[0x10]; - u8 unknown3[0x10]; + u8 calibration[0x10]; + u8 unknown3[0x10]; // address 0x40 - u8 encryption_key[0x10]; - u8 unknown4[0xA0]; + u8 encryption_key[0x10]; + u8 unknown4[0xA0]; // address 0xF0 - u8 encryption; - u8 unknown5[0x9]; + u8 encryption; + u8 unknown5[0x9]; // address 0xFA - u8 constant_id[6]; + u8 constant_id[6]; }; extern const ReportFeatures reporting_mode_features[]; @@ -104,21 +104,21 @@ public: enum { - PAD_LEFT = 0x01, - PAD_RIGHT = 0x02, - PAD_DOWN = 0x04, - PAD_UP = 0x08, - BUTTON_PLUS = 0x10, + PAD_LEFT = 0x01, + PAD_RIGHT = 0x02, + PAD_DOWN = 0x04, + PAD_UP = 0x08, + BUTTON_PLUS = 0x10, - BUTTON_TWO = 0x0100, - BUTTON_ONE = 0x0200, - BUTTON_B = 0x0400, - BUTTON_A = 0x0800, - BUTTON_MINUS = 0x1000, - BUTTON_HOME = 0x8000, + BUTTON_TWO = 0x0100, + BUTTON_ONE = 0x0200, + BUTTON_B = 0x0400, + BUTTON_A = 0x0800, + BUTTON_MINUS = 0x1000, + BUTTON_HOME = 0x8000, }; - Wiimote( const unsigned int index ); + Wiimote(const unsigned int index); std::string GetName() const; void Update(); @@ -147,9 +147,9 @@ protected: private: struct ReadRequest { - //u16 channel; - unsigned int address, size, position; - u8* data; + //u16 channel; + u32 address, size, position; + u8* data; }; void Reset(); @@ -164,88 +164,85 @@ private: bool NetPlay_GetWiimoteData(int wiimote, u8* data, u8 size); // control groups - Buttons *m_buttons, *m_dpad, *m_shake; - Cursor* m_ir; - Tilt* m_tilt; - Force* m_swing; - ControlGroup* m_rumble; - Extension* m_extension; - ControlGroup* m_options; + Buttons *m_buttons, *m_dpad, *m_shake; + Cursor* m_ir; + Tilt* m_tilt; + Force* m_swing; + ControlGroup* m_rumble; + Extension* m_extension; + ControlGroup* m_options; // WiiMote accel data - AccelData m_accel; + AccelData m_accel; // 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; - bool m_rumble_on; - bool m_speaker_mute; - bool m_motion_plus_present; - bool m_motion_plus_active; + bool m_rumble_on; + bool m_speaker_mute; + bool m_motion_plus_present; + bool m_motion_plus_active; - bool m_reporting_auto; - u8 m_reporting_mode; - u16 m_reporting_channel; + bool m_reporting_auto; + u8 m_reporting_mode; + 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; // read data request queue // maybe it isn't actually a queue // maybe read requests cancel any current requests - std::queue< ReadRequest > m_read_requests; + std::queue 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 { u8 unknown[0xF0]; // address 0xF0 - u8 activated; + u8 activated; u8 unknown2[9]; // address 0xFA - u8 ext_identifier[6]; - - } m_reg_motion_plus; + u8 ext_identifier[6]; + } m_reg_motion_plus; struct IrReg { - u8 data[0x33]; - u8 mode; - - } m_reg_ir; + u8 data[0x33]; + u8 mode; + } m_reg_ir; ExtensionReg m_reg_ext; struct SpeakerReg { - u8 unused_0; - u8 unk_1; - u8 format; + u8 unused_0; + u8 unk_1; + u8 format; // seems to always play at 6khz no matter what this is set to? // or maybe it only applies to pcm input - u16 sample_rate; - u8 volume; - u8 unk_6; - u8 unk_7; - u8 play; - u8 unk_9; - - } m_reg_speaker; + u16 sample_rate; + u8 volume; + u8 unk_6; + u8 unk_7; + u8 play; + u8 unk_9; + } m_reg_speaker; }; void Spy(Wiimote* wm_, const void* data_, size_t size_);