rewrote sceKernelLseek , fixed bug in clock_gettime

This commit is contained in:
georgemoralis 2024-04-21 23:07:11 +03:00
parent b04bc932a1
commit 9b0e6c31ca
2 changed files with 8 additions and 7 deletions

View file

@ -73,18 +73,19 @@ s64 PS4_SYSV_ABI sceKernelLseek(int d, s64 offset, int whence) {
auto* file = h->GetFile(d);
file->m_mutex.lock();
Common::FS::SeekOrigin origin;
if (whence == 0) {
origin = Common::FS::SeekOrigin::SetOrigin;
}
if (whence == 1) {
offset = static_cast<int64_t>(file->f.Tell()) + offset;
whence = 0;
origin = Common::FS::SeekOrigin::CurrentPosition;
}
if (whence == 2) {
offset = static_cast<int64_t>(file->f.GetSize()) + offset;
whence = 0;
origin = Common::FS::SeekOrigin::End;
}
file->f.Seek(offset);
file->f.Seek(offset, origin);
auto pos = static_cast<int64_t>(file->f.Tell());
file->m_mutex.unlock();

View file

@ -924,7 +924,7 @@ void pthreadSymbolsRegister(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("mkx2fVhNMsg", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_cond_broadcast);
LIB_FUNCTION("QBi7HCK03hw", "libkernel", 1, "libkernel", 1, 1, sceKernelClockGettime);
LIB_FUNCTION("lLMT9vJAck0", "libkernel", 1, "libkernel", 1, 1, clock_gettime);
LIB_FUNCTION("lLMT9vJAck0", "libScePosix", 1, "libkernel", 1, 1, clock_gettime);
LIB_FUNCTION("yS8U2TGCe1A", "libScePosix", 1, "libkernel", 1, 1, nanosleep);
// openorbis weird functions