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

Poll controllers on a separate thread on Windows #5706

Merged
merged 1 commit into from
Mar 24, 2014

Conversation

unknownbrackets
Copy link
Collaborator

This means controllers will sample more than the game fps, and will work whenever keyboards do.

But, consider a game that is running at 30fps:

  • The cpu runs as fast as it can for 1 frame (1/30 of an emulated second.)
  • The cpu sleeps to wait for the next frame.
  • The user presses buttons during the 1/30 seconds that the game might respond to (per vblank or delay thread, etc.)
  • Nothing happens until the next frame's cpu burst.

Which means, the faster the device, the worse the input latency will be. This doesn't change that, but at least if the game isn't flipping, it will ensure that controller inputs still work just as well as keyboard inputs.

Maybe we should have an option for faster devices that allows you to force the cpu to checkpoint at least each vblank, or possibly more frequently. I think that would actually help #4020 (assuming the input device provides enough accuracy.)

-[Unknown]

@solarmystic
Copy link
Contributor

@unknownbrackets
I had a quick go with two rhythm based games (Project Diva 2nd and Diva Extend) after applying this commit to the current master.

I don't know how to describe it exactly, but the button presses in those games definitely feels a bit more responsive as compared to the current master. My scores were definitely improved, although that could just be a placebo effect of the commit; I was of course expecting an improvement. The situation (for me) prior to this commit wasn't as dire as others have reported however, I did finish both games on Hard Difficulty before this on PPSSPP.

Tested on my Windows 7 laptop with a Microsoft X360 wired controller.

@unknownbrackets
Copy link
Collaborator Author

It may help but I'm not expecting it to fix the issue, especially for faster devices as I described.

-[Unknown]

@solarmystic
Copy link
Contributor

PPSSPP crashes after exiting the program with the initial unknownbrackets@a78d38c commit . Still does after updating it to unknownbrackets@5c707f8

Stack trace from MSVC 2013:-

    ntdll.dll!00000000772512f7()    Unknown
    KernelBase.dll!000007fefd161873()   Unknown
    kernel32.dll!0000000077002f51() Unknown
>   PPSSPPWindows64.exe!InputDevice::StopPolling() Line 83  C++
    PPSSPPWindows64.exe!WinMain(HINSTANCE__ * _hInstance, HINSTANCE__ * hPrevInstance, char * szCmdLine, int iCmdShow) Line 438 C++
    [External Code] 

capture

This means controllers will sample more than the game fps, and will work
whenever keyboards do.
@unknownbrackets
Copy link
Collaborator Author

Oh, I forgot to detach. It wasn't crashing for me (except in that weird race condition where host had been deleted inside NativeShutdown()), but detaching may fix it for you and should be correct.

-[Unknown]

@solarmystic
Copy link
Contributor

Yep, unknownbrackets@b641ced did the trick, thanks. Should be good to go now.

hrydgard added a commit that referenced this pull request Mar 24, 2014
Poll controllers on a separate thread on Windows
@hrydgard hrydgard merged commit 108ebca into hrydgard:master Mar 24, 2014
@unknownbrackets unknownbrackets deleted the win-input branch March 24, 2014 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants