Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jmlee337 opened this issue Mar 29, 2024 · 0 comments

Comments

@jmlee337
Copy link
Contributor

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.

void SlippiReplayComm::loadFile()
{
// TODO: Consider even only checking file mod time every 250 ms or something? Not sure
// TODO: what the perf impact is atm
u64 modTime = File::GetFileModTime(configFilePath);
if (modTime != 0 && modTime == configLastLoadModTime)
{
// TODO: Maybe be smarter than just using mod time? Look for other things that would
// TODO: indicate that file has changed and needs to be reloaded?
return;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant