2008-12-08 04:46:09 +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/
|
|
|
|
|
//
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2009-01-19 17:47:00 +00:00
|
|
|
|
|
2009-02-11 10:30:02 +00:00
|
|
|
|
#ifndef __NJOY_h__
|
|
|
|
|
#define __NJOY_h__
|
|
|
|
|
|
2009-01-19 17:47:00 +00:00
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Includes
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2008-12-27 11:32:03 +00:00
|
|
|
|
#include <vector> // System
|
2009-01-05 22:11:08 +00:00
|
|
|
|
#include <cstdio>
|
|
|
|
|
#include <ctime>
|
|
|
|
|
#include <cmath>
|
2009-02-10 14:02:01 +00:00
|
|
|
|
|
|
|
|
|
#include "../../../Core/InputCommon/Src/SDL.h" // Core
|
|
|
|
|
#include "../../../Core/InputCommon/Src/XInput.h"
|
2008-12-08 04:46:09 +00:00
|
|
|
|
|
2008-12-27 11:32:03 +00:00
|
|
|
|
#include "Common.h" // Common
|
2009-02-18 23:26:16 +00:00
|
|
|
|
#include "Setup.h"
|
2008-12-18 01:21:56 +00:00
|
|
|
|
#include "pluginspecs_pad.h"
|
|
|
|
|
#include "IniFile.h"
|
2008-12-08 04:46:09 +00:00
|
|
|
|
|
2008-12-27 11:32:03 +00:00
|
|
|
|
#include "Config.h" // Local
|
|
|
|
|
|
2008-12-14 23:52:01 +00:00
|
|
|
|
#if defined(HAVE_WX) && HAVE_WX
|
2008-12-27 11:32:03 +00:00
|
|
|
|
#include "GUI/AboutBox.h"
|
|
|
|
|
#include "GUI/ConfigBox.h"
|
|
|
|
|
//extern ConfigBox* m_frame;
|
2008-12-14 23:52:01 +00:00
|
|
|
|
#endif
|
2008-12-08 04:46:09 +00:00
|
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
2008-12-26 02:42:15 +00:00
|
|
|
|
#include <tchar.h>
|
|
|
|
|
#define DIRECTINPUT_VERSION 0x0800
|
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
|
|
2009-04-02 21:13:58 +00:00
|
|
|
|
#pragma comment(lib, "dxguid.lib")
|
|
|
|
|
#pragma comment(lib, "dinput8.lib")
|
|
|
|
|
#pragma comment(lib, "winmm.lib")
|
|
|
|
|
#include <dinput.h>
|
|
|
|
|
void FreeDirectInput(); // Needed in both nJoy.cpp and Rumble.cpp
|
2008-12-18 01:21:56 +00:00
|
|
|
|
#else
|
2009-01-19 17:47:00 +00:00
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <sys/ioctl.h>
|
2008-12-18 01:21:56 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef __linux__
|
|
|
|
|
#include <linux/input.h>
|
2008-12-08 04:46:09 +00:00
|
|
|
|
#endif
|
2009-01-19 17:47:00 +00:00
|
|
|
|
//////////////////////////////
|
2008-12-08 04:46:09 +00:00
|
|
|
|
|
2008-12-26 02:42:15 +00:00
|
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Define
|
2009-01-19 17:47:00 +00:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2008-12-08 04:46:09 +00:00
|
|
|
|
|
|
|
|
|
#define INPUT_VERSION "0.3"
|
|
|
|
|
#define INPUT_STATE "PUBLIC RELEASE"
|
|
|
|
|
#define RELDAY "21"
|
|
|
|
|
#define RELMONTH "07"
|
|
|
|
|
#define RELYEAR "2008"
|
|
|
|
|
#define THANKYOU "`plot`, Absolute0, Aprentice, Bositman, Brice, ChaosCode, CKemu, CoDeX, Dave2001, dn, drk||Raziel, Florin, Gent, Gigaherz, Hacktarux, JegHegy, Linker, Linuzappz, Martin64, Muad, Knuckles, Raziel, Refraction, Rudy_x, Shadowprince, Snake785, Saqib, vEX, yaz0r, Zilmar, Zenogais and ZeZu."
|
|
|
|
|
|
2008-12-26 02:42:15 +00:00
|
|
|
|
|
2008-12-28 18:50:24 +00:00
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Input vector. Todo: Save the configured keys here instead of in joystick
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/*
|
|
|
|
|
#ifndef _CONTROLLER_STATE_H
|
|
|
|
|
extern std::vector<u8> Keys;
|
|
|
|
|
#endif
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-12-26 02:42:15 +00:00
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Variables
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2009-02-10 14:02:01 +00:00
|
|
|
|
#ifndef _EXCLUDE_MAIN_
|
2009-02-18 23:26:16 +00:00
|
|
|
|
extern SPADInitialize *g_PADInitialize;
|
2008-12-26 02:42:15 +00:00
|
|
|
|
extern FILE *pFile;
|
2009-02-10 14:02:01 +00:00
|
|
|
|
extern std::vector<InputCommon::CONTROLLER_INFO> joyinfo;
|
|
|
|
|
extern InputCommon::CONTROLLER_STATE PadState[4];
|
|
|
|
|
extern InputCommon::CONTROLLER_MAPPING PadMapping[4];
|
2009-02-11 10:30:02 +00:00
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
extern HWND m_hWnd, m_hConsole; // Handle to window
|
|
|
|
|
#endif
|
|
|
|
|
extern int NumPads, NumGoodPads, LastPad; // Number of goods pads
|
2008-12-26 02:42:15 +00:00
|
|
|
|
#endif
|
2009-02-18 23:26:16 +00:00
|
|
|
|
////////////////////////////////
|
2008-12-26 02:42:15 +00:00
|
|
|
|
|
|
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Custom Functions
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2009-02-10 14:02:01 +00:00
|
|
|
|
bool Search_Devices(std::vector<InputCommon::CONTROLLER_INFO> &_joyinfo, int &_NumPads, int &_NumGoodPads);
|
2008-12-08 04:46:09 +00:00
|
|
|
|
void DEBUG_INIT();
|
|
|
|
|
void DEBUG_QUIT();
|
2009-02-01 16:29:35 +00:00
|
|
|
|
bool IsFocus();
|
2009-02-11 10:30:02 +00:00
|
|
|
|
bool ReloadDLL();
|
2009-04-02 21:13:58 +00:00
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
HRESULT InitRumble(HWND hWnd);
|
|
|
|
|
#endif
|
2008-12-08 04:46:09 +00:00
|
|
|
|
|
2009-02-18 23:26:16 +00:00
|
|
|
|
////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// ReRecording
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
#ifdef RERECORDING
|
|
|
|
|
namespace Recording
|
|
|
|
|
{
|
|
|
|
|
void Initialize();
|
|
|
|
|
void DoState(unsigned char **ptr, int mode);
|
|
|
|
|
void ShutDown();
|
|
|
|
|
void Save();
|
|
|
|
|
void Load();
|
|
|
|
|
const SPADStatus& Play();
|
|
|
|
|
void RecordInput(const SPADStatus& _rPADStatus);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
////////////////////////////////
|
2009-02-11 10:30:02 +00:00
|
|
|
|
|
|
|
|
|
|
2009-02-22 21:37:36 +00:00
|
|
|
|
#endif // __NJOY_h__
|