KerJoe / MPU6050-Cemuhook-gyro

Gyroscope for Cemuhook based on ESP8266 microcontroller and MPU6050 accelerometer and gyroscope IC

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sending bad CRC header for use in Dolphin Emulator

Kanoni-ADOH opened this issue · comments

Hello! Before anything, thanks a lot for this project, I've been testing it for a few days with multiple emulators and so far it's been working wonderfully!

...except with the Dolphin Emulator, this emu doesn't seem to be able to connect to the Arduino DSUServer, using the logs built in the emulator you can see many errors popping up when powering on the Arduino and the Emu starts trying to connect to it

Peek 2022-02-08 21-57

To reproduce it yourself, go to Controllers, under Wii Remotes click on Configure for the Wiimote required
Move into the Motion Input tab, click on Alternate Input Sources, add the IP and port of the Arduino, save & exit

Peek 2022-02-08 22-15

Then enable logging on Dolphin, go to View, and check both View Log and View Log Configuration
On Log Configuration, change "Verbosity" to "Info", and check the "Controller Interface (CI)" logs

Peek 2022-02-08 22-14

Then power the arduino and have a sight of the errors coming!

I have asked on the Dolphin Emu discord server and they told me Dolphin doesn't really make anything different for the client side of things compared to plain cemuhook, so this is a bit strange
I tried looking into both the code of the Arduino Server and the Dolphin DSUClient by myself but I don't know much of anything about coding really, so I hope you'll be able to fix it! ^-^

I've updated the code. It's seems to work mostly fine, though the bad CRC messages may still crop up.
The problem seems to be that the Dolphin anticipates the info packet response to come immediately after the request, so if the data response arrives before the info response does, the Dolphin will still treat it as info and fail to correctly calculate CRC.

Much thanks! I have tested it now and it works mostly fine as you said!
It seems the MPU gyro data starts freezing/stuttering after a few minutes, but I'll blame that on Dolphin, as no other emulator has this problem, oh well! Thanks a lot again ^-^

I'll close the issue now :)