yoshisuga / MAME4iOS

Multiple Arcade Machine Emulator for iOS, iPadOS, tvOS, macOS (Catalyst)
Other
635 stars 103 forks source link

“Better support for MFi controllers” (released in 2021.4) breaks 8BitDo Lite usability #426

Closed chinarut closed 1 year ago

chinarut commented 1 year ago

I just upgraded from 2020.12 to 2022.4-139 (yeah, it’s been awhile and happy to see all the progress!) and noticed my 8BitDo Lite D-pad control went wonky (particularly noticeable in shmups as you can imagine :)

it’s hard to describe the behavior [it’s a massive amount of lag and lack of responsiveness], I didn’t get a vidcap before downgrading to confirm the upgrade is an issue (and have limited IDs in AltStore so I am going to wait for your input to test further)

first thing I did was isolate the issue by installing MAME4mac 2022.4-139 on a 2015 MBP (Monterey 12.4) and the confirmed the controller still works fine so it’s iPadOS related.

without looking at the code, I assume you are still using the same 0.139 MAME core and it’s related to the “Better support for MFi controllers” feature in MAME4iOS 2021.4

to test this, I downgraded to MAME4iOS 2021.2 (2021.3 is a mac-only release) and sure enough my 8BitDo Lite controller works fine again (I tested with the salamand driver)

I really love that you can collapse sections now and use the controller to control menus so I can’t wait to get back to the current release (and eventually get caught up to the latest MAME so thanks for maintaining 0.139!)

while I don’t think it’s going to be anytime soon, if I can figure out how to rebuild the current release with the “Better support for MFi controller” feature reverted, I’ll give it a shot. but at the current runrate, it might be another 2 years 😅 I just know it’s a good opportunity to get my hands dirty so if you’d like to point to specific sections of the code (or just top level direction “here’s what I would do”) - happy to help as I am able as I seem to be quite addicted to tinkering the last 2 months 🤓 ✌🏼

if you need any other “how to reproduce” steps - let me know. I’m on an iPadPro 2019 12.9” on iPadOS 15.7. Here is the 8BitDo controller I am using with the latest firmware update (I updated it in Sept 2022 and the controller still works with the 2021.2 release (my workaround))

chinarut commented 1 year ago

@ToddLa is your controller rework limited to just this code?

https://github.com/yoshisuga/MAME4iOS/commit/7536b9104da27bdfec245ddd0ced45d8b629453d

if I reverted these changes in the current build, will I get the old 2021.2 MFi behavior back?

ToddLa commented 1 year ago

I just saw this issue, and need to investigate, and/or get details from you via DM on Discord.

Let me repro the issue first (if I can) then we can find a fix.

I need to re-read your long issue before I understand exactly what controller and or build/commit you are having a problem with

Wrt the 8bit zero, it has two modes keyboard and Xinput, it is much better to use In Xinput mode not keyboard, maybe that is all this is??

Anyway ping me on Discord, if you want. I will look over this in detail when I get to my office.

ToddLa commented 1 year ago

...or if discord don't work, we can just keep using this issue thread

ToddLa commented 1 year ago

I have a 8bitDo Lite and have not seen any issues. Will look again.

That single commit does not do anything that should cause crazy controller issues.

You said the problem is something you can screen-shot??

chinarut commented 1 year ago

hey - there is definitely no rush on this issue so here works fine - thanks for pinging me back!

hmm - good to know you have a 8BitDo Lite you don’t have any issues with. I do indeed have my Lite in X-input mode.

I wanted to go record a screencast of the behavior and running into the issue where the MAME4iOS folder isn’t showing up in On My iPad (related to #314 and thought the “Show Files” button resolved the issue but it doesn’t)

setting aside this issue for now, I’ve built MAME4iOS from source in XCode in the past and really don’t mind upskilling my dev skillz :) Could you tell me what git commands I use to build the latest release without a specific change set?

I can at least try it and see what happens!

chinarut commented 1 year ago

ok - here’s a screencast (trust me, I’m not intentionally trying to kill myself lol :)

https://youtu.be/Eb8Zi7KxJ7o

the easiest way to fix it is to roll back to the v2021.2 release.

do let me know what the magic command is with git to create a workspace w the v2022.4 release omitting the https://github.com/yoshisuga/MAME4iOS/commit/7536b9104da27bdfec245ddd0ced45d8b629453d change set and I’ll give it a shot and let ya know what happens!

chinarut commented 1 year ago

hey wanted to circle around & let you know this is not isolated to MAME4iOS - I experienced this issue w Play! last night.

it did not exhibit this behavior in Play! all the times I used it prior so I don't know what changed in the last week or two.

While I didn't test it last night, my experience with MAME4iOS is consistent - the v2022.4 release exhibits the defective behavior and the v2021.2 release does not.

so I reviewed our GitHub Glossary for kicks - it sounds like what I want is to create a "topic branch" (from v2022.4) and reverse "cherry pick" (by removing https://github.com/yoshisuga/MAME4iOS/commit/7536b9104da27bdfec245ddd0ced45d8b629453d) - I might be abusing use of these terms 😆

I know how to clone & build v2022.4 in a local workspace & just don't know how to remove change sets yet.

any other thoughts?

ToddLa commented 1 year ago

Could you tell me what git commands I use to build the latest release without a specific change set?

So much has changed after that specific git commit that undoing "just" that commit would not work

ToddLa commented 1 year ago

ok - here’s a screencast (trust me, I’m not intentionally trying to kill myself lol :) https://youtu.be/Eb8Zi7KxJ7o

I can't tell your exact problem from this video, but I assume you are getting terrible lag from from the controller inputs.

I have a proposed fix I want you to try (assuming you can build in Xcode)

  1. find this line in the file iOS/EmulatorController.m
    #define DIRECT_CONTROLLER_READ  0 // 1 - always read controller, 0 - cache read, and only read when marked dirty
  2. and CHANGE it to
    #define DIRECT_CONTROLLER_READ  1
  3. try MAME4iOS with both settings, and let me know if they feel different.
chinarut commented 1 year ago

hey thanks for a possible solution…I made the change and build is off to the races! my build machine is not exactly a screamer (MBP 2015) and it’s still on “Building | 3/120” so I think I’ll let this go overnight and circle back around later :)

chinarut commented 1 year ago

the proposed fix didn’t work :/

I can't tell your exact problem from this video, but I assume you are getting terrible lag from from the controller inputs.

yes, it is hard to describe/demo the behavior - i would say it’s less “lag” and more like the controller gets possessed and takes over for a bit (or doesn’t respond at all) - it’s like random input is being registered.

the behavior continues to be 100% reproducible (even with DIRECT_CONTROLLER_READ=1) on an 2018 iPadPro (now on iPadOS 16.1.1)

ToddLa commented 1 year ago

You said this is also a problem with other apps, so I don't know what to do next.

chinarut commented 1 year ago

hey happy new year! excuse the delay... well good news is its working after a rebuild of my Mac from a Time Machine backup (Mac decided to delete it's own AFPS Container definition after diskutil was behaving really strangely - fun)

perhaps it was something residual in the MAME4mac container? (I excluded the Container/Data/Documents directory from my backup so it's working on a fresh install that set up all the MAME directories again)

We can close this issue :) thanks for chiming in and your patience!