libnx
Data Structures | Typedefs | Enumerations | Functions
env.h File Reference

Homebrew environment definitions and utilities. More...

#include "../types.h"

Go to the source code of this file.

Data Structures

struct  ConfigEntry
 Structure representing an entry in the homebrew environment configuration. More...
 

Typedefs

typedef void(* LoaderReturnFn) (int result_code)
 Loader return function.
 

Enumerations

enum  { EntryFlag_IsMandatory = (1U<<( 0 )) }
 Entry flags. More...
 
enum  {
  EntryType_EndOfList =0,
  EntryType_MainThreadHandle =1,
  EntryType_NextLoadPath =2,
  EntryType_OverrideHeap =3,
  EntryType_OverrideService =4,
  EntryType_Argv =5,
  EntryType_SyscallAvailableHint =6,
  EntryType_AppletType =7,
  EntryType_AppletWorkaround =8,
  EntryType_StdioSockets =9,
  EntryType_ProcessHandle =10,
  EntryType_LastLoadResult =11
}
 

Functions

void envSetup (void *ctx, Handle main_thread, LoaderReturnFn saved_lr)
 Parses the homebrew loader environment block (internally called). More...
 
Handle envGetMainThreadHandle (void)
 Retrieves the handle to the main thread.
 
bool envIsNso (void)
 Returns true if the application is running as NSO, otherwise NRO.
 
bool envHasHeapOverride (void)
 Returns true if the environment has a heap override.
 
void * envGetHeapOverrideAddr (void)
 Returns the address of the overriden heap.
 
u64 envGetHeapOverrideSize (void)
 Returns the size of the overriden heap.
 
bool envHasArgv (void)
 Returns true if the environment has an argv array.
 
void * envGetArgv (void)
 Returns the pointer to the argv array.
 
bool envIsSyscallHinted (u8 svc)
 Returns whether a syscall is hinted to be available. More...
 
Handle envGetOwnProcessHandle (void)
 Returns the handle to the running homebrew process.
 
LoaderReturnFn envGetExitFuncPtr (void)
 Returns the loader's return function, to be called on program exit.
 
Result envSetNextLoad (const char *path, const char *argv)
 Configures the next homebrew application to load. More...
 
bool envHasNextLoad (void)
 Returns true if the environment supports envSetNextLoad.
 
Result envGetLastLoadResult (void)
 Returns the Result from the last NRO.
 

Detailed Description

Homebrew environment definitions and utilities.

Author
plutoo

Enumeration Type Documentation

anonymous enum
Enumerator
EntryType_EndOfList 

Entry list terminator.

EntryType_MainThreadHandle 

Provides the handle to the main thread.

EntryType_NextLoadPath 

Provides a buffer containing information about the next homebrew application to load.

EntryType_OverrideHeap 

Provides heap override information.

EntryType_OverrideService 

Provides service override information.

EntryType_Argv 

Provides argv.

EntryType_SyscallAvailableHint 

Provides syscall availability hints.

EntryType_AppletType 

Provides APT applet type.

EntryType_AppletWorkaround 

Indicates that APT is broken and should not be used.

EntryType_StdioSockets 

Provides socket-based standard stream redirection information.

EntryType_ProcessHandle 

Provides the process handle.

EntryType_LastLoadResult 

Provides the last load result.

anonymous enum

Entry flags.

Enumerator
EntryFlag_IsMandatory 

Specifies that the entry must be processed by the homebrew application.

Function Documentation

bool envIsSyscallHinted ( u8  svc)

Returns whether a syscall is hinted to be available.

Parameters
svcSyscall number to test.
Returns
true if the syscall is available.
Result envSetNextLoad ( const char *  path,
const char *  argv 
)

Configures the next homebrew application to load.

Parameters
pathPath to the next homebrew application to load (.nro).
argvArgument string to pass.
void envSetup ( void *  ctx,
Handle  main_thread,
LoaderReturnFn  saved_lr 
)

Parses the homebrew loader environment block (internally called).

Parameters
ctxReserved.
main_threadReserved.
saved_lrReserved.