env.h
Go to the documentation of this file.
/**
* @file env.h
* @brief Homebrew environment information.
*/
#pragma once
/// System run-flags.
enum {
RUNFLAG_APTWORKAROUND = BIT(0), ///< Use APT workaround.
RUNFLAG_APTREINIT = BIT(1), ///< Reinitialize APT.
RUNFLAG_APTCHAINLOAD = BIT(2), ///< Chainload APT on return.
};
/**
* @brief Gets whether the application was launched from a homebrew environment.
* @return Whether the application was launched from a homebrew environment.
*/
static inline bool envIsHomebrew(void) {
extern void* __service_ptr;
return __service_ptr != NULL;
}
/**
* @brief Retrieves a handle from the environment handle list.
* @param name Name of the handle.
* @return The retrieved handle.
*/
Handle envGetHandle(const char* name);
/**
* @brief Gets the environment-recommended app ID to use with APT.
* @return The APT app ID.
*/
static inline u32 envGetAptAppId(void) {
extern u32 __apt_appid;
return __apt_appid;
}
/**
* @brief Gets the size of the application heap.
* @return The application heap size.
*/
static inline u32 envGetHeapSize(void) {
extern u32 __ctru_heap_size;
return __ctru_heap_size;
}
/**
* @brief Gets the size of the linear heap.
* @return The linear heap size.
*/
static inline u32 envGetLinearHeapSize(void) {
extern u32 __ctru_linear_heap_size;
return __ctru_linear_heap_size;
}
/**
* @brief Gets the environment argument list.
* @return The argument list.
*/
static inline const char* envGetSystemArgList(void) {
extern const char* __system_arglist;
return __system_arglist;
}
/**
* @brief Gets the environment run flags.
* @return The run flags.
*/
static inline u32 envGetSystemRunFlags(void) {
extern u32 __system_runflags;
return __system_runflags;
}
envGetSystemArgList
static const char * envGetSystemArgList(void)
Gets the environment argument list.
Definition: env.h:61
envGetAptAppId
static u32 envGetAptAppId(void)
Gets the environment-recommended app ID to use with APT.
Definition: env.h:34
envIsHomebrew
static bool envIsHomebrew(void)
Gets whether the application was launched from a homebrew environment.
Definition: env.h:18
RUNFLAG_APTREINIT
@ RUNFLAG_APTREINIT
Reinitialize APT.
Definition: env.h:10
RUNFLAG_APTCHAINLOAD
@ RUNFLAG_APTCHAINLOAD
Chainload APT on return.
Definition: env.h:11
RUNFLAG_APTWORKAROUND
@ RUNFLAG_APTWORKAROUND
Use APT workaround.
Definition: env.h:9
envGetHeapSize
static u32 envGetHeapSize(void)
Gets the size of the application heap.
Definition: env.h:43
envGetSystemRunFlags
static u32 envGetSystemRunFlags(void)
Gets the environment run flags.
Definition: env.h:70
envGetHandle
Handle envGetHandle(const char *name)
Retrieves a handle from the environment handle list.
envGetLinearHeapSize
static u32 envGetLinearHeapSize(void)
Gets the size of the linear heap.
Definition: env.h:52
BIT
#define BIT(n)
Creates a bitmask from a bit number.
Definition: types.h:47
Handle
u32 Handle
Resource handle.
Definition: types.h:41
u32
uint32_t u32
32-bit unsigned integer
Definition: types.h:23