2009-07-03 11:45:47 +00:00
|
|
|
/* OnePAD - author: arcum42(@gmail.com)
|
|
|
|
* Copyright (C) 2009
|
|
|
|
*
|
|
|
|
* Based on ZeroPAD, author zerofrog@gmail.com
|
|
|
|
* Copyright (C) 2006-2007
|
|
|
|
*
|
|
|
|
* 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; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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 for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2010-07-04 22:49:00 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
2009-07-03 11:45:47 +00:00
|
|
|
*/
|
2010-04-25 00:31:27 +00:00
|
|
|
|
2015-10-14 13:05:02 +00:00
|
|
|
#pragma once
|
2009-12-22 03:17:35 +00:00
|
|
|
|
2014-12-07 20:06:21 +00:00
|
|
|
#include <SDL.h>
|
|
|
|
#include <SDL_haptic.h>
|
2009-07-03 11:45:47 +00:00
|
|
|
|
2015-10-14 13:05:02 +00:00
|
|
|
#include "GamePad.h"
|
2009-07-03 11:45:47 +00:00
|
|
|
#include "onepad.h"
|
2009-07-10 06:07:32 +00:00
|
|
|
#include "controller.h"
|
2016-10-16 19:39:56 +00:00
|
|
|
#define NB_EFFECT 2 // Don't use more than two, ps2 only has one for big motor and one for small(like most systems)
|
2009-07-03 11:45:47 +00:00
|
|
|
// holds all joystick info
|
2017-04-26 18:12:46 +00:00
|
|
|
class JoystickInfo : public GamePad
|
2009-07-03 11:45:47 +00:00
|
|
|
{
|
2016-09-04 12:10:02 +00:00
|
|
|
public:
|
2017-04-14 18:14:42 +00:00
|
|
|
JoystickInfo(int id);
|
|
|
|
~JoystickInfo();
|
2009-07-03 11:45:47 +00:00
|
|
|
|
2017-04-10 16:19:23 +00:00
|
|
|
JoystickInfo(const JoystickInfo &) = delete; // copy constructor
|
|
|
|
JoystickInfo &operator=(const JoystickInfo &) = delete; // assignment
|
|
|
|
|
2015-10-17 16:57:28 +00:00
|
|
|
|
2016-09-04 12:10:02 +00:00
|
|
|
// opens handles to all possible joysticks
|
2017-04-10 16:19:23 +00:00
|
|
|
static void EnumerateJoysticks(std::vector<std::unique_ptr<GamePad>> &vjoysticks);
|
2009-07-03 11:45:47 +00:00
|
|
|
|
2017-04-26 18:12:46 +00:00
|
|
|
void Rumble(unsigned type, unsigned pad) override;
|
2009-07-03 11:45:47 +00:00
|
|
|
|
2017-04-26 18:12:46 +00:00
|
|
|
bool TestForce(float) override;
|
2009-07-03 11:45:47 +00:00
|
|
|
|
2017-04-26 18:12:46 +00:00
|
|
|
const char *GetName() final;
|
2017-04-16 12:57:23 +00:00
|
|
|
|
2017-04-26 18:12:46 +00:00
|
|
|
int GetInput(gamePadValues input) final;
|
2017-04-16 12:57:23 +00:00
|
|
|
|
2017-04-26 18:12:46 +00:00
|
|
|
void UpdateGamePadState() final;
|
2017-04-16 12:57:23 +00:00
|
|
|
|
2017-04-26 18:12:46 +00:00
|
|
|
size_t GetUniqueIdentifier() final;
|
2017-04-16 15:41:05 +00:00
|
|
|
|
2016-09-04 12:10:02 +00:00
|
|
|
private:
|
2017-04-16 12:57:23 +00:00
|
|
|
SDL_GameController *m_controller;
|
2017-04-14 18:14:42 +00:00
|
|
|
SDL_Haptic *m_haptic;
|
|
|
|
std::array<int, NB_EFFECT> m_effects_id;
|
2017-04-16 15:41:05 +00:00
|
|
|
size_t m_unique_id;
|
2017-05-03 10:33:42 +00:00
|
|
|
std::array<int, MAX_KEYS> m_pad_to_sdl;
|
2009-07-03 11:45:47 +00:00
|
|
|
};
|