mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
73 lines
2.0 KiB
C
73 lines
2.0 KiB
C
#pragma once
|
|
#include "types.h"
|
|
|
|
typedef enum {
|
|
AppletType_None = -2,
|
|
AppletType_Default = -1,
|
|
AppletType_Application = 0,
|
|
AppletType_SystemApplet = 1,
|
|
AppletType_LibraryApplet = 2,
|
|
AppletType_OverlayApplet = 3,
|
|
AppletType_SystemApplication = 4,
|
|
} AppletType;
|
|
|
|
typedef enum {
|
|
AppletOperationMode_Handheld = 0,
|
|
AppletOperationMode_Docked = 1,
|
|
} AppletOperationMode;
|
|
|
|
/// applet hook types.
|
|
typedef enum {
|
|
AppletHookType_OnFocusState = 0, ///< FocusState changed.
|
|
AppletHookType_OnOperationMode, ///< OperationMode changed.
|
|
AppletHookType_OnPerformanceMode, ///< PerformanceMode changed.
|
|
|
|
AppletHookType_Max, ///< Number of applet hook types.
|
|
} AppletHookType;
|
|
|
|
/// applet hook function.
|
|
typedef void (*AppletHookFn)(AppletHookType hook, void* param);
|
|
|
|
/// applet hook cookie.
|
|
typedef struct AppletHookCookie AppletHookCookie;
|
|
|
|
struct AppletHookCookie
|
|
{
|
|
AppletHookCookie* next; ///< Next cookie.
|
|
AppletHookFn callback; ///< Hook callback.
|
|
void* param; ///< Callback parameter.
|
|
};
|
|
|
|
Result appletInitialize(void);
|
|
void appletExit(void);
|
|
Result appletGetAppletResourceUserId(u64 *out);
|
|
|
|
void appletNotifyRunning(u8 *out);
|
|
Result appletCreateManagedDisplayLayer(u64 *out);
|
|
|
|
/**
|
|
* @brief Processes the current applet status. Generally used within a main loop.
|
|
* @return Whether the application should continue running.
|
|
*/
|
|
bool appletMainLoop(void);
|
|
|
|
|
|
/**
|
|
* @brief Sets up an applet status hook.
|
|
* @param cookie Hook cookie to use.
|
|
* @param callback Function to call when applet's status changes.
|
|
* @param param User-defined parameter to pass to the callback.
|
|
*/
|
|
void appletHook(AppletHookCookie* cookie, AppletHookFn callback, void* param);
|
|
|
|
/**
|
|
* @brief Removes an applet status hook.
|
|
* @param cookie Hook cookie to remove.
|
|
*/
|
|
void appletUnhook(AppletHookCookie* cookie);
|
|
|
|
/// These return state which is updated by appletMainLoop() when notifications are received.
|
|
u8 appletGetOperationMode(void);
|
|
u32 appletGetPerformanceMode(void);
|
|
u8 appletGetFocusState(void);
|