From 03fc92847bedaae2eb0bee1add87c13bd90fd981 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 23 Aug 2015 09:43:14 +0200 Subject: applying patch plib-1.8.5.patch diff --git a/configure.in b/configure.in index d4b5c74..95c1ed6 100644 --- a/configure.in +++ b/configure.in @@ -36,6 +36,7 @@ AC_PROG_CPP AC_PROG_CXX AC_PROG_CXXCPP AC_PROG_INSTALL +AC_PROG_LIBTOOL AC_PROG_RANLIB dnl Command line arguments @@ -276,7 +277,7 @@ case "${host}" in LDFLAGS="$LDFLAGS $X_LIBS" - LIBS="$LIBS $X_PRE_LIBS -lXi -lXmu -lXext -lX11 $X_EXTRA_LIBS -lm" + LIBS="$LIBS $X_PRE_LIBS $X_EXTRA_LIBS" dnl ========================================================= dnl if test "x$x_includes" != "x"; then @@ -289,8 +290,8 @@ dnl ========================================================= AC_CHECK_LIB(pthread, pthread_create) AC_CHECK_LIB(GL, glNewList) if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then - dnl if no GL, check for MesaGL - AC_CHECK_LIB(MesaGL, glNewList,, + dnl if no GL, check for GL + AC_CHECK_LIB(GL, glNewList,, AC_MSG_ERROR([could not find working GL library])) fi @@ -356,6 +357,11 @@ esac CFLAGS="$CFLAGS $WFLAG" CXXFLAGS="$CXXFLAGS $WFLAG" +dnl Required to build shared libraries later +CFLAGS="$CFLAGS -fPIC" +CPPFLAGS="$CFLAGS" +CXXFLAGS="$CFLAGS" + dnl FreeBSD requires the -pthread switch to enable pthreads. Look for this dnl weirdness. save_CXXFLAGS="$CXXFLAGS" diff --git a/src/fnt/fntTXF.cxx b/src/fnt/fntTXF.cxx index e664c90..ed44ef3 100644 --- a/src/fnt/fntTXF.cxx +++ b/src/fnt/fntTXF.cxx @@ -30,6 +30,8 @@ # include #elif defined(UL_WIN32) /* Nothing */ +#elif defined(UL_BEOS) + /* Nothing */ #else # include #endif @@ -44,6 +46,8 @@ static bool glIsValidContext ( void ) return ( aglGetCurrentContext () != NULL ) ; #elif defined(UL_MAC_OSX) return ( CGLGetCurrentContext () != NULL ) ; +#elif defined(UL_BEOS) + return true ; #else return ( glXGetCurrentContext () != NULL ) ; #endif diff --git a/src/js/jsNone.cxx b/src/js/jsNone.cxx index 300bdbc..7a93266 100644 --- a/src/js/jsNone.cxx +++ b/src/js/jsNone.cxx @@ -22,7 +22,7 @@ #include "js.h" -#if defined(UL_IRIX) || defined(UL_SOLARIS) || defined (UL_HPUX) +#if defined(UL_IRIX) || defined(UL_SOLARIS) || defined (UL_HPUX) || defined (UL_BEOS) struct os_specific_s ; diff --git a/src/pui/pu.cxx b/src/pui/pu.cxx index 2e3728f..226b44e 100644 --- a/src/pui/pu.cxx +++ b/src/pui/pu.cxx @@ -27,7 +27,7 @@ # include #elif defined(UL_CGL) # include -#elif defined(UL_GLX) +#elif defined(UL_GLX) && !defined(UL_BEOS) # include #endif @@ -107,7 +107,7 @@ static bool glIsValidContext ( void ) return ( aglGetCurrentContext () != NULL ) ; #elif defined(UL_CGL) return ( CGLGetCurrentContext () != NULL ) ; -#elif defined(UL_GLX) +#elif defined(UL_GLX) && !defined(UL_BEOS) return ( glXGetCurrentContext () != NULL ) ; #else return true ; diff --git a/src/pw/Makefile.am b/src/pw/Makefile.am index 151fbd3..e38e8ce 100644 --- a/src/pw/Makefile.am +++ b/src/pw/Makefile.am @@ -4,7 +4,7 @@ lib_LIBRARIES = libplibpw.a include_HEADERS = pw.h -libplibpw_a_SOURCES = pw.cxx pwX11.cxx pwWindows.cxx pwMacOSX.cxx +libplibpw_a_SOURCES = pw.cxx pwX11.cxx pwHaiku.cxx pwWindows.cxx pwMacOSX.cxx INCLUDES = -I$(top_srcdir)/src/util diff --git a/src/pw/pwHaiku.cxx b/src/pw/pwHaiku.cxx new file mode 100644 index 0000000..e4636d4 --- /dev/null +++ b/src/pw/pwHaiku.cxx @@ -0,0 +1,200 @@ +#include "ul.h" + +/* ONLY COMPILE THIS FILE FOR HAIKU/BEOS EQUIPPED SYSTEMS */ + +#if defined(UL_BEOS) + +#include "pw.h" + +#include +#include +#include +#include +#include + +#include + +static bool initialised = false ; +static bool insideCallback = false ; +static int modifiers = 0 ; +static int origin [2] = { 0, 0 } ; +static int size [2] = { 640, 480 } ; +static int currScreen = 0 ; +static int currConnect = 0 ; +static int currCursor = PW_CURSOR_LEFT ; + +static pwResizeCB *resizeCB = NULL ; +static pwExitCB *exitCB = NULL ; +static pwKeybdFunc *kbCB = NULL ; +static pwMouseFunc *msCB = NULL ; +static pwMousePosFunc *mpCB = NULL ; + +static bool autoRepeat = false ; + +void pwSetAutoRepeatKey ( bool enable ) +{ + autoRepeat = enable ; +} + + +struct PixelFormat +{ + int num_samples ; + int bits_per_pixel ; ; + int z_bits ; +} ; + + +static PixelFormat preferred_pixel_formats [] = +{ + /* NumSamples, RGB_bits, Z_bits */ + + { 0, 24, 24 }, /* Progressively nastier image formats */ + { 0, 16, 24 }, + { 0, 16, 16 }, + { 0, 3, 16 }, + { 0, 3, 1 }, + { -1, -1, -1 } /* Magic end marker */ +} ; + + +void defaultExitFunc () +{ + pwCleanup () ; + exit ( 0 ) ; +} + + +void pwInit ( int multisample, int num_samples ) +{ + pwInit ( 0, 0, -1, -1, multisample, "NoName", FALSE, num_samples ) ; +} + + +void pwSetCallbacks ( pwKeybdFunc *kb, pwMouseFunc *ms, + pwMousePosFunc *mp, pwResizeCB *rcb, + pwExitCB *ecb ) +{ + if ( ! initialised ) + { + fprintf ( stderr, "PW: You must not call pwSetCallbacks before pwInit.\n"); + exit ( 1 ) ; + } + + kbCB = kb ; + msCB = ms ; + mpCB = mp ; + resizeCB = rcb ; + exitCB = ecb ? ecb : defaultExitFunc ; +} + + +void pwInit ( int x, int y, int w, int h, int multisample, + char *title, int border, int num_samples ) +{ + char *displayName = getenv ( "DISPLAY" ) ; + + if ( displayName == NULL ) displayName = ":0.0" ; + + pwSetCursor ( PW_CURSOR_LEFT ) ; + +#ifdef GL_MULTISAMPLE_FILTER_HINT_NV + glHint ( GL_MULTISAMPLE_FILTER_HINT_NV, multisample ) ; +#endif + + kbCB = NULL ; + msCB = NULL ; + mpCB = NULL ; + resizeCB = NULL ; + exitCB = defaultExitFunc ; + + initialised = true ; + insideCallback = false ; + + glClear ( GL_COLOR_BUFFER_BIT ) ; + pwSwapBuffers () ; + glClear ( GL_COLOR_BUFFER_BIT ) ; + pwSwapBuffers () ; +} + + +void pwGetSize ( int *w, int *h ) +{ + if ( w ) *w = size[0] ; + if ( h ) *h = size[1] ; +} + + +void pwSetCursor ( int c ) +{ + +} + + +void pwSetSize ( int w, int h ) +{ + +} + + +void pwSetOrigin ( int x, int y ) +{ + +} + + +void pwSetSizeOrigin ( int x, int y, int w, int h ) +{ + +} + +int pwGetModifiers () +{ + return modifiers ; +} + + +static void getEvents () +{ + +} + + +void pwSwapBuffers () +{ + if ( ! initialised ) + { + fprintf ( stderr, "PLIB/PW: FATAL - Application called pwSwapBuffers" + " before pwInit.\n" ) ; + exit ( 1 ) ; + } + + if ( insideCallback ) + { + fprintf ( stderr, "PLIB/PW: FATAL - Application called pwSwapBuffers" + " from inside a callback function.\n" ) ; + exit ( 1 ) ; + } + + glFlush () ; + getEvents () ; +} + + +#ifdef NEED_GAMMA +void pwSetGamma ( float g ) +{ + +} +#endif + + +void pwCleanup () +{ + if ( ! initialised ) + fprintf ( stderr, "PLIB/PW: WARNING - Application called pwCleanup" + " before pwInit.\n" ) ; +} + + +#endif diff --git a/src/pw/pwX11.cxx b/src/pw/pwX11.cxx index 33488d7..b76bd01 100644 --- a/src/pw/pwX11.cxx +++ b/src/pw/pwX11.cxx @@ -2,7 +2,7 @@ /* ONLY COMPILE THIS FILE FOR GLX/X11 EQUIPPED SYSTEMS */ -#ifdef UL_GLX +#if defined(UL_GLX) && !defined(UL_BEOS) #include "pw.h" diff --git a/src/sl/sl.h b/src/sl/sl.h index 65325eb..7c8eeef 100644 --- a/src/sl/sl.h +++ b/src/sl/sl.h @@ -44,6 +44,8 @@ #define SLDSP_DEFAULT_DEVICE "/dev/audio" #elif defined(UL_MACINTOSH) || defined(UL_MAC_OSX) #define SLDSP_DEFAULT_DEVICE "dsp" // dummy +#elif defined(UL_BEOS) +#define SLDSP_DEFAULT_DEVICE "/dev/audio" #else #error "Port me !" #endif diff --git a/src/sl/slDSP.cxx b/src/sl/slDSP.cxx index 933e20b..8aaff1c 100644 --- a/src/sl/slDSP.cxx +++ b/src/sl/slDSP.cxx @@ -1080,6 +1080,72 @@ float slDSP::secondsUsed () return secUsed; } +/* ------------------------------------------------------------ */ +/* Haiku/BeOS audio */ +/* ------------------------------------------------------------ */ + +#elif defined(UL_BEOS) + +void slDSP::open ( const char *device, int _rate, int _stereo, int _bps ) +{ + +} + + +void slDSP::close () +{ + +} + + +int slDSP::getDriverBufferSize () +{ + if ( error ) + return 0 ; +} + +void slDSP::getBufferInfo () +{ + if ( error ) + return ; +} + + +void slDSP::write ( void *buffer, size_t length ) +{ + +} + + +float slDSP::secondsRemaining () +{ + int samples_remain; + + if ( error ) + return 0.0f ; +} + + +float slDSP::secondsUsed () +{ + int samples_used; + + if ( error ) + return 0.0f ; +} + + +void slDSP::sync () +{ + if ( error ) + return ; +} + +void slDSP::stop () +{ +} + + #endif diff --git a/src/ssg/ssg.cxx b/src/ssg/ssg.cxx index bf678b3..737021a 100644 --- a/src/ssg/ssg.cxx +++ b/src/ssg/ssg.cxx @@ -31,6 +31,8 @@ # include #elif defined(UL_WIN32) /* Nothing */ +#elif defined(UL_BEOS) + /* Nothing */ #else # include #endif @@ -45,6 +47,8 @@ static bool glIsValidContext ( void ) return ( aglGetCurrentContext () != NULL ) ; #elif defined(UL_MAC_OSX) return ( CGLGetCurrentContext () != NULL ) ; +#elif defined(UL_BEOS) + return true ; #else return ( glXGetCurrentContext () != NULL ) ; #endif diff --git a/src/util/ul.h b/src/util/ul.h index d747047..4bc6f7e 100644 --- a/src/util/ul.h +++ b/src/util/ul.h @@ -60,7 +60,7 @@ #define UL_WIN32 1 #define UL_MSVC 1 /* Windoze AND MSVC. */ -#elif defined(__BEOS__) +#elif defined(__BEOS__) || defined(__HAIKU__) #define UL_BEOS 1 @@ -118,7 +118,7 @@ #ifdef UL_BEOS #include -#define UL_GLX 1 +#define UL_GLX 0 #endif #ifdef UL_MACINTOSH @@ -647,7 +647,7 @@ class ulDynamicLibrary } }; -#elif defined (__BEOS__) +#elif defined (__BEOS__) || (__HAIKU__) class ulDynamicLibrary { @@ -675,8 +675,8 @@ public: { void *sym = NULL ; - if ( handle && - get_image_symbol ( handle, "funcname", + if ( *handle && + get_image_symbol ( *handle, "funcname", B_SYMBOL_TYPE_TEXT, &sym ) == B_NO_ERROR ) return sym ; @@ -686,7 +686,7 @@ public: ~ulDynamicLibrary () { if ( handle != NULL ) - unload_add_on ( handle ) ; + unload_add_on ( *handle ) ; delete handle ; } -- 2.2.2