zeropad: deprecate it in favor of onepad.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4732 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut@gmail.com 2011-06-12 14:58:40 +00:00
parent 35b9dfce3f
commit f42aa2a7ea
33 changed files with 0 additions and 7347 deletions

View File

@ -1,103 +0,0 @@
# Check that people use the good file
if(NOT TOP_CMAKE_WAS_SOURCED)
message(FATAL_ERROR "
You did not 'cmake' the good CMakeLists.txt file. Use the one in the top dir.
It is advice to delete all wrongly generated cmake stuff => CMakeFiles & CMakeCache.txt")
endif(NOT TOP_CMAKE_WAS_SOURCED)
# plugin name
set(Output zeropad)
set(CommonFlags
-Wall
-fpic
)
set(OptimizationFlags
-O2
-DNDEBUG
-fomit-frame-pointer
)
# Debug - Build
if(CMAKE_BUILD_TYPE STREQUAL Debug)
# add defines
add_definitions(${CommonFlags} -g)
endif(CMAKE_BUILD_TYPE STREQUAL Debug)
# Devel - Build
if(CMAKE_BUILD_TYPE STREQUAL Devel)
# add defines
add_definitions(${CommonFlags} ${OptimizationFlags})
endif(CMAKE_BUILD_TYPE STREQUAL Devel)
# Release - Build
if(CMAKE_BUILD_TYPE STREQUAL Release)
# add defines
add_definitions(${CommonFlags} ${OptimizationFlags})
endif(CMAKE_BUILD_TYPE STREQUAL Release)
# zeropad sources
set(zeropadSources
analog.cpp
joystick.cpp
keyboard.cpp
zeropad.cpp)
# zeropad headers
set(zeropadHeaders
analog.h
bitwise.h
joystick.h
keyboard.h
zeropad.h)
# zeropad Linux sources
set(zeropadLinuxSources
Linux/gui.cpp
Linux/linux.cpp
# Linux/callbacks.c
Linux/interface.c
Linux/support.c)
# zeropad Linux headers
set(zeropadLinuxHeaders
Linux/callbacks.h
Linux/interface.h
Linux/linux.h
Linux/support.h)
# zeropad Windows sources
set(zeropadWindowsSources
Windows/gui.cpp
Windows/win.cpp)
# zeropad Windows headers
set(zeropadWindowsHeaders
Windows/resource.h
Windows/win.h)
# add additional include directories
include_directories(.
Linux)
# add library
add_library(${Output} SHARED
${zeropadSources}
${zeropadHeaders}
${zeropadLinuxSources}
${zeropadLinuxHeaders})
# set output directory
set_target_properties(${Output} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin/plugins)
# link target with SDL
target_link_libraries(${Output} ${SDL_LIBRARY})
# User flags options
if(NOT USER_CMAKE_LD_FLAGS STREQUAL "")
target_link_libraries(${Output} "${USER_CMAKE_LD_FLAGS}")
endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "")

View File

@ -1,123 +0,0 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtk/gtk.h>
#include "callbacks.h"
#include "interface.h"
#include "support.h"
void
OnAbout_Ok (GtkDialog *dialog,
gint response_id,
gpointer user_data)
{
}
void
OnConf_Pad1 (GtkButton *button,
gpointer user_data)
{
}
void
OnConf_Pad2 (GtkButton *button,
gpointer user_data)
{
}
void
OnConf_Pad3 (GtkButton *button,
gpointer user_data)
{
}
void
OnConf_Pad4 (GtkButton *button,
gpointer user_data)
{
}
void
on_joydevicescombo_changed (GtkComboBox *combobox,
gpointer user_data)
{
}
void
OnConf_Key (GtkButton *button,
gpointer user_data)
{
}
void
on_checkbutton_reversery_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
{
}
void
on_checkbutton_reverserx_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
{
}
void
on_forcefeedback_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
{
}
void
on_checkbutton_reverselx_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
{
}
void
on_checkbutton_reversely_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
{
}
void
OnConf_Ok (GtkButton *button,
gpointer user_data)
{
}
void
OnConf_Cancel (GtkButton *button,
gpointer user_data)
{
}

View File

@ -1,60 +0,0 @@
#include <gtk/gtk.h>
#define VERSION "0.3"
void
OnAbout_Ok (GtkDialog *dialog,
gint response_id,
gpointer user_data);
void
OnConf_Pad1 (GtkButton *button,
gpointer user_data);
void
OnConf_Pad2 (GtkButton *button,
gpointer user_data);
void
OnConf_Pad3 (GtkButton *button,
gpointer user_data);
void
OnConf_Pad4 (GtkButton *button,
gpointer user_data);
void
on_joydevicescombo_changed (GtkComboBox *combobox,
gpointer user_data);
void
OnConf_Key (GtkButton *button,
gpointer user_data);
void
on_checkbutton_reversery_toggled (GtkToggleButton *togglebutton,
gpointer user_data);
void
on_checkbutton_reverserx_toggled (GtkToggleButton *togglebutton,
gpointer user_data);
void
on_forcefeedback_toggled (GtkToggleButton *togglebutton,
gpointer user_data);
void
on_checkbutton_reverselx_toggled (GtkToggleButton *togglebutton,
gpointer user_data);
void
on_checkbutton_reversely_toggled (GtkToggleButton *togglebutton,
gpointer user_data);
void
OnConf_Ok (GtkButton *button,
gpointer user_data);
void
OnConf_Cancel (GtkButton *button,
gpointer user_data);

View File

@ -1,285 +0,0 @@
/* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <string.h>
#include <gtk/gtk.h>
#include <pthread.h>
#include "joystick.h"
#include "zeropad.h"
#include "linux.h"
extern "C"
{
#include "interface.h"
#include "support.h"
#include "callbacks.h"
}
extern string s_strIniPath;
GtkWidget *Conf = NULL, *About = NULL;
GtkWidget *s_devicecombo = NULL;
extern void UpdateConf(int pad);
void SaveConfig()
{
int i, j;
FILE *f;
const std::string iniFile(s_strIniPath + "/zeropad.ini");
f = fopen(iniFile.c_str(), "w");
if (f == NULL)
{
printf("ZeroPAD: failed to save ini %s\n", s_strIniPath.c_str());
return;
}
for (j = 0; j < 2 * PADSUBKEYS; j++)
{
for (i = 0; i < PADKEYS; i++)
{
fprintf(f, "[%d][%d] = 0x%lx\n", j, i, conf.keys[j][i]);
}
}
fprintf(f, "log = %d\n", conf.log);
fprintf(f, "options = %d\n", conf.options);
fclose(f);
}
void LoadConfig()
{
FILE *f;
char str[256];
int i, j;
memset(&conf, 0, sizeof(conf));
conf.keys[0][0] = XK_a; // L2
conf.keys[0][1] = XK_semicolon; // R2
conf.keys[0][2] = XK_w; // L1
conf.keys[0][3] = XK_p; // R1
conf.keys[0][4] = XK_i; // TRIANGLE
conf.keys[0][5] = XK_l; // CIRCLE
conf.keys[0][6] = XK_k; // CROSS
conf.keys[0][7] = XK_j; // SQUARE
conf.keys[0][8] = XK_v; // SELECT
conf.keys[0][11] = XK_n; // START
conf.keys[0][12] = XK_e; // UP
conf.keys[0][13] = XK_f; // RIGHT
conf.keys[0][14] = XK_d; // DOWN
conf.keys[0][15] = XK_s; // LEFT
conf.log = 0;
const std::string iniFile(s_strIniPath + "/zeropad.ini");
f = fopen(iniFile.c_str(), "r");
if (f == NULL)
{
printf("ZeroPAD: failed to load ini %s\n", s_strIniPath.c_str());
SaveConfig(); //save and return
return;
}
for (j = 0; j < 2 * PADSUBKEYS; j++)
{
for (i = 0; i < PADKEYS; i++)
{
sprintf(str, "[%d][%d] = 0x%%x\n", j, i);
if (fscanf(f, str, &conf.keys[j][i]) == 0) conf.keys[j][i] = 0;
}
}
fscanf(f, "log = %d\n", &conf.log);
fscanf(f, "options = %d\n", &conf.options);
fclose(f);
}
GtkWidget *MsgDlg;
void OnMsg_Ok()
{
gtk_widget_destroy(MsgDlg);
gtk_main_quit();
}
// GUI event handlers
void on_joydevicescombo_changed(GtkComboBox *combobox, gpointer user_data)
{
int joyid = gtk_combo_box_get_active(combobox);
// unassign every joystick with this pad
for (int i = 0; i < (int)s_vjoysticks.size(); ++i)
{
if (s_vjoysticks[i]->GetPAD() == s_selectedpad) s_vjoysticks[i]->Assign(-1);
}
if (joyid >= 0 && joyid < (int)s_vjoysticks.size()) s_vjoysticks[joyid]->Assign(s_selectedpad);
}
void on_checkbutton_reverselx_toggled(GtkToggleButton *togglebutton, gpointer user_data)
{
int mask = PADOPTION_REVERTLX << (16 * s_selectedpad);
if (gtk_toggle_button_get_active(togglebutton))
conf.options |= mask;
else
conf.options &= ~mask;
}
void on_checkbutton_reversely_toggled(GtkToggleButton *togglebutton, gpointer user_data)
{
int mask = PADOPTION_REVERTLY << (16 * s_selectedpad);
if (gtk_toggle_button_get_active(togglebutton))
conf.options |= mask;
else
conf.options &= ~mask;
}
void on_checkbutton_reverserx_toggled(GtkToggleButton *togglebutton, gpointer user_data)
{
int mask = PADOPTION_REVERTRX << (16 * s_selectedpad);
if (gtk_toggle_button_get_active(togglebutton))
conf.options |= mask;
else
conf.options &= ~mask;
}
void on_checkbutton_reversery_toggled(GtkToggleButton *togglebutton, gpointer user_data)
{
int mask = PADOPTION_REVERTRY << (16 * s_selectedpad);
if (gtk_toggle_button_get_active(togglebutton))
conf.options |= mask;
else
conf.options &= ~mask;
}
void on_forcefeedback_toggled(GtkToggleButton *togglebutton, gpointer user_data)
{
int mask = PADOPTION_REVERTLX << (16 * s_selectedpad);
if (gtk_toggle_button_get_active(togglebutton))
{
conf.options |= mask;
int joyid = gtk_combo_box_get_active(GTK_COMBO_BOX(s_devicecombo));
if (joyid >= 0 && joyid < (int)s_vjoysticks.size()) s_vjoysticks[joyid]->TestForce();
}
else
{
conf.options &= ~mask;
}
}
void SysMessage(char *fmt, ...)
{
GtkWidget *Ok, *Txt;
GtkWidget *Box, *Box1;
va_list list;
char msg[512];
va_start(list, fmt);
vsprintf(msg, fmt, list);
va_end(list);
if (msg[strlen(msg)-1] == '\n') msg[strlen(msg)-1] = 0;
MsgDlg = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_position(GTK_WINDOW(MsgDlg), GTK_WIN_POS_CENTER);
gtk_window_set_title(GTK_WINDOW(MsgDlg), "ZeroPad");
gtk_container_set_border_width(GTK_CONTAINER(MsgDlg), 5);
Box = gtk_vbox_new(5, 0);
gtk_container_add(GTK_CONTAINER(MsgDlg), Box);
gtk_widget_show(Box);
Txt = gtk_label_new(msg);
gtk_box_pack_start(GTK_BOX(Box), Txt, FALSE, FALSE, 5);
gtk_widget_show(Txt);
Box1 = gtk_hbutton_box_new();
gtk_box_pack_start(GTK_BOX(Box), Box1, FALSE, FALSE, 0);
gtk_widget_show(Box1);
Ok = gtk_button_new_with_label("Ok");
gtk_signal_connect(GTK_OBJECT(Ok), "clicked", GTK_SIGNAL_FUNC(OnMsg_Ok), NULL);
gtk_container_add(GTK_CONTAINER(Box1), Ok);
GTK_WIDGET_SET_FLAGS(Ok, GTK_CAN_DEFAULT);
gtk_widget_show(Ok);
gtk_widget_show(MsgDlg);
gtk_main();
}
void OnConf_Pad1(GtkButton *button, gpointer user_data)
{
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) UpdateConf(0);
}
void OnConf_Pad2(GtkButton *button, gpointer user_data)
{
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) UpdateConf(1);
}
void OnConf_Pad3(GtkButton *button, gpointer user_data)
{
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) UpdateConf(2);
}
void OnConf_Pad4(GtkButton *button, gpointer user_data)
{
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) UpdateConf(3);
}
void OnConf_Ok(GtkButton *button, gpointer user_data)
{
// conf.analog = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(Analog));
SaveConfig();
gtk_widget_destroy(Conf);
gtk_main_quit();
}
void OnConf_Cancel(GtkButton *button, gpointer user_data)
{
gtk_widget_destroy(Conf);
gtk_main_quit();
LoadConfig(); // load previous config
}
void OnAbout_Ok(GtkDialog *About, gint response_id, gpointer user_data)
{
gtk_widget_destroy(GTK_WIDGET(About));
gtk_main_quit();
}
void CALLBACK PADabout()
{
About = create_About();
gtk_widget_show_all(About);
gtk_main();
}
s32 CALLBACK PADtest()
{
return 0;
}

View File

@ -1,898 +0,0 @@
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include "callbacks.h"
#include "interface.h"
#include "support.h"
#define GLADE_HOOKUP_OBJECT(component,widget,name) \
g_object_set_data_full (G_OBJECT (component), name, \
gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
g_object_set_data (G_OBJECT (component), name, widget)
GtkWidget*
create_About (void)
{
GtkWidget *About;
const gchar *authors[] = {
"Author: zerofrog(@gmail.com)",
"Thanks to:",
" linuzappz <linuzappz@hotmail.com>",
"florin sasu <florinsasu@hotmail.com>",
"and SSSPSXPad, TwinPad authors",
NULL
};
/* TRANSLATORS: Replace this string with your names, one name per line. */
gchar *translators = _("translator-credits");
About = gtk_about_dialog_new ();
gtk_widget_set_name (About, "About");
gtk_container_set_border_width (GTK_CONTAINER (About), 5);
gtk_window_set_destroy_with_parent (GTK_WINDOW (About), TRUE);
gtk_about_dialog_set_version (GTK_ABOUT_DIALOG (About), VERSION);
gtk_about_dialog_set_name (GTK_ABOUT_DIALOG (About), _("ZeroPAD"));
gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG (About), authors);
gtk_about_dialog_set_translator_credits (GTK_ABOUT_DIALOG (About), translators);
g_signal_connect ((gpointer) About, "response",
G_CALLBACK (OnAbout_Ok),
NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */
GLADE_HOOKUP_OBJECT_NO_REF (About, About, "About");
return About;
}
GtkWidget*
create_Conf (void)
{
GtkWidget *Conf;
GtkWidget *dialog_vbox1;
GtkWidget *vbox1;
GtkWidget *frame1;
GtkWidget *alignment1;
GtkWidget *hbox1;
GtkWidget *PAD1;
GSList *PAD1_group = NULL;
GtkWidget *PAD2;
GtkWidget *PAD3;
GtkWidget *PAD4;
GtkWidget *label2;
GtkWidget *vbox2;
GtkWidget *label5;
GtkWidget *joydevicescombo;
GtkWidget *fixed1;
GtkWidget *eL2;
GtkWidget *eL1;
GtkWidget *eSelect;
GtkWidget *eStart;
GtkWidget *eUp;
GtkWidget *eRight;
GtkWidget *eLeft;
GtkWidget *eDown;
GtkWidget *eR2;
GtkWidget *eR1;
GtkWidget *eAnalog;
GtkWidget *eSquare;
GtkWidget *eTriangle;
GtkWidget *eCircle;
GtkWidget *eCross;
GtkWidget *eR3;
GtkWidget *eL3;
GtkWidget *eRx;
GtkWidget *eLx;
GtkWidget *eRy;
GtkWidget *eLy;
GtkWidget *eL_Up;
GtkWidget *eL_Left;
GtkWidget *eL_Right;
GtkWidget *eL_Down;
GtkWidget *eR_Up;
GtkWidget *eR_Left;
GtkWidget *eR_Right;
GtkWidget *eR_Down;
GtkWidget *R3;
GtkWidget *Select;
GtkWidget *Start;
GtkWidget *Square;
GtkWidget *Circle;
GtkWidget *L2;
GtkWidget *L1;
GtkWidget *Down;
GtkWidget *Up;
GtkWidget *Left;
GtkWidget *Right;
GtkWidget *R1;
GtkWidget *R2;
GtkWidget *Triangle;
GtkWidget *Cross;
GtkWidget *L3;
GtkWidget *checkbutton_reversery;
GtkWidget *checkbutton_reverserx;
GtkWidget *R_Down;
GtkWidget *Ry;
GtkWidget *Rx;
GtkWidget *R_Up;
GtkWidget *R_Right;
GtkWidget *R_Left;
GtkWidget *forcefeedback;
GtkWidget *checkbutton_reverselx;
GtkWidget *checkbutton_reversely;
GtkWidget *L_Down;
GtkWidget *Ly;
GtkWidget *Lx;
GtkWidget *L_Up;
GtkWidget *L_Left;
GtkWidget *L_Right;
GtkWidget *label3;
GtkWidget *Analog;
GtkWidget *label6;
GtkWidget *dialog_action_area1;
GtkWidget *okbutton1;
GtkWidget *cancelbutton1;
Conf = gtk_dialog_new ();
gtk_widget_set_name (Conf, "Conf");
gtk_window_set_title (GTK_WINDOW (Conf), _("ZeroPAD Configuration Dialog"));
gtk_window_set_type_hint (GTK_WINDOW (Conf), GDK_WINDOW_TYPE_HINT_DIALOG);
dialog_vbox1 = GTK_DIALOG (Conf)->vbox;
gtk_widget_set_name (dialog_vbox1, "dialog_vbox1");
gtk_widget_show (dialog_vbox1);
vbox1 = gtk_vbox_new (FALSE, 0);
gtk_widget_set_name (vbox1, "vbox1");
gtk_widget_show (vbox1);
gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);
frame1 = gtk_frame_new (NULL);
gtk_widget_set_name (frame1, "frame1");
gtk_widget_show (frame1);
gtk_box_pack_start (GTK_BOX (vbox1), frame1, FALSE, FALSE, 0);
alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1);
gtk_widget_set_name (alignment1, "alignment1");
gtk_widget_show (alignment1);
gtk_container_add (GTK_CONTAINER (frame1), alignment1);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 0, 0, 12, 0);
hbox1 = gtk_hbox_new (FALSE, 0);
gtk_widget_set_name (hbox1, "hbox1");
gtk_widget_show (hbox1);
gtk_container_add (GTK_CONTAINER (alignment1), hbox1);
PAD1 = gtk_radio_button_new_with_mnemonic (NULL, _("PAD1"));
gtk_widget_set_name (PAD1, "PAD1");
gtk_widget_show (PAD1);
gtk_box_pack_start (GTK_BOX (hbox1), PAD1, FALSE, FALSE, 0);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (PAD1), PAD1_group);
PAD1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (PAD1));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (PAD1), TRUE);
PAD2 = gtk_radio_button_new_with_mnemonic (NULL, _("PAD2"));
gtk_widget_set_name (PAD2, "PAD2");
gtk_widget_show (PAD2);
gtk_box_pack_start (GTK_BOX (hbox1), PAD2, FALSE, FALSE, 0);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (PAD2), PAD1_group);
PAD1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (PAD2));
PAD3 = gtk_radio_button_new_with_mnemonic (NULL, _("PAD1 alt."));
gtk_widget_set_name (PAD3, "PAD3");
gtk_widget_show (PAD3);
gtk_box_pack_start (GTK_BOX (hbox1), PAD3, FALSE, FALSE, 0);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (PAD3), PAD1_group);
PAD1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (PAD3));
PAD4 = gtk_radio_button_new_with_mnemonic (NULL, _("PAD2 alt."));
gtk_widget_set_name (PAD4, "PAD4");
gtk_widget_show (PAD4);
gtk_box_pack_start (GTK_BOX (hbox1), PAD4, FALSE, FALSE, 0);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (PAD4), PAD1_group);
PAD1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (PAD4));
label2 = gtk_label_new (_("<b>Choose PAD to modify</b>"));
gtk_widget_set_name (label2, "label2");
gtk_widget_show (label2);
gtk_frame_set_label_widget (GTK_FRAME (frame1), label2);
gtk_label_set_use_markup (GTK_LABEL (label2), TRUE);
vbox2 = gtk_vbox_new (FALSE, 0);
gtk_widget_set_name (vbox2, "vbox2");
gtk_widget_show (vbox2);
gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, TRUE, 0);
label5 = gtk_label_new (_("Joystick to use for this PAD"));
gtk_widget_set_name (label5, "label5");
gtk_widget_show (label5);
gtk_box_pack_start (GTK_BOX (vbox2), label5, FALSE, FALSE, 0);
joydevicescombo = gtk_combo_box_entry_new_text ();
gtk_widget_set_name (joydevicescombo, "joydevicescombo");
gtk_widget_show (joydevicescombo);
gtk_box_pack_start (GTK_BOX (vbox2), joydevicescombo, FALSE, TRUE, 0);
fixed1 = gtk_fixed_new ();
gtk_widget_set_name (fixed1, "fixed1");
gtk_widget_show (fixed1);
gtk_box_pack_start (GTK_BOX (vbox1), fixed1, TRUE, TRUE, 0);
eL2 = gtk_entry_new ();
gtk_widget_set_name (eL2, "eL2");
gtk_widget_show (eL2);
gtk_fixed_put (GTK_FIXED (fixed1), eL2, 64, 32);
gtk_widget_set_size_request (eL2, 64, 24);
gtk_editable_set_editable (GTK_EDITABLE (eL2), FALSE);
gtk_entry_set_invisible_char (GTK_ENTRY (eL2), 8226);
eL1 = gtk_entry_new ();
gtk_widget_set_name (eL1, "eL1");
gtk_widget_show (eL1);
gtk_fixed_put (GTK_FIXED (fixed1), eL1, 64, 80);
gtk_widget_set_size_request (eL1, 64, 24);
gtk_entry_set_invisible_char (GTK_ENTRY (eL1), 8226);
eSelect = gtk_entry_new ();
gtk_widget_set_name (eSelect, "eSelect");
gtk_widget_show (eSelect);
gtk_fixed_put (GTK_FIXED (fixed1), eSelect, 200, 184);
gtk_widget_set_size_request (eSelect, 64, 24);
gtk_editable_set_editable (GTK_EDITABLE (eSelect), FALSE);
gtk_entry_set_invisible_char (GTK_ENTRY (eSelect), 8226);
eStart = gtk_entry_new ();
gtk_widget_set_name (eStart, "eStart");
gtk_widget_show (eStart);
gtk_fixed_put (GTK_FIXED (fixed1), eStart, 272, 184);
gtk_widget_set_size_request (eStart, 64, 24);
gtk_editable_set_editable (GTK_EDITABLE (eStart), FALSE);
gtk_entry_set_invisible_char (GTK_ENTRY (eStart), 8226);
eUp = gtk_entry_new ();
gtk_widget_set_name (eUp, "eUp");
gtk_widget_show (eUp);
gtk_fixed_put (GTK_FIXED (fixed1), eUp, 64, 136);
gtk_widget_set_size_request (eUp, 64, 24);
gtk_entry_set_invisible_char (GTK_ENTRY (eUp), 8226);
eRight = gtk_entry_new ();
gtk_widget_set_name (eRight, "eRight");
gtk_widget_show (eRight);
gtk_fixed_put (GTK_FIXED (fixed1), eRight, 128, 184);
gtk_widget_set_size_request (eRight, 64, 24);
gtk_editable_set_editable (GTK_EDITABLE (eRight), FALSE);
gtk_entry_set_invisible_char (GTK_ENTRY (eRight), 8226);
eLeft = gtk_entry_new ();
gtk_widget_set_name (eLeft, "eLeft");
gtk_widget_show (eLeft);
gtk_fixed_put (GTK_FIXED (fixed1), eLeft, 0, 184);
gtk_widget_set_size_request (eLeft, 64, 24);
gtk_editable_set_editable (GTK_EDITABLE (eLeft), FALSE);
gtk_entry_set_invisible_char (GTK_ENTRY (eLeft), 8226);
eDown = gtk_entry_new ();
gtk_widget_set_name (eDown, "eDown");
gtk_widget_show (eDown);
gtk_fixed_put (GTK_FIXED (fixed1), eDown, 64, 232);
gtk_widget_set_size_request (eDown, 64, 24);
gtk_editable_set_editable (GTK_EDITABLE (eDown), FALSE);
gtk_entry_set_invisible_char (GTK_ENTRY (eDown), 8226);
eR2 = gtk_entry_new ();
gtk_widget_set_name (eR2, "eR2");
gtk_widget_show (eR2);
gtk_fixed_put (GTK_FIXED (fixed1), eR2, 408, 32);
gtk_widget_set_size_request (eR2, 64, 24);
gtk_editable_set_editable (GTK_EDITABLE (eR2), FALSE);
gtk_entry_set_invisible_char (GTK_ENTRY (eR2), 8226);
eR1 = gtk_entry_new ();
gtk_widget_set_name (eR1, "eR1");
gtk_widget_show (eR1);
gtk_fixed_put (GTK_FIXED (fixed1), eR1, 408, 80);
gtk_widget_set_size_request (eR1, 64, 24);
gtk_editable_set_editable (GTK_EDITABLE (eR1), FALSE);
gtk_entry_set_invisible_char (GTK_ENTRY (eR1), 8226);
eAnalog = gtk_entry_new ();
gtk_widget_set_name (eAnalog, "eAnalog");
gtk_widget_show (eAnalog);
gtk_fixed_put (GTK_FIXED (fixed1), eAnalog, 240, 232);
gtk_widget_set_size_request (eAnalog, 64, 24);
gtk_editable_set_editable (GTK_EDITABLE (eAnalog), FALSE);
gtk_entry_set_invisible_char (GTK_ENTRY (eAnalog), 8226);
eSquare = gtk_entry_new ();
gtk_widget_set_name (eSquare, "eSquare");
gtk_widget_show (eSquare);
gtk_fixed_put (GTK_FIXED (fixed1), eSquare, 344, 184);
gtk_widget_set_size_request (eSquare, 64, 24);
gtk_editable_set_editable (GTK_EDITABLE (eSquare), FALSE);
gtk_entry_set_invisible_char (GTK_ENTRY (eSquare), 8226);
eTriangle = gtk_entry_new ();
gtk_widget_set_name (eTriangle, "eTriangle");
gtk_widget_show (eTriangle);
gtk_fixed_put (GTK_FIXED (fixed1), eTriangle, 408, 136);
gtk_widget_set_size_request (eTriangle, 64, 24);
gtk_editable_set_editable (GTK_EDITABLE (eTriangle), FALSE);
gtk_entry_set_invisible_char (GTK_ENTRY (eTriangle), 8226);
eCircle = gtk_entry_new ();
gtk_widget_set_name (eCircle, "eCircle");
gtk_widget_show (eCircle);
gtk_fixed_put (GTK_FIXED (fixed1), eCircle, 472, 184);
gtk_widget_set_size_request (eCircle, 64, 24);
gtk_editable_set_editable (GTK_EDITABLE (eCircle), FALSE);
gtk_entry_set_invisible_char (GTK_ENTRY (eCircle), 8226);
eCross = gtk_entry_new ();
gtk_widget_set_name (eCross, "eCross");
gtk_widget_show (eCross);
gtk_fixed_put (GTK_FIXED (fixed1), eCross, 408, 232);
gtk_widget_set_size_request (eCross, 64, 24);
gtk_editable_set_editable (GTK_EDITABLE (eCross), FALSE);
gtk_entry_set_invisible_char (GTK_ENTRY (eCross), 8226);
eR3 = gtk_entry_new ();
gtk_widget_set_name (eR3, "eR3");
gtk_widget_show (eR3);
gtk_fixed_put (GTK_FIXED (fixed1), eR3, 272, 56);
gtk_widget_set_size_request (eR3, 64, 24);
gtk_editable_set_editable (GTK_EDITABLE (eR3), FALSE);
gtk_entry_set_invisible_char (GTK_ENTRY (eR3), 8226);
eL3 = gtk_entry_new ();
gtk_widget_set_name (eL3, "eL3");
gtk_widget_show (eL3);
gtk_fixed_put (GTK_FIXED (fixed1), eL3, 200, 56);
gtk_widget_set_size_request (eL3, 64, 24);
gtk_editable_set_editable (GTK_EDITABLE (eL3), FALSE);
gtk_entry_set_invisible_char (GTK_ENTRY (eL3), 8226);
eRx = gtk_entry_new ();
gtk_widget_set_name (eRx, "eRx");
gtk_widget_show (eRx);
gtk_fixed_put (GTK_FIXED (fixed1), eRx, 408, 384);
gtk_widget_set_size_request (eRx, 64, 24);
gtk_editable_set_editable (GTK_EDITABLE (eRx), FALSE);
gtk_entry_set_invisible_char (GTK_ENTRY (eRx), 8226);
eLx = gtk_entry_new ();
gtk_widget_set_name (eLx, "eLx");
gtk_widget_show (eLx);
gtk_fixed_put (GTK_FIXED (fixed1), eLx, 64, 384);
gtk_widget_set_size_request (eLx, 64, 24);
gtk_editable_set_editable (GTK_EDITABLE (eLx), FALSE);
gtk_entry_set_invisible_char (GTK_ENTRY (eLx), 8226);
eRy = gtk_entry_new ();
gtk_widget_set_name (eRy, "eRy");
gtk_widget_show (eRy);
gtk_fixed_put (GTK_FIXED (fixed1), eRy, 408, 432);
gtk_widget_set_size_request (eRy, 64, 24);
gtk_editable_set_editable (GTK_EDITABLE (eRy), FALSE);
gtk_entry_set_invisible_char (GTK_ENTRY (eRy), 8226);
eLy = gtk_entry_new ();
gtk_widget_set_name (eLy, "eLy");
gtk_widget_show (eLy);
gtk_fixed_put (GTK_FIXED (fixed1), eLy, 64, 432);
gtk_widget_set_size_request (eLy, 64, 24);
gtk_editable_set_editable (GTK_EDITABLE (eLy), FALSE);
gtk_entry_set_invisible_char (GTK_ENTRY (eLy), 8226);
eL_Up = gtk_entry_new ();
gtk_widget_set_name (eL_Up, "eL_Up");
gtk_widget_show (eL_Up);
gtk_fixed_put (GTK_FIXED (fixed1), eL_Up, 64, 336);
gtk_widget_set_size_request (eL_Up, 64, 24);
eL_Left = gtk_entry_new ();
gtk_widget_set_name (eL_Left, "eL_Left");
gtk_widget_show (eL_Left);
gtk_fixed_put (GTK_FIXED (fixed1), eL_Left, 0, 408);
gtk_widget_set_size_request (eL_Left, 64, 24);
eL_Right = gtk_entry_new ();
gtk_widget_set_name (eL_Right, "eL_Right");
gtk_widget_show (eL_Right);
gtk_fixed_put (GTK_FIXED (fixed1), eL_Right, 128, 408);
gtk_widget_set_size_request (eL_Right, 64, 24);
eL_Down = gtk_entry_new ();
gtk_widget_set_name (eL_Down, "eL_Down");
gtk_widget_show (eL_Down);
gtk_fixed_put (GTK_FIXED (fixed1), eL_Down, 64, 480);
gtk_widget_set_size_request (eL_Down, 64, 24);
eR_Up = gtk_entry_new ();
gtk_widget_set_name (eR_Up, "eR_Up");
gtk_widget_show (eR_Up);
gtk_fixed_put (GTK_FIXED (fixed1), eR_Up, 408, 336);
gtk_widget_set_size_request (eR_Up, 64, 24);
eR_Left = gtk_entry_new ();
gtk_widget_set_name (eR_Left, "eR_Left");
gtk_widget_show (eR_Left);
gtk_fixed_put (GTK_FIXED (fixed1), eR_Left, 344, 408);
gtk_widget_set_size_request (eR_Left, 64, 24);
eR_Right = gtk_entry_new ();
gtk_widget_set_name (eR_Right, "eR_Right");
gtk_widget_show (eR_Right);
gtk_fixed_put (GTK_FIXED (fixed1), eR_Right, 472, 408);
gtk_widget_set_size_request (eR_Right, 64, 24);
eR_Down = gtk_entry_new ();
gtk_widget_set_name (eR_Down, "eR_Down");
gtk_widget_show (eR_Down);
gtk_fixed_put (GTK_FIXED (fixed1), eR_Down, 408, 480);
gtk_widget_set_size_request (eR_Down, 64, 24);
R3 = gtk_button_new_with_mnemonic (_("R3"));
gtk_widget_set_name (R3, "R3");
gtk_widget_show (R3);
gtk_fixed_put (GTK_FIXED (fixed1), R3, 272, 32);
gtk_widget_set_size_request (R3, 64, 24);
Select = gtk_button_new_with_mnemonic (_("Select"));
gtk_widget_set_name (Select, "Select");
gtk_widget_show (Select);
gtk_fixed_put (GTK_FIXED (fixed1), Select, 200, 160);
gtk_widget_set_size_request (Select, 64, 24);
Start = gtk_button_new_with_mnemonic (_("Start"));
gtk_widget_set_name (Start, "Start");
gtk_widget_show (Start);
gtk_fixed_put (GTK_FIXED (fixed1), Start, 272, 160);
gtk_widget_set_size_request (Start, 64, 24);
Square = gtk_button_new_with_mnemonic (_("Square"));
gtk_widget_set_name (Square, "Square");
gtk_widget_show (Square);
gtk_fixed_put (GTK_FIXED (fixed1), Square, 344, 160);
gtk_widget_set_size_request (Square, 64, 24);
Circle = gtk_button_new_with_mnemonic (_("Circle"));
gtk_widget_set_name (Circle, "Circle");
gtk_widget_show (Circle);
gtk_fixed_put (GTK_FIXED (fixed1), Circle, 472, 160);
gtk_widget_set_size_request (Circle, 64, 24);
L2 = gtk_button_new_with_mnemonic (_("L2"));
gtk_widget_set_name (L2, "L2");
gtk_widget_show (L2);
gtk_fixed_put (GTK_FIXED (fixed1), L2, 64, 8);
gtk_widget_set_size_request (L2, 64, 24);
L1 = gtk_button_new_with_mnemonic (_("L1"));
gtk_widget_set_name (L1, "L1");
gtk_widget_show (L1);
gtk_fixed_put (GTK_FIXED (fixed1), L1, 64, 56);
gtk_widget_set_size_request (L1, 64, 24);
Down = gtk_button_new_with_mnemonic (_("Down"));
gtk_widget_set_name (Down, "Down");
gtk_widget_show (Down);
gtk_fixed_put (GTK_FIXED (fixed1), Down, 64, 208);
gtk_widget_set_size_request (Down, 64, 24);
Up = gtk_button_new_with_mnemonic (_("Up"));
gtk_widget_set_name (Up, "Up");
gtk_widget_show (Up);
gtk_fixed_put (GTK_FIXED (fixed1), Up, 64, 112);
gtk_widget_set_size_request (Up, 64, 24);
Left = gtk_button_new_with_mnemonic (_("Left"));
gtk_widget_set_name (Left, "Left");
gtk_widget_show (Left);
gtk_fixed_put (GTK_FIXED (fixed1), Left, 0, 160);
gtk_widget_set_size_request (Left, 64, 24);
Right = gtk_button_new_with_mnemonic (_("Right"));
gtk_widget_set_name (Right, "Right");
gtk_widget_show (Right);
gtk_fixed_put (GTK_FIXED (fixed1), Right, 128, 160);
gtk_widget_set_size_request (Right, 64, 24);
R1 = gtk_button_new_with_mnemonic (_("R1"));
gtk_widget_set_name (R1, "R1");
gtk_widget_show (R1);
gtk_fixed_put (GTK_FIXED (fixed1), R1, 408, 56);
gtk_widget_set_size_request (R1, 64, 24);
R2 = gtk_button_new_with_mnemonic (_("R2"));
gtk_widget_set_name (R2, "R2");
gtk_widget_show (R2);
gtk_fixed_put (GTK_FIXED (fixed1), R2, 408, 8);
gtk_widget_set_size_request (R2, 64, 24);
Triangle = gtk_button_new_with_mnemonic (_("Triangle"));
gtk_widget_set_name (Triangle, "Triangle");
gtk_widget_show (Triangle);
gtk_fixed_put (GTK_FIXED (fixed1), Triangle, 408, 112);
gtk_widget_set_size_request (Triangle, 64, 24);
Cross = gtk_button_new_with_mnemonic (_("Cross"));
gtk_widget_set_name (Cross, "Cross");
gtk_widget_show (Cross);
gtk_fixed_put (GTK_FIXED (fixed1), Cross, 408, 208);
gtk_widget_set_size_request (Cross, 64, 24);
L3 = gtk_button_new_with_mnemonic (_("L3"));
gtk_widget_set_name (L3, "L3");
gtk_widget_show (L3);
gtk_fixed_put (GTK_FIXED (fixed1), L3, 200, 32);
gtk_widget_set_size_request (L3, 64, 24);
checkbutton_reversery = gtk_check_button_new_with_mnemonic (_("Reverse RY"));
gtk_widget_set_name (checkbutton_reversery, "checkbutton_reversery");
gtk_widget_show (checkbutton_reversery);
gtk_fixed_put (GTK_FIXED (fixed1), checkbutton_reversery, 384, 536);
gtk_widget_set_size_request (checkbutton_reversery, 111, 22);
checkbutton_reverserx = gtk_check_button_new_with_mnemonic (_("Reverse RX"));
gtk_widget_set_name (checkbutton_reverserx, "checkbutton_reverserx");
gtk_widget_show (checkbutton_reverserx);
gtk_fixed_put (GTK_FIXED (fixed1), checkbutton_reverserx, 384, 512);
gtk_widget_set_size_request (checkbutton_reverserx, 111, 22);
R_Down = gtk_button_new_with_mnemonic (_("Down"));
gtk_widget_set_name (R_Down, "R_Down");
gtk_widget_show (R_Down);
gtk_fixed_put (GTK_FIXED (fixed1), R_Down, 408, 456);
gtk_widget_set_size_request (R_Down, 64, 24);
Ry = gtk_button_new_with_mnemonic (_("Ry"));
gtk_widget_set_name (Ry, "Ry");
gtk_widget_show (Ry);
gtk_fixed_put (GTK_FIXED (fixed1), Ry, 408, 408);
gtk_widget_set_size_request (Ry, 64, 24);
Rx = gtk_button_new_with_mnemonic (_("Rx"));
gtk_widget_set_name (Rx, "Rx");
gtk_widget_show (Rx);
gtk_fixed_put (GTK_FIXED (fixed1), Rx, 408, 360);
gtk_widget_set_size_request (Rx, 64, 24);
R_Up = gtk_button_new_with_mnemonic (_("Up"));
gtk_widget_set_name (R_Up, "R_Up");
gtk_widget_show (R_Up);
gtk_fixed_put (GTK_FIXED (fixed1), R_Up, 408, 312);
gtk_widget_set_size_request (R_Up, 64, 24);
R_Right = gtk_button_new_with_mnemonic (_("Right"));
gtk_widget_set_name (R_Right, "R_Right");
gtk_widget_show (R_Right);
gtk_fixed_put (GTK_FIXED (fixed1), R_Right, 472, 384);
gtk_widget_set_size_request (R_Right, 64, 24);
R_Left = gtk_button_new_with_mnemonic (_("Left"));
gtk_widget_set_name (R_Left, "R_Left");
gtk_widget_show (R_Left);
gtk_fixed_put (GTK_FIXED (fixed1), R_Left, 344, 384);
gtk_widget_set_size_request (R_Left, 64, 24);
forcefeedback = gtk_check_button_new_with_mnemonic (_("Enable Force\nFeedback"));
gtk_widget_set_name (forcefeedback, "forcefeedback");
gtk_widget_show (forcefeedback);
gtk_fixed_put (GTK_FIXED (fixed1), forcefeedback, 216, 512);
gtk_widget_set_size_request (forcefeedback, 112, 48);
checkbutton_reverselx = gtk_check_button_new_with_mnemonic (_("Reverse LX"));
gtk_widget_set_name (checkbutton_reverselx, "checkbutton_reverselx");
gtk_widget_show (checkbutton_reverselx);
gtk_fixed_put (GTK_FIXED (fixed1), checkbutton_reverselx, 48, 512);
gtk_widget_set_size_request (checkbutton_reverselx, 111, 22);
checkbutton_reversely = gtk_check_button_new_with_mnemonic (_("Reverse LY"));
gtk_widget_set_name (checkbutton_reversely, "checkbutton_reversely");
gtk_widget_show (checkbutton_reversely);
gtk_fixed_put (GTK_FIXED (fixed1), checkbutton_reversely, 48, 536);
gtk_widget_set_size_request (checkbutton_reversely, 111, 22);
L_Down = gtk_button_new_with_mnemonic (_("Down"));
gtk_widget_set_name (L_Down, "L_Down");
gtk_widget_show (L_Down);
gtk_fixed_put (GTK_FIXED (fixed1), L_Down, 64, 456);
gtk_widget_set_size_request (L_Down, 64, 24);
Ly = gtk_button_new_with_mnemonic (_("Ly"));
gtk_widget_set_name (Ly, "Ly");
gtk_widget_show (Ly);
gtk_fixed_put (GTK_FIXED (fixed1), Ly, 64, 408);
gtk_widget_set_size_request (Ly, 64, 24);
Lx = gtk_button_new_with_mnemonic (_("Lx"));
gtk_widget_set_name (Lx, "Lx");
gtk_widget_show (Lx);
gtk_fixed_put (GTK_FIXED (fixed1), Lx, 64, 360);
gtk_widget_set_size_request (Lx, 64, 24);
L_Up = gtk_button_new_with_mnemonic (_("Up"));
gtk_widget_set_name (L_Up, "L_Up");
gtk_widget_show (L_Up);
gtk_fixed_put (GTK_FIXED (fixed1), L_Up, 64, 312);
gtk_widget_set_size_request (L_Up, 64, 24);
L_Left = gtk_button_new_with_mnemonic (_("Left"));
gtk_widget_set_name (L_Left, "L_Left");
gtk_widget_show (L_Left);
gtk_fixed_put (GTK_FIXED (fixed1), L_Left, 0, 384);
gtk_widget_set_size_request (L_Left, 64, 24);
L_Right = gtk_button_new_with_mnemonic (_("Right"));
gtk_widget_set_name (L_Right, "L_Right");
gtk_widget_show (L_Right);
gtk_fixed_put (GTK_FIXED (fixed1), L_Right, 128, 384);
gtk_widget_set_size_request (L_Right, 64, 24);
label3 = gtk_label_new (_("Analog Controls (move mouse or analog joystick to select)"));
gtk_widget_set_name (label3, "label3");
gtk_widget_show (label3);
gtk_fixed_put (GTK_FIXED (fixed1), label3, 72, 256);
gtk_widget_set_size_request (label3, 400, 24);
gtk_label_set_line_wrap (GTK_LABEL (label3), TRUE);
gtk_label_set_single_line_mode (GTK_LABEL (label3), TRUE);
Analog = gtk_button_new_with_mnemonic (_("Analog"));
gtk_widget_set_name (Analog, "Analog");
gtk_widget_show (Analog);
gtk_fixed_put (GTK_FIXED (fixed1), Analog, 240, 208);
gtk_widget_set_size_request (Analog, 64, 24);
label6 = gtk_label_new (_("(Note: The analog key controls and joystick controls do not work well together currently, and should not be mixed. )"));
gtk_widget_set_name (label6, "label6");
gtk_widget_show (label6);
gtk_fixed_put (GTK_FIXED (fixed1), label6, 56, 280);
gtk_widget_set_size_request (label6, 448, 32);
gtk_label_set_justify (GTK_LABEL (label6), GTK_JUSTIFY_CENTER);
gtk_label_set_line_wrap (GTK_LABEL (label6), TRUE);
dialog_action_area1 = GTK_DIALOG (Conf)->action_area;
gtk_widget_set_name (dialog_action_area1, "dialog_action_area1");
gtk_widget_show (dialog_action_area1);
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);
okbutton1 = gtk_button_new_from_stock ("gtk-ok");
gtk_widget_set_name (okbutton1, "okbutton1");
gtk_widget_show (okbutton1);
gtk_dialog_add_action_widget (GTK_DIALOG (Conf), okbutton1, GTK_RESPONSE_OK);
GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);
cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
gtk_widget_set_name (cancelbutton1, "cancelbutton1");
gtk_widget_show (cancelbutton1);
gtk_dialog_add_action_widget (GTK_DIALOG (Conf), cancelbutton1, GTK_RESPONSE_CANCEL);
GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);
g_signal_connect ((gpointer) PAD1, "clicked",
G_CALLBACK (OnConf_Pad1),
NULL);
g_signal_connect ((gpointer) PAD2, "clicked",
G_CALLBACK (OnConf_Pad2),
NULL);
g_signal_connect ((gpointer) PAD3, "clicked",
G_CALLBACK (OnConf_Pad3),
NULL);
g_signal_connect ((gpointer) PAD4, "clicked",
G_CALLBACK (OnConf_Pad4),
NULL);
g_signal_connect ((gpointer) joydevicescombo, "changed",
G_CALLBACK (on_joydevicescombo_changed),
NULL);
g_signal_connect ((gpointer) R3, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) Select, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) Start, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) Square, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) Circle, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) L2, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) L1, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) Down, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) Up, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) Left, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) Right, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) R1, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) R2, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) Triangle, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) Cross, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) L3, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) checkbutton_reversery, "toggled",
G_CALLBACK (on_checkbutton_reversery_toggled),
NULL);
g_signal_connect ((gpointer) checkbutton_reverserx, "toggled",
G_CALLBACK (on_checkbutton_reverserx_toggled),
NULL);
g_signal_connect ((gpointer) R_Down, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) Ry, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) Rx, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) R_Up, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) R_Right, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) R_Left, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) forcefeedback, "toggled",
G_CALLBACK (on_forcefeedback_toggled),
NULL);
g_signal_connect ((gpointer) checkbutton_reverselx, "toggled",
G_CALLBACK (on_checkbutton_reverselx_toggled),
NULL);
g_signal_connect ((gpointer) checkbutton_reversely, "toggled",
G_CALLBACK (on_checkbutton_reversely_toggled),
NULL);
g_signal_connect ((gpointer) L_Down, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) Ly, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) Lx, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) L_Up, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) L_Left, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) L_Right, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) Analog, "clicked",
G_CALLBACK (OnConf_Key),
NULL);
g_signal_connect ((gpointer) okbutton1, "clicked",
G_CALLBACK (OnConf_Ok),
NULL);
g_signal_connect ((gpointer) cancelbutton1, "clicked",
G_CALLBACK (OnConf_Cancel),
NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */
GLADE_HOOKUP_OBJECT_NO_REF (Conf, Conf, "Conf");
GLADE_HOOKUP_OBJECT_NO_REF (Conf, dialog_vbox1, "dialog_vbox1");
GLADE_HOOKUP_OBJECT (Conf, vbox1, "vbox1");
GLADE_HOOKUP_OBJECT (Conf, frame1, "frame1");
GLADE_HOOKUP_OBJECT (Conf, alignment1, "alignment1");
GLADE_HOOKUP_OBJECT (Conf, hbox1, "hbox1");
GLADE_HOOKUP_OBJECT (Conf, PAD1, "PAD1");
GLADE_HOOKUP_OBJECT (Conf, PAD2, "PAD2");
GLADE_HOOKUP_OBJECT (Conf, PAD3, "PAD3");
GLADE_HOOKUP_OBJECT (Conf, PAD4, "PAD4");
GLADE_HOOKUP_OBJECT (Conf, label2, "label2");
GLADE_HOOKUP_OBJECT (Conf, vbox2, "vbox2");
GLADE_HOOKUP_OBJECT (Conf, label5, "label5");
GLADE_HOOKUP_OBJECT (Conf, joydevicescombo, "joydevicescombo");
GLADE_HOOKUP_OBJECT (Conf, fixed1, "fixed1");
GLADE_HOOKUP_OBJECT (Conf, eL2, "eL2");
GLADE_HOOKUP_OBJECT (Conf, eL1, "eL1");
GLADE_HOOKUP_OBJECT (Conf, eSelect, "eSelect");
GLADE_HOOKUP_OBJECT (Conf, eStart, "eStart");
GLADE_HOOKUP_OBJECT (Conf, eUp, "eUp");
GLADE_HOOKUP_OBJECT (Conf, eRight, "eRight");
GLADE_HOOKUP_OBJECT (Conf, eLeft, "eLeft");
GLADE_HOOKUP_OBJECT (Conf, eDown, "eDown");
GLADE_HOOKUP_OBJECT (Conf, eR2, "eR2");
GLADE_HOOKUP_OBJECT (Conf, eR1, "eR1");
GLADE_HOOKUP_OBJECT (Conf, eAnalog, "eAnalog");
GLADE_HOOKUP_OBJECT (Conf, eSquare, "eSquare");
GLADE_HOOKUP_OBJECT (Conf, eTriangle, "eTriangle");
GLADE_HOOKUP_OBJECT (Conf, eCircle, "eCircle");
GLADE_HOOKUP_OBJECT (Conf, eCross, "eCross");
GLADE_HOOKUP_OBJECT (Conf, eR3, "eR3");
GLADE_HOOKUP_OBJECT (Conf, eL3, "eL3");
GLADE_HOOKUP_OBJECT (Conf, eRx, "eRx");
GLADE_HOOKUP_OBJECT (Conf, eLx, "eLx");
GLADE_HOOKUP_OBJECT (Conf, eRy, "eRy");
GLADE_HOOKUP_OBJECT (Conf, eLy, "eLy");
GLADE_HOOKUP_OBJECT (Conf, eL_Up, "eL_Up");
GLADE_HOOKUP_OBJECT (Conf, eL_Left, "eL_Left");
GLADE_HOOKUP_OBJECT (Conf, eL_Right, "eL_Right");
GLADE_HOOKUP_OBJECT (Conf, eL_Down, "eL_Down");
GLADE_HOOKUP_OBJECT (Conf, eR_Up, "eR_Up");
GLADE_HOOKUP_OBJECT (Conf, eR_Left, "eR_Left");
GLADE_HOOKUP_OBJECT (Conf, eR_Right, "eR_Right");
GLADE_HOOKUP_OBJECT (Conf, eR_Down, "eR_Down");
GLADE_HOOKUP_OBJECT (Conf, R3, "R3");
GLADE_HOOKUP_OBJECT (Conf, Select, "Select");
GLADE_HOOKUP_OBJECT (Conf, Start, "Start");
GLADE_HOOKUP_OBJECT (Conf, Square, "Square");
GLADE_HOOKUP_OBJECT (Conf, Circle, "Circle");
GLADE_HOOKUP_OBJECT (Conf, L2, "L2");
GLADE_HOOKUP_OBJECT (Conf, L1, "L1");
GLADE_HOOKUP_OBJECT (Conf, Down, "Down");
GLADE_HOOKUP_OBJECT (Conf, Up, "Up");
GLADE_HOOKUP_OBJECT (Conf, Left, "Left");
GLADE_HOOKUP_OBJECT (Conf, Right, "Right");
GLADE_HOOKUP_OBJECT (Conf, R1, "R1");
GLADE_HOOKUP_OBJECT (Conf, R2, "R2");
GLADE_HOOKUP_OBJECT (Conf, Triangle, "Triangle");
GLADE_HOOKUP_OBJECT (Conf, Cross, "Cross");
GLADE_HOOKUP_OBJECT (Conf, L3, "L3");
GLADE_HOOKUP_OBJECT (Conf, checkbutton_reversery, "checkbutton_reversery");
GLADE_HOOKUP_OBJECT (Conf, checkbutton_reverserx, "checkbutton_reverserx");
GLADE_HOOKUP_OBJECT (Conf, R_Down, "R_Down");
GLADE_HOOKUP_OBJECT (Conf, Ry, "Ry");
GLADE_HOOKUP_OBJECT (Conf, Rx, "Rx");
GLADE_HOOKUP_OBJECT (Conf, R_Up, "R_Up");
GLADE_HOOKUP_OBJECT (Conf, R_Right, "R_Right");
GLADE_HOOKUP_OBJECT (Conf, R_Left, "R_Left");
GLADE_HOOKUP_OBJECT (Conf, forcefeedback, "forcefeedback");
GLADE_HOOKUP_OBJECT (Conf, checkbutton_reverselx, "checkbutton_reverselx");
GLADE_HOOKUP_OBJECT (Conf, checkbutton_reversely, "checkbutton_reversely");
GLADE_HOOKUP_OBJECT (Conf, L_Down, "L_Down");
GLADE_HOOKUP_OBJECT (Conf, Ly, "Ly");
GLADE_HOOKUP_OBJECT (Conf, Lx, "Lx");
GLADE_HOOKUP_OBJECT (Conf, L_Up, "L_Up");
GLADE_HOOKUP_OBJECT (Conf, L_Left, "L_Left");
GLADE_HOOKUP_OBJECT (Conf, L_Right, "L_Right");
GLADE_HOOKUP_OBJECT (Conf, label3, "label3");
GLADE_HOOKUP_OBJECT (Conf, Analog, "Analog");
GLADE_HOOKUP_OBJECT (Conf, label6, "label6");
GLADE_HOOKUP_OBJECT_NO_REF (Conf, dialog_action_area1, "dialog_action_area1");
GLADE_HOOKUP_OBJECT (Conf, okbutton1, "okbutton1");
GLADE_HOOKUP_OBJECT (Conf, cancelbutton1, "cancelbutton1");
return Conf;
}

View File

@ -1,6 +0,0 @@
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
GtkWidget* create_About (void);
GtkWidget* create_Conf (void);

View File

@ -1,400 +0,0 @@
/* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "linux.h"
Display *GSdsp;
static const char* s_pGuiKeyMap[] =
{
"L2", "R2", "L1", "R1",
"Triangle", "Circle", "Cross", "Square",
"Select", "L3", "R3", "Start",
"Up", "Right", "Down", "Left",
"Lx", "Rx", "Ly", "Ry",
"L_Up", "L_Right", "L_Down", "L_Left",
"R_Up", "R_Right", "R_Down", "R_Left"
};
string GetLabelFromButton(const char* buttonname)
{
string label = "e";
label += buttonname;
return label;
}
s32 _PADopen(void *pDsp)
{
GSdsp = *(Display**)pDsp;
SetAutoRepeat(false);
return 0;
}
void _PADclose()
{
SetAutoRepeat(true);
vector<JoystickInfo*>::iterator it = s_vjoysticks.begin();
// Delete everything in the vector vjoysticks.
while (it != s_vjoysticks.end())
{
delete *it;
it ++;
}
s_vjoysticks.clear();
}
int _GetJoystickIdFromPAD(int pad)
{
// select the right joystick id
int joyid = -1;
for (int p = 0; p < PADSUBKEYS; p++)
{
for (int i = 0; i < PADKEYS; ++i)
{
u32 temp = conf.keys[(PadEnum[pad][p])][i];
if (IS_JOYSTICK( temp) || IS_JOYBUTTONS(temp))
{
joyid = PAD_GETJOYID(temp);
return joyid;
}
}
}
if (!JoystickIdWithinBounds(joyid))
{
// get first unused joystick
for (joyid = 0; joyid < s_vjoysticks.size(); ++joyid)
{
if (s_vjoysticks[joyid]->GetPAD() < 0) break;
}
}
return joyid;
}
void CALLBACK PADupdate(int pad)
{
// Poll keyboard.
PollForKeyboardInput(pad);
// joystick info
SDL_JoystickUpdate();
for (int i = 0; i < PADKEYS; i++)
{
int key = conf.keys[PadEnum[pad][0]][i];
if (JoystickIdWithinBounds(PAD_GETJOYID(key)))
{
JoystickInfo* pjoy = s_vjoysticks[PAD_GETJOYID(key)];
int pad = (pjoy)->GetPAD();
if (IS_JOYBUTTONS(key))
{
int value = SDL_JoystickGetButton((pjoy)->GetJoy(), PAD_GETJOYBUTTON(key));
if (value)
clear_bit(status[pad], i); // released
else
set_bit(status[pad], i); // pressed
}
else if (IS_JOYSTICK(key))
{
int value = SDL_JoystickGetAxis((pjoy)->GetJoy(), PAD_GETJOYSTICK_AXIS(key));
switch (i)
{
case PAD_LX:
case PAD_LY:
case PAD_RX:
case PAD_RY:
if (abs(value) > (pjoy)->GetDeadzone(value))
Analog::ConfigurePad(i, pad, value);
else
Analog::ResetPad(i, pad);
break;
}
}
#ifdef EXPERIMENTAL_POV_CODE
else if (IS_HAT(key))
{
int value = SDL_JoystickGetHat((pjoy)->GetJoy(), PAD_GETJOYSTICK_AXIS(key));
//PAD_LOG("Hat = %d for key %d\n", PAD_GETPOVDIR(key), key);
if ((value != SDL_HAT_CENTERED) && (PAD_GETHATDIR(key) == value))
{
if ((value == SDL_HAT_UP) || (value == SDL_HAT_RIGHT) || (value == SDL_HAT_DOWN) ||(value == SDL_HAT_LEFT))
{
set_bit(status[pad], i);
PAD_LOG("Registered %s. Set (%d)\n", HatName(value), i);
}
else
{
clear_bit(status[pad], i);
}
}
else
{
clear_bit(status[pad], i);
}
}
#endif
else if (IS_POV(key))
{
int value = SDL_JoystickGetAxis((pjoy)->GetJoy(), PAD_GETJOYSTICK_AXIS(key));
if (PAD_GETPOVSIGN(key) && (value < -2048))
clear_bit(status[pad], i);
else if (!PAD_GETPOVSIGN(key) && (value > 2048))
clear_bit(status[pad], i);
else
set_bit(status[pad], i);
}
}
}
}
void UpdateConf(int pad)
{
initLogging();
s_selectedpad = pad;
int i;
GtkWidget *Btn;
for (i = 0; i < ArraySize(s_pGuiKeyMap); i++)
{
string tmp;
if (s_pGuiKeyMap[i] == NULL) continue;
Btn = lookup_widget(Conf, GetLabelFromButton(s_pGuiKeyMap[i]).c_str());
if (Btn == NULL)
{
PAD_LOG("ZeroPAD: cannot find key %s\n", s_pGuiKeyMap[i]);
continue;
}
if (IS_KEYBOARD(conf.keys[pad][i]))
{
char* pstr = KeysymToChar(PAD_GETKEY(conf.keys[pad][i]));
if (pstr != NULL) tmp = pstr;
}
else if (IS_JOYBUTTONS(conf.keys[pad][i]))
{
int button = PAD_GETJOYBUTTON(conf.keys[pad][i]);
tmp.resize(28);
sprintf(&tmp[0], "JBut %d", button);
}
else if (IS_JOYSTICK(conf.keys[pad][i]))
{
int axis = PAD_GETJOYSTICK_AXIS(conf.keys[pad][i]);
tmp.resize(28);
sprintf(&tmp[0], "JAxis %d", axis);
}
#ifdef EXPERIMENTAL_POV_CODE
else if (IS_HAT(conf.keys[pad][i]))
{
int axis = PAD_GETJOYSTICK_AXIS(conf.keys[pad][i]);
tmp.resize(28);
switch(PAD_GETHATDIR(conf.keys[pad][i]))
{
case SDL_HAT_UP:
sprintf(&tmp[0], "JPOVU-%d", axis);
break;
case SDL_HAT_RIGHT:
sprintf(&tmp[0], "JPOVR-%d", axis);
break;
case SDL_HAT_DOWN:
sprintf(&tmp[0], "JPOVD-%d", axis);
break;
case SDL_HAT_LEFT:
sprintf(&tmp[0], "JPOVL-%d", axis);
break;
}
}
#endif
else if (IS_POV(conf.keys[pad][i]))
{
tmp.resize(28);
sprintf(&tmp[0], "JPOV %d%s", PAD_GETJOYSTICK_AXIS(conf.keys[pad][i]), PAD_GETPOVSIGN(conf.keys[pad][i]) ? "-" : "+");
}
if (tmp.size() > 0)
{
gtk_entry_set_text(GTK_ENTRY(Btn), tmp.c_str());
}
else
gtk_entry_set_text(GTK_ENTRY(Btn), "Unknown");
gtk_object_set_user_data(GTK_OBJECT(Btn), (void*)(PADKEYS * pad + i));
}
// check bounds
int joyid = _GetJoystickIdFromPAD(pad);
if (JoystickIdWithinBounds(joyid))
gtk_combo_box_set_active(GTK_COMBO_BOX(s_devicecombo), joyid); // select the combo
else
gtk_combo_box_set_active(GTK_COMBO_BOX(s_devicecombo), s_vjoysticks.size()); // no gamepad
int padopts = conf.options >> (16 * pad);
set_checked(Conf, "checkbutton_reverselx", padopts & PADOPTION_REVERTLX);
set_checked(Conf, "checkbutton_reversely", padopts & PADOPTION_REVERTLY);
set_checked(Conf, "checkbutton_reverserx", padopts & PADOPTION_REVERTRX);
set_checked(Conf, "checkbutton_reversery", padopts & PADOPTION_REVERTRY);
set_checked(Conf, "forcefeedback", padopts & PADOPTION_FORCEFEEDBACK);
}
GtkWidget* GetLabelWidget(GtkButton *button)
{
const char* buttonname = gtk_widget_get_name(GTK_WIDGET(button));
const char* labelname = GetLabelFromButton(buttonname).c_str();
return lookup_widget(Conf, labelname);
}
int GetLabelId(GtkWidget *label)
{
if (label == NULL)
{
PAD_LOG("couldn't find correct label\n");
return -1;
}
return (int)(uptr)gtk_object_get_user_data(GTK_OBJECT(label));
}
void OnConf_Key(GtkButton *button, gpointer user_data)
{
GtkWidget* label = GetLabelWidget(button);
bool captured = false;
char str[32];
int id = GetLabelId(label);
if (id == -1) return;
int pad = id / PADKEYS;
int key = id % PADKEYS;
// save the joystick states
UpdateJoysticks();
while (!captured)
{
vector<JoystickInfo*>::iterator itjoy;
char *tmp;
if (PollX11Keyboard(tmp, conf.keys[pad][key]))
{
strcpy(str, tmp);
captured = true;
break;
}
SDL_JoystickUpdate();
itjoy = s_vjoysticks.begin();
while ((itjoy != s_vjoysticks.end()) && (!captured))
{
int jbutton, direction;
if ((*itjoy)->PollButtons(jbutton, conf.keys[pad][key]))
{
sprintf(str, "JBut %d", jbutton);
captured = true;
break;
}
bool negative = false;
bool pov = (!((key == PAD_RY) || (key == PAD_LY) || (key == PAD_RX) || (key == PAD_LX)));
if ((*itjoy)->PollAxes(pov, jbutton, negative, conf.keys[pad][key]))
{
if (pov)
sprintf(str, "JPOV %d%s", jbutton, (negative) ? "-" : "+");
else
sprintf(str, "JAxis %d", jbutton);
captured = true;
break;
}
#ifdef EXPERIMENTAL_POV_CODE
if ((*itjoy)->PollHats(jbutton, direction, conf.keys[pad][key]))
{
switch (direction)
{
case SDL_HAT_UP: sprintf(str, "JPOVU-%d", jbutton); break;
case SDL_HAT_RIGHT: sprintf(str, "JPOVR-%d", jbutton); break;
case SDL_HAT_DOWN: sprintf(str, "JPOVD-%d", jbutton); break;
case SDL_HAT_LEFT: sprintf(str, "JPOVL-%d", jbutton); break;
}
captured = true;
break;
}
#endif
itjoy++;
}
}
gtk_entry_set_text(GTK_ENTRY(label), str);
}
void CALLBACK PADconfigure()
{
LoadConfig();
Conf = create_Conf();
// recreate
JoystickInfo::EnumerateJoysticks(s_vjoysticks);
s_devicecombo = lookup_widget(Conf, "joydevicescombo");
// fill the combo
char str[255];
vector<JoystickInfo*>::iterator it = s_vjoysticks.begin();
// Delete everything in the vector vjoysticks.
while (it != s_vjoysticks.end())
{
sprintf(str, "%d: %s - but: %d, axes: %d, hats: %d", (*it)->GetId(), (*it)->GetName().c_str(),
(*it)->GetNumButtons(), (*it)->GetNumAxes(), (*it)->GetNumHats());
gtk_combo_box_append_text(GTK_COMBO_BOX(s_devicecombo), str);
it++;
}
gtk_combo_box_append_text(GTK_COMBO_BOX(s_devicecombo), "No Gamepad");
UpdateConf(0);
gtk_widget_show_all(Conf);
gtk_main();
}

View File

@ -1,41 +0,0 @@
/* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "joystick.h"
#include "keyboard.h"
#include "zeropad.h"
#include <string.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <pthread.h>
extern "C"
{
#include "interface.h"
#include "support.h"
#include "callbacks.h"
}
extern GtkWidget *Conf, *s_devicecombo;
extern string s_strIniPath;
#define is_checked(main_widget, widget_name) (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name))))
#define set_checked(main_widget,widget_name, state) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)), state)

View File

@ -1,144 +0,0 @@
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <gtk/gtk.h>
#include "support.h"
GtkWidget*
lookup_widget (GtkWidget *widget,
const gchar *widget_name)
{
GtkWidget *parent, *found_widget;
for (;;)
{
if (GTK_IS_MENU (widget))
parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
else
parent = widget->parent;
if (!parent)
parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey");
if (parent == NULL)
break;
widget = parent;
}
found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget),
widget_name);
if (!found_widget)
g_warning ("Widget not found: %s", widget_name);
return found_widget;
}
static GList *pixmaps_directories = NULL;
/* Use this function to set the directory containing installed pixmaps. */
void
add_pixmap_directory (const gchar *directory)
{
pixmaps_directories = g_list_prepend (pixmaps_directories,
g_strdup (directory));
}
/* This is an internally used function to find pixmap files. */
static gchar*
find_pixmap_file (const gchar *filename)
{
GList *elem;
/* We step through each of the pixmaps directory to find it. */
elem = pixmaps_directories;
while (elem)
{
gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data,
G_DIR_SEPARATOR_S, filename);
if (g_file_test (pathname, G_FILE_TEST_EXISTS))
return pathname;
g_free (pathname);
elem = elem->next;
}
return NULL;
}
/* This is an internally used function to create pixmaps. */
GtkWidget*
create_pixmap (GtkWidget *widget,
const gchar *filename)
{
gchar *pathname = NULL;
GtkWidget *pixmap;
if (!filename || !filename[0])
return gtk_image_new ();
pathname = find_pixmap_file (filename);
if (!pathname)
{
g_warning (_("Couldn't find pixmap file: %s"), filename);
return gtk_image_new ();
}
pixmap = gtk_image_new_from_file (pathname);
g_free (pathname);
return pixmap;
}
/* This is an internally used function to create pixmaps. */
GdkPixbuf*
create_pixbuf (const gchar *filename)
{
gchar *pathname = NULL;
GdkPixbuf *pixbuf;
GError *error = NULL;
if (!filename || !filename[0])
return NULL;
pathname = find_pixmap_file (filename);
if (!pathname)
{
g_warning (_("Couldn't find pixmap file: %s"), filename);
return NULL;
}
pixbuf = gdk_pixbuf_new_from_file (pathname, &error);
if (!pixbuf)
{
fprintf (stderr, "Failed to load pixbuf file: %s: %s\n",
pathname, error->message);
g_error_free (error);
}
g_free (pathname);
return pixbuf;
}
/* This is used to set ATK action descriptions. */
void
glade_set_atk_action_description (AtkAction *action,
const gchar *action_name,
const gchar *description)
{
gint n_actions, i;
n_actions = atk_action_get_n_actions (action);
for (i = 0; i < n_actions; i++)
{
if (!strcmp (atk_action_get_name (action, i), action_name))
atk_action_set_description (action, i, description);
}
}

View File

@ -1,69 +0,0 @@
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtk/gtk.h>
/*
* Standard gettext macros.
*/
#ifdef ENABLE_NLS
# include <libintl.h>
# undef _
# define _(String) dgettext (PACKAGE, String)
# define Q_(String) g_strip_context ((String), gettext (String))
# ifdef gettext_noop
# define N_(String) gettext_noop (String)
# else
# define N_(String) (String)
# endif
#else
# define textdomain(String) (String)
# define gettext(String) (String)
# define dgettext(Domain,Message) (Message)
# define dcgettext(Domain,Message,Type) (Message)
# define bindtextdomain(Domain,Directory) (Domain)
# define _(String) (String)
# define Q_(String) g_strip_context ((String), (String))
# define N_(String) (String)
#endif
/*
* Public Functions.
*/
/*
* This function returns a widget in a component created by Glade.
* Call it with the toplevel widget in the component (i.e. a window/dialog),
* or alternatively any widget in the component, and the name of the widget
* you want returned.
*/
GtkWidget* lookup_widget (GtkWidget *widget,
const gchar *widget_name);
/* Use this function to set the directory containing installed pixmaps. */
void add_pixmap_directory (const gchar *directory);
/*
* Private Functions.
*/
/* This is used to create the pixmaps used in the interface. */
GtkWidget* create_pixmap (GtkWidget *widget,
const gchar *filename);
/* This is used to create the pixbufs used in the interface. */
GdkPixbuf* create_pixbuf (const gchar *filename);
/* This is used to set ATK action descriptions. */
void glade_set_atk_action_description (AtkAction *action,
const gchar *action_name,
const gchar *description);

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +0,0 @@
# Create a shared library libZeroPAD
AUTOMAKE_OPTIONS = foreign
noinst_LIBRARIES = libZeroPAD.a
INCLUDES = -I@srcdir@/../../common/include
libZeroPAD_a_CXXFLAGS = $(shell pkg-config --cflags gtk+-2.0)
libZeroPAD_a_CFLAGS = $(shell pkg-config --cflags gtk+-2.0)
# Create a shared object by faking an exe (thanks to ODE makefiles)
traplibdir=$(prefix)
if DEBUGBUILD
preext=d
endif
EXEEXT=$(preext)@so_ext@
traplib_PROGRAMS=libZeroPAD
libZeroPAD_SOURCES=
libZeroPAD_DEPENDENCIES = libZeroPAD.a
libZeroPAD_LDFLAGS= @SHARED_LDFLAGS@
libZeroPAD_LDFLAGS+=-Wl,-soname,@ZEROPAD_SONAME@
libZeroPAD_LDADD=$(libZeroPAD_a_OBJECTS)
libZeroPAD_a_SOURCES = joystick.cpp analog.cpp analog.h zeropad.cpp zeropad.h \
Linux/gui.cpp Linux/linux.cpp Linux/support.c Linux/interface.c keyboard.cpp keyboard.h

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioPropertySheet
ProjectType="Visual C++"
Version="8.00"
Name="ProjectRootDir"
>
<UserMacro
Name="SvnRootDir"
Value="$(ProjectRootDir)\..\.."
/>
</VisualStudioPropertySheet>

View File

@ -1,18 +0,0 @@
LIBRARY "ZeroPAD"
EXPORTS
PS2EgetLibType @1
PS2EgetLibName @2
PS2EgetLibVersion2 @3
PADinit @7
PADshutdown @8
PADopen @9
PADclose @10
PADkeyEvent @11
PADstartPoll @12
PADpoll @13
PADquery @16
PADconfigure @17
PADtest @18
PADabout @19
PADupdate @20

View File

@ -1,134 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxresmw.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Neutral (Sys. Default) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUSD)
#ifdef _WIN32
LANGUAGE LANG_NEUTRAL, SUBLANG_SYS_DEFAULT
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_DIALOG1 DIALOGEX 3, 1, 443, 266
STYLE DS_SETFONT | WS_CAPTION | WS_SYSMENU
CAPTION "Pad Settings"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
PUSHBUTTON "OK",IDOK,320,244,56,18,NOT WS_TABSTOP
PUSHBUTTON "Cancel",IDCANCEL,384,244,56,17,NOT WS_TABSTOP
EDITTEXT IDC_ERIGHT,219,31,86,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP,WS_EX_TRANSPARENT
PUSHBUTTON "Start",IDC_START,219,17,86,15,NOT WS_TABSTOP,WS_EX_TRANSPARENT
EDITTEXT IDC_ER2,129,31,86,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP,WS_EX_TRANSPARENT
PUSHBUTTON "Select",IDC_SELECT,129,17,86,15,NOT WS_TABSTOP,WS_EX_TRANSPARENT
EDITTEXT IDC_ECIRCLE,340,214,86,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
PUSHBUTTON "Cross",IDC2_CROSS,340,199,86,15,NOT WS_TABSTOP
EDITTEXT IDC_ETRIANGLE,340,185,86,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
PUSHBUTTON "Square",IDC_SQUARE,340,170,86,15,NOT WS_TABSTOP
EDITTEXT IDC_ESQUARE,340,155,86,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
PUSHBUTTON "Circle",IDC_CIRCLE,340,140,86,15,NOT WS_TABSTOP
EDITTEXT IDC_ECROSS,340,125,86,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
PUSHBUTTON "Triangle",IDC_TRI,340,111,86,15,NOT WS_TABSTOP
EDITTEXT IDC_ER3,340,96,86,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
PUSHBUTTON "R2",IDC_R2,340,81,86,15,NOT WS_TABSTOP
EDITTEXT IDC_ESELECT,340,67,86,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
PUSHBUTTON "R1",IDC_R1,340,52,86,15,NOT WS_TABSTOP
EDITTEXT IDC_EL2,5,214,86,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
PUSHBUTTON "Down",IDC_DOWN,5,199,86,15,NOT WS_TABSTOP
EDITTEXT IDC_EUP,5,185,86,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
PUSHBUTTON "Right",IDC_RIGHT,5,170,86,15,NOT WS_TABSTOP
EDITTEXT IDC_EL1,5,155,86,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
PUSHBUTTON "Left",IDC_LEFT,5,140,86,15,NOT WS_TABSTOP
EDITTEXT IDC_ELEFT,5,125,86,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
PUSHBUTTON "Up",IDC_UP,5,111,86,15,NOT WS_TABSTOP
EDITTEXT IDC_EL3,5,96,86,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
PUSHBUTTON "L2",IDC_L2,5,81,86,15,NOT WS_TABSTOP
EDITTEXT IDC_ESTART,5,67,86,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
PUSHBUTTON "L1",IDC_L1,5,52,86,15,NOT WS_TABSTOP
CONTROL 112,IDC_STATIC,"Static",SS_BITMAP | SS_SUNKEN,94,47,242,183,WS_EX_TRANSPARENT
CONTROL "Tab1",IDC_TABC,"SysTabControl32",0x0,0,0,431,240
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_DIALOG1, DIALOG
BEGIN
BOTTOMMARGIN, 265
END
END
#endif // APSTUDIO_INVOKED
#endif // Neutral (Sys. Default) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Spanish resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ESN)
#ifdef _WIN32
LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_MODERN
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxresmw.h""\r\0"
END
3 TEXTINCLUDE
BEGIN
"\r\0"
END
#endif // APSTUDIO_INVOKED
#endif // Spanish resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -1,361 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="ZeroPAD"
ProjectGUID="{CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}"
RootNamespace="ZeroPAD"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
ConfigurationType="2"
InheritedPropertySheets="..\..\..\common\vsprops\plugin_svnroot.vsprops;.\ProjectRootDir.vsprops;..\..\..\common\vsprops\BaseProperties.vsprops;..\..\..\common\vsprops\3rdpartyDeps.vsprops;..\..\..\common\vsprops\pthreads.vsprops;..\..\..\common\vsprops\CodeGen_Debug.vsprops;..\..\..\common\vsprops\IncrementalLinking.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="_USRDLL;ZEROPAD_EXPORTS"
UsePrecompiledHeader="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="winmm.lib"
OutputFile="$(OutDir)\$(ProjectName)-dbg.dll"
LinkIncremental="2"
IgnoreDefaultLibraryNames=""
ModuleDefinitionFile="ZeroPAD.def"
SubSystem="2"
RandomizedBaseAddress="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
ConfigurationType="2"
InheritedPropertySheets="..\..\..\common\vsprops\plugin_svnroot.vsprops;.\ProjectRootDir.vsprops;..\..\..\common\vsprops\BaseProperties.vsprops;..\..\..\common\vsprops\3rdpartyDeps.vsprops;..\..\..\common\vsprops\CodeGen_Release.vsprops;..\..\..\common\vsprops\pthreads.vsprops"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="NDEBUG;_USRDLL;ZEROPAD_EXPORTS"
UsePrecompiledHeader="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="winmm.lib"
ModuleDefinitionFile="ZeroPAD.def"
SubSystem="2"
RandomizedBaseAddress="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Devel|Win32"
ConfigurationType="2"
InheritedPropertySheets="..\..\..\common\vsprops\plugin_svnroot.vsprops;.\ProjectRootDir.vsprops;..\..\..\common\vsprops\BaseProperties.vsprops;..\..\..\common\vsprops\3rdpartyDeps.vsprops;..\..\..\common\vsprops\pthreads.vsprops;..\..\..\common\vsprops\CodeGen_Devel.vsprops;..\..\..\common\vsprops\IncrementalLinking.vsprops"
CharacterSet="2"
WholeProgramOptimization="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="NDEBUG;_USRDLL;ZEROPAD_EXPORTS"
UsePrecompiledHeader="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="winmm.lib"
OutputFile="$(OutDir)\$(ProjectName)-dev.dll"
ModuleDefinitionFile="ZeroPAD.def"
SubSystem="2"
RandomizedBaseAddress="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\analog.cpp"
>
</File>
<File
RelativePath=".\gui.cpp"
>
</File>
<File
RelativePath="..\keyboard.cpp"
>
</File>
<File
RelativePath=".\win.cpp"
>
</File>
<File
RelativePath="..\zeropad.cpp"
>
</File>
<Filter
Name="Linux"
>
<File
RelativePath="..\Linux\gui.cpp"
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\Linux\linux.cpp"
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
</Filter>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\analog.h"
>
</File>
<File
RelativePath="..\bitwise.h"
>
</File>
<File
RelativePath="..\keyboard.h"
>
</File>
<File
RelativePath="..\PS2Edefs.h"
>
</File>
<File
RelativePath="..\PS2Etypes.h"
>
</File>
<File
RelativePath=".\resource.h"
>
</File>
<File
RelativePath=".\win.h"
>
</File>
<File
RelativePath="..\zeropad.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath=".\ZeroPAD.rc"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,110 +0,0 @@
/* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "win.h"
void SaveConfig()
{
char *szTemp;
char szIniFile[256], szValue[256], szProf[256];
int i, j;
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
szTemp = strrchr(szIniFile, '\\');
if (!szTemp) return;
strcpy(szTemp, "\\inis\\zeropad.ini");
for (j = 0; j < 2; j++)
{
for (i = 0; i < PADKEYS; i++)
{
sprintf(szProf, "%d_%d", j, i);
sprintf(szValue, "%d", conf.keys[j][i]);
WritePrivateProfileString("Interface", szProf, szValue, szIniFile);
}
}
sprintf(szValue, "%u", conf.log);
WritePrivateProfileString("Interface", "Logging", szValue, szIniFile);
}
void LoadConfig()
{
FILE *fp;
char *szTemp;
char szIniFile[256], szValue[256], szProf[256];
int i, j;
memset(&conf, 0, sizeof(conf));
#ifdef _WIN32
conf.keys[0][0] = 'W'; // L2
conf.keys[0][1] = 'O'; // R2
conf.keys[0][2] = 'A'; // L1
conf.keys[0][3] = ';'; // R1
conf.keys[0][4] = 'I'; // TRIANGLE
conf.keys[0][5] = 'L'; // CIRCLE
conf.keys[0][6] = 'K'; // CROSS
conf.keys[0][7] = 'J'; // SQUARE
conf.keys[0][8] = 'V'; // SELECT
conf.keys[0][11] = 'N'; // START
conf.keys[0][12] = 'E'; // UP
conf.keys[0][13] = 'F'; // RIGHT
conf.keys[0][14] = 'D'; // DOWN
conf.keys[0][15] = 'S'; // LEFT
#endif
conf.log = 0;
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
szTemp = strrchr(szIniFile, '\\');
if (!szTemp) return ;
strcpy(szTemp, "\\inis\\zeropad.ini");
fp = fopen("inis\\zeropad.ini", "rt");//check if usbnull.ini really exists
if (!fp)
{
CreateDirectory("inis", NULL);
SaveConfig();//save and return
return ;
}
fclose(fp);
for (j = 0; j < 2; j++)
{
for (i = 0; i < PADKEYS; i++)
{
sprintf(szProf, "%d_%d", j, i);
GetPrivateProfileString("Interface", szProf, NULL, szValue, 20, szIniFile);
conf.keys[j][i] = strtoul(szValue, NULL, 10);
}
}
GetPrivateProfileString("Interface", "Logging", NULL, szValue, 20, szIniFile);
conf.log = strtoul(szValue, NULL, 10);
}
void SysMessage(char *fmt, ...)
{
va_list list;
char tmp[512];
va_start(list, fmt);
vsprintf(tmp, fmt, list);
va_end(list);
MessageBox(0, tmp, "PADwinKeyb Msg", 0);
}

View File

@ -1,70 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by ZeroPAD.rc
//
#define IDD_DIALOG1 110
#define IDB_BITMAP1 112
#define IDC_EL3 1012
#define IDC_L2 1013
#define IDC_ER3 1014
#define IDC_R2 1015
#define IDC_ESTART 1016
#define IDC_L1 1017
#define IDC_ESELECT 1018
#define IDC_R1 1019
#define IDC_ECROSS 1020
#define IDC_TRI 1021
#define IDC_ESQUARE 1022
#define IDC_CIRCLE 1023
#define IDC_ECIRCLE 1024
#define IDC2_CROSS 1025
#define IDC_ETRIANGLE 1026
#define IDC_SQUARE 1027
#define IDC_ER2 1028
#define IDC_SELECT 1029
#define IDC_ER1 1030
#define IDC_L3 1031
#define IDC_EDOWN 1032
#define IDC_R3 1033
#define IDC_ERIGHT 1034
#define IDC_START 1035
#define IDC_ELEFT 1036
#define IDC_UP 1037
#define IDC_EUP 1038
#define IDC_RIGHT 1039
#define IDC_EL2 1040
#define IDC_DOWN 1041
#define IDC_EL1 1042
#define IDC_LEFT 1043
#define IDC_TABC 1044
#define IDC_LAX 1045
#define IDC_LAY 1046
#define IDC_RAX 1047
#define IDC_RAY 1048
#define IDC_SCROSS 1049
#define IDC_CHECK1 1050
#define IDC_LOG 1050
#define IDC_SCIRCLE 1051
#define IDC_SSQUARE 1052
#define IDC_STRIANGLE 1053
#define IDC_SL3 1054
#define IDC_SUP 1055
#define IDC_SDOWN 1056
#define IDC_SLEFT 1057
#define IDC_SRIGHT 1058
#define IDC_SR3 1059
#define IDC_SL1 1060
#define IDC_SL2 1061
#define IDC_SR1 1062
#define IDC_SR2 1063
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 114
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1051
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -1,274 +0,0 @@
/* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "win.h"
using namespace std;
extern u16 status[2];
extern string s_strIniPath;
WNDPROC GSwndProc = NULL;
HWND GShwnd = NULL;
HINSTANCE hInst = NULL;
extern keyEvent event;
s32 _PADopen(void *pDsp)
{
LoadConfig();
if (GShwnd != NULL && GSwndProc != NULL)
{
// revert
SetWindowLongPtr(GShwnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)(GSwndProc));
}
GShwnd = (HWND) * (long*)pDsp;
GSwndProc = (WNDPROC)GetWindowLongPtr(GShwnd, GWLP_WNDPROC);
GSwndProc = ((WNDPROC)SetWindowLongPtr(GShwnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)(PADwndProc)));
return 0;
}
void _PADclose()
{
if (GShwnd != NULL && GSwndProc != NULL)
{
SetWindowLongPtr(GShwnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)(GSwndProc));
GSwndProc = NULL;
GShwnd = NULL;
}
}
// Yes, let's not do anything when pcsx2 asks for us for an update.
// We certainly don't want to update the gamepad information...
void CALLBACK PADupdate(int pad)
{
}
// Most of the values look off in here by either a factor of 10 or 100.
string GetKeyLabel(const int pad, const int index)
{
const int key = conf.keys[pad][index];
char buff[16] = "NONE)";
if (key < 0x100) //IS_KEYBOARD; should be 0x10000
{
if (key == 0)
strcpy(buff, "NONE");
else
{
if (key >= 0x60 && key <= 0x69)
sprintf(buff, "NumPad %c", '0' + key - 0x60);
else
sprintf(buff, "%c", key);
}
}
else if (key >= 0x1000 && key < 0x2000) //IS_JOYBUTTONS; 0x10000 - 0x20000
{
sprintf(buff, "J%d_%d", (key & 0xfff) / 0x100, (key & 0xff) + 1);
}
else if (key >= 0x2000 && key < 0x3000) // IS_JOYSTICK; 0x20000 - 0x30000
{
static const char name[][4] = { "MIN", "MAX" };
const int axis = (key & 0xff);
sprintf(buff, "J%d_AXIS%d_%s", (key & 0xfff) / 0x100, axis / 2, name[axis % 2]);
if (index >= 17 && index <= 20) buff[strlen(buff) -4] = '\0';
}
else if (key >= 0x3000 && key < 0x4000) // IS_POV; 0x30000 - 0x50000
{
static const char name[][8] = { "FORWARD", "RIGHT", "BACK", "LEFT" };
const int pov = (key & 0xff);
sprintf(buff, "J%d_POV%d_%s", (key & 0xfff) / 0x100, pov / 4, name[pov % 4]);
}
return buff;
}
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HWND hWC;
TCITEM tcI;
int i, key;
int numkeys;
//u8* pkeyboard;
static int disabled = 0;
static int padn = 0;
switch (uMsg)
{
case WM_INITDIALOG:
LoadConfig();
padn = 0;
if (conf.log) CheckDlgButton(hW, IDC_LOG, TRUE);
for (i = 0; i < PADKEYS; i++)
{
hWC = GetDlgItem(hW, IDC_L2 + i * 2);
Button_SetText(hWC, GetKeyLabel(padn, i).c_str());
}
hWC = GetDlgItem(hW, IDC_TABC);
tcI.mask = TCIF_TEXT;
tcI.pszText = "PAD 1";
TabCtrl_InsertItem(hWC, 0, &tcI);
tcI.mask = TCIF_TEXT;
tcI.pszText = "PAD 2";
TabCtrl_InsertItem(hWC, 1, &tcI);
return TRUE;
case WM_TIMER:
if (disabled)
{
//pkeyboard = SDL_GetKeyState(&numkeys);
// Well, this doesn't exactly work either, but it's close...
numkeys = 256;
for (int i = 0; i < numkeys; ++i)
{
if (GetAsyncKeyState(i))
{
key = i;
break;
}
}
if (key == 0)
{
// check joystick
}
else
{
// Get rid of the expired timer, try to configure the keys, fail horribly,
// and either crash or don't register a keypress.
KillTimer(hW, 0x80);
hWC = GetDlgItem(hW, disabled);
conf.keys[padn][disabled-IDC_L2] = key;
Button_SetText(hWC, GetKeyLabel(padn, disabled - IDC_L2).c_str());
EnableWindow(hWC, TRUE);
disabled = 0;
return TRUE;
}
}
return TRUE;
case WM_COMMAND:
for (i = IDC_L2; i <= IDC_LEFT; i += 2)
{
if (LOWORD(wParam) == i)
{
// A button was pressed
if (disabled)//change selection
EnableWindow(GetDlgItem(hW, disabled), TRUE);
EnableWindow(GetDlgItem(hW, disabled = wParam), FALSE);
SetTimer(hW, 0x80, 2500, NULL);
return TRUE;
}
}
switch (LOWORD(wParam))
{
case IDCANCEL:
KillTimer(hW, 0x80);
EndDialog(hW, TRUE);
return TRUE;
case IDOK:
KillTimer(hW, 0x80);
if (IsDlgButtonChecked(hW, IDC_LOG))
conf.log = 1;
else
conf.log = 0;
SaveConfig();
EndDialog(hW, FALSE);
return TRUE;
}
break;
case WM_NOTIFY:
switch (wParam)
{
case IDC_TABC:
hWC = GetDlgItem(hW, IDC_TABC);
padn = TabCtrl_GetCurSel(hWC);
for (i = 0; i < PADKEYS; i++)
{
hWC = GetDlgItem(hW, IDC_EL3 + i);
Button_SetText(hWC, GetKeyLabel(padn, i).c_str());
}
return TRUE;
}
return FALSE;
}
return FALSE;
}
BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
EndDialog(hW, FALSE);
return TRUE;
}
}
return FALSE;
}
void CALLBACK PADconfigure()
{
INT_PTR ret;
ret = DialogBoxParam(hInst,MAKEINTRESOURCE(IDD_DIALOG1),GetActiveWindow(),(DLGPROC)ConfigureDlgProc,1);
}
void CALLBACK PADabout()
{
SysMessage("Author: zerofrog\nThanks to SSSPSXPad, TwinPAD, and PADwin plugins");
}
s32 CALLBACK PADtest()
{
return 0;
}
BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
DWORD dwReason,
LPVOID lpReserved)
{
hInst = (HINSTANCE)hModule;
return TRUE; // very quick :)
}

View File

@ -1,34 +0,0 @@
/* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <string.h>
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include "resource.h"
#include "../zeropad.h"
#include <pthread.h>
#include <string>
extern void SaveConfig();
extern void LoadConfig();
extern void SysMessage(char *fmt, ...);
extern LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
extern HINSTANCE hInst;

View File

@ -1,163 +0,0 @@
/* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "analog.h"
PADAnalog g_lanalog[NUM_OF_PADS], g_ranalog[NUM_OF_PADS];
namespace Analog
{
u8 Pad(int padvalue, u8 i)
{
switch (padvalue)
{
case PAD_LX:
return g_lanalog[i].x;
break;
case PAD_RX:
return g_ranalog[i].x;
break;
case PAD_LY:
return g_lanalog[i].y;
break;
case PAD_RY:
return g_ranalog[i].y;
break;
default:
return 0;
break;
}
}
void SetPad(int padvalue, u8 i, u8 value)
{
switch (padvalue)
{
case PAD_LX:
g_lanalog[i].x = value;
break;
case PAD_RX:
g_ranalog[i].x = value;
break;
case PAD_LY:
g_lanalog[i].y = value;
break;
case PAD_RY:
g_ranalog[i].y = value;
break;
default:
break;
}
}
void InvertPad(int padvalue, u8 i)
{
SetPad(padvalue, i, -Pad(padvalue, i));
}
void ResetPad(int padvalue, u8 i)
{
SetPad(padvalue, i, 0x80);
}
void Init()
{
for (int i = 0; i < 2; ++i)
{
ResetPad(PAD_LX, i);
ResetPad(PAD_LY, i);
ResetPad(PAD_RX, i);
ResetPad(PAD_RY, i);
}
}
bool RevertPad(u8 padvalue)
{
switch (padvalue)
{
case PAD_LX:
return ((conf.options & PADOPTION_REVERTLX) != 0);
break;
case PAD_RX:
return ((conf.options & PADOPTION_REVERTRX) != 0);
break;
case PAD_LY:
return ((conf.options & PADOPTION_REVERTLY) != 0);
break;
case PAD_RY:
return ((conf.options & PADOPTION_REVERTRY) != 0);
break;
default:
return false;
break;
}
}
void ConfigurePad(int padvalue, u8 i, int value)
{
int temp = Pad(padvalue, i);
SetPad(padvalue, i, value / 256);
if (RevertPad(padvalue)) InvertPad(padvalue, i);
SetPad(padvalue, i, Pad(padvalue, i) + 0x80);
//PAD_LOG("Setting pad[%d]@%d to %d from %d\n", padvalue, i, value, temp);
}
int AnalogToPad(int padvalue)
{
switch (padvalue)
{
case PAD_R_LEFT:
return PAD_RX;
break;
case PAD_R_UP:
return PAD_RY;
break;
case PAD_L_LEFT:
return PAD_LX;
break;
case PAD_L_UP:
return PAD_LY;
break;
case PAD_R_DOWN:
return PAD_RY;
break;
case PAD_R_RIGHT:
return PAD_RX;
break;
case PAD_L_DOWN:
return PAD_LY;
break;
case PAD_L_RIGHT:
return PAD_LX;
break;
}
return 0;
}
}

View File

@ -1,36 +0,0 @@
/* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#pragma once
#define NUM_OF_PADS 2
#include "zeropad.h"
namespace Analog
{
extern void Init();
extern u8 Pad(int padvalue, u8 i);
extern void SetPad(int padvalue, u8 i, u8 value);
extern void InvertPad(int padvalue, u8 i);
extern bool RevertPad(u8 padvalue);
extern void ResetPad(int padvalue, u8 i);
extern void ConfigurePad(int padvalue, u8 i, int value);
extern int KeypadToPad(u8 keypress);
extern int AnalogToPad(int padvalue);
}

View File

@ -1,41 +0,0 @@
/* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
template <class T>
static void __forceinline set_bit(T &value, int bit)
{
value |= (1 << bit);
}
template <class T>
static void __forceinline clear_bit(T &value, int bit)
{
value &= ~(1 << bit);
}
template <class T>
static void __forceinline toggle_bit(T &value, int bit)
{
value ^= (1 << bit);
}
template <class T>
static bool __forceinline test_bit(T &value, int bit)
{
return (value & (1 << bit));
}

View File

@ -1,30 +0,0 @@
#!/bin/sh
curdir=`pwd`
echo ----------------
echo Building ZeroPAD
echo ----------------
if [ $# -gt 0 ] && [ $1 = "all" ]
then
#if possible
aclocal
automake -a
autoconf
chmod +x configure
./configure --prefix=${PCSX2PLUGINS}
make clean
make install
else
make $@
fi
if [ $? -ne 0 ]
then
exit 1
fi
#cp libZeroPAD*.so* ${PCSX2PLUGINS}

View File

@ -1,74 +0,0 @@
AC_INIT(ZeroPAD,0.3,zerofrog@gmail.com)
AM_INIT_AUTOMAKE(ZeroPAD,0.3)
AC_PROG_CC([gcc g++ cl KCC CC cxx cc++ xlC aCC c++])
AC_PROG_CXX([gcc g++ cl KCC CC cxx cc++ xlC aCC c++])
AC_PROG_CPP([gcc g++ cl KCC CC cxx cc++ xlC aCC c++])
AC_PROG_INSTALL
AC_PROG_RANLIB
dnl necessary for compiling assembly
AM_PROG_AS
AC_SUBST(ZEROPAD_CURRENT, 0)
AC_SUBST(ZEROPAD_REVISION, 3)
AC_SUBST(ZEROPAD_AGE, 0)
AC_SUBST(ZEROPAD_RELEASE, [$ZEROPAD_CURRENT].[$ZEROPAD_REVISION].[$ZEROPAD_AGE])
AC_SUBST(ZEROPAD_SONAME, libZeroPAD.so.[$ZEROPAD_CURRENT].[$ZEROPAD_REVISION].[$ZEROPAD_AGE])
CFLAGS=
CXXFLAGS=
CCASFLAGS=
dnl Check for debug build
AC_MSG_CHECKING(debug build)
AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [debug build]),
debug=$enableval,debug=no)
if test "x$debug" == xyes
then
AC_DEFINE(PCSX2_DEBUG,1,[PCSX2_DEBUG])
CFLAGS+="-g -m32 -fpic "
CXXFLAGS+="-g -m32 -fpic "
CCASFLAGS+=" -m32 -fpic "
else
AC_DEFINE(NDEBUG,1,[NDEBUG])
CFLAGS+="-O2 -fomit-frame-pointer -m32 -fpic "
CXXFLAGS+="-O2 -fomit-frame-pointer -m32 -fpic "
CCASFLAGS+=" -m32 -fpic "
fi
AM_CONDITIONAL(DEBUGBUILD, test x$debug = xyes)
AC_MSG_RESULT($debug)
AC_CHECK_FUNCS([ _aligned_malloc _aligned_free ], AC_DEFINE(HAVE_ALIGNED_MALLOC))
AC_CHECK_LIB(SDL,SDL_Init,[])
dnl gtk
AC_MSG_CHECKING(gtk2+)
AC_CHECK_PROG(GTK_CONFIG, pkg-config, pkg-config)
LIBS+=$(pkg-config --libs gtk+-2.0 sdl)
CFLAGS+="$(pkg-config --cflags gtk+-2.0 sdl) "
CXXFLAGS+="$(pkg-config --cflags gtk+-2.0 sdl) "
dnl AC_CHECK_HEADER([SDL/SDL.h], [AC_DEFINE(JOYSTICK_SUPPORT,1)])
dnl assuming linux environment
so_ext=".so.$ZEROPAD_RELEASE"
SHARED_LDFLAGS="-shared"
AC_SUBST(so_ext)
AC_SUBST(SHARED_LDFLAGS)
AC_CHECK_LIB(stdc++,main,[LIBS="$LIBS -lstdc++"])
AC_CHECK_LIB(dl,main,[LIBS="$LIBS -ldl"])
AC_OUTPUT([
Makefile
])
echo "Configuration:"
echo " Debug build? $debug"
echo " x86-64 build? $cpu64"

View File

@ -1,529 +0,0 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2005-05-14.22
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
# 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, 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
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test -f "$tmpdepfile"; then :
else
stripped=`echo "$stripped" | sed 's,^.*/,,'`
tmpdepfile="$stripped.u"
fi
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
if test -f "$tmpdepfile"; then
outname="$stripped.o"
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mecanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View File

@ -1,301 +0,0 @@
/* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "joystick.h"
//////////////////////////
// Joystick definitions //
//////////////////////////
int s_selectedpad = 0;
vector<JoystickInfo*> s_vjoysticks;
static u32 s_bSDLInit = false;
void UpdateJoysticks()
{
vector<JoystickInfo*>::iterator itjoy = s_vjoysticks.begin();
SDL_JoystickUpdate();
// Save everything in the vector s_vjoysticks.
while (itjoy != s_vjoysticks.end())
{
(*itjoy)->SaveState();
itjoy++;
}
}
const char *HatName(int value)
{
switch(value)
{
case SDL_HAT_CENTERED:
return "SDL_HAT_CENTERED";
case SDL_HAT_UP:
return "SDL_HAT_UP";
case SDL_HAT_RIGHT:
return "SDL_HAT_RIGHT";
case SDL_HAT_DOWN:
return "SDL_HAT_DOWN";
case SDL_HAT_LEFT:
return "SDL_HAT_LEFT";
case SDL_HAT_RIGHTUP:
return "SDL_HAT_RIGHTUP";
case SDL_HAT_RIGHTDOWN:
return "SDL_HAT_RIGHTDOWN";
case SDL_HAT_LEFTUP:
return "SDL_HAT_LEFTUP";
case SDL_HAT_LEFTDOWN:
return "SDL_HAT_LEFTDOWN";
default:
return "Unknown";
}
return "Unknown";
}
bool JoystickIdWithinBounds(int joyid)
{
return ((joyid >= 0) && (joyid < (int)s_vjoysticks.size()));
}
// opens handles to all possible joysticks
void JoystickInfo::EnumerateJoysticks(vector<JoystickInfo*>& vjoysticks)
{
if (!s_bSDLInit)
{
#if SDL_VERSION_ATLEAST(1,3,0)
// SDL in 3rdparty wrap X11 call. In order to get x11 symbols loaded
// video must be loaded too.
// Example of X11 symbol are XAutoRepeatOn/XAutoRepeatOff
// Just to play it safe I separate 1.2 and 1.3 but I think it will be
// fine in 1.2 too -- greg
if (SDL_Init(SDL_INIT_JOYSTICK|SDL_INIT_VIDEO) < 0) return;
#else
if (SDL_Init(SDL_INIT_JOYSTICK) < 0) return;
#endif
SDL_JoystickEventState(SDL_QUERY);
s_bSDLInit = true;
}
vector<JoystickInfo*>::iterator it = vjoysticks.begin();
// Delete everything in the vector vjoysticks.
while (it != vjoysticks.end())
{
delete *it;
it ++;
}
vjoysticks.resize(SDL_NumJoysticks());
for (int i = 0; i < (int)vjoysticks.size(); ++i)
{
vjoysticks[i] = new JoystickInfo();
vjoysticks[i]->Init(i, true);
}
// set the pads
for (int pad = 0; pad < 2; ++pad)
{
// select the right joystick id
int joyid = -1;
for (int i = 0; i < PADKEYS; ++i)
{
if (IS_JOYSTICK(conf.keys[pad][i]) || IS_JOYBUTTONS(conf.keys[pad][i]))
{
joyid = PAD_GETJOYID(conf.keys[pad][i]);
break;
}
}
if ((joyid >= 0) && (joyid < (int)s_vjoysticks.size())) s_vjoysticks[joyid]->Assign(pad);
}
}
JoystickInfo::JoystickInfo()
{
joy = NULL;
_id = -1;
pad = -1;
axisrange = 0x7fff;
deadzone = 2000;
}
void JoystickInfo::Destroy()
{
if (joy != NULL)
{
if (SDL_JoystickOpened(_id)) SDL_JoystickClose(joy);
joy = NULL;
}
}
bool JoystickInfo::Init(int id, bool bStartThread)
{
Destroy();
_id = id;
joy = SDL_JoystickOpen(id);
if (joy == NULL)
{
PAD_LOG("failed to open joystick %d\n", id);
return false;
}
numaxes = SDL_JoystickNumAxes(joy);
numbuttons = SDL_JoystickNumButtons(joy);
numhats = SDL_JoystickNumHats(joy);
devname = SDL_JoystickName(id);
vaxisstate.resize(numaxes);
vbuttonstate.resize(numbuttons);
vhatstate.resize(numhats);
//PAD_LOG("There are %d buttons, %d axises, and %d hats.\n", numbuttons, numaxes, numhats);
return true;
}
// assigns a joystick to a pad
void JoystickInfo::Assign(int newpad)
{
if (pad == newpad) return;
pad = newpad;
if (pad >= 0)
{
for (int i = 0; i < PADKEYS; ++i)
{
if (IS_JOYBUTTONS(conf.keys[pad][i]))
{
conf.keys[pad][i] = PAD_JOYBUTTON(_id, PAD_GETJOYBUTTON(conf.keys[pad][i]));
}
else if (IS_JOYSTICK(conf.keys[pad][i]))
{
conf.keys[pad][i] = PAD_JOYSTICK(_id, PAD_GETJOYBUTTON(conf.keys[pad][i]));
}
}
}
}
void JoystickInfo::SaveState()
{
for (int i = 0; i < numbuttons; ++i)
SetButtonState(i, SDL_JoystickGetButton(joy, i));
for (int i = 0; i < numaxes; ++i)
SetAxisState(i, SDL_JoystickGetAxis(joy, i));
for (int i = 0; i < numhats; ++i)
SetHatState(i, SDL_JoystickGetHat(joy, i));
}
void JoystickInfo::TestForce()
{
}
bool JoystickInfo::PollButtons(int &jbutton, u32 &pkey)
{
// MAKE sure to look for changes in the state!!
for (int i = 0; i < GetNumButtons(); ++i)
{
int but = SDL_JoystickGetButton(GetJoy(), i);
if (but != GetButtonState(i))
{
if (!but) // released, we don't really want this
{
SetButtonState(i, 0);
break;
}
pkey = PAD_JOYBUTTON(GetId(), i);
jbutton = i;
return true;
}
}
return false;
}
bool JoystickInfo::PollAxes(bool pov, int &jbutton, bool &negative, u32 &pkey)
{
for (int i = 0; i < GetNumAxes(); ++i)
{
int value = SDL_JoystickGetAxis(GetJoy(), i);
if (value != GetAxisState(i))
{
PAD_LOG("Change in joystick %d: %d.\n", i, value);
if (abs(value) <= GetAxisState(i)) // we don't want this
{
// released, we don't really want this
SetAxisState(i, value);
break;
}
if (abs(value) > 0x3fff)
{
jbutton = i;
if (pov)
{
negative = (value < 0);
pkey = PAD_POV(GetId(), negative, i);
}
else // axis
{
pkey = PAD_JOYSTICK(GetId(), i);
}
return true;
}
}
}
return false;
}
bool JoystickInfo::PollHats(int &jbutton, int &dir, u32 &pkey)
{
#ifdef EXPERIMENTAL_POV_CODE
for (int i = 0; i < GetNumHats(); ++i)
{
int value = SDL_JoystickGetHat(GetJoy(), i);
if (value != SDL_HAT_CENTERED)
{
switch (value)
{
case SDL_HAT_UP:
case SDL_HAT_RIGHT:
case SDL_HAT_DOWN:
case SDL_HAT_LEFT:
pkey = PAD_HAT(GetId(), value, i);
jbutton = i;
dir = value;
PAD_LOG("Hat Pressed!");
return true;
default:
break;
}
}
}
#endif
return false;
}

View File

@ -1,148 +0,0 @@
/* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __JOYSTICK_H__
#define __JOYSTICK_H__
#ifdef __LINUX__
#include <SDL/SDL.h>
#else
#include <SDL.h>
#endif
#include "zeropad.h"
// holds all joystick info
class JoystickInfo
{
public:
JoystickInfo();
~JoystickInfo()
{
Destroy();
}
void Destroy();
// opens handles to all possible joysticks
static void EnumerateJoysticks(vector<JoystickInfo*>& vjoysticks);
bool Init(int id, bool bStartThread = true); // opens a handle and gets information
void Assign(int pad); // assigns a joystick to a pad
void TestForce();
bool PollButtons(int &jbutton, u32 &pkey);
bool PollAxes(bool pov, int &jbutton, bool &negative, u32 &pkey);
bool PollHats(int &jbutton, int &dir, u32 &pkey);
const string& GetName()
{
return devname;
}
int GetNumButtons()
{
return numbuttons;
}
int GetNumAxes()
{
return numaxes;
}
int GetNumHats()
{
return numhats;
}
int GetId()
{
return _id;
}
int GetPAD()
{
return pad;
}
int GetDeadzone(int axis)
{
return deadzone;
}
void SaveState();
int GetButtonState(int i)
{
return vbuttonstate[i];
}
int GetAxisState(int i)
{
return vaxisstate[i];
}
int GetHatState(int i)
{
//PAD_LOG("Getting POV State of %d.\n", i);
return vhatstate[i];
}
void SetButtonState(int i, int state)
{
vbuttonstate[i] = state;
}
void SetAxisState(int i, int value)
{
vaxisstate[i] = value;
}
void SetHatState(int i, int value)
{
//PAD_LOG("We should set %d to %d.\n", i, value);
vhatstate[i] = value;
}
SDL_Joystick* GetJoy()
{
return joy;
}
private:
string devname; // pretty device name
int _id;
int numbuttons, numaxes, numhats;
int axisrange, deadzone;
int pad;
vector<int> vbuttonstate, vaxisstate, vhatstate;
SDL_Joystick* joy;
};
extern int s_selectedpad;
extern vector<JoystickInfo*> s_vjoysticks;
extern void UpdateJoysticks();
extern const char *HatName(int value);
extern bool JoystickIdWithinBounds(int joyid);
#endif

View File

@ -1,284 +0,0 @@
/* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*
* Theoretically, this header is for anything to do with keyboard input.
* Pragmatically, event handing's going in here too.
*/
#include "keyboard.h"
__forceinline int FindKey(int key, int pad)
{
for (int p = 0; p < PADSUBKEYS; p++)
for (int i = 0; i < PADKEYS; i++)
if (key == conf.keys[(PadEnum[pad][p])][i]) return i;
return -1;
}
#ifdef _WINDOWS_
WORD toCharTemp;
#endif
char* KeysymToChar(int keysym)
{
#ifdef __LINUX__
return XKeysymToString(keysym);
#else
// fixed this to return *valid* results, and not some pointer
// to the fourth oblivion-- air
ToAscii((UINT) keysym, NULL, NULL, &toCharTemp, NULL);
return (char*)(&toCharTemp);
#endif
}
void PollForKeyboardInput(int pad)
{
#ifdef __LINUX__
PollForX11KeyboardInput(pad);
#endif
}
void SetAutoRepeat(bool autorep)
{
#ifdef __LINUX__
if (autorep)
XAutoRepeatOn(GSdsp);
else
XAutoRepeatOff(GSdsp);
#endif
}
#ifdef __LINUX__
void PollForX11KeyboardInput(int pad)
{
XEvent E;
KeySym key;
int keyPress = 0, keyRelease = 0;
int i;
// keyboard input
while (XPending(GSdsp) > 0)
{
XNextEvent(GSdsp, &E);
switch (E.type)
{
case KeyPress:
key = XLookupKeysym((XKeyEvent *) & E, 0);
i = FindKey(key, pad);
// Analog controls.
if ((i > PAD_RY) && (i <= PAD_R_LEFT))
{
switch (i)
{
case PAD_R_LEFT:
case PAD_R_UP:
case PAD_L_LEFT:
case PAD_L_UP:
Analog::ConfigurePad(Analog::AnalogToPad(i), pad, DEF_VALUE);
break;
case PAD_R_RIGHT:
case PAD_R_DOWN:
case PAD_L_RIGHT:
case PAD_L_DOWN:
Analog::ConfigurePad(Analog::AnalogToPad(i), pad, -DEF_VALUE);
break;
}
i += 0xff00;
}
if (i != -1)
{
clear_bit(keyRelease, i);
set_bit(keyPress, i);
}
//PAD_LOG("Key pressed:%d\n", i);
event.evt = KEYPRESS;
event.key = key;
break;
case KeyRelease:
key = XLookupKeysym((XKeyEvent *) & E, 0);
i = FindKey(key, pad);
// Analog Controls.
if ((i > PAD_RY) && (i <= PAD_R_LEFT))
{
Analog::ResetPad(Analog::AnalogToPad(i), pad);
i += 0xff00;
}
if (i != -1)
{
clear_bit(keyPress, i);
set_bit(keyRelease, i);
}
event.evt = KEYRELEASE;
event.key = key;
break;
case FocusIn:
XAutoRepeatOff(GSdsp);
break;
case FocusOut:
XAutoRepeatOn(GSdsp);
break;
}
}
UpdateKeys(pad, keyPress, keyRelease);
}
bool PollX11Keyboard(char* &temp, u32 &pkey)
{
GdkEvent *ev = gdk_event_get();
if (ev != NULL)
{
if (ev->type == GDK_KEY_PRESS)
{
if (ev->key.keyval == GDK_Escape)
{
temp = "Unknown";
pkey = NULL;
}
else
{
temp = KeysymToChar(ev->key.keyval);
pkey = ev->key.keyval;
}
return true;
}
}
return false;
}
#else
LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
int keyPress[2] = {0}, keyRelease[2] = {0};
static bool lbutton = false, rbutton = false;
switch (msg)
{
case WM_KEYDOWN:
if (lParam & 0x40000000) return TRUE;
for (int pad = 0; pad < 2; ++pad)
{
for (int i = 0; i < PADKEYS; i++)
{
if (wParam == conf.keys[pad][i])
{
set_bit(keyPress[pad], i);
clear_bit(keyRelease[pad], i);
break;
}
}
}
event.evt = KEYPRESS;
event.key = wParam;
break;
case WM_KEYUP:
for (int pad = 0; pad < 2; ++pad)
{
for (int i = 0; i < PADKEYS; i++)
{
if (wParam == conf.keys[pad][i])
{
set_bit(keyRelease[pad], i);
clear_bit(keyPress[pad], i);
break;
}
}
}
event.evt = KEYRELEASE;
event.key = wParam;
break;
/*case WM_LBUTTONDOWN:
lbutton = true;
break;
case WM_LBUTTONUP:
g_lanalog[0].x = 0x80;
g_lanalog[0].y = 0x80;
g_lanalog[1].x = 0x80;
g_lanalog[1].y = 0x80;
lbutton = false;
break;
case WM_RBUTTONDOWN:
rbutton = true;
break;
case WM_RBUTTONUP:
g_ranalog[0].x = 0x80;
g_ranalog[0].y = 0x80;
g_ranalog[1].x = 0x80;
g_ranalog[1].y = 0x80;
rbutton = false;
break;
case WM_MOUSEMOVE:
if (lbutton)
{
g_lanalog[0].x = LOWORD(lParam) & 254;
g_lanalog[0].y = HIWORD(lParam) & 254;
g_lanalog[1].x = LOWORD(lParam) & 254;
g_lanalog[1].y = HIWORD(lParam) & 254;
}
if (rbutton)
{
g_ranalog[0].x = LOWORD(lParam) & 254;
g_ranalog[0].y = HIWORD(lParam) & 254;
g_ranalog[1].x = LOWORD(lParam) & 254;
g_ranalog[1].y = HIWORD(lParam) & 254;
}
break;*/
case WM_DESTROY:
case WM_QUIT:
event.evt = KEYPRESS;
event.key = VK_ESCAPE;
return GSwndProc(hWnd, msg, wParam, lParam);
default:
return GSwndProc(hWnd, msg, wParam, lParam);
}
for (int pad = 0; pad < 2; ++pad)
{
UpdateKeys(pad, keyPress[pad], keyRelease[pad]);
}
return TRUE;
}
#endif

View File

@ -1,44 +0,0 @@
/* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __KEYBOARD_H__
#define __KEYBOARD_H__
#include "zeropad.h"
#ifdef __LINUX__
#include "Linux/linux.h"
extern Display *GSdsp;
extern void PollForX11KeyboardInput(int pad);
extern bool PollX11Keyboard(char* &temp, u32 &pkey);
#else
extern WNDPROC GSwndProc;
extern HWND GShwnd;
#endif
extern char* KeysymToChar(int keysym);
extern void PollForKeyboardInput(int pad);
extern void SetAutoRepeat(bool autorep);
extern __forceinline int FindKey(int key, int pad);
#endif

View File

@ -1,158 +0,0 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
scriptversion=2005-06-29.22
# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain.
#
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
errstatus=0
dirmode=
usage="\
Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
Create each directory DIR (with mode MODE, if specified), including all
leading file name components.
Report bugs to <bug-automake@gnu.org>."
# process command line arguments
while test $# -gt 0 ; do
case $1 in
-h | --help | --h*) # -h for help
echo "$usage"
exit $?
;;
-m) # -m PERM arg
shift
test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
dirmode=$1
shift
;;
--version)
echo "$0 $scriptversion"
exit $?
;;
--) # stop option processing
shift
break
;;
-*) # unknown option
echo "$usage" 1>&2
exit 1
;;
*) # first non-opt arg
break
;;
esac
done
for file
do
if test -d "$file"; then
shift
else
break
fi
done
case $# in
0) exit 0 ;;
esac
# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
# mkdir -p a/c at the same time, both will detect that a is missing,
# one will create a, then the other will try to create a and die with
# a "File exists" error. This is a problem when calling mkinstalldirs
# from a parallel make. We use --version in the probe to restrict
# ourselves to GNU mkdir, which is thread-safe.
case $dirmode in
'')
if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
echo "mkdir -p -- $*"
exec mkdir -p -- "$@"
else
# On NextStep and OpenStep, the `mkdir' command does not
# recognize any option. It will interpret all options as
# directories to create, and then abort because `.' already
# exists.
test -d ./-p && rmdir ./-p
test -d ./--version && rmdir ./--version
fi
;;
*)
if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
test ! -d ./--version; then
echo "mkdir -m $dirmode -p -- $*"
exec mkdir -m "$dirmode" -p -- "$@"
else
# Clean up after NextStep and OpenStep mkdir.
for d in ./-m ./-p ./--version "./$dirmode";
do
test -d $d && rmdir $d
done
fi
;;
esac
for file
do
case $file in
/*) pathcomp=/ ;;
*) pathcomp= ;;
esac
oIFS=$IFS
IFS=/
set fnord $file
shift
IFS=$oIFS
for d
do
test "x$d" = x && continue
pathcomp=$pathcomp$d
case $pathcomp in
-*) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
else
if test ! -z "$dirmode"; then
echo "chmod $dirmode $pathcomp"
lasterr=
chmod "$dirmode" "$pathcomp" || lasterr=$?
if test ! -z "$lasterr"; then
errstatus=$lasterr
fi
fi
fi
fi
pathcomp=$pathcomp/
done
done
exit $errstatus
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View File

@ -1,612 +0,0 @@
/* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <string.h>
#include <stdarg.h>
#include "zeropad.h"
#ifndef _WIN32
#include <unistd.h>
#else
#include "svnrev.h"
#endif
char libraryName[256];
PADconf conf;
keyEvent event;
u16 status[2];
int pressure;
static keyEvent s_event;
string s_strIniPath = "inis";
string s_strLogPath = "logs";
const u32 version = PS2E_PAD_VERSION;
const u32 revision = 0;
const u32 build = 3; // increase that with each version
int PadEnum[2][2] = {{0, 2}, {1, 3}};
u32 pads = 0;
u8 stdpar[2][20] = {
{0xff, 0x5a, 0xff, 0xff, 0x80, 0x80, 0x80, 0x80,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00},
{0xff, 0x5a, 0xff, 0xff, 0x80, 0x80, 0x80, 0x80,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00}
};
u8 cmd40[2][8] = {
{0xff, 0x5a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x5a},
{0xff, 0x5a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x5a}
};
u8 cmd41[2][8] = {
{0xff, 0x5a, 0xff, 0xff, 0x03, 0x00, 0x00, 0x5a},
{0xff, 0x5a, 0xff, 0xff, 0x03, 0x00, 0x00, 0x5a}
};
u8 unk46[2][8] = {
{0xFF, 0x5A, 0x00, 0x00, 0x01, 0x02, 0x00, 0x0A},
{0xFF, 0x5A, 0x00, 0x00, 0x01, 0x02, 0x00, 0x0A}
};
u8 unk47[2][8] = {
{0xff, 0x5a, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00},
{0xff, 0x5a, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00}
};
u8 unk4c[2][8] = {
{0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
};
u8 unk4d[2][8] = {
{0xff, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
{0xff, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
};
u8 cmd4f[2][8] = {
{0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a},
{0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a}
};
u8 stdcfg[2][8] = {
{0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
}; // 2 & 3 = 0
u8 stdmode[2][8] = {
{0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
};
u8 stdmodel[2][8] = {
{0xff,
0x5a,
0x03, // 03 - dualshock2, 01 - dualshock
0x02, // number of modes
0x01, // current mode: 01 - analog, 00 - digital
0x02,
0x01,
0x00},
{0xff,
0x5a,
0x03, // 03 - dualshock2, 01 - dualshock
0x02, // number of modes
0x01, // current mode: 01 - analog, 00 - digital
0x02,
0x01,
0x00}
};
u8 *buf;
int padID[2];
int padMode[2];
int curPad;
int curByte;
int curCmd;
int cmdLen;
int ds2mode = 0; // DS Mode at start
FILE *padLog = NULL;
pthread_spinlock_t s_mutexStatus;
u32 s_keyPress[2], s_keyRelease[2];
static void InitLibraryName()
{
#ifdef _WIN32
# ifdef PUBLIC
// Public Release!
// Output a simplified string that's just our name:
strcpy(libraryName, "ZeroPAD");
# elif defined( SVN_REV_UNKNOWN )
// Unknown revision.
// Output a name that includes devbuild status but not
// subversion revision tags:
strcpy(libraryName, "ZeroPAD"
# ifdef PCSX2_DEBUG
"-Debug"
# endif
);
# else
// Use TortoiseSVN's SubWCRev utility's output
// to label the specific revision:
sprintf_s(libraryName, "ZeroPAD r%d%s"
# ifdef PCSX2_DEBUG
"-Debug"
# else
"-Dev"
# endif
, SVN_REV,
SVN_MODS ? "m" : ""
);
# endif
#else
// I'll fix up SVN support later. --arcum42
strcpy(libraryName, "ZeroPAD"
# ifdef PCSX2_DEBUG
"-Debug"
# endif
);
#endif
}
u32 CALLBACK PS2EgetLibType()
{
return PS2E_LT_PAD;
}
char* CALLBACK PS2EgetLibName()
{
InitLibraryName();
return libraryName;
}
u32 CALLBACK PS2EgetLibVersion2(u32 type)
{
return (version << 16) | (revision << 8) | build;
}
void __Log(const char *fmt, ...)
{
va_list list;
//if (padLog == NULL || !conf.log) return;
if (padLog == NULL) return;
va_start(list, fmt);
vfprintf(padLog, fmt, list);
va_end(list);
}
void __LogToConsole(const char *fmt, ...)
{
va_list list;
va_start(list, fmt);
if (padLog != NULL) vfprintf(padLog, fmt, list);
printf("ZeroPad: ");
vprintf(fmt, list);
va_end(list);
}
void initLogging()
{
#ifdef PAD_LOG
if (padLog == NULL)
{
const std::string LogFile(s_strLogPath + "/padLog.txt");
padLog = fopen(LogFile.c_str(), "w");
if (padLog == NULL)
SysMessage("Can't create log file %s\n", LogFile.c_str());
else
setvbuf(padLog, NULL, _IONBF, 0);
}
PAD_LOG("PADinit\n");
#endif
}
void CloseLogging()
{
#ifdef PAD_LOG
if (padLog != NULL)
{
fclose(padLog);
padLog = NULL;
}
#endif
}
s32 CALLBACK PADinit(u32 flags)
{
initLogging();
pads |= flags;
status[0] = 0xffff;
status[1] = 0xffff;
LoadConfig();
PADsetMode(0, 0);
PADsetMode(1, 0);
pressure = 100;
Analog::Init();
return 0;
}
void CALLBACK PADshutdown()
{
#ifdef PAD_LOG
if (padLog != NULL)
{
fclose(padLog);
padLog = NULL;
}
#endif
}
s32 CALLBACK PADopen(void *pDsp)
{
memset(&event, 0, sizeof(event));
pthread_spin_init(&s_mutexStatus, PTHREAD_PROCESS_PRIVATE);
s_keyPress[0] = s_keyPress[1] = 0;
s_keyRelease[0] = s_keyRelease[1] = 0;
#ifdef __LINUX__
JoystickInfo::EnumerateJoysticks(s_vjoysticks);
#endif
return _PADopen(pDsp);
}
void CALLBACK PADsetSettingsDir(const char* dir)
{
// Get the path to the ini directory.
s_strIniPath = (dir==NULL) ? "inis/" : dir;
}
void CALLBACK PADsetLogDir(const char* dir)
{
// Get the path to the log directory.
s_strLogPath = (dir==NULL) ? "logs/" : dir;
// Reload the log file after updated the path
CloseLogging();
initLogging();
}
void CALLBACK PADclose()
{
pthread_spin_destroy(&s_mutexStatus);
_PADclose();
}
void _PADupdate(int pad)
{
pthread_spin_lock(&s_mutexStatus);
status[pad] |= s_keyRelease[pad];
status[pad] &= ~s_keyPress[pad];
s_keyRelease[pad] = 0;
s_keyPress[pad] = 0;
pthread_spin_unlock(&s_mutexStatus);
}
void UpdateKeys(int pad, int keyPress, int keyRelease)
{
pthread_spin_lock(&s_mutexStatus);
s_keyPress[pad] |= keyPress;
s_keyPress[pad] &= ~keyRelease;
s_keyRelease[pad] |= keyRelease;
s_keyRelease[pad] &= ~keyPress;
pthread_spin_unlock(&s_mutexStatus);
}
u32 CALLBACK PADquery()
{
return 3; // both
}
void PADsetMode(int pad, int mode)
{
padMode[pad] = mode;
switch (ds2mode)
{
case 0: // dualshock
switch (mode)
{
case 0: // digital
padID[pad] = 0x41;
break;
case 1: // analog
padID[pad] = 0x73;
break;
}
break;
case 1: // dualshock2
switch (mode)
{
case 0: // digital
padID[pad] = 0x41;
break;
case 1: // analog
padID[pad] = 0x79;
break;
}
break;
}
}
u8 CALLBACK PADstartPoll(int pad)
{
//PAD_LOG("PADstartPoll: %d\n", pad);
curPad = pad - 1;
curByte = 0;
return 0xff;
}
u8 _PADpoll(u8 value)
{
u8 button_check = 0, button_check2 = 0;
if (curByte == 0)
{
curByte++;
//PAD_LOG("PADpoll: cmd: %x\n", value);
curCmd = value;
switch (value)
{
case CMD_SET_VREF_PARAM: // DUALSHOCK2 ENABLER
cmdLen = 8;
buf = cmd40[curPad];
return 0xf3;
case CMD_QUERY_DS2_ANALOG_MODE: // QUERY_DS2_ANALOG_MODE
cmdLen = 8;
buf = cmd41[curPad];
return 0xf3;
case CMD_READ_DATA_AND_VIBRATE: // READ_DATA
_PADupdate(curPad);
stdpar[curPad][2] = status[curPad] >> 8;
stdpar[curPad][3] = status[curPad] & 0xff;
stdpar[curPad][4] = Analog::Pad(PAD_RX, curPad);
stdpar[curPad][5] = Analog::Pad(PAD_RY, curPad);
stdpar[curPad][6] = Analog::Pad(PAD_LX, curPad);
stdpar[curPad][7] = Analog::Pad(PAD_LY, curPad);
if (padMode[curPad] == 1)
cmdLen = 20;
else
cmdLen = 4;
button_check2 = stdpar[curPad][2] >> 4;
switch (stdpar[curPad][3])
{
case 0xBF: // X
stdpar[curPad][14] = (pressure * 255) / 100; //0xff/(100/(100-conf.keys[curPad][16]));
break;
case 0xDF: // Circle
stdpar[curPad][13] = (pressure * 255) / 100; //0xff/(100/(100-conf.keys[curPad][17]));
break;
case 0xEF: // Triangle
stdpar[curPad][12] = (pressure * 255) / 100; //0xff/(100/(100-conf.keys[curPad][19]));
break;
case 0x7F: // Square
stdpar[curPad][15] = (pressure * 255) / 100; //0xff/(100/(100-conf.keys[curPad][18]));
break;
case 0xFB: // L1
stdpar[curPad][16] = (pressure * 255) / 100; //0xff/(100/(100-conf.keys[curPad][26]));
break;
case 0xF7: // R1
stdpar[curPad][17] = (pressure * 255) / 100; //0xff/(100/(100-conf.keys[curPad][28]));
break;
case 0xFE: // L2
stdpar[curPad][18] = (pressure * 255) / 100; //0xff/(100/(100-conf.keys[curPad][27]));
break;
case 0xFD: // R2
stdpar[curPad][19] = (pressure * 255) / 100; //0xff/(100/(100-conf.keys[curPad][29]));
break;
default:
stdpar[curPad][14] = 0x00; // Not pressed
stdpar[curPad][13] = 0x00; // Not pressed
stdpar[curPad][12] = 0x00; // Not pressed
stdpar[curPad][15] = 0x00; // Not pressed
stdpar[curPad][16] = 0x00; // Not pressed
stdpar[curPad][17] = 0x00; // Not pressed
stdpar[curPad][18] = 0x00; // Not pressed
stdpar[curPad][19] = 0x00; // Not pressed
break;
}
switch (button_check2)
{
case 0xE: // UP
stdpar[curPad][10] = (pressure * 255) / 100; //0xff/(100/(100-conf.keys[curPad][21]));
break;
case 0xB: // DOWN
stdpar[curPad][11] = (pressure * 255) / 100; //0xff/(100/(100-conf.keys[curPad][22]));
break;
case 0x7: // LEFT
stdpar[curPad][9] = (pressure * 255) / 100; //0xff/(100/(100-conf.keys[curPad][23]));
break;
case 0xD: // RIGHT
stdpar[curPad][8] = (pressure * 255) / 100; //0xff/(100/(100-conf.keys[curPad][24]));
break;
default:
stdpar[curPad][8] = 0x00; // Not pressed
stdpar[curPad][9] = 0x00; // Not pressed
stdpar[curPad][10] = 0x00; // Not pressed
stdpar[curPad][11] = 0x00; // Not pressed
break;
}
buf = stdpar[curPad];
return padID[curPad];
case CMD_CONFIG_MODE: // CONFIG_MODE
cmdLen = 8;
buf = stdcfg[curPad];
if (stdcfg[curPad][3] == 0xff)
return 0xf3;
else
return padID[curPad];
case CMD_SET_MODE_AND_LOCK: // SET_MODE_AND_LOCK
cmdLen = 8;
buf = stdmode[curPad];
return 0xf3;
case CMD_QUERY_MODEL_AND_MODE: // QUERY_MODEL_AND_MODE
cmdLen = 8;
buf = stdmodel[curPad];
buf[4] = padMode[curPad];
return 0xf3;
case CMD_QUERY_ACT: // ??
cmdLen = 8;
buf = unk46[curPad];
return 0xf3;
case CMD_QUERY_COMB: // ??
cmdLen = 8;
buf = unk47[curPad];
return 0xf3;
case CMD_QUERY_MODE: // QUERY_MODE ??
cmdLen = 8;
buf = unk4c[curPad];
return 0xf3;
case CMD_VIBRATION_TOGGLE:
cmdLen = 8;
buf = unk4d[curPad];
return 0xf3;
case CMD_SET_DS2_NATIVE_MODE: // SET_DS2_NATIVE_MODE
cmdLen = 8;
padID[curPad] = 0x79; // setting ds2 mode
ds2mode = 1; // Set DS2 Mode
buf = cmd4f[curPad];
return 0xf3;
default:
PAD_LOG("*PADpoll*: unknown cmd %x\n", value);
break;
}
}
switch (curCmd)
{
case CMD_CONFIG_MODE:
if (curByte == 2)
{
switch (value)
{
case 0:
buf[2] = 0;
buf[3] = 0;
break;
case 1:
buf[2] = 0xff;
buf[3] = 0xff;
break;
}
}
break;
case CMD_SET_MODE_AND_LOCK:
if (curByte == 2)
{
PADsetMode(curPad, value);
}
break;
case CMD_QUERY_ACT:
if (curByte == 2)
{
switch (value)
{
case 0: // default
buf[5] = 0x2;
buf[6] = 0x0;
buf[7] = 0xA;
break;
case 1: // Param std conf change
buf[5] = 0x1;
buf[6] = 0x1;
buf[7] = 0x14;
break;
}
}
break;
case CMD_QUERY_MODE:
if (curByte == 2)
{
switch (value)
{
case 0: // mode 0 - digital mode
buf[5] = 0x4;
break;
case 1: // mode 1 - analog mode
buf[5] = 0x7;
break;
}
}
break;
}
if (curByte >= cmdLen) return 0;
return buf[curByte++];
}
u8 CALLBACK PADpoll(u8 value)
{
u8 ret;
ret = _PADpoll(value);
//PAD_LOG("PADpoll: %x (%d: %x)\n", value, curByte, ret);
return ret;
}
// PADkeyEvent is called every vsync (return NULL if no event)
keyEvent* CALLBACK PADkeyEvent()
{
s_event = event;
event.evt = 0;
event.key = 0;
return &s_event;
}

View File

@ -1,192 +0,0 @@
/* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __PAD_H__
#define __PAD_H__
#define PADdefs
#include "PS2Edefs.h"
#include <stdio.h>
#include <assert.h>
#ifdef _WIN32
#include <windows.h>
#include <windowsx.h>
#else
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#endif
#include <vector>
#include <map>
#include <string>
#include <pthread.h>
using namespace std;
#ifdef __LINUX__
#include "joystick.h"
#endif
#include "analog.h"
#include "bitwise.h"
extern char libraryName[256];
#define IS_KEYBOARD(key) (key < 0x10000)
#define IS_JOYBUTTONS(key) (key >= 0x10000 && key < 0x20000) // buttons
#define IS_JOYSTICK(key) (key >= 0x20000 && key < 0x30000) // analog
#define IS_POV(key) (key >= 0x30000 && key < 0x40000) // uses analog as buttons (cares about sign)
#define IS_HAT(key) (key >= 0x40000 && key < 0x50000) // uses hat as buttons (cares about sign)
//#define IS_MOUSE(key) (key >= 0x40000 && key < 0x50000) // mouse
#define PAD_GETKEY(key) ((key) & 0xffff)
#define PAD_GETJOYID(key) (((key) & 0xf000) >> 12)
#define PAD_GETJOYBUTTON(key) ((key) & 0xff)
#define PAD_GETJOYSTICK_AXIS(key) ((key) & 0xff)
#define PAD_JOYBUTTON(joyid, buttonid) (0x10000 | ((joyid) << 12) | (buttonid))
#define PAD_JOYSTICK(joyid, axisid) (0x20000 | ((joyid) << 12) | (axisid))
#define PAD_POV(joyid, sign, axisid) (0x30000 | ((joyid) << 12) | ((sign) << 8) | (axisid))
#define PAD_HAT(joyid, dir, axisid) (0x40000 | ((joyid) << 12) | ((dir) << 8) | (axisid))
#define PAD_GETPOVSIGN(key) (((key) & 0x100) >> 8)
#define PAD_GETHATDIR(key) (((key) & ~ 0x40000) >> 8)
#ifdef __LINUX__
#define PADKEYS 28
#else
#define PADKEYS 20
#endif
#define PADOPTION_FORCEFEEDBACK 1
#define PADOPTION_REVERTLX 0x2
#define PADOPTION_REVERTLY 0x4
#define PADOPTION_REVERTRX 0x8
#define PADOPTION_REVERTRY 0x10
#ifdef _WIN32
#define PADSUBKEYS 1
#else
#define PADSUBKEYS 2
#endif
//#define EXPERIMENTAL_POV_CODE
extern int PadEnum[2][2];
typedef struct
{
u32 keys[2 * PADSUBKEYS][PADKEYS];
u32 log;
u32 options; // upper 16 bits are for pad2
} PADconf;
typedef struct
{
u8 x, y;
} PADAnalog;
extern PADconf conf;
extern PADAnalog g_lanalog[2], g_ranalog[2];
extern FILE *padLog;
extern void initLogging();
#define PAD_LOG __Log
//#define PAD_LOG __LogToConsole
enum PadCommands
{
CMD_SET_VREF_PARAM = 0x40,
CMD_QUERY_DS2_ANALOG_MODE = 0x41,
CMD_READ_DATA_AND_VIBRATE = 0x42,
CMD_CONFIG_MODE = 0x43,
CMD_SET_MODE_AND_LOCK = 0x44,
CMD_QUERY_MODEL_AND_MODE = 0x45,
CMD_QUERY_ACT = 0x46, // ??
CMD_QUERY_COMB = 0x47, // ??
CMD_QUERY_MODE = 0x4C, // QUERY_MODE ??
CMD_VIBRATION_TOGGLE = 0x4D,
CMD_SET_DS2_NATIVE_MODE = 0x4F // SET_DS2_NATIVE_MODE
};
enum gamePadValues
{
PAD_R_LEFT = 27,
PAD_R_DOWN = 26,
PAD_R_RIGHT = 25,
PAD_R_UP = 24,
PAD_L_LEFT = 23,
PAD_L_DOWN = 22,
PAD_L_RIGHT = 21,
PAD_L_UP = 20,
PAD_RY = 19,
PAD_LY = 18,
PAD_RX = 17,
PAD_LX = 16,
PAD_LEFT = 15,
PAD_DOWN = 14,
PAD_RIGHT = 13,
PAD_UP = 12,
PAD_START = 11,
PAD_R3 = 10,
PAD_L3 = 9,
PAD_SELECT = 8,
PAD_SQUARE = 7,
PAD_CROSS = 6,
PAD_CIRCLE = 5,
PAD_TRIANGLE = 4,
PAD_R1 = 3,
PAD_L1 = 2,
PAD_R2 = 1,
PAD_L2 = 0
};
// Activate bolche's analog controls hack
// DEF_VALUE is the strength you press the control.
// Code taken from http://forums.pcsx2.net/thread-4699.html
#define DEF_VALUE 32766
/* end of pad.h */
extern keyEvent event;
extern u16 status[2];
extern u32 pads;
int POV(u32 direction, u32 angle);
s32 _PADopen(void *pDsp);
void _PADclose();
void _KeyPress(int pad, u32 key);
void _KeyRelease(int pad, u32 key);
void PADsetMode(int pad, int mode);
void _PADupdate(int pad);
void __Log(const char *fmt, ...);
void __LogToConsole(const char *fmt, ...);
void LoadConfig();
void SaveConfig();
void SysMessage(char *fmt, ...);
void UpdateKeys(int pad, int keyPress, int keyRelease);
#endif