Line 1:
Line 1:
nsysccr is Nintendo System CCR which interfaces with the IOS-PAD part of IOSU through various /dev nodes. See the [[IOSU#IOS-PAD|IOSU]] wiki page for a list.
nsysccr is Nintendo System CCR which interfaces with the IOS-PAD part of IOSU through various /dev nodes. See the [[IOSU#IOS-PAD|IOSU]] wiki page for a list.
==Reverse Engineered (Pseudo)Code==
==Reverse Engineered (Pseudo)Code==
+
===CCR - Misc. Gamepad ===
<syntaxhighlight lang="C">
<syntaxhighlight lang="C">
−
void CCREnableFwUpdateMode(void)
+
#define CCR_CDC_Handle 0x10000618
+
#define CCR_IPCBufPool 0x10000620
+
+
#define CCR_ERROR_BASE 0xFFEE0000
+
#define CCR_ERROR_NO_BUFPOOL (CCR_ERROR_BASE + 2)
+
+
int CCR_IPCBufPoolAllocate(void) //020038AC
+
{
+
return IPCBufPoolAllocate(&CCR_IPCBufPool, 0x3A4);
+
}
+
+
void CCR_IPCBufPoolFree(int handle) //020038BC
+
{
+
return IPCBufPoolFree(&CCR_IPCBufPool, handle);
+
}
+
+
int CCREnableDrhCheck(int value) //02002D14
+
{
+
int handle = CCR_IPCBufPoolAllocate();
+
if (!handle)
+
return CCR_ERROR_NO_BUFPOOL;
+
handle[0] = value;
+
handle[0x80/4] = handle;
+
handle[0x84/4] = 4;
+
int ret = IOS_Ioctlv(&CCR_CDC_Handle, 0x385, 1, 0, handle + 0x80);
+
CCR_IPCBufPoolFree(handle);
+
return ret;
+
}
+
+
int CCREnablePowerButton(int value) //02002D9C
+
{
+
int handle = CCR_IPCBufPoolAllocate();
+
if (!handle)
+
return CCR_ERROR_NO_BUFPOOL;
+
handle[0] = value;
+
handle[0x80/4] = handle;
+
handle[0x84/4] = 4;
+
int ret = IOS_Ioctlv(&CCR_CDC_Handle, 0x386, 1, 0, handle + 0x80);
+
CCR_IPCBufPoolFree(handle);
+
return ret;
+
}
+
+
int CCRSetCompatMode(int value) //02002E24
+
{
+
int handle = CCR_IPCBufPoolAllocate();
+
if (!handle)
+
return CCR_ERROR_NO_BUFPOOL;
+
handle[0] = value;
+
handle[0x80/4] = handle;
+
handle[0x84/4] = 4;
+
int ret = IOS_Ioctlv(&CCR_CDC_Handle, 0x387, 1, 0, handle + 0x80);
+
CCR_IPCBufPoolFree(handle);
+
return ret;
+
}
+
+
void CCREnableFwUpdateMode(void) //020038CC
{
{
if(bspWrite("CCRH", 0, "Reset") == 0) //bspWrite in coreinit, interfaces with IOS-BSP
if(bspWrite("CCRH", 0, "Reset") == 0) //bspWrite in coreinit, interfaces with IOS-BSP
Line 12:
Line 68:
}
}
−
void CCRDisableFwUpdateMode(void)
+
void CCRDisableFwUpdateMode(void) //02003970
{
{
if(bspWrite("CCRH", 0, "Reset") == 0) //bspWrite in coreinit, interfaces with IOS-BSP
if(bspWrite("CCRH", 0, "Reset") == 0) //bspWrite in coreinit, interfaces with IOS-BSP
Line 21:
Line 77:
OSSleepTicks((int64_t)3 * (OSGetSystemInfo()->busClockSpeed / 4));
OSSleepTicks((int64_t)3 * (OSGetSystemInfo()->busClockSpeed / 4));
}
}
−
+
</syntaxhighlight>
−
void CCRHIDSetup(void)
+
===CCRHID - Gamepad Human Interface Device API===
+
<syntaxhighlight lang="C">
+
void CCRHIDSetup(void) //02000498
{
{
COSInfo(6, "%s() depricated, no need to call\n", "CCRHIDSetup"); //Typo in binary
COSInfo(6, "%s() depricated, no need to call\n", "CCRHIDSetup"); //Typo in binary
Line 28:
Line 86:
}
}
−
void CCRHIDTeardown(void)
+
void CCRHIDTeardown(void) //020004D4
{
{
COSInfo(6, "%s() depricated, no need to call\n", "CCRHIDTeardown"); //Typo in binary
COSInfo(6, "%s() depricated, no need to call\n", "CCRHIDTeardown"); //Typo in binary