From 16f71a77e76499ff92953d49bb3c7b8388645e3a Mon Sep 17 00:00:00 2001 From: "j4ck.fr0st" Date: Mon, 18 Jan 2010 20:46:23 +0000 Subject: [PATCH] Revised r4853, config default settings will be used for games that do not have IR Pointer settings yet (falling back to hardcoded values if even those are missing) Fixes issue 2045 git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4882 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Plugins/Plugin_Wiimote/Src/Config.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Source/Plugins/Plugin_Wiimote/Src/Config.cpp b/Source/Plugins/Plugin_Wiimote/Src/Config.cpp index 92f40dce51..09a6058e14 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/Config.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/Config.cpp @@ -342,12 +342,21 @@ 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]; + int defaultLeft, defaultTop, defaultWidth, defaultHeight; + 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); + //Load defaults first... + iniFile.Get("Default", "IRLeft", &defaultLeft, LEFT); + iniFile.Get("Default", "IRTop", &defaultTop, TOP); + iniFile.Get("Default", "IRWidth", &defaultWidth, RIGHT - LEFT); + iniFile.Get("Default", "IRHeight", &defaultHeight, BOTTOM - TOP); + //...and fall back to them if the GameId is not found. + //It shouldn't matter if we read Default twice, its in memory anyways. + iniFile.Get(TmpSection, "IRLeft", &iIRLeft, defaultLeft); + iniFile.Get(TmpSection, "IRTop", &iIRTop, defaultTop); + iniFile.Get(TmpSection, "IRWidth", &iIRWidth, defaultWidth); + iniFile.Get(TmpSection, "IRHeight", &iIRHeight, defaultHeight); } void Config::Save()