• Login
  • Register
  • Dolphin Forums
  • Home
  • FAQ
  • Download
  • Wiki
  • Code


Dolphin, the GameCube and Wii emulator - Forums › Dolphin Emulator Discussion and Support › Development Discussion v
« Previous 1 ... 17 18 19 20 21 ... 111 Next »

File closes before writes finish (Mac?) – SSBM Stats/Slippi Project
View New Posts | View Today's Posts

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Modes
File closes before writes finish (Mac?) – SSBM Stats/Slippi Project
04-27-2017, 04:14 PM
#1
Fizzi Offline
Junior Member
**
Posts: 6
Threads: 1
Joined: Apr 2017
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/HardwareEnhancedMelee/blob/master/ASM/MatchDataExtraction.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/commit/3dc1a779fa4a9a759585ae06a0073c4ec2eb5a21#diff-287c76d5bc157f9891b04c7147170567R58
Find
Reply
04-27-2017, 07:11 PM
#2
JMC47 Offline
Content Producer
*******
Content Creators (Moderators)
Posts: 6,471
Threads: 28
Joined: Feb 2013
I know Dolphin will delay when it writes to the savefile by some non-trivial amount of time... sometimes seconds? I don't know if that's applicable here, but, that's one potential reason it's not finished writing. Also, it's possible that on mac the file writing isn't properly done and something is going wrong.
Find
Reply
04-29-2017, 08:51 AM
#3
Aleron Ives Offline
Senior Member
****
Posts: 663
Threads: 7
Joined: Apr 2014
Dolphin saves anywhere from immediately to ~10 seconds after the game indicates that it's done saving. I haven't found any particular indicator for how long the delay is going to be each time.
Find
Reply
05-05-2017, 03:55 PM
#4
Fizzi Offline
Junior Member
**
Posts: 6
Threads: 1
Joined: Apr 2017
Hmm I'm not sure any of that is relevant because it's actually a custom gecko code that is triggering ImmWrite and according to the log it's pretty instant. My guess is it's some kind of delay writing to disk or some other weird OS thing. I should see if it happens on windows...
Find
Reply
« Next Oldest | Next Newest »


  • View a Printable Version
  • Subscribe to this thread
Forum Jump:


Users browsing this thread: 1 Guest(s)



Powered By MyBB | Theme by Fragma

Linear Mode
Threaded Mode