Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #76 from igor725/features
Browse files Browse the repository at this point in the history
Stub sceRazorIsLoaded
  • Loading branch information
SysRay authored Apr 10, 2024
2 parents 1acaf8d + 2875b5a commit 4606192
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 2 deletions.
20 changes: 19 additions & 1 deletion core/timer/timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class Timer: public ITimer {
int getTime(SceKernelClockid id, SceKernelTimespec* tp) final;
int getTimeRes(SceKernelClockid id, SceKernelTimespec* tp) final;
int getTimeofDay(SceKernelTimeval* tp) final;
int getTimeZone(SceKernelTimezone* tz) final;
};

ITimer& accessTimer() {
Expand Down Expand Up @@ -160,4 +161,21 @@ int Timer::getTimeofDay(SceKernelTimeval* tp) {
uint64_t const t = time_point_cast<microseconds>(system_clock::now()).time_since_epoch().count();
micro2timeval(tp, t);
return Ok;
}
}

int Timer::getTimeZone(SceKernelTimezone* tz) {
if (tz == nullptr) return getErr(ErrCode::_EINVAL);
static bool isTZSet = false;

if (!isTZSet) {
_tzset();
isTZSet = true;
}

long tz_secswest;
if (auto err = _get_timezone(&tz_secswest)) return getErr((ErrCode)err);
if (auto err = _get_daylight(&tz->tz_dsttime)) return getErr((ErrCode)err);
tz->tz_minuteswest = int(tz_secswest / 60);

return Ok;
}
8 changes: 7 additions & 1 deletion core/timer/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ class ITimer {
* @return int getErr()
*/
virtual int getTimeofDay(SceKernelTimeval* tp) = 0;

/**
* @brief Get the time zone info
*
*/
virtual int getTimeZone(SceKernelTimezone* tz) = 0;
};

#if defined(__APICALL_EXTERN)
Expand All @@ -105,4 +111,4 @@ class ITimer {
#define __APICALL
#endif
__APICALL ITimer& accessTimer();
#undef __APICALL
#undef __APICALL
4 changes: 4 additions & 0 deletions modules/libSceGraphicsDriver/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,10 @@ bool SYSV_ABI sceGnmIsUserPaEnabled() {
return false;
}

bool SYSV_ABI sceRazorIsLoaded() {
return false;
}

void* SYSV_ABI sceGnmGetTheTessellationFactorRingBufferBaseAddress() {
LOG_USE_MODULE(libSceGraphicsDriver);
LOG_TRACE(L"%S", __FUNCTION__);
Expand Down
4 changes: 4 additions & 0 deletions modules/libkernel/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ EXPORT SYSV_ABI int sceKernelGettimeofday(SceKernelTimeval* tp) {
return accessTimer().getTimeofDay(tp);
}

EXPORT SYSV_ABI int sceKernelGettimezone(SceKernelTimezone* tz) {
return accessTimer().getTimeZone(tz);
}

EXPORT SYSV_ABI int __NID(clock_getres)(SceKernelClockid clockId, SceKernelTimespec* tp) {
return accessTimer().getTimeRes(clockId, tp);
}
Expand Down
5 changes: 5 additions & 0 deletions modules_include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ struct timespec64 {
typedef struct timeval64 SceKernelTimeval;
typedef struct timespec64 SceKernelTimespec;

struct SceKernelTimezone {
int tz_minuteswest;
int tz_dsttime;
};

struct SceRtcTick {
uint64_t tick;
};
Expand Down
5 changes: 5 additions & 0 deletions testRunner/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ fs.readdir(testsDir, (err, files) => {
Promise.all(procs).then((values) => {
values.forEach((ret) => {
fs.readFile(ret[0], 'utf-8', (err, data) => {
if (err !== null) {
console.error('Failed to open %s: %s', ret[0], err);
return;
}

const jdata = JSON.parse(data);
md_fd.write(`## ${jdata.name} (${jdata.time})\n`);
md_fd.write('| Test class | ✅ Passed | ❌ Failed | ⏭️Skipped | ⏳Time |\n');
Expand Down

0 comments on commit 4606192

Please sign in to comment.