# HG changeset patch # User Ryan C. Gordon # Date 1025582304 0 # Node ID cbb15ecf423afa9082893b5f7636465d4a07cecd # Parent 51883cd1193eaa9df85070821b0f4a6af16fa323 WinCE (PocketPC) patches from Tyler. diff -r 51883cd1193e -r cbb15ecf423a CHANGELOG --- a/CHANGELOG Tue Jul 02 03:57:48 2002 +0000 +++ b/CHANGELOG Tue Jul 02 03:58:24 2002 +0000 @@ -2,6 +2,14 @@ * CHANGELOG. */ +07012002 - Fixed configure.in to work around bug in older autoconfs. Started + merging Tyler's WinCE (PocketPC) port. Added checks for assert.h + and signal.h to configure.in/config.h.in, and #if HAVE_*_H checks + where appropriate in the code. Moved #include (along + with the HAVE_ASSERT_H check) to SDL_sound_internal.h, and removed + unnecessary #includes from the individual source files. Added + "md_reverb = 1;" to MIKMOD_init(). Modplug got some WinCE-specific + setting tweaks. 06292002 - More altcvt fixes from Frank Ranostaj...mostly working now. 06252002 - More altcvt fixes from Frank Ranostaj. 06132002 - Patch from Torbjörn to fix stereo AIFF files. diff -r 51883cd1193e -r cbb15ecf423a CREDITS --- a/CREDITS Tue Jul 02 03:57:48 2002 +0000 +++ b/CREDITS Tue Jul 02 03:58:24 2002 +0000 @@ -32,6 +32,7 @@ Max Horn win32 support, +PocketPC support, other fixes: Tyler Montbriand diff -r 51883cd1193e -r cbb15ecf423a SDL_sound.c --- a/SDL_sound.c Tue Jul 02 03:57:48 2002 +0000 +++ b/SDL_sound.c Tue Jul 02 03:58:24 2002 +0000 @@ -35,7 +35,6 @@ #include #include #include -#include #include #include "SDL.h" diff -r 51883cd1193e -r cbb15ecf423a SDL_sound_internal.h --- a/SDL_sound_internal.h Tue Jul 02 03:57:48 2002 +0000 +++ b/SDL_sound_internal.h Tue Jul 02 03:58:24 2002 +0000 @@ -45,6 +45,25 @@ #define SNDDBG(x) #endif +#if HAVE_ASSERT_H +# include +#endif + +#ifdef _WIN32_WCE + extern char *strrchr(const char *s, int c); +# ifdef NDEBUG +# define assert(x) +# else +# define assert(x) if(!x) { fprintf(stderr,"Assertion failed in %s, line %s.\n",__FILE__,__LINE__); fclose(stderr); fclose(stdout); exit(1); } +# endif +#endif + + +#if (!defined assert) /* if all else fails. */ +# define assert(x) +#endif + + typedef struct __SOUND_DECODERFUNCTIONS__ { /* This is a block of info about your decoder. See SDL_sound.h. */ diff -r 51883cd1193e -r cbb15ecf423a configure.in --- a/configure.in Tue Jul 02 03:57:48 2002 +0000 +++ b/configure.in Tue Jul 02 03:58:24 2002 +0000 @@ -54,7 +54,7 @@ AC_PROG_CC AC_PROG_INSTALL AC_PROG_LN_S -AC_PROG_LIBTOOL +AM_PROG_LIBTOOL dnl --------------------------------------------------------------------- @@ -86,7 +86,7 @@ SDL_VERSION=1.2.0 AM_PATH_SDL($SDL_VERSION, :, - AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) + AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) ) CFLAGS="$CFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" @@ -150,25 +150,31 @@ AC_DEFINE(SOUND_SUPPORTS_MIDI) fi +dnl Hooray for shitty autoconf bugs! +x="C__stream_decoder_new" +flcsym="FLA$x" dnl Check for libFLAC AC_ARG_ENABLE(flac, [ --enable-flac enable FLAC decoding via libFLAC [default=yes]], , enable_flac=yes) if test x$enable_flac = xyes; then AC_CHECK_HEADER(FLAC/stream_decoder.h, have_flac_hdr=yes) - AC_CHECK_LIB(FLAC, FLAC__stream_decoder_new, have_flac_lib=yes) + AC_CHECK_LIB(FLAC, $flcsym, have_flac_lib=yes) if test x$have_flac_hdr = xyes -a x$have_flac_lib = xyes; then LIBS="$LIBS -lFLAC" AC_DEFINE(SOUND_SUPPORTS_FLAC) fi fi +dnl Hooray for shitty autoconf bugs! +x="C__seekable_stream_decoder_new" +flcsym="FLA$x" dnl Check if libFLAC is recent enough for a seekable decoder AC_ARG_ENABLE(seekable-flac, [ --enable-seekable-flac enable the seekable decoder [default=yes]], , enable_seekable_flac=yes) if test x$enable_seekable_flac = xyes; then - AC_CHECK_LIB(FLAC, FLAC__seekable_stream_decoder_new, have_seekable_flac_lib=yes) + AC_CHECK_LIB(FLAC, $flcsym, have_seekable_flac_lib=yes) if test x$have_flac_hdr = xyes -a x$have_seekable_flac_lib = xyes; then AC_DEFINE(SOUND_SUPPORTS_SEEKABLE_FLAC) fi @@ -270,7 +276,7 @@ # Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS([stdlib.h string.h]) +AC_CHECK_HEADERS([stdlib.h string.h signal.h assert.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST @@ -281,8 +287,9 @@ # This is only in the bleeding edge autoconf distro... #AC_FUNC_MALLOC + AC_FUNC_MEMCMP -AC_CHECK_FUNCS([memset strrchr]) +AC_CHECK_FUNCS([memset strrchr setbuf]) dnl Add Makefile conditionals AM_CONDITIONAL(USE_TIMIDITY, test x$enable_midi = xyes) diff -r 51883cd1193e -r cbb15ecf423a decoders/aiff.c --- a/decoders/aiff.c Tue Jul 02 03:57:48 2002 +0000 +++ b/decoders/aiff.c Tue Jul 02 03:58:24 2002 +0000 @@ -50,7 +50,6 @@ #include #include #include -#include #include "SDL_sound.h" diff -r 51883cd1193e -r cbb15ecf423a decoders/au.c --- a/decoders/au.c Tue Jul 02 03:57:48 2002 +0000 +++ b/decoders/au.c Tue Jul 02 03:58:24 2002 +0000 @@ -36,7 +36,6 @@ #include #include #include -#include #include "SDL_sound.h" diff -r 51883cd1193e -r cbb15ecf423a decoders/flac.c --- a/decoders/flac.c Tue Jul 02 03:57:48 2002 +0000 +++ b/decoders/flac.c Tue Jul 02 03:58:24 2002 +0000 @@ -38,7 +38,6 @@ #include #include #include -#include #include "SDL_sound.h" diff -r 51883cd1193e -r cbb15ecf423a decoders/midi.c --- a/decoders/midi.c Tue Jul 02 03:57:48 2002 +0000 +++ b/decoders/midi.c Tue Jul 02 03:58:24 2002 +0000 @@ -37,7 +37,6 @@ #include #include #include -#include #include "SDL_sound.h" diff -r 51883cd1193e -r cbb15ecf423a decoders/mpglib.c --- a/decoders/mpglib.c Tue Jul 02 03:57:48 2002 +0000 +++ b/decoders/mpglib.c Tue Jul 02 03:58:24 2002 +0000 @@ -46,7 +46,6 @@ #include #include #include -#include #include "mpglib/mpg123_sdlsound.h" #include "mpglib/mpglib_sdlsound.h" diff -r 51883cd1193e -r cbb15ecf423a decoders/mpglib/mpg123_sdlsound.h --- a/decoders/mpglib/mpg123_sdlsound.h Tue Jul 02 03:57:48 2002 +0000 +++ b/decoders/mpglib/mpg123_sdlsound.h Tue Jul 02 03:58:24 2002 +0000 @@ -1,8 +1,7 @@ #include #include -#include -#if !defined(WIN32) && !defined(macintosh) +#if !defined(WIN32) && !defined(macintosh) && !defined(_WIN32_WCE) #include #endif @@ -13,7 +12,7 @@ # define WIN32 #endif -#if defined(WIN32) || defined(macintosh) +#if defined(WIN32) || defined(macintosh) || defined(_WIN32_WCE) # define M_PI 3.14159265358979323846 # define M_SQRT2 1.41421356237309504880 diff -r 51883cd1193e -r cbb15ecf423a decoders/mpglib/mpglib_common.c --- a/decoders/mpglib/mpglib_common.c Tue Jul 02 03:57:48 2002 +0000 +++ b/decoders/mpglib/mpglib_common.c Tue Jul 02 03:58:24 2002 +0000 @@ -1,6 +1,10 @@ + +#if HAVE_CONFIG_H +# include +#endif + #include #include -#include #include "SDL_sound.h" diff -r 51883cd1193e -r cbb15ecf423a decoders/ogg.c --- a/decoders/ogg.c Tue Jul 02 03:57:48 2002 +0000 +++ b/decoders/ogg.c Tue Jul 02 03:58:24 2002 +0000 @@ -42,7 +42,6 @@ #include #include #include -#include #include "SDL_sound.h" diff -r 51883cd1193e -r cbb15ecf423a decoders/quicktime.c --- a/decoders/quicktime.c Tue Jul 02 03:57:48 2002 +0000 +++ b/decoders/quicktime.c Tue Jul 02 03:58:24 2002 +0000 @@ -60,7 +60,6 @@ #include #include #include -#include #include "SDL_sound.h" diff -r 51883cd1193e -r cbb15ecf423a decoders/raw.c --- a/decoders/raw.c Tue Jul 02 03:57:48 2002 +0000 +++ b/decoders/raw.c Tue Jul 02 03:58:24 2002 +0000 @@ -47,7 +47,6 @@ #include #include #include -#include #include "SDL_sound.h" diff -r 51883cd1193e -r cbb15ecf423a decoders/shn.c --- a/decoders/shn.c Tue Jul 02 03:57:48 2002 +0000 +++ b/decoders/shn.c Tue Jul 02 03:58:24 2002 +0000 @@ -50,7 +50,6 @@ #include #include #include -#include #include "SDL_sound.h" diff -r 51883cd1193e -r cbb15ecf423a decoders/skeleton.c --- a/decoders/skeleton.c Tue Jul 02 03:57:48 2002 +0000 +++ b/decoders/skeleton.c Tue Jul 02 03:58:24 2002 +0000 @@ -46,7 +46,6 @@ #include #include #include -#include #include "SDL_sound.h" diff -r 51883cd1193e -r cbb15ecf423a decoders/smpeg.c --- a/decoders/smpeg.c Tue Jul 02 03:57:48 2002 +0000 +++ b/decoders/smpeg.c Tue Jul 02 03:58:24 2002 +0000 @@ -44,7 +44,6 @@ #include #include #include -#include #include "SDL_sound.h" diff -r 51883cd1193e -r cbb15ecf423a decoders/voc.c --- a/decoders/voc.c Tue Jul 02 03:57:48 2002 +0000 +++ b/decoders/voc.c Tue Jul 02 03:58:24 2002 +0000 @@ -46,7 +46,6 @@ #include #include #include -#include #include "SDL_sound.h" diff -r 51883cd1193e -r cbb15ecf423a decoders/wav.c --- a/decoders/wav.c Tue Jul 02 03:57:48 2002 +0000 +++ b/decoders/wav.c Tue Jul 02 03:58:24 2002 +0000 @@ -37,7 +37,6 @@ #include #include #include -#include #include "SDL_sound.h" diff -r 51883cd1193e -r cbb15ecf423a playsound/playsound.c --- a/playsound/playsound.c Tue Jul 02 03:57:48 2002 +0000 +++ b/playsound/playsound.c Tue Jul 02 03:58:24 2002 +0000 @@ -25,11 +25,24 @@ * This file written by Ryan C. Gordon. (icculus@clutteredmind.org) */ +#if HAVE_CONFIG_H +# include +#endif + #include #include #include -#include -#include + +#if HAVE_ASSERT_H +# include +#elif (!defined assert) +# define assert(x) +#endif + +#if HAVE_SIGNAL_H +# include +#endif + #include "SDL.h" #include "SDL_sound.h" @@ -57,7 +70,8 @@ SDL_VERSION(&sdl_compiled); sdl_linked = SDL_Linked_Version(); - printf("%s version %d.%d.%d\n" + fprintf(stdout, + "%s version %d.%d.%d\n" "Copyright 2001 Ryan C. Gordon\n" "This program is free software, covered by the GNU Lesser General\n" "Public License, and you are welcome to change it and/or\n" @@ -83,21 +97,24 @@ const Sound_DecoderInfo **i; const char **ext; - printf("Supported sound formats:\n"); + fprintf(stdout, "Supported sound formats:\n"); if (rc == NULL) - printf(" * Apparently, NONE!\n"); + fprintf(stdout, " * Apparently, NONE!\n"); else { for (i = rc; *i != NULL; i++) { - printf(" * %s\n", (*i)->description); + fprintf(stdout, " * %s\n", (*i)->description); + for (ext = (*i)->extensions; *ext != NULL; ext++) - printf(" File extension \"%s\"\n", *ext); - printf(" Written by %s.\n %s\n\n", (*i)->author, (*i)->url); + fprintf(stdout, " File extension \"%s\"\n", *ext); + + fprintf(stdout, " Written by %s.\n %s\n\n", + (*i)->author, (*i)->url); } /* for */ } /* else */ - printf("\n"); + fprintf(stdout, "\n"); } /* output_decoders */ @@ -147,7 +164,8 @@ static void output_credits(void) { - printf("playsound version %d.%d.%d\n" + fprintf(stdout, + "playsound version %d.%d.%d\n" "Copyright 2001 Ryan C. Gordon\n" "playsound is free software, covered by the GNU Lesser General\n" "Public License, and you are welcome to change it and/or\n" @@ -269,7 +287,7 @@ static volatile int done_flag = 0; - +#if HAVE_SIGNAL_H void sigint_catcher(int signum) { static Uint32 last_sigint = 0; @@ -293,6 +311,7 @@ done_flag = 1; } /* else */ } /* sigint_catcher */ +#endif /* global decoding state. */ @@ -324,7 +343,7 @@ static void do_seek(Sound_Sample *sample) { - printf("Seeking to %.2d:%.2d:%.4d...\n", + fprintf(stdout, "Seeking to %.2d:%.2d:%.4d...\n", (int) ((seek_list[seek_index] / 1000) / 60), (int) ((seek_list[seek_index] / 1000) % 60), (int) ((seek_list[seek_index] % 1000))); @@ -652,8 +671,10 @@ int delay; int new_sample = 1; - setbuf(stdout, NULL); - setbuf(stderr, NULL); + #ifdef HAVE_SETBUF + setbuf(stdout, NULL); + setbuf(stderr, NULL); + #endif if (argc < 2) { @@ -728,7 +749,9 @@ return(42); } /* if */ - signal(SIGINT, sigint_catcher); + #if HAVE_SIGNAL_H + signal(SIGINT, sigint_catcher); + #endif for (i = 1; i < argc; i++) { @@ -919,11 +942,11 @@ return(42); } /* if */ - printf("Now playing [%s]...\n", filename); + fprintf(stdout, "Now playing [%s]...\n", filename); if (predecode) { - printf(" predecoding..."); + fprintf(stdout, " predecoding..."); decoded_bytes = Sound_DecodeAll(sample); decoded_ptr = sample->buffer; if (sample->flags & SOUND_SAMPLEFLAG_ERROR) @@ -936,7 +959,7 @@ } /* if */ else { - printf("done.\n"); + fprintf(stdout, "done.\n"); } /* else */ } /* if */