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

Implement BizHawk's touch input interpolation changes in the core #2168

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

CasualPokePlayer
Copy link
Contributor

@CasualPokePlayer CasualPokePlayer commented Oct 23, 2024

"Touch input interpolation" here is rather simple: it does a simple linear interpolation against the touch values between the last frame's touch position and the current frame's touch position, using the current frame cycle count. In case the last frame wasn't touching anything, it just touches immediately.

The API presented here was originally intended as a way to try to avoid merge conflicts. It is intended that before RunFrame(), the user would call MoveTouch(), then call TouchScreen() once RunFrame() returns.

Alternatively, this newer API doesn't have to be used: TouchScreen() could be solely called before RunFrame() (this would probably be what the libretro port does, maybe some other ports). This however will run into issues for some games which do not like immediate changes to touch input every frame, rather needing touch input to go slowly across the frame, as touch input gets polled multiple times in a frame (see TASEmulators/BizHawk#3397).

melonDS Qt doesn't do this however, instead just calling TouchScreen() within mouse event handlers, i.e. within the UI thread, not the emulator thread. This does end up making it (at least seemingly) avoid issues with games not liking exactly per frame touch changes, but it is just a giant race condition and probably should be changed.

"Touch input interpolation" here is rather simple: it does a simple linear interpolation against the touch values between the last frame's touch position and the current frame's touch position, using the current frame cycle count. In case the last frame wasn't touching anything, it just touches immediately.

The API presented here was originally intended as a way to try to avoid merge conflicts. It is intended that before RunFrame(), the user would call MoveTouch(), then call TouchScreen() once RunFrame() returns.

Alternatively, TouchScreen() could be solely called before RunFrame() (this would probably be what the libretro port does, maybe some other ports). This however will run into issues for some games which do not like immediate changes to touch input every frame, rather needing touch input to go slowly across the frame, as touch input gets polled multiple times in a frame (see TASEmulators/BizHawk#3397).

melonDS Qt doesn't do this however, instead just calling TouchScreen() within mouse event handlers, i.e. within the UI thread, not the emulator thread. This does end up making it (at least seemingly) avoid issues with games not liking exactly per frame touch changes, but it is just a giant race condition and probably should be changed.
@JesseTG
Copy link
Contributor

JesseTG commented Oct 23, 2024

Alternatively, this newer API doesn't have to be used: TouchScreen() could be solely called before RunFrame() (this would probably be what the libretro port does, maybe some other ports). This however will run into issues for some games which do not like immediate changes to touch input every frame, rather needing touch input to go slowly across the frame, as touch input gets polled multiple times in a frame (see TASEmulators/BizHawk#3397).

Can you suggest such a problematic game? I'd like to compare the results before integrating this change and after.

@CasualPokePlayer
Copy link
Contributor Author

Can you suggest such a problematic game? I'd like to compare the results before integrating this change and after.

Just see the linked issue, which names such a game and provides SaveRAM for the problematic section.

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.

2 participants