#pragma once #ifdef __cplusplus extern "C" { #endif #include typedef enum RPXLoaderStatus { RPX_LOADER_RESULT_SUCCESS = 0, RPX_LOADER_RESULT_INVALID_ARGUMENT = -0x01, RPX_LOADER_RESULT_NOT_FOUND = -0x06, RPX_LOADER_RESULT_UNSUPPORTED_API_VERSION = -0x10, RPX_LOADER_RESULT_UNSUPPORTED_COMMAND = -0x11, RPX_LOADER_RESULT_LIB_UNINITIALIZED = -0x20, RPX_LOADER_RESULT_MODULE_NOT_FOUND = -0x30, RPX_LOADER_RESULT_MODULE_MISSING_EXPORT = -0x31, RPX_LOADER_RESULT_NOT_AVAILABLE = -0x40, RPX_LOADER_RESULT_UNKNOWN_ERROR = -0x100, } RPXLoaderStatus; typedef uint32_t RPXLoaderVersion; #define RPX_LOADER_MODULE_VERSION_ERROR 0xFFFFFFFF const char *RPXLoader_GetStatusStr(RPXLoaderStatus status); /** * This function has to be called before any other function of this lib (except RPXLoader_GetVersion) can be used. * * @return RPX_LOADER_RESULT_SUCCESS: The library has been initialized successfully. Other functions can now be used.
* RPX_LOADER_RESULT_MODULE_NOT_FOUND: The module could not be found. Make sure the module is loaded.
* RPX_LOADER_RESULT_MODULE_MISSING_EXPORT: The module is missing an expected export.
* RPX_LOADER_RESULT_UNSUPPORTED_API_VERSION: The version of the loaded module is not compatible with this version of the lib. */ RPXLoaderStatus RPXLoader_InitLibrary(); /** * Deinitializes the RPXLoader lib * @return RPX_LOADER_RESULT_SUCCESS */ RPXLoaderStatus RPXLoader_DeInitLibrary(); /** * Retrieves the API Version of the loaded RPXLoaderModule.
*
* @param outVersion pointer to the variable where the version will be stored. * * @return RPX_LOADER_RESULT_SUCCESS: The API version has been store in the version ptr.
* RPX_LOADER_RESULT_MODULE_NOT_FOUND: The module could not be found. Make sure the module is loaded.
* RPX_LOADER_RESULT_MODULE_MISSING_EXPORT: The module is missing an expected export.
* RPX_LOADER_RESULT_INVALID_ARGUMENT: Invalid version pointer.
* RPX_LOADER_RESULT_UNKNOWN_ERROR: Retrieving the module version failed. */ RPXLoaderStatus RPXLoader_GetVersion(uint32_t *outVersion); /** * Sets the .rpx or .wuhb that will be loaded the next time the homebrew wrapper application is launched (e.g. Health & Safety or Daily Log).
* When a .wuhb will be loaded, accesses to /vol/content will be redirected to the .wuhb, /vol/save will be redirected to the sd card.
*
* The path is **relative** to the root of the sd card
*
* To launch the prepared RPX call RPXLoader_LaunchPreparedHomebrew if this call was successful.
*
* Requires API version 1 or higher.
* * @param path: path to the .rpx/.wuhb that should be loaded. * @return RPX_LOADER_RESULT_SUCCESS: Loading of the next RPX will be redirected.
* RPX_LOADER_RESULT_LIB_UNINITIALIZED: Library was not initialized. Call RPXLoader_InitLibrary() before using this function.
* RPX_LOADER_RESULT_UNSUPPORTED_COMMAND: Command not supported by the currently loaded RPXLoaderModule version.
* RPX_LOADER_RESULT_INVALID_ARGUMENT: Given path was NULL
* RPX_LOADER_RESULT_UNKNOWN_ERROR: Unexpected error.
*/ RPXLoaderStatus RPXLoader_PrepareLaunchFromSD(const char *path); /** * Launches the wrapper app for launching the .rpx/.wuhb that has been set via RPXLoader_PrepareLaunchFromSD
* Works similar similar to the SYSLaunch* functions.
*
* see: `RPXLoader_LaunchHomebrew` to prepare and launch a RPX in one command.
*
* Requires API version 1 or higher.
* * @return RPX_LOADER_RESULT_SUCCESS: App is launching
* RPX_LOADER_RESULT_LIB_UNINITIALIZED: Library was not initialized. Call RPX_LOADER_InitLibrary() before using this function.
* RPX_LOADER_RESULT_UNSUPPORTED_COMMAND: Command not supported by the currently loaded RPXLoaderModule version.
* RPX_LOADER_RESULT_NOT_FOUND: No application that can be used as homebrew wrapper found.
* RPX_LOADER_RESULT_UNKNOWN_ERROR: Unexpected error. */ RPXLoaderStatus RPXLoader_LaunchPreparedHomebrew(); /** * Launches a given .rpx/.wuhb by launching a wrapper application and replacing the RPX on the fly.
* See RPXLoader_PrepareLaunchFromSD for more information.
*
* Note: Combines RPXLoader_PrepareLaunchFromSD and RPXLoader_LaunchPreparedHomebrew.
*
* Requires API version 1 or higher.
* * @param bundle_path path to the .rpx/.wuhb that should be loaded. * @return RPX_LOADER_RESULT_SUCCESS: Requested RPX/WUHB will be launched
* RPX_LOADER_RESULT_LIB_UNINITIALIZED: Library was not initialized. Call RPXLoader_InitLibrary() before using this function.
* RPX_LOADER_RESULT_UNSUPPORTED_COMMAND: Command not supported by the currently loaded RPXLoaderModule version.
* RPX_LOADER_RESULT_INVALID_ARGUMENT: The given path was NULL
* RPX_LOADER_RESULT_NOT_FOUND: No application that can be used as homebrew wrapper found.
* RPX_LOADER_RESULT_UNKNOWN_ERROR: Unexpected error. */ RPXLoaderStatus RPXLoader_LaunchHomebrew(const char *bundle_path); /** * Enables the /vol/content redirection (is enabled by default if a .wuhb is running)
*
* Requires API version 1 or higher.
* * @return RPX_LOADER_RESULT_SUCCESS: /vol/content has been enabled or was already enabled.
* RPX_LOADER_RESULT_LIB_UNINITIALIZED: "RPXLoader_Init()" was not called.
* RPX_LOADER_RESULT_UNKNOWN_ERROR: Error */ RPXLoaderStatus RPXLoader_EnableContentRedirection(); /** * Disables the /vol/content redirection
*
* Requires API version 1 or higher.
* * @return RPX_LOADER_RESULT_SUCCESS: /vol/content has been disabled or was already disabled.
* RPX_LOADER_RESULT_LIB_UNINITIALIZED: "RPXLoader_Init()" was not called.
* RPX_LOADER_RESULT_UNKNOWN_ERROR: Error */ RPXLoaderStatus RPXLoader_DisableContentRedirection(); /** * Unmounts the currently running bundle. This also disables the /vol/content redirection
*
* Requires API version 1 or higher.
* * @return RPX_LOADER_RESULT_SUCCESS: /vol/content has been unmounted or was not previously mounted.
* RPX_LOADER_RESULT_LIB_UNINITIALIZED: "RPXLoader_Init()" was not called.
* RPX_LOADER_RESULT_UNKNOWN_ERROR: Unable to unmount the currently running bundle.
*/ RPXLoaderStatus RPXLoader_UnmountCurrentRunningBundle(); /** * Returns the path of the currently running executable
* This function is not guaranteed to succeed, it only works if the executable is loaded via the RPXLoadingModule
* The returned path is relative to the root of the sd card.
*
* Requires API version 2 or higher.
* * @param outBuffer buffer where the result will be stored * @param outSize size of outBuffer * @return RPX_LOADER_RESULT_SUCCESS: The path of the currently running executable has been written to outBuffer.
* RPX_LOADER_RESULT_UNSUPPORTED_COMMAND: Command not supported by the currently loaded RPXLoaderModule version.
* RPX_LOADER_RESULT_INVALID_ARGUMENT: The given outBuffer was NULL or outSize was 0
* RPX_LOADER_RESULT_LIB_UNINITIALIZED: "RPXLoader_Init()" was not called.
* RPX_LOADER_RESULT_NOT_AVAILABLE: The path is not available.
*/ RPXLoaderStatus RPXLoader_GetPathOfRunningExecutable(char *outBuffer, uint32_t outSize); /** * Returns the path currently used for /vol/save redirection
* This function is not guaranteed to succeed, it only works if the executable is loaded via the RPXLoadingModule
* The returned path is relative to the root of the sd card.
*
* Requires API version 3 or higher.
* * @param outBuffer buffer where the result will be stored * @param outSize size of outBuffer * @return RPX_LOADER_RESULT_SUCCESS: The path of the /vol/save redirection has been written to outBuffer.
* RPX_LOADER_RESULT_UNSUPPORTED_COMMAND: Command not supported by the currently loaded RPXLoaderModule version.
* RPX_LOADER_RESULT_INVALID_ARGUMENT: The given outBuffer was NULL or outSize was 0
* RPX_LOADER_RESULT_LIB_UNINITIALIZED: "RPXLoader_Init()" was not called.
* RPX_LOADER_RESULT_NOT_AVAILABLE: The path is not available.
*/ RPXLoaderStatus RPXLoader_GetPathOfSaveRedirection(char *outBuffer, uint32_t outSize); #ifdef __cplusplus } // extern "C" #endif