mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-06 19:32:15 +02:00
Add g_nroReturnPath
g_nroReturnPath is the path that nx-hbloader will load after the next NRO returns. If it is not set, the next NRO will simply return to sdmc:/hbmenu.nro
This commit is contained in:
parent
a182f3b496
commit
b7ee0899d4
@ -34,6 +34,7 @@ enum {
|
|||||||
EntryType_ProcessHandle=10, ///< Provides the process handle.
|
EntryType_ProcessHandle=10, ///< Provides the process handle.
|
||||||
EntryType_LastLoadResult=11, ///< Provides the last load result.
|
EntryType_LastLoadResult=11, ///< Provides the last load result.
|
||||||
EntryType_RandomSeed=14, ///< Provides random data used to seed the pseudo-random number generator.
|
EntryType_RandomSeed=14, ///< Provides random data used to seed the pseudo-random number generator.
|
||||||
|
EntryType_NroReturnPath=15
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -94,6 +95,12 @@ Result envSetNextLoad(const char* path, const char* argv);
|
|||||||
/// Returns true if the environment supports envSetNextLoad.
|
/// Returns true if the environment supports envSetNextLoad.
|
||||||
bool envHasNextLoad(void);
|
bool envHasNextLoad(void);
|
||||||
|
|
||||||
|
/// Sets the path of the NRO that will be loaded after the next one
|
||||||
|
Result envSetNroReturnPath(const char* path);
|
||||||
|
|
||||||
|
///Returns true if the environment supports envSetNroReturnPath
|
||||||
|
bool envHasNroReturnPath(void);
|
||||||
|
|
||||||
/// Returns the Result from the last NRO.
|
/// Returns the Result from the last NRO.
|
||||||
Result envGetLastLoadResult(void);
|
Result envGetLastLoadResult(void);
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ static u64 g_syscallHints[2];
|
|||||||
static Handle g_processHandle = INVALID_HANDLE;
|
static Handle g_processHandle = INVALID_HANDLE;
|
||||||
static char* g_nextLoadPath = NULL;
|
static char* g_nextLoadPath = NULL;
|
||||||
static char* g_nextLoadArgv = NULL;
|
static char* g_nextLoadArgv = NULL;
|
||||||
|
static char* g_nroReturnPath=NULL;
|
||||||
static Result g_lastLoadResult = 0;
|
static Result g_lastLoadResult = 0;
|
||||||
static bool g_hasRandomSeed = false;
|
static bool g_hasRandomSeed = false;
|
||||||
static u64 g_randomSeed[2] = { 0, 0 };
|
static u64 g_randomSeed[2] = { 0, 0 };
|
||||||
@ -99,6 +100,10 @@ void envSetup(void* ctx, Handle main_thread, LoaderReturnFn saved_lr)
|
|||||||
g_randomSeed[1] = ent->Value[1];
|
g_randomSeed[1] = ent->Value[1];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EntryType_NroReturnPath:
|
||||||
|
g_nroReturnPath = (char*) ent->Value[0];
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (ent->Flags & EntryFlag_IsMandatory)
|
if (ent->Flags & EntryFlag_IsMandatory)
|
||||||
{
|
{
|
||||||
@ -184,6 +189,19 @@ bool envHasNextLoad(void) {
|
|||||||
return g_nextLoadPath != NULL;
|
return g_nextLoadPath != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result envSetNroReturnPath(const char* path) {
|
||||||
|
if (g_nroReturnPath == NULL)
|
||||||
|
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||||
|
|
||||||
|
strcpy(g_nroReturnPath, path);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool envHasNroReturnPath(void) {
|
||||||
|
return g_nroReturnPath!=NULL;
|
||||||
|
}
|
||||||
|
|
||||||
Result envGetLastLoadResult(void) {
|
Result envGetLastLoadResult(void) {
|
||||||
return g_lastLoadResult;
|
return g_lastLoadResult;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user