This repository has been archived by the owner on Sep 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Signed-off-by: Adubbz <[email protected]>
- Loading branch information
Showing
9 changed files
with
443 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#include "diagnostics.h" | ||
|
||
#include "goipc.h" | ||
|
||
void printDebugInfo() | ||
{ | ||
Result rc; | ||
u16 safeSystemVersion; | ||
|
||
if (g_nsvmInitialized) | ||
{ | ||
if (R_SUCCEEDED(rc = nsvmGetSafeSystemVersion(&safeSystemVersion))) | ||
printf("nsvmGetSafeSystemVersion: %u\n", safeSystemVersion); | ||
else | ||
printf("Failed to get current value from nsvmGetSafeSystemVersion. Error code: 0x%08x\n", rc); | ||
} | ||
else | ||
printf("Cannot get value of nsvmGetSafeSystemVersion as ns:vm hasn't been initialized."); | ||
} | ||
|
||
NagStatus checkNagStatus(void) | ||
{ | ||
if (!g_nsvmInitialized) | ||
{ | ||
// ns:vm is not essential to proceed, however users need to be warned that this means there is less verification | ||
// in place. | ||
return UNKNOWN; | ||
} | ||
|
||
Result rc; | ||
u8 needsUpdate; | ||
|
||
if (R_FAILED(rc = nsvmNeedsUpdateVulnerability(&needsUpdate))) | ||
{ | ||
printf("Failed to get current value from nsvmNeedsUpdateVulnerability. Error code: 0x%08x\n", rc); | ||
return FAILED; | ||
} | ||
|
||
if (!needsUpdate) | ||
return UNNAGGED; | ||
|
||
u64 needsUpdateSettingSize; | ||
u64 needsUpdateSetting; | ||
|
||
if (R_FAILED(rc = setsysGetSettingsItemValueSize("vulnerability", "needs_update_vulnerability_policy", &needsUpdateSettingSize))) | ||
{ | ||
printf("Could not get vulnerability!needs_update_vulnerability_policy size! Error code: 0x%08x\n", rc); | ||
return FAILED; | ||
} | ||
|
||
if (needsUpdateSettingSize != 4) | ||
{ | ||
printf("Invalid needs_update_vulnerability_policy size %lu. This likely means you are on an unsupported firmware.", needsUpdateSettingSize); | ||
return FAILED; | ||
} | ||
|
||
if (R_FAILED(rc = setsysGetSettingsItemValue("vulnerability", "needs_update_vulnerability_policy", &needsUpdateSetting))) | ||
{ | ||
printf("Could not get the value of vulnerability!needs_update_vulnerability_policy! Error code: 0x%08x\n", rc); | ||
return FAILED; | ||
} | ||
|
||
if (needsUpdateSetting) | ||
return NAGGED_SETTING; | ||
|
||
return NAGGED_NOSETTING; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#pragma once | ||
|
||
#include <stdbool.h> | ||
#include <switch.h> | ||
|
||
typedef enum | ||
{ | ||
FAILED, | ||
UNKNOWN, | ||
NAGGED_NOSETTING, | ||
NAGGED_SETTING, | ||
UNNAGGED | ||
} NagStatus; | ||
|
||
void printDebugInfo(); | ||
NagStatus checkNagStatus(void); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.