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

Controller dialog: Wheel and throttle support #13189

Merged
merged 5 commits into from
Dec 24, 2017
Merged

Conversation

garbear
Copy link
Member

@garbear garbear commented Dec 13, 2017

This PR adds support for wheels and throttles in the Game API and Peripheral API. These feature types are needed for full Saturn support.

Requires:

Description

Wheels and throttles introduce a new kind of input. Currently, we have buttons (semiaxis) and analog sticks (dual axis). These new features, on the other hand, are composed of a single full axis.

First we modify the Game API to accept events for a single axis. We then use the buttonmap.xml belonging to the emulator to map the axis feature to an axis on a libretro device. See kodi-game/game.libretro#23 for more info and examples.

Next, we modify the Peripheral API so that we can map axis features. See xbmc/peripheral.joystick#133 for more info and examples. Then we augment the joystick library to handle axis features and connect to the Peripheral API to the Game API.

Finally, we add the ability to map axis features in the Controller Dialog. The buttons for these features use a FSM similar to analog sticks, but instead of prompting for four buttons, they prompt for two.

Motivation and Context

Part of my goal toward a completed player manager.

How Has This Been Tested?

Tested on OSX with an Xbox 360 controller. Possible remaining bugs.

Screenshots (if appropriate):

Sega Arcade Racer

Sega Mission Stick

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Copy link
Member

@Montellese Montellese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found only a few minors. I'm not that deep in this code anymore though.

}
catch (...)
{
CLog::Log(LOGERROR, "GAME: %s: exception caught in InputEvent()", m_gameClient->ID().c_str());

This comment was marked as spam.

This comment was marked as spam.

@@ -105,6 +105,22 @@ bool CPort::OnAccelerometerMotion(const std::string& feature, float x, float y,
return m_gameInput->OnAccelerometerMotion(feature, x, y, z);
}

bool CPort::OnWheelMotion(const std::string& feature, float position, unsigned int motionTimeMs)
{
if ((position != 0.0f) && !m_gameClient.AcceptsInput())

This comment was marked as spam.

This comment was marked as spam.

const bool bWasActivated = (m_state != 0.0f);

if (!bActivated && bWasActivated)
{

This comment was marked as spam.

motionTimeMs = MotionTimeMs();
}
else
{

This comment was marked as spam.

@garbear
Copy link
Member Author

garbear commented Dec 24, 2017

addressed your comments. jenkins build this please

@garbear
Copy link
Member Author

garbear commented Dec 24, 2017

jenkins build this please

@garbear garbear merged commit 1ea2477 into xbmc:master Dec 24, 2017
@garbear garbear deleted the saturn branch December 24, 2017 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Games Component: Input Type: Feature non-breaking change which adds functionality v18 Leia
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants