2008-07-22 09:02:26 +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-07-23 19:23:36 +00:00
|
|
|
|
|
2008-07-26 12:28:17 +00:00
|
|
|
|
// Set this if you want to use the new wxWidgets GUI
|
|
|
|
|
#define USE_WXWIDGETS
|
|
|
|
|
|
2008-07-23 18:53:54 +00:00
|
|
|
|
#ifdef _WIN32
|
2008-07-22 09:02:26 +00:00
|
|
|
|
#define _CRT_SECURE_NO_WARNINGS
|
|
|
|
|
|
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
2008-07-23 19:23:36 +00:00
|
|
|
|
#include <tchar.h>
|
|
|
|
|
#endif
|
2008-07-23 18:53:54 +00:00
|
|
|
|
|
2008-07-22 09:02:26 +00:00
|
|
|
|
#include <vector>
|
|
|
|
|
#include <stdio.h>
|
2008-07-23 19:23:36 +00:00
|
|
|
|
#include <time.h>
|
2008-07-22 09:02:26 +00:00
|
|
|
|
#include <SDL.h> // includes SDL
|
2008-07-23 19:23:36 +00:00
|
|
|
|
|
2008-07-29 22:26:42 +00:00
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
#define SLEEP(x) Sleep(x)
|
|
|
|
|
#else
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#define SLEEP(x) usleep(x*1000)
|
|
|
|
|
#endif
|
2008-07-22 09:02:26 +00:00
|
|
|
|
|
2008-07-29 22:26:42 +00:00
|
|
|
|
#ifdef USE_WXWIDGETS
|
|
|
|
|
#include "GUI/AboutBox.h"
|
|
|
|
|
#include "GUI/ConfigBox.h"
|
|
|
|
|
#else
|
2008-07-22 09:02:26 +00:00
|
|
|
|
#include "config.h"
|
2008-07-29 22:26:42 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "Common.h"
|
|
|
|
|
#include "pluginspecs_pad.h"
|
2008-07-22 09:02:26 +00:00
|
|
|
|
#include "IniFile.h"
|
2008-07-23 19:23:36 +00:00
|
|
|
|
|
2008-07-23 18:53:54 +00:00
|
|
|
|
#ifdef _WIN32
|
2008-07-22 09:02:26 +00:00
|
|
|
|
#pragma comment(lib, "SDL.lib")
|
2008-07-29 22:26:42 +00:00
|
|
|
|
#pragma comment(lib, "comctl32.lib")
|
2008-07-23 18:53:54 +00:00
|
|
|
|
#endif
|
2008-07-22 09:02:26 +00:00
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Define
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
#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."
|
|
|
|
|
|
|
|
|
|
struct CONTROLLER_STATE{ // GC PAD INFO/STATE
|
|
|
|
|
int buttons[8]; // Amount of buttons (A B X Y Z, L-Trigger R-Trigger Start) might need to change the triggers buttons
|
|
|
|
|
int dpad; // 1 HAT (8 directions + neutral)
|
2008-07-23 00:49:20 +00:00
|
|
|
|
int dpad2[4]; // d-pad using buttons
|
2008-07-22 09:02:26 +00:00
|
|
|
|
int axis[4]; // 2 x 2 Axes (Main & Sub)
|
2008-07-23 00:49:20 +00:00
|
|
|
|
int halfpress; // ...
|
2008-07-22 09:02:26 +00:00
|
|
|
|
SDL_Joystick *joy; // SDL joystick device
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct CONTROLLER_MAPPING{ // GC PAD MAPPING
|
|
|
|
|
int buttons[8]; // Amount of buttons (A B X Y Z, L-Trigger R-Trigger Start) might need to change the triggers buttons
|
|
|
|
|
int dpad; // 1 HAT (8 directions + neutral)
|
2008-07-23 00:49:20 +00:00
|
|
|
|
int dpad2[4]; // d-pad using buttons
|
2008-07-22 09:02:26 +00:00
|
|
|
|
int axis[4]; // 2 x 2 Axes (Main & Sub)
|
|
|
|
|
int enabled; // Pad attached?
|
|
|
|
|
int deadzone; // Deadzone... what else?
|
2008-07-23 00:49:20 +00:00
|
|
|
|
int halfpress; // Halfpress... you know, like not fully pressed ;)...
|
2008-07-22 09:02:26 +00:00
|
|
|
|
int ID; // SDL joystick device ID
|
2008-07-23 00:49:20 +00:00
|
|
|
|
int controllertype; // Joystick, Joystick no hat or a keyboard (perhaps a mouse later)
|
2008-07-22 09:02:26 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct CONTROLLER_INFO{ // CONNECTED WINDOWS DEVICES INFO
|
|
|
|
|
int NumAxes; // Amount of Axes
|
|
|
|
|
int NumButtons; // Amount of Buttons
|
|
|
|
|
int NumBalls; // Amount of Balls
|
|
|
|
|
int NumHats; // Amount of Hats (POV)
|
|
|
|
|
const char *Name; // Joypad/stickname
|
|
|
|
|
int ID; // SDL joystick device ID
|
|
|
|
|
SDL_Joystick *joy; // SDL joystick device
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum
|
|
|
|
|
{
|
|
|
|
|
CTL_MAIN_X = 0,
|
|
|
|
|
CTL_MAIN_Y,
|
|
|
|
|
CTL_SUB_X,
|
|
|
|
|
CTL_SUB_Y,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum
|
|
|
|
|
{
|
|
|
|
|
CTL_L_SHOULDER = 0,
|
|
|
|
|
CTL_R_SHOULDER,
|
|
|
|
|
CTL_A_BUTTON,
|
|
|
|
|
CTL_B_BUTTON,
|
|
|
|
|
CTL_X_BUTTON,
|
|
|
|
|
CTL_Y_BUTTON,
|
|
|
|
|
CTL_Z_TRIGGER,
|
2008-07-23 00:49:20 +00:00
|
|
|
|
CTL_START
|
2008-07-22 09:02:26 +00:00
|
|
|
|
};
|
|
|
|
|
|
2008-07-23 00:49:20 +00:00
|
|
|
|
enum
|
|
|
|
|
{
|
|
|
|
|
CTL_TYPE_JOYSTICK = 0,
|
|
|
|
|
CTL_TYPE_JOYSTICK_NO_HAT,
|
|
|
|
|
CTL_TYPE_KEYBOARD
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum
|
|
|
|
|
{
|
|
|
|
|
CTL_D_PAD_UP = 0,
|
|
|
|
|
CTL_D_PAD_DOWN,
|
|
|
|
|
CTL_D_PAD_LEFT,
|
|
|
|
|
CTL_D_PAD_RIGHT
|
|
|
|
|
};
|
2008-07-22 09:02:26 +00:00
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Custom Functions
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
void GetJoyState(int controller);
|
|
|
|
|
int Search_Devices();
|
|
|
|
|
void DEBUG_INIT();
|
|
|
|
|
void DEBUG_QUIT();
|
|
|
|
|
|
|
|
|
|
void SaveConfig();
|
2008-07-23 19:23:36 +00:00
|
|
|
|
void LoadConfig();
|