Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full button remapping with native adapter #348

Open
wants to merge 106 commits into
base: slippi
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
f139d5b
update IniFile to mostly match mainline
NikhilNarayana Jun 20, 2021
501f2fc
add a Gecko_Disabled section similar to mainline
NikhilNarayana Jun 20, 2021
dae174b
fix missing declarations and don't use functions that don't exist in …
NikhilNarayana Jun 20, 2021
bdf1640
Playback Version 2.3.3
NikhilNarayana Jun 22, 2021
2544b0f
Release Linux with zip as well
NikhilNarayana Jun 22, 2021
2b56e8d
ci: fix playback builds
NikhilNarayana Jun 26, 2021
d61ca50
Fix: Linux pixbuf error due to older linuxdeploy (#298)
NikhilNarayana Jun 27, 2021
ec569cb
Update defaults (#299)
NikhilNarayana Jun 27, 2021
f720b29
Playback Version 2.3.4
NikhilNarayana Jun 27, 2021
2d3aee4
include GameSettings inis in linux release zip
NikhilNarayana Jul 3, 2021
3b5abab
ci: throw the entire Sys folder in the linux zip
NikhilNarayana Jul 3, 2021
682b904
fix(IniFile): value to string conversions
NikhilNarayana Jul 8, 2021
b4a0bb7
Validate player index on player selection messages (#284)
altf4 Jul 8, 2021
a4a5088
Fix crash when players have commas in their names (#287)
rapito Jul 8, 2021
5548ff4
Validate incoming chat and player selection packets (#290)
altf4 Jul 8, 2021
663115a
feat: default playback to windowed
NikhilNarayana Jul 17, 2021
4f372e3
feat: ensure dolphin is in foreground on launch
NikhilNarayana Jul 17, 2021
6ba9c5f
Adapter hot-swapping support
JulienBernard3383279 Mar 22, 2021
bf4b4df
Fix reset adapter causing crash when called from input thread
gpipes Jul 14, 2021
a48eac1
Disable WebView on Linux & Windows (#302)
ryanmcgrath Jul 18, 2021
6a17676
fix finalized frame calculation for doubles and pause
JLaferri Jul 28, 2021
3a3b061
feat: update frame index tooltip
NikhilNarayana Jul 28, 2021
59c7fa4
Potential macOS Metal & vsync improvements (#297)
ryanmcgrath Aug 8, 2021
377dabc
feat: add Beyond Melee to gameTypes (#305)
Janthor Aug 9, 2021
3ee93a6
add ally indicator code
JLaferri Aug 9, 2021
fa5200f
feat: hide slot b setting and force Slippi
NikhilNarayana Aug 10, 2021
99d1f1a
feat: force enable cheats and hide checkbox
NikhilNarayana Aug 10, 2021
4c8650e
macOS: Default to Vulkan for rendering (#306)
ryanmcgrath Aug 10, 2021
e4cc102
feat: updated chat configs (#307)
rapito Aug 10, 2021
72dc32c
feat: update chat messages
NikhilNarayana Aug 10, 2021
fba2ac3
Netplay v2.3.2 & Playback v2.3.6
NikhilNarayana Aug 10, 2021
8596db2
fix: Quick chat settings label
NikhilNarayana Aug 10, 2021
0fadaf2
add nana determinism logic
JLaferri Aug 11, 2021
0f7fbc4
Revert "Potential macOS Metal & vsync improvements (#297)"
NikhilNarayana Aug 10, 2021
4288f43
ci: don't build windows updater anymore
NikhilNarayana Aug 11, 2021
b103684
add camera independent PS jumbotron transitions
JLaferri Aug 12, 2021
715193a
replace disc name check with file check
UnclePunch Aug 10, 2021
2ba1524
chmod 755 some files (#320)
tzlils Sep 24, 2021
71f9cbd
Playback v2.3.7; remove Normal Lag Reduction and default to auto aspe…
NikhilNarayana Oct 13, 2021
4d1264e
ci: update small things
NikhilNarayana Nov 10, 2021
e857e60
chore: add "yellow during IASA" to denylist
NikhilNarayana Nov 10, 2021
93605de
fix macOS CI by pinning ffmpeg to 2.8
ryanmcgrath Nov 22, 2021
318f8d5
ci: avoid duplicate runs
NikhilNarayana Dec 11, 2021
8e77e54
ci: update some names
NikhilNarayana Dec 11, 2021
2892737
ci: update names again
NikhilNarayana Dec 11, 2021
1f07766
version: netplay to 2.3.3
JLaferri Dec 21, 2021
772b967
update codeset
JLaferri Dec 21, 2021
6dd5fb4
Potential macOS Metal & vsync improvements Round 2 (#309)
ryanmcgrath Dec 31, 2021
b2cb5cf
ci: swap never skip PR for branches
NikhilNarayana Dec 31, 2021
d84ad24
Decrease instances of the dreaded 2GB allocation error on macOS. Ish.…
ryanmcgrath Jan 1, 2022
d380d20
chore(ci): push not branches
NikhilNarayana Jan 6, 2022
c94eeb4
chore: clean up reduced poll rate message
NikhilNarayana Jan 7, 2022
1aa1bbb
fix: launching dolphin on fedora and some others
NikhilNarayana Jan 6, 2022
7bdc234
release(playback): v2.3.8
NikhilNarayana Jan 6, 2022
9c4d0a4
refactor: simplify appimage script
NikhilNarayana Jan 18, 2022
fa514cf
uncomment frame offset info logger
JLaferri Jan 24, 2022
a2aaac8
Remove WebKit2 from dependency search in wxWidgets (#333)
ryanmcgrath Jan 26, 2022
0eeb978
feat: skip frames instead of stalling for lockstep
JLaferri Jul 11, 2021
67d1891
feat: show message when computer is running slow
JLaferri Jul 13, 2021
88327ab
refactor: allow fast client to slow down in dramatic cases
JLaferri Jan 24, 2022
062d2b9
feat: dynamically adjust emulation speed for ultimate time-sync
JLaferri Jan 24, 2022
cf18051
chore: update codeset
JLaferri Jan 25, 2022
1aa450b
refactor: don't show slow pc message in doubles
JLaferri Jan 25, 2022
bc6b1bd
chore: update codeset
NikhilNarayana Jan 26, 2022
204401d
chore: update playback codeset
NikhilNarayana Jan 26, 2022
d7345ab
Avoid integer overflow in frame bounds check during netplay (#332)
altf4 Jan 26, 2022
772673b
chore: update codeset
JLaferri Jan 26, 2022
cc055eb
refactor: make poll rate message easier to read
NikhilNarayana Jan 26, 2022
58707b9
feat: add UIDs to replays
NikhilNarayana Jan 30, 2022
56d31e2
chore: update codeset
NikhilNarayana Jan 30, 2022
eaef7d5
feat: get finalized frame from game to clear old inputs
JLaferri Jan 29, 2022
d0afe80
feat: add GetFakePadOutput function for testing specific rollback sit…
JLaferri Jan 29, 2022
3c641dd
tweak time-sync behaviors
JLaferri Jan 29, 2022
d785366
chore: update codeset
JLaferri Jan 30, 2022
ea6b3b2
fix: stack overflow on FifoQueue delete
JLaferri Feb 1, 2022
795a516
fix: given frame advance, stall logic was incorrect
JLaferri Feb 1, 2022
4a4316c
chore: update codeset
JLaferri Feb 2, 2022
8b88a38
chore: increase the maximum inputs in a packet to some large value
JLaferri Feb 2, 2022
5daebe5
fix: ensure rxb contains input on a skip
JLaferri Feb 3, 2022
ce8acc9
fix: frame advance doubles crash
JLaferri Feb 4, 2022
c981326
fix: correctly stall doubles clients on frame 8 until all loaded
JLaferri Feb 4, 2022
d8f47ad
chore: update codeset
JLaferri Feb 4, 2022
4e29aa4
fix: don't reset monthly setting when turning off replays
NikhilNarayana Feb 7, 2022
44d376b
chore: update codeset
JLaferri Feb 7, 2022
a04b858
release: v2.4.0
NikhilNarayana Feb 7, 2022
a8fa262
chore: send more data about the current user to mm service
JLaferri Feb 11, 2022
37dd6c4
WIP zjump
jordan-zilch Mar 26, 2022
512ef86
x and z swap
jordan-zilch Apr 7, 2022
878861d
typo
jordan-zilch Apr 7, 2022
fc04d7c
Every button except X and Y is also inputting Z. Trying to figure out…
jordan-zilch Apr 7, 2022
d55f2b3
Remove unnecessary changes and fix input bug
jordan-zilch Apr 9, 2022
c205c93
Add a ZX swap toggle to the controller config
jordan-zilch May 6, 2022
637401b
rebase merge
jordan-zilch May 13, 2022
5ad098f
A remap appears to be done, now I just need to redo all the changes f…
jordan-zilch May 16, 2022
5e26306
Seems to be fully functional now
jordan-zilch May 16, 2022
144d776
Epic
jordan-zilch May 16, 2022
bb1b09c
fix: disable adapter rumble in Playback builds
NikhilNarayana May 1, 2022
94ba942
Add \'Button remapping\' to controller config
jordan-zilch May 16, 2022
0c0a1f4
Fixing after rebase
jordan-zilch May 17, 2022
fe7b9ae
More post-rebase fixing
jordan-zilch May 17, 2022
64894c9
More fixing
jordan-zilch May 17, 2022
8cb72bb
Whitespace
jordan-zilch May 17, 2022
caea329
Merge branch 'slippi' into remap
jordan-zilch May 17, 2022
e5cd4a8
Disable L or R analog triggers if either is remapped
jordan-zilch May 30, 2022
caa3c1c
Add option to disable any button (for disabling taunt or a trigger/ju…
jordan-zilch Jun 14, 2022
4b3981f
Merge branch 'project-slippi:slippi' into remap
jordan-zilch Sep 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Source/Core/Core/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,17 @@ void SConfig::SaveCoreSettings(IniFile &ini)
{
core->Set(StringFromFormat("SIDevice%i", i), m_SIDevice[i]);
core->Set(StringFromFormat("AdapterRumble%i", i), m_AdapterRumble[i]);
core->Set(StringFromFormat("AChoice%i", i), m_AChoice[i]);
core->Set(StringFromFormat("BChoice%i", i), m_BChoice[i]);
core->Set(StringFromFormat("XChoice%i", i), m_XChoice[i]);
core->Set(StringFromFormat("YChoice%i", i), m_YChoice[i]);
core->Set(StringFromFormat("ZChoice%i", i), m_ZChoice[i]);
core->Set(StringFromFormat("LChoice%i", i), m_LChoice[i]);
core->Set(StringFromFormat("RChoice%i", i), m_RChoice[i]);
core->Set(StringFromFormat("UpChoice%i", i), m_UpChoice[i]);
core->Set(StringFromFormat("RightChoice%i", i), m_RightChoice[i]);
core->Set(StringFromFormat("DownChoice%i", i), m_DownChoice[i]);
core->Set(StringFromFormat("LeftChoice%i", i), m_LeftChoice[i]);
core->Set(StringFromFormat("SimulateKonga%i", i), m_AdapterKonga[i]);
}
core->Set("WiiSDCard", m_WiiSDCard);
Expand Down Expand Up @@ -653,6 +664,17 @@ void SConfig::LoadCoreSettings(IniFile &ini)
#else
core->Get(StringFromFormat("AdapterRumble%i", i), &m_AdapterRumble[i], false);
#endif
core->Get(StringFromFormat("AChoice%i", i), (int *)&m_AChoice[i], (int)PAD_BUTTON_A);
core->Get(StringFromFormat("BChoice%i", i), (int *)&m_BChoice[i], (int)PAD_BUTTON_B);
core->Get(StringFromFormat("XChoice%i", i), (int *)&m_XChoice[i], (int)PAD_BUTTON_X);
core->Get(StringFromFormat("YChoice%i", i), (int *)&m_YChoice[i], (int)PAD_BUTTON_Y);
core->Get(StringFromFormat("ZChoice%i", i), (int *)&m_ZChoice[i], (int)PAD_TRIGGER_Z);
core->Get(StringFromFormat("LChoice%i", i), (int *)&m_LChoice[i], (int)PAD_TRIGGER_L);
core->Get(StringFromFormat("RChoice%i", i), (int *)&m_RChoice[i], (int)PAD_TRIGGER_R);
core->Get(StringFromFormat("UpChoice%i", i), (int *)&m_UpChoice[i], (int)PAD_BUTTON_UP);
core->Get(StringFromFormat("RightChoice%i", i), (int *)&m_RightChoice[i], (int)PAD_BUTTON_RIGHT);
core->Get(StringFromFormat("DownChoice%i", i), (int *)&m_DownChoice[i], (int)PAD_BUTTON_DOWN);
core->Get(StringFromFormat("LeftChoice%i", i), (int *)&m_LeftChoice[i], (int)PAD_BUTTON_LEFT);
core->Get(StringFromFormat("SimulateKonga%i", i), &m_AdapterKonga[i], false);
}
core->Get("WiiSDCard", &m_WiiSDCard, false);
Expand Down
36 changes: 36 additions & 0 deletions Source/Core/Core/ConfigManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
#include "Common/NonCopyable.h"
#include "Core/HW/EXI_Device.h"
#include "Core/HW/SI_Device.h"
#include "InputCommon/GCPadStatus.h"

#include "DiscIO/Filesystem.h"

#include "DiscIO/Filesystem.h"

Expand Down Expand Up @@ -402,6 +405,39 @@ struct SConfig : NonCopyable
bool m_BackgroundInput;
bool m_AdapterRumble[4];
bool m_AdapterKonga[4];
PadButton m_AChoice[4] = {
PAD_BUTTON_A,
PAD_BUTTON_A,
PAD_BUTTON_A,
PAD_BUTTON_A};
PadButton m_BChoice[4] = {
PAD_BUTTON_B,
PAD_BUTTON_B,
PAD_BUTTON_B,
PAD_BUTTON_B};
PadButton m_XChoice[4] = {
PAD_BUTTON_X,
PAD_BUTTON_X,
PAD_BUTTON_X,
PAD_BUTTON_X};
PadButton m_YChoice[4] = {
PAD_BUTTON_Y,
PAD_BUTTON_Y,
PAD_BUTTON_Y,
PAD_BUTTON_Y
};
PadButton m_ZChoice[4] = {
PAD_TRIGGER_Z,
PAD_TRIGGER_Z,
PAD_TRIGGER_Z,
PAD_TRIGGER_Z
};
PadButton m_LChoice[4] = {PAD_TRIGGER_L, PAD_TRIGGER_L, PAD_TRIGGER_L, PAD_TRIGGER_L};
PadButton m_RChoice[4] = {PAD_TRIGGER_R, PAD_TRIGGER_R, PAD_TRIGGER_R, PAD_TRIGGER_R};
PadButton m_UpChoice[4] = {PAD_BUTTON_UP, PAD_BUTTON_UP, PAD_BUTTON_UP, PAD_BUTTON_UP};
PadButton m_RightChoice[4] = {PAD_BUTTON_RIGHT, PAD_BUTTON_RIGHT, PAD_BUTTON_RIGHT, PAD_BUTTON_RIGHT};
PadButton m_DownChoice[4] = {PAD_BUTTON_DOWN, PAD_BUTTON_DOWN, PAD_BUTTON_DOWN, PAD_BUTTON_DOWN};
PadButton m_LeftChoice[4] = {PAD_BUTTON_LEFT, PAD_BUTTON_LEFT, PAD_BUTTON_LEFT, PAD_BUTTON_LEFT};

// Network settings
bool m_SSLDumpRead;
Expand Down
223 changes: 221 additions & 2 deletions Source/Core/DolphinWX/Config/GCAdapterConfigDiag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,60 @@ GCAdapterConfigDiag::GCAdapterConfigDiag(wxWindow* const parent, const wxString&
: wxDialog(parent, wxID_ANY, name), m_pad_id(tab_num)
{
GCAdapter::ResetAdapterIfNecessary();
wxArrayString remap_array_string;

wxCheckBox* const gamecube_rumble = new wxCheckBox(this, wxID_ANY, _("Rumble"));
remap_array_string.Add(_("A"));
remap_array_string.Add(_("B"));
remap_array_string.Add(_("X"));
remap_array_string.Add(_("Y"));
remap_array_string.Add(_("Z"));
remap_array_string.Add(_("L"));
remap_array_string.Add(_("R"));
remap_array_string.Add(_("D-pad up"));
remap_array_string.Add(_("D-pad right"));
remap_array_string.Add(_("D-pad down"));
remap_array_string.Add(_("D-pad left"));
remap_array_string.Add(_("None"));

wxCheckBox* const gamecube_rumble = new wxCheckBox(this, wxID_ANY, _("Rumble"));
wxChoice* const a_choice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, remap_array_string);
wxChoice* const b_choice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, remap_array_string);
wxChoice* const x_choice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, remap_array_string);
wxChoice *const y_choice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, remap_array_string);
wxChoice* const z_choice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, remap_array_string);
wxChoice* const l_choice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, remap_array_string);
wxChoice* const r_choice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, remap_array_string);
wxChoice* const up_choice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, remap_array_string);
wxChoice* const right_choice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, remap_array_string);
wxChoice* const down_choice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, remap_array_string);
wxChoice* const left_choice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, remap_array_string);
gamecube_rumble->SetValue(SConfig::GetInstance().m_AdapterRumble[m_pad_id]);
gamecube_rumble->Bind(wxEVT_CHECKBOX, &GCAdapterConfigDiag::OnAdapterRumble, this);

a_choice->SetSelection(PadButtonToSelection(SConfig::GetInstance().m_AChoice[m_pad_id]));
b_choice->SetSelection(PadButtonToSelection(SConfig::GetInstance().m_BChoice[m_pad_id]));
x_choice->SetSelection(PadButtonToSelection(SConfig::GetInstance().m_XChoice[m_pad_id]));
y_choice->SetSelection(PadButtonToSelection(SConfig::GetInstance().m_YChoice[m_pad_id]));
z_choice->SetSelection(PadButtonToSelection(SConfig::GetInstance().m_ZChoice[m_pad_id]));
l_choice->SetSelection(PadButtonToSelection(SConfig::GetInstance().m_LChoice[m_pad_id]));
r_choice->SetSelection(PadButtonToSelection(SConfig::GetInstance().m_RChoice[m_pad_id]));
up_choice->SetSelection(PadButtonToSelection(SConfig::GetInstance().m_UpChoice[m_pad_id]));
right_choice->SetSelection(PadButtonToSelection(SConfig::GetInstance().m_RightChoice[m_pad_id]));
down_choice->SetSelection(PadButtonToSelection(SConfig::GetInstance().m_DownChoice[m_pad_id]));
left_choice->SetSelection(PadButtonToSelection(SConfig::GetInstance().m_LeftChoice[m_pad_id]));

a_choice->Bind(wxEVT_CHOICE, &GCAdapterConfigDiag::OnAChoice, this);
b_choice->Bind(wxEVT_CHOICE, &GCAdapterConfigDiag::OnBChoice, this);
x_choice->Bind(wxEVT_CHOICE, &GCAdapterConfigDiag::OnXChoice, this);
y_choice->Bind(wxEVT_CHOICE, &GCAdapterConfigDiag::OnYChoice, this);
z_choice->Bind(wxEVT_CHOICE, &GCAdapterConfigDiag::OnZChoice, this);
l_choice->Bind(wxEVT_CHOICE, &GCAdapterConfigDiag::OnLChoice, this);
r_choice->Bind(wxEVT_CHOICE, &GCAdapterConfigDiag::OnRChoice, this);
up_choice->Bind(wxEVT_CHOICE, &GCAdapterConfigDiag::OnUpChoice, this);
right_choice->Bind(wxEVT_CHOICE, &GCAdapterConfigDiag::OnRightChoice, this);
down_choice->Bind(wxEVT_CHOICE, &GCAdapterConfigDiag::OnDownChoice, this);
left_choice->Bind(wxEVT_CHOICE, &GCAdapterConfigDiag::OnLeftChoice, this);

m_adapter_status = new wxStaticText(this, wxID_ANY, _("Adapter Not Detected"));

if (!GCAdapter::IsDetected())
Expand All @@ -33,6 +82,17 @@ GCAdapterConfigDiag::GCAdapterConfigDiag(wxWindow* const parent, const wxString&
{
m_adapter_status->SetLabelText(_("Driver Not Detected"));
gamecube_rumble->Disable();
a_choice->Disable();
b_choice->Disable();
x_choice->Disable();
y_choice->Disable();
z_choice->Disable();
l_choice->Disable();
r_choice->Disable();
up_choice->Disable();
right_choice->Disable();
down_choice->Disable();
left_choice->Disable();
}
}
else
Expand All @@ -47,6 +107,76 @@ GCAdapterConfigDiag::GCAdapterConfigDiag(wxWindow* const parent, const wxString&
szr->Add(m_adapter_status, 0, wxEXPAND);
szr->AddSpacer(space5);
szr->Add(gamecube_rumble, 0, wxEXPAND);
szr->AddSpacer(space5);
szr->Add(new wxStaticText(this, wxID_ANY, _("Button remapping: ")));
szr->AddSpacer(space5);

wxBoxSizer *const a_box = new wxBoxSizer(wxHORIZONTAL);
a_box->Add(new wxStaticText(this, wxID_ANY, _("A: ")));
a_box->AddSpacer(space5);
a_box->Add(a_choice, 0, wxEXPAND);
szr->Add(a_box);

wxBoxSizer *const b_box = new wxBoxSizer(wxHORIZONTAL);
b_box->Add(new wxStaticText(this, wxID_ANY, _("B: ")));
b_box->AddSpacer(space5);
b_box->Add(b_choice, 0, wxEXPAND);
szr->Add(b_box);

wxBoxSizer *const x_box = new wxBoxSizer(wxHORIZONTAL);
x_box->Add(new wxStaticText(this, wxID_ANY, _("X: ")));
x_box->AddSpacer(space5);
x_box->Add(x_choice, 0, wxEXPAND);
szr->Add(x_box);

wxBoxSizer *const y_box = new wxBoxSizer(wxHORIZONTAL);
y_box->Add(new wxStaticText(this, wxID_ANY, _("Y: ")));
y_box->AddSpacer(space5);
y_box->Add(y_choice, 0, wxEXPAND);
szr->Add(y_box);

wxBoxSizer *const z_box = new wxBoxSizer(wxHORIZONTAL);
z_box->Add(new wxStaticText(this, wxID_ANY, _("Z: ")));
z_box->AddSpacer(space5);
z_box->Add(z_choice, 0, wxEXPAND);
szr->Add(z_box);

wxBoxSizer *const l_box = new wxBoxSizer(wxHORIZONTAL);
l_box->Add(new wxStaticText(this, wxID_ANY, _("L: ")));
l_box->AddSpacer(space5);
l_box->Add(l_choice, 0, wxEXPAND);
szr->Add(l_box);

wxBoxSizer *const r_box = new wxBoxSizer(wxHORIZONTAL);
r_box->Add(new wxStaticText(this, wxID_ANY, _("R: ")));
r_box->AddSpacer(space5);
r_box->Add(r_choice, 0, wxEXPAND);
szr->Add(r_box);

wxBoxSizer *const up_box = new wxBoxSizer(wxHORIZONTAL);
up_box->Add(new wxStaticText(this, wxID_ANY, _("D-pad up: ")));
up_box->AddSpacer(space5);
up_box->Add(up_choice, 0, wxEXPAND);
szr->Add(up_box);

wxBoxSizer *const right_box = new wxBoxSizer(wxHORIZONTAL);
right_box->Add(new wxStaticText(this, wxID_ANY, _("D-pad right: ")));
right_box->AddSpacer(space5);
right_box->Add(right_choice, 0, wxEXPAND);
szr->Add(right_box);

wxBoxSizer *const down_box = new wxBoxSizer(wxHORIZONTAL);
down_box->Add(new wxStaticText(this, wxID_ANY, _("D-pad down: ")));
down_box->AddSpacer(space5);
down_box->Add(down_choice, 0, wxEXPAND);
szr->Add(down_box);

wxBoxSizer *const left_box = new wxBoxSizer(wxHORIZONTAL);
left_box->Add(new wxStaticText(this, wxID_ANY, _("D-pad left: ")));
left_box->AddSpacer(space5);
left_box->Add(left_choice, 0, wxEXPAND);
szr->Add(left_box);

szr->AddSpacer(space5);
szr->Add(CreateButtonSizer(wxCLOSE | wxNO_DEFAULT), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr->AddSpacer(space5);
Expand Down Expand Up @@ -89,8 +219,97 @@ void GCAdapterConfigDiag::OnAdapterRumble(wxCommandEvent& event)
SConfig::GetInstance().m_AdapterRumble[m_pad_id] = event.IsChecked();
}


int GCAdapterConfigDiag::PadButtonToSelection(PadButton button) {
switch (button)
{
case PAD_BUTTON_A:
return 0;
case PAD_BUTTON_B:
return 1;
case PAD_BUTTON_X:
return 2;
case PAD_BUTTON_Y:
return 3;
case PAD_TRIGGER_Z:
return 4;
case PAD_TRIGGER_L:
return 5;
case PAD_TRIGGER_R:
return 6;
case PAD_BUTTON_UP:
return 7;
case PAD_BUTTON_RIGHT:
return 8;
case PAD_BUTTON_DOWN:
return 9;
case PAD_BUTTON_LEFT:
return 10;
case PAD_BUTTON_NONE:
return 11;
};
return -1;
}

void GCAdapterConfigDiag::OnAChoice(wxCommandEvent &event)
{
SConfig::GetInstance().m_AChoice[m_pad_id] = SelectionToPadButton[event.GetSelection()];
}

void GCAdapterConfigDiag::OnBChoice(wxCommandEvent &event)
{
SConfig::GetInstance().m_BChoice[m_pad_id] = SelectionToPadButton[event.GetSelection()];
}

void GCAdapterConfigDiag::OnXChoice(wxCommandEvent &event)
{
SConfig::GetInstance().m_XChoice[m_pad_id] = SelectionToPadButton[event.GetSelection()];
}

void GCAdapterConfigDiag::OnYChoice(wxCommandEvent &event)
{
SConfig::GetInstance().m_YChoice[m_pad_id] = SelectionToPadButton[event.GetSelection()];
}

void GCAdapterConfigDiag::OnZChoice(wxCommandEvent &event)
{
SConfig::GetInstance().m_ZChoice[m_pad_id] = SelectionToPadButton[event.GetSelection()];
}

void GCAdapterConfigDiag::OnLChoice(wxCommandEvent &event)
{
SConfig::GetInstance().m_LChoice[m_pad_id] = SelectionToPadButton[event.GetSelection()];
}

void GCAdapterConfigDiag::OnRChoice(wxCommandEvent &event)
{
SConfig::GetInstance().m_RChoice[m_pad_id] = SelectionToPadButton[event.GetSelection()];
}

void GCAdapterConfigDiag::OnUpChoice(wxCommandEvent &event)
{
SConfig::GetInstance().m_UpChoice[m_pad_id] = SelectionToPadButton[event.GetSelection()];
}

void GCAdapterConfigDiag::OnRightChoice(wxCommandEvent &event)
{
SConfig::GetInstance().m_RightChoice[m_pad_id] = SelectionToPadButton[event.GetSelection()];
}

void GCAdapterConfigDiag::OnDownChoice(wxCommandEvent &event)
{
SConfig::GetInstance().m_DownChoice[m_pad_id] = SelectionToPadButton[event.GetSelection()];
}

void GCAdapterConfigDiag::OnLeftChoice(wxCommandEvent &event)
{
SConfig::GetInstance().m_LeftChoice[m_pad_id] = SelectionToPadButton[event.GetSelection()];
}



void GCAdapterConfigDiag::OnUpdateRate(wxTimerEvent& ev)
{
if (GCAdapter::IsDetected())
m_adapter_status->SetLabelText(wxString::Format("%s (poll rate: %.1f hz)", _("Adapter Detected"), 1000.0 / GCAdapter::ReadRate()));
}
}
20 changes: 19 additions & 1 deletion Source/Core/DolphinWX/Config/GCAdapterConfigDiag.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include <wx/dialog.h>
#include <wx/timer.h>
#include <wx/choice.h>
#include "InputCommon/GCPadStatus.h"

class wxStaticText;

Expand All @@ -24,6 +26,22 @@ class GCAdapterConfigDiag : public wxDialog

int m_pad_id;

void OnAdapterRumble(wxCommandEvent& event);
PadButton SelectionToPadButton[12] = {PAD_BUTTON_A, PAD_BUTTON_B, PAD_BUTTON_X, PAD_BUTTON_Y,
PAD_TRIGGER_Z, PAD_TRIGGER_L, PAD_TRIGGER_R, PAD_BUTTON_UP,
PAD_BUTTON_RIGHT, PAD_BUTTON_DOWN, PAD_BUTTON_LEFT, PAD_BUTTON_NONE};
int PadButtonToSelection(PadButton button);

void OnAdapterRumble(wxCommandEvent &event);
void OnAChoice(wxCommandEvent &event);
void OnBChoice(wxCommandEvent &event);
void OnXChoice(wxCommandEvent &event);
void OnYChoice(wxCommandEvent &event);
void OnZChoice(wxCommandEvent &event);
void OnLChoice(wxCommandEvent &event);
void OnRChoice(wxCommandEvent &event);
void OnUpChoice(wxCommandEvent &event);
void OnRightChoice(wxCommandEvent &event);
void OnDownChoice(wxCommandEvent &event);
void OnLeftChoice(wxCommandEvent &event);
void OnUpdateRate(wxTimerEvent& ev);
};
Loading