mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Add nunchuk support to tas input.
This commit is contained in:
@@ -110,7 +110,7 @@ void Nunchuk::GetState(u8* const data)
|
||||
m_buttons->GetState(&ncdata->bt.hex, nunchuk_button_bitmasks);
|
||||
|
||||
// flip the button bits :/
|
||||
*(u8*)&ncdata->bt ^= 0x03;
|
||||
ncdata->bt.hex ^= 0x03;
|
||||
|
||||
accel_cal& calib = *(accel_cal*)®.calibration;
|
||||
|
||||
|
||||
@@ -600,7 +600,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
|
||||
|
||||
if (data[1] == WM_REPORT_CORE_ACCEL_EXT16)
|
||||
{
|
||||
wm_extension *nc = (wm_extension*)&data[7];
|
||||
wm_nc *nc = (wm_nc*)&data[7];
|
||||
|
||||
SExt = StringFromFormat(
|
||||
"%02x %02x | %02x %02x %02x | %02x"
|
||||
|
||||
@@ -738,7 +738,7 @@ void Wiimote::Update()
|
||||
}
|
||||
}
|
||||
|
||||
Movie::CallWiiInputManip(data, rptf, m_index);
|
||||
Movie::CallWiiInputManip(data, rptf, m_index, m_extension->active_extension, m_ext_key);
|
||||
}
|
||||
if (NetPlay::IsNetPlayRunning())
|
||||
{
|
||||
@@ -746,10 +746,8 @@ void Wiimote::Update()
|
||||
if (rptf.core)
|
||||
m_status.buttons = *(wm_buttons*)(data + rptf.core);
|
||||
}
|
||||
if (!Movie::IsPlayingInput())
|
||||
{
|
||||
Movie::CheckWiimoteStatus(m_index, data, rptf, m_extension->active_extension, m_ext_key);
|
||||
}
|
||||
|
||||
Movie::CheckWiimoteStatus(m_index, data, rptf, m_extension->active_extension, m_ext_key);
|
||||
|
||||
// don't send a data report if auto reporting is off
|
||||
if (false == m_reporting_auto && data[2] >= WM_REPORT_CORE)
|
||||
|
||||
@@ -120,6 +120,8 @@ public:
|
||||
|
||||
void LoadDefaults(const ControllerInterface& ciface) override;
|
||||
|
||||
int CurrentExtension() const { return m_extension->active_extension; }
|
||||
|
||||
protected:
|
||||
bool Step();
|
||||
void HidOutputReport(const wm_report* const sr, const bool send_ack = true);
|
||||
|
||||
+13
-16
@@ -638,23 +638,23 @@ static void SetWiiInputDisplayString(int remoteID, u8* const data, const Wiimote
|
||||
s_InputDisplay[controllerID].append(ir);
|
||||
}
|
||||
|
||||
// Nunchuck
|
||||
// Nunchuk
|
||||
if (extData && ext == 1)
|
||||
{
|
||||
wm_nc nunchuck;
|
||||
memcpy(&nunchuck, extData, sizeof(wm_nc));
|
||||
WiimoteDecrypt(&key, (u8*)&nunchuck, 0, sizeof(wm_nc));
|
||||
nunchuck.bt.hex = nunchuck.bt.hex ^ 0xFF;
|
||||
wm_nc nunchuk;
|
||||
memcpy(&nunchuk, extData, sizeof(wm_nc));
|
||||
WiimoteDecrypt(&key, (u8*)&nunchuk, 0, sizeof(wm_nc));
|
||||
nunchuk.bt.hex = nunchuk.bt.hex ^ 0x3;
|
||||
|
||||
std::string accel = StringFromFormat(" N-ACC:%d,%d,%d", nunchuck.ax << 2 | nunchuck.passthrough_data.acc_x_lsb,
|
||||
nunchuck.ay << 2 | nunchuck.passthrough_data.acc_y_lsb << 1, nunchuck.az << 2 | nunchuck.passthrough_data.acc_z_lsb << 1);
|
||||
std::string accel = StringFromFormat(" N-ACC:%d,%d,%d",
|
||||
(nunchuk.ax << 2) | nunchuk.bt.acc_x_lsb, (nunchuk.ay << 2) | nunchuk.bt.acc_y_lsb, (nunchuk.az << 2) | nunchuk.bt.acc_z_lsb);
|
||||
|
||||
if (nunchuck.bt.c)
|
||||
if (nunchuk.bt.c)
|
||||
s_InputDisplay[controllerID].append(" C");
|
||||
if (nunchuck.bt.z)
|
||||
if (nunchuk.bt.z)
|
||||
s_InputDisplay[controllerID].append(" Z");
|
||||
s_InputDisplay[controllerID].append(accel);
|
||||
s_InputDisplay[controllerID].append(Analog2DToString(nunchuck.jx, nunchuck.jy, " ANA"));
|
||||
s_InputDisplay[controllerID].append(Analog2DToString(nunchuk.jx, nunchuk.jy, " ANA"));
|
||||
}
|
||||
|
||||
// Classic controller
|
||||
@@ -750,11 +750,10 @@ void RecordInput(GCPadStatus* PadStatus, int controllerID)
|
||||
|
||||
void CheckWiimoteStatus(int wiimote, u8 *data, const WiimoteEmu::ReportFeatures& rptf, int ext, const wiimote_key key)
|
||||
{
|
||||
u8 size = rptf.size;
|
||||
SetWiiInputDisplayString(wiimote, data, rptf, ext, key);
|
||||
|
||||
if (IsRecordingInput())
|
||||
RecordWiimote(wiimote, data, size);
|
||||
RecordWiimote(wiimote, data, rptf.size);
|
||||
}
|
||||
|
||||
void RecordWiimote(int wiimote, u8 *data, u8 size)
|
||||
@@ -1151,8 +1150,6 @@ bool PlayWiimote(int wiimote, u8 *data, const WiimoteEmu::ReportFeatures& rptf,
|
||||
memcpy(data, &(tmpInput[s_currentByte]), size);
|
||||
s_currentByte += size;
|
||||
|
||||
SetWiiInputDisplayString(wiimote, data, rptf, ext, key);
|
||||
|
||||
g_currentInputCount++;
|
||||
|
||||
CheckInputEnd();
|
||||
@@ -1262,10 +1259,10 @@ void CallGCInputManip(GCPadStatus* PadStatus, int controllerID)
|
||||
if (gcmfunc)
|
||||
(*gcmfunc)(PadStatus, controllerID);
|
||||
}
|
||||
void CallWiiInputManip(u8* data, WiimoteEmu::ReportFeatures rptf, int controllerID)
|
||||
void CallWiiInputManip(u8* data, WiimoteEmu::ReportFeatures rptf, int controllerID, int ext, const wiimote_key key)
|
||||
{
|
||||
if (wiimfunc)
|
||||
(*wiimfunc)(data, rptf, controllerID);
|
||||
(*wiimfunc)(data, rptf, controllerID, ext, key);
|
||||
}
|
||||
|
||||
void SetGraphicsConfig()
|
||||
|
||||
@@ -163,7 +163,7 @@ bool PlayInput(const std::string& filename);
|
||||
void LoadInput(const std::string& filename);
|
||||
void ReadHeader();
|
||||
void PlayController(GCPadStatus* PadStatus, int controllerID);
|
||||
bool PlayWiimote(int wiimote, u8* data, const struct WiimoteEmu::ReportFeatures& rptf, int ext, const struct wiimote_key key);
|
||||
bool PlayWiimote(int wiimote, u8* data, const struct WiimoteEmu::ReportFeatures& rptf, int ext, const wiimote_key key);
|
||||
void EndPlayInput(bool cont);
|
||||
void SaveRecording(const std::string& filename);
|
||||
void DoState(PointerWrap &p);
|
||||
@@ -171,16 +171,16 @@ void CheckMD5();
|
||||
void GetMD5();
|
||||
void Shutdown();
|
||||
void CheckPadStatus(GCPadStatus* PadStatus, int controllerID);
|
||||
void CheckWiimoteStatus(int wiimote, u8* data, const struct WiimoteEmu::ReportFeatures& rptf, int ext, const struct wiimote_key key);
|
||||
void CheckWiimoteStatus(int wiimote, u8* data, const struct WiimoteEmu::ReportFeatures& rptf, int ext, const wiimote_key key);
|
||||
|
||||
std::string GetInputDisplay();
|
||||
|
||||
// Done this way to avoid mixing of core and gui code
|
||||
typedef void(*GCManipFunction)(GCPadStatus*, int);
|
||||
typedef void(*WiiManipFunction)(u8*, WiimoteEmu::ReportFeatures, int);
|
||||
typedef void(*WiiManipFunction)(u8*, WiimoteEmu::ReportFeatures, int, int, wiimote_key);
|
||||
|
||||
void SetGCInputManip(GCManipFunction);
|
||||
void SetWiiInputManip(WiiManipFunction);
|
||||
void CallGCInputManip(GCPadStatus* PadStatus, int controllerID);
|
||||
void CallWiiInputManip(u8* core, WiimoteEmu::ReportFeatures rptf, int controllerID);
|
||||
void CallWiiInputManip(u8* core, WiimoteEmu::ReportFeatures rptf, int controllerID, int ext, const wiimote_key key);
|
||||
}
|
||||
|
||||
@@ -1003,10 +1003,12 @@ void GCTASManipFunction(GCPadStatus* PadStatus, int controllerID)
|
||||
main_frame->g_TASInputDlg[controllerID]->GetValues(PadStatus);
|
||||
}
|
||||
|
||||
void WiiTASManipFunction(u8* data, WiimoteEmu::ReportFeatures rptf, int controllerID)
|
||||
void WiiTASManipFunction(u8* data, WiimoteEmu::ReportFeatures rptf, int controllerID, int ext, const wiimote_key key)
|
||||
{
|
||||
if (main_frame)
|
||||
main_frame->g_TASInputDlg[controllerID + 4]->GetValues(data, rptf);
|
||||
{
|
||||
main_frame->g_TASInputDlg[controllerID + 4]->GetValues(data, rptf, ext, key);
|
||||
}
|
||||
}
|
||||
|
||||
bool TASInputHasFocus()
|
||||
|
||||
@@ -351,6 +351,6 @@ void OnStoppedCallback();
|
||||
|
||||
// For TASInputDlg
|
||||
void GCTASManipFunction(GCPadStatus* PadStatus, int controllerID);
|
||||
void WiiTASManipFunction(u8* data, WiimoteEmu::ReportFeatures rptf, int controllerID);
|
||||
void WiiTASManipFunction(u8* data, WiimoteEmu::ReportFeatures rptf, int controllerID, int ext, const wiimote_key key);
|
||||
bool TASInputHasFocus();
|
||||
extern int g_saveSlot;
|
||||
|
||||
@@ -731,7 +731,7 @@ void CFrame::OnTASInput(wxCommandEvent& event)
|
||||
|
||||
if (g_wiimote_sources[i] == WIIMOTE_SRC_EMU && !(Core::IsRunning() && !SConfig::GetInstance().m_LocalCoreStartupParameter.bWii))
|
||||
{
|
||||
g_TASInputDlg[i+4]->CreateWiiLayout();
|
||||
g_TASInputDlg[i+4]->CreateWiiLayout(i);
|
||||
g_TASInputDlg[i+4]->Show(true);
|
||||
g_TASInputDlg[i+4]->SetTitle(wxString::Format(_("TAS Input - Wiimote %d"), i + 1));
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -43,18 +43,18 @@ class TASInputDlg : public wxDialog
|
||||
void OnRightClickSlider(wxMouseEvent& event);
|
||||
void ResetValues();
|
||||
void GetValues(GCPadStatus* PadStatus);
|
||||
void GetValues(u8* data, WiimoteEmu::ReportFeatures rptf);
|
||||
void GetValues(u8* data, WiimoteEmu::ReportFeatures rptf, int ext, const wiimote_key key);
|
||||
void SetTurbo(wxMouseEvent& event);
|
||||
void SetTurboFalse(wxMouseEvent& event);
|
||||
void SetTurboState(wxCheckBox* CheckBox, bool* TurboOn);
|
||||
void SetTurboState(wxCheckBox* CheckBox, bool* turbo_on);
|
||||
void ButtonTurbo();
|
||||
void GetKeyBoardInput(GCPadStatus* PadStatus);
|
||||
void GetKeyBoardInput(u8* data, WiimoteEmu::ReportFeatures rptf);
|
||||
void GetKeyBoardInput(u8* data, WiimoteEmu::ReportFeatures rptf, int ext, const wiimote_key key);
|
||||
bool TextBoxHasFocus();
|
||||
void SetLandRTriggers();
|
||||
bool TASHasFocus();
|
||||
void CreateGCLayout();
|
||||
void CreateWiiLayout();
|
||||
void CreateWiiLayout(int num);
|
||||
wxBitmap CreateStickBitmap(int x, int y);
|
||||
void SetWiiButtons(u16* butt);
|
||||
void GetIRData(u8* const data, u8 mode, bool use_accel);
|
||||
@@ -74,6 +74,7 @@ class TASInputDlg : public wxDialog
|
||||
u32 range;
|
||||
u32 default_value = 128;
|
||||
bool set_by_keyboard = false;
|
||||
bool reverse = false;
|
||||
};
|
||||
|
||||
struct Button
|
||||
@@ -93,13 +94,15 @@ class TASInputDlg : public wxDialog
|
||||
|
||||
void SetStickValue(bool* ActivatedByKeyboard, int* AmountPressed, wxTextCtrl* Textbox, int CurrentValue, int center = 128);
|
||||
void SetButtonValue(Button* button, bool CurrentState);
|
||||
void SetSliderValue(Control* control, int CurrentValue, int defaultValue = 128);
|
||||
Stick CreateStick(int id_stick);
|
||||
void SetSliderValue(Control* control, int CurrentValue, int default_value = 128);
|
||||
void CreateBaseLayout();
|
||||
Stick CreateStick(int id_stick, int xRange, int yRange, u32 defaultX, u32 defaultY, bool reverseX, bool reverseY);
|
||||
wxStaticBoxSizer* CreateStickLayout(Stick* tempStick, const wxString& title);
|
||||
wxStaticBoxSizer* CreateAccelLayout(Control* x, Control* y, Control* z, const wxString& title);
|
||||
Button CreateButton(const std::string& name);
|
||||
Control CreateControl(long style, int width, int height, u32 range = 255);
|
||||
Control CreateControl(long style, int width, int height, bool reverse = false, u32 range = 255, u32 default_value = 128);
|
||||
|
||||
Control m_l_cont, m_r_cont, m_x_cont, m_y_cont, m_z_cont;
|
||||
Control m_l_cont, m_r_cont, m_x_cont, m_y_cont, m_z_cont, m_nx_cont, m_ny_cont, m_nz_cont;
|
||||
Button m_a, m_b, m_x, m_y, m_z, m_l, m_r, m_c;
|
||||
Button m_start, m_plus, m_minus, m_one, m_two, m_home;
|
||||
Button m_dpad_up, m_dpad_down, m_dpad_left, m_dpad_right;
|
||||
@@ -109,9 +112,14 @@ class TASInputDlg : public wxDialog
|
||||
Control* m_controls[10];
|
||||
static const int m_gc_pad_buttons_bitmask[12];
|
||||
static const int m_wii_buttons_bitmask[13];
|
||||
u8 m_ext = 0;
|
||||
wxBoxSizer* m_main_szr;
|
||||
wxBoxSizer* m_wiimote_szr;
|
||||
wxBoxSizer* m_ext_szr;
|
||||
wxStaticBoxSizer* m_main_stick_szr;
|
||||
wxStaticBoxSizer* m_c_stick_szr;
|
||||
|
||||
bool m_has_layout = false;
|
||||
bool m_is_wii = false;
|
||||
|
||||
wxGridSizer* const m_buttons_dpad = new wxGridSizer(3);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user