From 1a25dfe2794bad96c3f86a34b320704a3d694339 Mon Sep 17 00:00:00 2001 From: fgfemperor Date: Sat, 16 Jan 2010 15:02:01 +0000 Subject: [PATCH] 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 --- Source/Plugins/Plugin_Wiimote/Src/Config.cpp | 20 ++++++++++++++------ Source/Plugins/Plugin_Wiimote/Src/Config.h | 1 + Source/Plugins/Plugin_Wiimote/Src/main.cpp | 3 +++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Source/Plugins/Plugin_Wiimote/Src/Config.cpp b/Source/Plugins/Plugin_Wiimote/Src/Config.cpp index b05658437d..92f40dce51 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/Config.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/Config.cpp @@ -325,12 +325,7 @@ void Config::Load() iniFile.Get(SectionName, "TriggerType", &WiiMoteEmu::WiiMapping[i].TriggerType, 0); } - // Load the IR cursor settings - 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); + Config::LoadIR(); // 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 @@ -342,6 +337,19 @@ void Config::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() { IniFile iniFile; diff --git a/Source/Plugins/Plugin_Wiimote/Src/Config.h b/Source/Plugins/Plugin_Wiimote/Src/Config.h index 063f03e78f..18228d133e 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/Config.h +++ b/Source/Plugins/Plugin_Wiimote/Src/Config.h @@ -26,6 +26,7 @@ struct Config { Config(); void Load(); + void LoadIR(); void Save(); // For dialog sync diff --git a/Source/Plugins/Plugin_Wiimote/Src/main.cpp b/Source/Plugins/Plugin_Wiimote/Src/main.cpp index 848f5289d8..222fb3e532 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/main.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/main.cpp @@ -227,6 +227,9 @@ void Initialize(void *init) WMdisplay = (Display*)g_WiimoteInitialize.hWnd; #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; DEBUG_LOG(WIIMOTE, "ISOId: %08x %s", g_WiimoteInitialize.ISOId, Hex2Ascii(g_WiimoteInitialize.ISOId).c_str());