diff --git a/libctru/include/3ds/services/hb.h b/libctru/include/3ds/services/hb.h index e71dd0f..c575984 100644 --- a/libctru/include/3ds/services/hb.h +++ b/libctru/include/3ds/services/hb.h @@ -7,8 +7,8 @@ #include <3ds/types.h> -Result initHb(); -void exitHb(); +Result hbInit(); +void hbExit(); // flushes/invalidates entire data/instruction cache // can be useful when writing code to executable pages diff --git a/libctru/source/services/hb.c b/libctru/source/services/hb.c index cf21f07..96d5a03 100644 --- a/libctru/source/services/hb.c +++ b/libctru/source/services/hb.c @@ -5,12 +5,12 @@ static Handle hbHandle; -Result initHb() +Result hbInit() { return srvGetServiceHandle(&hbHandle, "hb:HB"); } -void exitHb() +void hbExit() { svcCloseHandle(hbHandle); } @@ -57,7 +57,11 @@ Result HB_ReprotectMemory(u32* addr, u32 pages, u32 mode, u32* reprotectedPages) if((ret = svcSendSyncRequest(hbHandle))!=0) return ret; - if(reprotectedPages)*reprotectedPages=(u32)cmdbuf[2]; + if(reprotectedPages) + { + if(!ret)*reprotectedPages=(u32)cmdbuf[2]; + else *reprotectedPages=0; + } return (Result)cmdbuf[1]; }