mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 20:42:44 +02:00
Fix codestyle for results
This commit is contained in:
parent
6b4b693842
commit
e54bbc54ea
@ -18,43 +18,68 @@
|
||||
#define MAKERESULT(module,description) \
|
||||
((((module)&0x1FF)) | ((description)&0x1FFF)<<9)
|
||||
|
||||
#define MODULE_LIBNX 345
|
||||
enum {
|
||||
Module_Libnx=345,
|
||||
Module_LibnxNvidia=348
|
||||
};
|
||||
|
||||
enum {
|
||||
LIBNX_BADRELOC=1,
|
||||
LIBNX_OUTOFMEM,
|
||||
LIBNX_ALREADYMAPPED,
|
||||
LIBNX_BADGETINFO_STACK,
|
||||
LIBNX_BADGETINFO_HEAP,
|
||||
LIBNX_BADQUERYMEMORY,
|
||||
LIBNX_ALREADYINITIALIZED,
|
||||
LIBNX_NOTINITIALIZED,
|
||||
LIBNX_NOTFOUND,
|
||||
LIBNX_IOERROR,
|
||||
LIBNX_BADINPUT,
|
||||
LIBNX_BADREENT,
|
||||
LIBNX_BUFFERPRODUCER_ERROR,
|
||||
LIBNX_HANDLETOOEARLY,
|
||||
LIBNX_HEAPALLOCFAILED,
|
||||
LIBNX_TOOMANYOVERRIDES,
|
||||
LIBNX_PARCELERROR,
|
||||
LIBNX_BADGFXINIT,
|
||||
LIBNX_BADGFXEVENTWAIT,
|
||||
LIBNX_BADGFXQUEUEBUFFER,
|
||||
LIBNX_BADGFXDEQUEUEBUFFER,
|
||||
LIBNX_APPLETCMDIDNOTFOUND,
|
||||
LIBNX_BADAPPLETRECEIVEMESSAGE,
|
||||
LIBNX_BADAPPLETNOTIFYRUNNING,
|
||||
LIBNX_BADAPPLETGETCURRENTFOCUSSTATE,
|
||||
LIBNX_BADAPPLETGETOPERATIONMODE,
|
||||
LIBNX_BADAPPLETGETPERFORMANCEMODE,
|
||||
LIBNX_BADUSBCOMMSREAD,
|
||||
LIBNX_BADUSBCOMMSWRITE,
|
||||
LIBNX_INITFAIL_SM,
|
||||
LIBNX_INITFAIL_AM,
|
||||
LIBNX_INITFAIL_HID,
|
||||
LIBNX_INITFAIL_FS,
|
||||
LIBNX_BADGETINFO_RNG,
|
||||
LIBNX_JITUNAVAILABLE,
|
||||
LIBNX_WEIRDKERNEL,
|
||||
LibnxError_BadReloc=1,
|
||||
LibnxError_OutOfMemory,
|
||||
LibnxError_AlreadyMapped,
|
||||
LibnxError_BadGetInfo_Stack,
|
||||
LibnxError_BadGetInfo_Heap,
|
||||
LibnxError_BadQueryMemory,
|
||||
LibnxError_AlreadyInitialized,
|
||||
LibnxError_NotInitialized,
|
||||
LibnxError_NotFound,
|
||||
LibnxError_IoError,
|
||||
LibnxError_BadInput,
|
||||
LibnxError_BadReent,
|
||||
LibnxError_BufferProducerError,
|
||||
LibnxError_HandleTooEarly,
|
||||
LibnxError_HeapAllocFailed,
|
||||
LibnxError_TooManyOverrides,
|
||||
LibnxError_ParcelError,
|
||||
LibnxError_BadGfxInit,
|
||||
LibnxError_BadGfxEventWait,
|
||||
LibnxError_BadGfxQueueBuffer,
|
||||
LibnxError_BadGfxDequeueBuffer,
|
||||
LibnxError_AppletCmdidNotFound,
|
||||
LibnxError_BadAppletReceiveMessage,
|
||||
LibnxError_BadAppletNotifyRunning,
|
||||
LibnxError_BadAppletGetCurrentFocusState,
|
||||
LibnxError_BadAppletGetOperationMode,
|
||||
LibnxError_BadAppletGetPerformanceMode,
|
||||
LibnxError_BadUsbCommsRead,
|
||||
LibnxError_BadUsbCommsWrite,
|
||||
LibnxError_InitFail_SM,
|
||||
LibnxError_InitFail_AM,
|
||||
LibnxError_InitFail_HID,
|
||||
LibnxError_InitFail_FS,
|
||||
LibnxError_BadGetInfo_Rng,
|
||||
LibnxError_JitUnavailable,
|
||||
LibnxError_WeirdKernel,
|
||||
};
|
||||
|
||||
enum {
|
||||
LibnxNvidiaError_Unknown=1,
|
||||
LibnxNvidiaError_NotImplemented, // Maps to Nvidia: 1
|
||||
LibnxNvidiaError_NotSupported, // Maps to Nvidia: 2
|
||||
LibnxNvidiaError_NotInitialized, // Maps to Nvidia: 3
|
||||
LibnxNvidiaError_BadParameter, // Maps to Nvidia: 4
|
||||
LibnxNvidiaError_Timeout, // Maps to Nvidia: 5
|
||||
LibnxNvidiaError_InsufficientMemory, // Maps to Nvidia: 6
|
||||
LibnxNvidiaError_ReadOnlyAttribute, // Maps to Nvidia: 7
|
||||
LibnxNvidiaError_InvalidState, // Maps to Nvidia: 8
|
||||
LibnxNvidiaError_InvalidAddress, // Maps to Nvidia: 9
|
||||
LibnxNvidiaError_InvalidSize, // Maps to Nvidia: 10
|
||||
LibnxNvidiaError_BadValue, // Maps to Nvidia: 11
|
||||
LibnxNvidiaError_AlreadyAllocated, // Maps to Nvidia: 13
|
||||
LibnxNvidiaError_Busy, // Maps to Nvidia: 14
|
||||
LibnxNvidiaError_ResourceError, // Maps to Nvidia: 15
|
||||
LibnxNvidiaError_CountMismatch, // Maps to Nvidia: 16
|
||||
LibnxNvidiaError_SharedMemoryTooSmall, // Maps to Nvidia: 0x1000
|
||||
LibnxNvidiaError_FileOperationFailed, // Maps to Nvidia: 0x30003
|
||||
LibnxNvidiaError_IoctlFailed, // Maps to Nvidia: 0x3000F
|
||||
};
|
||||
|
@ -15,8 +15,8 @@ Result binderInitSession(Binder *session, u32 unk0)
|
||||
{
|
||||
Result rc = 0;
|
||||
|
||||
if (!session->created) return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
if (session->initialized) return MAKERESULT(MODULE_LIBNX, LIBNX_ALREADYINITIALIZED);
|
||||
if (!session->created) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
if (session->initialized) return MAKERESULT(Module_Libnx, LibnxError_AlreadyInitialized);
|
||||
|
||||
rc = binderAdjustRefcount(session, 1, 0);
|
||||
|
||||
@ -42,7 +42,7 @@ Result binderInitSession(Binder *session, u32 unk0)
|
||||
if(session->nativeHandle == 0) {
|
||||
rc = binderAdjustRefcount(session, -1, 1);
|
||||
rc = binderAdjustRefcount(session, -1, 0);
|
||||
return MAKERESULT(MODULE_LIBNX, LIBNX_BADINPUT);
|
||||
return MAKERESULT(Module_Libnx, LibnxError_BadInput);
|
||||
}
|
||||
|
||||
session->initialized = 1;
|
||||
@ -88,7 +88,7 @@ static Result _binderTransactParcel(
|
||||
void* parcel_reply, size_t parcel_reply_size,
|
||||
u32 flags)
|
||||
{
|
||||
if (!session->created || !session->initialized) return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
if (!session->created || !session->initialized) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
@ -134,7 +134,7 @@ static Result _binderTransactParcelAuto(
|
||||
void* parcel_reply, size_t parcel_reply_size,
|
||||
u32 flags)
|
||||
{
|
||||
if (!session->created || !session->initialized) return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
if (!session->created || !session->initialized) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
@ -213,7 +213,7 @@ Result binderTransactParcel(
|
||||
|
||||
Result binderAdjustRefcount(Binder *session, s32 addval, s32 type)
|
||||
{
|
||||
if (!session->created) return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
if (!session->created) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
@ -252,7 +252,7 @@ Result binderAdjustRefcount(Binder *session, s32 addval, s32 type)
|
||||
|
||||
Result binderGetNativeHandle(Binder *session, u32 inval, Handle *handle_out)
|
||||
{
|
||||
if (!session->created) return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
if (!session->created) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
|
@ -44,7 +44,7 @@ Result bufferProducerRequestBuffer(s32 bufferIdx, bufferProducerGraphicBuffer *b
|
||||
Parcel parcel, parcel_reply;
|
||||
|
||||
if (g_bufferProducerBinderSession == NULL)
|
||||
return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
parcelInitialize(&parcel);
|
||||
parcelInitialize(&parcel_reply);
|
||||
@ -62,14 +62,14 @@ Result bufferProducerRequestBuffer(s32 bufferIdx, bufferProducerGraphicBuffer *b
|
||||
void* tmp_ptr;
|
||||
|
||||
tmp_ptr = parcelReadFlattenedObject(&parcel_reply, &tmpsize);
|
||||
if (tmp_ptr==NULL || tmpsize!=sizeof(bufferProducerGraphicBuffer)) return MAKERESULT(MODULE_LIBNX, LIBNX_BADINPUT);
|
||||
if (tmp_ptr==NULL || tmpsize!=sizeof(bufferProducerGraphicBuffer)) return MAKERESULT(Module_Libnx, LibnxError_BadInput);
|
||||
if (buf) memcpy(buf, tmp_ptr, sizeof(bufferProducerGraphicBuffer));
|
||||
}
|
||||
|
||||
int status = parcelReadInt32(&parcel_reply);
|
||||
|
||||
if (status != 0) {
|
||||
rc = MAKERESULT(MODULE_LIBNX, LIBNX_BUFFERPRODUCER_ERROR);
|
||||
rc = MAKERESULT(Module_Libnx, LibnxError_BufferProducerError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ Result bufferProducerDequeueBuffer(bool async, u32 width, u32 height, s32 format
|
||||
Parcel parcel, parcel_reply;
|
||||
|
||||
if (g_bufferProducerBinderSession == NULL)
|
||||
return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
parcelInitialize(&parcel);
|
||||
parcelInitialize(&parcel_reply);
|
||||
@ -105,13 +105,13 @@ Result bufferProducerDequeueBuffer(bool async, u32 width, u32 height, s32 format
|
||||
void* tmp_ptr;
|
||||
|
||||
tmp_ptr = parcelReadFlattenedObject(&parcel_reply, &tmpsize);
|
||||
if (tmp_ptr==NULL || tmpsize!=sizeof(bufferProducerFence)) return MAKERESULT(MODULE_LIBNX, LIBNX_BADINPUT);
|
||||
if (tmp_ptr==NULL || tmpsize!=sizeof(bufferProducerFence)) return MAKERESULT(Module_Libnx, LibnxError_BadInput);
|
||||
if (fence) memcpy(fence, tmp_ptr, sizeof(bufferProducerFence));
|
||||
}
|
||||
|
||||
int result = parcelReadInt32(&parcel_reply);
|
||||
if (result != 0)
|
||||
rc = MAKERESULT(MODULE_LIBNX, LIBNX_BUFFERPRODUCER_ERROR);
|
||||
rc = MAKERESULT(Module_Libnx, LibnxError_BufferProducerError);
|
||||
}
|
||||
|
||||
return rc;
|
||||
@ -123,7 +123,7 @@ Result bufferProducerDetachBuffer(s32 slot)
|
||||
Parcel parcel, parcel_reply;
|
||||
|
||||
if (g_bufferProducerBinderSession == NULL)
|
||||
return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
parcelInitialize(&parcel);
|
||||
parcelInitialize(&parcel_reply);
|
||||
@ -146,7 +146,7 @@ Result bufferProducerQueueBuffer(s32 buf, bufferProducerQueueBufferInput *input,
|
||||
Parcel parcel, parcel_reply;
|
||||
|
||||
if (g_bufferProducerBinderSession == NULL)
|
||||
return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
parcelInitialize(&parcel);
|
||||
parcelInitialize(&parcel_reply);
|
||||
@ -158,11 +158,11 @@ Result bufferProducerQueueBuffer(s32 buf, bufferProducerQueueBufferInput *input,
|
||||
rc = parcelTransact(g_bufferProducerBinderSession, QUEUE_BUFFER, &parcel, &parcel_reply);
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
if (parcelReadData(&parcel_reply, output, sizeof(bufferProducerQueueBufferOutput))==NULL) return MAKERESULT(MODULE_LIBNX, LIBNX_BADINPUT);
|
||||
if (parcelReadData(&parcel_reply, output, sizeof(bufferProducerQueueBufferOutput))==NULL) return MAKERESULT(Module_Libnx, LibnxError_BadInput);
|
||||
|
||||
int result = parcelReadInt32(&parcel_reply);
|
||||
if (result != 0)
|
||||
rc = MAKERESULT(MODULE_LIBNX, LIBNX_BUFFERPRODUCER_ERROR);
|
||||
rc = MAKERESULT(Module_Libnx, LibnxError_BufferProducerError);
|
||||
}
|
||||
|
||||
return rc;
|
||||
@ -174,7 +174,7 @@ Result bufferProducerQuery(s32 what, s32* value)
|
||||
Parcel parcel, parcel_reply;
|
||||
|
||||
if (g_bufferProducerBinderSession == NULL)
|
||||
return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
parcelInitialize(&parcel);
|
||||
parcelInitialize(&parcel_reply);
|
||||
@ -189,7 +189,7 @@ Result bufferProducerQuery(s32 what, s32* value)
|
||||
|
||||
int result = parcelReadInt32(&parcel_reply);
|
||||
if (result != 0)
|
||||
rc = MAKERESULT(MODULE_LIBNX, LIBNX_BUFFERPRODUCER_ERROR);
|
||||
rc = MAKERESULT(Module_Libnx, LibnxError_BufferProducerError);
|
||||
}
|
||||
|
||||
return rc;
|
||||
@ -201,7 +201,7 @@ Result bufferProducerConnect(s32 api, bool producerControlledByApp, bufferProduc
|
||||
Parcel parcel, parcel_reply;
|
||||
|
||||
if (g_bufferProducerBinderSession == NULL)
|
||||
return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
parcelInitialize(&parcel);
|
||||
parcelInitialize(&parcel_reply);
|
||||
@ -216,11 +216,11 @@ Result bufferProducerConnect(s32 api, bool producerControlledByApp, bufferProduc
|
||||
rc = parcelTransact(g_bufferProducerBinderSession, CONNECT, &parcel, &parcel_reply);
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
if (parcelReadData(&parcel_reply, output, sizeof(bufferProducerQueueBufferOutput))==NULL) return MAKERESULT(MODULE_LIBNX, LIBNX_BADINPUT);
|
||||
if (parcelReadData(&parcel_reply, output, sizeof(bufferProducerQueueBufferOutput))==NULL) return MAKERESULT(Module_Libnx, LibnxError_BadInput);
|
||||
|
||||
int result = parcelReadInt32(&parcel_reply);
|
||||
if (result != 0)
|
||||
rc = MAKERESULT(MODULE_LIBNX, LIBNX_BUFFERPRODUCER_ERROR);
|
||||
rc = MAKERESULT(Module_Libnx, LibnxError_BufferProducerError);
|
||||
}
|
||||
|
||||
return rc;
|
||||
@ -232,7 +232,7 @@ Result bufferProducerDisconnect(s32 api)
|
||||
Parcel parcel, parcel_reply;
|
||||
|
||||
if (g_bufferProducerBinderSession == NULL)
|
||||
return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
parcelInitialize(&parcel);
|
||||
parcelInitialize(&parcel_reply);
|
||||
@ -255,7 +255,7 @@ Result bufferProducerGraphicBufferInit(s32 buf, bufferProducerGraphicBuffer *inp
|
||||
Parcel parcel, parcel_reply;
|
||||
bool flag = 0;
|
||||
|
||||
if (g_bufferProducerBinderSession==NULL) return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
if (g_bufferProducerBinderSession==NULL) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
parcelInitialize(&parcel);
|
||||
parcelInitialize(&parcel_reply);
|
||||
@ -272,7 +272,7 @@ Result bufferProducerGraphicBufferInit(s32 buf, bufferProducerGraphicBuffer *inp
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
int result = parcelReadInt32(&parcel_reply);
|
||||
if (result != 0)
|
||||
rc = MAKERESULT(MODULE_LIBNX, LIBNX_BUFFERPRODUCER_ERROR);
|
||||
rc = MAKERESULT(Module_Libnx, LibnxError_BufferProducerError);
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
@ -101,8 +101,8 @@ static Result _gfxGetNativeWindowID(u8 *buf, u64 size, s32 *out_ID) {
|
||||
u32 *bufptr = (u32*)buf;
|
||||
|
||||
//Validate ParcelData{Size|Offset}.
|
||||
if((u64)bufptr[1] > size || (u64)bufptr[0] > size || ((u64)bufptr[1])+((u64)bufptr[0]) > size) return MAKERESULT(MODULE_LIBNX, LIBNX_BADINPUT);
|
||||
if(bufptr[0] < 0xc) return MAKERESULT(MODULE_LIBNX, LIBNX_BADINPUT);
|
||||
if((u64)bufptr[1] > size || (u64)bufptr[0] > size || ((u64)bufptr[1])+((u64)bufptr[0]) > size) return MAKERESULT(Module_Libnx, LibnxError_BadInput);
|
||||
if(bufptr[0] < 0xc) return MAKERESULT(Module_Libnx, LibnxError_BadInput);
|
||||
//bufptr = start of ParcelData
|
||||
bufptr = (u32*)&buf[bufptr[1]];
|
||||
|
||||
@ -314,7 +314,7 @@ void gfxInitDefault(void)
|
||||
}
|
||||
|
||||
Result rc = _gfxInit(ViServiceType_Default, "Default", ViLayerFlags_Default, 0, nv_servicetype, 0x300000);
|
||||
if (R_FAILED(rc)) fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_BADGFXINIT));
|
||||
if (R_FAILED(rc)) fatalSimple(MAKERESULT(Module_Libnx, LibnxError_BadGfxInit));
|
||||
}
|
||||
|
||||
void gfxExit(void)
|
||||
@ -367,7 +367,7 @@ void gfxExit(void)
|
||||
}
|
||||
|
||||
void gfxInitResolution(u32 width, u32 height) {
|
||||
if (g_gfxInitialized) fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_ALREADYINITIALIZED));
|
||||
if (g_gfxInitialized) fatalSimple(MAKERESULT(Module_Libnx, LibnxError_AlreadyInitialized));
|
||||
|
||||
g_gfx_framebuf_width = width;
|
||||
g_gfx_framebuf_height = height;
|
||||
@ -463,7 +463,7 @@ static void _waitevent(Handle *handle) {
|
||||
|
||||
} while(R_FAILED(rc) || (rc2 & 0x3FFFFF)==0xFA01);
|
||||
|
||||
if (R_FAILED(rc2)) fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_BADGFXEVENTWAIT));
|
||||
if (R_FAILED(rc2)) fatalSimple(MAKERESULT(Module_Libnx, LibnxError_BadGfxEventWait));
|
||||
}
|
||||
|
||||
void gfxWaitForVsync(void) {
|
||||
@ -475,11 +475,11 @@ void gfxSwapBuffers(void) {
|
||||
|
||||
rc = _gfxQueueBuffer(g_gfxCurrentProducerBuffer);
|
||||
|
||||
if (R_FAILED(rc)) fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_BADGFXQUEUEBUFFER));
|
||||
if (R_FAILED(rc)) fatalSimple(MAKERESULT(Module_Libnx, LibnxError_BadGfxQueueBuffer));
|
||||
|
||||
rc = _gfxDequeueBuffer();
|
||||
|
||||
if (R_FAILED(rc)) fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_BADGFXDEQUEUEBUFFER));
|
||||
if (R_FAILED(rc)) fatalSimple(MAKERESULT(Module_Libnx, LibnxError_BadGfxDequeueBuffer));
|
||||
}
|
||||
|
||||
u8* gfxGetFramebuffer(u32* width, u32* height) {
|
||||
|
@ -17,7 +17,7 @@ Result nvioctlChannel_SubmitGpfifo(u32 fd, nvioctl_gpfifo_entry *entries, u32 nu
|
||||
|
||||
// Make sure stack data doesn't get very large.
|
||||
if(num_entries > 0x200)
|
||||
return MAKERESULT(MODULE_LIBNX, LIBNX_OUTOFMEM);
|
||||
return MAKERESULT(Module_Libnx, LibnxError_OutOfMemory);
|
||||
|
||||
struct {
|
||||
__in u64 gpfifo; // (ignored) pointer to gpfifo entry structs
|
||||
|
@ -59,7 +59,7 @@ Result nvmapobjInitialize(nvmapobj *obj, size_t size) {
|
||||
obj->mem_size = size;
|
||||
|
||||
obj->mem = memalign(0x1000, size);
|
||||
if (obj->mem==NULL) rc = MAKERESULT(MODULE_LIBNX, LIBNX_OUTOFMEM);
|
||||
if (obj->mem==NULL) rc = MAKERESULT(Module_Libnx, LibnxError_OutOfMemory);
|
||||
if (R_SUCCEEDED(rc)) memset(obj->mem, 0, size);
|
||||
|
||||
if (R_SUCCEEDED(rc)) armDCacheFlush(obj->mem, size);
|
||||
@ -154,7 +154,7 @@ Result nvgfxInitialize(void) {
|
||||
if (R_SUCCEEDED(rc)) { //Unknown what size/etc is used officially.
|
||||
g_nvgfx_nvhost_userdata_size = 0x1000;
|
||||
g_nvgfx_nvhost_userdata = memalign(0x1000, g_nvgfx_nvhost_userdata_size);
|
||||
if (g_nvgfx_nvhost_userdata==NULL) rc = MAKERESULT(MODULE_LIBNX, LIBNX_OUTOFMEM);
|
||||
if (g_nvgfx_nvhost_userdata==NULL) rc = MAKERESULT(Module_Libnx, LibnxError_OutOfMemory);
|
||||
if (R_SUCCEEDED(rc)) memset(g_nvgfx_nvhost_userdata, 0, g_nvgfx_nvhost_userdata_size);
|
||||
}
|
||||
|
||||
@ -464,7 +464,7 @@ Result nvgfxSubmitGpfifo(void) {
|
||||
}
|
||||
|
||||
Result nvgfxGetFramebuffer(u8 **buffer, size_t *size) {
|
||||
if(!g_nvgfxInitialized)return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
if(!g_nvgfxInitialized)return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
if(buffer) *buffer = nvmap_objs[6].mem;
|
||||
if(size) *size = nvmap_objs[6].mem_size;
|
||||
|
@ -30,7 +30,7 @@ Result parcelTransact(Binder *session, u32 code, Parcel *in_parcel, Parcel *parc
|
||||
memset(inparcel, 0, sizeof(inparcel));
|
||||
memset(outparcel, 0, outparcel_size);
|
||||
|
||||
if((size_t)payloadSize >= sizeof(inparcel) || (size_t)ParcelObjectsSize >= sizeof(inparcel) || ((size_t)payloadSize)+((size_t)ParcelObjectsSize)+0x10 >= sizeof(inparcel)) return MAKERESULT(MODULE_LIBNX, LIBNX_BADINPUT);
|
||||
if((size_t)payloadSize >= sizeof(inparcel) || (size_t)ParcelObjectsSize >= sizeof(inparcel) || ((size_t)payloadSize)+((size_t)ParcelObjectsSize)+0x10 >= sizeof(inparcel)) return MAKERESULT(Module_Libnx, LibnxError_BadInput);
|
||||
|
||||
inparcel32[0] = payloadSize;//payloadSize
|
||||
inparcel32[1] = 0x10;//payloadOffset
|
||||
@ -43,9 +43,9 @@ Result parcelTransact(Binder *session, u32 code, Parcel *in_parcel, Parcel *parc
|
||||
rc = binderTransactParcel(session, code, inparcel, payloadSize+ParcelObjectsSize+0x10, outparcel, outparcel_size, 0);
|
||||
if (R_FAILED(rc)) return rc;
|
||||
|
||||
if((size_t)outparcel32[1] >= outparcel_size || ((size_t)outparcel32[0])+((size_t)outparcel32[1]) >= outparcel_size) return MAKERESULT(MODULE_LIBNX, LIBNX_BADINPUT);
|
||||
if((size_t)outparcel32[2] >= outparcel_size || ((size_t)outparcel32[2])+((size_t)outparcel32[3]) >= outparcel_size) return MAKERESULT(MODULE_LIBNX, LIBNX_BADINPUT);
|
||||
if((size_t)outparcel32[0] >= outparcel_size || (size_t)outparcel32[3] >= outparcel_size) return MAKERESULT(MODULE_LIBNX, LIBNX_BADINPUT);
|
||||
if((size_t)outparcel32[1] >= outparcel_size || ((size_t)outparcel32[0])+((size_t)outparcel32[1]) >= outparcel_size) return MAKERESULT(Module_Libnx, LibnxError_BadInput);
|
||||
if((size_t)outparcel32[2] >= outparcel_size || ((size_t)outparcel32[2])+((size_t)outparcel32[3]) >= outparcel_size) return MAKERESULT(Module_Libnx, LibnxError_BadInput);
|
||||
if((size_t)outparcel32[0] >= outparcel_size || (size_t)outparcel32[3] >= outparcel_size) return MAKERESULT(Module_Libnx, LibnxError_BadInput);
|
||||
|
||||
memcpy(parcel_reply->payload, &outparcel[outparcel32[1]], outparcel32[0]);
|
||||
parcel_reply->size = outparcel32[0];
|
||||
|
@ -17,7 +17,7 @@ Result jitCreate(Jit* j, size_t size)
|
||||
}
|
||||
else {
|
||||
// Jit is unavailable. :(
|
||||
return MAKERESULT(MODULE_LIBNX, LIBNX_JITUNAVAILABLE);
|
||||
return MAKERESULT(Module_Libnx, LibnxError_JitUnavailable);
|
||||
}
|
||||
|
||||
size = (size + 0xFFF) &~ 0xFFF;
|
||||
@ -25,7 +25,7 @@ Result jitCreate(Jit* j, size_t size)
|
||||
void* src_addr = memalign(size, 0x1000);
|
||||
|
||||
if (src_addr == NULL)
|
||||
return MAKERESULT(MODULE_LIBNX, LIBNX_OUTOFMEM);
|
||||
return MAKERESULT(Module_Libnx, LibnxError_OutOfMemory);
|
||||
|
||||
j->type = type;
|
||||
j->size = size;
|
||||
|
@ -130,7 +130,7 @@ void _randomInit(void)
|
||||
{
|
||||
// Get process TRNG seeds from kernel.
|
||||
if (R_FAILED(svcGetInfo(&seed[i], 11, 0, i)))
|
||||
fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_BADGETINFO_RNG));
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_BadGetInfo_Rng));
|
||||
}
|
||||
|
||||
u8 iv[8];
|
||||
|
@ -42,7 +42,7 @@ Result shmemMap(SharedMemory* s)
|
||||
}
|
||||
}
|
||||
else {
|
||||
rc = LIBNX_ALREADYMAPPED;
|
||||
rc = LibnxError_AlreadyMapped;
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
@ -44,7 +44,7 @@ Result threadCreate(
|
||||
void* stack = memalign(0x1000, stack_sz + reent_sz + tls_sz);
|
||||
|
||||
if (stack == NULL) {
|
||||
rc = MAKERESULT(MODULE_LIBNX, LIBNX_OUTOFMEM);
|
||||
rc = MAKERESULT(Module_Libnx, LibnxError_OutOfMemory);
|
||||
}
|
||||
else {
|
||||
void* stack_mirror = virtmemReserveMap(stack_sz);
|
||||
|
@ -13,7 +13,7 @@ Result tmemCreate(TransferMemory* t, size_t size, Permission perm)
|
||||
t->src_addr = memalign(0x1000, size);
|
||||
|
||||
if (t->src_addr == NULL) {
|
||||
rc = MAKERESULT(MODULE_LIBNX, LIBNX_OUTOFMEM);
|
||||
rc = MAKERESULT(Module_Libnx, LibnxError_OutOfMemory);
|
||||
}
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
@ -50,7 +50,7 @@ Result tmemMap(TransferMemory* t)
|
||||
}
|
||||
}
|
||||
else {
|
||||
rc = LIBNX_ALREADYMAPPED;
|
||||
rc = LibnxError_AlreadyMapped;
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
@ -60,16 +60,16 @@ void virtmemSetup(void) {
|
||||
}
|
||||
else {
|
||||
// Wat.
|
||||
fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_WEIRDKERNEL));
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_WeirdKernel));
|
||||
}
|
||||
}
|
||||
|
||||
if (R_FAILED(_GetRegionFromInfo(&g_Region[REGION_STACK], 2, 3))) {
|
||||
fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_BADGETINFO_STACK));
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_BadGetInfo_Stack));
|
||||
}
|
||||
|
||||
if (R_FAILED(_GetRegionFromInfo(&g_Region[REGION_HEAP], 4, 5))) {
|
||||
fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_BADGETINFO_HEAP));
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_BadGetInfo_Heap));
|
||||
}
|
||||
|
||||
// Failure is OK, happens on 1.0.0
|
||||
@ -101,7 +101,7 @@ void* virtmemReserve(size_t size) {
|
||||
rc = svcQueryMemory(&meminfo, &pageinfo, addr);
|
||||
|
||||
if (R_FAILED(rc)) {
|
||||
fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_BADQUERYMEMORY));
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_BadQueryMemory));
|
||||
}
|
||||
|
||||
if (meminfo.type != 0) {
|
||||
@ -177,7 +177,7 @@ void* virtmemReserveMap(size_t size)
|
||||
rc = svcQueryMemory(&meminfo, &pageinfo, addr);
|
||||
|
||||
if (R_FAILED(rc)) {
|
||||
fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_BADQUERYMEMORY));
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_BadQueryMemory));
|
||||
}
|
||||
|
||||
if (meminfo.type != 0) {
|
||||
|
@ -357,7 +357,7 @@ Result fsdevCommitDevice(const char *name)
|
||||
|
||||
device = fsdevFindDevice(name);
|
||||
if(device==NULL)
|
||||
return MAKERESULT(MODULE_LIBNX, LIBNX_NOTFOUND);
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotFound);
|
||||
|
||||
return fsFsCommit(&device->fs);
|
||||
}
|
||||
|
@ -24,11 +24,11 @@ Result usbCommsInitialize(void)
|
||||
if (R_SUCCEEDED(ret)) {
|
||||
//The buffer for PostBufferAsync commands must be 0x1000-byte aligned.
|
||||
g_usbComms_endpoint_in_buffer = memalign(0x1000, 0x1000);
|
||||
if (g_usbComms_endpoint_in_buffer==NULL) ret = MAKERESULT(MODULE_LIBNX, LIBNX_OUTOFMEM);
|
||||
if (g_usbComms_endpoint_in_buffer==NULL) ret = MAKERESULT(Module_Libnx, LibnxError_OutOfMemory);
|
||||
|
||||
if (R_SUCCEEDED(ret)) {
|
||||
g_usbComms_endpoint_out_buffer = memalign(0x1000, 0x1000);
|
||||
if (g_usbComms_endpoint_out_buffer==NULL) ret = MAKERESULT(MODULE_LIBNX, LIBNX_OUTOFMEM);
|
||||
if (g_usbComms_endpoint_out_buffer==NULL) ret = MAKERESULT(Module_Libnx, LibnxError_OutOfMemory);
|
||||
}
|
||||
|
||||
if (R_SUCCEEDED(ret)) {
|
||||
@ -264,7 +264,7 @@ size_t usbCommsRead(void* buffer, size_t size)
|
||||
if (R_SUCCEEDED(ret2)) {
|
||||
if (state!=5) ret = _usbCommsRead(buffer, size, &transferredSize); //If state changed during transfer, try again. usbDsWaitReady() will be called from this.
|
||||
}
|
||||
if (R_FAILED(ret))fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_BADUSBCOMMSREAD));
|
||||
if (R_FAILED(ret))fatalSimple(MAKERESULT(Module_Libnx, LibnxError_BadUsbCommsRead));
|
||||
}
|
||||
return transferredSize;
|
||||
}
|
||||
@ -280,7 +280,7 @@ size_t usbCommsWrite(const void* buffer, size_t size)
|
||||
if (R_SUCCEEDED(ret2)) {
|
||||
if (state!=5) ret = _usbCommsWrite(buffer, size, &transferredSize); //If state changed during transfer, try again. usbDsWaitReady() will be called from this.
|
||||
}
|
||||
if (R_FAILED(ret))fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_BADUSBCOMMSWRITE));
|
||||
if (R_FAILED(ret))fatalSimple(MAKERESULT(Module_Libnx, LibnxError_BadUsbCommsWrite));
|
||||
}
|
||||
return transferredSize;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ void __nx_dynamic(uintptr_t base, const Elf64_Dyn* dyn)
|
||||
}
|
||||
|
||||
if (rela == NULL)
|
||||
fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_BADRELOC));
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_BadReloc));
|
||||
|
||||
for (; relasz--; rela++)
|
||||
{
|
||||
|
@ -101,7 +101,7 @@ Handle envGetMainThreadHandle(void) {
|
||||
return g_mainThreadHandle;
|
||||
}
|
||||
|
||||
fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_HANDLETOOEARLY));
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_HandleTooEarly));
|
||||
}
|
||||
|
||||
bool envIsNso(void) {
|
||||
@ -147,7 +147,7 @@ LoaderReturnFn envGetExitFuncPtr(void) {
|
||||
Result envSetNextLoad(const char* path, const char* argv)
|
||||
{
|
||||
if (g_nextLoadPath == NULL)
|
||||
return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
strcpy(g_nextLoadPath, path);
|
||||
|
||||
|
@ -49,7 +49,7 @@ void __attribute__((weak)) __libnx_initheap(void)
|
||||
size = __nx_heap_size;
|
||||
|
||||
if (R_FAILED(rc))
|
||||
fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_HEAPALLOCFAILED));
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_HeapAllocFailed));
|
||||
}
|
||||
|
||||
// Newlib
|
||||
@ -67,21 +67,21 @@ void __attribute__((weak)) __appInit(void)
|
||||
// Initialize default services.
|
||||
rc = smInitialize();
|
||||
if (R_FAILED(rc))
|
||||
fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_INITFAIL_SM));
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_InitFail_SM));
|
||||
|
||||
rc = appletInitialize();
|
||||
if (R_FAILED(rc))
|
||||
fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_INITFAIL_AM));
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_InitFail_AM));
|
||||
|
||||
if (__nx_applet_type != AppletType_None) {
|
||||
rc = hidInitialize();
|
||||
if (R_FAILED(rc))
|
||||
fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_INITFAIL_HID));
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_InitFail_HID));
|
||||
}
|
||||
|
||||
rc = fsInitialize();
|
||||
if (R_FAILED(rc))
|
||||
fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_INITFAIL_FS));
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_InitFail_FS));
|
||||
|
||||
//fsdevInit();
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ extern u8 __tls_start[];
|
||||
static struct _reent* __libnx_get_reent(void) {
|
||||
ThreadVars* tv = getThreadVars();
|
||||
if (tv->magic != THREADVARS_MAGIC)
|
||||
fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_BADREENT));
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_BadReent));
|
||||
return tv->reent;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ static Service g_accSrv;
|
||||
Result accountInitialize(void)
|
||||
{
|
||||
if (serviceIsActive(&g_accSrv))
|
||||
return MAKERESULT(MODULE_LIBNX, LIBNX_ALREADYINITIALIZED);
|
||||
return MAKERESULT(Module_Libnx, LibnxError_AlreadyInitialized);
|
||||
|
||||
return smGetService(&g_accSrv, "acc:u1");
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ static Result _apmGetSession(Service* srv, Service* srv_out, u64 cmd_id);
|
||||
Result apmInitialize(void)
|
||||
{
|
||||
if (serviceIsActive(&g_apmSrv))
|
||||
return MAKERESULT(MODULE_LIBNX, LIBNX_ALREADYINITIALIZED);
|
||||
return MAKERESULT(Module_Libnx, LibnxError_AlreadyInitialized);
|
||||
|
||||
Result rc = 0;
|
||||
|
||||
|
@ -57,7 +57,7 @@ static Result _appletSetPerformanceModeChangedNotification(u8 flag);
|
||||
Result appletInitialize(void)
|
||||
{
|
||||
if (serviceIsActive(&g_appletSrv))
|
||||
return MAKERESULT(MODULE_LIBNX, LIBNX_ALREADYINITIALIZED);
|
||||
return MAKERESULT(Module_Libnx, LibnxError_AlreadyInitialized);
|
||||
|
||||
if (__nx_applet_type == AppletType_None)
|
||||
return 0;
|
||||
@ -92,7 +92,7 @@ Result appletInitialize(void)
|
||||
case AppletType_OverlayApplet: cmd_id = 300; break;
|
||||
case AppletType_SystemApplication: cmd_id = 350; break;
|
||||
// TODO: Replace error code
|
||||
default: fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_APPLETCMDIDNOTFOUND));
|
||||
default: fatalSimple(MAKERESULT(Module_Libnx, LibnxError_AppletCmdidNotFound));
|
||||
}
|
||||
|
||||
rc = _appletGetSessionProxy(&g_appletProxySession, cmd_id, CUR_PROCESS_HANDLE, NULL);
|
||||
@ -271,7 +271,7 @@ static Result appletSetFocusHandlingMode(u32 mode) {
|
||||
u8 invals[4];
|
||||
|
||||
if (mode > 3)
|
||||
return MAKERESULT(MODULE_LIBNX, LIBNX_BADINPUT);
|
||||
return MAKERESULT(Module_Libnx, LibnxError_BadInput);
|
||||
|
||||
memset(invals, 0, sizeof(invals));
|
||||
|
||||
@ -465,7 +465,7 @@ static Result _appletAcquireForegroundRights(void) {
|
||||
|
||||
Result appletGetAppletResourceUserId(u64 *out) {
|
||||
if (!serviceIsActive(&g_appletSrv))
|
||||
return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
*out = g_appletResourceUserId;
|
||||
return 0;
|
||||
@ -507,7 +507,7 @@ void appletNotifyRunning(u8 *out) {
|
||||
}
|
||||
}
|
||||
|
||||
if (R_FAILED(rc)) fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_BADAPPLETNOTIFYRUNNING));
|
||||
if (R_FAILED(rc)) fatalSimple(MAKERESULT(Module_Libnx, LibnxError_BadAppletNotifyRunning));
|
||||
}
|
||||
|
||||
static Result _appletReceiveMessage(u32 *out) {
|
||||
@ -851,14 +851,14 @@ bool appletMainLoop(void) {
|
||||
if ((rc & 0x3fffff) == 0x680)
|
||||
return true;
|
||||
|
||||
fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_BADAPPLETRECEIVEMESSAGE));
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_BadAppletReceiveMessage));
|
||||
}
|
||||
|
||||
switch(msg) {
|
||||
case 0xF:
|
||||
rc = _appletGetCurrentFocusState(&g_appletFocusState);
|
||||
if (R_FAILED(rc))
|
||||
fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_BADAPPLETGETCURRENTFOCUSSTATE));
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_BadAppletGetCurrentFocusState));
|
||||
|
||||
appletCallHook(AppletHookType_OnFocusState);
|
||||
break;
|
||||
@ -866,7 +866,7 @@ bool appletMainLoop(void) {
|
||||
case 0x1E:
|
||||
rc = _appletGetOperationMode(&g_appletOperationMode);
|
||||
if (R_FAILED(rc))
|
||||
fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_BADAPPLETGETOPERATIONMODE));
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_BadAppletGetOperationMode));
|
||||
|
||||
appletCallHook(AppletHookType_OnOperationMode);
|
||||
break;
|
||||
@ -874,7 +874,7 @@ bool appletMainLoop(void) {
|
||||
case 0x1F:
|
||||
rc = _appletGetPerformanceMode(&g_appletPerformanceMode);
|
||||
if (R_FAILED(rc))
|
||||
fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_BADAPPLETGETPERFORMANCEMODE));
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_BadAppletGetPerformanceMode));
|
||||
|
||||
appletCallHook(AppletHookType_OnPerformanceMode);
|
||||
break;
|
||||
|
@ -28,7 +28,7 @@ static Result _hidGetSharedMemoryHandle(Service* srv, Handle* handle_out);
|
||||
Result hidInitialize(void)
|
||||
{
|
||||
if (serviceIsActive(&g_hidSrv))
|
||||
return MAKERESULT(MODULE_LIBNX, LIBNX_ALREADYINITIALIZED);
|
||||
return MAKERESULT(Module_Libnx, LibnxError_AlreadyInitialized);
|
||||
|
||||
Result rc;
|
||||
Handle sharedmem_handle;
|
||||
|
@ -10,7 +10,7 @@ static Result _nvInitialize(Handle proc, Handle sharedmem, u32 transfermem_size)
|
||||
static Result _nvSetClientPID(u64 AppletResourceUserId);
|
||||
|
||||
Result nvInitialize(nvServiceType servicetype, size_t transfermem_size) {
|
||||
if(g_nvServiceType!=-1)return MAKERESULT(MODULE_LIBNX, LIBNX_ALREADYINITIALIZED);
|
||||
if(g_nvServiceType!=-1)return MAKERESULT(Module_Libnx, LibnxError_AlreadyInitialized);
|
||||
|
||||
Result rc = 0;
|
||||
u64 AppletResourceUserId = 0;
|
||||
|
@ -15,7 +15,7 @@ static size_t g_smOverridesNum = 0;
|
||||
void smAddOverrideHandle(u64 name, Handle handle)
|
||||
{
|
||||
if (g_smOverridesNum == MAX_OVERRIDES)
|
||||
fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_TOOMANYOVERRIDES));
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_TooManyOverrides));
|
||||
|
||||
size_t i = g_smOverridesNum;
|
||||
|
||||
|
@ -21,7 +21,7 @@ static Result _usbDsGetSession(Service* srv, Service* srv_out, u64 cmd_id, const
|
||||
|
||||
Result usbDsInitialize(UsbComplexId complexId, const usbDsDeviceInfo* deviceinfo) {
|
||||
if (serviceIsActive(&g_usbDsSrv))
|
||||
return MAKERESULT(MODULE_LIBNX, LIBNX_ALREADYINITIALIZED);
|
||||
return MAKERESULT(Module_Libnx, LibnxError_AlreadyInitialized);
|
||||
|
||||
Result rc = 0;
|
||||
|
||||
@ -327,7 +327,7 @@ Result usbDsParseReportData(usbDsReportData *reportdata, u32 urbId, u32 *request
|
||||
if (entry->id == urbId) break;
|
||||
}
|
||||
|
||||
if (pos == count) return MAKERESULT(MODULE_LIBNX, LIBNX_NOTFOUND);
|
||||
if (pos == count) return MAKERESULT(Module_Libnx, LibnxError_NotFound);
|
||||
|
||||
switch(entry->urb_status) {
|
||||
case 0x3:
|
||||
@ -539,7 +539,7 @@ Result usbDsGetDsInterface(UsbDsInterface** interface, struct usb_interface_desc
|
||||
{
|
||||
UsbDsInterface* ptr = _usbDsAllocateInterface();
|
||||
if(ptr == NULL)
|
||||
return MAKERESULT(MODULE_LIBNX, LIBNX_OUTOFMEM);
|
||||
return MAKERESULT(Module_Libnx, LibnxError_OutOfMemory);
|
||||
|
||||
Result rc = _usbDsGetSession(&g_usbDsSrv, &ptr->h, 2, descriptor, sizeof(struct usb_interface_descriptor), interface_name, strlen(interface_name)+1);
|
||||
|
||||
@ -571,10 +571,10 @@ void usbDsInterface_Close(UsbDsInterface* interface)
|
||||
|
||||
Result usbDsInterface_GetDsEndpoint(UsbDsInterface* interface, UsbDsEndpoint** endpoint, struct usb_endpoint_descriptor* descriptor)
|
||||
{
|
||||
if(!interface->initialized)return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
if(!interface->initialized)return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
UsbDsEndpoint* ptr = _usbDsAllocateEndpoint(interface);
|
||||
if(ptr==NULL)return MAKERESULT(MODULE_LIBNX, LIBNX_OUTOFMEM);
|
||||
if(ptr==NULL)return MAKERESULT(Module_Libnx, LibnxError_OutOfMemory);
|
||||
|
||||
Result rc = _usbDsGetSession(&interface->h, &ptr->h, 0, descriptor, sizeof(struct usb_endpoint_descriptor), NULL, 0);
|
||||
|
||||
@ -588,49 +588,49 @@ Result usbDsInterface_GetDsEndpoint(UsbDsInterface* interface, UsbDsEndpoint** e
|
||||
|
||||
Result usbDsInterface_EnableInterface(UsbDsInterface* interface)
|
||||
{
|
||||
if(!interface->initialized)return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
if(!interface->initialized)return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
return _usbDsCmdNoParams(&interface->h, 3);
|
||||
}
|
||||
|
||||
Result usbDsInterface_DisableInterface(UsbDsInterface* interface)
|
||||
{
|
||||
if(!interface->initialized)return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
if(!interface->initialized)return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
return _usbDsCmdNoParams(&interface->h, 4);
|
||||
}
|
||||
|
||||
Result usbDsInterface_CtrlInPostBufferAsync(UsbDsInterface* interface, void* buffer, size_t size, u32 *urbId)
|
||||
{
|
||||
if(!interface->initialized)return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
if(!interface->initialized)return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
return _usbDsPostBuffer(&interface->h, 5, buffer, size, urbId);
|
||||
}
|
||||
|
||||
Result usbDsInterface_CtrlOutPostBufferAsync(UsbDsInterface* interface, void* buffer, size_t size, u32 *urbId)
|
||||
{
|
||||
if(!interface->initialized)return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
if(!interface->initialized)return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
return _usbDsPostBuffer(&interface->h, 6, buffer, size, urbId);
|
||||
}
|
||||
|
||||
Result usbDsInterface_GetCtrlInReportData(UsbDsInterface* interface, usbDsReportData *out)
|
||||
{
|
||||
if(!interface->initialized)return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
if(!interface->initialized)return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
return _usbDsGetReport(&interface->h, 8, out);
|
||||
}
|
||||
|
||||
Result usbDsInterface_GetCtrlOutReportData(UsbDsInterface* interface, usbDsReportData *out)
|
||||
{
|
||||
if(!interface->initialized)return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
if(!interface->initialized)return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
return _usbDsGetReport(&interface->h, 10, out);
|
||||
}
|
||||
|
||||
Result usbDsInterface_StallCtrl(UsbDsInterface* interface)
|
||||
{
|
||||
if(!interface->initialized)return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
if(!interface->initialized)return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
return _usbDsCmdNoParams(&interface->h, 11);
|
||||
}
|
||||
@ -644,21 +644,21 @@ void usbDsEndpoint_Close(UsbDsEndpoint* endpoint)
|
||||
|
||||
Result usbDsEndpoint_PostBufferAsync(UsbDsEndpoint* endpoint, void* buffer, size_t size, u32 *urbId)
|
||||
{
|
||||
if(!endpoint->initialized)return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
if(!endpoint->initialized)return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
return _usbDsPostBuffer(&endpoint->h, 0, buffer, size, urbId);
|
||||
}
|
||||
|
||||
Result usbDsEndpoint_GetReportData(UsbDsEndpoint* endpoint, usbDsReportData *out)
|
||||
{
|
||||
if(!endpoint->initialized)return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
if(!endpoint->initialized)return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
return _usbDsGetReport(&endpoint->h, 3, out);
|
||||
}
|
||||
|
||||
Result usbDsEndpoint_StallCtrl(UsbDsEndpoint* endpoint)
|
||||
{
|
||||
if(!endpoint->initialized)return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
if(!endpoint->initialized)return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
return _usbDsCmdNoParams(&endpoint->h, 4);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ static Result _viGetSessionNoParams(Service* srv, Service* srv_out, u64 cmd_id);
|
||||
Result viInitialize(ViServiceType servicetype)
|
||||
{
|
||||
if (serviceIsActive(&g_viSrv))
|
||||
return MAKERESULT(MODULE_LIBNX, LIBNX_ALREADYINITIALIZED);
|
||||
return MAKERESULT(Module_Libnx, LibnxError_AlreadyInitialized);
|
||||
|
||||
Result rc = 0;
|
||||
|
||||
@ -425,7 +425,7 @@ Result viSetLayerScalingMode(ViLayer *layer, u32 ScalingMode) {
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
|
||||
if (!layer->initialized) return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
if (!layer->initialized) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
struct {
|
||||
u64 magic;
|
||||
|
Loading…
Reference in New Issue
Block a user