

#include <nitro/os.h>u32 OS_GetConsoleType( void );
None.
A u32-type value that depends on the program's execution environment. Details are provided in Description.
Returns a u32-type value that represents the program's execution environment.
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_GetConsoleType 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 the NTR as well as the TWL. The program is running in NTR mode in either case, but the hardware it is running on is different (NTR or TWL).
・The
OS_IsRunOnTwlfunction tells you whether the application is running in NTR mode or TWL mode. However, it will not tell you which hardware the application is running on.
With theOS_GetConsoleTypefunction, you can find out whether the application is running on NTR or TWL. However, it will not tell you what the operating mode is.
(Also, if the FINALROM build of a NITRO-only ROM is run on a TWL, it will return a value that indicates the software is running on NTR.))
The first time it is called, the OS_GetConsoleType function surveys the devices, memory, and other information to determine its return value, but in subsequent calls, it just returns the same value it returned earlier. As a result, there is hardly any overhead in calling this function.
This function's return values are limited in the FINALROM libraries. When running these builds on something other than the production hardware (such as the debugger), values may be returned that represent environments other than the one being used.
There is a similar function called OS_GetRunningConsoleType. This function is different in that it surveys the actual hardware and returns the appropriate value, even for FINALROM builds.
For example, this difference can be seen by running a TWL FINALROM build on IS-TWL-DEBUGGER. The IS-TWL-DEBUGGER hardware has 32 MB of built-in memory, so the value returned by the OS_GetRunningConsoleType function & OS_CONSOLE_SIZE_MASK is OS_CONSOLE_SIZE_32MB, and the value returned by the OS_GetConsoleType function & OS_CONSOLE_SIZE_MASK is OS_CONSOLE_SIZE_16MB.
If either of these functions for getting the operating environment are 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 is 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 in 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.
Operating environment:
The bitwise AND of the return value andOS_CONSOLE_MASKyield the following values depending on the operating environment.
For *1, where the function has determined that the application is running on an actual TWL system, the values are further refined based on the bitwise AND in combination with
Value Operating Environment OS_CONSOLE_TWLRunning on TWL hardware (*1) OS_CONSOLE_NITRORunning on NITRO hardware OS_CONSOLE_TWLDEBUGGERRunning on IS-TWL-DEBUGGER (*2) OS_CONSOLE_ISDEBUGGERRunning on IS-NITRO-DEBUGGER OS_CONSOLE_ENSATARunning on Ensata NITRO Software Emulator OS_CONSOLE_TWLTYPE_MASK.
That said, you do not normally have to give consideration toOS_CONSOLE_TWLTYPE_DEV. Based solely uponOS_CONSOLE_TWL, you can treat the hardware as an actual TWL system.
When using TWL debugger without connecting to debugger software, the operating environment isOS_CONSOLE_TWLand the TWL hardware type isOS_CONSOLE_TWLTYPE_DEV.
However, when using NITRO debugger without connecting to debugger software, the operating environment isOS_CONSOLE_IS_DEBUGGER(which is no different from being connected to debugger software).
Value TWL Hardware Types OS_CONSOLE_TWLTYPE_RETAILTWL retail hardware OS_CONSOLE_TWLTYPE_DEVTWL hardware with a different security key for development purposes / Also indicates no connection to TWL debugger software
For *2, where the function has determined that the application is running on IS-TWL-DEBUGGER, the values are further refined based on the bitwise AND in combination withOS_CONSOLE_BOARD_MASK.
Value IS-TWL-DEBUGGER Types OS_CONSOLE_BOARD_A9_A7Debugger that supports both the ARM9 and ARM7, for component development OS_CONSOLE_BOARD_A9ARM9-only debugger, for application development
Devices for Loading Programs:
The bitwise AND of the return value andOS_CONSOLE_DEV_MASKyield the following values depending on the device loading the program data.
Value Load Device OS_CONSOLE_DEV_CARDLoad from a Game Card device OS_CONSOLE_DEV_CARTRIDGELoad from a Game Pak (*3) OS_CONSOLE_DEV_NANDLoad from NAND OS_CONSOLE_DEV_SDCARDLoad from an SD Card OS_CONSOLE_DEV_MEMORYLoad from memory OS_CONSOLE_DEV_DOWNLOADLoad from a download
*3 The TWL system does not include a Game Pak slot, so this value cannot be obtained on the TWL platform.
Memory Size:
The bitwise AND of the return value andOS_CONSOLE_SIZE_MASKtakes the following values depending on the size of the implemented memory.
Value Main Memory Size OS_CONSOLE_SIZE_4MB4 MB OS_CONSOLE_SIZE_8MB8 MB OS_CONSOLE_SIZE_16MB16 MB OS_CONSOLE_SIZE_32MB32 MB
If a NITRO-only ROM is run on TWL hardware, the memory size is 4 MB, regardless of the build type.
The table below indicates the values that can be obtained with the OS_GetConsoleType and OS_GetRunningConsoleType functions. The logical sum (bitwise OR) of the items in the table is the value obtained. OS_CONSOLE_DEV_xxx is the value of the device that actually loaded the ROM data.
| For NITRO Mode | ||||
|---|---|---|---|---|
| Operating Environment | Build | Value of the OS_GetConsoleType Function |
Value of the OS_GetRunningConsoleType Function |
Comments |
| NTR system | DEBUG RELEASE |
OS_CONSOLE_NITRO OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_4MB |
OS_CONSOLE_NITRO OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_4MB |
All 4 are the same. |
| FINALROM | OS_CONSOLE_NITRO OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_4MB |
OS_CONSOLE_NITRO OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_4MB |
||
| TWL system | DEBUG RELEASE |
OS_CONSOLE_TWL OS_CONSOLE_TWLTYPE_RETAIL OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_4MB |
OS_CONSOLE_TWL OS_CONSOLE_TWLTYPE_RETAIL OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_4MB |
The only difference is the OS_GetConsoleType functionfor FINALROM builds. The amount of built-in memory is 4 MB, regardless of the build. |
| FINALROM | OS_CONSOLE_NITRO OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_4MB |
OS_CONSOLE_TWL OS_CONSOLE_TWLTYPE_RETAIL OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_4MB |
||
| IS-NITRO-DEBUGGER (debugger software even if not connected) |
DEBUG RELEASE |
OS_CONSOLE_ISDEBUGGER OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_8MB |
OS_CONSOLE_ISDEBUGGER OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_8MB |
The only difference is the OS_GetConsoleType functionfor FINALROM builds. |
| FINALROM | OS_CONSOLE_NITRO OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_4MB |
OS_CONSOLE_ISDEBUGGER OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_8MB |
||
| ENSATA EMULATOR | DEBUG RELEASE |
OS_CONSOLE_ISDEBUGGER OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_8MB |
OS_CONSOLE_ISDEBUGGER OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_8MB |
The only difference is the OS_GetConsoleType functionfor FINALROM builds. |
| FINALROM | OS_CONSOLE_NITRO OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_4MB |
OS_CONSOLE_ISDEBUGGER OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_8MB |
||
| IS-TWL-DEBUGGER (For general-purpose development: ARM9) |
DEBUG RELEASE |
OS_CONSOLE_TWLDEBUGGER OS_CONSOLE_BOARD_A9 OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_32MB |
OS_CONSOLE_TWLDEBUGGER OS_CONSOLE_BOARD_A9 OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_32MB |
The only difference is the OS_GetConsoleType functionfor FINALROM builds. |
| FINALROM | OS_CONSOLE_NITRO OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_4MB |
OS_CONSOLE_TWLDEBUGGER OS_CONSOLE_BOARD_A9 OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_32MB |
||
| IS-TWL-DEBUGGER (For component development: ARM9 + ARM7) |
DEBUG RELEASE |
OS_CONSOLE_TWLDEBUGGER OS_CONSOLE_BOARD_A9_A7 OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_32MB |
OS_CONSOLE_TWLDEBUGGER OS_CONSOLE_BOARD_A9_A7 OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_32MB |
The only difference is the OS_GetConsoleType functionfor FINALROM builds. |
| FINALROM | OS_CONSOLE_NITRO OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_4MB |
OS_CONSOLE_TWLDEBUGGER OS_CONSOLE_BOARD_A9_A7 OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_32MB |
||
| IS-TWL-DEBUGGER (For general-purpose development: ARM9) When not connected to debugger software |
DEBUG RELEASE |
OS_CONSOLE_TWL OS_CONSOLE_TWLTYPE_DEV OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_4MB |
OS_CONSOLE_TWL OS_CONSOLE_TWLTYPE_DEV OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_4MB |
The only difference is the OS_GetConsoleType functionfor FINALROM builds. The amount of built-in memory is 4 MB, regardless of the build. |
| FINALROM | OS_CONSOLE_NITRO OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_4MB |
OS_CONSOLE_TWL OS_CONSOLE_TWLTYPE_DEV OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_4MB |
||
| IS-TWL-DEBUGGER (For component development: ARM9 + ARM7) When not connected to debugger software |
DEBUG RELEASE |
OS_CONSOLE_TWL OS_CONSOLE_TWLTYPE_DEV OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_4MB |
OS_CONSOLE_TWL OS_CONSOLE_TWLTYPE_DEV OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_4MB |
The only difference is the OS_GetConsoleType functionfor FINALROM builds. The amount of built-in memory is 4 MB, regardless of the build. |
| FINALROM | OS_CONSOLE_NITRO OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_4MB |
OS_CONSOLE_TWL OS_CONSOLE_TWLTYPE_DEV7 OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_4MB |
||
| For TWL Mode | ||||
| Operating Environment | Build | Value of the OS_GetConsoleType Function |
Value of the OS_GetRunningConsoleType Function |
Comments |
| TWL system | DEBUG RELEASE |
OS_CONSOLE_TWL OS_CONSOLE_TWLTYPE_RETAIL OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_16MB |
OS_CONSOLE_TWL OS_CONSOLE_TWLTYPE_RETAIL OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_16MB |
All 4 are the same. |
| FINALROM | OS_CONSOLE_TWL OS_CONSOLE_TWLTYPE_RETAIL OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_16MB |
OS_CONSOLE_TWL OS_CONSOLE_TWLTYPE_RETAIL OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_16MB |
||
| IS-TWL-DEBUGGER (For general-purpose development: ARM9) |
DEBUG RELEASE |
OS_CONSOLE_TWLDEBUGGER OS_CONSOLE_BOARD_A9 OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_32MB |
OS_CONSOLE_TWLDEBUGGER OS_CONSOLE_BOARD_A9 OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_32MB |
The only difference is the OS_GetConsoleType functionfor FINALROM builds. |
| FINALROM | OS_CONSOLE_TWL OS_CONSOLE_TWLTYPE_RETAIL OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_16MB |
OS_CONSOLE_TWLDEBUGGER OS_CONSOLE_BOARD_A9 OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_32MB |
||
| IS-TWL-DEBUGGER (For component development: ARM9 + ARM7) |
DEBUG RELEASE |
OS_CONSOLE_TWLDEBUGGER OS_CONSOLE_BOARD_A9_A7 OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_32MB |
OS_CONSOLE_TWLDEBUGGER OS_CONSOLE_BOARD_A9_A7 OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_32MB |
The only difference is the OS_GetConsoleType functionfor FINALROM builds. |
| FINALROM | OS_CONSOLE_TWL OS_CONSOLE_TWLTYPE_RETAIL OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_16MB |
OS_CONSOLE_TWLDEBUGGER OS_CONSOLE_BOARD_A9_A7 OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_32MB |
||
| IS-TWL-DEBUGGER (For general-purpose development: ARM9) When not connected to debugger software |
DEBUG RELEASE |
OS_CONSOLE_TWL OS_CONSOLE_TWLTYPE_DEV OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_32MB |
OS_CONSOLE_TWL OS_CONSOLE_TWLTYPE_DEV OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_32MB |
The only difference is the OS_GetConsoleType functionfor FINALROM builds. |
| FINALROM | OS_CONSOLE_TWL OS_CONSOLE_TWLTYPE_RETAIL OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_16MB |
OS_CONSOLE_TWL OS_CONSOLE_TWLTYPE_DEV OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_32MB |
||
| IS-TWL-DEBUGGER (For component development: ARM9 + ARM7) When not connected to debugger software |
DEBUG RELEASE |
OS_CONSOLE_TWL OS_CONSOLE_TWLTYPE_DEV OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_32MB |
OS_CONSOLE_TWL OS_CONSOLE_TWLTYPE_DEV OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_32MB |
The only difference is the OS_GetConsoleType functionfor FINALROM builds. |
| FINALROM | OS_CONSOLE_TWL OS_CONSOLE_TWLTYPE_RETAIL OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_16MB |
OS_CONSOLE_TWL OS_CONSOLE_TWLTYPE_DEV OS_CONSOLE_DEV_xxx OS_CONSOLE_SIZE_32MB |
||
Identifying the Operating Environment in NITRO Mode
When running in NITRO mode, it is impossible to determine whether hardware is NTR or TWL using just the OS_GetConsoleType function. Although the distinction can be made by checking the value of the OS_GetRunningConsoleType function, Nintendo prefers that developers only use the OS_GetRunningConsoleType function for debugging purposes. Although there is usually no need to know which hardware system is running, the OSi_IsNitroModeOnTwl function has been prepared in case you need to identify the system. If this function returns TRUE, it will indicate that a NITRO-mode ROM is running on TWL.
The OSi_IsNitroModeOnTwl function, which includes TWL in its name, was originally handled as private when TWL development first began. This was based on the reasoning that the OSi_IsNitroModeOnTwl function should be used for limited purposes, and that NITRO developers were not familiar with TWL. This function is still private.
OS_IsRunOnDebugger
OS_IsRunOnEmulator
OS_GetRunningConsoleType
2009/10/30 Added information about operation when a debugger is not connected. Revised operating environment identification in NITRO mode.
2008/04/15 Split up tables according to the mode.
2008/03/27 Added actual values dependent on the environment and build.
2007/11/16 Added descriptions.
2007/11/05 Migrated to the OS_GetRunningConsoleType function.
CONFIDENTIAL