everyone.dance
everyone.dance copied to clipboard
[WIP] Optimize SongData file writes by keeping file handle open
This is a WIP that needs fixing before it can be safely merged.
The goal of this PR is to reduce time spent opening/closing file handles during gameplay by reusing the same open filehandle when updating the song data file. It contains the following changes:
- Update everyone.dance.lua to keep a persistent file handle open for the song data file.
- Update writing song data to seek to the beginning of the file first before writing, and write extra newlines at the end of the file.
- Update the electron client to stop parsing the song data file after the first blank line encountered to prevent accidentally reading partially-overwritten data from previous writes.
WIP:
- [ ] Getting failures when I get to the song wheel in SM5/SL5.0.1 that the file isn't properly opened. I assume I'm getting the control flow a bit incorrect.
- [ ] Haven't set up testing with the electron client yet, not sure if there are any gotchas on the client side.
Current lua failure on load:
00:17.101: WARNING: Error playing command:/Themes/Simply Love (For E.D Testing)/BGAnimations/everyone.dance.lua:31: File '/Users/bkirz/Library/Prefer
ences/StepMania 5.1/everyone.dance.txt' is not open for reading.
00:17.101: WARNING: [C]: Seek( = (null))