mirror of
https://github.com/joel16/3DSident.git
synced 2024-11-23 03:29:45 +00:00
Get actual battery percentage thanks to Spaqin
Removed ir:u service because it isn't required in this program. Besides I had to make room for mcu::HWC. I also forgot to mention I got the ACTU functions from MrCheeze. Many thanks to him.
This commit is contained in:
parent
7a36f136f2
commit
827f1772d2
@ -170,6 +170,7 @@ AccessControlInfo:
|
||||
- gsp::Gpu
|
||||
- hid:USER
|
||||
- http:C
|
||||
- mcu::HWC
|
||||
- mic:u
|
||||
- ndm:u
|
||||
- news:s
|
||||
@ -181,7 +182,6 @@ AccessControlInfo:
|
||||
- y2r:u
|
||||
- ldr:ro
|
||||
- ir:USER
|
||||
- ir:u
|
||||
- csnd:SND
|
||||
- am:u
|
||||
- ns:s
|
||||
|
@ -3,15 +3,18 @@
|
||||
|
||||
static Handle actHandle;
|
||||
|
||||
Result actInit(void) {
|
||||
Result actInit(void)
|
||||
{
|
||||
return srvGetServiceHandle(&actHandle, "act:u");
|
||||
}
|
||||
|
||||
Result actExit(void) {
|
||||
Result actExit(void)
|
||||
{
|
||||
return svcCloseHandle(actHandle);
|
||||
}
|
||||
|
||||
Result ACTU_Initialize(u32 sdkVersion, u32 unknown, Handle handle) {
|
||||
Result ACTU_Initialize(u32 sdkVersion, u32 unknown, Handle handle)
|
||||
{
|
||||
Result ret = 0;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
|
||||
@ -28,7 +31,8 @@ Result ACTU_Initialize(u32 sdkVersion, u32 unknown, Handle handle) {
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result ACTU_GetAccountDataBlock(u32 unknown, u32 size, u32 blockId, void* output) {
|
||||
Result ACTU_GetAccountDataBlock(u32 unknown, u32 size, u32 blockId, void* output)
|
||||
{
|
||||
Result ret = 0;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <malloc.h>
|
||||
|
||||
#include "actu.h"
|
||||
#include "mcu.h"
|
||||
#include "screenshot.h"
|
||||
|
||||
int vaPrint(char *format, ...)
|
||||
@ -176,6 +177,7 @@ int main(int argc, char *argv[])
|
||||
fsInit();
|
||||
sdmcInit();
|
||||
ptmuInit();
|
||||
mcuInit();
|
||||
amInit();
|
||||
psInit();
|
||||
aptInit();
|
||||
@ -187,7 +189,7 @@ int main(int argc, char *argv[])
|
||||
char *str_ver = malloc(255), *str_sysver = malloc(255);
|
||||
u32 os_ver = osGetKernelVersion(), firm_ver = osGetKernelVersion();
|
||||
|
||||
printf("\x1b[32m3DSident 0.4\x1b[0m\n\n");
|
||||
printf("\x1b[32m3DSident 0.5\x1b[0m\n\n");
|
||||
|
||||
snprintf(str_ver, 255, "\x1b[33m*\x1b[0m Kernel version: %lu.%lu-%lu\n\x1b[33m*\x1b[0m FIRM version is %lu.%lu-%lu\n",
|
||||
GET_VERSION_MAJOR(os_ver), GET_VERSION_MINOR(os_ver), GET_VERSION_REVISION(os_ver),
|
||||
|
21
source/mcu.c
Normal file
21
source/mcu.c
Normal file
@ -0,0 +1,21 @@
|
||||
#include "mcu.h"
|
||||
|
||||
Result mcuInit()
|
||||
{
|
||||
return srvGetServiceHandle(&mcuhwcHandle, "mcu::HWC");
|
||||
}
|
||||
|
||||
Result mcuExit()
|
||||
{
|
||||
return svcCloseHandle(mcuhwcHandle);
|
||||
}
|
||||
|
||||
Result mcuGetBatteryLevel(u8* out)
|
||||
{
|
||||
u32* ipc = getThreadCommandBuffer();
|
||||
ipc[0] = 0x50000;
|
||||
Result ret = svcSendSyncRequest(mcuhwcHandle);
|
||||
if(ret < 0) return ret;
|
||||
*out = ipc[2];
|
||||
return ipc[1];
|
||||
}
|
7
source/mcu.h
Normal file
7
source/mcu.h
Normal file
@ -0,0 +1,7 @@
|
||||
#include <3ds.h>
|
||||
|
||||
Handle mcuhwcHandle;
|
||||
|
||||
Result mcuInit();
|
||||
Result mcuExit();
|
||||
Result mcuGetBatteryLevel(u8* out);
|
Loading…
Reference in New Issue
Block a user