Cleanup the code a bit wrt, unused functions and functions

that can be declared static.
This commit is contained in:
riccardom 2010-04-05 16:11:29 +00:00
parent 320fa688f1
commit 914d91da2c
5 changed files with 17 additions and 12 deletions

View File

@ -64,7 +64,7 @@ float Rad2Deg(float Rad)
// Check if the pad is within the dead zone, we assume the range is 0x8000
// ----------------
float CoordinatesToRadius(int x, int y)
static float CoordinatesToRadius(int x, int y)
{
return sqrt(pow((float)x, 2) + pow((float)y, 2));
}
@ -159,7 +159,7 @@ void RadiusAdjustment(int &_x, int &_y, int _pad, std::string SRadius)
/* Calculate the distance from the outer edges of the box to the outer edges of the circle inside the box
at any angle from 0 to 360. The returned value is 1 + Distance, for example at most sqrt(2) in the
corners and at least 1.0 at the horizontal and vertical angles. */
float Square2CircleDistance(float deg)
static float Square2CircleDistance(float deg)
{
// See if we have to adjust the angle
deg = abs(deg);

View File

@ -1,4 +1,5 @@
#include "EventHandler.h"
#include "InputCommon.h"
//EventHandler *eventHandler = NULL;

View File

@ -125,7 +125,7 @@ bool SearchDevices(std::vector<CONTROLLER_INFO> &_joyinfo, int &_NumPads, int &_
// Read buttons status. Called from GetJoyState().
// ----------------------
void ReadButton(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping, int button, int NumButtons)
static void ReadButton(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping, int button, int NumButtons)
{
int ctl_button = _PadMapping.buttons[button];
if (ctl_button < NumButtons)
@ -250,7 +250,7 @@ void GetJoyState(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping, in
// ---------------------
/* Function: We have to avoid very big values to becuse some triggers are -0x8000 in the
unpressed state (and then go from -0x8000 to 0x8000 as they are fully pressed) */
bool AvoidValues(int value, bool NoTriggerFilter)
static bool AvoidValues(int value, bool NoTriggerFilter)
{
// Avoid detecting very small or very big (for triggers) values
if( (value > -0x2000 && value < 0x2000) // Small values

View File

@ -113,6 +113,7 @@ BOOL APIENTRY aMain(HINSTANCE hinstDLL, // DLL module handle
}
#endif
#if 0
#if defined(HAVE_WX)
wxWindow* GetParentedWxWindow(HWND Parent)
{
@ -127,7 +128,7 @@ wxWindow* GetParentedWxWindow(HWND Parent)
return win;
}
#endif
#endif
// Input Recording
@ -227,12 +228,13 @@ bool IsFocus()
#endif
}
#ifdef _WIN32
// Implement circular deadzone
const float kDeadZone = 0.1f;
void ScaleStickValues(unsigned char* outx,
unsigned char* outy,
short inx, short iny)
{
const float kDeadZone = 0.1f;
float x = ((float)inx + 0.5f) / 32767.5f;
float y = ((float)iny + 0.5f) / 32767.5f;
@ -258,12 +260,13 @@ void ScaleStickValues(unsigned char* outx,
*outx = 0x80 + ix;
*outy = 0x80 + iy;
}
#endif
// for same displacement should be sqrt(2)/2 (in theory)
// 3/4 = 0.75 is a little faster than sqrt(2)/2 = 0.7071...
// In SMS, 17/20 = 0.85 is perfect; in WW, 7/10 = 0.70 is closer.
#define DIAGONAL_SCALE 0.70710678
void EmulateAnalogStick(unsigned char *stickX, unsigned char *stickY, bool buttonUp, bool buttonDown, bool buttonLeft, bool buttonRight, int magnitude) {
static void EmulateAnalogStick(unsigned char *stickX, unsigned char *stickY, bool buttonUp, bool buttonDown, bool buttonLeft, bool buttonRight, int magnitude) {
int mainY = 0;
int mainX = 0;
if (buttonUp)
@ -434,7 +437,7 @@ bool XInput_Read(int XPadPlayer, SPADStatus* _pPADStatus)
#if (defined(HAVE_X11) && HAVE_X11) || (defined(HAVE_COCOA) && HAVE_COCOA)
#if defined(HAVE_X11) && HAVE_X11
// The graphics plugin in the PCSX2 design leaves a lot of the window processing to the pad plugin, weirdly enough.
void X11_Read(int _numPAD, SPADStatus* _pPADStatus)
static void X11_Read(int _numPAD, SPADStatus* _pPADStatus)
{
// Do all the stuff we need to do once per frame here
if (_numPAD != 0)
@ -684,6 +687,7 @@ void Initialize(void *init)
#endif
}
#if 0
void DoState(unsigned char **ptr, int mode)
{
#ifdef RERECORDING
@ -704,7 +708,7 @@ void DoState(unsigned char **ptr, int mode)
#endif
}
void Shutdown()
static void Shutdown()
{
// Save the recording and reset the counter
#ifdef RERECORDING
@ -729,7 +733,7 @@ void Shutdown()
#endif
SaveConfig();
}
#endif
// Set buttons status from wxWidgets in the main application
void PAD_Input(u16 _Key, u8 _UpDown) {}

View File

@ -628,9 +628,9 @@ bool Desmume::OnInit()
PADInitialize.padNumber = 1;
extern void Initialize(void *init);
#ifndef WIN32
extern void Initialize(void *init);
Initialize(&PADInitialize);
#endif