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 CONTROLLER_INFO *joyinfo;
|
|
|
|
|
extern bool emulator_running;
|
|
|
|
|
////////////////////////
|
|
|
|
|
|
|
|
|
|
int main_stick_x = 0;
|
|
|
|
|
|
|
|
|
|
// Set PAD status
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void ConfigBox::PadGetStatus()
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
int _numPAD = 0;
|
|
|
|
|
|
|
|
|
|
if (!joysticks[_numPAD].enabled)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Clear pad status
|
|
|
|
|
//memset(_pPADStatus, 0, sizeof(SPADStatus));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get pad status
|
|
|
|
|
GetJoyState(_numPAD);
|
|
|
|
|
|
|
|
|
|
// Reset!
|
|
|
|
|
/*
|
|
|
|
|
int base = 0x80;
|
|
|
|
|
_pPADStatus->stickY = base;
|
|
|
|
|
_pPADStatus->stickX = base;
|
|
|
|
|
_pPADStatus->substickX = base;
|
|
|
|
|
_pPADStatus->substickY = base;
|
|
|
|
|
_pPADStatus->button |= PAD_USE_ORIGIN;
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// Set analog controllers
|
|
|
|
|
// Set Deadzones perhaps out of function
|
|
|
|
|
//int deadzone = (int)(((float)(128.00/100.00)) * (float)(joysticks[_numPAD].deadzone+1));
|
|
|
|
|
//int deadzone2 = (int)(((float)(-128.00/100.00)) * (float)(joysticks[_numPAD].deadzone+1));
|
|
|
|
|
|
|
|
|
|
// Adjust range
|
|
|
|
|
// The value returned by SDL_JoystickGetAxis is a signed integer (-32768 to 32768)
|
|
|
|
|
// The value used for the gamecube controller is an unsigned char (0 to 255)
|
|
|
|
|
int main_stick_x = (joystate[_numPAD].axis[CTL_MAIN_X] >> 8);
|
|
|
|
|
int main_stick_y = -(joystate[_numPAD].axis[CTL_MAIN_Y] >> 8);
|
|
|
|
|
//int sub_stick_x = (joystate[_numPAD].axis[CTL_SUB_X] >> 8);
|
|
|
|
|
//int sub_stick_y = -(joystate[_numPAD].axis[CTL_SUB_Y] >> 8);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (joystate[_numPAD].buttons[CTL_A_BUTTON])
|
|
|
|
|
{
|
|
|
|
|
PanicAlert("");
|
|
|
|
|
//_pPADStatus->button |= PAD_BUTTON_A;
|
|
|
|
|
//_pPADStatus->analogA = 255; // Perhaps support pressure?
|
|
|
|
|
for(int i=0; i<4 ;i++)
|
|
|
|
|
{
|
|
|
|
|
m_bmpDot[i]->SetPosition(wxPoint(main_stick_x += 3, main_stick_y));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(int i=0; i<4 ;i++)
|
|
|
|
|
{
|
|
|
|
|
//m_bmpDot[i]->SetPosition(wxPoint(main_stick_x / 4, main_stick_y / 4));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Populate the advanced tab
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void ConfigBox::Update()
|
|
|
|
|
{
|
|
|
|
|
//PadGetStatus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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)
|
|
|
|
|
{
|
|
|
|
|
m_pInStatus[i] = new wxPanel(m_Notebook, ID_INSTATUS1 + i, wxDefaultPosition, wxDefaultSize);
|
|
|
|
|
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(),
|
|
|
|
|
wxPoint(40, 40), wxDefaultSize);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wxBitmap ConfigBox::CreateBitmap() // Create box
|
|
|
|
|
{
|
|
|
|
|
int w = 70, h = 70;
|
|
|
|
|
wxBitmap bitmap(w, h);
|
|
|
|
|
wxMemoryDC dc;
|
|
|
|
|
dc.SelectObject(bitmap);
|
|
|
|
|
|
|
|
|
|
// Set outline and fill colors
|
|
|
|
|
wxBrush LightBlueBrush(_T("#0383f0"));
|
|
|
|
|
wxPen LightBluePen(_T("#80c5fd"));
|
|
|
|
|
wxPen LightGrayPen(_T("#909090"));
|
|
|
|
|
dc.SetPen(LightGrayPen);
|
|
|
|
|
dc.SetBrush(*wxWHITE_BRUSH);
|
|
|
|
|
|
|
|
|
|
dc.Clear();
|
|
|
|
|
dc.DrawRectangle(0, 0, w, h);
|
|
|
|
|
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
|
|
|
|
|
wxBrush LightBlueBrush(_T("#0383f0"));
|
|
|
|
|
wxPen LightBluePen(_T("#80c5fd"));
|
|
|
|
|
wxPen LightGrayPen(_T("#909090"));
|
|
|
|
|
dc.SetPen(LightGrayPen);
|
|
|
|
|
dc.SetBrush(*wxWHITE_BRUSH);
|
|
|
|
|
|
|
|
|
|
dc.Clear();
|
|
|
|
|
dc.DrawRectangle(0, 0, w, h);
|
|
|
|
|
dc.SelectObject(wxNullBitmap);
|
|
|
|
|
return bitmap;
|
|
|
|
|
}
|