Make things ready for the final release

- Remove screenshot function since rosalina can now be used.
- Fixed device ID display on GUI.
- Lowered size for WiFi and Storage menu in GUI
- Console will now exit with any button excluding the rosalina activation buttons.
This commit is contained in:
Joel16 2018-08-02 23:38:53 -05:00
parent f7ded94e60
commit bdf282adbd
7 changed files with 84 additions and 286 deletions

View File

@ -24,19 +24,6 @@ Result FS_CloseArchive(FS_Archive archive)
return 0; return 0;
} }
Result FS_MakeDir(FS_Archive archive, const char *path)
{
Result ret = 0;
u16 path_u16[strlen(path) + 1];
Utils_U8_To_U16(path_u16, path, strlen(path) + 1);
if (R_FAILED(ret = FSUSER_CreateDirectory(archive, fsMakePath(PATH_UTF16, path_u16), 0)))
return ret;
return 0;
}
bool FS_FileExists(FS_Archive archive, const char *path) bool FS_FileExists(FS_Archive archive, const char *path)
{ {
Handle handle; Handle handle;
@ -52,19 +39,3 @@ bool FS_FileExists(FS_Archive archive, const char *path)
return true; return true;
} }
bool FS_DirExists(FS_Archive archive, const char *path)
{
Handle handle;
u16 path_u16[strlen(path) + 1];
Utils_U8_To_U16(path_u16, path, strlen(path) + 1);
if (R_FAILED(FSUSER_OpenDirectory(&handle, archive, fsMakePath(PATH_UTF16, path_u16))))
return false;
if (R_FAILED(FSDIR_Close(handle)))
return false;
return true;
}

View File

@ -7,8 +7,6 @@ FS_Archive archive;
Result FS_OpenArchive(FS_Archive *archive, FS_ArchiveID archiveID); Result FS_OpenArchive(FS_Archive *archive, FS_ArchiveID archiveID);
Result FS_CloseArchive(FS_Archive archive); Result FS_CloseArchive(FS_Archive archive);
Result FS_MakeDir(FS_Archive archive, const char *path);
bool FS_FileExists(FS_Archive archive, const char *path); bool FS_FileExists(FS_Archive archive, const char *path);
bool FS_DirExists(FS_Archive archive, const char *path);
#endif #endif

View File

@ -1,143 +0,0 @@
#include <3ds.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "fs.h"
#include "screenshot.h"
static int num = 0;
static Result generateScreenshot(const char *path)
{
int x = 0, y = 0;
Handle handle;
u32 bytesWritten = 0;
u64 offset = 0;
size_t size = 0x36;
Result ret = 0;
// Get top/bottom framebuffers
u8 *gfxBottom = gfxGetFramebuffer(GFX_BOTTOM, GFX_BOTTOM, NULL, NULL);
u8 *gfxTopLeft = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
// Open file for writing screenshot
if (R_FAILED(ret = FSUSER_OpenFile(&handle, archive, fsMakePath(PATH_ASCII, path), (FS_OPEN_CREATE | FS_OPEN_WRITE), 0)))
return ret;
// Some
u8 *buf = (u8*)malloc(size + 576000);
memset(buf, 0, size + 576000);
buf[size + 576000] = 0;
if (R_FAILED(ret = FSFILE_SetSize(handle, (u16)(size + 576000))))
{
free(buf);
return ret;
}
*(u16*)&buf[0x0] = 0x4D42;
*(u32*)&buf[0x2] = size + 576000;
*(u32*)&buf[0xA] = size;
*(u32*)&buf[0xE] = 0x28;
*(u32*)&buf[0x12] = 400;
*(u32*)&buf[0x16] = 480;
*(u32*)&buf[0x1A] = 0x00180001;
*(u32*)&buf[0x22] = 576000;
// Generate top left
u8* framebuf = gfxTopLeft;
for (y = 0; y < 240; y++)
{
for (x = 0; x < 400; x++)
{
int si = ((239 - y) + (x * 240)) * 3;
int di = size + (x + ((479 - y) * 400)) * 3;
buf[di++] = framebuf[si++];
buf[di++] = framebuf[si++];
buf[di++] = framebuf[si++];
}
}
// Generate bottom right
framebuf = gfxBottom;
for (y = 0; y < 240; y++)
{
for (x = 0; x < 320; x++)
{
int si = ((239 - y) + (x * 240)) * 3;
int di = size + ((x+40) + ((239 - y) * 400)) * 3;
buf[di++] = framebuf[si++];
buf[di++] = framebuf[si++];
buf[di++] = framebuf[si++];
}
// Make adjustments for the smaller width
for (x = 0; x < 40; x++)
{
int di = size + (x + ((239 - y) * 400)) * 3;
buf[di++] = 0;
buf[di++] = 0;
buf[di++] = 0;
}
for (x = 360; x < 400; x++)
{
int di = size + (x + ((239 - y) * 400)) * 3;
buf[di++] = 0;
buf[di++] = 0;
buf[di++] = 0;
}
}
if (R_FAILED(FSFILE_Write(handle, &bytesWritten, offset, (u32 *)buf, size + 576000, 0x10001)))
{
free(buf);
return ret;
}
if (R_FAILED(FSFILE_Close(handle)))
{
free(buf);
return ret;
}
free(buf);
return 0;
}
static void generateScreenshotFileName(int number, char *fileName, const char *ext)
{
time_t unixTime = time(NULL);
struct tm* timeStruct = gmtime((const time_t *)&unixTime);
int num = number;
int day = timeStruct->tm_mday;
int month = timeStruct->tm_mon + 1;
int year = timeStruct->tm_year + 1900;
if (!(FS_DirExists(archive, "/screenshots/")))
FS_MakeDir(archive, "/screenshots");
sprintf(fileName, "/screenshots/Screenshot_%02d%02d%02d-%i%s", year, month, day, num, ext);
}
void Screenshot_Capture(void)
{
static char filename[256];
sprintf(filename, "%s", "screenshot");
svcSleepThread(10000000);
generateScreenshotFileName(num, filename, ".bmp");
while (FS_FileExists(archive, filename))
{
num++;
generateScreenshotFileName(num, filename, ".bmp");
}
generateScreenshot(filename);
num++;
}

View File

@ -1,6 +0,0 @@
#ifndef _3DSIDENT_SCREENSHOT_H_
#define _3DSIDENT_SCREENSHOT_H_
void Screenshot_Capture(void);
#endif

View File

@ -5,18 +5,16 @@
#include "ac.h" #include "ac.h"
#include "actu.h" #include "actu.h"
#include "fs.h"
#include "hardware.h" #include "hardware.h"
#include "kernel.h" #include "kernel.h"
#include "misc.h" #include "misc.h"
#include "screenshot.h"
#include "storage.h" #include "storage.h"
#include "system.h" #include "system.h"
#include "utils.h" #include "utils.h"
#include "wifi.h" #include "wifi.h"
#define ANY_KEY (KEY_TOUCH | KEY_A | KEY_B | KEY_X | KEY_Y | KEY_START | \ #define ANY_KEY (KEY_TOUCH | KEY_A | KEY_B | KEY_X | KEY_Y | KEY_START | KEY_R | \
KEY_UP | KEY_DOWN | KEY_LEFT | KEY_RIGHT | KEY_ZL | KEY_ZR | \ KEY_UP | KEY_CPAD_DOWN | KEY_LEFT | KEY_RIGHT | KEY_ZL | KEY_ZR | \
KEY_CSTICK_UP | KEY_CSTICK_DOWN | KEY_CSTICK_LEFT | KEY_CSTICK_RIGHT) KEY_CSTICK_UP | KEY_CSTICK_DOWN | KEY_CSTICK_LEFT | KEY_CSTICK_RIGHT)
static u32 cpu_time_limit = 0; static u32 cpu_time_limit = 0;
@ -45,14 +43,10 @@ void Init_Services(void)
APT_GetAppCpuTimeLimit(&cpu_time_limit); APT_GetAppCpuTimeLimit(&cpu_time_limit);
APT_SetAppCpuTimeLimit(30); APT_SetAppCpuTimeLimit(30);
FS_OpenArchive(&archive, ARCHIVE_SDMC);
} }
void Term_Services(void) void Term_Services(void)
{ {
FS_CloseArchive(archive);
if (cpu_time_limit != UINT32_MAX) if (cpu_time_limit != UINT32_MAX)
APT_SetAppCpuTimeLimit(cpu_time_limit); APT_SetAppCpuTimeLimit(cpu_time_limit);
@ -292,13 +286,8 @@ int main(int argc, char *argv[])
gspWaitForVBlank(); gspWaitForVBlank();
hidScanInput(); hidScanInput();
u32 kDown = hidKeysDown();
u32 kHeld = hidKeysHeld();
if (((kHeld & KEY_L) && (kDown & KEY_R)) || ((kHeld & KEY_R) && (kDown & KEY_L))) if (hidKeysDown() & ANY_KEY)
Screenshot_Capture();
else if (kDown & ANY_KEY)
break; break;
gfxFlushBuffers(); gfxFlushBuffers();

View File

@ -5,7 +5,6 @@
#include "actu.h" #include "actu.h"
#include "C2D_helper.h" #include "C2D_helper.h"
#include "common.h" #include "common.h"
#include "fs.h"
#include "menus.h" #include "menus.h"
#include "sprites.h" #include "sprites.h"
#include "textures.h" #include "textures.h"
@ -37,8 +36,6 @@ static void Init_Services(void)
APT_GetAppCpuTimeLimit(&cpu_time_limit); APT_GetAppCpuTimeLimit(&cpu_time_limit);
APT_SetAppCpuTimeLimit(30); APT_SetAppCpuTimeLimit(30);
FS_OpenArchive(&archive, ARCHIVE_SDMC);
staticBuf = C2D_TextBufNew(4096); staticBuf = C2D_TextBufNew(4096);
dynamicBuf = C2D_TextBufNew(4096); dynamicBuf = C2D_TextBufNew(4096);
sizeBuf = C2D_TextBufNew(4096); sizeBuf = C2D_TextBufNew(4096);
@ -57,8 +54,6 @@ static void Term_Services(void)
C2D_TextBufDelete(dynamicBuf); C2D_TextBufDelete(dynamicBuf);
C2D_TextBufDelete(staticBuf); C2D_TextBufDelete(staticBuf);
FS_CloseArchive(archive);
if (cpu_time_limit != UINT32_MAX) if (cpu_time_limit != UINT32_MAX)
APT_SetAppCpuTimeLimit(cpu_time_limit); APT_SetAppCpuTimeLimit(cpu_time_limit);

View File

@ -12,7 +12,6 @@
#include "kernel.h" #include "kernel.h"
#include "menu_control.h" #include "menu_control.h"
#include "misc.h" #include "misc.h"
#include "screenshot.h"
#include "storage.h" #include "storage.h"
#include "system.h" #include "system.h"
#include "textures.h" #include "textures.h"
@ -28,40 +27,40 @@ static int item_height = 0;
static char kernel_version[100], system_version[100], firm_version[100], initial_version[0xB], nand_lfcs[0xB]; static char kernel_version[100], system_version[100], firm_version[100], initial_version[0xB], nand_lfcs[0xB];
static u32 sd_titles = 0, nand_titles = 0, tickets = 0; static u32 sd_titles = 0, nand_titles = 0, tickets = 0;
static void Menu_DrawItem(int x, int y, char *item_title, const char* text, ...) static void Menu_DrawItem(int x, int y, float size, char *item_title, const char* text, ...)
{ {
float title_width = 0.0f; float title_width = 0.0f;
Draw_GetTextSize(0.5f, &title_width, NULL, item_title); Draw_GetTextSize(size, &title_width, NULL, item_title);
Draw_Text(x, y, 0.5f, MENU_INFO_TITLE_COLOUR, item_title); Draw_Text(x, y, size, MENU_INFO_TITLE_COLOUR, item_title);
char buffer[256]; char buffer[256];
va_list args; va_list args;
va_start(args, text); va_start(args, text);
vsnprintf(buffer, 256, text, args); vsnprintf(buffer, 256, text, args);
Draw_Text(x + title_width + 5, y, 0.5f, MENU_INFO_DESC_COLOUR, buffer); Draw_Text(x + title_width + 5, y, size, MENU_INFO_DESC_COLOUR, buffer);
va_end(args); va_end(args);
} }
static void Menu_Kernel(void) static void Menu_Kernel(void)
{ {
Menu_DrawItem(15, 102, "Kernel version:", kernel_version); Menu_DrawItem(15, 102, 0.5f, "Kernel version:", kernel_version);
Menu_DrawItem(15, 120, "FIRM version:", firm_version); Menu_DrawItem(15, 120, 0.5f, "FIRM version:", firm_version);
Menu_DrawItem(15, 136, "System version:", system_version); Menu_DrawItem(15, 136, 0.5f, "System version:", system_version);
Menu_DrawItem(15, 156, "Initial system version:", initial_version); Menu_DrawItem(15, 156, 0.5f, "Initial system version:", initial_version);
Menu_DrawItem(15, 174, "SDMC CID:", display_info? Kernel_GetSDMCCID() : NULL); Menu_DrawItem(15, 174, 0.5f, "SDMC CID:", display_info? Kernel_GetSDMCCID() : NULL);
Menu_DrawItem(15, 192, "NAND CID:", display_info? Kernel_GetNANDCID() : NULL); Menu_DrawItem(15, 192, 0.5f, "NAND CID:", display_info? Kernel_GetNANDCID() : NULL);
Menu_DrawItem(15, 210, "Device ID:", "%llu", display_info? Kernel_GetDeviceId() : 0); Menu_DrawItem(15, 210, 0.5f, "Device ID:", "%lu", display_info? Kernel_GetDeviceId() : 0);
} }
static void Menu_System(void) static void Menu_System(void)
{ {
Menu_DrawItem(15, 102, "Model:", "%s (%s - %s)", System_GetModel(), System_GetRunningHW(), System_GetRegion()); Menu_DrawItem(15, 102, 0.5f, "Model:", "%s (%s - %s)", System_GetModel(), System_GetRunningHW(), System_GetRegion());
Menu_DrawItem(15, 120, "Language:", System_GetLang()); Menu_DrawItem(15, 120, 0.5f, "Language:", System_GetLang());
Menu_DrawItem(15, 138, "ECS Device ID:", "%llu", display_info? System_GetSoapId() : 0); Menu_DrawItem(15, 138, 0.5f, "ECS Device ID:", "%llu", display_info? System_GetSoapId() : 0);
Menu_DrawItem(15, 156, "Original local friend code seed:", "%010llX", display_info? System_GetLocalFriendCodeSeed() : 0); Menu_DrawItem(15, 156, 0.5f, "Original local friend code seed:", "%010llX", display_info? System_GetLocalFriendCodeSeed() : 0);
Menu_DrawItem(15, 174, "NAND local friend code seed:", "%s", display_info? nand_lfcs : NULL); Menu_DrawItem(15, 174, 0.5f, "NAND local friend code seed:", "%s", display_info? nand_lfcs : NULL);
Menu_DrawItem(15, 192, "MAC Address:", display_info? System_GetMacAddress() : NULL); Menu_DrawItem(15, 192, 0.5f, "MAC Address:", display_info? System_GetMacAddress() : NULL);
Menu_DrawItem(15, 210, "Serial number:", display_info? System_GetSerialNumber() : NULL); Menu_DrawItem(15, 210, 0.5f, "Serial number:", display_info? System_GetSerialNumber() : NULL);
} }
static void Menu_Battery(void) static void Menu_Battery(void)
@ -71,25 +70,25 @@ static void Menu_Battery(void)
bool is_connected = false; bool is_connected = false;
ret = MCUHWC_GetBatteryLevel(&battery_percent); ret = MCUHWC_GetBatteryLevel(&battery_percent);
Menu_DrawItem(15, 102, "Battery percentage:", "%3d%%", R_FAILED(ret)? 0 : (battery_percent)); Menu_DrawItem(15, 102, 0.5f, "Battery percentage:", "%3d%%", R_FAILED(ret)? 0 : (battery_percent));
ret = PTMU_GetBatteryChargeState(&battery_status); ret = PTMU_GetBatteryChargeState(&battery_status);
Menu_DrawItem(15, 120, "Battery status:", R_FAILED(ret)? NULL : (battery_status? "charging" : "not charging")); Menu_DrawItem(15, 120, 0.5f, "Battery status:", R_FAILED(ret)? NULL : (battery_status? "charging" : "not charging"));
if (R_FAILED(ret = MCUHWC_GetBatteryVoltage(&battery_volt))) if (R_FAILED(ret = MCUHWC_GetBatteryVoltage(&battery_volt)))
Menu_DrawItem(15, 136, "Battery voltage:", "%d (%.1f V)", 0, 0); Menu_DrawItem(15, 136, 0.5f, "Battery voltage:", "%d (%.1f V)", 0, 0);
else else
Menu_DrawItem(15, 136, "Battery voltage:", "%d (%.1f V)", battery_volt, 5.0 * ((double)battery_volt / 256.0)); Menu_DrawItem(15, 136, 0.5f, "Battery voltage:", "%d (%.1f V)", battery_volt, 5.0 * ((double)battery_volt / 256.0));
ret = PTMU_GetAdapterState(&is_connected); ret = PTMU_GetAdapterState(&is_connected);
Menu_DrawItem(15, 156, "Adapter state:", R_FAILED(ret)? NULL : (is_connected? "connected" : "disconnected")); Menu_DrawItem(15, 156, 0.5f, "Adapter state:", R_FAILED(ret)? NULL : (is_connected? "connected" : "disconnected"));
if ((R_SUCCEEDED(MCUHWC_GetFwVerHigh(&fw_ver_high))) && (R_SUCCEEDED(MCUHWC_GetFwVerLow(&fw_ver_low)))) if ((R_SUCCEEDED(MCUHWC_GetFwVerHigh(&fw_ver_high))) && (R_SUCCEEDED(MCUHWC_GetFwVerLow(&fw_ver_low))))
Menu_DrawItem(15, 174, "MCU firmware:", "%u.%u", (fw_ver_high - 0x10), fw_ver_low); Menu_DrawItem(15, 174, 0.5f, "MCU firmware:", "%u.%u", (fw_ver_high - 0x10), fw_ver_low);
else else
Menu_DrawItem(15, 174, "MCU firmware:", "0.0"); Menu_DrawItem(15, 174, 0.5f, "MCU firmware:", "0.0");
Menu_DrawItem(15, 192, "Power-saving mode:", Config_IsPowerSaveEnabled()? "enabled" : "disabled"); Menu_DrawItem(15, 192, 0.5f, "Power-saving mode:", Config_IsPowerSaveEnabled()? "enabled" : "disabled");
} }
static void Menu_NNID(void) static void Menu_NNID(void)
@ -102,19 +101,19 @@ static void Menu_NNID(void)
char country[0x3], name[0x16], nnid[0x11], timeZone[0x41]; char country[0x3], name[0x16], nnid[0x11], timeZone[0x41];
ret = ACTU_GetAccountDataBlock(nnid, 0x11, 0x8); ret = ACTU_GetAccountDataBlock(nnid, 0x11, 0x8);
Menu_DrawItem(15, 102, "NNID:", R_FAILED(ret)? NULL : (display_info? nnid : NULL)); Menu_DrawItem(15, 102, 0.5f, "NNID:", R_FAILED(ret)? NULL : (display_info? nnid : NULL));
ret = ACTU_GetAccountDataBlock(&principalID, 0x4, 0xC); ret = ACTU_GetAccountDataBlock(&principalID, 0x4, 0xC);
Menu_DrawItem(15, 120, "Principal ID:", "%u", R_FAILED(ret)? 0 : (display_info? principalID : 0)); Menu_DrawItem(15, 120, 0.5f, "Principal ID:", "%u", R_FAILED(ret)? 0 : (display_info? principalID : 0));
Menu_DrawItem(15, 136, "Persistent ID:", "%u", R_FAILED(accountDataBlockRet)? 0 : (display_info? accountDataBlock.persistentID : 0)); Menu_DrawItem(15, 136, 0.5f, "Persistent ID:", "%u", R_FAILED(accountDataBlockRet)? 0 : (display_info? accountDataBlock.persistentID : 0));
Menu_DrawItem(15, 156, "Transferable ID Base:", "%llu", R_FAILED(accountDataBlockRet)? 0 : (display_info? accountDataBlock.transferableID : 0)); Menu_DrawItem(15, 156, 0.5f, "Transferable ID Base:", "%llu", R_FAILED(accountDataBlockRet)? 0 : (display_info? accountDataBlock.transferableID : 0));
ret = ACTU_GetAccountDataBlock(country, 0x3, 0xB); ret = ACTU_GetAccountDataBlock(country, 0x3, 0xB);
Menu_DrawItem(15, 174, "Country:", R_FAILED(ret)? NULL : (display_info? country : NULL)); Menu_DrawItem(15, 174, 0.5f, "Country:", R_FAILED(ret)? NULL : (display_info? country : NULL));
ret = ACTU_GetAccountDataBlock(timeZone, 0x41, 0x1E); ret = ACTU_GetAccountDataBlock(timeZone, 0x41, 0x1E);
Menu_DrawItem(15, 192, "Time Zone:", R_FAILED(ret)? NULL : (display_info? timeZone : NULL)); Menu_DrawItem(15, 192, 0.5f, "Time Zone:", R_FAILED(ret)? NULL : (display_info? timeZone : NULL));
} }
static void Menu_Config(void) static void Menu_Config(void)
@ -122,54 +121,54 @@ static void Menu_Config(void)
char username[0x14]; char username[0x14];
wcstombs(username, Config_GetUsername(), sizeof(username)); wcstombs(username, Config_GetUsername(), sizeof(username));
Menu_DrawItem(15, 102, "Username: ", username); Menu_DrawItem(15, 102, 0.5f, "Username: ", username);
Menu_DrawItem(15, 120, "Birthday:", display_info? Config_GetBirthday() : NULL); Menu_DrawItem(15, 120, 0.5f, "Birthday:", display_info? Config_GetBirthday() : NULL);
Menu_DrawItem(15, 136, "EULA version:", Config_GetEulaVersion()); Menu_DrawItem(15, 136, 0.5f, "EULA version:", Config_GetEulaVersion());
Menu_DrawItem(15, 156, "Parental control pin:", display_info? Config_GetParentalPin() : NULL); Menu_DrawItem(15, 156, 0.5f, "Parental control pin:", display_info? Config_GetParentalPin() : NULL);
Menu_DrawItem(15, 174, "Parental control e-mail:", display_info? Config_GetParentalEmail() : NULL); Menu_DrawItem(15, 174, 0.5f, "Parental control e-mail:", display_info? Config_GetParentalEmail() : NULL);
Menu_DrawItem(15, 192, "Parental control answer:", display_info? Config_GetParentalSecretAnswer() : NULL); Menu_DrawItem(15, 192, 0.5f, "Parental control answer:", display_info? Config_GetParentalSecretAnswer() : NULL);
} }
static void Menu_Hardware(void) static void Menu_Hardware(void)
{ {
Result ret = 0; Result ret = 0;
Menu_DrawItem(15, 102, "Screen type:", System_GetScreenType()); Menu_DrawItem(15, 102, 0.5f, "Screen type:", System_GetScreenType());
Menu_DrawItem(15, 120, "Headphone status:", Hardware_GetAudioJackStatus()); Menu_DrawItem(15, 120, 0.5f, "Headphone status:", Hardware_GetAudioJackStatus());
Menu_DrawItem(15, 136, "Card slot status:", Hardware_GetCardSlotStatus()); Menu_DrawItem(15, 136, 0.5f, "Card slot status:", Hardware_GetCardSlotStatus());
Menu_DrawItem(15, 156, "SDMC status:", Hardware_DetectSD()); Menu_DrawItem(15, 156, 0.5f, "SDMC status:", Hardware_DetectSD());
Menu_DrawItem(15, 174, "Sound output:", Config_GetSoundOutputMode()); Menu_DrawItem(15, 174, 0.5f, "Sound output:", Config_GetSoundOutputMode());
if (Utils_IsN3DS()) if (Utils_IsN3DS())
{ {
Menu_DrawItem(15, 192, "Brightness level:", "%s (auto-brightness mode %s)", Hardware_GetBrightness(GSPLCD_SCREEN_TOP), Menu_DrawItem(15, 192, 0.5f, "Brightness level:", "%s (auto-brightness mode %s)", Hardware_GetBrightness(GSPLCD_SCREEN_TOP),
Config_IsAutoBrightnessEnabled()? "enabled" : "disabled"); Config_IsAutoBrightnessEnabled()? "enabled" : "disabled");
} }
else else
Menu_DrawItem(15, 192, "Brightness level:", Hardware_GetBrightness(GSPLCD_SCREEN_TOP)); Menu_DrawItem(15, 192, 0.5f, "Brightness level:", Hardware_GetBrightness(GSPLCD_SCREEN_TOP));
} }
static void Menu_Misc(void) static void Menu_Misc(void)
{ {
Result ret = 0; Result ret = 0;
Menu_DrawItem(15, 102, "Installed titles:", "SD: %lu (NAND: %lu)", sd_titles, nand_titles); Menu_DrawItem(15, 102, 0.5f, "Installed titles:", "SD: %lu (NAND: %lu)", sd_titles, nand_titles);
Menu_DrawItem(15, 120, "Installed tickets:", "%lu", tickets); Menu_DrawItem(15, 120, 0.5f, "Installed tickets:", "%lu", tickets);
u64 homemenuID = 0; u64 homemenuID = 0;
ret = APT_GetAppletInfo(APPID_HOMEMENU, &homemenuID, NULL, NULL, NULL, NULL); ret = APT_GetAppletInfo(APPID_HOMEMENU, &homemenuID, NULL, NULL, NULL, NULL);
Menu_DrawItem(15, 136, "Homemenu ID:", "%016llX", (R_FAILED(ret))? ret : homemenuID); Menu_DrawItem(15, 136, 0.5f, "Homemenu ID:", "%016llX", (R_FAILED(ret))? ret : homemenuID);
double wifi_signal_percent = (osGetWifiStrength() * 33.3333333333); double wifi_signal_percent = (osGetWifiStrength() * 33.3333333333);
Menu_DrawItem(15, 156, "WiFi signal strength:", "%d (%.0lf%%)", osGetWifiStrength(), wifi_signal_percent); Menu_DrawItem(15, 156, 0.5f, "WiFi signal strength:", "%d (%.0lf%%)", osGetWifiStrength(), wifi_signal_percent);
char hostname[128]; char hostname[128];
ret = gethostname(hostname, sizeof(hostname)); ret = gethostname(hostname, sizeof(hostname));
if (display_info) if (display_info)
Menu_DrawItem(15, 174, "IP:", hostname); Menu_DrawItem(15, 174, 0.5f, "IP:", hostname);
else else
Menu_DrawItem(15, 174, "IP:", NULL); Menu_DrawItem(15, 174, 0.5f, "IP:", NULL);
} }
@ -188,18 +187,18 @@ static void Menu_WiFi(void)
Draw_Text(20, 30, 0.45f, MENU_INFO_DESC_COLOUR, "WiFi Slot 1:"); Draw_Text(20, 30, 0.45f, MENU_INFO_DESC_COLOUR, "WiFi Slot 1:");
if (R_SUCCEEDED(ACI_GetSSID(ssid))) if (R_SUCCEEDED(ACI_GetSSID(ssid)))
Menu_DrawItem(20, 46, "SSID:", ssid); Menu_DrawItem(20, 46, 0.45f, "SSID:", ssid);
if (R_SUCCEEDED(ACI_GetPassphrase(passphrase))) if (R_SUCCEEDED(ACI_GetPassphrase(passphrase)))
Menu_DrawItem(20, 62, "Pass:", "%s (%s)", display_info? passphrase : NULL, WiFi_GetSecurityMode()); Menu_DrawItem(20, 62, 0.45f, "Pass:", "%s (%s)", display_info? passphrase : NULL, WiFi_GetSecurityMode());
if ((R_SUCCEEDED(CFG_GetConfigInfoBlk8(CFG_WIFI_SLOT_SIZE, CFG_WIFI_BLKID, (u8*)&slotData))) && (slotData.set)) if ((R_SUCCEEDED(CFG_GetConfigInfoBlk8(CFG_WIFI_SLOT_SIZE, CFG_WIFI_BLKID, (u8*)&slotData))) && (slotData.set))
{ {
if (display_info) if (display_info)
Menu_DrawItem(20, 78, "Mac address:", "%02X:%02X:%02X:%02X:%02X:%02X", slotData.mac_addr[0], slotData.mac_addr[1], slotData.mac_addr[2], Menu_DrawItem(20, 78, 0.45f, "Mac address:", "%02X:%02X:%02X:%02X:%02X:%02X", slotData.mac_addr[0], slotData.mac_addr[1], slotData.mac_addr[2],
slotData.mac_addr[3], slotData.mac_addr[4], slotData.mac_addr[5]); slotData.mac_addr[3], slotData.mac_addr[4], slotData.mac_addr[5]);
else else
Menu_DrawItem(20, 78, "Mac address:", NULL); Menu_DrawItem(20, 78, 0.45f, "Mac address:", NULL);
} }
} }
@ -211,18 +210,18 @@ static void Menu_WiFi(void)
Draw_Text(20, 98, 0.45f, MENU_INFO_DESC_COLOUR, "WiFi Slot 2:"); Draw_Text(20, 98, 0.45f, MENU_INFO_DESC_COLOUR, "WiFi Slot 2:");
if (R_SUCCEEDED(ACI_GetSSID(ssid))) if (R_SUCCEEDED(ACI_GetSSID(ssid)))
Menu_DrawItem(20, 114, "SSID:", ssid); Menu_DrawItem(20, 114, 0.45f, "SSID:", ssid);
if (R_SUCCEEDED(ACI_GetPassphrase(passphrase))) if (R_SUCCEEDED(ACI_GetPassphrase(passphrase)))
Menu_DrawItem(20, 130, "Pass:", "%s (%s)", display_info? passphrase : NULL, WiFi_GetSecurityMode()); Menu_DrawItem(20, 130, 0.45f, "Pass:", "%s (%s)", display_info? passphrase : NULL, WiFi_GetSecurityMode());
if ((R_SUCCEEDED(CFG_GetConfigInfoBlk8(CFG_WIFI_SLOT_SIZE, CFG_WIFI_BLKID + 1, (u8*)&slotData))) && (slotData.set)) if ((R_SUCCEEDED(CFG_GetConfigInfoBlk8(CFG_WIFI_SLOT_SIZE, CFG_WIFI_BLKID + 1, (u8*)&slotData))) && (slotData.set))
{ {
if (display_info) if (display_info)
Menu_DrawItem(20, 146, "Mac address:", "%02X:%02X:%02X:%02X:%02X:%02X", slotData.mac_addr[0], slotData.mac_addr[1], slotData.mac_addr[2], Menu_DrawItem(20, 146, 0.45f, "Mac address:", "%02X:%02X:%02X:%02X:%02X:%02X", slotData.mac_addr[0], slotData.mac_addr[1], slotData.mac_addr[2],
slotData.mac_addr[3], slotData.mac_addr[4], slotData.mac_addr[5]); slotData.mac_addr[3], slotData.mac_addr[4], slotData.mac_addr[5]);
else else
Menu_DrawItem(20, 146, "Mac address:", NULL); Menu_DrawItem(20, 146, 0.45f, "Mac address:", NULL);
} }
} }
@ -234,18 +233,18 @@ static void Menu_WiFi(void)
Draw_Text(20, 166, 0.45f, MENU_INFO_DESC_COLOUR, "WiFi Slot 3:"); Draw_Text(20, 166, 0.45f, MENU_INFO_DESC_COLOUR, "WiFi Slot 3:");
if (R_SUCCEEDED(ACI_GetSSID(ssid))) if (R_SUCCEEDED(ACI_GetSSID(ssid)))
Menu_DrawItem(20, 182, "SSID:", ssid); Menu_DrawItem(20, 182, 0.45f, "SSID:", ssid);
if (R_SUCCEEDED(ACI_GetPassphrase(passphrase))) if (R_SUCCEEDED(ACI_GetPassphrase(passphrase)))
Menu_DrawItem(20, 198, "Pass:", "%s (%s)", display_info? passphrase : NULL, WiFi_GetSecurityMode()); Menu_DrawItem(20, 198, 0.45f, "Pass:", "%s (%s)", display_info? passphrase : NULL, WiFi_GetSecurityMode());
if ((R_SUCCEEDED(CFG_GetConfigInfoBlk8(CFG_WIFI_SLOT_SIZE, CFG_WIFI_BLKID + 2, (u8*)&slotData))) && (slotData.set)) if ((R_SUCCEEDED(CFG_GetConfigInfoBlk8(CFG_WIFI_SLOT_SIZE, CFG_WIFI_BLKID + 2, (u8*)&slotData))) && (slotData.set))
{ {
if (display_info) if (display_info)
Menu_DrawItem(20, 214, "Mac address:", "%02X:%02X:%02X:%02X:%02X:%02X", slotData.mac_addr[0], slotData.mac_addr[1], slotData.mac_addr[2], Menu_DrawItem(20, 214, 0.45f, "Mac address:", "%02X:%02X:%02X:%02X:%02X:%02X", slotData.mac_addr[0], slotData.mac_addr[1], slotData.mac_addr[2],
slotData.mac_addr[3], slotData.mac_addr[4], slotData.mac_addr[5]); slotData.mac_addr[3], slotData.mac_addr[4], slotData.mac_addr[5]);
else else
Menu_DrawItem(20, 214, "Mac address:", NULL); Menu_DrawItem(20, 214, 0.45f, "Mac address:", NULL);
} }
} }
} }
@ -280,9 +279,9 @@ static void Menu_Storage(void)
Draw_Rect(21, 106, 58, 8, BACKGROUND_COLOUR); Draw_Rect(21, 106, 58, 8, BACKGROUND_COLOUR);
Draw_Rect(21, 106, (((double)sdUsed / (double)sdTotal) * 58.00), 8, MENU_SELECTOR_COLOUR); Draw_Rect(21, 106, (((double)sdUsed / (double)sdTotal) * 58.00), 8, MENU_SELECTOR_COLOUR);
Draw_Text(85, 50, 0.45f, MENU_INFO_DESC_COLOUR, "SD:"); Draw_Text(85, 50, 0.45f, MENU_INFO_DESC_COLOUR, "SD:");
Menu_DrawItem(85, 71, "Free:", sdFreeSize); Menu_DrawItem(85, 71, 0.45f, "Free:", sdFreeSize);
Menu_DrawItem(85, 87, "Used:", sdUsedSize); Menu_DrawItem(85, 87, 0.45f, "Used:", sdUsedSize);
Menu_DrawItem(85, 103, "Total:", sdTotalSize); Menu_DrawItem(85, 103, 0.45f, "Total:", sdTotalSize);
Draw_Image(drive_icon, 20, 40); Draw_Image(drive_icon, 20, 40);
ctrUsed = Storage_GetUsedStorage(SYSTEM_MEDIATYPE_CTR_NAND); ctrUsed = Storage_GetUsedStorage(SYSTEM_MEDIATYPE_CTR_NAND);
@ -291,9 +290,9 @@ static void Menu_Storage(void)
Draw_Rect(221, 106, 58, 8, BACKGROUND_COLOUR); Draw_Rect(221, 106, 58, 8, BACKGROUND_COLOUR);
Draw_Rect(221, 106, (((double)ctrUsed / (double)ctrTotal) * 58.00), 8, MENU_SELECTOR_COLOUR); Draw_Rect(221, 106, (((double)ctrUsed / (double)ctrTotal) * 58.00), 8, MENU_SELECTOR_COLOUR);
Draw_Text(285, 50, 0.45f, MENU_INFO_DESC_COLOUR, "CTR Nand:"); Draw_Text(285, 50, 0.45f, MENU_INFO_DESC_COLOUR, "CTR Nand:");
Menu_DrawItem(285, 71, "Free:", ctrFreeSize); Menu_DrawItem(285, 71, 0.45f, "Free:", ctrFreeSize);
Menu_DrawItem(285, 87, "Used:", ctrUsedSize); Menu_DrawItem(285, 87, 0.45f, "Used:", ctrUsedSize);
Menu_DrawItem(285, 103, "Total:", ctrTotalSize); Menu_DrawItem(285, 103, 0.45f, "Total:", ctrTotalSize);
Draw_Image(drive_icon, 220, 40); Draw_Image(drive_icon, 220, 40);
twlUsed = Storage_GetUsedStorage(SYSTEM_MEDIATYPE_TWL_NAND); twlUsed = Storage_GetUsedStorage(SYSTEM_MEDIATYPE_TWL_NAND);
@ -302,9 +301,9 @@ static void Menu_Storage(void)
Draw_Rect(21, 201, 58, 8, BACKGROUND_COLOUR); Draw_Rect(21, 201, 58, 8, BACKGROUND_COLOUR);
Draw_Rect(21, 201, (((double)twlUsed / (double)twlTotal) * 58.00), 8, MENU_SELECTOR_COLOUR); Draw_Rect(21, 201, (((double)twlUsed / (double)twlTotal) * 58.00), 8, MENU_SELECTOR_COLOUR);
Draw_Text(85, 145, 0.45f, MENU_INFO_DESC_COLOUR, "TWL Nand:"); Draw_Text(85, 145, 0.45f, MENU_INFO_DESC_COLOUR, "TWL Nand:");
Menu_DrawItem(85, 166, "Free:", twlFreeSize); Menu_DrawItem(85, 166, 0.45f, "Free:", twlFreeSize);
Menu_DrawItem(85, 182, "Used:", twlUsedSize); Menu_DrawItem(85, 182, 0.45f, "Used:", twlUsedSize);
Menu_DrawItem(85, 198, "Total:", twlTotalSize); Menu_DrawItem(85, 198, 0.45f, "Total:", twlTotalSize);
Draw_Image(drive_icon, 20, 135); Draw_Image(drive_icon, 20, 135);
twlpUsed = Storage_GetUsedStorage(SYSTEM_MEDIATYPE_TWL_PHOTO); twlpUsed = Storage_GetUsedStorage(SYSTEM_MEDIATYPE_TWL_PHOTO);
@ -313,9 +312,9 @@ static void Menu_Storage(void)
Draw_Rect(221, 201, 58, 8, BACKGROUND_COLOUR); Draw_Rect(221, 201, 58, 8, BACKGROUND_COLOUR);
Draw_Rect(221, 201, (((double)twlpUsed / (double)twlpTotal) * 58.00), 8, MENU_SELECTOR_COLOUR); Draw_Rect(221, 201, (((double)twlpUsed / (double)twlpTotal) * 58.00), 8, MENU_SELECTOR_COLOUR);
Draw_Text(285, 145, 0.45f, MENU_INFO_DESC_COLOUR, "TWL Photo:"); Draw_Text(285, 145, 0.45f, MENU_INFO_DESC_COLOUR, "TWL Photo:");
Menu_DrawItem(285, 166, "Free:", twlpFreeSize); Menu_DrawItem(285, 166, 0.45f, "Free:", twlpFreeSize);
Menu_DrawItem(285, 182, "Used:", twlpUsedSize); Menu_DrawItem(285, 182, 0.45f, "Used:", twlpUsedSize);
Menu_DrawItem(285, 198, "Total:", twlpTotalSize); Menu_DrawItem(285, 198, 0.45f, "Total:", twlpTotalSize);
Draw_Image(drive_icon, 220, 135); Draw_Image(drive_icon, 220, 135);
} }
@ -361,10 +360,9 @@ void Menu_Main(void)
nand_titles = Misc_TitleCount(MEDIATYPE_NAND); nand_titles = Misc_TitleCount(MEDIATYPE_NAND);
tickets = Misc_TicketCount(); tickets = Misc_TicketCount();
float instr_width = 0.0f, instr_width2 = 0.0f, instr_width3 = 0.0f, instr_height = 0.0f; float instr_width = 0.0f, instr_width2 = 0.0f, instr_height = 0.0f;
Draw_GetTextSize(0.5f, &instr_width, &instr_height, "Press select to hide user-specific info."); Draw_GetTextSize(0.5f, &instr_width, &instr_height, "Press select to hide user-specific info.");
Draw_GetTextSize(0.5f, &instr_width2, NULL, "Press L + R to capture a screenshot."); Draw_GetTextSize(0.5f, &instr_width2, NULL, "Press START + SELECT to use button tester.");
Draw_GetTextSize(0.5f, &instr_width3, NULL, "Press START + SELECT to use button tester.");
while (aptMainLoop()) while (aptMainLoop())
{ {
@ -408,9 +406,8 @@ void Menu_Main(void)
Menu_Misc(); Menu_Misc();
break; break;
case 9: case 9:
Draw_Text((400 - instr_width) / 2, (240 - instr_height) / 2, 0.5f, MENU_INFO_TITLE_COLOUR, "Press select to hide user-specific info."); Draw_Text((400 - instr_width) / 2, ((240 - instr_height) / 2) + 18, 0.5f, MENU_INFO_TITLE_COLOUR, "Press select to hide user-specific info.");
Draw_Text((400 - instr_width2) / 2, ((240 - instr_height) / 2) + 18, 0.5f, MENU_INFO_TITLE_COLOUR, "Press L + R to capture a screenshot."); Draw_Text((400 - instr_width2) / 2, ((240 - instr_height) / 2) + 36, 0.5f, MENU_INFO_TITLE_COLOUR, "Press START + SELECT to use button tester.");
Draw_Text((400 - instr_width3) / 2, ((240 - instr_height) / 2) + 36, 0.5f, MENU_INFO_TITLE_COLOUR, "Press START + SELECT to use button tester.");
break; break;
} }
@ -458,9 +455,6 @@ void Menu_Main(void)
Menu_Controls(); Menu_Controls();
if (((kHeld & KEY_L) && (kDown & KEY_R)) || ((kHeld & KEY_R) && (kDown & KEY_L)))
Screenshot_Capture();
if (kDown & KEY_A) if (kDown & KEY_A)
{ {
if (selection == 9) if (selection == 9)