diff --git a/Source/Core/InputCommon/Src/SDL.h b/Source/Core/InputCommon/Src/SDL.h index 550b8cc4d0..e1a0b8417c 100644 --- a/Source/Core/InputCommon/Src/SDL.h +++ b/Source/Core/InputCommon/Src/SDL.h @@ -173,32 +173,29 @@ struct PadAxis }; struct PadWiimote { - int A; - int B; - int One; - int Two; - int P; - int M; - int H; - int L, R, U, D; - int Shake; - int PitchL, PitchR; + int keyForControls[14]; + // Order is A, B, 1, 2, +, -, Home + // L, R, U, D, Shake, PitchL, PitchR }; + struct PadNunchuck { - int Z; - int C; - int L, R, U, D; - int Shake; + int keyForControls[7]; + // Order is Z, C, L, R, U, D, Shake }; struct PadClassicController { - int A, B, X, Y; - int P, M, H; - int Tl, Zl, Zr, Tr; - int Dl, Du, Dr, Dd; - int Ll, Lu, Lr, Ld; - int Rl, Ru, Rr, Rd; + int keyForControls[23]; + // Order is A, B, X, Y, +, -, Home + // Tl, Zl, Zr, Tr, Dl, Du, Dr, Dd + // Ll, Lu, Lr, Ld, Rl, Ru, Rr, Rd +}; +struct PadGH3Controller +{ + int keyForControls[14]; + // Order is Green, Red, Yellow, Blue, Orange, + // +, -, Whammy, Al, Au, Ar, Ad, + // StrumUp, StrumDown }; struct CONTROLLER_STATE_NEW // GC PAD INFO/STATE { @@ -211,6 +208,7 @@ struct CONTROLLER_MAPPING_NEW // GC PAD MAPPING PadWiimote Wm; PadNunchuck Nc; PadClassicController Cc; + PadGH3Controller GH3c; bool enabled; // Pad attached? int DeadZoneL; // Analog 1 Deadzone int DeadZoneR; // Analog 2 Deadzone diff --git a/Source/Plugins/Plugin_Wiimote/Src/Config.cpp b/Source/Plugins/Plugin_Wiimote/Src/Config.cpp index d8a937c75e..7a66c23ec4 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/Config.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/Config.cpp @@ -67,153 +67,85 @@ void Config::Load(bool ChangePad) iniFile.Get("Real", "AccNunNeutralY", &iAccNunNeutralY, 0); iniFile.Get("Real", "AccNunNeutralZ", &iAccNunNeutralZ, 0); - // Default controls - int WmA = 65, WmB = 66, - Wm1 = 49, Wm2 = 50, - WmP = 80, WmM = 77, WmH = 72, - WmL = VK_LEFT, WmR = VK_RIGHT, WmU = VK_UP, WmD = VK_DOWN, // Regular directional keys - WmShake = 83, // S - WmPitchL = 51, WmPitchR = 52, // 3 and 4 - - NcZ = 90, NcC = 67, // C, Z - NcL = VK_NUMPAD4, NcR = VK_NUMPAD6, NcU = VK_NUMPAD8, NcD = VK_NUMPAD5, // Numpad - NcShake = 68, // D - - CcA = 90, CcB = 67, CcX = 0x58, CcY = 0x59, // C, Z, X, Y - CcP = 0x4f, CcM = 0x4e, CcH = 0x55, // O instead of P, N instead of M, U instead of H - CcTl = 0x37, CcZl = 0x38, CcZr = 0x39, CcTr = 0x30, // 7, 8, 9, 0 - CcDl = VK_NUMPAD4, CcDu = VK_NUMPAD8, CcDr = VK_NUMPAD6, CcDd = VK_NUMPAD5, // Numpad - CcLl = 0x4a, CcLu = 0x49, CcLr = 0x4c, CcLd = 0x4b, // J, I, L, K - CcRl = 0x44, CcRu = 0x52, CcRr = 0x47, CcRd = 0x46; // D, R, G, F - for (int i = 0; i < 1; i++) { - // ================================================================== // Slot specific settings - // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ - std::string SectionName = StringFromFormat("Wiimote%i", i + 1); - iniFile.Get(SectionName.c_str(), "NoTriggerFilter", &bNoTriggerFilter, false); - iniFile.Get(SectionName.c_str(), "TriggerType", &Trigger.Type, Trigger.TRIGGER_OFF); - iniFile.Get(SectionName.c_str(), "TriggerRollRange", &Trigger.Range.Roll, 50); - iniFile.Get(SectionName.c_str(), "TriggerPitchRange", &Trigger.Range.Pitch, false); + char SectionName[32]; + sprintf(SectionName, "Wiimote%i", i + 1); + iniFile.Get(SectionName, "NoTriggerFilter", &bNoTriggerFilter, false); + iniFile.Get(SectionName, "TriggerType", &Trigger.Type, Trigger.TRIGGER_OFF); + iniFile.Get(SectionName, "TriggerRollRange", &Trigger.Range.Roll, 50); + iniFile.Get(SectionName, "TriggerPitchRange", &Trigger.Range.Pitch, false); // Wiimote - iniFile.Get(SectionName.c_str(), "WmA", &WiiMoteEmu::PadMapping[i].Wm.A, WmA); - iniFile.Get(SectionName.c_str(), "WmB", &WiiMoteEmu::PadMapping[i].Wm.B, WmB); - iniFile.Get(SectionName.c_str(), "Wm1", &WiiMoteEmu::PadMapping[i].Wm.One, Wm1); - iniFile.Get(SectionName.c_str(), "Wm2", &WiiMoteEmu::PadMapping[i].Wm.Two, Wm2); - iniFile.Get(SectionName.c_str(), "WmP", &WiiMoteEmu::PadMapping[i].Wm.P, WmP); - iniFile.Get(SectionName.c_str(), "WmM", &WiiMoteEmu::PadMapping[i].Wm.M, WmM); - iniFile.Get(SectionName.c_str(), "WmH", &WiiMoteEmu::PadMapping[i].Wm.H, WmH); - iniFile.Get(SectionName.c_str(), "WmL", &WiiMoteEmu::PadMapping[i].Wm.L, WmL); - iniFile.Get(SectionName.c_str(), "WmR", &WiiMoteEmu::PadMapping[i].Wm.R, WmR); - iniFile.Get(SectionName.c_str(), "WmU", &WiiMoteEmu::PadMapping[i].Wm.U, WmU); - iniFile.Get(SectionName.c_str(), "WmD", &WiiMoteEmu::PadMapping[i].Wm.D, WmD); - iniFile.Get(SectionName.c_str(), "WmShake", &WiiMoteEmu::PadMapping[i].Wm.Shake, WmShake); - iniFile.Get(SectionName.c_str(), "WmPitchL", &WiiMoteEmu::PadMapping[i].Wm.PitchL, WmPitchL); - iniFile.Get(SectionName.c_str(), "WmPitchR", &WiiMoteEmu::PadMapping[i].Wm.PitchR, WmPitchR); - + for (int x = 0; x < 14; x++) + iniFile.Get(SectionName, wmControlNames[x], &WiiMoteEmu::PadMapping[i].Wm.keyForControls[x], wmDefaultControls[x]); // Nunchuck - iniFile.Get(SectionName.c_str(), "NunchuckStick", &Nunchuck.Type, Nunchuck.KEYBOARD); - iniFile.Get(SectionName.c_str(), "NcZ", &WiiMoteEmu::PadMapping[i].Nc.Z, NcZ); - iniFile.Get(SectionName.c_str(), "NcC", &WiiMoteEmu::PadMapping[i].Nc.C, NcC); - iniFile.Get(SectionName.c_str(), "NcL", &WiiMoteEmu::PadMapping[i].Nc.L, NcL); - iniFile.Get(SectionName.c_str(), "NcR", &WiiMoteEmu::PadMapping[i].Nc.R, NcR); - iniFile.Get(SectionName.c_str(), "NcU", &WiiMoteEmu::PadMapping[i].Nc.U, NcU); - iniFile.Get(SectionName.c_str(), "NcD", &WiiMoteEmu::PadMapping[i].Nc.D, NcD); - iniFile.Get(SectionName.c_str(), "NcShake", &WiiMoteEmu::PadMapping[i].Nc.Shake, NcShake); + iniFile.Get(SectionName, "NunchuckStick", &Nunchuck.Type, Nunchuck.KEYBOARD); + for (int x = 0; x < 7; x++) + iniFile.Get(SectionName, ncControlNames[x], &WiiMoteEmu::PadMapping[i].Nc.keyForControls[x], nCDefaultControls[x]); // Classic Controller - iniFile.Get(SectionName.c_str(), "CcLeftStick", &ClassicController.LType, ClassicController.KEYBOARD); - iniFile.Get(SectionName.c_str(), "CcRightStick", &ClassicController.RType, ClassicController.KEYBOARD); - iniFile.Get(SectionName.c_str(), "CcTriggers", &ClassicController.TType, ClassicController.KEYBOARD); - iniFile.Get(SectionName.c_str(), "CcA", &WiiMoteEmu::PadMapping[i].Cc.A, CcA); - iniFile.Get(SectionName.c_str(), "CcB", &WiiMoteEmu::PadMapping[i].Cc.B, CcB); - iniFile.Get(SectionName.c_str(), "CcX", &WiiMoteEmu::PadMapping[i].Cc.X, CcX); - iniFile.Get(SectionName.c_str(), "CcY", &WiiMoteEmu::PadMapping[i].Cc.Y, CcY); - iniFile.Get(SectionName.c_str(), "CcP", &WiiMoteEmu::PadMapping[i].Cc.P, CcP); - iniFile.Get(SectionName.c_str(), "CcM", &WiiMoteEmu::PadMapping[i].Cc.M, CcM); - iniFile.Get(SectionName.c_str(), "CcH", &WiiMoteEmu::PadMapping[i].Cc.H, CcH); - iniFile.Get(SectionName.c_str(), "CcTl", &WiiMoteEmu::PadMapping[i].Cc.Tl, CcTl); - iniFile.Get(SectionName.c_str(), "CcZl", &WiiMoteEmu::PadMapping[i].Cc.Zl, CcZl); - iniFile.Get(SectionName.c_str(), "CcZr", &WiiMoteEmu::PadMapping[i].Cc.Zr, CcZr); - iniFile.Get(SectionName.c_str(), "CcTr", &WiiMoteEmu::PadMapping[i].Cc.Tr, CcTr); - iniFile.Get(SectionName.c_str(), "CcDl", &WiiMoteEmu::PadMapping[i].Cc.Dl, CcDl); - iniFile.Get(SectionName.c_str(), "CcDu", &WiiMoteEmu::PadMapping[i].Cc.Du, CcDu); - iniFile.Get(SectionName.c_str(), "CcDr", &WiiMoteEmu::PadMapping[i].Cc.Dr, CcDr); - iniFile.Get(SectionName.c_str(), "CcDd", &WiiMoteEmu::PadMapping[i].Cc.Dd, CcDd); - iniFile.Get(SectionName.c_str(), "CcLl", &WiiMoteEmu::PadMapping[i].Cc.Ll, CcLl); - iniFile.Get(SectionName.c_str(), "CcLu", &WiiMoteEmu::PadMapping[i].Cc.Lu, CcLu); - iniFile.Get(SectionName.c_str(), "CcLr", &WiiMoteEmu::PadMapping[i].Cc.Lr, CcLr); - iniFile.Get(SectionName.c_str(), "CcLd", &WiiMoteEmu::PadMapping[i].Cc.Ld, CcLd); - iniFile.Get(SectionName.c_str(), "CcRl", &WiiMoteEmu::PadMapping[i].Cc.Rl, CcRl); - iniFile.Get(SectionName.c_str(), "CcRu", &WiiMoteEmu::PadMapping[i].Cc.Ru, CcRu); - iniFile.Get(SectionName.c_str(), "CcRr", &WiiMoteEmu::PadMapping[i].Cc.Rr, CcRr); - iniFile.Get(SectionName.c_str(), "CcRd", &WiiMoteEmu::PadMapping[i].Cc.Rd, CcRd); + iniFile.Get(SectionName, "CcLeftStick", &ClassicController.LType, ClassicController.KEYBOARD); + iniFile.Get(SectionName, "CcRightStick", &ClassicController.RType, ClassicController.KEYBOARD); + iniFile.Get(SectionName, "CcTriggers", &ClassicController.TType, ClassicController.KEYBOARD); + for (int x = 0; x < 23; x++) + iniFile.Get(SectionName, ccControlNames[x], &WiiMoteEmu::PadMapping[i].Cc.keyForControls[x], ccDefaultControls[x]); + for (int x = 0; x < 14; x++) + iniFile.Get(SectionName, gh3ControlNames[x], &WiiMoteEmu::PadMapping[i].GH3c.keyForControls[x], GH3DefaultControls[x]); // Don't update this when we are loading settings from the ConfigBox if(!ChangePad) { - /* 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.c_str(), "DeviceID", &WiiMoteEmu::PadMapping[i].ID, 0); - iniFile.Get(SectionName.c_str(), "Enabled", &WiiMoteEmu::PadMapping[i].enabled, true); + // 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); } - // =================== - // ================================================================== // Joypad specific settings - // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ // Current joypad device ID: PadMapping[i].ID // Current joypad name: joyinfo[PadMapping[i].ID].Name - /* Prevent a crash from illegal access to joyinfo that will only have values for - the current amount of connected PadMapping */ + // 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; // Create a section name - SectionName = WiiMoteEmu::joyinfo[WiiMoteEmu::PadMapping[i].ID].Name; + std::string joySectionName = WiiMoteEmu::joyinfo[WiiMoteEmu::PadMapping[i].ID].Name; - iniFile.Get(SectionName.c_str(), "left_x", &WiiMoteEmu::PadMapping[i].Axis.Lx, 0); - iniFile.Get(SectionName.c_str(), "left_y", &WiiMoteEmu::PadMapping[i].Axis.Ly, 1); - iniFile.Get(SectionName.c_str(), "right_x", &WiiMoteEmu::PadMapping[i].Axis.Rx, 2); - iniFile.Get(SectionName.c_str(), "right_y", &WiiMoteEmu::PadMapping[i].Axis.Ry, 3); - iniFile.Get(SectionName.c_str(), "l_trigger", &WiiMoteEmu::PadMapping[i].Axis.Tl, 1004); - iniFile.Get(SectionName.c_str(), "r_trigger", &WiiMoteEmu::PadMapping[i].Axis.Tr, 1005); - iniFile.Get(SectionName.c_str(), "DeadZoneL", &WiiMoteEmu::PadMapping[i].DeadZoneL, 0); - iniFile.Get(SectionName.c_str(), "DeadZoneR", &WiiMoteEmu::PadMapping[i].DeadZoneR, 0); - iniFile.Get(SectionName.c_str(), "TriggerType", &WiiMoteEmu::PadMapping[i].triggertype, 0); - iniFile.Get(SectionName.c_str(), "Diagonal", &WiiMoteEmu::PadMapping[i].SDiagonal, "100%"); - iniFile.Get(SectionName.c_str(), "Circle2Square", &WiiMoteEmu::PadMapping[i].bCircle2Square, false); - iniFile.Get(SectionName.c_str(), "RollInvert", &WiiMoteEmu::PadMapping[i].bRollInvert, false); - iniFile.Get(SectionName.c_str(), "PitchInvert", &WiiMoteEmu::PadMapping[i].bPitchInvert, false); + 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(), "TriggerType", &WiiMoteEmu::PadMapping[i].triggertype, 0); + iniFile.Get(joySectionName.c_str(), "Diagonal", &WiiMoteEmu::PadMapping[i].SDiagonal, "100%"); + iniFile.Get(joySectionName.c_str(), "Circle2Square", &WiiMoteEmu::PadMapping[i].bCircle2Square, false); + iniFile.Get(joySectionName.c_str(), "RollInvert", &WiiMoteEmu::PadMapping[i].bRollInvert, false); + iniFile.Get(joySectionName.c_str(), "PitchInvert", &WiiMoteEmu::PadMapping[i].bPitchInvert, false); } - // ============================= - - // ================================================================== - // Load the IR cursor settings if it's avaliable, if not load the default settings - // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ + // Load the IR cursor settings if it's avaliable for the GameId, 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 = "Default"; - 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); - // ============================= + 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 - // ================================================================== - /* 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 */ - // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ iniFile.Load(FULL_CONFIG_DIR "gfx_opengl.ini"); iniFile.Get("Settings", "KeepAR_4_3", &bKeepAR43, false); iniFile.Get("Settings", "KeepAR_16_9", &bKeepAR169, false); iniFile.Get("Settings", "Crop", &bCrop, false); - // ============================= - // Logging - INFO_LOG(CONSOLE, "Load()\n"); + //INFO_LOG(CONSOLE, "Load()\n"); } void Config::Save(int Slot) @@ -235,120 +167,74 @@ void Config::Save(int Slot) for (int i = 0; i < 1; i++) { - // ================================================================== // Slot specific settings - // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ - std::string SectionName = StringFromFormat("Wiimote%i", i + 1); - iniFile.Set(SectionName.c_str(), "Enabled", WiiMoteEmu::PadMapping[i].enabled); - iniFile.Set(SectionName.c_str(), "NoTriggerFilter", bNoTriggerFilter); - iniFile.Set(SectionName.c_str(), "TriggerType", Trigger.Type); - iniFile.Set(SectionName.c_str(), "TriggerRollRange", Trigger.Range.Roll); - iniFile.Set(SectionName.c_str(), "TriggerPitchRange", Trigger.Range.Pitch); + char SectionName[32]; + sprintf(SectionName, "Wiimote%i", i + 1); + + iniFile.Set(SectionName, "Enabled", WiiMoteEmu::PadMapping[i].enabled); + iniFile.Set(SectionName, "NoTriggerFilter", bNoTriggerFilter); + iniFile.Set(SectionName, "TriggerType", Trigger.Type); + iniFile.Set(SectionName, "TriggerRollRange", Trigger.Range.Roll); + iniFile.Set(SectionName, "TriggerPitchRange", Trigger.Range.Pitch); // Wiimote - iniFile.Set(SectionName.c_str(), "WmA", WiiMoteEmu::PadMapping[i].Wm.A); - iniFile.Set(SectionName.c_str(), "WmB", WiiMoteEmu::PadMapping[i].Wm.B); - iniFile.Set(SectionName.c_str(), "Wm1", WiiMoteEmu::PadMapping[i].Wm.One); - iniFile.Set(SectionName.c_str(), "Wm2", WiiMoteEmu::PadMapping[i].Wm.Two); - iniFile.Set(SectionName.c_str(), "WmP", WiiMoteEmu::PadMapping[i].Wm.P); - iniFile.Set(SectionName.c_str(), "WmM", WiiMoteEmu::PadMapping[i].Wm.M); - iniFile.Set(SectionName.c_str(), "WmH", WiiMoteEmu::PadMapping[i].Wm.H); - iniFile.Set(SectionName.c_str(), "WmL", WiiMoteEmu::PadMapping[i].Wm.L); - iniFile.Set(SectionName.c_str(), "WmR", WiiMoteEmu::PadMapping[i].Wm.R); - iniFile.Set(SectionName.c_str(), "WmU", WiiMoteEmu::PadMapping[i].Wm.U); - iniFile.Set(SectionName.c_str(), "WmD", WiiMoteEmu::PadMapping[i].Wm.D); - iniFile.Set(SectionName.c_str(), "WmShake", WiiMoteEmu::PadMapping[i].Wm.Shake); - iniFile.Set(SectionName.c_str(), "WmPitchL", WiiMoteEmu::PadMapping[i].Wm.PitchL); - iniFile.Set(SectionName.c_str(), "WmPitchR", WiiMoteEmu::PadMapping[i].Wm.PitchR); + for (int x = 0; x < 14; x++) + iniFile.Set(SectionName, wmControlNames[x], WiiMoteEmu::PadMapping[i].Wm.keyForControls[x]); // Nunchuck - iniFile.Set(SectionName.c_str(), "NunchuckStick", Nunchuck.Type); - iniFile.Set(SectionName.c_str(), "NcZ", WiiMoteEmu::PadMapping[i].Nc.Z); - iniFile.Set(SectionName.c_str(), "NcC", WiiMoteEmu::PadMapping[i].Nc.C); - iniFile.Set(SectionName.c_str(), "NcL", WiiMoteEmu::PadMapping[i].Nc.L); - iniFile.Set(SectionName.c_str(), "NcR", WiiMoteEmu::PadMapping[i].Nc.R); - iniFile.Set(SectionName.c_str(), "NcU", WiiMoteEmu::PadMapping[i].Nc.U); - iniFile.Set(SectionName.c_str(), "NcD", WiiMoteEmu::PadMapping[i].Nc.D); - iniFile.Set(SectionName.c_str(), "NcShake", WiiMoteEmu::PadMapping[i].Nc.Shake); + iniFile.Set(SectionName, "NunchuckStick", Nunchuck.Type); + for (int x = 0; x < 7; x++) + iniFile.Set(SectionName, ncControlNames[x], WiiMoteEmu::PadMapping[i].Nc.keyForControls[x]); // Classic Controller - iniFile.Set(SectionName.c_str(), "CcLeftStick", ClassicController.LType); - iniFile.Set(SectionName.c_str(), "CcRightStick", ClassicController.RType); - iniFile.Set(SectionName.c_str(), "CcTriggers", ClassicController.TType); - iniFile.Set(SectionName.c_str(), "CcA", WiiMoteEmu::PadMapping[i].Cc.A); - iniFile.Set(SectionName.c_str(), "CcB", WiiMoteEmu::PadMapping[i].Cc.B); - iniFile.Set(SectionName.c_str(), "CcX", WiiMoteEmu::PadMapping[i].Cc.X); - iniFile.Set(SectionName.c_str(), "CcY", WiiMoteEmu::PadMapping[i].Cc.Y); - iniFile.Set(SectionName.c_str(), "CcP", WiiMoteEmu::PadMapping[i].Cc.P); - iniFile.Set(SectionName.c_str(), "CcM", WiiMoteEmu::PadMapping[i].Cc.M); - iniFile.Set(SectionName.c_str(), "CcH", WiiMoteEmu::PadMapping[i].Cc.H); - iniFile.Set(SectionName.c_str(), "CcTl", WiiMoteEmu::PadMapping[i].Cc.Tl); - iniFile.Set(SectionName.c_str(), "CcZl", WiiMoteEmu::PadMapping[i].Cc.Zl); - iniFile.Set(SectionName.c_str(), "CcZr", WiiMoteEmu::PadMapping[i].Cc.Zr); - iniFile.Set(SectionName.c_str(), "CcTr", WiiMoteEmu::PadMapping[i].Cc.Tr); - iniFile.Set(SectionName.c_str(), "CcDl", WiiMoteEmu::PadMapping[i].Cc.Dl); - iniFile.Set(SectionName.c_str(), "CcDu", WiiMoteEmu::PadMapping[i].Cc.Du); - iniFile.Set(SectionName.c_str(), "CcDr", WiiMoteEmu::PadMapping[i].Cc.Dr); - iniFile.Set(SectionName.c_str(), "CcDd", WiiMoteEmu::PadMapping[i].Cc.Dd); - iniFile.Set(SectionName.c_str(), "CcLl", WiiMoteEmu::PadMapping[i].Cc.Ll); - iniFile.Set(SectionName.c_str(), "CcLu", WiiMoteEmu::PadMapping[i].Cc.Lu); - iniFile.Set(SectionName.c_str(), "CcLr", WiiMoteEmu::PadMapping[i].Cc.Lr); - iniFile.Set(SectionName.c_str(), "CcLd", WiiMoteEmu::PadMapping[i].Cc.Ld); - iniFile.Set(SectionName.c_str(), "CcRl", WiiMoteEmu::PadMapping[i].Cc.Rl); - iniFile.Set(SectionName.c_str(), "CcRu", WiiMoteEmu::PadMapping[i].Cc.Ru); - iniFile.Set(SectionName.c_str(), "CcRr", WiiMoteEmu::PadMapping[i].Cc.Rr); - iniFile.Set(SectionName.c_str(), "CcRd", WiiMoteEmu::PadMapping[i].Cc.Rd); + iniFile.Set(SectionName, "CcLeftStick", ClassicController.LType); + iniFile.Set(SectionName, "CcRightStick", ClassicController.RType); + iniFile.Set(SectionName, "CcTriggers", ClassicController.TType); + for (int x = 0; x < 23; x++) + iniFile.Set(SectionName, ccControlNames[x], WiiMoteEmu::PadMapping[i].Cc.keyForControls[x]); // Save the physical device ID number - iniFile.Set(SectionName.c_str(), "DeviceID", WiiMoteEmu::PadMapping[i].ID); - // =================== + iniFile.Set(SectionName, "DeviceID", WiiMoteEmu::PadMapping[i].ID); - // ================================================================== // Joypad specific settings - // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ - // Current joypad device ID: PadMapping[i].ID - // Current joypad name: joyinfo[PadMapping[i].ID].Name + // 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 */ + // 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; // Create a new section name after the joypad name - SectionName = WiiMoteEmu::joyinfo[WiiMoteEmu::PadMapping[i].ID].Name; + std::string joySectionName = WiiMoteEmu::joyinfo[WiiMoteEmu::PadMapping[i].ID].Name; - iniFile.Set(SectionName.c_str(), "left_x", WiiMoteEmu::PadMapping[i].Axis.Lx); - iniFile.Set(SectionName.c_str(), "left_y", WiiMoteEmu::PadMapping[i].Axis.Ly); - iniFile.Set(SectionName.c_str(), "right_x", WiiMoteEmu::PadMapping[i].Axis.Rx); - iniFile.Set(SectionName.c_str(), "right_y", WiiMoteEmu::PadMapping[i].Axis.Ry); - iniFile.Set(SectionName.c_str(), "l_trigger", WiiMoteEmu::PadMapping[i].Axis.Tl); - iniFile.Set(SectionName.c_str(), "r_trigger", WiiMoteEmu::PadMapping[i].Axis.Tr); + 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(SectionName.c_str(), "DeadZoneL", WiiMoteEmu::PadMapping[i].DeadZoneL); - iniFile.Set(SectionName.c_str(), "DeadZoneR", WiiMoteEmu::PadMapping[i].DeadZoneR); - //iniFile.Set(SectionName.c_str(), "controllertype", WiiMoteEmu::PadMapping[i].controllertype); - iniFile.Set(SectionName.c_str(), "TriggerType", WiiMoteEmu::PadMapping[i].triggertype); - iniFile.Set(SectionName.c_str(), "Diagonal", WiiMoteEmu::PadMapping[i].SDiagonal); - iniFile.Set(SectionName.c_str(), "Circle2Square", WiiMoteEmu::PadMapping[i].bCircle2Square); - iniFile.Set(SectionName.c_str(), "RollInvert", WiiMoteEmu::PadMapping[i].bRollInvert); - iniFile.Set(SectionName.c_str(), "PitchInvert", WiiMoteEmu::PadMapping[i].bPitchInvert); - // ====================================== + 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(), "controllertype", WiiMoteEmu::PadMapping[i].controllertype); + iniFile.Set(joySectionName.c_str(), "TriggerType", WiiMoteEmu::PadMapping[i].triggertype); + iniFile.Set(joySectionName.c_str(), "Diagonal", WiiMoteEmu::PadMapping[i].SDiagonal); + iniFile.Set(joySectionName.c_str(), "Circle2Square", WiiMoteEmu::PadMapping[i].bCircle2Square); + iniFile.Set(joySectionName.c_str(), "RollInvert", WiiMoteEmu::PadMapping[i].bRollInvert); + iniFile.Set(joySectionName.c_str(), "PitchInvert", WiiMoteEmu::PadMapping[i].bPitchInvert); } - iniFile.Save(FULL_CONFIG_DIR "Wiimote.ini"); + iniFile.Save(FULL_CONFIG_DIR "Wiimote.ini"); - // ================================================================== - // Save the IR cursor settings if it's avaliable, if not save the default settings - // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ + // Save the IR cursor settings if it's avaliable for the GameId, 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 = "Default"; - 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); + 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); iniFile.Save(FULL_CONFIG_DIR "IR Pointer.ini"); - // ============================= - // Logging - INFO_LOG(CONSOLE, "Save()\n"); + //INFO_LOG(CONSOLE, "Save()\n"); } \ No newline at end of file diff --git a/Source/Plugins/Plugin_Wiimote/Src/Config.h b/Source/Plugins/Plugin_Wiimote/Src/Config.h index 3f81fadd90..8dab0efc7b 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/Config.h +++ b/Source/Plugins/Plugin_Wiimote/Src/Config.h @@ -18,6 +18,7 @@ #ifndef _PLUGIN_WIIMOTE_CONFIG_H #define _PLUGIN_WIIMOTE_CONFIG_H +#define GH3_CONTROLS 14 enum { EXT_NONE = 0, @@ -110,5 +111,152 @@ struct Config bool bKeepAR43, bKeepAR169, bCrop; }; +// Ini Control Names +// Do not change the order unless you change the related arrays +static const char* wmControlNames[] = // 14 +{ + "WmA", + "WmB", + "Wm1", + "Wm2", + "WmP", + "WmM", + "WmH", + "WmL", + "WmR", + "WmU", + "WmD", + "WmShake", + "WmPitchL", + "WmPitchR", + }; +static const char* ncControlNames[] = // 7 +{ + "NcZ", + "NcC", + "NcL", + "NcR", + "NcU", + "NcD", + "NcShake", +}; + +static const char* ccControlNames[] = // 23 +{ + "CcA", + "CcB", + "CcX", + "CcY", + "CcP", + "CcM", + "CcH", + "CcTl", + "CcZl", + "CcZr", + "CcTr", + "CcDl", + "CcDu", + "CcDr", + "CcDd", + "CcLl", + "CcLu", + "CcLr", + "CcLd", + "CcRl", + "CcRu", + "CcRr", + "CcRd", +}; + +static const char* gh3ControlNames[] = +{ + "GH3Green", + "GH3Red", + "GH3Yellow", + "GH3Blue", + "GH3Orange", + "GH3Plus", + "GH3Minus", + "GH3Whammy", + "GH3Al", + "GH3Au", + "GH3Ar", + "GH3Ad", + "GH3StrumUp", + "GH3StrumDown", +}; +// Default controls +static int wmDefaultControls[] = +{ + 65, // WmA + 66, // WmB + 49, // Wm1 + 50, // Wm2 + 80, // WmP + 77, // WmM + 72, // WmH + VK_LEFT, // Regular directional keys + VK_RIGHT, + VK_UP, + VK_DOWN, + 83, // WmShake (S) + 51, // WmPitchL (3) + 52, // WmPitchR (4) +}; +static int nCDefaultControls[] = +{ + 90, // NcZ Z + 67, // NcC C + VK_NUMPAD4, // NcL + VK_NUMPAD6, // NcR + VK_NUMPAD8, // NcU + VK_NUMPAD5, // NcD +68, // NcShake D +}; + +static int ccDefaultControls[] = +{ + 90, // CcA (C) + 67, // CcB (Z) + 0x58, // CcX (X) + 0x59, // CcY (Y) + 0x4f, // CcP O instead of P + 0x4e, // CcM N instead of M + 0x55, // CcH U instead of H + 0x37, // CcTl 7 + 0x38, // CcZl 8 + 0x39, // CcZr 9 + 0x30, // CcTr 0 + VK_NUMPAD4, //CcDl + VK_NUMPAD8, // CcDu + VK_NUMPAD6, // CcDr + VK_NUMPAD5, // CcDd + 0x4a, // CcLl J + 0x49, // CcLu I + 0x4c, // CcLr L + 0x4b, // CcLd K + 0x44, // CcRl D + 0x52, // CcRu R + 0x47, // CcRr G + 0x46, // CcRd F +}; +static int GH3DefaultControls[] = +{ + 0, // GH3Green + 0, // GH3Red + 0, // GH3Yellow + 0, // GH3Blue + 0, // GH3Orange + 0, // GH3Plus + 0, // GH3Minus + 0, // GH3Whammy + 0, // GH3Al + 0, // GH3Au + 0, // GH3Ar + 0, // GH3Ad + 13, // GH3StrumUp + 161, // GH3StrumDown +}; + extern Config g_Config; #endif // _PLUGIN_WIIMOTE_CONFIG_H \ No newline at end of file diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp index 4353932f8b..8d36640a31 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp @@ -15,18 +15,11 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ -#include "CommonTypes.h" // for u16 -#include "IniFile.h" -#include "Timer.h" - -#include "wiimote_real.h" // Local #include "wiimote_hid.h" #include "main.h" #include "ConfigPadDlg.h" #include "Config.h" -#include "EmuMain.h" // for LoadRecordedMovements() -#include "EmuSubroutines.h" // for WmRequestStatus -#include "EmuDefinitions.h" // for joyinfo +#include "EmuMain.h" // for WiiMoteEmu class // Change Joystick /* Function: When changing the joystick we save and load the settings and @@ -147,57 +140,57 @@ void WiimotePadConfigDialog::UpdateGUIButtonMapping(int controller) // Wiimote #ifdef _WIN32 - m_bWmA[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.A).c_str())); - m_bWmB[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.B).c_str())); - m_bWm1[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.One).c_str())); - m_bWm2[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.Two).c_str())); - m_bWmP[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.P).c_str())); - m_bWmM[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.M).c_str())); - m_bWmH[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.H).c_str())); - m_bWmL[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.L).c_str())); - m_bWmR[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.R).c_str())); - m_bWmU[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.U).c_str())); - m_bWmD[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.D).c_str())); - m_bWmShake[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.Shake).c_str())); - m_bWmPitchL[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.PitchL).c_str())); - m_bWmPitchR[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.PitchR).c_str())); + m_bWmA[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.keyForControls[0]).c_str())); + m_bWmB[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.keyForControls[1]).c_str())); + m_bWm1[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.keyForControls[2]).c_str())); + m_bWm2[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.keyForControls[3]).c_str())); + m_bWmP[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.keyForControls[4]).c_str())); + m_bWmM[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.keyForControls[5]).c_str())); + m_bWmH[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.keyForControls[6]).c_str())); + m_bWmL[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.keyForControls[7]).c_str())); + m_bWmR[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.keyForControls[8]).c_str())); + m_bWmU[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.keyForControls[9]).c_str())); + m_bWmD[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.keyForControls[10]).c_str())); + m_bWmShake[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.keyForControls[11]).c_str())); + m_bWmPitchL[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.keyForControls[12]).c_str())); + m_bWmPitchR[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.keyForControls[13]).c_str())); // Nunchuck - m_bNcZ[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Nc.Z).c_str())); - m_bNcC[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Nc.C).c_str())); - m_bNcL[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Nc.L).c_str())); - m_bNcR[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Nc.R).c_str())); - m_bNcU[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Nc.U).c_str())); - m_bNcD[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Nc.D).c_str())); - m_bNcShake[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Nc.Shake).c_str())); + m_bNcZ[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Nc.keyForControls[0]).c_str())); + m_bNcC[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Nc.keyForControls[1]).c_str())); + m_bNcL[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Nc.keyForControls[2]).c_str())); + m_bNcR[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Nc.keyForControls[3]).c_str())); + m_bNcU[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Nc.keyForControls[4]).c_str())); + m_bNcD[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Nc.keyForControls[5]).c_str())); + m_bNcShake[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Nc.keyForControls[6]).c_str())); // Classic Controller - m_bCcA[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.A).c_str())); - m_bCcB[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.B).c_str())); - m_bCcX[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.X).c_str())); - m_bCcY[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.Y).c_str())); - m_bCcP[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.P).c_str())); - m_bCcM[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.M).c_str())); - m_bCcH[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.H).c_str())); - m_bCcTl[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.Tl).c_str())); - m_bCcZl[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.Zl).c_str())); - m_bCcZr[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.Zr).c_str())); - m_bCcTr[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.Tr).c_str())); - m_bCcDl[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.Dl).c_str())); - m_bCcDu[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.Du).c_str())); - m_bCcDr[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.Dr).c_str())); - m_bCcDd[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.Dd).c_str())); - m_bCcLl[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.Ll).c_str())); - m_bCcLu[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.Lu).c_str())); - m_bCcLr[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.Lr).c_str())); - m_bCcLd[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.Ld).c_str())); - m_bCcRl[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.Rl).c_str())); - m_bCcRu[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.Ru).c_str())); - m_bCcRr[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.Rr).c_str())); - m_bCcRd[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.Rd).c_str())); + m_bCcA[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.keyForControls[0]).c_str())); + m_bCcB[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.keyForControls[1]).c_str())); + m_bCcX[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.keyForControls[2]).c_str())); + m_bCcY[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.keyForControls[3]).c_str())); + m_bCcP[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.keyForControls[4]).c_str())); + m_bCcM[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.keyForControls[5]).c_str())); + m_bCcH[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.keyForControls[6]).c_str())); + m_bCcTl[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.keyForControls[7]).c_str())); + m_bCcZl[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.keyForControls[8]).c_str())); + m_bCcZr[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.keyForControls[9]).c_str())); + m_bCcTr[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.keyForControls[10]).c_str())); + m_bCcDl[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.keyForControls[11]).c_str())); + m_bCcDu[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.keyForControls[12]).c_str())); + m_bCcDr[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.keyForControls[13]).c_str())); + m_bCcDd[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.keyForControls[14]).c_str())); + m_bCcLl[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.keyForControls[15]).c_str())); + m_bCcLu[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.keyForControls[16]).c_str())); + m_bCcLr[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.keyForControls[17]).c_str())); + m_bCcLd[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.keyForControls[18]).c_str())); + m_bCcRl[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.keyForControls[19]).c_str())); + m_bCcRu[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.keyForControls[20]).c_str())); + m_bCcRr[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.keyForControls[21]).c_str())); + m_bCcRd[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.keyForControls[22]).c_str())); #endif - //INFO_LOG(CONSOLE, "m_bWmA[%i] = %i = %s\n", controller, WiiMoteEmu::PadMapping[controller].Wm.A, InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.A).c_str()); + //INFO_LOG(CONSOLE, "m_bWmA[%i] = %i = %s\n", controller, WiiMoteEmu::PadMapping[controller].Wm.keyForControls[0], InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.keyForControls[0]).c_str()); } /* Populate the PadMapping array with the dialog items settings (for example @@ -253,57 +246,17 @@ void WiimotePadConfigDialog::SaveButtonMapping(int controller, bool DontChangeId // Save keyboard key mapping void WiimotePadConfigDialog::SaveKeyboardMapping(int Controller, int Id, int Key) { - switch(Id) + if (IDB_WM_A <= Id && Id <= IDB_WM_PITCH_R) { - // Wiimote - case IDB_WM_A: WiiMoteEmu::PadMapping[Controller].Wm.A = Key; break; - case IDB_WM_B: WiiMoteEmu::PadMapping[Controller].Wm.B = Key; break; - case IDB_WM_1: WiiMoteEmu::PadMapping[Controller].Wm.One = Key; break; - case IDB_WM_2: WiiMoteEmu::PadMapping[Controller].Wm.Two = Key; break; - case IDB_WM_P: WiiMoteEmu::PadMapping[Controller].Wm.P = Key; break; - case IDB_WM_M: WiiMoteEmu::PadMapping[Controller].Wm.M = Key; break; - case IDB_WM_H: WiiMoteEmu::PadMapping[Controller].Wm.H = Key; break; - case IDB_WM_L: WiiMoteEmu::PadMapping[Controller].Wm.L = Key; break; - case IDB_WM_R: WiiMoteEmu::PadMapping[Controller].Wm.R = Key; break; - case IDB_WM_U: WiiMoteEmu::PadMapping[Controller].Wm.U = Key; break; - case IDB_WM_D: WiiMoteEmu::PadMapping[Controller].Wm.D = Key; break; - case IDB_WM_SHAKE: WiiMoteEmu::PadMapping[Controller].Wm.Shake = Key; break; - case IDB_WM_PITCH_L: WiiMoteEmu::PadMapping[Controller].Wm.PitchL = Key; break; - case IDB_WM_PITCH_R: WiiMoteEmu::PadMapping[Controller].Wm.PitchR = Key; break; - - // Nunchuck - case IDB_NC_Z: WiiMoteEmu::PadMapping[Controller].Nc.Z = Key; break; - case IDB_NC_C: WiiMoteEmu::PadMapping[Controller].Nc.C = Key; break; - case IDB_NC_L: WiiMoteEmu::PadMapping[Controller].Nc.L = Key; break; - case IDB_NC_R: WiiMoteEmu::PadMapping[Controller].Nc.R = Key; break; - case IDB_NC_U: WiiMoteEmu::PadMapping[Controller].Nc.U = Key; break; - case IDB_NC_D: WiiMoteEmu::PadMapping[Controller].Nc.D = Key; break; - case IDB_NC_SHAKE: WiiMoteEmu::PadMapping[Controller].Nc.Shake = Key; break; - - // Classic Controller - case IDB_CC_A: WiiMoteEmu::PadMapping[Controller].Cc.A = Key; break; - case IDB_CC_B: WiiMoteEmu::PadMapping[Controller].Cc.B = Key; break; - case IDB_CC_X: WiiMoteEmu::PadMapping[Controller].Cc.X = Key; break; - case IDB_CC_Y: WiiMoteEmu::PadMapping[Controller].Cc.Y = Key; break; - case IDB_CC_P: WiiMoteEmu::PadMapping[Controller].Cc.P = Key; break; - case IDB_CC_M: WiiMoteEmu::PadMapping[Controller].Cc.M = Key; break; - case IDB_CC_H: WiiMoteEmu::PadMapping[Controller].Cc.H = Key; break; - case IDB_CC_TL: WiiMoteEmu::PadMapping[Controller].Cc.Tl = Key; break; - case IDB_CC_ZL: WiiMoteEmu::PadMapping[Controller].Cc.Zl = Key; break; - case IDB_CC_ZR: WiiMoteEmu::PadMapping[Controller].Cc.Zr = Key; break; - case IDB_CC_TR: WiiMoteEmu::PadMapping[Controller].Cc.Tr = Key; break; - case IDB_CC_DL: WiiMoteEmu::PadMapping[Controller].Cc.Dl = Key; break; - case IDB_CC_DU: WiiMoteEmu::PadMapping[Controller].Cc.Du = Key; break; - case IDB_CC_DR: WiiMoteEmu::PadMapping[Controller].Cc.Dr = Key; break; - case IDB_CC_DD: WiiMoteEmu::PadMapping[Controller].Cc.Dd = Key; break; - case IDB_CC_LL: WiiMoteEmu::PadMapping[Controller].Cc.Ll = Key; break; - case IDB_CC_LU: WiiMoteEmu::PadMapping[Controller].Cc.Lu = Key; break; - case IDB_CC_LR: WiiMoteEmu::PadMapping[Controller].Cc.Lr = Key; break; - case IDB_CC_LD: WiiMoteEmu::PadMapping[Controller].Cc.Ld = Key; break; - case IDB_CC_RL: WiiMoteEmu::PadMapping[Controller].Cc.Rl = Key; break; - case IDB_CC_RU: WiiMoteEmu::PadMapping[Controller].Cc.Ru = Key; break; - case IDB_CC_RR: WiiMoteEmu::PadMapping[Controller].Cc.Rr = Key; break; - case IDB_CC_RD: WiiMoteEmu::PadMapping[Controller].Cc.Rd = Key; break; + WiiMoteEmu::PadMapping[Controller].Wm.keyForControls[Id - IDB_WM_A] = Key; + } + else if (IDB_NC_Z <= Id && Id <= IDB_NC_SHAKE) + { + WiiMoteEmu::PadMapping[Controller].Nc.keyForControls[Id - IDB_NC_Z] = Key; + } + else if (IDB_CC_A <= Id && Id <= IDB_CC_RD) + { + WiiMoteEmu::PadMapping[Controller].Cc.keyForControls[Id - IDB_CC_A] = Key; } //INFO_LOG(CONSOLE, "WiiMoteEmu::PadMapping[%i].Wm.A = %i", Controller, WiiMoteEmu::PadMapping[Controller].Wm.A); @@ -339,7 +292,6 @@ void WiimotePadConfigDialog::ToBlank(bool _ToBlank) // Update the textbox for the buttons -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ void WiimotePadConfigDialog::SetButtonText(int id, char text[128], int _Page) { // Set controller value @@ -411,7 +363,6 @@ void WiimotePadConfigDialog::SetButtonText(int id, char text[128], int _Page) } // Get the text in the textbox for the buttons -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ wxString WiimotePadConfigDialog::GetButtonText(int id, int _Page) { //INFO_LOG(CONSOLE, "GetButtonText: %i\n", id); @@ -456,9 +407,7 @@ void WiimotePadConfigDialog::GetButtons(wxCommandEvent& event) void WiimotePadConfigDialog::DoGetButtons(int _GetId) { - // ============================================= // Collect the starting values - // ---------------- // Get the current controller int Controller = Page; @@ -493,7 +442,6 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId) int pressed = 0; bool Succeed = false; bool Stop = false; // Stop the timer - // ======================= //INFO_LOG(CONSOLE, "Before (%i) Id:%i %i IsRunning:%i\n", // GetButtonWaitingTimer, GetButtonWaitingID, _GetId, m_ButtonMappingTimer->IsRunning()); @@ -530,9 +478,7 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId) Axis, LeftRight, XInput, Button, Hat); } - // =============================================== // Check for buttons - // ---------------- // If there is a timer but we should not create a new one else @@ -542,12 +488,8 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId) g_Pressed, value, type, pressed, Succeed, Stop, LeftRight, Axis, XInput, Button, Hat, NoTriggerFilter); } - // ========================= Check for keys - - // =============================================== // Process results - // ---------------- // Count each time GetButtonWaitingTimer++; @@ -577,7 +519,7 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId) // If we got a button if(Succeed) { - Stop = true; + Stop = true; // Write the number of the pressed button to the text box sprintf(format, "%d", pressed); SetButtonTextAll(_GetId, format); @@ -613,8 +555,7 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId) " select another key with a higher key code."), pressed) , wxT("Notice"), wxICON_INFORMATION); } - // ======================== Process results - + // Debugging /* INFO_LOG(CONSOLE, "Change: %i %i %i %i '%s' '%s' '%s' '%s'\n", diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigRecording.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigRecording.cpp index 1ead21dce4..44e3f3e2db 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigRecording.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigRecording.cpp @@ -15,7 +15,6 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ -#include "CommonTypes.h" // for u16 #include "IniFile.h" #include "Timer.h" diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigRecordingDlg.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigRecordingDlg.cpp index 51a5537121..0aedf459dc 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigRecordingDlg.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigRecordingDlg.cpp @@ -15,20 +15,12 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ - -#include "CommonTypes.h" // for u16 -#include "IniFile.h" -#include "StringUtil.h" - -#include "wiimote_real.h" // Local #include "wiimote_hid.h" #include "main.h" #include "ConfigRecordingDlg.h" #include "ConfigBasicDlg.h" #include "Config.h" #include "EmuMain.h" // for LoadRecordedMovements() -#include "EmuSubroutines.h" // for WmRequestStatus -#include "EmuDefinitions.h" // for joyinfo BEGIN_EVENT_TABLE(WiimoteRecordingConfigDialog,wxDialog) EVT_CLOSE(WiimoteRecordingConfigDialog::OnClose) @@ -74,11 +66,13 @@ WiimoteRecordingConfigDialog::WiimoteRecordingConfigDialog(wxWindow *parent, wxW : wxDialog (parent, id, title, position, size, style) { - #if wxUSE_TIMER - m_TimeoutTimer = new wxTimer(this, IDTM_UPDATE); - m_bWaitForRecording = false; - m_bRecording = false; - #endif +#if wxUSE_TIMER + m_TimeoutTimer = new wxTimer(this, IDTM_UPDATE); +#endif + + m_bWaitForRecording = false; + m_bRecording = false; + m_vRecording.resize(RECORDING_ROWS + 1); g_Config.Load(); diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h index 4e7bba7208..43b58ad853 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h @@ -205,13 +205,14 @@ struct KeyboardWiimote { enum EKeyboardWiimote { - A = 0, MA, // Keyboard A and Mouse A - B, MB, + A = 0, // Keyboard A and Mouse A + B, ONE, TWO, P, M, H, L, R, U, D, - PITCH_L, PITCH_R, SHAKE, + PITCH_L, PITCH_R, + MA, MB, LAST_CONSTANT }; @@ -264,15 +265,15 @@ struct KeyboardGH3GLP { // This is not allowed in Linux so we have to set the starting value manually #ifdef _WIN32 - BG = g_ClassicContExt.LAST_CONSTANT, + Green = g_ClassicContExt.LAST_CONSTANT, #else - BG = 47, + Green = 47, #endif - BR, BY, BB, - BO, BP, BM, - WB, - Ll, Lr, Lu, Ld, - Bu, Bd, + Red, Yellow, Blue, + Orange,Plus, Minus, + Whammy, + Al, Ar, Au, Ad, + StrumUp, StrumDown, SHAKE }; }; diff --git a/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp b/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp index aa79944b5e..8a39615a76 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp @@ -294,78 +294,45 @@ int RecordingCheckKeys(int WmNuIr) } -//****************************************************************************** // Subroutines -//****************************************************************************** -///////////////////////////////////////////////////////////////////////// // Multi System Input Status Check -// --------------- int IsKey(int Key) { #ifdef _WIN32 + if (Key == g_Wiimote_kbd.SHAKE) + return GetAsyncKeyState(PadMapping[0].Wm.keyForControls[Key - g_Wiimote_kbd.A]) || GetAsyncKeyState(VK_MBUTTON); + if (g_Wiimote_kbd.A <= Key && Key <= g_Wiimote_kbd.PITCH_R) + { + return GetAsyncKeyState(PadMapping[0].Wm.keyForControls[Key - g_Wiimote_kbd.A]); + } + if (g_NunchuckExt.Z <= Key && Key <= g_NunchuckExt.SHAKE) + { + return GetAsyncKeyState(PadMapping[0].Nc.keyForControls[Key - g_NunchuckExt.Z]); + } + if (g_ClassicContExt.A <= Key && Key <= g_ClassicContExt.Rd) + { + return GetAsyncKeyState(PadMapping[0].Cc.keyForControls[Key - g_ClassicContExt.A]); + } + if (g_GH3Ext.Green <= Key && Key <= g_GH3Ext.StrumDown) + { + return GetAsyncKeyState(PadMapping[0].GH3c.keyForControls[Key - g_GH3Ext.Green]); + } + switch(Key) { // Wiimote - case g_Wiimote_kbd.MA: return GetAsyncKeyState(VK_LBUTTON); - case g_Wiimote_kbd.MB: return GetAsyncKeyState(VK_RBUTTON); - case g_Wiimote_kbd.A: return GetAsyncKeyState(PadMapping[0].Wm.A); - case g_Wiimote_kbd.B: return GetAsyncKeyState(PadMapping[0].Wm.B); - case g_Wiimote_kbd.ONE: return GetAsyncKeyState(PadMapping[0].Wm.One); - case g_Wiimote_kbd.TWO: return GetAsyncKeyState(PadMapping[0].Wm.Two); - case g_Wiimote_kbd.P: return GetAsyncKeyState(PadMapping[0].Wm.P); - case g_Wiimote_kbd.M: return GetAsyncKeyState(PadMapping[0].Wm.M); - case g_Wiimote_kbd.H: return GetAsyncKeyState(PadMapping[0].Wm.H); - case g_Wiimote_kbd.L: return GetAsyncKeyState(PadMapping[0].Wm.L); - case g_Wiimote_kbd.R: return GetAsyncKeyState(PadMapping[0].Wm.R); - case g_Wiimote_kbd.U: return GetAsyncKeyState(PadMapping[0].Wm.U); - case g_Wiimote_kbd.D: return GetAsyncKeyState(PadMapping[0].Wm.D); - case g_Wiimote_kbd.PITCH_L: return GetAsyncKeyState(PadMapping[0].Wm.PitchL); - case g_Wiimote_kbd.PITCH_R: return GetAsyncKeyState(PadMapping[0].Wm.PitchR); - case g_Wiimote_kbd.SHAKE: return GetAsyncKeyState(PadMapping[0].Wm.Shake) || GetAsyncKeyState(VK_MBUTTON); - - // Nunchuck - case g_NunchuckExt.Z: return GetAsyncKeyState(PadMapping[0].Nc.Z); - case g_NunchuckExt.C: return GetAsyncKeyState(PadMapping[0].Nc.C); - case g_NunchuckExt.L: return GetAsyncKeyState(PadMapping[0].Nc.L); - case g_NunchuckExt.R: return GetAsyncKeyState(PadMapping[0].Nc.R); - case g_NunchuckExt.U: return GetAsyncKeyState(PadMapping[0].Nc.U); - case g_NunchuckExt.D: return GetAsyncKeyState(PadMapping[0].Nc.D); - case g_NunchuckExt.SHAKE: return GetAsyncKeyState(PadMapping[0].Nc.Shake); - - // Classic Controller - case g_ClassicContExt.A: return GetAsyncKeyState(PadMapping[0].Cc.A); - case g_ClassicContExt.B: return GetAsyncKeyState(PadMapping[0].Cc.B); - case g_ClassicContExt.X: return GetAsyncKeyState(PadMapping[0].Cc.X); - case g_ClassicContExt.Y: return GetAsyncKeyState(PadMapping[0].Cc.Y); - case g_ClassicContExt.P: return GetAsyncKeyState(PadMapping[0].Cc.P); // Default is O instead of P - case g_ClassicContExt.M: return GetAsyncKeyState(PadMapping[0].Cc.M); // Default is N instead of M - case g_ClassicContExt.H: return GetAsyncKeyState(PadMapping[0].Cc.H); // Default is U instead of H - - case g_ClassicContExt.Tl: return GetAsyncKeyState(PadMapping[0].Cc.Tl); // Digital left trigger - case g_ClassicContExt.Zl: return GetAsyncKeyState(PadMapping[0].Cc.Zl); - case g_ClassicContExt.Zr: return GetAsyncKeyState(PadMapping[0].Cc.Zr); - case g_ClassicContExt.Tr: return GetAsyncKeyState(PadMapping[0].Cc.Tr); // Digital right trigger - - case g_ClassicContExt.Dl: return GetAsyncKeyState(PadMapping[0].Cc.Dl); // Digital left - case g_ClassicContExt.Du: return GetAsyncKeyState(PadMapping[0].Cc.Du); // Up - case g_ClassicContExt.Dr: return GetAsyncKeyState(PadMapping[0].Cc.Dr); // Right - case g_ClassicContExt.Dd: return GetAsyncKeyState(PadMapping[0].Cc.Dd); // Down - - case g_ClassicContExt.Ll: return GetAsyncKeyState(PadMapping[0].Cc.Ll); // Left analog - case g_ClassicContExt.Lu: return GetAsyncKeyState(PadMapping[0].Cc.Lu); - case g_ClassicContExt.Lr: return GetAsyncKeyState(PadMapping[0].Cc.Lr); - case g_ClassicContExt.Ld: return GetAsyncKeyState(PadMapping[0].Cc.Ld); - - case g_ClassicContExt.Rl: return GetAsyncKeyState(PadMapping[0].Cc.Rl); // Right analog - case g_ClassicContExt.Ru: return GetAsyncKeyState(PadMapping[0].Cc.Ru); - case g_ClassicContExt.Rr: return GetAsyncKeyState(PadMapping[0].Cc.Rr); - case g_ClassicContExt.Rd: return GetAsyncKeyState(PadMapping[0].Cc.Rd); - + case g_Wiimote_kbd.MA: + return GetAsyncKeyState(VK_LBUTTON); + case g_Wiimote_kbd.MB: + return GetAsyncKeyState(VK_RBUTTON); // This should not happen - default: PanicAlert("There is syntax error in a function that is calling IsKey(%i)", Key); return false; + default: + PanicAlert("There is syntax error in a function that is calling IsKey(%i)", Key); + return false; } + #else return false; #endif @@ -1323,15 +1290,15 @@ void FillReportGuitarHero3Extension(wm_GH3_extension& _ext) _ext.pad8 = 1; _ext.pad9 = 3; - _ext.BP = 1; - _ext.BM = 1; - _ext.BD = 1; - _ext.BU = 1; - _ext.BY = 1; - _ext.BG = 1; - _ext.BB = 1; - _ext.BR = 1; - _ext.BO = 1; + _ext.Plus = 1; + _ext.Minus = 1; + _ext.StrumDown = 1; + _ext.StrumUp = 1; + _ext.Yellow = 1; + _ext.Green = 1; + _ext.Blue = 1; + _ext.Red = 1; + _ext.Orange = 1; // Check that Dolphin is in focus @@ -1357,13 +1324,13 @@ void FillReportGuitarHero3Extension(wm_GH3_extension& _ext) // Update the left analog stick if (g_Config.GH3Controller.LType == g_Config.GH3Controller.KEYBOARD) { - if(IsKey(g_GH3Ext.Ll)) // Left analog left + if(IsKey(g_GH3Ext.Al)) // Left analog left _ext.SX = g_GH3Calibration.Lx.min; - if(IsKey(g_ClassicContExt.Lu)) // up + if(IsKey(g_GH3Ext.Au)) // up _ext.SY = g_GH3Calibration.Ly.max; - if(IsKey(g_ClassicContExt.Lr)) // right + if(IsKey(g_GH3Ext.Ar)) // right _ext.SX = g_GH3Calibration.Lx.max; - if(IsKey(g_ClassicContExt.Ld)) // down + if(IsKey(g_GH3Ext.Ad)) // down _ext.SY = g_GH3Calibration.Ly.min; } @@ -1395,24 +1362,24 @@ void FillReportGuitarHero3Extension(wm_GH3_extension& _ext) } } - if(IsKey(g_GH3Ext.Bu)) _ext.BU = 0x00; // Strum Up - if(IsKey(g_GH3Ext.Bd)) _ext.BD= 0x00; // Strum Down + if(IsKey(g_GH3Ext.StrumUp)) _ext.StrumUp = 0x00; // Strum Up + if(IsKey(g_GH3Ext.StrumDown)) _ext.StrumDown= 0x00; // Strum Down - if(IsKey(g_GH3Ext.BP)) - _ext.BP = 0x00; - if(IsKey(g_GH3Ext.BM)) - _ext.BM = 0x00; + if(IsKey(g_GH3Ext.Plus)) + _ext.Plus = 0x00; + if(IsKey(g_GH3Ext.Minus)) + _ext.Minus = 0x00; - if(IsKey(g_GH3Ext.BY)) - _ext.BY = 0x00; - if(IsKey(g_GH3Ext.BG)) - _ext.BG = 0x00; - if(IsKey(g_GH3Ext.BB)) - _ext.BB = 0x00; - if(IsKey(g_GH3Ext.BR)) - _ext.BR = 0x00; - if(IsKey(g_GH3Ext.BO)) - _ext.BO = 0x00; + if(IsKey(g_GH3Ext.Yellow)) + _ext.Yellow = 0x00; + if(IsKey(g_GH3Ext.Green)) + _ext.Green = 0x00; + if(IsKey(g_GH3Ext.Blue)) + _ext.Blue = 0x00; + if(IsKey(g_GH3Ext.Red)) + _ext.Red = 0x00; + if(IsKey(g_GH3Ext.Orange)) + _ext.Orange = 0x00; } // Convert data for reporting diff --git a/Source/Plugins/Plugin_Wiimote/Src/main.h b/Source/Plugins/Plugin_Wiimote/Src/main.h index 16f30636db..31c3ac7816 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/main.h +++ b/Source/Plugins/Plugin_Wiimote/Src/main.h @@ -19,6 +19,9 @@ #define MAIN_H #include // System +#include + +#include "CommonTypes.h" // Definitions and declarations void DoInitialize(); diff --git a/Source/Plugins/Plugin_Wiimote/Src/wiimote_hid.h b/Source/Plugins/Plugin_Wiimote/Src/wiimote_hid.h index e5ff113890..ae5e0ebbda 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/wiimote_hid.h +++ b/Source/Plugins/Plugin_Wiimote/Src/wiimote_hid.h @@ -237,24 +237,24 @@ struct wm_GH3_extension u8 TB : 5; // not used in GH3 u8 pad3 : 3; // Always 0 - u8 WB : 5; + u8 Whammy : 5; u8 pad4 : 3; // Always 0 u8 pad5 : 2; // Always 1 - u8 BP : 1; + u8 Plus : 1; u8 pad6 : 1; // Always 1 - u8 BM : 1; + u8 Minus : 1; u8 pad7 : 1; // Always 1 - u8 BD : 1; + u8 StrumDown : 1; u8 pad8 : 1; // Always 1 - u8 BU : 1; + u8 StrumUp : 1; u8 pad9 : 2; // Always 1 - u8 BY : 1; - u8 BG : 1; - u8 BB : 1; - u8 BR : 1; - u8 BO : 1; + u8 Yellow : 1; + u8 Green : 1; + u8 Blue : 1; + u8 Red : 1; + u8 Orange : 1; };