GameList: Add played time tracker

This commit is contained in:
Connor McLaughlin
2022-10-21 21:02:19 +10:00
parent 6def728888
commit ca571f8a78
10 changed files with 439 additions and 40 deletions

View File

@ -1914,4 +1914,28 @@ bool FileSystem::SetPathCompression(const char* path, bool enable)
return false;
}
FileSystem::POSIXLock::POSIXLock(int fd)
{
if (lockf(fd, F_LOCK, 0) == 0)
{
m_fd = fd;
}
else
{
Log_ErrorPrintf("lockf() failed: %d", fd);
m_fd = -1;
}
}
FileSystem::POSIXLock::POSIXLock(std::FILE* fp)
{
POSIXLock(fileno(fp));
}
FileSystem::POSIXLock::~POSIXLock()
{
if (m_fd >= 0)
lockf(m_fd, F_ULOCK, m_fd);
}
#endif