git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@32889 e17a0e51-4ae3-4d35-97c3-1a29b211df97
This commit is contained in:
parent
5408345d8b
commit
7d0f136239
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
October 25, 2009 Wei Mingzhi <weimingzhi@gmail.com>
|
||||
|
||||
* plugins/dfinput/cfg.c: Replaced dfinput with new SDL/Xkb-based input plugin.
|
||||
* plugins/dfinput/analog.c: Likewise.
|
||||
* plugins/dfinput/Makefile.in: Likewise.
|
||||
* plugins/dfinput/cfg-gtk2.c: Likewise.
|
||||
* plugins/dfinput/pad.c: Likewise.
|
||||
* plugins/dfinput/sdljoy.c: Likewise.
|
||||
* plugins/dfinput/xkb.c: Likewise.
|
||||
* plugins/dfinput/dfinput.glade2: Likewise.
|
||||
* plugins/dfinput/Makefile.am: Likewise.
|
||||
* plugins/dfinput/pad.h: Likewise.
|
||||
* plugins/dfinput/padjoy.h: Removed.
|
||||
* configure.ac: Check for SDL on configure.
|
||||
* debian/control: Added libsdl1.2-dev to Build-Depends.
|
||||
* po/pt_BR.po, po/zh_TW.po, po/zh_CN.po, po/pcsx.pot: Updated.
|
||||
|
||||
October 24, 2009 Wei Mingzhi <weimingzhi@gmail.com>
|
||||
|
||||
* macosx/Pcsx.xcodeproj/project.pbxproj: Fixed Mac OS X build.
|
||||
|
|
|
@ -153,6 +153,9 @@ PEOPSXGL = @PEOPSXGL@
|
|||
PKG_CONFIG = @PKG_CONFIG@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
|
|
|
@ -10336,6 +10336,188 @@ fi
|
|||
AC_SUBST($1)dnl
|
||||
])
|
||||
|
||||
# Configure paths for SDL
|
||||
# Sam Lantinga 9/21/99
|
||||
# stolen from Manish Singh
|
||||
# stolen back from Frank Belew
|
||||
# stolen from Manish Singh
|
||||
# Shamelessly stolen from Owen Taylor
|
||||
|
||||
dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||
dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_SDL],
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from the sdl-config script
|
||||
dnl
|
||||
AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
|
||||
sdl_prefix="$withval", sdl_prefix="")
|
||||
AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
|
||||
sdl_exec_prefix="$withval", sdl_exec_prefix="")
|
||||
AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
|
||||
, enable_sdltest=yes)
|
||||
|
||||
if test x$sdl_exec_prefix != x ; then
|
||||
sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix"
|
||||
if test x${SDL_CONFIG+set} != xset ; then
|
||||
SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
|
||||
fi
|
||||
fi
|
||||
if test x$sdl_prefix != x ; then
|
||||
sdl_config_args="$sdl_config_args --prefix=$sdl_prefix"
|
||||
if test x${SDL_CONFIG+set} != xset ; then
|
||||
SDL_CONFIG=$sdl_prefix/bin/sdl-config
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$prefix" != xNONE; then
|
||||
PATH="$prefix/bin:$prefix/usr/bin:$PATH"
|
||||
fi
|
||||
AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
|
||||
min_sdl_version=ifelse([$1], ,0.11.0,$1)
|
||||
AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
|
||||
no_sdl=""
|
||||
if test "$SDL_CONFIG" = "no" ; then
|
||||
no_sdl=yes
|
||||
else
|
||||
SDL_CFLAGS=`$SDL_CONFIG $sdl_config_args --cflags`
|
||||
SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs`
|
||||
|
||||
sdl_major_version=`$SDL_CONFIG $sdl_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
sdl_minor_version=`$SDL_CONFIG $sdl_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
if test "x$enable_sdltest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_CXXFLAGS="$CXXFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $SDL_CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
|
||||
LIBS="$LIBS $SDL_LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed SDL is sufficiently new. (Also sanity
|
||||
dnl checks the results of sdl-config to some extent
|
||||
dnl
|
||||
rm -f conf.sdltest
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "SDL.h"
|
||||
|
||||
char*
|
||||
my_strdup (char *str)
|
||||
{
|
||||
char *new_str;
|
||||
|
||||
if (str)
|
||||
{
|
||||
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
|
||||
strcpy (new_str, str);
|
||||
}
|
||||
else
|
||||
new_str = NULL;
|
||||
|
||||
return new_str;
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int major, minor, micro;
|
||||
char *tmp_version;
|
||||
|
||||
/* This hangs on some systems (?)
|
||||
system ("touch conf.sdltest");
|
||||
*/
|
||||
{ FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
|
||||
|
||||
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
||||
tmp_version = my_strdup("$min_sdl_version");
|
||||
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||
printf("%s, bad version string\n", "$min_sdl_version");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (($sdl_major_version > major) ||
|
||||
(($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
|
||||
(($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
|
||||
printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
|
||||
printf("*** best to upgrade to the required version.\n");
|
||||
printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
|
||||
printf("*** to point to the correct copy of sdl-config, and remove the file\n");
|
||||
printf("*** config.cache before re-running configure\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
if test "x$no_sdl" = x ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$SDL_CONFIG" = "no" ; then
|
||||
echo "*** The sdl-config script installed by SDL could not be found"
|
||||
echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
|
||||
echo "*** your path, or set the SDL_CONFIG environment variable to the"
|
||||
echo "*** full path to sdl-config."
|
||||
else
|
||||
if test -f conf.sdltest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run SDL test program, checking why..."
|
||||
CFLAGS="$CFLAGS $SDL_CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
|
||||
LIBS="$LIBS $SDL_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <stdio.h>
|
||||
#include "SDL.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{ return 0; }
|
||||
#undef main
|
||||
#define main K_and_R_C_main
|
||||
], [ return 0; ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding SDL or finding the wrong"
|
||||
echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
|
||||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||
echo "*** is required on your system"
|
||||
echo "***"
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means SDL was incorrectly installed"
|
||||
echo "*** or that you have moved SDL since it was installed. In the latter case, you"
|
||||
echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
SDL_CFLAGS=""
|
||||
SDL_LIBS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
AC_SUBST(SDL_CFLAGS)
|
||||
AC_SUBST(SDL_LIBS)
|
||||
rm -f conf.sdltest
|
||||
])
|
||||
|
||||
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
|
|
|
@ -801,6 +801,9 @@ HAVE_ALSA_FALSE
|
|||
HAVE_ALSA_TRUE
|
||||
HAVE_OSS_FALSE
|
||||
HAVE_OSS_TRUE
|
||||
SDL_LIBS
|
||||
SDL_CFLAGS
|
||||
SDL_CONFIG
|
||||
GLADE2_LIBS
|
||||
GLADE2_CFLAGS
|
||||
GTK2_LIBS
|
||||
|
@ -957,6 +960,9 @@ enable_nls
|
|||
enable_rpath
|
||||
with_libiconv_prefix
|
||||
with_libintl_prefix
|
||||
with_sdl_prefix
|
||||
with_sdl_exec_prefix
|
||||
enable_sdltest
|
||||
enable_alsa
|
||||
enable_opengl
|
||||
enable_dynarec
|
||||
|
@ -1621,6 +1627,7 @@ Optional Features:
|
|||
--disable-libtool-lock avoid locking (might break parallel builds)
|
||||
--disable-nls do not use Native Language Support
|
||||
--disable-rpath do not hardcode runtime library paths
|
||||
--disable-sdltest Do not try to compile and run a test SDL program
|
||||
--enable-alsa use ALSA sound output (default=no)
|
||||
--enable-opengl build OpenGL plugin (default=no)
|
||||
--enable-dynarec=... force selection of dynamic recompiler platform (x86, x86_64, ppc) (default: autodetect)
|
||||
|
@ -1636,6 +1643,8 @@ Optional Packages:
|
|||
--without-libiconv-prefix don't search for libiconv in includedir and libdir
|
||||
--with-libintl-prefix[=DIR] search for libintl in DIR/include and DIR/lib
|
||||
--without-libintl-prefix don't search for libintl in includedir and libdir
|
||||
--with-sdl-prefix=PFX Prefix where SDL is installed (optional)
|
||||
--with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)
|
||||
|
||||
Some influential environment variables:
|
||||
CC C compiler command
|
||||
|
@ -4594,13 +4603,13 @@ if test "${lt_cv_nm_interface+set}" = set; then
|
|||
else
|
||||
lt_cv_nm_interface="BSD nm"
|
||||
echo "int some_variable = 0;" > conftest.$ac_ext
|
||||
(eval echo "\"\$as_me:4597: $ac_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:4606: $ac_compile\"" >&5)
|
||||
(eval "$ac_compile" 2>conftest.err)
|
||||
cat conftest.err >&5
|
||||
(eval echo "\"\$as_me:4600: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
|
||||
(eval echo "\"\$as_me:4609: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
|
||||
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
|
||||
cat conftest.err >&5
|
||||
(eval echo "\"\$as_me:4603: output\"" >&5)
|
||||
(eval echo "\"\$as_me:4612: output\"" >&5)
|
||||
cat conftest.out >&5
|
||||
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
|
||||
lt_cv_nm_interface="MS dumpbin"
|
||||
|
@ -5806,7 +5815,7 @@ ia64-*-hpux*)
|
|||
;;
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '#line 5809 "configure"' > conftest.$ac_ext
|
||||
echo '#line 5818 "configure"' > conftest.$ac_ext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
|
@ -7629,11 +7638,11 @@ else
|
|||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:7632: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:7641: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:7636: \$? = $ac_status" >&5
|
||||
echo "$as_me:7645: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
|
@ -7968,11 +7977,11 @@ else
|
|||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:7971: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:7980: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:7975: \$? = $ac_status" >&5
|
||||
echo "$as_me:7984: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
|
@ -8073,11 +8082,11 @@ else
|
|||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:8076: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:8085: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:8080: \$? = $ac_status" >&5
|
||||
echo "$as_me:8089: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
|
@ -8128,11 +8137,11 @@ else
|
|||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:8131: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:8140: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:8135: \$? = $ac_status" >&5
|
||||
echo "$as_me:8144: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
|
@ -10941,7 +10950,7 @@ else
|
|||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 10944 "configure"
|
||||
#line 10953 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
|
@ -11037,7 +11046,7 @@ else
|
|||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 11040 "configure"
|
||||
#line 11049 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
|
@ -14162,6 +14171,322 @@ $as_echo "yes" >&6; }
|
|||
fi
|
||||
|
||||
|
||||
# Check whether --with-sdl-prefix was given.
|
||||
if test "${with_sdl_prefix+set}" = set; then
|
||||
withval=$with_sdl_prefix; sdl_prefix="$withval"
|
||||
else
|
||||
sdl_prefix=""
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --with-sdl-exec-prefix was given.
|
||||
if test "${with_sdl_exec_prefix+set}" = set; then
|
||||
withval=$with_sdl_exec_prefix; sdl_exec_prefix="$withval"
|
||||
else
|
||||
sdl_exec_prefix=""
|
||||
fi
|
||||
|
||||
# Check whether --enable-sdltest was given.
|
||||
if test "${enable_sdltest+set}" = set; then
|
||||
enableval=$enable_sdltest;
|
||||
else
|
||||
enable_sdltest=yes
|
||||
fi
|
||||
|
||||
|
||||
if test x$sdl_exec_prefix != x ; then
|
||||
sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix"
|
||||
if test x${SDL_CONFIG+set} != xset ; then
|
||||
SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
|
||||
fi
|
||||
fi
|
||||
if test x$sdl_prefix != x ; then
|
||||
sdl_config_args="$sdl_config_args --prefix=$sdl_prefix"
|
||||
if test x${SDL_CONFIG+set} != xset ; then
|
||||
SDL_CONFIG=$sdl_prefix/bin/sdl-config
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$prefix" != xNONE; then
|
||||
PATH="$prefix/bin:$prefix/usr/bin:$PATH"
|
||||
fi
|
||||
# Extract the first word of "sdl-config", so it can be a program name with args.
|
||||
set dummy sdl-config; ac_word=$2
|
||||
{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if test "${ac_cv_path_SDL_CONFIG+set}" = set; then
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
case $SDL_CONFIG in
|
||||
[\\/]* | ?:[\\/]*)
|
||||
ac_cv_path_SDL_CONFIG="$SDL_CONFIG" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
ac_cv_path_SDL_CONFIG="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
test -z "$ac_cv_path_SDL_CONFIG" && ac_cv_path_SDL_CONFIG="no"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
SDL_CONFIG=$ac_cv_path_SDL_CONFIG
|
||||
if test -n "$SDL_CONFIG"; then
|
||||
{ $as_echo "$as_me:$LINENO: result: $SDL_CONFIG" >&5
|
||||
$as_echo "$SDL_CONFIG" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:$LINENO: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
min_sdl_version=1.2.0
|
||||
{ $as_echo "$as_me:$LINENO: checking for SDL - version >= $min_sdl_version" >&5
|
||||
$as_echo_n "checking for SDL - version >= $min_sdl_version... " >&6; }
|
||||
no_sdl=""
|
||||
if test "$SDL_CONFIG" = "no" ; then
|
||||
no_sdl=yes
|
||||
else
|
||||
SDL_CFLAGS=`$SDL_CONFIG $sdl_config_args --cflags`
|
||||
SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs`
|
||||
|
||||
sdl_major_version=`$SDL_CONFIG $sdl_config_args --version | \
|
||||
sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
|
||||
sdl_minor_version=`$SDL_CONFIG $sdl_config_args --version | \
|
||||
sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
|
||||
sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
|
||||
sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
|
||||
if test "x$enable_sdltest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_CXXFLAGS="$CXXFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $SDL_CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
|
||||
LIBS="$LIBS $SDL_LIBS"
|
||||
rm -f conf.sdltest
|
||||
if test "$cross_compiling" = yes; then
|
||||
echo $ac_n "cross compiling; assumed OK... $ac_c"
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "SDL.h"
|
||||
|
||||
char*
|
||||
my_strdup (char *str)
|
||||
{
|
||||
char *new_str;
|
||||
|
||||
if (str)
|
||||
{
|
||||
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
|
||||
strcpy (new_str, str);
|
||||
}
|
||||
else
|
||||
new_str = NULL;
|
||||
|
||||
return new_str;
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int major, minor, micro;
|
||||
char *tmp_version;
|
||||
|
||||
/* This hangs on some systems (?)
|
||||
system ("touch conf.sdltest");
|
||||
*/
|
||||
{ FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
|
||||
|
||||
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
||||
tmp_version = my_strdup("$min_sdl_version");
|
||||
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||
printf("%s, bad version string\n", "$min_sdl_version");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (($sdl_major_version > major) ||
|
||||
(($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
|
||||
(($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
|
||||
printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
|
||||
printf("*** best to upgrade to the required version.\n");
|
||||
printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
|
||||
printf("*** to point to the correct copy of sdl-config, and remove the file\n");
|
||||
printf("*** config.cache before re-running configure\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_ACEOF
|
||||
rm -f conftest$ac_exeext
|
||||
if { (ac_try="$ac_link"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_link") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
|
||||
{ (case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_try") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
:
|
||||
else
|
||||
$as_echo "$as_me: program exited with status $ac_status" >&5
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
( exit $ac_status )
|
||||
no_sdl=yes
|
||||
fi
|
||||
rm -rf conftest.dSYM
|
||||
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
|
||||
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
if test "x$no_sdl" = x ; then
|
||||
{ $as_echo "$as_me:$LINENO: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
:
|
||||
else
|
||||
{ $as_echo "$as_me:$LINENO: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
if test "$SDL_CONFIG" = "no" ; then
|
||||
echo "*** The sdl-config script installed by SDL could not be found"
|
||||
echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
|
||||
echo "*** your path, or set the SDL_CONFIG environment variable to the"
|
||||
echo "*** full path to sdl-config."
|
||||
else
|
||||
if test -f conf.sdltest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run SDL test program, checking why..."
|
||||
CFLAGS="$CFLAGS $SDL_CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
|
||||
LIBS="$LIBS $SDL_LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "SDL.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{ return 0; }
|
||||
#undef main
|
||||
#define main K_and_R_C_main
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return 0;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (ac_try="$ac_link"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_link") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest$ac_exeext && {
|
||||
test "$cross_compiling" = yes ||
|
||||
$as_test_x conftest$ac_exeext
|
||||
}; then
|
||||
echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding SDL or finding the wrong"
|
||||
echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
|
||||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||
echo "*** is required on your system"
|
||||
echo "***"
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means SDL was incorrectly installed"
|
||||
echo "*** or that you have moved SDL since it was installed. In the latter case, you"
|
||||
echo "*** may want to edit the sdl-config script: $SDL_CONFIG"
|
||||
fi
|
||||
|
||||
rm -rf conftest.dSYM
|
||||
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
SDL_CFLAGS=""
|
||||
SDL_LIBS=""
|
||||
{ { $as_echo "$as_me:$LINENO: error: *** SDL not found!" >&5
|
||||
$as_echo "$as_me: error: *** SDL not found!" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
|
||||
|
||||
rm -f conf.sdltest
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@ PKG_CHECK_MODULES(GLIB2, glib-2.0, [], AC_MSG_ERROR([*** glib2 not found!]))
|
|||
PKG_CHECK_MODULES(GTK2, gtk+-2.0, [], AC_MSG_ERROR([*** libgtk2 not found!]))
|
||||
PKG_CHECK_MODULES(GLADE2, libglade-2.0, [], AC_MSG_ERROR([*** libglade2 not found!]))
|
||||
|
||||
AM_PATH_SDL(1.2.0, :, AC_MSG_ERROR([*** SDL not found!]))
|
||||
|
||||
AC_SUBST(GLIB2_CFLAGS)
|
||||
AC_SUBST(GLIB2_LIBS)
|
||||
AC_SUBST(GTK2_CFLAGS)
|
||||
|
|
|
@ -136,6 +136,9 @@ PEOPSXGL = @PEOPSXGL@
|
|||
PKG_CONFIG = @PKG_CONFIG@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
|
|
|
@ -2,7 +2,7 @@ Source: pcsxr
|
|||
Section: otherosfs
|
||||
Priority: extra
|
||||
Maintainer: Wei Mingzhi <whistler@openoffice.org>
|
||||
Build-Depends: debhelper (>= 5), libgtk2.0-dev, libglade2-dev, zlib1g-dev | libz-dev, libxv-dev, libxtst-dev, nasm, libbz2-dev, libgl1-mesa-dev, libxxf86vm-dev, libasound2-dev
|
||||
Build-Depends: debhelper (>= 5), libgtk2.0-dev, libglade2-dev, zlib1g-dev | libz-dev, libxv-dev, libxtst-dev, nasm, libbz2-dev, libgl1-mesa-dev, libxxf86vm-dev, libasound2-dev, libsdl1.2-dev
|
||||
Standards-Version: 3.7.3
|
||||
|
||||
Package: pcsxr
|
||||
|
|
|
@ -129,6 +129,9 @@ PEOPSXGL = @PEOPSXGL@
|
|||
PKG_CONFIG = @PKG_CONFIG@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
|
|
|
@ -150,6 +150,9 @@ PEOPSXGL = @PEOPSXGL@
|
|||
PKG_CONFIG = @PKG_CONFIG@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
|
|
|
@ -245,6 +245,9 @@ PEOPSXGL = @PEOPSXGL@
|
|||
PKG_CONFIG = @PKG_CONFIG@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
|
|
|
@ -136,6 +136,9 @@ PEOPSXGL = @PEOPSXGL@
|
|||
PKG_CONFIG = @PKG_CONFIG@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
|
|
|
@ -164,6 +164,9 @@ PEOPSXGL = @PEOPSXGL@
|
|||
PKG_CONFIG = @PKG_CONFIG@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
|
|
|
@ -3,19 +3,20 @@ libdir = @libdir@/games/psemu/
|
|||
|
||||
lib_LTLIBRARIES = libDFInput.la
|
||||
|
||||
libDFInput_la_SOURCES = pad.c padjoy.h
|
||||
libDFInput_la_SOURCES = cfg.c pad.c pad.h sdljoy.c xkb.c analog.c
|
||||
libDFInput_la_LDFLAGS = -module -avoid-version -lpthread -lX11 \
|
||||
-L/usr/X11R6/lib64 -L/usr/X11R6/lib
|
||||
`sdl-config --libs` -L/usr/X11R6/lib64 -L/usr/X11R6/lib
|
||||
|
||||
INCLUDES = -DPIXMAPDIR=\"${datadir}/pixmaps/\" \
|
||||
-DLOCALE_DIR=\"${datadir}/locale/\" \
|
||||
-DDATADIR=\"${datadir}/psemu/\" \
|
||||
$(GTK2_CFLAGS) $(GLADE2_CFLAGS) -I/usr/X11R6/include \
|
||||
-I../../include
|
||||
-I../../include -I../../libpcsxcore `sdl-config --cflags`
|
||||
|
||||
bin_PROGRAMS = cfgDFInput
|
||||
cfgDFInput_SOURCES = cfg.c padjoy.h
|
||||
cfgDFInput_SOURCES = cfg-gtk2.c pad.h
|
||||
cfgDFInput_LDADD = $(GTK2_LIBS) $(GLADE2_LIBS)
|
||||
cfgDFInput_LDFLAGS = `sdl-config --libs`
|
||||
|
||||
glade_DATA = dfinput.glade2
|
||||
gladedir = $(datadir)/psemu/
|
||||
|
|
|
@ -56,17 +56,20 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
|
|||
libLTLIBRARIES_INSTALL = $(INSTALL)
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
libDFInput_la_LIBADD =
|
||||
am_libDFInput_la_OBJECTS = pad.lo
|
||||
am_libDFInput_la_OBJECTS = cfg.lo pad.lo sdljoy.lo xkb.lo analog.lo
|
||||
libDFInput_la_OBJECTS = $(am_libDFInput_la_OBJECTS)
|
||||
libDFInput_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(libDFInput_la_LDFLAGS) $(LDFLAGS) -o $@
|
||||
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
am_cfgDFInput_OBJECTS = cfg.$(OBJEXT)
|
||||
am_cfgDFInput_OBJECTS = cfg-gtk2.$(OBJEXT)
|
||||
cfgDFInput_OBJECTS = $(am_cfgDFInput_OBJECTS)
|
||||
am__DEPENDENCIES_1 =
|
||||
cfgDFInput_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
|
||||
cfgDFInput_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(cfgDFInput_LDFLAGS) $(LDFLAGS) -o $@
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
|
@ -167,6 +170,9 @@ PEOPSXGL = @PEOPSXGL@
|
|||
PKG_CONFIG = @PKG_CONFIG@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
|
@ -233,18 +239,19 @@ top_build_prefix = @top_build_prefix@
|
|||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
lib_LTLIBRARIES = libDFInput.la
|
||||
libDFInput_la_SOURCES = pad.c padjoy.h
|
||||
libDFInput_la_SOURCES = cfg.c pad.c pad.h sdljoy.c xkb.c analog.c
|
||||
libDFInput_la_LDFLAGS = -module -avoid-version -lpthread -lX11 \
|
||||
-L/usr/X11R6/lib64 -L/usr/X11R6/lib
|
||||
`sdl-config --libs` -L/usr/X11R6/lib64 -L/usr/X11R6/lib
|
||||
|
||||
INCLUDES = -DPIXMAPDIR=\"${datadir}/pixmaps/\" \
|
||||
-DLOCALE_DIR=\"${datadir}/locale/\" \
|
||||
-DDATADIR=\"${datadir}/psemu/\" \
|
||||
$(GTK2_CFLAGS) $(GLADE2_CFLAGS) -I/usr/X11R6/include \
|
||||
-I../../include
|
||||
-I../../include -I../../libpcsxcore `sdl-config --cflags`
|
||||
|
||||
cfgDFInput_SOURCES = cfg.c padjoy.h
|
||||
cfgDFInput_SOURCES = cfg-gtk2.c pad.h
|
||||
cfgDFInput_LDADD = $(GTK2_LIBS) $(GLADE2_LIBS)
|
||||
cfgDFInput_LDFLAGS = `sdl-config --libs`
|
||||
glade_DATA = dfinput.glade2
|
||||
gladedir = $(datadir)/psemu/
|
||||
EXTRA_DIST = $(glade_DATA)
|
||||
|
@ -340,7 +347,7 @@ clean-binPROGRAMS:
|
|||
done
|
||||
cfgDFInput$(EXEEXT): $(cfgDFInput_OBJECTS) $(cfgDFInput_DEPENDENCIES)
|
||||
@rm -f cfgDFInput$(EXEEXT)
|
||||
$(LINK) $(cfgDFInput_OBJECTS) $(cfgDFInput_LDADD) $(LIBS)
|
||||
$(cfgDFInput_LINK) $(cfgDFInput_OBJECTS) $(cfgDFInput_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
@ -348,8 +355,12 @@ mostlyclean-compile:
|
|||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfg.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/analog.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfg-gtk2.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfg.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pad.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdljoy.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xkb.Plo@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright (c) 2009, Wei Mingzhi <whistler@openoffice.org>.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses>.
|
||||
*/
|
||||
|
||||
#include "pad.h"
|
||||
|
||||
void InitAnalog() {
|
||||
g.PadState[0].AnalogStatus[ANALOG_LEFT][ANALOG_X] = 128;
|
||||
g.PadState[0].AnalogStatus[ANALOG_LEFT][ANALOG_Y] = 128;
|
||||
g.PadState[0].AnalogStatus[ANALOG_RIGHT][ANALOG_X] = 128;
|
||||
g.PadState[0].AnalogStatus[ANALOG_RIGHT][ANALOG_Y] = 128;
|
||||
g.PadState[1].AnalogStatus[ANALOG_LEFT][ANALOG_X] = 128;
|
||||
g.PadState[1].AnalogStatus[ANALOG_LEFT][ANALOG_Y] = 128;
|
||||
g.PadState[1].AnalogStatus[ANALOG_RIGHT][ANALOG_X] = 128;
|
||||
g.PadState[1].AnalogStatus[ANALOG_RIGHT][ANALOG_Y] = 128;
|
||||
}
|
||||
|
||||
void CheckAnalog() {
|
||||
int i, j, k, val;
|
||||
uint8_t n;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (g.cfg.PadDef[i].Type != PSE_PAD_TYPE_ANALOGPAD) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (j = 0; j < ANALOG_TOTAL; j++) {
|
||||
for (k = 0; k < 2; k++) {
|
||||
if (g.cfg.PadDef[i].AnalogDef[j][k] == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
n = abs(g.cfg.PadDef[i].AnalogDef[j][k]) - 1;
|
||||
|
||||
val = SDL_JoystickGetAxis(g.PadState[i].JoyDev, n);
|
||||
|
||||
val += 32768;
|
||||
val /= 256;
|
||||
|
||||
if (g.cfg.PadDef[i].AnalogDef[j][k] < 0) {
|
||||
g.PadState[i].AnalogStatus[j][k] = 255 - val;
|
||||
} else {
|
||||
g.PadState[i].AnalogStatus[j][k] = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,666 @@
|
|||
/*
|
||||
* Copyright (c) 2009, Wei Mingzhi <whistler@openoffice.org>.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses>.
|
||||
*/
|
||||
|
||||
#include "cfg.c"
|
||||
|
||||
#include <time.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <glade/glade.h>
|
||||
|
||||
GtkWidget *MainWindow;
|
||||
|
||||
const int DPad[DKEY_TOTAL] = {
|
||||
DKEY_UP,
|
||||
DKEY_DOWN,
|
||||
DKEY_LEFT,
|
||||
DKEY_RIGHT,
|
||||
DKEY_CROSS,
|
||||
DKEY_CIRCLE,
|
||||
DKEY_SQUARE,
|
||||
DKEY_TRIANGLE,
|
||||
DKEY_L1,
|
||||
DKEY_R1,
|
||||
DKEY_L2,
|
||||
DKEY_R2,
|
||||
DKEY_L3,
|
||||
DKEY_R3,
|
||||
DKEY_SELECT,
|
||||
DKEY_START
|
||||
};
|
||||
|
||||
const char *DPadText[DKEY_TOTAL] = {
|
||||
N_("D-Pad Up"),
|
||||
N_("D-Pad Down"),
|
||||
N_("D-Pad Left"),
|
||||
N_("D-Pad Right"),
|
||||
N_("Cross"),
|
||||
N_("Circle"),
|
||||
N_("Square"),
|
||||
N_("Triangle"),
|
||||
N_("L1"),
|
||||
N_("R1"),
|
||||
N_("L2"),
|
||||
N_("R2"),
|
||||
N_("L3"),
|
||||
N_("R3"),
|
||||
N_("Select"),
|
||||
N_("Start")
|
||||
};
|
||||
|
||||
const char *AnalogText[] = {
|
||||
N_("L-Stick X"),
|
||||
N_("L-Stick Y"),
|
||||
N_("R-Stick X"),
|
||||
N_("R-Stick Y")
|
||||
};
|
||||
|
||||
static int GetSelectedKeyIndex(int padnum) {
|
||||
GladeXML *xml;
|
||||
GtkTreeSelection *selection;
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel *model;
|
||||
GtkTreePath *path;
|
||||
gboolean selected;
|
||||
int i;
|
||||
|
||||
xml = glade_get_widget_tree(MainWindow);
|
||||
|
||||
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(glade_xml_get_widget(xml, padnum == 0 ? "treeview1" : "treeview2")));
|
||||
selected = gtk_tree_selection_get_selected(selection, &model, &iter);
|
||||
|
||||
if (!selected) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
path = gtk_tree_model_get_path(model, &iter);
|
||||
i = *gtk_tree_path_get_indices(path);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
static void GetKeyDescription(char *buf, int joynum, int key) {
|
||||
const char *hatname[16] = {_("Centered"), _("Up"), _("Right"), _("Rightup"),
|
||||
_("Down"), "", _("Rightdown"), "", _("Left"), _("Leftup"), "", "",
|
||||
_("Leftdown"), "", "", ""};
|
||||
|
||||
switch (g.cfg.PadDef[joynum].KeyDef[key].JoyEvType) {
|
||||
case BUTTON:
|
||||
sprintf(buf, _("Joystick: Button %d"), g.cfg.PadDef[joynum].KeyDef[key].J.Button);
|
||||
break;
|
||||
|
||||
case AXIS:
|
||||
sprintf(buf, _("Joystick: Axis %d%c"), abs(g.cfg.PadDef[joynum].KeyDef[key].J.Axis) - 1,
|
||||
g.cfg.PadDef[joynum].KeyDef[key].J.Axis > 0 ? '+' : '-');
|
||||
break;
|
||||
|
||||
case HAT:
|
||||
sprintf(buf, _("Joystick: Hat %d %s"), (g.cfg.PadDef[joynum].KeyDef[key].J.Hat >> 8),
|
||||
hatname[g.cfg.PadDef[joynum].KeyDef[key].J.Hat & 0x0F]);
|
||||
break;
|
||||
|
||||
case NONE:
|
||||
default:
|
||||
buf[0] = '\0';
|
||||
break;
|
||||
}
|
||||
|
||||
if (g.cfg.PadDef[joynum].KeyDef[key].Key != 0) {
|
||||
if (buf[0] != '\0') {
|
||||
strcat(buf, " / ");
|
||||
}
|
||||
|
||||
strcat(buf, _("Keyboard:"));
|
||||
strcat(buf, " ");
|
||||
strcat(buf, XKeysymToString(g.cfg.PadDef[joynum].KeyDef[key].Key));
|
||||
} else if (buf[0] == '\0') {
|
||||
strcpy(buf, _("(Not Set)"));
|
||||
}
|
||||
}
|
||||
|
||||
static void GetAnalogDescription(char *buf, int joynum, int analognum, int analogaxis) {
|
||||
int16_t v = g.cfg.PadDef[joynum].AnalogDef[analognum][analogaxis];
|
||||
|
||||
if (v == 0) {
|
||||
sprintf(buf, _("(Not Set)"));
|
||||
} else {
|
||||
sprintf(buf, _("Joystick: Axis %d%s"), abs(v) - 1, (v < 0) ? _(" (Reversed)") : "");
|
||||
}
|
||||
}
|
||||
|
||||
static void UpdateKeyList() {
|
||||
const char *widgetname[2] = {"treeview1", "treeview2"};
|
||||
|
||||
GladeXML *xml;
|
||||
GtkWidget *widget;
|
||||
GtkListStore *store;
|
||||
GtkTreeIter iter;
|
||||
int i, j;
|
||||
char buf[256];
|
||||
|
||||
xml = glade_get_widget_tree(MainWindow);
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
widget = glade_xml_get_widget(xml, widgetname[i]);
|
||||
|
||||
store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
|
||||
|
||||
for (j = 0; j < DKEY_TOTAL; j++) {
|
||||
gtk_list_store_append(store, &iter);
|
||||
GetKeyDescription(buf, i, DPad[j]);
|
||||
gtk_list_store_set(store, &iter, 0, _(DPadText[j]), 1, buf, -1);
|
||||
}
|
||||
|
||||
if (g.cfg.PadDef[i].Type == PSE_PAD_TYPE_ANALOGPAD) {
|
||||
for (j = 0; j < 4; j++) {
|
||||
gtk_list_store_append(store, &iter);
|
||||
GetAnalogDescription(buf, i, j / 2, j % 2);
|
||||
gtk_list_store_set(store, &iter, 0, _(AnalogText[j]), 1, buf, -1);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_tree_view_set_model(GTK_TREE_VIEW(widget), GTK_TREE_MODEL(store));
|
||||
g_object_unref(G_OBJECT(store));
|
||||
gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(widget), TRUE);
|
||||
gtk_widget_show(widget);
|
||||
}
|
||||
}
|
||||
|
||||
static void UpdateKey() {
|
||||
const char *widgetname[2] = {"treeview1", "treeview2"};
|
||||
int i, index;
|
||||
GladeXML *xml;
|
||||
GtkWidget *widget;
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
GValue value = {0, };
|
||||
char buf[256];
|
||||
|
||||
xml = glade_get_widget_tree(MainWindow);
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
index = GetSelectedKeyIndex(i);
|
||||
if (index == -1) continue;
|
||||
|
||||
widget = glade_xml_get_widget(xml, widgetname[i]);
|
||||
gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widget)), &model, &iter);
|
||||
|
||||
if (index < DKEY_TOTAL) {
|
||||
GetKeyDescription(buf, i, DPad[index]);
|
||||
} else {
|
||||
GetAnalogDescription(buf, i, (index - DKEY_TOTAL) / 2, (index - DKEY_TOTAL) % 2);
|
||||
}
|
||||
|
||||
g_value_init(&value, G_TYPE_STRING);
|
||||
g_value_set_string(&value, buf);
|
||||
gtk_list_store_set_value(GTK_LIST_STORE(model), &iter, 1, &value);
|
||||
}
|
||||
}
|
||||
|
||||
static void OnConfigExit(GtkWidget *widget, gpointer user_data) {
|
||||
SaveConfig();
|
||||
|
||||
gtk_widget_destroy(widget);
|
||||
SDL_Quit();
|
||||
|
||||
gtk_exit(0);
|
||||
}
|
||||
|
||||
static void TreeSelectionChanged(GtkTreeSelection *selection, gpointer user_data) {
|
||||
GladeXML *xml;
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel *model;
|
||||
GtkTreePath *path;
|
||||
|
||||
gboolean selected;
|
||||
int i;
|
||||
|
||||
selected = gtk_tree_selection_get_selected(selection, &model, &iter);
|
||||
|
||||
if (selected) {
|
||||
path = gtk_tree_model_get_path(model, &iter);
|
||||
i = *gtk_tree_path_get_indices(path);
|
||||
|
||||
// If a row was selected, and the row is not blank, we can now enable
|
||||
// some of the disabled widgets
|
||||
xml = glade_get_widget_tree(MainWindow);
|
||||
|
||||
if ((int)user_data == 0) {
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(xml, "btnchange1")), TRUE);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(xml, "btnreset1")), TRUE);
|
||||
} else {
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(xml, "btnchange2")), TRUE);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(xml, "btnreset2")), TRUE);
|
||||
}
|
||||
} else {
|
||||
xml = glade_get_widget_tree(MainWindow);
|
||||
|
||||
if ((int)user_data == 0) {
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(xml, "btnchange1")), FALSE);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(xml, "btnreset1")), FALSE);
|
||||
} else {
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(xml, "btnchange2")), FALSE);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(xml, "btnreset2")), FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void OnDeviceChanged(GtkWidget *widget, gpointer user_data) {
|
||||
int n = (int)user_data, current = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
|
||||
current--;
|
||||
g.cfg.PadDef[n].DevNum = current;
|
||||
}
|
||||
|
||||
static void OnTypeChanged(GtkWidget *widget, gpointer user_data) {
|
||||
int n = (int)user_data, current = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
|
||||
g.cfg.PadDef[n].Type = (current == 0 ? PSE_PAD_TYPE_STANDARD : PSE_PAD_TYPE_ANALOGPAD);
|
||||
|
||||
UpdateKeyList();
|
||||
}
|
||||
|
||||
static void OnThreadedToggled(GtkWidget *widget, gpointer user_data) {
|
||||
g.cfg.Threaded = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
||||
}
|
||||
|
||||
static void SysErrorMessage(gchar *primary, gchar *secondary) {
|
||||
GtkWidget *message_dialog;
|
||||
|
||||
message_dialog = gtk_message_dialog_new(NULL,
|
||||
GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, primary, NULL);
|
||||
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG (message_dialog), secondary);
|
||||
|
||||
gtk_dialog_run(GTK_DIALOG(message_dialog));
|
||||
gtk_widget_destroy(message_dialog);
|
||||
}
|
||||
|
||||
static void ReadDKeyEvent(int padnum, int key) {
|
||||
SDL_Joystick *js;
|
||||
time_t t;
|
||||
GdkEvent *ge;
|
||||
int i;
|
||||
Sint16 axis;
|
||||
|
||||
if (g.cfg.PadDef[padnum].DevNum >= 0) {
|
||||
js = SDL_JoystickOpen(g.cfg.PadDef[padnum].DevNum);
|
||||
SDL_JoystickEventState(SDL_IGNORE);
|
||||
} else {
|
||||
js = NULL;
|
||||
}
|
||||
|
||||
t = time(NULL);
|
||||
|
||||
while (time(NULL) < t + 10) {
|
||||
// check joystick events
|
||||
if (js != NULL) {
|
||||
SDL_JoystickUpdate();
|
||||
|
||||
for (i = 0; i < SDL_JoystickNumButtons(js); i++) {
|
||||
if (SDL_JoystickGetButton(js, i)) {
|
||||
g.cfg.PadDef[padnum].KeyDef[key].JoyEvType = BUTTON;
|
||||
g.cfg.PadDef[padnum].KeyDef[key].J.Button = i;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < SDL_JoystickNumAxes(js); i++) {
|
||||
axis = SDL_JoystickGetAxis(js, i);
|
||||
if (abs(axis) > 16383) {
|
||||
g.cfg.PadDef[padnum].KeyDef[key].JoyEvType = AXIS;
|
||||
g.cfg.PadDef[padnum].KeyDef[key].J.Axis = (i + 1) * (axis > 0 ? 1 : -1);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < SDL_JoystickNumHats(js); i++) {
|
||||
axis = SDL_JoystickGetHat(js, i);
|
||||
if (axis != SDL_HAT_CENTERED) {
|
||||
g.cfg.PadDef[padnum].KeyDef[key].JoyEvType = HAT;
|
||||
|
||||
if (axis & SDL_HAT_UP) {
|
||||
g.cfg.PadDef[padnum].KeyDef[key].J.Hat = ((i << 8) | SDL_HAT_UP);
|
||||
} else if (axis & SDL_HAT_DOWN) {
|
||||
g.cfg.PadDef[padnum].KeyDef[key].J.Hat = ((i << 8) | SDL_HAT_DOWN);
|
||||
} else if (axis & SDL_HAT_LEFT) {
|
||||
g.cfg.PadDef[padnum].KeyDef[key].J.Hat = ((i << 8) | SDL_HAT_LEFT);
|
||||
} else if (axis & SDL_HAT_RIGHT) {
|
||||
g.cfg.PadDef[padnum].KeyDef[key].J.Hat = ((i << 8) | SDL_HAT_RIGHT);
|
||||
}
|
||||
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check keyboard events
|
||||
while ((ge = gdk_event_get()) != NULL) {
|
||||
if (ge->type == GDK_KEY_PRESS) {
|
||||
if (ge->key.keyval != XK_Escape) {
|
||||
g.cfg.PadDef[padnum].KeyDef[key].Key = ge->key.keyval;
|
||||
}
|
||||
gdk_event_free(ge);
|
||||
goto end;
|
||||
}
|
||||
gdk_event_free(ge);
|
||||
}
|
||||
|
||||
usleep(5000);
|
||||
}
|
||||
|
||||
end:
|
||||
if (js != NULL) {
|
||||
SDL_JoystickClose(js);
|
||||
}
|
||||
}
|
||||
|
||||
static void ReadAnalogEvent(int padnum, int analognum, int analogaxis) {
|
||||
SDL_Joystick *js;
|
||||
time_t t;
|
||||
GdkEvent *ge;
|
||||
int i;
|
||||
Sint16 axis;
|
||||
|
||||
if (g.cfg.PadDef[padnum].DevNum < 0) {
|
||||
SysErrorMessage(_("Device not set"), _("Please select a valid Joystick Device"));
|
||||
return;
|
||||
}
|
||||
|
||||
js = SDL_JoystickOpen(g.cfg.PadDef[padnum].DevNum);
|
||||
if (js == NULL) {
|
||||
SysErrorMessage(_("Device open error"), _("Unable to open Joystick Device"));
|
||||
return;
|
||||
}
|
||||
|
||||
t = time(NULL);
|
||||
|
||||
while (time(NULL) < t + 10) {
|
||||
// check joystick events
|
||||
SDL_JoystickUpdate();
|
||||
for (i = 0; i < SDL_JoystickNumAxes(js); i++) {
|
||||
axis = SDL_JoystickGetAxis(js, i);
|
||||
if (abs(axis) > 16383) {
|
||||
g.cfg.PadDef[padnum].AnalogDef[analognum][analogaxis] = (i + 1) * (axis > 0 ? 1 : -1);
|
||||
goto end1;
|
||||
}
|
||||
}
|
||||
|
||||
// check keyboard events
|
||||
while ((ge = gdk_event_get()) != NULL) {
|
||||
if (ge->type == GDK_KEY_PRESS) {
|
||||
if (ge->key.keyval == XK_Escape) {
|
||||
gdk_event_free(ge);
|
||||
goto end1;
|
||||
}
|
||||
}
|
||||
gdk_event_free(ge);
|
||||
}
|
||||
|
||||
usleep(5000);
|
||||
}
|
||||
|
||||
end1:
|
||||
SDL_JoystickClose(js);
|
||||
}
|
||||
|
||||
static void OnChangeClicked(GtkWidget *widget, gpointer user_data) {
|
||||
int pad = (int)user_data;
|
||||
int index = GetSelectedKeyIndex(pad);
|
||||
|
||||
if (index == -1) return;
|
||||
|
||||
if (index < DKEY_TOTAL) {
|
||||
ReadDKeyEvent(pad, DPad[index]);
|
||||
} else {
|
||||
index -= DKEY_TOTAL;
|
||||
ReadAnalogEvent(pad, index / 2, index % 2);
|
||||
}
|
||||
|
||||
UpdateKey();
|
||||
}
|
||||
|
||||
static void OnResetClicked(GtkWidget *widget, gpointer user_data) {
|
||||
int pad = (int)user_data;
|
||||
int index = GetSelectedKeyIndex(pad);
|
||||
|
||||
if (index == -1) return;
|
||||
|
||||
if (index < DKEY_TOTAL) {
|
||||
g.cfg.PadDef[pad].KeyDef[DPad[index]].Key = 0;
|
||||
g.cfg.PadDef[pad].KeyDef[DPad[index]].JoyEvType = NONE;
|
||||
g.cfg.PadDef[pad].KeyDef[DPad[index]].J.Button = 0;
|
||||
} else {
|
||||
index -= DKEY_TOTAL;
|
||||
g.cfg.PadDef[pad].AnalogDef[index / 2][index % 2] = 0;
|
||||
}
|
||||
|
||||
UpdateKey();
|
||||
}
|
||||
|
||||
static void PopulateDevList() {
|
||||
const char *widgetname[2] = {"combodev1", "combodev2"};
|
||||
int i, j, n;
|
||||
GtkWidget *widget;
|
||||
GladeXML *xml;
|
||||
GtkTreeIter iter;
|
||||
GtkListStore *store;
|
||||
GtkCellRenderer *renderer;
|
||||
char buf[256];
|
||||
|
||||
xml = glade_get_widget_tree(MainWindow);
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
widget = glade_xml_get_widget(xml, widgetname[i]);
|
||||
|
||||
renderer = gtk_cell_renderer_text_new();
|
||||
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(widget), renderer, FALSE);
|
||||
gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(widget), renderer, "text", 0);
|
||||
|
||||
store = gtk_list_store_new(1, G_TYPE_STRING);
|
||||
|
||||
gtk_list_store_append(store, &iter);
|
||||
gtk_list_store_set(store, &iter, 0, _("None"), -1);
|
||||
|
||||
n = SDL_NumJoysticks();
|
||||
for (j = 0; j < n; j++) {
|
||||
sprintf(buf, "%d: %s", j + 1, SDL_JoystickName(j));
|
||||
gtk_list_store_append(store, &iter);
|
||||
gtk_list_store_set(store, &iter, 0, buf, -1);
|
||||
}
|
||||
|
||||
gtk_combo_box_set_model(GTK_COMBO_BOX(widget), GTK_TREE_MODEL(store));
|
||||
|
||||
n = g.cfg.PadDef[i].DevNum + 1;
|
||||
if (n > SDL_NumJoysticks()) {
|
||||
n = 0;
|
||||
g.cfg.PadDef[i].DevNum = -1;
|
||||
}
|
||||
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(widget), n);
|
||||
}
|
||||
}
|
||||
|
||||
long PADconfigure() {
|
||||
GladeXML *xml;
|
||||
GtkWidget *widget;
|
||||
GtkTreeSelection *treesel;
|
||||
GtkTreeViewColumn *column;
|
||||
GtkCellRenderer *renderer;
|
||||
|
||||
if (SDL_Init(SDL_INIT_JOYSTICK) == -1) {
|
||||
fprintf(stderr, "Failed to initialize SDL!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
LoadConfig();
|
||||
|
||||
xml = glade_xml_new(DATADIR "dfinput.glade2", "CfgWnd", NULL);
|
||||
if (xml == NULL) {
|
||||
g_warning("We could not load the interface!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
MainWindow = glade_xml_get_widget(xml, "CfgWnd");
|
||||
gtk_window_set_title(GTK_WINDOW(MainWindow), _("Gamepad/Keyboard Input Configuration"));
|
||||
|
||||
widget = glade_xml_get_widget(xml, "treeview1");
|
||||
|
||||
// column for key
|
||||
renderer = gtk_cell_renderer_text_new();
|
||||
column = gtk_tree_view_column_new_with_attributes(_("Key"),
|
||||
renderer, "text", 0, NULL);
|
||||
gtk_tree_view_append_column(GTK_TREE_VIEW(widget), column);
|
||||
|
||||
// column for button
|
||||
renderer = gtk_cell_renderer_text_new();
|
||||
column = gtk_tree_view_column_new_with_attributes(_("Button"),
|
||||
renderer, "text", 1, NULL);
|
||||
gtk_tree_view_append_column(GTK_TREE_VIEW(widget), column);
|
||||
|
||||
treesel = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget));
|
||||
gtk_tree_selection_set_mode(treesel, GTK_SELECTION_SINGLE);
|
||||
|
||||
g_signal_connect_data(G_OBJECT(treesel), "changed",
|
||||
G_CALLBACK(TreeSelectionChanged), (gpointer)0, NULL, G_CONNECT_AFTER);
|
||||
|
||||
widget = glade_xml_get_widget(xml, "treeview2");
|
||||
|
||||
// column for key
|
||||
renderer = gtk_cell_renderer_text_new();
|
||||
column = gtk_tree_view_column_new_with_attributes(_("Key"),
|
||||
renderer, "text", 0, NULL);
|
||||
gtk_tree_view_append_column(GTK_TREE_VIEW(widget), column);
|
||||
|
||||
// column for button
|
||||
renderer = gtk_cell_renderer_text_new();
|
||||
column = gtk_tree_view_column_new_with_attributes(_("Button"),
|
||||
renderer, "text", 1, NULL);
|
||||
gtk_tree_view_append_column(GTK_TREE_VIEW(widget), column);
|
||||
|
||||
treesel = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget));
|
||||
gtk_tree_selection_set_mode(treesel, GTK_SELECTION_SINGLE);
|
||||
|
||||
g_signal_connect_data(G_OBJECT(treesel), "changed",
|
||||
G_CALLBACK(TreeSelectionChanged), (gpointer)1, NULL, G_CONNECT_AFTER);
|
||||
|
||||
widget = glade_xml_get_widget(xml, "CfgWnd");
|
||||
g_signal_connect_data(GTK_OBJECT(widget), "delete_event",
|
||||
GTK_SIGNAL_FUNC(OnConfigExit), NULL, NULL, G_CONNECT_AFTER);
|
||||
|
||||
widget = glade_xml_get_widget(xml, "btnclose");
|
||||
g_signal_connect_data(GTK_OBJECT(widget), "clicked",
|
||||
GTK_SIGNAL_FUNC(OnConfigExit), xml, NULL, G_CONNECT_AFTER);
|
||||
|
||||
PopulateDevList();
|
||||
UpdateKeyList();
|
||||
|
||||
widget = glade_xml_get_widget(xml, "checkmt");
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), g.cfg.Threaded);
|
||||
g_signal_connect_data(GTK_OBJECT(widget), "toggled",
|
||||
GTK_SIGNAL_FUNC(OnThreadedToggled), NULL, NULL, G_CONNECT_AFTER);
|
||||
|
||||
widget = glade_xml_get_widget(xml, "combodev1");
|
||||
g_signal_connect_data(GTK_OBJECT(widget), "changed",
|
||||
GTK_SIGNAL_FUNC(OnDeviceChanged), (gpointer)0, NULL, G_CONNECT_AFTER);
|
||||
|
||||
widget = glade_xml_get_widget(xml, "combodev2");
|
||||
g_signal_connect_data(GTK_OBJECT(widget), "changed",
|
||||
GTK_SIGNAL_FUNC(OnDeviceChanged), (gpointer)1, NULL, G_CONNECT_AFTER);
|
||||
|
||||
widget = glade_xml_get_widget(xml, "combotype1");
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(widget),
|
||||
g.cfg.PadDef[0].Type == PSE_PAD_TYPE_ANALOGPAD ? 1 : 0);
|
||||
g_signal_connect_data(GTK_OBJECT(widget), "changed",
|
||||
GTK_SIGNAL_FUNC(OnTypeChanged), (gpointer)0, NULL, G_CONNECT_AFTER);
|
||||
|
||||
widget = glade_xml_get_widget(xml, "combotype2");
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(widget),
|
||||
g.cfg.PadDef[1].Type == PSE_PAD_TYPE_ANALOGPAD ? 1 : 0);
|
||||
g_signal_connect_data(GTK_OBJECT(widget), "changed",
|
||||
GTK_SIGNAL_FUNC(OnTypeChanged), (gpointer)1, NULL, G_CONNECT_AFTER);
|
||||
|
||||
widget = glade_xml_get_widget(xml, "btnchange1");
|
||||
gtk_widget_set_sensitive(widget, FALSE);
|
||||
g_signal_connect_data(GTK_OBJECT(widget), "clicked",
|
||||
GTK_SIGNAL_FUNC(OnChangeClicked), (gpointer)0, NULL, G_CONNECT_AFTER);
|
||||
|
||||
widget = glade_xml_get_widget(xml, "btnreset1");
|
||||
gtk_widget_set_sensitive(widget, FALSE);
|
||||
g_signal_connect_data(GTK_OBJECT(widget), "clicked",
|
||||
GTK_SIGNAL_FUNC(OnResetClicked), (gpointer)0, NULL, G_CONNECT_AFTER);
|
||||
|
||||
widget = glade_xml_get_widget(xml, "btnchange2");
|
||||
gtk_widget_set_sensitive(widget, FALSE);
|
||||
g_signal_connect_data(GTK_OBJECT(widget), "clicked",
|
||||
GTK_SIGNAL_FUNC(OnChangeClicked), (gpointer)1, NULL, G_CONNECT_AFTER);
|
||||
|
||||
widget = glade_xml_get_widget(xml, "btnreset2");
|
||||
gtk_widget_set_sensitive(widget, FALSE);
|
||||
g_signal_connect_data(GTK_OBJECT(widget), "clicked",
|
||||
GTK_SIGNAL_FUNC(OnResetClicked), (gpointer)1, NULL, G_CONNECT_AFTER);
|
||||
|
||||
gtk_widget_show(MainWindow);
|
||||
gtk_main();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void OnAboutExit(GtkWidget *widget, gpointer user_data) {
|
||||
gtk_widget_destroy(widget);
|
||||
gtk_exit(0);
|
||||
}
|
||||
|
||||
void PADabout() {
|
||||
const char *authors[]= {"Wei Mingzhi <weimingzhi@gmail.com>", NULL};
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_about_dialog_new();
|
||||
#ifdef EPSXE
|
||||
gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(widget), "Gamepad/Keyboard Input (ePSXe)");
|
||||
#else
|
||||
gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(widget), "Gamepad/Keyboard Input");
|
||||
#endif
|
||||
gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(widget), "1.1");
|
||||
gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(widget), authors);
|
||||
gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(widget), "http://www.codeplex.com/pcsxr/");
|
||||
|
||||
g_signal_connect_data(GTK_OBJECT(widget), "response",
|
||||
GTK_SIGNAL_FUNC(OnAboutExit), NULL, NULL, G_CONNECT_AFTER);
|
||||
|
||||
gtk_widget_show(widget);
|
||||
gtk_main();
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
#ifdef ENABLE_NLS
|
||||
setlocale(LC_ALL, "");
|
||||
bindtextdomain(GETTEXT_PACKAGE, LOCALE_DIR);
|
||||
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
|
||||
textdomain(GETTEXT_PACKAGE);
|
||||
#endif
|
||||
|
||||
gtk_set_locale();
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
if (argc > 1 && !strcmp(argv[1], "-about")) {
|
||||
PADabout();
|
||||
} else {
|
||||
PADconfigure();
|
||||
}
|
||||
|
||||
gtk_exit(0);
|
||||
return 0;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,31 +1,95 @@
|
|||
<?xml version="1.0"?>
|
||||
<glade-interface>
|
||||
<!-- interface-requires gtk+ 2.6 -->
|
||||
<!-- interface-naming-policy toplevel-contextual -->
|
||||
<widget class="GtkWindow" id="CfgWin">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">Configure Gamepad/Keyboard</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<!-- interface-requires gtk+ 2.12 -->
|
||||
<!-- interface-naming-policy project-wide -->
|
||||
<widget class="GtkDialog" id="CfgWnd">
|
||||
<property name="border_width">5</property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="type_hint">normal</property>
|
||||
<property name="has_separator">False</property>
|
||||
<child internal-child="vbox">
|
||||
<widget class="GtkVBox" id="dialog-vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="border_width">6</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox2">
|
||||
<widget class="GtkNotebook" id="notebook1">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="border_width">6</property>
|
||||
<property name="spacing">50</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label1">
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Pad number:</property>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox6">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label10">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Device:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="combodev1">
|
||||
<property name="width_request">150</property>
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox5">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label5">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Type:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="combotype1">
|
||||
<property name="width_request">200</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="items" translatable="yes">Digital Pad
|
||||
Analog Pad</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
@ -34,29 +98,301 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="radiobutton1">
|
||||
<property name="label" translatable="yes">1</property>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="hscrollbar_policy">automatic</property>
|
||||
<property name="vscrollbar_policy">automatic</property>
|
||||
<property name="window_placement_set">True</property>
|
||||
<property name="shadow_type">etched-in</property>
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="treeview1">
|
||||
<property name="width_request">500</property>
|
||||
<property name="height_request">275</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="radiobutton2">
|
||||
<property name="label" translatable="yes">2</property>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">20</property>
|
||||
<property name="layout_style">center</property>
|
||||
<child>
|
||||
<widget class="GtkButton" id="btnchange1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-edit</property>
|
||||
<property name="icon-size">1</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label4">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Change</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="btnreset1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox2">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="image2">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-undo</property>
|
||||
<property name="icon-size">1</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label6">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Reset</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Controller 1</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="tab_fill">False</property>
|
||||
<property name="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox4">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox8">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label11">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Device:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="combodev2">
|
||||
<property name="width_request">150</property>
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox7">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label7">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Type:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="combotype2">
|
||||
<property name="width_request">200</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="items" translatable="yes">Digital Pad
|
||||
Analog Pad</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">radiobutton1</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="hscrollbar_policy">automatic</property>
|
||||
<property name="vscrollbar_policy">automatic</property>
|
||||
<property name="window_placement_set">True</property>
|
||||
<property name="shadow_type">etched-in</property>
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="treeview2">
|
||||
<property name="width_request">500</property>
|
||||
<property name="height_request">275</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox3">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">20</property>
|
||||
<property name="layout_style">center</property>
|
||||
<child>
|
||||
<widget class="GtkButton" id="btnchange2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox3">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="image3">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-edit</property>
|
||||
<property name="icon-size">1</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label8">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Change</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="btnreset2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox4">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="image4">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-undo</property>
|
||||
<property name="icon-size">1</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label9">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Reset</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
@ -65,130 +401,72 @@
|
|||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="border_width">6</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Device file:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="filename_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox3">
|
||||
<widget class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="border_width">6</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="label" translatable="yes">Controller 2</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
<property name="tab_fill">False</property>
|
||||
<property name="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox3">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">20</property>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chkMultithreaded">
|
||||
<property name="label" translatable="yes">Multi-threaded</property>
|
||||
<widget class="GtkCheckButton" id="checkmt">
|
||||
<property name="label" translatable="yes">Multi-Threaded (Recommended)</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="padding">16</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chkAnalog">
|
||||
<property name="label" translatable="yes">Analog</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkFrame" id="frame1">
|
||||
<widget class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">out</property>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment1">
|
||||
<property name="visible">True</property>
|
||||
<property name="bottom_padding">5</property>
|
||||
<property name="left_padding">12</property>
|
||||
<property name="right_padding">12</property>
|
||||
<child>
|
||||
<widget class="GtkFixed" id="fixed1">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label4">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Button Configuration</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
<property name="label" translatable="yes">Options</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">3</property>
|
||||
<property name="position">2</property>
|
||||
<property name="tab_fill">False</property>
|
||||
<property name="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox1">
|
||||
<child internal-child="action_area">
|
||||
<widget class="GtkHButtonBox" id="dialog-action_area1">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<widget class="GtkButton" id="btnCancel">
|
||||
<property name="label">gtk-cancel</property>
|
||||
<widget class="GtkButton" id="btnclose">
|
||||
<property name="label">gtk-close</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
|
@ -197,43 +475,7 @@
|
|||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="btnOK">
|
||||
<property name="label">gtk-ok</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<widget class="GtkAboutDialog" id="AboutWin">
|
||||
<property name="visible">True</property>
|
||||
<property name="window_position">center</property>
|
||||
<property name="type_hint">normal</property>
|
||||
<property name="comments" translatable="yes">Based on PadJoy by Erich Kitzmüller (ammoq@ammoq.com)</property>
|
||||
<property name="authors">Erich Kitzmüller (ammoq@ammoq.com)
|
||||
Andrew Burton (adb@iinet.net.au)</property>
|
||||
<property name="translator_credits" translatable="yes" comments="TRANSLATORS: Replace this string with your names, one name per line.">translator-credits</property>
|
||||
<child internal-child="vbox">
|
||||
<widget class="GtkVBox" id="dialog-vbox1">
|
||||
<property name="orientation">vertical</property>
|
||||
<child internal-child="action_area">
|
||||
<widget class="GtkHButtonBox" id="dialog-action_area1"/>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="pack_type">end</property>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,182 @@
|
|||
/*
|
||||
* Copyright (c) 2009, Wei Mingzhi <whistler@openoffice.org>.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses>.
|
||||
*/
|
||||
|
||||
#ifndef PAD_H_
|
||||
#define PAD_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//#define EPSXE 1
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <SDL.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/XKBlib.h>
|
||||
|
||||
#include "psemu_plugin_defs.h"
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
#include <libintl.h>
|
||||
#include <locale.h>
|
||||
#define _(x) gettext(x)
|
||||
#define N_(x) (x)
|
||||
#else
|
||||
#define _(x) (x)
|
||||
#define N_(x) (x)
|
||||
#endif
|
||||
|
||||
enum {
|
||||
DKEY_SELECT = 0,
|
||||
DKEY_L3,
|
||||
DKEY_R3,
|
||||
DKEY_START,
|
||||
DKEY_UP,
|
||||
DKEY_RIGHT,
|
||||
DKEY_DOWN,
|
||||
DKEY_LEFT,
|
||||
DKEY_L2,
|
||||
DKEY_R2,
|
||||
DKEY_L1,
|
||||
DKEY_R1,
|
||||
DKEY_TRIANGLE,
|
||||
DKEY_CIRCLE,
|
||||
DKEY_CROSS,
|
||||
DKEY_SQUARE,
|
||||
|
||||
DKEY_TOTAL
|
||||
};
|
||||
|
||||
enum {
|
||||
ANALOG_LEFT = 0,
|
||||
ANALOG_RIGHT,
|
||||
|
||||
ANALOG_TOTAL
|
||||
};
|
||||
|
||||
enum { NONE = 0, AXIS, HAT, BUTTON };
|
||||
|
||||
typedef struct tagKeyDef {
|
||||
uint8_t JoyEvType;
|
||||
union {
|
||||
int16_t d;
|
||||
int16_t Axis; // positive=axis+, negative=axis-, abs(Axis)-1=axis index
|
||||
uint16_t Hat; // 8-bit for hat number, 8-bit for direction
|
||||
uint16_t Button; // button number
|
||||
} J;
|
||||
uint16_t Key;
|
||||
} KEYDEF;
|
||||
|
||||
enum { ANALOG_X = 0, ANALOG_Y };
|
||||
|
||||
typedef struct tagPadDef {
|
||||
int8_t DevNum;
|
||||
uint16_t Type;
|
||||
KEYDEF KeyDef[DKEY_TOTAL];
|
||||
int16_t AnalogDef[ANALOG_TOTAL][2]; // positive=axis+, negative=axis-, abs(Axis)-1=axis index
|
||||
} PADDEF;
|
||||
|
||||
typedef struct tagConfig {
|
||||
uint8_t Threaded;
|
||||
PADDEF PadDef[2];
|
||||
} CONFIG;
|
||||
|
||||
typedef struct tagPadState {
|
||||
SDL_Joystick *JoyDev;
|
||||
uint8_t PadMode;
|
||||
uint8_t PadID;
|
||||
uint16_t KeyStatus;
|
||||
uint16_t JoyKeyStatus;
|
||||
uint8_t AnalogStatus[ANALOG_TOTAL][2]; // 0-255 where 128 is center position
|
||||
} PADSTATE;
|
||||
|
||||
typedef struct tagGlobalData {
|
||||
CONFIG cfg;
|
||||
|
||||
uint8_t Opened;
|
||||
Display *Disp;
|
||||
|
||||
PADSTATE PadState[2];
|
||||
long KeyLeftOver;
|
||||
} GLOBALDATA;
|
||||
|
||||
extern GLOBALDATA g;
|
||||
|
||||
enum {
|
||||
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,
|
||||
};
|
||||
|
||||
// cfg.c functions...
|
||||
void LoadConfig();
|
||||
void SaveConfig();
|
||||
|
||||
// sdljoy.c functions...
|
||||
void InitSDLJoy();
|
||||
void DestroySDLJoy();
|
||||
void CheckJoy();
|
||||
|
||||
// xkb.c functions...
|
||||
void InitKeyboard();
|
||||
void DestroyKeyboard();
|
||||
void CheckKeyboard();
|
||||
|
||||
// analog.c functions...
|
||||
void InitAnalog();
|
||||
void CheckAnalog();
|
||||
|
||||
// pad.c functions...
|
||||
char *PSEgetLibName(void);
|
||||
uint32_t PSEgetLibType(void);
|
||||
uint32_t PSEgetLibVersion(void);
|
||||
long PADinit(long flags);
|
||||
long PADshutdown(void);
|
||||
long PADopen(unsigned long *Disp);
|
||||
long PADclose(void);
|
||||
long PADquery(void);
|
||||
unsigned char PADstartPoll(int pad);
|
||||
unsigned char PADpoll(unsigned char value);
|
||||
long PADreadPort1(PadDataS *pad);
|
||||
long PADreadPort2(PadDataS *pad);
|
||||
long PADkeypressed(void);
|
||||
long PADconfigure(void);
|
||||
void PADabout(void);
|
||||
long PADtest(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,82 +0,0 @@
|
|||
#ifndef _PADJOY_H_
|
||||
|
||||
#define _PADJOY_H_
|
||||
|
||||
#define DEBUG(x) fprintf(stderr, "DFInput: %s\n", x);
|
||||
|
||||
// Maximum number of joy devices
|
||||
#define MAXDEVICES 2
|
||||
// Maximum number of supported axis (per device, a normal joystick has 2)
|
||||
#define MAXAXES 20
|
||||
// Maximum number of supported buttons (per device)
|
||||
#define MAXBUTTONS 32
|
||||
// Number of PSX-Buttons (including analog axis)
|
||||
#define MAXPSXBUTTONS 20
|
||||
|
||||
// Status of digital Axes (avoids repeated events of the same type on an analog pad)
|
||||
#define AXESTS_UNUSED -1
|
||||
#define AXESTS_UNKNOWN 0
|
||||
#define AXESTS_CENTER 1
|
||||
#define AXESTS_PLUS 2
|
||||
#define AXESTS_MINUS 3
|
||||
#define AXESTS_ANALOG 4
|
||||
|
||||
// every kind of supported event is coded into a long int
|
||||
typedef int32_t EventCode;
|
||||
|
||||
// Position of directional buttons in PadButtons
|
||||
#define PSXBTN_UP 12
|
||||
#define PSXBTN_RIGHT 13
|
||||
#define PSXBTN_DOWN 14
|
||||
#define PSXBTN_LEFT 15
|
||||
|
||||
// macros to define Eventcodes
|
||||
// this may look like I make it too complicated, but it keeps things open for future improvements
|
||||
#define NO_EVENT 0
|
||||
#define FIRST_KEY_EVENT 0
|
||||
#define FIRST_JOY_EVENT (1<<16)
|
||||
#define RELEASE_EVENT (1<<30)
|
||||
#define FIRST_ANALOG_EVENT (1<<20)
|
||||
|
||||
#define KEY_EVENT(n) (FIRST_KEY_EVENT+(n))
|
||||
#define AXISPLUS_EVENT(p,n) (FIRST_JOY_EVENT+2*(n)+(p)*(2*MAXAXES+MAXBUTTONS))
|
||||
#define AXISMINUS_EVENT(p,n) (FIRST_JOY_EVENT+2*(n)+1+(p)*(2*MAXAXES+MAXBUTTONS))
|
||||
#define BUTTON_EVENT(p,n) (FIRST_JOY_EVENT+2*MAXAXES+(n)+(p)*(2*MAXAXES+MAXBUTTONS))
|
||||
#define ANALOGAXIS_EVENT(p,n,v) (FIRST_ANALOG_EVENT+256*(n)+(v)+(p)*(256*MAXAXES))
|
||||
|
||||
// Makro Definitions etc.
|
||||
#define MAXMACROS 3
|
||||
#define MAXMACROLENGTH 100
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char controllerType;
|
||||
unsigned short buttonStatus;
|
||||
unsigned char rightJoyX, rightJoyY, leftJoyX, leftJoyY;
|
||||
unsigned char moveX, moveY;
|
||||
unsigned char reserved[91];
|
||||
} PadDataS;
|
||||
|
||||
// Number of events to fetch at once...
|
||||
#define MAXCNT 100
|
||||
|
||||
/* number of buttons required for configuration */
|
||||
#define CONFIGBUTTONCOUNT 20
|
||||
|
||||
#define EVENTTYPE_NONE -1
|
||||
#define EVENTTYPE_KEY 0
|
||||
#define EVENTTYPE_BUTTON 1
|
||||
#define EVENTTYPE_AXISPLUS 2
|
||||
#define EVENTTYPE_AXISMINUS 3
|
||||
#define EVENTTYPE_ANALOG 4
|
||||
|
||||
// The following struct is used in the config part only
|
||||
typedef struct
|
||||
{
|
||||
unsigned int event_type; // Button, Axe, AnalogAxe
|
||||
unsigned int pad;
|
||||
unsigned int no; // Keycode in case of key event
|
||||
int value; // 0=release, 1=press, or analog value in case of EVENTTYPE_ANALOG
|
||||
} PadJoyEvent;
|
||||
|
||||
#endif
|
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
* Copyright (c) 2009, Wei Mingzhi <whistler@openoffice.org>.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses>.
|
||||
*/
|
||||
|
||||
#include "pad.h"
|
||||
|
||||
void InitSDLJoy() {
|
||||
uint8_t i;
|
||||
|
||||
g.PadState[0].JoyKeyStatus = 0xFFFF;
|
||||
g.PadState[1].JoyKeyStatus = 0xFFFF;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (g.cfg.PadDef[i].DevNum >= 0) {
|
||||
g.PadState[i].JoyDev = SDL_JoystickOpen(g.cfg.PadDef[i].DevNum);
|
||||
} else {
|
||||
g.PadState[i].JoyDev = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_JoystickEventState(SDL_IGNORE);
|
||||
|
||||
InitAnalog();
|
||||
}
|
||||
|
||||
void DestroySDLJoy() {
|
||||
uint8_t i;
|
||||
|
||||
if (SDL_WasInit(SDL_INIT_JOYSTICK)) {
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (g.PadState[i].JoyDev != NULL) {
|
||||
SDL_JoystickClose(g.PadState[i].JoyDev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
g.PadState[i].JoyDev = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CheckJoy() {
|
||||
uint8_t i, j, n;
|
||||
int dx, dy;
|
||||
|
||||
SDL_JoystickUpdate();
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (g.PadState[i].JoyDev == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (j = 0; j < DKEY_TOTAL; j++) {
|
||||
switch (g.cfg.PadDef[i].KeyDef[j].JoyEvType) {
|
||||
case AXIS:
|
||||
n = abs(g.cfg.PadDef[i].KeyDef[j].J.Axis) - 1;
|
||||
|
||||
if (g.cfg.PadDef[i].KeyDef[j].J.Axis > 0) {
|
||||
if (SDL_JoystickGetAxis(g.PadState[i].JoyDev, n) > 16383) {
|
||||
g.PadState[i].JoyKeyStatus &= ~(1 << j);
|
||||
} else {
|
||||
g.PadState[i].JoyKeyStatus |= (1 << j);
|
||||
}
|
||||
} else if (g.cfg.PadDef[i].KeyDef[j].J.Axis < 0) {
|
||||
if (SDL_JoystickGetAxis(g.PadState[i].JoyDev, n) < -16383) {
|
||||
g.PadState[i].JoyKeyStatus &= ~(1 << j);
|
||||
} else {
|
||||
g.PadState[i].JoyKeyStatus |= (1 << j);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case HAT:
|
||||
n = (g.cfg.PadDef[i].KeyDef[j].J.Hat >> 8);
|
||||
|
||||
if (SDL_JoystickGetHat(g.PadState[i].JoyDev, n) & (g.cfg.PadDef[i].KeyDef[j].J.Hat & 0xFF)) {
|
||||
g.PadState[i].JoyKeyStatus &= ~(1 << j);
|
||||
} else {
|
||||
g.PadState[i].JoyKeyStatus |= (1 << j);
|
||||
}
|
||||
break;
|
||||
|
||||
case BUTTON:
|
||||
if (SDL_JoystickGetButton(g.PadState[i].JoyDev, g.cfg.PadDef[i].KeyDef[j].J.Button)) {
|
||||
g.PadState[i].JoyKeyStatus &= ~(1 << j);
|
||||
} else {
|
||||
g.PadState[i].JoyKeyStatus |= (1 << j);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CheckAnalog();
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* Copyright (c) 2009, Wei Mingzhi <whistler@openoffice.org>.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses>.
|
||||
*/
|
||||
|
||||
#include "pad.h"
|
||||
|
||||
static Atom wmprotocols, wmdelwindow;
|
||||
|
||||
void InitKeyboard() {
|
||||
wmprotocols = XInternAtom(g.Disp, "WM_PROTOCOLS", 0);
|
||||
wmdelwindow = XInternAtom(g.Disp, "WM_DELETE_WINDOW", 0);
|
||||
|
||||
XAutoRepeatOff(g.Disp);
|
||||
|
||||
g.PadState[0].KeyStatus = 0xFFFF;
|
||||
g.PadState[1].KeyStatus = 0xFFFF;
|
||||
}
|
||||
|
||||
void DestroyKeyboard() {
|
||||
XAutoRepeatOn(g.Disp);
|
||||
}
|
||||
|
||||
void CheckKeyboard() {
|
||||
uint8_t i, j, found;
|
||||
XEvent evt;
|
||||
XClientMessageEvent *xce;
|
||||
uint16_t Key;
|
||||
|
||||
while (XPending(g.Disp)) {
|
||||
XNextEvent(g.Disp, &evt);
|
||||
switch (evt.type) {
|
||||
case KeyPress:
|
||||
Key = XLookupKeysym((XKeyEvent *)&evt, 0);
|
||||
found = 0;
|
||||
for (i = 0; i < 2; i++) {
|
||||
for (j = 0; j < DKEY_TOTAL; j++) {
|
||||
if (g.cfg.PadDef[i].KeyDef[j].Key == Key) {
|
||||
found = 1;
|
||||
g.PadState[i].KeyStatus &= ~(1 << j);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
g.KeyLeftOver = Key;
|
||||
}
|
||||
return;
|
||||
|
||||
case KeyRelease:
|
||||
Key = XLookupKeysym((XKeyEvent *)&evt, 0);
|
||||
found = 0;
|
||||
for (i = 0; i < 2; i++) {
|
||||
for (j = 0; j < DKEY_TOTAL; j++) {
|
||||
if (g.cfg.PadDef[i].KeyDef[j].Key == Key) {
|
||||
found = 1;
|
||||
g.PadState[i].KeyStatus |= (1 << j);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
g.KeyLeftOver = ((long)Key | 0x40000000);
|
||||
}
|
||||
break;
|
||||
|
||||
case ClientMessage:
|
||||
xce = (XClientMessageEvent *)&evt;
|
||||
if (xce->message_type == wmprotocols && (Atom)xce->data.l[0] == wmdelwindow) {
|
||||
// Fake an ESC key if user clicked the close button on window
|
||||
g.KeyLeftOver = XK_Escape;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case FocusOut:
|
||||
XAutoRepeatOn(g.Disp);
|
||||
break;
|
||||
|
||||
case FocusIn:
|
||||
XAutoRepeatOff(g.Disp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -174,6 +174,9 @@ PEOPSXGL = @PEOPSXGL@
|
|||
PKG_CONFIG = @PKG_CONFIG@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
|
|
|
@ -174,6 +174,9 @@ PEOPSXGL = @PEOPSXGL@
|
|||
PKG_CONFIG = @PKG_CONFIG@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
|
|
|
@ -165,6 +165,9 @@ PEOPSXGL = @PEOPSXGL@
|
|||
PKG_CONFIG = @PKG_CONFIG@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
|
|
715
po/pcsx.pot
715
po/pcsx.pot
File diff suppressed because it is too large
Load Diff
BIN
po/pt_BR.gmo
BIN
po/pt_BR.gmo
Binary file not shown.
1102
po/pt_BR.po
1102
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
BIN
po/zh_CN.gmo
BIN
po/zh_CN.gmo
Binary file not shown.
844
po/zh_CN.po
844
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
BIN
po/zh_TW.gmo
BIN
po/zh_TW.gmo
Binary file not shown.
1052
po/zh_TW.po
1052
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue