project-slippi / Ishiiruka

GNU General Public License v2.0
329 stars 140 forks source link

SlippiReplayComm cannot pick up comm file changes within the same epoch second #420

Open jmlee337 opened 7 months ago

jmlee337 commented 7 months ago

from discord:

following up from ⁠dolphin⁠ I've noticed that maybe the problem is that ishii does not detect a second comm file change if it's too soon after the first. To demonstrate this, here's my launcher stdout, where you can see four comms file changes

12:08:09.611 (dolphin/instance)             > wrote comms file with filePath:
12:08:21.284 (dolphin/instance)             > wrote comms file with filePath:
12:08:21.728 (dolphin/instance)             > wrote comms file with filePath: C:\Users\jmlee337\Documents\Slippi\Spectate\Game_20240312T120821.slp
12:08:51.067 (dolphin/instance)             > wrote comms file with filePath: C:\Users\jmlee337\Documents\Slippi\Spectate\Game_20240312T120851.slp

however, ishii only detects three comm file changes, seeming to miss the third one at 08:21.728

08:13:263 Core\Slippi\SlippiReplayComm.cpp:159 W[EXI]: File change detected in comm file: C:\Users\jmlee337\AppData\Roaming\Electron\temp\slippi-comms-bfbe88b0cd0f190263e30bf5.json
08:21:291 Core\Slippi\SlippiReplayComm.cpp:159 W[EXI]: File change detected in comm file: C:\Users\jmlee337\AppData\Roaming\Electron\temp\slippi-comms-bfbe88b0cd0f190263e30bf5.json
08:51:070 Core\Slippi\SlippiReplayComm.cpp:159 W[EXI]: File change detected in comm file: C:\Users\jmlee337\AppData\Roaming\Electron\temp\slippi-comms-bfbe88b0cd0f190263e30bf5.json
08:52:519 Core\HW\EXI_DeviceSlippi.cpp:1180 W[EXI]: [Frame -123] FFW frame, behind by: 80 frames.

Times are given in seconds since the Epoch. oh https://pubs.opengroup.org/onlinepubs/7908799/xsh/sysstat.h.html so if the file changes on the same second, it won't be detected it seems 🤔 yep this seems to be it. If I delay launchPlaybackDolphin to make sure invocations are at least 1000ms apart, it works

12:54:43.422 (dolphin/instance)             > wrote comms file with filePath:
12:55:12.947 (dolphin/instance)             > wrote comms file with filePath:
12:55:13.960 (dolphin/instance)             > wrote comms file with filePath: C:\Users\jmlee337\Documents\Slippi\Spectate\Game_20240312T125513.slp
54:47:117 Core\Slippi\SlippiReplayComm.cpp:159 W[EXI]: File change detected in comm file: C:\Users\jmlee337\AppData\Roaming\Electron\temp\slippi-comms-88bda1ce88203558b51baafa.json
55:12:953 Core\Slippi\SlippiReplayComm.cpp:159 W[EXI]: File change detected in comm file: C:\Users\jmlee337\AppData\Roaming\Electron\temp\slippi-comms-88bda1ce88203558b51baafa.json
55:13:974 Core\Slippi\SlippiReplayComm.cpp:159 W[EXI]: File change detected in comm file: C:\Users\jmlee337\AppData\Roaming\Electron\temp\slippi-comms-88bda1ce88203558b51baafa.json
55:15:191 Core\HW\EXI_DeviceSlippi.cpp:1180 W[EXI]: [Frame -110] FFW frame, behind by: 581 frames.

https://github.com/project-slippi/Ishiiruka/blob/18ee3450ee1cfde20ada2547c4792dc863dcd075/Source/Core/Core/Slippi/SlippiReplayComm.cpp#L146-L157