Merged PadSimple with nJoy

(Linux build could be broken, X360Pad support could be broken)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4924 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
ayuanx
2010-01-22 23:19:16 +00:00
parent c09ec17bb2
commit 68a4eacb62
38 changed files with 3302 additions and 9319 deletions

View File

@ -1,35 +1,22 @@
// Project description
// -------------------
// Name: nJoy
// Description: A Dolphin Compatible Input Plugin
//
// Author: Falcon4ever (nJoy@falcon4ever.com)
// Site: www.multigesture.net
// Copyright (C) 2003 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/
//
// Include
// ---------
#include "../../../Core/InputCommon/Src/SDL.h" // Core
#include "EmuDefinitions.h"
@ -80,19 +67,16 @@ RUMBLE pRumble[MAX_WIIMOTES];
void Pad_Use_Rumble(u8 _numPAD)
{
if (WiiMapping[_numPAD].Rumble)
if (!g_Rumble)
{
if (!g_Rumble)
{
// GetForegroundWindow() always sends the good HWND
if (FAILED(InitRumble(GetForegroundWindow())))
PanicAlert("Could not initialize Rumble!");
} else
{
// Acquire gamepad
if (pRumble[_numPAD].g_pDevice != NULL)
pRumble[_numPAD].g_pDevice->Acquire();
}
// GetForegroundWindow() always sends the good HWND
if (FAILED(InitRumble(GetForegroundWindow())))
PanicAlert("Could not initialize Rumble!");
} else
{
// Acquire gamepad
if (pRumble[_numPAD].g_pDevice != NULL)
pRumble[_numPAD].g_pDevice->Acquire();
}
}
@ -102,23 +86,23 @@ void Pad_Use_Rumble(u8 _numPAD)
void PAD_Rumble(u8 _numPAD, unsigned int _uType)
{
if (WiiMapping[_numPAD].ID >= NumPads || !WiiMapping[_numPAD].Rumble)
return;
Pad_Use_Rumble(_numPAD);
int Strenght = 0;
if (WiiMapping[_numPAD].Rumble) // rumble activated
if (_uType == 1)
{
if (_uType == 1)
{
// it looks like _uStrength is equal to 3 everytime anyway...
Strenght = 1000 * (WiiMapping[_numPAD].RumbleStrength);
Strenght = Strenght > 10000 ? 10000 : Strenght;
}
else
Strenght = 0;
SetDeviceForcesXY(_numPAD, Strenght);
// it looks like _uStrength is equal to 3 everytime anyway...
Strenght = 1000 * (WiiMapping[_numPAD].RumbleStrength);
Strenght = Strenght > 10000 ? 10000 : Strenght;
}
else
Strenght = 0;
SetDeviceForcesXY(_numPAD, Strenght);
}
// Rumble stuff :D!