mackieks / MaplePad

🍁 Dreamcast controller emulator using RP2040. Supports 8-page memory card, SPI/I2C OLED for VMU LCD, and rumble.
Creative Commons Attribution 4.0 International
209 stars 12 forks source link

Rumble issues in Windows CE titles #13

Open mackieks opened 1 year ago

mackieks commented 1 year ago

Description: One of many, many problems with WinCE software. Some titles don't detect rumble at all. Some titles advise that an unsupported accessory has been connected when rumble is enabled, and work fine with rumble disabled. Sega Rally 2 seems to detect rumble, but hard crashes when rumble actually activates in-game, i.e. when the DC sends a setCondition packet to MaplePad (how this is even possible is beyond me.)

This is probably a packet format issue, or a packet that isn't being handled correctly by MaplePad. I already fixed some bugs where MaplePad wasn't responding to GetMediaInfo packets properly, so maybe there are more issues like that lurking in the code. The worst possible scenario would be if the vibeHandler timer ISR is somehow interfering with the receipt/transmission of rumble-related packets. Also, maybe continuous vibration/AST not being implemented is causing problems...? Really need to address that.

To-do: Capture logic traces with HKT-7700+stock VMU and MaplePad to compare behavior. Some analysis of Sega Rally 2 already performed last year.

Affected titles: (tested on 1.4b/c)

mackieks commented 1 year ago

Sega Rally 2 test from 9/17/22:

unknown2

Absolutely baffling... So in Sega Rally, going into the settings, selecting a rumble strength and pressing A will make the game send a SetCondition command to the rumble pack. But with Maplepad, the SetCondition command never gets sent when I press A. In fact the game instantly freezes how the controller could make the entire game loop freeze is beyond me

MaplePad's SendControllerStatus packet (A press) looks the same as the HKT-7700's in this capture. I did see some spurious spikes on the data lines after turning off the glitch filter in DSView. Maybe the next step is to capture this particular transaction with the scope and make sure this isn't a SI issue or a bug in the PIO engine.

megavolt85 commented 8 months ago

the problem is that the current implementation of maple in pio is very crap and misses some packets, you need to completely rewrite the pio rx module and get rid of state_machine.c advice from an experienced programmer, if you want to do it well, write your code, other people's code always contains errors

mackieks commented 8 months ago

Thanks for the heads up! I'm no longer working on this project, but feel free to open a PR if you want to contribute

megavolt85 commented 8 months ago

I'm currently busy with my project of connecting USB keyboards/mouses to DreamCast. initially I also used this library to process maple, but when I tried to connect a PS3 controller, I encountered the same problems as you, in the end I had to write PIO RX from scratch and change PIO TX so that it would work stably P.S. I use only one core for maple, the second core is used for USB processing, and I do not use DMA for maple transfers

mackieks commented 8 months ago

Sounds like your rewritten Maple Bus core works well. If it's abstracted enough to merge into MaplePad you're welcome to open a PR.