1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-11-08 11:51:48 +00:00

utils: report IsT flag at startup

This commit is contained in:
Pablo Curiel 2024-05-26 13:31:43 +02:00
parent 503ce4c1a7
commit d64c4de092
2 changed files with 38 additions and 5 deletions

View file

@ -105,6 +105,9 @@ bool utilsIsMarikoUnit(void);
/// Returns true if the application is running under a development unit. /// Returns true if the application is running under a development unit.
bool utilsIsDevelopmentUnit(void); bool utilsIsDevelopmentUnit(void);
/// Returns true if the application is running under a unit with the Terra platform flag set.
bool utilsIsTerraUnit(void);
/// Returns true if the application is running under applet mode. /// Returns true if the application is running under applet mode.
bool utilsIsAppletMode(void); bool utilsIsAppletMode(void);

View file

@ -70,7 +70,7 @@ static u8 g_customFirmwareType = UtilsCustomFirmwareType_Unknown;
static u8 g_productModel = SetSysProductModel_Invalid; static u8 g_productModel = SetSysProductModel_Invalid;
static bool g_isDevUnit = false; static bool g_isTerraUnit = false, g_isDevUnit = false;
static AppletType g_programAppletType = AppletType_None; static AppletType g_programAppletType = AppletType_None;
@ -103,7 +103,9 @@ static void _utilsGetCustomFirmwareType(void);
static bool _utilsGetProductModel(void); static bool _utilsGetProductModel(void);
static bool _utilsIsDevelopmentUnit(void); static bool utilsGetDevelopmentUnitFlag(void);
static bool utilsGetTerraUnitFlag(void);
static bool utilsMountEmmcBisSystemPartitionStorage(void); static bool utilsMountEmmcBisSystemPartitionStorage(void);
static void utilsUnmountEmmcBisSystemPartitionStorage(void); static void utilsUnmountEmmcBisSystemPartitionStorage(void);
@ -185,12 +187,16 @@ bool utilsInitializeResources(void)
if (!_utilsGetProductModel()) break; if (!_utilsGetProductModel()) break;
/* Get development unit flag. */ /* Get development unit flag. */
if (!_utilsIsDevelopmentUnit()) break; if (!utilsGetDevelopmentUnitFlag()) break;
/* Get Terra unit flag. */
if (!utilsGetTerraUnitFlag()) break;
/* Get applet type. */ /* Get applet type. */
g_programAppletType = appletGetAppletType(); g_programAppletType = appletGetAppletType();
LOG_MSG_INFO("Running under %s %s unit in %s mode.", g_isDevUnit ? "development" : "retail", utilsIsMarikoUnit() ? "Mariko" : "Erista", utilsIsAppletMode() ? "applet" : "title override"); LOG_MSG_INFO("Running under %s %s unit %s Terra flag in %s mode.", g_isDevUnit ? "development" : "retail", utilsIsMarikoUnit() ? "Mariko" : "Erista", \
g_isTerraUnit ? "with" : "without", utilsIsAppletMode() ? "applet" : "title override");
if (g_appLaunchPath) if (g_appLaunchPath)
{ {
@ -432,6 +438,11 @@ bool utilsIsDevelopmentUnit(void)
return g_isDevUnit; return g_isDevUnit;
} }
bool utilsIsTerraUnit(void)
{
return g_isTerraUnit;
}
bool utilsIsAppletMode(void) bool utilsIsAppletMode(void)
{ {
return (g_programAppletType > AppletType_Application && g_programAppletType < AppletType_SystemApplication); return (g_programAppletType > AppletType_Application && g_programAppletType < AppletType_SystemApplication);
@ -1313,7 +1324,7 @@ static bool _utilsGetProductModel(void)
return ret; return ret;
} }
static bool _utilsIsDevelopmentUnit(void) static bool utilsGetDevelopmentUnitFlag(void)
{ {
Result rc = 0; Result rc = 0;
bool tmp = false; bool tmp = false;
@ -1329,6 +1340,25 @@ static bool _utilsIsDevelopmentUnit(void)
return R_SUCCEEDED(rc); return R_SUCCEEDED(rc);
} }
static bool utilsGetTerraUnitFlag(void)
{
/* Return right away if we're running under a HOS version that's too low. */
if (hosversionBefore(8, 0, 0)) return true;
Result rc = 0;
bool tmp = false;
rc = setsysGetT(&tmp);
if (R_SUCCEEDED(rc))
{
g_isTerraUnit = tmp;
} else {
LOG_MSG_ERROR("setsysGetT failed! (0x%X).", rc);
}
return R_SUCCEEDED(rc);
}
static bool utilsMountEmmcBisSystemPartitionStorage(void) static bool utilsMountEmmcBisSystemPartitionStorage(void)
{ {
Result rc = 0; Result rc = 0;