OSGetTitleStatus

Syntax


#include <revolution/discnand.h>

#define OSTITLE_STATUS_UNKNOWN      0
#define OSTITLE_STATUS_INSTALLED    1
#define OSTITLE_STATUS_NOEXISTS     2
#define OSTITLE_STATUS_DELETED      3
#define OSTITLE_STATUS_SAVEONLY     4
#define OSTITLE_STATUS_NORIGHTS     5
#define OSTITLE_STATUS_PARTIAL      6
#define OSTITLE_STATUS_FATAL        7

BOOL OSGetTitleStatus(OSTitleId titleId, u32* status, void* buffer, u32* bufferSize);

Arguments

titleId Title ID of the NAND application whose status you want to get.
status Status of the application indicated by OSTITLE_STATUS_*.
buffer Address of the temporary buffer used to get the status. This address of this buffer must be aligned to 32 bytes. If NULL is specified, a buffer is not used.
bufferSize When NULL has been passed to buffer, the required size of the temporary buffer is stored in *bufSize. If a buffer address has been passed to buffer (that is, it is not NULL), the value of *bufSize is treated as the upper limit for the temporary buffer used inside the function. After the buffer is finished being used, it can be released.

Return Values

Returns OSTITLE_RESULT_OK when the process has ended normally. Returns OSTITLE_RESULT_ALLOC_FAILED if the temporary buffer is not large enough. Returns OSTITLE_RESULT_OPERATION if the process does not end normally.

Description

Gets the status for the NAND application specified by the title ID.
The application status is defined with the following macro constants.

OSTITLE_STATUS_UNKNOWN Cannot get the status. This is returned while still in the process of getting the actual status, and when the process fails.
OSTITLE_STATUS_INSTALLED Installed in an executable state.
OSTITLE_STATUS_NOEXISTS Never been installed.
OSTITLE_STATUS_DELETED Deleted from the Wii Menu (there is evidence of a past installation).
OSTITLE_STATUS_SAVEONLY Only the channel has been deleted from the Wii Menu, and save data remains.
OSTITLE_STATUS_NORIGHTS Installed, but this application does not have the right to execute it.
OSTITLE_STATUS_PARTIAL Partially installed.
OSTITLE_STATUS_FATAL Fatal state, possibly because content that should exist is not present.

Normal NAND applications do not return these three status states: OSTITLE_STATUS_NORIGHTS, OSTITLE_STATUS_PARTIAL, and OSTITLE_STATUS_FATAL.

Getting the OSTITLE_STATUS_INSTALLED state, which is the status for a normal installation, requires the temporary buffer used inside the library. If the size of the temporary buffer is unknown, use the following procedure to get the status.

  1. Call this function with NULL specified for the third argument, buffer. When this is done, the necessary size for the buffer gets stored to the memory region indicated by the fourth argument, bufferSize.
  2. If the buffer size that gets stored here is non-zero, allocate a memory region larger than this size.
    If zero is stored here for the buffer size, quit the process if the application status stored in the second argument, status, is not OSTITLE_STATUS_UNKNOWN.
    Otherwise, you can proceed, but be sure that the returned buffer size is zero. When that is the case, pass NULL for the buffer address.
  3. Now call the function again, this time with the starting address of the allocated memory (or NULL) specified for the buffer argument.
  4. The status of the application is written to the status argument.

The maximum size of the temporary buffer is several KB, compared to the several hundred bytes of a normal NAND application (basically, an application that has not been updated to a newer version).

See Also

OSIsTitleInstalled

Revision History

2009/10/16 Changed the include file.
2007/07/18 Initial version.


CONFIDENTIAL