From cb30289b5be25ed09bb8b68c87f139706a55f5c6 Mon Sep 17 00:00:00 2001 From: Nick Sayer Date: Tue, 3 Apr 2001 05:57:04 +0000 Subject: [PATCH] 1. Add support to the xmame port for building the GL version. Yet more reason to get DRI support working (hint hint). 2. While we're at it, add a quick patch from the author to improve reliability a tiny bit. Approved by: stijn@win.tue.nl --- emulators/xmame/Makefile | 25 +++++- emulators/xmame/files/patch-ac | 12 ++- emulators/xmame/files/patch-ae | 138 +++++++++++++++++++++++++++++++++ emulators/xmame/pkg-descr | 4 +- emulators/xmame/pkg-plist | 12 +++ 5 files changed, 182 insertions(+), 9 deletions(-) create mode 100644 emulators/xmame/files/patch-ae diff --git a/emulators/xmame/Makefile b/emulators/xmame/Makefile index 5e3477be072a..b887e743b013 100644 --- a/emulators/xmame/Makefile +++ b/emulators/xmame/Makefile @@ -154,8 +154,23 @@ CFLAGS+= -O3 -march=i686 -Wall -Wno-unused -funroll-loops \ -malign-functions=4 -malign-jumps=4 -malign-loops=4 .endif -# SDL extension - enabled by default because x{mame,mess} can run full +# Choose one of several display targets: +# WITH_GL OpenGL based, displays vector games with hardware +# acceleration +# WITH_SDL Uses the SDL library to be able to play fullscreen +# without root rights +# WITH_X11 The standard display target, should work without +# dependancies other than X +# +# WITH_SDL is enabled by default because x{mame,mess} can run full # screen without having to be setuid root. +.if defined(WITH_GL) && ${WITH_GL} == "yes" +CFLAGS+= ${PTHREAD_CFLAGS} +USE_MESA= yes +DISPLAY_METHOD= xgl +PLIST_SUB+= OPENGL="" +.else +PLIST_SUB+= OPENGL="@comment " .if !defined(WITH_SDL) || ${WITH_SDL} != "no" LIB_DEPENDS= SDL-1.1.3:${PORTSDIR}/devel/sdl-devel SDL_CONFIG?= ${LOCALBASE}/bin/sdl11-config @@ -164,9 +179,12 @@ DISPLAY_METHOD= SDL pre-everything:: @${ECHO_MSG} "===> If you don't want ${MAMEMESS:U} to be built with SDL support," @${ECHO_MSG} " use \"make WITH_SDL=no\"" + @${ECHO_MSG} "===> You can also build ${MAMEMESS:U} with OpenGL support." + @${ECHO_MSG} " use \"make WITH_GL=yes\" for this" .else DISPLAY_METHOD= x11 .endif +.endif # The large number of sed regexes here is intended to make this port a whole # lot easier to maintain - please don't convert them into a patch. @@ -182,10 +200,11 @@ do-configure: -e "s@= x11@= ${DISPLAY_METHOD}@g" \ -e "s@= mame@= ${MAMEMESS}@g" \ -e "s@# X86_ASM@${ASM_COMMENT}X86_ASM@g" \ + -e "s@GLLIBS=.-ldl@GLLIBS= ${PTHREAD_LIBS}@g" \ ${WRKSRC}/makefile.unix.sed > ${WRKSRC}/makefile.unix -.if !defined(WITH_SDL) || ${WITH_SDL} != "no" ${PERL} -pi -e 's@SDL/@SDL11/@' ${WRKSRC}/src/unix/video-drivers/SDL.c -.endif + ${PERL} -pi -e 's@png.h@../../png.h@' \ + ${WRKSRC}/src/unix/video-drivers/glexport.c post-build: cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} SDL_VIDEODRIVER=aalib \ diff --git a/emulators/xmame/files/patch-ac b/emulators/xmame/files/patch-ac index bea3973b68ec..9a9567c01510 100644 --- a/emulators/xmame/files/patch-ac +++ b/emulators/xmame/files/patch-ac @@ -1,6 +1,11 @@ --- src/unix/unix.mak.orig Sat Mar 24 02:33:38 2001 -+++ src/unix/unix.mak Fri Mar 30 09:52:29 2001 -@@ -50,14 +50,14 @@ ++++ src/unix/unix.mak Mon Apr 2 10:33:48 2001 +@@ -46,18 +46,18 @@ + LIBS.x11 = $(X11LIB) $(JOY_X11_LIBS) -lX11 -lXext + LIBS.svgalib = $(X11LIB) -lvga -lvgagl + LIBS.ggi = $(X11LIB) -lggi +-LIBS.xgl = $(X11LIB) $(JOY_X11_LIBS) -lX11 -lXext $(GLLIBS) -ljpeg ++LIBS.xgl = $(X11LIB) $(JOY_X11_LIBS) -lX11 -lXext $(GLLIBS) -L/usr/local/lib -ljpeg $(PTHREAD_LIBS) LIBS.xfx = $(X11LIB) $(JOY_X11_LIBS) -lX11 -lXext -lglide2x LIBS.svgafx = $(X11LIB) -lvga -lvgagl -lglide2x LIBS.openstep = -framework AppKit @@ -9,7 +14,8 @@ LIBS.photon2 = -L/usr/lib -lph -lphrender CFLAGS.x11 = $(X11INC) $(JOY_X11_CFLAGS) - CFLAGS.xgl = $(X11INC) $(JOY_X11_CFLAGS) +-CFLAGS.xgl = $(X11INC) $(JOY_X11_CFLAGS) ++CFLAGS.xgl = $(X11INC) $(JOY_X11_CFLAGS) -I/usr/local/include $(PTHREAD_CFLAGS) CFLAGS.xfx = $(X11INC) $(JOY_X11_CFLAGS) -I/usr/include/glide CFLAGS.svgafx = -I/usr/include/glide -CFLAGS.SDL = -D_REENTRANT diff --git a/emulators/xmame/files/patch-ae b/emulators/xmame/files/patch-ae new file mode 100644 index 000000000000..c030ba962efb --- /dev/null +++ b/emulators/xmame/files/patch-ae @@ -0,0 +1,138 @@ +--- src/unix/video-drivers/glxtool.h.orig Sat Mar 24 02:33:38 2001 ++++ src/unix/video-drivers/glxtool.h Mon Apr 2 21:40:48 2001 +@@ -28,6 +28,8 @@ + int accumBlueBits; + int accumAlphaBits; + ++ /* internal use only */ ++ int gl_supported; + long nativeVisualID; + } GLCapabilities; + +--- src/unix/video-drivers/xgl.c.orig Mon Apr 2 13:33:10 2001 ++++ src/unix/video-drivers/xgl.c Mon Apr 2 21:42:05 2001 +@@ -63,14 +63,14 @@ + GLXContext glContext=NULL; + + const GLCapabilities glCapsDef = { BUFFER_DOUBLE, COLOR_RGBA, STEREO_OFF, +- 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, ++ 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, + -1 + }; + + GLCapabilities glCaps; + + static const char * xgl_version_str = +- "\nGLmame v0.83, by Sven Goethel, http://www.jausoft.com, sgoethel@jausoft.com,\nbased upon GLmame v0.6 driver for xmame, written by Mike Oliphant\n\n"; ++ "\nGLmame v0.85, by Sven Goethel, http://www.jausoft.com, sgoethel@jausoft.com,\nbased upon GLmame v0.6 driver for xmame, written by Mike Oliphant\n\n"; + + struct rc_option display_opts[] = { + /* name, shortname, type, dest, deflt, min, max, func, help */ +@@ -237,6 +237,7 @@ + + glCaps.alphaBits=(alphablending>0)?1:0; + glCaps.buffer =(doublebuffer>0)?BUFFER_DOUBLE:BUFFER_SINGLE; ++ glCaps.gl_supported = 1; + + window = RootWindow(display,DefaultScreen( display )); + vgc = findVisualGlX( display, window, +--- src/unix/video-drivers/glxtool.c.orig Fri Mar 23 17:33:38 2001 ++++ src/unix/video-drivers/glxtool.c Mon Apr 2 22:31:23 2001 +@@ -68,6 +68,7 @@ + GLCapabilities *glCaps ) + { + int i=0; ++ visualAttribList[i++] = GLX_USE_GL; /* paranoia .. */ + visualAttribList[i++] = GLX_RED_SIZE; + visualAttribList[i++] = 1; + visualAttribList[i++] = GLX_GREEN_SIZE; +@@ -134,13 +135,18 @@ + int gc_ret = 0; + int ownwin = 0; + ++ GLCapabilities _glCaps; ++ + /** + * The Visual seeked by Function: findVisualIdByFeature ! + */ + XVisualInfo * visualList=NULL; /* the visual list, to be XFree-ed */ + ++ /* paranoia .. */ ++ glCaps->gl_supported = 1; ++ + /* backup ... */ +- GLCapabilities _glCaps = *glCaps; ++ _glCaps = *glCaps; + + if(pOwnWin) ownwin=*pOwnWin; + +@@ -214,14 +220,14 @@ + + if( offscreen && vgc.visual!=NULL) + { +- if(*pix!=0) ++ if(pix!=NULL && *pix!=NULL) + { + XFreePixmap(display, *pix); + } +- if(vgc.visual !=NULL) ++ if(pix!=NULL && vgc.visual !=NULL) + *pix = XCreatePixmap( display, rootWin, width, height, + vgc.visual->depth); +- if(*pix!=0) ++ if(pix!=NULL && *pix!=NULL) + { + *pWin = __glXCreateGLXPixmap( display, vgc.visual, *pix ); + if(*pWin==0) +@@ -271,7 +277,7 @@ + fflush(stderr); + } + +- if(*pix!=0) ++ if(pix!=NULL && *pix!=NULL) + { + XFreePixmap(display, *pix); + *pix=0; +@@ -463,6 +469,16 @@ + int iValue2=0; + int iValue3=0; + ++ memset(glCaps, 0, sizeof(GLCapabilities)); ++ ++ if(__glXGetConfig( disp, visual, GLX_USE_GL, &iValue)==0) ++ { ++ glCaps->gl_supported=(iValue==True)?1:0; ++ } else { ++ fprintf(stderr,"GLINFO: fetching GLX_USE_GL state failed\n"); ++ fflush(stderr); ++ } ++ + if(__glXGetConfig( disp, visual, GLX_DOUBLEBUFFER, &iValue)==0) + { + glCaps->buffer=iValue?BUFFER_DOUBLE:BUFFER_SINGLE; +@@ -530,7 +546,7 @@ + fprintf(stderr,"GLINFO: fetching rgba AccumSize states failed\n"); + fflush(stderr); + } +- glCaps->nativeVisualID=(long)visual->visualid; ++ glCaps->nativeVisualID=(long) (visual->visualid); + + return 1; + } +@@ -541,6 +557,8 @@ + GLCapabilities _glCaps; + setGLCapabilities ( display, vi, &_glCaps); + ++ if(_glCaps.gl_supported != glCaps->gl_supported) return 0; ++ + if(_glCaps.bufferbuffer) return 0; + + if(_glCaps.colorcolor) return 0; +@@ -635,6 +653,7 @@ + + void printGLCapabilities ( GLCapabilities *glCaps ) + { ++ fprintf(stdout, "\t gl_supported: %d !\n", glCaps->gl_supported); + fprintf(stdout, "\t doubleBuff: %d, ", (int)glCaps->buffer); + fprintf(stdout, " rgba: %d, ", (int)glCaps->color); + fprintf(stdout, " stereo: %d, ", (int)glCaps->stereo); diff --git a/emulators/xmame/pkg-descr b/emulators/xmame/pkg-descr index c0dbd88c2645..22bcc304b1df 100644 --- a/emulators/xmame/pkg-descr +++ b/emulators/xmame/pkg-descr @@ -2,7 +2,7 @@ XMAME is an arcade game machine emulator for UNIX/X11. It will emulate the hardware, video, sound, and other services, of many classic arcade game machines. -As of this release, XMAME supports an incredible 2073 arcade games, and +As of this release, XMAME supports an incredible 2843 arcade games, and the number grows every day! A partial list of the (more popular and well-known) games currently supported by this emulator include: @@ -20,5 +20,3 @@ have access to a ROM burner, or you don't own one of these video games you can obtain ROM images for XMAME on the Net. WWW: http://x.mame.net/ - -[ Maintained by Jacob A. Hart . ] diff --git a/emulators/xmame/pkg-plist b/emulators/xmame/pkg-plist index 67bf6d44ed8c..47f495451305 100644 --- a/emulators/xmame/pkg-plist +++ b/emulators/xmame/pkg-plist @@ -36,6 +36,18 @@ share/%%MAMEMESS%%/%%MAMEMESS%%rc %%PINMAMEONLY%%%%PORTDOCS%%share/doc/xpinmame/keys.txt %%PINMAMEONLY%%%%PORTDOCS%%share/doc/xpinmame/sounds.dat %%PORTDOCS%%@dirrm share/doc/%%MAMEMESS%% +%%OPENGL%%share/%%MAMEMESS%%/cab/glmame/cabfront.jpg +%%OPENGL%%share/%%MAMEMESS%%/cab/glmame/cabtitle.jpg +%%OPENGL%%share/%%MAMEMESS%%/cab/glmame/glmame.cab +%%OPENGL%%@dirrm share/%%MAMEMESS%%/cab/glmame +%%OPENGL%%share/%%MAMEMESS%%/cab/glmamejau/cabfront.jpg +%%OPENGL%%share/%%MAMEMESS%%/cab/glmamejau/cabside.jpg +%%OPENGL%%share/%%MAMEMESS%%/cab/glmamejau/cabtitle.jpg +%%OPENGL%%share/%%MAMEMESS%%/cab/glmamejau/glmamejau.cab +%%OPENGL%%@dirrm share/%%MAMEMESS%%/cab/glmamejau +%%OPENGL%%share/%%MAMEMESS%%/cab/trans/trans.cab +%%OPENGL%%@dirrm share/%%MAMEMESS%%/cab/trans +%%OPENGL%%@dirrm share/%%MAMEMESS%%/cab @dirrm share/%%MAMEMESS%%/roms @dirrm share/%%MAMEMESS%% @unexec rmdir %%SPOOLGAMES%%/%%MAMEMESS%% 2>/dev/null || true