#include <nitro/os.h>
u32 OS_GetConsoleType( void );
None.
A type u32
value that depends on the program's execution environment. Details are provided in the Description section above.
Returns a type u32
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.
The function examines and identifies devices, memory, and other factors when it is called the first time; but on subsequent calls, it returns the same value that was previously returned. However, in the latest ROM version library (FINALROM
), it always returns constant OS_CONSOLE_NITRO | OS_CONSOLE_DEV_CARD | OS_CONSOLE_SIZE_4MB
)
Performing an AND operation on the return value and OS_CONSOLE_MASK
results in a value that depends on the operating environment in which the program is running:
OS_CONSOLE_ENSATA |
Running on ensata NITRO Software Emulator |
OS_CONSOLE_ISEMULATOR |
Running on the TEG version of IS-NITRO-EMULATOR |
OS_CONSOLE_ISDEBUGGER |
Running on IS-NITRO-DEBUGGER |
OS_CONSOLE_NITRO |
Running on an actual NITRO console |
Performing an AND operation on the return value and OS_CONSOLE_DEV_MASK
results in a value that depends on the device that reads the Game Card data:
OS_CONSOLE_DEV_CARD |
Load from a Game Card device |
OS_CONSOLE_DEV_CARTRIDGE |
Load from a Game Pak |
Performing an AND operation on the return value and OS_CONSOLE_SIZE_MASK
results in a value that depends on the size of the implemented memory:
OS_CONSOLE_SIZE_4MB |
4MByte |
OS_CONSOLE_SIZE_8MB |
8MByte |
Example:
switch( OS_GetConsoleType() & OS_CONSOLE_MASK ) case OS_CONSOLE_ENSATA: OS_Printf( "running on ENSATA" ); break; case OS_CONSOLE_ISEMULATOR: OS_Printf( "running on IS-NITRO-EMULATOR" ); break; case OS_CONSOLE_ISDEBUGGER: OS_Printf( "running on IS-NITRO-DEBUGGER" ); break; case OS_CONSOLE_NITRO: OS_Printf( "running on retailed NITRO" ); break;
10/12/2004 Explained the constants returned with FINALROM version.
08/17/2004 Standardized the notation of IS-NITRO-EMULATOR.
06/08/2004 Initial version.