If you happen to follow competitive Melee, you might have seen the Slippi project in action collecting stats from Melee at Summit and Rivalries.
I'm trying to make Melee stats extraction more accessible to the public so I wrote a very simple Slippi emulation for Dolphin. It's made to work with a specific Melee code found here: https://github.com/JLaferri/HardwareEnha...action.asm
The emulation is really quite simple, the device connects to port B, listens to ImmWrites, and writes the bytes received to a file on disk. A new file is created every time a new melee game is started. Anyway, I developed it on OSX and it works except for one slight issue where sometimes the file doesn't seem to finish writing. I thought calling Close would flush everything in the write buffer but it seems like sometimes perhaps the file gets closed before the end of the data is written. The file should always end with the bytes 0x3902 or 0x3900 but sometimes those never get written, as well as some bytes before it.
I've tried various things such as calling .Flush() manually, letting the garbage collector close the file for me (to try to give it more time?), not calling Close() at all... etc. I can't seem to reliably 100% of the time make sure the file finishes writing. Wondering if anyone can help me out. I haven't tried compiling the code on Windows and seeing if the issue exists there too... haven't had access to a Windows machine recently.
Here is the relevant code changes:
https://github.com/JLaferri/dolphin/comm...7170567R58
I'm trying to make Melee stats extraction more accessible to the public so I wrote a very simple Slippi emulation for Dolphin. It's made to work with a specific Melee code found here: https://github.com/JLaferri/HardwareEnha...action.asm
The emulation is really quite simple, the device connects to port B, listens to ImmWrites, and writes the bytes received to a file on disk. A new file is created every time a new melee game is started. Anyway, I developed it on OSX and it works except for one slight issue where sometimes the file doesn't seem to finish writing. I thought calling Close would flush everything in the write buffer but it seems like sometimes perhaps the file gets closed before the end of the data is written. The file should always end with the bytes 0x3902 or 0x3900 but sometimes those never get written, as well as some bytes before it.
I've tried various things such as calling .Flush() manually, letting the garbage collector close the file for me (to try to give it more time?), not calling Close() at all... etc. I can't seem to reliably 100% of the time make sure the file finishes writing. Wondering if anyone can help me out. I haven't tried compiling the code on Windows and seeing if the issue exists there too... haven't had access to a Windows machine recently.
Here is the relevant code changes:
https://github.com/JLaferri/dolphin/comm...7170567R58