| 
									
										
										
										
											2008-12-26 02:48:35 +00:00
										 |  |  |  | //////////////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  |  | // Project description
 | 
					
						
							|  |  |  |  | // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | // Name: nJoy 
 | 
					
						
							|  |  |  |  | // Description: A Dolphin Compatible Input Plugin
 | 
					
						
							|  |  |  |  | //
 | 
					
						
							|  |  |  |  | // Author: Falcon4ever (nJoy@falcon4ever.com)
 | 
					
						
							|  |  |  |  | // Site: www.multigesture.net
 | 
					
						
							|  |  |  |  | // Copyright (C) 2003-2008 Dolphin Project.
 | 
					
						
							|  |  |  |  | //
 | 
					
						
							|  |  |  |  | //////////////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  |  | //
 | 
					
						
							|  |  |  |  | // Licensetype: GNU General Public License (GPL)
 | 
					
						
							|  |  |  |  | //
 | 
					
						
							|  |  |  |  | // 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/
 | 
					
						
							|  |  |  |  | //
 | 
					
						
							|  |  |  |  | //////////////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-26 02:42:15 +00:00
										 |  |  |  | //////////////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  |  | // Include
 | 
					
						
							|  |  |  |  | // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | #include "ConfigBox.h"
 | 
					
						
							|  |  |  |  | #include "../nJoy.h"
 | 
					
						
							|  |  |  |  | #include "Images/controller.xpm"
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | extern bool emulator_running; | 
					
						
							|  |  |  |  | ////////////////////////
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-27 11:32:03 +00:00
										 |  |  |  | /* If we don't use this hack m_MainSizer->GetMinSize().GetWidth() will not change
 | 
					
						
							|  |  |  |  |    when we enable and disable bShowAdvanced */ | 
					
						
							|  |  |  |  | bool StrangeHack = true; | 
					
						
							| 
									
										
										
										
											2008-12-26 02:42:15 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | // Set PAD status
 | 
					
						
							|  |  |  |  | // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | void ConfigBox::PadGetStatus() | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-12-28 18:50:24 +00:00
										 |  |  |  | 	// Return if it's not detected
 | 
					
						
							| 
									
										
										
										
											2009-01-21 18:09:31 +00:00
										 |  |  |  | 	if(PadMapping[notebookpage].ID >= SDL_NumJoysticks()) | 
					
						
							| 
									
										
										
										
											2008-12-28 18:50:24 +00:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		m_TStatusIn[notebookpage]->SetLabel(wxT("Not connected")); | 
					
						
							|  |  |  |  | 		m_TStatusOut[notebookpage]->SetLabel(wxT("Not connected")); | 
					
						
							| 
									
										
										
										
											2009-01-20 05:28:30 +00:00
										 |  |  |  | 		m_TStatusTriggers[notebookpage]->SetLabel(wxT("Not connected")); | 
					
						
							| 
									
										
										
										
											2008-12-28 18:50:24 +00:00
										 |  |  |  | 		return; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-27 11:32:03 +00:00
										 |  |  |  | 	// Return if it's not enabled
 | 
					
						
							| 
									
										
										
										
											2009-01-21 18:09:31 +00:00
										 |  |  |  | 	if (!PadMapping[notebookpage].enabled) | 
					
						
							| 
									
										
										
										
											2008-12-27 11:32:03 +00:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		m_TStatusIn[notebookpage]->SetLabel(wxT("Not enabled")); | 
					
						
							| 
									
										
										
										
											2008-12-28 18:50:24 +00:00
										 |  |  |  | 		m_TStatusOut[notebookpage]->SetLabel(wxT("Not enabled")); | 
					
						
							| 
									
										
										
										
											2009-01-20 05:28:30 +00:00
										 |  |  |  | 		m_TStatusTriggers[notebookpage]->SetLabel(wxT("Not enabled")); | 
					
						
							| 
									
										
										
										
											2008-12-26 02:42:15 +00:00
										 |  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2008-12-27 11:32:03 +00:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2008-12-26 02:42:15 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-20 05:28:30 +00:00
										 |  |  |  | 	// Get physical device status
 | 
					
						
							| 
									
										
										
										
											2009-01-21 18:09:31 +00:00
										 |  |  |  | 	int PhysicalDevice = PadMapping[notebookpage].ID; | 
					
						
							|  |  |  |  | 	int TriggerType = PadMapping[notebookpage].triggertype; | 
					
						
							| 
									
										
										
										
											2009-01-20 05:28:30 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-26 02:42:15 +00:00
										 |  |  |  | 	// Get pad status
 | 
					
						
							| 
									
										
										
										
											2008-12-27 11:32:03 +00:00
										 |  |  |  | 	GetJoyState(notebookpage); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-20 05:28:30 +00:00
										 |  |  |  | 	//////////////////////////////////////
 | 
					
						
							|  |  |  |  | 	// Analog stick
 | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2008-12-26 02:42:15 +00:00
										 |  |  |  | 	// Set Deadzones perhaps out of function
 | 
					
						
							| 
									
										
										
										
											2009-01-21 18:09:31 +00:00
										 |  |  |  | 	//int deadzone = (int)(((float)(128.00/100.00)) * (float)(PadMapping[_numPAD].deadzone+1));
 | 
					
						
							|  |  |  |  | 	//int deadzone2 = (int)(((float)(-128.00/100.00)) * (float)(PadMapping[_numPAD].deadzone+1));
 | 
					
						
							| 
									
										
										
										
											2008-12-26 02:42:15 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-27 11:32:03 +00:00
										 |  |  |  | 	// Get original values
 | 
					
						
							| 
									
										
										
										
											2009-01-24 22:13:53 +00:00
										 |  |  |  | 	int main_x = PadState[notebookpage].axis[CTL_MAIN_X]; | 
					
						
							|  |  |  |  | 	int main_y = PadState[notebookpage].axis[CTL_MAIN_Y]; | 
					
						
							|  |  |  |  |     //int sub_x = (PadState[_numPAD].axis[CTL_SUB_X];
 | 
					
						
							|  |  |  |  | 	//int sub_y = -(PadState[_numPAD].axis[CTL_SUB_Y];
 | 
					
						
							| 
									
										
										
										
											2008-12-26 02:42:15 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-27 11:32:03 +00:00
										 |  |  |  | 	// Get adjusted values
 | 
					
						
							|  |  |  |  | 	int main_x_after = main_x, main_y_after = main_y; | 
					
						
							| 
									
										
										
										
											2009-01-21 18:09:31 +00:00
										 |  |  |  | 	if(PadMapping[notebookpage].bSquareToCircle) | 
					
						
							| 
									
										
										
										
											2008-12-26 02:42:15 +00:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2009-01-20 06:38:29 +00:00
										 |  |  |  | 		std::vector<int> main_xy = Pad_Square_to_Circle(main_x, main_y, notebookpage); | 
					
						
							| 
									
										
										
										
											2008-12-27 11:32:03 +00:00
										 |  |  |  | 		main_x_after = main_xy.at(0); | 
					
						
							|  |  |  |  | 		main_y_after = main_xy.at(1); | 
					
						
							| 
									
										
										
										
											2008-12-26 02:42:15 +00:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-27 11:32:03 +00:00
										 |  |  |  | 	// 
 | 
					
						
							|  |  |  |  | 	float f_x = main_x / 32767.0; | 
					
						
							|  |  |  |  | 	float f_y = main_y / 32767.0; | 
					
						
							|  |  |  |  | 	float f_x_aft = main_x_after / 32767.0; | 
					
						
							|  |  |  |  | 	float f_y_aft = main_y_after / 32767.0; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	m_TStatusIn[notebookpage]->SetLabel(wxString::Format( | 
					
						
							|  |  |  |  | 		wxT("x:%1.2f y:%1.2f"), | 
					
						
							|  |  |  |  | 		f_x, f_y	 | 
					
						
							|  |  |  |  | 		)); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	m_TStatusOut[notebookpage]->SetLabel(wxString::Format( | 
					
						
							|  |  |  |  | 		wxT("x:%1.2f y:%1.2f"), | 
					
						
							|  |  |  |  | 		f_x_aft, f_y_aft | 
					
						
							|  |  |  |  | 		)); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// Adjust the values for the plot
 | 
					
						
							|  |  |  |  | 	int BoxW_ = BoxW - 2; int BoxH_ = BoxH - 2; // Border adjustment
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	main_x = (BoxW_ / 2) + (main_x * BoxW_ / (32767 * 2)); | 
					
						
							|  |  |  |  | 	main_y = (BoxH_ / 2) + (main_y * BoxH_ / (32767 * 2)); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	int main_x_out = (BoxW_ / 2) + (main_x_after * BoxW_ / (32767 * 2)); | 
					
						
							|  |  |  |  | 	int main_y_out = (BoxH_ / 2) + (main_y_after * BoxH_ / (32767 * 2)); | 
					
						
							|  |  |  |  | 	 | 
					
						
							|  |  |  |  | 	// Adjust the dot
 | 
					
						
							|  |  |  |  | 	m_bmpDot[notebookpage]->SetPosition(wxPoint(main_x, main_y)); | 
					
						
							|  |  |  |  | 	m_bmpDotOut[notebookpage]->SetPosition(wxPoint(main_x_out, main_y_out)); | 
					
						
							| 
									
										
										
										
											2009-01-20 05:28:30 +00:00
										 |  |  |  | 	///////////////////// Analog stick
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	//////////////////////////////////////
 | 
					
						
							|  |  |  |  | 	// Triggers
 | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2009-01-20 06:38:29 +00:00
										 |  |  |  | 	int TriggerValue = 255; | 
					
						
							| 
									
										
										
										
											2009-01-24 22:13:53 +00:00
										 |  |  |  | 	if (PadState[notebookpage].halfpress) TriggerValue = 100; | 
					
						
							| 
									
										
										
										
											2009-01-20 06:38:29 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// Get the selected keys
 | 
					
						
							|  |  |  |  | 	long Left, Right; | 
					
						
							|  |  |  |  | 	m_JoyShoulderL[notebookpage]->GetValue().ToLong(&Left); | 
					
						
							|  |  |  |  | 	m_JoyShoulderR[notebookpage]->GetValue().ToLong(&Right); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-20 14:25:33 +00:00
										 |  |  |  | 	// Get the trigger values
 | 
					
						
							| 
									
										
										
										
											2009-01-24 22:13:53 +00:00
										 |  |  |  | 	int TriggerLeft = PadState[notebookpage].axis[CTL_L_SHOULDER]; | 
					
						
							|  |  |  |  | 	int TriggerRight = PadState[notebookpage].axis[CTL_R_SHOULDER]; | 
					
						
							| 
									
										
										
										
											2009-01-20 05:28:30 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// Convert the triggers values
 | 
					
						
							| 
									
										
										
										
											2009-01-21 18:09:31 +00:00
										 |  |  |  | 	if (PadMapping[notebookpage].triggertype == CTL_TRIGGER_SDL) | 
					
						
							| 
									
										
										
										
											2009-01-20 14:25:33 +00:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		TriggerLeft = Pad_Convert(TriggerLeft); | 
					
						
							|  |  |  |  | 		TriggerRight = Pad_Convert(TriggerRight); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// If we don't have any axis selected for the shoulder buttons
 | 
					
						
							|  |  |  |  | 	if(Left < 1000) TriggerLeft = 0; | 
					
						
							|  |  |  |  | 	if(Right < 1000) TriggerRight = 0; | 
					
						
							| 
									
										
										
										
											2009-01-20 05:28:30 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-20 06:38:29 +00:00
										 |  |  |  | 	// Get the digital values
 | 
					
						
							| 
									
										
										
										
											2009-01-24 22:13:53 +00:00
										 |  |  |  | 	if(Left < 1000 && PadState[notebookpage].buttons[CTL_L_SHOULDER]) TriggerLeft = TriggerValue; | 
					
						
							|  |  |  |  | 	if(Right < 1000 && PadState[notebookpage].buttons[CTL_R_SHOULDER]) TriggerRight = TriggerValue; | 
					
						
							| 
									
										
										
										
											2009-01-20 06:38:29 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-20 05:28:30 +00:00
										 |  |  |  | 	m_TStatusTriggers[notebookpage]->SetLabel(wxString::Format( | 
					
						
							| 
									
										
										
										
											2009-01-20 06:38:29 +00:00
										 |  |  |  | 		wxT("Left:%03i  Right:%03i"), | 
					
						
							| 
									
										
										
										
											2009-01-20 05:28:30 +00:00
										 |  |  |  | 		TriggerLeft, TriggerRight	 | 
					
						
							|  |  |  |  | 		)); | 
					
						
							|  |  |  |  | 	///////////////////// Triggers
 | 
					
						
							| 
									
										
										
										
											2008-12-26 02:42:15 +00:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-19 05:49:25 +00:00
										 |  |  |  | // Show the current pad status
 | 
					
						
							|  |  |  |  | // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2009-01-20 05:28:30 +00:00
										 |  |  |  | std::string ShowStatus(int VirtualController) | 
					
						
							| 
									
										
										
										
											2009-01-19 05:49:25 +00:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-01-20 05:28:30 +00:00
										 |  |  |  | 	// Check if it's enabled
 | 
					
						
							| 
									
										
										
										
											2009-01-21 18:09:31 +00:00
										 |  |  |  | 	if (!PadMapping[VirtualController].enabled) return StringFromFormat("%i disabled", VirtualController); | 
					
						
							| 
									
										
										
										
											2009-01-20 05:28:30 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// Save the physical device
 | 
					
						
							| 
									
										
										
										
											2009-01-21 18:09:31 +00:00
										 |  |  |  | 	int PhysicalDevice = PadMapping[VirtualController].ID; | 
					
						
							| 
									
										
										
										
											2009-01-20 05:28:30 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-19 17:47:00 +00:00
										 |  |  |  | 	// Make local shortcut
 | 
					
						
							| 
									
										
										
										
											2009-01-24 22:13:53 +00:00
										 |  |  |  | 	SDL_Joystick *joy = PadState[VirtualController].joy; | 
					
						
							| 
									
										
										
										
											2009-01-20 05:28:30 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// Make shortcuts for all pads
 | 
					
						
							| 
									
										
										
										
											2009-01-24 22:13:53 +00:00
										 |  |  |  | 	SDL_Joystick *joy0 = PadState[0].joy; | 
					
						
							|  |  |  |  | 	SDL_Joystick *joy1 = PadState[1].joy; | 
					
						
							|  |  |  |  | 	SDL_Joystick *joy2 = PadState[2].joy; | 
					
						
							|  |  |  |  | 	SDL_Joystick *joy3 = PadState[3].joy; | 
					
						
							| 
									
										
										
										
											2009-01-19 17:47:00 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// Temporary storage
 | 
					
						
							| 
									
										
										
										
											2009-01-19 05:49:25 +00:00
										 |  |  |  | 	std::string StrAxes, StrHats, StrBut; | 
					
						
							|  |  |  |  | 	int value; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-19 17:47:00 +00:00
										 |  |  |  | 	// Get status
 | 
					
						
							| 
									
										
										
										
											2009-01-20 05:28:30 +00:00
										 |  |  |  | 	int Axes = joyinfo[PhysicalDevice].NumAxes; | 
					
						
							|  |  |  |  | 	int Balls = joyinfo[PhysicalDevice].NumBalls; | 
					
						
							|  |  |  |  | 	int Hats = joyinfo[PhysicalDevice].NumHats; | 
					
						
							|  |  |  |  | 	int Buttons = joyinfo[PhysicalDevice].NumButtons; | 
					
						
							| 
									
										
										
										
											2009-01-19 17:47:00 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// Update the internal values
 | 
					
						
							| 
									
										
										
										
											2009-01-19 05:49:25 +00:00
										 |  |  |  | 	SDL_JoystickUpdate(); | 
					
						
							| 
									
										
										
										
											2009-01-19 17:47:00 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// Go through all axes and read out their values
 | 
					
						
							|  |  |  |  | 	for(int i = 0; i < Axes; i++) | 
					
						
							| 
									
										
										
										
											2009-01-19 05:49:25 +00:00
										 |  |  |  | 	{	 | 
					
						
							|  |  |  |  | 		value = SDL_JoystickGetAxis(joy, i); | 
					
						
							| 
									
										
										
										
											2009-01-20 14:25:33 +00:00
										 |  |  |  | 		StrAxes += StringFromFormat(" %i:%06i", i, value); | 
					
						
							| 
									
										
										
										
											2009-01-19 05:49:25 +00:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2009-01-19 17:47:00 +00:00
										 |  |  |  | 	for(int i = 0;i < Hats; i++) | 
					
						
							| 
									
										
										
										
											2009-01-19 05:49:25 +00:00
										 |  |  |  | 	{	 | 
					
						
							|  |  |  |  | 		value = SDL_JoystickGetHat(joy, i); | 
					
						
							|  |  |  |  | 		StrHats += StringFromFormat(" %i:%i", i, value); | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2009-01-19 17:47:00 +00:00
										 |  |  |  | 	for(int i = 0;i < Buttons; i++) | 
					
						
							| 
									
										
										
										
											2009-01-19 05:49:25 +00:00
										 |  |  |  | 	{	 | 
					
						
							|  |  |  |  | 		value = SDL_JoystickGetButton(joy, i); | 
					
						
							|  |  |  |  | 		StrBut += StringFromFormat(" %i:%i", i+1, value); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	return StringFromFormat( | 
					
						
							| 
									
										
										
										
											2009-01-21 18:09:31 +00:00
										 |  |  |  | 		"PadMapping\n" | 
					
						
							| 
									
										
										
										
											2009-01-24 22:13:53 +00:00
										 |  |  |  | 		"Enabled: %i %i %i %i\n" | 
					
						
							| 
									
										
										
										
											2009-01-21 18:09:31 +00:00
										 |  |  |  | 		"ID: %i %i %i %i\n" | 
					
						
							|  |  |  |  | 		"Controllertype: %i %i %i %i\n" | 
					
						
							|  |  |  |  | 		"SquareToCircle: %i %i %i %i\n\n"		 | 
					
						
							| 
									
										
										
										
											2009-01-24 22:13:53 +00:00
										 |  |  |  | 		"Handles: %p %p %p %p\n" | 
					
						
							| 
									
										
										
										
											2009-01-21 18:09:31 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-20 14:25:33 +00:00
										 |  |  |  | 		"XInput: %i %i %i\n" | 
					
						
							| 
									
										
										
										
											2009-01-20 05:28:30 +00:00
										 |  |  |  | 		"Axes: %s\n" | 
					
						
							|  |  |  |  | 		"Hats: %s\n" | 
					
						
							|  |  |  |  | 		"But: %s\n" | 
					
						
							| 
									
										
										
										
											2009-01-24 22:13:53 +00:00
										 |  |  |  | 		"Device: Ax: %i Balls:%i Hats:%i But:%i", | 
					
						
							|  |  |  |  | 		PadMapping[0].enabled, PadMapping[1].enabled, PadMapping[2].enabled, PadMapping[3].enabled, | 
					
						
							| 
									
										
										
										
											2009-01-21 18:09:31 +00:00
										 |  |  |  | 		PadMapping[0].ID, PadMapping[1].ID, PadMapping[2].ID, PadMapping[3].ID, | 
					
						
							|  |  |  |  | 		PadMapping[0].controllertype, PadMapping[1].controllertype, PadMapping[2].controllertype, PadMapping[3].controllertype, | 
					
						
							|  |  |  |  | 		PadMapping[0].bSquareToCircle, PadMapping[1].bSquareToCircle, PadMapping[2].bSquareToCircle, PadMapping[3].bSquareToCircle, | 
					
						
							| 
									
										
										
										
											2009-01-20 10:41:05 +00:00
										 |  |  |  | 		joy0, joy1, joy2, joy3, | 
					
						
							| 
									
										
										
										
											2009-01-24 22:13:53 +00:00
										 |  |  |  | 		//PadState[PadMapping[0].ID].joy, PadState[PadMapping[1].ID].joy, PadState[PadMapping[2].ID].joy, PadState[PadMapping[3].ID].joy,
 | 
					
						
							| 
									
										
										
										
											2009-01-21 18:09:31 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 		#ifdef _WIN32
 | 
					
						
							|  |  |  |  | 			XInput::IsConnected(0), XInput::GetXI(0, XI_TRIGGER_L), XInput::GetXI(0, XI_TRIGGER_R), | 
					
						
							|  |  |  |  | 		#endif
 | 
					
						
							| 
									
										
										
										
											2009-01-19 17:47:00 +00:00
										 |  |  |  | 		StrAxes.c_str(), StrHats.c_str(), StrBut.c_str(), | 
					
						
							|  |  |  |  | 		Axes, Balls, Hats, Buttons | 
					
						
							| 
									
										
										
										
											2009-01-19 05:49:25 +00:00
										 |  |  |  | 		); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-26 02:42:15 +00:00
										 |  |  |  | // Populate the advanced tab
 | 
					
						
							|  |  |  |  | // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | void ConfigBox::Update() | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-01-19 05:49:25 +00:00
										 |  |  |  | 	// Show the current status
 | 
					
						
							| 
									
										
										
										
											2009-01-24 22:17:51 +00:00
										 |  |  |  | 	/*
 | 
					
						
							| 
									
										
										
										
											2008-12-27 11:32:03 +00:00
										 |  |  |  | 	m_pStatusBar->SetLabel(wxString::Format( | 
					
						
							| 
									
										
										
										
											2009-01-19 17:47:00 +00:00
										 |  |  |  | 		"%s", ShowStatus(notebookpage).c_str() | 
					
						
							| 
									
										
										
										
											2009-01-24 22:17:51 +00:00
										 |  |  |  | 		));*/ | 
					
						
							| 
									
										
										
										
											2009-01-24 22:13:53 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	//LogMsg("Abc%s\n", ShowStatus(notebookpage).c_str());
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if(StrangeHack) PadGetStatus(); | 
					
						
							|  |  |  |  | 	if(!g_Config.bShowAdvanced) StrangeHack = false; else StrangeHack = true; | 
					
						
							| 
									
										
										
										
											2008-12-26 02:42:15 +00:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // Populate the advanced tab
 | 
					
						
							|  |  |  |  | // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | void ConfigBox::CreateAdvancedControls(int i) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-12-27 11:32:03 +00:00
										 |  |  |  | 	m_pInStatus[i] = new wxPanel(m_Controller[i], ID_INSTATUS1 + i, wxDefaultPosition, wxDefaultSize); | 
					
						
							| 
									
										
										
										
											2008-12-26 02:42:15 +00:00
										 |  |  |  | 	m_bmpSquare[i] = new wxStaticBitmap(m_pInStatus[i], ID_STATUSBMP1 + i, CreateBitmap(), | 
					
						
							|  |  |  |  | 		//wxPoint(4, 15), wxSize(70,70));
 | 
					
						
							|  |  |  |  | 		//wxPoint(4, 20), wxDefaultSize);
 | 
					
						
							|  |  |  |  | 		wxDefaultPosition, wxDefaultSize); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	m_bmpDot[i] = new wxStaticBitmap(m_pInStatus[i], ID_STATUSDOTBMP1 + i, CreateBitmapDot(), | 
					
						
							| 
									
										
										
										
											2008-12-27 11:32:03 +00:00
										 |  |  |  | 		wxPoint(BoxW / 2, BoxH / 2), wxDefaultSize); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	m_pOutStatus[i] = new wxPanel(m_Controller[i], ID_INSTATUS1 + i, wxDefaultPosition, wxDefaultSize); | 
					
						
							|  |  |  |  | 	m_bmpSquareOut[i] = new wxStaticBitmap(m_pOutStatus[i], ID_STATUSBMP1 + i, CreateBitmap(), | 
					
						
							|  |  |  |  | 		//wxPoint(4, 15), wxSize(70,70));
 | 
					
						
							|  |  |  |  | 		//wxPoint(4, 20), wxDefaultSize);
 | 
					
						
							|  |  |  |  | 		wxDefaultPosition, wxDefaultSize); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	m_bmpDotOut[i] = new wxStaticBitmap(m_pOutStatus[i], ID_STATUSDOTBMP1 + i, CreateBitmapDot(), | 
					
						
							|  |  |  |  | 		wxPoint(BoxW / 2, BoxH / 2), wxDefaultSize); | 
					
						
							| 
									
										
										
										
											2008-12-26 02:42:15 +00:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | wxBitmap ConfigBox::CreateBitmap() // Create box
 | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-12-27 11:32:03 +00:00
										 |  |  |  | 	BoxW = 70, BoxH = 70; | 
					
						
							|  |  |  |  | 	wxBitmap bitmap(BoxW, BoxH); | 
					
						
							| 
									
										
										
										
											2008-12-26 02:42:15 +00:00
										 |  |  |  | 	wxMemoryDC dc; | 
					
						
							|  |  |  |  | 	dc.SelectObject(bitmap); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// Set outline and fill colors
 | 
					
						
							| 
									
										
										
										
											2008-12-27 11:32:03 +00:00
										 |  |  |  | 	//wxBrush LightBlueBrush(_T("#0383f0"));
 | 
					
						
							|  |  |  |  | 	//wxPen LightBluePen(_T("#80c5fd"));
 | 
					
						
							|  |  |  |  | 	//wxPen LightGrayPen(_T("#909090"));
 | 
					
						
							|  |  |  |  | 	wxPen LightBluePen(_T("#7f9db9")); // Windows XP color	
 | 
					
						
							|  |  |  |  | 	dc.SetPen(LightBluePen); | 
					
						
							| 
									
										
										
										
											2008-12-26 02:42:15 +00:00
										 |  |  |  | 	dc.SetBrush(*wxWHITE_BRUSH); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	dc.Clear(); | 
					
						
							| 
									
										
										
										
											2008-12-27 11:32:03 +00:00
										 |  |  |  | 	dc.DrawRectangle(0, 0, BoxW, BoxH); | 
					
						
							| 
									
										
										
										
											2008-12-26 02:42:15 +00:00
										 |  |  |  | 	dc.SelectObject(wxNullBitmap); | 
					
						
							|  |  |  |  | 	return bitmap; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | wxBitmap ConfigBox::CreateBitmapDot() // Create dot
 | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	int w = 2, h = 2; | 
					
						
							|  |  |  |  | 	wxBitmap bitmap(w, h); | 
					
						
							|  |  |  |  | 	wxMemoryDC dc; | 
					
						
							|  |  |  |  | 	dc.SelectObject(bitmap); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// Set outline and fill colors
 | 
					
						
							| 
									
										
										
										
											2008-12-27 11:32:03 +00:00
										 |  |  |  | 	//wxBrush RedBrush(_T("#0383f0"));	
 | 
					
						
							|  |  |  |  | 	//wxPen RedPen(_T("#80c5fd"));
 | 
					
						
							|  |  |  |  | 	//wxPen LightGrayPen(_T("#909090"));
 | 
					
						
							|  |  |  |  | 	dc.SetPen(*wxRED_PEN); | 
					
						
							|  |  |  |  | 	dc.SetBrush(*wxRED_BRUSH); | 
					
						
							| 
									
										
										
										
											2008-12-26 02:42:15 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	dc.Clear(); | 
					
						
							|  |  |  |  | 	dc.DrawRectangle(0, 0, w, h); | 
					
						
							|  |  |  |  | 	dc.SelectObject(wxNullBitmap); | 
					
						
							|  |  |  |  | 	return bitmap; | 
					
						
							| 
									
										
										
										
											2009-01-20 10:41:05 +00:00
										 |  |  |  | } |