Add necessary ac functions for rosalina's wifi connection forcing feature

This commit is contained in:
LiquidFenrir 2019-07-21 18:04:02 +02:00
parent 0da86433ee
commit 4218915eb9
2 changed files with 70 additions and 0 deletions

View File

@ -90,3 +90,23 @@ Result ACU_GetLastErrorCode(u32* errorCode);
* @param errorCode Pointer to output the error code to. * @param errorCode Pointer to output the error code to.
*/ */
Result ACU_GetLastDetailErrorCode(u32* errorCode); Result ACU_GetLastDetailErrorCode(u32* errorCode);
/**
* @brief Prepares a buffer to hold the configuration data to start a connection.
* @param config Pointer to a buffer of size at least 0x200 to contain the data.
*/
Result ACU_CreateDefaultConfig(u8* config);
/**
* @brief Sets the slot to use when connecting.
* @param config Pointer to a buffer of size at least 0x200 used with ACU_CreateDefaultConfig previously.
* @param type Allowed slots flag. 1 for slot 1, 2 for slot 2, 4 for slot 3.
*/
Result ACU_SetAllowApType(u8* config, u8 type);
/**
* @brief Starts the connection procedure.
* @param config Pointer to a buffer of size at least 0x200 used with ACU_CreateDefaultConfig previously.
* @param connectionHandle Handle created with svcCreateEvent to wait on until the connection succeeds or fails.
*/
Result ACU_ConnectAsync(u8* config, Handle connectionHandle);

View File

@ -197,3 +197,53 @@ Result ACU_GetLastDetailErrorCode(u32* errorCode)
return (Result)cmdbuf[1]; return (Result)cmdbuf[1];
} }
Result ACU_CreateDefaultConfig(u8* config)
{
Result ret=0;
u32 *cmdbuf = getThreadCommandBuffer();
u32 *staticbufs = getThreadStaticBuffers();
cmdbuf[0] = IPC_MakeHeader(0x1,0,0); // 0x10000
staticbufs[0] = IPC_Desc_StaticBuffer(0x200, 0);
staticbufs[1] = (u32)config;
if(R_FAILED(ret = svcSendSyncRequest(acHandle))) return ret;
return (Result)cmdbuf[1];
}
Result ACU_SetAllowApType(u8* config, u8 type)
{
Result ret=0;
u32 *cmdbuf = getThreadCommandBuffer();
u32 *staticbufs = getThreadStaticBuffers();
cmdbuf[0] = IPC_MakeHeader(0x22,1,2); // 0x220042
cmdbuf[1] = type;
cmdbuf[2] = IPC_Desc_StaticBuffer(0x200, 0);
cmdbuf[3] = (u32)config;
staticbufs[0] = IPC_Desc_StaticBuffer(0x200, 0);
staticbufs[1] = (u32)config;
if(R_FAILED(ret = svcSendSyncRequest(acHandle))) return ret;
return (Result)cmdbuf[1];
}
Result ACU_ConnectAsync(u8* config, Handle connectionHandle)
{
Result ret=0;
u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x4,0,6); // 0x40006
cmdbuf[1] = 0x20;
cmdbuf[3] = 0;
cmdbuf[4] = connectionHandle;
cmdbuf[5] = IPC_Desc_StaticBuffer(0x200, 1);
cmdbuf[6] = (u32)config;
if(R_FAILED(ret = svcSendSyncRequest(acHandle))) return ret;
return (Result)cmdbuf[1];
}