2012-06-23 20:08:56 +02:00
|
|
|
#include "Config.h"
|
|
|
|
|
|
|
|
DML_CFG *DMLCfg;
|
|
|
|
|
|
|
|
void ConfigInit( DML_CFG *Cfg )
|
|
|
|
{
|
2012-08-09 02:17:50 +02:00
|
|
|
DMLCfg = (DML_CFG*)malloc( sizeof( DML_CFG ) );
|
2012-06-23 20:08:56 +02:00
|
|
|
|
|
|
|
memset32( DMLCfg, 0, sizeof(DML_CFG) );
|
|
|
|
|
|
|
|
//If a loader supplied any options we use them otherwise use the code defines
|
2012-09-25 13:48:20 +02:00
|
|
|
if( Cfg->Magicbytes == 0xD1050CF6 )
|
2012-06-23 20:08:56 +02:00
|
|
|
{
|
|
|
|
memcpy( DMLCfg, Cfg, sizeof( DML_CFG ) );
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
2012-09-25 13:48:20 +02:00
|
|
|
dbgprintf("No valid config found in RAM\n");
|
2012-06-23 20:08:56 +02:00
|
|
|
dbgprintf("Version:%08X\n", DMLCfg->Version );
|
2012-09-25 13:48:20 +02:00
|
|
|
dbgprintf("Config :%08X\n", DMLCfg->Config );
|
2012-06-23 20:08:56 +02:00
|
|
|
|
|
|
|
DMLCfg->Config = 0;
|
|
|
|
#ifdef CHEATHOOK
|
|
|
|
DMLCfg->Config |= DML_CFG_CHEATS;
|
|
|
|
#endif
|
|
|
|
#ifdef DEBUGGER
|
|
|
|
DMLCfg->Config |= DML_CFG_DEBUGGER;
|
|
|
|
#endif
|
|
|
|
#ifdef DEBUGGERWAIT
|
|
|
|
DMLCfg->Config |= DML_CFG_DEBUGWAIT;
|
|
|
|
#endif
|
|
|
|
#ifdef CARDMODE
|
|
|
|
DMLCfg->Config |= DML_CFG_NMM;
|
|
|
|
#endif
|
|
|
|
#ifdef CARDDEBUG
|
|
|
|
DMLCfg->Config |= DML_CFG_NMM_DEBUG;
|
|
|
|
#endif
|
|
|
|
#ifdef ACTIVITYLED
|
|
|
|
DMLCfg->Config |= DML_CFG_ACTIVITY_LED;
|
|
|
|
#endif
|
|
|
|
#ifdef PADHOOK
|
|
|
|
DMLCfg->Config |= DML_CFG_PADHOOK;
|
|
|
|
#endif
|
|
|
|
DMLCfg->Magicbytes = 0xD1050CF6;
|
2012-09-25 13:48:20 +02:00
|
|
|
DMLCfg->Version = CONFIG_VERSION;
|
|
|
|
DMLCfg->VideoMode = DML_VID_DML_AUTO;
|
2012-06-23 20:08:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//Check if a memcard is inserted in Slot A
|
|
|
|
if( (read32(0xD806800) & 0x1000) == 0x1000 )
|
|
|
|
{
|
|
|
|
DMLCfg->Config &= ~DML_CFG_NMM; // disable NMM
|
|
|
|
}
|
|
|
|
|
|
|
|
dbgprintf("Config:%08X\n", DMLCfg->Config );
|
|
|
|
}
|
|
|
|
|
|
|
|
inline u32 ConfigGetConfig( u32 Config )
|
|
|
|
{
|
|
|
|
return !!(DMLCfg->Config & Config);
|
|
|
|
}
|
2012-11-30 22:46:19 +01:00
|
|
|
inline void ConfigSetConfig( u32 Config )
|
|
|
|
{
|
|
|
|
DMLCfg->Config |= Config;
|
|
|
|
}
|
|
|
|
inline void ConfigClearConfig( u32 Config )
|
|
|
|
{
|
|
|
|
DMLCfg->Config &= ~Config;
|
|
|
|
}
|
2012-06-23 20:08:56 +02:00
|
|
|
u32 ConfigGetVideMode( void )
|
|
|
|
{
|
|
|
|
return DMLCfg->VideoMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
char *ConfigGetGamePath( void )
|
|
|
|
{
|
|
|
|
return DMLCfg->GamePath;
|
|
|
|
}
|
|
|
|
char *ConfigGetCheatPath( void )
|
|
|
|
{
|
|
|
|
return DMLCfg->CheatPath;
|
|
|
|
}
|