Merge branch 'master' of github.com:smealum/ctrulib

This commit is contained in:
Lectem 2015-04-14 22:56:19 +02:00
commit e26e37b942
5 changed files with 63 additions and 43 deletions

View File

@ -103,13 +103,10 @@ Note: If the title has the system category bit set, this will fail
*/ */
Result AM_DeleteAppTitle(u8 mediatype, u64 titleID); Result AM_DeleteAppTitle(u8 mediatype, u64 titleID);
/* AM_InstallFIRM() /* AM_InstallNativeFirm()
About: Installs FIRM to NAND (firm0:/ & firm1:/) from a CXI About: Installs NATIVE_FIRM to NAND (firm0:/ & firm1:/) from a CXI
Note: The title must have the uniqueid: 0x00000, otherwise this will fail.
titleid title id of title
*/ */
Result AM_InstallFIRM(u64 titleID); Result AM_InstallNativeFirm();
/* AM_GetTitleProductCode() /* AM_GetTitleProductCode()
About: Gets the product code of a title based on its title id. About: Gets the product code of a title based on its title id.

View File

@ -11,7 +11,6 @@ typedef enum {
MEMOP_UNMAP=5, // Mirror unmapping MEMOP_UNMAP=5, // Mirror unmapping
MEMOP_PROT =6, // Change protection MEMOP_PROT =6, // Change protection
MEMOP_FREE_LINEAR =0x10001, // Free linear heap
MEMOP_ALLOC_LINEAR=0x10003 // Allocate linear heap MEMOP_ALLOC_LINEAR=0x10003 // Allocate linear heap
} MemOp; } MemOp;
@ -195,6 +194,7 @@ s32 svcCreateThread(Handle* thread, ThreadFunc entrypoint, u32 arg, u32* stack_
void __attribute__((noreturn)) svcExitThread(); void __attribute__((noreturn)) svcExitThread();
void svcSleepThread(s64 ns); void svcSleepThread(s64 ns);
s32 svcSetThreadPriority(Handle thread, s32 prio); s32 svcSetThreadPriority(Handle thread, s32 prio);
s32 svcGetProcessorID();
s32 svcCreateMutex(Handle* mutex, bool initially_locked); s32 svcCreateMutex(Handle* mutex, bool initially_locked);
s32 svcReleaseMutex(Handle handle); s32 svcReleaseMutex(Handle handle);
s32 svcCreateSemaphore(Handle* semaphore, s32 initial_count, s32 max_count); s32 svcCreateSemaphore(Handle* semaphore, s32 initial_count, s32 max_count);
@ -228,11 +228,13 @@ Result svcCreatePort(Handle* portServer, Handle* portClient, const char* name, s
Result svcDebugActiveProcess(Handle* debug, u32 processId); Result svcDebugActiveProcess(Handle* debug, u32 processId);
Result svcBreakDebugProcess(Handle debug); Result svcBreakDebugProcess(Handle debug);
Result svcTerminateDebugProcess(Handle debug); Result svcTerminateDebugProcess(Handle debug);
Result svcGetProcessDebugEvent(DebugEventInfo *info, Handle debug); Result svcGetProcessDebugEvent(DebugEventInfo* info, Handle debug);
Result svcContinueDebugEvent(Handle debug, u32 flags); Result svcContinueDebugEvent(Handle debug, u32 flags);
Result svcGetProcessList(s32* processCount, u32* processIds, s32 processIdMaxCount); Result svcGetProcessList(s32* processCount, u32* processIds, s32 processIdMaxCount);
Result svcReadProcessMemory(void* buffer, Handle debug, u32 addr, u32 size); Result svcReadProcessMemory(void* buffer, Handle debug, u32 addr, u32 size);
Result svcWriteProcessMemory(Handle debug, const void* buffer, u32 addr, u32 size);
Result svcControlProcessMemory(Handle process, u32 addr0, u32 addr1, u32 size, u32 type, u32 perm);
Result svcMapProcessMemory(Handle process, u32 startAddr, u32 endAddr); Result svcMapProcessMemory(Handle process, u32 startAddr, u32 endAddr);
Result svcUnmapProcessMemory(Handle process, u32 startAddr, u32 endAddr); Result svcUnmapProcessMemory(Handle process, u32 startAddr, u32 endAddr);
Result svcBackdoor(s32 (*callback)(void));
Result svcQueryProcessMemory(MemInfo* info, PageInfo* out, Handle process, u32 addr); Result svcQueryProcessMemory(MemInfo* info, PageInfo* out, Handle process, u32 addr);
s32 svcGetProcessorID();

View File

@ -216,6 +216,7 @@ void GPU_Reset(u32* gxbuf, u32* gpuBuf, u32 gpuBufSize)
GPUCMD_Finalize(); GPUCMD_Finalize();
GPUCMD_Run(gpuBuf); GPUCMD_Run(gpuBuf);
GPUCMD_SetBufferOffset(0);
} }
void GPU_SetFloatUniform(GPU_SHADER_TYPE type, u32 startreg, u32* data, u32 numreg) void GPU_SetFloatUniform(GPU_SHADER_TYPE type, u32 startreg, u32* data, u32 numreg)

View File

@ -171,14 +171,12 @@ Result AM_DeleteAppTitle(u8 mediatype, u64 titleID)
return (Result)cmdbuf[1]; return (Result)cmdbuf[1];
} }
Result AM_InstallFIRM(u64 titleID) Result AM_InstallNativeFirm()
{ {
Result ret = 0; Result ret = 0;
u32 *cmdbuf = getThreadCommandBuffer(); u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = 0x04010080; cmdbuf[0] = 0x040F0000;
cmdbuf[1] = titleID & 0xffffffff;
cmdbuf[2] = (u32)(titleID >> 32);
if((ret = svcSendSyncRequest(amHandle))!=0) return ret; if((ret = svcSendSyncRequest(amHandle))!=0) return ret;

View File

@ -65,6 +65,12 @@ svcSetThreadPriority:
svc 0x0C svc 0x0C
bx lr bx lr
.global svcGetProcessorID
.type svcGetProcessorID, %function
svcGetProcessorID:
svc 0x11
bx lr
.global svcCreateMutex .global svcCreateMutex
.type svcCreateMutex, %function .type svcCreateMutex, %function
svcCreateMutex: svcCreateMutex:
@ -80,6 +86,24 @@ svcReleaseMutex:
svc 0x14 svc 0x14
bx lr bx lr
.global svcCreateSemaphore
.type svcCreateSemaphore, %function
svcCreateSemaphore:
push {r0}
svc 0x15
pop {r3}
str r1, [r3]
bx lr
.global svcReleaseSemaphore
.type svcReleaseSemaphore, %function
svcReleaseSemaphore:
push {r0}
svc 0x16
pop {r3}
str r1, [r3]
bx lr
.global svcCreateEvent .global svcCreateEvent
.type svcCreateEvent, %function .type svcCreateEvent, %function
svcCreateEvent: svcCreateEvent:
@ -265,30 +289,6 @@ svcGetProcessId:
str r1, [r3] str r1, [r3]
bx lr bx lr
.global svcOutputDebugString
.type svcOutputDebugString, %function
svcOutputDebugString:
svc 0x3D
bx lr
.global svcCreateSemaphore
.type svcCreateSemaphore, %function
svcCreateSemaphore:
push {r0}
svc 0x15
pop {r3}
str r1, [r3]
bx lr
.global svcReleaseSemaphore
.type svcReleaseSemaphore, %function
svcReleaseSemaphore:
push {r0}
svc 0x16
pop {r3}
str r1, [r3]
bx lr
.global svcGetThreadId .global svcGetThreadId
.type svcGetThreadId, %function .type svcGetThreadId, %function
svcGetThreadId: svcGetThreadId:
@ -298,6 +298,12 @@ svcGetThreadId:
str r1, [r3] str r1, [r3]
bx lr bx lr
.global svcOutputDebugString
.type svcOutputDebugString, %function
svcOutputDebugString:
svc 0x3D
bx lr
.global svcCreatePort .global svcCreatePort
.type svcCreatePort, %function .type svcCreatePort, %function
svcCreatePort: svcCreatePort:
@ -361,6 +367,22 @@ svcReadProcessMemory:
svc 0x6A svc 0x6A
bx lr bx lr
.global svcWriteProcessMemory
.type svcWriteProcessMemory, %function
svcWriteProcessMemory:
svc 0x6B
bx lr
.global svcControlProcessMemory
.type svcControlProcessMemory, %function
svcControlProcessMemory:
push {r4-r5}
ldr r4, [sp, #0x8]
ldr r5, [sp, #0xC]
svc 0x70
pop {r4-r5}
bx lr
.global svcMapProcessMemory .global svcMapProcessMemory
.type svcMapProcessMemory, %function .type svcMapProcessMemory, %function
svcMapProcessMemory: svcMapProcessMemory:
@ -373,6 +395,12 @@ svcUnmapProcessMemory:
svc 0x72 svc 0x72
bx lr bx lr
.global svcBackdoor
.type svcBackdoor, %function
svcBackdoor:
svc 0x7B
bx lr
.global svcQueryProcessMemory .global svcQueryProcessMemory
.type svcQueryProcessMemory, %function .type svcQueryProcessMemory, %function
svcQueryProcessMemory: svcQueryProcessMemory:
@ -385,9 +413,3 @@ svcQueryProcessMemory:
add sp, sp, #8 add sp, sp, #8
pop {r4-r6} pop {r4-r6}
bx lr bx lr
.global svcGetProcessorID
.type svcGetProcessorID, %function
svcGetProcessorID:
svc 0x11
bx lr