mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
results: use R_VALUE for comparisons
This commit is contained in:
parent
c95b46c053
commit
e5ae43f4c2
@ -224,7 +224,7 @@ Result nwindowDequeueBuffer(NWindow* nw, s32* out_slot, NvMultiFence* out_fence)
|
||||
do {
|
||||
eventWait(&nw->event, UINT64_MAX);
|
||||
rc = bqDequeueBuffer(&nw->bq, true, nw->width, nw->height, nw->format, nw->usage, &slot, &fence);
|
||||
} while (rc == MAKERESULT(Module_LibnxBinder, LibnxBinderError_WouldBlock));
|
||||
} while (R_VALUE(rc) == MAKERESULT(Module_LibnxBinder, LibnxBinderError_WouldBlock));
|
||||
}
|
||||
else
|
||||
rc = bqDequeueBuffer(&nw->bq, false, nw->width, nw->height, nw->format, nw->usage, &slot, &fence);
|
||||
|
@ -11,7 +11,7 @@ Result condvarWaitTimeout(CondVar* c, Mutex* m, u64 timeout) {
|
||||
rc = svcWaitProcessWideKeyAtomic((u32*)m, c, getThreadVars()->handle, timeout);
|
||||
|
||||
// On timeout, we need to acquire it manually.
|
||||
if (rc == 0xEA01)
|
||||
if (R_VALUE(rc) == 0xEA01)
|
||||
mutexLock(m);
|
||||
|
||||
return rc;
|
||||
|
@ -176,13 +176,13 @@ void virtmemSetup(void) {
|
||||
// Forgive me.
|
||||
g_IsLegacyKernel = true;
|
||||
rc = svcUnmapMemory((void*)0xFFFFFFFFFFFFE000UL, (void*)0xFFFFFE000UL, 0x1000);
|
||||
if (rc == KERNELRESULT(InvalidMemoryState)) {
|
||||
if (R_VALUE(rc) == KERNELRESULT(InvalidMemoryState)) {
|
||||
// Invalid src-address error means that a valid 36-bit address was rejected.
|
||||
// Thus we are 32-bit.
|
||||
_memregionInitHardcoded(&g_AslrRegion, 0x200000ull, 0x100000000ull);
|
||||
_memregionInitHardcoded(&g_StackRegion, 0x200000ull, 0x40000000ull);
|
||||
}
|
||||
else if (rc == KERNELRESULT(InvalidMemoryRange)) {
|
||||
else if (R_VALUE(rc) == KERNELRESULT(InvalidMemoryRange)) {
|
||||
// Invalid dst-address error means our 36-bit src-address was valid.
|
||||
// Thus we are 36-bit.
|
||||
_memregionInitHardcoded(&g_AslrRegion, 0x8000000ull, 0x1000000000ull);
|
||||
|
@ -88,7 +88,7 @@ static Result _nvFenceEventWaitCommon(Event* event, u32 event_id, s32 timeout_us
|
||||
if (timeout_us >= 0)
|
||||
timeout_ns = (u64)1000*timeout_us;
|
||||
Result rc = eventWait(event, timeout_ns);
|
||||
if ((rc & 0x3FFFFF) == 0xEA01) { // timeout
|
||||
if (R_VALUE(rc) == 0xEA01) { // timeout
|
||||
nvioctlNvhostCtrl_EventSignal(g_ctrl_fd, event_id);
|
||||
rc = MAKERESULT(Module_LibnxNvidia, LibnxNvidiaError_Timeout);
|
||||
}
|
||||
@ -103,7 +103,7 @@ static Result _nvFenceWait_200(NvFence* f, s32 timeout_us)
|
||||
Event* event = _nvGetEvent(event_id);
|
||||
if (event) {
|
||||
rc = nvioctlNvhostCtrl_EventWaitAsync(g_ctrl_fd, f->id, f->value, timeout_us, event_id);
|
||||
if (rc == MAKERESULT(Module_LibnxNvidia, LibnxNvidiaError_Timeout))
|
||||
if (R_VALUE(rc) == MAKERESULT(Module_LibnxNvidia, LibnxNvidiaError_Timeout))
|
||||
rc = _nvFenceEventWaitCommon(event, 0x10000000 | event_id, timeout_us);
|
||||
}
|
||||
_nvFreeEventSlot(event_id);
|
||||
@ -115,7 +115,7 @@ static Result _nvFenceWait_100(NvFence* f, s32 timeout_us)
|
||||
{
|
||||
u32 event_id;
|
||||
Result rc = nvioctlNvhostCtrl_EventWait(g_ctrl_fd, f->id, f->value, timeout_us, 0, &event_id);
|
||||
if (rc == MAKERESULT(Module_LibnxNvidia, LibnxNvidiaError_Timeout) && timeout_us) {
|
||||
if (R_VALUE(rc) == MAKERESULT(Module_LibnxNvidia, LibnxNvidiaError_Timeout) && timeout_us) {
|
||||
Event event;
|
||||
rc = nvQueryEvent(g_ctrl_fd, event_id, &event);
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
|
@ -802,7 +802,7 @@ fsdev_write(struct _reent *r,
|
||||
}
|
||||
|
||||
rc = fsFileWrite(&file->fd, file->offset, ptr, len, FsWriteOption_None);
|
||||
if(rc == 0xD401)
|
||||
if(R_VALUE(rc) == 0xD401)
|
||||
return fsdev_write_safe(r, fd, ptr, len);
|
||||
if(R_FAILED(rc))
|
||||
{
|
||||
@ -911,7 +911,7 @@ fsdev_read(struct _reent *r,
|
||||
|
||||
/* read the data */
|
||||
rc = fsFileRead(&file->fd, file->offset, ptr, len, FsReadOption_None, &bytes);
|
||||
if(rc == 0xD401)
|
||||
if(R_VALUE(rc) == 0xD401)
|
||||
return fsdev_read_safe(r, fd, ptr, len);
|
||||
if(R_SUCCEEDED(rc))
|
||||
{
|
||||
@ -1707,7 +1707,7 @@ fsdev_getmtime(const char *name,
|
||||
if(fs_path.data == NULL)
|
||||
return -1;*/
|
||||
|
||||
/*if(rc == 0)
|
||||
/*if(R_SUCCEEDED(rc))
|
||||
{*/
|
||||
/* convert from milliseconds to seconds */
|
||||
//*mtime /= 1000;
|
||||
|
@ -113,7 +113,7 @@ static ssize_t _romfs_read(romfs_mount *mount, u64 offset, void* buffer, u64 siz
|
||||
rc = fsStorageRead(&mount->fd_storage, pos, buffer, size);
|
||||
read = size;
|
||||
}
|
||||
if (rc == 0xD401) return _romfs_read_safe(mount, pos, buffer, size);
|
||||
if (R_VALUE(rc) == 0xD401) return _romfs_read_safe(mount, pos, buffer, size);
|
||||
if (R_FAILED(rc)) return -1;
|
||||
return read;
|
||||
}
|
||||
|
@ -175,11 +175,11 @@ Result _appletInitialize(void) {
|
||||
else
|
||||
rc = _appletOpenLibraryAppletProxy(&g_appletProxySession, CUR_PROCESS_HANDLE, attr);
|
||||
|
||||
if (rc == AM_BUSY_ERROR) {
|
||||
if (R_VALUE(rc) == AM_BUSY_ERROR) {
|
||||
svcSleepThread(10000000);
|
||||
}
|
||||
|
||||
} while (rc == AM_BUSY_ERROR);
|
||||
} while (R_VALUE(rc) == AM_BUSY_ERROR);
|
||||
}
|
||||
|
||||
// [7.0.0+] GetAppletCommonFunctions
|
||||
|
@ -68,7 +68,7 @@ static Result _grcCreateGameMovieTrimmer(GrcGameMovieTrimmer *t, size_t size) {
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
rc = appletCreateGameMovieTrimmer(&t->s, &t->tmem);
|
||||
|
||||
while(rc == retryrc) {
|
||||
while(R_VALUE(rc) == retryrc) {
|
||||
svcSleepThread(100000000);
|
||||
rc = appletCreateGameMovieTrimmer(&t->s, &t->tmem);
|
||||
}
|
||||
@ -184,7 +184,7 @@ Result grcCreateMovieMaker(GrcMovieMaker *m, size_t size) {
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
rc = appletCreateMovieMaker(&m->a, &m->tmem);
|
||||
|
||||
while(rc == retryrc) {
|
||||
while(R_VALUE(rc) == retryrc) {
|
||||
svcSleepThread(100000000);
|
||||
rc = appletCreateMovieMaker(&m->a, &m->tmem);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ Result _smInitialize(void) {
|
||||
}
|
||||
|
||||
Handle tmp;
|
||||
if (R_SUCCEEDED(rc) && smGetServiceOriginal(&tmp, (SmServiceName){}) == 0x415) {
|
||||
if (R_SUCCEEDED(rc) && R_VALUE(smGetServiceOriginal(&tmp, (SmServiceName){})) == 0x415) {
|
||||
u64 pid_placeholder = 0;
|
||||
rc = serviceDispatchIn(&g_smSrv, 0, pid_placeholder, .in_send_pid = true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user