2009-07-28 21:32:10 +00:00
|
|
|
// Copyright (C) 2003 Dolphin Project.
|
2008-12-08 05:25:12 +00:00
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
|
|
|
|
2009-02-20 03:13:22 +00:00
|
|
|
#include <iostream>
|
|
|
|
|
2008-12-08 05:25:12 +00:00
|
|
|
#include "Common.h"
|
|
|
|
#include "IniFile.h"
|
2009-02-20 03:13:22 +00:00
|
|
|
#include "StringUtil.h"
|
2009-12-25 22:10:56 +00:00
|
|
|
#include "wiimote_hid.h"
|
2008-12-08 05:25:12 +00:00
|
|
|
#include "Config.h"
|
2009-02-09 13:10:29 +00:00
|
|
|
#include "EmuDefinitions.h" // for PadMapping
|
2009-02-20 03:13:22 +00:00
|
|
|
#include "main.h"
|
2010-02-02 21:56:29 +00:00
|
|
|
#include "FileUtil.h"
|
2008-12-08 05:25:12 +00:00
|
|
|
|
2009-11-09 07:46:43 +00:00
|
|
|
// Configuration file control names
|
2009-07-10 06:16:22 +00:00
|
|
|
// Do not change the order unless you change the related arrays
|
2009-11-09 07:46:43 +00:00
|
|
|
// Directionals are ordered as L, R, U, D
|
|
|
|
|
2009-07-10 06:16:22 +00:00
|
|
|
static const char* wmControlNames[] =
|
|
|
|
{
|
|
|
|
"WmA",
|
|
|
|
"WmB",
|
|
|
|
"Wm1",
|
|
|
|
"Wm2",
|
|
|
|
"WmP",
|
|
|
|
"WmM",
|
|
|
|
"WmH",
|
|
|
|
"WmL",
|
|
|
|
"WmR",
|
|
|
|
"WmU",
|
|
|
|
"WmD",
|
2009-12-08 19:58:19 +00:00
|
|
|
"WmRollL",
|
|
|
|
"WmRollR",
|
|
|
|
"WmPitchU",
|
|
|
|
"WmPitchD",
|
2009-12-04 12:22:36 +00:00
|
|
|
"WmShake",
|
2009-12-27 19:31:02 +00:00
|
|
|
|
|
|
|
"NcZ",
|
|
|
|
"NcC",
|
|
|
|
"NcL",
|
|
|
|
"NcR",
|
|
|
|
"NcU",
|
|
|
|
"NcD",
|
|
|
|
"NcRollL",
|
|
|
|
"NcRollR",
|
|
|
|
"NcPitchU",
|
|
|
|
"NcPitchD",
|
|
|
|
"NcShake",
|
|
|
|
|
|
|
|
"CcA",
|
|
|
|
"CcB",
|
|
|
|
"CcX",
|
|
|
|
"CcY",
|
|
|
|
"CcP",
|
|
|
|
"CcM",
|
|
|
|
"CcH",
|
|
|
|
"CcTl",
|
|
|
|
"CcTr",
|
|
|
|
"CcZl",
|
|
|
|
"CcZr",
|
|
|
|
"CcDl",
|
|
|
|
"CcDr",
|
|
|
|
"CcDu",
|
|
|
|
"CcDd",
|
|
|
|
"CcLl",
|
|
|
|
"CcLr",
|
|
|
|
"CcLu",
|
|
|
|
"CcLd",
|
|
|
|
"CcRl",
|
|
|
|
"CcRr",
|
|
|
|
"CcRu",
|
|
|
|
"CcRd",
|
|
|
|
|
|
|
|
"GH3Green",
|
|
|
|
"GH3Red",
|
|
|
|
"GH3Yellow",
|
|
|
|
"GH3Blue",
|
|
|
|
"GH3Orange",
|
|
|
|
"GH3Plus",
|
|
|
|
"GH3Minus",
|
|
|
|
"GH3Whammy",
|
|
|
|
"GH3Al",
|
|
|
|
"GH3Ar",
|
|
|
|
"GH3Au",
|
|
|
|
"GH3Ad",
|
|
|
|
"GH3StrumUp",
|
|
|
|
"GH3StrumDown",
|
2009-11-09 07:46:43 +00:00
|
|
|
};
|
2009-12-27 19:31:02 +00:00
|
|
|
|
2009-11-09 07:46:43 +00:00
|
|
|
static int wmDefaultControls[] =
|
|
|
|
{
|
2009-12-27 19:31:02 +00:00
|
|
|
// Wiimote
|
2009-12-08 19:58:19 +00:00
|
|
|
#ifdef _WIN32
|
2009-11-09 07:46:43 +00:00
|
|
|
'Z',
|
|
|
|
'X',
|
|
|
|
'C',
|
|
|
|
'V',
|
2009-12-08 19:58:19 +00:00
|
|
|
VK_OEM_PLUS,
|
|
|
|
VK_OEM_MINUS,
|
|
|
|
VK_BACK,
|
2009-11-09 07:46:43 +00:00
|
|
|
VK_LEFT,
|
|
|
|
VK_RIGHT,
|
|
|
|
VK_UP,
|
|
|
|
VK_DOWN,
|
2009-12-08 19:58:19 +00:00
|
|
|
'N',
|
|
|
|
'M',
|
2009-11-09 07:46:43 +00:00
|
|
|
VK_OEM_COMMA,
|
2009-12-04 12:22:36 +00:00
|
|
|
VK_OEM_PERIOD,
|
2009-12-27 19:31:02 +00:00
|
|
|
VK_OEM_2, // /
|
2009-11-09 07:46:43 +00:00
|
|
|
#elif defined(HAVE_X11) && HAVE_X11
|
2010-01-27 13:46:30 +00:00
|
|
|
XK_z,
|
|
|
|
XK_x,
|
|
|
|
XK_c,
|
|
|
|
XK_v,
|
2009-12-09 00:06:52 +00:00
|
|
|
XK_equal,
|
|
|
|
XK_minus,
|
2009-12-08 19:58:19 +00:00
|
|
|
XK_BackSpace,
|
2009-11-09 07:46:43 +00:00
|
|
|
XK_Left,
|
|
|
|
XK_Right,
|
|
|
|
XK_Up,
|
|
|
|
XK_Down,
|
2010-01-27 13:46:30 +00:00
|
|
|
XK_n,
|
|
|
|
XK_m,
|
2009-11-09 07:46:43 +00:00
|
|
|
XK_comma,
|
2009-12-04 12:22:36 +00:00
|
|
|
XK_period,
|
2009-12-27 19:31:02 +00:00
|
|
|
XK_slash,
|
2009-11-09 07:46:43 +00:00
|
|
|
#else
|
2009-12-27 19:31:02 +00:00
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
2009-11-09 07:46:43 +00:00
|
|
|
#endif
|
2009-07-10 06:16:22 +00:00
|
|
|
|
2009-12-27 19:31:02 +00:00
|
|
|
// Nunchuck
|
2009-11-09 07:46:43 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
VK_NUMPAD0,
|
|
|
|
VK_DECIMAL,
|
|
|
|
VK_NUMPAD4,
|
|
|
|
VK_NUMPAD6,
|
|
|
|
VK_NUMPAD8,
|
|
|
|
VK_NUMPAD5,
|
2009-12-17 14:15:56 +00:00
|
|
|
VK_NUMPAD7,
|
|
|
|
VK_NUMPAD9,
|
|
|
|
VK_NUMPAD1,
|
|
|
|
VK_NUMPAD3,
|
2009-12-27 19:31:02 +00:00
|
|
|
VK_NUMPAD2,
|
2009-11-09 07:46:43 +00:00
|
|
|
#elif defined(HAVE_X11) && HAVE_X11
|
|
|
|
XK_KP_0,
|
|
|
|
XK_KP_Decimal,
|
|
|
|
XK_KP_4,
|
|
|
|
XK_KP_6,
|
|
|
|
XK_KP_8,
|
|
|
|
XK_KP_5,
|
2009-12-17 14:15:56 +00:00
|
|
|
XK_KP_7,
|
|
|
|
XK_KP_9,
|
|
|
|
XK_KP_1,
|
|
|
|
XK_KP_3,
|
2009-12-27 19:31:02 +00:00
|
|
|
XK_KP_2,
|
2009-11-09 07:46:43 +00:00
|
|
|
#else
|
2009-12-27 19:31:02 +00:00
|
|
|
0,0,0,0,0,0,0,0,0,0,0,
|
2009-11-09 07:46:43 +00:00
|
|
|
#endif
|
2009-07-10 06:16:22 +00:00
|
|
|
|
2009-11-09 07:46:43 +00:00
|
|
|
// Classic Controller
|
|
|
|
// A, B, X, Y
|
|
|
|
#ifdef _WIN32
|
|
|
|
VK_OEM_4, // [
|
2009-12-08 19:58:19 +00:00
|
|
|
VK_OEM_6, // ]
|
2009-11-09 07:46:43 +00:00
|
|
|
VK_OEM_1, // ;
|
2009-12-08 19:58:19 +00:00
|
|
|
VK_OEM_7, // '
|
2009-11-09 07:46:43 +00:00
|
|
|
#elif defined(HAVE_X11) && HAVE_X11
|
|
|
|
XK_bracketleft,
|
2009-12-08 19:58:19 +00:00
|
|
|
XK_bracketright,
|
2009-11-09 07:46:43 +00:00
|
|
|
XK_semicolon,
|
2009-12-08 19:58:19 +00:00
|
|
|
XK_quoteright,
|
2009-11-09 07:46:43 +00:00
|
|
|
#else
|
|
|
|
0,0,0,0,
|
|
|
|
#endif
|
|
|
|
// +, -, Home
|
2009-12-08 19:58:19 +00:00
|
|
|
'H',
|
|
|
|
'F',
|
|
|
|
'G',
|
2009-11-09 07:46:43 +00:00
|
|
|
// Triggers, Zs
|
|
|
|
'E',
|
|
|
|
'Y',
|
2009-12-08 19:58:19 +00:00
|
|
|
'R',
|
2009-11-09 07:46:43 +00:00
|
|
|
'T',
|
2009-12-08 19:58:19 +00:00
|
|
|
// Digital pad
|
2009-11-09 07:46:43 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
VK_NUMPAD4,
|
|
|
|
VK_NUMPAD6,
|
|
|
|
VK_NUMPAD8,
|
2009-12-08 19:58:19 +00:00
|
|
|
VK_NUMPAD5,
|
2009-11-09 07:46:43 +00:00
|
|
|
#elif defined(HAVE_X11) && HAVE_X11
|
|
|
|
XK_KP_4,
|
|
|
|
XK_KP_6,
|
|
|
|
XK_KP_8,
|
2009-12-08 19:58:19 +00:00
|
|
|
XK_KP_5,
|
2009-11-09 07:46:43 +00:00
|
|
|
#else
|
2009-12-08 19:58:19 +00:00
|
|
|
0,0,0,0,
|
2009-11-09 07:46:43 +00:00
|
|
|
#endif
|
2009-12-08 19:58:19 +00:00
|
|
|
// Left analog
|
|
|
|
'A',
|
|
|
|
'D',
|
|
|
|
'W',
|
|
|
|
'S',
|
|
|
|
// Right analog
|
|
|
|
'J',
|
|
|
|
'L',
|
|
|
|
'I',
|
2009-12-27 19:31:02 +00:00
|
|
|
'K',
|
2009-07-10 06:16:22 +00:00
|
|
|
|
2009-12-27 19:31:02 +00:00
|
|
|
// Guttar Hero
|
2009-11-09 07:46:43 +00:00
|
|
|
'A',
|
|
|
|
'S',
|
|
|
|
'D',
|
|
|
|
'F',
|
|
|
|
'G',
|
|
|
|
'L',
|
|
|
|
'J',
|
|
|
|
'H',
|
2009-07-10 06:16:22 +00:00
|
|
|
#ifdef _WIN32
|
2009-11-09 07:46:43 +00:00
|
|
|
VK_NUMPAD4,
|
|
|
|
VK_NUMPAD6,
|
|
|
|
VK_NUMPAD8,
|
|
|
|
VK_NUMPAD5,
|
2009-07-10 06:16:22 +00:00
|
|
|
#elif defined(HAVE_X11) && HAVE_X11
|
2009-11-09 07:46:43 +00:00
|
|
|
XK_KP_4,
|
|
|
|
XK_KP_6,
|
|
|
|
XK_KP_8,
|
|
|
|
XK_KP_5,
|
2009-07-10 06:16:22 +00:00
|
|
|
#else
|
|
|
|
0,0,0,0,
|
|
|
|
#endif
|
2009-11-09 07:46:43 +00:00
|
|
|
'I',
|
|
|
|
'K',
|
2009-07-10 06:16:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-12-08 05:25:12 +00:00
|
|
|
Config g_Config;
|
|
|
|
|
|
|
|
Config::Config()
|
|
|
|
{
|
2009-02-10 17:25:08 +00:00
|
|
|
// Set all default values to zero
|
2009-07-05 04:29:00 +00:00
|
|
|
memset(this, 0, sizeof(Config));
|
2008-12-08 05:25:12 +00:00
|
|
|
}
|
|
|
|
|
2009-12-27 19:31:02 +00:00
|
|
|
void Config::Load()
|
2008-12-08 05:25:12 +00:00
|
|
|
{
|
2009-07-05 04:29:00 +00:00
|
|
|
std::string temp;
|
|
|
|
IniFile iniFile;
|
2010-02-02 21:56:29 +00:00
|
|
|
iniFile.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "Wiimote.ini").c_str());
|
2008-12-08 05:25:12 +00:00
|
|
|
|
2009-02-15 18:57:00 +00:00
|
|
|
// Real Wiimote
|
2009-01-28 16:09:08 +00:00
|
|
|
iniFile.Get("Real", "UpdateStatus", &bUpdateRealWiimote, true);
|
2010-04-15 16:47:55 +00:00
|
|
|
iniFile.Get("Real", "Unpair", &bUnpairRealWiimote, false);
|
2009-02-03 11:45:59 +00:00
|
|
|
iniFile.Get("Real", "AccNeutralX", &iAccNeutralX, 0);
|
|
|
|
iniFile.Get("Real", "AccNeutralY", &iAccNeutralY, 0);
|
|
|
|
iniFile.Get("Real", "AccNeutralZ", &iAccNeutralZ, 0);
|
|
|
|
iniFile.Get("Real", "AccNunNeutralX", &iAccNunNeutralX, 0);
|
|
|
|
iniFile.Get("Real", "AccNunNeutralY", &iAccNunNeutralY, 0);
|
|
|
|
iniFile.Get("Real", "AccNunNeutralZ", &iAccNunNeutralZ, 0);
|
2009-02-09 13:10:29 +00:00
|
|
|
|
2009-12-25 22:10:56 +00:00
|
|
|
for (int i = 0; i < MAX_WIIMOTES; i++)
|
2009-02-09 13:10:29 +00:00
|
|
|
{
|
|
|
|
// Slot specific settings
|
2009-07-08 07:16:26 +00:00
|
|
|
char SectionName[32];
|
|
|
|
sprintf(SectionName, "Wiimote%i", i + 1);
|
2009-12-27 19:31:02 +00:00
|
|
|
|
|
|
|
// General
|
2010-01-01 03:19:46 +00:00
|
|
|
iniFile.Get(SectionName, "Source", &WiiMoteEmu::WiiMapping[i].Source, (i == 0) ? 1 : 0);
|
2010-01-01 00:38:24 +00:00
|
|
|
|
2009-12-27 19:31:02 +00:00
|
|
|
iniFile.Get(SectionName, "Sideways", &WiiMoteEmu::WiiMapping[i].bSideways, false);
|
|
|
|
iniFile.Get(SectionName, "Upright", &WiiMoteEmu::WiiMapping[i].bUpright, false);
|
|
|
|
iniFile.Get(SectionName, "ExtensionConnected", &WiiMoteEmu::WiiMapping[i].iExtensionConnected, WiiMoteEmu::EXT_NONE);
|
|
|
|
iniFile.Get(SectionName, "MotionPlusConnected", &WiiMoteEmu::WiiMapping[i].bMotionPlusConnected, false);
|
|
|
|
|
|
|
|
iniFile.Get(SectionName, "TiltInputWM", &WiiMoteEmu::WiiMapping[i].Tilt.InputWM, WiiMoteEmu::FROM_KEYBOARD);
|
|
|
|
iniFile.Get(SectionName, "TiltInputNC", &WiiMoteEmu::WiiMapping[i].Tilt.InputNC, WiiMoteEmu::FROM_KEYBOARD);
|
|
|
|
iniFile.Get(SectionName, "TiltRollDegree", &WiiMoteEmu::WiiMapping[i].Tilt.RollDegree, 60);
|
|
|
|
iniFile.Get(SectionName, "TiltRollSwing", &WiiMoteEmu::WiiMapping[i].Tilt.RollSwing, false);
|
|
|
|
iniFile.Get(SectionName, "TiltRollInvert", &WiiMoteEmu::WiiMapping[i].Tilt.RollInvert, false);
|
|
|
|
WiiMoteEmu::WiiMapping[i].Tilt.RollRange = (WiiMoteEmu::WiiMapping[i].Tilt.RollSwing) ? 0 : WiiMoteEmu::WiiMapping[i].Tilt.RollDegree;
|
|
|
|
iniFile.Get(SectionName, "TiltPitchDegree", &WiiMoteEmu::WiiMapping[i].Tilt.PitchDegree, 60);
|
|
|
|
iniFile.Get(SectionName, "TiltPitchSwing", &WiiMoteEmu::WiiMapping[i].Tilt.PitchSwing, false);
|
|
|
|
iniFile.Get(SectionName, "TiltPitchInvert", &WiiMoteEmu::WiiMapping[i].Tilt.PitchInvert, false);
|
|
|
|
WiiMoteEmu::WiiMapping[i].Tilt.PitchRange = (WiiMoteEmu::WiiMapping[i].Tilt.PitchSwing) ? 0 : WiiMoteEmu::WiiMapping[i].Tilt.PitchDegree;
|
2010-03-27 04:21:19 +00:00
|
|
|
|
2009-12-27 19:31:02 +00:00
|
|
|
// StickMapping
|
|
|
|
iniFile.Get(SectionName, "NCStick", &WiiMoteEmu::WiiMapping[i].Stick.NC, WiiMoteEmu::FROM_KEYBOARD);
|
|
|
|
iniFile.Get(SectionName, "CCStickLeft", &WiiMoteEmu::WiiMapping[i].Stick.CCL, WiiMoteEmu::FROM_KEYBOARD);
|
|
|
|
iniFile.Get(SectionName, "CCStickRight", &WiiMoteEmu::WiiMapping[i].Stick.CCR, WiiMoteEmu::FROM_KEYBOARD);
|
|
|
|
iniFile.Get(SectionName, "CCTriggers", &WiiMoteEmu::WiiMapping[i].Stick.CCT, WiiMoteEmu::FROM_KEYBOARD);
|
|
|
|
iniFile.Get(SectionName, "GHStick", &WiiMoteEmu::WiiMapping[i].Stick.GH, WiiMoteEmu::FROM_KEYBOARD);
|
|
|
|
|
|
|
|
// ButtonMapping
|
|
|
|
for (int x = 0; x < WiiMoteEmu::LAST_CONSTANT; x++)
|
|
|
|
iniFile.Get(SectionName, wmControlNames[x], &WiiMoteEmu::WiiMapping[i].Button[x], wmDefaultControls[x]);
|
|
|
|
|
|
|
|
// This pad Id could possibly be higher than the number of pads that are connected,
|
|
|
|
// but we check later, when needed, that that is not the case
|
|
|
|
iniFile.Get(SectionName, "DeviceID", &WiiMoteEmu::WiiMapping[i].ID, 0);
|
|
|
|
|
|
|
|
iniFile.Get(SectionName, "Axis_Lx", &WiiMoteEmu::WiiMapping[i].AxisMapping.Lx, 0);
|
|
|
|
iniFile.Get(SectionName, "Axis_Ly", &WiiMoteEmu::WiiMapping[i].AxisMapping.Ly, 1);
|
|
|
|
iniFile.Get(SectionName, "Axis_Rx", &WiiMoteEmu::WiiMapping[i].AxisMapping.Rx, 2);
|
|
|
|
iniFile.Get(SectionName, "Axis_Ry", &WiiMoteEmu::WiiMapping[i].AxisMapping.Ry, 3);
|
|
|
|
iniFile.Get(SectionName, "Trigger_L", &WiiMoteEmu::WiiMapping[i].AxisMapping.Tl, 1004);
|
|
|
|
iniFile.Get(SectionName, "Trigger_R", &WiiMoteEmu::WiiMapping[i].AxisMapping.Tr, 1005);
|
|
|
|
iniFile.Get(SectionName, "DeadZoneL", &WiiMoteEmu::WiiMapping[i].DeadZoneL, 0);
|
|
|
|
iniFile.Get(SectionName, "DeadZoneR", &WiiMoteEmu::WiiMapping[i].DeadZoneR, 0);
|
2010-01-22 23:19:16 +00:00
|
|
|
iniFile.Get(SectionName, "Diagonal", &WiiMoteEmu::WiiMapping[i].Diagonal, 100);
|
2009-12-27 19:31:02 +00:00
|
|
|
iniFile.Get(SectionName, "Circle2Square", &WiiMoteEmu::WiiMapping[i].bCircle2Square, false);
|
2010-01-20 17:01:38 +00:00
|
|
|
iniFile.Get(SectionName, "Rumble", &WiiMoteEmu::WiiMapping[i].Rumble, false);
|
2010-01-23 13:34:18 +00:00
|
|
|
iniFile.Get(SectionName, "RumbleStrength", &WiiMoteEmu::WiiMapping[i].RumbleStrength, 80);
|
2009-12-27 19:31:02 +00:00
|
|
|
iniFile.Get(SectionName, "TriggerType", &WiiMoteEmu::WiiMapping[i].TriggerType, 0);
|
2010-04-13 01:34:11 +00:00
|
|
|
|
|
|
|
//UDPWii
|
|
|
|
iniFile.Get(SectionName, "UDPWii_Enable", &WiiMoteEmu::WiiMapping[i].UDPWM.enable, false);
|
|
|
|
std::string port;
|
|
|
|
char default_port[15];
|
|
|
|
sprintf(default_port,"%d",4432+i);
|
|
|
|
iniFile.Get(SectionName, "UDPWii_Port", &port, default_port);
|
|
|
|
strncpy(WiiMoteEmu::WiiMapping[i].UDPWM.port,port.c_str(),10);
|
|
|
|
iniFile.Get(SectionName, "UDPWii_EnableAccel", &WiiMoteEmu::WiiMapping[i].UDPWM.enableAccel, true);
|
|
|
|
iniFile.Get(SectionName, "UDPWii_EnableButtons", &WiiMoteEmu::WiiMapping[i].UDPWM.enableButtons, true);
|
|
|
|
iniFile.Get(SectionName, "UDPWii_EnableIR", &WiiMoteEmu::WiiMapping[i].UDPWM.enableIR, true);
|
|
|
|
iniFile.Get(SectionName, "UDPWii_EnableNunchuck", &WiiMoteEmu::WiiMapping[i].UDPWM.enableNunchuck, true);
|
2009-02-09 13:10:29 +00:00
|
|
|
}
|
2009-12-27 19:31:02 +00:00
|
|
|
|
2010-03-27 04:21:19 +00:00
|
|
|
iniFile.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "Dolphin.ini").c_str());
|
|
|
|
for (int i = 0; i < MAX_WIIMOTES; i++)
|
|
|
|
{
|
|
|
|
char SectionName[32];
|
|
|
|
sprintf(SectionName, "Wiimote%i", i + 1);
|
|
|
|
iniFile.Get(SectionName, "AutoReconnectRealWiimote", &WiiMoteEmu::WiiMapping[i].bWiiAutoReconnect, false);
|
|
|
|
}
|
|
|
|
|
2010-01-16 15:02:01 +00:00
|
|
|
Config::LoadIR();
|
2009-07-08 07:16:26 +00:00
|
|
|
|
|
|
|
// 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
|
2010-02-02 21:56:29 +00:00
|
|
|
iniFile.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_opengl.ini").c_str());
|
2009-02-26 00:11:51 +00:00
|
|
|
iniFile.Get("Settings", "KeepAR_4_3", &bKeepAR43, false);
|
|
|
|
iniFile.Get("Settings", "KeepAR_16_9", &bKeepAR169, false);
|
|
|
|
iniFile.Get("Settings", "Crop", &bCrop, false);
|
|
|
|
|
2009-09-15 02:12:55 +00:00
|
|
|
//DEBUG_LOG(WIIMOTE, "Load()");
|
2008-12-08 05:25:12 +00:00
|
|
|
}
|
|
|
|
|
2010-01-16 15:02:01 +00:00
|
|
|
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];
|
2010-01-18 20:46:23 +00:00
|
|
|
int defaultLeft, defaultTop, defaultWidth, defaultHeight;
|
|
|
|
|
2010-01-16 15:02:01 +00:00
|
|
|
sprintf(TmpSection, "%s", g_ISOId ? Hex2Ascii(g_ISOId).c_str() : "Default");
|
2010-02-02 21:56:29 +00:00
|
|
|
iniFile.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "IR Pointer.ini").c_str());
|
2010-01-18 20:46:23 +00:00
|
|
|
//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);
|
2010-03-26 12:36:28 +00:00
|
|
|
iniFile.Get("Default", "IRLevel", &iIRLevel, 3);
|
|
|
|
|
2010-01-18 20:46:23 +00:00
|
|
|
//...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);
|
2010-01-16 15:02:01 +00:00
|
|
|
}
|
|
|
|
|
2009-12-27 19:31:02 +00:00
|
|
|
void Config::Save()
|
2008-12-08 05:25:12 +00:00
|
|
|
{
|
2009-07-05 04:29:00 +00:00
|
|
|
IniFile iniFile;
|
2010-02-02 21:56:29 +00:00
|
|
|
iniFile.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "Wiimote.ini").c_str());
|
2010-01-11 13:56:11 +00:00
|
|
|
|
2009-02-01 13:01:50 +00:00
|
|
|
iniFile.Set("Real", "UpdateStatus", bUpdateRealWiimote);
|
2010-04-15 16:47:55 +00:00
|
|
|
iniFile.Set("Real", "Unpair", bUnpairRealWiimote);
|
2009-02-03 11:45:59 +00:00
|
|
|
iniFile.Set("Real", "AccNeutralX", iAccNeutralX);
|
|
|
|
iniFile.Set("Real", "AccNeutralY", iAccNeutralY);
|
|
|
|
iniFile.Set("Real", "AccNeutralZ", iAccNeutralZ);
|
|
|
|
iniFile.Set("Real", "AccNunNeutralX", iAccNunNeutralX);
|
|
|
|
iniFile.Set("Real", "AccNunNeutralY", iAccNunNeutralY);
|
|
|
|
iniFile.Set("Real", "AccNunNeutralZ", iAccNunNeutralZ);
|
2008-12-08 05:25:12 +00:00
|
|
|
|
2009-12-25 22:10:56 +00:00
|
|
|
for (int i = 0; i < MAX_WIIMOTES; i++)
|
2009-02-09 13:10:29 +00:00
|
|
|
{
|
|
|
|
// Slot specific settings
|
2009-07-08 07:16:26 +00:00
|
|
|
char SectionName[32];
|
|
|
|
sprintf(SectionName, "Wiimote%i", i + 1);
|
|
|
|
|
2009-12-27 19:31:02 +00:00
|
|
|
iniFile.Set(SectionName, "Source", WiiMoteEmu::WiiMapping[i].Source);
|
|
|
|
iniFile.Set(SectionName, "Sideways", WiiMoteEmu::WiiMapping[i].bSideways);
|
|
|
|
iniFile.Set(SectionName, "Upright", WiiMoteEmu::WiiMapping[i].bUpright);
|
|
|
|
iniFile.Set(SectionName, "ExtensionConnected", WiiMoteEmu::WiiMapping[i].iExtensionConnected);
|
|
|
|
iniFile.Set(SectionName, "MotionPlusConnected", WiiMoteEmu::WiiMapping[i].bMotionPlusConnected);
|
|
|
|
iniFile.Set(SectionName, "TiltInputWM", WiiMoteEmu::WiiMapping[i].Tilt.InputWM);
|
|
|
|
iniFile.Set(SectionName, "TiltInputNC", WiiMoteEmu::WiiMapping[i].Tilt.InputNC);
|
|
|
|
iniFile.Set(SectionName, "TiltRollDegree", WiiMoteEmu::WiiMapping[i].Tilt.RollDegree);
|
|
|
|
iniFile.Set(SectionName, "TiltRollSwing", WiiMoteEmu::WiiMapping[i].Tilt.RollSwing);
|
|
|
|
iniFile.Set(SectionName, "TiltRollInvert", WiiMoteEmu::WiiMapping[i].Tilt.RollInvert);
|
|
|
|
iniFile.Set(SectionName, "TiltPitchDegree", WiiMoteEmu::WiiMapping[i].Tilt.PitchDegree);
|
|
|
|
iniFile.Set(SectionName, "TiltPitchSwing", WiiMoteEmu::WiiMapping[i].Tilt.PitchSwing);
|
|
|
|
iniFile.Set(SectionName, "TiltPitchInvert", WiiMoteEmu::WiiMapping[i].Tilt.PitchInvert);
|
|
|
|
|
|
|
|
// StickMapping
|
|
|
|
iniFile.Set(SectionName, "NCStick", WiiMoteEmu::WiiMapping[i].Stick.NC);
|
|
|
|
iniFile.Set(SectionName, "CCStickLeft", WiiMoteEmu::WiiMapping[i].Stick.CCL);
|
|
|
|
iniFile.Set(SectionName, "CCStickRight", WiiMoteEmu::WiiMapping[i].Stick.CCR);
|
|
|
|
iniFile.Set(SectionName, "CCTriggers", WiiMoteEmu::WiiMapping[i].Stick.CCT);
|
|
|
|
iniFile.Set(SectionName, "GHStick", WiiMoteEmu::WiiMapping[i].Stick.GH);
|
|
|
|
|
|
|
|
// ButtonMapping
|
|
|
|
for (int x = 0; x < WiiMoteEmu::LAST_CONSTANT; x++)
|
|
|
|
iniFile.Set(SectionName, wmControlNames[x], WiiMoteEmu::WiiMapping[i].Button[x]);
|
2009-02-24 02:40:17 +00:00
|
|
|
|
2009-02-09 13:10:29 +00:00
|
|
|
// Save the physical device ID number
|
2009-12-27 19:31:02 +00:00
|
|
|
iniFile.Set(SectionName, "DeviceID", WiiMoteEmu::WiiMapping[i].ID);
|
|
|
|
|
|
|
|
iniFile.Set(SectionName, "Axis_Lx", WiiMoteEmu::WiiMapping[i].AxisMapping.Lx);
|
|
|
|
iniFile.Set(SectionName, "Axis_Ly", WiiMoteEmu::WiiMapping[i].AxisMapping.Ly);
|
|
|
|
iniFile.Set(SectionName, "Axis_Rx", WiiMoteEmu::WiiMapping[i].AxisMapping.Rx);
|
|
|
|
iniFile.Set(SectionName, "Axis_Ry", WiiMoteEmu::WiiMapping[i].AxisMapping.Ry);
|
|
|
|
iniFile.Set(SectionName, "Trigger_L", WiiMoteEmu::WiiMapping[i].AxisMapping.Tl);
|
|
|
|
iniFile.Set(SectionName, "Trigger_R", WiiMoteEmu::WiiMapping[i].AxisMapping.Tr);
|
|
|
|
iniFile.Set(SectionName, "DeadZoneL", WiiMoteEmu::WiiMapping[i].DeadZoneL);
|
|
|
|
iniFile.Set(SectionName, "DeadZoneR", WiiMoteEmu::WiiMapping[i].DeadZoneR);
|
|
|
|
iniFile.Set(SectionName, "Diagonal", WiiMoteEmu::WiiMapping[i].Diagonal);
|
|
|
|
iniFile.Set(SectionName, "Circle2Square", WiiMoteEmu::WiiMapping[i].bCircle2Square);
|
|
|
|
iniFile.Set(SectionName, "Rumble", WiiMoteEmu::WiiMapping[i].Rumble);
|
2010-01-23 13:34:18 +00:00
|
|
|
iniFile.Set(SectionName, "RumbleStrength", WiiMoteEmu::WiiMapping[i].RumbleStrength);
|
2009-12-27 19:31:02 +00:00
|
|
|
iniFile.Set(SectionName, "TriggerType", WiiMoteEmu::WiiMapping[i].TriggerType);
|
2010-04-13 01:34:11 +00:00
|
|
|
|
|
|
|
// UDPWii
|
|
|
|
iniFile.Set(SectionName, "UDPWii_Enable", WiiMoteEmu::WiiMapping[i].UDPWM.enable);
|
|
|
|
iniFile.Set(SectionName, "UDPWii_Port", WiiMoteEmu::WiiMapping[i].UDPWM.port);
|
|
|
|
iniFile.Set(SectionName, "UDPWii_EnableAccel", WiiMoteEmu::WiiMapping[i].UDPWM.enableAccel);
|
|
|
|
iniFile.Set(SectionName, "UDPWii_EnableButtons", WiiMoteEmu::WiiMapping[i].UDPWM.enableButtons);
|
|
|
|
iniFile.Set(SectionName, "UDPWii_EnableIR", WiiMoteEmu::WiiMapping[i].UDPWM.enableIR);
|
|
|
|
iniFile.Set(SectionName, "UDPWii_EnableNunchuck", WiiMoteEmu::WiiMapping[i].UDPWM.enableNunchuck);
|
2009-02-09 13:10:29 +00:00
|
|
|
}
|
|
|
|
|
2010-02-02 21:56:29 +00:00
|
|
|
iniFile.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "Wiimote.ini").c_str());
|
2009-02-26 00:35:17 +00:00
|
|
|
|
2009-07-08 07:16:26 +00:00
|
|
|
// Save the IR cursor settings if it's avaliable for the GameId, if not save the default settings
|
2010-02-02 21:56:29 +00:00
|
|
|
iniFile.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "IR Pointer.ini").c_str());
|
2009-07-08 07:16:26 +00:00
|
|
|
char TmpSection[32];
|
|
|
|
sprintf(TmpSection, "%s", g_ISOId ? Hex2Ascii(g_ISOId).c_str() : "Default");
|
|
|
|
iniFile.Set(TmpSection, "IRLeft", iIRLeft);
|
|
|
|
iniFile.Set(TmpSection, "IRTop", iIRTop);
|
|
|
|
iniFile.Set(TmpSection, "IRWidth", iIRWidth);
|
|
|
|
iniFile.Set(TmpSection, "IRHeight", iIRHeight);
|
2010-03-26 12:36:28 +00:00
|
|
|
iniFile.Set(TmpSection, "IRLevel", iIRLevel);
|
2010-02-02 21:56:29 +00:00
|
|
|
iniFile.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "IR Pointer.ini").c_str());
|
2009-02-26 00:35:17 +00:00
|
|
|
|
2010-03-27 04:21:19 +00:00
|
|
|
//Save any options that need to be accessed in Dolphin
|
|
|
|
iniFile.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "Dolphin.ini").c_str());
|
2010-03-28 09:51:57 +00:00
|
|
|
for (int i = 0; i < MAX_WIIMOTES; i++)
|
|
|
|
{
|
|
|
|
char SectionName[32];
|
|
|
|
sprintf(SectionName, "Wiimote%i", i + 1);
|
|
|
|
iniFile.Set(SectionName, "AutoReconnectRealWiimote", WiiMoteEmu::WiiMapping[i].bWiiAutoReconnect);
|
|
|
|
}
|
2010-03-27 04:21:19 +00:00
|
|
|
iniFile.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "Dolphin.ini").c_str());
|
|
|
|
|
2009-09-15 02:12:55 +00:00
|
|
|
//DEBUG_LOG(WIIMOTE, "Save()");
|
2009-11-15 22:26:39 +00:00
|
|
|
}
|