Merge branch 'master' into gpu_revamp
This commit is contained in:
commit
0eed263bba
@ -13,6 +13,7 @@ extern "C" {
|
||||
#include <3ds/os.h>
|
||||
#include <3ds/gfx.h>
|
||||
#include <3ds/console.h>
|
||||
#include <3ds/util/utf.h>
|
||||
|
||||
#include <3ds/services/ac.h>
|
||||
#include <3ds/services/am.h>
|
||||
|
@ -4,6 +4,16 @@
|
||||
Requires access to "am:net" or "am:u" service
|
||||
*/
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u64 titleID;
|
||||
u64 unknown;
|
||||
u16 titleVersion;
|
||||
u8 unknown2[6];
|
||||
} TitleList;
|
||||
|
||||
|
||||
Result amInit();
|
||||
Result amExit();
|
||||
|
||||
@ -20,16 +30,26 @@ About: Writes a titleid list for a mediatype to a buffer
|
||||
|
||||
mediatype mediatype to get list from
|
||||
count number of titleids to get
|
||||
buffer buffer to write titleids to
|
||||
titleIDs buffer to write titleids to
|
||||
*/
|
||||
Result AM_GetTitleList(u8 mediatype, u32 count, void *buffer);
|
||||
Result AM_GetTitleIdList(u8 mediatype, u32 count, u64 *titleIDs);
|
||||
|
||||
/* AM_GetDeviceId()
|
||||
About: Gets a 32bit device id, it's used for some key slot inits
|
||||
|
||||
device_id ptr to where the device id is written to
|
||||
*/
|
||||
Result AM_GetDeviceId(u32 *deviceid);
|
||||
Result AM_GetDeviceId(u32 *deviceID);
|
||||
|
||||
/* AM_ListTitles()
|
||||
About: Get a list with details about the installed titles
|
||||
|
||||
mediatype mediatype of title
|
||||
titleCount number of titles to list
|
||||
titleIdList pointer to a title ID list
|
||||
titleList pointer for the output TitleList array
|
||||
*/
|
||||
Result AM_ListTitles(u8 mediatype, u32 titleCount, u64 *titleIdList, TitleList *titleList);
|
||||
|
||||
/**** Title Install Methods ****/
|
||||
/* AM_StartCiaInstall()
|
||||
@ -38,7 +58,7 @@ About: Inits CIA install process, the returned ciahandle is where the data for C
|
||||
mediatype mediatype to install CIA to
|
||||
ciahandle ptr to where the handle should be written to
|
||||
*/
|
||||
Result AM_StartCiaInstall(u8 mediatype, Handle *ciahandle);
|
||||
Result AM_StartCiaInstall(u8 mediatype, Handle *ciaHandle);
|
||||
|
||||
/* AM_StartDlpChildCiaInstall()
|
||||
About: Inits CIA install process, the returned ciahandle is where the data for CIA should be written to
|
||||
@ -46,14 +66,14 @@ Note: This is for installing DLP CIAs only, mediatype is hardcoded to be NAND
|
||||
|
||||
ciahandle ptr to where the handle should be written to
|
||||
*/
|
||||
Result AM_StartDlpChildCiaInstall(Handle *ciahandle);
|
||||
Result AM_StartDlpChildCiaInstall(Handle *ciaHandle);
|
||||
|
||||
/* AM_CancelCIAInstall()
|
||||
About: Abort CIA install process
|
||||
|
||||
ciahandle ptr to cia Handle provided by AM
|
||||
*/
|
||||
Result AM_CancelCIAInstall(Handle *ciahandle);
|
||||
Result AM_CancelCIAInstall(Handle *ciaHandle);
|
||||
|
||||
/* AM_FinishCiaInstall()
|
||||
About: Once all data is written to the cia handle, this command signals AM to proceed with CIA install.
|
||||
@ -62,7 +82,7 @@ Note: AM closes the cia handle provided here
|
||||
mediatype same mediatype specified ciahandle was obtained
|
||||
ciahandle ptr to cia Handle provided by AM
|
||||
*/
|
||||
Result AM_FinishCiaInstall(u8 mediatype, Handle *ciahandle);
|
||||
Result AM_FinishCiaInstall(u8 mediatype, Handle *ciaHandle);
|
||||
|
||||
/**** Title Delete Methods ****/
|
||||
/* AM_DeleteTitle()
|
||||
@ -72,7 +92,7 @@ Note: AM closes the cia handle provided here
|
||||
mediatype mediatype of title
|
||||
titleid title id of title
|
||||
*/
|
||||
Result AM_DeleteTitle(u8 mediatype, u64 titleid);
|
||||
Result AM_DeleteTitle(u8 mediatype, u64 titleID);
|
||||
|
||||
/* AM_DeleteAppTitle()
|
||||
About: Deletes any title on NAND/SDMC
|
||||
@ -81,16 +101,15 @@ Note: If the title has the system category bit set, this will fail
|
||||
mediatype mediatype of title
|
||||
titleid title id of title
|
||||
*/
|
||||
Result AM_DeleteAppTitle(u8 mediatype, u64 titleid);
|
||||
Result AM_DeleteAppTitle(u8 mediatype, u64 titleID);
|
||||
|
||||
/* AM_InstallFIRM()
|
||||
About: Installs FIRM to NAND (firm0:/ & firm1:/) from a CXI
|
||||
Note: The title must have the uniqueid: 0x00000, otherwise this will fail.
|
||||
|
||||
mediatype mediatype of title
|
||||
titleid title id of title
|
||||
*/
|
||||
Result AM_InstallFIRM(u8 mediatype, u64 titleid);
|
||||
Result AM_InstallFIRM(u64 titleID);
|
||||
|
||||
/* AM_GetTitleProductCode()
|
||||
About: Gets the product code of a title based on its title id.
|
||||
@ -99,5 +118,4 @@ About: Gets the product code of a title based on its title id.
|
||||
titleid title id of title
|
||||
productcode buffer to output the product code to (should have a length of 16)
|
||||
*/
|
||||
Result AM_GetTitleProductCode(u8 mediatype, u64 titleid, char* productcode);
|
||||
|
||||
Result AM_GetTitleProductCode(u8 mediatype, u64 titleID, char* productCode);
|
||||
|
@ -97,3 +97,4 @@ Result svcReadProcessMemory(void* buffer, Handle debug, u32 addr, u32 size);
|
||||
Result svcMapProcessMemory(Handle process, u32 startAddr, u32 endAddr);
|
||||
Result svcUnmapProcessMemory(Handle process, u32 startAddr, u32 endAddr);
|
||||
Result svcQueryProcessMemory(MemInfo* info, PageInfo* out, Handle process, u32 addr);
|
||||
s32 svcGetProcessorID();
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <3ds/types.h>
|
||||
#include <3ds/svc.h>
|
||||
@ -35,7 +36,7 @@ Result AM_GetTitleCount(u8 mediatype, u32 *count)
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result AM_GetTitleList(u8 mediatype, u32 count, void *buffer)
|
||||
Result AM_GetTitleIdList(u8 mediatype, u32 count, u64 *titleIDs)
|
||||
{
|
||||
Result ret = 0;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
@ -44,14 +45,32 @@ Result AM_GetTitleList(u8 mediatype, u32 count, void *buffer)
|
||||
cmdbuf[1] = count;
|
||||
cmdbuf[2] = mediatype;
|
||||
cmdbuf[3] = ((count*8) << 4) | 12;
|
||||
cmdbuf[4] = (u32)buffer;
|
||||
cmdbuf[4] = (u32)titleIDs;
|
||||
|
||||
if((ret = svcSendSyncRequest(amHandle))!=0) return ret;
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result AM_GetDeviceId(u32 *deviceid)
|
||||
Result AM_ListTitles(u8 mediatype, u32 titleCount, u64 *titleIdList, TitleList *titleList)
|
||||
{
|
||||
Result ret = 0;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
|
||||
cmdbuf[0] = 0x00030084;
|
||||
cmdbuf[1] = mediatype;
|
||||
cmdbuf[2] = titleCount;
|
||||
cmdbuf[3] = ((titleCount*8)<<4) | 10;
|
||||
cmdbuf[4] = (u32)titleIdList;
|
||||
cmdbuf[5] = ((sizeof(TitleList)*titleCount)<<4) | 12;
|
||||
cmdbuf[6] = (u32)titleList;
|
||||
|
||||
if((ret = svcSendSyncRequest(amHandle))!=0) return ret;
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result AM_GetDeviceId(u32 *deviceID)
|
||||
{
|
||||
Result ret = 0;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
@ -60,12 +79,12 @@ Result AM_GetDeviceId(u32 *deviceid)
|
||||
|
||||
if((ret = svcSendSyncRequest(amHandle))!=0) return ret;
|
||||
|
||||
*deviceid = cmdbuf[3];
|
||||
*deviceID = cmdbuf[3];
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result AM_StartCiaInstall(u8 mediatype, Handle *ciahandle)
|
||||
Result AM_StartCiaInstall(u8 mediatype, Handle *ciaHandle)
|
||||
{
|
||||
Result ret = 0;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
@ -75,12 +94,12 @@ Result AM_StartCiaInstall(u8 mediatype, Handle *ciahandle)
|
||||
|
||||
if((ret = svcSendSyncRequest(amHandle))!=0) return ret;
|
||||
|
||||
*ciahandle = cmdbuf[3];
|
||||
*ciaHandle = cmdbuf[3];
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result AM_StartDlpChildCiaInstall(Handle *ciahandle)
|
||||
Result AM_StartDlpChildCiaInstall(Handle *ciaHandle)
|
||||
{
|
||||
Result ret = 0;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
@ -89,96 +108,97 @@ Result AM_StartDlpChildCiaInstall(Handle *ciahandle)
|
||||
|
||||
if((ret = svcSendSyncRequest(amHandle))!=0) return ret;
|
||||
|
||||
*ciahandle = cmdbuf[3];
|
||||
*ciaHandle = cmdbuf[3];
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result AM_CancelCIAInstall(Handle *ciahandle)
|
||||
Result AM_CancelCIAInstall(Handle *ciaHandle)
|
||||
{
|
||||
Result ret = 0;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
|
||||
cmdbuf[0] = 0x04040002;
|
||||
cmdbuf[1] = 0x10;
|
||||
cmdbuf[2] = *ciahandle;
|
||||
cmdbuf[2] = *ciaHandle;
|
||||
|
||||
if((ret = svcSendSyncRequest(amHandle))!=0) return ret;
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result AM_FinishCiaInstall(u8 mediatype, Handle *ciahandle)
|
||||
Result AM_FinishCiaInstall(u8 mediatype, Handle *ciaHandle)
|
||||
{
|
||||
Result ret = 0;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
|
||||
cmdbuf[0] = 0x04050002;
|
||||
cmdbuf[1] = 0x10;
|
||||
cmdbuf[2] = *ciahandle;
|
||||
cmdbuf[2] = *ciaHandle;
|
||||
|
||||
if((ret = svcSendSyncRequest(amHandle))!=0) return ret;
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result AM_DeleteTitle(u8 mediatype, u64 titleid)
|
||||
Result AM_DeleteTitle(u8 mediatype, u64 titleID)
|
||||
{
|
||||
Result ret = 0;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
|
||||
cmdbuf[0] = 0x041000C0;
|
||||
cmdbuf[1] = mediatype;
|
||||
cmdbuf[2] = titleid & 0xffffffff;
|
||||
cmdbuf[3] = (titleid >> 32) & 0xffffffff;
|
||||
cmdbuf[2] = titleID & 0xffffffff;
|
||||
cmdbuf[3] = (u32)(titleID >> 32);
|
||||
|
||||
if((ret = svcSendSyncRequest(amHandle))!=0) return ret;
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result AM_DeleteAppTitle(u8 mediatype, u64 titleid)
|
||||
Result AM_DeleteAppTitle(u8 mediatype, u64 titleID)
|
||||
{
|
||||
Result ret = 0;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
|
||||
cmdbuf[0] = 0x000400C0;
|
||||
cmdbuf[1] = mediatype;
|
||||
cmdbuf[2] = titleid & 0xffffffff;
|
||||
cmdbuf[3] = (titleid >> 32) & 0xffffffff;
|
||||
cmdbuf[2] = titleID & 0xffffffff;
|
||||
cmdbuf[3] = (u32)(titleID >> 32);
|
||||
|
||||
if((ret = svcSendSyncRequest(amHandle))!=0) return ret;
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result AM_InstallFIRM(u8 mediatype, u64 titleid)
|
||||
Result AM_InstallFIRM(u64 titleID)
|
||||
{
|
||||
Result ret = 0;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
|
||||
cmdbuf[0] = 0x000400C0;
|
||||
cmdbuf[1] = mediatype;
|
||||
cmdbuf[2] = titleid & 0xffffffff;
|
||||
cmdbuf[3] = (titleid >> 32) & 0xffffffff;
|
||||
cmdbuf[0] = 0x04010080;
|
||||
cmdbuf[1] = titleID & 0xffffffff;
|
||||
cmdbuf[2] = (u32)(titleID >> 32);
|
||||
|
||||
if((ret = svcSendSyncRequest(amHandle))!=0) return ret;
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result AM_GetTitleProductCode(u8 mediatype, u64 titleid, char* productcode)
|
||||
Result AM_GetTitleProductCode(u8 mediatype, u64 titleID, char* productCode)
|
||||
{
|
||||
Result ret = 0;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
|
||||
cmdbuf[0] = 0x000500C0;
|
||||
cmdbuf[1] = mediatype;
|
||||
cmdbuf[2] = titleid & 0xffffffff;
|
||||
cmdbuf[3] = (titleid >> 32) & 0xffffffff;
|
||||
cmdbuf[2] = titleID & 0xffffffff;
|
||||
cmdbuf[3] = (u32)(titleID >> 32);
|
||||
|
||||
if((ret = svcSendSyncRequest(amHandle))!=0) return ret;
|
||||
|
||||
snprintf(productcode, 16, "%s", (char*)(&cmdbuf[2]));
|
||||
// The product code string can use the full 16 bytes without NULL terminator
|
||||
if(productCode) snprintf(productCode, 16, "%s", (char*)&cmdbuf[2]);
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
@ -361,3 +361,9 @@ svcQueryProcessMemory:
|
||||
add sp, sp, #8
|
||||
pop {r4-r6}
|
||||
bx lr
|
||||
|
||||
.global svcGetProcessorID
|
||||
.type svcGetProcessorID, %function
|
||||
svcGetProcessorID:
|
||||
svc 0x11
|
||||
bx lr
|
||||
|
Loading…
Reference in New Issue
Block a user