diff --git a/sysmodules/rosalina/include/minisoc.h b/sysmodules/rosalina/include/minisoc.h index 8b82b44..cf0229f 100644 --- a/sysmodules/rosalina/include/minisoc.h +++ b/sysmodules/rosalina/include/minisoc.h @@ -38,8 +38,10 @@ #define SYNC_ERROR ENODEV -extern Handle SOCU_handle; -extern Handle socMemhandle; +extern Handle SOCU_handle; +extern Handle socMemhandle; + +extern bool miniSocEnabled; Result miniSocInit(); Result miniSocExit(void); diff --git a/sysmodules/rosalina/source/menu.c b/sysmodules/rosalina/source/menu.c index cacf483..942f570 100644 --- a/sysmodules/rosalina/source/menu.c +++ b/sysmodules/rosalina/source/menu.c @@ -33,6 +33,7 @@ #include "menus.h" #include "utils.h" #include "menus/n3ds.h" +#include "minisoc.h" u32 waitInputWithTimeout(u32 msec) { @@ -241,6 +242,15 @@ static void menuDraw(Menu *menu, u32 selected) Draw_DrawCharacter(10, 30 + i * SPACING_Y, COLOR_TITLE, i == selected ? '>' : ' '); } + if(miniSocEnabled) + { + char ipBuffer[17]; + u32 ip = gethostid(); + u8 *addr = (u8 *)&ip; + int n = sprintf(ipBuffer, "%hhu.%hhu.%hhu.%hhu", addr[0], addr[1], addr[2], addr[3]); + Draw_DrawString(SCREEN_BOT_WIDTH - 10 - SPACING_X * n, 10, COLOR_WHITE, ipBuffer); + } + if(batteryLevel != 255) Draw_DrawFormattedString(SCREEN_BOT_WIDTH - 10 - 4 * SPACING_X, SCREEN_BOT_HEIGHT - 20, COLOR_WHITE, "%02hhu%%", batteryLevel); else diff --git a/sysmodules/rosalina/source/minisoc.c b/sysmodules/rosalina/source/minisoc.c index 69be679..76c2d22 100644 --- a/sysmodules/rosalina/source/minisoc.c +++ b/sysmodules/rosalina/source/minisoc.c @@ -71,6 +71,8 @@ static u32 socContextSize = 0x60000; // SOCU_handle from ctrulib // socMemhandle from ctrulib +bool miniSocEnabled = false; + Result miniSocInit() { if(AtomicPostIncrement(&miniSocRefCount)) @@ -94,6 +96,7 @@ Result miniSocInit() if(ret != 0) goto cleanup; svcKernelSetState(0x10000, 2); + miniSocEnabled = true; return 0; cleanup: @@ -136,7 +139,10 @@ Result miniSocExit(void) svcControlMemory(&tmp, socContextAddr, socContextAddr, socContextSize, MEMOP_FREE, MEMPERM_DONTCARE); if(ret == 0) + { svcKernelSetState(0x10000, 2); + miniSocEnabled = false; + } return ret; }