Load IR Pointer settings on every game boot, because that's a per-game setting (each game has it's own IR calibration)...

Please ignore previous revision, which is a proof of why late-night coding isn't always a good idea...

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4853 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
fgfemperor
2010-01-16 15:02:01 +00:00
parent e203c80c5d
commit 1a25dfe279
3 changed files with 18 additions and 6 deletions

View File

@ -325,12 +325,7 @@ void Config::Load()
iniFile.Get(SectionName, "TriggerType", &WiiMoteEmu::WiiMapping[i].TriggerType, 0); iniFile.Get(SectionName, "TriggerType", &WiiMoteEmu::WiiMapping[i].TriggerType, 0);
} }
// Load the IR cursor settings Config::LoadIR();
iniFile.Load(FULL_CONFIG_DIR "IR Pointer.ini");
iniFile.Get("Default", "IRLeft", &iIRLeft, LEFT);
iniFile.Get("Default", "IRTop", &iIRTop, TOP);
iniFile.Get("Default", "IRWidth", &iIRWidth, RIGHT - LEFT);
iniFile.Get("Default", "IRHeight", &iIRHeight, BOTTOM - TOP);
// Load a few screen settings to. If these are added to the DirectX plugin it's probably // Load a few screen settings to. If these are added to the DirectX plugin it's probably
// better to place them in the main Dolphin.ini file // better to place them in the main Dolphin.ini file
@ -342,6 +337,19 @@ void Config::Load()
//DEBUG_LOG(WIIMOTE, "Load()"); //DEBUG_LOG(WIIMOTE, "Load()");
} }
void Config::LoadIR()
{
// Load the IR cursor settings if it's avaliable for the GameId, if not load the default settings
IniFile iniFile;
char TmpSection[32];
sprintf(TmpSection, "%s", g_ISOId ? Hex2Ascii(g_ISOId).c_str() : "Default");
iniFile.Load(FULL_CONFIG_DIR "IR Pointer.ini");
iniFile.Get(TmpSection, "IRLeft", &iIRLeft, LEFT);
iniFile.Get(TmpSection, "IRTop", &iIRTop, TOP);
iniFile.Get(TmpSection, "IRWidth", &iIRWidth, RIGHT - LEFT);
iniFile.Get(TmpSection, "IRHeight", &iIRHeight, BOTTOM - TOP);
}
void Config::Save() void Config::Save()
{ {
IniFile iniFile; IniFile iniFile;

View File

@ -26,6 +26,7 @@ struct Config
{ {
Config(); Config();
void Load(); void Load();
void LoadIR();
void Save(); void Save();
// For dialog sync // For dialog sync

View File

@ -227,6 +227,9 @@ void Initialize(void *init)
WMdisplay = (Display*)g_WiimoteInitialize.hWnd; WMdisplay = (Display*)g_WiimoteInitialize.hWnd;
#endif #endif
// Load IR settings, as this is a per-game setting and the user might have loaded a different game
g_Config.LoadIR();
g_ISOId = g_WiimoteInitialize.ISOId; g_ISOId = g_WiimoteInitialize.ISOId;
DEBUG_LOG(WIIMOTE, "ISOId: %08x %s", g_WiimoteInitialize.ISOId, Hex2Ascii(g_WiimoteInitialize.ISOId).c_str()); DEBUG_LOG(WIIMOTE, "ISOId: %08x %s", g_WiimoteInitialize.ISOId, Hex2Ascii(g_WiimoteInitialize.ISOId).c_str());