added HB service support (ninjhax only)
This commit is contained in:
parent
1a72193dc5
commit
2c04f993d6
@ -30,6 +30,7 @@ extern "C" {
|
|||||||
#include <3ds/services/mic.h>
|
#include <3ds/services/mic.h>
|
||||||
#include <3ds/services/mvd.h>
|
#include <3ds/services/mvd.h>
|
||||||
#include <3ds/services/qtm.h>
|
#include <3ds/services/qtm.h>
|
||||||
|
#include <3ds/services/hb.h>
|
||||||
|
|
||||||
#include <3ds/gpu/gx.h>
|
#include <3ds/gpu/gx.h>
|
||||||
#include <3ds/gpu/gpu.h>
|
#include <3ds/gpu/gpu.h>
|
||||||
|
16
libctru/include/3ds/services/hb.h
Normal file
16
libctru/include/3ds/services/hb.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#ifndef HB_H
|
||||||
|
#define HB_H
|
||||||
|
|
||||||
|
// WARNING ! THIS FILE PROVIDES AN INTERFACE TO A NON-OFFICIAL SERVICE PROVIDED BY NINJHAX
|
||||||
|
// BY USING COMMANDS FROM THIS SERVICE YOU WILL LIKELY MAKE YOUR APPLICATION INCOMPATIBLE WITH OTHER HOMEBREW LAUNCHING METHODS
|
||||||
|
// A GOOD WAY TO COPE WITH THIS IS TO CHECK THE OUTPUT OF initHb FOR ERRORS
|
||||||
|
|
||||||
|
#include <3ds/types.h>
|
||||||
|
|
||||||
|
Result initHb();
|
||||||
|
void exitHb();
|
||||||
|
|
||||||
|
Result HB_GetBootloaderAddresses(void** load3dsx, void** setArgv);
|
||||||
|
Result HB_ReprotectMemory(u32* addr, u32 pages, u32 mode, u32* reprotectedPages);
|
||||||
|
|
||||||
|
#endif
|
48
libctru/source/services/hb.c
Normal file
48
libctru/source/services/hb.c
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#include <3ds/types.h>
|
||||||
|
#include <3ds/svc.h>
|
||||||
|
#include <3ds/srv.h>
|
||||||
|
#include <3ds/services/hb.h>
|
||||||
|
|
||||||
|
static Handle hbHandle;
|
||||||
|
|
||||||
|
Result initHb()
|
||||||
|
{
|
||||||
|
return srvGetServiceHandle(&hbHandle, "hb:HB");
|
||||||
|
}
|
||||||
|
|
||||||
|
void exitHb()
|
||||||
|
{
|
||||||
|
svcCloseHandle(hbHandle);
|
||||||
|
}
|
||||||
|
|
||||||
|
Result HB_GetBootloaderAddresses(void** load3dsx, void** setArgv)
|
||||||
|
{
|
||||||
|
Result ret = 0;
|
||||||
|
u32 *cmdbuf = getThreadCommandBuffer();
|
||||||
|
|
||||||
|
cmdbuf[0] = 0x00060000;
|
||||||
|
|
||||||
|
if((ret = svcSendSyncRequest(hbHandle))!=0) return ret;
|
||||||
|
|
||||||
|
if(load3dsx)*load3dsx=(void*)cmdbuf[2];
|
||||||
|
if(setArgv)*setArgv=(void*)cmdbuf[3];
|
||||||
|
|
||||||
|
return (Result)cmdbuf[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
Result HB_ReprotectMemory(u32* addr, u32 pages, u32 mode, u32* reprotectedPages)
|
||||||
|
{
|
||||||
|
Result ret = 0;
|
||||||
|
u32 *cmdbuf = getThreadCommandBuffer();
|
||||||
|
|
||||||
|
cmdbuf[0] = 0x000900C0;
|
||||||
|
cmdbuf[1] = (u32)addr;
|
||||||
|
cmdbuf[2] = pages;
|
||||||
|
cmdbuf[3] = mode;
|
||||||
|
|
||||||
|
if((ret = svcSendSyncRequest(hbHandle))!=0) return ret;
|
||||||
|
|
||||||
|
if(reprotectedPages)*reprotectedPages=(u32)cmdbuf[2];
|
||||||
|
|
||||||
|
return (Result)cmdbuf[1];
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user