mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
New Wiimote Plugin Config GUI
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3676 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// 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
|
||||
@ -15,11 +15,6 @@
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Includes
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//#include "Common.h" // for u16
|
||||
#include "CommonTypes.h" // for u16
|
||||
#include "IniFile.h"
|
||||
#include "Timer.h"
|
||||
@ -27,21 +22,18 @@
|
||||
#include "wiimote_real.h" // Local
|
||||
#include "wiimote_hid.h"
|
||||
#include "main.h"
|
||||
#include "ConfigDlg.h"
|
||||
#include "ConfigPadDlg.h"
|
||||
#include "Config.h"
|
||||
#include "EmuMain.h" // for LoadRecordedMovements()
|
||||
#include "EmuSubroutines.h" // for WmRequestStatus
|
||||
#include "EmuDefinitions.h" // for joyinfo
|
||||
//////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Change Joystick
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/* Function: When changing the joystick we save and load the settings and update the PadMapping
|
||||
and PadState array. PadState[].joy is the gamepad handle that is used to access the pad throughout
|
||||
the plugin. Joyinfo[].joy is only used the first time the pads are checked. */
|
||||
void WiimoteConfigDialog::DoChangeJoystick()
|
||||
void WiimotePadConfigDialog::DoChangeJoystick()
|
||||
{
|
||||
// Close the current pad, unless it's used by another slot
|
||||
//if (PadMapping[notebookpage].enabled) PadClose(notebookpage);
|
||||
@ -56,7 +48,7 @@ void WiimoteConfigDialog::DoChangeJoystick()
|
||||
// Open the new pad
|
||||
if (WiiMoteEmu::PadMapping[Page].enabled) PadOpen(Page);
|
||||
}
|
||||
void WiimoteConfigDialog::PadOpen(int Open) // Open for slot 1, 2, 3 or 4
|
||||
void WiimotePadConfigDialog::PadOpen(int Open) // Open for slot 1, 2, 3 or 4
|
||||
{
|
||||
// Check that we got a good pad
|
||||
if (!WiiMoteEmu::joyinfo.at(WiiMoteEmu::PadMapping[Open].ID).Good)
|
||||
@ -69,13 +61,13 @@ void WiimoteConfigDialog::PadOpen(int Open) // Open for slot 1, 2, 3 or 4
|
||||
INFO_LOG(CONSOLE, "Update the Slot %i handle to Id %i\n", Page, WiiMoteEmu::PadMapping[Open].ID);
|
||||
WiiMoteEmu::PadState[Open].joy = SDL_JoystickOpen(WiiMoteEmu::PadMapping[Open].ID);
|
||||
}
|
||||
void WiimoteConfigDialog::PadClose(int Close) // Close for slot 1, 2, 3 or 4
|
||||
void WiimotePadConfigDialog::PadClose(int Close) // Close for slot 1, 2, 3 or 4
|
||||
{
|
||||
if (SDL_JoystickOpened(WiiMoteEmu::PadMapping[Close].ID)) SDL_JoystickClose(WiiMoteEmu::PadState[Close].joy);
|
||||
WiiMoteEmu::PadState[Close].joy = NULL;
|
||||
}
|
||||
|
||||
void WiimoteConfigDialog::DoChangeDeadZone(bool Left)
|
||||
void WiimotePadConfigDialog::DoChangeDeadZone(bool Left)
|
||||
{
|
||||
if(Left)
|
||||
{
|
||||
@ -104,7 +96,7 @@ void WiimoteConfigDialog::DoChangeDeadZone(bool Left)
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// Set the button text for all four Wiimotes
|
||||
void WiimoteConfigDialog::SetButtonTextAll(int id, char text[128])
|
||||
void WiimotePadConfigDialog::SetButtonTextAll(int id, char text[128])
|
||||
{
|
||||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
@ -116,7 +108,7 @@ void WiimoteConfigDialog::SetButtonTextAll(int id, char text[128])
|
||||
}
|
||||
|
||||
|
||||
void WiimoteConfigDialog::SaveButtonMappingAll(int Slot)
|
||||
void WiimotePadConfigDialog::SaveButtonMappingAll(int Slot)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
@ -129,7 +121,7 @@ void WiimoteConfigDialog::SaveButtonMappingAll(int Slot)
|
||||
|
||||
// Set dialog items from saved values
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void WiimoteConfigDialog::UpdateGUIButtonMapping(int controller)
|
||||
void WiimotePadConfigDialog::UpdateGUIButtonMapping(int controller)
|
||||
{
|
||||
// Temporary storage
|
||||
wxString tmp;
|
||||
@ -215,7 +207,7 @@ void WiimoteConfigDialog::UpdateGUIButtonMapping(int controller)
|
||||
/* Populate the PadMapping array with the dialog items settings (for example
|
||||
selected joystick, enabled or disabled status and so on) */
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void WiimoteConfigDialog::SaveButtonMapping(int controller, bool DontChangeId, int FromSlot)
|
||||
void WiimotePadConfigDialog::SaveButtonMapping(int controller, bool DontChangeId, int FromSlot)
|
||||
{
|
||||
// Temporary storage
|
||||
wxString tmp;
|
||||
@ -263,7 +255,7 @@ void WiimoteConfigDialog::SaveButtonMapping(int controller, bool DontChangeId, i
|
||||
}
|
||||
|
||||
// Save keyboard key mapping
|
||||
void WiimoteConfigDialog::SaveKeyboardMapping(int Controller, int Id, int Key)
|
||||
void WiimotePadConfigDialog::SaveKeyboardMapping(int Controller, int Id, int Key)
|
||||
{
|
||||
switch(Id)
|
||||
{
|
||||
@ -323,7 +315,7 @@ void WiimoteConfigDialog::SaveKeyboardMapping(int Controller, int Id, int Key)
|
||||
|
||||
// Replace the harder to understand -1 with "" for the sake of user friendliness
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void WiimoteConfigDialog::ToBlank(bool ToBlank)
|
||||
void WiimotePadConfigDialog::ToBlank(bool ToBlank)
|
||||
{
|
||||
if (!ControlsCreated) return;
|
||||
|
||||
@ -352,7 +344,7 @@ void WiimoteConfigDialog::ToBlank(bool ToBlank)
|
||||
|
||||
// Update the textbox for the buttons
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void WiimoteConfigDialog::SetButtonText(int id, char text[128], int _Page)
|
||||
void WiimotePadConfigDialog::SetButtonText(int id, char text[128], int _Page)
|
||||
{
|
||||
// Set controller value
|
||||
int controller;
|
||||
@ -424,7 +416,7 @@ void WiimoteConfigDialog::SetButtonText(int id, char text[128], int _Page)
|
||||
|
||||
// Get the text in the textbox for the buttons
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
wxString WiimoteConfigDialog::GetButtonText(int id, int _Page)
|
||||
wxString WiimotePadConfigDialog::GetButtonText(int id, int _Page)
|
||||
{
|
||||
//INFO_LOG(CONSOLE, "GetButtonText: %i\n", id);
|
||||
|
||||
@ -462,12 +454,12 @@ wxString WiimoteConfigDialog::GetButtonText(int id, int _Page)
|
||||
is that we start another parallel loop (at least in Windows) that blocks the old loop. And our only
|
||||
option to wait for the old loop to finish is with a new loop, and that will block the old loop for as
|
||||
long as it's going on. Therefore a timer is easier to control. */
|
||||
void WiimoteConfigDialog::GetButtons(wxCommandEvent& event)
|
||||
void WiimotePadConfigDialog::GetButtons(wxCommandEvent& event)
|
||||
{
|
||||
DoGetButtons(event.GetId());
|
||||
}
|
||||
|
||||
void WiimoteConfigDialog::DoGetButtons(int GetId)
|
||||
void WiimotePadConfigDialog::DoGetButtons(int GetId)
|
||||
{
|
||||
// =============================================
|
||||
// Collect the starting values
|
||||
@ -642,7 +634,7 @@ void WiimoteConfigDialog::DoGetButtons(int GetId)
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// Convert the 0x8000 range values to BoxW and BoxH for the plot
|
||||
void WiimoteConfigDialog::Convert2Box(int &x)
|
||||
void WiimotePadConfigDialog::Convert2Box(int &x)
|
||||
{
|
||||
// Border adjustment
|
||||
int BoxW_ = BoxW - 2; int BoxH_ = BoxH - 2;
|
||||
@ -653,7 +645,7 @@ void WiimoteConfigDialog::Convert2Box(int &x)
|
||||
|
||||
// Update the input status boxes
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void WiimoteConfigDialog::PadGetStatus()
|
||||
void WiimotePadConfigDialog::PadGetStatus()
|
||||
{
|
||||
//INFO_LOG(CONSOLE, "SDL_WasInit: %i\n", SDL_WasInit(0));
|
||||
|
||||
@ -819,7 +811,7 @@ void WiimoteConfigDialog::PadGetStatus()
|
||||
|
||||
// Populate the advanced tab
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void WiimoteConfigDialog::UpdatePad(wxTimerEvent& WXUNUSED(event))
|
||||
void WiimotePadConfigDialog::UpdatePad(wxTimerEvent& WXUNUSED(event))
|
||||
{
|
||||
// Show the current status
|
||||
/*
|
||||
@ -833,4 +825,4 @@ void WiimoteConfigDialog::UpdatePad(wxTimerEvent& WXUNUSED(event))
|
||||
|
||||
PadGetStatus();
|
||||
}
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
Reference in New Issue
Block a user