Back ported SDL joystick/gamepad improvements from Qt to GTK gui.
This commit is contained in:
parent
61894c7772
commit
5bfbbbba7e
|
@ -102,20 +102,20 @@ LoadCPalette(const std::string &file)
|
||||||
static void
|
static void
|
||||||
CreateDirs(const std::string &dir)
|
CreateDirs(const std::string &dir)
|
||||||
{
|
{
|
||||||
const char *subs[8]={"fcs","snaps","gameinfo","sav","cheats","movies","cfg.d"};
|
const char *subs[9]={"fcs","snaps","gameinfo","sav","cheats","movies","input"};
|
||||||
std::string subdir;
|
std::string subdir;
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
#if defined(WIN32) || defined(NEED_MINGW_HACKS)
|
#if defined(WIN32) || defined(NEED_MINGW_HACKS)
|
||||||
mkdir(dir.c_str());
|
mkdir(dir.c_str());
|
||||||
chmod(dir.c_str(), 755);
|
chmod(dir.c_str(), 755);
|
||||||
for(x = 0; x < 6; x++) {
|
for(x = 0; x < 7; x++) {
|
||||||
subdir = dir + PSS + subs[x];
|
subdir = dir + PSS + subs[x];
|
||||||
mkdir(subdir.c_str());
|
mkdir(subdir.c_str());
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
mkdir(dir.c_str(), S_IRWXU);
|
mkdir(dir.c_str(), S_IRWXU);
|
||||||
for(x = 0; x < 6; x++) {
|
for(x = 0; x < 7; x++) {
|
||||||
subdir = dir + PSS + subs[x];
|
subdir = dir + PSS + subs[x];
|
||||||
mkdir(subdir.c_str(), S_IRWXU);
|
mkdir(subdir.c_str(), S_IRWXU);
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ InitConfig()
|
||||||
config->addOption("input4", "SDL.Input.3", "Gamepad.3");
|
config->addOption("input4", "SDL.Input.3", "Gamepad.3");
|
||||||
|
|
||||||
// allow for input configuration
|
// allow for input configuration
|
||||||
config->addOption('i', "inputcfg", "SDL.InputCfg", InputCfg);
|
//config->addOption('i', "inputcfg", "SDL.InputCfg", InputCfg);
|
||||||
|
|
||||||
// display input
|
// display input
|
||||||
config->addOption("inputdisplay", "SDL.InputDisplay", 0);
|
config->addOption("inputdisplay", "SDL.InputDisplay", 0);
|
||||||
|
@ -286,8 +286,6 @@ InitConfig()
|
||||||
//TODO implement this
|
//TODO implement this
|
||||||
config->addOption("periodicsaves", "SDL.PeriodicSaves", 0);
|
config->addOption("periodicsaves", "SDL.PeriodicSaves", 0);
|
||||||
|
|
||||||
|
|
||||||
#ifdef _GTK
|
|
||||||
char* home_dir = getenv("HOME");
|
char* home_dir = getenv("HOME");
|
||||||
// prefixed with _ because they are internal (not cli options)
|
// prefixed with _ because they are internal (not cli options)
|
||||||
config->addOption("_lastopenfile", "SDL.LastOpenFile", home_dir);
|
config->addOption("_lastopenfile", "SDL.LastOpenFile", home_dir);
|
||||||
|
@ -295,7 +293,9 @@ InitConfig()
|
||||||
config->addOption("_lastopennsf", "SDL.LastOpenNSF", home_dir);
|
config->addOption("_lastopennsf", "SDL.LastOpenNSF", home_dir);
|
||||||
config->addOption("_lastsavestateas", "SDL.LastSaveStateAs", home_dir);
|
config->addOption("_lastsavestateas", "SDL.LastSaveStateAs", home_dir);
|
||||||
config->addOption("_lastloadlua", "SDL.LastLoadLua", "");
|
config->addOption("_lastloadlua", "SDL.LastLoadLua", "");
|
||||||
#endif
|
|
||||||
|
config->addOption("_useNativeFileDialog", "SDL.UseNativeFileDialog", false);
|
||||||
|
config->addOption("_useNativeMenuBar" , "SDL.UseNativeMenuBar", false);
|
||||||
|
|
||||||
// fcm -> fm2 conversion
|
// fcm -> fm2 conversion
|
||||||
config->addOption("fcmconvert", "SDL.FCMConvert", "");
|
config->addOption("fcmconvert", "SDL.FCMConvert", "");
|
||||||
|
@ -317,10 +317,8 @@ InitConfig()
|
||||||
prefix = buf;
|
prefix = buf;
|
||||||
|
|
||||||
config->addOption(prefix + "DeviceType", DefaultGamePadDevice[i]);
|
config->addOption(prefix + "DeviceType", DefaultGamePadDevice[i]);
|
||||||
config->addOption(prefix + "DeviceNum", 0);
|
config->addOption(prefix + "DeviceGUID", "");
|
||||||
for(unsigned int j = 0; j < GAMEPAD_NUM_BUTTONS; j++) {
|
config->addOption(prefix + "Profile" , "");
|
||||||
config->addOption(prefix + GamePadNames[j], DefaultGamePad[i][j]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PowerPad 0 - 1
|
// PowerPad 0 - 1
|
||||||
|
|
|
@ -18,6 +18,8 @@ void SilenceSound(int s); /* DOS and SDL */
|
||||||
|
|
||||||
int InitJoysticks(void);
|
int InitJoysticks(void);
|
||||||
int KillJoysticks(void);
|
int KillJoysticks(void);
|
||||||
|
int AddJoystick( int which );
|
||||||
|
int RemoveJoystick( int which );
|
||||||
uint32 *GetJSOr(void);
|
uint32 *GetJSOr(void);
|
||||||
|
|
||||||
int InitVideo(FCEUGI *gi);
|
int InitVideo(FCEUGI *gi);
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "memview.h"
|
#include "memview.h"
|
||||||
#include "ramwatch.h"
|
#include "ramwatch.h"
|
||||||
#include "debugger.h"
|
#include "debugger.h"
|
||||||
|
#include "sdl-joystick.h"
|
||||||
#include "fceux_git_info.h"
|
#include "fceux_git_info.h"
|
||||||
|
|
||||||
#ifdef _S9XLUA_H
|
#ifdef _S9XLUA_H
|
||||||
|
@ -74,7 +75,6 @@ extern bool gtk_gui_run;
|
||||||
GtkWidget *MainWindow = NULL;
|
GtkWidget *MainWindow = NULL;
|
||||||
GtkWidget *evbox = NULL;
|
GtkWidget *evbox = NULL;
|
||||||
GtkWidget *padNoCombo = NULL;
|
GtkWidget *padNoCombo = NULL;
|
||||||
GtkWidget *configNoCombo = NULL;
|
|
||||||
GtkWidget *buttonMappings[10] = { NULL };
|
GtkWidget *buttonMappings[10] = { NULL };
|
||||||
static GtkWidget *Menubar = NULL;
|
static GtkWidget *Menubar = NULL;
|
||||||
static GtkRadioMenuItem *stateSlot[10] = { NULL };
|
static GtkRadioMenuItem *stateSlot[10] = { NULL };
|
||||||
|
@ -137,9 +137,6 @@ int configGamepadButton (GtkButton * button, gpointer p)
|
||||||
int padNo =
|
int padNo =
|
||||||
atoi (gtk_combo_box_text_get_active_text
|
atoi (gtk_combo_box_text_get_active_text
|
||||||
(GTK_COMBO_BOX_TEXT (padNoCombo))) - 1;
|
(GTK_COMBO_BOX_TEXT (padNoCombo))) - 1;
|
||||||
int configNo =
|
|
||||||
atoi (gtk_combo_box_text_get_active_text
|
|
||||||
(GTK_COMBO_BOX_TEXT (configNoCombo))) - 1;
|
|
||||||
|
|
||||||
char buf[256];
|
char buf[256];
|
||||||
std::string prefix;
|
std::string prefix;
|
||||||
|
@ -154,28 +151,28 @@ int configGamepadButton (GtkButton * button, gpointer p)
|
||||||
|
|
||||||
snprintf (buf, sizeof(buf)-1, "SDL.Input.GamePad.%d.", padNo);
|
snprintf (buf, sizeof(buf)-1, "SDL.Input.GamePad.%d.", padNo);
|
||||||
prefix = buf;
|
prefix = buf;
|
||||||
DWaitButton (NULL, &GamePadConfig[padNo][x], configNo, &buttonConfigStatus );
|
DWaitButton (NULL, &GamePad[padNo].bmap[x], &buttonConfigStatus );
|
||||||
|
|
||||||
g_config->setOption (prefix + GamePadNames[x],
|
// g_config->setOption (prefix + GamePadNames[x],
|
||||||
GamePadConfig[padNo][x].ButtonNum[configNo]);
|
// GamePadConfig[padNo][x].ButtonNum[configNo]);
|
||||||
|
//
|
||||||
if (GamePadConfig[padNo][x].ButtType[0] == BUTTC_KEYBOARD)
|
// if (GamePadConfig[padNo][x].ButtType[0] == BUTTC_KEYBOARD)
|
||||||
{
|
// {
|
||||||
g_config->setOption (prefix + "DeviceType", "Keyboard");
|
// g_config->setOption (prefix + "DeviceType", "Keyboard");
|
||||||
}
|
// }
|
||||||
else if (GamePadConfig[padNo][x].ButtType[0] == BUTTC_JOYSTICK)
|
// else if (GamePadConfig[padNo][x].ButtType[0] == BUTTC_JOYSTICK)
|
||||||
{
|
// {
|
||||||
g_config->setOption (prefix + "DeviceType", "Joystick");
|
// g_config->setOption (prefix + "DeviceType", "Joystick");
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
g_config->setOption (prefix + "DeviceType", "Unknown");
|
// g_config->setOption (prefix + "DeviceType", "Unknown");
|
||||||
}
|
// }
|
||||||
g_config->setOption (prefix + "DeviceNum",
|
// g_config->setOption (prefix + "DeviceNum",
|
||||||
GamePadConfig[padNo][x].DeviceNum[configNo]);
|
// GamePadConfig[padNo][x].DeviceNum[configNo]);
|
||||||
|
|
||||||
snprintf (buf, sizeof (buf), "<tt>%s</tt>",
|
snprintf (buf, sizeof (buf), "<tt>%s</tt>",
|
||||||
ButtonName (&GamePadConfig[padNo][x], configNo));
|
ButtonName (&GamePad[padNo].bmap[x]));
|
||||||
|
|
||||||
if ( buttonMappings[x] != NULL )
|
if ( buttonMappings[x] != NULL )
|
||||||
{
|
{
|
||||||
|
@ -698,28 +695,25 @@ void updateGamepadConfig (GtkWidget * w, gpointer p)
|
||||||
int i;
|
int i;
|
||||||
char strBuf[128];
|
char strBuf[128];
|
||||||
|
|
||||||
if ( (padNoCombo == NULL) || (configNoCombo == NULL) )
|
if ( (padNoCombo == NULL) )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int padNo =
|
int padNo =
|
||||||
atoi (gtk_combo_box_text_get_active_text
|
atoi (gtk_combo_box_text_get_active_text
|
||||||
(GTK_COMBO_BOX_TEXT (padNoCombo))) - 1;
|
(GTK_COMBO_BOX_TEXT (padNoCombo))) - 1;
|
||||||
int configNo =
|
|
||||||
atoi (gtk_combo_box_text_get_active_text
|
|
||||||
(GTK_COMBO_BOX_TEXT (configNoCombo))) - 1;
|
|
||||||
|
|
||||||
for (i = 0; i < 10; i++)
|
for (i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
GtkWidget *mappedKey = buttonMappings[i];
|
GtkWidget *mappedKey = buttonMappings[i];
|
||||||
if (GamePadConfig[padNo][i].ButtType[configNo] == BUTTC_KEYBOARD)
|
if (GamePad[padNo].bmap[i].ButtType == BUTTC_KEYBOARD)
|
||||||
{
|
{
|
||||||
snprintf (strBuf, sizeof (strBuf), "<tt>%s</tt>",
|
snprintf (strBuf, sizeof (strBuf), "<tt>%s</tt>",
|
||||||
SDL_GetKeyName (GamePadConfig[padNo][i].
|
SDL_GetKeyName (GamePad[padNo].bmap[i].
|
||||||
ButtonNum[configNo]));
|
ButtonNum));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sprintf (strBuf, "<tt>%s</tt>", ButtonName( &GamePadConfig[padNo][i], configNo ) );
|
sprintf (strBuf, "<tt>%s</tt>", ButtonName( &GamePad[padNo].bmap[i] ) );
|
||||||
|
|
||||||
if ( mappedKey != NULL )
|
if ( mappedKey != NULL )
|
||||||
{
|
{
|
||||||
|
@ -734,7 +728,6 @@ static void closeGamepadConfig (GtkWidget * w, GdkEvent * e, gpointer p)
|
||||||
gtk_widget_destroy (w);
|
gtk_widget_destroy (w);
|
||||||
|
|
||||||
padNoCombo = NULL;
|
padNoCombo = NULL;
|
||||||
configNoCombo = NULL;
|
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
|
@ -799,20 +792,6 @@ void openGamepadConfig (void)
|
||||||
g_signal_connect (padNoCombo, "changed",
|
g_signal_connect (padNoCombo, "changed",
|
||||||
G_CALLBACK (updateGamepadConfig), NULL);
|
G_CALLBACK (updateGamepadConfig), NULL);
|
||||||
|
|
||||||
configNoCombo = gtk_combo_box_text_new ();
|
|
||||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (configNoCombo),
|
|
||||||
"1");
|
|
||||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (configNoCombo),
|
|
||||||
"2");
|
|
||||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (configNoCombo),
|
|
||||||
"3");
|
|
||||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (configNoCombo),
|
|
||||||
"4");
|
|
||||||
gtk_combo_box_set_active (GTK_COMBO_BOX (configNoCombo), 0);
|
|
||||||
g_signal_connect (padNoCombo, "changed",
|
|
||||||
G_CALLBACK (updateGamepadConfig), NULL);
|
|
||||||
|
|
||||||
|
|
||||||
//g_signal_connect (typeCombo, "changed", G_CALLBACK (setInputDevice),
|
//g_signal_connect (typeCombo, "changed", G_CALLBACK (setInputDevice),
|
||||||
// gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT
|
// gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT
|
||||||
// (typeCombo)));
|
// (typeCombo)));
|
||||||
|
@ -827,8 +806,6 @@ void openGamepadConfig (void)
|
||||||
|
|
||||||
gtk_box_pack_start (GTK_BOX (hboxPadNo), padNoLabel, TRUE, TRUE, 5);
|
gtk_box_pack_start (GTK_BOX (hboxPadNo), padNoLabel, TRUE, TRUE, 5);
|
||||||
gtk_box_pack_start (GTK_BOX (hboxPadNo), padNoCombo, TRUE, TRUE, 5);
|
gtk_box_pack_start (GTK_BOX (hboxPadNo), padNoCombo, TRUE, TRUE, 5);
|
||||||
//gtk_box_pack_start(GTK_BOX(hboxPadNo), configNoLabel, TRUE, TRUE, 5);
|
|
||||||
//gtk_box_pack_start(GTK_BOX(hboxPadNo), configNoCombo, TRUE, TRUE, 5);
|
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), hboxPadNo, FALSE, TRUE, 5);
|
gtk_box_pack_start (GTK_BOX (vbox), hboxPadNo, FALSE, TRUE, 5);
|
||||||
//gtk_box_pack_start_defaults(GTK_BOX(vbox), typeCombo);
|
//gtk_box_pack_start_defaults(GTK_BOX(vbox), typeCombo);
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,9 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
#include "sdl-video.h"
|
|
||||||
#include "sdl.h"
|
#include "sdl.h"
|
||||||
|
#include "sdl-video.h"
|
||||||
|
#include "sdl-joystick.h"
|
||||||
|
|
||||||
#include "../common/cheat.h"
|
#include "../common/cheat.h"
|
||||||
#include "../../movie.h"
|
#include "../../movie.h"
|
||||||
|
@ -60,6 +61,7 @@ extern bool bindSavestate, frameAdvanceLagSkip, lagCounterDisplay;
|
||||||
static int UsrInputType[NUM_INPUT_DEVICES] = { SI_GAMEPAD, SI_GAMEPAD, SI_NONE };
|
static int UsrInputType[NUM_INPUT_DEVICES] = { SI_GAMEPAD, SI_GAMEPAD, SI_NONE };
|
||||||
static int CurInputType[NUM_INPUT_DEVICES] = { SI_GAMEPAD, SI_GAMEPAD, SI_NONE };
|
static int CurInputType[NUM_INPUT_DEVICES] = { SI_GAMEPAD, SI_GAMEPAD, SI_NONE };
|
||||||
static int cspec = 0;
|
static int cspec = 0;
|
||||||
|
static int buttonConfigInProgress = 0;
|
||||||
|
|
||||||
extern int gametype;
|
extern int gametype;
|
||||||
|
|
||||||
|
@ -618,10 +620,10 @@ static void KeyboardCommands (void)
|
||||||
|
|
||||||
if (_keyonly (Hotkeys[HK_DECREASE_SPEED]))
|
if (_keyonly (Hotkeys[HK_DECREASE_SPEED]))
|
||||||
{
|
{
|
||||||
DecreaseEmulationSpeed ();
|
DecreaseEmulationSpeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_keyonly (Hotkeys[HK_INCREASE_SPEED]))
|
if (_keyonly(Hotkeys[HK_INCREASE_SPEED]))
|
||||||
{
|
{
|
||||||
IncreaseEmulationSpeed ();
|
IncreaseEmulationSpeed ();
|
||||||
}
|
}
|
||||||
|
@ -693,17 +695,10 @@ static void KeyboardCommands (void)
|
||||||
//}
|
//}
|
||||||
if (_keyonly (Hotkeys[HK_QUIT]))
|
if (_keyonly (Hotkeys[HK_QUIT]))
|
||||||
{
|
{
|
||||||
if (noGui == 1)
|
CloseGame();
|
||||||
{
|
FCEUI_Kill();
|
||||||
CloseGame ();
|
SDL_Quit();
|
||||||
}
|
exit(0);
|
||||||
else
|
|
||||||
{
|
|
||||||
CloseGame();
|
|
||||||
FCEUI_Kill();
|
|
||||||
SDL_Quit();
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#ifdef _S9XLUA_H
|
#ifdef _S9XLUA_H
|
||||||
|
@ -985,6 +980,12 @@ UpdatePhysicalInput ()
|
||||||
g_keyState[ event.key.keysym.scancode ] = (event.type == SDL_KEYDOWN) ? 1 : 0;
|
g_keyState[ event.key.keysym.scancode ] = (event.type == SDL_KEYDOWN) ? 1 : 0;
|
||||||
//checkKeyBoardState( event.key.keysym.scancode );
|
//checkKeyBoardState( event.key.keysym.scancode );
|
||||||
break;
|
break;
|
||||||
|
case SDL_JOYDEVICEADDED:
|
||||||
|
AddJoystick( event.jdevice.which );
|
||||||
|
break;
|
||||||
|
case SDL_JOYDEVICEREMOVED:
|
||||||
|
RemoveJoystick( event.jdevice.which );
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -993,8 +994,6 @@ UpdatePhysicalInput ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int bcpv, bcpj;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Begin configuring the buttons by placing the video and joystick
|
* Begin configuring the buttons by placing the video and joystick
|
||||||
* subsystems into a well-known state. Button configuration really
|
* subsystems into a well-known state. Button configuration really
|
||||||
|
@ -1002,31 +1001,11 @@ static int bcpv, bcpj;
|
||||||
*/
|
*/
|
||||||
int ButtonConfigBegin ()
|
int ButtonConfigBegin ()
|
||||||
{
|
{
|
||||||
//dont shut down video subsystem if we are using gtk to prevent the sdl window from becoming detached to GTK window
|
// initialize the joystick subsystem (if not already inited)
|
||||||
// prg318 - 10-2-2011
|
|
||||||
#ifdef _GTK
|
|
||||||
int noGui;
|
|
||||||
g_config->getOption ("SDL.NoGUI", &noGui);
|
|
||||||
if (noGui == 1)
|
|
||||||
{
|
|
||||||
//SDL_QuitSubSystem (SDL_INIT_VIDEO);
|
|
||||||
bcpv = KillVideo ();
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
// XXX soules - why are we doing this right before KillVideo()?
|
|
||||||
//SDL_QuitSubSystem (SDL_INIT_VIDEO);
|
|
||||||
|
|
||||||
// shut down the video and joystick subsystems
|
|
||||||
bcpv = KillVideo ();
|
|
||||||
#endif
|
|
||||||
//SDL_Surface *screen;
|
|
||||||
|
|
||||||
bcpj = KillJoysticks ();
|
|
||||||
|
|
||||||
// XXX soules - why did we shut this down?
|
|
||||||
// initialize the joystick subsystem
|
|
||||||
InitJoysticks ();
|
InitJoysticks ();
|
||||||
|
|
||||||
|
buttonConfigInProgress = 1;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1038,18 +1017,7 @@ int ButtonConfigBegin ()
|
||||||
void
|
void
|
||||||
ButtonConfigEnd ()
|
ButtonConfigEnd ()
|
||||||
{
|
{
|
||||||
// shutdown the joystick and video subsystems
|
buttonConfigInProgress = 0;
|
||||||
KillJoysticks ();
|
|
||||||
//SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
|
||||||
|
|
||||||
// re-initialize joystick and video subsystems if they were active before
|
|
||||||
/*if(!bcpv) {
|
|
||||||
InitVideo(GameInfo);
|
|
||||||
} */
|
|
||||||
if (!bcpj)
|
|
||||||
{
|
|
||||||
InitJoysticks ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1058,48 +1026,50 @@ ButtonConfigEnd ()
|
||||||
static int
|
static int
|
||||||
DTestButton (ButtConfig * bc)
|
DTestButton (ButtConfig * bc)
|
||||||
{
|
{
|
||||||
int x;
|
|
||||||
|
|
||||||
for (x = 0; x < bc->NumC; x++)
|
if (bc->ButtType == BUTTC_KEYBOARD)
|
||||||
{
|
{
|
||||||
if (bc->ButtType[x] == BUTTC_KEYBOARD)
|
if (g_keyState[SDL_GetScancodeFromKey (bc->ButtonNum)])
|
||||||
{
|
{
|
||||||
if (g_keyState[SDL_GetScancodeFromKey (bc->ButtonNum[x])])
|
bc->state = 1;
|
||||||
{
|
return 1;
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (bc->ButtType[x] == BUTTC_JOYSTICK)
|
else
|
||||||
|
{
|
||||||
|
bc->state = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (bc->ButtType == BUTTC_JOYSTICK)
|
||||||
|
{
|
||||||
|
if (DTestButtonJoy (bc))
|
||||||
{
|
{
|
||||||
if (DTestButtonJoy (bc))
|
return 1;
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define MK(x) {{BUTTC_KEYBOARD},{0},{MKK(x)},1}
|
#define MK(x) {BUTTC_KEYBOARD,0,MKK(x),0}
|
||||||
#define MK2(x1,x2) {{BUTTC_KEYBOARD},{0},{MKK(x1),MKK(x2)},2}
|
//#define MK2(x1,x2) {BUTTC_KEYBOARD,0,MKK(x1)}
|
||||||
#define MKZ() {{0},{0},{0},0}
|
#define MKZ() {0,0,-1,0}
|
||||||
#define GPZ() {MKZ(), MKZ(), MKZ(), MKZ()}
|
#define GPZ() {MKZ(), MKZ(), MKZ(), MKZ()}
|
||||||
|
|
||||||
ButtConfig GamePadConfig[4][10] = {
|
//ButtConfig GamePadConfig[ GAMEPAD_NUM_DEVICES ][ GAMEPAD_NUM_BUTTONS ] =
|
||||||
/* Gamepad 1 */
|
//{
|
||||||
{MK (KP_3), MK (KP_2), MK (SLASH), MK (ENTER),
|
///* Gamepad 1 */
|
||||||
MK (W), MK (Z), MK (A), MK (S), MKZ (), MKZ ()},
|
// {MK (KP_3), MK (KP_2), MK (SLASH), MK (ENTER),
|
||||||
|
// MK (w), MK (z), MK (a), MK (s), MKZ (), MKZ ()},
|
||||||
/* Gamepad 2 */
|
//
|
||||||
GPZ (),
|
// /* Gamepad 2 */
|
||||||
|
// GPZ (),
|
||||||
/* Gamepad 3 */
|
//
|
||||||
GPZ (),
|
// /* Gamepad 3 */
|
||||||
|
// GPZ (),
|
||||||
/* Gamepad 4 */
|
//
|
||||||
GPZ ()
|
// /* Gamepad 4 */
|
||||||
};
|
// GPZ ()
|
||||||
|
//};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the status of the gamepad input devices.
|
* Update the status of the gamepad input devices.
|
||||||
|
@ -1131,7 +1101,7 @@ UpdateGamepad(void)
|
||||||
// a, b, select, start, up, down, left, right
|
// a, b, select, start, up, down, left, right
|
||||||
for (x = 0; x < 8; x++)
|
for (x = 0; x < 8; x++)
|
||||||
{
|
{
|
||||||
if (DTestButton (&GamePadConfig[wg][x]))
|
if (DTestButton (&GamePad[wg].bmap[x]))
|
||||||
{
|
{
|
||||||
//printf("GamePad%i Button Hit: %i \n", wg, x );
|
//printf("GamePad%i Button Hit: %i \n", wg, x );
|
||||||
if(opposite_dirs == 0)
|
if(opposite_dirs == 0)
|
||||||
|
@ -1169,7 +1139,7 @@ UpdateGamepad(void)
|
||||||
{
|
{
|
||||||
for (x = 0; x < 2; x++)
|
for (x = 0; x < 2; x++)
|
||||||
{
|
{
|
||||||
if (DTestButton (&GamePadConfig[wg][8 + x]))
|
if (DTestButton (&GamePad[wg].bmap[8 + x]))
|
||||||
{
|
{
|
||||||
JS |= (1 << x) << (wg << 3);
|
JS |= (1 << x) << (wg << 3);
|
||||||
}
|
}
|
||||||
|
@ -1238,11 +1208,15 @@ static uint8 fkbkeys[0x48];
|
||||||
/**
|
/**
|
||||||
* Update all of the input devices required for the active game.
|
* Update all of the input devices required for the active game.
|
||||||
*/
|
*/
|
||||||
void FCEUD_UpdateInput ()
|
void FCEUD_UpdateInput(void)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
int t = 0;
|
int t = 0;
|
||||||
|
|
||||||
|
if ( buttonConfigInProgress )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
UpdatePhysicalInput ();
|
UpdatePhysicalInput ();
|
||||||
KeyboardCommands ();
|
KeyboardCommands ();
|
||||||
|
|
||||||
|
@ -1600,36 +1574,42 @@ UpdateFTrainer ()
|
||||||
* @param bc the NES gamepad's button config
|
* @param bc the NES gamepad's button config
|
||||||
* @param which the index of the button
|
* @param which the index of the button
|
||||||
*/
|
*/
|
||||||
const char * ButtonName (const ButtConfig * bc, int which)
|
const char * ButtonName (const ButtConfig * bc)
|
||||||
{
|
{
|
||||||
static char name[256];
|
static char name[256];
|
||||||
|
|
||||||
switch (bc->ButtType[which])
|
name[0] = 0;
|
||||||
|
|
||||||
|
if (bc->ButtonNum == -1)
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
switch (bc->ButtType)
|
||||||
{
|
{
|
||||||
case BUTTC_KEYBOARD:
|
case BUTTC_KEYBOARD:
|
||||||
return SDL_GetKeyName (bc->ButtonNum[which]);
|
return SDL_GetKeyName (bc->ButtonNum);
|
||||||
break;
|
break;
|
||||||
case BUTTC_JOYSTICK:
|
case BUTTC_JOYSTICK:
|
||||||
{
|
{
|
||||||
int joyNum, inputNum;
|
int joyNum, inputNum;
|
||||||
const char *inputType, *inputDirection;
|
const char *inputType, *inputDirection;
|
||||||
|
|
||||||
joyNum = bc->DeviceNum[which];
|
joyNum = bc->DeviceNum;
|
||||||
|
|
||||||
if (bc->ButtonNum[which] & 0x8000)
|
if (bc->ButtonNum & 0x8000)
|
||||||
{
|
{
|
||||||
inputType = "Axis";
|
inputType = "Axis";
|
||||||
inputNum = bc->ButtonNum[which] & 0x3FFF;
|
inputNum = bc->ButtonNum & 0x3FFF;
|
||||||
inputDirection = bc->ButtonNum[which] & 0x4000 ? "-" : "+";
|
inputDirection = bc->ButtonNum & 0x4000 ? "-" : "+";
|
||||||
}
|
}
|
||||||
else if (bc->ButtonNum[which] & 0x2000)
|
else if (bc->ButtonNum & 0x2000)
|
||||||
{
|
{
|
||||||
int inputValue;
|
int inputValue;
|
||||||
char direction[128] = "";
|
char direction[128] = "";
|
||||||
|
|
||||||
inputType = "Hat";
|
inputType = "Hat";
|
||||||
inputNum = (bc->ButtonNum[which] >> 8) & 0x1F;
|
inputNum = (bc->ButtonNum >> 8) & 0x1F;
|
||||||
inputValue = bc->ButtonNum[which] & 0xF;
|
inputValue = bc->ButtonNum & 0xF;
|
||||||
|
|
||||||
if (inputValue & SDL_HAT_UP)
|
if (inputValue & SDL_HAT_UP)
|
||||||
strncat (direction, "Up ", sizeof (direction)-1);
|
strncat (direction, "Up ", sizeof (direction)-1);
|
||||||
|
@ -1648,7 +1628,7 @@ const char * ButtonName (const ButtConfig * bc, int which)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
inputType = "Button";
|
inputType = "Button";
|
||||||
inputNum = bc->ButtonNum[which];
|
inputNum = bc->ButtonNum;
|
||||||
inputDirection = "";
|
inputDirection = "";
|
||||||
}
|
}
|
||||||
sprintf( name, "js%i:%s%i%s", joyNum, inputType, inputNum, inputDirection );
|
sprintf( name, "js%i:%s%i%s", joyNum, inputType, inputNum, inputDirection );
|
||||||
|
@ -1663,11 +1643,12 @@ const char * ButtonName (const ButtConfig * bc, int which)
|
||||||
* Waits for a button input and returns the information as to which
|
* Waits for a button input and returns the information as to which
|
||||||
* button was pressed. Used in button configuration.
|
* button was pressed. Used in button configuration.
|
||||||
*/
|
*/
|
||||||
int DWaitButton (const uint8 * text, ButtConfig * bc, int wb, int *buttonConfigStatus )
|
int DWaitButton (const uint8_t * text, ButtConfig * bc, int *buttonConfigStatus )
|
||||||
{
|
{
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
static int32 LastAx[64][64];
|
static int32 LastAx[64][64];
|
||||||
int x, y;
|
int x, y;
|
||||||
|
int timeout_ms = 10000;
|
||||||
|
|
||||||
if (text)
|
if (text)
|
||||||
{
|
{
|
||||||
|
@ -1686,9 +1667,24 @@ int DWaitButton (const uint8 * text, ButtConfig * bc, int wb, int *buttonConfigS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Purge all pending events, so that this next button press
|
||||||
|
// will be the one we want.
|
||||||
|
while (SDL_PollEvent (&event))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
int done = 0;
|
int done = 0;
|
||||||
|
|
||||||
|
usleep(10000);
|
||||||
|
timeout_ms -= 10;
|
||||||
|
|
||||||
|
if ( timeout_ms <= 0 )
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
#ifdef _GTK
|
#ifdef _GTK
|
||||||
while (gtk_events_pending ())
|
while (gtk_events_pending ())
|
||||||
gtk_main_iteration_do (FALSE);
|
gtk_main_iteration_do (FALSE);
|
||||||
|
@ -1699,23 +1695,24 @@ int DWaitButton (const uint8 * text, ButtConfig * bc, int wb, int *buttonConfigS
|
||||||
switch (event.type)
|
switch (event.type)
|
||||||
{
|
{
|
||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
bc->ButtType[wb] = BUTTC_KEYBOARD;
|
//printf("SDL KeyDown:%i \n", event.key.keysym.sym );
|
||||||
bc->DeviceNum[wb] = 0;
|
bc->ButtType = BUTTC_KEYBOARD;
|
||||||
bc->ButtonNum[wb] = event.key.keysym.sym;
|
bc->DeviceNum = 0;
|
||||||
|
bc->ButtonNum = event.key.keysym.sym;
|
||||||
return (1);
|
return (1);
|
||||||
case SDL_JOYBUTTONDOWN:
|
case SDL_JOYBUTTONDOWN:
|
||||||
bc->ButtType[wb] = BUTTC_JOYSTICK;
|
bc->ButtType = BUTTC_JOYSTICK;
|
||||||
bc->DeviceNum[wb] = event.jbutton.which;
|
bc->DeviceNum = event.jbutton.which;
|
||||||
bc->ButtonNum[wb] = event.jbutton.button;
|
bc->ButtonNum = event.jbutton.button;
|
||||||
return (1);
|
return (1);
|
||||||
case SDL_JOYHATMOTION:
|
case SDL_JOYHATMOTION:
|
||||||
if (event.jhat.value == SDL_HAT_CENTERED)
|
if (event.jhat.value == SDL_HAT_CENTERED)
|
||||||
done--;
|
done--;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bc->ButtType[wb] = BUTTC_JOYSTICK;
|
bc->ButtType = BUTTC_JOYSTICK;
|
||||||
bc->DeviceNum[wb] = event.jhat.which;
|
bc->DeviceNum = event.jhat.which;
|
||||||
bc->ButtonNum[wb] =
|
bc->ButtonNum =
|
||||||
(0x2000 | ((event.jhat.hat & 0x1F) << 8) | event.
|
(0x2000 | ((event.jhat.hat & 0x1F) << 8) | event.
|
||||||
jhat.value);
|
jhat.value);
|
||||||
return (1);
|
return (1);
|
||||||
|
@ -1737,9 +1734,9 @@ int DWaitButton (const uint8 * text, ButtConfig * bc, int wb, int *buttonConfigS
|
||||||
(LastAx[event.jaxis.which][event.jaxis.axis] -
|
(LastAx[event.jaxis.which][event.jaxis.axis] -
|
||||||
event.jaxis.value) >= 8192)
|
event.jaxis.value) >= 8192)
|
||||||
{
|
{
|
||||||
bc->ButtType[wb] = BUTTC_JOYSTICK;
|
bc->ButtType = BUTTC_JOYSTICK;
|
||||||
bc->DeviceNum[wb] = event.jaxis.which;
|
bc->DeviceNum = event.jaxis.which;
|
||||||
bc->ButtonNum[wb] = (0x8000 | event.jaxis.axis |
|
bc->ButtonNum = (0x8000 | event.jaxis.axis |
|
||||||
((event.jaxis.value < 0)
|
((event.jaxis.value < 0)
|
||||||
? 0x4000 : 0));
|
? 0x4000 : 0));
|
||||||
return (1);
|
return (1);
|
||||||
|
@ -1776,213 +1773,206 @@ int DWaitButton (const uint8 * text, ButtConfig * bc, int wb, int *buttonConfigS
|
||||||
* used as input for the specified button, thus allowing up to four
|
* used as input for the specified button, thus allowing up to four
|
||||||
* possible settings for each input button.
|
* possible settings for each input button.
|
||||||
*/
|
*/
|
||||||
void
|
// void
|
||||||
ConfigButton (char *text, ButtConfig * bc)
|
//ConfigButton (char *text, ButtConfig * bc)
|
||||||
{
|
//{
|
||||||
uint8 buf[256];
|
// uint8 buf[256];
|
||||||
int wc;
|
// int wc;
|
||||||
|
//
|
||||||
for (wc = 0; wc < MAXBUTTCONFIG; wc++)
|
// for (wc = 0; wc < MAXBUTTCONFIG; wc++)
|
||||||
{
|
// {
|
||||||
sprintf ((char *) buf, "%s (%d)", text, wc + 1);
|
// sprintf ((char *) buf, "%s (%d)", text, wc + 1);
|
||||||
DWaitButton (buf, bc, wc, NULL);
|
// DWaitButton (buf, bc, wc, NULL);
|
||||||
|
//
|
||||||
if (wc &&
|
// if (wc &&
|
||||||
bc->ButtType[wc] == bc->ButtType[wc - 1] &&
|
// bc->ButtType[wc] == bc->ButtType[wc - 1] &&
|
||||||
bc->DeviceNum[wc] == bc->DeviceNum[wc - 1] &&
|
// bc->DeviceNum[wc] == bc->DeviceNum[wc - 1] &&
|
||||||
bc->ButtonNum[wc] == bc->ButtonNum[wc - 1])
|
// bc->ButtonNum[wc] == bc->ButtonNum[wc - 1])
|
||||||
{
|
// {
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
bc->NumC = wc;
|
//}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the button configuration for a specified device.
|
* Update the button configuration for a specified device.
|
||||||
*/
|
*/
|
||||||
extern Config *g_config;
|
extern Config *g_config;
|
||||||
|
|
||||||
void ConfigDevice (int which, int arg)
|
//void ConfigDevice (int which, int arg)
|
||||||
{
|
//{
|
||||||
char buf[256];
|
// char buf[256];
|
||||||
int x;
|
// int x;
|
||||||
std::string prefix;
|
// std::string prefix;
|
||||||
const char *str[10] =
|
// const char *str[10] =
|
||||||
{ "A", "B", "SELECT", "START", "UP", "DOWN", "LEFT", "RIGHT", "Rapid A",
|
// { "A", "B", "SELECT", "START", "UP", "DOWN", "LEFT", "RIGHT", "Rapid A",
|
||||||
"Rapid B"
|
// "Rapid B"
|
||||||
};
|
// };
|
||||||
|
//
|
||||||
// XXX soules - set the configuration options so that later calls
|
// // XXX soules - set the configuration options so that later calls
|
||||||
// don't override these. This is a temp hack until I
|
// // don't override these. This is a temp hack until I
|
||||||
// can clean up this file.
|
// // can clean up this file.
|
||||||
|
//
|
||||||
ButtonConfigBegin ();
|
// ButtonConfigBegin ();
|
||||||
switch (which)
|
// switch (which)
|
||||||
{
|
// {
|
||||||
case FCFGD_QUIZKING:
|
// case FCFGD_QUIZKING:
|
||||||
prefix = "SDL.Input.QuizKing.";
|
// prefix = "SDL.Input.QuizKing.";
|
||||||
for (x = 0; x < 6; x++)
|
// for (x = 0; x < 6; x++)
|
||||||
{
|
// {
|
||||||
sprintf (buf, "Quiz King Buzzer #%d", x + 1);
|
// sprintf (buf, "Quiz King Buzzer #%d", x + 1);
|
||||||
ConfigButton (buf, &QuizKingButtons[x]);
|
// ConfigButton (buf, &QuizKingButtons[x]);
|
||||||
|
//
|
||||||
g_config->setOption (prefix + QuizKingNames[x],
|
// g_config->setOption (prefix + QuizKingNames[x],
|
||||||
QuizKingButtons[x].ButtonNum[0]);
|
// QuizKingButtons[x].ButtonNum);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (QuizKingButtons[0].ButtType[0] == BUTTC_KEYBOARD)
|
// if (QuizKingButtons[0].ButtType == BUTTC_KEYBOARD)
|
||||||
{
|
// {
|
||||||
g_config->setOption (prefix + "DeviceType", "Keyboard");
|
// g_config->setOption (prefix + "DeviceType", "Keyboard");
|
||||||
}
|
// }
|
||||||
else if (QuizKingButtons[0].ButtType[0] == BUTTC_JOYSTICK)
|
// else if (QuizKingButtons[0].ButtType == BUTTC_JOYSTICK)
|
||||||
{
|
// {
|
||||||
g_config->setOption (prefix + "DeviceType", "Joystick");
|
// g_config->setOption (prefix + "DeviceType", "Joystick");
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
g_config->setOption (prefix + "DeviceType", "Unknown");
|
// g_config->setOption (prefix + "DeviceType", "Unknown");
|
||||||
}
|
// }
|
||||||
g_config->setOption (prefix + "DeviceNum",
|
// g_config->setOption (prefix + "DeviceNum",
|
||||||
QuizKingButtons[0].DeviceNum[0]);
|
// QuizKingButtons[0].DeviceNum);
|
||||||
break;
|
// break;
|
||||||
case FCFGD_HYPERSHOT:
|
// case FCFGD_HYPERSHOT:
|
||||||
prefix = "SDL.Input.HyperShot.";
|
// prefix = "SDL.Input.HyperShot.";
|
||||||
for (x = 0; x < 4; x++)
|
// for (x = 0; x < 4; x++)
|
||||||
{
|
// {
|
||||||
sprintf (buf, "Hyper Shot %d: %s",
|
// sprintf (buf, "Hyper Shot %d: %s",
|
||||||
((x & 2) >> 1) + 1, (x & 1) ? "JUMP" : "RUN");
|
// ((x & 2) >> 1) + 1, (x & 1) ? "JUMP" : "RUN");
|
||||||
ConfigButton (buf, &HyperShotButtons[x]);
|
// ConfigButton (buf, &HyperShotButtons[x]);
|
||||||
|
//
|
||||||
g_config->setOption (prefix + HyperShotNames[x],
|
// g_config->setOption (prefix + HyperShotNames[x],
|
||||||
HyperShotButtons[x].ButtonNum[0]);
|
// HyperShotButtons[x].ButtonNum);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (HyperShotButtons[0].ButtType[0] == BUTTC_KEYBOARD)
|
// if (HyperShotButtons[0].ButtType == BUTTC_KEYBOARD)
|
||||||
{
|
// {
|
||||||
g_config->setOption (prefix + "DeviceType", "Keyboard");
|
// g_config->setOption (prefix + "DeviceType", "Keyboard");
|
||||||
}
|
// }
|
||||||
else if (HyperShotButtons[0].ButtType[0] == BUTTC_JOYSTICK)
|
// else if (HyperShotButtons[0].ButtType == BUTTC_JOYSTICK)
|
||||||
{
|
// {
|
||||||
g_config->setOption (prefix + "DeviceType", "Joystick");
|
// g_config->setOption (prefix + "DeviceType", "Joystick");
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
g_config->setOption (prefix + "DeviceType", "Unknown");
|
// g_config->setOption (prefix + "DeviceType", "Unknown");
|
||||||
}
|
// }
|
||||||
g_config->setOption (prefix + "DeviceNum",
|
// g_config->setOption (prefix + "DeviceNum",
|
||||||
HyperShotButtons[0].DeviceNum[0]);
|
// HyperShotButtons[0].DeviceNum);
|
||||||
break;
|
// break;
|
||||||
case FCFGD_POWERPAD:
|
// case FCFGD_POWERPAD:
|
||||||
snprintf (buf, 256, "SDL.Input.PowerPad.%d", (arg & 1));
|
// snprintf (buf, 256, "SDL.Input.PowerPad.%d", (arg & 1));
|
||||||
prefix = buf;
|
// prefix = buf;
|
||||||
for (x = 0; x < 12; x++)
|
// for (x = 0; x < 12; x++)
|
||||||
{
|
// {
|
||||||
sprintf (buf, "PowerPad %d: %d", (arg & 1) + 1, x + 11);
|
// sprintf (buf, "PowerPad %d: %d", (arg & 1) + 1, x + 11);
|
||||||
ConfigButton (buf, &powerpadsc[arg & 1][x]);
|
// ConfigButton (buf, &powerpadsc[arg & 1][x]);
|
||||||
|
//
|
||||||
g_config->setOption (prefix + PowerPadNames[x],
|
// g_config->setOption (prefix + PowerPadNames[x],
|
||||||
powerpadsc[arg & 1][x].ButtonNum[0]);
|
// powerpadsc[arg & 1][x].ButtonNum);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (powerpadsc[arg & 1][0].ButtType[0] == BUTTC_KEYBOARD)
|
// if (powerpadsc[arg & 1][0].ButtType == BUTTC_KEYBOARD)
|
||||||
{
|
// {
|
||||||
g_config->setOption (prefix + "DeviceType", "Keyboard");
|
// g_config->setOption (prefix + "DeviceType", "Keyboard");
|
||||||
}
|
// }
|
||||||
else if (powerpadsc[arg & 1][0].ButtType[0] == BUTTC_JOYSTICK)
|
// else if (powerpadsc[arg & 1][0].ButtType == BUTTC_JOYSTICK)
|
||||||
{
|
// {
|
||||||
g_config->setOption (prefix + "DeviceType", "Joystick");
|
// g_config->setOption (prefix + "DeviceType", "Joystick");
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
g_config->setOption (prefix + "DeviceType", "Unknown");
|
// g_config->setOption (prefix + "DeviceType", "Unknown");
|
||||||
}
|
// }
|
||||||
g_config->setOption (prefix + "DeviceNum",
|
// g_config->setOption (prefix + "DeviceNum",
|
||||||
powerpadsc[arg & 1][0].DeviceNum[0]);
|
// powerpadsc[arg & 1][0].DeviceNum);
|
||||||
break;
|
// break;
|
||||||
|
//
|
||||||
case FCFGD_GAMEPAD:
|
// case FCFGD_GAMEPAD:
|
||||||
snprintf (buf, 256, "SDL.Input.GamePad.%d", arg);
|
// snprintf (buf, 256, "SDL.Input.GamePad.%d", arg);
|
||||||
prefix = buf;
|
// prefix = buf;
|
||||||
for (x = 0; x < 10; x++)
|
// for (x = 0; x < 10; x++)
|
||||||
{
|
// {
|
||||||
sprintf (buf, "GamePad #%d: %s", arg + 1, str[x]);
|
// sprintf (buf, "GamePad #%d: %s", arg + 1, str[x]);
|
||||||
ConfigButton (buf, &GamePadConfig[arg][x]);
|
// ConfigButton (buf, &GamePadConfig[arg][x]);
|
||||||
|
//
|
||||||
g_config->setOption (prefix + GamePadNames[x],
|
// g_config->setOption (prefix + GamePadNames[x],
|
||||||
GamePadConfig[arg][x].ButtonNum[0]);
|
// GamePadConfig[arg][x].ButtonNum);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (GamePadConfig[arg][0].ButtType[0] == BUTTC_KEYBOARD)
|
// if (GamePadConfig[arg][0].ButtType == BUTTC_KEYBOARD)
|
||||||
{
|
// {
|
||||||
g_config->setOption (prefix + "DeviceType", "Keyboard");
|
// g_config->setOption (prefix + "DeviceType", "Keyboard");
|
||||||
}
|
// }
|
||||||
else if (GamePadConfig[arg][0].ButtType[0] == BUTTC_JOYSTICK)
|
// else if (GamePadConfig[arg][0].ButtType == BUTTC_JOYSTICK)
|
||||||
{
|
// {
|
||||||
g_config->setOption (prefix + "DeviceType", "Joystick");
|
// g_config->setOption (prefix + "DeviceType", "Joystick");
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
g_config->setOption (prefix + "DeviceType", "Unknown");
|
// g_config->setOption (prefix + "DeviceType", "Unknown");
|
||||||
}
|
// }
|
||||||
g_config->setOption (prefix + "DeviceNum",
|
// g_config->setOption (prefix + "DeviceNum",
|
||||||
GamePadConfig[arg][0].DeviceNum[0]);
|
// GamePadConfig[arg][0].DeviceNum);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
ButtonConfigEnd ();
|
// ButtonConfigEnd ();
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the button configuration for a device, specified by a text string.
|
* Update the button configuration for a device, specified by a text string.
|
||||||
*/
|
*/
|
||||||
void InputCfg (const std::string & text)
|
//void InputCfg (const std::string & text)
|
||||||
{
|
//{
|
||||||
#ifdef _GTK
|
//
|
||||||
// enable noGui to prevent the gtk x11 hack from executing
|
// if (noGui)
|
||||||
noGui = 1;
|
// {
|
||||||
// this is only called at the begininng of execution; make sure the video subsystem is initialized
|
// if (text.find ("gamepad") != std::string::npos)
|
||||||
InitVideo (GameInfo);
|
// {
|
||||||
#endif
|
// int device = (text[strlen ("gamepad")] - '1');
|
||||||
|
// if (device < 0 || device > 3)
|
||||||
if (noGui)
|
// {
|
||||||
{
|
// FCEUD_PrintError
|
||||||
if (text.find ("gamepad") != std::string::npos)
|
// ("Invalid gamepad device specified; must be one of gamepad1 through gamepad4");
|
||||||
{
|
// exit (-1);
|
||||||
int device = (text[strlen ("gamepad")] - '1');
|
// }
|
||||||
if (device < 0 || device > 3)
|
// ConfigDevice (FCFGD_GAMEPAD, device);
|
||||||
{
|
// }
|
||||||
FCEUD_PrintError
|
// else if (text.find ("powerpad") != std::string::npos)
|
||||||
("Invalid gamepad device specified; must be one of gamepad1 through gamepad4");
|
// {
|
||||||
exit (-1);
|
// int device = (text[strlen ("powerpad")] - '1');
|
||||||
}
|
// if (device < 0 || device > 1)
|
||||||
ConfigDevice (FCFGD_GAMEPAD, device);
|
// {
|
||||||
}
|
// FCEUD_PrintError
|
||||||
else if (text.find ("powerpad") != std::string::npos)
|
// ("Invalid powerpad device specified; must be powerpad1 or powerpad2");
|
||||||
{
|
// exit (-1);
|
||||||
int device = (text[strlen ("powerpad")] - '1');
|
// }
|
||||||
if (device < 0 || device > 1)
|
// ConfigDevice (FCFGD_POWERPAD, device);
|
||||||
{
|
// }
|
||||||
FCEUD_PrintError
|
// else if (text.find ("hypershot") != std::string::npos)
|
||||||
("Invalid powerpad device specified; must be powerpad1 or powerpad2");
|
// {
|
||||||
exit (-1);
|
// ConfigDevice (FCFGD_HYPERSHOT, 0);
|
||||||
}
|
// }
|
||||||
ConfigDevice (FCFGD_POWERPAD, device);
|
// else if (text.find ("quizking") != std::string::npos)
|
||||||
}
|
// {
|
||||||
else if (text.find ("hypershot") != std::string::npos)
|
// ConfigDevice (FCFGD_QUIZKING, 0);
|
||||||
{
|
// }
|
||||||
ConfigDevice (FCFGD_HYPERSHOT, 0);
|
// }
|
||||||
}
|
// else
|
||||||
else if (text.find ("quizking") != std::string::npos)
|
// printf ("Please run \"fceux --nogui\" before using --inputcfg\n");
|
||||||
{
|
//
|
||||||
ConfigDevice (FCFGD_QUIZKING, 0);
|
//}
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
printf ("Please run \"fceux --nogui\" before using --inputcfg\n");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1994,7 +1984,9 @@ void InputCfg (const std::string & text)
|
||||||
UpdateInput (Config * config)
|
UpdateInput (Config * config)
|
||||||
{
|
{
|
||||||
char buf[64];
|
char buf[64];
|
||||||
std::string device, prefix;
|
std::string device, prefix, guid, mapping;
|
||||||
|
|
||||||
|
InitJoysticks();
|
||||||
|
|
||||||
for (unsigned int i = 0; i < 3; i++)
|
for (unsigned int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
|
@ -2087,37 +2079,18 @@ UpdateInput (Config * config)
|
||||||
snprintf (buf, sizeof(buf)-1, "SDL.Input.GamePad.%u.", i);
|
snprintf (buf, sizeof(buf)-1, "SDL.Input.GamePad.%u.", i);
|
||||||
prefix = buf;
|
prefix = buf;
|
||||||
|
|
||||||
config->getOption (prefix + "DeviceType", &device);
|
config->getOption (prefix + "DeviceType", &device );
|
||||||
if (device.find ("Keyboard") != std::string::npos)
|
config->getOption (prefix + "DeviceGUID", &guid );
|
||||||
{
|
config->getOption (prefix + "Profile" , &mapping);
|
||||||
type = BUTTC_KEYBOARD;
|
|
||||||
}
|
|
||||||
else if (device.find ("Joystick") != std::string::npos)
|
|
||||||
{
|
|
||||||
type = BUTTC_JOYSTICK;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
type = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
config->getOption (prefix + "DeviceNum", &devnum);
|
GamePad[i].init( i, guid.c_str(), mapping.c_str() );
|
||||||
for (unsigned int j = 0; j < GAMEPAD_NUM_BUTTONS; j++)
|
|
||||||
{
|
|
||||||
config->getOption (prefix + GamePadNames[j], &button);
|
|
||||||
|
|
||||||
GamePadConfig[i][j].ButtType[0] = type;
|
|
||||||
GamePadConfig[i][j].DeviceNum[0] = devnum;
|
|
||||||
GamePadConfig[i][j].ButtonNum[0] = button;
|
|
||||||
GamePadConfig[i][j].NumC = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PowerPad 0 - 1
|
// PowerPad 0 - 1
|
||||||
for (unsigned int i = 0; i < POWERPAD_NUM_DEVICES; i++)
|
for (unsigned int i = 0; i < POWERPAD_NUM_DEVICES; i++)
|
||||||
{
|
{
|
||||||
char buf[64];
|
char buf[64];
|
||||||
snprintf (buf, 32, "SDL.Input.PowerPad.%u.", i);
|
snprintf (buf, sizeof(buf)-1, "SDL.Input.PowerPad.%u.", i);
|
||||||
prefix = buf;
|
prefix = buf;
|
||||||
|
|
||||||
config->getOption (prefix + "DeviceType", &device);
|
config->getOption (prefix + "DeviceType", &device);
|
||||||
|
@ -2139,10 +2112,9 @@ UpdateInput (Config * config)
|
||||||
{
|
{
|
||||||
config->getOption (prefix + PowerPadNames[j], &button);
|
config->getOption (prefix + PowerPadNames[j], &button);
|
||||||
|
|
||||||
powerpadsc[i][j].ButtType[0] = type;
|
powerpadsc[i][j].ButtType = type;
|
||||||
powerpadsc[i][j].DeviceNum[0] = devnum;
|
powerpadsc[i][j].DeviceNum = devnum;
|
||||||
powerpadsc[i][j].ButtonNum[0] = button;
|
powerpadsc[i][j].ButtonNum = button;
|
||||||
powerpadsc[i][j].NumC = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2166,10 +2138,9 @@ UpdateInput (Config * config)
|
||||||
{
|
{
|
||||||
config->getOption (prefix + QuizKingNames[j], &button);
|
config->getOption (prefix + QuizKingNames[j], &button);
|
||||||
|
|
||||||
QuizKingButtons[j].ButtType[0] = type;
|
QuizKingButtons[j].ButtType = type;
|
||||||
QuizKingButtons[j].DeviceNum[0] = devnum;
|
QuizKingButtons[j].DeviceNum = devnum;
|
||||||
QuizKingButtons[j].ButtonNum[0] = button;
|
QuizKingButtons[j].ButtonNum = button;
|
||||||
QuizKingButtons[j].NumC = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// HyperShot
|
// HyperShot
|
||||||
|
@ -2192,10 +2163,9 @@ UpdateInput (Config * config)
|
||||||
{
|
{
|
||||||
config->getOption (prefix + HyperShotNames[j], &button);
|
config->getOption (prefix + HyperShotNames[j], &button);
|
||||||
|
|
||||||
HyperShotButtons[j].ButtType[0] = type;
|
HyperShotButtons[j].ButtType = type;
|
||||||
HyperShotButtons[j].DeviceNum[0] = devnum;
|
HyperShotButtons[j].DeviceNum = devnum;
|
||||||
HyperShotButtons[j].ButtonNum[0] = button;
|
HyperShotButtons[j].ButtonNum = button;
|
||||||
HyperShotButtons[j].NumC = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mahjong
|
// Mahjong
|
||||||
|
@ -2218,10 +2188,9 @@ UpdateInput (Config * config)
|
||||||
{
|
{
|
||||||
config->getOption (prefix + MahjongNames[j], &button);
|
config->getOption (prefix + MahjongNames[j], &button);
|
||||||
|
|
||||||
MahjongButtons[j].ButtType[0] = type;
|
MahjongButtons[j].ButtType = type;
|
||||||
MahjongButtons[j].DeviceNum[0] = devnum;
|
MahjongButtons[j].DeviceNum = devnum;
|
||||||
MahjongButtons[j].ButtonNum[0] = button;
|
MahjongButtons[j].ButtonNum = button;
|
||||||
MahjongButtons[j].NumC = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TopRider
|
// TopRider
|
||||||
|
@ -2244,10 +2213,9 @@ UpdateInput (Config * config)
|
||||||
{
|
{
|
||||||
config->getOption (prefix + TopRiderNames[j], &button);
|
config->getOption (prefix + TopRiderNames[j], &button);
|
||||||
|
|
||||||
TopRiderButtons[j].ButtType[0] = type;
|
TopRiderButtons[j].ButtType = type;
|
||||||
TopRiderButtons[j].DeviceNum[0] = devnum;
|
TopRiderButtons[j].DeviceNum = devnum;
|
||||||
TopRiderButtons[j].ButtonNum[0] = button;
|
TopRiderButtons[j].ButtonNum = button;
|
||||||
TopRiderButtons[j].NumC = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FTrainer
|
// FTrainer
|
||||||
|
@ -2270,10 +2238,9 @@ UpdateInput (Config * config)
|
||||||
{
|
{
|
||||||
config->getOption (prefix + FTrainerNames[j], &button);
|
config->getOption (prefix + FTrainerNames[j], &button);
|
||||||
|
|
||||||
FTrainerButtons[j].ButtType[0] = type;
|
FTrainerButtons[j].ButtType = type;
|
||||||
FTrainerButtons[j].DeviceNum[0] = devnum;
|
FTrainerButtons[j].DeviceNum = devnum;
|
||||||
FTrainerButtons[j].ButtonNum[0] = button;
|
FTrainerButtons[j].ButtonNum = button;
|
||||||
FTrainerButtons[j].NumC = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FamilyKeyBoard
|
// FamilyKeyBoard
|
||||||
|
@ -2296,10 +2263,9 @@ UpdateInput (Config * config)
|
||||||
{
|
{
|
||||||
config->getOption (prefix + FamilyKeyBoardNames[j], &button);
|
config->getOption (prefix + FamilyKeyBoardNames[j], &button);
|
||||||
|
|
||||||
fkbmap[j].ButtType[0] = type;
|
fkbmap[j].ButtType = type;
|
||||||
fkbmap[j].DeviceNum[0] = devnum;
|
fkbmap[j].DeviceNum = devnum;
|
||||||
fkbmap[j].ButtonNum[0] = button;
|
fkbmap[j].ButtonNum = button;
|
||||||
fkbmap[j].NumC = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2311,11 +2277,11 @@ const char *GamePadNames[GAMEPAD_NUM_BUTTONS] = { "A", "B", "Select", "Start",
|
||||||
const char *DefaultGamePadDevice[GAMEPAD_NUM_DEVICES] =
|
const char *DefaultGamePadDevice[GAMEPAD_NUM_DEVICES] =
|
||||||
{ "Keyboard", "None", "None", "None" };
|
{ "Keyboard", "None", "None", "None" };
|
||||||
const int DefaultGamePad[GAMEPAD_NUM_DEVICES][GAMEPAD_NUM_BUTTONS] =
|
const int DefaultGamePad[GAMEPAD_NUM_DEVICES][GAMEPAD_NUM_BUTTONS] =
|
||||||
{ {SDLK_F, SDLK_D, SDLK_S, SDLK_RETURN,
|
{ {SDLK_f, SDLK_d, SDLK_s, SDLK_RETURN,
|
||||||
SDLK_UP, SDLK_DOWN, SDLK_LEFT, SDLK_RIGHT, 0, 0},
|
SDLK_UP, SDLK_DOWN, SDLK_LEFT, SDLK_RIGHT, -1, -1},
|
||||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}
|
||||||
};
|
};
|
||||||
|
|
||||||
// PowerPad defaults
|
// PowerPad defaults
|
||||||
|
|
|
@ -1,34 +1,39 @@
|
||||||
#ifndef _aosdfjk02fmasf
|
#ifndef _aosdfjk02fmasf
|
||||||
#define _aosdfjk02fmasf
|
#define _aosdfjk02fmasf
|
||||||
|
|
||||||
#include "../common/configSys.h"
|
#include <stdint.h>
|
||||||
|
|
||||||
#define MAXBUTTCONFIG 4
|
#include "common/configSys.h"
|
||||||
typedef struct {
|
|
||||||
uint8 ButtType[MAXBUTTCONFIG];
|
//#define MAXBUTTCONFIG 4
|
||||||
uint8 DeviceNum[MAXBUTTCONFIG];
|
|
||||||
//uint16 ButtonNum[MAXBUTTCONFIG];
|
enum {
|
||||||
int ButtonNum[MAXBUTTCONFIG];
|
BUTTC_KEYBOARD = 0,
|
||||||
uint32 NumC;
|
BUTTC_JOYSTICK = 1,
|
||||||
|
BUTTC_MOUSE = 2
|
||||||
|
};
|
||||||
|
struct ButtConfig
|
||||||
|
{
|
||||||
|
int ButtType; //[MAXBUTTCONFIG];
|
||||||
|
int DeviceNum; //[MAXBUTTCONFIG];
|
||||||
|
int ButtonNum; //[MAXBUTTCONFIG];
|
||||||
|
int state;
|
||||||
|
//uint32_t NumC;
|
||||||
//uint64 DeviceID[MAXBUTTCONFIG]; /* TODO */
|
//uint64 DeviceID[MAXBUTTCONFIG]; /* TODO */
|
||||||
} ButtConfig;
|
};
|
||||||
|
|
||||||
|
|
||||||
extern int NoWaiting;
|
extern int NoWaiting;
|
||||||
extern CFGSTRUCT InputConfig[];
|
extern CFGSTRUCT InputConfig[];
|
||||||
extern ARGPSTRUCT InputArgs[];
|
extern ARGPSTRUCT InputArgs[];
|
||||||
extern int Hotkeys[];
|
extern int Hotkeys[];
|
||||||
void ParseGIInput(FCEUGI *GI);
|
void ParseGIInput(FCEUGI *GI);
|
||||||
void setHotKeys();
|
void setHotKeys(void);
|
||||||
int getKeyState( int k );
|
int getKeyState( int k );
|
||||||
int ButtonConfigBegin();
|
int ButtonConfigBegin();
|
||||||
void ButtonConfigEnd();
|
void ButtonConfigEnd();
|
||||||
void ConfigButton(char *text, ButtConfig *bc);
|
void ConfigButton(char *text, ButtConfig *bc);
|
||||||
int DWaitButton(const uint8 *text, ButtConfig *bc, int wb, int *buttonConfigStatus = NULL);
|
int DWaitButton(const uint8_t *text, ButtConfig *bc, int *buttonConfigStatus = NULL);
|
||||||
|
|
||||||
#define BUTTC_KEYBOARD 0x00
|
|
||||||
#define BUTTC_JOYSTICK 0x01
|
|
||||||
#define BUTTC_MOUSE 0x02
|
|
||||||
|
|
||||||
#define FCFGD_GAMEPAD 1
|
#define FCFGD_GAMEPAD 1
|
||||||
#define FCFGD_POWERPAD 2
|
#define FCFGD_POWERPAD 2
|
||||||
|
@ -41,7 +46,7 @@ void InitInputInterface(void);
|
||||||
void InputUserActiveFix(void);
|
void InputUserActiveFix(void);
|
||||||
|
|
||||||
extern bool replaceP2StartWithMicrophone;
|
extern bool replaceP2StartWithMicrophone;
|
||||||
extern ButtConfig GamePadConfig[4][10];
|
//extern ButtConfig GamePadConfig[4][10];
|
||||||
//extern ButtConfig powerpadsc[2][12];
|
//extern ButtConfig powerpadsc[2][12];
|
||||||
//extern ButtConfig QuizKingButtons[6];
|
//extern ButtConfig QuizKingButtons[6];
|
||||||
//extern ButtConfig FTrainerButtons[12];
|
//extern ButtConfig FTrainerButtons[12];
|
||||||
|
@ -54,9 +59,9 @@ int DTestButtonJoy(ButtConfig *bc);
|
||||||
void FCEUD_UpdateInput(void);
|
void FCEUD_UpdateInput(void);
|
||||||
|
|
||||||
void UpdateInput(Config *config);
|
void UpdateInput(Config *config);
|
||||||
void InputCfg(const std::string &);
|
//void InputCfg(const std::string &);
|
||||||
|
|
||||||
std::string GetUserText(const char* title);
|
std::string GetUserText(const char* title);
|
||||||
const char* ButtonName(const ButtConfig* bc, int which);
|
const char* ButtonName(const ButtConfig* bc);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,92 @@
|
||||||
|
// sdl-joystick.h
|
||||||
|
|
||||||
|
#ifndef __SDL_JOYSTICK_H__
|
||||||
|
#define __SDL_JOYSTICK_H__
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "Qt/main.h"
|
||||||
|
#include "Qt/input.h"
|
||||||
|
#include "Qt/sdl.h"
|
||||||
|
|
||||||
|
#define MAX_JOYSTICKS 32
|
||||||
|
|
||||||
|
struct nesGamePadMap_t
|
||||||
|
{
|
||||||
|
char guid[64];
|
||||||
|
char name[128];
|
||||||
|
char btn[GAMEPAD_NUM_BUTTONS][32];
|
||||||
|
char os[64];
|
||||||
|
|
||||||
|
nesGamePadMap_t(void);
|
||||||
|
~nesGamePadMap_t(void);
|
||||||
|
|
||||||
|
void clearMapping(void);
|
||||||
|
int parseMapping( const char *text );
|
||||||
|
};
|
||||||
|
|
||||||
|
struct jsDev_t
|
||||||
|
{
|
||||||
|
SDL_Joystick *js;
|
||||||
|
SDL_GameController *gc;
|
||||||
|
|
||||||
|
jsDev_t(void);
|
||||||
|
//~jsDev_t(void);
|
||||||
|
|
||||||
|
void init( int idx );
|
||||||
|
int close(void);
|
||||||
|
SDL_Joystick *getJS(void);
|
||||||
|
bool isGameController(void);
|
||||||
|
bool isConnected(void);
|
||||||
|
void print(void);
|
||||||
|
int bindPort( int idx );
|
||||||
|
int unbindPort( int idx );
|
||||||
|
int getBindPorts(void);
|
||||||
|
const char *getName(void);
|
||||||
|
const char *getGUID(void);
|
||||||
|
|
||||||
|
private:
|
||||||
|
int devIdx;
|
||||||
|
int portBindMask;
|
||||||
|
std::string guidStr;
|
||||||
|
std::string name;
|
||||||
|
};
|
||||||
|
|
||||||
|
class GamePad_t
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
ButtConfig bmap[GAMEPAD_NUM_BUTTONS];
|
||||||
|
|
||||||
|
GamePad_t(void);
|
||||||
|
~GamePad_t(void);
|
||||||
|
|
||||||
|
int init( int port, const char *guid, const char *profile = NULL );
|
||||||
|
const char *getGUID(void);
|
||||||
|
|
||||||
|
int loadDefaults(void);
|
||||||
|
int loadProfile( const char *name, const char *guid = NULL );
|
||||||
|
|
||||||
|
int getDeviceIndex(void){ return devIdx; }
|
||||||
|
int setDeviceIndex( int devIdx );
|
||||||
|
int setMapping( const char *map );
|
||||||
|
int setMapping( nesGamePadMap_t *map );
|
||||||
|
|
||||||
|
int createProfile( const char *name );
|
||||||
|
int getMapFromFile( const char *filename, char *out );
|
||||||
|
int getDefaultMap( char *out, const char *guid = NULL );
|
||||||
|
int saveMappingToFile( const char *filename, const char *txtMap );
|
||||||
|
int saveCurrentMapToFile( const char *filename );
|
||||||
|
int deleteMapping( const char *name );
|
||||||
|
|
||||||
|
private:
|
||||||
|
int devIdx;
|
||||||
|
int portNum;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
extern GamePad_t GamePad[4];
|
||||||
|
|
||||||
|
jsDev_t *getJoystickDevice( int devNum );
|
||||||
|
|
||||||
|
#endif
|
|
@ -615,12 +615,14 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
std::string s;
|
std::string s;
|
||||||
|
|
||||||
g_config->getOption("SDL.InputCfg", &s);
|
//g_config->getOption("SDL.InputCfg", &s);
|
||||||
if(s.size() != 0)
|
//
|
||||||
{
|
//if(s.size() != 0)
|
||||||
InitVideo(GameInfo);
|
//{
|
||||||
InputCfg(s);
|
// InitVideo(GameInfo);
|
||||||
}
|
// InputCfg(s);
|
||||||
|
//}
|
||||||
|
|
||||||
// set the FAMICOM PAD 2 Mic thing
|
// set the FAMICOM PAD 2 Mic thing
|
||||||
{
|
{
|
||||||
int t;
|
int t;
|
||||||
|
|
Loading…
Reference in New Issue