From ae81c01449914e0dc6a19ed136f2f1fd8ea9d099 Mon Sep 17 00:00:00 2001
From: John Peterson <jpeterson57@gmail.com>
Date: Thu, 26 Feb 2009 00:35:17 +0000
Subject: [PATCH] Emulated Wiimote: Moved the IR Pointer settings to a separate
 'IR Pointer.ini' file. Also moved the 'WiimoteMovement.ini' file to the
 /User/Config dir.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2440 8ced0084-cf51-0410-be5f-012b33b47a6e
---
 Source/Plugins/Plugin_Wiimote/Src/Config.cpp  | 43 ++++++++++++-------
 .../Plugin_Wiimote/Src/ConfigRecording.cpp    | 10 ++---
 Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp |  2 +-
 3 files changed, 33 insertions(+), 22 deletions(-)

diff --git a/Source/Plugins/Plugin_Wiimote/Src/Config.cpp b/Source/Plugins/Plugin_Wiimote/Src/Config.cpp
index d85476ef4b..bb499a5f5b 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/Config.cpp
+++ b/Source/Plugins/Plugin_Wiimote/Src/Config.cpp
@@ -68,14 +68,6 @@ void Config::Load(bool ChangePad)
 	iniFile.Get("Real", "AccNunNeutralY", &iAccNunNeutralY, 0);
 	iniFile.Get("Real", "AccNunNeutralZ", &iAccNunNeutralZ, 0);
 
-	// Load the IR cursor settings if it's avaliable, if not load the default settings
-	std::string TmpSection;
-	if (g_ISOId) TmpSection = Hex2Ascii(g_ISOId); else TmpSection = "Emulated";
-	iniFile.Get(TmpSection.c_str(), "IRLeft", &iIRLeft, LEFT);
-	iniFile.Get(TmpSection.c_str(), "IRTop", &iIRTop, TOP);
-	iniFile.Get(TmpSection.c_str(), "IRWidth", &iIRWidth, RIGHT - LEFT);
-	iniFile.Get(TmpSection.c_str(), "IRHeight", &iIRHeight, BOTTOM - TOP);
-
 	// Default controls
 		int WmA = 65, WmB = 66,
 			Wm1 = 49, Wm2 = 50,
@@ -199,6 +191,18 @@ void Config::Load(bool ChangePad)
 	}
 	// =============================
 
+	// ==================================================================
+	// Load the IR cursor settings if it's avaliable, if not load the default settings
+	// �����������������
+	iniFile.Load(FULL_CONFIG_DIR "IR Pointer.ini");
+	std::string TmpSection;
+	if (g_ISOId) TmpSection = Hex2Ascii(g_ISOId); else TmpSection = "Emulated";
+	iniFile.Get(TmpSection.c_str(), "IRLeft", &iIRLeft, LEFT);
+	iniFile.Get(TmpSection.c_str(), "IRTop", &iIRTop, TOP);
+	iniFile.Get(TmpSection.c_str(), "IRWidth", &iIRWidth, RIGHT - LEFT);
+	iniFile.Get(TmpSection.c_str(), "IRHeight", &iIRHeight, BOTTOM - TOP);
+	// =============================
+
 	// ==================================================================
 	/* 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 */
@@ -231,14 +235,6 @@ void Config::Save(int Slot)
 	iniFile.Set("Real", "AccNunNeutralY", iAccNunNeutralY);
 	iniFile.Set("Real", "AccNunNeutralZ", iAccNunNeutralZ);
 
-	// Save the IR cursor settings if it's avaliable, if not save the default settings
-	std::string TmpSection;
-	if (g_ISOId) TmpSection = Hex2Ascii(g_ISOId); else TmpSection = "Emulated";
-	iniFile.Set(TmpSection.c_str(), "IRLeft", iIRLeft);
-	iniFile.Set(TmpSection.c_str(), "IRTop", iIRTop);
-	iniFile.Set(TmpSection.c_str(), "IRWidth", iIRWidth);
-	iniFile.Set(TmpSection.c_str(), "IRHeight", iIRHeight);
-
 	for (int i = 0; i < 1; i++)
 	{
 		// ==================================================================
@@ -341,5 +337,20 @@ void Config::Save(int Slot)
 	}
 
     iniFile.Save(FULL_CONFIG_DIR "Wiimote.ini");
+
+	// ==================================================================
+	// Save the IR cursor settings if it's avaliable, if not save the default settings
+	// �����������������
+	iniFile.Load(FULL_CONFIG_DIR "IR Pointer.ini");
+	std::string TmpSection;
+	if (g_ISOId) TmpSection = Hex2Ascii(g_ISOId); else TmpSection = "Emulated";
+	iniFile.Set(TmpSection.c_str(), "IRLeft", iIRLeft);
+	iniFile.Set(TmpSection.c_str(), "IRTop", iIRTop);
+	iniFile.Set(TmpSection.c_str(), "IRWidth", iIRWidth);
+	iniFile.Set(TmpSection.c_str(), "IRHeight", iIRHeight);
+	iniFile.Save(FULL_CONFIG_DIR "IR Pointer.ini");
+	// =============================
+
+	// Logging
 	Console::Print("Save()\n");
 }
diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigRecording.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigRecording.cpp
index bfc7b71a9d..6e6accdcf9 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/ConfigRecording.cpp
+++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigRecording.cpp
@@ -40,7 +40,7 @@ void ConfigDialog::LoadFile()
 	Console::Print("LoadFile()\n");
 
 	IniFile file;
-	file.Load("WiimoteMovement.ini");
+	file.Load(FULL_CONFIG_DIR "WiimoteMovement.ini");
 
 	for (int i = 1; i < (RECORDING_ROWS + 1); i++)
 	{
@@ -82,7 +82,7 @@ void ConfigDialog::SaveFile()
 	Console::Print("SaveFile\n");
 
 	IniFile file;
-	file.Load("WiimoteMovement.ini");
+	file.Load(FULL_CONFIG_DIR "WiimoteMovement.ini");
 
 	for(int i = 1; i < (RECORDING_ROWS + 1); i++)
 	{
@@ -114,7 +114,7 @@ void ConfigDialog::SaveFile()
 		file.Set(SaveName.c_str(), "PlaybackSpeed", m_RecordPlayBackSpeed[i]->GetSelection());
 	}
 
-	file.Save("WiimoteMovement.ini");
+	file.Save(FULL_CONFIG_DIR "WiimoteMovement.ini");
 	Console::Print("SaveFile()\n");
 }
 /////////////////////////////
@@ -360,7 +360,7 @@ void ConfigDialog::ConvertToString()
 {
 	// Load ini file
 	IniFile file;
-	file.Load("WiimoteMovement.ini");
+	file.Load(FULL_CONFIG_DIR "WiimoteMovement.ini");
 	std::string TmpStr = "", TmpIR = "", TmpTime = "";
 
 	for (int i = 0; i < m_vRecording.size(); i++)
@@ -422,7 +422,7 @@ void ConfigDialog::ConvertToString()
 		m_RecordPlayBackSpeed[m_iRecordTo]->SetSelection(3);
 	}	
 
-	file.Save("WiimoteMovement.ini");
+	file.Save(FULL_CONFIG_DIR "WiimoteMovement.ini");
 
 	Console::Print("Save recording to WiimoteMovement.ini\n");
 }
diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp
index ef55643b08..756c5039a8 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp
+++ b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp
@@ -233,7 +233,7 @@ void LoadRecordedMovements()
 	Console::Print("LoadRecordedMovements()\n");
 
 	IniFile file;
-	file.Load("WiimoteMovement.ini");
+	file.Load(FULL_CONFIG_DIR "WiimoteMovement.ini");
 
 	for(int i = 0; i < RECORDING_ROWS; i++)
 	{