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-02-09 13:10:29 +00:00
|
|
|
|
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"
|
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
|
|
|
|
|
|
|
|
// Wiimote
|
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-11-09 07:46:43 +00:00
|
|
|
};
|
|
|
|
static int wmDefaultControls[] =
|
|
|
|
{
|
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,
|
|
|
|
VK_OEM_2 // /
|
2009-11-09 07:46:43 +00:00
|
|
|
#elif defined(HAVE_X11) && HAVE_X11
|
2009-12-08 19:58:19 +00:00
|
|
|
'Z',
|
|
|
|
'X',
|
|
|
|
'C',
|
|
|
|
'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,
|
2009-12-08 19:58:19 +00:00
|
|
|
'N',
|
|
|
|
'M',
|
2009-11-09 07:46:43 +00:00
|
|
|
XK_comma,
|
2009-12-04 12:22:36 +00:00
|
|
|
XK_period,
|
|
|
|
XK_slash
|
2009-11-09 07:46:43 +00:00
|
|
|
#else
|
2009-12-08 19:58:19 +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-11-09 07:46:43 +00:00
|
|
|
// Nunchuk
|
2009-07-10 06:16:22 +00:00
|
|
|
static const char* ncControlNames[] =
|
|
|
|
{
|
|
|
|
"NcZ",
|
|
|
|
"NcC",
|
|
|
|
"NcL",
|
|
|
|
"NcR",
|
|
|
|
"NcU",
|
|
|
|
"NcD",
|
|
|
|
"NcShake",
|
|
|
|
};
|
2009-11-09 07:46:43 +00:00
|
|
|
static int nCDefaultControls[] =
|
|
|
|
{
|
|
|
|
#ifdef _WIN32
|
|
|
|
VK_NUMPAD0,
|
|
|
|
VK_DECIMAL,
|
|
|
|
VK_NUMPAD4,
|
|
|
|
VK_NUMPAD6,
|
|
|
|
VK_NUMPAD8,
|
|
|
|
VK_NUMPAD5,
|
|
|
|
VK_ADD
|
|
|
|
#elif defined(HAVE_X11) && HAVE_X11
|
|
|
|
XK_KP_0,
|
|
|
|
XK_KP_Decimal,
|
|
|
|
XK_KP_4,
|
|
|
|
XK_KP_6,
|
|
|
|
XK_KP_8,
|
|
|
|
XK_KP_5,
|
|
|
|
XK_KP_Add
|
|
|
|
#else
|
|
|
|
0,0,0,0,0,0,0
|
|
|
|
#endif
|
|
|
|
};
|
2009-07-10 06:16:22 +00:00
|
|
|
|
2009-11-09 07:46:43 +00:00
|
|
|
// Classic Controller
|
2009-07-10 06:16:22 +00:00
|
|
|
static const char* ccControlNames[] =
|
|
|
|
{
|
|
|
|
"CcA",
|
|
|
|
"CcB",
|
|
|
|
"CcX",
|
|
|
|
"CcY",
|
|
|
|
"CcP",
|
|
|
|
"CcM",
|
|
|
|
"CcH",
|
|
|
|
"CcTl",
|
2009-11-09 07:46:43 +00:00
|
|
|
"CcTr",
|
2009-07-10 06:16:22 +00:00
|
|
|
"CcZl",
|
|
|
|
"CcZr",
|
|
|
|
"CcDl",
|
|
|
|
"CcDr",
|
2009-11-09 07:46:43 +00:00
|
|
|
"CcDu",
|
2009-07-10 06:16:22 +00:00
|
|
|
"CcDd",
|
|
|
|
"CcLl",
|
|
|
|
"CcLr",
|
2009-11-09 07:46:43 +00:00
|
|
|
"CcLu",
|
2009-07-10 06:16:22 +00:00
|
|
|
"CcLd",
|
|
|
|
"CcRl",
|
|
|
|
"CcRr",
|
2009-11-09 07:46:43 +00:00
|
|
|
"CcRu",
|
2009-07-10 06:16:22 +00:00
|
|
|
"CcRd",
|
|
|
|
};
|
2009-11-09 07:46:43 +00:00
|
|
|
static int ccDefaultControls[] =
|
|
|
|
{
|
|
|
|
// 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',
|
|
|
|
'K'
|
2009-11-09 07:46:43 +00:00
|
|
|
};
|
2009-07-10 06:16:22 +00:00
|
|
|
|
2009-11-09 07:46:43 +00:00
|
|
|
// GH3 Default controls
|
2009-07-10 06:16:22 +00:00
|
|
|
static const char* gh3ControlNames[] =
|
|
|
|
{
|
|
|
|
"GH3Green",
|
|
|
|
"GH3Red",
|
|
|
|
"GH3Yellow",
|
|
|
|
"GH3Blue",
|
|
|
|
"GH3Orange",
|
|
|
|
"GH3Plus",
|
|
|
|
"GH3Minus",
|
|
|
|
"GH3Whammy",
|
|
|
|
"GH3Al",
|
|
|
|
"GH3Ar",
|
2009-11-09 07:46:43 +00:00
|
|
|
"GH3Au",
|
2009-07-10 06:16:22 +00:00
|
|
|
"GH3Ad",
|
|
|
|
"GH3StrumUp",
|
|
|
|
"GH3StrumDown",
|
|
|
|
};
|
2009-11-09 07:46:43 +00:00
|
|
|
static int GH3DefaultControls[] =
|
2009-07-10 06:16:22 +00:00
|
|
|
{
|
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-02-09 13:10:29 +00:00
|
|
|
void Config::Load(bool ChangePad)
|
2008-12-08 05:25:12 +00:00
|
|
|
{
|
2009-07-05 04:29:00 +00:00
|
|
|
std::string temp;
|
|
|
|
IniFile iniFile;
|
2009-07-28 16:20:54 +00:00
|
|
|
iniFile.Load(FULL_CONFIG_DIR "Wiimote.ini");
|
2008-12-08 05:25:12 +00:00
|
|
|
|
2009-02-15 18:57:00 +00:00
|
|
|
// General
|
2009-12-11 13:57:25 +00:00
|
|
|
iniFile.Get("Settings", "InputActive", &bInputActive, true);
|
2009-12-09 14:52:30 +00:00
|
|
|
iniFile.Get("Settings", "Sideways", &bSideways, false);
|
|
|
|
iniFile.Get("Settings", "Upright", &bUpright, false);
|
2009-07-05 04:29:00 +00:00
|
|
|
iniFile.Get("Settings", "ExtensionConnected", &iExtensionConnected, EXT_NONE);
|
2009-09-15 02:12:55 +00:00
|
|
|
iniFile.Get("Settings", "MotionPlusConnected", &bMotionPlusConnected, false);
|
2009-01-25 23:07:15 +00:00
|
|
|
|
2009-02-15 18:57:00 +00:00
|
|
|
// Real Wiimote
|
2009-01-25 23:07:15 +00:00
|
|
|
iniFile.Get("Real", "Connect", &bConnectRealWiimote, true);
|
2009-12-08 19:58:19 +00:00
|
|
|
iniFile.Get("Real", "Use", &bUseRealWiimote, false);
|
2009-01-28 16:09:08 +00:00
|
|
|
iniFile.Get("Real", "UpdateStatus", &bUpdateRealWiimote, true);
|
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-13 04:31:38 +00:00
|
|
|
for (int i = 0; i < 1; i++) // Only got 1 wiimote yet
|
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);
|
|
|
|
iniFile.Get(SectionName, "NoTriggerFilter", &bNoTriggerFilter, false);
|
2009-12-09 14:52:30 +00:00
|
|
|
|
2009-12-14 02:23:14 +00:00
|
|
|
iniFile.Get(SectionName, "TiltType", &Tilt.Type, Tilt.KEYBOARD);
|
|
|
|
iniFile.Get(SectionName, "TiltRollSwing", &Tilt.Range.RollSwing, false);
|
|
|
|
iniFile.Get(SectionName, "TiltRollDegree", &Tilt.Range.RollDegree, 60);
|
|
|
|
Tilt.Range.Roll = (Tilt.Range.RollSwing) ? 0 : Tilt.Range.RollDegree;
|
|
|
|
iniFile.Get(SectionName, "TiltRollInvert", &Tilt.RollInvert, false);
|
|
|
|
iniFile.Get(SectionName, "TiltPitchSwing", &Tilt.Range.PitchSwing, false);
|
|
|
|
iniFile.Get(SectionName, "TiltPitchDegree", &Tilt.Range.PitchDegree, 60);
|
|
|
|
Tilt.Range.Pitch = (Tilt.Range.PitchSwing) ? 0 : Tilt.Range.PitchDegree;
|
|
|
|
iniFile.Get(SectionName, "TiltPitchInvert", &Tilt.PitchInvert, false);
|
2009-02-15 18:23:42 +00:00
|
|
|
|
|
|
|
// Wiimote
|
2009-11-09 07:46:43 +00:00
|
|
|
for (int x = 0; x < WM_CONTROLS; x++)
|
2009-07-08 07:16:26 +00:00
|
|
|
iniFile.Get(SectionName, wmControlNames[x], &WiiMoteEmu::PadMapping[i].Wm.keyForControls[x], wmDefaultControls[x]);
|
2009-02-15 18:23:42 +00:00
|
|
|
// Nunchuck
|
2009-07-08 07:16:26 +00:00
|
|
|
iniFile.Get(SectionName, "NunchuckStick", &Nunchuck.Type, Nunchuck.KEYBOARD);
|
2009-11-09 07:46:43 +00:00
|
|
|
for (int x = 0; x < NC_CONTROLS; x++)
|
2009-07-08 07:16:26 +00:00
|
|
|
iniFile.Get(SectionName, ncControlNames[x], &WiiMoteEmu::PadMapping[i].Nc.keyForControls[x], nCDefaultControls[x]);
|
2009-02-09 13:10:29 +00:00
|
|
|
|
2009-02-24 02:40:17 +00:00
|
|
|
// Classic Controller
|
2009-07-08 07:16:26 +00:00
|
|
|
iniFile.Get(SectionName, "CcLeftStick", &ClassicController.LType, ClassicController.KEYBOARD);
|
|
|
|
iniFile.Get(SectionName, "CcRightStick", &ClassicController.RType, ClassicController.KEYBOARD);
|
|
|
|
iniFile.Get(SectionName, "CcTriggers", &ClassicController.TType, ClassicController.KEYBOARD);
|
2009-11-09 07:46:43 +00:00
|
|
|
for (int x = 0; x < CC_CONTROLS; x++)
|
2009-07-08 07:16:26 +00:00
|
|
|
iniFile.Get(SectionName, ccControlNames[x], &WiiMoteEmu::PadMapping[i].Cc.keyForControls[x], ccDefaultControls[x]);
|
2009-12-09 14:52:30 +00:00
|
|
|
|
2009-07-18 05:04:36 +00:00
|
|
|
iniFile.Get(SectionName, "GH3Analog", &GH3Controller.AType, GH3Controller.ANALOG1);
|
2009-11-09 07:46:43 +00:00
|
|
|
for (int x = 0; x < GH3_CONTROLS; x++)
|
2009-07-08 07:16:26 +00:00
|
|
|
iniFile.Get(SectionName, gh3ControlNames[x], &WiiMoteEmu::PadMapping[i].GH3c.keyForControls[x], GH3DefaultControls[x]);
|
2009-02-24 02:40:17 +00:00
|
|
|
|
2009-02-09 13:10:29 +00:00
|
|
|
// Don't update this when we are loading settings from the ConfigBox
|
2009-11-14 17:08:32 +00:00
|
|
|
if(!ChangePad)
|
2009-02-09 13:10:29 +00:00
|
|
|
{
|
2009-07-08 07:16:26 +00:00
|
|
|
// 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::PadMapping[i].ID, 0);
|
|
|
|
iniFile.Get(SectionName, "Enabled", &WiiMoteEmu::PadMapping[i].enabled, true);
|
2009-02-09 13:10:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Joypad specific settings
|
2009-11-14 17:08:32 +00:00
|
|
|
// Current joypad device ID: PadMapping[i].ID
|
|
|
|
// Current joypad name: joyinfo[PadMapping[i].ID].Name
|
2009-02-09 13:10:29 +00:00
|
|
|
|
2009-11-14 17:08:32 +00:00
|
|
|
// Prevent a crash from illegal access to joyinfo that will only have values for
|
|
|
|
// the current amount of connected PadMapping
|
|
|
|
if((u32)WiiMoteEmu::PadMapping[i].ID >= WiiMoteEmu::joyinfo.size()) continue;
|
2009-11-12 18:57:35 +00:00
|
|
|
|
2009-11-14 17:08:32 +00:00
|
|
|
// Create a section name
|
|
|
|
std::string joySectionName = WiiMoteEmu::joyinfo[WiiMoteEmu::PadMapping[i].ID].Name;
|
|
|
|
|
|
|
|
iniFile.Get(joySectionName.c_str(), "left_x", &WiiMoteEmu::PadMapping[i].Axis.Lx, 0);
|
|
|
|
iniFile.Get(joySectionName.c_str(), "left_y", &WiiMoteEmu::PadMapping[i].Axis.Ly, 1);
|
|
|
|
iniFile.Get(joySectionName.c_str(), "right_x", &WiiMoteEmu::PadMapping[i].Axis.Rx, 2);
|
|
|
|
iniFile.Get(joySectionName.c_str(), "right_y", &WiiMoteEmu::PadMapping[i].Axis.Ry, 3);
|
|
|
|
iniFile.Get(joySectionName.c_str(), "l_trigger", &WiiMoteEmu::PadMapping[i].Axis.Tl, 1004);
|
|
|
|
iniFile.Get(joySectionName.c_str(), "r_trigger", &WiiMoteEmu::PadMapping[i].Axis.Tr, 1005);
|
|
|
|
iniFile.Get(joySectionName.c_str(), "DeadZoneL", &WiiMoteEmu::PadMapping[i].DeadZoneL, 0);
|
|
|
|
iniFile.Get(joySectionName.c_str(), "DeadZoneR", &WiiMoteEmu::PadMapping[i].DeadZoneR, 0);
|
|
|
|
iniFile.Get(joySectionName.c_str(), "Diagonal", &WiiMoteEmu::PadMapping[i].SDiagonal, "100%");
|
|
|
|
iniFile.Get(joySectionName.c_str(), "Circle2Square", &WiiMoteEmu::PadMapping[i].bCircle2Square, false);
|
2009-12-09 14:52:30 +00:00
|
|
|
iniFile.Get(joySectionName.c_str(), "Rumble", &WiiMoteEmu::PadMapping[i].Rumble, true);
|
2009-12-14 03:30:21 +00:00
|
|
|
iniFile.Get(joySectionName.c_str(), "RumbleStrength", &WiiMoteEmu::PadMapping[i].RumbleStrength, 9); // x10
|
2009-12-09 14:52:30 +00:00
|
|
|
iniFile.Get(joySectionName.c_str(), "TriggerType", &WiiMoteEmu::PadMapping[i].triggertype, 0);
|
2009-02-09 13:10:29 +00:00
|
|
|
}
|
2009-07-08 07:16:26 +00:00
|
|
|
// Load the IR cursor settings if it's avaliable for the GameId, if not load the default settings
|
2009-07-28 16:20:54 +00:00
|
|
|
iniFile.Load(FULL_CONFIG_DIR "IR Pointer.ini");
|
2009-07-08 07:16:26 +00:00
|
|
|
char TmpSection[32];
|
|
|
|
sprintf(TmpSection, "%s", g_ISOId ? Hex2Ascii(g_ISOId).c_str() : "Default");
|
|
|
|
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 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
|
|
|
|
|
2009-07-28 16:20:54 +00:00
|
|
|
iniFile.Load(FULL_CONFIG_DIR "gfx_opengl.ini");
|
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
|
|
|
}
|
|
|
|
|
2009-02-10 17:25:08 +00:00
|
|
|
void Config::Save(int Slot)
|
2008-12-08 05:25:12 +00:00
|
|
|
{
|
2009-07-05 04:29:00 +00:00
|
|
|
IniFile iniFile;
|
2009-07-28 16:20:54 +00:00
|
|
|
iniFile.Load(FULL_CONFIG_DIR "Wiimote.ini");
|
2009-12-14 02:23:14 +00:00
|
|
|
// iniFile.Set("Settings", "InputActive", bInputActive);
|
2009-12-09 14:52:30 +00:00
|
|
|
iniFile.Set("Settings", "Sideways", bSideways);
|
|
|
|
iniFile.Set("Settings", "Upright", bUpright);
|
2009-09-15 02:12:55 +00:00
|
|
|
iniFile.Set("Settings", "MotionPlusConnected", bMotionPlusConnected);
|
2009-12-09 14:52:30 +00:00
|
|
|
iniFile.Set("Settings", "ExtensionConnected", iExtensionConnected);
|
2008-12-08 05:25:12 +00:00
|
|
|
|
2009-01-25 23:07:15 +00:00
|
|
|
iniFile.Set("Real", "Connect", bConnectRealWiimote);
|
2009-01-28 16:09:08 +00:00
|
|
|
iniFile.Set("Real", "Use", bUseRealWiimote);
|
2009-02-01 13:01:50 +00:00
|
|
|
iniFile.Set("Real", "UpdateStatus", bUpdateRealWiimote);
|
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-13 04:31:38 +00:00
|
|
|
for (int i = 0; i < 1; i++) // Only got 1 wiimote yet
|
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-06 01:15:13 +00:00
|
|
|
iniFile.Set(SectionName, "NoTriggerFilter", bNoTriggerFilter);
|
2009-12-09 14:52:30 +00:00
|
|
|
iniFile.Set(SectionName, "TiltType", Tilt.Type);;
|
2009-12-14 02:23:14 +00:00
|
|
|
iniFile.Set(SectionName, "TiltRollDegree", Tilt.Range.RollDegree);
|
|
|
|
iniFile.Set(SectionName, "TiltRollSwing", Tilt.Range.RollSwing);
|
|
|
|
iniFile.Set(SectionName, "TiltRollInvert", Tilt.RollInvert);
|
|
|
|
iniFile.Set(SectionName, "TiltPitchDegree", Tilt.Range.PitchDegree);
|
|
|
|
iniFile.Set(SectionName, "TiltPitchSwing", Tilt.Range.PitchSwing);
|
|
|
|
iniFile.Set(SectionName, "TiltPitchInvert", Tilt.PitchInvert);
|
2009-02-15 18:23:42 +00:00
|
|
|
// Wiimote
|
2009-11-09 07:46:43 +00:00
|
|
|
for (int x = 0; x < WM_CONTROLS; x++)
|
2009-07-08 07:16:26 +00:00
|
|
|
iniFile.Set(SectionName, wmControlNames[x], WiiMoteEmu::PadMapping[i].Wm.keyForControls[x]);
|
2009-02-15 18:23:42 +00:00
|
|
|
|
|
|
|
// Nunchuck
|
2009-07-08 07:16:26 +00:00
|
|
|
iniFile.Set(SectionName, "NunchuckStick", Nunchuck.Type);
|
2009-11-09 07:46:43 +00:00
|
|
|
for (int x = 0; x < NC_CONTROLS; x++)
|
2009-07-08 07:16:26 +00:00
|
|
|
iniFile.Set(SectionName, ncControlNames[x], WiiMoteEmu::PadMapping[i].Nc.keyForControls[x]);
|
2009-02-09 13:10:29 +00:00
|
|
|
|
2009-02-24 02:40:17 +00:00
|
|
|
// Classic Controller
|
2009-07-08 07:16:26 +00:00
|
|
|
iniFile.Set(SectionName, "CcLeftStick", ClassicController.LType);
|
|
|
|
iniFile.Set(SectionName, "CcRightStick", ClassicController.RType);
|
|
|
|
iniFile.Set(SectionName, "CcTriggers", ClassicController.TType);
|
2009-11-09 07:46:43 +00:00
|
|
|
for (int x = 0; x < CC_CONTROLS; x++)
|
2009-07-08 07:16:26 +00:00
|
|
|
iniFile.Set(SectionName, ccControlNames[x], WiiMoteEmu::PadMapping[i].Cc.keyForControls[x]);
|
2009-12-09 14:52:30 +00:00
|
|
|
|
2009-07-09 03:58:53 +00:00
|
|
|
// GH3
|
2009-07-18 05:04:36 +00:00
|
|
|
iniFile.Set(SectionName, "GH3Analog", GH3Controller.AType);
|
2009-11-09 07:46:43 +00:00
|
|
|
for (int x = 0; x < GH3_CONTROLS; x++)
|
2009-07-09 03:58:53 +00:00
|
|
|
iniFile.Set(SectionName, gh3ControlNames[x], WiiMoteEmu::PadMapping[i].GH3c.keyForControls[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-11 13:57:25 +00:00
|
|
|
iniFile.Set(SectionName, "Enabled", WiiMoteEmu::PadMapping[i].enabled);
|
2009-07-08 07:16:26 +00:00
|
|
|
iniFile.Set(SectionName, "DeviceID", WiiMoteEmu::PadMapping[i].ID);
|
2009-02-09 13:10:29 +00:00
|
|
|
|
|
|
|
// Joypad specific settings
|
2009-11-14 17:08:32 +00:00
|
|
|
// Current joypad device ID: PadMapping[i].ID
|
|
|
|
// Current joypad name: joyinfo[PadMapping[i].ID].Name
|
|
|
|
|
|
|
|
// Save joypad specific settings. Check for "PadMapping[i].ID < SDL_NumJoysticks()" to
|
|
|
|
// avoid reading a joyinfo that does't exist
|
|
|
|
if((u32)WiiMoteEmu::PadMapping[i].ID >= WiiMoteEmu::joyinfo.size()) continue;
|
2009-02-09 13:10:29 +00:00
|
|
|
|
|
|
|
// Create a new section name after the joypad name
|
2009-11-14 17:08:32 +00:00
|
|
|
std::string joySectionName = WiiMoteEmu::joyinfo[WiiMoteEmu::PadMapping[i].ID].Name;
|
|
|
|
|
2009-07-08 07:16:26 +00:00
|
|
|
iniFile.Set(joySectionName.c_str(), "left_x", WiiMoteEmu::PadMapping[i].Axis.Lx);
|
|
|
|
iniFile.Set(joySectionName.c_str(), "left_y", WiiMoteEmu::PadMapping[i].Axis.Ly);
|
|
|
|
iniFile.Set(joySectionName.c_str(), "right_x", WiiMoteEmu::PadMapping[i].Axis.Rx);
|
|
|
|
iniFile.Set(joySectionName.c_str(), "right_y", WiiMoteEmu::PadMapping[i].Axis.Ry);
|
|
|
|
iniFile.Set(joySectionName.c_str(), "l_trigger", WiiMoteEmu::PadMapping[i].Axis.Tl);
|
|
|
|
iniFile.Set(joySectionName.c_str(), "r_trigger", WiiMoteEmu::PadMapping[i].Axis.Tr);
|
|
|
|
iniFile.Set(joySectionName.c_str(), "DeadZoneL", WiiMoteEmu::PadMapping[i].DeadZoneL);
|
|
|
|
iniFile.Set(joySectionName.c_str(), "DeadZoneR", WiiMoteEmu::PadMapping[i].DeadZoneR);
|
|
|
|
iniFile.Set(joySectionName.c_str(), "Diagonal", WiiMoteEmu::PadMapping[i].SDiagonal);
|
|
|
|
iniFile.Set(joySectionName.c_str(), "Circle2Square", WiiMoteEmu::PadMapping[i].bCircle2Square);
|
2009-12-09 14:52:30 +00:00
|
|
|
iniFile.Set(joySectionName.c_str(), "Rumble", WiiMoteEmu::PadMapping[i].Rumble);
|
|
|
|
iniFile.Set(joySectionName.c_str(), "RumbleStrength", WiiMoteEmu::PadMapping[i].RumbleStrength);
|
|
|
|
iniFile.Set(joySectionName.c_str(), "TriggerType", WiiMoteEmu::PadMapping[i].triggertype);
|
2009-02-09 13:10:29 +00:00
|
|
|
}
|
|
|
|
|
2009-07-28 16:20:54 +00:00
|
|
|
iniFile.Save(FULL_CONFIG_DIR "Wiimote.ini");
|
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
|
2009-07-28 16:20:54 +00:00
|
|
|
iniFile.Load(FULL_CONFIG_DIR "IR Pointer.ini");
|
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);
|
2009-07-28 16:20:54 +00:00
|
|
|
iniFile.Save(FULL_CONFIG_DIR "IR Pointer.ini");
|
2009-02-26 00:35:17 +00:00
|
|
|
|
2009-09-15 02:12:55 +00:00
|
|
|
//DEBUG_LOG(WIIMOTE, "Save()");
|
2009-11-15 22:26:39 +00:00
|
|
|
}
|