mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-23 09:10:43 +00:00
- Update to 0.34
- Add support for SDL Joysticks. - Possibly run on more than i386.
This commit is contained in:
parent
4fdaa91f15
commit
398c8f81ad
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=78501
@ -6,38 +6,50 @@
|
||||
#
|
||||
|
||||
PORTNAME= generator
|
||||
PORTVERSION= 0.15
|
||||
PORTVERSION= 0.34
|
||||
CATEGORIES= emulators
|
||||
MASTER_SITES= http://www.squish.net/generator/files/
|
||||
|
||||
MAINTAINER= nakai@FreeBSD.org
|
||||
COMMENT= SEGA Genesis emulator
|
||||
|
||||
LIB_DEPENDS= tcl82.1:${PORTSDIR}/lang/tcl82 \
|
||||
tk82.1:${PORTSDIR}/x11-toolkits/tk82
|
||||
LIB_DEPENDS= gtk12.2:${PORTSDIR}/x11-toolkits/gtk12 \
|
||||
SDL-1.1.5:${PORTSDIR}/devel/sdl12
|
||||
.if (${MACHINE_ARCH} == "i386")
|
||||
BUILD_DEPENDS= nasm:${PORTSDIR}/devel/nasm
|
||||
.endif
|
||||
|
||||
CONFIGURE_ENV= CFLAGS="-I${LOCALBASE}/include \
|
||||
-I${LOCALBASE}/include/tk8.2 -I${LOCALBASE}/include/tcl8.2"
|
||||
CONFIGURE_ARGS= --enable-tcltk
|
||||
SDL_CONFIG?= ${LOCALBASE}/bin/sdl11-config
|
||||
GTK_CONFIG?= ${X11BASE}/bin/gtk12-config
|
||||
|
||||
USE_GMAKE= yes
|
||||
USE_X_PREFIX= yes
|
||||
USE_REINPLACE= yes
|
||||
GNU_CONFIGURE= yes
|
||||
CONFIGURE_ARGS= --with-gtk
|
||||
|
||||
nakai:
|
||||
echo ${CONFIGURE_ARGS}
|
||||
.if (${MACHINE_ARCH} == "i386")
|
||||
CONFIGURE_ARGS+= --with-raze
|
||||
.else
|
||||
CONFIGURE_ARGS+= --with-cmz80
|
||||
.endif
|
||||
|
||||
do-configure:
|
||||
( cd ${WRKSRC}/src; ${CONFIGURE_ENV} ../compile/${CONFIGURE_SCRIPT} \
|
||||
${CONFIGURE_ARGS} )
|
||||
MAKE_ENV+= GTK_CONFIG="${GTK_CONFIG}" \
|
||||
SDL_CONFIG="${SDL_CONFIG}"
|
||||
CONFIGURE_ENV+= GTK_CONFIG="${GTK_CONFIG}" \
|
||||
SDL_CONFIG="${SDL_CONFIG}"
|
||||
|
||||
do-build:
|
||||
( cd ${WRKSRC}/src; ${GMAKE} )
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
do-install:
|
||||
${MKDIR} ${PREFIX}/bin
|
||||
${MKDIR} ${PREFIX}/share/generator/
|
||||
${INSTALL_PROGRAM} ${WRKSRC}/src/generator-tcltk ${PREFIX}/bin
|
||||
${INSTALL_DATA} ${WRKSRC}/share/* ${PREFIX}/share/generator
|
||||
post-patch:
|
||||
.if ${OSVERSION} >= 500035
|
||||
@${REINPLACE_CMD} -e \
|
||||
's|-malign-loops|-falign-loops|g ; \
|
||||
s|-malign-jumps|-falign-jumps|g ; \
|
||||
s|-malign-functions|-falign-functions|g' ${WRKSRC}/configure.in
|
||||
@${REINPLACE_CMD} -e \
|
||||
's|-malign-loops|-falign-loops|g ; \
|
||||
s|-malign-jumps|-falign-jumps|g ; \
|
||||
s|-malign-functions|-falign-functions|g' ${WRKSRC}/configure
|
||||
.endif
|
||||
|
||||
.include <bsd.port.mk>
|
||||
.include <bsd.port.post.mk>
|
||||
|
@ -1 +1 @@
|
||||
MD5 (generator-0.15.tar.gz) = a557031c3ebcacfa20419454eeccedf1
|
||||
MD5 (generator-0.34.tar.gz) = 8eb154bc0d0f644800c865175f22b873
|
||||
|
@ -1,140 +0,0 @@
|
||||
--- compile/configure.orig Wed Apr 18 19:33:42 2001
|
||||
+++ compile/configure Wed Apr 18 21:09:12 2001
|
||||
@@ -2009,7 +2009,7 @@
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
ac_save_LIBS="$LIBS"
|
||||
-LIBS="-ltcl8.0 $LIBS"
|
||||
+LIBS="-ltcl82 $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2015 "configure"
|
||||
#include "confdefs.h"
|
||||
@@ -2037,7 +2037,7 @@
|
||||
fi
|
||||
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
|
||||
echo "$ac_t""yes" 1>&6
|
||||
- LIBS="$LIBS -ltcl8.0"; lib=yes
|
||||
+ LIBS="$LIBS -ltcl82"; lib=yes
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
lib=no
|
||||
@@ -2051,7 +2051,7 @@
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
ac_save_LIBS="$LIBS"
|
||||
-LIBS="-ltcl $LIBS"
|
||||
+LIBS="-ltcl82 $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2057 "configure"
|
||||
#include "confdefs.h"
|
||||
@@ -2079,7 +2079,7 @@
|
||||
fi
|
||||
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
|
||||
echo "$ac_t""yes" 1>&6
|
||||
- LIBS="$LIBS -ltcl"; lib=yes
|
||||
+ LIBS="$LIBS -ltcl82"; lib=yes
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
lib=no
|
||||
@@ -2096,7 +2096,7 @@
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
ac_save_LIBS="$LIBS"
|
||||
-LIBS="-ltk8.0 $LIBS"
|
||||
+LIBS="-ltk82 $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2102 "configure"
|
||||
#include "confdefs.h"
|
||||
@@ -2124,7 +2124,7 @@
|
||||
fi
|
||||
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
|
||||
echo "$ac_t""yes" 1>&6
|
||||
- LIBS="$LIBS -ltk8.0"; lib=yes
|
||||
+ LIBS="$LIBS -ltk82"; lib=yes
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
lib=no
|
||||
@@ -2138,7 +2138,7 @@
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
ac_save_LIBS="$LIBS"
|
||||
-LIBS="-ltk $LIBS"
|
||||
+LIBS="-ltk82 $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2144 "configure"
|
||||
#include "confdefs.h"
|
||||
@@ -2166,7 +2166,7 @@
|
||||
fi
|
||||
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
|
||||
echo "$ac_t""yes" 1>&6
|
||||
- LIBS="$LIBS -ltk"; lib=yes
|
||||
+ LIBS="$LIBS -ltk82"; lib=yes
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
lib=no
|
||||
@@ -2322,18 +2322,20 @@
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
ac_save_LIBS="$LIBS"
|
||||
-LIBS="-lalleg $LIBS"
|
||||
+LIBS="-L/usr/local/lib -lalleg-3.9.34 -lalleg_unsharable $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2328 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
-char allegro_exit();
|
||||
+#include <allegro.h>
|
||||
|
||||
int main() {
|
||||
allegro_exit()
|
||||
; return 0; }
|
||||
+
|
||||
+END_OF_MAIN();
|
||||
EOF
|
||||
if { (eval echo configure:2339: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
@@ -2350,7 +2352,7 @@
|
||||
fi
|
||||
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
|
||||
echo "$ac_t""yes" 1>&6
|
||||
- LIBS="$LIBS -lalleg";lib=yes
|
||||
+ LIBS="$LIBS -L/usr/local/lib -lalleg-3.9.34 -lalleg_unsharable";lib=yes
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
lib=no
|
||||
@@ -2599,7 +2601,7 @@
|
||||
#include "confdefs.h"
|
||||
#include <$ac_hdr>
|
||||
EOF
|
||||
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
+ac_try="$ac_cpp -I/usr/local/include/tk8.2/ -I/usr/local/include/tcl8.2/ conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:2604: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
@@ -2686,7 +2688,7 @@
|
||||
#include "confdefs.h"
|
||||
#include <$ac_hdr>
|
||||
EOF
|
||||
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
+ac_try="$ac_cpp -I/usr/local/include/tcl8.2 conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:2691: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
@@ -2950,6 +2952,7 @@
|
||||
fprintf(f, "%d\n", sizeof(unsigned char));
|
||||
exit(0);
|
||||
}
|
||||
+
|
||||
EOF
|
||||
if { (eval echo configure:2955: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
|
||||
then
|
||||
@@ -2982,6 +2985,7 @@
|
||||
#line 2983 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <stdio.h>
|
||||
+
|
||||
main()
|
||||
{
|
||||
FILE *f=fopen("conftestval", "w");
|
@ -1,13 +0,0 @@
|
||||
--- src/generator.c.orig Mon May 1 02:01:59 2000
|
||||
+++ src/generator.c Wed Apr 18 22:32:44 2001
|
||||
@@ -109,8 +109,10 @@
|
||||
ui_err("Failed to initialise cpuz80 module (%d)", retval);
|
||||
|
||||
/* initialise sound system */
|
||||
+/*
|
||||
if ((retval = sound_init()))
|
||||
ui_err("Failed to initialise sound module (%d)", retval);
|
||||
+*/
|
||||
|
||||
signal(SIGINT, gen_sighandler);
|
||||
|
@ -1,75 +0,0 @@
|
||||
--- src/gensound.c.orig Mon May 1 02:04:06 2000
|
||||
+++ src/gensound.c Wed Apr 18 22:32:49 2001
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
static unsigned int sound_sampsperfield = 0;
|
||||
static int sound_dev = 0;
|
||||
-/* static int sound_dump = 0; */
|
||||
+static int sound_dump = 0;
|
||||
static uint16 soundbuf[2][SOUND_MAXRATE/50]; /* pal is lowest framerate */
|
||||
static int sound_format;
|
||||
static int sound_stereo;
|
||||
@@ -69,15 +69,19 @@
|
||||
{
|
||||
audio_buf_info sound_info;
|
||||
|
||||
+ return 0;
|
||||
+
|
||||
LOG_NORMAL(("Initialising sound..."));
|
||||
sound_sampsperfield = SOUND_SAMPLERATE / vdp_framerate;
|
||||
|
||||
- /* sound_dump = open("/tmp/sound_dump", O_CREAT|O_WRONLY|O_TRUNC); */
|
||||
+ sound_dump = open("/tmp/sound_dump", O_CREAT|O_WRONLY|O_TRUNC);
|
||||
|
||||
- if ((sound_dev = open(SOUND_DEVICE, O_WRONLY, 0)) == -1) {
|
||||
+/*
|
||||
+ if ((sound_dev = open("/dev/null", O_WRONLY, 0)) == -1) {
|
||||
LOG_CRITICAL(("open " SOUND_DEVICE " failed: %s", strerror(errno)));
|
||||
return 1;
|
||||
}
|
||||
+ sound_dev = sound_dump;
|
||||
sound_frag = (SOUND_FRAGMENTS<<16 |
|
||||
(int)(ceil(log10(sound_sampsperfield*4)/log10(2))));
|
||||
if (ioctl(sound_dev, SNDCTL_DSP_SETFRAGMENT, &sound_frag) == -1) {
|
||||
@@ -142,6 +146,7 @@
|
||||
return 1;
|
||||
LOG_NORMAL(("YM2612 Initialised @ sample rate %d", sound_speed));
|
||||
return 0;
|
||||
+*/
|
||||
}
|
||||
|
||||
/*** sound_final - finalise this sub-unit ***/
|
||||
@@ -169,6 +174,7 @@
|
||||
|
||||
void sound_genreset(void)
|
||||
{
|
||||
+ return 0;
|
||||
#ifdef JFM
|
||||
jfm_reset(sound_ctx);
|
||||
#else
|
||||
@@ -211,6 +217,8 @@
|
||||
audio_buf_info sound_info;
|
||||
unsigned int pending;
|
||||
|
||||
+ return 0;
|
||||
+
|
||||
if (ioctl(sound_dev, SNDCTL_DSP_GETOSPACE, &sound_info) == -1)
|
||||
ui_err("Error getting output space info", strerror(errno));
|
||||
pending = (sound_info.fragstotal*sound_info.fragsize)-sound_info.bytes;
|
||||
@@ -232,14 +240,14 @@
|
||||
buffer[i*2+1] = (soundbuf[1][i] >> 8) | ((soundbuf[1][i] << 8) & 0xff00);
|
||||
}
|
||||
}
|
||||
+/*
|
||||
if (write(sound_dev, buffer, sound_sampsperfield*4) == -1) {
|
||||
if (errno != EINTR)
|
||||
ui_err("Error writing to sound device: %s", strerror(errno));
|
||||
}
|
||||
- /*
|
||||
+*/
|
||||
if (write(sound_dump, buffer, sound_sampsperfield*4) == -1)
|
||||
ui_err("Error writing to dump file: %s", strerror(errno));
|
||||
- */
|
||||
}
|
||||
|
||||
#ifdef JFM
|
@ -1,34 +0,0 @@
|
||||
--- src/snd/fm.c.orig Wed Apr 18 22:37:06 2001
|
||||
+++ src/snd/fm.c Wed Apr 18 22:37:27 2001
|
||||
@@ -1231,6 +1231,8 @@
|
||||
{
|
||||
int fn;
|
||||
|
||||
+return 0;
|
||||
+
|
||||
/* frequency base */
|
||||
OPN->ST.freqbase = (OPN->ST.rate) ? ((double)OPN->ST.clock * 4096.0 / OPN->ST.rate) / pris : 0;
|
||||
/* Timer base time */
|
||||
@@ -3183,6 +3185,8 @@
|
||||
YM2612 *F2612 = &(FM2612[n]);
|
||||
int addr;
|
||||
|
||||
+ return 0;
|
||||
+
|
||||
switch( a&3){
|
||||
case 0: /* address port 0 */
|
||||
F2612->OPN.ST.address = v & 0xff;
|
||||
@@ -3227,8 +3231,13 @@
|
||||
}
|
||||
unsigned char YM2612Read(int n,int a)
|
||||
{
|
||||
+/*
|
||||
YM2612 *F2612 = &(FM2612[n]);
|
||||
int addr = F2612->OPN.ST.address;
|
||||
+*/
|
||||
+ YM2612 *F2612; int addr;
|
||||
+
|
||||
+ return 0;
|
||||
|
||||
switch( a&3){
|
||||
case 0: /* status 0 */
|
11
emulators/generator/files/patch-configure
Normal file
11
emulators/generator/files/patch-configure
Normal file
@ -0,0 +1,11 @@
|
||||
--- configure.orig Sat Oct 20 16:05:45 2001
|
||||
+++ configure Mon Apr 7 02:18:27 2003
|
||||
@@ -1575,7 +1575,7 @@
|
||||
if [ "x$GCCVER" != "xno" ]; then
|
||||
echo "$as_me:1576: result: Turning on gcc optimisations" >&5
|
||||
echo "${ECHO_T}Turning on gcc optimisations" >&6
|
||||
- CFLAGS="$CFLAGS -O3 -ffast-math -fomit-frame-pointer"
|
||||
+ CFLAGS="$CFLAGS -ffast-math -fomit-frame-pointer"
|
||||
if [ "x$GCCVER" = "x3" ]; then
|
||||
echo "$as_me:1580: result: Turning on gcc 3 optimisations" >&5
|
||||
echo "${ECHO_T}Turning on gcc 3 optimisations" >&6
|
11
emulators/generator/files/patch-configure.in
Normal file
11
emulators/generator/files/patch-configure.in
Normal file
@ -0,0 +1,11 @@
|
||||
--- configure.in.orig Sat Oct 20 15:34:19 2001
|
||||
+++ configure.in Mon Apr 7 02:18:22 2003
|
||||
@@ -118,7 +118,7 @@
|
||||
else
|
||||
if [[ "x$GCCVER" != "xno" ]]; then
|
||||
AC_MSG_RESULT(Turning on gcc optimisations)
|
||||
- CFLAGS="$CFLAGS -O3 -ffast-math -fomit-frame-pointer"
|
||||
+ CFLAGS="$CFLAGS -ffast-math -fomit-frame-pointer"
|
||||
if [[ "x$GCCVER" = "x3" ]]; then
|
||||
AC_MSG_RESULT(Turning on gcc 3 optimisations)
|
||||
CFLAGS="$CFLAGS -minline-all-stringops -fno-math-errno"
|
20
emulators/generator/files/patch-main-Makefile.in
Normal file
20
emulators/generator/files/patch-main-Makefile.in
Normal file
@ -0,0 +1,20 @@
|
||||
--- main/Makefile.in.orig Mon Apr 7 01:54:22 2003
|
||||
+++ main/Makefile.in Mon Apr 7 01:54:57 2003
|
||||
@@ -222,7 +222,7 @@
|
||||
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
|
||||
if test -f $$p \
|
||||
; then \
|
||||
- f=`echo $$p1|sed '$(transform);s/$$/$(EXEEXT)/'`; \
|
||||
+ f=`echo $$p1|sed 's/$$/$(EXEEXT)/'`; \
|
||||
echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f; \
|
||||
else :; fi; \
|
||||
@@ -231,7 +231,7 @@
|
||||
uninstall-binPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||
- f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
|
||||
+ f=`echo $$p|sed 's/$(EXEEXT)$$//;s/$$/$(EXEEXT)/'`; \
|
||||
echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
|
||||
rm -f $(DESTDIR)$(bindir)/$$f; \
|
||||
done
|
136
emulators/generator/files/patch-main-ui-gtk.c
Normal file
136
emulators/generator/files/patch-main-ui-gtk.c
Normal file
@ -0,0 +1,136 @@
|
||||
--- main/ui-gtk.c.orig Sun Oct 14 18:02:05 2001
|
||||
+++ main/ui-gtk.c Mon Apr 7 01:40:55 2003
|
||||
@@ -18,7 +18,8 @@
|
||||
/* need Xlib.h for XAutoRepeatOff - how poo is X */
|
||||
#include "X11/Xlib.h"
|
||||
|
||||
-#include "SDL.h"
|
||||
+#include <SDL.h>
|
||||
+#include <SDL_joystick.h>
|
||||
|
||||
#include "generator.h"
|
||||
#include "snprintf.h"
|
||||
@@ -98,6 +99,8 @@
|
||||
static int ui_query_response = -1; /* query response */
|
||||
t_gtkkeys ui_cont[2]; /* keyboard key codes */
|
||||
static int ui_musicfile = -1; /* fd of output file for GYM/GNM logging */
|
||||
+static int ui_joysticks = 0; /* number of joysticks */
|
||||
+static SDL_Joystick *js_handle[2] = { NULL, NULL };
|
||||
|
||||
static enum {
|
||||
SCREEN_100, SCREEN_200, SCREEN_FULL
|
||||
@@ -120,6 +123,7 @@
|
||||
static int ui_gtk_query(const char *msg, int style);
|
||||
static void ui_gtk_opts_to_menu(void);
|
||||
static void ui_simpleplot(void);
|
||||
+static void ui_sdl_events (void);
|
||||
|
||||
/*** Program entry point ***/
|
||||
|
||||
@@ -129,6 +133,8 @@
|
||||
GtkWidget *button, *draw, *obj;
|
||||
struct passwd *passwd;
|
||||
struct stat statbuf;
|
||||
+ int i;
|
||||
+ const char *name;
|
||||
|
||||
gtk_set_locale();
|
||||
gtk_init(&argc, &argv);
|
||||
@@ -209,10 +215,21 @@
|
||||
GDK_WINDOW_XWINDOW(draw->window));
|
||||
putenv(SDL_windowhack);
|
||||
}
|
||||
- if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||
+ if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK) < 0) {
|
||||
fprintf(stderr, "Couldn't initialise SDL: %s\n", SDL_GetError());
|
||||
return -1;
|
||||
}
|
||||
+ ui_joysticks = SDL_NumJoysticks();
|
||||
+ /* Print information about the joysticks */
|
||||
+ fprintf(stderr, "%d joysticks detected\n", ui_joysticks);
|
||||
+ for (i = 0; i < ui_joysticks; ++i) {
|
||||
+ name = SDL_JoystickName(i);
|
||||
+ fprintf(stderr, "Joystick %d: %s\n", i, name ? name : "Unknown Joystick");
|
||||
+ }
|
||||
+ js_handle[0] = SDL_JoystickOpen(0);
|
||||
+ js_handle[1] = SDL_JoystickOpen(1);
|
||||
+ SDL_JoystickEventState(SDL_ENABLE);
|
||||
+
|
||||
ui_gtk_sizechange();
|
||||
ui_gtk_newoptions();
|
||||
ui_gtk_opts_to_menu();
|
||||
@@ -264,9 +281,11 @@
|
||||
if (ui_running) {
|
||||
while (gtk_events_pending())
|
||||
gtk_main_iteration_do(0);
|
||||
+ ui_sdl_events();
|
||||
ui_newframe();
|
||||
event_doframe();
|
||||
} else {
|
||||
+ ui_sdl_events();
|
||||
gtk_main();
|
||||
}
|
||||
}
|
||||
@@ -1529,6 +1548,62 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+static void
|
||||
+ui_sdl_events (void)
|
||||
+{
|
||||
+ SDL_Event event;
|
||||
+
|
||||
+#define LEFT(event) ((event.jaxis.value < -16384) ? 1 : 0)
|
||||
+#define RIGHT(event) ((event.jaxis.value > 16384) ? 1 : 0)
|
||||
+#define UP(event) ((event.jaxis.value < -16384) ? 1 : 0)
|
||||
+#define DOWN(event) ((event.jaxis.value > 16384) ? 1 : 0)
|
||||
+#define PRESS(event) ((event.type == SDL_JOYBUTTONDOWN) ? 1 : 0)
|
||||
+
|
||||
+ while (SDL_PollEvent(&event)) {
|
||||
+ switch (event.type) {
|
||||
+ case SDL_JOYAXISMOTION:
|
||||
+ if (event.jaxis.which > 1)
|
||||
+ break;
|
||||
+ switch (event.jaxis.axis) {
|
||||
+ case 0: /* left & right */
|
||||
+ mem68k_cont[event.jaxis.which].left = LEFT(event);
|
||||
+ mem68k_cont[event.jaxis.which].right = RIGHT(event);
|
||||
+ break;
|
||||
+ case 1: /* up & down */
|
||||
+ mem68k_cont[event.jaxis.which].up = UP(event);
|
||||
+ mem68k_cont[event.jaxis.which].down = DOWN(event);
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ break;
|
||||
+ case SDL_JOYBUTTONDOWN:
|
||||
+ case SDL_JOYBUTTONUP:
|
||||
+ if (event.jbutton.which > 1)
|
||||
+ break;
|
||||
+ switch (event.jbutton.button) {
|
||||
+ case 0:
|
||||
+ mem68k_cont[event.jbutton.which].a = PRESS(event);
|
||||
+ break;
|
||||
+ case 1:
|
||||
+ mem68k_cont[event.jbutton.which].b = PRESS(event);
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ mem68k_cont[event.jbutton.which].c = PRESS(event);
|
||||
+ break;
|
||||
+ case 3:
|
||||
+ mem68k_cont[event.jbutton.which].start = PRESS(event);
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
|
||||
void ui_gtk_mainenter(void)
|
||||
{
|
@ -1,6 +1 @@
|
||||
bin/generator-tcltk
|
||||
share/generator/copyright.hlp
|
||||
share/generator/gen.tcl
|
||||
share/generator/generator.hlp
|
||||
share/generator/genesis.hlp
|
||||
@dirrm share/generator
|
||||
bin/generator-gtk
|
||||
|
Loading…
Reference in New Issue
Block a user