Begin refactoring APT code, many changes to make code a bit more manageable
This commit is contained in:
parent
3a10698964
commit
14cdb5a9d3
@ -45,21 +45,82 @@ typedef enum {
|
|||||||
APP_APPLETCLOSED ///< Applet closed.
|
APP_APPLETCLOSED ///< Applet closed.
|
||||||
} APT_AppStatus;
|
} APT_AppStatus;
|
||||||
|
|
||||||
|
/// APT applet position.
|
||||||
|
typedef enum {
|
||||||
|
APTPOS_NONE = -1, ///< No position specified.
|
||||||
|
APTPOS_APP = 0, ///< Application.
|
||||||
|
APTPOS_APPLIB = 1, ///< Application library (?).
|
||||||
|
APTPOS_SYS = 2, ///< System applet.
|
||||||
|
APTPOS_SYSLIB = 3, ///< System library (?).
|
||||||
|
APTPOS_RESIDENT = 4, ///< Resident applet.
|
||||||
|
} APT_AppletPos;
|
||||||
|
|
||||||
|
typedef u8 APT_AppletAttr;
|
||||||
|
|
||||||
|
/// Create an APT_AppletAttr bitfield from its components.
|
||||||
|
static inline APT_AppletAttr aptMakeAppletAttr(APT_AppletPos pos, bool manualGpuRights, bool manualDspRights)
|
||||||
|
{
|
||||||
|
return (pos&7) | (manualGpuRights ? BIT(3) : 0) | (manualDspRights ? BIT(4) : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// APT query reply.
|
||||||
|
typedef enum {
|
||||||
|
APTREPLY_REJECT = 0,
|
||||||
|
APTREPLY_ACCEPT = 1,
|
||||||
|
APTREPLY_LATER = 2,
|
||||||
|
} APT_QueryReply;
|
||||||
|
|
||||||
/// APT signals.
|
/// APT signals.
|
||||||
typedef enum {
|
typedef enum {
|
||||||
APTSIGNAL_HOMEBUTTON = 1, ///< Home button pressed.
|
APTSIGNAL_NONE = 0, ///< No signal received.
|
||||||
// 2: sleep-mode related?
|
APTSIGNAL_HOMEBUTTON = 1, ///< HOME button pressed.
|
||||||
APTSIGNAL_PREPARESLEEP = 3, ///< Prepare to enter sleep mode.
|
APTSIGNAL_HOMEBUTTON2 = 2, ///< HOME button pressed (again?).
|
||||||
// 4: triggered when ptm:s GetShellStatus() returns 5.
|
APTSIGNAL_SLEEP_QUERY = 3, ///< Prepare to enter sleep mode.
|
||||||
APTSIGNAL_ENTERSLEEP = 5, ///< Enter sleep mode.
|
APTSIGNAL_SLEEP_CANCEL = 4, ///< Triggered when ptm:s GetShellStatus() returns 5.
|
||||||
APTSIGNAL_WAKEUP = 6, ///< Wake from sleep mode.
|
APTSIGNAL_SLEEP_ENTER = 5, ///< Enter sleep mode.
|
||||||
APTSIGNAL_ENABLE = 7, ///< Enable.
|
APTSIGNAL_SLEEP_WAKEUP = 6, ///< Wake from sleep mode.
|
||||||
APTSIGNAL_POWERBUTTON = 8, ///< Power button pressed.
|
APTSIGNAL_SHUTDOWN = 7, ///< Shutdown.
|
||||||
APTSIGNAL_UTILITY = 9, ///< Utility called.
|
APTSIGNAL_POWERBUTTON = 8, ///< POWER button pressed.
|
||||||
APTSIGNAL_SLEEPSYSTEM = 10, ///< System sleeping.
|
APTSIGNAL_POWERBUTTON2 = 9, ///< POWER button cleared (?).
|
||||||
APTSIGNAL_ERROR = 11 ///< Error occurred.
|
APTSIGNAL_TRY_SLEEP = 10, ///< System sleeping (?).
|
||||||
|
APTSIGNAL_ORDERTOCLOSE = 11, ///< Order to close (such as when an error happens?).
|
||||||
} APT_Signal;
|
} APT_Signal;
|
||||||
|
|
||||||
|
/// APT commands.
|
||||||
|
typedef enum {
|
||||||
|
APTCMD_NONE = 0, ///< No command received.
|
||||||
|
APTCMD_WAKEUP = 1, ///< Applet should wake up.
|
||||||
|
APTCMD_REQUEST = 2, ///< Source applet sent us a parameter.
|
||||||
|
APTCMD_RESPONSE = 3, ///< Target applet replied to our parameter.
|
||||||
|
APTCMD_EXIT = 4, ///< Exit (??)
|
||||||
|
APTCMD_MESSAGE = 5, ///< Message (??)
|
||||||
|
APTCMD_HOMEBUTTON_ONCE = 6, ///< HOME button pressed once.
|
||||||
|
APTCMD_HOMEBUTTON_TWICE = 7, ///< HOME button pressed twice (double-pressed).
|
||||||
|
APTCMD_DSP_SLEEP = 8, ///< DSP should sleep (manual DSP rights related?).
|
||||||
|
APTCMD_DSP_WAKEUP = 9, ///< DSP should wake up (manual DSP rights related?).
|
||||||
|
APTCMD_WAKEUP_EXIT = 10, ///< Applet wakes up due to a different applet exiting.
|
||||||
|
APTCMD_WAKEUP_PAUSE = 11, ///< Applet wakes up after being paused through HOME menu.
|
||||||
|
APTCMD_WAKEUP_CANCEL = 12, ///< Applet wakes up due to being cancelled.
|
||||||
|
APTCMD_WAKEUP_CANCELALL = 13, ///< Applet wakes up due to all applets being cancelled.
|
||||||
|
APTCMD_WAKEUP_POWERBUTTON = 14, ///< Applet wakes up due to POWER button being pressed (?).
|
||||||
|
APTCMD_WAKEUP_JUMPTOHOME = 15, ///< Applet wakes up and is instructed to jump to HOME menu (?).
|
||||||
|
APTCMD_SYSAPPLET_REQUEST = 16, ///< Request for sysapplet (?).
|
||||||
|
APTCMD_WAKEUP_LAUNCHAPP = 17, ///< Applet wakes up and is instructed to launch another applet (?).
|
||||||
|
} APT_Command;
|
||||||
|
|
||||||
|
/// APT capture buffer information.
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
u32 size;
|
||||||
|
u32 is3D;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
u32 leftOffset;
|
||||||
|
u32 rightOffset;
|
||||||
|
u32 format;
|
||||||
|
} top, bottom;
|
||||||
|
} aptCaptureBufInfo;
|
||||||
|
|
||||||
/// APT hook types.
|
/// APT hook types.
|
||||||
typedef enum {
|
typedef enum {
|
||||||
APTHOOK_ONSUSPEND = 0, ///< App suspended.
|
APTHOOK_ONSUSPEND = 0, ///< App suspended.
|
||||||
@ -91,11 +152,11 @@ Result aptInit(void);
|
|||||||
/// Exits APT.
|
/// Exits APT.
|
||||||
void aptExit(void);
|
void aptExit(void);
|
||||||
|
|
||||||
/// Opens an APT session.
|
/**
|
||||||
void aptOpenSession(void);
|
* @brief Sends an APT command through IPC, taking care of locking, opening and closing an APT session.
|
||||||
|
* @param aptcmdbuf Pointer to command buffer (should have capacity for at least 16 words).
|
||||||
/// Closes an APT session.
|
*/
|
||||||
void aptCloseSession(void);
|
Result aptSendCommand(u32* aptcmdbuf);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets the app's status.
|
* @brief Sets the app's status.
|
||||||
@ -183,10 +244,11 @@ Result APT_GetLockHandle(u16 flags, Handle* lockHandle);
|
|||||||
/**
|
/**
|
||||||
* @brief Initializes an application's registration with APT.
|
* @brief Initializes an application's registration with APT.
|
||||||
* @param appId ID of the application.
|
* @param appId ID of the application.
|
||||||
* @param eventHandle1 Pointer to output the signal event handle to.
|
* @param attr Attributes of the application.
|
||||||
* @param eventHandle2 Pointer to output the launch and exit event handle to.
|
* @param signalEvent Pointer to output the signal event handle to.
|
||||||
|
* @param resumeEvent Pointer to output the resume event handle to.
|
||||||
*/
|
*/
|
||||||
Result APT_Initialize(NS_APPID appId, Handle* eventHandle1, Handle* eventHandle2);
|
Result APT_Initialize(NS_APPID appId, APT_AppletAttr attr, Handle* signalEvent, Handle* resumeEvent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Terminates an application's registration with APT.
|
* @brief Terminates an application's registration with APT.
|
||||||
@ -199,31 +261,30 @@ Result APT_HardwareResetAsync(void);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Enables APT.
|
* @brief Enables APT.
|
||||||
* @param a Parameter to enable with.
|
* @param attr Attributes of the application.
|
||||||
*/
|
*/
|
||||||
Result APT_Enable(u32 a);
|
Result APT_Enable(APT_AppletAttr attr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets applet management info.
|
* @brief Gets applet management info.
|
||||||
* @param inval Requested applet type.
|
* @param inpos Requested applet position.
|
||||||
* @param outval8 Pointer to output the current applet type to.
|
* @param outpos Pointer to output the position of the current applet to.
|
||||||
* @param outval32 Pointer to output the requested app ID to.
|
* @param req_appid Pointer to output the AppID of the applet at the requested position to.
|
||||||
* @param menu_appid Pointer to output the home menu app ID to.
|
* @param menu_appid Pointer to output the HOME menu AppID to.
|
||||||
* @param active_appid Pointer to output the currently active app ID to.
|
* @param active_appid Pointer to output the AppID of the currently active applet to.
|
||||||
* @param pAttributes Pointer to output the atrributes to.
|
|
||||||
*/
|
*/
|
||||||
Result APT_GetAppletManInfo(u8 inval, u8 *outval8, u32 *outval32, NS_APPID *menu_appid, NS_APPID *active_appid);
|
Result APT_GetAppletManInfo(APT_AppletPos inpos, APT_AppletPos* outpos, NS_APPID* req_appid, NS_APPID* menu_appid, NS_APPID* active_appid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets an applet's information.
|
* @brief Gets an applet's information.
|
||||||
* @param appID ID of the applet.
|
* @param appID AppID of the applet.
|
||||||
* @param pProgramID Pointer to output the program ID to.
|
* @param pProgramID Pointer to output the program ID to.
|
||||||
* @param pMediaType Pointer to output the media type to.
|
* @param pMediaType Pointer to output the media type to.
|
||||||
* @param pRegistered Pointer to output the registration status to.
|
* @param pRegistered Pointer to output the registration status to.
|
||||||
* @param pLoadState Pointer to output the load state to.
|
* @param pLoadState Pointer to output the load state to.
|
||||||
* @param pAttributes Pointer to output the atrributes to.
|
* @param pAttributes Pointer to output the applet atrributes to.
|
||||||
*/
|
*/
|
||||||
Result APT_GetAppletInfo(NS_APPID appID, u64* pProgramID, u8* pMediaType, u8* pRegistered, u8* pLoadState, u32* pAttributes);
|
Result APT_GetAppletInfo(NS_APPID appID, u64* pProgramID, u8* pMediaType, bool* pRegistered, bool* pLoadState, APT_AppletAttr* pAttributes);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets an applet's program information.
|
* @brief Gets an applet's program information.
|
||||||
@ -256,13 +317,13 @@ Result APT_PrepareToJumpToHomeMenu(void);
|
|||||||
* @param Size of the parameter buffer.
|
* @param Size of the parameter buffer.
|
||||||
* @param handle Handle to pass.
|
* @param handle Handle to pass.
|
||||||
*/
|
*/
|
||||||
Result APT_JumpToHomeMenu(const u8 *param, size_t paramSize, Handle handle);
|
Result APT_JumpToHomeMenu(const void* param, size_t paramSize, Handle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Prepares to jump to an application.
|
* @brief Prepares to jump to an application.
|
||||||
* @param a Application to jump to.
|
* @param exiting Specifies whether the applet is exiting.
|
||||||
*/
|
*/
|
||||||
Result APT_PrepareToJumpToApplication(u32 a);
|
Result APT_PrepareToJumpToApplication(bool exiting);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Jumps to an application.
|
* @brief Jumps to an application.
|
||||||
@ -270,14 +331,14 @@ Result APT_PrepareToJumpToApplication(u32 a);
|
|||||||
* @param Size of the parameter buffer.
|
* @param Size of the parameter buffer.
|
||||||
* @param handle Handle to pass.
|
* @param handle Handle to pass.
|
||||||
*/
|
*/
|
||||||
Result APT_JumpToApplication(const u8 *param, size_t paramSize, Handle handle);
|
Result APT_JumpToApplication(const void* param, size_t paramSize, Handle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets whether an application is registered.
|
* @brief Gets whether an application is registered.
|
||||||
* @param appID ID of the application.
|
* @param appID ID of the application.
|
||||||
* @param out Pointer to output the registration state to.
|
* @param out Pointer to output the registration state to.
|
||||||
*/
|
*/
|
||||||
Result APT_IsRegistered(NS_APPID appID, u8* out);
|
Result APT_IsRegistered(NS_APPID appID, bool* out);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Inquires as to whether a signal has been received.
|
* @brief Inquires as to whether a signal has been received.
|
||||||
@ -294,59 +355,75 @@ Result APT_NotifyToWait(NS_APPID appID);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Calls an applet utility function.
|
* @brief Calls an applet utility function.
|
||||||
|
* @param id Utility function to call.
|
||||||
* @param out Pointer to write output data to.
|
* @param out Pointer to write output data to.
|
||||||
* @param a Utility function to call.
|
* @param outSize Size of the output buffer.
|
||||||
* @param size1 Size of the first buffer.
|
* @param in Pointer to the input data.
|
||||||
* @param buf1 First buffer.
|
* @param inSize Size of the input buffer.
|
||||||
* @param size2 Size of the second buffer.
|
|
||||||
* @param buf2 Second buffer.
|
|
||||||
*/
|
*/
|
||||||
Result APT_AppletUtility(u32* out, u32 a, u32 size1, u8* buf1, u32 size2, u8* buf2);
|
Result APT_AppletUtility(int id, void* out, size_t outSize, const void* in, size_t inSize);
|
||||||
|
|
||||||
|
/// Sleeps if shell is closed (?).
|
||||||
|
Result APT_SleepIfShellClosed(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Tries to lock a transition (?).
|
||||||
|
* @param transition Transition ID.
|
||||||
|
* @param succeeded Pointer to output whether the lock was successfully applied.
|
||||||
|
*/
|
||||||
|
Result APT_TryLockTransition(u32 transition, bool* succeeded);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Unlocks a transition (?).
|
||||||
|
* @param transition Transition ID.
|
||||||
|
*/
|
||||||
|
Result APT_UnlockTransition(u32 transition);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Glances at a receieved parameter without removing it from the queue.
|
* @brief Glances at a receieved parameter without removing it from the queue.
|
||||||
* @param appID ID of the application.
|
* @param appID ID of the application.
|
||||||
* @param bufferSize Size of the buffer.
|
|
||||||
* @param buffer Buffer to receive to.
|
* @param buffer Buffer to receive to.
|
||||||
|
* @param bufferSize Size of the buffer.
|
||||||
|
* @param command Pointer to output the command ID to.
|
||||||
* @param actualSize Pointer to output the actual received data size to.
|
* @param actualSize Pointer to output the actual received data size to.
|
||||||
* @param signalType Pointer to output the signal type to.
|
* @param parameter Pointer to output the parameter handle to.
|
||||||
*/
|
*/
|
||||||
Result APT_GlanceParameter(NS_APPID appID, u32 bufferSize, u32* buffer, u32* actualSize, u8* signalType);
|
Result APT_GlanceParameter(NS_APPID appID, void* buffer, size_t bufferSize, APT_Command* command, size_t* actualSize, Handle* parameter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Receives a parameter.
|
* @brief Receives a parameter.
|
||||||
* @param appID ID of the application.
|
* @param appID ID of the application.
|
||||||
* @param bufferSize Size of the buffer.
|
|
||||||
* @param buffer Buffer to receive to.
|
* @param buffer Buffer to receive to.
|
||||||
|
* @param bufferSize Size of the buffer.
|
||||||
|
* @param command Pointer to output the command ID to.
|
||||||
* @param actualSize Pointer to output the actual received data size to.
|
* @param actualSize Pointer to output the actual received data size to.
|
||||||
* @param signalType Pointer to output the signal type to.
|
* @param parameter Pointer to output the parameter handle to.
|
||||||
*/
|
*/
|
||||||
Result APT_ReceiveParameter(NS_APPID appID, u32 bufferSize, u32* buffer, u32* actualSize, u8* signalType);
|
Result APT_ReceiveParameter(NS_APPID appID, void* buffer, size_t bufferSize, APT_Command* command, size_t* actualSize, Handle* parameter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sends a parameter.
|
* @brief Sends a parameter.
|
||||||
* @param src_appID ID of the source application.
|
* @param source ID of the source application.
|
||||||
* @param dst_appID ID of the destination application.
|
* @param dest ID of the destination application.
|
||||||
* @param bufferSize Size of the buffer.
|
* @param command Command to send.
|
||||||
* @param buffer Buffer to send.
|
* @param buffer Buffer to send.
|
||||||
* @param paramhandle Handle to pass.
|
* @param bufferSize Size of the buffer.
|
||||||
* @param signalType Signal type to send.
|
* @param parameter Parameter handle to pass.
|
||||||
*/
|
*/
|
||||||
Result APT_SendParameter(NS_APPID src_appID, NS_APPID dst_appID, u32 bufferSize, u32* buffer, Handle paramhandle, u8 signalType);
|
Result APT_SendParameter(NS_APPID source, NS_APPID dest, APT_Command command, const void* buffer, u32 bufferSize, Handle parameter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sends capture buffer information.
|
* @brief Sends capture buffer information.
|
||||||
* @param bufferSize Size of the buffer to send.
|
* @param captureBuf Capture buffer information to send.
|
||||||
* @param buffer Buffer to send.
|
|
||||||
*/
|
*/
|
||||||
Result APT_SendCaptureBufferInfo(u32 bufferSize, u32* buffer);
|
Result APT_SendCaptureBufferInfo(const aptCaptureBufInfo* captureBuf);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Replies to a sleep query.
|
* @brief Replies to a sleep query.
|
||||||
* @param appID ID of the application.
|
* @param appID ID of the application.
|
||||||
* @param a Parameter to reply with.
|
* @param reply Query reply value.
|
||||||
*/
|
*/
|
||||||
Result APT_ReplySleepQuery(NS_APPID appID, u32 a);
|
Result APT_ReplySleepQuery(NS_APPID appID, APT_QueryReply reply);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Replies that a sleep notification has been completed.
|
* @brief Replies that a sleep notification has been completed.
|
||||||
@ -356,9 +433,9 @@ Result APT_ReplySleepNotificationComplete(NS_APPID appID);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Prepares to close the application.
|
* @brief Prepares to close the application.
|
||||||
* @param a Whether the jump is to the home menu.
|
* @param cancelPreload Whether applet preloads should be cancelled.
|
||||||
*/
|
*/
|
||||||
Result APT_PrepareToCloseApplication(u8 a);
|
Result APT_PrepareToCloseApplication(bool cancelPreload);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Closes the application.
|
* @brief Closes the application.
|
||||||
@ -366,7 +443,7 @@ Result APT_PrepareToCloseApplication(u8 a);
|
|||||||
* @param paramSize Size of param.
|
* @param paramSize Size of param.
|
||||||
* @param handle Handle to pass.
|
* @param handle Handle to pass.
|
||||||
*/
|
*/
|
||||||
Result APT_CloseApplication(const u8 *param, size_t paramSize, Handle handle);
|
Result APT_CloseApplication(const void* param, size_t paramSize, Handle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets the application's CPU time limit.
|
* @brief Sets the application's CPU time limit.
|
||||||
@ -382,22 +459,9 @@ Result APT_GetAppCpuTimeLimit(u32 *percent);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Checks whether the system is a New 3DS.
|
* @brief Checks whether the system is a New 3DS.
|
||||||
* Note: this function is unreliable, see: http://3dbrew.org/wiki/APT:PrepareToStartApplication
|
|
||||||
* @param out Pointer to write the New 3DS flag to.
|
* @param out Pointer to write the New 3DS flag to.
|
||||||
*/
|
*/
|
||||||
Result APT_CheckNew3DS_Application(u8 *out);
|
Result APT_CheckNew3DS(bool* out);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Checks whether the system is a New 3DS.
|
|
||||||
* @param out Pointer to write the New 3DS flag to.
|
|
||||||
*/
|
|
||||||
Result APT_CheckNew3DS_System(u8 *out);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Checks whether the system is a New 3DS.
|
|
||||||
* @param out Pointer to write the New 3DS flag to.
|
|
||||||
*/
|
|
||||||
Result APT_CheckNew3DS(u8 *out);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Prepares for an applicaton jump.
|
* @brief Prepares for an applicaton jump.
|
||||||
@ -405,31 +469,30 @@ Result APT_CheckNew3DS(u8 *out);
|
|||||||
* @param programID ID of the program to jump to.
|
* @param programID ID of the program to jump to.
|
||||||
* @param mediatype Media type of the program to jump to.
|
* @param mediatype Media type of the program to jump to.
|
||||||
*/
|
*/
|
||||||
Result APT_PrepareToDoAppJump(u8 flags, u64 programID, u8 mediatype);
|
Result APT_PrepareToDoApplicationJump(u8 flags, u64 programID, u8 mediatype);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Performs an application jump.
|
* @brief Performs an application jump.
|
||||||
* @param NSbuf0Size Size of NSbuf0Ptr.
|
* @param param Parameter buffer.
|
||||||
* @param NSbuf1Size Size of NSbuf1Ptr.
|
* @param paramSize Size of parameter buffer.
|
||||||
* @param NSbuf0Ptr Launch buffer 0.
|
* @param hmac HMAC buffer (should be 0x20 bytes long).
|
||||||
* @param NSbuf1Ptr Launch buffer 1.
|
|
||||||
*/
|
*/
|
||||||
Result APT_DoAppJump(u32 NSbuf0Size, u32 NSbuf1Size, u8 *NSbuf0Ptr, u8 *NSbuf1Ptr);
|
Result APT_DoApplicationJump(const void* param, size_t paramSize, const void* hmac);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Prepares to start a library applet.
|
* @brief Prepares to start a library applet.
|
||||||
* @param appID ID of the applet to start.
|
* @param appID AppID of the applet to start.
|
||||||
*/
|
*/
|
||||||
Result APT_PrepareToStartLibraryApplet(NS_APPID appID);
|
Result APT_PrepareToStartLibraryApplet(NS_APPID appID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Starts a library applet.
|
* @brief Starts a library applet.
|
||||||
* @param appID ID of the applet to launch.
|
* @param appID AppID of the applet to launch.
|
||||||
* @param inhandle Handle to pass to the applet.
|
* @param param Buffer containing applet parameters.
|
||||||
* @param parambuf Buffer containing applet parameters.
|
* @param paramsize Size of the buffer.
|
||||||
* @param parambufsize Size of parambuf.
|
* @param handle Handle to pass to the applet.
|
||||||
*/
|
*/
|
||||||
Result APT_StartLibraryApplet(NS_APPID appID, Handle inhandle, u32 *parambuf, u32 parambufsize);
|
Result APT_StartLibraryApplet(NS_APPID appID, const void* param, size_t paramSize, Handle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Launches a library applet.
|
* @brief Launches a library applet.
|
||||||
@ -443,18 +506,18 @@ Result APT_LaunchLibraryApplet(NS_APPID appID, Handle inhandle, u32 *parambuf, u
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Prepares to start a system applet.
|
* @brief Prepares to start a system applet.
|
||||||
* @param appID ID of the applet to start.
|
* @param appID AppID of the applet to start.
|
||||||
*/
|
*/
|
||||||
Result APT_PrepareToStartSystemApplet(NS_APPID appID);
|
Result APT_PrepareToStartSystemApplet(NS_APPID appID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Starts a system applet.
|
* @brief Starts a system applet.
|
||||||
* @param appID ID of the applet to launch.
|
* @param appID AppID of the applet to launch.
|
||||||
* @param bufSize Size of the parameter buffer.
|
* @param param Buffer containing applet parameters.
|
||||||
* @param applHandle Handle to pass to the applet.
|
* @param paramSize Size of the parameter buffer.
|
||||||
* @param buf Buffer containing applet parameters.
|
* @param handle Handle to pass to the applet.
|
||||||
*/
|
*/
|
||||||
Result APT_StartSystemApplet(NS_APPID appID, u32 bufSize, Handle applHandle, u8 *buf);
|
Result APT_StartSystemApplet(NS_APPID appID, const void* param, size_t paramSize, Handle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Retrieves the shared system font.
|
* @brief Retrieves the shared system font.
|
||||||
|
@ -16,9 +16,7 @@ Result fontEnsureMapped(void)
|
|||||||
Result res = 0;
|
Result res = 0;
|
||||||
Handle hSharedFont = 0;
|
Handle hSharedFont = 0;
|
||||||
|
|
||||||
aptOpenSession();
|
|
||||||
res = APT_GetSharedFont(&hSharedFont, &sharedFontAddr);
|
res = APT_GetSharedFont(&hSharedFont, &sharedFontAddr);
|
||||||
aptCloseSession();
|
|
||||||
if (R_FAILED(res)) return res;
|
if (R_FAILED(res)) return res;
|
||||||
|
|
||||||
// Map the shared font if it's not already mapped.
|
// Map the shared font if it's not already mapped.
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -31,7 +31,7 @@ static int hidRefCount;
|
|||||||
|
|
||||||
Result hidInit(void)
|
Result hidInit(void)
|
||||||
{
|
{
|
||||||
u8 val=0;
|
bool val=false;
|
||||||
Result ret=0;
|
Result ret=0;
|
||||||
|
|
||||||
if (AtomicPostIncrement(&hidRefCount)) return 0;
|
if (AtomicPostIncrement(&hidRefCount)) return 0;
|
||||||
@ -84,7 +84,7 @@ void hidExit(void)
|
|||||||
if (AtomicDecrement(&hidRefCount)) return;
|
if (AtomicDecrement(&hidRefCount)) return;
|
||||||
|
|
||||||
// Unmap HID sharedmem and close handles.
|
// Unmap HID sharedmem and close handles.
|
||||||
u8 val=0;
|
bool val=false;
|
||||||
int i; for(i=0; i<5; i++)svcCloseHandle(hidEvents[i]);
|
int i; for(i=0; i<5; i++)svcCloseHandle(hidEvents[i]);
|
||||||
svcUnmapMemoryBlock(hidMemHandle, (u32)hidSharedMem);
|
svcUnmapMemoryBlock(hidMemHandle, (u32)hidSharedMem);
|
||||||
svcCloseHandle(hidMemHandle);
|
svcCloseHandle(hidMemHandle);
|
||||||
|
@ -60,12 +60,12 @@ Handle nfcGetSessionHandle(void)
|
|||||||
Result nfcStartScanning(u16 inval)
|
Result nfcStartScanning(u16 inval)
|
||||||
{
|
{
|
||||||
Result ret, ret2;
|
Result ret, ret2;
|
||||||
u8 new3ds_flag = 0;
|
bool new3ds_flag = false;
|
||||||
u8 status;
|
u8 status;
|
||||||
|
|
||||||
APT_CheckNew3DS(&new3ds_flag);
|
APT_CheckNew3DS(&new3ds_flag);
|
||||||
|
|
||||||
if(new3ds_flag==0)
|
if(!new3ds_flag)
|
||||||
{
|
{
|
||||||
ret = NFC_StartCommunication();
|
ret = NFC_StartCommunication();
|
||||||
if(R_FAILED(ret))return ret;
|
if(R_FAILED(ret))return ret;
|
||||||
@ -102,13 +102,13 @@ Result nfcStartScanning(u16 inval)
|
|||||||
|
|
||||||
void nfcStopScanning(void)
|
void nfcStopScanning(void)
|
||||||
{
|
{
|
||||||
u8 new3ds_flag = 0;
|
bool new3ds_flag = false;
|
||||||
|
|
||||||
APT_CheckNew3DS(&new3ds_flag);
|
APT_CheckNew3DS(&new3ds_flag);
|
||||||
|
|
||||||
NFC_StopTagScanning();
|
NFC_StopTagScanning();
|
||||||
|
|
||||||
if(new3ds_flag==0)
|
if(!new3ds_flag)
|
||||||
{
|
{
|
||||||
NFC_StopCommunication();
|
NFC_StopCommunication();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user