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

HW: Fix infinite rumble on emulation pause #6477

Merged
merged 1 commit into from Mar 26, 2018

Conversation

Kekker-git
Copy link
Contributor

This fixes the old issue of rumble not stopping when emulation is paused. It was fixed for the GameCube adapter and LibUSB controllers here, but that fix did not work for XInput or DInput controllers on Windows.

A partner and I tested on two different machines in multiple games and multiple controllers. With XInput controllers, the rumble stopped on emulation pause and resumed where appropriate, and stopped properly on emulation close. Neither me nor my partner were able to test with DInput. I have a DInput controller, but my rumble motors are not recognized by Dolphin on any build that I've tested.

I believe it follows the code style guidelines, but this is the first pull request from my team so if anything is off please let us know.

@@ -278,6 +278,10 @@ void Stop() // - Hammertime!
#if defined(__LIBUSB__)
GCAdapter::ResetRumble();
#endif
#if defined(CIFACE_USE_XINPUT) || defined(CIFACE_USE_DINPUT)
for (int i = 0; i != 4; ++i)

This comment was marked as off-topic.

@lioncash
Copy link
Member

This can also likely just be a single commit or two (given 2 are added, and then 2 are just reverting them). It's also a convention to prefix the commits with the general area they're modifying.

e.g.

Core: Fix thing

@Kekker-git
Copy link
Contributor Author

Yes, I figured the two reverts would seem odd. We're working on this as part of a project, and our professor wanted us to modify the "about" text with our names. I'm not entirely certain how to delete the commits or if I even can, so I just reverted them.

Sorry about the prefix bit; if anyone else is wondering, this is modifying Core/Core and Core/Core/HW.

@lioncash
Copy link
Member

lioncash commented Mar 20, 2018

You can amend this like so:

  1. Run git --reset hard HEAD~2 to get rid of the reversion commits
  2. Now we only have 4 left to deal with so run git rebase HEAD~4
  3. You should now be in a vim-like CLI interface. Press I (not L, in case they look similar on your browser's font), then remove the two lines that have the first two initial commits. This will drop them entirely.
  4. Change the text that says pick next to the "Fix rumble on emulation pause" commit to s (to squash it down into the other commit).
  5. Press ESC to exit editing mode and then type :x to save and quit.

Once this runs, type git commit --amend. The same vim-like interface comes up, so press I and you can then edit the commit message. Exiting it is done the same way as before.

Then push the commits with git push -f origin master.

@@ -36,7 +36,8 @@ AboutDolphin::AboutDolphin(wxWindow* parent, wxWindowID id, const wxString& titl
_("\n"
"Dolphin is a free and open-source GameCube and Wii emulator.\n"
"\n"
"This software should not be used to play games you do not legally own.\n");
"This software should not be used to play games you do not legally own.\n"
"\nWith contributions by: Connor Roth, Calvun Williams, Justin Futrell, Andrew Nguyen\n");

This comment was marked as off-topic.

@Kekker-git Kekker-git force-pushed the master branch 2 times, most recently from acb8429 to 2f66d61 Compare March 21, 2018 00:54
@Kekker-git
Copy link
Contributor Author

It should be fixed. I squashed it to one commit, removed the reverts, and made a static ResetRumble() function that is called whenever the rumble reset is needed.

@Kekker-git Kekker-git changed the title Fix infinite rumble on emulation pause HW: Fix infinite rumble on emulation pause Mar 21, 2018
#if defined(__LIBUSB__)
GCAdapter::ResetRumble();
#endif
#if defined(CIFACE_USE_XINPUT) || defined(CIFACE_USE_DINPUT)

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

GCAdapter::ResetRumble();
#endif
#if defined(CIFACE_USE_XINPUT) || defined(CIFACE_USE_DINPUT)
for (int i = 0; i != 4; ++i)

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@@ -806,6 +801,17 @@ static bool PauseAndLock(bool do_lock, bool unpause_on_unlock)
return was_unpaused;
}

static void ResetRumble()

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@leoetlino
Copy link
Member

Code looks fine to me now, but please rebase your branch and squash the commits.

@Kekker-git Kekker-git force-pushed the master branch 4 times, most recently from cc95a85 to 32a92a3 Compare March 26, 2018 02:48
@Kekker-git
Copy link
Contributor Author

Sorry it took me a while. I had squashed the commits, but asked my partner to move the ResetRumble() function and he didn't squash his commits. The commit has been rebased and squashed to one commit, with ResetRumble() above the Stop() function where it was first called.

@delroth delroth merged commit 5479ba9 into dolphin-emu:master Mar 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
6 participants