#include <nitro/os.h>
u32 OS_GetRunningConsoleType( void );
None.
A u32
-type value that depends on the program's execution environment. Details are provided in Description.
Returns a u32
-type value which indicates the environment in which the program is executing.
This function is an effective way to automatically switch processes depending on the operating environment. It allows you to create a common program for multiple operating environments.
OS_GetRunningConsoleType
is a function for getting the operating environment, not a function for finding out the operating mode. Use the OS_IsRunOnTwl
function to find out the operating mode. For example, games for NTR can be played on NTR as well as TWL. The program is running in NTR mode in either case, but the hardware it is running on is different (NTR or TWL).
The first time it is called, the OS_GetRunningConsoleType
function will survey the devices, memory, and other information to determine its return value, but in subsequent calls, it will just return the same value it returned earlier. As a result, there is hardly any overhead in calling this function.
There is a similar function called OS_GetConsoleType
. This will return a value with FINALROM builds that always indicates an actual console, as opposed to a debugger or emulator. In contrast, the OS_GetRunningConsoleType
function will actually determine the hardware configuration and return the appropriate value, even for FINALROM builds.
If either of these functions for getting the operating environment is being left in a FINALROM build, it would be safer to use the OS_GetConsoleType
function instead of the OS_GetRunningConsoleType
function. The reason is this: Thinking ahead to when this platform has become a retail product, the final ROM should only be running on the production hardware, so we want to eliminate the chances of a value that should never occur on the retail product (such as "operating environment is the debugger") being returned. With that in mind, it would probably be best to limit your use of the OS_GetRunningConsoleType
function to debugging purposes.
Values That Can Be Obtained
Actual Values Due to the Environment or Build
Identifying the Operating Environment in NITRO Mode
For this information, see the explanations for the OS_GetConsoleType
function.
OS_IsRunOnEmulator
OS_GetConsoleType
2007/11/05 Migrated from the OS_GetConsoleType
function.
2007/10/29 Added information about values under the TWL environment.
2004/10/12 Described that a constant is returned in the FINALROM version.
2004/08/17 Standardized the notation used for IS-NITRO-EMULATOR.
2004/06/08 Initial version.
CONFIDENTIAL