-
Notifications
You must be signed in to change notification settings - Fork 143
Implementation of KPAD / WPAD #497
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, here's a few nits I noticed.
struct ChanData | ||
{ | ||
be2_val<KPADControlDpdCallback> controlDpdCallback; | ||
be2_val<KPADControlMplsCallback > controlMplsCallback; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove space before >
src/decaf-sdl/decafsdl_input.cpp
Outdated
if (value < 0) { | ||
return value / 32768.0f; | ||
} | ||
else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else {
This latest update is working quite nicely now - helps a few games to in game |
@@ -183,6 +199,10 @@ WPADControlDpd(int32_t chan, | |||
return WPADError::OK; | |||
} | |||
|
|||
bool IsProControllerAllowed() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return type on separate line
@@ -89,6 +100,26 @@ struct KPADExtStatus | |||
}; | |||
CHECK_SIZE(KPADExtStatus, 0x50); | |||
|
|||
struct KPADMPDir { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove space before struct
Looking pretty solid overall - will merge it when I get a chance at my PC. I was wondering if you had any thoughts on improving the API between the front-end and decaf itself? I'm not so sure the API I threw together the first time round was a great choice. Maybe instead of having a function per button in the decaf InputDriver we should consider consolidating them into basically how VPADRead works and read the structure in one go? Thinking ahead too I think we are also going to need support for frontend notifying decaf of controllers being connected and other such controller events, also adding methods for vibration etc. Although I am not sure where this could fit in if we ever did bluetooth / usb passthrough as the games do have access to USB devices. Something to consider for a future PR at least - if you have any ideas about a nicer API that is. |
padscore_kpad.cpp gCoreButtonMap is now unused. In KPADReadEx you use gLastButtonState but don't update its value., Also gLastButtonState should be moved to sKpadData->lastButtonState. And it needs to be per controller rather than for all. So something roughly like this:
Also do not worry about constantly rebasing onto latest master, I can do that when merging. |
config::input::wpadType[0] = config->get_qualified_as<std::string>("input.wpadType0").value_or(config::input::wpadType[0]); | ||
config::input::wpadType[1] = config->get_qualified_as<std::string>("input.wpadType1").value_or(config::input::wpadType[1]); | ||
config::input::wpadType[2] = config->get_qualified_as<std::string>("input.wpadType2").value_or(config::input::wpadType[2]); | ||
config::input::wpadType[3] = config->get_qualified_as<std::string>("input.wpadType3").value_or(config::input::wpadType[3]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change these repetitive code to use for loops?
also in other places below and in config.cpp and main.cpp ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would require using string formatting to do that, probably nicer like it is here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (int i = 0; i < 4; i++) {
config::input::wpadType[i] = config->get_qualified_as<std::string>("input.wpadType" + std::to_string(i)).value_or(config::input::wpadType[i]);
}
or simply std::to_string
, no need to really use anything more fancy like fmt
. Nothing wrong with some small formatting or use of a lookup table (std:string[4] digits = {"0", "1", "2", "3"};
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point 👍
With these changes I was able to play a two player game of family tennis, but there is still a long way to go.
I wasn't able to get a second player to join a Mario Kart game.