diff --git a/acconfig.h b/acconfig.h index 1310e39346..58584cc166 100644 --- a/acconfig.h +++ b/acconfig.h @@ -79,6 +79,9 @@ /* Define if ESD DIGI driver is supported. */ #undef ALLEGRO_WITH_ESDDIGI +/* Define if aRts DIGI driver is supported. */ +#undef ALLEGRO_WITH_ARTSDIGI + /* Define to (void *)-1, if MAP_FAILED is not defined. */ #undef MAP_FAILED diff --git a/aclocal.m4 b/aclocal.m4 index f51eba3d43..fe9daeb9e6 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -148,11 +148,6 @@ fi ]) AC_MSG_RESULT(\"$allegro_cv_asm_prefix\")]) -dnl -dnl Turn off Pentium optimizations by default. -dnl -allegro_pentium_optimizations=no - dnl dnl Test for modules support (dlopen interface and -export-dynamic linker flag). dnl @@ -207,7 +202,7 @@ AC_DEFUN(ALLEGRO_ACTEST_SUPPORT_XWINDOWS, test "X$enableval" != "Xno" && allegro_enable_xwin_shm=yes, allegro_enable_xwin_shm=yes) AC_ARG_ENABLE(xwin-vidmode, -[ --enable-xwin-vidmode[=x] enable the use of XF86VidMode Extension [default=yes]], +[ --enable-xwin-vidmode[=x] enable the use of XF86VidMode Ext. [default=yes]], test "X$enableval" != "Xno" && allegro_enable_xwin_xf86vidmode=yes, allegro_enable_xwin_xf86vidmode=yes) AC_ARG_ENABLE(xwin-dga, @@ -378,10 +373,62 @@ test "X$enableval" != "Xno" && allegro_enable_esddigi=yes, allegro_enable_esddigi=yes) if test -n "$allegro_enable_esddigi"; then - AC_CHECK_HEADER(esd.h, allegro_support_esddigi=yes) - if test -n "$allegro_support_esddigi" && - test -z "$allegro_support_modules"; then - LIBS="-lesd $LIBS" + AC_PATH_PROG(ESD_CONFIG, esd-config) + if test -n "$ESD_CONFIG"; then + ALLEGRO_OLD_LIBS="$LIBS" + ALLEGRO_OLD_CFLAGS="$CFLAGS" + LIBS="`$ESD_CONFIG --libs` $LIBS" + CFLAGS="`$ESD_CONFIG --cflags` $CFLAGS" + AC_MSG_CHECKING(for esd_open_sound) + AC_TRY_LINK([#include ], + [esd_open_sound(0);], + [allegro_support_esddigi=yes + if test -n "$allegro_support_modules"; then + LIBS="$ALLEGRO_OLD_LIBS" + fi], + [CFLAGS="$ALLEGRO_OLD_CFLAGS" + LIBS="$ALLEGRO_OLD_LIBS"]) + if test -n "$allegro_support_esddigi"; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + fi +fi]) + +dnl +dnl Test for ARTS DIGI driver. +dnl +dnl Variables: +dnl allegro_support_artsdigi=(yes|) +dnl +AC_DEFUN(ALLEGRO_ACTEST_ARTSDIGI, +[AC_ARG_ENABLE(artsdigi, +[ --enable-artsdigi[=x] enable building ARTS DIGI driver [default=yes]], +test "X$enableval" != "Xno" && allegro_enable_artsdigi=yes, +allegro_enable_artsdigi=yes) + +if test -n "$allegro_enable_artsdigi"; then + AC_PATH_PROG(ARTSC_CONFIG, artsc-config) + if test -n "$ARTSC_CONFIG"; then + ALLEGRO_OLD_LIBS="$LIBS" + ALLEGRO_OLD_CFLAGS="$CFLAGS" + LIBS="`$ARTSC_CONFIG --libs` $LIBS" + CFLAGS="`$ARTSC_CONFIG --cflags` $CFLAGS" + AC_MSG_CHECKING(for arts_init) + AC_TRY_LINK([#include ], + [arts_init();], + [allegro_support_artsdigi=yes + if test -n "$allegro_support_modules"; then + LIBS="$ALLEGRO_OLD_LIBS" + fi], + [CFLAGS="$ALLEGRO_OLD_CFLAGS" + LIBS="$ALLEGRO_OLD_LIBS"]) + if test -n "$allegro_support_artsdigi"; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi fi fi]) @@ -462,10 +509,30 @@ dnl AC_DEFUN(ALLEGRO_ACTEST_GCC_VERSION, [AC_MSG_CHECKING(whether -fomit-frame-pointer is safe) AC_CACHE_VAL(allegro_cv_support_fomit_frame_pointer, -[if test $GCC = yes && $CC --version | grep -q '3\.0\(\.\?[[012]]\)\?$'; then +[if test $GCC = yes && $CC --version | grep '3\.0\(\.\?[[012]]\)\?$' >/dev/null; then allegro_cv_support_fomit_frame_pointer=no else allegro_cv_support_fomit_frame_pointer=yes fi ]) AC_MSG_RESULT($allegro_cv_support_fomit_frame_pointer)]) + +dnl Test for include path conflict with gcc 3.1 or later. +dnl +dnl Variables: +dnl allegro_cv_support_include_prefix +dnl +AC_DEFUN(ALLEGRO_ACTEST_GCC_INCLUDE_PREFIX, +[AC_MSG_CHECKING(whether an include prefix is needed) +allegro_save_CFLAGS="$CFLAGS" +CFLAGS="-Werror -I$prefix/include $CFLAGS" +AC_CACHE_VAL(allegro_cv_support_include_prefix, +[if test $GCC = yes; then + AC_TRY_COMPILE(,int foo(){return 0;}, allegro_cv_support_include_prefix=yes, allegro_cv_support_include_prefix=no) +else + allegro_cv_support_include_prefix=yes +fi +]) +CFLAGS="$allegro_save_CFLAGS" +AC_MSG_RESULT($allegro_cv_support_include_prefix)]) + diff --git a/allegro.cfg b/allegro.cfg index d819a4b542..fc9721e58d 100644 --- a/allegro.cfg +++ b/allegro.cfg @@ -27,6 +27,7 @@ system = # # BE - Belgium # BR - Brazil +# CF - Canada (French) # CH - Switzerland # CZ - Czech Republic # DE - Germany @@ -151,6 +152,18 @@ framebuffer = +# Unix/X11 only: whether to force window centering in fullscreen mode +# for the XWFS driver (yes or no) +force_centering = + + + +# Windows only: whether to disable direct updating in color conversion +# mode for the DXWN driver (yes or no) +disable_direct_updating = + + + # Linux/fbcon mode timings. Duplicate then fill in `X', `Y' and # the timings themselves. You can copy them from fb.modes directly -- the @@ -246,6 +259,7 @@ mouse_accel_factor = # 0 - none # OSSD - Open Sound System # ESDD - Enlightened Sound Daemon +# ARTS - aRts (Analog Real-Time Synthesizer) # ALSA - ALSA Sound System # # BeOS digital sound drivers: @@ -289,7 +303,7 @@ digi_card = # BeOS music drivers: # # 0 - none -# BMID - BeOS MIDI synthetizer +# BMID - BeOS MIDI synthesizer # DIGI - DIGMID software wavetable # @@ -413,7 +427,7 @@ alsa_numfrags = -# BeOS only: MIDI synthetizer instruments quality (0=low, 1=high) +# BeOS only: MIDI synthesizer instruments quality (0=low, 1=high) be_midi_quality = diff --git a/configure.in b/configure.in index a1978f7b15..894dfcae0b 100644 --- a/configure.in +++ b/configure.in @@ -6,6 +6,9 @@ AC_CONFIG_HEADER(include/allegro/platform/alunixac.h:include/allegro/platform/al AC_PREREQ(2.12) AC_ARG_PROGRAM +dnl Build CFLAGS from scratch +CFLAGS= + dnl Enable 8-bpp color depth (default). AC_ARG_ENABLE(color8, [ --enable-color8[=x] enable support for 8-bpp modes [default=yes]], @@ -72,10 +75,17 @@ AC_ARG_ENABLE(staticprog, [ --enable-staticprog[=x] link programs with static library [default=no]], test "X$enableval" != "Xno" && allegro_build_static_programs=yes) -dnl Enable Pentium optimizations. -AC_ARG_ENABLE(pentiumopts, -[ --enable-pentiumopts[=x] enable Pentium optimizations [default=no]], -test "X$enableval" != "Xno" && allegro_pentium_optimizations=yes) +dnl Enable x86 processor-specific optimizations. +AC_ARG_ENABLE(opts, +[ --enable-opts=CPU enable x86 processor optimizations [pentium]], +test "X$enableval" != "Xyes" && allegro_optimizations=$enableval, +allegro_optimizations=pentium) + +dnl Enable x86 processor-specific exclusive optimizations. +AC_ARG_ENABLE(exclopts, +[ --enable-exclopts=CPU enable x86 processor exclusive optimizations [none]], +test "X$enableval" != "Xyes" && allegro_exclusive_optimizations=$enableval, +allegro_exclusive_optimizations=none) dnl Sanity check on shared/static options if test "X$allegro_static_libraries" != "Xyes"; then @@ -92,9 +102,13 @@ AC_ARG_ENABLE(strictwarn, [ --enable-strictwarn[=x] produce strict compiler warnings [default=no]], test "X$enableval" != "Xno" && allegro_strict_warnings=yes) +dnl Check that $prefix is set (needed for ALLEGRO_ACTEST_GCC_INCLUDE_PREFIX) +test "$prefix" = NONE && prefix=/usr/local + dnl Check for tools. AC_PROG_CC ALLEGRO_ACTEST_GCC_VERSION +ALLEGRO_ACTEST_GCC_INCLUDE_PREFIX AC_PROG_CPP ALLEGRO_ACTEST_PROG_LD_S AC_PROG_RANLIB @@ -103,10 +117,13 @@ AC_PROG_MAKE_SET AC_PROG_LN_S dnl LDCONFIG is used for installing shared libraries, in Linux/ELF at least -AC_PATH_PROGS(LDCONFIG, ldconfig, [echo ought to run ldconfig], $PATH:/sbin:/usr/sbin) +AC_PATH_PROG(LDCONFIG, ldconfig, [echo ought to run ldconfig], $PATH:/sbin:/usr/sbin) +dnl MAKEINFO is needed for producing the info pages +AC_PATH_PROG(MAKEINFO, makeinfo, [echo ought to run makeinfo], $PATH:/sbin/:/usr/sbin) + dnl INSTALL_INFO is needed for installing the info pages -AC_PATH_PROGS(INSTALL_INFO, install-info, [echo ought to run install-info], $PATH:/sbin:/usr/sbin) +AC_PATH_PROG(INSTALL_INFO, install-info, [echo ought to run install-info], $PATH:/sbin:/usr/sbin) dnl Test for asm support. ALLEGRO_ACTEST_SUPPORT_ASM @@ -156,46 +173,13 @@ if test -n "$allegro_support_modules"; then AC_DEFINE(ALLEGRO_WITH_MODULES) fi -dnl How to compile C and asm files. -if test -n "GCC"; then - if test "X$allegro_strict_warnings" = "Xyes"; then - WFLAGS="-Wall -Werror" - else - WFLAGS="-Wall" - fi - if test "X$allegro_pentium_optimizations" = "Xyes"; then - TARGET_ARCH="-mcpu=pentium" - else - TARGET_ARCH= - fi - if test "X$allegro_cv_support_fomit_frame_pointer" = "Xyes"; then - CFLAGS="$TARGET_ARCH -O2 -funroll-loops -ffast-math -fomit-frame-pointer $WFLAGS" - else - CFLAGS="$TARGET_ARCH -O2 -funroll-loops -ffast-math $WFLAGS" - fi - ALLEGRO_DEBUG_CFLAGS="-g $WFLAGS -DDEBUGMODE" - ALLEGRO_PROFILE_CFLAGS="-pg $TARGET_ARCH -O2 -funroll-loops -ffast-math $WFLAGS" - if test "$allegro_cv_support_asm" != i386; then - CFLAGS="$CFLAGS -DALLEGRO_USE_C" - ALLEGRO_DEBUG_CFLAGS="$ALLEGRO_DEBUG_CFLAGS -DALLEGRO_USE_C" - ALLEGRO_PROFILE_CFLAGS="$ALLEGRO_PROFILE_CFLAGS -DALLEGRO_USE_C" - fi - ALLEGRO_SFLAGS="-x assembler-with-cpp" - ALLEGRO_SHAREDLIB_CFLAGS="-fPIC -DALLEGRO_SHARED" +dnl Do we need to pass the include prefix to the compiler? +if test "$allegro_cv_support_include_prefix" = "yes"; then + INCLUDE_PREFIX="$prefix" else - CFLAGS="$CFLAGS -DALLEGRO_LIB_BUILD" - ALLEGRO_DEBUG_CFLAGS="$CFLAGS" - ALLEGRO_PROFILE_CFLAGS="$CFLAGS" - ALLEGRO_SFLAGS= - ALLEGRO_SHAREDLIB_CFLAGS= + INCLUDE_PREFIX= fi -CFLAGS="$CFLAGS -DALLEGRO_LIB_BUILD" - -AC_SUBST(CFLAGS) -AC_SUBST(ALLEGRO_DEBUG_CFLAGS) -AC_SUBST(ALLEGRO_PROFILE_CFLAGS) -AC_SUBST(ALLEGRO_SFLAGS) -AC_SUBST(ALLEGRO_SHAREDLIB_CFLAGS) +AC_SUBST(INCLUDE_PREFIX) dnl Which version of library to link with (shared/debugging/profiling/normal)? if test "X$allegro_build_debugging_programs" = "Xyes"; then @@ -291,6 +275,12 @@ if test -n "$allegro_support_esddigi"; then AC_DEFINE(ALLEGRO_WITH_ESDDIGI) fi +dnl Test for aRts drivers. +ALLEGRO_ACTEST_ARTSDIGI +if test -n "$allegro_support_artsdigi"; then + AC_DEFINE(ALLEGRO_WITH_ARTSDIGI) +fi + dnl Test for OSS MIDI drivers. ALLEGRO_ACTEST_OSSMIDI if test -n "$allegro_support_ossmidi"; then @@ -370,6 +360,7 @@ case "$allegro_system" in AC_CHECK_HEADERS(sys/io.h linux/joystick.h) if test "$allegro_enable_vga" = yes; then + allegro_support_vga=yes AC_DEFINE(ALLEGRO_LINUX_VGA) fi @@ -396,7 +387,7 @@ case "$allegro_system" in fi AC_MSG_CHECKING(for vga_version in vga.h) AC_CACHE_VAL(allegro_cv_have_vga_version, - [AC_TRY_COMPILE([#include ], [int x = vga_version;], + [AC_TRY_COMPILE([#include ], [int x = vga_version; x++;], allegro_cv_have_vga_version=yes, allegro_cv_have_vga_version=no)]) AC_MSG_RESULT($allegro_cv_have_vga_version) @@ -422,7 +413,7 @@ dnl Modules. if test -n "$allegro_support_modules"; then dnl VGA/ModeX. - if test "X$allegro_enable_vga" = "Xyes"; then + if test "X$allegro_support_vga" = "Xyes"; then ALLEGRO_MODULE_TARGETS="$ALLEGRO_MODULE_TARGETS lib/unix/alleg-vga.so" fi @@ -451,6 +442,11 @@ if test -n "$allegro_support_modules"; then ALLEGRO_MODULE_TARGETS="$ALLEGRO_MODULE_TARGETS lib/unix/alleg-esddigi.so" fi + dnl aRts DIGI. + if test "X$allegro_support_artsdigi" = "Xyes"; then + ALLEGRO_MODULE_TARGETS="$ALLEGRO_MODULE_TARGETS lib/unix/alleg-artsdigi.so" + fi + dnl DGA2. if test "X$allegro_support_xf86dga2" = "Xyes"; then ALLEGRO_MODULE_TARGETS="$ALLEGRO_MODULE_TARGETS lib/unix/alleg-dga2.so" @@ -479,6 +475,51 @@ AC_TYPE_SIGNAL AC_FUNC_VPRINTF AC_CHECK_FUNCS(memcmp mkstemp stricmp strlwr strupr) +dnl Tweak header files for library build +CFLAGS="$CFLAGS -DALLEGRO_LIB_BUILD" + +dnl How to compile C and asm files. +if test -n "GCC"; then + if test "X$allegro_strict_warnings" = "Xyes"; then + WFLAGS="-Wall -W -Wstrict-prototypes -Wno-unused -Werror" + else + WFLAGS="-Wall -Wno-unused" + fi + if test "$allegro_cv_support_asm" = i386; then + if test "$allegro_exclusive_optimizations" != none; then + TARGET_ARCH="-march=$allegro_exclusive_optimizations" + else + TARGET_ARCH="-mcpu=$allegro_optimizations" + fi + else + TARGET_ARCH= + fi + if test "$allegro_cv_support_asm" != i386; then + CFLAGS="$CFLAGS -DALLEGRO_USE_C" + fi + dnl In this order... + ALLEGRO_DEBUG_CFLAGS="$CFLAGS -g $WFLAGS -DDEBUGMODE" + ALLEGRO_PROFILE_CFLAGS="$CFLAGS -pg $TARGET_ARCH -O2 -funroll-loops -ffast-math $WFLAGS" + if test "X$allegro_cv_support_fomit_frame_pointer" = "Xyes"; then + CFLAGS="$CFLAGS $TARGET_ARCH -O2 -funroll-loops -ffast-math -fomit-frame-pointer $WFLAGS" + else + CFLAGS="$CFLAGS $TARGET_ARCH -O2 -funroll-loops -ffast-math $WFLAGS" + fi + ALLEGRO_SFLAGS="-x assembler-with-cpp" + ALLEGRO_SHAREDLIB_CFLAGS="-fPIC -DALLEGRO_SHARED" +else + ALLEGRO_DEBUG_CFLAGS="$CFLAGS" + ALLEGRO_PROFILE_CFLAGS="$CFLAGS" + ALLEGRO_SFLAGS= + ALLEGRO_SHAREDLIB_CFLAGS= +fi + +AC_SUBST(CFLAGS) +AC_SUBST(ALLEGRO_DEBUG_CFLAGS) +AC_SUBST(ALLEGRO_PROFILE_CFLAGS) +AC_SUBST(ALLEGRO_SFLAGS) +AC_SUBST(ALLEGRO_SHAREDLIB_CFLAGS) + dnl Prepare initial dependencies file (if missing). if test -f "$srcdir/makefile.dep"; then if test `cd "$srcdir" ; pwd` != `cd . ; pwd`; then @@ -489,8 +530,7 @@ if test -f "$srcdir/makefile.dep"; then sleep 1 fi elif test ! -f makefile.dep; then - echo '# Execute "make depend".' >makefile.dep - allegro_make_depend="yes"; + allegro_make_depend="yes" fi dnl Prepare makefile and allegro-config. @@ -500,9 +540,12 @@ AC_OUTPUT(makefile:makefile.in allegro-config:misc/allegro-config.in, dnl Run "make depend" if necessary. if test "X$allegro_make_depend" = "Xyes"; then dnl The makefile doesn't work with non-gmake at the moment, so force gmake. - if ${MAKE-make} -h | grep -iq gnu; then + if ${MAKE-make} -v -f /dev/null 2>/dev/null | grep -i "gnu" >/dev/null; then ${MAKE-make} depend else + AC_MSG_WARN([Non-GNU make detected, trying gmake to build dependencies.]) gmake depend + AC_MSG_WARN([You need to use GNU make to build Allegro.]) + AC_MSG_WARN([This might be called gmake on your system.]) fi fi diff --git a/demo/demo.c b/demo/demo.c index ba2eca3df1..54d67b4117 100644 --- a/demo/demo.c +++ b/demo/demo.c @@ -18,6 +18,7 @@ #include #include +#include #include "allegro.h" #include "demo.h" @@ -2000,6 +2001,7 @@ int main(int argc, char *argv[]) jumpstart = TRUE; } + srand(time(NULL)); allegro_init(); install_keyboard(); install_timer(); diff --git a/demo/music.txt b/demo/music.txt index 583be747ed..8c5f93863d 100644 --- a/demo/music.txt +++ b/demo/music.txt @@ -1,5 +1,5 @@ -The music in the demo game is by Garret Thomson (gart@terraport.net). +The music in the demo game is by Garret Thomson (g@sirsonic.com). Garret has written the music to two IBM shareware games; Clyde's revenge, from Moonlite Software, and Maximum Justice, by Supremetek software. He has @@ -10,7 +10,7 @@ the last 4 years. He is always willing to take on a new project, and provide any original music a programmer might need for a game. He writes all styles of music, and can compose anything from rock to techno to jazz; whatever you have in mind, he can meet your needs. If you are interested in contacting -him, email him at gart@terraport.net. +him, email him at g@sirsonic.com. For more information about him and his music, point your web browser at http://www.cybertheque.com/galerie/garret/ diff --git a/docs/build/bcc32.txt b/docs/build/bcc32.txt index 727d817f00..b50659197b 100644 --- a/docs/build/bcc32.txt +++ b/docs/build/bcc32.txt @@ -25,31 +25,38 @@ creating the very useful IMPLIB program. + =========================================== ============ Required software ============ =========================================== - Borland C++Builder (or Borland C++ command line tools) - - GNU make (mak*b.zip). - - Optional: rm (fil*b.zip). Used by the clean targets. - - Optional: sed (sed*b.zip). Used by "make depend" and "fixdll". - - Optional: sort (txt*b.zip). Used by "fixdll". Use Unix sort, not DOS! + - Recent set of DirectX and other Windows SDK headers. + - GNU make 3.77 or higher. + - Optional: GNU sed. Used by "make depend" and "fixdll.bat". + - Optional: GNU sort (not DOS sort). Used by "fixdll.bat". In order to run your programs, you need to obtain the Allegro DLLs and install them in the Windows system directory. This is known to work with the Borland C++ 5.5 command line compiler. + Earlier versions may cause problems (for example v5.02). You need to use GNU make, since Borland make is really ugly about its - makefiles. You can grab it from either the MinGW32 or DJGPP - distributions; more info on this in available in the MinGW32 and DJGPP - READMEs. + makefiles. You can grab it from either the MinGW32 or DJGPP + distributions; more info on this in available in the following files: + docs/build/mingw32.txt and docs/build/djgpp.txt. + ============================================ ============ Installing Allegro ============ ============================================ + Set up your environment so that Borland C++ can be used from the + commandline. Then set the variable BCC32DIR to the directory where + Borland C++ is located, for example 'set BCC32DIR=c:\bcc32'. + Type "cd allegro" and then "fix.bat bcc32". Then, run "make". Find something fun to do while it's compiling. It will eventually finish; then just type "make install" to set the library up for use. @@ -67,7 +74,7 @@ If your copy of Allegro doesn't include the linker .def file (unlikely, unless you have run "make veryclean" at some point), you can regenerate - them by running "fixdll.bat". + it by running "misc\fixdll.bat". @@ -86,5 +93,15 @@ Don't forget that you need to use the END_OF_MAIN() macro right after your main() function! + Note: including any Allegro headers in a C++ program currently prevents + Borland C++ from compiling it. The workaround is to include the following + 6 standard C headers prior to including any Allegro headers: + #include + #include + #include + #include + #include + #include + You will need to distribute the appropriate DLL along with your program. diff --git a/docs/build/beos.txt b/docs/build/beos.txt index 53dec1dbf3..c5c8833f8a 100644 --- a/docs/build/beos.txt +++ b/docs/build/beos.txt @@ -29,9 +29,9 @@ BeOS Intel R4 and R5 Pro Edition come with everything you need. If you have BeOS Intel R5 Personal Edition, you require the development tools; - these can be found on the Be homepage at http://www.be.com. - You also need updated binutils, which can be found at bebits.com. It - might not be a bad idea to update gcc as well, but is not required. + these can be found on the Be homepage at http://www.be.com. You also need + updated binutils, which can be found at http://bebits.com. It might not + be a bad idea to update gcc as well, but is not required. @@ -39,10 +39,10 @@ ============ Installing Allegro ============ ============================================ - Allegro comes as a source distribuition; this means you'll have to - compile it to get it to work. Unzip the library archive wherever you - want, and cd into that directory with a Terminal. Due to the multi-platform - nature of Allegro, you need to run: + Allegro comes as a source distribuition: you'll have to compile it to get + it to work. Unzip the library archive wherever you want, and cd into that + directory with a Terminal. Due to the multi-platform nature of Allegro, + you need to run: fix.sh beos @@ -57,8 +57,8 @@ With this last command the Allegro library will be installed into /boot/home/config/lib (the default location for BeOS shared libraries), - while the headers will go into /boot/develop/headers (the default locations - where Be looks for them). + while the headers will go into /boot/develop/headers (the default + locations where Be looks for them). You have now installed Allegro! See the rest of the documentation and examples to learn more about it. A simple example of a command line to @@ -89,33 +89,36 @@ If you have compiled a static version of the library, it will be copied to /boot/develop/lib/x86. + + ======================================= ============ Using Allegro ============ ======================================= Linking Allegro to a program also requires you to link several other BeOS - libraries and set the correct library search pathes. To simplify the linking - process, the installation sets up a script, allegro-config, that will print - out a suitable commandline. You can use this inside backtick command - substitution, for example: + libraries and set the correct library search pathes. To simplify the + linking process, the installation sets up a script, allegro-config, that + will print out a suitable commandline. You can use this inside backtick + command substitution, for example: gcc myfile.c -o myprogram `allegro-config --static` This will enable you to link against the static library. The `allegro-config --shared` option mentioned above will output all the - options and libraries needed to link dynamically against the shared version - of the Allegro library. If you use --libs instead of --shared or --static, - the script will generate the linking arguments according to the latest - installed library version. You can also run these allegro-config commands - on the commandline to see what exactly they do. + options and libraries needed to link dynamically against the shared + version of the Allegro library. If you use --libs instead of --shared or + --static, the script will generate the linking arguments according to the + latest installed library version. You can also run these allegro-config + commands on the commandline to see what exactly they do. If you want to build a debug version of your program, assuming that you have installed the debug version of Allegro, use: gcc myfile.c -o myprogram `allegro-config --libs debug` - Terminal newbies, take note that these are ` backticks, not normal ' quotes! + Terminal newbies, take note that these are ` backticks, not normal ' + quotes! There are also other switches for printing out the Allegro version number, or to override the install paths. Run allegro-config without any diff --git a/docs/build/djgpp.txt b/docs/build/djgpp.txt index 493293bb43..3d2849e119 100644 --- a/docs/build/djgpp.txt +++ b/docs/build/djgpp.txt @@ -20,7 +20,10 @@ ===================================== Status: complete. This is the original Allegro version, and has had - plenty of time to become nice and stable. + plenty of time to become nice and stable. However, under Windows NT, + 2000, or XP you will very likely experience problems and should consider + using the native Windows version of Allegro instead, less likely to give + you problems under such environments. @@ -34,7 +37,6 @@ - Binutils 2.9.x or later (bnu*b.zip). - GNU make (mak*b.zip). - Texinfo (txi*b.zip). - - Optional: rm (fil*b.zip). Used by the clean and uninstall targets. - Optional: sed (sed*b.zip). Used by "make depend". All of the above can be downloaded from your nearest SimTel mirror site, diff --git a/docs/build/linux.txt b/docs/build/linux.txt index 6eecb38f57..828c33257b 100644 --- a/docs/build/linux.txt +++ b/docs/build/linux.txt @@ -160,10 +160,5 @@ When using the PS/2 Intellimouse protocol, it is necessary to explicitly put the mouse into wheel mode, which requires Allegro - to have write permissions to the device. As this only has to be - done once (the mouse will remember its state unless you unplug - it), an alternative to changing device file permissions is to - initialise the mouse during boot up with GPM. To do this, edit - your init scripts and use the `-t imps2 -m /dev/psaux' options for - GPM. If you do not want GPM active, kill it with `gpm -k'. + to have write permissions to the device. diff --git a/docs/build/macos.txt b/docs/build/macos.txt index 441dea7115..f791d10308 100644 --- a/docs/build/macos.txt +++ b/docs/build/macos.txt @@ -13,7 +13,8 @@ By Ronaldo H. Yamada See readme.txt for copyright information. - + + ==================================== ============ MPW notes ============= @@ -27,6 +28,7 @@ missing or otherwise not working very well. + =========================================== ============ Required hardware ============ =========================================== @@ -34,6 +36,7 @@ - An Power Macintosh + =========================================== ============ Required software ============ =========================================== @@ -52,9 +55,11 @@ developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM_Images/> An old version of the headers is included with MPW, but I use a new set - DrawSprocketSDK and SoundManager can be obtained directly from Apple + DrawSprocketSDK and SoundManager can be obtained directly from Apple. + + * the final users can need theses softwares. + - *the final users can need theses softwares ============================================ ============ Installing Allegro ============ @@ -63,13 +68,16 @@ This is a source-only distribution, so you will have to compile Allegro before you can use it. To do this you should: - Set up the current directory to main allegro dir(which contains this file). - If launch MPW droping this file then, this is probably done + Set up the current directory to main allegro dir (which contains the file + fixmpw.sh). If launch MPW droping this file then, this is probably done. + + On Worksheet window type fixmpw.sh followed by Command-Return or Enter. + This sets the library up ready for use. + + Install a debugging version of the library, be patient this take many + minutes. If required you must quit the MPW Shell before use the library. + - On Worksheet window type fixmpw.sh followed by Command-Return or Enter - this set the library up ready for use. - install a debugging version of the library. be patient this take many minutes - If required you must quit the MPW Shell before use the library ================================================ ============ Custom install Allegro ============ @@ -86,11 +94,12 @@ fixmpw.sh alld tests + + ======================================= ============ Using Allegro ============ ======================================= - Allegro could be work like an Shared Library, so for future compatibility you must define the preprocessor should symbol ALLEGRO_STATICLINK before including any of the Allegro headers. @@ -120,7 +129,8 @@ "{PPCLibraries}PPCCRuntime.o" "{PPCLibraries}PPCToolLibs.o" - you always should tell about allegro entry point in linking, include this option + you always should tell about allegro entry point in linking, include this + option: -m MacEntry @@ -135,10 +145,11 @@ see examples in tests:mac folder + ========================================== ============ Unistall Allegro ============ ========================================== - delete the Allegro Folder at Interfaces&Libraries - and the Script "SetAllegro" from Startup Itens Folder + Delete the Allegro Folder at Interfaces&Libraries + and the Script "SetAllegro" from Startup Items Folder. diff --git a/docs/build/mingw32.txt b/docs/build/mingw32.txt index 8d730c3406..da4ace5c19 100644 --- a/docs/build/mingw32.txt +++ b/docs/build/mingw32.txt @@ -16,6 +16,8 @@ Robert J Ohannessian added some updates to the installation instructions and added an example on how to use Dev-C++ with Allegro. + Elias Pschernig and Hein Zelle revamped the cross-compilation section. + See readme.txt for a more general overview. @@ -38,12 +40,11 @@ will work. This is because GNU make will automatically use sh.exe instead of command.com if it finds it somewhere in the path. - 'make depend' and 'fixdll.bat' requires that you have GNU sed installed. - 'make clean' and 'make uninstall' requires that you have GNU fileutils - installed. You can download some extra utilities for MingW32 from - 'http://agnes.dida.physik.uni-essen.de/~janjaap/mingw32/download.html' - and - 'ftp://ftp.franken.de/pub/win32/develop/gnuwin32/mingw32/porters/Mikey/'. + "make depend" and "fixdll.bat" requires that you have GNU sed installed. + "fixdll.bat" requires that you have GNU sort (not DOS !) installed. + The clean targets require that you have GNU fileutils installed. + You can download some extra utilities for MingW32 from: + http://sourceforge.net/projects/gnuwin32/ If you at any stage in the installation process get an 'Out of Environment space' message, then please see the Allegro F.A.Q. @@ -89,10 +90,9 @@ distributions from the internet. Please don't unzip/install until step 3. 1) Download the complete MingW32 distribution from 'http://www.mingw.org' - You should download the complete package instead the many small ones - unless you want to move files manually. :-) At the time of writing - (November, 2001) version 1.1 is the newest. A direct link is here: - 'http://prdownloads.sourceforge.net/mingw/MinGW-1.1.tar.gz' + or 'http://sourceforge.net/projects/mingw/'. You should download the + complete package instead of the many small ones unless you want to + move files manually. :-) Note that gcc 2.95.3 at least is required. 2) Get the minimal DirectX 7 SDK for MingW32. (dx70_mgw.zip) Download it from 'http://alleg.sourceforge.net/wip.html'. Please don't confuse it @@ -153,8 +153,8 @@ (November, 2001) version 1.1 is the newest. A direct link is here: 'http://prdownloads.sourceforge.net/mingw/MinGW-1.1.tar.gz' - 2) Download the Dev-C++ 4 IDE (without Mingw compiler and libraries) from - 'http://www.bloodshed.net/dev/download.html'. + 2) Download the Dev-C++ 4 IDE (without MingW32 compiler and libraries) + from 'http://www.bloodshed.net/dev/download.html'. Once again, make sure you do not install it until you get to step 4. 3) Get the minimal DirectX 7 SDK for MingW32. (dx70_mgw.zip) Download it @@ -166,9 +166,9 @@ 4) Install the package from step 1. I recommend you unzip it to 'C:\Dev-Cpp' (the following steps assume this is what you used). - Do NOT install it in a directory name with spaces, plus signs, minus - signs, slashes, or anything else that's fancy enough to break the - compiler. That goes double for people installing in C:\Program Files. + Do NOT install it in a directory name with spaces, plus signs, slashes, + or anything else that's fancy enough to break the compiler. + That goes double for people installing in C:\Program Files. 5) Install the package from step 2 to 'C:\Dev-Cpp'. Overwrite any existing files. @@ -210,18 +210,20 @@ and an example program. + ============================================ ==== Setting up Cygwin to build Allegro ==== ============================================ 1) Obtain the Cygwin packages. Get setup.exe from 'http://sources.redhat.com/cygwin/'. Start the Cygwin setup program - and download these packages: bash, binutils, cygwin, fileutils, gcc, - gdb, login, make, man, mingw, sed, sh-utils, texinfo, textutils and - w32api. + and download these packages: bash, binutils, cygwin, cygutils, + fileutils, gcc, gdb, login, make, man, mingw-runtime, sed, sh-utils, + texinfo, textutils and w32api. - Install these packages. The rest of these instructions assumes - you installed to 'c:\cygwin'. + Install these packages (run setup.exe once more). The rest of these + instructions assumes you installed to 'c:\cygwin'. When setup asks + you which line endings you want, select unix-style instead of DOS. 2) Get the minimal DirectX 7 SDK for MingW32. (dx70_mgw.zip) Download it from 'http://alleg.sourceforge.net/wip.html' and unzip it to a @@ -237,7 +239,7 @@ and/or on your Windows start menu. Make sure /bin/sh exists, if not just run: 'ln -s /bin/bash.exe /bin/sh.exe'. - 5) Then run './fix.sh mingw32'. This will take a while... + 5) Then run './fix.sh mingw32 --dtou'. This will take a while... Test the installation by typing the following in the BASH shell: 'gcc -v'. The answer should be similar to: @@ -245,6 +247,12 @@ Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/specs gcc version 2.95.3-5 (cygwin special) + Note! If you have problems installing the profiling version of the Allegro + library, you will probably need to copy a file called libgmon.a from the + MingW32 distribution to your /lib/mingw directory (c:\cygwin\lib\mingw) in + cygwin. This is expected to be fixed in a later release of the + mingw-runtime package (I'm currently using mingw-runtime-1.2-1). + ======================================= @@ -253,24 +261,62 @@ Brief example of how to set up a MingW32 cross-compiler system: - 1) Download the prebuilt MingW32 cross-compiler from - 'http://www.devolution.com/~slouken/SDL/Xmingw32/' - Uncompress this file to '/usr/local/'. If you put the cross-compiler - elsewhere you will have to edit the file 'xmake.sh' and replace - XC_PATH and INSTALL_BASE with the right directory names. - - 2) Get the minimal DirectX 7 SDK for MingW32. (dx70_mgw.zip) Download it - from 'http://alleg.sourceforge.net/wip.html' and unzip it to - '/usr/local/cross-tools/i386-mingw32msvc/'. Make sure you convert all - text files to unix style (unzip -a) or the pre-processor will croak. - - 3) Then run './fix.sh mingw32 --dtou'. You are now finished with all the - preparations. + 1) Download and install the MingW32 cross-compiler. You can get the + software: + - directly from the MingW site: + http://sourceforge.net/projects/mingw/ + You need the following packages (as of February 2003): + - gcc (gcc-3.2.2-20030208-1-src.tar.gz) + - binutils (binutils-2.13.90-20030111-1-src.tar.gz) + - mingw runtime (mingw-runtime-2.4.tar.gz) + - w32api (w32api-2.2.tar.gz) + Optionally, you can get from the SDL site, + http://www.libsdl.org/extras/win32/common: + - opengl-devel (opengl-devel.tar.gz) + - using a more convenient script with instructions for downloading: + http://www.libsdl.org/extras/win32/cross/README.txt + Follow the instructions, and make sure to edit the build-crosh.sh + script so it downloads the most recent version of gcc and binutils. + - as a premade Debian package called 'mingw32', which you can install + with 'apt-get install mingw32'. + + 2) Get the minimal DirectX 7 SDK for MingW32 (dx70_mgw.zip). + Download it from 'http://alleg.sourceforge.net/wip.html' and unzip it + in the cross-compiler base directory. Make sure you convert all text + files to unix style (unzip -a) or the preprocessor will croak. The + DirectX package downloaded and installed by the SDL script is not up + to date: replace it with the package from the Allegro site. + + 3) Edit the file 'xmake.sh' in the root of your Allegro directory, + replacing XC_PATH, XPREFIX and INSTALL_BASE with the right names. + For example, if your compiler's base dir (the one with bin, lib and + include sub-folders) is /usr/i586-mingw32msvc, and you have prefix-less + binaries in /usr/i586-mingw32msvc/bin, you would use: + + XC_PATH=/usr/i586-mingw32msvc/bin + XPREFIX= + INSTALL_BASE=/usr/i586-mingw32msvc + + Note that the build-cross.sh script from SDL installs binaries both + with and without prefix, but some binaries (windres specifically) + are installed only with prefix. If you installed the crosscompiler + in /opt/cross-tools using this script, you would use: + + XC_PATH=/opt/cross-tools/i386-mingw32msvc/bin:/opt/cross-tools/bin + XPREFIX=i386-mingw32msvc- + INSTALL_BASE=/opt/cross-tools/i386-mingw32msvc + + 4) Run './fix.sh mingw32 --dtou' (--dtou is only needed if your Allegro + directory has text files in DOS format, otherwise you can use --quick). + If you are using a CVS version of Allegro, run 'make depend' to + generate the build dependencies, then run 'misc/fixdll.sh' to generate + the allegro.def file. You are now finished with all the preparations. - 4) You can now run './xmake.sh' to build the Allegro library and then run - './xmake.sh install' as root to install Allegro. You can use - 'xmake.sh' as you would use 'make' to compile any Allegro stuff. - For instance: To make documentation you can run './xmake.sh docs'. + 5) You can now run './xmake.sh' to build the Allegro library and then run + './xmake.sh install' as root to install it. Afterwards, you can use + 'xmake.sh' as you would use 'make' to compile your Allegro programs, or + you can use the 'cross-make.sh' and 'cross-configure.sh' scripts from + the SDL site. You must use 'xmake.sh' to compile Allegro itself though. @@ -305,6 +351,14 @@ make + If your copy of Allegro does not include the linker .def file (unlikely, + unless you have run "make veryclean" at some point, or are using the CVS + version of Allegro), you can regenerate it by running "misc\fixdll.bat". + You will need to have GNU sed and sort installed for this operation to + work. The version of sed that is linked from the MingW32 site does not + work properly; it has issues with end-of-line characters. You should get + sed and sort from the link at the top of this document. + Once the build is finished you can recover some disk space by running "make compress", which uses the UPX program to compress the executable files and the optimized dll. Before running "make compress", you must set @@ -318,7 +372,7 @@ make install - You have now installed mingW32 and allegro! See the rest of the + You have now installed MingW32 and allegro! See the rest of the documentation and examples to learn more about it. diff --git a/docs/build/msvc.txt b/docs/build/msvc.txt index ba3796e87c..9806e57b52 100644 --- a/docs/build/msvc.txt +++ b/docs/build/msvc.txt @@ -31,9 +31,8 @@ - Recent set of DirectX and other Windows SDK headers. - djgpp compiler (djdev*.zip, gcc*b.zip, and bnu*b.zip). - GNU make (mak*b.zip). - - Optional: rm (fil*b.zip). Used by the clean targets. - - Optional: sed (sed*b.zip). Used by "make depend" and "fixdll". - - Optional: sort (txt*b.zip). Used by "fixdll". Use Unix sort, not DOS! + - Optional: sed (sed*b.zip). Used by "make depend" and "fixdll.bat". + - Optional: sort (txt*b.zip). Used by "fixdll.bat". GNU sort, not DOS! Allegro should work ok with MSVC versions 4, 5 and 6. @@ -84,7 +83,7 @@ If your copy of Allegro doesn't include the linker .def file (unlikely, unless you have run "make veryclean" at some point), you can regenerate - them by running "fixdll.bat". + it by running "misc\fixdll.bat". Once the build is finished you can recover some disk space by running "make compress", which uses the UPX program to compress the executable diff --git a/docs/build/unix.txt b/docs/build/unix.txt index fd6215d4fd..a4771b02e1 100644 --- a/docs/build/unix.txt +++ b/docs/build/unix.txt @@ -108,6 +108,7 @@ To create the dependency files. + ======================================= ============ Using Allegro ============ ======================================= diff --git a/docs/build/watcom.txt b/docs/build/watcom.txt index aee8f56ef9..653dc4627e 100644 --- a/docs/build/watcom.txt +++ b/docs/build/watcom.txt @@ -26,10 +26,8 @@ hardware drivers: the djgpp and Watcom versions are 100% identical in this respect. - This library should work with Watcom C versions 10.6 or 11.0, but I have - no way to test anything but 10.6, and only minimal interest in - maintaining this port, so I'm afraid you are pretty much on your own if - you have problems with any different compiler versions. + This library works with version 10.6 and the various 11.0 versions of the + Watcom C compiler, as well as with Open Watcom 1.0 or later. @@ -37,11 +35,12 @@ ============ Required software ============ =========================================== - - Watcom C, version 10.6 or 11.0 + - Watcom C version 10.6 or 11.0x, or Open Watcom 1.0 or later. - djgpp compiler (djdev*.zip, gcc*b.zip, and bnu*b.zip). - GNU make (mak*b.zip). - - sed (sed*b.zip). - - Optional: rm (fil*b.zip). Used by the clean and uninstall targets. + - GNU sed (sed*b.zip): + Required for 10.6: Used to build asm sources. + Optional for other versions: Used by "make depend". Except for the Watcom compiler itself, all of the above packages can be downloaded from your nearest SimTel mirror site, in the diff --git a/docs/makedoc.c b/docs/makedoc.c index 749358e00d..dfa457d09d 100644 --- a/docs/makedoc.c +++ b/docs/makedoc.c @@ -16,6 +16,7 @@ #include #include #include +#include #define TEXT_FLAG 0x00000001 @@ -44,6 +45,7 @@ #define HEADER_FLAG 0x00800000 #define START_TITLE_FLAG 0x01000000 #define END_TITLE_FLAG 0x02000000 +#define MANGLE_EMAILS 0x08000000 #define TOC_SIZE 8192 @@ -97,12 +99,24 @@ char mansynopsis[256] = ""; char *html_extension = "html"; char *texinfo_extension = "txi"; +char *email_mangle_at, *email_mangle_dot; int mpreformat = 0; int mpreindent = 0; +static void _activate_email_mangling(const char *txt); +static void _mangle_email_links(char *buf); +static char *_mangle_email(const char *email, int len); +static char *my_strcat(char *dynamic_string, const char *normal_string); +static char *my_strdup(const char *text); +static void *my_xrealloc(void *ptr, size_t new_size); +static void *my_xmalloc(size_t size); +static void my_abort(int code); + + + int mytolower(int c) { if ((c >= 'A') && (c <= 'Z')) @@ -246,6 +260,11 @@ void free_data(void) free(tocprev); } + + if (email_mangle_at) + free(email_mangle_at); + if (email_mangle_dot) + free(email_mangle_dot); } @@ -438,6 +457,9 @@ int read_file(char *filename, char *htmlname) p--; } + if (flags & MANGLE_EMAILS) + _mangle_email_links(buf); + if (buf[0] == '@') { /* a marker line */ if (mystricmp(buf+1, "text") == 0) @@ -523,6 +545,9 @@ int read_file(char *filename, char *htmlname) add_toc_line(buf+11, NULL, 1, line, 0, 1, 1); else if (strincmp(buf+1, "multiwordheaders") == 0) multiwordheaders = 1; + else if (strincmp(buf+1, "mangle_emails=") == 0) { + _activate_email_mangling(buf+15); + } else if (buf[1] == '<') add_line(buf+1, (flags | HTML_FLAG | HTML_CMD_FLAG | NO_EOL_FLAG ) & (~TEXT_FLAG)); else if (buf[1] == '$') @@ -570,6 +595,91 @@ int read_file(char *filename, char *htmlname) +/* _activate_email_mangling: + * Called when the input ._tx file contains @mangle_emails=x. Activates + * the global mangling flag, and reads from txt two strings separated + * by space character which are meant to be used for '@' and '.' + * respectively in the email mangling. + */ +static void _activate_email_mangling(const char *txt) +{ + const char *p; + assert(txt); + assert(*txt); + + flags |= MANGLE_EMAILS; + /* free previous strings if they existed */ + if (email_mangle_at) free(email_mangle_at); + if (email_mangle_dot) free(email_mangle_dot); + + /* find space separator to detect words */ + p = strchr(txt, ' '); + assert(p); /* format specification requires two words with space */ + email_mangle_at = my_strdup(txt); + *(email_mangle_at + (p - txt)) = 0; + assert(*(p + 1)); /* second word required */ + email_mangle_dot = my_strdup(p+1); +} + + + +/* _mangle_email_links: + * Checks the given buffer for .. links and mangles them. + * Modifications are made directly over buf, make sure there's enough + * space in it. + */ +static void _mangle_email_links(char *buf) +{ + assert(buf); + while(*buf && (buf = strstr(buf, ""))) { + char *temp, *end = strstr(buf, ""); + assert(end); /* can't have multiline emails */ + buf += 7; + temp = _mangle_email(buf, end - buf); + memmove(buf + strlen(temp), end, strlen(end) + 1); + strncpy(buf, temp, strlen(temp)); + free(temp); + } +} + + +/* _mangle_email: + * Given a string, len characters will be parsed. '@' will be substituted + * by "' %s ', email_mangle_at", and '.' will be substituted by "' %s ", + * email_mangle_dot". The returned string has to be freed by the caller. + */ +static char *_mangle_email(const char *email, int len) +{ + char *temp, buf[2]; + int pos; + assert(email); + assert(*email); + assert(len > 0); + + temp = my_strdup(email); + *temp = 0; + buf[1] = 0; + for(pos = 0; pos < len; pos++) { + if(email[pos] == '@') { + temp = my_strcat(temp, " "); + temp = my_strcat(temp, email_mangle_at); + temp = my_strcat(temp, " "); + } + else if(email[pos] == '.') { + temp = my_strcat(temp, " "); + temp = my_strcat(temp, email_mangle_dot); + temp = my_strcat(temp, " "); + } + else { + buf[0] = email[pos]; + temp = my_strcat(temp, buf); + } + } + return temp; +} + + + char *strip_html(char *p) { static char buf[256]; @@ -789,7 +899,7 @@ void output_toc(FILE *f, char *filename, int root, int body, int part) else { strcpy(name, filename); s = extension(name)-1; - if ((int)s - (int)get_filename(name) > 5) + if (s - get_filename(name) > 5) s = get_filename(name)+5; sprintf(s, "%03d.%s", section_number, html_extension); hfprintf(f, "
  • %s\n", get_filename(name), ALT_TEXT(toc)); @@ -846,8 +956,15 @@ void output_toc(FILE *f, char *filename, int root, int body, int part) toc = toc->next; } - if (nested) + if (nested) { + if (i > 1) + qsort(ptr, i, sizeof(TOC *), toc_scmp); + for (j = 0; j < i; j++) + hfprintf(f, "
  • %s\n", ptr[j]->text, ALT_TEXT(ptr[j])); + + nested = i = 0; fprintf(f, "\n"); + } if (root) fprintf(f, "\n"); @@ -1175,7 +1292,7 @@ int write_html(char *filename) fclose(f); strcpy(buf, filename); s = extension(buf)-1; - if ((int)s - (int)get_filename(buf) > 5) + if (s - get_filename(buf) > 5) s = get_filename(buf)+5; sprintf(s, "%03d.%s", section_number-1, html_extension); printf("writing %s\n", buf); @@ -1325,16 +1442,25 @@ void html2texinfo(FILE *f, char *p) -void write_textinfo_xref(FILE *f, char *xref) +void write_textinfo_xref(FILE *f, char *xref, char **chapter_nodes) { char *tok; tok = strtok(xref, ",;"); while (tok) { + char **p = chapter_nodes; while ((*tok) && (myisspace(*tok))) tok++; - tfprintf(f, "@xref{%s}.@*\n", tok); + while(*p) { + if(!strincmp(tok, strip_html(*p))) + break; + p++; + } + if(*p) + tfprintf(f, "@xref{%s, %s}.@*\n", first_word(tok), strip_html(*p)); + else + tfprintf(f, "@xref{%s}.@*\n", tok); tok = strtok(NULL, ",;"); } } @@ -1346,14 +1472,14 @@ int write_texinfo(char *filename) char buf[256]; LINE *line = head, *title_line = 0; char *p, *str, *next, *prev; - char *xref[256]; + char *xref[256], *chapter_nodes[256]; int xrefs = 0; int in_item = 0; int section_number = 0; int toc_waiting = 0; int continue_def = 0; int title_pass = 0; - int i; + int i = 0; FILE *f; printf("writing %s\n", filename); @@ -1362,6 +1488,26 @@ int write_texinfo(char *filename) if (!f) return 1; + /* First scan all the chapters of the documents and build a lookup table + * with their text lines. This lookup table will be used during the + * generation of @xref texinfo commands, due to textinfo's restriction + * that nodes can't contain spaces, and hence remain as a single word. + */ + chapter_nodes[0] = 0; + while (line) { + if (line->flags & TEXINFO_FLAG) { + p = line->text; + + if (line->flags & HEADING_FLAG) { + chapter_nodes[i++] = p; + chapter_nodes[i] = 0; + } + } + line = line->next; + } + + line = head; + while (line) { if (line->flags & TEXINFO_FLAG) { p = line->text; @@ -1392,7 +1538,7 @@ int write_texinfo(char *filename) if (xrefs > 0) { fputs("See also:@*\n", f); for (i=0; i 0) { fputs("See also:@*\n", f); for (i=0; i 0) { fputs("See also:@*\n", f); for (i=0; itext, next, prev, node_name(section_number-1)); @@ -2518,3 +2664,84 @@ int main(int argc, char *argv[]) return err; } + + +/* my_strcat: + * Special strcat function, which is a mixture of realloc and strcat. + * The first parameter has to be a pointer to dynamic memory, since it's + * space will be resized with my_xrealloc (it can be NULL). The second + * pointer can be any type of string, and will be appended to the first + * one. This function returns a new pointer to the memory holding both + * strings. + */ +static char *my_strcat(char *dynamic_string, const char *normal_string) +{ + int len; + + if(!dynamic_string) + return my_strdup(normal_string); + + len = strlen(dynamic_string); + dynamic_string = my_xrealloc(dynamic_string, 1 + len + strlen(normal_string)); + strcpy(dynamic_string + len, normal_string); + return dynamic_string; +} + + + +/* my_strdup: + * Safe wrapper around strdup, always returns the duplicated string. + */ +static char *my_strdup(const char *text) +{ + char *p = my_xmalloc(strlen(text)+1); + return strcpy(p, text); +} + + + +/* my_xrealloc: + * Wrapper around real realloc call. Returns the new chunk of memory or + * aborts execution if it couldn't realloc it. + */ +static void *my_xrealloc(void *ptr, size_t new_size) +{ + if (!ptr) + return my_xmalloc(new_size); + ptr = realloc(ptr, new_size); + if (!ptr) my_abort(1); + return ptr; +} + + + +/* my_xmalloc: + * Returns the requested chunk of memory. If there's not enough + * memory, the program will abort. + */ +static void *my_xmalloc(size_t size) +{ + void *p = malloc(size); + if (!p) my_abort(1); + return p; +} + + + +/* my_abort: + * Aborts execution with a hopefully meaningful message. If code is less + * than 1, an undefined exit will happen. Available error codes: + * 1: insufficient memory + */ +static void my_abort(int code) +{ + switch(code) { + case 1: printf("Aborting due to insuficcient memory\n"); break; + default: printf("An undefined error caused abnormal termination\n"); + } + abort(); +} + + + + diff --git a/docs/src/abi._tx b/docs/src/abi._tx index 65442c1e1b..956fd5d184 100644 --- a/docs/src/abi._tx +++ b/docs/src/abi._tx @@ -69,12 +69,12 @@ Windows notes Linux notes To make sure an Allegro binary compiled on your machine will work on - another machine, do not disable any features with `configure'. Your + another machine, do not disable any "features" with `configure'. Your copy of Allegro must have assembly routines, threads, modules, all colour depths and X11 support enabled, amongst other things. If in doubt, leave it at the default setting. - When you are ready to distribute your binary, run "ldd ". + When you are ready to distribute your binary, run "ldd <mybinary>". It should say something like: liballeg.so.4.0 => /usr/local/lib/liballeg.so.4.0 (0xdeadbeaf) @@ -89,6 +89,13 @@ Linux notes See also the Windows section if you need to use a modified version of Allegro. + For people packaging Allegro for redistribution: Drivers that are + built as dynamically loaded modules may be disabled or left out, but + all others should be left in. Examples of drivers that are _not_ + dynamically loaded include: VBE/AF, DGA1, OSS digital, OSS MIDI. In + short, if a program built against a copy of default-options Allegro + will work with your final library, all is goodly. + @heading diff --git a/docs/src/ahack._tx b/docs/src/ahack._tx index f855e8905e..470eb324dd 100644 --- a/docs/src/ahack._tx +++ b/docs/src/ahack._tx @@ -188,32 +188,34 @@ for including a version number in things like the DLL filename. @heading Header Files -allegro.h lives in the include/ directory. This includes other headers which -live in the include/allegro/ tree. The reason for this slightly odd approach is -that allegro.h can include things like "allegro/internal/alconfig.h", which -will work both in-situ within the build directory, and if we copy allegro.h to -the system include directory and the other headers into -system_include/allegro/. This avoids cluttering the system directories with -lots of our headers, while still allowing programs to just include -<allegro.h>, and also makes it possible for people to access internal -headers with #include <allegro/internal/aintern.h>. - -allegro.h includes alconfig.h, which checks the current platform and -includes a helper header for this compiler (aldjgpp.h, almsvc.h, alwatcom.h, -etc). That helper header defines a bunch of macros describing the system, -emulates whatever things are needed to make the code compile properly, and -optionally defines ALLEGRO_EXTRA_HEADER and ALLEGRO_INTERNAL_HEADER if it is -going to need any other platform-specific includes. +allegro.h lives in the include/ directory. It is only a placeholder which +includes other headers which live in the include/allegro/ tree. The reason +for this slightly odd approach is that allegro.h can include things like +"allegro/keyboard.h", which will work both in-situ within the build +directory, and if we copy allegro.h to the system include directory and the +other headers into system_include/allegro/. This avoids cluttering the +system directories with lots of our headers, while still allowing programs +to just #include <allegro.h>, and also makes it possible for people to +access keyboard stuff with #include <allegro/keyboard.h>. + +base.h includes alconfig.h, which checks the current platform and includes +a helper header for this compiler (aldjgpp.h, almsvc.h, alwatcom.h, etc). +That helper header defines a bunch of macros describing the system, emulates +whatever things are needed to make the code compile properly, and optionally +defines ALLEGRO_EXTRA_HEADER and ALLEGRO_INTERNAL_HEADER if it is going to +need any other platform-specific includes. After including the platform header, the rest of alconfig.h defines a lot of generic helper macros to their default values, but only if the platform header hasn't already overridden these to something specific. -allegro.h contains structure definitions and function prototypes. At the end -of the file, it includes alinline.h, which defines all the inline routines -and vtable wrappers, along with C versions of the fixed point math routines -if no inline asm is available. If inline asm is supported, it includes one -of al386gcc.h, al386vc.h, or al386wat.h. +Every module-specific header contains structure definitions and function +prototypes. At the end of the file, it may include a header from the +include/allegro/inline/ directory which defines related inline routines. +If inline asm is supported, this can include in turn asm.inl which imports +routines from one of the compiler-specific files al386gcc.h, al386vc.h and +al386wat.h; otherwise C versions are used instead. The header alinline.h +is a placeholder which includes all the headers defining inline functions. If ALLEGRO_EXTRA_HEADER is defined, allegro.h includes this at the very end. This is used to include one of the files aldos.h, alwin.h, etc, which define @@ -225,10 +227,7 @@ the earlier header described the basic language syntax. aintern.h is like the internal.h in earlier Allegro versions, defining routines that are shared between multiple sources, but that we don't -generally want user programs to see. For platform-specific internal -definitions, we have aintdos.h, aintwin.h, etc. These headers are not -included directly by allegro.h, but can still be included by the more brave -or foolish type of user program :-) +generally want user programs to see. On platforms which have specific, non-portable API routines of their own, these should go in a special header in the root of the include directory, @@ -256,10 +255,11 @@ C sources. The symbol ALLEGRO_SRC is defined while compiling library source files. If you want to inline a function in one of your sources, use the INLINE macro. -To declare a zero-sized array in a structure, use int x[ZERO_SIZE]. To use -64 bit integers, declare a LONG_LONG variable (this won't be defined on all -platforms). To do things with filenames, check the macros ALLEGRO_LFN, -OTHER_PATH_SEPARATOR, and DEVICE_SEPARATOR. See the headers for details. +To declare a zero-sized array in terminal position inside a structure, use +the ZERO_SIZE_ARRAY(type, name) macro. To use 64 bit integers, declare a +LONG_LONG variable (this won't be defined on all platforms). To do things +with filenames, check the macros ALLEGRO_LFN, OTHER_PATH_SEPARATOR, and +DEVICE_SEPARATOR. See the headers for details. @@ -354,5 +354,107 @@ must call _remove_exit_func() from inside your shutdown routine, or you will find yourself stuck in an endless loop. + +@heading +How to contribute patches + +Once you are willing to contribute that beautiful hack which does what +everybody has been waiting for, the fix for that hideous bug which has been +driving you mad for several nights, the nice improved documentation you would +have liked to read in the manual for the first time, etc, you have already +done the hardest part. Now you only need a way to let the Allegro developers +merge your changes in the main distribution. + +You could probably send your patch to one of the people working on Allegro, +but this is not very safe, it depends on the person you chose being available +and willing to do the work for you. The best you can do is to send your patch +to the Allegro Developers mailing list. Read the readme.txt file for +information on how to subscribe to this list. Alternatively, updated +subscription instructions should always be available at +http://alleg.sourceforge.net/maillist.en. + +Sending your patches to the mailing list instead of a single person is good, +because all the subscribed developers can take a look at your modifications, +suggest improvements, or find problems, which you can discuss on the same +mailing list, letting other developers join the conversation when they +consider appropriate. If the modifications are good, they will probably be +accepted and merged in the WIP version for the next release. If you aren't +lucky, or your patch still needs some work, you will be told why it's not +accepted, or what you have to do to improve it. If you aren't subscribed to +the list, remember to tell it in your email. + + + +@hnode Building your patch against an existent release + +If you have obtained Allegro from an existent release, stable or unstable, +you will have all the source code contained in some archive format. You will +need it, because to create a patch you need two versions of each modified +file, the original version, and your modified version. You will also need +the diff tool, which is used to create the patches. This tool is usually +packaged as a standalone package in most GNU/Linux distributions with the +same name. For DOS, you can get a port from http://www.delorie.com/djgpp/. +Just choose a mirror from http://www.delorie.com/djgpp/getting.html, +enter the v2gnu directory and download the difxxb.zip package. While you are +at it, you can also get a tool named patch (patxxb.zip), which is used to +apply patches generated by diff, in case you have to apply the patches +somebody else sends to you. Install the binaries in some directory of your +path, so that you can use them from anywhere. + +If you are planing to modify only one file, you will usually copy this file +to the same name in the same directory with the appended extension '.old' +before starting to work on it. After you have made your modifications to the +file, and verified that they please you, go to the directory containing the +modified and original files and type at the prompt: +
    +   diff -u file.c.old file.c > patch
    +
    +This command will generate a text file which contains the differences +between both files in unified output format. Open it with your prefered +editor and verify that it contains the modifications you wanted to do: lines +you have added will be marked with a plus sign '+', lines you have removed +will be marked with a minus sign '-'. If the file is bigger than a few +kilobytes, compress it before sending to the developers mailing list, and of +course remember to add an explanation of what the patch is meant to do, why +it's needed, and any other information you consider relevant. + +If the modifications you want to do are scattered through several files +and/or directories, this form of patch generation is very tiresome for both +ends (you, and the developers). So unpack a fresh copy of the Allegro source +somewhere and move it to the parent directory where your current version is, +after giving it another name of course, so as to obtain two complete sources +trees side by side. Modify the files you wish in your working +directory. Once you are finished, go back to the parent directory housing the +two source trees and type: +
    +   diff -ur fresh_original_directory working_directory > patch
    +
    +The '-r' switch makes diff compare directories recursively. Again, do the +previous steps of verifying your patch, compressing and sending with correct +instructions. If your patch adds or removes files, you will have to add the +'-N' switch, because by default diff will ignore files which are only in one +of the trees. Of course, you might want to run a 'make clean' in your working +directory before running this command, or you will include lots of generated +files which have nothing to do with your patch. Or you could edit the +resulting patch, but that can be error prone. + + + +@hnode Building your patch against a CVS version + +If you are working with the cvs version of Allegro which you can get from +Sourceforge (http://sourceforge.net/projects/alleg/), you won't need +to copy any files at all. Just modify the files you want, go to the root +directory of the cvs copy and type: +
    +   cvs diff -u > patch
    +
    +Unlike the standalone diff, the cvs diff command will work recursively +through the Allegro source tree, comparing each file against the Sourceforge +repository. The patch will have slightly different headers, but that's ok, +once you have it follow the previous process to send it to the developers +mailing list. Of course, check cvs' manual for more information and options. + + @ @ diff --git a/docs/src/allegro._tx b/docs/src/allegro._tx index 97931740db..62496e0d28 100644 --- a/docs/src/allegro._tx +++ b/docs/src/allegro._tx @@ -12,7 +12,7 @@ @f1=


    Back to Contents

    @rtfh=Allegro - a game programming library -@manh="version 4.0.1 (CVS)" "Allegro" "Allegro manual" +@manh="version 4.0.3 (CVS)" "Allegro" "Allegro manual" @mans=#include @$\input texinfo @$@setfilename allegro.inf @@ -47,12 +47,12 @@ \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/ \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/ /\____/ - \_/__/ Version 4.0.1 (CVS) + \_/__/ Version 4.0.3 (CVS) A game programming library. - By Shawn Hargreaves, Dec 15, 2001. + By Shawn Hargreaves, Jul 04, 2002. See the AUTHORS file for a complete list of contributors. @@ -117,6 +117,24 @@ information about how to install Allegro and link your program with it. to this function, because allegro_init() installs it as an atexit() routine so it will be called automatically when your program exits. +@@Macro @END_OF_MAIN() +@xref Windows specifics, Unix specifics, Differences between platforms + In order to maintain cross-platform compatibility, you have to put this + macro at the very end of your main function. This macro uses some `magic' + to mangle your main procedure on platforms that need it like Windows + or Linux. On the other platforms this macro compiles to nothing, so you + don't have to #ifdef around it. Example: +

    +      int main(void)
    +      {
    +	 allegro_init();
    +	 /* more stuff goes here */
    +	 ...
    +	 return 0;
    +      }
    +      END_OF_MAIN()
    +
    + @@extern char @allegro_id[]; Text string containing a date and version number for the library, in case you want to display these somewhere. @@ -144,10 +162,13 @@ information about how to install Allegro and link your program with it. OSTYPE_DOSEMU - Linux DOSEMU OSTYPE_OPENDOS - Caldera OpenDOS OSTYPE_LINUX - Linux + OSTYPE_SUNOS - SunOS/Solaris OSTYPE_FREEBSD - FreeBSD + OSTYPE_NETBSD - NetBSD + OSTYPE_IRIX - IRIX + OSTYPE_QNX - QNX OSTYPE_UNIX - Unknown Unix variant OSTYPE_BEOS - BeOS - OSTYPE_QNX - QNX OSTYPE_MACOS - MacOS @@extern int @os_version; @@ -164,14 +185,14 @@ information about how to install Allegro and link your program with it. Set by allegro_init() to either TRUE or FALSE depending on whether your Operating System is multitasking or not. -@@void @allegro_message(char *msg, ...); +@@void @allegro_message(const char *msg, ...); Outputs a message, using a printf() format string. This function must only be used when you aren't in graphics mode, eg. before calling set_gfx_mode(), or after a set_gfx_mode(GFX_TEXT). On platforms that have - a text mode console (DOS, Unix and BeOS) it will print the string to the - console, attempting to work around codepage differences by reducing any - accented characters to 7 bit ASCII approximations, or under Windows it - will bring up a GUI message box. + a text console (DOS and Unix) it will print the string to that console, + attempting to work around codepage differences by reducing any accented + characters to 7 bit ASCII approximations, and on platforms featuring a + windowing system it will bring up a GUI message box. @@void @set_window_title(const char *name); @xref set_window_close_button, set_window_close_hook @@ -204,15 +225,13 @@ information about how to install Allegro and link your program with it. On platforms that have a close button, this routine installs a hook function to handle the close event. In other words, when the user clicks the close button on your program's window, the function you specify here - will be called. You can use this function to display a box offering to - save data or checking that the user really wants to exit, or you can use - it just to save config data, free memory and exit. + will be called. This function should not generally attempt to exit the program or save any data itself. The function could be called at any time, and there is - usually a risk of trying to save when the data are invalid. Instead, you - should set a flag during this function, and test the flag on a regular - basis in the main program. + usually a risk of conflict with the main thread of the program. Instead, + you should set a flag during this function, and test it on a regular + basis in the main loop of the program. Pass NULL to this function to restore the close button's default functionality. On Windows and BeOS, the following message will appear: @@ -1074,6 +1093,18 @@ framebuffer = x
    Linux only: specifies what device file to use for the fbcon driver. If this variable is not set, Allegro checks the FRAMEBUFFER environment variable, and then defaults to /dev/fb0. +
  • +force_centering = x
    + Unix/X11 only: specifies whether to force window centering in fullscreen + mode when the XWFS driver is used (yes or no). Enabling this setting may + cause some artifacts to appear on KDE desktops. +
  • +disable_direct_updating = x
    + Windows only: specifies whether to disable direct updating when the + GFX_DIRECTX_WIN driver is used in color conversion mode (yes or no). + Direct updating can cause artifacts to be left on the desktop when the + window is moved or minimized; disabling it results in a significant + performance loss.
  • [mouse]
    Section containing mouse configuration information, using the variables: @@ -1234,7 +1265,7 @@ alsa_rawmidi_device = x
    Unix only: ALSA rawmidi device to use for output.
  • be_midi_quality = x
    - BeOS only: system MIDI synthentetizer instruments quality. 0 uses low + BeOS only: system MIDI synthesizer instruments quality. 0 uses low quality 8-bit 11 kHz samples, 1 uses 16-bit 22 kHz samples.
  • be_midi_freq = x
    @@ -1346,7 +1377,7 @@ Mouse routines @@extern volatile int @mouse_x; @@extern volatile int @mouse_y; -@@exterm volatile int @mouse_z; +@@extern volatile int @mouse_z; @@extern volatile int @mouse_b; @@extern volatile int @mouse_pos; @xref install_mouse, poll_mouse, mouse_needs_poll @@ -1374,7 +1405,7 @@ Mouse routines @@extern BITMAP *@mouse_sprite; @@extern int @mouse_x_focus; -@@exterm int @mouse_y_focus; +@@extern int @mouse_y_focus; @xref set_mouse_sprite, set_mouse_sprite_focus Global variables containing the current mouse sprite and the focus point. These are read-only, and only to be modified using the @@ -1404,7 +1435,7 @@ Mouse routines unscare_mouse(). @@void @scare_mouse_area(int x, int y, int w, int h); -@xref unscare_mouse, scare_mouse_area, show_mouse +@xref unscare_mouse, scare_mouse, show_mouse Like scare_mouse(), but will only hide the cursor if it is inside the specified rectangle. Otherwise the cursor will simply be frozen in place until you call unscare_mouse(), so it cannot interfere with your drawing. @@ -1486,7 +1517,9 @@ speeds. Under DOS it will constantly reprogram the clock to make sure they are all called at the correct times. Because they alter the low level timer chip settings, these routines should not be used together with other DOS timer -functions like the djgpp uclock() routine. +functions like the djgpp uclock() routine. Moreover, the FPU state is not +preserved across Allegro interrupts so you ought not to use floating point +or MMX code inside timer interrupt handlers. Under other platforms, they are usually implemented using threads, which run parallel to the main thread. Therefore timer callbacks on such platforms @@ -1571,7 +1604,7 @@ Allegro does not provide such devices.) counter++; } - END_OF_FUNCTION(my_timer_handler); + END_OF_FUNCTION(my_timer_handler) and in your initialisation code you should lock the memory:
    @@ -1619,7 +1652,7 @@ Allegro does not provide such devices.)
     @xref timer_can_simulate_retrace, timer_is_using_retrace
     @xref enable_triple_buffer
        The DOS timer handler can be used to simulate vertical retrace 
    -   interrupts. An retrace interrupt can be extremely useful for implementing 
    +   interrupts. A retrace interrupt can be extremely useful for implementing 
        smooth animation, but unfortunately the VGA hardware doesn't support it. 
        The EGA did, and some SVGA chipsets do, but not enough, and not in a 
        sufficiently standardised way, for it to be useful. Allegro works around 
    @@ -2099,7 +2132,7 @@ Joystick routines
        "analogue", there are some #define aliases in allegro/joystick.h that
        will allow you to write "analog" instead.
     
    -@@char *@calibrate_joystick_name(int n);
    +@@const char *@calibrate_joystick_name(int n);
     @xref install_joystick, calibrate_joystick, joy, num_joysticks
        Returns a text description for the next type of calibration that will be 
        done on the specified joystick, or NULL if no more calibration is 
    @@ -2158,10 +2191,12 @@ Joystick routines
     Graphics modes
     
     @@void @set_color_depth(int depth);
    -@xref set_gfx_mode, set_color_conversion, makecol, getr
    +@xref set_gfx_mode, set_color_conversion, makecol, getr, bitmap_color_depth
        Sets the pixel format to be used by subsequent calls to set_gfx_mode() 
        and create_bitmap(). Valid depths are 8 (the default), 15, 16, 24, and 32 
    -   bits.
    +   bits. Note that you can retrieve the pixel format currently in use by
    +   calling bitmap_color_depth() on the 'screen' bitmap, once a graphics mode
    +   has been set.
     
     @@void @request_refresh_rate(int rate);
     @xref set_gfx_mode, get_refresh_rate
    @@ -2183,8 +2218,8 @@ Graphics modes
     @@GFX_MODE_LIST *@get_gfx_mode_list(int card);
     @xref destroy_gfx_mode_list, set_gfx_mode, set_color_depth
        Attempts to create a list of all the supported video modes for a certain
    -   GFX driver. This function returns a pointer to a list structure of the
    -   type GFX_MODE_LIST which has the following definition:
    +   graphics driver. This function returns a pointer to a list structure of 
    +   the type GFX_MODE_LIST which has the following definition:
     
        typedef struct GFX_MODE_LIST {
           int num_modes;
    @@ -2200,6 +2235,9 @@ Graphics modes
     
    This list is terminated with an { 0, 0, 0 } entry. + Note that the card parameter must refer to a _real_ driver. This function + fails if you pass GFX_SAFE, GFX_AUTODETECT, or any other "magic" driver. + @@void @destroy_gfx_mode_list(GFX_MODE_LIST *mode_list); @xref get_gfx_mode_list, set_gfx_mode, set_color_depth Removes the mode list created by get_gfx_mode_list() from memory. @@ -2308,7 +2346,7 @@ Graphics modes Pauses the program whenever it is in the background. Execution will be resumed as soon as the user switches back to it. This is the default in most fullscreen multitasking environments, for example the Linux - console. + console, but not under Windows.
  • SWITCH_AMNESIA
    Like SWITCH_PAUSE, but this mode doesn't bother to remember the @@ -2571,9 +2609,11 @@ Graphics modes Attempts to page flip the hardware screen to display the specified video bitmap object, which must be the same size as the physical screen, and should have been obtained by calling the create_video_bitmap() function. - Returns zero on success. This function will wait for a vertical retrace - if the graphics card requires it, so you don't need to call vsync() - yourself. + Returns zero on success and non-zero on failure. + + Allegro will handle any necessary vertical retrace synchronisation when + page flipping, so you don't need to call vsync() before it. This means + that show_video_bitmap() has the same time delay effects as vsync(). @@int @request_video_bitmap(BITMAP *bitmap); @xref poll_scroll, request_scroll, gfx_capabilities, timer_simulate_retrace @@ -2618,7 +2658,7 @@ Allegro supports several different types of bitmaps: - The screen bitmap, which represents the hardware video memory. Ultimately you have to draw onto this in order for your image to be - visible. + visible. It is destroyed by any subsequent calls to set_gfx_mode(). - Memory bitmaps, which are located in system RAM and can be used to store graphics or as temporary drawing spaces for double buffered @@ -2635,7 +2675,8 @@ Allegro supports several different types of bitmaps: - Video memory bitmaps. These are created by the create_video_bitmap() function, and are usually implemented as sub-bitmaps of the screen - object. + object. They must be destroyed by destroy_bitmap() before any subsequent + calls to set_gfx_mode(). - System bitmaps. These are created by the create_system_bitmap() function, and are a sort of halfway house between memory and video @@ -2648,7 +2689,8 @@ Allegro supports several different types of bitmaps: video bitmaps, using the bank switch functions and bmp_write*() macros. Not every platform implements this type of bitmap: if they aren't available, create_system_bitmap() will function identically to - create_bitmap(). + create_bitmap(). They must be destroyed by destroy_bitmap() before any + subsequent calls to set_gfx_mode(). @@extern BITMAP *@screen; @xref set_gfx_mode, is_screen_bitmap, create_video_bitmap, scroll_screen @@ -2721,6 +2763,9 @@ Allegro supports several different types of bitmaps: @@int @bitmap_color_depth(BITMAP *bmp); @xref set_color_depth, bitmap_mask_color Returns the color depth of the specified bitmap (8, 15, 16, 24, or 32). + Note that calling it on the 'screen' bitmap will return the pixel format + currently in use, as specified by the latest call to set_color_depth(), + once a graphics mode has been set. @@int @bitmap_mask_color(BITMAP *bmp); @xref MASK_COLOR_8, set_color_depth, bitmap_color_depth @@ -2822,13 +2867,24 @@ will not be known, so the file may be converted wrongly. @@BITMAP *@load_bitmap(const char *filename, RGB *pal); @xref load_bmp, load_lbm, load_pcx, load_tga, destroy_bitmap, save_bitmap @xref register_bitmap_file_type, set_color_depth, set_color_conversion +@xref generate_optimized_palette, generate_332_palette Loads a bitmap from a file, returning a pointer to a bitmap and storing the palette data in the specified location, which should be an array of 256 RGB structures. You are responsible for destroying the bitmap when you are finished with it. Returns NULL on error. At present this function supports BMP, LBM, PCX, and TGA files, determining the type from the file - extension. If the file contains a truecolor image, you must set the video - mode or call set_color_conversion() before loading it. + extension. + + If the file contains a truecolor image, you must set the video mode or + call set_color_conversion() before loading it. In this case, if the + destination color depth is 8-bit, the palette will be generated by calling + generate_optimized_palette() on the bitmap; otherwise, the returned + palette will be generated by calling generate_332_palette(). + + The pal argument may be NULL. In this case, the palette data are simply + not returned. Additionally, if the file is a truecolor image and the + destination color depth is 8-bit, the color conversion process will use + the current palette instead of generating an optimized one. @@BITMAP *@load_bmp(const char *filename, RGB *pal); @xref load_bitmap @@ -2852,11 +2908,14 @@ will not be known, so the file may be converted wrongly. Writes a bitmap into a file, using the specified palette, which should be an array of 256 RGB structures. Returns non-zero on error. The output format is determined from the filename extension: at present this - function supports BMP, PCX and TGA formats. One thing to watch out for: - if you use this to dump the screen into a file you may end up with an - image much larger than you were expecting, because Allegro often creates - virtual screens larger than the visible screen. You can get around this - by using a sub-bitmap to specify which part of the screen to save, eg: + function supports BMP, PCX and TGA formats. + + Two things to watch out for: on some video cards it may be faster to copy + the screen to a memory bitmap and save the latter, and if you use this to + dump the screen into a file you may end up with an image much larger than + you were expecting, because Allegro often creates virtual screens larger + than the visible screen. You can get around this by using a sub-bitmap to + specify which part of the screen to save, eg:
           BITMAP *bmp;
           PALETTE pal;
    @@ -3338,7 +3397,8 @@ drawing mode and the clipping rectangle of the destination bitmap.
     @xref vline, line, drawing_mode
        Draws a horizontal line onto the bitmap, from point (x1, y) to (x2, y).
     
    -@@void @do_line(BITMAP *bmp, int x1, y1, x2, y2, int d, void (*proc)());
    +@\void @do_line(BITMAP *bmp, int x1, y1, x2, y2, int d, 
    +@@             void (*proc)(BITMAP *bmp, int x, int y, int d));
     @xref do_circle, do_ellipse, do_arc, line
        Calculates all the points along a line from point (x1, y1) to (x2, y2), 
        calling the supplied function for each one. This will be passed a copy of 
    @@ -3353,7 +3413,7 @@ drawing mode and the clipping rectangle of the destination bitmap.
     @xref polygon, triangle3d, drawing_mode
        Draws a filled triangle between the three points.
     
    -@@void @polygon(BITMAP *bmp, int vertices, int *points, int color);
    +@@void @polygon(BITMAP *bmp, int vertices, const int *points, int color);
     @xref triangle, polygon3d, drawing_mode
        Draws a filled polygon with an arbitrary number of corners. Pass the 
        number of vertices and an array containing a series of x, y points (a 
    @@ -3368,7 +3428,8 @@ drawing mode and the clipping rectangle of the destination bitmap.
        Draws a solid, filled rectangle with the two points as its opposite 
        corners.
     
    -@@void @do_circle(BITMAP *bmp, int x, int y, int radius, int d, void (*proc)());
    +@\void @do_circle(BITMAP *bmp, int x, int y, int radius, int d,
    +@@               void (*proc)(BITMAP *bmp, int x, int y, int d));
     @xref do_ellipse, do_arc, do_line, circle, circlefill
        Calculates all the points in a circle around point (x, y) with radius r, 
        calling the supplied function for each one. This will be passed a copy of 
    @@ -3383,7 +3444,8 @@ drawing mode and the clipping rectangle of the destination bitmap.
     @xref ellipsefill, circle, do_circle, drawing_mode
        Draws a filled circle with the specified centre and radius.
     
    -@@void @do_ellipse(BITMAP *bmp, int x, y, int rx, ry, int d, void (*proc)());
    +@\void @do_ellipse(BITMAP *bmp, int x, int y, int rx, ry, int d,
    +@@                void (*proc)(BITMAP *bmp, int x, int y, int d));
     @xref do_circle, do_arc, do_line, ellipse, ellipsefill
        Calculates all the points in an ellipse around point (x, y) with radius 
        rx and ry, calling the supplied function for each one. This will be 
    @@ -3398,7 +3460,8 @@ drawing mode and the clipping rectangle of the destination bitmap.
     @xref circlefill, ellipse, do_ellipse, drawing_mode
        Draws a filled ellipse with the specified centre and radius.
     
    -@@void @do_arc(BITMAP *bmp, int x, y, fixed a1, a2, int r, d, void (*proc)());
    +@\void @do_arc(BITMAP *bmp, int x, int y, fixed a1, fixed a2, int r, int d,
    +@@            void (*proc)(BITMAP *bmp, int x, int y, int d));
     @xref do_circle, do_ellipse, do_line, arc
        Calculates all the points in a circular arc around point (x, y) with 
        radius r, calling the supplied function for each one. This will be passed 
    @@ -3418,7 +3481,7 @@ drawing mode and the clipping rectangle of the destination bitmap.
        full circle, 64 a right angle, etc. Zero is to the right of the centre 
        point, and larger values rotate anticlockwise from there.
     
    -@@void @calc_spline(int points[8], int npts, int *x, int *y);
    +@@void @calc_spline(const int points[8], int npts, int *x, int *y);
     @xref spline
        Calculates a series of npts values along a bezier spline, storing them in 
        the output x and y arrays. The bezier curve is specified by the four x/y 
    @@ -3434,7 +3497,7 @@ drawing mode and the clipping rectangle of the destination bitmap.
        useful for constructing smooth paths around a series of control points, 
        as in exspline.c.
     
    -@@void @spline(BITMAP *bmp, int points[8], int color);
    +@@void @spline(BITMAP *bmp, const int points[8], int color);
     @xref calc_spline, drawing_mode
        Draws a bezier spline using the four control points specified in the 
        points array.
    @@ -3509,12 +3572,26 @@ bitmap.
        destination bitmaps to be of different color depths, so it can be used to 
        convert images from one pixel format to another.
     
    +@\void @stretch_blit(BITMAP *source, BITMAP *dest,
    +@\                  int source_x, source_y, source_width, source_height,
    +@@                  int dest_x, dest_y, dest_width, dest_height);
    +@xref blit, masked_stretch_blit, stretch_sprite
    +   Like blit(), except it can scale images (so the source and destination 
    +   rectangles don't need to be the same size) and requires the source and 
    +   destination bitmaps to be of the same color depth. This routine doesn't 
    +   do as much safety checking as the regular blit(): in particular you must 
    +   take care not to copy from areas outside the source bitmap, and you 
    +   cannot blit between overlapping regions, ie. you must use different 
    +   bitmaps for the source and the destination. Moreover, the source must 
    +   be a memory bitmap.
    +
     @\void @masked_blit(BITMAP *source, BITMAP *dest, int source_x, int source_y,
     @@                  int dest_x, int dest_y, int width, int height);
     @xref blit, masked_stretch_blit, draw_sprite, bitmap_mask_color
        Like blit(), but skips transparent pixels, which are marked by a zero in 
        256 color modes or bright pink for truecolor data (maximum red and blue, 
    -   zero green). The source and destination regions must not overlap.
    +   zero green), and requires the source and destination bitmaps to be of 
    +   the same color depth. The source and destination regions must not overlap.
     
        If the GFX_HW_VRAM_BLIT_MASKED bit in the gfx_capabilities flag is set, 
        the current driver supports hardware accelerated masked blits from one 
    @@ -3523,29 +3600,18 @@ bitmap.
        sprites in an offscreen portion of the video memory.
     
        Warning: if the hardware acceleration flag is not set, masked_blit() will 
    -   not work correctly when used with a video memory source image, and the 
    -   input graphic must always be a memory bitmap!
    -
    -@\void @stretch_blit(BITMAP *source, BITMAP *dest,
    -@\                  int source_x, source_y, source_width, source_height,
    -@@                  int dest_x, dest_y, dest_width, dest_height);
    -@xref blit, masked_stretch_blit, stretch_sprite
    -   Like blit(), except it can scale images so the source and destination 
    -   rectangles don't need to be the same size. This routine doesn't do as 
    -   much safety checking as the regular blit: in particular you must take 
    -   care not to copy from areas outside the source bitmap, and you cannot 
    -   blit between overlapping regions, ie. you must use different bitmaps for 
    -   the source and the destination. Also, the source must be a memory bitmap 
    -   or sub-bitmap, not the hardware screen.
    +   not work correctly when used with a source image in system or video 
    +   memory so the latter must be a memory bitmap.
     
     @\void @masked_stretch_blit(BITMAP *source, BITMAP *dest,
     @\                         int source_x, source_y, source_w, source_h,
     @@                         int dest_x, dest_y, dest_w, dest_h);
     @xref blit, masked_blit, stretch_blit, stretch_sprite
    -   Like stretch_blit(), but skips transparent pixels, which are marked by a 
    -   zero in 256 color modes or bright pink for truecolor data (maximum red 
    -   and blue, zero green). The source and destination regions must not 
    -   overlap.
    +   Like masked_blit(), except it can scale images (so the source and 
    +   destination rectangles don't need to be the same size). This routine 
    +   doesn't do as much safety checking as the regular masked_blit(): in 
    +   particular you must take care not to copy from areas outside the source 
    +   bitmap. Moreover, the source must be a memory bitmap.
     
     @@void @draw_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y);
     @xref draw_sprite_v_flip, draw_trans_sprite, draw_lit_sprite
    @@ -3568,14 +3634,21 @@ bitmap.
        memory.
     
        Warning: if the hardware acceleration flag is not set, draw_sprite() will 
    -   not work correctly when used with a video memory source image, and the 
    -   input graphic must always be a memory bitmap!
    +   not work correctly when used with a sprite image in system or video 
    +   memory so the latter must be a memory bitmap.
     
        Although generally not supporting graphics of mixed color depths, as a 
        special case this function can be used to draw 256 color source images 
        onto truecolor destination bitmaps, so you can use palette effects on 
        specific sprites within a truecolor program.
     
    +@@void @stretch_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y, int w, int h);
    +@xref draw_sprite, stretch_blit, bitmap_mask_color
    +   Like draw_sprite(), except it can stretch the sprite image to the 
    +   specified width and height and requires the sprite image and destination 
    +   bitmap to be of the same color depth. Moreover, the sprite image must 
    +   be a memory bitmap.
    +
     @@void @draw_sprite_v_flip(BITMAP *bmp, BITMAP *sprite, int x, int y);
     @@void @draw_sprite_h_flip(BITMAP *bmp, BITMAP *sprite, int x, int y);
     @@void @draw_sprite_vh_flip(BITMAP *bmp, BITMAP *sprite, int x, int y);
    @@ -3604,19 +3677,25 @@ bitmap.
     @@void @draw_lit_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y, int color);
     @xref draw_sprite, draw_trans_sprite, draw_gouraud_sprite
     @xref draw_lit_rle_sprite, color_map, set_trans_blender, bitmap_mask_color
    -   Tints the sprite image to the specified color or light level, using the 
    -   global color_map table, and draws the resulting image to the destination 
    -   bitmap. This must only be used after you have set up the color mapping 
    -   table (for 256 color modes) or blender functions (for truecolor modes).
    +   In 256 color modes, uses the global color_map table to tint the sprite
    +   image to the specified color or to light it to the level specified by
    +   'color', depending on the function which was used to build the table
    +   (create_trans_table or create_light_table), and draws the resulting image
    +   to the destination bitmap. In truecolor modes, uses the blender functions
    +   to light the sprite image using the alpha level specified by 'color' (the
    +   alpha level which was passed to the blender functions is ignored) and
    +   draws the resulting image to the destination bitmap. The 'color' parameter
    +   must be in the range [0-255] whatever its actual meaning is. This must
    +   only be used after you have set up the color mapping table (for 256 color
    +   modes) or blender functions (for truecolor modes).
     
     @\void @draw_gouraud_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y,
     @@                         int c1, int c2, int c3, int c4);
     @xref draw_sprite, draw_lit_sprite, color_map, set_trans_blender
     @xref bitmap_mask_color
    -   Tints the sprite to the specified color or light level, interpolating the 
    -   four corner colors across the surface of the image. This must only be 
    -   used after you have set up the color mapping table (for 256 color modes) 
    -   or blender functions (for truecolor modes).
    +   More sophisticated version of draw_lit_sprite(): the 'color' parameter is
    +   not constant across the sprite image anymore but interpolated between the
    +   four specified corner colors, which have the same actual meaning as it.
     
     @@void @draw_character(BITMAP *bmp, BITMAP *sprite, int x, int y, int color);
     @xref draw_sprite, bitmap_mask_color
    @@ -3689,14 +3768,6 @@ bitmap.
        given by (cx, cy) to (x, y) in the bitmap, then rotates and scales around
        this point.
     
    -@@void @stretch_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y, int w, int h);
    -@xref draw_sprite, stretch_blit, bitmap_mask_color
    -   Draws the sprite image onto the bitmap at the specified position, 
    -   stretching it to the specified width and height. The difference between 
    -   stretch_sprite() and stretch_blit() is that stretch_sprite() masks out 
    -   transparent pixels, which are marked by a zero in 256 color modes or 
    -   bright pink for truecolor data (maximum red and blue, zero green).
    -
     
     
     @heading
    @@ -4092,7 +4163,7 @@ Polygon rendering
           polygon3d_f(bmp, type, tex, 4, v[]);
     
     @\int @clip3d_f(int type, float min_z, float max_z, int vc,
    -@@             V3D_f *vtx[], V3D_f *vout[], V3D_f *vtmp[], int out[]);
    +@@             const V3D_f *vtx[], V3D_f *vout[], V3D_f *vtmp[], int out[]);
     @xref polygon3d, clip3d
        Clips the polygon given in vtx. The number of vertices is vc, the result 
        goes in vout, and vtmp and out are needed for internal purposes. The 
    @@ -4109,7 +4180,7 @@ Polygon rendering
        no provision is made for high/truecolor GCOL.
     
     @\int @clip3d(int type, fixed min_z, fixed max_z, int vc,
    -@@           V3D *vtx[], V3D *vout[], V3D *vtmp[], int out[]);
    +@@           const V3D *vtx[], V3D *vout[], V3D *vtmp[], int out[]);
     @xref polygon3d, clip3d_f
        Fixed point version of clip3d_f(). This function should be used with 
        caution, due to the limited precision of fixed point arithmetic and high 
    @@ -4371,7 +4442,7 @@ Transparency and patterned drawing
        Sets the graphics drawing mode. This only affects the geometric routines 
        like putpixel, lines, rectangles, circles, polygons, floodfill, etc, not 
        the text output, blitting, or sprite drawing functions. The mode should 
    -   be one of the values:
    +   be one of the following constants:
     
           DRAW_MODE_SOLID               - the default, solid color
                                           drawing
    @@ -4381,6 +4452,9 @@ Transparency and patterned drawing
           DRAW_MODE_MASKED_PATTERN      - masked pattern fill
           DRAW_MODE_TRANS               - translucent color blending
     
    + In DRAW_MODE_SOLID, pixels of the bitmap being drawn onto are simply + replaced by those produced by the drawing function. + In DRAW_MODE_XOR, pixels are written to the bitmap with an exclusive-or operation rather than a simple copy, so drawing the same shape twice will erase it. Because it involves reading as well as writing the bitmap @@ -4439,9 +4513,9 @@ Transparency and patterned drawing @hnode 256 color transparency In paletted video modes, translucency and lighting are implemented with a -64k lookup table, which contain the result of combining any two colors c1 -and c2. You must set up this table before you use any of the lighting or -translucency routines. Depending on how you construct the table, a range of +64k lookup table, which contains the result of combining any two colors c1 +and c2. You must set up this table before you use any of the translucency +or lighting routines. Depending on how you construct the table, a range of different effects are possible. For example, translucency can be implemented by using a color halfway between c1 and c2 as the result of the combination. Lighting is achieved by treating one of the colors as a light level (0-255) @@ -4460,28 +4534,15 @@ typedef struct { @@extern COLOR_MAP *@color_map; @xref create_color_table, create_light_table, create_trans_table @xref create_blender_table, set_trans_blender, draw_trans_sprite -@xref draw_lit_sprite, drawing_mode +@xref draw_lit_sprite, draw_gouraud_sprite, drawing_mode Global pointer to the color mapping table. This must be set before using any translucent or lit drawing functions in a 256 color video mode! -@\void @create_light_table(COLOR_MAP *table, const PALETTE pal, -@@ int r, g, b, void (*callback)(int pos)); -@xref color_map, create_trans_table, create_color_table -@xref create_blender_table, draw_lit_sprite - Fills the specified color mapping table with lookup data for doing - lighting effects with the specified palette. When combining the colors c1 - and c2 with this table, c1 is treated as a light level from 0-255. At - light level 255 the table will output color c2 unchanged, at light level - 0 it will output the r, g, b value you specify to this function, and at - intermediate light levels it will output a color somewhere between the - two extremes. The r, g, and b values are in the range 0-63. If the - callback function is not NULL, it will be called 256 times during the - calculation, allowing you to display a progress indicator. - @\void @create_trans_table(COLOR_MAP *table, const PALETTE pal, @@ int r, g, b, void (*callback)(int pos)); @xref color_map, create_light_table, create_color_table -@xref create_blender_table, draw_trans_sprite +@xref create_blender_table, draw_trans_sprite, draw_lit_sprite +@xref draw_gouraud_sprite Fills the specified color mapping table with lookup data for doing translucency effects with the specified palette. When combining the colors c1 and c2 with this table, the result will be a color somewhere @@ -4493,10 +4554,26 @@ typedef struct { If the callback function is not NULL, it will be called 256 times during the calculation, allowing you to display a progress indicator. +@\void @create_light_table(COLOR_MAP *table, const PALETTE pal, +@@ int r, g, b, void (*callback)(int pos)); +@xref color_map, create_trans_table, create_color_table +@xref create_blender_table, draw_trans_sprite, draw_lit_sprite +@xref draw_gouraud_sprite + Fills the specified color mapping table with lookup data for doing + lighting effects with the specified palette. When combining the colors c1 + and c2 with this table, c1 is treated as a light level from 0-255. At + light level 255 the table will output color c2 unchanged, at light level + 0 it will output the r, g, b value you specify to this function, and at + intermediate light levels it will output a color somewhere between the + two extremes. The r, g, and b values are in the range 0-63. If the + callback function is not NULL, it will be called 256 times during the + calculation, allowing you to display a progress indicator. + @\void @create_color_table(COLOR_MAP *table, const PALETTE pal, @\ void (*blend)(PALETTE pal, int x, int y, RGB *rgb), @@ void (*callback)(int pos)); @xref color_map, create_light_table, create_trans_table, create_blender_table +@xref draw_trans_sprite, draw_lit_sprite, draw_gouraud_sprite Fills the specified color mapping table with lookup data for doing customised effects with the specified palette, calling the blend function to determine the results of each color combination. Your blend routine @@ -4511,6 +4588,7 @@ typedef struct { @\void @create_blender_table(COLOR_MAP *table, const PALETTE pal, @@ void (*callback)(int pos)); @xref color_map, create_light_table, create_trans_table, create_color_table +@xref draw_trans_sprite, draw_lit_sprite, draw_gouraud_sprite @xref set_trans_blender, set_blender_mode Fills the specified color mapping table with lookup data for doing a paletted equivalent of whatever truecolor blender mode is currently @@ -4521,13 +4599,32 @@ typedef struct { @hnode truecolor transparency In truecolor video modes, translucency and lighting are implemented by a -blender function in the form: +blender function of the form:
     unsigned long (*BLENDER_FUNC)(unsigned long x, y, n);
     
    -This routine takes two color parameters, decomposes them into their red, -green, and blue components, combines them according to the interpolation -value n, and then merges the result back into a single return color value. + +For each pixel to be drawn, this routine is passed two color parameters x +and y, decomposes them into their red, green and blue components, combines +them according to some mathematical transformation involving the +interpolation factor n, and then merges the result back into a single +return color value, which will be used to draw the pixel onto +the destination bitmap. + +The parameter x represents the blending modifier color and the parameter y +represents the base color to be modified. The interpolation factor n is in +the range [0-255] and controls the solidity of the blending. + +When a translucent drawing function is used, x is the color of the source, +y is the color of the bitmap begin drawn onto and n is the alpha level +that was passed to the function that sets the blending mode (the RGB triplet +that was passed to this function is not taken into account). + +When a lit sprite drawing function is used, x is the color represented by +the RGB triplet that was passed to the function that sets the blending mode +(the alpha level that was passed to this function is not taken into +account), y is the color of the sprite and n is the alpha level that was +passed to the drawing function itself. Since these routines may be used from various different color depths, there are three such callbacks, one for use with 15 bit 5.5.5 pixels, one for 16 @@ -4541,16 +4638,8 @@ between the 24 and 32 bit code since the bit packing is the same). @xref set_difference_blender, set_dissolve_blender, set_dodge_blender @xref set_hue_blender, set_invert_blender, set_luminance_blender @xref set_multiply_blender, set_saturation_blender, set_screen_blender - Selects the default set of truecolor blender routines, which perform a - simple linear interpolation between the source and destination colors. - When a translucent drawing function is called, the alpha parameter set by - this routine is used as the interpolation factor, which controls the - solidity of the drawing (range 0 to 255). When a lit sprite drawing - function is called, the alpha value passed to this routine is ignored, - and instead the color passed to the sprite function is used to select an - alpha level. The blender routine will then be used to interpolate between - the sprite color and the RGB values that were passed to this function - (ranging 0-255). + Enables a linear interpolator blender mode for combining translucent + or lit truecolor pixels. @@void @set_alpha_blender(); @xref set_trans_blender, draw_trans_sprite, draw_trans_rle_sprite, @@ -4578,77 +4667,77 @@ between the 24 and 32 bit code since the bit packing is the same). @@void @set_add_blender(int r, int g, int b, int a); @xref set_trans_blender, drawing_mode - Enables an additive color blender mode for combining lit or translucent + Enables an additive blender mode for combining translucent or lit truecolor pixels. @@void @set_burn_blender(int r, int g, int b, int a); @xref set_trans_blender, drawing_mode - Enables a burn blender mode for combining lit or translucent truecolor - pixels. Here the lightness values of the colours of the source image + Enables a burn blender mode for combining translucent or lit truecolor + pixels. Here the lightness values of the colours of the source image reduce the lightness of the destination image, darkening the image. @@void @set_color_blender(int r, int g, int b, int a); @xref set_trans_blender, drawing_mode - Enables a color blender mode for combining lit or translucent truecolor - pixels. Applies only the hue and saturation of the source image to the + Enables a color blender mode for combining translucent or lit truecolor + pixels. Applies only the hue and saturation of the source image to the destination image. The luminance of the destination image is not affected. @@void @set_difference_blender(int r, int g, int b, int a); @xref set_trans_blender, drawing_mode - Enables a difference blender mode for combining lit or translucent - truecolor pixels. This makes an image which has colours calculated by the + Enables a difference blender mode for combining translucent or lit + truecolor pixels. This makes an image which has colours calculated by the difference between the source and destination colours. @@void @set_dissolve_blender(int r, int g, int b, int a); @xref set_trans_blender, drawing_mode - Enables a dissolve blender mode for combining lit or translucent - truecolor pixels. Randomly replaces the colours of some pixels in the - destination image with those of the source image. The number of pixels - replaced depends on the alpha value (higher value, more pixels replaced; + Enables a dissolve blender mode for combining translucent or lit + truecolor pixels. Randomly replaces the colours of some pixels in the + destination image with those of the source image. The number of pixels + replaced depends on the alpha value (higher value, more pixels replaced; you get the idea :). @@void @set_dodge_blender(int r, int g, int b, int a); @xref set_trans_blender, drawing_mode - Enables a dodge blender mode for combining lit or translucent truecolor - pixels. The lightness of colours in the source lighten the colours of the + Enables a dodge blender mode for combining translucent or lit truecolor + pixels. The lightness of colours in the source lighten the colours of the destination. White has the most effect; black has none. @@void @set_hue_blender(int r, int g, int b, int a); @xref set_trans_blender, drawing_mode - Enables a hue blender mode for combining lit or translucent truecolor + Enables a hue blender mode for combining translucent or lit truecolor pixels. This applies the hue of the source to the destination. @@void @set_invert_blender(int r, int g, int b, int a); @xref set_trans_blender, drawing_mode - Enables an invert blender mode for combining lit or translucent truecolor - pixels. Blends the inverse (or negative) colour of the source with the + Enables an invert blender mode for combining translucent or lit truecolor + pixels. Blends the inverse (or negative) colour of the source with the destination. @@void @set_luminance_blender(int r, int g, int b, int a); @xref set_trans_blender, drawing_mode - Enables a luminance blender mode for combining lit or translucent + Enables a luminance blender mode for combining translucent or lit truecolor pixels. Applies the luminance of the source to the destination. The colour of the destination is not affected. @@void @set_multiply_blender(int r, int g, int b, int a); @xref set_trans_blender, drawing_mode - Enables a multiply blender mode for combining lit or translucent - truecolor pixels. Combines the source and destination images, multiplying - the colours to produce a darker colour. If a colour is multiplied by - white it remains unchanged; when multiplied by black it also becomes + Enables a multiply blender mode for combining translucent or lit + truecolor pixels. Combines the source and destination images, multiplying + the colours to produce a darker colour. If a colour is multiplied by + white it remains unchanged; when multiplied by black it also becomes black. @@void @set_saturation_blender(int r, int g, int b, int a); @xref set_trans_blender, drawing_mode - Enables a saturation blender mode for combining lit or translucent - truecolor pixels. Applies the saturation of the source to the destination + Enables a saturation blender mode for combining translucent or lit + truecolor pixels. Applies the saturation of the source to the destination image. @@void @set_screen_blender(int r, int g, int b, int a); @xref set_trans_blender, drawing_mode - Enables a screen blender mode for combining lit or translucent truecolor - pixels. This blender mode lightens the colour of the destination image by - multiplying the inverse of the source and destination colours. Sort of + Enables a screen blender mode for combining translucent or lit truecolor + pixels. This blender mode lightens the colour of the destination image by + multiplying the inverse of the source and destination colours. Sort of like the opposite of the multiply blender mode. @@void @set_blender_mode(BLENDER_FUNC b15, b16, b24, int r, g, b, a); @@ -5197,7 +5286,9 @@ Digital sample routines is relative rather than absolute: 1000 represents the frequency that the sample was recorded at, 2000 is twice this, etc. If the loop flag is set, the sample will repeat until you call stop_sample(), and can be - manipulated while it is playing by calling adjust_sample(). + manipulated while it is playing by calling adjust_sample(). Returns the + voice number that was allocated for the sample (a non-negative number if + successful). @@void @adjust_sample(const SAMPLE *spl, int vol, int pan, int freq, int loop); @xref play_sample @@ -5454,10 +5545,11 @@ MIDI music routines Seeks to the given midi_pos in the current MIDI file. If the target is earlier in the file than the current midi_pos it seeks from the beginning; otherwise it seeks from the current position. Returns zero if - successful, non-zero if it hit the end of the file (1 means it stopped - playing, 2 means it looped back to the start). If this function stops - because it reached EOF, midi_pos will be set to the negative length of - the MIDI file. + it could successfully seek to the requested position. Otherwise, a + return value of 1 means it stopped playing, and midi_pos is set to the + negative length of the MIDI file (so you can use this function to + determine the length of a MIDI file). A return value of 2 means the MIDI + file looped back to the start. @@void @midi_out(unsigned char *data, int length); @xref install_sound, load_midi_patches, midi_recorder @@ -5511,7 +5603,7 @@ MIDI music routines call this before or after initialising the sound code, or can simply set the ibk_file and ibk_drum_file variables in the configuration file to have the data loaded automatically. Note that this function has no effect - on any drivers other than the Adlib one! + on any drivers other than the Adlib one! Returns non-zero on error. @@ -5527,15 +5619,18 @@ doing something clever like generating the waveform on the fly. @xref install_sound, get_audio_stream_buffer, stop_audio_stream This function creates a new audio stream and starts it playing. The length is the size of each transfer buffer (in samples), which should - normally be a power of two somewhere around 1k in size: larger buffers - are more efficient and require fewer updates, but result in more latency - between you providing the data and it actually being played. The bits - parameter must be 8 or 16, freq is the sample rate of the data, and the - vol and pan values use the same 0-255 ranges as the regular sample - playing functions. If you want to adjust the pitch, volume, or panning of - a stream once it is playing, you can use the regular voice_*() functions - with stream->voice as a parameter. The sample data is always in unsigned - format, with stereo waveforms consisting of alternate left/right samples. + normally (but doesn't have to) be a power of two somewhere around 1k in + size. Larger buffers are more efficient and require fewer updates, but + result in more latency between you providing the data and it actually + being played. The bits parameter must be 8 or 16, freq is the sample + rate of the data in Hertz. The vol and pan values use the same 0-255 + ranges as the regular sample playing functions. The stereo parameter + should be set to 1 for stereo streams, or 0 otherwise. If you want to + adjust the pitch, volume, or panning of a stream once it is playing, + you can use the regular voice_*() functions with stream->voice as a + parameter. The sample data is always in unsigned format, with stereo + waveforms consisting of alternating left/right samples, left sample + first. @@void @stop_audio_stream(AUDIOSTREAM *stream); @xref play_audio_stream @@ -5773,7 +5868,7 @@ directories, but not hidden files and directories. Similarly, if you pass error code will be stored in errno. @@int @exists(const char *filename); -@xref file_exists +@xref file_exists, file_size, file_time Shortcut version of file_exists(), which checks for normal files, which may have the archive or read-only bits set, but are not hidden, directories, system files, etc. @@ -5787,7 +5882,8 @@ directories, but not hidden files and directories. Similarly, if you pass @@time_t @file_time(const char *filename); @xref file_exists, file_size Returns the modification time (number of seconds since 00:00:00 GMT - 1/1/1970) of a file. + 1/1/1970) of a file. If the file does not exist or an error occurs, it + will return zero and store the system error code in errno. @@int @delete_file(const char *filename); Removes a file from the disk. @@ -5853,18 +5949,32 @@ directories, but not hidden files and directories. Similarly, if you pass @xref pack_fopen, load_datafile Sets the encryption password to be used for all read/write operations on files opened in future using Allegro's packfile functions (whether - they are compressed or not). Files written with an encryption password - cannot be read unless the same password is selected, so be careful: if - you forget the key, I can't make your data come back again! Pass NULL - or an empty string to return to the normal, non-encrypted mode. If you - are using this function to prevent people getting access to your - datafiles, be careful not to store an obvious copy of the password in - your executable: if there are any strings like "I'm the password for - the datafile", it would be fairly easy to get access to your data :-) - - Important: as soon as you have opened a file using an encryption - password, call packfile_password(NULL) again. Better still, don't touch - this function at all. Ever. + they are compressed or not), including all the save, load and config + routines. Files written with an encryption password cannot be read + unless the same password is selected, so be careful: if you forget the + key, I can't make your data come back again! Pass NULL or an empty + string to return to the normal, non-encrypted mode. If you are using + this function to prevent people getting access to your datafiles, be + careful not to store an obvious copy of the password in your executable: + if there are any strings like "I'm the password for the datafile", it + would be fairly easy to get access to your data :-) + + Note #1: when writing a packfile, you can change the password to whatever + you want after opening the file, without affecting the write operation. + On the contrary, when writing a sub-chunk of a packfile, you must make + sure that the password that was active at the time the sub-chunk was + opened is still active before closing the sub-chunk. This is guaranteed + to be true if you didn't call the packfile_password() routine in the + meantime. Read operations, either on packfiles or sub-chunks, have no + such restriction. + + Note #2: as explained above, the password is used for all read/write + operations on files, including for several functions of the library that + operate on files without explicitly using packfiles, e.g load_bitmap(). + The unencrypted mode is mandatory in order for those functions to work. + Therefore remember to call packfile_password(NULL) before using them if + you previously changed the password. As a rule of thumb, always call + packfile_password(NULL) when you are done with operations on packfiles. @@PACKFILE *@pack_fopen(const char *filename, const char *mode); @xref packfile functions, pack_fopen_chunk, packfile_password @@ -5945,16 +6055,36 @@ directories, but not hidden files and directories. Similarly, if you pass @!rtf @rtf - These work like the equivalent stdio functions, except that pack_fread() - and pack_fwrite() take a single size parameter instead of that silly size - and num_elements system, seeking only supports forward movement relative - to the current position, and the pack_fgets() function does not include a - trailing carriage return in the returned string. The pack_i* and pack_m* - routines read and write 16 and 32 bit values using the Intel and Motorola - byte ordering systems (endianness) respectively. Note that seeking is - very slow when reading compressed files, and so should be avoided unless - you are sure that the file is not compressed. - + These work like the equivalent stdio functions. There are some + differences, however: +
    • + Seeking only supports forward movement relative to the current position. + Note that seeking is very slow when reading compressed files, and so + should be avoided unless you are sure that the file is not compressed. +
    • + The pack_i* and pack_m* routines read and write 16 and 32 bit values using + the Intel and Motorola byte ordering systems (endianness) respectively. + Intel is least significant byte first (little-endian); Motorola is most + significant byte first (big-endian). +
    • + pack_fread() and pack_fwrite() take a single size parameter instead of + that silly size and num_elements system. +
    • + The pack_fgets() function does not include a trailing carriage return in + the returned string. +
    • + pack_fputs() always writes in the UTF-8 text encoding format, converting + from the current text encoding. Newlines (\n) are written as \r\n on + DOS/Windows. If you do not want either of these things to happen, + use pack_fwrite() and/or pack_putc() instead. +
    • + pack_feof() returns nonzero as soon as you reach the end of the file. It + does not wait for you to attempt to read beyond the end of the file, + contrary to the ISO C feof() function. The only way to know whether you + have read beyond the end of the file is to check the return value of the + read operation you use (and be wary of pack_*getl() as EOF is also a valid + return value with these functions). +
    @@PACKFILE *@pack_fopen_chunk(PACKFILE *f, int pack); @xref pack_fclose_chunk, pack_fopen Opens a sub-chunk of a file. Chunks are primarily intended for use by the @@ -6052,13 +6182,13 @@ directly from a specific datafile object. @xref load_datafile_object Frees an object previously loaded by load_datafile_object(). -@@DATAFILE *@find_datafile_object(DATAFILE *dat, const char *objectname); +@@DATAFILE *@find_datafile_object(const DATAFILE *dat, const char *objectname); @xref load_datafile, load_datafile_object Searches an already loaded datafile for an object with the specified name, returning a pointer to it, or NULL if the object cannot be found. It understands '/' and '#' separators for nested datafile paths. -@@char *@get_datafile_property(DATAFILE *dat, int type); +@@const char *@get_datafile_property(const DATAFILE *dat, int type); Returns the specified property string for the object, or an empty string if the property isn't present. See grabber.txt for more information. @@ -6070,13 +6200,16 @@ directly from a specific datafile object. @@void @fixup_datafile(DATAFILE *data); @xref set_gfx_mode, set_color_conversion - If you are using compiled datafiles (produced by the dat2s utility) that - contain truecolor images, you must call this function once after your set - the video mode that you will be using, to convert the color values into - the appropriate format. It handles flipping between RGB and BGR formats, - and converting between different color depths whenever that can be done - without changing the size of the image (ie. changing between 15<->16 - bit hicolor for both bitmaps and RLE sprites, and 24<->32 bit + If you are using compiled datafiles (produced by the dat2s utility) on a + platform that doesn't support constructors, or on a platform that does + support constructors and the datafiles contain truecolor images, you + must call this function once after your set the video mode that you will + be using. This will ensure the datafiles are properly initialised in the + first case and convert the color values into the appropriate format in + the second case. It handles flipping between RGB and BGR formats, and + converting between different color depths whenever that can be done + without changing the size of the image (ie. changing between 15<->16 + bit hicolor for both bitmaps and RLE sprites, and 24<->32 bit truecolor for RLE sprites). @hnode using datafiles @@ -6166,11 +6299,11 @@ integer' is not. Returns the smallest integer not less than x. That is, it rounds towards positive infinity. -@@fixed @ftofix(float x); +@@fixed @ftofix(double x); @xref fixtof, itofix, fixtoi Converts a floating point value to fixed point. -@@float @fixtof(fixed x); +@@double @fixtof(fixed x); @xref ftofix, itofix, fixtoi Converts fixed point to floating point. @@ -6861,8 +6994,8 @@ changes are the following: and d_rtext_proc() right aligns it. Any '&' characters in the string will be replaced with lines underneath the following character, for displaying keyboard shortcuts (as in MS Windows). To display a single ampersand, put - "&&". To use draw the text in something other than the default font, set - the dp2 field to point to your custom font data. + "&&". To draw the text in something other than the default font, set the + dp2 field to point to your custom font data. @@int @d_button_proc(int msg, DIALOG *d, int c); A button object (the dp field points to the text string). This object can @@ -6968,7 +7101,8 @@ changes are the following: clicked or if an alt+key corresponding to one of the shortcuts in the menu is pressed. It ignores a lot of the fields in the dialog structure, in particular the color is taken from the gui_*_color variables, and the - width and height are calculated automatically. The dp field points to an + width and height are calculated automatically (the w and h fields from + the DIALOG are only used as a minimum size.) The dp field points to an array of menu structures: see do_menu() for more information. The top level menu will be displayed as a horizontal bar, but when child menus drop down from it they will be in the normal vertical format used by @@ -7141,7 +7275,7 @@ Popup or pulldown menus are created as an array of the structures: typedef struct MENU { char *text; - the text to display for the menu item - int (*proc)(); - called when the menu item is clicked + int (*proc)(void); - called when the menu item is clicked struct MENU *child; - nested child menu int flags; - disabled or checked state void *dp; - pointer to any data you need @@ -7274,7 +7408,7 @@ ensure there is room for the check. @heading DOS specifics -@@Drivers: @JOY_TYPE_*/DOS +@@Drivers @JOY_TYPE_*/DOS @xref install_joystick The DOS library supports the following type parameters for the install_joystick() function: @@ -7359,7 +7493,7 @@ DOS specifics The Sony Dual Shock or Namco Jogcon will reset themselves (to digital mode) after not being polled for 5 seconds. This is normal, the same thing happens on a Playstation, it's designed to stop any vibration in - case the host machine crashes. other mode switching controllers may + case the host machine crashes. Other mode switching controllers may have similar quirks. However, if this happens to a Jogcon controller the mode button is disabled. To reenable the mode button on the Jogcon you need to hold down the Start and Select buttons at the same time. @@ -7414,7 +7548,7 @@ DOS specifics Drivers for the IF-SEGA joystick interface cards by the IO-DATA company (these come in PCI, PCI2, and ISA variants). -@@Drivers: @GFX_*/DOS +@@Drivers @GFX_*/DOS @xref set_gfx_mode The DOS library supports the following card parameters for the set_gfx_mode() function: @@ -7559,7 +7693,7 @@ DOS specifics normal VESA 640x400 mode will be chosen instead), so if you want to use it you will have to explicitly pass GFX_XTENDED to set_gfx_mode(). -@@Drivers: @DIGI_*/DOS +@@Drivers @DIGI_*/DOS @xref detect_digi_driver, install_sound, install_sound_input The DOS sound functions support the following digital soundcards:
    @@ -7576,7 +7710,7 @@ DOS specifics
           DIGI_SOUNDSCAPE      - Ensoniq Soundscape
           DIGI_WINSOUNDSYS     - Windows Sound System
     
    -@@Drivers: @MIDI_*/DOS +@@Drivers @MIDI_*/DOS @xref detect_midi_driver, install_sound, install_sound_input The DOS sound functions support the following MIDI soundcards:
    @@ -7655,8 +7789,10 @@ processing of the main() function described above.
     
     When creating the main window, Allegro searches the executable for an ICON 
     resource named "allegro_icon". If it is present, Allegro automatically 
    -loads it and uses it as its application icon. Otherwise, Allegro uses the 
    -default IDI_APPLICATION icon.
    +loads it and uses it as its application icon; otherwise, Allegro uses the 
    +default IDI_APPLICATION icon. See the manual of your compiler for a method 
    +to create an ICON resource, or use the wfixicon utility from the tools/win 
    +directory.
     
     DirectX requires that system and video bitmaps (including the screen) be 
     locked before you can draw onto them. This will be done automatically, but 
    @@ -7675,7 +7811,7 @@ function are 8, 16, 24 and 32. This means that 15-bit and 16-bit desktops
     cannot be differentiated and are both reported as 16-bit desktops. See
     below for the consequences for windowed and overlay DirectX drivers.
     
    -@@Drivers: @GFX_*/Windows
    +@@Drivers @GFX_*/Windows
     @xref set_gfx_mode
        The Windows library supports the following card parameters for the 
        set_gfx_mode() function:
    @@ -7734,6 +7870,8 @@ below for the consequences for windowed and overlay DirectX drivers.
           /* ok, we are in direct drawing mode */
        }
     
    + Note that, mainly for performance reasons, this driver requires the + width of the screen to be a multiple of 4.
  • GFX_DIRECTX_OVL
    The DirectX overlay driver. It uses special hardware features to run @@ -7763,7 +7901,7 @@ below for the consequences for windowed and overlay DirectX drivers. this driver features a hardware mouse cursor emulation in order to speed up basic mouse operations (like GUI operations). -@@Drivers: @DIGI_*/Windows +@@Drivers @DIGI_*/Windows @xref detect_digi_driver, install_sound, install_sound_input The Windows sound functions support the following digital soundcards:
    @@ -7775,7 +7913,7 @@ below for the consequences for windowed and overlay DirectX drivers.
                                  Allegro mixing
           DIGI_WAVOUTID(n)     - high (n=0) or low (n=1) quality WaveOut device
     
    -@@Drivers: @MIDI_*/Windows +@@Drivers @MIDI_*/Windows @xref detect_midi_driver, install_sound, install_sound_input The Windows sound functions support the following MIDI soundcards:
    @@ -7796,14 +7934,26 @@ you must include winalleg.h after other Allegro headers.
        unless you have installed the neutral system driver (SYSTEM_NONE).
     
     @@void @win_set_window(HWND wnd);
    -   Registers an user-created window to be used by Allegro. This functions
    -   must be called *before* initializing the library with allegro_init() or
    -   installing the autodetected system driver (SYSTEM_AUTODETECT). It lets
    -   you attach Allegro to any already existing window and prevents the
    +   Registers an user-created window to be used by Allegro. This function is
    +   meant to be called before initialising the library with allegro_init()
    +   or installing the autodetected system driver (SYSTEM_AUTODETECT). It
    +   lets you attach Allegro to any already existing window and prevents the
        library from creating its own, thus leaving you total control over the
    -   window (in particular, you are responsible for processing the events).
    -   You can then use every component of the library (mouse, keyboard,
    -   sound, timers and so on) except the graphics subsystem.
    +   window; in particular, you are responsible for processing the events as
    +   usual (Allegro will automatically monitor a few of them, but will not
    +   filter out any of them). You can then use every component of the library 
    +   (mouse, keyboard, sound, timers and so on) except the graphics subsystem,
    +   bearing in mind that some Allegro functions are blocking (e.g readkey()
    +   if the key buffer is empty) and thus must be carefully manipulated by the
    +   window thread.
    +
    +   However you can also call it after the library has been initialised,
    +   provided that no graphics mode is set. In this case the keyboard, mouse,
    +   sound and sound recording modules will be restarted.
    +
    +   Passing NULL instructs Allegro to switch back to its built-in window if
    +   an user-created window was registered, or to request a new handle from
    +   Windows for its built-in window if this was already in use.
     
     @@void @win_set_wnd_create_proc(HWND (*proc)(WNDPROC));
        Registers an user-defined procedure to be used by Allegro for creating
    @@ -7927,7 +8077,7 @@ END_OF_MAIN() right after your main() function. Pretty easy, really, and if
     you forget, you'll get a nice linker error about a missing _mangled_main 
     function to remind you :-)
     
    -@@Drivers: @GFX_*/Linux
    +@@Drivers @GFX_*/Linux
     @xref set_gfx_mode, GFX_*/X
        When running in Linux console mode, Allegro supports the following card 
        parameters for the set_gfx_mode() function:
    @@ -7952,7 +8102,7 @@ function to remind you :-)
           set_gfx_mode() documentation for details.
     
  • GFX_FBCON
    - Use the framebuffer device (eg. dev/fb0). This requires you to have + Use the framebuffer device (eg. /dev/fb0). This requires you to have framebuffer support compiled into your kernel, and correctly configured for your hardware. It is currently the only console mode driver that will work without root permissions, unless you are using @@ -7975,7 +8125,7 @@ function to remind you :-) supporting the same modes as in the DOS versions of these drivers. Requires root permissions. -@@Drivers: @GFX_*/X +@@Drivers @GFX_*/X @xref set_gfx_mode, GFX_*/Linux When running in X mode, Allegro supports the following card parameters for the set_gfx_mode() function: @@ -8028,7 +8178,7 @@ function to remind you :-) The same as GFX_XDGA2, but turns off hardware acceleration support. This driver requires root permissions. -@@Drivers: @DIGI_*/Unix +@@Drivers @DIGI_*/Unix @xref detect_digi_driver, install_sound, install_sound_input The Unix sound functions support the following digital soundcards:
    @@ -8036,9 +8186,10 @@ function to remind you :-)
           DIGI_NONE            - no digital sound
           DIGI_OSS             - Open Sound System
           DIGI_ESD             - Enlightened Sound Daemon
    +      DIGI_ARTS            - aRts (Analog Real-Time Synthesizer)
           DIGI_ALSA            - ALSA sound driver
     
    -@@Drivers: @MIDI_*/Unix +@@Drivers @MIDI_*/Unix @xref detect_midi_driver, install_sound, install_sound_input The Unix sound functions support the following MIDI soundcards:
    @@ -8054,7 +8205,7 @@ function to remind you :-)
     @heading
     BeOS specifics
     
    -@@Drivers: @GFX_*/BeOS
    +@@Drivers @GFX_*/BeOS
     @xref set_gfx_mode
        BeOS Allegro supports the following card parameters for the
        set_gfx_mode() function:
    @@ -8088,7 +8239,7 @@ BeOS specifics
           Fast windowed mode using the BDirectWindow class. Not all graphics
           cards support this.
     
    -@@Drivers: @DIGI_*/BeOS
    +@@Drivers @DIGI_*/BeOS
     @xref detect_digi_driver, install_sound, install_sound_input
        The BeOS sound functions support the following digital soundcards:
     
    @@ -8096,7 +8247,7 @@ BeOS specifics
           DIGI_NONE            - no digital sound
           DIGI_BEOS            - BeOS digital output
     
    -@@Drivers: @MIDI_*/BeOS +@@Drivers @MIDI_*/BeOS @xref detect_midi_driver, install_sound, install_sound_input The BeOS sound functions support the following MIDI soundcards:
    @@ -8111,7 +8262,7 @@ BeOS specifics
     @heading
     QNX specifics
     
    -@@Drivers: @GFX_*/QNX
    +@@Drivers @GFX_*/QNX
     @xref set_gfx_mode
        QNX Allegro supports the following card parameters for the
        set_gfx_mode() function:
    @@ -8138,9 +8289,11 @@ QNX specifics
           Fullscreen exclusive mode through Photon.
     
  • GFX_PHOTON
    - Windowed mode in a Photon window. + Windowed mode in a Photon window. Note that, mainly for performance + reasons, this driver requires the width of the screen to be a multiple + of 4. -@@Drivers: @DIGI_*/QNX +@@Drivers @DIGI_*/QNX @xref detect_digi_driver, install_sound, install_sound_input The QNX sound functions support the following digital soundcards:
    @@ -8148,7 +8301,7 @@ QNX specifics
           DIGI_NONE            - no digital sound
           DIGI_ALSA            - ALSA sound driver
     
    -@@Drivers: @MIDI_*/QNX +@@Drivers @MIDI_*/QNX @xref detect_midi_driver, install_sound, install_sound_input The QNX sound functions support the following MIDI soundcards:
    @@ -8177,14 +8330,14 @@ code from one platform to another (you can find a more detailed version of
     this in the docs section of the Allegro website).
     
     The Windows and Unix versions require you to write END_OF_MAIN() after your 
    -main() function, which is used to magically turn an ANSI C style main() into 
    -a Windows style WinMain(), and so that the Unix code can grab a copy of your 
    -argv[] parameter.
    +main() function, which is used to magically turn an ANSI C style main() 
    +into a Windows style WinMain(), and so that the Unix code can grab a copy 
    +of your argv[] parameter.
     
    -On many platforms Allegro runs very slowly if you rely on it to
    -automatically lock bitmaps when drawing onto them. For good performance, you
    -need to call acquire_bitmap() and release_bitmap() yourself, and try to keep
    -the amount of locking to a minimum.
    +On many platforms Allegro runs very slowly if you rely on it in order to 
    +automatically lock bitmaps when drawing onto them. For good performance, 
    +you need to call acquire_bitmap() and release_bitmap() yourself, and try 
    +to keep the amount of locking to a minimum.
     
     The Windows version may lose the contents of video memory if the user 
     switches away from your program, so you need to deal with that.
    @@ -8195,8 +8348,7 @@ portability of your program, you should call poll_mouse() and
     poll_keyboard() in all the relevant places.
     
     Allegro defines a number of standard macros that can be used to check 
    -various attributes of the current platform, or to insulate you from some of 
    -the differences between systems:
    +various attributes of the current platform:
     
     ALLEGRO_PLATFORM_STR
    Text string containing the name of the current platform. @@ -8233,23 +8385,17 @@ the differences between systems: graphics mode. If this define is absent, you are running in an environment like Windows that has no stdout at all. +ALLEGRO_MAGIC_MAIN
    + Defined if Allegro uses a magic main, i.e takes over the main() entry + point and turns it into a secondary entry point suited to its needs. + ALLEGRO_LFN
    Non-zero if long filenames are supported, or zero if you are limited to 8.3 format (in the djgpp version, this is a variable depending on the runtime environment). -INLINE
    - Use this in place of the regular "inline" function modifier keyword, and - your code will work correctly on any of the supported compilers. - -ZERO_SIZE
    - Use this to declare zero sized arrays, eg. the "char *line[ZERO_SIZE]" in - the BITMAP structure. Some compilers want an actual zero there, while - others want nothing between the [], so this macro enables the same code - to work either way. - LONG_LONG
    - Defined to whatever represents a 64 bit "long long" integer for the + Defined to whatever represents a 64-bit "long long" integer for the current compiler, or not defined if that isn't supported. OTHER_PATH_SEPARATOR
    @@ -8259,17 +8405,24 @@ the differences between systems: DEVICE_SEPARATOR
    Defined to the filename device separator character (a colon for DOS and - Windows), or to zero if there are no explicit devices in paths (eg. Unix). + Windows), or to zero if there are no explicit devices in paths (Unix). + +Allegro also defines a number of standard macros that can be used to +insulate you from some of the differences between systems: USE_CONSOLE
    - If you define this prior to including Allegro headers, the Windows version - will be set up for building a console application rather than the normal - GUI program. + If you define this prior to including Allegro headers, Allegro will be + set up for building a console application rather than the default GUI + program on some platforms (especially Windows). -END_OF_MAIN()
    - Putting this after your main() function will enable Windows programs to - work with a regular main() routine, so you don't need to change - everything to use WinMain(). +INLINE
    + Use this in place of the regular "inline" function modifier keyword, and + your code will work correctly on any of the supported compilers. + +ZERO_SIZE_ARRAY(type, name)
    + Use this to declare zero-sized arrays in terminal position inside + structures, like in the BITMAP structure. These arrays are effectively + equivalent to the flexible array members of ISO C99. @@ -8452,7 +8605,7 @@ will make debugging much easier, and includes assert tests that will help to locate errors in your code at an earlier stage. Allegro also contains some debugging helper functions: -@@void @al_assert(char *file, int line); +@@void @al_assert(const char *file, int line); @xref ASSERT, al_trace, register_assert_handler Raises an assert for an error at the specified file and line number. The file parameter is always given in ASCII format. If you have installed a @@ -8462,7 +8615,7 @@ debugging helper functions: will usually want to use the ASSERT() macro instead of calling this function directly. -@@void @al_trace(char *msg, ...); +@@void @al_trace(const char *msg, ...); @xref TRACE, al_assert, register_trace_handler Outputs a debugging trace message, using a printf() format string given in ASCII. If you have installed a custom trace handler it uses that, or @@ -8483,7 +8636,7 @@ debugging helper functions: defined the preprocessor symbol DEBUGMODE before including Allegro headers, it passes the supplied message given in ASCII format to al_trace(). -@@void @register_assert_handler(int (*handler)(char *msg)); +@@void @register_assert_handler(int (*handler)(const char *msg)); @xref al_assert, ASSERT, register_trace_handler Supplies a custom handler function for dealing with assert failures. Your callback will be passed a formatted error message in ASCII, and should @@ -8492,7 +8645,7 @@ debugging helper functions: display the error messages on a graphics mode screen without aborting the program. -@@void @register_trace_handler(int (*handler)(char *msg)); +@@void @register_trace_handler(int (*handler)(const char *msg)); @xref al_trace, TRACE, register_assert_handler Supplies a custom handler function for dealing with trace output. Your callback will be passed a formatted error message in ASCII, and should @@ -8512,6 +8665,10 @@ platforms you can set the environment variables:
    • DEBUGMODE=1
      Selects a debug build, rather than the normal optimised version. +
    • + DEBUGMODE=2
      + Selects a build intended to debug Allegro itself, rather than the + normal optimised version.
    • PROFILEMODE=1
      Selects a profiling build, rather than the normal optimised version. @@ -8578,8 +8735,6 @@ makefiles also provide some special pseudo-targets:
    • 'uninstall'
      Removes the Allegro library and headers from your compiler directories. - This requires a Unix-style 'rm' utility to be available, eg. from the GNU - fileutils package.
    • 'docs'
      Converts the documentation files from the ._tx sources. @@ -8608,14 +8763,12 @@ makefiles also provide some special pseudo-targets: Removes generated object and library files, either to recover disk space or to force a complete rebuild the next time you run make. This target is designed so that if you run a "make install" followed by "make clean", - you will still have a functional version of Allegro. This requires a - Unix-style 'rm' utility to be available, eg. from the GNU fileutils - package. + you will still have a functional version of Allegro.
    • 'distclean'
      Like "make clean", but more so. This removes all the executable files and - HTML format documentation, leaving you with only the same files that are - included when you unzip a new Allegro distribution. + the documentation, leaving you with only the same files that are included + when you unzip a new Allegro distribution.
    • 'veryclean'
      Use with extreme caution! This target deletes absolutely all generated diff --git a/docs/src/changes._tx b/docs/src/changes._tx index 36a8e442ed..41b4fe7c3c 100644 --- a/docs/src/changes._tx +++ b/docs/src/changes._tx @@ -8,6 +8,490 @@ @ @ + +@heading +Changes from 4.0.2 to 4.0.3 (Apr 2003) +
      • + Many minor changes and clarifications in the docs. +
      • + Eric Botcazou fixed the profile build on BeOS. +
      • + Eric Botcazou updated the FAQ about DJGPP's va_list problem (thanks + to aj for spotting this). +
      • + Andrei Ellman suggested some additions to the docs. +
      • + Eric Botcazou added makeinfo detection under Unix. +
      • + Ville Skyttä fixed a problem with make install libdir= and modules on + Unix systems. +
      • + Peter Wang added a hack to not unload the SVGAlib module if SVGAlib + installs an atexit() handler. +
      • + Grzegorz Adam Hankiewicz corrected broken chapter references emitted by + the doc processor. +
      • + Grzegorz Adam Hankiewicz documented the END_OF_MAIN macro. +
      • + Eric Botcazou added big-endian support to the BMP, PCX and TGA loaders + as well as to the X11 driver. +
      • + Eric Botcazou fixed the 'uninstall' target and a problem with + Mingw32's make for the Watcom port. +
      • + Annie Testes fixed a bug with asynchronous I/O mode restoring under Linux. +
      • + Annie Testes made the screen be cleared before setting the default + palette when calling set_gfx_mode(). +
      • + Annie Testes fixed a bug with patterned drawing in the C version. +
      • + Vincent Penquerc'h spotted an off-by-one problem when building the list + of color depths in the gfx mode selector. +
      • + Peter Wang made the Intellimouse PS/2 driver work for USB mice in Linux. +
      • + Oscar Giner fixed a conflict between the magic main and the MFC. +
      • + Matthew Leverton fixed a bug with pack_fgets(). +
      • + Eric Botcazou fixed broken and missing dependencies for make -j2 builds. +
      • + Grzegorz Adam Hankiewicz backported his email address mangling code from + 4.1.x for inclusion in makedoc. +
      • + Hein Zelle revamped the cross-compilation section of docs/build/mingw32.txt. +
      • + Marcel Smit and Eric Botcazou made the show_video_bitmap() method of the + Windows windowed driver wait for a vsync. +
      • + Eric Botcazou made the test program really time the fixed math functions. +
      • + Eric Botcazou clarified the limitations of Allegro's interrupts regarding + the FPU state under DOS. +
      • + Peter Wang fixed a bug in stretch_blit() where the first column or row can + get an extra pixel, reported by David Gowers and AJ. +
      • + Eric Botcazou made the linux mouse detection code really empty the buffer + before proceeding in the setup program. +
      • + Eric Botcazou made the Watcom port compile in warnmode with Open Watcom. +
      • + Elias Pschernig fixed the build with the Unix->MinGW cross-compiler. +
      • + Magnus Henoch made the gfx mode selector keep the current selection as + much as possible. +
      • + Henrik Stokseth merged the standard and extended gfx mode selectors. +
      • + Eric Botcazou added -Wstrict-prototypes to the build warnmode under DOS, + Windows and BeOS. +
      • + Philipp Thomas added the German translation to the RPM spec file. +
      • + Philipp Thomas fixed all function prototypes, thus allowing to build with + -Wstrict-prototypes on Unix systems. +
      • + Philipp Thomas fixed the compilation on x86-64. +
      • + Philipp Thomas fixed all comparisons between signed and unsigned types, + thus allowing to build with -W -Wno-unused on Unix systems. +
      • + Eric Botcazou reworked the truecolor subsection of the 'Transparency and + patterned drawing' section. +
      • + Eric Botcazou clarified the return value on failure of file_time(), + following AJ's suggestion. +
      • + Eric Botcazou fixed the build in strictwarn mode on Unix systems. +
      • + Peter Wang added an aRts driver to the Unix port. +
      • + Eric Botcazou fixed a mouse bug when the screen is scrolled with the X11 + fullscreen driver. +
      • + Eric Botcazou fixed a bug with resolution and color depth not being taken + into account by gfx_mode_select_ex(). +
      • + Eric Botcazou defined ALLEGRO_LIB_BUILD for debug and profile releases as + well on Unix systems. +
      • + Eric Botcazou forced the exstream example to abort if no real sound driver + is found. +
      • + Eric Botcazou clarified the limitations of the stretching functions. +
      • + Eric Botcazou re-enabled the autodetection of joysticks in the setup + program. +
      • + Annie Testes fixed some device name strings in the setup program. +
      • + Eric Botcazou disabled hackish centering code in fullscreen mode + under X11 which caused some artifacts to appear on KDE desktops. +
      • + Eric Botcazou fixed a bug with Alt+TAB under X11. +
      • + Eric Botcazou added a configure check for the include prefix problem + with gcc 3.1 or later on Unix systems. +
      • + Matt Witherspoon and Eric Botcazou fixed a bug in the scroll() method of + the Linux SVGAlib driver so as to make it wait for the vertical retrace. +
      • + Ben Davis documented the non-standard behaviour of pack_feof(). +
      • + Eric Botcazou worked around a weird problem with some X11 window managers + that prevented the fullscreen driver from setting up. +
      • + Grzegorz Adam Hankiewicz added a warning about DJGPP stability under some + Windows versions. +
      • + Eric Botcazou made it so that the window is centered at startup under + Windows. +
      • + Chris Jones and Eric Botcazou worked around a problem with DOS file + attributes under Win2k. +
      • + Eric Botcazou made the filetest work better with the keyboard. +
      • + Elias Pschernig added support to use the saved window position for initial + window placing under Windows. +
      • + Eric Botcazou fixed the mishandling of TAB characters in menu bar entries. +
      • + Elias Pschernig optimized the load_bitmap() function family when no + palette is specified and documented the feature. +
      • + Eric Botcazou added a new DEBUGMODE level so that debuggers will not be + flooded by internal debug messages any more under Windows. +
      • + Grzegorz Adam Hankiewicz improved the internationalization of the close + button message. +
      • + Thomas Klausner added NetBSD detection. +
      • + Ben Davis constified the parameter of set_window_title(). +
      • + Lisa Parratt added IRIX detection. +
      • + Robert J. Ohannessian clarified the docs for play_audio_stream(). +
      • + Eric Botcazou fixed a buffer overflow in the Windows debug version + spotted by aj. +
      • + Eric Botcazou fixed the compile-time check for the MMX asm support. +
      • + Eric Botcazou fixed the non-MMX asm color copy routine. +
      • + Grzegorz Adam Hankiewicz added informations on the FLI format provided + by Kronoman X to the FAQ. +
      • + Eric Botcazou added the support for plugin scripts to the MinGW port. +
      • + Matthew Leverton added the detection of left-hand mouse configuration + under Windows. +
      • + Eric Botcazou fixed a crash when Alt+Tabbing under WinXP. +
      • + Grzegorz Adam Hankiewicz updated the docs about mailing lists/contacts. +
      • + Grzegorz Adam Hankiewicz added instructions on how to create and submit + patches to the Allegro developers. +
      • + Lisa Parratt spotted a BSDism that IRIX doesn't like at all. +
      • + Eric Botcazou fixed a bug in scare_mouse_area(). +
      • + Elias Pschernig added the Euro character to the default font and to the + German and French keyboard configuration files. +
      • + Eric Botcazou prevented set_gfx_mode() from resetting the layout of all + color depths. +
      • + Oscar Giner added the Catalan translation. +
      • + Oscar Giner corrected the Spanish translation. +
      • + Eric Botcazou prevented the linker from choking on Solaris because of a + static library with no symbols. +
      • + Eric Botcazou removed joystick control from main part of the setup program. +
      • + Eric Botcazou documented the workaround needed for C++ programs compiled + with Borland C++ (in docs/build/bcc32.txt). +
      • + Eric Botcazou unified the magic main for the 3 Windows compilers and fixed + the WinMain() linkage for Borland C++. +
      • + Henrik Schmidt made gcc pass '-h' instead of '-soname' to the linker and + replaced '-L' by '-h' in shell comparisons so as not to break on Solaris. +
      • + Javier Gonzalez and Eric Botcazou fixed the infamous blank screen problem + under Win2k/WinXP. +
      • + Evert Glebbeek added configure options for x86 processor optimizations + on Unix systems. +
      • + Benny Colyn added the Dutch translation. +
      • + Evert Glebbeek added the detection of SunOS/Solaris. +
      • + Javier Gonzalez fixed a graphics bug with always-on-top applications. +
      • + Igor Gnip added the detection of MSYS via the SHELL variable to the + MingW32 port. +
      • + Eric Botcazou fixed a bug than had prevented ALT+F4 from being properly + handled under Windows and cleaned up the low-level scancode handler. +
      • + Eric Botcazou updated the description of the layout of header files in + the aHack file. +
      • + Grzegorz Adam Hankiewicz corrected the docs about 'ulimit' in the Help + file. +
      • + Peter Wang made fix.sh and zipup.sh not destroy timestamps when just + changing EOL markers. +
      • + Robert J. Ohannessian added more caveats to docs/build/mingw32.txt. +
      • + Eric Botcazou modified the querying of DirectSound devices under Windows. +
      • + Evert Glebbeek added a '-fullscreen' switch to the grabber, Laurence + Withers a '-windowed' switch. +
      • + Daniel Schlydler fixed problems with get_executable_name() under Windows. +
      • + Eric Botcazou added a FAQ entry on the C++ headers problem with gcc 3.x + and Mingw32, summarizing findings by Robert J. Ohannessian. +
      • + Grzegorz Adam Hankiewicz fixed a crash in the exmouse example when no + mouse is present. +
      • + Angelo Mottola made the exunicod example welcome Italian programmers too. +
      • + Eric Botcazou fixed a conflict between Allegro headers and standard C++ + headers of gcc 3.x under Mingw32. +
      • + Matthew Leverton made the DOS/Windows makefiles use 'copy /B' instead + of 'copy' for file concatenation. +
      • + Roberto Alfonso added an srand() call in the demo game. +
      • + Elias Pschernig removed (seemingly) arbitrary window size checks in the + Unix X11 driver. +
      • + Javier Gonzaled fixed a bug with volume and pan not properly set in + loop mode by the DirectSound driver. +
      • + Eric Botcazou fixed the documented prototype of fixtof() and ftofix(). +
      • + Eric Botcazou fixed a bug that causes timers to restart permanently when + Allegro is switched out under Windows. +
      • + Eric Botcazou fixed a bug with graphics mode switching using a + ALT+key combination under Windows. +
      • + Eric Botcazou improved win_set_window() so that it can be called + after the library has been initialized. +
      • + Elias Pschernig fixed a bug in midi_seek(). +
      • + Grzegorz Adam Hankiewicz added a linux specific debug help section. +
      • + Jan Bruun Andersen fixed a compilation problem with Cygwin. +
      • + Ben Davis and Robert J. Ohannessian put in (void *) casts for the + LOCK_* macros on DJGPP and Mac. +
      • + Nicholas Davies made the fix class not trigger warnings with gcc -Weffc++. +
      • + Angelo Mottola fixed a keyboard focus problem under BeOS. +
      • + Peter Wang fixed the detection of ESD on Unix systems. +
      • + Peter Wang made files be opened with as permissive as possible + permissions on Unix systems. +
      • + Peter Wang did some housekeeping work throughout the code and the + documentation. +
      • + Peter Wang added support for the environment variable ALLEGRO_MODULES + under Unix. +
      • + Sven Sandberg fixed various problems in the makefiles. +
      • + Henrik Stokseth made the zipwin.sh script for packaging the Windows + binary distribution work with Cygwin. +
      • + Peter Wang and Eric Botcazou made it so that Allegro C programs can + compile with gcc -ansi -pedantic. +
      • + Eric Botcazou fixed the 'configure --disable-constructor' problem. +
      • + Igor Gnip removed the requirements for fileutils on DOS/Windows platforms. +
      + + +@heading +Changes from 4.0.1 to 4.0.2 (Jun 2002) +
      • + Many clarifications in the docs. +
      • + Sven Sandberg improved accuracy and fixed bugs in do_arc(). +
      • + Matthew Leverton added missing header files to be installed by the + Windows binary distribution. +
      • + Grzegorz Adam Hankiewicz fixed a problem with the TOC of the FAQ. +
      • + Eric Botcazou fixed a bug with stretch_blit() under Windows XP. +
      • + Peter Wang fixed various configure machinery problems under Unix. +
      • + Sven Sandberg updated the Swedish translation file. +
      • + Sven Sandberg fixed a crash in the exswitch example when compiled + by Watcom C/C++ and also made if faster. +
      • + Maxime Carey added a Canada (French) keyboard mapping file. +
      • + Henrik Stokseth updated instructions and fixed installation for Cygwin. +
      • + Eric Botcazou added an option to disable direct updating in color + conversion mode under Windows. +
      • + Eric Botcazou (presumably) fixed the bug in the emergency exit mechanism + under Windows when called from the DLL. +
      • + Angelo Mottola made it so that the sound doesn't block the main thread + anymore under BeOS. +
      • + Deepak T and Eric Botcazou fixed clipping in three C sprite drawing + routines. +
      • + Peter Wang fixed a deadlock that occurred under Unix when Allegro + received an X11 close event. +
      • + Eric Botcazou added a --cppflags option to allegro-config and fixed + C++ compilation under QNX. +
      • + Vincent Penquerc'h added a --version= option to allegro-config. +
      • + Robert J. Ohannessian made the 32->24 color convertors more robust and + improved the MMX one in the process. +
      • + Robert J. Ohannessian, Eric Botcazou and Sven Sandberg fixed a bug in + the hue blender and the hsv_to_rgb() routine. +
      • + Matthew Leverton fixed another problem with al_find*() and NTFS + partitions under Windows. +
      • + Peter Wang fixed a bug in ALSA device detection. +
      • + Peter Wang fixed a bug in al_find* under Unix when running as root. +
      • + Matthew Leverton and Eric Botcazou fixed a bug with mouse mickeys in + windowed mode under Windows. +
      + + +@heading +Changes from 4.0.0 to 4.0.1 (Mar 2002) +
      • + Many minor changes, many clarifications in the docs. +
      • + Peter Wang fixed the installation of shared libs under FreeBSD. +
      • + Peter Wang and Eric Botcazou fixed autodetection glitches for VGA and + SVGAlib. +
      • + Eric Botcazou fixed a problem under X11 when the MIT X-SHM extension is + used. +
      • + Eric Botcazou fixed a deadlock on exit when an user window is used in + conjunction with timers under Windows. +
      • + Eric Botcazou disabled useless backbuffers for the DirectX safe driver. +
      • + Peter Wang made the Alsa sound driver use non-blocking mode when + detecting if ALSA PCM available. +
      • + Sven Sandberg added support for long long integers to usprintf() and al. +
      • + Robert J. Ohannessian fixed the difference blender. +
      • + Peter Wang fixed a race condition when closing the X display. +
      • + Elias Pschernig made all active dialogs redraw themselves after a switch. +
      • + Peter Wang made fbcon a priority driver, so that it can appear above VGA. +
      • + Javier Gonzalez fixed a glitch in the DirectSound input code. +
      • + Eric Botcazou fixed the SIGSEGV on exit with the three-finger salute + under QNX. +
      • + Eric Botcazou fixed the C-to-asm calling problem for Borland C++ compiled + programs. +
      • + Eric Botcazou cleaned up the messy (and somewhat incorrect) DirectDraw + bitmap management code. +
      • + Sven Sandberg improved the video bitmap subdivision algorithm. +
      • + Sven Sandberg fixed problems in the Windows makefiles (especially + Borland) when building Allegro under Win98. +
      • + Peter Wang removed the hack which switched off fix aliases under IRIX. +
      • + Vincent Penquerc'h fixed a problem with the SIGALRM timer and + SWITCH_PAUSE. +
      • + Javier Gonzalez fixed a latency problem with audiostreams. +
      • + Laurence Withers made the font exporter use the current palette for the + output. +
      • + Elias Pschernig made some changes to grabber: added a close hook; keeps + track if anything has been modified; when you exit the grabber and the + file was modified, the popup now has a 3rd option for save+exit; window + title displays the current filename, and if the file has been modified; + fixed multicolour font exports. +
      • + Sven Sandberg optimized again the create_light_table() function. +
      • + Attila Szilagyi fixed SVGAlib horizontal scrolling. +
      • + Eric Botcazou fixed synchronization problems under QNX. +
      • + Grzegorz Adam Hankiewicz made the TOC at the top of sections + alphabetically sorted. +
      • + Eric Botcazou fixed the screen not restored after a wake-up in the + Windows windowed and overlay drivers. +
      • + Richard Reeve fixed a silly mistake with gcc 3.0.x detection. +
      • + Angelo Mottola fixed static keyconf compilation problem on BeOS due to + pckeys keyboard driver. +
      • + Eric Botcazou fixed the not-returning-focus-on-exit bug under Windows. +
      • + Michael Bukin fixed a bug with C-version textprintf on 24-bpp bitmaps, + reported by Bertrand Coconnier. +
      • + Eric Botcazou fixed a bug in the 32->15 MMX color conversion routine. +
      • + Eric Botcazou fixed the DLL linking problem with Borland C++ Builder 4. +
      • + Sven Sandberg made exaccel more responsive. +
      • + Sven Sandberg fixed a glitch with short filenames under DOS. +
      + + @heading Changes from 3.9.40 to 4.0.0 (Dec 2001)
      • @@ -406,7 +890,7 @@ Changes from 3.11 to 3.9.40 (Nov 2001) 3.9.38: Peter Wang renamed clear() to clear_bitmap(). clear() is still provided for backwards compatibility.
      • - 3.9.38: Stephan Roh made fractal generator work under non-Intel + 3.9.38: Stepan Roh made fractal generator work under non-Intel processors.
      • 3.9.38: Eric Botcazou made a valid display switch mode of SWITCH_NONE @@ -425,7 +909,7 @@ Changes from 3.11 to 3.9.40 (Nov 2001)
      • 3.9.38: Angelo Mottola added a bfixicon utility.
      • - 3.9.38: Stephan Roh made the native Allegro time format of ANSI time_t. + 3.9.38: Stepan Roh made the native Allegro time format of ANSI time_t.
      • 3.9.38: Peter Wang added an ustrtok_r() function.
      • @@ -998,7 +1482,7 @@ Changes from 3.11 to 3.9.40 (Nov 2001) findnext(), and findclose(), and corrected the documentation for get_executable_name().
      • - 3.9.33: Stephan Roh made patches to allow compilation on IRIX. + 3.9.33: Stepan Roh made patches to allow compilation on IRIX.
      • 3.9.33: John Harger made a change to improve the stability of AllegroGL in Windows. diff --git a/docs/src/faq._tx b/docs/src/faq._tx index 9a56d51fe7..1f3b4dea0a 100644 --- a/docs/src/faq._tx +++ b/docs/src/faq._tx @@ -92,6 +92,10 @@ DJGPP problems @@ When I run make, it says "makefile has modification time in the future". Are you sure that your system time and date are set correctly? + Alternatively you may have downloaded a fresh file made by someone in a + more eastern timezone. In the latter case you can either wait a few + hours, temporarily set your clock forward, or use a utility such as + "touch" to change the timestamp of the files.

      • @@ When I run make, it says "virtual memory exhausted". @@ -104,6 +108,14 @@ DJGPP problems have to type this in by hand, because the pulldown list doesn't go above 16384). +

      • +@@ When I run make, it says "conflicting types for va_list". +
      • + As the error message suggests, there is a conflict between newer + versions of gcc and older versions of the libc. You must upgrade your + djdevxxx.zip package to the latest update (timestamp 11 August 2002) + of DJGPP-2.03 or above. +

      • @@ When I try to compile a program using Allegro, I get lots of errors like:
        C:\TEMP\ccdaaaaa(.text+0x9):x.c: undefined reference to `allegro_init'
        @@ -227,7 +239,7 @@ DOS problems Well duh, you need to increase the size of your environment then :-) You can do this by changing the settings for your DOS box (click the system menu and select "properties"), or at startup in your config.sys - file (eg. "shell=c:\command.com /e:8192"). + file (eg. "shell=c:\command.com /e:8192 /p").
      @@ -236,6 +248,22 @@ DOS problems Windows problems

      • +@@ I get an "out of environment space" error when I run fix.bat or + vcvars32.bat! +
      • + Well duh, you need to increase the size of your environment then :-) + You can do this by changing the settings for your DOS box (click the + system menu and select "properties"), or at startup in your config.sys + file (eg. "shell=c:\command.com /e:8192 /p"). + +

      • +@@ I get an error about a "missing separator" when I run make! +
      • + Make sure that you don't have a semi-colon appended to your MSVCDIR + variable if you are using MSVC, to your MINGDIR variable if you are + using Mingw32 or to your BCC32DIR variable if you are using BCC. + +

      • @@ I get lots of compile errors about things like "LPDIRECTDRAWSURFACE2"!
      • You need to tell your compiler how to find the DirectX include files @@ -252,20 +280,55 @@ Windows problems least version 5, which you can get from the Microsoft Developer site.

      • -@@ I get errors about a missing WinMain() or main() function! +@@ When I run make, it says "windres: no resources". +
      • + If an anti-virus software (Norton or McAfee for example) is running in + the background on your computer, try to disable it temporarily. + +

      • +@@ I get an error about a missing WinMain() or main() function!
      • You need to write END_OF_MAIN() just after your main() function. Allegro uses this, along with some preprocessor magic, to turn a normal main() function into a Windows-style WinMain() entrypoint.

      • -@@ I get an "out of environment space" error when I run fix.bat or - vcvars32.bat! +@@ I get an error about an "unresolved external symbol _main"!
      • - Well duh, you need to increase the size of your environment then :-) - You can do this by changing the settings for your DOS box (click the - system menu and select "properties"), or at startup in your config.sys - file (eg. "shell=c:\command.com /e:8192"). + Make sure you're building a Windows GUI Application, and not a Windows + Console Application. This is a setting when you create the project in + MSVC or Borland C++ Builder. This is specified by the '-tW' flag for + the Borland C++ command line compiler. Either that, or define the + preprocessor symbol ALLEGRO_USE_CONSOLE prior to including Allegro + headers if you really need the console for your program. + +
      • +@@ I get lots of compile errors about conflicting types for "struct BITMAP"! +

        + If your program directly includes Win32 API header files, see the + "Windows specifics" section of the documentation. If your program only + includes header files of the C++ standard library, you're very likely + trying to compile it with gcc 3.x for Mingw32; if so, define the + symbol __GTHREAD_HIDE_WIN32API on the compiler command line: + g++ -D__GTHREAD_HIDE_WIN32API program.cpp -lalleg + +
      • +@@ In windowed mode artifacts are left on the desktop when the window + is moved or when another window is placed on top of it. +

        + Disable direct updating for the DirectX windowed driver by using the + dedicated configuration variable. See the 'Configuration routines' + section in the docs and the allegro.cfg template file for more + detailed informations. + +

      • +@@ In windowed mode the screen stays black unless the window is placed + under another window on the desktop. +
      • + Disable direct updating for the DirectX windowed driver by using the + dedicated configuration variable. See the 'Configuration routines' + section in the docs and the allegro.cfg template file for more + detailed informations.
      @@ -424,7 +487,12 @@ General problems @@ How can I generate FLI or FLC format animations? See the Allegro.cc homepage (http://www.allegro.cc/) - for some utilities, for example DTA and Smacker. + for some utilities, for example DTA and Smacker. Also, you can use ASE + (Allegro Sprite Editor, http://ase.sourceforge.net/), which allows + drawing/editing each frame of the animation and save it as a FLI. Or + you can use The GIMP (http://www.gimp.org/) along with it's GFli + plugin, using layers as frames, and saving your work as "file.fli". + The GIMP allows you to edit existent FLI files too.

    • @@ How can I make parts of my sprite transparent in truecolor modes? @@ -452,7 +520,7 @@ General problems will rotate the graphic by 45 degrees.

    • -@@ I can't get the d_icon_proc() GUI object to work! +@@ I can't get the d_bitmap_proc() or d_icon_proc() GUI object to work!
    • You are probably trying to initialise the dialog structure with a pointer to your bitmap, right? That won't work because the dialog is @@ -492,7 +560,7 @@ General problems speed_counter++; } - END_OF_FUNCTION(increment_speed_counter); + END_OF_FUNCTION(increment_speed_counter) void play_the_game() { diff --git a/docs/src/help._tx b/docs/src/help._tx index 8630f69c2d..9c5eba9c45 100644 --- a/docs/src/help._tx +++ b/docs/src/help._tx @@ -148,6 +148,68 @@ Part 3 - when your program crashes should start out by assuming that it is a case of operator error and double-check exactly what you are passing to the Allegro function. +@hnode crashes under Linux/Unix + When your Allegro compiled Linux/Unix program crashes, you will usually + get a not very meaningful message along with a core dump: +
      +      Shutting down Allegro due to signal #11
      +      Segment violation (core dumped)
      +
      + Look at your filesystem: there should be a file named core or something + similar with information telling you exactly where the crash occurred. + If there is no core, check your environment settings, under bash this is + done with the 'ulimit -a' command. Usually 'ulimit -c unlimited' + somewhere in your login scripts should work fine. + + Just like with djgpp, to make sense of the core, you should compile your + program with debugging information (using the -g switch), and then run + the GNU debugger on it "gdb binary core". That will load the debugger, + print some information about linked binaries and leave you at a prompt. + Now you can get the full backtrace: +
      +      (gdb) backtrace
      +      #0  0x08065237 in utf8_getx (s=0xbffffc5c) at ./src/unicode.c:347
      +      #1  0x0806953f in ustrzcpy (dest=0x0, size=2147483646, src=0x0) at ./src/unicode.c:1770
      +      #2  0x08057575 in _mangled_main () at t.c:9
      +      #3  0x0806c9bf in main (argc=1, argv=0xbffffd14) at ./src/unix/umain.c:39
      +      #4  0x4015414f in __libc_start_main () from /lib/libc.so.6
      +
      + In this case, you can see that the crash occurred in the ustrzcpy() + function, which was called at line 9 of the main() function in the t.c + source file. Now you just have to go to that line, have a look at + whatever you are doing there, and change it to be correct :-) + + Note that the crash happened deep inside an Allegro function, which is + also revealed by the traceback. However, the binary was linked against a + static debug version of Allegro, we wouldn't have had so much luck with + a non debug or dynamically linked version. + + Since gdb is an interactive debugger, you could also select a frame and + check out the values of the variables, to see better who is the culprit: +
      +      (gdb) frame 2
      +      #2  0x08057575 in _mangled_main () at t.c:9
      +      9          ustrcpy(p1, p2);
      +      (gdb) list
      +      4
      +      5       int main(void)
      +      6       {
      +      7          char *p1 = 0, *p2 = 0;
      +      8          allegro_init();
      +      9          ustrcpy(p1, p2);
      +      10         return 0;
      +      11      }
      +      12      END_OF_MAIN()
      +      (gdb) print p1
      +      $1 = 0x0
      +      (gdb) print p2
      +      $2 = 0x0
      +
      + Yuck! Playing with NULL values doesn't really pay off. Ok, while this was + a slightly out-of-the-can example, you surely get the point. Remember to + check out GDB's manual to learn about more useful commands and/or how to + debug your program while it's running and many other things. + @heading diff --git a/docs/src/thanks._tx b/docs/src/thanks._tx index cfb8a9a9f4..4e04b30701 100644 --- a/docs/src/thanks._tx +++ b/docs/src/thanks._tx @@ -2,6 +2,7 @@ @# This is the source for the Allegro thanks list, in a weird custom format. @# Read makedoc.c for a description of what is going on... @# +@mangle_emails=at dot @ @ @Allegro Contributors @@ -36,8 +37,9 @@ Contributors Wrote the Ensoniq Soundscape driver and fixed division bugs in the fix class. - Andrei 'old-boy' Ellman (ellman@xs4all.nl).
      - Contributed the polygon_z_normal() function. + Andrei Ellman (ae-a@wackonet.fsnet.co.uk).
      + Contributed the polygon_z_normal() function and suggested some additions + to the docs. Andrew Ellem (krand@ican.net).
      Wrote the original version of the digital audio streaming code. @@ -58,11 +60,13 @@ Contributors fetch_mode_list() to the BeOS and DGA2 fullscreen drivers. And, oh, contributed the QNX port too. - Annie Testes (email unknown).
      - Added font_height, render_char, char_length hooks to FONT_VTABLE. - Fixed several glitches in the unicode support. Added a pack_fdopen() - function. Caught a misordering in the X system shutdown. Found ASCII - strings that needed to be converted. + Annie Testes (annie@kezako.net).
      + Added font_height, render_char, char_length hooks to FONT_VTABLE. Fixed + several glitches in the unicode support. Added a pack_fdopen() function. + Caught a misordering in the X system shutdown. Found ASCII strings that + needed to be converted. Fixed some device name strings in the setup + program. Fixed a bug with patterned drawing in the C version and another + one with asynchronous I/O mode restoring under Linux. Antoine Mathys (mmathys@bluewin.ch).
      Added the Swiss keyboard mapping. @@ -81,6 +85,9 @@ Contributors Arne Steinarson (arst@ludd.luth.se).
      The fixed point square root routine came from his fix-float library. + Attila Szilagyi (attilabox@hotmail.com).
      + Fixed SVGAlib horizontal scrolling. + Ben Chauveau (bendomc@worldnet.fr).
      Added support for Tseng ET6000 cards (now available as part of the FreeBE/AF project). @@ -93,12 +100,16 @@ Contributors Added set_volume_per_voice(), made silent voices continue playing, and fixed other minor bugs in the mixer. Fixed a bug in create_rgb_table(). Adapted polygon functions to handle two coincident vertices. Added the - set_window_close_button() and set_window_close_hook() framework. - Added support for timers with parameters under Windows. + set_window_close_button() and set_window_close_hook() framework. Added + support for timers with parameters under Windows. Documented the + non-standard behaviour of pack_feof(). Benjamin Joel Stover (stovertech@intellisys.net).
      Wrote the initial version of the fullscreen X-Windows graphics driver. + Benny Colyn (email unknown).
      + Added a Dutch translation. + Bertrand Coconnier (bcoconni@club-internet.fr).
      Modified routines in poly3d.c for subpixel and subtexel accuracy. Speed enhancements in polygon functions. Fixed blending in C version of @@ -132,6 +143,9 @@ Contributors Chris Graham.
      Suggested to add a new flag for Windows NTFS compressed files. + Chris Jones (cj@jibblers.plus.com).
      + Worked around a problem with DOS file attributes under Win2k. + Chris La Mantia (celamantia@home.com).
      Wrote the d_radio_proc(), d_icon_proc(), and d_slider_proc() dialog objects, added the D_DISABLED flag, improved the GUI handling of @@ -147,6 +161,9 @@ Contributors Enlarged the starfield in exstars, and fixed an incorrect range in exlights. + Daniel Schlydler (daniel@dascdev.net).
      + Fixed problems with get_executable_name() under Windows. + David A. Capello (dacap@users.sourceforge.net).
      Made dotted_rect() avoid bank switches. Fixed a problem with lost GUI mouse clicks. Made d_menu_proc steal/return focus when @@ -162,6 +179,9 @@ Contributors David Calvin (calvid@rpi.edu).
      Wrote the original version of the sound setup utility. + Deepak T (coolbool@gmx.net).
      + Fixed clipping in three C sprite drawing routines. + Dmitriy Kazimirow (mariann@mail.ru).
      Provided the Russian keyboard mapping and message translation files. @@ -182,6 +202,11 @@ Contributors Elias Pschernig (eliaspschernig@aon.at).
      Added a COLORCONV_KEEP_TRANS mode. Contributed the wfixicon utility. + Contributed several enhancements to the grabber. Fixed a bug in + midi_seek(). Added support to use the saved window position for initial + window placing under Windows. Optimized the load_bitmap() function family + when no palette is specified and documented the feature. Revamped the + cross-compilation section of docs/build/mingw32.txt. Eric Botcazou (ebotcazou@multimania.com).
      Made the DGA driver work better in 8bpp and 32bpp modes, improved the @@ -198,9 +223,11 @@ Contributors Ettore Perazzoli (ettore@comm2000.it).
      Optimised the linear -> mode-X blitting function. - Evert Glebbeek (eglebbk@phys.uva.nl).
      - Put set_gfx_mode on a diet and added a config entry for specifying the - card to be used for GFX_AUTODETECT_WINDOWED. + Evert Glebbeek (eglebbk@dds.nl).
      + Put set_gfx_mode on a diet, added a config entry for specifying the card + to be used for GFX_AUTODETECT_WINDOWED, added a '-fullscreen' switch to + the grabber, added the detection of SunOS/Solaris and added configure + options for x86 processor optimisations on Unix systems. Fabian Nunez (faybs@iafrica.com).
      Added support for the CH Flightstick Pro and Logitech Wingman Extreme @@ -217,7 +244,7 @@ Contributors Frodo Baggins (l41273@alfa.ist.utl.pt).
      Made the Portuguese keyboard mapping. - Garret Thomson (gart@terraport.net).
      + Garret Thomson (g@sirsonic.com).
      Wrote the music used in the demo game. George Foot (gfoot@users.sourceforge.net).
      @@ -237,8 +264,8 @@ Contributors target, translated the docs and system error messages into Spanish, suggested the idea of embedding the setup utility into other programs, wrote some documentation and corrected the .texi generation to improve - texi2dvi output, improved the makedoc utility, added reload_config_texts() - and did plenty of other things too. + texi2dvi output, improved the makedoc utility, added reload_config_texts(), + added the email address mangling code and did plenty of other things too. Grzegorz Godlewski.
      Contributed a Polish localization patch and added support for lower and @@ -258,8 +285,13 @@ Contributors Haruhiko Okumura, 12-2-404 Green Heights, 580 Nagasawa, Yokosuka 239, JP.
      Wrote the original version of the LZSS compression code. - Henrik Schmidt.
      - Found a workaround for the switching problem under Windows. + Hein Zelle (hein@icce.rug.nl).
      + Revamped the cross-compilation section of docs/build/mingw32.txt. + + Henrik Schmidt (hbs@ks.informatik.uni-kiel.de).
      + Found a workaround for the switching problem under Windows, made gcc pass + '-h' instead of '-soname' to the linker and replaced '-L' by '-h' in shell + comparisons so as not to break on Solaris. Henrik Stokseth (hstokset@tiscali.no).
      Contributed a native Mingw32 build which can also be built with a @@ -269,6 +301,10 @@ Contributors Rewrote the mode-selector to use get_gfx_mode_list(). Rewrote/updated some scripts and reworked the build system many times. + Igor Gnip (gnipi@mindnever.org).
      + Removed the requirements for fileutils on DOS/Windows platforms and added + the detection of MSYS to the MingW32 port. + Isaac Cruz (icruzbal@teleline.es).
      Fixed a bug with accelerated drawing onto sub bitmaps of DirectDraw surfaces, added the GFX_DIRECTX_WIN driver, fixed a Windows sub bitmap @@ -287,10 +323,13 @@ Contributors Added support for quoted strings in the get_config_argv() function, and the dithering code for paletted images. + Jan Bruun Andersen (jba-dk@users.sourceforge.net).
      + Fixed a compilation problem with Cygwin. + Jan Hubicka (hubicka@horac.ta.jcu.cz).
      Vastly improved the speed of the create_rgb_table() function. - Jason Wilkins (fenix at io dot com).
      + Jason Wilkins (fenix@io.com).
      Wrote the quaternion math routines, and contributed the BeOS port. Javier Gonzalez (xaviergonz@hotmail.com).
      @@ -298,7 +337,8 @@ Contributors set_window_title(), added close button hook support and improved switching in Windows, fixed bad clearing of subbitmaps, and made bug reports and suggestions for improvement. Contributed bidirectional - looping and backward playing support for the DirectSound driver. + looping support, backward playing support and bugfixes for the + DirectSound driver, and did plenty of other things too. Jim Flynn (jflynn@pacbell.net).
      Removed floating point calculations from the AWE32 MIDI driver. @@ -350,10 +390,11 @@ Contributors Krzysztof Krzyzaniak (eloy@arrakis.cs.put.poznan.pl).
      Wrote the load_voc() function. - Laurence Withers (lwithers@lwithers.demon.co.uk).
      + Laurence Withers (lwithers@users.sf.net).
      Added destroy hook to font structure, worked on const-correctness - throughout the library, implemented the new FONT structure and made - some modules avoid linking dependencies. + throughout the library, implemented the new FONT structure, made + some modules avoid linking dependencies and added a '-windowed' + switch to the grabber. Lee Killough (email unknown).
      Added the low-level hook routine to the keyboard handler, and fixed a @@ -362,12 +403,18 @@ Contributors Lennart Rolland (chimeni@hotmail.com).
      Contributed the Norwegian message translation. + Lisa Parratt (lisa@thecommune.org.uk).
      + Spotted a BSDism that IRIX doesn't like@all and added IRIX detection. + Lorenzo Petrone (_lano_@libero.it).
      Contributed the gfxinfo utility and added two FAQ entries. Lucas Vignoli Reis (lucasvr@bestway.com.br).
      Added the Portuguese (Brazil) message translation and keyboard mapping. + Magnus Henoch (mange@freemail.hu).
      + Made the gfx mode selector keep the current selection as much as possible. + Maiolino Carmelo (cmaiolino@ctonline.it).
      Added the Italian keyboard mapping table. @@ -381,9 +428,10 @@ Contributors of the joystick code that didn't come from Jonathan, and to locate a stupid mistake in my VESA linear framebuffer code. - Marcel Smit.
      + Marcel Smit (marcel.athlon@hccnet.nl).
      Corrected a bug that caused errors when drawing persp. correct polys - facing the screen. + facing the screen. Made the show_video_bitmap() method of the Windows + windowed driver wait for a vsync. Marco Campinoti (marco@etruscan.li.it).
      Added 15 and 24 bit support to the native Tseng ET4000 driver (now @@ -421,9 +469,23 @@ Contributors Added the French keyboard mapping, support for the Pause/PrtScr keys, and changed the key[] table to a normal/extended bitfield. + Matt Witherspoon (spoon@vt.edu).
      + Fixed a bug in the scroll() method of the Linux SVGAlib driver. + Matthew Bowie (catcat@nmt.edu).
      Added support for 4-button joysticks. + Matthew Leverton (matthew@leverton.cc).
      + Fixed a bug with mouse mickeys in windowed mode under Windows. Fixed a + problem with al_find*() and NTFS partitions under Windows. Added missing + header files to be installed by the Windows binary distribution, made the + DOS/Windows makefiles use 'copy /B' instead of 'copy', added the detection + of left-hand mouse configuration under Windows and fixed a bug with + pack_fgets(). + + Maxime Carey (werfu@users.sourceforge.net).
      + Contributed the Canada (French) keyboard mapping file. + Michael Bevin (michael.bevin@stonebow.otago.ac.nz).
      Optimised the create_trans_table() function. @@ -452,6 +514,9 @@ Contributors Improved the accuracy of the timer routines, and added the callback parameters. + Nicholas Davies(master_goodbytes@hotmail.com).
      + Made the fix class not trigger warnings with gcc -Weffc++. + Nick Kochakian (nickk@worldnet.att.net).
      Wrote the DirectSound input driver. @@ -463,6 +528,10 @@ Contributors Olly Betts (olly@muscat.co.uk).
      Modified the djgpp makefile to support cross-compiling on a Linux machine. + Oscar Giner (O_giner@hotmail.com).
      + Added the Catalan translation, corrected the Spanish translation and fixed + a conflict between the magic main and the MFC. + Owen Embury (owen@gememail.demon.co.uk).
      Wrote part of the translucency/lighting code. @@ -532,6 +601,13 @@ Contributors Phil Frisbie, Jr. (pfrisbie@geocities.com).
      Wrote the CPU type detection code. + Philipp Thomas (pthomas@suse.de).
      + Fixed all comparisons between signed and unsigned types, thus allowing to + build with -W -Wno-unused on Unix systems, fixed the compilation on + x86-64, fixed all function prototypes, thus allowing to build with + -Wstrict-prototypes on Unix systems, and added the German translation to + the RPM spec file. + Przemek Podsiadly (ppodsiad@elka.pw.edu.pl).
      Added hicolor versions of the 3d polygon code. @@ -545,16 +621,22 @@ Contributors Added support for 6-button joysticks, and wrote the 12-bit color example program (ex12bit.c). + Richard Reeve (r.e.reeve@stir.ac.uk).
      + Fixed a silly mistake with gcc 3.0.x detection. + Robert J. Ragno (rjr@mit.edu).
      Wrote the Gravis GrIP driver, and made some improvements to the Wingman, PSX, and throttle input code. - Robert J. Ohannessian (voidstar_@excite.com).
      + Robert J. Ohannessian (voidstar@ifrance.com).
      Added MMX optimisation for the 8 and 16 bit clear() functions, and fixed bad clearing of subbitmaps. Also added SSE detection and optimized some - masked_blits with SSE instructions. Added some routines to the unified - color convertor. Revamped the retrieval mechanism of CPU capabilities. - Did plenty of other things too. + masked_blits with SSE instructions. Added some routines to the unified + color convertor and made some of them more robust. Revamped the retrieval + mechanism of CPU capabilities. Did plenty of other things too. + + Roberto Alfonso (rpgrca@labint.frba.utn.edu.ar).
      + Added an srand() call in the demo game. Robin Burrows (rburrows@bigfoot.com).
      Provided a new page flipping code for the DirectDraw subsytem, added a @@ -606,7 +688,7 @@ Contributors Added support for a second joystick. Stefan Schimanski (1Stein@gmx.de).
      - Wrote the Windows version pretty much single-handedly. + Wrote the original Windows version pretty much single-handedly. Stefan T. Boettner (virtual.man@t-online.de).
      Wrote the Linux SVGAlib driver. @@ -621,7 +703,7 @@ Contributors Stephen Kittelson (stickman2000@juno.com).
      Made bugfixes and tweaks to the keyboard system. - Sven Sandberg (svsa1977@student.uu.se).
      + Sven Sandberg (svens@it.uu.se).
      Fixed a problem with save_bitmap() rounding the image widths, optimised the create_light_table() function, optimised the fixed point trig routines, provided the Swedish message translations, improved the file @@ -642,6 +724,9 @@ Contributors Improved the cpu detection for Cyrix chips and made the file selector only list valid drive letters. + Thomas Klausner (wiz@danbala.ifoer.tuwien.ac.at).
      + Added NetBSD detection. + Thomas Wolf (two@chello.at).
      Corrected some errors in the German keyboard mapping, and added the German translation of the system messages. @@ -673,6 +758,9 @@ Contributors joystick drivers by S.Suzuki merged into my codebase. Added more aggressive Sidewinder joystick driver. + Ville Skyttä (scop@users.sourceforge.net).
      + Fixed a problem with make install libdir= and modules on Unix systems. + Vincent Penquerc'h (lyrian@kezako.net).
      Added the D_DIRTY flag and mouse button press/release events to the GUI system, optimised the 256 to truecolor blitting code to avoid repeated @@ -737,7 +825,7 @@ Thanks! John Pollard (74723.1626@compuserve.com).
      The FM instrument definitions are based on his MID-KIT library. - Kendall Bennett and all the other cool people at SciTech Software.
      + Kendall Bennett and all the other cool people@SciTech Software.
      These guys gave the world UniVBE, the VBE/AF API, and a lot of free information and example code. Plus they very kindly sent me a copy of the VBE/AF spec when I wanted one. diff --git a/examples/ex12bit.c b/examples/ex12bit.c index ae6ee24f73..73c30a6d2f 100644 --- a/examples/ex12bit.c +++ b/examples/ex12bit.c @@ -72,7 +72,7 @@ typedef struct /* these functions can be used in any 12-bit program */ int makecol12(int r, int g, int b); -void set_12bit_palette(); +void set_12bit_palette(void); BITMAP *create_bitmap_12(int w, int h); diff --git a/examples/ex3buf.c b/examples/ex3buf.c index 44a88f4f3f..6760ac5bfc 100644 --- a/examples/ex3buf.c +++ b/examples/ex3buf.c @@ -160,7 +160,7 @@ void triple_buffer(BITMAP *page1, BITMAP *page2, BITMAP *page3) -int main() +int main(void) { BITMAP *page1, *page2, *page3; int c; diff --git a/examples/excolmap.c b/examples/excolmap.c index ea097d8180..bc989e4a10 100644 --- a/examples/excolmap.c +++ b/examples/excolmap.c @@ -48,7 +48,6 @@ void callback_func(int pos) * to the function. * Since we want a greyscale effect with no matter what A (or 'x') color, we * ignore it and use y to look at the palette. - * The x=x line is there to avoid compiler warnings. * NOTE: * When you return the rgb value, you don't need to search the palette for * the nearest color, Allegro does this automatically. @@ -131,7 +130,7 @@ int main(void) create_color_table(&greyscale_table, pal, return_grey_color, callback_func); - /* build a color lookup table for greyscale effect */ + /* build a color lookup table for negative effect */ #ifdef ALLEGRO_CONSOLE_OK printf("\n\nGenerating Negative Table (3.25 lines to go)\n"); #endif @@ -149,7 +148,7 @@ int main(void) } set_palette(pal); - /* look, we have set the drawing mode to TRANS. This makes all the drawing + /* we have set the drawing mode to TRANS. This makes all the drawing * functions use the general color_map table, which is _NOT_ translucent, * since we are using a custom color_map table. */ diff --git a/examples/excustom.c b/examples/excustom.c index a363ec9cf9..813da0febc 100644 --- a/examples/excustom.c +++ b/examples/excustom.c @@ -156,7 +156,7 @@ DIALOG the_dialog[] = -int main() +int main(void) { int item; diff --git a/examples/exdbuf.c b/examples/exdbuf.c index 70ab66d985..9df32244e7 100644 --- a/examples/exdbuf.c +++ b/examples/exdbuf.c @@ -11,7 +11,7 @@ -int main() +int main(void) { BITMAP *buffer; int c; diff --git a/examples/exfixed.c b/examples/exfixed.c index c93120f080..7844505e52 100644 --- a/examples/exfixed.c +++ b/examples/exfixed.c @@ -11,7 +11,7 @@ -int main() +int main(void) { /* declare three 32 bit (16.16) fixed point variables */ fixed x, y, z; diff --git a/examples/exflip.c b/examples/exflip.c index 8f78fd7d98..788f80e5ac 100644 --- a/examples/exflip.c +++ b/examples/exflip.c @@ -10,7 +10,7 @@ -int main() +int main(void) { BITMAP *buffer; BITMAP *page1, *page2; diff --git a/examples/exhello.c b/examples/exhello.c index 3f424346a3..4dd9a96930 100644 --- a/examples/exhello.c +++ b/examples/exhello.c @@ -10,7 +10,7 @@ -int main() +int main(void) { /* you should always do this at the start of Allegro programs */ allegro_init(); diff --git a/examples/exjoy.c b/examples/exjoy.c index 4b9d5389c2..aa95a8b229 100644 --- a/examples/exjoy.c +++ b/examples/exjoy.c @@ -12,7 +12,7 @@ -int main() +int main(void) { BITMAP *bmp; /* we create a pointer to a virtual screen */ int x=160, y=100; /* these will be used to show the target sight */ diff --git a/examples/exmem.c b/examples/exmem.c index ac3f1e6493..e1f36bbf1b 100644 --- a/examples/exmem.c +++ b/examples/exmem.c @@ -11,7 +11,7 @@ -int main() +int main(void) { BITMAP *memory_bitmap; int x, y; diff --git a/examples/exmouse.c b/examples/exmouse.c index 7704f08cc4..de3d28d598 100644 --- a/examples/exmouse.c +++ b/examples/exmouse.c @@ -11,7 +11,7 @@ -int main() +int main(void) { int mickeyx = 0; int mickeyy = 0; @@ -21,7 +21,6 @@ int main() allegro_init(); install_keyboard(); - install_mouse(); install_timer(); if (set_gfx_mode(GFX_SAFE, 320, 200, 0, 0) != 0) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); @@ -32,6 +31,14 @@ int main() text_mode(makecol(255, 255, 255)); clear_to_color(screen, makecol(255, 255, 255)); + /* Detect mouse presence */ + if (install_mouse() < 0) { + textout_centre(screen, font, "No mouse detected, but you need one!", + SCREEN_W/2, SCREEN_H/2, makecol(0, 0, 0)); + readkey(); + return 0; + } + textprintf_centre(screen, font, SCREEN_W/2, 8, makecol(0, 0, 0), "Driver: %s", mouse_driver->name); diff --git a/examples/expal.c b/examples/expal.c index 2182f13099..8f1eaa5e6d 100644 --- a/examples/expal.c +++ b/examples/expal.c @@ -11,7 +11,7 @@ -int main() +int main(void) { PALETTE palette; RGB temp; diff --git a/examples/expat.c b/examples/expat.c index e46e3653a1..33b6bed281 100644 --- a/examples/expat.c +++ b/examples/expat.c @@ -33,7 +33,7 @@ void draw_pattern(BITMAP *bitmap, char *message, int color) -int main() +int main(void) { BITMAP *bitmap; diff --git a/examples/exquat.c b/examples/exquat.c index 005b22357f..366121b16a 100644 --- a/examples/exquat.c +++ b/examples/exquat.c @@ -249,7 +249,7 @@ void euler_interpolate(EULER * from, EULER * to, float t, EULER * out) -int main() +int main(void) { int index; diff --git a/examples/exrgbhsv.c b/examples/exrgbhsv.c index cee92d5f32..e32fb1abcf 100644 --- a/examples/exrgbhsv.c +++ b/examples/exrgbhsv.c @@ -131,7 +131,7 @@ DIALOG the_dlg[] = -int main() +int main(void) { allegro_init(); install_keyboard(); diff --git a/examples/exscroll.c b/examples/exscroll.c index b32daa890f..15c2d52372 100644 --- a/examples/exscroll.c +++ b/examples/exscroll.c @@ -14,7 +14,7 @@ -int main() +int main(void) { BITMAP *scroller, *status_bar; int counter = 0; diff --git a/examples/exsprite.c b/examples/exsprite.c index fbf9e1a301..710270f0bd 100644 --- a/examples/exsprite.c +++ b/examples/exsprite.c @@ -55,7 +55,7 @@ void animate(void) /* clears sprite buffer with color 0 */ clear_bitmap(sprite_buffer); - /* if SPACE key pressed set a next flag */ + /* if key pressed set a next flag */ if (keypressed()) next = TRUE; else diff --git a/examples/exstream.c b/examples/exstream.c index 5bff00519e..53813eda16 100644 --- a/examples/exstream.c +++ b/examples/exstream.c @@ -14,7 +14,7 @@ -int main() +int main(void) { AUDIOSTREAM *stream; int updates = 0; @@ -37,10 +37,17 @@ int main() /* install a digital sound driver */ if (install_sound(DIGI_AUTODETECT, MIDI_NONE, NULL) != 0) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); - allegro_message("Error initialising sound system\n%s\n", allegro_error); + allegro_message("Error initialising sound driver\n%s\n", allegro_error); return 1; } + /* we want a _real_ sound driver */ + if (digi_card == DIGI_NONE) { + set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); + allegro_message("Unable to find a sound driver\n%s\n", allegro_error); + return 1; + } + /* create an audio stream */ stream = play_audio_stream(BUFFER_SIZE, 8, FALSE, 22050, 255, 128); if (!stream) { diff --git a/examples/exswitch.c b/examples/exswitch.c index adbf9d8398..4055e755e6 100644 --- a/examples/exswitch.c +++ b/examples/exswitch.c @@ -144,7 +144,7 @@ void draw_pointless_graphics(void) clear_to_color(graphics_area, palette_color[255]); cr = ((float)x / (float)graphics_area->w - 0.75) * 2.0; - ci = ((float)y / (float)graphics_area->h - 0.5) * 2.0; + ci = ((float)y / (float)graphics_area->h - 0.5) * 1.8; zr = 0; zi = 0; @@ -155,15 +155,19 @@ void draw_pointless_graphics(void) zr = tr + cr; zi = ti + ci; + if ((zr < -10) || (zr > 10) || (zi < -10) || (zi > 10)) + break; } if ((zi != zi) || (zr != zr)) c = 0; - else - c = sqrt(zi*zi + zr*zr) * 256; - - if (c > 255) + else if ((zi <= -1) || (zi >= 1) || (zr <= -1) || (zr >= 1)) c = 255; + else { + c = sqrt(zi*zi + zr*zr) * 256; + if (c > 255) + c = 255; + } putpixel(graphics_area, x, y, makecol(c, c, c)); @@ -223,6 +227,11 @@ int main(void) text_area = create_sub_bitmap(screen, 0, 0, SCREEN_W, SCREEN_H/2); graphics_area = create_sub_bitmap(screen, 0, SCREEN_H/2, SCREEN_W/2, SCREEN_H/2); + if ((!text_area) || (!graphics_area)) { + set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); + allegro_message("Out of memory!\n"); + return 1; + } LOCK_VARIABLE(counter); LOCK_FUNCTION(increment_counter); @@ -241,11 +250,13 @@ int main(void) last_counter = counter; acquire_screen(); - textprintf_centre(screen, font, SCREEN_W*3/4, SCREEN_H*3/4, palette_color[255], "Time: %d", last_counter); + textprintf_centre(screen, font, SCREEN_W*3/4, SCREEN_H*3/4, + palette_color[255], "Time: %d", last_counter); release_screen(); acquire_bitmap(graphics_area); - draw_pointless_graphics(); + for (i=0; i<10; i++) + draw_pointless_graphics(); release_bitmap(graphics_area); } diff --git a/examples/extimer.c b/examples/extimer.c index f9ce083fe3..9eee7671f7 100644 --- a/examples/extimer.c +++ b/examples/extimer.c @@ -48,7 +48,7 @@ END_OF_FUNCTION(inc_z); -int main() +int main(void) { int c; @@ -91,7 +91,7 @@ int main() /* or in beats per second (this is 10 ticks a second) */ install_int_ex(inc_y, BPS_TO_TIMER(10)); - /* or in seconds (this is 10 ticks a second) */ + /* or in seconds (this is 10 seconds a tick) */ install_int_ex(inc_z, SECS_TO_TIMER(10)); /* the interrupts are now active... */ diff --git a/examples/extruec.c b/examples/extruec.c index 13f4b9a0d7..5295423070 100644 --- a/examples/extruec.c +++ b/examples/extruec.c @@ -60,7 +60,7 @@ void test(int colordepth) -int main() +int main(void) { allegro_init(); install_keyboard(); diff --git a/examples/exunicod.c b/examples/exunicod.c index 32750c8ad6..ae9c915161 100644 --- a/examples/exunicod.c +++ b/examples/exunicod.c @@ -7,11 +7,11 @@ #include -#include +#include "allegro.h" #define DATAFILE_NAME "unifont.dat" -#define NLANGUAGES 8 +#define NLANGUAGES 9 char message_en[] = "W\x00" "e\x00" "l\x00" "c\x00" "o\x00" "m\x00" "e\x00" " \x00" "t\x00" "o\x00" @@ -23,6 +23,9 @@ char message_fr[] = "B\x00" "i\x00" "e\x00" "n\x00" "v\x00" "e\x00" "n\x00" "u\x char message_es[] = "B\x00" "i\x00" "e\x00" "n\x00" "v\x00" "e\x00" "n\x00" "i\x00" "d\x00" "o\x00" " \x00" "a\x00" " \x00\x00\x00"; +char message_it[] = "B\x00" "e\x00" "n\x00" "v\x00" "e\x00" "n\x00" "u\x00" "t\x00" "i\x00" + " \x00" "a\x00" "d\x00" " \x00\x00\x00"; + char message_el[] = "\x9A\x03\xB1\x03\xBB\x03\xCE\x03\xC2\x03" " \x00\xAE\x03\xC1\x03\xB8\x03\xB1\x03\xC4\x03\xB5\x03" " \x00\xC3\x03\xC4\x03\xBF\x03" " \x00\x00\x00"; @@ -51,13 +54,14 @@ struct MESSAGE { struct MESSAGE message[] = { {message_en, FALSE}, {message_fr, FALSE}, {message_es, FALSE}, + {message_it, FALSE}, {message_el, FALSE}, {message_ru, FALSE}, {message_he, TRUE}, {message_ja, TRUE}, {message_zh, FALSE} }; -int speed[] = {1, 2, 4, 3, 2, 3, 2, 4}; +int speed[] = {1, 2, 4, 3, 2, 3, 2, 4, 3}; int main(int argc, char *argv[]) diff --git a/examples/exzbuf.c b/examples/exzbuf.c index a98073e6b7..dedecc2043 100644 --- a/examples/exzbuf.c +++ b/examples/exzbuf.c @@ -111,7 +111,7 @@ void draw_cube(BITMAP* buffer, V3D_f x1[], V3D_f x2[]) -int main() +int main(void) { ZBUFFER *zbuf; BITMAP *buffer; diff --git a/fix.bat b/fix.bat index 41c2435e74..9b8e842476 100644 --- a/fix.bat +++ b/fix.bat @@ -85,7 +85,7 @@ if [%1] == [bcc32] goto done if [%1] == [mingw32] goto done echo Converting Allegro files to DOS CR/LF format... -utod *.bat .../*.c *.cfg .../*.h .../*.inc .../*.rc +utod .../*.bat .../*.sh .../*.c *.cfg .../*.h .../*.inc .../*.rc utod .../*.inl .../*.s .../*.txt .../*._tx makefile.* :done diff --git a/fix.sh b/fix.sh index 6a3e0c3de9..fbcf6fbd15 100755 --- a/fix.sh +++ b/fix.sh @@ -49,6 +49,11 @@ proc_filelist() if [ "$1" != "omit_sh" ]; then AL_FILELIST="$AL_FILELIST `find . -type f -name '*.sh'`" fi + + # touch DOS batch files? + if [ "$1" != "omit_bat" ]; then + AL_FILELIST="$AL_FILELIST `find . -type f -name '*.bat'`" + fi } proc_utod() @@ -56,24 +61,31 @@ proc_utod() echo "Converting files from Unix to DOS/Win32..." proc_filelist "omit_sh" for file in $AL_FILELIST; do - echo "$file" - cp $file _tmpfile - perl -p -i -e "s/([^\r]|^)\n/\1\r\n/" _tmpfile - touch -r $file _tmpfile - mv _tmpfile $file + if [ "$ALLEGRO_USE_CYGWIN" = "1" ]; then + unix2dos $file + else + echo "$file" + perl -p -e "s/([^\r]|^)\n/\1\r\n/" $file > _tmpfile + touch -r $file _tmpfile + mv _tmpfile $file + fi done } proc_dtou() { echo "Converting files from DOS/Win32 to Unix..." - proc_filelist + proc_filelist "omit_bat" for file in $AL_FILELIST; do - echo "$file" - mv $file _tmpfile - tr -d '\015' < _tmpfile > $file - touch -r _tmpfile $file - rm _tmpfile + if [ "$ALLEGRO_USE_CYGWIN" = "1" ]; then + dos2unix $file + else + echo "$file" + mv $file _tmpfile + tr -d '\015' < _tmpfile > $file + touch -r _tmpfile $file + rm _tmpfile + fi done chmod +x *.sh misc/*.sh misc/*.pl if [ -e configure ]; then @@ -127,12 +139,12 @@ esac if [ "$AL_NOCONV" != "1" ]; then case "$2" in - "--utod" ) proc_utod;; - "--dtou" ) proc_dtou;; - "--utom" ) proc_utom;; - "--mtou" ) proc_mtou;; + "--utod" ) proc_utod "$1";; + "--dtou" ) proc_dtou "$1";; + "--utom" ) proc_utom "$1";; + "--mtou" ) proc_mtou "$1";; "--quick" ) echo "No text file conversion...";; - * ) proc_dtou;; + * ) proc_dtou "$1";; esac fi diff --git a/include/allegro.h b/include/allegro.h index d218ce4405..a7e0eca228 100644 --- a/include/allegro.h +++ b/include/allegro.h @@ -9,10 +9,12 @@ * \_/__/ * * Main header file for the entire Allegro library. - * Separate modules can be included from the allegro/ directory. + * (separate modules can be included from the allegro/ directory) * * By Shawn Hargreaves. * + * Vincent Penquerc'h split the original allegro.h into separate headers. + * * See readme.txt for copyright information. */ diff --git a/include/allegro/alcompat.h b/include/allegro/alcompat.h index 41430d7521..e2bb5b0c6c 100644 --- a/include/allegro/alcompat.h +++ b/include/allegro/alcompat.h @@ -26,7 +26,7 @@ #ifndef ALLEGRO_NO_CLEAR_BITMAP_ALIAS #if (defined ALLEGRO_GCC) - static __attribute__((unused)) inline void clear(BITMAP *bmp) + static __attribute__((unused)) __inline__ void clear(BITMAP *bmp) { clear_bitmap(bmp); } @@ -41,7 +41,7 @@ #ifndef ALLEGRO_NO_FIX_ALIASES #if (defined ALLEGRO_GCC) #define AL_ALIAS(DECL, CALL) \ - static __attribute__((unused)) inline DECL \ + static __attribute__((unused)) __inline__ DECL \ { \ return CALL; \ } @@ -52,21 +52,21 @@ return CALL; \ } #endif - AL_ALIAS(fixed fadd(fixed x, fixed y), fixadd(x, y)); - AL_ALIAS(fixed fsub(fixed x, fixed y), fixsub(x, y)); - AL_ALIAS(fixed fmul(fixed x, fixed y), fixmul(x, y)); - AL_ALIAS(fixed fdiv(fixed x, fixed y), fixdiv(x, y)); - AL_ALIAS(int fceil(fixed x), fixceil(x)); - AL_ALIAS(int ffloor(fixed x), fixfloor(x)); - AL_ALIAS(fixed fcos(fixed x), fixcos(x)); - AL_ALIAS(fixed fsin(fixed x), fixsin(x)); - AL_ALIAS(fixed ftan(fixed x), fixtan(x)); - AL_ALIAS(fixed facos(fixed x), fixacos(x)); - AL_ALIAS(fixed fasin(fixed x), fixasin(x)); - AL_ALIAS(fixed fatan(fixed x), fixatan(x)); - AL_ALIAS(fixed fatan2(fixed y, fixed x), fixatan2(y, x)); - AL_ALIAS(fixed fsqrt(fixed x), fixsqrt(x)); - AL_ALIAS(fixed fhypot(fixed x, fixed y), fixhypot(x, y)); + AL_ALIAS(fixed fadd(fixed x, fixed y), fixadd(x, y)) + AL_ALIAS(fixed fsub(fixed x, fixed y), fixsub(x, y)) + AL_ALIAS(fixed fmul(fixed x, fixed y), fixmul(x, y)) + AL_ALIAS(fixed fdiv(fixed x, fixed y), fixdiv(x, y)) + AL_ALIAS(int fceil(fixed x), fixceil(x)) + AL_ALIAS(int ffloor(fixed x), fixfloor(x)) + AL_ALIAS(fixed fcos(fixed x), fixcos(x)) + AL_ALIAS(fixed fsin(fixed x), fixsin(x)) + AL_ALIAS(fixed ftan(fixed x), fixtan(x)) + AL_ALIAS(fixed facos(fixed x), fixacos(x)) + AL_ALIAS(fixed fasin(fixed x), fixasin(x)) + AL_ALIAS(fixed fatan(fixed x), fixatan(x)) + AL_ALIAS(fixed fatan2(fixed y, fixed x), fixatan2(y, x)) + AL_ALIAS(fixed fsqrt(fixed x), fixsqrt(x)) + AL_ALIAS(fixed fhypot(fixed x, fixed y), fixhypot(x, y)) #undef AL_ALIAS #endif diff --git a/include/allegro/base.h b/include/allegro/base.h index 862b99d1a3..01dd066ee7 100644 --- a/include/allegro/base.h +++ b/include/allegro/base.h @@ -37,10 +37,10 @@ #define ALLEGRO_VERSION 4 #define ALLEGRO_SUB_VERSION 0 -#define ALLEGRO_WIP_VERSION 1 -#define ALLEGRO_VERSION_STR "4.0.1 (CVS)" -#define ALLEGRO_DATE_STR "2001" -#define ALLEGRO_DATE 20011215 /* yyyymmdd */ +#define ALLEGRO_WIP_VERSION 3 +#define ALLEGRO_VERSION_STR "4.0.3 (CVS)" +#define ALLEGRO_DATE_STR "2002" +#define ALLEGRO_DATE 20020704 /* yyyymmdd */ /*******************************************/ /************ Some global stuff ************/ @@ -65,6 +65,8 @@ #undef SGN #define SGN(x) (((x) >= 0) ? 1 : -1) +#define AL_PI 3.14159265358979323846 + #define AL_ID(a,b,c,d) (((a)<<24) | ((b)<<16) | ((c)<<8) | (d)) AL_VAR(int *, allegro_errno); diff --git a/include/allegro/datafile.h b/include/allegro/datafile.h index 92e3b0c308..cf993d6adf 100644 --- a/include/allegro/datafile.h +++ b/include/allegro/datafile.h @@ -74,7 +74,7 @@ AL_FUNC(void, unload_datafile_object, (DATAFILE *dat)); AL_FUNC(DATAFILE *, find_datafile_object, (AL_CONST DATAFILE *dat, AL_CONST char *objectname)); AL_FUNC(AL_CONST char *, get_datafile_property, (AL_CONST DATAFILE *dat, int type)); -AL_FUNC(void, register_datafile_object, (int id, AL_METHOD(void *, load, (struct PACKFILE *f, long size)), AL_METHOD(void, destroy, (void *data)))); +AL_FUNC(void, register_datafile_object, (int id_, AL_METHOD(void *, load, (struct PACKFILE *f, long size)), AL_METHOD(void, destroy, (void *data)))); AL_FUNC(void, fixup_datafile, (DATAFILE *data)); diff --git a/include/allegro/fix.h b/include/allegro/fix.h index af904109ef..e6430567be 100644 --- a/include/allegro/fix.h +++ b/include/allegro/fix.h @@ -29,14 +29,14 @@ class fix /* C++ wrapper for the fixed point routines */ public: fixed v; - fix() { } - fix(const fix &x) { v = x.v; } - fix(const int x) { v = itofix(x); } - fix(const long x) { v = itofix(x); } - fix(const unsigned int x) { v = itofix(x); } - fix(const unsigned long x) { v = itofix(x); } - fix(const float x) { v = ftofix(x); } - fix(const double x) { v = ftofix(x); } + fix() : v(0) { } + fix(const fix &x) : v(x.v) { } + fix(const int x) : v(itofix(x)) { } + fix(const long x) : v(itofix(x)) { } + fix(const unsigned int x) : v(itofix(x)) { } + fix(const unsigned long x) : v(itofix(x)) { } + fix(const float x) : v(ftofix(x)) { } + fix(const double x) : v(ftofix(x)) { } operator int() const { return fixtoi(v); } operator long() const { return fixtoi(v); } diff --git a/include/allegro/gfx.h b/include/allegro/gfx.h index 8f18b350d2..396da24db3 100644 --- a/include/allegro/gfx.h +++ b/include/allegro/gfx.h @@ -230,7 +230,7 @@ typedef struct BITMAP /* a bitmap structure */ int x_ofs; /* horizontal offset (for sub-bitmaps) */ int y_ofs; /* vertical offset (for sub-bitmaps) */ int seg; /* bitmap segment */ - unsigned char *line[ZERO_SIZE]; + ZERO_SIZE_ARRAY(unsigned char *, line); } BITMAP; diff --git a/include/allegro/inline/system.inl b/include/allegro/inline/system.inl index 96f97733ff..0d8536f7f6 100644 --- a/include/allegro/inline/system.inl +++ b/include/allegro/inline/system.inl @@ -26,7 +26,7 @@ #include "allegro/debug.h" -AL_INLINE(void, set_window_title, (char *name), +AL_INLINE(void, set_window_title, (AL_CONST char *name), { ASSERT(system_driver); diff --git a/include/allegro/internal/aintern.h b/include/allegro/internal/aintern.h index dd3bad75d0..56dd9aa202 100644 --- a/include/allegro/internal/aintern.h +++ b/include/allegro/internal/aintern.h @@ -310,11 +310,27 @@ AL_VAR(int, _color_conv); AL_FUNC(BITMAP *, _fixup_loaded_bitmap, (BITMAP *bmp, PALETTE pal, int bpp)); +/* default truecolor pixel format */ +#define DEFAULT_RGB_R_SHIFT_15 0 +#define DEFAULT_RGB_G_SHIFT_15 5 +#define DEFAULT_RGB_B_SHIFT_15 10 +#define DEFAULT_RGB_R_SHIFT_16 0 +#define DEFAULT_RGB_G_SHIFT_16 5 +#define DEFAULT_RGB_B_SHIFT_16 11 +#define DEFAULT_RGB_R_SHIFT_24 0 +#define DEFAULT_RGB_G_SHIFT_24 8 +#define DEFAULT_RGB_B_SHIFT_24 16 +#define DEFAULT_RGB_R_SHIFT_32 0 +#define DEFAULT_RGB_G_SHIFT_32 8 +#define DEFAULT_RGB_B_SHIFT_32 16 +#define DEFAULT_RGB_A_SHIFT_32 24 + + /* console switching support */ AL_FUNC(void, _register_switch_bitmap, (BITMAP *bmp, BITMAP *parent)); AL_FUNC(void, _unregister_switch_bitmap, (BITMAP *bmp)); AL_FUNC(void, _save_switch_state, (int switch_mode)); -AL_FUNC(void, _restore_switch_state, ()); +AL_FUNC(void, _restore_switch_state, (void)); AL_VAR(int, _dispsw_status); @@ -1087,7 +1103,7 @@ typedef struct DATAFILE_TYPE { int type; AL_METHOD(void *, load, (PACKFILE *f, long size)); - AL_METHOD(void, destroy, ()); + AL_METHOD(void, destroy, (void *)); } DATAFILE_TYPE; @@ -1124,7 +1140,7 @@ AL_VAR(struct _AL_LINKER_MOUSE *, _al_linker_mouse); /* dynamic driver lists */ -AL_FUNC(_DRIVER_INFO *, _create_driver_list, ()); +AL_FUNC(_DRIVER_INFO *, _create_driver_list, (void)); AL_FUNC(void, _destroy_driver_list, (_DRIVER_INFO *drvlist)); AL_FUNC(void, _driver_list_append_driver, (_DRIVER_INFO **drvlist, int id, void *driver, int autodetect)); AL_FUNC(void, _driver_list_prepend_driver, (_DRIVER_INFO **drvlist, int id, void *driver, int autodetect)); diff --git a/include/allegro/internal/alconfig.h b/include/allegro/internal/alconfig.h index ae5e4b52f1..4c2695b0eb 100644 --- a/include/allegro/internal/alconfig.h +++ b/include/allegro/internal/alconfig.h @@ -58,13 +58,17 @@ #define ALLEGRO_GCC #ifndef AL_INLINE - #define AL_INLINE(type, name, args, code) extern inline type name args code + #ifdef __cplusplus + #define AL_INLINE(type, name, args, code) static inline type name args code + #else + #define AL_INLINE(type, name, args, code) extern __inline__ type name args code + #endif #endif #define AL_PRINTFUNC(type, name, args, a, b) AL_FUNC(type, name, args) __attribute__ ((format (printf, a, b))) #ifndef INLINE - #define INLINE inline + #define INLINE __inline__ #endif #if __GNUC__ >= 3 @@ -78,11 +82,11 @@ #define RET_VOLATILE volatile #endif - #ifndef ZERO_SIZE + #ifndef ZERO_SIZE_ARRAY #if __GNUC__ < 3 - #define ZERO_SIZE 0 + #define ZERO_SIZE_ARRAY(type, name) __extension__ type name[0] #else - #define ZERO_SIZE + #define ZERO_SIZE_ARRAY(type, name) type name[] /* ISO C99 flexible array members */ #endif #endif @@ -108,15 +112,6 @@ #endif - -/* if we are using gcc, then constructors are supported */ -#ifdef __GNUC__ - #undef CONSTRUCTOR_FUNCTION - #undef DESTRUCTOR_FUNCTION - #define CONSTRUCTOR_FUNCTION(func) func __attribute__ ((constructor)) - #define DESTRUCTOR_FUNCTION(func) func __attribute__ ((destructor)) -#endif - /* the rest of this file fills in some default definitions of language * features and helper functions, which are conditionalised so they will * only be included if none of the above headers defined custom versions. @@ -130,8 +125,8 @@ #define RET_VOLATILE volatile #endif -#ifndef ZERO_SIZE - #define ZERO_SIZE +#ifndef ZERO_SIZE_ARRAY + #define ZERO_SIZE_ARRAY(type, name) type name[] #endif #ifndef AL_CONST @@ -248,6 +243,32 @@ #endif +/* endian-independent 3-byte accessor macros */ +#ifdef ALLEGRO_LITTLE_ENDIAN + + #define READ3BYTES(p) (((int) *(p)) \ + | ((int) *((p) + 1) << 8) \ + | ((int) *((p) + 2) << 16)) + + #define WRITE3BYTES(p,c) ((*(p) = (c)), \ + (*((p) + 1) = (c) >> 8), \ + (*((p) + 2) = (c) >> 16)) + +#elif defined ALLEGRO_BIG_ENDIAN + + #define READ3BYTES(p) (((int) *(p) << 16) \ + | ((int) *((p) + 1) << 8) \ + | ((int) *((p) + 2))) + + #define WRITE3BYTES(p,c) ((*(p) = (c) >> 16), \ + (*((p) + 1) = (c) >> 8), \ + (*((p) + 2) = (c))) + +#else + #error endianess not defined +#endif + + /* generic versions of the video memory access helpers */ #ifndef bmp_select #define bmp_select(bmp) @@ -264,55 +285,22 @@ #define bmp_read16(addr) (*((unsigned short *)(addr))) #define bmp_read32(addr) (*((unsigned long *)(addr))) - #ifdef ALLEGRO_LITTLE_ENDIAN - - AL_INLINE(void, bmp_write24, (unsigned long addr, int c), - { - unsigned char *p = (unsigned char *)addr; - - p[0] = c & 0xFF; - p[1] = (c>>8) & 0xFF; - p[2] = (c>>16) & 0xFF; - }) - - AL_INLINE(int, bmp_read24, (unsigned long addr), - { - unsigned char *p = (unsigned char *)addr; - int c; + AL_INLINE(int, bmp_read24, (unsigned long addr), + { + unsigned char *p = (unsigned char *)addr; + int c; - c = p[0]; - c |= (int)p[1] << 8; - c |= (int)p[2] << 16; + c = READ3BYTES(p); - return c; - }) + return c; + }) - #elif defined ALLEGRO_BIG_ENDIAN + AL_INLINE(void, bmp_write24, (unsigned long addr, int c), + { + unsigned char *p = (unsigned char *)addr; - AL_INLINE(void, bmp_write24, (unsigned long addr, int c), - { - unsigned char *p = (unsigned char *)addr; - - p[0] = (c>>16) & 0xFF; - p[1] = (c>>8) & 0xFF; - p[2] = c & 0xFF; - }) - - AL_INLINE(int, bmp_read24, (unsigned long addr), - { - unsigned char *p = (unsigned char *)addr; - int c; - - c = (int)p[0] << 16; - c |= (int)p[1] << 8; - c |= p[2]; - - return c; - }) - - #else - #error endianess not defined - #endif + WRITE3BYTES(p, c); + }) #endif diff --git a/include/allegro/platform/aintbeos.h b/include/allegro/platform/aintbeos.h index 7b62936b41..6098b8986e 100644 --- a/include/allegro/platform/aintbeos.h +++ b/include/allegro/platform/aintbeos.h @@ -116,7 +116,7 @@ int be_sound_init(int input, int voices); void be_sound_exit(int input); void *be_sound_lock_voice(int voice, int start, int end); void be_sound_unlock_voice(int voice); -int be_sound_buffer_size(); +int be_sound_buffer_size(void); int be_sound_mixer_volume(int volume); void be_sound_suspend(void); void be_sound_resume(void); diff --git a/include/allegro/platform/aintunix.h b/include/allegro/platform/aintunix.h index 84a933bf88..4f16265f7e 100644 --- a/include/allegro/platform/aintunix.h +++ b/include/allegro/platform/aintunix.h @@ -58,8 +58,8 @@ extern "C" { AL_VAR(_DRIVER_INFO *, _unix_gfx_driver_list); AL_VAR(_DRIVER_INFO *, _unix_digi_driver_list); AL_VAR(_DRIVER_INFO *, _unix_midi_driver_list); - AL_FUNC(void, _unix_driver_lists_init, ()); - AL_FUNC(void, _unix_driver_lists_shutdown, ()); + AL_FUNC(void, _unix_driver_lists_init, (void)); + AL_FUNC(void, _unix_driver_lists_shutdown, (void)); AL_FUNC(void, _unix_register_gfx_driver, (int id, GFX_DRIVER *driver, int autodetect, int priority)); AL_FUNC(void, _unix_register_digi_driver, (int id, DIGI_DRIVER *driver, int autodetect, int priority)); AL_FUNC(void, _unix_register_midi_driver, (int id, MIDI_DRIVER *driver, int autodetect, int priority)); diff --git a/include/allegro/platform/aintwin.h b/include/allegro/platform/aintwin.h index 5c18bca47e..b7cbf35166 100644 --- a/include/allegro/platform/aintwin.h +++ b/include/allegro/platform/aintwin.h @@ -66,7 +66,9 @@ AL_FUNC(void, exit_directx_window, (void)); AL_FUNC(int, wnd_call_proc, (AL_METHOD(int, proc, (void)))); AL_FUNC(int, get_dx_ver, (void)); AL_FUNC(void, set_sync_timer_freq, (int freq)); +AL_FUNC(int, adjust_window, (int w, int h)); AL_FUNC(void, restore_window_style, (void)); +AL_FUNC(void, save_window_pos, (void)); /* main window */ @@ -109,7 +111,7 @@ AL_FUNC(void, sys_directx_remove_display_switch_callback, (AL_METHOD(void, cb, ( AL_FUNC(void, sys_switch_in, (void)); AL_FUNC(void, sys_switch_out, (void)); -AL_FUNC(void, thread_switch_out, (void)); +AL_FUNC(int, thread_switch_out, (void)); AL_FUNC(void, midi_switch_out, (void)); AL_FUNC(void, sys_directx_switch_out_callback, (void)); @@ -120,6 +122,7 @@ AL_FUNC(void, sys_directx_switch_in_callback, (void)); /*******************************************/ /************** keyboard routines **********/ /*******************************************/ +AL_VAR(HANDLE, key_thread); AL_FUNC(int, key_dinput_acquire, (void)); AL_FUNC(int, key_dinput_unacquire, (void)); AL_FUNC(void, wnd_acquire_keyboard, (void)); @@ -130,12 +133,14 @@ AL_FUNC(void, wnd_unacquire_keyboard, (void)); /*******************************************/ /************** mouse routines *************/ /*******************************************/ +AL_VAR(HANDLE, mouse_thread); AL_FUNC(int, mouse_dinput_acquire, (void)); AL_FUNC(int, mouse_dinput_unacquire, (void)); -AL_FUNC(int, mouse_set_syscursor, (void)); -AL_FUNC(int, mouse_set_sysmenu, (void)); +AL_FUNC(int, mouse_set_syscursor, (int state)); +AL_FUNC(int, mouse_set_sysmenu, (int state)); AL_FUNC(void, wnd_acquire_mouse, (void)); AL_FUNC(void, wnd_unacquire_mouse, (void)); +AL_FUNC(void, wnd_set_syscursor, (int state)); @@ -177,7 +182,7 @@ AL_FUNC(int, digi_directsound_rec_read, (void *buf)); AL_FUNC(char* , win_err_str, (long err)); AL_FUNC(void, thread_safe_trace, (char *msg, ...)); -#ifdef DEBUGMODE +#if DEBUGMODE >= 2 #define _TRACE thread_safe_trace #else #define _TRACE 1 ? (void) 0 : thread_safe_trace diff --git a/include/allegro/platform/al386gcc.h b/include/allegro/platform/al386gcc.h index 8928e3ebbf..2808eea50d 100644 --- a/include/allegro/platform/al386gcc.h +++ b/include/allegro/platform/al386gcc.h @@ -29,7 +29,7 @@ AL_INLINE(int, _default_ds, (void), { short result; - asm ( + __asm__ ( " movw %%ds, %0 " : "=r" (result) @@ -47,7 +47,7 @@ AL_INLINE(unsigned long, bmp_write_line, (BITMAP *bmp, int line), { unsigned long result; - asm volatile ( + __asm__ volatile ( " call *%3 " : "=a" (result) /* result in eax */ @@ -69,7 +69,7 @@ AL_INLINE(unsigned long, bmp_read_line, (BITMAP *bmp, int line), { unsigned long result; - asm volatile ( + __asm__ volatile ( " call *%3 " : "=a" (result) /* result in eax */ @@ -89,7 +89,7 @@ AL_INLINE(unsigned long, bmp_read_line, (BITMAP *bmp, int line), */ AL_INLINE(void, bmp_unwrite_line, (BITMAP *bmp), { - asm volatile ( + __asm__ volatile ( " call *%1 " : : "d" (bmp), /* bitmap in edx */ @@ -136,7 +136,7 @@ AL_INLINE(fixed, fixadd, (fixed x, fixed y), __PRECALCULATE_CONSTANTS(x + (double)y) { - asm ( + __asm__ ( " addl %2, %0 ; " /* do the addition */ " jno 0f ; " /* check for overflow */ @@ -174,7 +174,7 @@ AL_INLINE(fixed, fixsub, (fixed x, fixed y), __PRECALCULATE_CONSTANTS(x - (double)y) { - asm ( + __asm__ ( " subl %2, %0 ; " /* do the subtraction */ " jno 0f ; " /* check for overflow */ @@ -213,7 +213,7 @@ AL_INLINE(fixed, fixmul, (fixed x, fixed y), __PRECALCULATE_CONSTANTS(x / 65536.0 * y) { - asm ( + __asm__ ( " movl %2, %%eax ; " " imull %3 ; " /* do the multiply */ " shrdl $16, %%edx, %%eax ; " @@ -266,7 +266,7 @@ AL_INLINE(fixed, fixdiv, (fixed x, fixed y), __PRECALCULATE_CONSTANTS(x * 65536.0 / y) { - asm ( + __asm__ ( " testl %%eax, %%eax ; " /* test sign of x */ " js 3f ; " @@ -346,7 +346,7 @@ AL_INLINE(int, fixfloor, (fixed x), { int result; - asm ( + __asm__ ( " sarl $16, %0 " /* convert to int */ : "=r" (result) /* result in a register */ @@ -367,7 +367,7 @@ AL_INLINE(int, fixceil, (fixed x), { int result; - asm ( + __asm__ ( " addl $0xFFFF, %0 ;" /* ceil () */ " jns 0f ;" " jo 1f ;" diff --git a/include/allegro/platform/albecfg.h b/include/allegro/platform/albecfg.h index b6523eb0e4..931d9742ba 100644 --- a/include/allegro/platform/albecfg.h +++ b/include/allegro/platform/albecfg.h @@ -34,6 +34,7 @@ #define ALLEGRO_PLATFORM_STR "BeOS" #define ALLEGRO_LITTLE_ENDIAN #define ALLEGRO_CONSOLE_OK +#define ALLEGRO_USE_CONSTRUCTOR /* arrange for other headers to be included later on */ #define ALLEGRO_EXTRA_HEADER "allegro/platform/albeos.h" diff --git a/include/allegro/platform/aldjgpp.h b/include/allegro/platform/aldjgpp.h index c99bf41767..1e77cbf43d 100644 --- a/include/allegro/platform/aldjgpp.h +++ b/include/allegro/platform/aldjgpp.h @@ -30,9 +30,11 @@ /* describe this platform */ #define ALLEGRO_PLATFORM_STR "djgpp" #define ALLEGRO_DOS +#define ALLEGRO_I386 #define ALLEGRO_LITTLE_ENDIAN #define ALLEGRO_CONSOLE_OK #define ALLEGRO_VRAM_SINGLE_SURFACE +#define ALLEGRO_USE_CONSTRUCTOR /* memory locking macros */ @@ -40,11 +42,11 @@ void _unlock_dpmi_data(void *addr, int size); #define END_OF_FUNCTION(x) void x##_end(void) { } #define END_OF_STATIC_FUNCTION(x) static void x##_end(void) { } -#define LOCK_DATA(d, s) _go32_dpmi_lock_data(d, s) -#define LOCK_CODE(c, s) _go32_dpmi_lock_code(c, s) -#define UNLOCK_DATA(d,s) _unlock_dpmi_data(d, s) +#define LOCK_DATA(d, s) _go32_dpmi_lock_data((void *)d, s) +#define LOCK_CODE(c, s) _go32_dpmi_lock_code((void *)c, s) +#define UNLOCK_DATA(d,s) _unlock_dpmi_data((void *)d, s) #define LOCK_VARIABLE(x) LOCK_DATA((void *)&x, sizeof(x)) -#define LOCK_FUNCTION(x) LOCK_CODE(x, (long)x##_end - (long)x) +#define LOCK_FUNCTION(x) LOCK_CODE((void *)x, (long)x##_end - (long)x) /* long filename status */ @@ -74,7 +76,7 @@ void _unlock_dpmi_data(void *addr, int size); #define bmp_read24(addr) (_farnspeekl(addr) & 0xFFFFFF) #ifndef AL_INLINE -extern inline /* special bodge because AL_INLINE isn't defined yet */ +extern __inline__ /* special bodge because AL_INLINE isn't defined yet */ #endif void bmp_write24(unsigned long addr, int c) { diff --git a/include/allegro/platform/almaccfg.h b/include/allegro/platform/almaccfg.h index 937e23ec73..2036a81021 100644 --- a/include/allegro/platform/almaccfg.h +++ b/include/allegro/platform/almaccfg.h @@ -33,7 +33,7 @@ #undef ALLEGRO_CONSOLE_OK #define INLINE -#define ZERO_SIZE 64 +#define ZERO_SIZE_ARRAY(type, name) type name[64] #define AL_CONST const #define AL_VAR(type, name) extern type name #define AL_ARRAY(type, name) extern type name[] @@ -46,11 +46,11 @@ #define END_OF_FUNCTION(x) void x##_end(void) { } #define END_OF_STATIC_FUNCTION(x) static void x##_end(void) { } -#define LOCK_DATA(d, s) _mac_lock(d, s) -#define LOCK_CODE(c, s) _mac_lock(c, s) -#define UNLOCK_DATA(d,s) _mac_unlock(d, s) +#define LOCK_DATA(d, s) _mac_lock((void *)d, s) +#define LOCK_CODE(c, s) _mac_lock((void *)c, s) +#define UNLOCK_DATA(d,s) _mac_unlock((void *)d, s) #define LOCK_VARIABLE(x) LOCK_DATA((void *)&x, sizeof(x)) -#define LOCK_FUNCTION(x) LOCK_CODE(x, (long)x##_end - (long)x) +#define LOCK_FUNCTION(x) LOCK_CODE((void *)x, (long)x##_end - (long)x) /* long filename status */ #define ALLEGRO_LFN 0 diff --git a/include/allegro/platform/almngw32.h b/include/allegro/platform/almngw32.h index 3fb628cacb..42a56b3cc8 100644 --- a/include/allegro/platform/almngw32.h +++ b/include/allegro/platform/almngw32.h @@ -36,6 +36,7 @@ #define ALLEGRO_WINDOWS #define ALLEGRO_I386 #define ALLEGRO_LITTLE_ENDIAN +#define ALLEGRO_USE_CONSTRUCTOR #ifdef USE_CONSOLE #define ALLEGRO_CONSOLE_OK diff --git a/include/allegro/platform/almsvc.h b/include/allegro/platform/almsvc.h index be18cf1dc6..91c2589252 100644 --- a/include/allegro/platform/almsvc.h +++ b/include/allegro/platform/almsvc.h @@ -43,6 +43,10 @@ #define ALLEGRO_NO_MAGIC_MAIN #endif +#ifdef ALLEGRO_AND_MFC + #define ALLEGRO_NO_MAGIC_MAIN +#endif + /* describe how function prototypes look to MSVC */ #if (defined ALLEGRO_STATICLINK) || (defined ALLEGRO_SRC) diff --git a/include/allegro/platform/alqnx.h b/include/allegro/platform/alqnx.h index 3e75447c11..caad575378 100644 --- a/include/allegro/platform/alqnx.h +++ b/include/allegro/platform/alqnx.h @@ -21,6 +21,7 @@ extern int __crt0_argc; extern char **__crt0_argv; #ifndef USE_CONSOLE + #define ALLEGRO_MAGIC_MAIN #define main _mangled_main #undef END_OF_MAIN #define END_OF_MAIN() void *_mangled_main_address = (void*) _mangled_main; diff --git a/include/allegro/platform/alqnxcfg.h b/include/allegro/platform/alqnxcfg.h index 02af4d3baf..f65e7c9556 100644 --- a/include/allegro/platform/alqnxcfg.h +++ b/include/allegro/platform/alqnxcfg.h @@ -45,6 +45,7 @@ #define ALLEGRO_LITTLE_ENDIAN #define ALLEGRO_CONSOLE_OK #define ALLEGRO_USE_SCHED_YIELD +#define ALLEGRO_USE_CONSTRUCTOR /* arrange for other headers to be included later on */ #define ALLEGRO_EXTRA_HEADER "allegro/platform/alqnx.h" diff --git a/include/allegro/platform/alunix.h b/include/allegro/platform/alunix.h index fbcb11a7df..135847dd30 100644 --- a/include/allegro/platform/alunix.h +++ b/include/allegro/platform/alunix.h @@ -36,12 +36,13 @@ extern int __crt0_argc; extern char **__crt0_argv; #ifndef USE_CONSOLE -# define main _mangled_main -# undef END_OF_MAIN -# define END_OF_MAIN() void *_mangled_main_address = (void*) _mangled_main; + #define ALLEGRO_MAGIC_MAIN + #define main _mangled_main + #undef END_OF_MAIN + #define END_OF_MAIN() void *_mangled_main_address = (void*) _mangled_main; #else -# undef END_OF_MAIN -# define END_OF_MAIN() void *_mangled_main_address; + #undef END_OF_MAIN + #define END_OF_MAIN() void *_mangled_main_address; #endif @@ -100,6 +101,21 @@ AL_VAR(DIGI_DRIVER, digi_esd); #endif /* ALLEGRO_WITH_ESDDIGI */ +#ifdef ALLEGRO_WITH_ARTSDIGI + +#define DIGI_ARTS AL_ID('A','R','T','S') + +#ifndef ALLEGRO_WITH_MODULES + +AL_VAR(DIGI_DRIVER, digi_arts); + +#define DIGI_DRIVER_ARTS \ + { DIGI_ARTS, &digi_arts, TRUE }, + +#endif + +#endif /* ALLEGRO_WITH_ARTSDIGI */ + #ifdef ALLEGRO_WITH_ALSADIGI #define DIGI_ALSA AL_ID('A','L','S','A') @@ -235,36 +251,36 @@ AL_FUNC(void, split_modex_screen, (int line)); /* Port I/O functions -- maybe these should be internal */ -static inline void outportb(unsigned short port, unsigned char value) +static INLINE void outportb(unsigned short port, unsigned char value) { __asm__ volatile ("outb %0, %1" : : "a" (value), "d" (port)); } -static inline void outportw(unsigned short port, unsigned short value) +static INLINE void outportw(unsigned short port, unsigned short value) { __asm__ volatile ("outw %0, %1" : : "a" (value), "d" (port)); } -static inline void outportl(unsigned short port, unsigned long value) +static INLINE void outportl(unsigned short port, unsigned long value) { __asm__ volatile ("outl %0, %1" : : "a" (value), "d" (port)); } -static inline unsigned char inportb(unsigned short port) +static INLINE unsigned char inportb(unsigned short port) { unsigned char value; __asm__ volatile ("inb %1, %0" : "=a" (value) : "d" (port)); return value; } -static inline unsigned short inportw(unsigned short port) +static INLINE unsigned short inportw(unsigned short port) { unsigned short value; __asm__ volatile ("inw %1, %0" : "=a" (value) : "d" (port)); return value; } -static inline unsigned long inportl(unsigned short port) +static INLINE unsigned long inportl(unsigned short port) { unsigned long value; __asm__ volatile ("inl %1, %0" : "=a" (value) : "d" (port)); diff --git a/include/allegro/platform/alunixac.hin b/include/allegro/platform/alunixac.hin index aac1de1b4d..1e97a1e028 100644 --- a/include/allegro/platform/alunixac.hin +++ b/include/allegro/platform/alunixac.hin @@ -80,6 +80,9 @@ /* Define if ESD DIGI driver is supported. */ #undef ALLEGRO_WITH_ESDDIGI +/* Define if aRts DIGI driver is supported. */ +#undef ALLEGRO_WITH_ARTSDIGI + /* Define to (void *)-1, if MAP_FAILED is not defined. */ #undef MAP_FAILED diff --git a/include/allegro/platform/alwatcom.h b/include/allegro/platform/alwatcom.h index 6fafa26429..9dfde71a72 100644 --- a/include/allegro/platform/alwatcom.h +++ b/include/allegro/platform/alwatcom.h @@ -33,7 +33,7 @@ #endif -#pragma disable_message (120 201) +#pragma disable_message (120 201 202) /* describe this platform */ @@ -50,6 +50,10 @@ #define ALLEGRO_MMX #endif +#if __WATCOMC__ >= 1200 /* Open Watcom 1.0 */ + #define AL_CONST const +#endif + /* emulate some important djgpp routines */ #define inportb(port) inp(port) diff --git a/include/allegro/platform/alwin.h b/include/allegro/platform/alwin.h index 26644496ae..0ddcdf749b 100644 --- a/include/allegro/platform/alwin.h +++ b/include/allegro/platform/alwin.h @@ -30,51 +30,24 @@ AL_FUNC(int, _WinMain, (void *_main, void *hInst, void *hPrev, char *Cmd, int nS #if (!defined ALLEGRO_NO_MAGIC_MAIN) && (!defined ALLEGRO_SRC) + #define ALLEGRO_MAGIC_MAIN #define main _mangled_main - #undef END_OF_MAIN - #ifdef ALLEGRO_GCC - #ifdef __cplusplus - - /* GCC version for C++ programs, using __attribute__ ((stdcall)) */ - #define END_OF_MAIN() \ - \ - extern "C" { \ - int __attribute__ ((stdcall)) WinMain(void *hI, void *hP, char *Cmd, int nShow); \ - \ - } \ - \ - int __attribute__ ((stdcall)) WinMain(void *hI, void *hP, char *Cmd, int nShow) \ - { \ - return _WinMain((void *)_mangled_main, hI, hP, Cmd, nShow); \ - } - - #else /* not C++ */ - - /* GCC version for C programs, using __attribute__ ((stdcall)) */ - #define END_OF_MAIN() \ - \ - int __attribute__ ((stdcall)) WinMain(void *hI, void *hP, char *Cmd, int nShow); \ - \ - int __attribute__ ((stdcall)) WinMain(void *hI, void *hP, char *Cmd, int nShow) \ - { \ - return _WinMain((void *)_mangled_main, hI, hP, Cmd, nShow); \ - } - - #endif /* end of not C++ */ - #else /* end of GCC */ - - /* MSVC version, using __stdcall */ - #define END_OF_MAIN() \ - \ - int __stdcall WinMain(void *hI, void *hP, char *Cmd, int nShow) \ - { \ - return _WinMain((void *)_mangled_main, hI, hP, Cmd, nShow); \ - } + /* disable strict pointer typing because of the vague prototype below */ + #define NO_STRICT + #ifdef __cplusplus + extern "C" int __stdcall WinMain(void *hInst, void *hPrev, char *Cmd, int nShow); #endif + #define END_OF_MAIN() \ + \ + int __stdcall WinMain(void *hInst, void *hPrev, char *Cmd, int nShow) \ + { \ + return _WinMain((void *)_mangled_main, hInst, hPrev, Cmd, nShow); \ + } + #endif diff --git a/include/allegro/rle.h b/include/allegro/rle.h index 6f3936a341..0fda20f5d5 100644 --- a/include/allegro/rle.h +++ b/include/allegro/rle.h @@ -31,7 +31,7 @@ typedef struct RLE_SPRITE /* a RLE compressed sprite */ int w, h; /* width and height in pixels */ int color_depth; /* color depth of the image */ int size; /* size of sprite data in bytes */ - signed char dat[ZERO_SIZE]; + ZERO_SIZE_ARRAY(signed char, dat); } RLE_SPRITE; diff --git a/include/allegro/system.h b/include/allegro/system.h index d3216978c3..ffc77a4567 100644 --- a/include/allegro/system.h +++ b/include/allegro/system.h @@ -47,10 +47,13 @@ AL_ARRAY(char, allegro_error); #define OSTYPE_DOSEMU AL_ID('D','E','M','U') #define OSTYPE_OPENDOS AL_ID('O','D','O','S') #define OSTYPE_LINUX AL_ID('T','U','X',' ') +#define OSTYPE_SUNOS AL_ID('S','U','N',' ') #define OSTYPE_FREEBSD AL_ID('F','B','S','D') +#define OSTYPE_NETBSD AL_ID('N','B','S','D') +#define OSTYPE_IRIX AL_ID('I','R','I','X') +#define OSTYPE_QNX AL_ID('Q','N','X',' ') #define OSTYPE_UNIX AL_ID('U','N','I','X') #define OSTYPE_BEOS AL_ID('B','E','O','S') -#define OSTYPE_QNX AL_ID('Q','N','X',' ') #define OSTYPE_MACOS AL_ID('M','A','C',' ') AL_VAR(int, os_type); diff --git a/include/allegro/text.h b/include/allegro/text.h index 27cf193369..7f81e3af94 100644 --- a/include/allegro/text.h +++ b/include/allegro/text.h @@ -30,7 +30,7 @@ struct BITMAP; typedef struct FONT_GLYPH /* a single monochrome font character */ { short w, h; - unsigned char dat[ZERO_SIZE]; + ZERO_SIZE_ARRAY(unsigned char, dat); } FONT_GLYPH; diff --git a/include/winalleg.h b/include/winalleg.h index 0194ba7214..91c4df2562 100644 --- a/include/winalleg.h +++ b/include/winalleg.h @@ -31,10 +31,6 @@ #define WIN32_LEAN_AND_MEAN /* to save compilation time */ #endif -#ifndef ALLEGRO_NO_MAGIC_MAIN - #define NO_STRICT /* needed by the magic main emulation */ -#endif - /* bodges to avoid conflicts between Allegro and Windows */ diff --git a/makefile.all b/makefile.all index d7a37dca9a..bcd25b9ea8 100644 --- a/makefile.all +++ b/makefile.all @@ -5,6 +5,7 @@ # # Environment variables: # DEBUGMODE=1 selects a debug build. +# DEBUGMODE=2 selects a build intended to debug Allegro itself. # PROFILEMODE=1 selects a profiling build. # WARNMODE=1 selects strict compiler warnings. # STATICLINK=1 use static linking (MSVC, Mingw32). @@ -28,11 +29,7 @@ # distclean: remove objects and executables. # veryclean: remove all generated files. # depend: regenerate the dependency files. -# compress: compress the executable files (djgpp only). -# -# The "clean", "distclean", "veryclean", and "uninstall" targets require -# a Unix-style rm command to be installed, eg. from the djgpp fileutils -# package. +# compress: compress the executable files (djgpp, Mingw32, MSVC). @@ -131,7 +128,13 @@ endif default: msg lib $(PROGRAMS) docs @echo The $(DESCRIPTION) $(PLATFORM) library has been compiled. - @echo Run make install to complete the installation. +ifdef UNIX_TOOLS + @echo Run \"make install\" with the options you passed to \"make\" + @echo in order to complete the installation. +else + @echo Run "make install" with the options you passed to "make" + @echo in order to complete the installation. +endif all: $(MAKE) msg lib @@ -140,7 +143,13 @@ all: @echo Compiling utilities, examples and test programs. Please wait... $(MAKE) $(PROGRAMS) docs @echo All $(PLATFORM) library versions have been compiled. - @echo Run make installall to complete the installation. +ifdef UNIX_TOOLS + @echo Run \"make installall\" with the options you passed to \"make all\" + @echo in order to complete the installation. +else + @echo Run "make installall" with the options you passed to "make all" + @echo in order to complete the installation. +endif installall: $(MAKE) msg lib install @@ -163,14 +172,40 @@ $(LIB_NAME): $(OBJECTS) $(RUNNER) # -------- rules for deleting the generated files -------- clean: +ifdef UNIX_TOOLS -rm -fv $(OBJ_CLEAN_FILES) -rm -fv $(OTHER_CLEAN_FILES) +else + define RM_CLEAN + $(foreach file, $(wildcard $(OBJ_CLEAN_FILES)), -del $(subst /,\,$(file)) + ) + $(foreach file, $(wildcard $(OTHER_CLEAN_FILES)), -del $(subst /,\,$(file)) + ) + endef + -$(RM_CLEAN) +endif distclean: clean +ifdef UNIX_TOOLS -rm -fv $(DISTCLEAN_FILES) +else + define RM_DISTCLEAN + $(foreach file, $(wildcard $(DISTCLEAN_FILES)), -del $(subst /,\,$(file)) + ) + endef + -$(RM_DISTCLEAN) +endif veryclean: distclean +ifdef UNIX_TOOLS -rm -fv $(VERYCLEAN_FILES) +else + define RM_VERYCLEAN + $(foreach file, $(wildcard $(VERYCLEAN_FILES)), -del $(subst /,\,$(file)) + ) + endef + -$(RM_VERYCLEAN) +endif diff --git a/makefile.bcc b/makefile.bcc index 027cd0354c..9cd9dcfec4 100644 --- a/makefile.bcc +++ b/makefile.bcc @@ -63,7 +63,18 @@ ifdef BCC32DIR BCC32DIR_D = $(subst /,\,$(BCC32DIR)) else badbcc32: - @echo You need to set BCC32DIR to the directory where Borland C++ Builder is located. + @echo Your BCC32DIR environment variable is not set! + @echo See the docs/build/bcc32.txt file! +endif + +NULLSTRING := +SPACE := $(NULLSTRING) # special magic to get an isolated space character + +ifneq ($(findstring $(SPACE),$(BCC32DIR)),) +badspaces: + @echo There are spaces in your BCC32DIR environment variable: + @echo please change it to the 8.3 short filename version, + @echo or move your compiler to a different directory. endif @@ -81,7 +92,7 @@ _default: default ifdef WARNMODE WFLAGS = -w else - WFLAGS = + WFLAGS = -w-8060 endif OFLAGS = -O2 -OS @@ -129,8 +140,6 @@ dibsound: tests/win/dibsound.exe scrsave: tests/win/scrsave.scr wfixicon: tools/win/wfixicon.exe -DISTCLEAN_FILES += $(addprefix tests/win/, dibgrab.exe dibhello.exe dibsound.exe scrsave.scr) tools/win/wfixicon.exe - # -------- rules for installing and removing the library files -------- @@ -271,6 +280,20 @@ endif +# -------- helper function for compressing the executables -------- + +.PHONY: compress + +compress: +ifdef UPX_BIN + $(UPX_BIN) demo/*.exe examples/*.exe setup/*.exe tests/*.exe tools/*.exe lib/mingw32/all*.dll +else + @echo No executable compressor specified! You must set the environment variable + @echo UPX_BIN to point to upx.exe. +endif + + + # -------- link as a DLL (sort of ;-) -------- ifdef UNIX_TOOLS @@ -295,31 +318,11 @@ COMPILE_FLAGS += $(subst src/,-DALLEGRO_SRC ,$(findstring src/, $<))$(CFLAGS) $(OBJ_DIR)/%.obj: %.c bcc32 $(COMPILE_FLAGS) -W -I. -I./include -c -o$(subst /,\,$@) $(subst /,\,$<) -$(OBJ_DIR)/%.res: %.rc +obj/bcc32/%.res: %.rc brcc32 -i $(BCC32DIR)\include -fo $(subst /,\,$@) $(subst /,\,$<) -*/%.exe: $(OBJ_DIR)/%.obj $(IMPLIB_NAME) - ilink32 $(LFLAGS) -aa -Tpe c0w32 $(subst /,\,$<),$(subst /,\,$@),,$(subst /,\,$(LIB_NAME) $(LIBRARIES)) -ifdef DELETE_TDS_FILES - ifdef UNIX_TOOLS - @rm $(subst .exe,.tds,$@) - else - @del $(subst .exe,.tds,$(subst /,\,$@)) - endif -endif - -tests/win/%.exe: $(OBJ_DIR)/%.obj $(IMPLIB_NAME) - ilink32 $(LFLAGS) -aa -Tpe c0w32 $(subst /,\,$<),$(subst /,\,$@),,$(subst /,\,$(LIB_NAME) $(LIBRARIES)) -ifdef DELETE_TDS_FILES - ifdef UNIX_TOOLS - @rm $(subst .exe,.tds,$@) - else - @del $(subst .exe,.tds,$(subst /,\,$@)) - endif -endif - -tests/win/dibsound.exe: $(OBJ_DIR)/dibsound.obj $(OBJ_DIR)/dibsound.res $(IMPLIB_NAME) - @echo $(subst /,\\,$(OBJ_DIR)/dibsound.res) > res.rsp +tests/win/dibsound.exe: $(OBJ_DIR)/dibsound.obj obj/bcc32/dibsound.res $(IMPLIB_NAME) + @echo obj\\bcc32\\dibsound.res > res.rsp ilink32 $(LFLAGS) -aa -Tpe c0w32 $(subst /,\,$(OBJ_DIR)/dibsound.obj),tests\win\dibsound.exe,,$(subst /,\,$(LIB_NAME) $(LIBRARIES)),,@res.rsp ifdef UNIX_TOOLS @rm res.rsp @@ -333,8 +336,18 @@ else endif endif -tests/win/scrsave.scr: $(OBJ_DIR)/scrsave.obj $(OBJ_DIR)/scrsave.res $(IMPLIB_NAME) - @echo $(subst /,\\,$(OBJ_DIR)/scrsave.res) > res.rsp +tests/win/%.exe: $(OBJ_DIR)/%.obj $(IMPLIB_NAME) + ilink32 $(LFLAGS) -aa -Tpe c0w32 $(subst /,\,$<),$(subst /,\,$@),,$(subst /,\,$(LIB_NAME) $(LIBRARIES)) +ifdef DELETE_TDS_FILES + ifdef UNIX_TOOLS + @rm $(subst .exe,.tds,$@) + else + @del $(subst .exe,.tds,$(subst /,\,$@)) + endif +endif + +tests/win/scrsave.scr: $(OBJ_DIR)/scrsave.obj obj/bcc32/scrsave.res $(IMPLIB_NAME) + @echo obj\\bcc32\\scrsave.res > res.rsp ilink32 $(LFLAGS) -aa -Tpe c0w32 $(subst /,\,$(OBJ_DIR)/scrsave.obj),tests\win\scrsave.scr,,$(subst /,\,$(LIB_NAME) $(LIBRARIES)),,@res.rsp ifdef UNIX_TOOLS @rm res.rsp @@ -358,6 +371,16 @@ ifdef DELETE_TDS_FILES endif endif +*/%.exe: $(OBJ_DIR)/%.obj $(IMPLIB_NAME) + ilink32 $(LFLAGS) -aa -Tpe c0w32 $(subst /,\,$<),$(subst /,\,$@),,$(subst /,\,$(LIB_NAME) $(LIBRARIES)) +ifdef DELETE_TDS_FILES + ifdef UNIX_TOOLS + @rm $(subst .exe,.tds,$@) + else + @del $(subst .exe,.tds,$(subst /,\,$@)) + endif +endif + LINK_CONSOLE_DEPS = $(IMPLIB_NAME) define DO_LINK_CONSOLE @@ -382,7 +405,7 @@ endif PLUGIN_LIB = lib/bcc32/$(VERY_SHORT_VERSION)dat.lib PLUGINS_H = obj/bcc32/plugins.h PLUGIN_DEPS = $(LIB_NAME) $(PLUGIN_LIB) -PLUGIN_SCR = scx +PLUGIN_SCR = scv ifdef UNIX_TOOLS define GENERATE_PLUGINS_H @@ -390,7 +413,7 @@ ifdef UNIX_TOOLS endef else define GENERATE_PLUGINS_H - copy tools\plugins\*.inc obj\bcc32\plugins.h + copy /B tools\plugins\*.inc obj\bcc32\plugins.h endef endif @@ -479,17 +502,17 @@ DEPEND_PARMS = -MM -MG -I. -I./include -DSCAN_DEPEND -DALLEGRO_BCC32 depend: gcc $(DEPEND_PARMS) demo/*.c examples/*.c setup/*.c tests/*.c > _depend.tmp gcc $(DEPEND_PARMS) tests/win/*.c tools/*.c tools/win/*.c tools/plugins/*.c >> _depend.tmp - sed -e 's/\\/\//g' -e 's/\/$$/\\/' -e "s/^[a-zA-Z0-9_\/]*\///" -e "s/ \.\// /g" _depend.tmp > _depend1.tmp - sed -e "s/asmdef\.o/asmdef\.exe/" _depend1.tmp > _depend.tmp + sed -e "s/^[a-zA-Z0-9_\/]*\///" _depend.tmp > _depend2.tmp + sed -e "s/asmdef\.o/asmdef\.exe/" _depend2.tmp > _depend.tmp ifdef UNIX_TOOLS sed -e "s/^\([a-zA-Z0-9_]*\)\.o:/obj\/bcc32\/alleg\/\1\.obj:/" _depend.tmp > obj/bcc32/alleg/makefile.dep sed -e "s/^\([a-zA-Z0-9_]*\)\.o:/obj\/bcc32\/alld\/\1\.obj:/" _depend.tmp > obj/bcc32/alld/makefile.dep sed -e "s/^\([a-zA-Z0-9_]*\)\.o:/obj\/bcc32\/allp\/\1\.obj:/" _depend.tmp > obj/bcc32/allp/makefile.dep - rm _depend.tmp _depend1.tmp + rm _depend.tmp _depend2.tmp else sed -e "s/^\([a-zA-Z0-9_]*\)\.o:/obj\/bcc32\/alleg\/\1\.obj:/" _depend.tmp > obj\bcc32\alleg\makefile.dep sed -e "s/^\([a-zA-Z0-9_]*\)\.o:/obj\/bcc32\/alld\/\1\.obj:/" _depend.tmp > obj\bcc32\alld\makefile.dep sed -e "s/^\([a-zA-Z0-9_]*\)\.o:/obj\/bcc32\/allp\/\1\.obj:/" _depend.tmp > obj\bcc32\allp\makefile.dep del _depend.tmp - del _depend1.tmp + del _depend2.tmp endif diff --git a/makefile.be b/makefile.be index 959d14f491..b2b0ea86bb 100644 --- a/makefile.be +++ b/makefile.be @@ -43,7 +43,7 @@ _default: default # -------- decide what compiler options to use -------- ifdef WARNMODE -WFLAGS = -Wall -W -Werror -Wno-unused -Wno-multichar -Wno-ctor-dtor-privacy +WFLAGS = -Wall -W -Wstrict-prototypes -Wno-unused -Wno-multichar -Wno-ctor-dtor-privacy -Werror else WFLAGS = -Wall -Wno-unused -Wno-multichar -Wno-ctor-dtor-privacy endif @@ -88,7 +88,7 @@ else CFLAGS = $(WFLAGS) $(OFLAGS) -fomit-frame-pointer SFLAGS = $(WFLAGS) -ifdef SYMBOLMODE +ifndef SYMBOLMODE LFLAGS = -s else LFLAGS = @@ -100,7 +100,7 @@ endif # -------- list which platform specific objects to include -------- -VPATH = src/beos src/i386 src/misc tools/beos +VPATH = src/beos src/i386 src/misc src/unix tools/beos LIBRARIES = -lbe -lgame -ldevice -lmidi -lmedia @@ -234,11 +234,15 @@ include makefile.tst # -------- finally, we get to the fun part... -------- +ifdef PROFILEMODE +OTHER_OBJECTS = /boot/develop/lib/x86/i386-mcount.o +endif + ifdef STATICLINK # -------- link as a static library -------- define MAKE_LIB -ar rs $(LIB_NAME) $(OBJECTS) +ar rs $(LIB_NAME) $(OBJECTS) $(OTHER_OBJECTS) endef else @@ -246,7 +250,7 @@ else # -------- link as a shared library -------- define MAKE_LIB -gcc -nostart $(PFLAGS) -o $(LIB_NAME) $(OBJECTS) $(LIBRARIES) +gcc -nostart $(PFLAGS) -o $(LIB_NAME) $(OBJECTS) $(OTHER_OBJECTS) $(LIBRARIES) endef endif # STATICLINK @@ -267,7 +271,7 @@ $(OBJ_DIR)/%.o: %.s # link without Allegro, because we have no shared library yet docs/makedoc: $(OBJ_DIR)/makedoc$(OBJ) - gcc -o $@ $< + gcc -o $@ $< $(OTHER_OBJECTS) obj/beos/asmdef.inc: obj/beos/asmdef obj/beos/asmdef obj/beos/asmdef.inc @@ -311,7 +315,7 @@ fixdemo: demo/demo demo/demo.dat tools/beos/bfixicon DEPEND_PARAMS = -MM -MG -I. -I./include -DSCAN_DEPEND -DALLEGRO_BEOS depend: - gcc $(DEPEND_PARAMS) src/*.c src/beos/*.c src/beos/*.cpp src/i386/*.c src/misc/*.c demo/*.c examples/*.c setup/*.c tests/*.c tools/*.c tools/beos/*.cpp tools/plugins/*.c > _depend.tmp + gcc $(DEPEND_PARAMS) src/*.c src/beos/*.c src/beos/*.cpp src/i386/*.c src/misc/*.c src/unix/*.c demo/*.c examples/*.c setup/*.c tests/*.c tools/*.c tools/beos/*.cpp tools/plugins/*.c > _depend.tmp gcc $(DEPEND_PARAMS) -x assembler-with-cpp src/i386/*.s src/misc/*.s >> _depend.tmp sed -e "s/^[a-zA-Z0-9_\/]*\///" _depend.tmp > _depend2.tmp sed -e "s/^\([a-zA-Z0-9_]*\.o *:\)/obj\/beos\/alleg\/\1/" _depend2.tmp > obj/beos/alleg/makefile.dep diff --git a/makefile.dj b/makefile.dj index 5b49575d76..93dfa0c4cf 100644 --- a/makefile.dj +++ b/makefile.dj @@ -160,7 +160,7 @@ _default: default # -------- decide what compiler options to use -------- ifdef WARNMODE - WFLAGS = -Wall -W -Werror -Wno-unused + WFLAGS = -Wall -W -Wstrict-prototypes -Wno-unused -Werror else WFLAGS = -Wall -Wno-unused endif @@ -351,13 +351,18 @@ UNINSTALL_FILES = $(DJDIR_U)/lib/liballeg.a \ uninstall: -install-info --delete $(DJDIR_U)/info/allegro.$(INFO) $(DJDIR_U)/info/dir - -rm -fv $(UNINSTALL_FILES) ifdef UNIX_TOOLS + -rm -fv $(UNINSTALL_FILES) -rmdir $(DJDIR_U)/include/allegro/platform -rmdir $(DJDIR_U)/include/allegro/inline -rmdir $(DJDIR_U)/include/allegro/internal -rmdir $(DJDIR_U)/include/allegro else + define RM_FILES + $(foreach file, $(wildcard $(UNINSTALL_FILES)), del $(subst /,\,$(file)) + ) + endef + -$(RM_FILES) -rd $(DJDIR_D)\include\allegro\platform -rd $(DJDIR_D)\include\allegro\inline -rd $(DJDIR_D)\include\allegro\internal @@ -456,7 +461,7 @@ endef else define GENERATE_PLUGINS_H - copy tools\plugins\*.inc obj\djgpp\plugins.h + copy /B tools\plugins\*.inc obj\djgpp\plugins.h endef endif diff --git a/makefile.in b/makefile.in index a971adfd07..94e496fd0a 100644 --- a/makefile.in +++ b/makefile.in @@ -19,7 +19,7 @@ includedir = @includedir@ infodir = @infodir@ mandir = @mandir@ libdir = @libdir@ -modulebasedir = @libdir@/allegro +modulebasedir = $(libdir)/allegro moduledir = $(modulebasedir)/$(shared_major_minor) EXE = @@ -27,6 +27,7 @@ OBJ = .o OBJDIR = obj/unix LIBDIR = lib/unix INFO_DIR = $(infodir)/dir +DESTDIR = ACLOCAL = aclocal ACLOCAL_M4 = $(srcdir)/aclocal.m4 @@ -42,7 +43,7 @@ transform = @program_transform_name@ CC = @CC@ CPP = @CPP@ -MAKEINFO = makeinfo --no-split +MAKEINFO = @MAKEINFO@ RANLIB = @RANLIB@ AR = ar LIBS = @LIBS@ @@ -217,7 +218,7 @@ $(filter %.texi,$(DOCS)): docs/texi/%.texi: docs/src/%._tx $(MAKEDOC) $(MAKEDOC) -texi $@ $< $(filter %.info,$(DOCS)): docs/info/%.info: docs/texi/%.texi $(MAKEDOC) - $(MAKEINFO) -o $@ $< + $(MAKEINFO) --no-split -o $@ $< $(filter %.html,$(DOCS)): docs/html/%.html: docs/src/%._tx $(MAKEDOC) $(MAKEDOC) -html $@ $< @@ -225,15 +226,15 @@ $(filter %.html,$(DOCS)): docs/html/%.html: docs/src/%._tx $(MAKEDOC) docs/man/install_allegro.3: docs/src/allegro._tx $(MAKEDOC) $(MAKEDOC) -man docs/man/dummyname.3 $< -AUTHORS: docs/src/thanks._tx +AUTHORS: docs/src/thanks._tx $(MAKEDOC) $(MAKEDOC) -part -ascii AUTHORS $< cp AUTHORS docs/txt/authors.txt -THANKS: docs/src/thanks._tx +THANKS: docs/src/thanks._tx $(MAKEDOC) $(MAKEDOC) -part -ascii THANKS $< cp THANKS docs/txt/thanks.txt -CHANGES: docs/src/changes._tx +CHANGES: docs/src/changes._tx $(MAKEDOC) $(MAKEDOC) -ascii CHANGES $< cp CHANGES docs/txt/changes.txt @@ -244,7 +245,7 @@ docs/allegro.ps: docs/allegro.dvi cd docs && dvips -o allegro.ps allegro.dvi && cd .. # Dependencies and rules for building libraries and simple programs. -include makefile.dep +-include makefile.dep all: lib modules programs docs @@ -274,14 +275,38 @@ suid: $(ALLEGRO_EXE_TARGETS) touch suid clean: - rm -f $(OBJ_CLEAN_FILES) - rm -f $(OTHER_CLEAN_FILES) + + define RM_OBJ_CLEAN_FILES + $(foreach file, $(OBJ_CLEAN_FILES), rm -f $(file) + ) + endef + + define RM_OTHER_CLEAN_FILES + $(foreach file, $(OTHER_CLEAN_FILES), rm -f $(file) + ) + endef + + $(RM_OBJ_CLEAN_FILES) + $(RM_OTHER_CLEAN_FILES) distclean: clean - rm -f $(DISTCLEAN_FILES) + + define RM_DISTCLEAN_FILES + $(foreach file, $(DISTCLEAN_FILES), rm -f $(file) + ) + endef + + $(RM_DISTCLEAN_FILES) veryclean: distclean - rm -f $(VERYCLEAN_FILES) makefile + + define RM_VERYCLEAN_FILES + $(foreach file, $(VERYCLEAN_FILES), rm -f $(file) + ) + endef + + $(RM_VERYCLEAN_FILES) + rm -f makefile maintainer-clean: veryclean rm -f configure @@ -300,86 +325,90 @@ full-install: install-headers install-programs install-lib @echo "and/or make install-gzipped-info" install-lib: lib - $(mkinstalldirs) $(libdir) + $(mkinstalldirs) $(DESTDIR)$(libdir) @for l in alleg alld allp; do \ if test -f $(LIBDIR)/lib$${l}.a; then \ - echo Installing $(LIBDIR)/lib$${l}.a to $(libdir); \ - $(INSTALL_DATA) $(LIBDIR)/lib$${l}.a $(libdir)/; \ + echo Installing $(LIBDIR)/lib$${l}.a to $(DESTDIR)$(libdir); \ + $(INSTALL_DATA) $(LIBDIR)/lib$${l}.a $(DESTDIR)$(libdir)/; \ fi; \ done @for l in alleg alld allp; do \ if test -f $(LIBDIR)/lib$${l}-$(shared_version).so; then \ - echo Installing $(LIBDIR)/lib$${l}-$(shared_version).so to $(libdir); \ - $(INSTALL_DATA) $(LIBDIR)/lib$${l}-$(shared_version).so $(libdir)/; \ - $(INSTALL_DATA) $(LIBDIR)/lib$${l}_unsharable.a $(libdir)/; \ + echo Installing $(LIBDIR)/lib$${l}-$(shared_version).so to $(DESTDIR)$(libdir); \ + $(INSTALL_DATA) $(LIBDIR)/lib$${l}-$(shared_version).so $(DESTDIR)$(libdir)/; \ + $(INSTALL_DATA) $(LIBDIR)/lib$${l}_unsharable.a $(DESTDIR)$(libdir)/; \ fi; \ done @if test -n "$(ALLEGRO_MODULE_TARGETS)"; then \ - $(mkinstalldirs) $(moduledir); \ + $(mkinstalldirs) $(DESTDIR)$(moduledir); \ for m in $(ALLEGRO_MODULE_TARGETS) modules.lst; do \ - echo Installing $$m to $(moduledir); \ - $(INSTALL_DATA) $$m $(moduledir)/; \ + echo Installing $$m to $(DESTDIR)$(moduledir); \ + $(INSTALL_DATA) $$m $(DESTDIR)$(moduledir)/; \ done; \ fi - $(mkinstalldirs) $(bindir) - @echo Installing allegro-config to $(bindir) - @$(INSTALL_PROGRAM) allegro-config $(bindir) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @echo Installing allegro-config to $(DESTDIR)$(bindir) + @$(INSTALL_PROGRAM) allegro-config $(DESTDIR)$(bindir) @if test -n "$(LIBDIR)/liball*-$(shared_version).so"; then \ - (grep -q $(libdir) /etc/ld.so.conf || \ + (cat /etc/ld.so.conf | grep $(libdir) >/dev/null || \ test $(libdir) = /lib || test $(libdir) = /usr/lib) \ && ($(LDCONFIG) $(libdir) || true) || (\ echo "" ; \ echo "Warning: shared library destination $(libdir) is not in ldd search path." ; \ echo "Unless you add it to /etc/ld.so.conf, you must set LD_LIBRARY_PATH to include"; \ echo "$(libdir) each time you want to run an Allegro program." ; \ - $(LDCONFIG) -n $(libdir) ; \ ) ; \ fi + @for l in alleg alld allp; do \ + if test -f $(DESTDIR)$(libdir)/lib$${l}-$(shared_version).so -a \! -h $(DESTDIR)$(libdir)/lib$${l}.so.${shared_major_minor}; then \ + (cd $(DESTDIR)$(libdir); ln -s lib$${l}-$(shared_version).so lib$${l}.so.${shared_major_minor}); \ + fi; \ + done install-headers: - $(mkinstalldirs) $(includedir)/allegro - $(mkinstalldirs) $(includedir)/allegro/inline - $(mkinstalldirs) $(includedir)/allegro/internal - $(mkinstalldirs) $(includedir)/allegro/platform - $(INSTALL_DATA) $(srcdir)/include/allegro.h $(includedir)/ - $(INSTALL_DATA) $(srcdir)/include/xalleg.h $(includedir)/ - $(INSTALL_DATA) $(srcdir)/include/linalleg.h $(includedir)/ - $(INSTALL_DATA) $(CONFIG_H) $(includedir)/allegro/ + $(mkinstalldirs) $(DESTDIR)$(includedir)/allegro + $(mkinstalldirs) $(DESTDIR)$(includedir)/allegro/inline + $(mkinstalldirs) $(DESTDIR)$(includedir)/allegro/internal + $(mkinstalldirs) $(DESTDIR)$(includedir)/allegro/platform + $(INSTALL_DATA) $(srcdir)/include/allegro.h $(DESTDIR)$(includedir)/ + $(INSTALL_DATA) $(srcdir)/include/xalleg.h $(DESTDIR)$(includedir)/ + $(INSTALL_DATA) $(srcdir)/include/linalleg.h $(DESTDIR)$(includedir)/ + $(INSTALL_DATA) $(CONFIG_H) $(DESTDIR)$(includedir)/allegro/ @for file in $(srcdir)/include/allegro/*.h; do \ - echo Installing $$file to $(includedir)/allegro; \ - $(INSTALL_DATA) $$file $(includedir)/allegro/; \ + echo Installing $$file to $(DESTDIR)$(includedir)/allegro; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(includedir)/allegro/; \ done @for file in $(srcdir)/include/allegro/inline/*.inl; do \ - echo Installing $$file to $(includedir)/allegro/inline; \ - $(INSTALL_DATA) $$file $(includedir)/allegro/inline/; \ + echo Installing $$file to $(DESTDIR)$(includedir)/allegro/inline; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(includedir)/allegro/inline/; \ done @for file in $(srcdir)/include/allegro/internal/*.h; do \ - echo Installing $$file to $(includedir)/allegro/internal; \ - $(INSTALL_DATA) $$file $(includedir)/allegro/internal/; \ + echo Installing $$file to $(DESTDIR)$(includedir)/allegro/internal; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(includedir)/allegro/internal/; \ done @for file in $(srcdir)/include/allegro/platform/*.h; do \ - echo Installing $$file to $(includedir)/allegro/platform; \ - $(INSTALL_DATA) $$file $(includedir)/allegro/platform/; \ + echo Installing $$file to $(DESTDIR)$(includedir)/allegro/platform; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(includedir)/allegro/platform/; \ done install-programs: programs - $(mkinstalldirs) $(bindir) + $(mkinstalldirs) $(DESTDIR)$(bindir) @for prog in $(ALLEGRO_LIB_EXES) $(ALLEGRO_DATAFILE_EXES); do \ if test "X`echo $$prog | sed -e s,tools/.\*,,`" = X; then \ - echo Installing $$prog to $(bindir); \ - $(INSTALL_PROGRAM) $$prog $(bindir); \ + echo Installing $$prog to $(DESTDIR)$(bindir); \ + $(INSTALL_PROGRAM) $$prog $(DESTDIR)$(bindir); \ fi; \ done install-info: docs @echo Installing Allegro info documentation... - $(mkinstalldirs) $(infodir) - @$(INSTALL_DATA) docs/info/allegro.info $(infodir) + $(mkinstalldirs) $(DESTDIR)$(infodir) + @$(INSTALL_DATA) docs/info/allegro.info $(DESTDIR)$(infodir) -@if $(SHELL) -c "$(INSTALL_INFO) --version" >/dev/null 2>&1; then \ - if $(INSTALL_INFO) --version 2>&1 | grep -q "Debian"; then \ - $(INSTALL_INFO) --section Development -- $(infodir)/allegro.info; \ + if $(INSTALL_INFO) --version 2>&1 | grep "Debian" >/dev/null; then \ + $(INSTALL_INFO) --section Development -- $(DESTDIR)$(infodir)/allegro.info; \ else \ - $(INSTALL_INFO) $(infodir)/allegro.info $(INFO_DIR); \ + $(INSTALL_INFO) $(DESTDIR)$(infodir)/allegro.info $(INFO_DIR); \ fi; \ else \ true; \ @@ -387,21 +416,21 @@ install-info: docs install-gzipped-info: install-info @echo Compressing documentation... - @gzip -9 -f $(infodir)/allegro.info + @gzip -9 -f $(DESTDIR)$(infodir)/allegro.info install-man: docs - $(mkinstalldirs) $(mandir)/man3 + $(mkinstalldirs) $(DESTDIR)$(mandir)/man3 @for file in $(srcdir)/docs/man/*.3; do \ - echo Installing $$file to $(mandir)/man3; \ - $(INSTALL_DATA) $$file $(mandir)/man3/; \ + echo Installing $$file to $(DESTDIR)$(mandir)/man3; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man3/; \ done install-gzipped-man: docs - $(mkinstalldirs) $(mandir)/man3 + $(mkinstalldirs) $(DESTDIR)$(mandir)/man3 @for file in $(srcdir)/docs/man/*.3; do \ - echo Installing $$file.gz to $(mandir)/man3; \ - $(INSTALL_DATA) $$file $(mandir)/man3/; \ - gzip -9 -f $(mandir)/man3/`echo $$file | sed -e "s:.*/::"`; \ + echo Installing $$file.gz to $(DESTDIR)$(mandir)/man3; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man3/; \ + gzip -9 -f $(DESTDIR)$(mandir)/man3/`echo $$file | sed -e "s:.*/::"`; \ done uninstall: uninstall-lib uninstall-modules uninstall-headers uninstall-programs uninstall-info uninstall-man @@ -423,8 +452,8 @@ uninstall-shared: @echo "Uninstalling shared libraries..." @for l in alleg alld allp; do \ rm -f $(libdir)/lib$${l}-${shared_version}.so; \ + rm -f $(libdir)/lib$${l}.so.${shared_major_minor}; \ done - $(LDCONFIG) -n $(libdir) # remove symlinks -$(LDCONFIG) $(libdir) # update cache (only works if we're root) uninstall-modules: @@ -451,7 +480,7 @@ uninstall-info: gunzip $(infodir)/allegro.info.gz; \ fi; -@if $(SHELL) -c "$(INSTALL_INFO) --version" >/dev/null 2>&1; then \ - if $(INSTALL_INFO) --version 2>&1 | grep -q "Debian"; then \ + if $(INSTALL_INFO) --version 2>&1 | grep "Debian" >/dev/null; then \ $(INSTALL_INFO) --remove $(infodir)/allegro.info; \ else \ $(INSTALL_INFO) --remove $(infodir)/allegro.info $(INFO_DIR); \ @@ -478,7 +507,8 @@ depend: $(SHELL) -c 'cd $(srcdir) && misc/depmod.sh fbcon -- $(ALLEGRO_MODULE_FBCON_FILES)' >>makefile.dep $(SHELL) -c 'cd $(srcdir) && misc/depmod.sh alsadigi -lasound $(ALLEGRO_MODULE_ALSADIGI_FILES)' >>makefile.dep $(SHELL) -c 'cd $(srcdir) && misc/depmod.sh alsamidi -lasound $(ALLEGRO_MODULE_ALSAMIDI_FILES)' >>makefile.dep - $(SHELL) -c 'cd $(srcdir) && misc/depmod.sh esddigi -lesd $(ALLEGRO_MODULE_ESD_FILES)' >>makefile.dep + $(SHELL) -c 'cd $(srcdir) && misc/depmod.sh esddigi "\`esd-config --libs\`" $(ALLEGRO_MODULE_ESD_FILES)' >>makefile.dep + $(SHELL) -c 'cd $(srcdir) && misc/depmod.sh artsdigi "\`artsc-config --libs\`" $(ALLEGRO_MODULE_ARTS_FILES)' >>makefile.dep $(SHELL) -c 'cd $(srcdir) && misc/depmod.sh dga2 -lXxf86dga $(ALLEGRO_MODULE_DGA2_FILES)' >> makefile.dep @echo "Generating dependencies for simple programs" $(SHELL) -c 'cd $(srcdir) && misc/deplexe.sh $(ALLEGRO_LIB_EXE_SOURCES) $(ALLEGRO_EXAMPLE_FILES)' >>makefile.dep diff --git a/makefile.lst b/makefile.lst index 6bf851a22b..ced68cc979 100644 --- a/makefile.lst +++ b/makefile.lst @@ -261,8 +261,10 @@ ALLEGRO_SRC_LINUX_FILES = \ ALLEGRO_SRC_UNIX_FILES = \ src/unix/alsa.c \ src/unix/alsamidi.c \ + src/unix/arts.c \ src/unix/udjgpp.c \ src/unix/udrvlist.c \ + src/unix/udummy.c \ src/unix/uesd.c \ src/unix/ufile.c \ src/unix/ugfxdrv.c \ @@ -335,6 +337,9 @@ ALLEGRO_MODULE_ALSAMIDI_FILES = \ ALLEGRO_MODULE_ESD_FILES = \ src/unix/uesd.c +ALLEGRO_MODULE_ARTS_FILES = \ + src/unix/arts.c + ALLEGRO_MODULE_DGA2_FILES = \ src/x/xdga2.c \ src/x/xdga2s.s @@ -497,10 +502,8 @@ OBJ_CLEAN_FILES = \ obj/*/*.o obj/*/*/*.o obj/*/*/*/*.o obj/*/*.obj obj/*/*/*.obj OTHER_CLEAN_FILES = \ - docs/texi/*.texi docs/texi/*.txi docs/*.tex docs/info/*.info \ - docs/info/*.inf docs/man/*.3 docs/txt/*.txt \ obj/*/*.h obj/*/*.s obj/*/*.exe obj/*/*/*.lst obj/*/*/*.asm \ - obj/*/*/*.res obj/*/asmdef src/i386/asmdef \ + obj/*/*.res obj/*/asmdef obj/*/*.inc src/i386/asmdef \ lib/*/*.a lib/unix/*.so* lib/unix/sta* \ lib/*/*.lib lib/*/*.exp lib/*/*.dll \ lib/*/*.pdb lib/*/*.ilk lib/*/*.map *.pdb */*.pdb \ @@ -509,13 +512,16 @@ OTHER_CLEAN_FILES = \ log */log */*/log core */core */*/core DISTCLEAN_FILES = \ - docs/html/*.html docs/html/*.htm docs/rtf/*.rtf docs/makedoc \ - docs/allegro.dvi docs/allegro.ps* \ + docs/texi/*.texi docs/texi/*.txi docs/*.tex docs/info/*.info \ + docs/info/*.inf docs/man/*.3 docs/txt/*.txt \ + docs/html/*.html docs/html/*.htm docs/html/*.css docs/chm/*.chm docs/chm/*.hh* \ + docs/rtf/*.rtf docs/devhelp/*.html docs/devhelp/*.devhelp \ + docs/makedoc docs/allegro.dvi docs/allegro.ps* \ $(ALLEGRO_LIB_EXES) $(ALLEGRO_EXAMPLE_EXES) $(ALLEGRO_DATAFILE_EXES) \ - *.exe */*.exe msvcmake.bat tests/win/*.scr \ + *.exe */*.exe */*/*.exe msvcmake.bat tests/win/*.scr \ config.cache config.log stamp-h stamp-h[0-9]* suid makefile.dep \ config.status include/allegro/alunixac.h allegro-config VERYCLEAN_FILES = \ authors AUTHORS changes CHANGES thanks THANKS \ - obj/*/*.inc obj/*/*/*.dep lib/*/*.def + obj/*/*/*.dep lib/*/*.def diff --git a/makefile.mgw b/makefile.mgw index 8239e94409..a2fb808407 100644 --- a/makefile.mgw +++ b/makefile.mgw @@ -15,6 +15,10 @@ EXE = .exe OBJ = .o HTML = html +ifndef CROSSCOMPILE + PLUGIN_RUNNER = obj/mingw32/runner.exe +endif + PLATFORM_DIR = obj/mingw32 ifdef CROSSCOMPILE @@ -25,6 +29,10 @@ ifdef ALLEGRO_USE_CYGWIN UNIX_TOOLS = 1 endif +ifneq (,$(findstring /sh.exe,$(SHELL))) + UNIX_TOOLS = 1 +endif + ifdef STATICLINK @@ -95,9 +103,21 @@ ifdef MINGDIR MINGDIR_D = $(subst /,\,$(MINGDIR)) else badming: - @echo Please specify your mingw32 directory via MINGDIR=. See the readme.mgw file! + @echo Your MINGDIR environment variable is not set! + @echo See the docs/build/mingw32.txt file! endif +NULLSTRING := +SPACE := $(NULLSTRING) # special magic to get an isolated space character + +ifneq ($(findstring $(SPACE),$(MINGDIR)),) +badspaces: + @echo There are spaces in your MINGDIR environment variable: + @echo please change it to the 8.3 short filename version, + @echo or move your compiler to a different directory. +endif + + # -------- give a sensible default target for make without any args -------- @@ -114,7 +134,7 @@ ifdef ALLEGRO_USE_CYGWIN endif ifdef WARNMODE - WFLAGS = -Wall -W -Werror -Wno-unused + WFLAGS = -Wall -W -Wstrict-prototypes -Wno-unused -Werror else WFLAGS = -Wall -Wno-unused endif @@ -208,8 +228,6 @@ dibsound: tests/win/dibsound.exe scrsave: tests/win/scrsave.scr wfixicon: tools/win/wfixicon.exe -DISTCLEAN_FILES += $(addprefix tests/win/, dibgrab.exe dibhello.exe dibsound.exe scrsave.scr) tools/win/wfixicon.exe - # -------- rules for installing and removing the library files -------- @@ -226,26 +244,29 @@ endif # STATICLINK $(MINGDIR_U)/lib/$(IMPLIB_BASENAME): $(IMPLIB_NAME) cp lib/mingw32/$(IMPLIB_BASENAME) $(MINGDIR_U)/lib -$(MINGDIR_U)/include/allegro.h: include/allegro.h +$(MINGDIR_U)/include: + mkdir $(MINGDIR_U)/include + +$(MINGDIR_U)/include/allegro.h: include/allegro.h $(MINGDIR_U)/include cp include/allegro.h $(MINGDIR_U)/include -$(MINGDIR_U)/include/winalleg.h: include/winalleg.h +$(MINGDIR_U)/include/winalleg.h: include/winalleg.h $(MINGDIR_U)/include cp include/winalleg.h $(MINGDIR_U)/include -$(MINGDIR_U)/include/allegro: - mkdir $(MINGDIR_U)/include/allegro +$(MINGDIR_U)/include/allegro: $(MINGDIR_U)/include + mkdir -p $(MINGDIR_U)/include/allegro $(MINGDIR_U)/include/allegro/%.h: include/allegro/%.h cp $< $@ $(MINGDIR_U)/include/allegro/internal: - mkdir $(MINGDIR_U)/include/allegro/internal + mkdir -p $(MINGDIR_U)/include/allegro/internal $(MINGDIR_U)/include/allegro/internal/%.h: include/allegro/internal/%.h cp $< $@ $(MINGDIR_U)/include/allegro/inline: - mkdir $(MINGDIR_U)/include/allegro/inline + mkdir -p $(MINGDIR_U)/include/allegro/inline $(MINGDIR_U)/include/allegro/inline/%.inl: include/allegro/inline/%.inl cp $< $@ @@ -268,14 +289,18 @@ endif # STATICLINK $(MINGDIR_U)/lib/$(IMPLIB_BASENAME): $(IMPLIB_NAME) copy lib\mingw32\$(IMPLIB_BASENAME) $(MINGDIR_D)\lib -$(MINGDIR_U)/include/allegro.h: include/allegro.h +$(MINGDIR_U)/include: + md $(MINGDIR_D)\include + +$(MINGDIR_U)/include/allegro.h: include/allegro.h $(MINGDIR_U)/include copy include\allegro.h $(MINGDIR_D)\include -$(MINGDIR_U)/include/winalleg.h: include/winalleg.h +$(MINGDIR_U)/include/winalleg.h: include/winalleg.h $(MINGDIR_U)/include copy include\winalleg.h $(MINGDIR_D)\include -$(MINGDIR_U)/include/allegro: - md $(MINGDIR_D)\include\allegro +$(MINGDIR_U)/include/allegro: $(MINGDIR_U)/include + -md $(MINGDIR_D)\include\allegro +# workaround for a weird make problem $(MINGDIR_U)/include/allegro/%.h: include/allegro/%.h copy $(subst /,\,$< $@) @@ -307,11 +332,11 @@ HEADERS = $(addprefix $(MINGDIR_U)/,$(wildcard include/allegro/*.h)) \ INSTALL_FILES = $(MINGDIR_U)/lib/$(IMPLIB_BASENAME) \ $(MINGDIR_U)/include/allegro.h \ + $(MINGDIR_U)/include/winalleg.h \ $(MINGDIR_U)/include/allegro \ $(MINGDIR_U)/include/allegro/internal \ $(MINGDIR_U)/include/allegro/inline \ $(MINGDIR_U)/include/allegro/platform \ - $(MINGDIR_U)/include/winalleg.h \ $(MINGDIR_U)/include/allegro/platform/aintwin.h \ $(MINGDIR_U)/include/allegro/platform/al386gcc.h \ $(MINGDIR_U)/include/allegro/platform/almngw32.h \ @@ -367,7 +392,7 @@ endif .PHONY: compress -compress: $(PROGRAMS) +compress: ifdef UPX_BIN $(UPX_BIN) demo/*.exe examples/*.exe setup/*.exe tests/*.exe tools/*.exe lib/mingw32/all*.dll else @@ -389,8 +414,8 @@ ifndef CROSSCOMPILE DLLWRAP = dllwrap WINDRES = windres else - DLLWRAP = i386-mingw32msvc-dllwrap - WINDRES = i386-mingw32msvc-windres + DLLWRAP = $(XPREFIX)dllwrap + WINDRES = $(XPREFIX)windres endif ifdef STATICLINK @@ -424,24 +449,53 @@ $(OBJ_DIR)/%.o: %.s $(OBJ_DIR)/%.o: %.rc $(WINDRES) --include-dir include -O coff -o $@ -i $< -$(OBJ_DIR)/%.res: %.rc +obj/mingw32/%.res: %.rc $(WINDRES) -O coff -o $@ -i $< -*/%.exe: $(OBJ_DIR)/%.o $(IMPLIB_NAME) - gcc $(LFLAGS) $(PFLAGS) -Wl,--subsystem,windows -o $@ $< $(IMPLIB_NAME) $(LIBRARIES) +tests/win/dibsound.exe: $(OBJ_DIR)/dibsound.o obj/mingw32/dibsound.res $(IMPLIB_NAME) + gcc $(LFLAGS) $(PFLAGS) -Wl,--subsystem,windows -o tests/win/dibsound.exe $(OBJ_DIR)/dibsound.o obj/mingw32/dibsound.res $(IMPLIB_NAME) $(LIBRARIES) tests/win/%.exe: $(OBJ_DIR)/%.o $(IMPLIB_NAME) gcc $(LFLAGS) $(PFLAGS) -Wl,--subsystem,windows -o $@ $< $(IMPLIB_NAME) $(LIBRARIES) -tests/win/dibsound.exe: $(OBJ_DIR)/dibsound.o $(OBJ_DIR)/dibsound.res $(IMPLIB_NAME) - gcc $(LFLAGS) $(PFLAGS) -Wl,--subsystem,windows -o tests/win/dibsound.exe $(OBJ_DIR)/dibsound.o $(OBJ_DIR)/dibsound.res $(IMPLIB_NAME) $(LIBRARIES) - -tests/win/scrsave.scr: $(OBJ_DIR)/scrsave.o $(OBJ_DIR)/scrsave.res $(IMPLIB_NAME) - gcc $(LFLAGS) $(PFLAGS) -Wl,--subsystem,windows -o tests/win/scrsave.scr $(OBJ_DIR)/scrsave.o $(OBJ_DIR)/scrsave.res $(IMPLIB_NAME) $(LIBRARIES) +tests/win/scrsave.scr: $(OBJ_DIR)/scrsave.o obj/mingw32/scrsave.res $(IMPLIB_NAME) + gcc $(LFLAGS) $(PFLAGS) -Wl,--subsystem,windows -o tests/win/scrsave.scr $(OBJ_DIR)/scrsave.o obj/mingw32/scrsave.res $(IMPLIB_NAME) $(LIBRARIES) tools/win/%.exe: $(OBJ_DIR)/%.o $(IMPLIB_NAME) gcc $(LFLAGS) $(PFLAGS) -Wl,--subsystem,console -o $@ $< $(IMPLIB_NAME) $(LIBRARIES) +ifdef CROSSCOMPILE + +demo/demo.exe: $(OBJ_DIR)/demo.o $(IMPLIB_NAME) + gcc $(LFLAGS) $(PFLAGS) -Wl,--subsystem,windows -o $@ $< $(IMPLIB_NAME) $(LIBRARIES) + +else + +obj/mingw32/demo.res: demo/demo.dat tools/win/wfixicon.exe +ifdef STATICLINK + tools/win/wfixicon.exe obj/mingw32/demo.ico -ro -d demo/demo.dat SHIP3 GAME_PAL +else + ifdef UNIX_TOOLS + cp tools/win/wfixicon.exe lib/mingw32/wfixicon.exe + else + copy tools\win\wfixicon.exe lib\mingw32\wfixicon.exe + endif + lib/mingw32/wfixicon.exe obj/mingw32/demo.ico -ro -d demo/demo.dat SHIP3 GAME_PAL + ifdef UNIX_TOOLS + rm lib/mingw32/wfixicon.exe + else + del lib\mingw32\wfixicon.exe + endif +endif + +demo/demo.exe: $(OBJ_DIR)/demo.o obj/mingw32/demo.res $(IMPLIB_NAME) + gcc $(LFLAGS) $(PFLAGS) -Wl,--subsystem,windows -o demo/demo.exe $(OBJ_DIR)/demo.o obj/mingw32/demo.res $(IMPLIB_NAME) $(LIBRARIES) + +endif # CROSSCOMPILE + +examples/%.exe setup/%.exe tests/%.exe: $(OBJ_DIR)/%.o $(IMPLIB_NAME) + gcc $(LFLAGS) $(PFLAGS) -Wl,--subsystem,windows -o $@ $< $(IMPLIB_NAME) $(LIBRARIES) + LINK_CONSOLE_DEPS = $(IMPLIB_NAME) define LINK_CONSOLE @@ -465,12 +519,15 @@ obj/mingw32/asmdef.inc: obj/mingw32/asmdef.exe obj/mingw32/asmdef.exe: src/i386/asmdef.c gcc -O $(WFLAGS) $(PFLAGS) -I. -I./include -o obj/mingw32/asmdef.exe src/i386/asmdef.c +obj/mingw32/runner.exe: src/misc/runnergw.c + gcc -O -Wall -Werror -o obj/mingw32/runner.exe src/misc/runnergw.c + endif # CROSSCOMPILE PLUGIN_LIB = lib/mingw32/lib$(VERY_SHORT_VERSION)dat.a -PLUGIN_DEPS = $(IMPLIB_NAME) $(PLUGIN_LIB) +PLUGIN_DEPS = $(IMPLIB_NAME) $(PLUGIN_LIB) $(PLUGIN_RUNNER) PLUGINS_H = obj/mingw32/plugins.h -PLUGIN_SCR = scv +PLUGIN_SCR = scm ifdef UNIX_TOOLS define GENERATE_PLUGINS_H @@ -478,7 +535,7 @@ ifdef UNIX_TOOLS endef else define GENERATE_PLUGINS_H - copy tools\plugins\*.inc obj\mingw32\plugins.h + copy /B tools\plugins\*.inc obj\mingw32\plugins.h endef endif @@ -487,27 +544,15 @@ define MAKE_PLUGIN_LIB endef define LINK_WITH_PLUGINS - gcc $(LFLAGS) -Wl,--subsystem,windows -o $@ $< $(strip $(PLUGIN_LIB) $(addprefix @,$(PLUGIN_SCRIPTS)) $(IMPLIB_NAME) $(LIBRARIES)) + $(PLUGIN_RUNNER) gcc $(LFLAGS) $(PFLAGS) -Wl,--subsystem,windows -o $@ $< $(strip $(PLUGIN_LIB) $(addprefix @,$(PLUGIN_SCRIPTS)) $(IMPLIB_NAME) $(LIBRARIES)) endef define LINK_CONSOLE_WITH_PLUGINS - gcc $(LFLAGS) -Wl,--subsystem,console -o $@ $< $(strip $(PLUGIN_LIB) $(addprefix @,$(PLUGIN_SCRIPTS)) $(IMPLIB_NAME) $(LIBRARIES)) + $(PLUGIN_RUNNER) gcc $(LFLAGS) $(PFLAGS) -Wl,--subsystem,console -o $@ $< $(strip $(PLUGIN_LIB) $(addprefix @,$(PLUGIN_SCRIPTS)) $(IMPLIB_NAME) $(LIBRARIES)) endef -# -------- demo program iconification -------- - -.PHONY: fixdemo - -$(OBJ_DIR)/demo.res: demo/demo.dat tools/win/wfixicon.exe - tools/win/wfixicon.exe $(OBJ_DIR)/demo.ico -ro -d demo/demo.dat SHIP3 GAME_PAL - -fixdemo: $(OBJ_DIR)/demo.o $(OBJ_DIR)/demo.res $(IMPLIB_NAME) - gcc $(LFLAGS) $(PFLAGS) -Wl,--subsystem,windows -o demo/demo.exe $(OBJ_DIR)/demo.o $(OBJ_DIR)/demo.res $(IMPLIB_NAME) $(LIBRARIES) - - - # -------- generate automatic dependencies -------- DEPEND_PARAMS = -MM -MG -I. -I./include -DSCAN_DEPEND -DALLEGRO_MINGW32 diff --git a/makefile.qnx b/makefile.qnx index 43dc63f907..60c9f50d20 100644 --- a/makefile.qnx +++ b/makefile.qnx @@ -34,9 +34,9 @@ _default: default # -------- decide what compiler options to use -------- ifdef WARNMODE - WFLAGS = -Wall -W -Werror -Wno-unused -Wno-multichar -Wno-ctor-dtor-privacy + WFLAGS = -Wall -W -Werror -Wno-unused else - WFLAGS = -Wall -Wno-unused -Wno-multichar -Wno-ctor-dtor-privacy + WFLAGS = -Wall -Wno-unused endif ifdef TARGET_ARCH_COMPAT @@ -73,7 +73,7 @@ LFLAGS = -pg else # -------- optimised build -------- -CFLAGS = $(WFLAGS) $(OFLAGS) -fomit-frame-pointer -fno-strength-reduce +CFLAGS = $(WFLAGS) $(OFLAGS) -fomit-frame-pointer SFLAGS = $(WFLAGS) ifndef SYMBOLMODE LFLAGS += -s @@ -222,15 +222,6 @@ obj/qnx/asmdef.inc: obj/qnx/asmdef obj/qnx/asmdef: src/i386/asmdef.c include/*.h include/allegro/*.h obj/qnx/asmcapa.h gcc -O $(WFLAGS) -I. -I./include -o obj/qnx/asmdef src/i386/asmdef.c -obj/qnx/setupdat.s: setup/setup.dat tools/dat2s - tools/dat2s -o obj/qnx/setupdat.s setup/setup.dat - -obj/qnx/setupdat.o: obj/qnx/setupdat.s - gcc -o obj/qnx/setupdat.o -c obj/qnx/setupdat.s - -setup/setup: $(OBJ_DIR)/setup.o obj/qnx/setupdat.o $(LIB_NAME) - gcc $(LFLAGS) -o setup/setup $(OBJ_DIR)/setup.o obj/qnx/setupdat.o $(LIB_NAME) $(LIBRARIES) - PLUGIN_LIB = lib/qnx/lib$(VERY_SHORT_VERSION)dat.a PLUGINS_H = obj/qnx/plugins.h PLUGIN_DEPS = $(LIB_NAME) $(PLUGIN_LIB) diff --git a/makefile.tst b/makefile.tst index c8a2fd1512..90220657ac 100644 --- a/makefile.tst +++ b/makefile.tst @@ -15,7 +15,7 @@ else endif mmxtest: - gcc -DASMCAPA_MMX_TEST -assembler-with-cpp -c src/misc/asmcapa.s -o $(ASMCAPA_DIR_U)/asmcapa$(OBJ) + gcc -DASMCAPA_MMX_TEST -x assembler-with-cpp -c src/misc/asmcapa.s -o $(ASMCAPA_DIR_U)/asmcapa$(OBJ) ifdef UNIX_TOOLS echo "#define ALLEGRO_MMX" >> $(ASMCAPA_DIR_U)/asmcapa.h else @@ -23,7 +23,7 @@ else endif ssetest: - gcc -DASMCAPA_SSE_TEST -assembler-with-cpp -c src/misc/asmcapa.s -o $(ASMCAPA_DIR_U)/asmcapa$(OBJ) + gcc -DASMCAPA_SSE_TEST -x assembler-with-cpp -c src/misc/asmcapa.s -o $(ASMCAPA_DIR_U)/asmcapa$(OBJ) ifdef UNIX_TOOLS echo "#define ALLEGRO_SSE" >> $(ASMCAPA_DIR_U)/asmcapa.h else diff --git a/makefile.vc b/makefile.vc index e46733b98f..8c2425f14e 100644 --- a/makefile.vc +++ b/makefile.vc @@ -84,29 +84,20 @@ ifdef MSVCDir MSVCDIR_U = $(subst \,/,$(MSVCDir)) MSVCDIR_D = $(subst /,\,$(MSVCDir)) else -ifdef MSDEVDIR - MSVCDIR_U = $(subst \,/,$(MSDEVDIR)) - MSVCDIR_D = $(subst /,\,$(MSDEVDIR)) -else -ifdef MSDevDir - MSVCDIR_U = $(subst \,/,$(MSDevDir)) - MSVCDIR_D = $(subst /,\,$(MSDevDir)) -else badmsvc: - @echo Your MSVCDIR or MSDEVDIR environment variable is not set! -endif -endif + @echo Your MSVCDIR environment variable is not set! + @echo See the docs/build/msvc.txt file! endif endif NULLSTRING := SPACE := $(NULLSTRING) # special magic to get an isolated space character -ifneq ($(findstring $(SPACE),$(MSVCDIR)$(MSDEVDIR)),) +ifneq ($(findstring $(SPACE),$(MSVCDIR)),) badspaces: - @echo There are spaces in your MSVCDIR or MSDEVDIR environment - @echo variables: please change these to the 8.3 short filename - @echo version, or move your compiler to a different directory. + @echo There are spaces in your MSVCDIR environment variable: + @echo please change it to the 8.3 short filename version, + @echo or move your compiler to a different directory. endif @@ -174,8 +165,6 @@ dibsound: tests/win/dibsound.exe scrsave: tests/win/scrsave.scr wfixicon: tools/win/wfixicon.exe -DISTCLEAN_FILES += $(addprefix tests/win/, dibgrab.exe dibhello.exe dibsound.exe scrsave.scr) tools/win/wfixicon.exe - # -------- rules for installing and removing the library files -------- @@ -343,7 +332,7 @@ endif .PHONY: compress -compress: $(PROGRAMS) +compress: ifdef UPX_BIN $(UPX_BIN) demo/*.exe examples/*.exe setup/*.exe tests/*.exe tools/*.exe lib/msvc/all*.dll else @@ -392,24 +381,44 @@ $(OBJ_DIR)/%.obj: %.s $(OBJ_DIR)/%.obj: %.rc rc -i"include" -fo$@ $< -$(OBJ_DIR)/%.res: %.rc +obj/msvc/%.res: %.rc rc -fo$@ $< -*/%.exe: $(OBJ_DIR)/%.obj $(IMPLIB_NAME) $(RUNNER) - $(RUNNER) link @ -nologo $(LFLAGS) -subsystem:windows -out:$@ $< $(IMPLIB_NAME) $(LIBRARIES) +tests/win/dibsound.exe: $(OBJ_DIR)/dibsound.obj obj/msvc/dibsound.res $(IMPLIB_NAME) $(RUNNER) + $(RUNNER) link @ -nologo $(LFLAGS) -subsystem:windows -out:tests/win/dibsound.exe $(OBJ_DIR)/dibsound.obj obj/msvc/dibsound.res $(IMPLIB_NAME) $(LIBRARIES) tests/win/%.exe: $(OBJ_DIR)/%.obj $(IMPLIB_NAME) $(RUNNER) $(RUNNER) link @ -nologo $(LFLAGS) -subsystem:windows -out:$@ $< $(IMPLIB_NAME) $(LIBRARIES) -tests/win/dibsound.exe: $(OBJ_DIR)/dibsound.obj $(OBJ_DIR)/dibsound.res $(IMPLIB_NAME) $(RUNNER) - $(RUNNER) link @ -nologo $(LFLAGS) -subsystem:windows -out:tests/win/dibsound.exe $(OBJ_DIR)/dibsound.obj $(OBJ_DIR)/dibsound.res $(IMPLIB_NAME) $(LIBRARIES) - -tests/win/scrsave.scr: $(OBJ_DIR)/scrsave.obj $(OBJ_DIR)/scrsave.res $(IMPLIB_NAME) $(RUNNER) - $(RUNNER) link @ -nologo $(LFLAGS) -subsystem:windows -out:tests/win/scrsave.scr $(OBJ_DIR)/scrsave.obj $(OBJ_DIR)/scrsave.res $(IMPLIB_NAME) $(LIBRARIES) +tests/win/scrsave.scr: $(OBJ_DIR)/scrsave.obj obj/msvc/scrsave.res $(IMPLIB_NAME) $(RUNNER) + $(RUNNER) link @ -nologo $(LFLAGS) -subsystem:windows -out:tests/win/scrsave.scr $(OBJ_DIR)/scrsave.obj obj/msvc/scrsave.res $(IMPLIB_NAME) $(LIBRARIES) tools/win/%.exe: $(OBJ_DIR)/%.obj $(IMPLIB_NAME) $(RUNNER) $(RUNNER) link @ -nologo $(LFLAGS) -subsystem:console -out:$@ $< $(IMPLIB_NAME) $(LIBRARIES) +obj/msvc/demo.res: demo/demo.dat tools/win/wfixicon.exe +ifdef STATICLINK + tools/win/wfixicon.exe obj/msvc/demo.ico -ro -d demo/demo.dat SHIP3 GAME_PAL +else + ifdef UNIX_TOOLS + cp tools/win/wfixicon.exe lib/msvc/wfixicon.exe + else + copy tools\win\wfixicon.exe lib\msvc\wfixicon.exe + endif + lib/msvc/wfixicon.exe obj/msvc/demo.ico -ro -d demo/demo.dat SHIP3 GAME_PAL + ifdef UNIX_TOOLS + rm lib/msvc/wfixicon.exe + else + del lib\msvc\wfixicon.exe + endif +endif + +demo/demo.exe: $(OBJ_DIR)/demo.obj obj/msvc/demo.res $(IMPLIB_NAME) $(RUNNER) + $(RUNNER) link @ -nologo $(LFLAGS) -subsystem:windows -out:demo/demo.exe $(OBJ_DIR)/demo.obj obj/msvc/demo.res $(IMPLIB_NAME) $(LIBRARIES) + +*/%.exe: $(OBJ_DIR)/%.obj $(IMPLIB_NAME) $(RUNNER) + $(RUNNER) link @ -nologo $(LFLAGS) -subsystem:windows -out:$@ $< $(IMPLIB_NAME) $(LIBRARIES) + LINK_CONSOLE_DEPS = $(IMPLIB_NAME) $(RUNNER) define LINK_CONSOLE @@ -436,7 +445,7 @@ ifdef UNIX_TOOLS endef else define GENERATE_PLUGINS_H - copy tools\plugins\*.inc obj\msvc\plugins.h + copy /B tools\plugins\*.inc obj\msvc\plugins.h endef endif @@ -454,18 +463,6 @@ endef -# -------- demo program iconification -------- - -.PHONY: fixdemo - -$(OBJ_DIR)/demo.res: demo/demo.dat tools/win/wfixicon.exe - tools/win/wfixicon.exe $(OBJ_DIR)/demo.ico -ro -d demo/demo.dat SHIP3 GAME_PAL - -fixdemo: $(OBJ_DIR)/demo.obj $(OBJ_DIR)/demo.res $(IMPLIB_NAME) $(RUNNER) - $(RUNNER) link @ -nologo $(LFLAGS) -subsystem:windows -out:demo/demo.exe $(OBJ_DIR)/demo.obj $(OBJ_DIR)/demo.res $(IMPLIB_NAME) $(LIBRARIES) - - - # -------- generate automatic dependencies -------- DEPEND_PARAMS = -MM -MG -I. -I./include -DSCAN_DEPEND -DALLEGRO_MSVC diff --git a/makefile.ver b/makefile.ver index b9767ce522..5ac5d73835 100644 --- a/makefile.ver +++ b/makefile.ver @@ -3,5 +3,5 @@ LIBRARY_VERSION = 40 # Shared library versions for Unix -shared_version = 4.0.1 +shared_version = 4.0.3 shared_major_minor = 4.0 diff --git a/makefile.wat b/makefile.wat index 50bf2cc61e..7d559bf05b 100644 --- a/makefile.wat +++ b/makefile.wat @@ -71,7 +71,7 @@ ifdef DEBUGMODE CFLAGS = -DDEBUGMODE=$(DEBUGMODE) $(WFLAGS) -bt=dos4g -5s -s -d2 SFLAGS = -DDEBUGMODE=$(DEBUGMODE) -Wall -LFLAGS = "option quiet" "option stack=128k" "system dos4g" "debug all" +LFLAGS = 'option quiet' 'option stack=128k' 'system dos4g' 'debug all' else ifdef PROFILEMODE @@ -79,14 +79,14 @@ ifdef PROFILEMODE # -------- profiling build -------- CFLAGS = $(WFLAGS) -bt=dos4g -5s -ox -et SFLAGS = -Wall -LFLAGS = "option quiet" "option stack=128k" "system dos4g" +LFLAGS = 'option quiet' 'option stack=128k' 'system dos4g' else # -------- optimised build -------- CFLAGS = $(WFLAGS) -bt=dos4g -5s -ox SFLAGS = -Wall -LFLAGS = "option quiet" "option stack=128k" "system dos4g" +LFLAGS = 'option quiet' 'option stack=128k' 'system dos4g' endif endif @@ -165,7 +165,11 @@ UNINSTALL_FILES = $(WATDIR_U)/lib386/alleg.lib \ $(WATDIR_U)/h/allegro/platform/*.h uninstall: - -rm -fv $(UNINSTALL_FILES) + define RM_FILES + $(foreach file, $(wildcard $(UNINSTALL_FILES)), del $(subst /,\,$(file)) + ) + endef + -$(RM_FILES) -rd $(WATDIR_D)\h\allegro\platform -rd $(WATDIR_D)\h\allegro\inline -rd $(WATDIR_D)\h\allegro\internal @@ -209,7 +213,7 @@ $(OBJ_DIR)/iscanmmx.obj: iscanmmx.s $(RUNNER) endif */%.exe: $(OBJ_DIR)/%.obj $(LIB_NAME) $(RUNNER) - $(RUNNER) wlink \\ @ $(LFLAGS) "name $@" "file $<" "library $(LIB_NAME)" + $(RUNNER) wlink \\ @ $(LFLAGS) 'name $@' 'file $<' 'library $(LIB_NAME)' obj/watcom/asmdef.inc: obj/watcom/asmdef.exe obj/watcom/asmdef.exe obj/watcom/asmdef.inc @@ -226,7 +230,7 @@ PLUGIN_DEPS = $(LIB_NAME) $(PLUGIN_LIB) $(RUNNER) PLUGIN_SCR = scw define GENERATE_PLUGINS_H -copy tools\plugins\*.inc obj\watcom\plugins.h +copy /B tools\plugins\*.inc obj\watcom\plugins.h endef define MAKE_PLUGIN_LIB @@ -234,7 +238,7 @@ $(RUNNER) wlib \\ @ -q -b -n $(PLUGIN_LIB) $(addprefix +,$(PLUGIN_OBJS)) endef define LINK_WITH_PLUGINS -$(RUNNER) wlink \\ @ $(LFLAGS) "name $@" "file $<" $(strip "library $(PLUGIN_LIB)" $(addprefix @,$(PLUGIN_SCRIPTS)) "library $(LIB_NAME)") +$(RUNNER) wlink \\ @ $(LFLAGS) 'name $@' 'file $<' $(strip 'library $(PLUGIN_LIB)' $(addprefix @,$(PLUGIN_SCRIPTS)) 'library $(LIB_NAME)') endef diff --git a/misc/allegro-config-qnx.sh b/misc/allegro-config-qnx.sh index e2e0ab9841..26447f13e7 100644 --- a/misc/allegro-config-qnx.sh +++ b/misc/allegro-config-qnx.sh @@ -7,9 +7,9 @@ # # gcc myprog.c -o myprog `allegro-config --libs` # -# Derived from BeOS and Unix versions of the same script. +# Derived from the Unix version of the same script. -version=4.0.1 +version=4.0.3 prefix= exec_prefix=$prefix @@ -19,6 +19,7 @@ lib_type=alleg allegro_libs="-lm -lph -lasound" allegro_cflags="" +allegro_cppflags="-D__GCC_BUILTIN" usage() { @@ -29,8 +30,9 @@ Usage: allegro-config [OPTIONS] [LIBRARIES] Options: --prefix[=DIR] --exec-prefix[=DIR] - --version + --version[=VERSION] --cflags + --cppflags --libs Libraries: @@ -73,6 +75,10 @@ while test $# -gt 0; do echo_exec_prefix=yes ;; + --version=*) + version=$optarg + ;; + --version) echo $version ;; @@ -81,6 +87,10 @@ while test $# -gt 0; do echo_cflags=yes ;; + --cppflags) + echo_cppflags=yes + ;; + --libs) echo_libs=yes ;; @@ -91,6 +101,7 @@ while test $# -gt 0; do debug) allegro_cflags=-DDEBUGMODE $allegro_cflags + allegro_cppflags=-DDEBUGMODE $allegro_cppflags lib_type=alld ;; @@ -118,6 +129,10 @@ if test "$echo_cflags" = "yes"; then echo -I${prefix}/usr/include $allegro_cflags fi +if test "$echo_cppflags" = "yes"; then + echo -I${prefix}/usr/include $allegro_cppflags +fi + if test "$echo_libs" = "yes"; then libdirs=-L${exec_prefix}/usr/lib echo $libdirs -l${lib_type} $allegro_libs diff --git a/misc/allegro-config.in b/misc/allegro-config.in index 19860b2a3e..6a0c8d2c39 100644 --- a/misc/allegro-config.in +++ b/misc/allegro-config.in @@ -9,11 +9,12 @@ # # This is heavily based on a similar script from GTK. -version=4.0.1 +version=4.0.3 prefix=@prefix@ exec_prefix=$prefix exec_prefix_set=no +include_prefix=@INCLUDE_PREFIX@ static_libs=@LINK_WITH_STATIC_LIBS@ lib_type=@LIB_TO_LINK@ @@ -21,6 +22,7 @@ lib_type=@LIB_TO_LINK@ allegro_ldflags=`echo "@LDFLAGS@" | sed -e "s/ -s\b//"` allegro_libs="@LIBS@" allegro_cflags="" +allegro_cppflags="" usage() { @@ -31,8 +33,9 @@ Usage: allegro-config [OPTIONS] [LIBRARIES] Options: --prefix[=DIR] --exec-prefix[=DIR] - --version + --version[=VERSION] --cflags + --cppflags --libs --static --shared @@ -78,6 +81,10 @@ while test $# -gt 0; do echo_exec_prefix=yes ;; + --version=*) + version=$optarg + ;; + --version) echo $version ;; @@ -86,6 +93,10 @@ while test $# -gt 0; do echo_cflags=yes ;; + --cppflags) + echo_cppflags=yes + ;; + --libs) echo_libs=yes ;; @@ -110,6 +121,7 @@ while test $# -gt 0; do debug) allegro_cflags=-DDEBUGMODE $allegro_cflags + allegro_cppflags=-DDEBUGMODE $allegro_cppflags lib_type=alld ;; @@ -134,7 +146,19 @@ if test "$echo_exec_prefix" = "yes"; then fi if test "$echo_cflags" = "yes"; then - echo -I${prefix}/include $allegro_cflags + if test -n "$include_prefix"; then + echo -I${include_prefix}/include $allegro_cflags + else + echo $allegro_cflags + fi +fi + +if test "$echo_cppflags" = "yes"; then + if test -n "$include_prefix"; then + echo -I${include_prefix}/include $allegro_cppflags + else + echo $allegro_cppflags + fi fi if test "$echo_libs" = "yes"; then @@ -147,11 +171,11 @@ if test "$echo_libs" = "yes"; then fi if test "$echo_env" = "yes"; then - echo "export PATH=\$PATH:$prefix/bin" - echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:$prefix/lib" - echo "export LIBRARY_PATH=\$LIBRARY_PATH:$prefix/lib" - echo "export C_INCLUDE_PATH=\$C_INCLUDE_PATH:$prefix/include" - echo "export CPLUS_INCLUDE_PATH=\$CPLUS_INCLUDE_PATH:$prefix/include" - echo "export OBJC_INCLUDE_PATH=\$OBJC_INCLUDE_PATH:$prefix/include" + echo "export PATH=\$PATH:$prefix/bin" + echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:$prefix/lib" + echo "export LIBRARY_PATH=\$LIBRARY_PATH:$prefix/lib" + echo "export C_INCLUDE_PATH=\$C_INCLUDE_PATH:$prefix/include" + echo "export CPLUS_INCLUDE_PATH=\$CPLUS_INCLUDE_PATH:$prefix/include" + echo "export OBJC_INCLUDE_PATH=\$OBJC_INCLUDE_PATH:$prefix/include" fi diff --git a/misc/allegro.spec b/misc/allegro.spec index 9ef9eb8e47..03a729df27 100644 --- a/misc/allegro.spec +++ b/misc/allegro.spec @@ -4,11 +4,12 @@ Summary: A game programming library. Summary(es): Una libreria de programacion de juegos. Summary(fr): Une librairie de programmation de jeux. Summary(it): Una libreria per la programmazione di videogiochi. +Summary(de): Eine Bibliothek zur Programmierung von Spielen. Name: allegro -Version: 4.0.1 +Version: 4.0.3 Release: 1 License: Gift Ware -Packager: Allegro development team +Packager: Allegro development team Group: System/Libraries Source: ftp://sunsite.dk/allegro/%{name}-%{version}.tar.gz URL: http://alleg.sourceforge.net @@ -43,11 +44,16 @@ les jeux vid Allegro è una libreria multipiattaforma dedicata all'uso nei videogiochi ed in altri tipi di programmazione multimediale. +%description -l de +Allegro ist eine plattformübergreifende Bibliothek zur Verwendung in +Computerspielen und anderen Formen von Multimediaprogrammierung. + %package devel Summary: A game programming library. Summary(es): Una libreria de programacion de juegos. Summary(fr): Une librairie de programmation de jeux. Summary(it): Una libreria per la programmazione di videogiochi. +Summary(de): Eine Bibliothek zur Programmierung von Spielen. Group: Development/C Prereq: allegro Autoreq: on @@ -72,11 +78,18 @@ Allegro ed in altri tipi di programmazione multimediale. Questo pacchetto è necessario per compilare programmi scritti con Allegro. +%description devel -l de +Allegro ist eine plattformübergreifende Bibliothek zur Verwendung in +Computerspielen und anderen Formen von Multimediaprogrammierung. +Dieses Paket wird benötigt, um Programme zu bauen, die Allegro +verwenden. + %package tools Summary: Extra tools for the Allegro programming library. Summary(es): Herramientas adicionales para la librería de programación Allegro. Summary(fr): Outils supplémentaires pour la librairie de programmation Allegro. Summary(it): Programmi di utilità aggiuntivi per la libreria Allegro. +Summary(de): Zusätzliche Hilfprogramme für die Allegro Bibliothek. Group: Development/Other Prereq: allegro Autoreq: on @@ -104,6 +117,12 @@ ed in altri tipi di programmazione multimediale. Questo pacchetto contiene programmi di utilità aggiuntivi utili allo sviluppo di programmi con Allegro. +%description tools -l de +Allegro ist eine plattformübergreifende Bibliothek zur Verwendung in +Computerspielen und anderen Formen von Multimediaprogrammierung. +Dieses Paket enthält Programme, die für die Entwicklung von +Allegro Programmen hilfreich sind. + %prep %setup -q @@ -183,8 +202,11 @@ rm -rf %{buildroot} %{_bindir}/textconv %changelog +* Fri Feb 07 2003 Philipp Thomas 4.0.3-1 +- added German translation + * Fri Dec 07 2001 Angelo Mottola 4.0.0-1 -- added italian translation +- added Italian translation * Tue Oct 02 2001 Peter Wang 3.9.39-1 - icon courtesy of Johan Peitz diff --git a/misc/askq.c b/misc/askq.c index d57e9acfca..643d11c122 100644 --- a/misc/askq.c +++ b/misc/askq.c @@ -4,7 +4,7 @@ */ -#include +#include #include @@ -13,26 +13,26 @@ int main(int argc, char *argv[]) { int i; - cputs("\r\n"); + puts("\n"); for (i=1; i 1) - putch(' '); + putc(' ', stdout); - cputs(argv[i]); + puts(argv[i]); } - cputs("? [y/n] "); + puts("? [y/n] "); for (;;) { - i = getch(); + i = getc(stdin); if ((tolower(i) == 'y') || (tolower(i) == 'n')) { - putch(i); - cputs("\r\n\n"); + putc(i, stdout); + puts("\n\n"); return (tolower(i) == 'y') ? 0 : 1; } else - putch(7); + putc(7, stdout); } } diff --git a/misc/deplib.sh b/misc/deplib.sh index 4c9fef5035..9e3e4454eb 100755 --- a/misc/deplib.sh +++ b/misc/deplib.sh @@ -23,7 +23,8 @@ write_code() { echo "\$(LIBDIR)/${sharelib}: ${shareobj}" echo " rm -f \$@" # gf: This bit is obviously gcc-specific - echo " gcc -shared -o \$@ ${shareobj} \$(LDFLAGS) -Wl,-soname,lib${1}.so.\$(shared_major_minor) \$(LIBS)" + # eb: Yes, but the GNU C Compiler doesn't always spell 'gcc' + echo " \$(CC) -shared -o \$@ ${shareobj} \$(LDFLAGS) -Wl,-h,lib${1}.so.\$(shared_major_minor) \$(LIBS)" echo "" echo "\$(LIBDIR)/${unsharelib}: ${unshareobj}" echo " rm -f \$@" @@ -31,9 +32,12 @@ write_code() { } +# See src/unix/udummy.c for the rationale sources=`echo $* | sed 's,[^ ]*/,,g'` sharable_sources=`echo $sources | sed 's,[^. ]*\.s,,g'` +sharable_sources=`echo $sharable_sources | sed 's,[ ]*udummy\.c,,g'` unsharable_sources=`echo $sources | sed 's,[^. ]*\.[^s],,g'` +unsharable_sources=`echo $unsharable_sources udummy.c` objects=`echo $sources | sed 's,\.[^. ]*,,g'` sharable_objects=`echo $sharable_sources | sed 's,\.[^. ]*,,g'` diff --git a/misc/depmod.sh b/misc/depmod.sh index e4a3a77dbd..ea9c95f9b2 100755 --- a/misc/depmod.sh +++ b/misc/depmod.sh @@ -33,9 +33,9 @@ echo "" # module rule echo "\$(LIBDIR)/$module: \$(${objlist})" if test "$modlibs" = "--"; then - echo " gcc -shared \$(ALLEGRO_SHAREDLIB_CFLAGS) -o \$@ \$(${objlist}) \$(LDFLAGS)" + echo " \$(CC) -shared \$(ALLEGRO_SHAREDLIB_CFLAGS) -o \$@ \$(${objlist}) \$(LDFLAGS)" else - echo " gcc -shared \$(ALLEGRO_SHAREDLIB_CFLAGS) -o \$@ \$(${objlist}) \$(LDFLAGS) $modlibs" + echo " \$(CC) -shared \$(ALLEGRO_SHAREDLIB_CFLAGS) -o \$@ \$(${objlist}) \$(LDFLAGS) $modlibs" fi echo "" diff --git a/misc/findtext.sh b/misc/findtext.sh index 5934248aff..6410ddea04 100755 --- a/misc/findtext.sh +++ b/misc/findtext.sh @@ -9,9 +9,13 @@ echo "Scanning for translation strings..." -echo "language_name = English" > entext.cfg -echo >> entext.cfg -echo "[language]" >> entext.cfg +if [ -e resource/language/entext.cfg ]; then + cat resource/language/entext.cfg > entext.cfg +else + echo "language_name = English" > entext.cfg + echo >> entext.cfg + echo "[language]" >> entext.cfg +fi grep get_config_text src/*.c src/*/*.c | \ sed -n -e "s/.*get_config_text *(\"\(.*\)\").*/\1/p" \ diff --git a/misc/fixdll.sh b/misc/fixdll.sh index 2ebd75b018..8ea00cce85 100644 --- a/misc/fixdll.sh +++ b/misc/fixdll.sh @@ -89,11 +89,11 @@ if [ -e misc/dllsyms.lst ]; then # test for new symbols comm -2 -3 _allsyms2.tmp _dllsyms2.tmp > _difsyms2.tmp if [ -s _difsyms2.tmp ]; then - echo " "`wc --lines < _difsyms2.tmp`" symbols added:" + echo " "`wc --lines < _difsyms2.tmp`" symbol(s) added:" cat _difsyms2.tmp cat misc/dllsyms.lst _difsyms2.tmp > _alldef3.tmp else - echo " no symbols added" + echo " no symbol added" cp misc/dllsyms.lst _alldef3.tmp fi else diff --git a/misc/fixver.sh b/misc/fixver.sh index b60d90c97b..f75ab470fd 100755 --- a/misc/fixver.sh +++ b/misc/fixver.sh @@ -58,7 +58,7 @@ FILETYPE VFT_DLL VALUE "FileDescription", "Allegro\000" VALUE "FileVersion", "$verstr\000" VALUE "InternalName", "ALLEG$1$2\000" - VALUE "LegalCopyright", "Copyright © 1994-2001 Allegro Developers\000\000" + VALUE "LegalCopyright", "Copyright © 1994-$year Allegro Developers\000\000" VALUE "OriginalFilename", "ALLEG$1$2.DLL\000" VALUE "ProductName", "Allegro\000" VALUE "ProductVersion", "$verstr\000" @@ -98,7 +98,7 @@ cp makefile.ver fixver.tmp sed -f fixver.sed fixver.tmp > makefile.ver # patch allegro-config.in, allegro-config.qnx -echo "s/version=.*/version=$1.$2.$3/" >> fixver.sed +echo "s/version=[0-9].*/version=$1.$2.$3/" >> fixver.sed echo "Patching misc/allegro-config.in..." cp misc/allegro-config.in fixver.tmp diff --git a/misc/mkunixdists.sh b/misc/mkunixdists.sh index 507828e0f2..0bddb34127 100755 --- a/misc/mkunixdists.sh +++ b/misc/mkunixdists.sh @@ -79,12 +79,16 @@ echo "Stripping to form end-user distribution" (cd include && rm -f bealleg.h qnxalleg.h macalleg.h winalleg.h) (cd misc && rm -f cmplog.pl dllsyms.lst findtext.sh fixpatch.sh fixver.sh) (cd misc && rm -f allegro-config-qnx.sh zipup.sh zipwin.sh *.bat *.c) + mkdir .saveme + cp readme.txt docs/build/unix.txt docs/build/linux.txt .saveme rm -rf demo docs examples resource setup tests tools rm -f AUTHORS CHANGES THANKS *.txt fix* indent* readme.* allegro.mft rm -f makefile.all makefile.be makefile.qnx makefile.bcc makefile.dj rm -f makefile.mgw makefile.mpw makefile.vc makefile.wat makefile.tst rm -f xmake.sh rm -f keyboard.dat language.dat + mv .saveme/* . + rmdir .saveme { # Tweak makefile.in cp makefile.in makefile.old && cat makefile.old | diff --git a/misc/zipup.sh b/misc/zipup.sh index 814691b429..9dc108b62a 100755 --- a/misc/zipup.sh +++ b/misc/zipup.sh @@ -35,9 +35,13 @@ fi for file in makefile.*; do mv $file _tmpfile tr -d \\\r < _tmpfile > $file + touch -r _tmpfile $file rm _tmpfile done +# fix some wrong permissions in the CVS repository +chmod +x misc/asmdef.sh misc/fixdll.sh + # delete all generated files echo "Cleaning the Allegro tree..." @@ -55,12 +59,14 @@ find . -name '*~' -exec rm -f {} \; utod() { for file in $*; do - if echo $file | grep -q "^\.\.\./"; then + if echo $file | grep "^\.\.\./" >/dev/null; then # files like .../*.c recurse into directories (emulating djgpp libc) spec=$(echo $file | sed -e "s/^\.\.\.\///") find . -type f -name "$spec" -exec perl -p -i -e 's/([^\r]|^)\n/\1\r\n/' {} \; else - perl -p -i -e "s/([^\r]|^)\n/\1\r\n/" $file + perl -p -e "s/([^\r]|^)\n/\1\r\n/" $file > _tmpfile + touch -r $file _tmpfile + mv _tmpfile $file fi done } @@ -252,4 +258,6 @@ fi echo "Done!" +echo "Please note that your files are now in DOS format, so you might want" +echo "to run \"fix.sh unix\" now." diff --git a/misc/zipwin.sh b/misc/zipwin.sh index 40f17c4a2b..b828f330a2 100755 --- a/misc/zipwin.sh +++ b/misc/zipwin.sh @@ -1,9 +1,12 @@ #! /bin/sh # # Shell script to create a Windows binary distribution. This will -# compile the DLL files using MSVC, generate the batch file and associated -# helpers needed for end users to build the example programs, and finally -# zip up the results. +# compile the DLL files using MSVC or Cygwin, generate the batch file and +# associated helpers needed for end users to build the example programs, +# and finally zip up the results. +# +# Note! If you use Cygwin to generate the DLLs make sure you have set up +# your MINGDIR and ALLEGRO_USE_CYGWIN environment variables correctly. # # It should be run from the root of the Allegro directory, eg. # bash misc/zipwin.sh, so that it can find misc/vcvars.c and misc/askq.c. @@ -11,17 +14,24 @@ # check we have a filename, and strip off the path and extension from it if [ $# -ne 1 ]; then - echo "Usage: zipwin archive_name" 1>&2 + echo "Usage: zipwin " 1>&2 exit 1 fi name=$(echo "$1" | sed -e 's/.*[\\\/]//; s/\.zip//') -# check that MSVC is available -if [ "$MSVCDIR" = "" -a "$MSDEVDIR" = "" ]; then - echo "You need to set up MSVC (run vcvars32.bat) before running this script" 1>&2 - exit 1 +# check that MSVC or Cygwin is available +if [ "$ALLEGRO_USE_CYGWIN" = "1" ]; then + if [ "$MINGDIR" = "" ]; then + echo "You need to set up Cygwin before running this script" 1>&2 + exit 1 + fi +else + if [ "$MSVCDIR" = "" ]; then + echo "You need to set up MSVC (run vcvars32.bat) before running this script" 1>&2 + exit 1 + fi fi @@ -32,8 +42,12 @@ if [ ! -f include/allegro.h ]; then fi -# convert Allegro to MSVC format -./fix.sh msvc --utod +# convert Allegro to MSVC or Cygwin format +if [ "$ALLEGRO_USE_CYGWIN" = "1" ]; then + ./fix.sh mingw32 --dtou +else + ./fix.sh msvc --utod +fi # delete all generated files @@ -46,7 +60,7 @@ misc/fixdll.sh # generate dependencies -echo "Generating MSVC dependencies..." +echo "Generating dependencies..." make.exe depend @@ -62,14 +76,22 @@ ver=`sed -n -e "s/LIBRARY_VERSION = \(.*\)/\1/p" makefile.ver` # compile vcvars echo "Compiling vcvars.exe..." -cl -nologo misc/vcvars.c advapi32.lib -rm vcvars.obj +if [ "$ALLEGRO_USE_CYGWIN" = "1" ]; then + gcc -Wl,--subsystem,console -o vcvars.exe misc/vcvars.c -ladvapi32 +else + cl -nologo misc/vcvars.c advapi32.lib + rm vcvars.obj +fi # compile askq echo "Compiling askq.exe..." -cl -nologo misc/askq.c -rm askq.obj +if [ "$ALLEGRO_USE_CYGWIN" = "1" ]; then + gcc -Wl,--subsystem,console -o askq.exe misc/askq.c +else + cl -nologo misc/askq.c + rm askq.obj +fi # generate the setup code for msvcmake.bat (this bit checks for vcvars32, @@ -87,7 +109,6 @@ rem Generated by misc/zipwin.sh if not exist include\\allegro.h goto no_allegro if not "%MSVCDIR%" == "" goto got_msvc -if not "%MSDEVDIR%" == "" goto got_msvc if "%VCVARS%" == "" goto no_vcvars @@ -121,6 +142,18 @@ echo Compiling test and example programs END_OF_BATCH +# If running Cygwin, we need to do some trickery +if [ "$ALLEGRO_USE_CYGWIN" = "1" ]; then + ./fix.sh msvc --utod + export MSVCDIR="MSVCDIR" + make.exe depend UNIX_TOOLS=1 + + echo "Fooling the MSVC makefile ..." + cp lib/mingw32/*.dll lib/msvc/ + make.exe -t lib +fi + + # SED script for converting make -n output into a funky batch file cat > _fix1.sed << END_OF_SED @@ -134,7 +167,7 @@ s/obj\/msvc\/runner.exe // s/\\//\\\\/g # make sure were are using command.com copy, rather than cp -s/^.*cat tools.*msvc.plugins.h/copy tools\\\\plugins\\\\*.inc obj\\\\msvc\\\\plugins.h/ +s/^.*cat tools.*msvc.plugins.h/copy \/B tools\\\\plugins\\\\*.inc obj\\\\msvc\\\\plugins.h/ # add blank lines, to make the batch output more readable s/^\([^@]*\)$/\\ @@ -175,6 +208,9 @@ make.exe -n | \ rm _fix1.sed _fix2.sed +if [ "$ALLEGRO_USE_CYGWIN" = "1" ]; then + unset MSVCDIR +fi # finish writing msvcmake.bat (this bit asks whether to install the headers, # libs, and DLL files) @@ -182,7 +218,6 @@ cat >> msvcmake.bat << END_OF_BATCH askq.exe Would you like to copy the headers and libs to your MSVC directories if errorlevel 1 goto no_lib_copy -if not "%MSDEVDIR%" == "" set _VC_DIR_=%MSDEVDIR% if not "%MSVCDIR%" == "" set _VC_DIR_=%MSVCDIR% echo Copying libraries @@ -194,11 +229,25 @@ copy include\\allegro.h "%_VC_DIR_%\\include" echo Copying winalleg.h copy include\\winalleg.h "%_VC_DIR_%\\include" -echo Creating internal header directory +echo Copying module headers md "%_VC_DIR_%\\include\\allegro" +copy include\\allegro\\*.h "%_VC_DIR_%\\include\\allegro" + +echo Copying inline headers +md "%_VC_DIR_%\\include\\allegro\\inline" +copy include\\allegro\\inline\\*.inl "%_VC_DIR_%\\include\\allegro\\inline" echo Copying internal headers -copy include\\allegro\\*.h "%_VC_DIR_%\\include\\allegro" +md "%_VC_DIR_%\\include\\allegro\\internal" +copy include\\allegro\\internal\\*.h "%_VC_DIR_%\\include\\allegro\\internal" + +echo Copying platform headers +md "%_VC_DIR_%\\include\\allegro\\platform" +copy include\\allegro\\platform\\aintwin.h "%_VC_DIR_%\\include\\allegro\\platform" +copy include\\allegro\\platform\\al386vc.h "%_VC_DIR_%\\include\\allegro\\platform" +copy include\\allegro\\platform\\almsvc.h "%_VC_DIR_%\\include\\allegro\\platform" +copy include\\allegro\\platform\\alplatf.h "%_VC_DIR_%\\include\\allegro\\platform" +copy include\\allegro\\platform\\alwin.h "%_VC_DIR_%\\include\\allegro\\platform" set _VC_DIR_= @@ -297,6 +346,12 @@ END_OF_README echo "Creating $name.zip..." cd .. if [ -f $name.zip ]; then rm $name.zip; fi + +if [ "$ALLEGRO_USE_CYGWIN" = "1" ]; then + unix2dos allegro/$name.txt + unix2dos allegro/msvcmake.bat +fi + zip -9 $name.zip allegro/$name.txt allegro/msvcmake.bat allegro/vcvars.exe allegro/askq.exe allegro/lib/msvc/*.dll diff --git a/modules.lst b/modules.lst index c4ccf9801b..4f4ab4739e 100644 --- a/modules.lst +++ b/modules.lst @@ -5,5 +5,6 @@ alleg-fbcon.so alleg-svgalib.so alleg-dga2.so alleg-esddigi.so +alleg-artsdigi.so alleg-alsadigi.so alleg-alsamidi.so diff --git a/readme.txt b/readme.txt index 1fbd7f25f1..1a78bad581 100644 --- a/readme.txt +++ b/readme.txt @@ -6,12 +6,12 @@ \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/ \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/ /\____/ - \_/__/ Version 4.0.1 (CVS) + \_/__/ Version 4.0.3 (CVS) A game programming library. - By Shawn Hargreaves, Dec 15, 2001. + By Shawn Hargreaves, Jul 04, 2002. See the AUTHORS file for a complete list of contributors. @@ -70,8 +70,10 @@ QNX - see docs/build/qnx.txt MacOS/MPW - see docs/build/macos.txt - General API information can be found in docs/txt/allegro.txt, which is - also available in HTML, TexInfo, and RTF format in the docs directory. + General API information can be found in the main manual, usually referred + to as docs/txt/allegro.txt or simply allegro.txt throughout this document + and which is also available in HTML, TexInfo, and RTF format in the docs + directory. @@ -237,77 +239,89 @@ The latest version of Allegro can always be found on the Allegro homepage, http://alleg.sourceforge.net/. - There are three mailing lists for Allegro-related discussion, each with a + There are three mailing lists for Allegro-related discussion, each with a slightly different purpose. - [AL] - Allegro - allegro@canvaslink.com. + [AL] - Allegro main - http://lists.sourceforge.net/lists/listinfo/alleg-main This list is for any kind of discussion about Allegro, questions about Allegro, reports of problems with Allegro, suggestions for new features, announcements of programs written using Allegro, etc. General rule: if it has to do with Allegro, you can post it here. If not, go somewhere else (for example comp.os.msdos.djgpp, comp.lang.c, - or the AGP list). + or the online forums at http://www.allegro.cc . - [AGP] - Allegro Games Programming - agp@canvaslink.com. - - This list is for discussion of the more general kinds of issue that - may arise while writing a game using Allegro, but that are not - specifically related to Allegro itself. For example if you wanted to - talk about algorithms for scrolling a tile map, that would be - off-topic in the main Allegro list, but appropriate to discuss here. - - [AD] - Allegro Developers - conductors@canvaslink.com. + [AD] - Allegro developers - http://lists.sourceforge.net/lists/listinfo/alleg-developers This list is for the people currently working on Allegro, who use it to coordinate their efforts. You can use this address if you need to contact the developers directly, for example to submit some new code - that you have written or to report a bug. Unlike the other lists, we - will be really rude to people who post inappropriate material here, so - please don't do that! Do not send tech-support questions to this list. - Don't post bug reports here unless you are 100% certain they aren't - your fault (if you are in any doubt, use the main Allegro list - instead, which is read by most of the same people who are subscribed - here). The Allegro development is a completely open process, and - everyone is welcome to drop by, have a listen, and start contributing - code patches. This list is for working rather than talking, though, so - please don't do anything that might get in our way. - - To subscribe to one of the lists, write to listserv@canvaslink.com with - the text "subscribe {list} myname" in the body of your message, where - {list} is one of allegro, agp, or conductors. - - To remove yourself from a list, write to listserv@canvaslink.com with the - text "unsubscribe {list}" in the body of your message, where {list} is - one of allegro, agp, or conductors. - - Note that the address for subscribing and unsubscribing is NOT the same - as the regular address for posting messages! Please remember to send your - administration requests to the listserv, rather than to the list itself. - - To send a message to one of the lists, write to allegro@canvaslink.com, - agp@canvaslink.com, or conductors@canvaslink.com. You don't need to be - subscribed to these lists before you can post to them, but it is a good - idea to subscribe in order to see the replies. It is ok to post code - contributions to the developers list without being subscribed, though, as - long as you mention this in your mail so we will know to reply by private - email. Before posting tech-support questions to the Allegro list, please - take a moment to read the guidelines in docs/txt/help.txt. - - You can search through the mailing list archives using the engine on - http://www.canvaslink.com/allegro/search.htm. - - Note: please don't send messages in HTML format. The increased size - places an unnecessary load on the server, and many subscribers have a - hard time reading these posts. - - Note: please do not crosspost between these lists. Choose the most - appropriate one for your message, and then send it only to that list. - - Note: please don't send large binary attachments to any of the lists. - Upload your files to a website and then post the URL, or if you can't do - that, post an annoucement asking people to write to you privately, and - then send the file by individual email to whoever responds. + that you have written or to report a bug. + + Unlike the other lists, we will be really rude to people who post + inappropriate material here, so please don't do that! Do not send + tech-support questions to this list. Don't post bug reports here unless + you are 100% certain they aren't your fault (if you are in any doubt, + use the main Allegro list instead, which is read by most of the same + people who are subscribed here). + + The Allegro development is a completely open process, and everyone is + welcome to drop by, have a listen, and start contributing code patches. + This list is for working rather than talking, though, so please don't + do anything that might get in our way. + + [Alleg5] - Allegro 5 - http://lists.sourceforge.net/mailman/listinfo/alleg-bigfive + + Just as described in the future (http://alleg.sourceforge.net/future.html) + section, the next big version of Allegro will feature at least a + complete API rewrite to fix all the quirks it has now. This list is for + discussing the future API, proposing new functions or modifying the + behaviour of actual ones, and posting code with the implementation if + it's possible to do so. + + To subscribe to one of the three lists, simply go to it's web page and use + the online forms to subscribe yourself. You can remove yourself from a + list going to the same page above, which can be used to remind you of your + password too, in case you have forgotten it. + + To send a message to one of the lists, write to + alleg-main@lists.sourceforge.net, alleg-developers@lists.sourceforge.net, + or alleg-bigfive@lists.sourceforge.net. You don't need to be subscribed to + these mailing lists before you can post there, but it is a good idea to + subscribe in order to see the replies. + + Before posting tech-support questions to the Allegro list, please take a + moment to read the guidelines in docs/txt/help.txt. See docs/txt/ahack.txt + for information about the style of code we use, and how to create your + patches. + + If you want to search through the archives of any of those mailing lists, + you will have to check the available options at + http://alleg.sourceforge.net/maillist.html . + + Please don't send messages in HTML format. The increased size places an + unnecessary load on the server, and many subscribers have a hard time + reading these posts. + + Please do not crosspost between these lists. Choose the most appropriate + one for your message, and then send it only to that list. + + Please don't send large binary attachments to any of the lists, they will + be rejected by the size limit filter, which is set to 100KB for the + developers mailing list, and 40KB for the others. Upload your files to a + website and then post the URL, or if you can't do that, post an + announcement asking people to write to you privately, and then send the + file by individual email to whoever responded. + + Please use English in your messages. You could eventually post messages in + whatever language you prefer, but that would terribly limit the chances of + getting a useful answer. + + Remember that the RFC 1855: netiquette guidelines + (http://www.rfc-editor.org/rfc/rfc1855.txt) describes other general + guidelines you should follow as a correct internet user (in mailing lists + and other places as well), and provides more verbose descriptions and + explanations about why you should follow the above guidelines. My personal address is shawn@talula.demon.co.uk, but please try to avoid mailing me personally about anything other than personal issues. Use the diff --git a/resource/keyboard/cf.cfg b/resource/keyboard/cf.cfg new file mode 100644 index 0000000000..89b6693880 --- /dev/null +++ b/resource/keyboard/cf.cfg @@ -0,0 +1,109 @@ +keyboard_name = Canada (Français) + +[key_escape] +accent1 = 65 +accent2 = 66 +accent3 = 69 +accent4 = 66 +accent1_flag = 0 +accent2_flag = 1 +accent3_flag = 0 +accent4_flag = 0 + +[key_ascii] +key60 = 35 +key65 = 128 +key66 = 168 +key70 = 60 +key71 = 171 +key74 = 233 + +[key_capslock] +key60 = 35 +key70 = 60 +key74 = 201 +key71 = 171 + +[key_shift] +key29 = 34 +key30 = 47 +key33 = 63 +key60 = 124 +key65 = 128 +key66 = 168 +key69 = 96 +key70 = 62 +key71 = 187 +key72 = 39 +key73 = 34 +key74 = 201 + +[key_altgr] +key27 = 188 +key28 = 177 +key29 = 64 +key30 = 163 +key31 = 162 +key32 = 164 +key33 = 172 +key34 = 124 +key35 = 178 +key36 = 179 +key60 = 92 +key61 = 189 +key62 = 190 +key65 = 91 +key66 = 93 +key68 = 126 +key69 = 123 +key70 = 125 +key71 = 176 +key72 = 175 +key73 = 173 +key74 = 180 + +[key_accent1_lower] +key1 = 226 +key5 = 234 +key9 = 238 +key15 = 244 +key21 = 251 + +[key_accent1_upper] +key1 = 194 +key5 = 202 +key15 = 212 +key21 = 219 + +[key_accent2_lower] +key1 = 228 +key5 = 235 +key9 = 239 +key15 = 246 +key21 = 252 +key25 = 255 + +[key_accent2_upper] +key1 = 196 +key5 = 203 +key15 = 214 +key21 = 220 + +[key_accent3_lower] +key1 = 224 +key5 = 232 +key15 = 242 +key21 = 249 + +[key_accent3_upper] +key1 = 192 +key5 = 200 +key9 = 204 +key15 = 210 +key21 = 217 + +[key_accent4_lower] +key3 = 231 + +[key_accent4_upper] +key3 = 199 diff --git a/resource/keyboard/de.cfg b/resource/keyboard/de.cfg index 41fd32abe7..844cd67ed9 100644 --- a/resource/keyboard/de.cfg +++ b/resource/keyboard/de.cfg @@ -77,3 +77,4 @@ key17 = 64 key66 = 126 key13 = 181 key71 = 124 +key5 = 8364 diff --git a/resource/keyboard/fr.cfg b/resource/keyboard/fr.cfg index 7bc6ab5fe9..b663985eb0 100644 --- a/resource/keyboard/fr.cfg +++ b/resource/keyboard/fr.cfg @@ -126,6 +126,7 @@ key27 = 64 key61 = 93 key62 = 125 key66 = 36 +key5 = 8364 [key_accent1_lower] key17 = 226 diff --git a/resource/language/catext.cfg b/resource/language/catext.cfg new file mode 100644 index 0000000000..313e4cafdf --- /dev/null +++ b/resource/language/catext.cfg @@ -0,0 +1,263 @@ +language_name = Català + +[language] +A = A +Aim = Eix +Aim_X = Eix X +Aim_y = Eix y +Analogue_Buttons = Butons analògics +Apple_SoundManager_%d.x_%d_hz,_%d-bit,_%s_,_%d_ = Apple SoundManager %d.x %d hz, %d-bit, %s , %d +approx. = aprox. +Autodetect = Autodetectar +Auto_fullscreen = Mode pantalla completa automàtic +Auto_windowed = Mode en finestra automàtic +AWE32_detection_failed_on_port_0x%04x = Detecció fallida de la AWE32 en el port 0x%04x +AWE32_driver:_had_trouble_with_the_embedded_data = El controlador de la AWE32 ha tingut problemes amb les dades enllaçades +AWE32_not_detected = AWE32 no detectada +B1 = B1 +B2 = B2 +B3 = B3 +B4 = B4 +B5 = B5 +B6 = B6 +B7 = B7 +B8 = B8 +Back = Enrera +Bad_VBE/AF_driver_ID_string = Cadena d'identificació del controlador VBE/AD invàlida +Banked_framebuffer_not_available = Framebuffer per bancs no disponible +B = B +BLASTER_environment_variable_has_no_E_section = La variable d'entorn BLASTER no te secció E +BLASTER_environment_variable_not_set = Variable d'entorn BLASTER no definida +Blue = Azul +Button_1 = Botón 1 +Button_2 = Botón 2 +Button_3 = Botón 3 +Button_4 = Botón 4 +Button_5 = Botón 5 +Cancel = Cancel·lar +Cannot_access_the_framebuffer = Impossible accedir al framebuffer +Can_not_allocate_audio_buffer = Impossible reservar el buffer d'audio +Cannot_create_direct_context = Impossible crear un contexte directe +Cannot_create_offscreen_context = Imposible crear un contexte fora de pantalla +Can_not_create_XImage = Impossible crear una XImage +Can_not_do_double_buffered_sound = Impossible utilitzar un doble buffer de so +Cannot_enable_linear_addressing = Impossible activar el direccionament linial +Can_not_get_channel_setup = Impossible obtenir la configuració del canal +Can_not_get_information_about_sound = Impossible obtenir informació del so +Can_not_get_video_mode_settings = Impossible obtenir els paràmetres dels modes de video +Can_not_grab_keyboard = Impossible obtenir el control del teclat +Can_not_grab_mouse = Impossible obtenir el control del ratolí +Can_not_init_software_mixer = Impossible iniciar el mesclador per software +Can_not_install_colormap = Impossible instal·lar el mapa de colors +Can_not_obtain_user_name = Impossible obtenir el nombre d'usuari +Can_not_open_card/pcm_device = Impossible accedir a la tarja/controladora PCM +Can_not_open_framebuffer = Impossible accedir al framebuffer +Can_not_query_DirectVideo = Impossible interrogar DirectVideo +Can_not_set_channel_parameters = Impossible definir els paràmetros del canal +Can_not_set_video_mode = Impossible activar el modw de video +Cannot_start_direct_context = Impossible iniciar el contexte directe +Can_not_switch_to_DGA_mode = Impossible canviar al mode DGA +Can't_find_VBEAF.DRV = Impossible trobar VBEAF.DRV +Can't_make_linear_screen_bitmap = Impossible crear un bitmap linial de pantalla +Can't_map_framebuffer = Impossible direccionar el framebuffer +Can't_map_memory_for_VBE/AF = Impossible direccionar la memòria per VBE/AF +Can't_open_framebuffer_%s = Impossible accedir al framebuffer %s +Can't_use_SB_MIDI_interface_and_DSP_at_the_same_time = Impossible usar l'interfaç MIDI y el DSP de la SB al mateix temps +Card__%d,_device__%d:_%d_bits,_%s,_%d_bps,_%s = Tarjeta #%d, dispositivo #%d: %d bits, %s, %d bps, %s +C = C +C_Down = C Avall +Centre_the_hat = Centri el hat del joystick +Circle = Circle +C_Left = C Esquerra +colors = colors +Could_not_find_GRIP.GLL = Impossible trobar GRIP.GLL +Could_not_initialize_GrIP_system = Impossible iniciar el sistema GrIP +C_Right = C Dreta +Cross = Creu +C_Up = C Adalt +Device_connected_is_not_a_Wingman_Warrior = El dispositiu conectat no és un Wingman Warrior +DGA_1.0_is_required = Es requireix DGA 1.0 +DGA_2.0_or_newer_is_required = Es requireix DGA 2.0 o superior +DGA_extension_is_not_supported = Extensió DGA no suportada +Dial = Marcar +Digital_input_driver_not_found = Controlador d'entrada digital no trobat +Digital_sound_driver_not_found = Controlador de so digital no trobat +DIGMID_patch_set_not_found = Fitxer patch per a DIGMID no trobat +Direction_Pad = Pad de direcció +Direction_Pad_X = Eix X del pad de direcció +Direction_Pad_Y = Eix Y del pad de direcció +DirectVideo_is_not_supported = DirectVideo no suportat +DrawSprocket_%d_x_%d,_%dbpp,_%dhz = DrawSprocket %d x %d, %dbpp, %dhz +Dual_OPL2_synths = Sintetitzador OP2 dual +Error_finding_our_VT:_%s = Impossible trobar el nostre VT: %s +Error_reading_.IBK_file_'%s' = Error de lectura del fitxer .IBK '%s' +Error_setting_VGA_video_mode = Error activant el mode de video VGA +ESS_AudioDrive_not_found = ESS AudioDrive no trobat +ES%X_(%d_hz)_on_port_%X,_using_IRQ_%d_and_DMA_channel_%d = ES%X (%d hz) al port %X, usant el IRQ %d y el canal DMA %d +failed_on_channel_initialization = error iniciant canal +Failed_to_init_digital_input_driver = Error iniciant el controlador d'entrada digital +Failed_to_init_digital_sound_driver = Error iniciant el controlador de sonido digital +Failed_to_init_MIDI_input_driver = Error iniciant el controlador d'entrada MIDI +Failed_to_init_MIDI_music_driver = Error iniciant el controlador musical MIDI +Failed_to_set_VBE/AF_mode = Error activant el mode VBE/AF +Fatal_error:_unable_to_activate_the_Allegro_system = Error fatal: impossible activar el sistema d'Allegro +Fatal_error:_unable_to_set_GFX_SAFE = Error fatal: impossible activar el mode GFX_SAFE +Framebuffer_ioctl()_failed = Fallida a l'usar ioctl() en el framebuffer +Framebuffer_resolution_not_available = Resolució del framebuffer no disponible +Getting_buffer_size:_%s = Obtenint el tamany del buffer: %s +Graphics_Mode = Mode gràfic +Green = Verd +Hardware_acceleration_not_available = Acceleració per hardware no disponible +Hardware_scrolling_not_supported = Scroll per hardware no disponible +Hat = Hat del joystick +I_Button = Botó I +IF-SEGA2/PCI:__create_linear_mapping_error = IF-SEGA2/PCI: error de _create_linear_mapping +IF-SEGA2/PCI:__create_selector_error = IF-SEGA2/PCI: error de _create_selector +IF-SEGA2/PCI:_device_not_found = IF-SEGA2/PCI: dispositiu no trobat +IF-SEGA2/PCI:_read_configuration_dword_error = IF-SEGA2/PCI: error al llegir la paraula doble de configuració +II_Button = Botó II +Input_is_not_supported = Entrada no suportada +Insufficient_%s_voices_available = Insuficients veus (%s) disponibles +Insufficient_video_memory = Memòria de video insuficient +Internal_error = Error intern +L1_Button = Botó L1 +L1 = L1 +L2 = L2 +L3 = L3 +Left = Esquerra +Left_Stick = Palanca esquerra +Left_Stick_X = Eix X de la palanca esquerra +Left_Stick_Y = Eix Y de la palanca esquerra +Linear_framebuffer_not_available = Framebuffer linial no disponible +L = L +MIDI_input_driver_not_found = Controlador d'entrada MIDI no trobat +MIDI = MIDI +MIDI_music_driver_not_found = Controlador musical MIDI no trobat +M = M +Mode-X_only_supports_8_bit_color = El Mode-X solament suporta color de 8 bits +Move_stick_2_to_the_bottom_right = Mogui la palanca 2 del joystick abaix y a la dreta +Move_stick_2_to_the_top_left = Mogui la palanca 2 del joystick amunt y a l'esquerra +Move_stick_to_the_bottom_right = Mogui el joystick abaix y a la derecha +Move_stick_to_the_top_left = Mogui el joystick amunt y a la izquierda +Move_the_hat_down = Mogui el hat del joystick abaix +Move_the_hat_left = Mogui el hat del joystick a l'esquerra +Move_the_hat_right = Mogui el hat del joystick a la dreta +Move_the_hat_up = Mogui el hat del joystick amunt +MPU-401_and_%s_conflict_over_IRQ_%d = Hi ha un conflicte a l'IRQ %d entre el MPU-401 y %s +MPU-401_MIDI_interface_on_port_%X,_using_IRQ_%d = Interfaç MIDI MPU-401 en el port %X, utilitzant l'IRQ %d +MPU-401_not_found = MPU-401 no trobat +No_GrIP_devices_available = No hi ha controladors GrIP disponibles +No_joysticks_found = No s'ha trobat cap joystick +No = No +No_server = No hi ha servidor +No_support_synth_type_found = No s'ha trobat cap tipus de sintetitzador suportat +Not_a_valid_VGA_resolution = No és una resolució VGA vàlida +Not_a_VGA_mode-X_resolution = No és una resolució VGA Mode-X vàlida +Not_enough_memory = Memòria insuficient +Not_in_stereo_or_mono_mode = No es troba en mode mono ni stereo +no_vsync = sense vsync +No_window = Cap finestra +Obsolete_VBE/AF_version_(need_2.0_or_greater) = Versió VBE/AF obsoleta (necessària 2.0 o superior) +OK = Acceptar +Older_SB_version_detected = Versió de SB antiga detectada +open_NoteAllocator_failed = fallida en NoteAllocator obert +OPL2_synth = Sintetitzador OPL2 +OPL3_synth_not_found = Sintetitzador OPL3 no trobat +OPL3_synth = Sintetitzador OPL3 +OPL_synth_not_found = Sintetitzador OPL no trobat +OSS_output_driver_must_be_installed_before_input_can_be_read = El controlador de sortida OSS s'ha d'instal·lar abans que es pugui llegir l'entrada +Overlays_not_supported = Overlays no suportats +Pad = Pad +PCI_BIOS_not_installed = BIOS PCI no instalada +Position = Posició +Position_x = Posició x +Position_X = Posició X +Position_y = Posició y +R1 = R1 +R2 = R2 +R3 = R3 +Red = Vermell +Required_VGA_mode_not_supported = Mode VGA requerit no trobat +Resolution_not_supported = Resolució no suportada +Right = Dreta +Right_Stick = Palanca dreta +Right_Stick_X = Eix X de la palanca dreta +Right_Stick_Y = Eix Y de la palanca dreta +R = R +SB_AWE32/compatible_on_port_0x%04x = SB AWE32/compatible al port 0x%04x +SB_output_driver_must_be_installed_before_input_can_be_read = El controlador de sortida SB s'ha d'instal·lar abans que es pugui llegir l'entrada +%s:_can_not_open = %s: impossible obrir +SciTech_VBE/AF_drivers_do_not_support_wide_virtual_screens = Els controladores SciTech VBE/AF no suporten pantalles virtuals amples +%s:_%d_bits,_%s,_%d_bps,_%s = %s: %d bits, %s, %d bps, %s +%s_(%d_hz)_on_port_%X,_using_IRQ_%d_and_DMA_channel_%d = %s (%d hz) al port %X, usant l'IRQ %d y el canal DMA %d +%s_does_not_support_audio_input = %s no suporta entrada d'audio +%s_does_not_support_MIDI_input = %s no suporta entrada MIDI +Second_OPL2_synth_not_found = Segon sintetitzador OPL2 no trobat +Select = Seleccionar +Set_throttle_to_maximum = Situi l'accelerador al màxim +Set_throttle_to_minimum = Situi l'accelerador al mínim +Setting_DSP_parameters:_%s = Configurant els paràmetres del DSP: %s +Setting_fragment_size:_%s = Configurant el tamany del fragment: %s +%s_must_only_be_writeable_by_root = %s solament ha de ser accessible per escriptura pel root +%s_not_found = %s no trobat +Software_wavetable_synth = Sintetitzador de software per tabla d'ondes +%s_on_port_%X = %s al port %X +Sound_Blaster_MIDI_interface_on_port_%X = Interfaç Sound Blaster MIDI al port %X +Sound_Blaster_not_found = Sound Blaster no trobada +SoundManager_3.0_or_later_required = Es requireix una SoundManager 3.0 o superior +SoundManager_not_found = SoundManager no trobada +Soundscape_not_found = Soundscape no trobada +Soundscape_%s_(%d_hz)_on_port_%X,_using_IRQ_%d,_DMA_channel_%d_and_waveport_%X = Soundscape %s (%d hz) al port %X, usant l'IRQ %d, el canal DMA %d y el port d'ondes %X +Sound_system_not_installed = Sistema de so no instal·lat +Spinner = Spinner +Square = Cuadrat +%s:_%s = %s: %s +Start = Començar +Stick_%d = Palanca %d +Stick = Palanca +Stick_X = Eix X de la palanca +Stick_Y = Eix Y de la palanca +SWIFT_Device_not_detected = Dispositiu SWIFT no detectat +The_sound_of_silence = El so del silenci +This_driver_needs_local_display = Aquest controlador necessita una pantalla local +This_driver_needs_root_privileges = Aquest controlador necessita privilegis de root +Throttle = Accelerador +Triangle = Triangle +Trigger = Gallet +Twist = Twist +Unable_to_control_VT_switching = Impossible controlar el canvi de VT +Unable_to_find_a_suitable_graphics_driver = Impossible trobar un controlador gràfic adecuat +Unable_to_find_a_usable_VT = Impossible trobar un VT que es pugui utilitzar +Unable_to_map_video_memory = Impossible direccionar la memòria de video +Unable_to_open_%s:_%s = Impossible obrir %s: %s +Unable_to_open = Impossible obrir +Unable_to_reopen_new_console = Impossible reobrir una nova consola +Unsupported_color_depth = Profunditat de color no suportada +Unsupported_memory_layout = Disposició de memòria no suportada +Unsupported_sample_format = Format de sample no suportat +Unsupported_screen_size = Tamany de pantalla no suportat +Unsupported_virtual_resolution = Resolució de pantalla virtual no suportat +unused = no utilitzat +VBE/AF_device_not_present = Controlador VBE/AF absent +VBE/AF_nearptrs_not_supported_on_this_platform = Els punters curts de VBE/AF no són suportats en aquesta plataforma +VBE/AF_Plug_and_Play_initialisation_failed = Fallida a la inicialització de VBE/AF Plug and Play +VBE_%d.0_not_available = VBE %d.0 no disponible +VESA_function_0x4F02_failed = Fallida a la funció VESA 0x4F02 +VESA_function_0x4F06_failed = Fallida a la funció VESA 0x4F06 +VESA_mode_0x100_not_available = Mode VESA 0x100 no disponible +VESA_not_available = VESA no disponible +VESA_protected_mode_interface_not_available = Interfaç VESA en mode protegit no disponible +VGA_only_supports_8_bit_color = VGA solament suporta color de 8 bits +VidMode_extension_is_not_supported = Extensió VidMode no suportada +VidMode_extension_requires_local_display = l'extensió VidMode requireix una pantalla local +Virtual_screen_size_too_large = Tamany de pantalla virtual massa gran +VT_WAITACTIVE_failure = Fallida de VT_WAITACTIVE +Windowed_mode_not_supported = Mode en finestra no suportat +Wingman_Warrior_not_connected = Wingman Warrior no conectat +Xtended_mode_only_supports_640x400 = El mode Xtended solament suporta 640x400 +Xtended_mode_only_supports_8_bit_color = El mode Xtended solament suporta color de 8 bits +X = X +Yellow = Groc +Yes = Si +Y = Y +Z = Z diff --git a/resource/language/entext.cfg b/resource/language/entext.cfg index 5974f18127..d6ea8b5749 100644 --- a/resource/language/entext.cfg +++ b/resource/language/entext.cfg @@ -1,3 +1,5 @@ language_name = English [language] + +allegro_window_close_message = Warning: forcing program shutdown may lead to data loss and unexpected results. It is preferable to use the exit command inside the window. Proceed anyway? diff --git a/resource/language/estext.cfg b/resource/language/estext.cfg index 1d35375e29..d6142ca3de 100644 --- a/resource/language/estext.cfg +++ b/resource/language/estext.cfg @@ -1,6 +1,7 @@ language_name = Español [language] +allegro_window_close_message = Aviso: forzar la terminación del programa puede llevar a pérdidas de datos y resultados inesperados. Es preferible que use el comando salir dentro de la ventana. ¿Continuar de todas formas? A = A Aim = Eje Aim_X = Eje X @@ -12,7 +13,7 @@ Autodetect = Autodetectar Auto_fullscreen = Modo pantalla completa automático Auto_windowed = Modo en ventana automático AWE32_detection_failed_on_port_0x%04x = Detección fallida de la AWE32 en el puerto 0x%04x -AWE32_driver:_had_trouble_with_the_embedded_data = El controlador del a AWE32 tuvo problemas los datos enlazados +AWE32_driver:_had_trouble_with_the_embedded_data = El controlador de la AWE32 tuvo problemas con los datos enlazados AWE32_not_detected = AWE32 no detectada B1 = B1 B2 = B2 @@ -39,22 +40,22 @@ Cannot_access_the_framebuffer = Imposible acceder al framebuffer Can_not_allocate_audio_buffer = Imposible reservar el buffer de audio Cannot_create_direct_context = Imposible crear un contexto directo Cannot_create_offscreen_context = Imposible crear un contexto fuera de pantalla -Can_not_create_XImage = Imposible crear una XImagen +Can_not_create_XImage = Imposible crear una XImage Can_not_do_double_buffered_sound = Imposible utilizar un doble buffer de sonido Cannot_enable_linear_addressing = Imposible activar el direccionamiento lineal Can_not_get_channel_setup = Imposible obtener la configuración del canal Can_not_get_information_about_sound = Imposible obtener información del sonido -Can_not_get_video_mode_settings = Imposible obtener los parámetros de los modos de video -Can_not_grab_keyboard = Imposible de obtener el control del teclado -Can_not_grab_mouse = Imposible de obtener el control del ratón +Can_not_get_video_mode_settings = Imposible obtener los parámetros de los modos de vídeo +Can_not_grab_keyboard = Imposible obtener el control del teclado +Can_not_grab_mouse = Imposible obtener el control del ratón Can_not_init_software_mixer = Imposible iniciar el mezclador por software Can_not_install_colormap = Imposible instalar el mapa de colores Can_not_obtain_user_name = Imposible obtener el nombre de usuario -Can_not_open_card/pcm_device = Imposible acceder a la tarjeta/controlador PCM +Can_not_open_card/pcm_device = Imposible acceder a la tarjeta/controladora PCM Can_not_open_framebuffer = Imposible acceder al framebuffer Can_not_query_DirectVideo = Imposible de interrogar DirectVideo Can_not_set_channel_parameters = Imposible definir los parámetros del canal -Can_not_set_video_mode = Imposible activar el modo de video +Can_not_set_video_mode = Imposible activar el modo de vídeo Cannot_start_direct_context = Imposible iniciar el contexto directo Can_not_switch_to_DGA_mode = Imposible cambiar al modo DGA Can't_find_VBEAF.DRV = Imposible encontrar VBEAF.DRV @@ -63,11 +64,11 @@ Can't_map_framebuffer = Imposible direccionar el framebuffer Can't_map_memory_for_VBE/AF = Imposible direccionar la memoria para VBE/AF Can't_open_framebuffer_%s = Imposible acceder al framebuffer %s Can't_use_SB_MIDI_interface_and_DSP_at_the_same_time = Imposible usar el interfaz MIDI y el DSP de la SB al mismo tiempo -Card__%d,_device__%d:_%d_bits,_%s,_%d_bps,_%s = Tarjeta #%d, periférico #%d: %d bits, %s, %d bps, %s +Card__%d,_device__%d:_%d_bits,_%s,_%d_bps,_%s = Tarjeta #%d, dispositivo #%d: %d bits, %s, %d bps, %s C = C C_Down = C Abajo Centre_the_hat = Centre el hat del joystick -Circle = Circulo +Circle = Círculo C_Left = C Izquierda colors = colores Could_not_find_GRIP.GLL = Imposible encontrar GRIP.GLL @@ -75,7 +76,7 @@ Could_not_initialize_GrIP_system = Imposible iniciar el sistema GrIP C_Right = C Derecha Cross = Cruz C_Up = C Arriba -Device_connected_is_not_a_Wingman_Warrior = El periférico conectado no es un Wingman Warrior +Device_connected_is_not_a_Wingman_Warrior = El dispositivo conectado no es un Wingman Warrior DGA_1.0_is_required = Se requiere DGA 1.0 DGA_2.0_or_newer_is_required = Se requiere DGA 2.0 o superior DGA_extension_is_not_supported = Extensión DGA no soportada @@ -88,18 +89,18 @@ Direction_Pad_X = Eje X del pad de dirección Direction_Pad_Y = Eje Y del pad de dirección DirectVideo_is_not_supported = DirectVideo no soportado DrawSprocket_%d_x_%d,_%dbpp,_%dhz = DrawSprocket %d x %d, %dbpp, %dhz -Dual_OPL2_synths = Sintetizador OP2 doble +Dual_OPL2_synths = Sintetizador OP2 dual Error_finding_our_VT:_%s = Imposible encontrar nuestro VT: %s Error_reading_.IBK_file_'%s' = Error de lectura del fichero .IBK '%s' -Error_setting_VGA_video_mode = Error activando el modo de video VGA +Error_setting_VGA_video_mode = Error activando el modo de vídeo VGA ESS_AudioDrive_not_found = ESS AudioDrive no encontrado ES%X_(%d_hz)_on_port_%X,_using_IRQ_%d_and_DMA_channel_%d = ES%X (%d hz) en el puerto %X, usando el IRQ %d y el canal DMA %d failed_on_channel_initialization = error iniciando canal -Failed_to_init_digital_input_driver = Error iniciando el driver de entrada digital -Failed_to_init_digital_sound_driver = Error iniciando el driver de sonido digital -Failed_to_init_MIDI_input_driver = Error iniciando el driver de entrada MIDI -Failed_to_init_MIDI_music_driver = Error iniciando el driver musical MIDI -Failed_to_set_VBE/AF_mode = Error activando del modo VBE/AF +Failed_to_init_digital_input_driver = Error iniciando el controlador de entrada digital +Failed_to_init_digital_sound_driver = Error iniciando el controlador de sonido digital +Failed_to_init_MIDI_input_driver = Error iniciando el controlador de entrada MIDI +Failed_to_init_MIDI_music_driver = Error iniciando el controlador musical MIDI +Failed_to_set_VBE/AF_mode = Error activando el modo VBE/AF Fatal_error:_unable_to_activate_the_Allegro_system = Error fatal: imposible activar el sistema de Allegro Fatal_error:_unable_to_set_GFX_SAFE = Error fatal: imposible activar el modo GFX_SAFE Framebuffer_ioctl()_failed = Fallo al usar ioctl() en el framebuffer @@ -118,8 +119,9 @@ IF-SEGA2/PCI:_read_configuration_dword_error = IF-SEGA2/PCI: error al leer palab II_Button = Botón II Input_is_not_supported = Entrada no soportada Insufficient_%s_voices_available = Insuficientes voces (%s) disponibles -Insufficient_video_memory = Memoria de video insuficiente +Insufficient_video_memory = Memoria de vídeo insuficiente Internal_error = Error interno +Invalid_virtual_resolution_requested = Resolución virtual solicitada inválida L1_Button = Botón L1 L1 = L1 L2 = L2 @@ -128,17 +130,17 @@ Left = Izquierda Left_Stick = Palanca izquierda Left_Stick_X = Eje X de la palanca izquierda Left_Stick_Y = Eje Y de la palanca izquierda -Linear_framebuffer_not_available = Framebuffer linear no disponible +Linear_framebuffer_not_available = Framebuffer lineal no disponible L = L MIDI_input_driver_not_found = Controlador de entrada MIDI no encontrado MIDI = MIDI MIDI_music_driver_not_found = Controlador musical MIDI no encontrado M = M Mode-X_only_supports_8_bit_color = El Modo-X solo soporta color de 8 bits -Move_stick_2_to_the_bottom_right = Mueva el joystick 2 abajo y a la derecha -Move_stick_2_to_the_top_left = Mueva el joystick 2 arriba y a la izquierda +Move_stick_2_to_the_bottom_right = Mueva la palanca 2 del joystick abajo y a la derecha +Move_stick_2_to_the_top_left = Mueva la palanca 2 del joystick arriba y a la izquierda Move_stick_to_the_bottom_right = Mueva el joystick abajo y a la derecha -Move_stick_to_the_top_left = Mueva la el joystick arriba y a la izquierda +Move_stick_to_the_top_left = Mueva el joystick arriba y a la izquierda Move_the_hat_down = Mueva el hat del joystick abajo Move_the_hat_left = Mueva el hat del joystick a la izquierda Move_the_hat_right = Mueva el hat del joystick a la derecha @@ -217,7 +219,7 @@ Stick_%d = Palanca %d Stick = Palanca Stick_X = Eje X de la palanca Stick_Y = Eje Y de la palanca -SWIFT_Device_not_detected = Periférico SWIFT no detectado +SWIFT_Device_not_detected = Dispositivo SWIFT no detectado The_sound_of_silence = El sonido del silencio This_driver_needs_local_display = Este controlador necesita una pantalla local This_driver_needs_root_privileges = Este controlador necesita privilegios de root @@ -228,11 +230,11 @@ Twist = Twist Unable_to_control_VT_switching = Imposible controlar el cambio de VT Unable_to_find_a_suitable_graphics_driver = Imposible encontrar un controlador gráfico adecuado Unable_to_find_a_usable_VT = Imposible encontrar un VT que se pueda utilizar -Unable_to_map_video_memory = Imposible direccionar la memoria de video +Unable_to_map_video_memory = Imposible direccionar la memoria de vídeo Unable_to_open_%s:_%s = Imposible abrir %s: %s Unable_to_open = Imposible abrir Unable_to_reopen_new_console = Imposible reabrir una nueva consola -Unsupported_color_depth = Profondeur de couleurs non supportée +Unsupported_color_depth = Profundidad de color no soportada Unsupported_memory_layout = Disposición de memoria no soportada Unsupported_sample_format = Formato de sample no soportado Unsupported_screen_size = Tamaño de pantalla no soportado diff --git a/resource/language/frtext.cfg b/resource/language/frtext.cfg index a692daa13a..5778ee75e7 100644 --- a/resource/language/frtext.cfg +++ b/resource/language/frtext.cfg @@ -1,6 +1,7 @@ language_name = Français [language] +allegro_window_close_message = Attention: forcer la sortie du programme peut conduire à la perte de données et à des résultats inattendus. Il est préférable d'utiliser la commande de sortie à l'intérieur de la fenêtre. Voulez-vous poursuivre quand même ? AWE32_detection_failed_on_port_0x%04x = Echec de la détection de l'AWE32 sur le port 0x%04x AWE32_driver:_had_trouble_with_the_embedded_data = Pilote AWE32: problèmes avec les données résidentes AWE32_not_detected = AWE32 non détectée diff --git a/resource/language/nltext.cfg b/resource/language/nltext.cfg new file mode 100644 index 0000000000..5e21b2a43d --- /dev/null +++ b/resource/language/nltext.cfg @@ -0,0 +1,96 @@ +language_name = Dutch + +[language] +%s_(%d_hz)_on_port_%X,_using_IRQ_%d_and_DMA_channel_%d = %s (%d hz) op poort %X, gebruikt IRQ %d en DMA-kanaal %d +%s_does_not_support_audio_input = %s ondersteund geen audio invoer +%s_does_not_support_MIDI_input = %s ondersteund geen MIDI invoer +%s_not_found = %s niet gevonden +%s_on_port_%X = %s op poort %X +4-button_joystick = joystick met 4 knoppen +6-button_joystick = joystick met 6 knoppen +8-button_joystick = joystick met 8 knoppen +AWE32_detection_failed_on_port_0x%04x = Automatische herkenning van de AWE32 op poort 0x%04x niet gelukt +AWE32_driver:_had_trouble_with_the_embedded_data = AWE32-stuurprogramma: probleem met ingebouwde gegevens +AWE32_not_detected = AWE32 niet gevonden +Bad_VBE/AF_driver_ID_string = Ongeldige VBE/AF-stuurprogramma ID-String +Banked_framebuffer_not_available = Banked Framebuffer niet verkrijgbaar +BLASTER_environment_variable_has_no_E_section = BLASTER-omgevingsvariabele bevat geen E-gedeelte +BLASTER_environment_variable_not_set = BLASTER-omgevingsvariabele niet ingesteld +Can't_find_VBEAF.DRV = VBEAF.DRV niet gevonden +Can't_make_linear_screen_bitmap = Fout bij het creeren van de lineaire beeldschermbitmap +Can't_map_memory_for_VBE/AF = Geheugen-map voor VBE/AF mislukt +Can't_use_SB_MIDI_interface_and_DSP_at_the_same_time = de SB MIDI-interface en DSP kunnen niet tegelijk gebruikt worden +Cancel = Annuleren +Centre_the_hat = Centreer de kop +digital = digitaal +DIGMID_patch_set_not_found = DIGMID-Soundset niet gevonden +Disk_Error = Schijffout +Dual_joysticks = Dual Joysticks +Dual_OPL2_synths = Dual OPL2 Synths +Error_reading_.IBK_file_'%s' = Fout bij het lezen van .IBK-data '%s' +Error_setting_video_mode = Fout bij het instellen van de grafische modus +ES%X_(%d_hz)_on_port_%X,_using_IRQ_%d_and_DMA_channel_%d = ES%X (%d hz) op poort %X, gebruikt IRQ %d en DMA-kanaal %d +ESS_AudioDrive_not_found = ESS AudioDrive niet gevonden +Failed_to_set_VBE/AF_mode = Instellen VBE/AF modus mislukt +Flightstick_Pro = Flightstick Pro +Graphics_Mode = Grafische modus +Hardware_acceleration_not_available = Hardwareversnelling niet toegankelijk +Hardware_scrolling_not_supported = Hardwarescrolling niet ondersteund +Hat = kop +Insufficient_%s_voices_available = Onvoldoende %s stemmen verkrijgbaar +Insufficient_video_memory = Ontoereikend videogeheugen +Linear_framebuffer_not_available = lineaire framebuffer nicht verkrijgbaar +MIDI = MIDI +Mode-X_only_supports_8_bit_color = Mode-X ondersteund slechts 256 (8bits) kleuren +Move_stick_2_to_the_bottom_right = beweeg Joystick 2 naar rechtsonder +Move_stick_2_to_the_top_left = beweeg Joystick 2 naar linksboven +Move_stick_to_the_bottom_right = beweeg de Joystick naar rechtsonder +Move_stick_to_the_top_left = beweeg de Joystick naar linksboven +Move_the_hat_down = beweeg de kop naar onder +Move_the_hat_left = beweeg de kop naar links +Move_the_hat_right = beweeg de kop naar rechts +Move_the_hat_up = beweeg de kop naar boven +MPU-401_and_%s_conflict_over_IRQ_%d = Conflict tussen MPU-401 en %s voor IRQ %d +MPU-401_MIDI_interface_on_port_%X,_using_IRQ_%d = MPU-401 MIDI-Interface op poort %X, gebruikt IRQ %d +MPU-401_not_found = MPU-401 niet gevonden +Not_a_valid_VGA_resolution = Geen geldige VGA resolutie +Not_a_VGA_mode-X_resolution = Geen geldige VGA Mode-X resolutie +Obsolete_VBE/AF_version_(need_2.0_or_greater) = Verouderde VBE/AF-versie (v2.0 of hoger nodig) +OK = OK +Older_SB_version_detected = Oudere SB-versie gevonden +OPL_synth_not_found = OPL-synth niet gevonden +OPL2_synth = OPL2 synth +OPL3_synth = OPL3 synth +OPL3_synth_not_found = OPL3-synth niet gevonden +Resolution_not_supported = beeldschermresulutie niet ondersteund +SB_AWE32/compatible_on_port_0x%04x = SB AWE32/compatibel op poort 0x%04x +SB_output_driver_must_be_installed_before_input_can_be_read = SB uitvoer stuurprogramma moet geinstalleerd worden, alvorens SB-invoer plaats kan vinden +SciTech_VBE/AF_drivers_do_not_support_wide_virtual_screens = SciTech VBE/AF stuurprogramma ondersteund geen brede virtuele beeldschermen +Second_OPL2_synth_not_found = tweede OPL2-synth niet gevonden +Set_throttle_to_maximum = zet throttle op het maximum +Set_throttle_to_minimum = zet throttle op het Minimum +Software_wavetable_synth = Software-Wavetable synthese +Sound_Blaster_MIDI_interface_on_port_%X = Sound Blaster MIDI-Interface op poort %X +Sound_Blaster_not_found = Sound Blaster niet gevonden +Sound_system_not_installed = Soundsystem niet geinstaleerd +Standard_joystick = Standaard-Joystick +Stick = Stuurknuppel +The_sound_of_silence = volmaakte stilte +Throttle = throttle +unused = ongebruikt +VBE_%d.0_not_available = VBE %d.0 niet verkrijgbaar +VBE_mode_not_available = VBE-modus niet toegankelijk +VBE/AF_device_not_present = VBE/AF-apparaat niet aanwezig +VBE/AF_nearptrs_not_supported_on_this_platform = VBE/AF-nearptrs worden op dit platform niet ondersteund +VBE/AF_Plug_and_Play_initialisation_failed = VBE/AF-Plug&Play-initialisering mislukt +VESA_function_0x4F02_failed = VESA-functie 0x4F02 mislukt +VESA_function_0x4F06_failed = VESA-functie 0x4F06 mislukt +VESA_mode_0x100_not_available = VESA-Modus 0x100 niet verkrijgbaar +VESA_not_available = VESA niet toegankelijk +VESA_protected_mode_interface_not_available = VESA-Protected-Mode-Interface niet verkrijgbaar +VGA_only_supports_8_bit_color = VGA ondersteund slechts 256 kleuren +Virtual_screen_size_too_large = virtuele schermgrootte te groot +Wingman_Extreme = Wingman Extreme +Xtended_mode_only_supports_640x400 = Xtended-Mode ondersteund slects 640x400 beeldpunten +Xtended_mode_only_supports_8_bit_color = Xtended-Modus ondersteund slechts 256 kleuren + diff --git a/resource/language/setext.cfg b/resource/language/setext.cfg index b9c59bcee2..e40b27a36b 100644 --- a/resource/language/setext.cfg +++ b/resource/language/setext.cfg @@ -1,8 +1,8 @@ language_name = Svenska [language] -%s:_%d_bits,_%s,_%d_bps,_%s = %s: %d bitar, %s %d bps, %s = %s: -%s:_%s = %s: %s +%s:_%d_bits,_%s,_%d_bps,_%s = %s: %d bitar, %s %d bps, %s +%s:_can_not_open = %s: kunde inte öppna %s_(%d_hz)_on_port_%X,_using_IRQ_%d_and_DMA_channel_%d = %s (%d hz) pÃ¥ port %X använder IRQ %d och DMA-kanal %d %s_does_not_support_MIDI_input = %s stöder inte MIDI-inspelning %s_does_not_support_audio_input = %s stöder inte ljudinspelning @@ -16,36 +16,72 @@ AWE32_detection_failed_on_port_0x%04x = Kunde inte hitta AWE32 pÃ¥ port 0x%04x AWE32_driver:_had_trouble_with_the_embedded_data = AWE32-drivrutin: problem med inbäddad data AWE32_not_detected = Kunde inte hitta AWE32 Analogue_Buttons = Analoga knappar +Apple_SoundManager_%d.x_%d_hz,_%d-bit,_%s_,_%d_ = Apple SoundManager %d.x %d hz, %d-bitars, %s , %d +Auto_fullscreen = Auto fullskärm +Auto_windowed = Auto fönsterläge BLASTER_environment_variable_has_no_E_section = Miljövariabeln BLASTER har ingen E-parameter BLASTER_environment_variable_not_set = Miljövariabeln BLASTER är inte satt +Back = Tillbaka Bad_VBE/AF_driver_ID_string = Felaktig ID-text för VBE/AF-drivrutinen Banked_framebuffer_not_available = Delad skärmbuffer ej tillgänglig +BeOS_joystick = BeOS-joystick +BeOS_Keyboard = BeOS-tangentbord +BeOS_MIDI = BeOS-MIDI +BeOS_Sound = BeOS-ljud Blue = BlÃ¥ +Button_1 = Knapp 1 +Button_2 = Knapp 2 +Button_3 = Knapp 3 +Button_4 = Knapp 4 +Button_5 = Knapp 5 +C_Down = C ner +C_Left = C vänster +C_Right = C höger +C_Up = C upp Can't_find_VBEAF.DRV = Kunde inte hitta VBEAF.DRV -Can't_make_linear_screen_bitmap = Kunde inte skapa linjär skärmbitmap -Can't_map_framebuffer_%s = Kunde inte mappa skärmbuffer %s -Can't_map_memory_for_VBE/AF = Kan inte mappa minne för VBE/AF +Can't_make_linear_screen_bitmap = Kunde inte skapa linjär skärmbitmapp +Can't_map_framebuffer = Kunde inte mappa skärmbuffer +Can't_map_memory_for_VBE/AF = Kunde inte mappa minne för VBE/AF Can't_open_framebuffer_%s = Kunde inte öppna skärmbuffer %s -Can't_use_SB_MIDI_interface_and_DSP_at_the_same_time = Kan inte använda SB MIDI-gränssnitt och DSP samtidigt +Can't_use_SB_MIDI_interface_and_DSP_at_the_same_time = Kunde inte använda SB MIDI-gränssnitt och DSP samtidigt Can_not_allocate_audio_buffer = Kunde inte allokera ljudbuffer Can_not_create_XImage = Kunde inte skapa XImage +Can_not_do_double_buffered_sound = Dubbelbuffrat ljud stöds inte +Can_not_get_information_about_sound = Kunde inte hitta information om ljud Can_not_get_video_mode_settings = Kunde inte ladda grafikkortsinställningar Can_not_grab_keyboard = Kunde inte hitta nÃ¥got tangentbord Can_not_grab_mouse = Kunde inte hitta nÃ¥gon mus Can_not_init_software_mixer = Kunde inte initiera mjukvarumixer Can_not_install_colormap = Kunde inte installera färgtabell +Can_not_obtain_user_name = Kunde inte komma Ã¥t användarnamnet +Can_not_open_card/pcm_device = Kunde inte öppna kort-/pcm-enhet +Can_not_open_framebuffer = Kunde inte öppna skärmbuffer +Can_not_query_DirectVideo = Kunde inte kommunicera med DirectVideo +Can_not_set_channel_parameters = Kunde inte sätta kanal-parametrar Can_not_set_video_mode = Kunde inte sätta grafikläge Can_not_switch_to_DGA_mode = Kunde inte byta till DGA-läge Cancel = Avbryt -Cannot_open_card/pcm_device = Kunde inte öppna kort-/pcm-enhet +Cannot_access_the_framebuffer = Kunde inte komma Ã¥t skärmbuffer +Card__%d,_device__%d:_%d_bits,_%s,_%d_bps,_%s = Kort %d, enhet %d: %d bitar, %s, %d bps, %s Centre_the_hat = Centrera övre styrspaken +Circle = Cirkel Could_not_find_GRIP.GLL = Kunde inte hitta GRIP.GLL Could_not_initialize_GrIP_system = Kunde inte initiera GrIP-systemet -Couldn't_allocate_screen_bitmap! = Kunde inte allokera skärmbitmapp! +Couldn't_allocate_screen_bitmap! = Kunde inte allokera skärmbitmapp +DGA_1.0_is_required = DGA 1.0 krävs +DGA_1.0_window = DGA 1.0 fönster +DGA_2.0_or_newer_is_required = DGA 2.0 eller nyare krävs +DGA_2.0_soft = DGA 2.0 mjukvara DGA_extension_is_not_supported = DGA-utökning stöds inte DIGMID_patch_set_not_found = Kunde inte hitta nÃ¥gon DIGMID patch-uppsättning +Device_connected_is_not_a_Wingman_Warrior = Den anslutna enheten är inte en Wingman Warrior Digital_input_driver_not_found = Kunde inte hitta nÃ¥gon drivrutin för digital ljudinmatning -Digital_sound_driver_not_found = Kunde inte hitta nÃ¥gon drivrutin för digitalt ljud +DirectDraw_accel = DirectDraw accellererad +DirectDraw_safe = DirectDraw säker +DirectDraw_soft = DirectDraw mjukvara +DirectDraw_window = DirectDraw fönsterläge +DirectInput_keyboard = DirectInput tangentbord +DirectInput_mouse = DirectInput mus DirectVideo_is_not_supported = DirectVideo stöds inte Disk_Error = Diskfel Dual_OPL2_synths = TvÃ¥ OPL2-syntar @@ -53,30 +89,49 @@ Dual_joysticks = TvÃ¥ joystickar ES%X_(%d_hz)_on_port_%X,_using_IRQ_%d_and_DMA_channel_%d = ES%X (%d hz) pÃ¥ port %X, använder IRQ %d och DMA-kanal %d ESS_AudioDrive_not_found = Kunde inte hitta ESS AudioDrive Error_reading_.IBK_file_'%s' = Fel vid läsning av .IBK-filen '%s' -Error_setting_VGA_video_mode = Ett fel uppstod när VGA-grafikläget skulle sättas -Error_setting_video_mode = Det gick inte att sätta skärmläge +Error_setting_VGA_video_mode = Fel uppstod när VGA-grafikläget skulle sättas +Error_setting_video_mode = Fel uppstod vid byte av skärmläge Failed_to_init_MIDI_input_driver = Misslyckades med att initiera drivrutinen för MIDI-inmatning Failed_to_init_MIDI_music_driver = Misslyckades med att initiera drivrutinen för MIDI-musik Failed_to_init_digital_input_driver = Misslyckades med att initiera drivrutinen för digital ljudinmatning Failed_to_init_digital_sound_driver = Misslyckades med att initiera drivrutinen för digitalt ljud Failed_to_set_VBE/AF_mode = Kunde inte sätta VBE/AF-läge +Fatal_error:_unable_to_set_GFX_SAFE = Fatalt fel: Kunde inte sätta GFX_SAFE +Fixed-rate_timer = Timer med konstant hastighet +Framebuffer_ioctl()_failed = Skärmbuffer ioctl() misslyckades +Framebuffer_resolution_not_available = Skärmbuffer-upplösning inte tillgänglig +Fullscreen = Fullskärm +Getting_buffer_size:_%s = Hämtar bufferstorlek: %s Graphics_Mode = Grafikläge Green = Grön Hardware_acceleration_not_available = HÃ¥rdvaruacceleration är inte tillgänglig Hardware_scrolling_not_supported = HÃ¥rdvaruskrollning stöds inte Hat = Övre styrspak +IF-SEGA2/PCI:__create_linear_mapping_error = IF-SEGA2/PCI: _create_linear_mapping-fel +IF-SEGA2/PCI:__create_selector_error = IF-SEGA2/PCI: _create_selector-fel +IF-SEGA2/PCI:_device_not_found = IF-SEGA2/PCI: enheten kunde inte hittas Input_is_not_supported = Ljudinmatning stöds inte Insufficient_%s_voices_available = För fÃ¥ %s-kanaler tillgängliga Insufficient_video_memory = För lite grafikminne +Int_0x33_mouse = Int 0x33-mus Internal_error = Internt fel +Invalid_virtual_resolution_requested = Ogiltig virtuell upplösning efterfrÃ¥gades +L1_Button = L1-knapp Left = Vänster Linear_framebuffer_not_available = Linjär skärmbuffer ej tillgänglig +Linux_analogue_joystick(s) = Linux analog(a) joystick(ar) +Linux_console = Linuxkonsoll +Linux_console_keyboard = Linuxkonsoll-tangentbord MIDI_input_driver_not_found = Kunde inte hitta nÃ¥gon drivrutin för MIDI-inmatning MIDI_music_driver_not_found = Kunde inte hitta nÃ¥gon drivrutin för MIDI-musik MPU-401_MIDI_interface_on_port_%X,_using_IRQ_%d = MPU-401 MIDI-gränssnitt pÃ¥ port %X, använder IRQ %d MPU-401_and_%s_conflict_over_IRQ_%d = MPU-401 och %s krockar pÃ¥ IRQ %d MPU-401_not_found = Kunde inte hitta MPU-401 +MacOs = Mac OS +MacOs_Mouse = Mac OS-mus +MacOs_Timer = Mac OS-timer Mode-X_only_supports_8_bit_color = Mode-X stöder bara 8-bitars färg +Mouse = Mus Move_stick_2_to_the_bottom_right = Dra joystick 2 nerÃ¥t Ã¥t höger Move_stick_2_to_the_top_left = Dra joystick 2 uppÃ¥t Ã¥t vänster Move_stick_to_the_bottom_right = Dra joystickspaken nerÃ¥t Ã¥t höger @@ -85,41 +140,66 @@ Move_the_hat_down = Dra övre styrspaken nerÃ¥t Move_the_hat_left = Dra övre styrspaken Ã¥t vänster Move_the_hat_right = Dra övre styrspaken Ã¥t höger Move_the_hat_up = Dra övre styrspaken uppÃ¥t +No = Nej +No_GrIP_devices_available = Inga GrIP-enheter tillgängliga +No_joystick = Ingen joystick No_joysticks_found = Kunde inte hitta nÃ¥gra joystickar +No_mouse = Ingen mus No_server = Ingen server +No_sound = Inget ljud No_window = Inget fönster Not_a_VGA_mode-X_resolution = Inte en VGA mode-X-upplösning Not_a_valid_VGA_resolution = Ogiltig VGA-upplösning Not_enough_memory = Slut pÃ¥ minne +Not_in_stereo_or_mono_mode = Är inte i stereo- eller monoläge OPL2_synth = OPL2-synt OPL3_synth = OPL3-synt OPL3_synth_not_found = Kunde inte hitta nÃ¥gon OPL3-synt OPL_synth_not_found = Kunde inte hitta nÃ¥gon OPL-synt +OSS_output_driver_must_be_installed_before_input_can_be_read = OSS-ut-drivrutin mÃ¥ste installeras innan inmatning kan ske Obsolete_VBE/AF_version_(need_2.0_or_greater) = För gammal version av VBE/AF (2.0 eller högre krävs) Older_SB_version_detected = Hittade äldre SB-version +PCI_BIOS_not_installed = PCI BIOS är inte installerat +PC_keyboard_(DOS) = PC-tangentbord (DOS) +Photon_accelerated = Photon accellererad +Photon_mouse = Photon-mus +Photon_safe = Photon säker +Photon_windowed = Photon fönsterläge +QNX_Realtime_Platform = QNX realtidsplattform +QNX_keyboard = QNX-tangentbord Red = Röd -Requested_mode_not_available! = Det efterfrÃ¥gade grafikläget stöds inte! +Requested_mode_not_available! = Det efterfrÃ¥gade läget är inte tillgängligt +Required_VGA_mode_not_supported = VGA-läget som behövs stöds inte Resolution_not_supported = Upplösningen stöds inte Right = Höger SB_AWE32/compatible_on_port_0x%04x = SB AWE32/kompatibel pÃ¥ port 0x%04x +SB_MIDI_interface = SB MIDI-gränssnitt SB_output_driver_must_be_installed_before_input_can_be_read = SB-drivrutin mÃ¥ste installeras innan ljudinspelning kan ske +SWIFT_Device_not_detected = SWIFT-enhet kunde inte hittas +Safe_Fullscreen = Säker fullskärm SciTech_VBE/AF_drivers_do_not_support_wide_virtual_screens = SciTech VBE/AF-drivrutinerna stöder inte breda virtuella skärmar Second_OPL2_synth_not_found = Kunde inte hitta den andra OPL2-synten Set_throttle_to_maximum = Sätt gasreglaget i maxläge Set_throttle_to_minimum = Sätt gasreglaget i minläge Setting_DSP_parameters:_%s = Sätter DSP-parametrar: %s Software_wavetable_synth = Synt med mjukvaruinstrument +SoundManager_3.0_or_later_required = SoundManager 3.0 eller senare krävs +SoundManager_not_found = Kunde inte hitta SoundManager Sound_Blaster_MIDI_interface_on_port_%X = Sound Blaster MIDI-gränssnitt pÃ¥ port %X Sound_Blaster_not_found = Kunde inte hitta Sound Blaster Sound_system_not_installed = Ljudsystemet installerades inte +Soundscape_%s_(%d_hz)_on_port_%X,_using_IRQ_%d,_DMA_channel_%d_and_waveport_%X = Soundscale %s (%d hz) pÃ¥ port %X, använder IRQ %D, DMA-kanal %d och waveport %X Soundscape_not_found = Kunde inte hitta Soundscape Standard_joystick = Standardjoystick Stick = Joystick The_sound_of_silence = Total Tystnad +This_driver_needs_local_display = Denna drivrutin kräver lokal display This_driver_needs_root_privileges = Drivrutinen kräver rootprivilegier Throttle = Gasreglage +Triangle = Triangel Unable_to_find_a_suitable_graphics_driver = Kunde inte hitta nÃ¥gon passande drivrutin för grafik Unable_to_find_a_usable_VT = Kunde inte hitta nÃ¥gon användbar VT +Unable_to_map_video_memory = Kunde inte mappa videominne Unable_to_open = Kunde inte öppna Unable_to_open_%s:_%s = Kunde inte öppna %s: %s Unable_to_reopen_new_console = Kunde inte öppna ett nytt konsoll @@ -127,11 +207,11 @@ Unsupported_color_depth = Färgdjupet stöds inte Unsupported_memory_layout = Minneslayouten stöds inte Unsupported_sample_format = Ljudformatet stöds inte Unsupported_screen_size = Upplösningen stöds inte +Unsupported_virtual_resolution = Den virtuella upplösningen stöds inte VBE/AF_Plug_and_Play_initialisation_failed = VBE/AF Plug and Play-initieringen misslyckades VBE/AF_device_not_present = Kunde inte hitta nÃ¥gon VBE/AF-enhet VBE/AF_nearptrs_not_supported_on_this_platform = VBE/AF direktpekare stöds inte pÃ¥ detta system VBE_%d.0_not_available = VBE %d.0 är inte tillgängligt -VBE_mode_not_available = VBE-läge är inte tillgängligt VBE_mode_not_available = VBE-läget är inte tillgängligt VESA_function_0x4F02_failed = VESA-funktionen 0x4F02 misslyckades VESA_function_0x4F06_failed = VESA-funktionen 0x4F06 misslyckades @@ -140,12 +220,30 @@ VESA_not_available = VESA är inte tillgängligt VESA_protected_mode_interface_not_available = Protected mode-gränssnitt för VESA är inte tillgängligt VGA_only_supports_8_bit_color = VGA stöder bara 8-bitars färg VT_WAITACTIVE_failure = VT_WAITACTIVE-fel +Variable-rate_timer = Timer med variabel hastighet VidMode_extension_is_not_supported = VidMode-utökning stöds inte +VidMode_extension_requires_local_display = VidMode-utökning kräver lokal display Virtual_screen_size_too_large = Virtuella skärmbredden är för stor +Win32_high_performance_timer = Win32 högupplöst timer +Win32_low_performance_timer = Win32 lÃ¥gupplöst timer +Windowed = Fönsterläge +Windowed_mode_not_supported = Fönsterläge stöds inte +Windows_2000_mouse = Windows 2000-mus +Windows_NT_mouse = Windows NT-mus +Windows_Sound_System = Windows ljudsystem Wingman_Warrior_not_connected = Wingman Warrior är inte ansluten +X-Windows_keyboard = X-Windows-tangentbord +X-Windows_mouse = X-Windows-mus +X11_fullscreen = X11 helskärm +X11_window = X11 fönsterläge Xtended_mode_only_supports_640x400 = Xtended mode stöder bara 640x400 Xtended_mode_only_supports_8_bit_color = Xtended mode stöder bara 8-bitars färg Yellow = Gul +Yes = Ja +allegro_window_close_message = Varning: Om du stänger programmet pÃ¥ detta sätt kan det orsaka förlust av data och fÃ¥ oväntade sidoeffekter. Det rekommenderas att använda programmets eget kommando för att avsluta. Vill du ändÃ¥ stänga programmet? approx. = ungefär +colors = färger +failed_on_channel_initialization = Initiering av kanalen misslyckades no_vsync = ingen vsync +open_NoteAllocator_failed = open NoteAllocator misslyckades unused = oanvänd diff --git a/setup/setup.c b/setup/setup.c index 57396a3245..31ad30013d 100644 --- a/setup/setup.c +++ b/setup/setup.c @@ -413,6 +413,16 @@ static void find_sound_drivers(void) } #endif + #ifdef DIGI_ARTS + case DIGI_ARTS: + { + static char *param[] = {"flip_pan", "sound_bits", "sound_stereo", "sound_freq", "digi_volume", NULL}; + digi_cards[c].param = uconvert_static_string_array(param); + digi_cards[c].desc = uconvert_static_string("aRts"); + break; + } + #endif + #ifdef DIGI_ALSA case DIGI_ALSA: { @@ -1323,6 +1333,7 @@ static int detect_mouse(void) int retval = -1; char buffer[256]; char tmp1[256], tmp2[256], tmp3[64], tmp4[64]; + AL_CONST char *drv_name; int count; _DRIVER_INFO *list; int list_size; @@ -1336,11 +1347,11 @@ static int detect_mouse(void) goto finished; } + popup(uconvert_ascii("Move your mouse around", tmp1), uconvert_ascii("Press any key to cancel", tmp2)); + while (read(fd, buffer, 1) == 1) ; - popup(uconvert_ascii("Move your mouse around", tmp1), uconvert_ascii("Press any key to cancel", tmp2)); - w = sizeof(buffer); l = (SCREEN_W - w)/2; r = l + w; @@ -1350,7 +1361,7 @@ static int detect_mouse(void) rect(popup_bitmap2, l-1, t-1, r, b+1, gui_fg_color); blit(popup_bitmap2, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H); - for (count = 0; count < sizeof(buffer); ) { + for (count = 0; count < (int)sizeof(buffer); ) { if (read(fd, buffer+count, 1) == 1) { vline(popup_bitmap2, l + count*w/sizeof buffer, t, b, gui_mg_color); blit(popup_bitmap2, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H); @@ -1362,10 +1373,10 @@ static int detect_mouse(void) if (count == 0) popup(uconvert_ascii("No data received", tmp1), NULL); - else if (count < sizeof(buffer)) + else if (count < (int)sizeof(buffer)) popup(uconvert_ascii("Insufficient data received", tmp1), NULL); - if (count < sizeof(buffer)) { + if (count < (int)sizeof(buffer)) { retval = -1; goto finished; } @@ -1376,17 +1387,19 @@ static int detect_mouse(void) for (i = 0; i < list_size; i++) { MOUSE_DRIVER *drv = list[i].driver; if (drv->analyse_data && drv->analyse_data (buffer, count)) { - if (alert(uconvert_ascii("This driver understands your mouse:", tmp1), drv->name, uconvert_ascii("Select it?", tmp2), - uconvert_ascii("Yes", tmp3), uconvert_ascii("No", tmp4), 'y', 'n') == 1) + drv_name = get_config_text(drv->ascii_name); + if (alert(uconvert_ascii("This driver understands your mouse:", tmp1), drv_name, uconvert_ascii("Select it?", tmp2), + uconvert_ascii("Yes", tmp3), uconvert_ascii("No", tmp4), 'y', 'n') == 1) break; } } - if (i < list_size) + if (i < list_size) { retval = i; + } else { - alert(uconvert_ascii("No drivers understand your mouse", tmp1), NULL, uconvert_ascii("Try using the GPM repeater", tmp2), - uconvert_ascii("Ok", tmp3), NULL, 0, 0); + alert(uconvert_ascii("No driver understands your mouse", tmp1), uconvert_ascii("Try using the GPM repeater", tmp2), + uconvert_ascii("or set the device filename by hand", tmp3), uconvert_ascii("Ok", tmp4), NULL, 0, 0); retval = -1; } @@ -2196,7 +2209,7 @@ static void setup_param_dialog(void) c++; } - param_ok = ((int)d - (int)param_dlg) / sizeof(DIALOG); + param_ok = (int)(d - param_dlg); /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (p) (help) */ DLG(d_button_proc, 30, 142, 125, 25, -1, 16, 13, D_EXIT, 0, 0, uconvert_static_string("OK"), NULL, uconvert_static_string("Use these parameters")); @@ -2443,8 +2456,8 @@ static DIALOG_STATE main_handler(int c) if (init_sound(uconvert_ascii("Unable to autodetect!", tmp1)) != 0) return state_redraw; - uszprintf(b1, sizeof(b1), uconvert_ascii("Digital: %s", tmp1), digi_driver->name); - uszprintf(b2, sizeof(b2), uconvert_ascii("MIDI: %s", tmp1), midi_driver->name); + uszprintf(b1, sizeof(b1), uconvert_ascii("Digital: %s", tmp1), uconvert_ascii(digi_driver->ascii_name, tmp2)); + uszprintf(b2, sizeof(b2), uconvert_ascii("MIDI: %s", tmp1), uconvert_ascii(midi_driver->ascii_name, tmp2)); alert(uconvert_ascii("- detected hardware -", tmp1), b1, b2, uconvert_ascii("Ok", tmp2), NULL, 0, 0); for (i=0; parameters[i].name; i++) { @@ -2485,9 +2498,9 @@ static DIALOG_STATE main_handler(int c) if (init_sound(uconvert_ascii("Sound initialization failed!", tmp1)) != 0) return state_redraw; uszprintf(digi_desc, sizeof(digi_desc), uconvert_ascii("Driver: %s Description: %s", tmp1), - digi_driver->name, digi_driver->desc); - uszprintf(midi_desc, sizeof(midi_desc), uconvert_ascii("Driver: %s Description: %s", tmp1), - midi_driver->name, midi_driver->desc); + uconvert_ascii(digi_driver->ascii_name, tmp2), digi_driver->desc); + uszprintf(midi_desc, sizeof(midi_desc), uconvert_ascii("Driver: %s Description: %s", tmp1), + uconvert_ascii(midi_driver->ascii_name, tmp2), midi_driver->desc); activate_dialog(test_dlg, test_handler, FALSE); break; @@ -2649,6 +2662,8 @@ static DIALOG_STATE main_handler(int c) joystick_dlg[2].d1 = 0; get_joystick_drivers(&list, &list_size); + install_joystick(JOY_TYPE_AUTODETECT); + for (i=0; list[i].driver; i++) { if (list[i].id == _joy_type) { joystick_dlg[2].d1 = i; @@ -2656,6 +2671,8 @@ static DIALOG_STATE main_handler(int c) } } + remove_joystick(); + activate_dialog(joystick_dlg, joystick_handler, FALSE); break; @@ -2786,8 +2803,6 @@ int main(void) if (!language_type[i]) ustrzcpy(language_type, sizeof(language_type), uconvert_ascii("en", tmp2)); - install_joystick(JOY_TYPE_AUTODETECT); - find_sound_drivers(); set_config_data(empty_string, 0); diff --git a/src/allegro.c b/src/allegro.c index 003cd988c9..d68beac6fe 100644 --- a/src/allegro.c +++ b/src/allegro.c @@ -272,7 +272,7 @@ int install_allegro(int system_id, int *errno_ptr, int (*atexit_ptr)(void (*func char tmp1[64], tmp2[64]; int i; - #ifndef CONSTRUCTOR_FUNCTION + #ifndef ALLEGRO_USE_CONSTRUCTOR /* call constructor functions manually */ extern void _initialize_datafile_types(); extern void _midi_constructor(); @@ -282,10 +282,6 @@ int install_allegro(int system_id, int *errno_ptr, int (*atexit_ptr)(void (*func _midi_constructor(); _mouse_constructor(); _register_bitmap_file_type_init(); - #else - #ifndef DESTRUCTOR_FUNCTION - _register_bitmap_file_type_init(); - #endif #endif if (errno_ptr) @@ -472,7 +468,7 @@ void al_assert(AL_CONST char *file, int line) if (asserted) return; - /* todo: use snprintf() */ + /* todo, some day: use snprintf (C99) */ sprintf(buf, "Assert failed at line %d of %s", line, file); if (assert_handler) { @@ -525,7 +521,7 @@ void al_trace(AL_CONST char *msg, ...) char buf[512]; char *s; - /* todo: use vsnprintf() */ + /* todo, some day: use vsnprintf (C99) */ va_list ap; va_start(ap, msg); vsprintf(buf, msg, ap); diff --git a/src/beos/bgfxapi.cpp b/src/beos/bgfxapi.cpp index 04830c6337..ccbca9ae81 100644 --- a/src/beos/bgfxapi.cpp +++ b/src/beos/bgfxapi.cpp @@ -80,7 +80,7 @@ AL_CONST BE_MODE_TABLE _be_mode_table[] = { { 32, 1152, 900, B_32_BIT_1152x900, B_RGB32 }, { 32, 1280, 1024, B_32_BIT_1280x1024, B_RGB32 }, { 32, 1600, 1200, B_32_BIT_1600x1200, B_RGB32 }, - { -1 } + { -1, 0, 0, 0, 0 } }; sem_id _be_fullscreen_lock = -1; @@ -190,17 +190,18 @@ static inline void change_focus(bool active) static inline bool handle_window_close(const char *title) { + char tmp1[1024], tmp2[16], tmp3[16]; int result; - char tmp1[512], tmp2[32], tmp3[32]; if (_be_window_close_hook != NULL) { _be_window_close_hook(); } else { + /* display the default close box */ BAlert *close_alert = new BAlert(title, - uconvert_toascii(get_config_text(ALLEGRO_WINDOW_CLOSE_MESSAGE), tmp1), - uconvert_toascii(get_config_text("Yes"), tmp2), - uconvert_toascii(get_config_text("No"), tmp3), + uconvert(get_config_text(ALLEGRO_WINDOW_CLOSE_MESSAGE), U_CURRENT, tmp1, U_UTF8, sizeof(tmp1)), + uconvert(get_config_text("Yes"), U_CURRENT, tmp2, U_UTF8, sizeof(tmp2)), + uconvert(get_config_text("No"), U_CURRENT, tmp3, U_UTF8, sizeof(tmp3)), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); close_alert->SetShortcut(1, B_ESCAPE); if (_be_midisynth) @@ -211,6 +212,7 @@ static inline bool handle_window_close(const char *title) if (result == 0) be_terminate(0, false); } + return false; } diff --git a/src/beos/bkeyapi.cpp b/src/beos/bkeyapi.cpp index 2d2b6a67ed..3055fadb0e 100644 --- a/src/beos/bkeyapi.cpp +++ b/src/beos/bkeyapi.cpp @@ -201,6 +201,10 @@ static int32 keyboard_thread(void *keyboard_started) while(keyboard_thread_running) { int i; + snooze(KEY_THREAD_PERIOD); + if (!_be_focus_count) + continue; + get_key_info(&key_info_new); if (three_finger_flag && @@ -250,8 +254,6 @@ static int32 keyboard_thread(void *keyboard_started) } key_info_old = key_info_new; - - snooze(KEY_THREAD_PERIOD); } AL_TRACE("keyboard thread exited\n"); diff --git a/src/beos/bsndapi.cpp b/src/beos/bsndapi.cpp index 2ffd4b3477..9a0a9f5d95 100644 --- a/src/beos/bsndapi.cpp +++ b/src/beos/bsndapi.cpp @@ -59,9 +59,7 @@ static void be_sound_handler(void *cookie, void *buffer, size_t size, const medi locker->Lock(); acquire_sem(_be_sound_stream_lock); if (be_sound_active) { - be_main_suspend(); _mix_some_samples((unsigned long)buffer, 0, be_sound_signed); - be_main_resume(); } else { memset(buffer, 0, size); diff --git a/src/bmp.c b/src/bmp.c index 2ed266e432..667250d5b1 100644 --- a/src/bmp.c +++ b/src/bmp.c @@ -262,9 +262,7 @@ static void read_24bit_line(int length, PACKFILE *f, BITMAP *bmp, int line) c.b = pack_getc(f); c.g = pack_getc(f); c.r = pack_getc(f); - bmp->line[line][i*3+_rgb_r_shift_24/8] = c.r; - bmp->line[line][i*3+_rgb_g_shift_24/8] = c.g; - bmp->line[line][i*3+_rgb_b_shift_24/8] = c.b; + WRITE3BYTES(bmp->line[line]+i*3, makecol24(c.r, c.g, c.b)); nbytes += 3; } @@ -471,12 +469,16 @@ BITMAP *load_bmp(AL_CONST char *filename, RGB *pal) PACKFILE *f; BITMAP *bmp; PALETTE tmppal; + int want_palette = TRUE; int ncol; unsigned long biSize; int bpp, dest_depth; - if (!pal) + /* we really need a palette */ + if (!pal) { + want_palette = FALSE; pal = tmppal; + } f = pack_fopen(filename, F_READ); if (!f) @@ -512,10 +514,8 @@ BITMAP *load_bmp(AL_CONST char *filename, RGB *pal) return NULL; } - if (infoheader.biBitCount == 24) { + if (infoheader.biBitCount == 24) bpp = 24; - generate_332_palette(pal); - } else bpp = 8; @@ -548,8 +548,17 @@ BITMAP *load_bmp(AL_CONST char *filename, RGB *pal) bmp = NULL; } - if (dest_depth != bpp) + if (dest_depth != bpp) { + /* restore original palette except if it comes from the bitmap */ + if ((bpp != 8) && (!want_palette)) + pal = NULL; + bmp = _fixup_loaded_bitmap(bmp, pal, dest_depth); + } + + /* construct a fake palette if 8-bit mode is not involved */ + if ((bpp != 8) && (dest_depth != 8) && want_palette) + generate_332_palette(pal); pack_fclose(f); return bmp; diff --git a/src/c/cdefs15.h b/src/c/cdefs15.h index 554f375fad..3527c060e2 100644 --- a/src/c/cdefs15.h +++ b/src/c/cdefs15.h @@ -62,7 +62,8 @@ #define PATTERN_LINE(y) (PIXEL_PTR) (_drawing_pattern->line[((y) - _drawing_y_anchor) \ & _drawing_y_mask]) -#define GET_PATTERN_PIXEL(x,y) GET_MEMORY_PIXEL(OFFSET_PIXEL_PTR(PATTERN_LINE(y), (x))) +#define GET_PATTERN_PIXEL(x,y) GET_MEMORY_PIXEL(OFFSET_PIXEL_PTR(PATTERN_LINE(y), \ + ((x) - _drawing_x_anchor) & _drawing_x_mask)) #define RLE_PTR signed short* #define RLE_IS_EOL(c) ((unsigned short) (c) == MASK_COLOR_15) diff --git a/src/c/cdefs16.h b/src/c/cdefs16.h index d3218d37ef..86034ab3ac 100644 --- a/src/c/cdefs16.h +++ b/src/c/cdefs16.h @@ -62,7 +62,8 @@ #define PATTERN_LINE(y) (PIXEL_PTR) (_drawing_pattern->line[((y) - _drawing_y_anchor) \ & _drawing_y_mask]) -#define GET_PATTERN_PIXEL(x,y) GET_MEMORY_PIXEL(OFFSET_PIXEL_PTR(PATTERN_LINE(y), (x))) +#define GET_PATTERN_PIXEL(x,y) GET_MEMORY_PIXEL(OFFSET_PIXEL_PTR(PATTERN_LINE(y), \ + ((x) - _drawing_x_anchor) & _drawing_x_mask)) #define RLE_PTR signed short* #define RLE_IS_EOL(c) ((unsigned short) (c) == MASK_COLOR_16) diff --git a/src/c/cdefs24.h b/src/c/cdefs24.h index 7c271e3c58..bc627a7931 100644 --- a/src/c/cdefs24.h +++ b/src/c/cdefs24.h @@ -26,15 +26,10 @@ #define DEC_PIXEL_PTR(p) ((p) -= 3) #define PUT_PIXEL(p,c) bmp_write24((unsigned long) (p), (c)) -#define PUT_MEMORY_PIXEL(p,c) ((*(p) = (c)), \ - (*(p + 1) = ((c) >> 8)), \ - (*(p + 2) = ((c) >> 16))) +#define PUT_MEMORY_PIXEL(p,c) WRITE3BYTES((p), (c)) #define PUT_RGB(p,r,g,b) bmp_write24((unsigned long) (p), makecol24((r), (g), (b))) #define GET_PIXEL(p) bmp_read24((unsigned long) (p)) -#define GET_MEMORY_PIXEL(p) (((unsigned long) (*(p))) \ - | ((unsigned long) (*((p) + 1)) << 8) \ - | ((unsigned long) (*((p) + 2)) << 16)) - +#define GET_MEMORY_PIXEL(p) READ3BYTES((p)) #define IS_MASK(c) ((unsigned long) (c) == MASK_COLOR_24) #define IS_SPRITE_MASK(b,c) ((unsigned long) (c) == MASK_COLOR_24) @@ -66,7 +61,8 @@ #define PATTERN_LINE(y) (PIXEL_PTR) (_drawing_pattern->line[((y) - _drawing_y_anchor) \ & _drawing_y_mask]) -#define GET_PATTERN_PIXEL(x,y) GET_MEMORY_PIXEL(OFFSET_PIXEL_PTR(PATTERN_LINE(y), (x))) +#define GET_PATTERN_PIXEL(x,y) GET_MEMORY_PIXEL(OFFSET_PIXEL_PTR(PATTERN_LINE(y), \ + ((x) - _drawing_x_anchor) & _drawing_x_mask)) #define RLE_PTR signed long* #define RLE_IS_EOL(c) ((unsigned long) (c) == MASK_COLOR_24) diff --git a/src/c/cdefs32.h b/src/c/cdefs32.h index bde055c076..2229037d32 100644 --- a/src/c/cdefs32.h +++ b/src/c/cdefs32.h @@ -57,7 +57,8 @@ #define PATTERN_LINE(y) (PIXEL_PTR) (_drawing_pattern->line[((y) - _drawing_y_anchor) \ & _drawing_y_mask]) -#define GET_PATTERN_PIXEL(x,y) GET_MEMORY_PIXEL(OFFSET_PIXEL_PTR(PATTERN_LINE(y), (x))) +#define GET_PATTERN_PIXEL(x,y) GET_MEMORY_PIXEL(OFFSET_PIXEL_PTR(PATTERN_LINE(y), \ + ((x) - _drawing_x_anchor) & _drawing_x_mask)) #define RLE_PTR signed long* #define RLE_IS_EOL(c) ((unsigned long) (c) == MASK_COLOR_32) diff --git a/src/c/cdefs8.h b/src/c/cdefs8.h index 010d217335..13f7142899 100644 --- a/src/c/cdefs8.h +++ b/src/c/cdefs8.h @@ -56,7 +56,8 @@ #define PS_ALPHA_BLEND(b,o,c) ((b)->data[(o) & 0xFF][(c) & 0xFF]) #define PATTERN_LINE(y) _drawing_pattern->line[((y) - _drawing_y_anchor) & _drawing_y_mask] -#define GET_PATTERN_PIXEL(x,y) GET_MEMORY_PIXEL(OFFSET_PIXEL_PTR(PATTERN_LINE(y), (x))) +#define GET_PATTERN_PIXEL(x,y) GET_MEMORY_PIXEL(OFFSET_PIXEL_PTR(PATTERN_LINE(y), \ + ((x) - _drawing_x_anchor) & _drawing_x_mask)) #define RLE_PTR signed char* #define RLE_IS_EOL(c) ((c) == 0) diff --git a/src/c/cgfx.h b/src/c/cgfx.h index c3cde2ead0..f925535af6 100644 --- a/src/c/cgfx.h +++ b/src/c/cgfx.h @@ -169,7 +169,7 @@ void FUNC_LINEAR_HLINE(BITMAP *dst, int dx1, int dy, int dx2, int color) INC_PIXEL_PTR(d); } while (--curw > 0); s = sline; - curw = ((w < (int)_drawing_x_mask+1) ? w : _drawing_x_mask+1); + curw = MIN(w, (int)_drawing_x_mask+1); } while (curw > 0); } else if (_drawing_mode == DRAW_MODE_SOLID_PATTERN) { @@ -187,7 +187,7 @@ void FUNC_LINEAR_HLINE(BITMAP *dst, int dx1, int dy, int dx2, int color) INC_PIXEL_PTR(d); } while (--curw > 0); s = sline; - curw = ((w < (int)_drawing_x_mask+1) ? w : _drawing_x_mask+1); + curw = MIN(w, (int)_drawing_x_mask+1); } while (curw > 0); } else if (_drawing_mode == DRAW_MODE_MASKED_PATTERN) { @@ -202,7 +202,7 @@ void FUNC_LINEAR_HLINE(BITMAP *dst, int dx1, int dy, int dx2, int color) INC_PIXEL_PTR(d); } while (--curw > 0); s = sline; - curw = ((w < (int)_drawing_x_mask+1) ? w : _drawing_x_mask+1); + curw = MIN(w, (int)_drawing_x_mask+1); } while (curw > 0); } } diff --git a/src/c/cspr.h b/src/c/cspr.h index c5af062485..d159ad478b 100644 --- a/src/c/cspr.h +++ b/src/c/cspr.h @@ -203,6 +203,8 @@ void FUNC_LINEAR_DRAW_SPRITE_V_FLIP(BITMAP *dst, BITMAP *src, int dx, int dy) if (h <= 0) return; + /* use backward drawing onto dst */ + sybeg = src->h - (sybeg + h); dybeg += h - 1; } else { @@ -269,6 +271,8 @@ void FUNC_LINEAR_DRAW_SPRITE_H_FLIP(BITMAP *dst, BITMAP *src, int dx, int dy) if (w <= 0) return; + /* use backward drawing onto dst */ + sxbeg = src->w - (sxbeg + w); dxbeg += w - 1; tmp = dst->ct - dy; @@ -344,6 +348,8 @@ void FUNC_LINEAR_DRAW_SPRITE_VH_FLIP(BITMAP *dst, BITMAP *src, int dx, int dy) if (w <= 0) return; + /* use backward drawing onto dst */ + sxbeg = src->w - (sxbeg + w); dxbeg += w - 1; tmp = dst->ct - dy; @@ -355,6 +361,8 @@ void FUNC_LINEAR_DRAW_SPRITE_VH_FLIP(BITMAP *dst, BITMAP *src, int dx, int dy) if (h <= 0) return; + /* use backward drawing onto dst */ + sybeg = src->h - (sybeg + h); dybeg += h - 1; } else { diff --git a/src/c/cstretch.c b/src/c/cstretch.c index f966286930..c3832aaed2 100644 --- a/src/c/cstretch.c +++ b/src/c/cstretch.c @@ -106,14 +106,10 @@ static void stretch_line16(unsigned long dptr, unsigned char *sptr) #endif #ifdef ALLEGRO_COLOR24 -static long bmp_memory_read24(unsigned char *p) -{ - return ((*(p)) | ((*(p + 1)) << 8) | ((*(p + 2)) << 16)); -} static void stretch_line24(unsigned long dptr, unsigned char *sptr) { - DECLARE_STRETCHER(unsigned char, 3, bmp_write24, bmp_memory_read24); + DECLARE_STRETCHER(unsigned char, 3, bmp_write24, READ3BYTES); } #endif @@ -211,7 +207,7 @@ static void stretch_masked_line16(unsigned long dptr, unsigned char *sptr) #ifdef ALLEGRO_COLOR24 static void stretch_masked_line24(unsigned long dptr, unsigned char *sptr) { - DECLARE_MASKED_STRETCHER(unsigned char, 3, bmp_write24, bmp_memory_read24, MASK_COLOR_24); + DECLARE_MASKED_STRETCHER(unsigned char, 3, bmp_write24, READ3BYTES, MASK_COLOR_24); } #endif diff --git a/src/color.c b/src/color.c index a383cb9eb0..c02cdec1db 100644 --- a/src/color.c +++ b/src/color.c @@ -268,7 +268,7 @@ static unsigned int col_diff[3*128]; * Color matching is done with weighted squares, which are much faster * if we pregenerate a little lookup table... */ -static void bestfit_init() +static void bestfit_init(void) { int i; @@ -347,22 +347,24 @@ void hsv_to_rgb(float h, float s, float v, int *r, int *g, int *b) float f, x, y, z; int i; - v *= 255.0; + v *= 255.0f; - if (s == 0.0) { + if (s == 0.0f) { *r = *g = *b = (int)v; } else { - while (h < 0) - h += 360; - h = fmod(h, 360) / 60.0; + h = fmod(h, 360.0) / 60.0; + if (h < 0) + h += 6.0f; + i = (int)h; f = h - i; - x = v * (1.0 - s); - y = v * (1.0 - (s * f)); - z = v * (1.0 - (s * (1.0 - f))); + x = v * (1.0f - s) + 0.5f; + y = v * (1.0f - (s * f)) + 0.5f; + z = v * (1.0f - (s * (1.0f - f))) + 0.5f; switch (i) { + case 6: case 0: *r = v; *g = z; *b = x; break; case 1: *r = y; *g = v; *b = x; break; case 2: *r = x; *g = v; *b = z; break; @@ -382,33 +384,33 @@ void rgb_to_hsv(int r, int g, int b, float *h, float *s, float *v) { float min, max, delta, rc, gc, bc; - rc = (float)r / 255.0; - gc = (float)g / 255.0; - bc = (float)b / 255.0; + rc = (float)r / 255.0f; + gc = (float)g / 255.0f; + bc = (float)b / 255.0f; max = MAX(rc, MAX(gc, bc)); min = MIN(rc, MIN(gc, bc)); delta = max - min; *v = max; - if (max != 0.0) + if (max != 0.0f) *s = delta / max; else - *s = 0.0; + *s = 0.0f; - if (*s == 0.0) { - *h = 0.0; + if (*s == 0.0f) { + *h = 0.0f; } else { if (rc == max) *h = (gc - bc) / delta; else if (gc == max) - *h = 2 + (bc - rc) / delta; + *h = 2.0f + (bc - rc) / delta; else if (bc == max) - *h = 4 + (rc - gc) / delta; + *h = 4.0f + (rc - gc) / delta; - *h *= 60.0; - if (*h < 0) - *h += 360.0; + *h *= 60.0f; + if (*h < 0.0f) + *h += 360.0f; } } diff --git a/src/config.c b/src/config.c index 87bf39400a..ac84768ae5 100644 --- a/src/config.c +++ b/src/config.c @@ -18,6 +18,8 @@ */ +#include + #include "allegro.h" #include "allegro/internal/aintern.h" @@ -250,7 +252,7 @@ static void init_config(int loaddata) */ static int get_line(AL_CONST char *data, int length, char *name, int name_size, char *val, int val_size) { - char buf[256], buf2[256]; + char buf[512], buf2[512]; int inpos, outpos, i, j; int c, c2, w0; @@ -1159,17 +1161,23 @@ AL_CONST char *get_config_text(AL_CONST char *msg) init_config(TRUE); - s = umsg; - pos = 0; - - while ((c = ugetxc(&s)) != 0) { - if ((uisspace(c)) || (c == '=') || (c == '#')) - pos += usetc(name+pos, '_'); - else - pos += usetc(name+pos, c); + /* kludge to make it easier to translate the message */ + if (strcmp(msg, ALLEGRO_WINDOW_CLOSE_MESSAGE) == 0) { + do_uconvert("allegro_window_close_message", U_ASCII, name, U_CURRENT, sizeof(name)); } + else { + s = umsg; + pos = 0; - usetc(name+pos, 0); + while ((c = ugetxc(&s)) != 0) { + if ((uisspace(c)) || (c == '=') || (c == '#')) + pos += usetc(name+pos, '_'); + else + pos += usetc(name+pos, c); + } + + usetc(name+pos, 0); + } /* check for hooked sections */ hook = config_hook; diff --git a/src/datafile.c b/src/datafile.c index 37a55bbcba..d682c49c9a 100644 --- a/src/datafile.c +++ b/src/datafile.c @@ -2072,11 +2072,11 @@ void _construct_datafile(DATAFILE *data) /* _initialize_datafile_types: * Register my loader functions with the code in dataregi.c. */ -#ifdef CONSTRUCTOR_FUNCTION - CONSTRUCTOR_FUNCTION(void _initialize_datafile_types()); +#ifdef ALLEGRO_USE_CONSTRUCTOR + CONSTRUCTOR_FUNCTION(void _initialize_datafile_types(void)); #endif -void _initialize_datafile_types() +void _initialize_datafile_types(void) { register_datafile_object(DAT_FILE, load_file_object, (void (*)(void *data))unload_datafile ); register_datafile_object(DAT_FONT, load_font_object, (void (*)(void *data))destroy_font ); diff --git a/src/dispsw.c b/src/dispsw.c index 19917b219c..ea32064cd9 100644 --- a/src/dispsw.c +++ b/src/dispsw.c @@ -393,7 +393,7 @@ static void restore_bitmap_state(BITMAP_INFORMATION *info) /* _restore_switch_state: * Restores the graphics state after a console switch. */ -void _restore_switch_state() +void _restore_switch_state(void) { BITMAP_INFORMATION *info = info_list; int hadmouse, hadtimer; diff --git a/src/dos/adlib.c b/src/dos/adlib.c index 407c473dc5..95713b1ce2 100644 --- a/src/dos/adlib.c +++ b/src/dos/adlib.c @@ -653,7 +653,7 @@ static int fm_mixer_volume(int volume) /* fm_is_there: * Checks for the presence of an OPL synth at the current port. */ -static int fm_is_there() +static int fm_is_there(void) { fm_write(1, 0); /* init test register */ diff --git a/src/dos/dfile.c b/src/dos/dfile.c index 6a42cc8719..8eaea7e25b 100644 --- a/src/dos/dfile.c +++ b/src/dos/dfile.c @@ -130,10 +130,6 @@ static void fill_ffblk(struct al_ffblk *info) -/* we pass all the flags to findfirst() in order to work around the DOS limitations */ -#define FA_ALL (FA_RDONLY | FA_HIDDEN | FA_SYSTEM | FA_LABEL | FA_DIREC | FA_ARCH) - - /* al_findfirst: * Initiates a directory search. */ @@ -154,18 +150,23 @@ int al_findfirst(AL_CONST char *pattern, struct al_ffblk *info, int attrib) /* attach it to the info structure */ info->ff_data = (void *) ff_data; - /* initialize it */ - ff_data->attrib = attrib; + /* Win2k appears to set bit7 for files which otherwise + * would not have any attribute flag set. + */ + ff_data->attrib = attrib | 0x80; /* start the search */ errno = *allegro_errno = 0; - /* The return value of findfirst() and findnext() is not meaningful because the + /* We pass all the flags to findfirst() in order to work around the DOS limitations + * for FA_RDONLY and FA_ARCH which are normally ignored. + * + * The return value of findfirst() and findnext() is not meaningful because the * functions return an errno code under DJGPP (ENOENT or ENMFILE) whereas they * return a DOS error code under Watcom (02h, 03h or 12h). * However the functions of both compilers set errno accordingly. */ - ret = findfirst(uconvert_toascii(pattern, tmp), &ff_data->data, FA_ALL); + ret = findfirst(uconvert_toascii(pattern, tmp), &ff_data->data, 0xFF); if (ret != 0) { #ifdef ALLEGRO_DJGPP diff --git a/src/dos/djirq.c b/src/dos/djirq.c index 13c41aea55..c43b1da145 100644 --- a/src/dos/djirq.c +++ b/src/dos/djirq.c @@ -36,18 +36,18 @@ _IRQ_HANDLER _irq_handler[MAX_IRQS]; unsigned char *_irq_stack[IRQ_STACKS]; -extern void _irq_wrapper_0(), _irq_wrapper_1(), - _irq_wrapper_2(), _irq_wrapper_3(), - _irq_wrapper_4(), _irq_wrapper_5(), - _irq_wrapper_6(), _irq_wrapper_7(), - _irq_wrapper_0_end(); +extern void _irq_wrapper_0(void), _irq_wrapper_1(void), + _irq_wrapper_2(void), _irq_wrapper_3(void), + _irq_wrapper_4(void), _irq_wrapper_5(void), + _irq_wrapper_6(void), _irq_wrapper_7(void), + _irq_wrapper_0_end(void); /* _dos_irq_init: * Initialises this module. */ -void _dos_irq_init() +void _dos_irq_init(void) { int c; @@ -74,7 +74,7 @@ void _dos_irq_init() /* _dos_irq_exit: * Routine for freeing the interrupt handler stacks. */ -void _dos_irq_exit() +void _dos_irq_exit(void) { int c; @@ -95,7 +95,7 @@ void _dos_irq_exit() * switching. The C function should return zero to exit the interrupt with * an iret instruction, and non-zero to chain to the old handler. */ -int _install_irq(int num, int (*handler)()) +int _install_irq(int num, int (*handler)(void)) { __dpmi_paddr addr; int c; diff --git a/src/dos/dkeybd.c b/src/dos/dkeybd.c index 8c988de1e8..1c9b299058 100644 --- a/src/dos/dkeybd.c +++ b/src/dos/dkeybd.c @@ -74,7 +74,7 @@ _DRIVER_INFO _keyboard_driver_list[] = /* kb_wait_for_write_ready: * Wait for the keyboard controller to set the ready-for-write bit. */ -static INLINE int kb_wait_for_write_ready() +static INLINE int kb_wait_for_write_ready(void) { int timeout = 4096; @@ -89,7 +89,7 @@ static INLINE int kb_wait_for_write_ready() /* kb_wait_for_read_ready: * Wait for the keyboard controller to set the ready-for-read bit. */ -static INLINE int kb_wait_for_read_ready() +static INLINE int kb_wait_for_read_ready(void) { int timeout = 16384; diff --git a/src/dos/dsystem.c b/src/dos/dsystem.c index f172a73e73..c762544563 100644 --- a/src/dos/dsystem.c +++ b/src/dos/dsystem.c @@ -159,7 +159,7 @@ static void signal_handler(int num) /* detect_os: * Operating system autodetection routine. */ -static void detect_os() +static void detect_os(void) { __dpmi_regs r; char buf[16]; diff --git a/src/dos/dtimer.c b/src/dos/dtimer.c index 1893af9575..79898d9c67 100644 --- a/src/dos/dtimer.c +++ b/src/dos/dtimer.c @@ -130,7 +130,7 @@ static INLINE void set_timer_rate(long time) /* read_timer: * Reads the elapsed time from PIT channel 1. */ -static INLINE long read_timer() +static INLINE long read_timer(void) { long x; @@ -146,7 +146,7 @@ static INLINE long read_timer() /* fixed_timer_handler: * Interrupt handler for the fixed-rate timer driver. */ -static int fixed_timer_handler() +static int fixed_timer_handler(void) { int bios; @@ -224,7 +224,7 @@ void fixed_timer_exit() /* var_timer_handler: * Interrupt handler for the variable-rate timer driver. */ -static int var_timer_handler() +static int var_timer_handler(void) { long new_delay = 0x8000; int callback[MAX_TIMERS]; @@ -358,7 +358,7 @@ END_OF_STATIC_FUNCTION(var_timer_handler); /* var_timer_can_simulate_retrace: * Checks whether it is cool to enable retrace syncing at the moment. */ -int var_timer_can_simulate_retrace() +int var_timer_can_simulate_retrace(void) { return ((gfx_driver) && ((gfx_driver->id == GFX_VGA) || (gfx_driver->id == GFX_MODEX))); @@ -370,7 +370,7 @@ int var_timer_can_simulate_retrace() * Times several vertical retraces, and calibrates the retrace syncing * code accordingly. */ -static void timer_calibrate_retrace() +static void timer_calibrate_retrace(void) { int ot = _timer_use_retrace; int c; diff --git a/src/dos/emu8k.c b/src/dos/emu8k.c index 1dc1da7f17..3811f59ea9 100644 --- a/src/dos/emu8k.c +++ b/src/dos/emu8k.c @@ -1084,7 +1084,7 @@ END_OF_STATIC_FUNCTION(emu8k_terminatesound); * of the BLASTER environment variable, and then does some test reads to check * that there is an EMU8000 there. */ -int emu8k_detect() +int emu8k_detect(void) { char *envvar; diff --git a/src/dos/emu8k.h b/src/dos/emu8k.h index 629291bfdb..88e7445920 100644 --- a/src/dos/emu8k.h +++ b/src/dos/emu8k.h @@ -109,11 +109,11 @@ typedef int generators_t[SOUNDFONT_NUM_GENERATORS]; extern int _emu8k_baseport; extern int _emu8k_numchannels; -void emu8k_init(); +void emu8k_init(void); void emu8k_startsound(int channel,struct envparms_t *envparms); void emu8k_releasesound(int channel,struct envparms_t *envparms); void emu8k_terminatesound(int channel); -int emu8k_detect(); +int emu8k_detect(void); void emu8k_modulate_atten (int channel, int atten); void emu8k_modulate_ip (int channel, int ip); @@ -122,7 +122,7 @@ void emu8k_modulate_pan (int channel, int pan); envparms_t *emu8k_createenvelope(generators_t); void emu8k_destroyenvelope(envparms_t *); -void emu8k_lock(); +void emu8k_lock(void); void *_lock_malloc(size_t size); /* malloc and lock */ diff --git a/src/dos/emu8kmid.c b/src/dos/emu8kmid.c index 51d81163de..dad1474648 100644 --- a/src/dos/emu8kmid.c +++ b/src/dos/emu8kmid.c @@ -335,7 +335,7 @@ static int awe32_detect(int input) /* awe32_lockmem: * Locks required memory blocks */ -static void awe32_lockmem() +static void awe32_lockmem(void) { /* functions */ LOCK_FUNCTION(awe32_key_on); diff --git a/src/dos/essaudio.c b/src/dos/essaudio.c index 1b439f9603..3164da2cf3 100644 --- a/src/dos/essaudio.c +++ b/src/dos/essaudio.c @@ -87,14 +87,14 @@ static int ess_sel; /* selector for the DMA buffer */ static unsigned long ess_buf[2]; /* pointers to the two buffers */ static int ess_bufnum = 0; /* the one currently in use */ -static void ess_lock_mem(); +static void ess_lock_mem(void); /* ess_buffer_size: * Returns the current DMA buffer size, for use by the audiostream code. */ -static int ess_buffer_size() +static int ess_buffer_size(void) { return ess_dma_size/4; /* convert bytes to stereo 16 bit samples */ } @@ -104,7 +104,7 @@ static int ess_buffer_size() /* is_dsp_ready_for_read: * Determines if DSP is ready to be read from. */ -static INLINE RET_VOLATILE int is_dsp_ready_for_read() +static INLINE RET_VOLATILE int is_dsp_ready_for_read(void) { return (inportb(0x0E + _sound_port) & 0x80); } @@ -114,7 +114,7 @@ static INLINE RET_VOLATILE int is_dsp_ready_for_read() /* ess_read_dsp: * Reads a byte from the DSP chip. Returns -1 if it times out. */ -static INLINE RET_VOLATILE int ess_read_dsp() +static INLINE RET_VOLATILE int ess_read_dsp(void) { int x; @@ -183,7 +183,7 @@ static void ess_set_sample_rate(unsigned int rate) /* ess_read_dsp_version: * Reads the version number of the AudioDrive DSP chip, returning -1 on error. */ -static int ess_read_dsp_version() +static int ess_read_dsp_version(void) { if (ess_hw_ver > 0) return ess_hw_ver; @@ -252,7 +252,7 @@ END_OF_STATIC_FUNCTION(ess_play_buffer); /* ess_interrupt: * The AudioDrive end-of-buffer interrupt handler. */ -static int ess_interrupt() +static int ess_interrupt(void) { int value; @@ -520,7 +520,7 @@ static void ess_exit(int input) * Locks all the memory touched by parts of the AudiDrive code that are * executed in an interrupt context. */ -static void ess_lock_mem() +static void ess_lock_mem(void) { LOCK_VARIABLE(digi_audiodrive); LOCK_VARIABLE(_sound_freq); diff --git a/src/dos/ifsega.c b/src/dos/ifsega.c index 145333c142..3d48bfe33d 100644 --- a/src/dos/ifsega.c +++ b/src/dos/ifsega.c @@ -28,10 +28,10 @@ /* driver functions */ -static int sg_init(); -static void sg_exit(); +static int sg_init(void); +static void sg_exit(void); static int sg_poll(int); -static int sg1_poll(); +static int sg1_poll(void); static int sg_poll_sub(int num, int base); static int sg_poll_sub2(int base); @@ -59,7 +59,7 @@ JOYSTICK_DRIVER joystick_sg1 = /* sg_init: * Initialises the driver. */ -static int sg_init() +static int sg_init(void) { static char *name_b[] = { "A", "B", "C", "X", "Y", "Z", "L", "R", "Start" }; int i, j; @@ -92,7 +92,7 @@ static int sg_init() /* sg_exit: * Shuts down the driver. */ -static void sg_exit() +static void sg_exit(void) { } @@ -389,7 +389,7 @@ static void sg_button_init(int num) /* sg1_poll: * 1P - Updates the joystick status variables. */ -static int sg1_poll() +static int sg1_poll(void) { return sg_poll(IFSEGAISA_BASE); } diff --git a/src/dos/joystd.c b/src/dos/joystd.c index db39109ca0..a9093041d4 100644 --- a/src/dos/joystd.c +++ b/src/dos/joystd.c @@ -201,7 +201,7 @@ static int joy2_old_x, joy2_old_y; /* poll_mask: * Returns a mask indicating which axes to poll. */ -static int poll_mask() +static int poll_mask(void) { int mask = MASK_1X | MASK_1Y; @@ -254,7 +254,7 @@ static int averaged_poll(int *x, int *y, int *x2, int *y2, int mask) * Called after each calibration operation, to calculate what else might * need to be measured for the current hardware. */ -static void recalc_calibration_flags() +static void recalc_calibration_flags(void) { #define FLAG_SET(n) ((joystick_flags & (n)) == (n)) @@ -310,7 +310,7 @@ static void recalc_calibration_flags() /* joy_init: * Initialises the driver. */ -static int joy_init() +static int joy_init(void) { int i; @@ -433,7 +433,7 @@ static int joy_init() /* joy_exit: * Shuts down the driver. */ -static void joy_exit() +static void joy_exit(void) { joystick_flags = 0; } @@ -512,7 +512,7 @@ static int calibrate_corner(int stick, int corner) /* calibrate_joystick_tl: * For backward compatibility with the old API. */ -int calibrate_joystick_tl() +int calibrate_joystick_tl(void) { int ret; @@ -532,7 +532,7 @@ int calibrate_joystick_tl() /* calibrate_joystick_br: * For backward compatibility with the old API. */ -int calibrate_joystick_br() +int calibrate_joystick_br(void) { int ret; @@ -555,7 +555,7 @@ int calibrate_joystick_br() * (the user decides whether this is all the way forwards or all the * way back), and also call calibrate_joystick_throttle_max(). */ -int calibrate_joystick_throttle_min() +int calibrate_joystick_throttle_min(void) { int dummy; @@ -583,7 +583,7 @@ int calibrate_joystick_throttle_min() * (the user decides whether this is all the way forwards or all the * way back), and also call calibrate_joystick_throttle_min(). */ -int calibrate_joystick_throttle_max() +int calibrate_joystick_throttle_max(void) { int dummy; @@ -677,7 +677,7 @@ static int sort_out_analogue(int x, int min, int low_margin, int high_margin, in /* joy_poll: * Updates the joystick status variables. */ -static int joy_poll() +static int joy_poll(void) { int x, y, x2, y2, i; unsigned char status; @@ -900,7 +900,7 @@ static int poll(int *x, int *y, int *x2, int *y2, int poll_mask) /* joy_save_data: * Writes calibration data into the config file. */ -static int joy_save_data() +static int joy_save_data(void) { char tmp1[128], tmp2[128]; char *j = uconvert_ascii("joystick", tmp1); @@ -945,7 +945,7 @@ static int joy_save_data() /* joy_load_data: * Loads calibration data from the config file. */ -static int joy_load_data() +static int joy_load_data(void) { char tmp1[128], tmp2[128]; char *j = uconvert_ascii("joystick", tmp1); diff --git a/src/dos/mpu.c b/src/dos/mpu.c index 96f5b962aa..b78adc6f2c 100644 --- a/src/dos/mpu.c +++ b/src/dos/mpu.c @@ -137,7 +137,7 @@ END_OF_FUNCTION(_mpu_poll); /* mpu_interrupt: * Handler for the MPU-401 input interrupt. */ -static int mpu_interrupt() +static int mpu_interrupt(void) { _mpu_poll(); _eoi(_mpu_irq); diff --git a/src/dos/multijoy.c b/src/dos/multijoy.c index b05a25d80f..0121df484e 100644 --- a/src/dos/multijoy.c +++ b/src/dos/multijoy.c @@ -88,25 +88,25 @@ #define LPT3_BASE 0x3bc /* driver functions */ -static int db91_init(); -static int db92_init(); -static int db93_init(); -static void db91_exit(); -static void db92_exit(); -static void db93_exit(); -static int db91_poll(); -static int db92_poll(); -static int db93_poll(); - -static int tgx1_init(); -static int tgx2_init(); -static int tgx3_init(); -static void tgx1_exit(); -static void tgx2_exit(); -static void tgx3_exit(); -static int tgx1_poll(); -static int tgx2_poll(); -static int tgx3_poll(); +static int db91_init(void); +static int db92_init(void); +static int db93_init(void); +static void db91_exit(void); +static void db92_exit(void); +static void db93_exit(void); +static int db91_poll(void); +static int db92_poll(void); +static int db93_poll(void); + +static int tgx1_init(void); +static int tgx2_init(void); +static int tgx3_init(void); +static void tgx1_exit(void); +static void tgx2_exit(void); +static void tgx3_exit(void); +static int tgx1_poll(void); +static int tgx2_poll(void); +static int tgx3_poll(void); JOYSTICK_DRIVER joystick_db91 = { @@ -218,34 +218,34 @@ static int db9_init (int base) return 0; } -static int db91_init() +static int db91_init(void) { return db9_init(LPT1_BASE); } -static int db92_init() +static int db92_init(void) { return db9_init(LPT2_BASE); } -static int db93_init() +static int db93_init(void) { return db9_init(LPT3_BASE); } -static void db91_exit() +static void db91_exit(void) { outportb(LPT1_BASE + 2 , 0 ^ CONTROL_PORT_INVERT); outportb(LPT1_BASE + 0x402, 0x15); } -static void db92_exit() +static void db92_exit(void) { outportb(LPT2_BASE + 2 , 0 ^ CONTROL_PORT_INVERT); outportb(LPT2_BASE + 0x402, 0x15); } -static void db93_exit() +static void db93_exit(void) { outportb(LPT3_BASE + 2 , 0 ^ CONTROL_PORT_INVERT); outportb(LPT3_BASE + 0x402, 0x15); @@ -282,19 +282,19 @@ static void db9_poll(int base) joy[0].button[1].b = (status & 32 ) ? 0 : 1; } -static int db91_poll() +static int db91_poll(void) { db9_poll (LPT1_BASE); return 0; } -static int db92_poll() +static int db92_poll(void) { db9_poll (LPT2_BASE); return 0; } -static int db93_poll() +static int db93_poll(void) { db9_poll (LPT3_BASE); return 0; @@ -331,32 +331,32 @@ static int tgx_init(int base) return 0; } -static int tgx1_init() +static int tgx1_init(void) { return tgx_init(LPT1_BASE); } -static int tgx2_init() +static int tgx2_init(void) { return tgx_init(LPT2_BASE); } -static int tgx3_init() +static int tgx3_init(void) { return tgx_init(LPT3_BASE); } -static void tgx1_exit() +static void tgx1_exit(void) { outportb (LPT1_BASE + 2, 0 ^ CONTROL_PORT_INVERT); } -static void tgx2_exit() +static void tgx2_exit(void) { outportb (LPT2_BASE + 2, 0 ^ CONTROL_PORT_INVERT); } -static void tgx3_exit() +static void tgx3_exit(void) { outportb (LPT3_BASE + 2, 0 ^ CONTROL_PORT_INVERT); } @@ -388,19 +388,19 @@ static void tgx_poll(int base) joy[number].button[4].b = (control & 8) ? 0 : 1; } } -static int tgx1_poll() +static int tgx1_poll(void) { tgx_poll (LPT1_BASE); return 0; } -static int tgx2_poll() +static int tgx2_poll(void) { tgx_poll (LPT2_BASE); return 0; } -static int tgx3_poll() +static int tgx3_poll(void) { tgx_poll (LPT3_BASE); return 0; diff --git a/src/dos/n64pad.c b/src/dos/n64pad.c index 3460f00d81..d1b5b0065b 100644 --- a/src/dos/n64pad.c +++ b/src/dos/n64pad.c @@ -53,13 +53,13 @@ /* driver functions */ -static int n64_init(); -static void n64p1_exit(); -static void n64p2_exit(); -static void n64p3_exit(); -static int n64p1_poll(); -static int n64p2_poll(); -static int n64p3_poll(); +static int n64_init(void); +static void n64p1_exit(void); +static void n64p2_exit(void); +static void n64p3_exit(void); +static int n64p1_poll(void); +static int n64p2_poll(void); +static int n64p3_poll(void); static int n64_detect(int base, int joynum); @@ -112,7 +112,7 @@ JOYSTICK_DRIVER joystick_n643 = /* n64_init: * Initialiases the N64 joypad driver. */ -static int n64_init() +static int n64_init(void) { int i; @@ -157,7 +157,7 @@ static int n64_init() /* n64p1_exit: * Shuts down the driver. */ -static void n64p1_exit() +static void n64p1_exit(void) { outportb(LPT1_BASE, 0x00); } @@ -167,7 +167,7 @@ static void n64p1_exit() /* n64p2_exit: * Shuts down the driver. */ -static void n64p2_exit() +static void n64p2_exit(void) { outportb(LPT2_BASE, 0x00); } @@ -177,7 +177,7 @@ static void n64p2_exit() /* n64p3_exit: * Shuts down the driver. */ -static void n64p3_exit() +static void n64p3_exit(void) { outportb(LPT3_BASE, 0x00); } @@ -333,7 +333,7 @@ static int n64_poll(int base, int joynum) /* n64p1_poll: * Input polling function. */ -static int n64p1_poll() +static int n64p1_poll(void) { int joynum; @@ -348,7 +348,7 @@ static int n64p1_poll() /* n64p2_poll: * Input polling function. */ -static int n64p2_poll() +static int n64p2_poll(void) { int joynum; @@ -363,7 +363,7 @@ static int n64p2_poll() /* n64p3_poll: * Input polling function. */ -static int n64p3_poll() +static int n64p3_poll(void) { int joynum; diff --git a/src/dos/psxpad.c b/src/dos/psxpad.c index 1bbabe8797..fdd07bf0d9 100644 --- a/src/dos/psxpad.c +++ b/src/dos/psxpad.c @@ -154,17 +154,17 @@ /* driver functions */ -static int psx1_init(); -static int psx2_init(); -static int psx3_init(); +static int psx1_init(void); +static int psx2_init(void); +static int psx3_init(void); static void psx_exit(int base); -static void psx1_exit(); -static void psx2_exit(); -static void psx3_exit(); -static int psx1_poll(); -static int psx2_poll(); -static int psx3_poll(); -static int psx_detect(); +static void psx1_exit(void); +static void psx2_exit(void); +static void psx3_exit(void); +static int psx1_poll(void); +static int psx2_poll(void); +static int psx3_poll(void); +static int psx_detect(int base, int conport, int tap); @@ -412,21 +412,21 @@ static int psx_init(int base) -static int psx1_init() +static int psx1_init(void) { return psx_init(LPT1_BASE); } -static int psx2_init() +static int psx2_init(void) { return psx_init(LPT2_BASE); } -static int psx3_init() +static int psx3_init(void) { return psx_init(LPT3_BASE); } @@ -438,21 +438,21 @@ static int psx3_init() * disabled - otherwise prevents Sony Dual Shock controller crash protection */ -static void psx1_exit() +static void psx1_exit(void) { /*outportb(LPT1_BASE + 0, 0); */ } -static void psx2_exit() +static void psx2_exit(void) { /*outportb(LPT2_BASE + 0, 0); */ } -static void psx3_exit() +static void psx3_exit(void) { /*outportb(LPT3_BASE + 0, 0); */ } @@ -1069,7 +1069,7 @@ static void psx_poll(int base, int conport, int tap, int type, int joynum) -static int psx1_poll() +static int psx1_poll(void) { int joynum; @@ -1093,7 +1093,7 @@ static int psx1_poll() -static int psx2_poll() +static int psx2_poll(void) { int joynum; @@ -1117,7 +1117,7 @@ static int psx2_poll() -static int psx3_poll() +static int psx3_poll(void) { int joynum; diff --git a/src/dos/sb.c b/src/dos/sb.c index 1377046fc3..87eac71adc 100644 --- a/src/dos/sb.c +++ b/src/dos/sb.c @@ -215,7 +215,7 @@ static void sb_lock_mem(void); /* sb_read_dsp: * Reads a byte from the SB DSP chip. Returns -1 if it times out. */ -static INLINE RET_VOLATILE int sb_read_dsp() +static INLINE RET_VOLATILE int sb_read_dsp(void) { int x; @@ -412,7 +412,7 @@ int _sb_reset_dsp(int data) /* _sb_read_dsp_version: * Reads the version number of the SB DSP chip, returning -1 on error. */ -int _sb_read_dsp_version() +int _sb_read_dsp_version(void) { int x, y; @@ -440,7 +440,7 @@ int _sb_read_dsp_version() /* sb_buffer_size: * Returns the current DMA buffer size, for use by the audiostream code. */ -static int sb_buffer_size() +static int sb_buffer_size(void) { return (sb_stereo ? sb_dma_mix_size/2 : sb_dma_mix_size); } @@ -522,7 +522,7 @@ END_OF_STATIC_FUNCTION(sb_record_buffer); * if the card doesn't have auto-initialised dma, and then refills the * buffer that just finished playing. */ -static int sb_interrupt() +static int sb_interrupt(void) { unsigned char isr; @@ -598,7 +598,7 @@ END_OF_STATIC_FUNCTION(sb_interrupt); /* sb_start: * Starts up the sound output. */ -static void sb_start() +static void sb_start(void) { sb_bufnum = 0; @@ -621,7 +621,7 @@ static void sb_start() /* sb_stop: * Stops the sound output. */ -static void sb_stop() +static void sb_stop(void) { /* halt sound output */ _sb_voice(0); @@ -1143,7 +1143,7 @@ static int sb_rec_start(int rate, int bits, int stereo) /* sb_rec_stop: * Stops recording, switches the SB back to D/A mode, and restarts playback. */ -static void sb_rec_stop() +static void sb_rec_stop(void) { if (!sb_recording) return; @@ -1186,7 +1186,7 @@ END_OF_STATIC_FUNCTION(sb_rec_read); /* sb_midi_interrupt: * Interrupt handler for the SB MIDI input. */ -static int sb_midi_interrupt() +static int sb_midi_interrupt(void) { int c = sb_read_dsp(); @@ -1291,9 +1291,9 @@ static void sb_midi_exit(int input) * Locks all the memory touched by parts of the SB code that are executed * in an interrupt context. */ -static void sb_lock_mem() +static void sb_lock_mem(void) { - extern void _mpu_poll_end(); + extern void _mpu_poll_end(void); LOCK_VARIABLE(digi_sb10); LOCK_VARIABLE(digi_sb15); diff --git a/src/dos/sndscape.c b/src/dos/sndscape.c index bdb7f30c43..859371de4f 100644 --- a/src/dos/sndscape.c +++ b/src/dos/sndscape.c @@ -205,7 +205,7 @@ DIGI_DRIVER digi_soundscape = /* soundscape_buffer_size: * Returns the current DMA buffer size, for use by the audiostream code. */ -static int soundscape_buffer_size() +static int soundscape_buffer_size(void) { return soundscape_dma_size/4; /* convert bytes to stereo 16 bit samples */ } @@ -347,7 +347,7 @@ static int set_format(int srate, int stereo, int size16bit, int direction) /* stop_codec: * This function will stop the CoDec auto-restart DMA process. */ -static void stop_codec() +static void stop_codec(void) { int i; @@ -423,7 +423,7 @@ static int get_ini_config_entry(char *entry, char *dest, FILE *fp) /* get_init_config: * This function gets all parameters from a file (SNDSCAPE.INI) */ -static int get_init_config() +static int get_init_config(void) { FILE *fp = NULL; char str[78]; @@ -513,7 +513,7 @@ static int get_init_config() * present. If this function is not explicitly called by the application, it * it will be called by the OpenSoundscape function. */ -static int detect_soundscape() +static int detect_soundscape(void) { int tmp; @@ -570,7 +570,7 @@ static int soundscape_mixer_volume(int volume) /* soundscape_interrupt: * The Soundscape end-of-buffer interrupt handler. */ -static int soundscape_interrupt() +static int soundscape_interrupt(void) { /* if the CoDec is interrupting ... */ if (inportb(soundscape_waveport + CD_STATUS_OFF) & 0x01) { @@ -826,7 +826,7 @@ static void soundscape_exit(int input) * Locks all the memory touched by parts of the Soundscape code that are * executed in an interrupt context. */ -static void soundscape_lock_mem() +static void soundscape_lock_mem(void) { LOCK_VARIABLE(digi_soundscape); LOCK_VARIABLE(soundscape_freq); diff --git a/src/dos/vesa.c b/src/dos/vesa.c index 8b4308c959..998e76f7b9 100644 --- a/src/dos/vesa.c +++ b/src/dos/vesa.c @@ -41,7 +41,7 @@ static void vesa_vsync(void); static void vesa_set_palette_range(AL_CONST PALETTE p, int from, int to, int vsync); static int vesa_request_scroll(int x, int y); static int vesa_poll_scroll(void); -static GFX_MODE_LIST *vesa_fetch_mode_list(); +static GFX_MODE_LIST *vesa_fetch_mode_list(void); static char vesa_desc[256] = EMPTY_STRING; @@ -300,7 +300,7 @@ static int evilness_flag = 0; /* set if we are doing dodgy things /* get_vesa_info: * Retrieves a VESA info block structure, returning 0 for success. */ -static int get_vesa_info() +static int get_vesa_info(void) { unsigned long addr; int c; @@ -604,7 +604,7 @@ static void setup_vesa_desc(GFX_DRIVER *driver, int vbe_version, int linear) * Generates a list of valid video modes for the VESA drivers. * Returns the mode list on success or NULL on failure. */ -static GFX_MODE_LIST *vesa_fetch_mode_list() +static GFX_MODE_LIST *vesa_fetch_mode_list(void) { GFX_MODE_LIST *mode_list; unsigned long mode_ptr; @@ -1234,7 +1234,7 @@ static BITMAP *vesa_3_init(int w, int h, int v_w, int v_h, int color_depth) * blanking registers. VBE doesn't provide a vsync function, but we * can emulate it by changing the display start with the vsync flag set. */ -static void vesa_vsync() +static void vesa_vsync(void) { vesa_scroll(vesa_xscroll, vesa_yscroll); } @@ -1419,7 +1419,7 @@ static int vesa_request_scroll(int x, int y) /* vesa_poll_scroll: * VBE 3.0 triple buffering test routine. */ -static int vesa_poll_scroll() +static int vesa_poll_scroll(void) { _dpmi_reg.x.ax = 0x4F07; _dpmi_reg.x.bx = 4; diff --git a/src/dos/wat.c b/src/dos/wat.c index 8035e86a0c..1407ac03b4 100644 --- a/src/dos/wat.c +++ b/src/dos/wat.c @@ -56,11 +56,20 @@ int __djgpp_ds_alias = 0; * Stop those stupid "abort, retry, fail" messages from popping up all * over the place. */ +#if __WATCOMC__ >= 1200 + +static void __interrupt __far my_int24() +{} + +#else + static int __interrupt __far my_int24() { return 3; } +#endif + /* _dos_irq_init: diff --git a/src/dos/wss.c b/src/dos/wss.c index 40b3c963ad..05a25a3d5f 100644 --- a/src/dos/wss.c +++ b/src/dos/wss.c @@ -183,7 +183,7 @@ static struct codec_rate_struct codec_rates[NUMCODECRATES] = /* return size of audiostream buffers */ -static int wss_buffer_size() +static int wss_buffer_size(void) { return BLOCKLEN / (wss_stereo ? 2 : 1) / (wss_16bits ? 2 : 1); } @@ -191,7 +191,7 @@ static int wss_buffer_size() /* WSS busy wait */ -static void wss_wait() +static void wss_wait(void) { int i = 0xFFFF; @@ -203,7 +203,7 @@ static void wss_wait() /* Our IRQ handler. Kinda short... */ -static int wss_irq_handler() +static int wss_irq_handler(void) { /* Ack int */ outportb(STATUS, 0); diff --git a/src/drvlist.c b/src/drvlist.c index cfca528ff5..e187af6d2c 100644 --- a/src/drvlist.c +++ b/src/drvlist.c @@ -37,7 +37,7 @@ static int count_drivers(_DRIVER_INFO *drvlist) /* _create_driver_list: * Creates a new driver list and returns it. Returns NULL on error. */ -_DRIVER_INFO *_create_driver_list() +_DRIVER_INFO *_create_driver_list(void) { _DRIVER_INFO *drv; diff --git a/src/file.c b/src/file.c index 8337f30ec1..001c2b4def 100644 --- a/src/file.c +++ b/src/file.c @@ -35,6 +35,25 @@ +/* permissions to use when opening files */ +#ifndef ALLEGRO_MPW + +/* some OSes have no concept of "group" and "other" */ +#ifndef S_IRGRP + #define S_IRGRP 0 + #define S_IWGRP 0 +#endif +#ifndef S_IROTH + #define S_IROTH 0 + #define S_IWOTH 0 +#endif + +#define OPEN_PERMS (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) + +#endif /* !ALLEGRO_MPW */ + + + #define N 4096 /* 4k buffers for LZ compression */ #define F 18 /* upper limit for LZ match length */ #define THRESHOLD 2 /* LZ encode string into pos and length @@ -1443,9 +1462,9 @@ PACKFILE *pack_fopen(AL_CONST char *filename, AL_CONST char *mode) #ifndef ALLEGRO_MPW if (strpbrk(mode, "wW")) /* write mode? */ - fd = open(uconvert_toascii(filename, tmp), O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); + fd = open(uconvert_toascii(filename, tmp), O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, OPEN_PERMS); else - fd = open(uconvert_toascii(filename, tmp), O_RDONLY | O_BINARY, S_IRUSR | S_IWUSR); + fd = open(uconvert_toascii(filename, tmp), O_RDONLY | O_BINARY, OPEN_PERMS); #else if (strpbrk(mode, "wW")) /* write mode? */ fd = _al_open(uconvert_toascii(filename, tmp), O_WRONLY | O_BINARY | O_CREAT | O_TRUNC); @@ -1544,7 +1563,7 @@ PACKFILE *pack_fopen_chunk(PACKFILE *f, int pack) char *tmp_name = tmpnam(NULL); if (tmp_name) { #ifndef ALLEGRO_MPW - tmp_fd = open(tmp_name, O_RDWR | O_BINARY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); + tmp_fd = open(tmp_name, O_RDWR | O_BINARY | O_CREAT | O_EXCL, OPEN_PERMS); #else tmp_fd = _al_open(tmp_name, O_RDWR | O_BINARY | O_CREAT | O_EXCL); #endif @@ -1815,7 +1834,7 @@ int pack_iputw(int w, PACKFILE *f) -/* pack_iputw: +/* pack_iputl: * Writes a 32 bit long to a file, using intel byte ordering. */ long pack_iputl(long l, PACKFILE *f) @@ -1992,7 +2011,7 @@ static void pack_ungetc (int ch, PACKFILE *f) */ char *pack_fgets(char *p, int max, PACKFILE *f) { - char *pmax; + char *pmax, *orig_p = p; int c; *allegro_errno = 0; @@ -2033,7 +2052,7 @@ char *pack_fgets(char *p, int max, PACKFILE *f) if (c == '\0' || *allegro_errno) return NULL; - return p; + return orig_p; /* p has changed */ } diff --git a/src/fli.c b/src/fli.c index c85cb952fb..37354571b4 100644 --- a/src/fli.c +++ b/src/fli.c @@ -529,7 +529,7 @@ static void do_fli_lc(unsigned char *p, int sz) /* do_fli_black: * Processes an FLI BLACK chunk */ -static void do_fli_black() +static void do_fli_black(void) { clear_bitmap(fli_bitmap); @@ -704,7 +704,7 @@ static int _fli_parse_chunk(FLI_CHUNK *chunk, unsigned char *p, unsigned long fr /* read_frame: * Advances to the next frame in the FLI. */ -static void read_frame() +static void read_frame(void) { unsigned char *p; FLI_CHUNK chunk; @@ -823,7 +823,7 @@ static void read_frame() * reading a frame and displaying it, rather than between one frame and * the next, in order to make the playback as smooth as possible. */ -static int do_play_fli(BITMAP *bmp, int loop, int (*callback)()) +static int do_play_fli(BITMAP *bmp, int loop, int (*callback)(void)) { int ret; @@ -902,7 +902,7 @@ int play_memory_fli(void *fli_data, BITMAP *bmp, int loop, int (*callback)(void) /* do_open_fli: * Worker function used by open_fli() and open_memory_fli(). */ -static int do_open_fli() +static int do_open_fli(void) { long speed; diff --git a/src/font.c b/src/font.c index 558c29890e..07b2687b48 100644 --- a/src/font.c +++ b/src/font.c @@ -15,6 +15,9 @@ * ASCII (0x0020 to 0x007F) * Latin-1 (0x00A1 to 0x00FF) * Extended-A (0x0100 to 0x017F) + * Euro (0x20AC) + * + * Elias Pschernig added the Euro character. * * See readme.txt for copyright information. */ @@ -417,6 +420,19 @@ static FONT_GLYPH* extended_a_data[] = +/* euro character (0x20AC) */ +static FONT_GLYPH f_0x20AC = { 8, 8, { 0x3C, 0x62, 0xF8, 0x60, 0xF8, 0x62, 0x3C, 0x00 } }; + + + +/* euro character */ +static FONT_GLYPH* euro_data[] = +{ + &f_0x20AC +}; + + + /* allegro_404_char: * This is what we render missing glyphs as. */ @@ -732,10 +748,16 @@ FONT_VTABLE* font_vtable_color = &_font_vtable_color; * Declaration of `_default_font' and `font' ********/ +static FONT_MONO_DATA euro_monofont = { + 0x20AC, 0x20AD, /* begin, end characters */ + euro_data, /* the data set */ + 0 /* next */ +}; + static FONT_MONO_DATA extended_a_monofont = { 0x100, 0x180, /* begin, end characters */ extended_a_data, /* the data set */ - 0 /* next */ + &euro_monofont /* next */ }; static FONT_MONO_DATA latin1_monofont = { diff --git a/src/fsel.c b/src/fsel.c index f7d78d781d..4a96beccd8 100644 --- a/src/fsel.c +++ b/src/fsel.c @@ -118,7 +118,7 @@ static DIALOG file_selector[] = /* count_disks: * Counts the number of valid drives. */ -static int count_disks() +static int count_disks(void) { int c, i; diff --git a/src/gfx.c b/src/gfx.c index cddda5a39f..b3ae7647fb 100644 --- a/src/gfx.c +++ b/src/gfx.c @@ -20,6 +20,7 @@ */ +#include #include "allegro.h" #include "allegro/internal/aintern.h" @@ -1160,6 +1161,24 @@ void ellipsefill(BITMAP *bmp, int x, int y, int rx, int ry, int color) +/* get_point_on_arc: + * Helper function for the do_arc() function, converting from (radius, angle) + * to (x, y). + */ +static INLINE void get_point_on_arc(int r, fixed a, int *out_x, int *out_y) +{ + double s, c; + double double_a = a * (AL_PI * 2 / (1 << 24)); + s = sin(double_a); + c = cos(double_a); + s = -s * r; + c = c * r; + *out_x = (int)((c < 0) ? (c - 0.5) : (c + 0.5)); + *out_y = (int)((s < 0) ? (s - 0.5) : (s + 0.5)); +} + + + /* do_arc: * Helper function for the arc function. Calculates the points in an arc * of radius r around point x, y, going anticlockwise from fixed point @@ -1170,243 +1189,180 @@ void ellipsefill(BITMAP *bmp, int x, int y, int rx, int ry, int color) */ void do_arc(BITMAP *bmp, int x, int y, fixed ang1, fixed ang2, int r, int d, void (*proc)(BITMAP *, int, int, int)) { - unsigned long rr = r*r; - unsigned long rr1, rr2, rr3; + /* start position */ + int sx, sy; + /* current position */ int px, py; + /* end position */ int ex, ey; - int px1, px2, px3; - int py1, py2, py3; - int d1, d2, d3; - int ax, ay; - int q, qe; - long tg_cur, tg_end; - int done = FALSE; - - rr1 = r; - rr2 = itofix(x); - rr3 = itofix(y); - - /* evaluate the start point and the end point */ - px = fixtoi(rr2 + rr1 * fixcos(ang1)); - py = fixtoi(rr3 - rr1 * fixsin(ang1)); - ex = fixtoi(rr2 + rr1 * fixcos(ang2)); - ey = fixtoi(rr3 - rr1 * fixsin(ang2)); - - /* start quadrant */ - if (px >= x) { - if (py <= y) - q = 1; /* quadrant 1 */ + /* square of radius of circle */ + long rr; + /* difference between main radius squared and radius squared of three + potential next points */ + long rr1, rr2, rr3; + /* square of x and of y */ + unsigned long xx, yy, xx_new, yy_new; + /* start quadrant, current quadrant and end quadrant */ + int sq, q, qe; + /* direction of movement */ + int dx, dy; + /* temporary variable for determining if we have reached end point */ + int det; + + /* Calculate the start point and the end point. */ + /* We have to flip y because bitmaps count y coordinates downwards. */ + get_point_on_arc(r, ang1, &sx, &sy); + px = sx; + py = sy; + get_point_on_arc(r, ang2, &ex, &ey); + + rr = r*r; + xx = px*px; + yy = py*py - rr; + + /* Find start quadrant. */ + if (px >= 0) { + if (py <= 0) + q = 0; /* quadrant 0 */ else - q = 4; /* quadrant 4 */ + q = 3; /* quadrant 3 */ } else { - if (py < y) - q = 2; /* quadrant 2 */ + if (py < 0) + q = 1; /* quadrant 1 */ else - q = 3; /* quadrant 3 */ + q = 2; /* quadrant 2 */ } + sq = q; - /* end quadrant */ - if (ex >= x) { - if (ey <= y) - qe = 1; /* quadrant 1 */ + /* Find end quadrant. */ + if (ex >= 0) { + if (ey <= 0) + qe = 0; /* quadrant 0 */ else - qe = 4; /* quadrant 4 */ + qe = 3; /* quadrant 3 */ } else { - if (ey < y) - qe = 2; /* quadrant 2 */ + if (ey < 0) + qe = 1; /* quadrant 1 */ else - qe = 3; /* quadrant 3 */ + qe = 2; /* quadrant 2 */ } - #define loc_tg(_y, _x) (_x-x) ? itofix(_y-y)/(_x-x) : itofix(_y-y) - - tg_end = loc_tg(ey, ex); - - while (!done) { - proc(bmp, px, py, d); - - /* from here, we have only 3 possible direction of movement, eg. - * for the first quadrant: - * - * OOOOOOOOO - * OOOOOOOOO - * OOOOOO21O - * OOOOOO3*O + if (q > qe) { + /* qe must come after q. */ + qe += 4; + } + else if (q == qe) { + /* If q==qe but the beginning comes after the end, make qe be + * strictly after q. */ + if (((ang2&0xffffff) < (ang1&0xffffff)) || + (((ang1&0xffffff) < 0x400000) && ((ang2&0xffffff) >= 0xc00000))) + qe += 4; + } - /* evaluate the 3 possible points */ - switch (q) { - - case 1: - px1 = px; - py1 = py-1; - px2 = px-1; - py2 = py-1; - px3 = px-1; - py3 = py; - - /* 2nd quadrant check */ - if (px != x) { - break; - } - else { - /* we were in the end quadrant, changing is illegal. Exit. */ - if (qe == q) - done = TRUE; - q++; - } - /* fall through */ - - case 2: - px1 = px-1; - py1 = py; - px2 = px-1; - py2 = py+1; - px3 = px; - py3 = py+1; - - /* 3rd quadrant check */ - if (py != y) { - break; - } - else { - /* we were in the end quadrant, changing is illegal. Exit. */ - if (qe == q) - done = TRUE; - q++; - } - /* fall through */ - - case 3: - px1 = px; - py1 = py+1; - px2 = px+1; - py2 = py+1; - px3 = px+1; - py3 = py; - - /* 4th quadrant check */ - if (px != x) { - break; - } - else { - /* we were in the end quadrant, changing is illegal. Exit. */ - if (qe == q) - done = TRUE; - q++; - } - /* fall through */ - - case 4: - px1 = px+1; - py1 = py; - px2 = px+1; - py2 = py-1; - px3 = px; - py3 = py-1; - - /* 1st quadrant check */ - if (py == y) { - /* we were in the end quadrant, changing is illegal. Exit. */ - if (qe == q) - done = TRUE; - - q = 1; - px1 = px; - py1 = py-1; - px2 = px-1; - py2 = py-1; - px3 = px-1; - py3 = py; - } - break; - - default: - return; - } + /* initial direction of movement */ + if (((q+1)&2) == 0) + dy = -1; + else + dy = 1; + if ((q&2) == 0) + dx = -1; + else + dx = 1; - /* now, we must decide which of the 3 points is the right point. - * We evaluate the distance from center and, then, choose the - * nearest point. + while (TRUE) { + /* Change quadrant when needed. + * dx and dy determine the possible directions to go in this + * quadrant, so they must be updated when we change quadrant. */ - ax = x-px1; - ay = y-py1; - rr1 = ax*ax + ay*ay; - - ax = x-px2; - ay = y-py2; - rr2 = ax*ax + ay*ay; - - ax = x-px3; - ay = y-py3; - rr3 = ax*ax + ay*ay; - - /* difference from the main radius */ - if (rr1 > rr) - d1 = rr1-rr; - else - d1 = rr-rr1; - if (rr2 > rr) - d2 = rr2-rr; - else - d2 = rr-rr2; - if (rr3 > rr) - d3 = rr3-rr; - else - d3 = rr-rr3; - - /* what is the minimum? */ - if (d1 <= d2) { - px = px1; - py = py1; - } - else if (d2 <= d3) { - px = px2; - py = py2; + if ((q&1) == 0) { + if (px == 0) { + if (qe == q) + break; + q++; + dy = -dy; + } } else { - px = px3; - py = py3; + if (py == 0) { + if (qe == q) + break; + q++; + dx = -dx; + } } - /* are we in the final quadrant? */ + /* Are we in the final quadrant? */ if (qe == q) { - tg_cur = loc_tg(py, px); + /* Have we reached (or passed) the end point both in x and y? */ + det = 0; - /* is the arc finished? */ - switch (q) { + if (dy > 0) { + if (py >= ey) + det++; + } + else { + if (py <= ey) + det++; + } + if (dx > 0) { + if (px >= ex) + det++; + } + else { + if (px <= ex) + det++; + } + + if (det == 2) + break; + } - case 1: - /* end quadrant = 1? */ - if (tg_cur <= tg_end) - done = TRUE; - break; + proc(bmp, x+px, y+py, d); - case 2: - /* end quadrant = 2? */ - if (tg_cur <= tg_end) - done = TRUE; - break; + /* From here, we have only 3 possible directions of movement, eg. + * for the first quadrant: + * + * ......... + * ......... + * ......21. + * ......3*. + * + * These are reached by adding dx to px and/or adding dy to py. + * We need to find which of these points gives the best + * approximation of the (square of the) radius. + */ - case 3: - /* end quadrant = 3? */ - if (tg_cur <= tg_end) - done = TRUE; - break; + xx_new = (px+dx) * (px+dx); + yy_new = (py+dy) * (py+dy) - rr; + rr1 = xx_new + yy; + rr2 = xx_new + yy_new; + rr3 = xx + yy_new; - case 4: - /* end quadrant = 4? */ - if (tg_cur <= tg_end) - done = TRUE; - break; - } + /* Set rr1, rr2, rr3 to be the difference from the main radius of the + * three points. + */ + if (rr1 < 0) + rr1 = -rr1; + if (rr2 < 0) + rr2 = -rr2; + if (rr3 < 0) + rr3 = -rr3; + + if (rr3 >= MIN(rr1, rr2)) { + px += dx; + xx = xx_new; + } + if (rr1 > MIN(rr2, rr3)) { + py += dy; + yy = yy_new; } } - - /* draw the last evaluated point */ - proc(bmp, px, py, d); + /* Only draw last point if it doesn't overlap with first one. */ + if ((px != sx) || (py != sy) || (sq == qe)) + proc(bmp, x+px, y+py, d); } diff --git a/src/graphics.c b/src/graphics.c index e8bb4dc48d..ff9cef60c0 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -70,19 +70,19 @@ int _blender_col_32 = 0; int _blender_alpha = 0; /* for truecolor translucent drawing */ -int _rgb_r_shift_15 = 0; /* truecolor pixel format */ -int _rgb_g_shift_15 = 5; -int _rgb_b_shift_15 = 10; -int _rgb_r_shift_16 = 0; -int _rgb_g_shift_16 = 5; -int _rgb_b_shift_16 = 11; -int _rgb_r_shift_24 = 0; -int _rgb_g_shift_24 = 8; -int _rgb_b_shift_24 = 16; -int _rgb_r_shift_32 = 0; -int _rgb_g_shift_32 = 8; -int _rgb_b_shift_32 = 16; -int _rgb_a_shift_32 = 24; +int _rgb_r_shift_15 = DEFAULT_RGB_R_SHIFT_15; /* truecolor pixel format */ +int _rgb_g_shift_15 = DEFAULT_RGB_G_SHIFT_15; +int _rgb_b_shift_15 = DEFAULT_RGB_B_SHIFT_15; +int _rgb_r_shift_16 = DEFAULT_RGB_R_SHIFT_16; +int _rgb_g_shift_16 = DEFAULT_RGB_G_SHIFT_16; +int _rgb_b_shift_16 = DEFAULT_RGB_B_SHIFT_16; +int _rgb_r_shift_24 = DEFAULT_RGB_R_SHIFT_24; +int _rgb_g_shift_24 = DEFAULT_RGB_G_SHIFT_24; +int _rgb_b_shift_24 = DEFAULT_RGB_B_SHIFT_24; +int _rgb_r_shift_32 = DEFAULT_RGB_R_SHIFT_32; +int _rgb_g_shift_32 = DEFAULT_RGB_G_SHIFT_32; +int _rgb_b_shift_32 = DEFAULT_RGB_B_SHIFT_32; +int _rgb_a_shift_32 = DEFAULT_RGB_A_SHIFT_32; /* lookup table for scaling 5 bit colors up to 8 bits */ @@ -490,7 +490,7 @@ static int get_config_gfx_driver(char *gfx_card, int check_mode, int require_win int set_gfx_mode(int card, int w, int h, int v_w, int v_h) { static int allow_config = TRUE; - extern void blit_end(); + extern void blit_end(void); _DRIVER_INFO *driver_list; int tried = FALSE; char buf[ALLEGRO_ERROR_SIZE], tmp[64]; @@ -577,6 +577,12 @@ int set_gfx_mode(int card, int w, int h, int v_w, int v_h) gfx_capabilities = 0; } + /* We probably don't want to do this because it makes + * Allegro "forget" the color layout of previously set + * graphics modes. But it should be retained if bitmaps + * created in those modes are to be used in the new mode. + */ +#if 0 /* restore default truecolor pixel format */ _rgb_r_shift_15 = 0; _rgb_g_shift_15 = 5; @@ -591,6 +597,7 @@ int set_gfx_mode(int card, int w, int h, int v_w, int v_h) _rgb_g_shift_32 = 8; _rgb_b_shift_32 = 16; _rgb_a_shift_32 = 24; +#endif gfx_capabilities = 0; @@ -681,6 +688,9 @@ int set_gfx_mode(int card, int w, int h, int v_w, int v_h) gfx_capabilities |= GFX_CAN_TRIPLE_BUFFER; } + clear_bitmap(screen); + + /* set up the default colors */ for (c=0; c<256; c++) _palette_color8[c] = c; @@ -697,8 +707,6 @@ int set_gfx_mode(int card, int w, int h, int v_w, int v_h) gui_bg_color = makecol(255, 255, 255); } - clear_bitmap(screen); - if (_al_linker_mouse) _al_linker_mouse->set_mouse_etc(); @@ -898,6 +906,8 @@ BITMAP *create_sub_bitmap(BITMAP *parent, int x, int y, int width, int height) BITMAP *bitmap; int i; + ASSERT((width > 0) && (height > 0)); + if (!parent) return NULL; diff --git a/src/gui.c b/src/gui.c index 59ee19ae35..e047035cbf 100644 --- a/src/gui.c +++ b/src/gui.c @@ -459,7 +459,7 @@ static int obj_list_cmp(AL_CONST void *e1, AL_CONST void *e2) */ static int cmp_tab(AL_CONST DIALOG *d1, AL_CONST DIALOG *d2) { - int ret = (int)d2 - (int)d1; + int ret = (int)((AL_CONST unsigned long)d2 - (AL_CONST unsigned long)d1); if (ret < 0) ret += 0x10000; @@ -474,7 +474,7 @@ static int cmp_tab(AL_CONST DIALOG *d1, AL_CONST DIALOG *d2) */ static int cmp_shift_tab(AL_CONST DIALOG *d1, AL_CONST DIALOG *d2) { - int ret = (int)d1 - (int)d2; + int ret = (int)((AL_CONST unsigned long)d1 - (AL_CONST unsigned long)d2); if (ret < 0) ret += 0x10000; @@ -1143,7 +1143,7 @@ typedef struct MENU_INFO /* information about a popup menu */ int size; /* number of items in the menu */ int sel; /* selected item */ int x, y, w, h; /* screen position of the menu */ - int (*proc)(); /* callback function */ + int (*proc)(void); /* callback function */ BITMAP *saved; /* saved what was underneath it */ } MENU_INFO; @@ -1154,6 +1154,43 @@ void (*gui_menu_draw_menu_item)(MENU *m, int x, int y, int w, int h, int bar, in +/* split_around_tab: + * Helper function for splitting a string into two tokens + * delimited by the first TAB character. + */ +static char* split_around_tab(const char *s, char **tok1, char **tok2) +{ + char *buf, *last; + char tmp[16]; + + buf = ustrdup(s); + *tok1 = ustrtok_r(buf, uconvert_ascii("\t", tmp), &last); + *tok2 = ustrtok_r(NULL, empty_string, &last); + + return buf; +} + + + +/* bar_entry_lengh: + * Helper function for calculating the length of a menu bar entry. + */ +static int bar_entry_length(const char *text) +{ + char *buf, *tok1, *tok2; + int len; + + buf = split_around_tab(text, &tok1, &tok2); + len = gui_strlen(tok1) + 16; + if (tok2) + len += gui_strlen(tok2) + 16; + free(buf); + + return len; +} + + + /* get_menu_pos: * Calculates the coordinates of an object within a top level menu bar. */ @@ -1165,10 +1202,10 @@ static void get_menu_pos(MENU_INFO *m, int c, int *x, int *y, int *w) *x = m->x+1; for (c2=0; c2menu[c2].text) + 16; + *x += bar_entry_length(m->menu[c2].text); *y = m->y+1; - *w = gui_strlen(m->menu[c].text) + 16; + *w = bar_entry_length(m->menu[c].text); } else { *x = m->x+1; @@ -1186,11 +1223,9 @@ static void draw_menu_item(MENU_INFO *m, int c) { int fg, bg; int x, y, w; - char *buf, *tok; - char *last; + char *buf, *tok1, *tok2; int my; int rtm; - char tmp[16]; get_menu_pos(m, c, &x, &y, &w); @@ -1225,14 +1260,10 @@ static void draw_menu_item(MENU_INFO *m, int c) rtm = text_mode(bg); if (ugetc(m->menu[c].text)) { - buf = ustrdup(m->menu[c].text); - tok = ustrtok_r(buf, uconvert_ascii("\t", tmp), &last); - - gui_textout(screen, tok, x+8, y+1, fg, FALSE); - - tok = ustrtok_r(NULL, empty_string, &last); - if (tok) - gui_textout(screen, tok, x+w-gui_strlen(tok)-10, y+1, fg, FALSE); + buf = split_around_tab(m->menu[c].text, &tok1, &tok2); + gui_textout(screen, tok1, x+8, y+1, fg, FALSE); + if (tok2) + gui_textout(screen, tok2, x+w-gui_strlen(tok2)-10, y+1, fg, FALSE); if ((m->menu[c].child) && (!m->bar)) { my = y + text_height(font)/2; @@ -1343,11 +1374,10 @@ static int mouse_in_parent_menu(MENU_INFO *m) */ static void fill_menu_info(MENU_INFO *m, MENU *menu, MENU_INFO *parent, int bar, int x, int y, int minw, int minh) { - char *buf, *tok, *last; + char *buf, *tok1, *tok2; int extra = 0; int c; int child = FALSE; - char tmp[16]; m->menu = menu; m->parent = parent; @@ -1362,34 +1392,33 @@ static void fill_menu_info(MENU_INFO *m, MENU *menu, MENU_INFO *parent, int bar, /* calculate size of the menu */ for (m->size=0; m->menu[m->size].text; m->size++) { - if ((m->menu[m->size].child) && (!m->bar)) - child = TRUE; - - if (ugetc(m->menu[m->size].text)) { - buf = ustrdup(m->menu[m->size].text); - tok = ustrtok_r(buf, uconvert_ascii("\t", tmp), &last); - c = gui_strlen(tok); - } - else { - buf = NULL; - c = 0; - } - if (m->bar) { - m->w += c+16; + m->w += bar_entry_length(m->menu[m->size].text); } else { + if (m->menu[m->size].child) + child = TRUE; + + if (ugetc(m->menu[m->size].text)) { + buf = split_around_tab(m->menu[m->size].text, &tok1, &tok2); + c = gui_strlen(tok1); + } + else { + buf = NULL; + c = 0; + } + m->h += text_height(font)+4; m->w = MAX(m->w, c+16); - } - if (buf) { - tok = ustrtok_r(NULL, empty_string, &last); - if (tok) { - c = gui_strlen(tok); - extra = MAX(extra, c); + if (buf) { + if (tok2) { + c = gui_strlen(tok2); + extra = MAX(extra, c); + } + + free(buf); } - free(buf); } } diff --git a/src/guiproc.c b/src/guiproc.c index a06777e32b..9e6fd1f119 100644 --- a/src/guiproc.c +++ b/src/guiproc.c @@ -589,7 +589,7 @@ int d_icon_proc(int msg, DIALOG *d, int c) */ int d_keyboard_proc(int msg, DIALOG *d, int c) { - int (*proc)(); + int (*proc)(void); int ret = D_O_K; switch (msg) { @@ -1323,17 +1323,17 @@ int d_text_list_proc(int msg, DIALOG *d, int c) thisitem = (*(getfuncptr)d->dp)(i, NULL); failure = FALSE; - if ((int)d->dp3 < ustrlen(thisitem)) { - for (a=0; a<(int)d->dp3; a++) { + if ((int)((unsigned long)d->dp3) < ustrlen(thisitem)) { + for (a=0; a < (int)((unsigned long)d->dp3); a++) { if (utolower(ugetat(thisitem, a)) != utolower(ugetat(selected, a))) { failure = TRUE; break; } } - if ((!failure) && (utolower(ugetat(thisitem, (int)d->dp3)) == utolower(c))) { + if ((!failure) && (utolower(ugetat(thisitem, (int)(unsigned long)d->dp3)) == utolower(c))) { d->d1 = i; - d->dp3 = (void *)((int)d->dp3 + 1); + d->dp3 = (void *)((unsigned long)d->dp3 + 1); if (sel) { for (i=0; i big scaling, due + * to fixed point number representation imprecisions + */ + if (sxd < itofix(1)) + sx += (sxd >> 1); + if (syd < itofix(1)) + sy += (syd >> 1); + /* search the cache */ stretcher_count++; if (stretcher_count <= 0) { diff --git a/src/joystick.c b/src/joystick.c index 0a4e951231..6efdae8249 100644 --- a/src/joystick.c +++ b/src/joystick.c @@ -56,7 +56,7 @@ static int joy_loading = FALSE; /* clear_joystick_vars: * Resets the joystick state variables to their default values. */ -static void clear_joystick_vars() +static void clear_joystick_vars(void) { AL_CONST char *unused = get_config_text("unused"); int i, j, k; diff --git a/src/keyboard.c b/src/keyboard.c index e3a534f4ce..5c57011190 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -149,7 +149,7 @@ void clear_keybuf() /* clear_key: * Helper function to clear the key[] array. */ -static void clear_key() +static void clear_key(void) { int c; @@ -345,7 +345,7 @@ void install_keyboard_hooks(int (*keypressed)(void), int (*readkey)(void)) /* update_shifts: * Helper function to update the key_shifts variable and LED state. */ -static INLINE void update_shifts() +static INLINE void update_shifts(void) { #define LED_FLAGS (KB_SCROLOCK_FLAG | KB_NUMLOCK_FLAG | KB_CAPSLOCK_FLAG) diff --git a/src/lbm.c b/src/lbm.c index 1f66733ddf..cd1a04e3f5 100644 --- a/src/lbm.c +++ b/src/lbm.c @@ -285,21 +285,8 @@ BITMAP *load_lbm(AL_CONST char *filename, RGB *pal) return FALSE; } - if (dest_depth != 8) { - BITMAP *b2 = b; - - b = create_bitmap_ex(dest_depth, b2->w, b2->h); - if (!b) { - destroy_bitmap(b2); - return NULL; - } - - select_palette(pal); - blit(b2, b, 0, 0, 0, 0, b->w, b->h); - unselect_palette(); - - destroy_bitmap(b2); - } + if (dest_depth != 8) + b = _fixup_loaded_bitmap(b, pal, dest_depth); return b; } diff --git a/src/linux/fbcon.c b/src/linux/fbcon.c index 4130eb841b..96fc2d4b51 100644 --- a/src/linux/fbcon.c +++ b/src/linux/fbcon.c @@ -152,7 +152,6 @@ static BITMAP *fb_init(int w, int h, int v_w, int v_h, int color_depth) case 32: color_depth = orig_mode.bits_per_pixel; set_color_depth(color_depth); - default: } break; case 0: @@ -160,7 +159,7 @@ static BITMAP *fb_init(int w, int h, int v_w, int v_h, int color_depth) my_mode.xres = w; my_mode.yres = h; my_mode.xres_virtual = MAX(w, v_w); - my_mode.yres_virtual = MAX(MAX(h, v_h), fix_info.smem_len / (my_mode.xres_virtual * BYTES_PER_PIXEL(color_depth))); + my_mode.yres_virtual = MAX(MAX(h, v_h), (int)(fix_info.smem_len / (my_mode.xres_virtual * BYTES_PER_PIXEL(color_depth)))); break; case 1: @@ -173,7 +172,7 @@ static BITMAP *fb_init(int w, int h, int v_w, int v_h, int color_depth) case 2: /* see if we can fake a smaller mode (better than nothing) */ - if ((my_mode.xres < w) || (my_mode.yres < h) || (v_w > w) || (v_h > h)) + if (((int)my_mode.xres < w) || ((int)my_mode.yres < h) || (v_w > w) || (v_h > h)) continue; fb_approx = TRUE; break; @@ -499,9 +498,9 @@ static int fb_scroll(int x, int y) /* fb_vsync: * Waits for a retrace. */ -static void fb_vsync() +static void fb_vsync(void) { - int prev; + unsigned int prev; #ifdef FBIOGET_VBLANK @@ -549,7 +548,7 @@ static void fb_vsync() prev = retrace_count; do { - } while (retrace_count == prev); + } while (retrace_count == (int)prev); } } @@ -571,7 +570,7 @@ static void fb_set_palette(AL_CONST RGB *p, int from, int to, int vsync) cmap.blue = b; cmap.transp = NULL; - for (i=0; i= 0) break; } if (n > 24) return 1; /* leave the error message about /dev/console */ @@ -147,6 +150,7 @@ int __al_linux_init_console(void) for (tty = 1, mask = 2; mask; tty++, mask <<= 1) if (!(vts.v_state & mask)) { snprintf (tty_name, sizeof(tty_name), "/dev/tty%d", tty); + tty_name[sizeof(tty_name)-1] = 0; if ((fd = open (tty_name, O_RDWR)) != -1) { close (fd); break; @@ -235,12 +239,13 @@ int __al_linux_done_console (void) snprintf(msg, sizeof(msg), "\nProgram finished: press %s+F%d to switch back to the previous console\n", (__al_linux_prev_vt > 12) ? "AltGR" : "Alt", __al_linux_prev_vt%12); + msg[sizeof(msg)-1] = 0; do { ret = write(STDERR_FILENO, msg, strlen(msg)); if ((ret < 0) && (errno != EINTR)) break; - } while (ret < strlen(msg)); + } while (ret < (int)strlen(msg)); __al_linux_got_text_message = FALSE; } diff --git a/src/linux/ljoy.c b/src/linux/ljoy.c index 041cb266b9..a03201427d 100644 --- a/src/linux/ljoy.c +++ b/src/linux/ljoy.c @@ -52,9 +52,11 @@ static int joy_init (void) for (i = 0; i < MAX_JOYSTICKS; i++) { snprintf (tmp, sizeof(tmp), "/dev/input/js%d", i); + tmp[sizeof(tmp)-1] = 0; joy_fd[i] = open (tmp, O_RDONLY); if (joy_fd[i] == -1) { snprintf (tmp, sizeof(tmp), "/dev/js%d", i); + tmp[sizeof(tmp)-1] = 0; joy_fd[i] = open (tmp, O_RDONLY); if (joy_fd[i] == -1) break; diff --git a/src/linux/lkeybd.c b/src/linux/lkeybd.c index 43da638ab0..ce6c28e7cf 100644 --- a/src/linux/lkeybd.c +++ b/src/linux/lkeybd.c @@ -62,7 +62,8 @@ static STD_DRIVER std_keyboard = update_keyboard, resume_keyboard, suspend_keyboard, - -1 /* fd -- filled in later */ + -1, /* fd -- filled in later */ + { 0 } }; @@ -153,7 +154,8 @@ static char pad_asciis_no_numlock[NUM_PAD_KEYS] = { static void process_keyboard_data (unsigned char *buf, size_t bytes_read) { unsigned int ch; - unsigned int code, mycode, press, ascii; + unsigned int code, mycode, press; + int ascii; int map; struct kbentry kbe; diff --git a/src/linux/lmouse.c b/src/linux/lmouse.c index 54a6d2bc24..ae7b92adb5 100644 --- a/src/linux/lmouse.c +++ b/src/linux/lmouse.c @@ -159,11 +159,12 @@ static void resume_mouse (void); static void suspend_mouse (void); static STD_DRIVER std_mouse = { - STD_MOUSE, - update_mouse, - resume_mouse, - suspend_mouse, - -1 /* fd -- filled in later */ + STD_MOUSE, + update_mouse, + resume_mouse, + suspend_mouse, + -1, /* fd -- filled in later */ + { 0 } }; diff --git a/src/linux/lmseps2.c b/src/linux/lmseps2.c index d34526d87f..8f8dc8566c 100644 --- a/src/linux/lmseps2.c +++ b/src/linux/lmseps2.c @@ -59,8 +59,13 @@ static int processor (unsigned char *buf, int buf_size, struct mouse_info *info) /* if data is invalid, return no motion and all buttons released */ info->l = info->r = info->m = info->x = info->y = info->z = 0; info->updated = 1; - if ((buf[0] & 0xc0) != 0x00) return 1; /* invalid byte, eat it */ - + if (intellimouse) { + if ((buf[0] & 0xc8) != 0x08) return 1; /* invalid byte, eat it */ + } + else { + if ((buf[0] & 0xc0) != 0x00) return 1; /* invalid byte, eat it */ + } + /* data is valid, process it */ info->l = !!(buf[0] & 1); info->r = !!(buf[0] & 2); @@ -155,7 +160,7 @@ static void wakeup_im (int fd) ret = write (fd, init, sizeof (init)); if ((ret < 0) && (errno != EINTR)) break; - } while (ret < sizeof (init)); + } while (ret < (int)sizeof (init)); } /* mouse_init: @@ -172,23 +177,21 @@ static int mouse_init (void) uconvert_ascii ("mouse_device", tmp2), uconvert_ascii ("/dev/mouse", tmp3)); - /* Put Intellimouse into wheel mode */ - if (intellimouse) { - int fd = open (uconvert_toascii (udevice, tmp1), O_WRONLY); - if (fd >= 0) { - wakeup_im (fd); - close (fd); - } - } - /* Open mouse device. Devices are cool. */ - intdrv.device = open (uconvert_toascii (udevice, tmp1), O_RDONLY | O_NONBLOCK); + if (intellimouse) + intdrv.device = open (uconvert_toascii (udevice, tmp1), O_RDWR | O_NONBLOCK); + else + intdrv.device = open (uconvert_toascii (udevice, tmp1), O_RDONLY | O_NONBLOCK); if (intdrv.device < 0) { uszprintf (allegro_error, ALLEGRO_ERROR_SIZE, get_config_text ("Unable to open %s: %s"), udevice, ustrerror (errno)); return -1; } + /* Put Intellimouse into wheel mode */ + if (intellimouse) + wakeup_im (intdrv.device); + /* Discard any garbage, so the next thing we read is a packet header */ sync_mouse (intdrv.device); diff --git a/src/linux/lsystem.c b/src/linux/lsystem.c index 123a05bf76..986075253c 100644 --- a/src/linux/lsystem.c +++ b/src/linux/lsystem.c @@ -272,7 +272,7 @@ static void sys_linux_message (AL_CONST char *msg) ret = write(STDERR_FILENO, msg, strlen(msg)); if ((ret < 0) && (errno != EINTR)) break; - } while (ret < strlen(msg)); + } while (ret < (int)strlen(msg)); __al_linux_got_text_message = TRUE; diff --git a/src/linux/svgalib.c b/src/linux/svgalib.c index 2477ddece2..5b2cd46168 100644 --- a/src/linux/svgalib.c +++ b/src/linux/svgalib.c @@ -92,6 +92,15 @@ static int last_line; +#ifdef ALLEGRO_MODULE + +/* If this is non-zero, this module won't be unloaded. */ +int _module_dont_unload_me_dirty_hack = 0; + +#endif + + + /* _svgalib_read_line: * Return linear offset for reading line. */ @@ -144,17 +153,17 @@ static const int signals[] = { static struct sigaction old_signals[NUM_SIGNALS]; -static void save_signals() +static void save_signals(void) { int i; - for (i = 0; i < NUM_SIGNALS; i++) + for (i = 0; i < (int)NUM_SIGNALS; i++) sigaction(signals[i], NULL, old_signals+i); } -static void restore_signals() +static void restore_signals(void) { int i; - for (i = 0; i < NUM_SIGNALS; i++) + for (i = 0; i < (int)NUM_SIGNALS; i++) sigaction(signals[i], old_signals+i, NULL); } @@ -178,6 +187,13 @@ static int safe_vga_setmode(int num, int tio) ret = vga_setmode(num); +#ifdef ALLEGRO_MODULE + /* A side-effect of vga_setmode() is that it will register an + * atexit handler. See umodules.c for this problem. + */ + _module_dont_unload_me_dirty_hack = 1; +#endif + tcsetattr(__al_linux_console_fd, TCSANOW, &termio); if (tio) ioctl(__al_linux_console_fd, VT_SETMODE, &vtm); @@ -430,7 +446,7 @@ static BITMAP *do_set_mode(int w, int h, int v_w, int v_h, int color_depth) /* svga_version2: * Returns non-zero if we have SVGAlib version 2 (or the prereleases). */ -static int svga_version2() +static int svga_version2(void) { #ifdef ALLEGRO_LINUX_SVGALIB_HAVE_VGA_VERSION return vga_version >= 0x1900; @@ -508,6 +524,10 @@ static int svga_scroll(int x, int y) vga_setdisplaystart((x + y * bytes_per_line) /* & display_start_mask */); /* The bitmask seems to mess things up on my machine, even though * the documentation says it should be there. -- PW */ + + /* wait for a retrace */ + vga_waitretrace(); + return 0; } @@ -516,7 +536,7 @@ static int svga_scroll(int x, int y) /* svga_vsync: * Waits for a retrace. */ -static void svga_vsync() +static void svga_vsync(void) { vga_waitretrace(); } @@ -542,7 +562,7 @@ static void svga_set_palette(AL_CONST RGB *p, int from, int to, int vsync) /* svga_save: * Saves the graphics state. */ -static void svga_save() +static void svga_save(void) { safe_vga_setmode(TEXT, 0); } @@ -552,7 +572,7 @@ static void svga_save() /* svga_restore: * Restores the graphics state. */ -static void svga_restore() +static void svga_restore(void) { safe_vga_setmode(svga_mode, 0); vga_setpage(0); diff --git a/src/linux/vtswitch.c b/src/linux/vtswitch.c index 95edbfa614..92b181f5b5 100644 --- a/src/linux/vtswitch.c +++ b/src/linux/vtswitch.c @@ -50,8 +50,8 @@ static struct vt_mode startup_vtmode; volatile int __al_linux_switching_blocked = 0; -volatile static int console_active = 1; /* are we active? */ -volatile static int console_should_be_active = 1; /* should we be? */ +static volatile int console_active = 1; /* are we active? */ +static volatile int console_should_be_active = 1; /* should we be? */ @@ -120,7 +120,7 @@ void __al_linux_remove_display_switch_callback (void (*cb) (void)) /* go_away: * Performs a switch away. */ -static void go_away() +static void go_away(void) { int i; @@ -159,7 +159,7 @@ static void go_away() /* come_back: * Performs a switch back. */ -static void come_back() +static void come_back(void) { int i; diff --git a/src/math3d.c b/src/math3d.c index 3f868c8440..c1f01163eb 100644 --- a/src/math3d.c +++ b/src/math3d.c @@ -22,14 +22,9 @@ -#ifndef M_PI - #define M_PI 3.14159265358979323846 -#endif - - -#define floatcos(x) cos((x) * M_PI / 128.0) -#define floatsin(x) sin((x) * M_PI / 128.0) -#define floattan(x) tan((x) * M_PI / 128.0) +#define floatcos(x) cos((x) * AL_PI / 128.0) +#define floatsin(x) sin((x) * AL_PI / 128.0) +#define floattan(x) tan((x) * AL_PI / 128.0) diff --git a/src/midi.c b/src/midi.c index 430474a7dc..b5d784c4c3 100644 --- a/src/midi.c +++ b/src/midi.c @@ -83,7 +83,7 @@ volatile long _midi_tick = 0; /* counter for killing notes */ static void midi_player(void); /* core MIDI player routine */ static void prepare_to_play(MIDI *midi); -static void midi_lock_mem(); +static void midi_lock_mem(void); static MIDI *midifile = NULL; /* the file that is playing */ @@ -602,7 +602,7 @@ END_OF_STATIC_FUNCTION(reset_controllers); /* update_controllers: * Checks cached controller information and updates active voices. */ -static void update_controllers() +static void update_controllers(void) { int c, c2, vol, bend, note; @@ -1341,7 +1341,7 @@ int midi_seek(int target) prepare_to_play(midifile); /* now sit back and let midi_player get to the position */ - while ((midi_pos < target) && (midi_pos != -1)) { + while ((midi_pos < target) && (midi_pos >= 0)) { int mmpc = midi_pos_counter; int mmp = midi_pos; @@ -1362,7 +1362,7 @@ int midi_seek(int target) midi_driver = old_driver; midi_seeking = 0; - if (midi_pos != -1) { + if (midi_pos >= 0) { /* refresh the driver with any changed parameters */ if (midi_driver->raw_midi) { for (c=0; c<16; c++) { @@ -1394,7 +1394,7 @@ int midi_seek(int target) return 0; } - if ((midi_loop) && (!midi_looping)) { /* was file was looped? */ + if ((midi_loop) && (!midi_looping)) { /* was file looped? */ prepare_to_play(old_midifile); install_int(midi_player, 20); return 2; /* seek past EOF => file restarted */ @@ -1455,7 +1455,7 @@ int load_midi_patches() * Locks all the memory that the midi player touches inside the timer * interrupt handler (which is most of it). */ -static void midi_lock_mem() +static void midi_lock_mem(void) { LOCK_VARIABLE(midi_pos); LOCK_VARIABLE(midi_pos_counter); @@ -1508,8 +1508,8 @@ static void midi_lock_mem() /* midi_constructor: * Register my functions with the code in sound.c. */ -#ifdef CONSTRUCTOR_FUNCTION - CONSTRUCTOR_FUNCTION(void _midi_constructor()); +#ifdef ALLEGRO_USE_CONSTRUCTOR + CONSTRUCTOR_FUNCTION(void _midi_constructor(void)); #endif static struct _AL_LINKER_MIDI midi_linker = { @@ -1517,7 +1517,7 @@ static struct _AL_LINKER_MIDI midi_linker = { midi_exit }; -void _midi_constructor() +void _midi_constructor(void) { _al_linker_midi = &midi_linker; } diff --git a/src/misc/icolconv.s b/src/misc/icolconv.s index 68e3a9fcb8..f0a69457be 100644 --- a/src/misc/icolconv.s +++ b/src/misc/icolconv.s @@ -1250,6 +1250,10 @@ FUNC (_colorconv_blit_32_to_24) pushl %edi /* init register values */ + movl $0xFFFFFF, %eax /* get RGB mask */ + movd %eax, %mm5 /* low RGB mask in mm5 */ + movd %eax, %mm6 + psllq $32, %mm6 /* high RGB mask in mm6 */ movl ARG1, %eax /* eax = src_rect */ movl GFXRECT_WIDTH(%eax), %ecx /* ecx = src_rect->width */ @@ -1287,29 +1291,37 @@ FUNC (_colorconv_blit_32_to_24) _align_ next_block_32_to_24: - movq (%esi), %mm0 /* mm0 = [.RGB1][.RGB0] */ - movq 8(%esi), %mm1 /* mm1 = [.RGB3][.RGB2] */ - movq %mm0, %mm2 - movq %mm1, %mm3 - movq %mm1, %mm4 - psllq $48, %mm3 - psllq $40, %mm0 - psrlq $32, %mm2 - psrlq $40, %mm0 - psllq $24, %mm2 - por %mm3, %mm0 - por %mm2, %mm0 - psllq $8, %mm4 - psllq $40, %mm1 - psrlq $32, %mm4 - psrlq $56, %mm1 - por %mm4, %mm1 - movq %mm0, (%edi) - movd %mm1, 8(%edi) - addl $16, %esi + /* i686: 14 cycles/4 pixels, i586: 11 cycles/4 pixels */ + movq (%esi), %mm0 /* mm0 = [ARGBARGB](1)(0) */ addl $12, %edi + movq 8(%esi), %mm2 /* mm2 = [ARGBARGB](3)(2) */ + addl $16, %esi + + movq %mm0, %mm1 /* mm1 = [ARGBARGB](1)(0) */ + movq %mm2, %mm3 /* mm3 = [ARGBARGB](3)(2) */ + + pand %mm6, %mm1 /* mm1 = [.RGB....](1) */ + pand %mm5, %mm2 /* mm2 = [.....RGB](2) */ + psrlq $8, %mm1 /* mm1 = [..RGB...](1) */ + pand %mm6, %mm3 /* mm3 = [.RGB....](3) */ + + movq %mm2, %mm4 /* mm4 = [.....RGB](2) */ + pand %mm5, %mm0 /* mm0 = [.....RGB](0) */ + + psrlq $16, %mm2 /* mm2 = [.......R](2) */ + por %mm1, %mm0 /* mm0 = [..RGBRGB](1)(0) */ + + psrlq $24, %mm3 /* mm3 = [....RGB.](3) */ decl %ecx + + psllq $48, %mm4 /* mm4 = [GB......](2) */ + por %mm3, %mm2 /* mm2 = [....RGBR](3)(2) */ + + por %mm4, %mm0 /* mm0 = [GBRGBRGB](2)(1)(0) */ + movq %mm0, -12(%edi) + movd %mm2, -4(%edi) + jnz next_block_32_to_24 #ifndef ALLEGRO_COLORCONV_ALIGNED_WIDTH @@ -1335,16 +1347,17 @@ FUNC (_colorconv_blit_32_to_24) shrl $1, %ecx jnc end_of_line_32_to_24 - movq (%esi), %mm0 /* read 2 pixels */ + /* 4 cycles/2 pixels */ + movq (%esi), %mm0 /* mm0 = [.RGB.RGB](1)(0) */ - movq %mm0, %mm1 + movq %mm0, %mm1 /* mm1 = [.RGB.RGB](1)(0) */ - psllq $40, %mm0 - psrlq $32, %mm1 - psrlq $40, %mm0 - psllq $24, %mm1 + pand %mm5, %mm0 /* mm0 = [.....RGB](0) */ + pand %mm6, %mm1 /* mm1 = [.RGB....](1) */ - por %mm1, %mm0 + psrlq $8, %mm1 /* mm1 = [..RGB...](1) */ + + por %mm1, %mm0 /* mm0 = [..RGBRGB](1)(0) */ movd %mm0, (%edi) psrlq $32, %mm0 @@ -2957,6 +2970,8 @@ FUNC (_colorconv_blit_32_to_24) INIT_REGISTERS_NO_MMX(SIZE_4, SIZE_3, LOOP_RATIO_1) #endif + movl $0xFFFFFF, %ebp + _align_ next_line_32_to_24_no_mmx: movl MYLOCAL1, %ecx @@ -2970,27 +2985,31 @@ FUNC (_colorconv_blit_32_to_24) _align_ /* 100% Pentium pairable loop */ - /* 10 cycles = 9 cycles/4 pixels + 1 cycle loop */ + /* 12 cycles = 11 cycles/4 pixels + 1 cycle loop */ next_block_32_to_24_no_mmx: - movl 4(%esi), %ebx /* ebx = pixel2 */ + movl 4(%esi), %ebx /* ebx = [ARGB](2) */ addl $12, %edi /* 4 pixels written */ - movl %ebx, %ebp /* ebp = pixel2 */ - movl 12(%esi), %edx /* edx = pixel4 */ - shll $8, %edx /* edx = pixel4 << 8 */ - movl (%esi), %eax /* eax = pixel1 */ - shll $24, %ebx /* ebx = b8 pixel2 << 24 */ - movb 10(%esi), %dl /* edx = pixel4 | r8 pixel3 */ - orl %eax, %ebx /* ebx = b8 pixel2 | pixel1 */ - movl %ebp, %eax /* eax = pixel2 */ - shrl $8, %eax /* eax = r8g8 pixel2 */ - movl %ebx, -12(%edi) /* write pixel1..b8 pixel2 */ - movl 8(%esi), %ebx /* ebx = pixel 3 */ - movl %edx, -4(%edi) /* write r8 pixel3..pixel4 */ - shll $16, %ebx /* ebx = g8b8 pixel3 << 16 */ + movl (%esi), %eax /* eax = [ARGB](1) */ + movl %ebx, %edx /* edx = [ARGB](2) */ + shll $24, %edx /* edx = [B...](2) */ + andl %ebp, %ebx /* ebx = [.RGB](2) */ + shrl $8, %ebx /* ebx = [..RG](2) */ + andl %ebp, %eax /* eax = [.RGB](1) */ + orl %edx, %eax /* eax = [BRGB](2)(1) */ + movl 8(%esi), %edx /* edx = [ARGB](3) */ + movl %eax, -12(%edi) /* write [BRGB](2)(1) */ + movl %edx, %eax /* eax = [ARGB](3) */ + shll $16, %edx /* edx = [GB..](3) */ + andl %ebp, %eax /* eax = [.RGB](3) */ + shrl $16, %eax /* eax = [...R](3) */ + orl %edx, %ebx /* ebx = [GBRG](3)(2) */ + movl 12(%esi), %edx /* edx = [ARGB](4) */ + movl %ebx, -8(%edi) /* write [GBRG](3)(2) */ + shll $8, %edx /* edx = [RGB.](4) */ addl $16, %esi /* 4 pixels read */ - orl %ebx, %eax /* eax = g8b8 pixel3 | r8g8 pixel2 */ + orl %edx, %eax /* eax = [RGBR](4)(3) */ decl %ecx - movl %eax, -8(%edi) /* write g8r8 pixel2..b8g8 pixel3 */ + movl %eax, -4(%edi) /* write [RGBR](4)(3) */ jnz next_block_32_to_24_no_mmx popl %edx @@ -3019,7 +3038,7 @@ FUNC (_colorconv_blit_32_to_24) movl 4(%esi), %ebx addl $8, %esi movl %ebx, %ecx - andl $0xFFFFFF, %eax + andl %ebp, %eax shll $24, %ebx orl %ebx, %eax shrl $8, %ecx @@ -3068,34 +3087,33 @@ FUNC (_colorcopy) movl GFXRECT_WIDTH(%eax), %eax mull %ebx - movl %eax, %edx /* edx = src_rect->width * bpp */ + movl %eax, %ecx /* ecx = src_rect->width * bpp */ movl ARG1, %eax - movl GFXRECT_HEIGHT(%eax), %ecx /* ecx = src_rect->height */ + movl GFXRECT_HEIGHT(%eax), %edx /* edx = src_rect->height */ movl GFXRECT_DATA(%eax), %esi /* esi = src_rect->data */ movl GFXRECT_PITCH(%eax), %eax /* eax = src_rect->pitch */ - subl %edx, %eax /* eax = (src_rect->pitch) - edx */ + subl %ecx, %eax /* eax = (src_rect->pitch) - ecx */ movl ARG2, %ebx /* ebx = dest_rect */ movl GFXRECT_DATA(%ebx), %edi /* edi = dest_rect->data */ movl GFXRECT_PITCH(%ebx), %ebx /* ebx = dest_rect->pitch */ - subl %edx, %ebx /* ebx = (dest_rect->pitch) - edx */ + subl %ecx, %ebx /* ebx = (dest_rect->pitch) - ecx */ - pushl %edx + movl %ecx, %ebp /* save for later */ #ifdef ALLEGRO_MMX - movl GLOBL(cpu_capabilities), %edx /* if MMX is enabled (or not disabled :) */ - andl $CPU_MMX, %edx + movl GLOBL(cpu_capabilities), %ecx /* if MMX is enabled (or not disabled :) */ + andl $CPU_MMX, %ecx jz next_line_no_mmx - popl %edx - movd %edx, %mm7 /* save for later */ - shrl $5, %edx /* we work with 32 pixels at a time */ - movd %edx, %mm6 + movl %ebp, %ecx + shrl $5, %ecx /* we work with 32 pixels at a time */ + movd %ecx, %mm6 _align_ next_line: - movd %mm6, %edx - orl %edx, %edx + movd %mm6, %ecx + orl %ecx, %ecx jz do_one_byte _align_ @@ -3110,21 +3128,21 @@ FUNC (_colorcopy) addl $32, %edi movq %mm2, -16(%edi) movq %mm3, -8(%edi) - decl %edx + decl %ecx jnz next_block do_one_byte: - movd %mm7, %edx - andl $31, %edx + movl %ebp, %ecx + andl $31, %ecx jz end_of_line - shrl $1, %edx + shrl $1, %ecx jnc do_two_bytes movsb do_two_bytes: - shrl $1, %edx + shrl $1, %ecx jnc do_four_bytes movsb @@ -3132,14 +3150,14 @@ FUNC (_colorcopy) _align_ do_four_bytes: - shrl $1, %edx + shrl $1, %ecx jnc do_eight_bytes movsl _align_ do_eight_bytes: - shrl $1, %edx + shrl $1, %ecx jnc do_sixteen_bytes movq (%esi), %mm0 @@ -3149,7 +3167,7 @@ FUNC (_colorcopy) _align_ do_sixteen_bytes: - shrl $1, %edx + shrl $1, %ecx jnc end_of_line movq (%esi), %mm0 @@ -3163,7 +3181,7 @@ FUNC (_colorcopy) end_of_line: addl %eax, %esi addl %ebx, %edi - decl %ecx + decl %edx jnz next_line emms @@ -3172,27 +3190,25 @@ FUNC (_colorcopy) _align_ next_line_no_mmx: - popl %edx - pushl %edx - shrl $2, %edx - orl %edx, %edx + movl %ebp, %ecx + shrl $2, %ecx + orl %ecx, %ecx jz do_one_byte_no_mmx rep; movsl do_one_byte_no_mmx: - popl %edx - pushl %edx - andl $3, %edx + movl %ebp, %ecx + andl $3, %ecx jz end_of_line_no_mmx - shrl $1, %edx + shrl $1, %ecx jnc do_two_bytes_no_mmx movsb do_two_bytes_no_mmx: - shrl $1, %edx + shrl $1, %ecx jnc end_of_line_no_mmx movsb @@ -3202,11 +3218,9 @@ FUNC (_colorcopy) end_of_line_no_mmx: addl %eax, %esi addl %ebx, %edi - decl %ecx + decl %edx jnz next_line_no_mmx - popl %edx - end_of_function: popl %edi popl %esi diff --git a/src/misc/modex.c b/src/misc/modex.c index b5a834ac01..b29badd073 100644 --- a/src/misc/modex.c +++ b/src/misc/modex.c @@ -35,9 +35,9 @@ -void _x_draw_sprite_end(); -void _x_blit_from_memory_end(); -void _x_blit_to_memory_end(); +void _x_draw_sprite_end(void); +void _x_blit_from_memory_end(void); +void _x_blit_to_memory_end(void); @@ -97,7 +97,7 @@ static int modex_scroll(int x, int y); static int request_modex_scroll(int x, int y); static int poll_modex_scroll(void); static void modex_enable_triple_buffer(void); -static GFX_MODE_LIST *modex_fetch_mode_list(); +static GFX_MODE_LIST *modex_fetch_mode_list(void); @@ -163,7 +163,7 @@ GFX_MODE modex_gfx_modes[] = { static BITMAP *xtended_init(int w, int h, int v_w, int v_h, int color_depth); -static GFX_MODE_LIST *xtended_fetch_mode_list(); +static GFX_MODE_LIST *xtended_fetch_mode_list(void); GFX_DRIVER gfx_xtended = @@ -822,7 +822,7 @@ static BITMAP *xtended_init(int w, int h, int v_w, int v_h, int color_depth) /* xtended_fetch_mode_list: * Creates a list of of currently implemented Xtended modes. */ -static GFX_MODE_LIST *xtended_fetch_mode_list() +static GFX_MODE_LIST *xtended_fetch_mode_list(void) { GFX_MODE_LIST *mode_list; @@ -1147,7 +1147,7 @@ void _x_draw_lit_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y, int color) */ void _x_draw_rle_sprite(BITMAP *bmp, AL_CONST RLE_SPRITE *sprite, int x, int y) { - signed char *p = sprite->dat; + AL_CONST signed char *p = sprite->dat; int c; int x_pos, y_pos; int lgap, width; @@ -1251,7 +1251,7 @@ void _x_draw_rle_sprite(BITMAP *bmp, AL_CONST RLE_SPRITE *sprite, int x, int y) */ void _x_draw_trans_rle_sprite(BITMAP *bmp, AL_CONST RLE_SPRITE *sprite, int x, int y) { - signed char *p = sprite->dat; + AL_CONST signed char *p = sprite->dat; int c; int x_pos, y_pos; int lgap, width; @@ -1357,7 +1357,7 @@ void _x_draw_trans_rle_sprite(BITMAP *bmp, AL_CONST RLE_SPRITE *sprite, int x, i */ void _x_draw_lit_rle_sprite(BITMAP *bmp, AL_CONST RLE_SPRITE *sprite, int x, int y, int color) { - signed char *p = sprite->dat; + AL_CONST signed char *p = sprite->dat; int c; int x_pos, y_pos; int lgap, width; @@ -1484,8 +1484,8 @@ void _x_draw_character(BITMAP *bmp, BITMAP *sprite, int x, int y, int color) */ void _x_draw_glyph(BITMAP *bmp, AL_CONST FONT_GLYPH *glyph, int x, int y, int color) { - unsigned char *data = glyph->dat; - unsigned char *dat; + AL_CONST unsigned char *data = glyph->dat; + AL_CONST unsigned char *dat; unsigned long addr; int w = glyph->w; int h = glyph->h; @@ -1576,7 +1576,7 @@ void _x_draw_glyph(BITMAP *bmp, AL_CONST FONT_GLYPH *glyph, int x, int y, int co /* modex_fetch_mode_list: * Creates a list of of currently implemented ModeX modes. */ -static GFX_MODE_LIST *modex_fetch_mode_list() +static GFX_MODE_LIST *modex_fetch_mode_list(void) { GFX_MODE_LIST *mode_list; diff --git a/src/misc/modexgfx.s b/src/misc/modexgfx.s index 0da301077e..245e625fb9 100644 --- a/src/misc/modexgfx.s +++ b/src/misc/modexgfx.s @@ -21,7 +21,7 @@ */ -#include "src/i386/asmdefs.inc" +#include "../i386/asmdefs.inc" .text diff --git a/src/misc/pckeys.c b/src/misc/pckeys.c index 87ecf02ed9..536985299e 100644 --- a/src/misc/pckeys.c +++ b/src/misc/pckeys.c @@ -269,7 +269,7 @@ unsigned short *_key_accent4_upper_table = standard_key_empty_table; /* set_standard_keyboard: * Sets up pointers ready to use the standard US keyboard mapping. */ -static INLINE void set_standard_keyboard() +static INLINE void set_standard_keyboard(void) { _key_ascii_table = standard_key_ascii_table; _key_capslock_table = standard_key_capslock_table; @@ -294,7 +294,7 @@ static INLINE void set_standard_keyboard() /* set_custom_keyboard: * Sets up pointers ready to use the custom keyboard mapping. */ -static INLINE void set_custom_keyboard() +static INLINE void set_custom_keyboard(void) { _key_ascii_table = custom_key_ascii_table; _key_capslock_table = custom_key_capslock_table; diff --git a/src/misc/runnergw.c b/src/misc/runnergw.c new file mode 100644 index 0000000000..6b5aa460c7 --- /dev/null +++ b/src/misc/runnergw.c @@ -0,0 +1,45 @@ +/* + * Silly little bodge for getting the MinGW compiler + * to handle "response files" a la Watcom/Microsoft. + */ + + +#include +#include +#include + + +int main(int argc, char *argv[]) +{ + char var[4096], *p; + FILE *file; + int i,c; + + p = var; + *p = '\0'; + + for (i=1; i < argc; i++) { + if (argv[i][0] == '@') { + if ((file=fopen(argv[i]+1, "r")) == NULL) { + fprintf(stderr, "Unable to open %s.\n", argv[i]); + exit(EXIT_FAILURE); + } + + while ((c=fgetc(file)) != EOF) { + if (c != '\n') + *p++ = c; + } + + fclose(file); + } + else { + strcat(var, argv[i]); + p = var + strlen(var); + } + + *p++ = ' '; + *p = '\0'; + } + + return system(var); +} diff --git a/src/misc/vbeaf.c b/src/misc/vbeaf.c index 104acf12fc..2e4984da01 100644 --- a/src/misc/vbeaf.c +++ b/src/misc/vbeaf.c @@ -543,7 +543,7 @@ static int saved_vw; static int saved_vh; static int saved_wret; -extern void _af_int86(), _af_call_rm(), _af_wrapper(), _af_wrapper_end(); +extern void _af_int86(void), _af_call_rm(void), _af_wrapper(void), _af_wrapper_end(void); @@ -679,7 +679,7 @@ static int call_vbeaf_asm(void *proc) /* vbeaf_no_wait: * Dummy wait-till-idle routine for non-accelerated drivers. */ -static void vbeaf_no_wait() +static void vbeaf_no_wait(void) { } @@ -747,7 +747,7 @@ static int load_vbeaf_driver(AL_CONST char *filename) /* initialise_freebeaf_extensions: * Prepares the FreeBE/AF extension functions. */ -static void initialise_freebeaf_extensions() +static void initialise_freebeaf_extensions(void) { typedef unsigned long (*EXT_INIT_FUNC)(AF_DRIVER *af, unsigned long id); EXT_INIT_FUNC ext_init; @@ -800,7 +800,7 @@ static void initialise_freebeaf_extensions() * Sets up the DPMI memory mappings required by the VBE/AF driver, * returning zero on success. */ -static int initialise_vbeaf_driver() +static int initialise_vbeaf_driver(void) { int c; @@ -2245,7 +2245,7 @@ static void prepare_mono_pattern(BITMAP *bmp) /* go_accel: * Prepares the hardware for an accelerated drawing operation. */ -static INLINE void go_accel() +static INLINE void go_accel(void) { /* turn on the accelerator */ if (!_accel_active) { @@ -2653,7 +2653,7 @@ static int vbeaf_triangle(BITMAP *bmp, int x1, int y1, int x2, int y2, int x3, i */ static void vbeaf_draw_glyph(BITMAP *bmp, AL_CONST FONT_GLYPH *glyph, int x, int y, int color) { - unsigned char *data = glyph->dat; + AL_CONST unsigned char *data = glyph->dat; int w = glyph->w; int h = glyph->h; int stride = (w+7)/8; @@ -2700,7 +2700,7 @@ static void vbeaf_draw_glyph(BITMAP *bmp, AL_CONST FONT_GLYPH *glyph, int x, int af_driver->PutMonoImage(af_driver, color, d, x+bmp->x_ofs, y+bmp->y_ofs, - stride, 0, 0, stride*8, h, data); + stride, 0, 0, stride*8, h, (unsigned char *)data); af_driver->SetMix(af_driver, vbeaf_fg_mix, vbeaf_bg_mix); ); diff --git a/src/misc/vbeafex.c b/src/misc/vbeafex.c index 1d4d6a8d36..3523f87c1e 100644 --- a/src/misc/vbeafex.c +++ b/src/misc/vbeafex.c @@ -55,7 +55,7 @@ typedef struct LIBC_DATA { long size; - void (*abort)(); + void (*abort)(void); void *(*calloc)(unsigned long num_elements, unsigned long size); void (*exit)(int status); void (*free)(void *ptr); @@ -76,7 +76,7 @@ typedef struct LIBC_DATA int (*rename)(const char *oldname, const char *newname); unsigned int (*time)(unsigned int *t); void (*setfileattr)(const char *filename, unsigned attrib); - unsigned long (*getcurrentdate)(); + unsigned long (*getcurrentdate)(void); } LIBC_DATA; @@ -95,7 +95,7 @@ static void setfileattr(const char *filename, unsigned attrib) * Export function for checking the current date. Returns the number of * days since 1/1/1980. */ -static unsigned long getcurrentdate() +static unsigned long getcurrentdate(void) { unsigned long t = time(NULL); @@ -191,16 +191,16 @@ typedef struct typedef struct PMODE_DATA { long size; - int (*getModeType)(); - void *(*getBIOSPointer)(); - void *(*getA0000Pointer)(); + int (*getModeType)(void); + void *(*getBIOSPointer)(void); + void *(*getA0000Pointer)(void); void *(*mapPhysicalAddr)(unsigned long base, unsigned long limit); void *(*mallocShared)(long size); int (*mapShared)(void *ptr); void (*freeShared)(void *ptr); void *(*mapToProcess)(void *linear, unsigned long limit); - void (*loadDS)(); - void (*saveDS)(); + void (*loadDS)(void); + void (*saveDS)(void); void *(*mapRealPointer)(unsigned int r_seg, unsigned int r_off); void *(*allocRealSeg)(unsigned int size, unsigned int *r_seg, unsigned int *r_off); void (*freeRealSeg)(void *mem); @@ -215,23 +215,23 @@ typedef struct PMODE_DATA int (*int386x)(int intno, SCITECH_REGS *in, SCITECH_REGS *out, SCITECH_SREGS *sregs); void (*availableMemory)(unsigned long *physical, unsigned long *total); void *(*getVESABuf)(unsigned int *len, unsigned int *rseg, unsigned int *roff); - long (*getOSType)(); + long (*getOSType)(void); void (*fatalError)(const char *msg); void (*setBankA)(int bank); void (*setBankAB)(int bank); - const char *(*getCurrentPath)(); - const char *(*getVBEAFPath)(); - const char *(*getNucleusPath)(); - const char *(*getNucleusConfigPath)(); - const char *(*getUniqueID)(); - const char *(*getMachineName)(); - int (*VF_available)(); + const char *(*getCurrentPath)(void); + const char *(*getVBEAFPath)(void); + const char *(*getNucleusPath)(void); + const char *(*getNucleusConfigPath)(void); + const char *(*getUniqueID)(void); + const char *(*getMachineName)(void); + int (*VF_available)(void); void *(*VF_init)(unsigned long baseAddr, int bankSize, int codeLen, void *bankFunc); - void (*VF_exit)(); - int (*kbhit)(); - int (*getch)(); - int (*openConsole)(); - int (*getConsoleStateSize)(); + void (*VF_exit)(void); + int (*kbhit)(void); + int (*getch)(void); + int (*openConsole)(void); + int (*getConsoleStateSize)(void); void (*saveConsoleState)(void *stateBuf, int console_id); void (*restoreConsoleState)(const void *stateBuf, int console_id); void (*closeConsole)(int console_id); @@ -246,7 +246,7 @@ typedef struct PMODE_DATA /* get_mode_type: * Return that we are running in 386 mode. */ -static int get_mode_type() +static int get_mode_type(void) { return 2; /* 0=real mode, 1=16 bit pmode, 2=32 bit pmode */ } @@ -256,7 +256,7 @@ static int get_mode_type() /* get_bios_pointer: * Returns a pointer to the BIOS data area at segment 0x400. */ -static void *get_bios_pointer() +static void *get_bios_pointer(void) { if (!(_crt0_startup_flags & _CRT0_FLAG_NEARPTR)) if (__djgpp_nearptr_enable() == 0) @@ -270,7 +270,7 @@ static void *get_bios_pointer() /* get_a0000_pointer: * Returns a linear pointer to the VGA frame buffer memory. */ -static void *get_a0000_pointer() +static void *get_a0000_pointer(void) { if (!(_crt0_startup_flags & _CRT0_FLAG_NEARPTR)) if (__djgpp_nearptr_enable() == 0) @@ -348,7 +348,7 @@ static unsigned short saved_ds = 0; /* save_ds: * Saves the current data segment selector into a code segment variable. */ -static void save_ds() +static void save_ds(void) { saved_ds = _default_ds(); } @@ -358,7 +358,7 @@ static void save_ds() /* load_ds: * Restores a data segment selector previously stored by save_ds(). */ -static void load_ds() +static void load_ds(void) { #ifdef ALLEGRO_GCC @@ -819,7 +819,7 @@ static void *vesa_ptr = NULL; /* free_vesa_buf: * Cleanup routine. */ -static void free_vesa_buf() +static void free_vesa_buf(void) { if (vesa_ptr) { free_real_seg(vesa_ptr); @@ -857,7 +857,7 @@ static void *get_vesa_buf(unsigned int *len, unsigned int *rseg, unsigned int *r /* get_os_type: * Returns the OS type flag. */ -static long get_os_type() +static long get_os_type(void) { return 1; /* _OS_DOS */ } @@ -917,7 +917,7 @@ static void set_bankab(int bank) /* get_current_path: * Returns the current working directory. */ -static const char *get_current_path() +static const char *get_current_path(void) { static char *buffer = NULL; @@ -934,7 +934,7 @@ static const char *get_current_path() /* get_vbeaf_path: * Returns the VBE/AF driver directory. */ -static const char *get_vbeaf_path() +static const char *get_vbeaf_path(void) { return "c:\\"; } @@ -944,7 +944,7 @@ static const char *get_vbeaf_path() /* get_nucleus_path: * Returns the Nucleus driver directory. */ -static const char *get_nucleus_path() +static const char *get_nucleus_path(void) { static char *buffer = NULL; char *p; @@ -971,7 +971,7 @@ static const char *get_nucleus_path() /* get_nucleus_config_path: * Returns the Nucleus config directory. */ -static const char *get_nucleus_config_path() +static const char *get_nucleus_config_path(void) { static char *buffer = NULL; @@ -990,7 +990,7 @@ static const char *get_nucleus_config_path() /* get_unique_id: * Returns a network unique machine identifier as a string. */ -static const char *get_unique_id() +static const char *get_unique_id(void) { return "DOS"; } @@ -1000,7 +1000,7 @@ static const char *get_unique_id() /* get_machine_name: * Returns the network machine name as a string. */ -static const char *get_machine_name() +static const char *get_machine_name(void) { static char *buffer = NULL; @@ -1021,7 +1021,7 @@ static const char *get_machine_name() /* vf_available: * Checks whether the virtual framebuffer mode is avaliable (no, it isn't). */ -static int vf_available() +static int vf_available(void) { return 0; } @@ -1041,7 +1041,7 @@ static void *vf_init(unsigned long baseAddr, int bankSize, int codeLen, void *ba /* vf_exit: * Shuts down the virtual framebuffer mode. */ -static void vf_exit() +static void vf_exit(void) { } @@ -1059,7 +1059,7 @@ typedef struct /* open_console: * Prepares the system for console output. */ -static int open_console() +static int open_console(void) { return 0; } @@ -1069,7 +1069,7 @@ static int open_console() /* get_console_state_size: * Returns the size of a console state buffer. */ -static int get_console_state_size() +static int get_console_state_size(void) { return sizeof(CONSOLE_STATE); } diff --git a/src/misc/vga.c b/src/misc/vga.c index acb451ee98..933ad4b2c8 100644 --- a/src/misc/vga.c +++ b/src/misc/vga.c @@ -38,7 +38,7 @@ static BITMAP *vga_init(int w, int h, int v_w, int v_h, int color_depth); static void vga_exit(BITMAP *b); static int vga_scroll(int x, int y); -static GFX_MODE_LIST *vga_fetch_mode_list(); +static GFX_MODE_LIST *vga_fetch_mode_list(void); GFX_DRIVER gfx_vga = @@ -340,7 +340,7 @@ static int vga_scroll(int x, int y) /* vga_fetch_mode_list: * Creates a list of of currently implemented VGA modes. */ -static GFX_MODE_LIST *vga_fetch_mode_list() +static GFX_MODE_LIST *vga_fetch_mode_list(void) { GFX_MODE_LIST *mode_list; diff --git a/src/modesel.c b/src/modesel.c index 121e6ec646..202fd0a61d 100644 --- a/src/modesel.c +++ b/src/modesel.c @@ -16,6 +16,9 @@ * * Rewritten by Henrik Stokseth. * + * Magnus Henoch modified it to keep the current selection + * across the changes as much as possible. + * * See readme.txt for copyright information. */ @@ -31,29 +34,18 @@ static AL_CONST char *gfx_mode_getter(int index, int *list_size); static AL_CONST char *gfx_card_getter(int index, int *list_size); static AL_CONST char *gfx_depth_getter(int index, int *list_size); -int d_listchange_proc(int msg, DIALOG* d, int c); +static int change_proc(int msg, DIALOG *d, int c); #define ALL_BPP(w, h) { w, h, { TRUE, TRUE, TRUE, TRUE, TRUE }} -#define BPP_08 0 -#define BPP_15 1 -#define BPP_16 2 -#define BPP_24 3 -#define BPP_32 4 -#define BPP_TOTAL 5 - -#define GFX_TITLE 1 -#define GFX_OK 2 -#define GFX_CANCEL 3 -#define GFX_DRIVERLIST 4 -#define GFX_MODELIST 5 -#define GFX_DEPTHLIST 6 +#define N_COLOR_DEPTH 5 +static int bpp_value_list[N_COLOR_DEPTH] = {8, 15, 16, 24, 32}; typedef struct MODE_LIST { int w, h; - char bpp[5]; + char has_bpp[N_COLOR_DEPTH]; } MODE_LIST; #define DRVNAME_SIZE 128 @@ -117,12 +109,12 @@ static DIALOG gfx_mode_dialog[] = { /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ { _gui_shadow_box_proc, 0, 0, 313, 159, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, + { change_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { _gui_ctext_proc, 156, 8, 1, 1, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, { _gui_button_proc, 196, 105, 101, 17, 0, 0, 0, D_EXIT, 0, 0, NULL, NULL, NULL }, { _gui_button_proc, 196, 127, 101, 17, 0, 0, 27, D_EXIT, 0, 0, NULL, NULL, NULL }, { _gui_list_proc, 16, 28, 165, 116, 0, 0, 0, D_EXIT, 0, 0, (void*)gfx_card_getter, NULL, NULL }, { _gui_list_proc, 196, 28, 101, 68, 0, 0, 0, D_EXIT, 3, 0, (void*)gfx_mode_getter, NULL, NULL }, - { d_listchange_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { d_yield_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } }; @@ -133,44 +125,150 @@ static DIALOG gfx_mode_ex_dialog[] = { /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ { _gui_shadow_box_proc, 0, 0, 313, 159, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, + { change_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { _gui_ctext_proc, 156, 8, 1, 1, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, { _gui_button_proc, 196, 105, 101, 17, 0, 0, 0, D_EXIT, 0, 0, NULL, NULL, NULL }, { _gui_button_proc, 196, 127, 101, 17, 0, 0, 27, D_EXIT, 0, 0, NULL, NULL, NULL }, { _gui_list_proc, 16, 28, 165, 68, 0, 0, 0, D_EXIT, 0, 0, (void*)gfx_card_getter, NULL, NULL }, { _gui_list_proc, 196, 28, 101, 68, 0, 0, 0, D_EXIT, 3, 0, (void*)gfx_mode_getter, NULL, NULL }, { _gui_list_proc, 16, 105, 165, 44, 0, 0, 0, D_EXIT, 0, 0, (void*)gfx_depth_getter, NULL, NULL }, - { d_listchange_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { d_yield_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } }; +#define GFX_CHANGEPROC 1 +#define GFX_TITLE 2 +#define GFX_OK 3 +#define GFX_CANCEL 4 +#define GFX_DRIVERLIST 5 +#define GFX_MODELIST 6 +#define GFX_DEPTHLIST 7 + + + +/* bpp_value: + * Returns the bpp value of the color depth pointed to by INDEX. + */ +static INLINE int bpp_value(int index) +{ + ASSERT(index < N_COLOR_DEPTH); + + return bpp_value_list[index]; +} + + + +/* bpp_value_for_mode: + * Returns the bpp value of the color depth pointed to by INDEX + * for the specified MODE of the specified DRIVER or -1 if INDEX + * is out of bound. + */ +static int bpp_value_for_mode(int index, int driver, int mode) +{ + int i, j = -1; + + ASSERT(index < N_COLOR_DEPTH); + + for (i=0; i < N_COLOR_DEPTH; i++) { + if (driver_list[driver].mode_list[mode].has_bpp[i]) { + if (++j == index) + return bpp_value(i); + } + } + + return -1; +} + + + +/* bpp_index: + * Returns the bpp index of the color depth given by DEPTH. + */ +static int bpp_index(int depth) +{ + int i; + + for (i=0; i < N_COLOR_DEPTH; i++) { + if (bpp_value_list[i] == depth) + return i; + } + + ASSERT(FALSE); + return -1; +} + -/* d_listchange_proc: - * Stores the current driver in d1 and graphics mode in d2; - * if a new driver is selected in the listbox, it changes the - * w/h and cdepth listboxes so that they redraw and they - * lose their selections. likewise if a new w/h is selected the - * cdepth listbox is updated. + +/* bpp_index_for_mode: + * Returns the bpp index of the color depth given by DEPTH for + * the specified MODE of the specified DRIVER or -1 if DEPTH + * is not supported. */ -int d_listchange_proc(int msg, DIALOG* d, int c) +static int bpp_index_for_mode(int depth, int driver, int mode) { + int i, index = -1; + + for (i=0; i < N_COLOR_DEPTH; i++) { + if (driver_list[driver].mode_list[mode].has_bpp[i]) { + index++; + if (bpp_value_list[i] == depth) + return index; + } + } + + return -1; +} + + + +/* change_proc: + * Stores the current driver in d1 and graphics mode in d2; if a new + * driver is selected in the listbox, it updates the resolution and + * color depth listboxes so that they redraw; if a new resolution is + * selected in the listbox, it updates the color depth listbox. The + * current selection is kept across the changes as much as possible. + */ +static int change_proc(int msg, DIALOG *d, int c) +{ + int width = driver_list[d->d1].mode_list[d->d2].w; + int height = driver_list[d->d1].mode_list[d->d2].h; + int depth = bpp_value_for_mode(what_dialog[GFX_DEPTHLIST].d1, d->d1, d->d2); + int i; + if (msg != MSG_IDLE) return D_O_K; if (what_dialog[GFX_DRIVERLIST].d1 != d->d1) { + /* record the new setting */ d->d1 = what_dialog[GFX_DRIVERLIST].d1; - d->d2 = what_dialog[GFX_MODELIST].d1; + + /* try to preserve the resolution */ what_dialog[GFX_MODELIST].d1 = 0; - what_dialog[GFX_MODELIST].d2 = 0; + for (i = 0; i < driver_list[d->d1].mode_count; i++) { + if (driver_list[d->d1].mode_list[i].w == width && + driver_list[d->d1].mode_list[i].h == height) { + what_dialog[GFX_MODELIST].d1 = i; + break; + } + } + + what_dialog[GFX_MODELIST].d2 = 0; scare_mouse(); object_message(&what_dialog[GFX_MODELIST], MSG_DRAW, 0); unscare_mouse(); + /* record the new setting */ + d->d2 = what_dialog[GFX_MODELIST].d1; + if (what_dialog == gfx_mode_ex_dialog) { - what_dialog[GFX_DEPTHLIST].d1 = 0; + /* try to preserve the color depth */ + what_dialog[GFX_DEPTHLIST].d1 = bpp_index_for_mode(depth, d->d1, d->d2); + if (what_dialog[GFX_DEPTHLIST].d1 < 0) + what_dialog[GFX_DEPTHLIST].d1 = 0; + what_dialog[GFX_DEPTHLIST].d2 = 0; scare_mouse(); object_message(&what_dialog[GFX_DEPTHLIST], MSG_DRAW, 0); unscare_mouse(); @@ -178,11 +276,16 @@ int d_listchange_proc(int msg, DIALOG* d, int c) } if (what_dialog[GFX_MODELIST].d1 != d->d2) { + /* record the new setting */ d->d2 = what_dialog[GFX_MODELIST].d1; if (what_dialog == gfx_mode_ex_dialog) { - what_dialog[GFX_DEPTHLIST].d1 = 0; + /* try to preserve the color depth */ + what_dialog[GFX_DEPTHLIST].d1 = bpp_index_for_mode(depth, d->d1, d->d2); + if (what_dialog[GFX_DEPTHLIST].d1 < 0) + what_dialog[GFX_DEPTHLIST].d1 = 0; + what_dialog[GFX_DEPTHLIST].d2 = 0; scare_mouse(); object_message(&what_dialog[GFX_DEPTHLIST], MSG_DRAW, 0); unscare_mouse(); @@ -230,13 +333,7 @@ static int create_mode_list(DRIVER_LIST *driver_list_entry) if ((gfx_mode_entry->width == temp_mode_list[mode].w) && (gfx_mode_entry->height == temp_mode_list[mode].h)) { res_exist = TRUE; - switch(gfx_mode_entry->bpp) { - case 8 : temp_mode_list[mode].bpp[BPP_08] = TRUE; break; - case 15: temp_mode_list[mode].bpp[BPP_15] = TRUE; break; - case 16: temp_mode_list[mode].bpp[BPP_16] = TRUE; break; - case 24: temp_mode_list[mode].bpp[BPP_24] = TRUE; break; - case 32: temp_mode_list[mode].bpp[BPP_32] = TRUE; break; - } + temp_mode_list[mode].has_bpp[bpp_index(gfx_mode_entry->bpp)] = TRUE; break; } } @@ -254,19 +351,9 @@ static int create_mode_list(DRIVER_LIST *driver_list_entry) temp_mode_list[mode].w = gfx_mode_entry->width; temp_mode_list[mode].h = gfx_mode_entry->height; - temp_mode_list[mode].bpp[BPP_08] = FALSE; - temp_mode_list[mode].bpp[BPP_15] = FALSE; - temp_mode_list[mode].bpp[BPP_16] = FALSE; - temp_mode_list[mode].bpp[BPP_24] = FALSE; - temp_mode_list[mode].bpp[BPP_32] = FALSE; - - switch(gfx_mode_entry->bpp) { - case 8 : temp_mode_list[mode].bpp[BPP_08] = TRUE; break; - case 15: temp_mode_list[mode].bpp[BPP_15] = TRUE; break; - case 16: temp_mode_list[mode].bpp[BPP_16] = TRUE; break; - case 24: temp_mode_list[mode].bpp[BPP_24] = TRUE; break; - case 32: temp_mode_list[mode].bpp[BPP_32] = TRUE; break; - } + + memset(temp_mode_list[mode].has_bpp, 0, N_COLOR_DEPTH); + temp_mode_list[mode].has_bpp[bpp_index(gfx_mode_entry->bpp)] = TRUE; } } @@ -302,8 +389,8 @@ static int create_mode_list(DRIVER_LIST *driver_list_entry) static int create_driver_list(void) { _DRIVER_INFO *driver_info; - GFX_DRIVER *gfx_driver; - int driver_count2, used_prefetched; + GFX_DRIVER *gfx_driver; + int driver_count2, used_prefetched; if (system_driver->gfx_drivers) driver_info = system_driver->gfx_drivers(); @@ -374,6 +461,7 @@ static void destroy_driver_list(void) if (driver_list[driver].fetch_mode_list_ptr) free(driver_list[driver].mode_list); } + free(driver_list); } @@ -407,7 +495,7 @@ static AL_CONST char *gfx_mode_getter(int index, int *list_size) if (index < 0) { if (list_size) { - *list_size = driver_list[entry].mode_count; + *list_size = driver_list[entry].mode_count; return NULL; } } @@ -425,8 +513,9 @@ static AL_CONST char *gfx_mode_getter(int index, int *list_size) */ static AL_CONST char *gfx_depth_getter(int index, int *list_size) { + static char *bpp_string_list[N_COLOR_DEPTH] = {"256", "32K", "64K", "16M", "16M"}; MODE_LIST *mode; - int bpp_count, card_entry, mode_entry, bpp_entry; + int card_entry, mode_entry, bpp_entry, bpp_count, bpp_index; char tmp[128]; card_entry = what_dialog[GFX_DRIVERLIST].d1; @@ -435,96 +524,38 @@ static AL_CONST char *gfx_depth_getter(int index, int *list_size) if (index < 0) { if (list_size) { - bpp_count = 0; - if(mode->bpp[BPP_08]) bpp_count++; - if(mode->bpp[BPP_15]) bpp_count++; - if(mode->bpp[BPP_16]) bpp_count++; - if(mode->bpp[BPP_24]) bpp_count++; - if(mode->bpp[BPP_32]) bpp_count++; + /* Count the number of BPP entries for the mode. */ + for (bpp_count = 0, bpp_entry = 0; bpp_entry < N_COLOR_DEPTH; bpp_entry++) { + if (mode->has_bpp[bpp_entry]) + bpp_count++; + } + *list_size = bpp_count; return NULL; } } - bpp_entry = 0; - bpp_count = 0; - while (bpp_count < index) { - bpp_entry++; - if (mode->bpp[bpp_entry]) bpp_count++; - } - - switch (bpp_entry) { - - case BPP_08: - uszprintf(mode_string, sizeof(mode_string), uconvert_ascii(" 8 %s (256 %s)", tmp), get_config_text("bpp"), get_config_text("colors")); - break; - - case BPP_15: - uszprintf(mode_string, sizeof(mode_string), uconvert_ascii("15 %s (32K %s)", tmp), get_config_text("bpp"), get_config_text("colors")); - break; - - case BPP_16: - uszprintf(mode_string, sizeof(mode_string), uconvert_ascii("16 %s (64K %s)", tmp), get_config_text("bpp"), get_config_text("colors")); - break; - - case BPP_24: - uszprintf(mode_string, sizeof(mode_string), uconvert_ascii("24 %s (16M %s)", tmp), get_config_text("bpp"), get_config_text("colors")); - break; - - case BPP_32: - uszprintf(mode_string, sizeof(mode_string), uconvert_ascii("32 %s (16M %s)", tmp), get_config_text("bpp"), get_config_text("colors")); - break; + /* Find the BPP entry for the mode corresponding to the zero-based index. */ + bpp_index = -1; + bpp_entry = -1; + while (bpp_index < index) { + if (mode->has_bpp[++bpp_entry]) + bpp_index++; } + uszprintf(mode_string, + sizeof(mode_string), + uconvert_ascii("%2d %s (%s %s)", tmp), + bpp_value(bpp_entry), + get_config_text("bpp"), + bpp_string_list[bpp_entry], + get_config_text("colors")); + return mode_string; } -/* gfx_mode_select: - * Displays the Allegro graphics mode selection dialog, which allows the - * user to select a screen mode and graphics card. Stores the selection - * in the three variables, and returns zero if it was closed with the - * Cancel button, or non-zero if it was OK'd. - */ -int gfx_mode_select(int *card, int *w, int *h) -{ - int what_driver, what_mode, ret; - - clear_keybuf(); - - while (gui_mouse_b()); - - what_dialog = gfx_mode_dialog; - - gfx_mode_dialog[GFX_TITLE].dp = (void*)get_config_text("Graphics Mode"); - gfx_mode_dialog[GFX_OK].dp = (void*)get_config_text("OK"); - gfx_mode_dialog[GFX_CANCEL].dp = (void*)get_config_text("Cancel"); - - create_driver_list(); - - centre_dialog(gfx_mode_dialog); - set_dialog_color(gfx_mode_dialog, gui_fg_color, gui_bg_color); - ret = popup_dialog(gfx_mode_dialog, GFX_DRIVERLIST); - - what_driver = gfx_mode_dialog[GFX_DRIVERLIST].d1; - what_mode = gfx_mode_dialog[GFX_MODELIST].d1; - - *card = driver_list[what_driver].id; - - *w = driver_list[what_driver].mode_list[what_mode].w; - *h = driver_list[what_driver].mode_list[what_mode].h; - - destroy_driver_list(); - - if (ret == GFX_CANCEL) - return FALSE; - else - return TRUE; -} - - - /* gfx_mode_select_ex: * Extended version of the graphics mode selection dialog, which allows the * user to select the color depth as well as the resolution and hardware @@ -533,82 +564,81 @@ int gfx_mode_select(int *card, int *w, int *h) */ int gfx_mode_select_ex(int *card, int *w, int *h, int *color_depth) { - int i, j, ret, what_driver, what_mode, what_bpp; + int i, ret, what_driver, what_mode, what_bpp, extd; clear_keybuf(); + extd = color_depth ? TRUE : FALSE; + while (gui_mouse_b()); - what_dialog = gfx_mode_ex_dialog; + what_dialog = extd ? gfx_mode_ex_dialog : gfx_mode_dialog; - create_driver_list(); + what_dialog[GFX_TITLE].dp = (void*)get_config_text("Graphics Mode"); + what_dialog[GFX_OK].dp = (void*)get_config_text("OK"); + what_dialog[GFX_CANCEL].dp = (void*)get_config_text("Cancel"); - gfx_mode_ex_dialog[GFX_DRIVERLIST].d1 = 0; + create_driver_list(); - for (i=0; iw >= x) && - (mouse_y - mouse_y_focus + mouse_sprite->h >= y)) { + if ((mx - mouse_x_focus < x + w) && + (my - mouse_y_focus < y + h) && + (mx - mouse_x_focus + mouse_sprite->w >= x) && + (my - mouse_y_focus + mouse_sprite->h >= y)) { if (scared_size < SCARED_SIZE) { scared_screen[scared_size] = _mouse_screen; @@ -961,8 +961,8 @@ void remove_mouse(void) /* _mouse_constructor: * Register mouse functions if this object file is linked in. */ -#ifdef CONSTRUCTOR_FUNCTION - CONSTRUCTOR_FUNCTION(void _mouse_constructor()); +#ifdef ALLEGRO_USE_CONSTRUCTOR + CONSTRUCTOR_FUNCTION(void _mouse_constructor(void)); #endif static struct _AL_LINKER_MOUSE mouse_linker = { diff --git a/src/pcx.c b/src/pcx.c index a494770f56..cfc877c611 100644 --- a/src/pcx.c +++ b/src/pcx.c @@ -31,6 +31,7 @@ BITMAP *load_pcx(AL_CONST char *filename, RGB *pal) PACKFILE *f; BITMAP *b; PALETTE tmppal; + int want_palette = TRUE; int c; int width, height; int bpp, bytes_per_line; @@ -39,8 +40,11 @@ BITMAP *load_pcx(AL_CONST char *filename, RGB *pal) char ch; int dest_depth; - if (!pal) + /* we really need a palette */ + if (!pal) { + want_palette = FALSE; pal = tmppal; + } f = pack_fopen(filename, F_READ); if (!f) @@ -85,12 +89,18 @@ BITMAP *load_pcx(AL_CONST char *filename, RGB *pal) b = create_bitmap_ex(bpp, width, height); if (!b) { pack_fclose(f); - return FALSE; + return NULL; } for (y=0; y= 0) diff --git a/src/sound.c b/src/sound.c index 10b83726d3..2c4d490ec3 100644 --- a/src/sound.c +++ b/src/sound.c @@ -162,7 +162,7 @@ static void sound_lock_mem(void); /* read_sound_config: * Helper for reading the sound hardware configuration data. */ -static void read_sound_config() +static void read_sound_config(void) { char tmp1[64], tmp2[64]; char *sound = uconvert_ascii("sound", tmp1); @@ -1201,7 +1201,7 @@ static INLINE int allocate_physical_voice(int priority) * others to make room, as we allow up to 256 virtual voices to be used * simultaneously. */ -static INLINE int allocate_virtual_voice() +static INLINE int allocate_virtual_voice(void) { int virt_voices, c; diff --git a/src/tga.c b/src/tga.c index 7396b324c1..be1d8be0fb 100644 --- a/src/tga.c +++ b/src/tga.c @@ -14,7 +14,9 @@ * * RLE support added by Michal Mertl and Salvador Eduardo Tropea. * - * Palette reading improved by Peter Wang. + * Palette reading improved by Peter Wang. + * + * Big-endian support added by Eric Botcazou. * * See readme.txt for copyright information. */ @@ -25,145 +27,217 @@ -/* rle_tga_read: - * Helper for reading 256 color RLE data from TGA files. +/* raw_tga_read8: + * Helper for reading 256-color raw data from TGA files. + */ +static INLINE unsigned char *raw_tga_read8(unsigned char *b, int w, PACKFILE *f) +{ + return b + pack_fread(b, w, f); +} + + + +/* rle_tga_read8: + * Helper for reading 256-color RLE data from TGA files. */ -static void rle_tga_read(unsigned char *b, int w, PACKFILE *f) +static void rle_tga_read8(unsigned char *b, int w, PACKFILE *f) { - unsigned char value; - int count; - int c = 0; + int value, count, c = 0; do { count = pack_getc(f); if (count & 0x80) { + /* run-length packet */ count = (count & 0x7F) + 1; c += count; value = pack_getc(f); while (count--) - *(b++) = value; + *b++ = value; } else { + /* raw packet */ count++; c += count; - pack_fread(b, count, f); - b += count; + b = raw_tga_read8(b, count, f); } } while (c < w); } +/* single_tga_read32: + * Helper for reading a single 32-bit data from TGA files. + */ +static INLINE int single_tga_read32(PACKFILE *f) +{ + RGB value; + int alpha; + + value.b = pack_getc(f); + value.g = pack_getc(f); + value.r = pack_getc(f); + alpha = pack_getc(f); + + return makeacol32(value.r, value.g, value.b, alpha); +} + + + +/* raw_tga_read32: + * Helper for reading 32-bit raw data from TGA files. + */ +static unsigned int *raw_tga_read32(unsigned int *b, int w, PACKFILE *f) +{ + while (w--) + *b++ = single_tga_read32(f); + + return b; +} + + + /* rle_tga_read32: - * Helper for reading 32 bit RLE data from TGA files. + * Helper for reading 32-bit RLE data from TGA files. */ -static void rle_tga_read32(unsigned char *b, int w, PACKFILE *f) +static void rle_tga_read32(unsigned int *b, int w, PACKFILE *f) { - unsigned char value[4]; - int count; - int c = 0; + int color, count, c = 0; do { count = pack_getc(f); if (count & 0x80) { + /* run-length packet */ count = (count & 0x7F) + 1; c += count; - pack_fread(value, 4, f); - while (count--) { - b[_rgb_a_shift_32/8] = value[3]; - b[_rgb_r_shift_32/8] = value[2]; - b[_rgb_g_shift_32/8] = value[1]; - b[_rgb_b_shift_32/8] = value[0]; - b += 4; - } + color = single_tga_read32(f); + while (count--) + *b++ = color; } else { + /* raw packet */ count++; c += count; - while (count--) { - pack_fread(value, 4, f); - b[_rgb_a_shift_32/8] = value[3]; - b[_rgb_r_shift_32/8] = value[2]; - b[_rgb_g_shift_32/8] = value[1]; - b[_rgb_b_shift_32/8] = value[0]; - b += 4; - } + b = raw_tga_read32(b, count, f); } } while (c < w); } +/* single_tga_read24: + * Helper for reading a single 24-bit data from TGA files. + */ +static INLINE int single_tga_read24(PACKFILE *f) +{ + RGB value; + + value.b = pack_getc(f); + value.g = pack_getc(f); + value.r = pack_getc(f); + + return makecol24(value.r, value.g, value.b); +} + + + +/* raw_tga_read24: + * Helper for reading 24-bit raw data from TGA files. + */ +static unsigned char *raw_tga_read24(unsigned char *b, int w, PACKFILE *f) +{ + int color; + + while (w--) { + color = single_tga_read24(f); + WRITE3BYTES(b, color); + b += 3; + } + + return b; +} + + /* rle_tga_read24: - * Helper for reading 24 bit RLE data from TGA files. + * Helper for reading 24-bit RLE data from TGA files. */ static void rle_tga_read24(unsigned char *b, int w, PACKFILE *f) { - unsigned char value[4]; - int count; - int c = 0; + int color, count, c = 0; do { count = pack_getc(f); if (count & 0x80) { + /* run-length packet */ count = (count & 0x7F) + 1; c += count; - pack_fread(value, 3, f); + color = single_tga_read24(f); while (count--) { - b[_rgb_r_shift_24/8] = value[2]; - b[_rgb_g_shift_24/8] = value[1]; - b[_rgb_b_shift_24/8] = value[0]; + WRITE3BYTES(b, color); b += 3; } } else { + /* raw packet */ count++; c += count; - while (count--) { - pack_fread(value, 3, f); - b[_rgb_r_shift_24/8] = value[2]; - b[_rgb_g_shift_24/8] = value[1]; - b[_rgb_b_shift_24/8] = value[0]; - b += 3; - } + b = raw_tga_read24(b, count, f); } } while (c < w); } +/* single_tga_read16: + * Helper for reading a single 16-bit data from TGA files. + */ +static INLINE int single_tga_read16(PACKFILE *f) +{ + int value; + + value = pack_igetw(f); + + return (((value >> 10) & 0x1F) << _rgb_r_shift_15) | + (((value >> 5) & 0x1F) << _rgb_g_shift_15) | + ((value & 0x1F) << _rgb_b_shift_15); +} + + + +/* raw_tga_read16: + * Helper for reading 16-bit raw data from TGA files. + */ +static unsigned short *raw_tga_read16(unsigned short *b, int w, PACKFILE *f) +{ + while (w--) + *b++ = single_tga_read16(f); + + return b; +} + + + /* rle_tga_read16: - * Helper for reading 16 bit RLE data from TGA files. + * Helper for reading 16-bit RLE data from TGA files. */ static void rle_tga_read16(unsigned short *b, int w, PACKFILE *f) { - unsigned int value; - unsigned short color; - int count; - int c = 0; + int color, count, c = 0; do { count = pack_getc(f); if (count & 0x80) { + /* run-length packet */ count = (count & 0x7F) + 1; c += count; - value = pack_igetw(f); - color = ((((value >> 10) & 0x1F) << _rgb_r_shift_15) | - (((value >> 5) & 0x1F) << _rgb_g_shift_15) | - ((value & 0x1F) << _rgb_b_shift_15)); + color = single_tga_read16(f); while (count--) - *(b++) = color; + *b++ = color; } else { + /* raw packet */ count++; c += count; - while (count--) { - value = pack_igetw(f); - color = ((((value >> 10) & 0x1F) << _rgb_r_shift_15) | - (((value >> 5) & 0x1F) << _rgb_g_shift_15) | - ((value & 0x1F) << _rgb_b_shift_15)); - *(b++) = color; - } + b = raw_tga_read16(b, count, f); } } while (c < w); } @@ -171,27 +245,31 @@ static void rle_tga_read16(unsigned short *b, int w, PACKFILE *f) /* load_tga: - * Loads a 256 color or 24 bit uncompressed TGA file, returning a bitmap - * structure and storing the palette data in the specified palette (this - * should be an array of at least 256 RGB structures). + * Loads a TGA file, returning a bitmap structure and storing the + * palette data in the specified palette (this should be an array + * of at least 256 RGB structures). */ BITMAP *load_tga(AL_CONST char *filename, RGB *pal) { - unsigned char image_id[256], image_palette[256][3], rgb[4]; + unsigned char image_id[256], image_palette[256][3]; unsigned char id_length, palette_type, image_type, palette_entry_size; unsigned char bpp, descriptor_bits; short unsigned int first_color, palette_colors; short unsigned int left, top, image_width, image_height; - unsigned int c, i, x, y, yc; + unsigned int c, i, y, yc; unsigned short *s; int dest_depth; int compressed; PACKFILE *f; BITMAP *bmp; PALETTE tmppal; + int want_palette = TRUE; - if (!pal) + /* we really need a palette */ + if (!pal) { + want_palette = FALSE; pal = tmppal; + } f = pack_fopen(filename, F_READ); if (!f) @@ -273,11 +351,9 @@ BITMAP *load_tga(AL_CONST char *filename, RGB *pal) /* truecolor image */ if ((palette_type == 0) && ((bpp == 15) || (bpp == 16))) { bpp = 15; - generate_332_palette(pal); dest_depth = _color_load_depth(15, FALSE); } else if ((palette_type == 0) && ((bpp == 24) || (bpp == 32))) { - generate_332_palette(pal); dest_depth = _color_load_depth(bpp, (bpp == 32)); } else { @@ -321,52 +397,29 @@ BITMAP *load_tga(AL_CONST char *filename, RGB *pal) case 1: case 3: if (compressed) - rle_tga_read(bmp->line[yc], image_width, f); + rle_tga_read8(bmp->line[yc], image_width, f); else - pack_fread(bmp->line[yc], image_width, f); + raw_tga_read8(bmp->line[yc], image_width, f); break; case 2: if (bpp == 32) { - if (compressed) { - rle_tga_read32(bmp->line[yc], image_width, f); - } - else { - for (x=0; xline[yc][x*4+_rgb_a_shift_32/8] = rgb[3]; - bmp->line[yc][x*4+_rgb_r_shift_32/8] = rgb[2]; - bmp->line[yc][x*4+_rgb_g_shift_32/8] = rgb[1]; - bmp->line[yc][x*4+_rgb_b_shift_32/8] = rgb[0]; - } - } + if (compressed) + rle_tga_read32((unsigned int *)bmp->line[yc], image_width, f); + else + raw_tga_read32((unsigned int *)bmp->line[yc], image_width, f); } else if (bpp == 24) { - if (compressed) { + if (compressed) rle_tga_read24(bmp->line[yc], image_width, f); - } - else { - for (x=0; xline[yc][x*3+_rgb_r_shift_24/8] = rgb[2]; - bmp->line[yc][x*3+_rgb_g_shift_24/8] = rgb[1]; - bmp->line[yc][x*3+_rgb_b_shift_24/8] = rgb[0]; - } - } + else + raw_tga_read24(bmp->line[yc], image_width, f); } else { - if (compressed) { + if (compressed) rle_tga_read16((unsigned short *)bmp->line[yc], image_width, f); - } - else { - s = (unsigned short *)bmp->line[yc]; - for (x=0; x> 10) & 0x1F) << _rgb_r_shift_15) | - (((c >> 5) & 0x1F) << _rgb_g_shift_15) | - ((c & 0x1F) << _rgb_b_shift_15)); - } - } + else + raw_tga_read16((unsigned short *)bmp->line[yc], image_width, f); } break; } @@ -379,9 +432,18 @@ BITMAP *load_tga(AL_CONST char *filename, RGB *pal) return NULL; } - if (dest_depth != bpp) - bmp = _fixup_loaded_bitmap(bmp, pal, dest_depth); + if (dest_depth != bpp) { + /* restore original palette except if it comes from the bitmap */ + if ((bpp != 8) && (!want_palette)) + pal = NULL; + bmp = _fixup_loaded_bitmap(bmp, pal, dest_depth); + } + + /* construct a fake palette if 8-bit mode is not involved */ + if ((bpp != 8) && (dest_depth != 8) && want_palette) + generate_332_palette(pal); + return bmp; } diff --git a/src/unicode.c b/src/unicode.c index 0fa03e64a6..aa768d481b 100644 --- a/src/unicode.c +++ b/src/unicode.c @@ -2277,10 +2277,21 @@ typedef struct STRING_ARG +/* LONGEST: + * 64-bit integers on platforms that support it, 32-bit otherwise. + */ +#ifdef LONG_LONG + #define LONGEST LONG_LONG +#else + #define LONGEST long +#endif + + + /* va_int: * Helper for reading an integer from the varargs list. */ -#ifdef LONGLONG +#ifdef LONG_LONG #define va_int(args, flags) \ ( \ @@ -2288,7 +2299,7 @@ typedef struct STRING_ARG va_arg(args, signed int) \ : \ (((flags) & SPRINT_FLAG_LONG_LONG) ? \ - va_arg(args, signed LONGLONG) \ + va_arg(args, signed LONG_LONG) \ : \ (((flags) & SPRINT_FLAG_LONG_INT) ? \ va_arg(args, signed long int) \ @@ -2316,7 +2327,7 @@ typedef struct STRING_ARG /* va_uint: * Helper for reading an unsigned integer from the varargs list. */ -#ifdef LONGLONG +#ifdef LONG_LONG #define va_uint(args, flags) \ ( \ @@ -2324,7 +2335,7 @@ typedef struct STRING_ARG va_arg(args, unsigned int) \ : \ (((flags) & SPRINT_FLAG_LONG_LONG) ? \ - va_arg(args, unsigned LONGLONG) \ + va_arg(args, unsigned LONG_LONG) \ : \ (((flags) & SPRINT_FLAG_LONG_INT) ? \ va_arg(args, unsigned long int) \ @@ -2373,7 +2384,7 @@ static int sprint_char(STRING_ARG *string_arg, SPRINT_INFO *info, long val) /* sprint_i: * Worker function for formatting integers. */ -static int sprint_i(STRING_ARG *string_arg, unsigned long val, int precision) +static int sprint_i(STRING_ARG *string_arg, unsigned LONGEST val, int precision) { char tmp[24]; /* for 64-bit integers */ int i = 0, pos = string_arg->size; @@ -2418,7 +2429,7 @@ static int sprint_i(STRING_ARG *string_arg, unsigned long val, int precision) /* sprint_int: * Helper for formatting a signed integer. */ -static int sprint_int(STRING_ARG *string_arg, SPRINT_INFO *info, long val) +static int sprint_int(STRING_ARG *string_arg, SPRINT_INFO *info, LONGEST val) { int pos = 0, len = 0; @@ -2446,7 +2457,7 @@ static int sprint_int(STRING_ARG *string_arg, SPRINT_INFO *info, long val) /* sprint_unsigned: * Helper for formatting an unsigned integer. */ -static int sprint_unsigned(STRING_ARG *string_arg, SPRINT_INFO *info, unsigned long val) +static int sprint_unsigned(STRING_ARG *string_arg, SPRINT_INFO *info, unsigned LONGEST val) { int pos = 0; @@ -2466,7 +2477,7 @@ static int sprint_unsigned(STRING_ARG *string_arg, SPRINT_INFO *info, unsigned l /* sprint_hex: * Helper for formatting a hex integer. */ -static int sprint_hex(STRING_ARG *string_arg, SPRINT_INFO *info, int caps, unsigned long val) +static int sprint_hex(STRING_ARG *string_arg, SPRINT_INFO *info, int caps, unsigned LONGEST val) { static char hex_digit_caps[] = "0123456789ABCDEF"; static char hex_digit[] = "0123456789abcdef"; @@ -2515,7 +2526,7 @@ static int sprint_hex(STRING_ARG *string_arg, SPRINT_INFO *info, int caps, unsig /* sprint_octal: * Helper for formatting an octal integer. */ -static int sprint_octal(STRING_ARG *string_arg, SPRINT_INFO *info, unsigned long val) +static int sprint_octal(STRING_ARG *string_arg, SPRINT_INFO *info, unsigned LONGEST val) { char tmp[24]; /* for 64-bit integers */ int pos = 0, i = 0; diff --git a/src/unix/alsa.c b/src/unix/alsa.c index 3d77e338a6..eb16bb824b 100644 --- a/src/unix/alsa.c +++ b/src/unix/alsa.c @@ -172,7 +172,8 @@ static int alsa_detect(int input) uconvert_ascii("alsa_pcmdevice", tmp2), snd_defaults_pcm_device()); - if (snd_pcm_open(&handle, card, device, SND_PCM_OPEN_PLAYBACK) == 0) { + if (snd_pcm_open(&handle, card, device, (SND_PCM_OPEN_PLAYBACK + | SND_PCM_OPEN_NONBLOCK)) == 0) { if ((snd_pcm_info(handle, &info) == 0) && (info.flags & SND_PCM_INFO_PLAYBACK)) ret = TRUE; diff --git a/src/unix/arts.c b/src/unix/arts.c new file mode 100644 index 0000000000..5680474118 --- /dev/null +++ b/src/unix/arts.c @@ -0,0 +1,298 @@ +/* ______ ___ ___ + * /\ _ \ /\_ \ /\_ \ + * \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___ + * \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\ + * \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \ + * \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/ + * \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/ + * /\____/ + * \_/__/ + * + * aRts sound driver (using artsc). + * + * By Peter Wang. + * + * See readme.txt for copyright information. + */ + + +#include "allegro.h" + +#if (defined DIGI_ARTS) && ((!defined ALLEGRO_WITH_MODULES) || (defined ALLEGRO_MODULE)) + +#include "allegro/internal/aintern.h" +#include "allegro/platform/aintunix.h" + +#include + +static int _al_arts_bits, _al_arts_rate, _al_arts_stereo; +#define _al_arts_signed (TRUE) + +static arts_stream_t _al_arts_stream = NULL; +static int _al_arts_bufsize; +static int _al_arts_fragments; +static unsigned char *_al_arts_bufdata = NULL; + +static int _al_arts_detect(int input); +static int _al_arts_init(int input, int voices); +static void _al_arts_exit(int input); +static int _al_arts_buffer_size(void); + +static char _al_arts_desc[256] = EMPTY_STRING; + +DIGI_DRIVER digi_arts = +{ + DIGI_ARTS, + empty_string, + empty_string, + "aRts", + 0, + 0, + MIXER_MAX_SFX, + MIXER_DEF_SFX, + + _al_arts_detect, + _al_arts_init, + _al_arts_exit, + NULL, + + NULL, + NULL, + _al_arts_buffer_size, + _mixer_init_voice, + _mixer_release_voice, + _mixer_start_voice, + _mixer_stop_voice, + _mixer_loop_voice, + + _mixer_get_position, + _mixer_set_position, + + _mixer_get_volume, + _mixer_set_volume, + _mixer_ramp_volume, + _mixer_stop_volume_ramp, + + _mixer_get_frequency, + _mixer_set_frequency, + _mixer_sweep_frequency, + _mixer_stop_frequency_sweep, + + _mixer_get_pan, + _mixer_set_pan, + _mixer_sweep_pan, + _mixer_stop_pan_sweep, + + _mixer_set_echo, + _mixer_set_tremolo, + _mixer_set_vibrato, + 0, 0, + 0, + 0, + 0, + 0, + 0, + 0 +}; + + + +/* _al_arts_buffer_size: + * Returns the current DMA buffer size, for use by the audiostream code. + */ +static int _al_arts_buffer_size() +{ + return _al_arts_bufsize / (_al_arts_bits / 8) / (_al_arts_stereo ? 2 : 1); +} + + + +/* _al_arts_update: + * Update data. + */ +static void _al_arts_update(int threaded) +{ + int i; + + for (i = 0; i < _al_arts_fragments; i++) { + if (arts_write(_al_arts_stream, _al_arts_bufdata, _al_arts_bufsize) + < _al_arts_bufsize) + break; + _mix_some_samples((unsigned long) _al_arts_bufdata, 0, _al_arts_signed); + } +} + + + +#define copy_error_text(code, tmp) \ +ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, \ + uconvert_ascii(arts_error_text(code), (tmp))); + + + +/* _al_arts_detect: + * Detect driver presence. + */ +static int _al_arts_detect(int input) +{ + char tmp[ALLEGRO_ERROR_SIZE]; + int code; + + if (input) { + ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, + get_config_text("Input is not supported")); + return FALSE; + } + + code = arts_init(); + if (code != 0) { + copy_error_text(code, tmp); + return FALSE; + } + + arts_free(); + return TRUE; +} + + + +/* _al_arts_init: + * Init routine. + */ +static int _al_arts_init(int input, int voices) +{ + char tmp1[ALLEGRO_ERROR_SIZE]; + char tmp2[128]; + int code; + + if (input) { + ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, + get_config_text("Input is not supported")); + return -1; + } + + /* Initialise artsc library. */ + code = arts_init(); + if (code != 0) { + copy_error_text(code, tmp1); + return -1; + } + + /* Make a copy of the global sound settings. */ + _al_arts_bits = (_sound_bits == 8) ? 8 : 16; + _al_arts_stereo = (_sound_stereo) ? 1 : 0; + _al_arts_rate = (_sound_freq > 0) ? _sound_freq : 44100; + + /* Open a stream for playback. */ + _al_arts_stream = arts_play_stream(_al_arts_rate, _al_arts_bits, + _al_arts_stereo ? 2 : 1, + "allegro"); + if (!_al_arts_stream) { + ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, + get_config_text("Can not open audio stream")); + goto error; + } + + /* Need non-blocking writes. */ + code = arts_stream_set(_al_arts_stream, ARTS_P_BLOCKING, 0); + if (code != 0) { + copy_error_text(code, tmp1); + goto error; + } + + /* Try to reduce the latency of our stream. */ + if (arts_stream_get(_al_arts_stream, ARTS_P_BUFFER_TIME) > 100) + arts_stream_set(_al_arts_stream, ARTS_P_BUFFER_TIME, 100); + + /* Read buffer parameters and allocate buffer space. */ + _al_arts_bufsize = arts_stream_get(_al_arts_stream, ARTS_P_PACKET_SIZE); + _al_arts_fragments = arts_stream_get(_al_arts_stream, ARTS_P_PACKET_COUNT); + _al_arts_bufdata = malloc(_al_arts_bufsize); + if (!_al_arts_bufdata) { + ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, + get_config_text("Can not allocate audio buffer")); + goto error; + } + + /* Start up mixer. */ + digi_arts.voices = voices; + + if (_mixer_init(_al_arts_bufsize / (_al_arts_bits / 8), _al_arts_rate, + _al_arts_stereo, ((_al_arts_bits == 16) ? 1 : 0), + &digi_arts.voices) != 0) { + ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, + get_config_text("Can not init software mixer")); + goto error; + } + + _mix_some_samples((unsigned long) _al_arts_bufdata, 0, _al_arts_signed); + + /* Add audio interrupt. */ + _unix_bg_man->register_func(_al_arts_update); + + /* Decribe ourself. */ + uszprintf(_al_arts_desc, sizeof(_al_arts_desc), + get_config_text("%s: %d bits, %s, %d bps, %s"), + "aRts", _al_arts_bits, + uconvert_ascii("signed", tmp1), _al_arts_rate, + uconvert_ascii((_al_arts_stereo ? "stereo" : "mono"), tmp2)); + digi_driver->desc = _al_arts_desc; + + return 0; + + error: + + if (_al_arts_bufdata) { + free(_al_arts_bufdata); + _al_arts_bufdata = NULL; + } + + if (_al_arts_stream) { + arts_close_stream(_al_arts_stream); + _al_arts_stream = NULL; + } + + arts_free(); + + return -1; +} + + + +/* _al_arts_exit: + * Shutdown routine. + */ +static void _al_arts_exit(int input) +{ + if (input) + return; + + _unix_bg_man->unregister_func(_al_arts_update); + + _mixer_exit(); + + free(_al_arts_bufdata); + _al_arts_bufdata = NULL; + + arts_close_stream(_al_arts_stream); + _al_arts_stream = NULL; + + arts_free(); +} + + + +#ifdef ALLEGRO_MODULE + +/* _module_init: + * Called when loaded as a dynamically linked module. + */ +void _module_init(int system_driver) +{ + _unix_register_digi_driver(DIGI_ARTS, &digi_arts, TRUE, TRUE); +} + +#endif + +#endif + diff --git a/src/unix/udrvlist.c b/src/unix/udrvlist.c index d7ec4d7163..5f24d262d7 100644 --- a/src/unix/udrvlist.c +++ b/src/unix/udrvlist.c @@ -31,7 +31,7 @@ _DRIVER_INFO *_unix_midi_driver_list = 0; /* _unix_driver_lists_init: * Initialise driver lists. */ -void _unix_driver_lists_init() +void _unix_driver_lists_init(void) { _unix_gfx_driver_list = _create_driver_list(); if (_unix_gfx_driver_list) @@ -51,7 +51,7 @@ void _unix_driver_lists_init() /* _unix_driver_lists_shutdown: * Free driver lists. */ -void _unix_driver_lists_shutdown() +void _unix_driver_lists_shutdown(void) { if (_unix_gfx_driver_list) { _destroy_driver_list(_unix_gfx_driver_list); diff --git a/src/unix/udummy.c b/src/unix/udummy.c new file mode 100644 index 0000000000..66c531e3e7 --- /dev/null +++ b/src/unix/udummy.c @@ -0,0 +1,8 @@ +/* This file contains a dummy symbol that gets unconditionally included + * in liballeg_unsharable.a through a tweak in misc/deplib.sh, in order + * to make sure that the static library contains at least one symbol. + * This is needed for Solaris because the linker chokes when a library + * contains no symbol. + */ + +int _dummy_symbol; diff --git a/src/unix/uesd.c b/src/unix/uesd.c index 6b94832407..efab1f6f23 100644 --- a/src/unix/uesd.c +++ b/src/unix/uesd.c @@ -148,7 +148,7 @@ static int _al_esd_detect(int input) } /* We don't want esdlib to spawn ESD while we are detecting it. */ - setenv("ESD_NO_SPAWN", "1", 0); + putenv("ESD_NO_SPAWN=1"); /* Get ESD server name. */ server = get_config_string(uconvert_ascii("sound", tmp1), @@ -209,6 +209,7 @@ static int _al_esd_init(int input, int voices) if (_al_esd_bufdata == 0) { ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Can not allocate audio buffer")); close(_al_esd_fd); + return -1; } digi_esd.voices = voices; @@ -217,6 +218,8 @@ static int _al_esd_init(int input, int voices) _al_esd_stereo, ((_al_esd_bits == 16) ? 1 : 0), &digi_esd.voices) != 0) { ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Can not init software mixer")); + free(_al_esd_bufdata); + _al_esd_bufdata = 0; close(_al_esd_fd); return -1; } diff --git a/src/unix/ufile.c b/src/unix/ufile.c index 0271a6e530..fdaf3d08b4 100644 --- a/src/unix/ufile.c +++ b/src/unix/ufile.c @@ -264,17 +264,20 @@ static int ff_match(AL_CONST char *s1, AL_CONST char *s2) static int ff_get_attrib(AL_CONST char *name, struct stat *s) { int attrib = 0; + uid_t euid = geteuid(); - if (s->st_uid == geteuid()) { - if ((s->st_mode & S_IWUSR) == 0) - attrib |= FA_RDONLY; - } - else if (s->st_gid == getegid()) { - if ((s->st_mode & S_IWGRP) == 0) - attrib |= FA_RDONLY; - } - else if ((s->st_mode & S_IWOTH) == 0) { - attrib |= FA_RDONLY; + if (euid != 0) { + if (s->st_uid == euid) { + if ((s->st_mode & S_IWUSR) == 0) + attrib |= FA_RDONLY; + } + else if (s->st_gid == getegid()) { + if ((s->st_mode & S_IWGRP) == 0) + attrib |= FA_RDONLY; + } + else if ((s->st_mode & S_IWOTH) == 0) { + attrib |= FA_RDONLY; + } } if (S_ISDIR(s->st_mode)) diff --git a/src/unix/umodules.c b/src/unix/umodules.c index 94568c9210..a986faed27 100644 --- a/src/unix/umodules.c +++ b/src/unix/umodules.c @@ -53,6 +53,7 @@ static char *module_path[] = static void strip(char *s) { char *x; + if (!s[0]) return; for (x = s + strlen(s) - 1; isspace(*x); x--); x[1] = '\0'; for (x = s; isspace(*x); x++); @@ -67,26 +68,43 @@ static void strip(char *s) void _unix_load_modules(int system_driver) { PACKFILE *f; - char **path; + char fullpath[1024]; + char *fullpath_slash; char buf[1024]; char buf2[1024]; - char buf3[1024]; + char **pathptr; char *filename; void *handle; void (*init)(int); MODULE *m; - for (path = module_path; *path; path++) { - snprintf(buf, sizeof buf, "%s%d.%d/modules.lst", *path, - ALLEGRO_VERSION, ALLEGRO_SUB_VERSION); - f = pack_fopen(uconvert_ascii(buf, buf2), F_READ); - if (f) goto found; + /* Read the ALLEGRO_MODULES environment variable. + * But don't do it if we are root (for obvious reasons). + */ + if (geteuid() != 0) { + char *env = getenv("ALLEGRO_MODULES"); + if (env) { + snprintf(fullpath, sizeof fullpath, "%s/%s", env, "modules.lst"); + fullpath[(sizeof fullpath) - 1] = 0; + f = pack_fopen(uconvert_ascii(fullpath, buf), F_READ); + if (f) goto found; + } } - return; + for (pathptr = module_path; *pathptr; pathptr++) { + snprintf(fullpath, sizeof fullpath, "%s/%d.%d/modules.lst", + *pathptr, ALLEGRO_VERSION, ALLEGRO_SUB_VERSION); + fullpath[(sizeof fullpath) - 1] = 0; + f = pack_fopen(uconvert_ascii(fullpath, buf), F_READ); + if (f) goto found; + } + return; + found: + fullpath_slash = strrchr(fullpath, '/'); + while (!pack_feof(f)) { if (!pack_fgets(buf, sizeof buf, f)) break; @@ -95,16 +113,19 @@ void _unix_load_modules(int system_driver) if ((filename[0] == '#') || (strlen(filename) == 0)) continue; - if (filename[0] != '/') { - snprintf(buf3, sizeof buf3, "%s%d.%d/%s", *path, - ALLEGRO_VERSION, ALLEGRO_SUB_VERSION, filename); - filename = buf3; + if (!fullpath_slash) { + snprintf(fullpath, sizeof fullpath, filename); + fullpath[(sizeof fullpath) - 1] = 0; } - - if (!exists(uconvert_ascii(filename, buf))) + else { + snprintf(fullpath_slash+1, (sizeof fullpath) - (fullpath_slash - fullpath) - 1, filename); + fullpath[(sizeof fullpath) - 1] = 0; + } + + if (!exists(uconvert_ascii(fullpath, buf))) continue; - handle = dlopen(filename, RTLD_NOW); + handle = dlopen(fullpath, RTLD_NOW); if (!handle) { /* useful during development */ /* printf("Error loading module: %s\n", dlerror()); */ @@ -134,14 +155,27 @@ void _unix_load_modules(int system_driver) void _unix_unload_modules(void) { MODULE *m, *next; - void (*shutdown)(); + void (*shutdown)(void); + int *dont_unload; for (m = module_list; m; m = next) { next = m->next; + shutdown = dlsym(m->handle, "_module_shutdown"); if (shutdown) shutdown(); - dlclose(m->handle); + + /* Dirty hack: If the loaded module registers its own cleanup + * function with atexit, we mustn't unload the module, otherwise + * the atexit machinery will end up referring to a function that + * won't exist by the end of the program. This problem only + * affects SVGAlib currently. + */ + dont_unload = dlsym(m->handle, "_module_dont_unload_me_dirty_hack"); + + if ((!dont_unload) || !(*dont_unload)) + dlclose(m->handle); + free(m); } diff --git a/src/unix/uossmidi.c b/src/unix/uossmidi.c index 57b917c04f..ab520634a5 100644 --- a/src/unix/uossmidi.c +++ b/src/unix/uossmidi.c @@ -107,7 +107,7 @@ void seqbuf_dump() /* attempt to open sequencer device */ -static int seq_attempt_open() +static int seq_attempt_open(void) { char tmp1[128], tmp2[128], tmp3[128]; int fd; @@ -225,7 +225,7 @@ static int oss_midi_detect(int input) static int oss_midi_init(int input, int voices) { char tmp1[128], tmp2[128], tmp3[128]; - int i; + unsigned int i; if (input) { ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Input is not supported")); diff --git a/src/unix/usnddrv.c b/src/unix/usnddrv.c index b78fb584ab..b41e21caf3 100644 --- a/src/unix/usnddrv.c +++ b/src/unix/usnddrv.c @@ -21,6 +21,9 @@ BEGIN_DIGI_DRIVER_LIST +#if (defined DIGI_ARTS) && (!defined ALLEGRO_WITH_MODULES) + DIGI_DRIVER_ARTS +#endif #if (defined DIGI_ESD) && (!defined ALLEGRO_WITH_MODULES) DIGI_DRIVER_ESD #endif diff --git a/src/unix/usystem.c b/src/unix/usystem.c index 02a0160d72..346416df41 100644 --- a/src/unix/usystem.c +++ b/src/unix/usystem.c @@ -169,9 +169,19 @@ void _read_os_type() if (!strcmp(utsn.sysname, "Linux")) { os_type = OSTYPE_LINUX; } + else if (!strcmp(utsn.sysname, "SunOS")) { + os_type = OSTYPE_SUNOS; + } else if (!strcmp(utsn.sysname, "FreeBSD")) { os_type = OSTYPE_FREEBSD; } + else if (!strcmp(utsn.sysname, "NetBSD")) { + os_type = OSTYPE_NETBSD; + } + else if ((!strcmp(utsn.sysname, "IRIX")) + || (!strcmp(utsn.sysname, "IRIX64"))) { + os_type = OSTYPE_IRIX; + } else if (!strcmp(utsn.sysname, "QNX")) { os_type = OSTYPE_QNX; } diff --git a/src/unix/uthreads.c b/src/unix/uthreads.c index 765303e7d9..8a6a81895c 100644 --- a/src/unix/uthreads.c +++ b/src/unix/uthreads.c @@ -30,6 +30,7 @@ static void bg_man_pthreads_enable_interrupts (void); static void bg_man_pthreads_disable_interrupts (void); #define MAX_FUNCS 16 + static bg_func funcs[MAX_FUNCS]; static int max_func; /* highest+1 used entry */ @@ -38,11 +39,11 @@ static pthread_mutex_t cli_mutex; static pthread_cond_t cli_cond; static int cli_count; -static void block_all_signals(void) +static void block_all_signals (void) { sigset_t mask; - sigfillset(&mask); - pthread_sigmask(SIG_BLOCK, &mask, NULL); + sigfillset (&mask); + pthread_sigmask (SIG_BLOCK, &mask, NULL); } static void *bg_man_pthreads_threadfunc (void *arg) @@ -68,10 +69,15 @@ static void *bg_man_pthreads_threadfunc (void *arg) i = i * (TIMERS_PER_SECOND/100) / 10000L; pthread_mutex_lock (&cli_mutex); + + /* wait until interrupts are enabled */ while (cli_count > 0) pthread_cond_wait (&cli_cond, &cli_mutex); + + /* call all the callbacks */ for (n = 0; n < max_func; n++) if (funcs[n]) funcs[n](1); + pthread_mutex_unlock (&cli_mutex); } @@ -129,23 +135,51 @@ static int bg_man_pthreads_register_func (bg_func f) return ret; } -static int bg_man_pthreads_unregister_func (bg_func f) +static int really_unregister_func (bg_func f) { - int i, ret = 0; - bg_man_pthreads_disable_interrupts (); + int i; - for (i = 0; funcs[i] != f && i < max_func; i++); + for (i = 0; i < max_func && funcs[i] != f; i++); if (i == max_func) - ret = -1; + return -1; else { - funcs[i] = NULL; + funcs[i] = NULL; if (i+1 == max_func) do { max_func--; } while ((max_func > 0) && !funcs[max_func-1]); + return 0; + } +} + +static int bg_man_pthreads_unregister_func (bg_func f) +{ + /* Normally we just bg_man_pthread_disable_interrupts(), remove `f', + * then bg_man_pthread_enable_interrupts(). + * + * However, the X system driver's input handler is a bg_man callback. + * When it receives a close event, it calls exit(), which calls + * allegro_exit(). Eventually various subsystems will try to + * unregister their callbacks, i.e. call this function. But we're in + * the middle of input handler call, and `cli_mutex' is still locked. + * + * So we... special case! If the calling thread is the bg_man thread + * we simply bypass the locking, as there's no synchronisation + * problem to avoid anyway. + */ + + int ret; + + if (pthread_equal (pthread_self (), thread)) + /* Being called from a bg_man registered callback. */ + ret = really_unregister_func (f); + else { + /* Normal case. */ + bg_man_pthreads_disable_interrupts (); + ret = really_unregister_func (f); + bg_man_pthreads_enable_interrupts (); } - bg_man_pthreads_enable_interrupts (); return ret; } diff --git a/src/win/dllver.rc b/src/win/dllver.rc index 5942e69310..bc27265eec 100644 --- a/src/win/dllver.rc +++ b/src/win/dllver.rc @@ -5,8 +5,8 @@ 1 VERSIONINFO -FILEVERSION 4, 0, 1, 0 -PRODUCTVERSION 4, 0, 1, 0 +FILEVERSION 4, 0, 3, 0 +PRODUCTVERSION 4, 0, 3, 0 FILEOS VOS__WINDOWS32 FILETYPE VFT_DLL { @@ -17,12 +17,12 @@ FILETYPE VFT_DLL VALUE "Comments", "Please see AUTHORS for a list of contributors\000" VALUE "CompanyName", "Allegro Developers\000\000" VALUE "FileDescription", "Allegro\000" - VALUE "FileVersion", "4.0.1 (CVS)\000" + VALUE "FileVersion", "4.0.3 (CVS)\000" VALUE "InternalName", "ALLEG40\000" - VALUE "LegalCopyright", "Copyright © 1994-2001 Allegro Developers\000\000" + VALUE "LegalCopyright", "Copyright © 1994-2002 Allegro Developers\000\000" VALUE "OriginalFilename", "ALLEG40.DLL\000" VALUE "ProductName", "Allegro\000" - VALUE "ProductVersion", "4.0.1 (CVS)\000" + VALUE "ProductVersion", "4.0.3 (CVS)\000" } } diff --git a/src/win/wddbmp.c b/src/win/wddbmp.c index d2fc39853e..739322a084 100644 --- a/src/win/wddbmp.c +++ b/src/win/wddbmp.c @@ -77,12 +77,16 @@ LPDIRECTDRAWSURFACE2 gfx_directx_create_surface(int w, int h, LPDDPIXELFORMAT pi switch (type) { - case SURF_PRIMARY : + case SURF_PRIMARY_COMPLEX: surf_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; surf_desc.dwFlags |= DDSD_BACKBUFFERCOUNT; surf_desc.dwBackBufferCount = 2; break; + case SURF_PRIMARY_SINGLE: + surf_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + break; + case SURF_OVERLAY: surf_desc.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY | DDSCAPS_FLIP | DDSCAPS_COMPLEX; surf_desc.dwFlags |= DDSD_BACKBUFFERCOUNT | DDSD_HEIGHT | DDSD_WIDTH; @@ -124,13 +128,13 @@ LPDIRECTDRAWSURFACE2 gfx_directx_create_surface(int w, int h, LPDDPIXELFORMAT pi hr = IDirectDraw2_CreateSurface(directdraw, &surf_desc, &_surf1, NULL); if (FAILED(hr)) { - if ((type == SURF_PRIMARY) || (type == SURF_OVERLAY)) { + if ((type == SURF_PRIMARY_COMPLEX) || (type == SURF_OVERLAY)) { /* lower the number of backbuffers */ surf_desc.dwBackBufferCount = 1; hr = IDirectDraw2_CreateSurface(directdraw, &surf_desc, &_surf1, NULL); if (FAILED(hr)) { - /* no backbuffer any more (e.g. in windowed mode) */ + /* no backbuffer any more */ surf_desc.dwBackBufferCount = 0; surf_desc.dwFlags &= ~DDSD_BACKBUFFERCOUNT; surf_desc.ddsCaps.dwCaps &= ~(DDSCAPS_FLIP | DDSCAPS_COMPLEX); diff --git a/src/win/wddfull.c b/src/win/wddfull.c index 9c18dd16ec..a9fefb53e8 100644 --- a/src/win/wddfull.c +++ b/src/win/wddfull.c @@ -172,7 +172,7 @@ static struct BITMAP *init_directx_accel(int w, int h, int v_w, int v_h, int col _enter_critical(); - bmp = gfx_directx_init(&gfx_directx_accel, w, h, v_w, v_h, color_depth); + bmp = gfx_directx_init(&gfx_directx_accel, TRUE, w, h, v_w, v_h, color_depth); if (bmp) { enable_acceleration(&gfx_directx_accel); @@ -195,7 +195,7 @@ static struct BITMAP *init_directx_soft(int w, int h, int v_w, int v_h, int colo _enter_critical(); - bmp = gfx_directx_init(&gfx_directx_soft, w, h, v_w, v_h, color_depth); + bmp = gfx_directx_init(&gfx_directx_soft, TRUE, w, h, v_w, v_h, color_depth); if (bmp) { enable_triple_buffering(&gfx_directx_soft); @@ -217,7 +217,7 @@ static struct BITMAP *init_directx_safe(int w, int h, int v_w, int v_h, int colo _enter_critical(); - bmp = gfx_directx_init(&gfx_directx_safe, w, h, v_w, v_h, color_depth); + bmp = gfx_directx_init(&gfx_directx_safe, FALSE, w, h, v_w, v_h, color_depth); if (bmp) finalize_fullscreen_init(); diff --git a/src/win/wddmode.c b/src/win/wddmode.c index eb106cd9ed..5179462005 100644 --- a/src/win/wddmode.c +++ b/src/win/wddmode.c @@ -311,7 +311,7 @@ static HRESULT CALLBACK EnumModesCallback(LPDDSURFACEDESC lpDDSurfaceDesc, LPVOI /* gfx_directx_fetch_mode_list: * Creates a list of available video modes. - * Returns number of video modes on success and -1 on failure. + * Returns the list on success, NULL on failure. */ GFX_MODE_LIST *gfx_directx_fetch_mode_list(void) { diff --git a/src/win/wddovl.c b/src/win/wddovl.c index 8a7a7b85b3..9a6f835c49 100644 --- a/src/win/wddovl.c +++ b/src/win/wddovl.c @@ -85,8 +85,8 @@ static WIN_GFX_DRIVER win_gfx_driver_overlay = static char gfx_driver_desc[256] = EMPTY_STRING; static LPDIRECTDRAWSURFACE2 overlay_surface = NULL; +static BITMAP *viewport = NULL, *background = NULL; static BOOL overlay_visible = FALSE; -static HBRUSH original_brush, overlay_brush; @@ -117,6 +117,11 @@ static int update_overlay(int x, int y, int w, int h) HRESULT hr; RECT dest_rect = {x, y, x + w, y + h}; + /* paint the window background with the overlay color key */ + background->x_ofs = x + viewport->x_ofs; + background->y_ofs = y + viewport->y_ofs; + clear_to_color(background, background->vtable->mask_color); + /* show the overlay surface */ hr = IDirectDrawSurface2_UpdateOverlay(overlay_surface, NULL, dd_prim_surface, &dest_rect, @@ -287,7 +292,6 @@ static int create_overlay(int w, int h, int color_depth) */ static struct BITMAP *init_directx_ovl(int w, int h, int v_w, int v_h, int color_depth) { - RECT win_size; HRESULT hr; DDCOLORKEY key; @@ -315,37 +319,14 @@ static struct BITMAP *init_directx_ovl(int w, int h, int v_w, int v_h, int color if (finalize_directx_init() != 0) goto Error; - /* adjust window */ - win_size.left = wnd_x = 32; - win_size.right = wnd_x + w; - win_size.top = wnd_y = 32; - win_size.bottom = wnd_y + h; - wnd_width = w; - wnd_height = h; - - /* paint window background with overlay color key */ - original_brush = (HBRUSH) GetClassLong(allegro_wnd, GCL_HBRBACKGROUND); - overlay_brush = CreateSolidBrush(MASK_COLOR_32); - SetClassLong(allegro_wnd, GCL_HBRBACKGROUND, (LONG) overlay_brush); - - /* retrieve the size of the decorated window */ - AdjustWindowRect(&win_size, GetWindowLong(allegro_wnd, GWL_STYLE), FALSE); - - /* display the window */ - MoveWindow(allegro_wnd, win_size.left, win_size.top, - win_size.right - win_size.left, win_size.bottom - win_size.top, TRUE); - - /* check that the actual window size is the one requested */ - GetClientRect(allegro_wnd, &win_size); - if ( ((win_size.right - win_size.left) != w) || - ((win_size.bottom - win_size.top) != h) ) { + if (adjust_window(w, h) != 0) { _TRACE("window size not supported.\n"); ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Resolution not supported")); goto Error; } /* create surfaces */ - if (create_primary() != 0) + if (create_primary(FALSE) != 0) goto Error; if (create_overlay(w, h, color_depth) != 0) @@ -394,6 +375,8 @@ static struct BITMAP *init_directx_ovl(int w, int h, int v_w, int v_h, int color goto Error; dd_frontbuffer = make_directx_bitmap(overlay_surface, w, h, BMP_ID_VIDEO); + viewport = make_directx_bitmap(dd_prim_surface, w, h, BMP_ID_VIDEO); + background = create_sub_bitmap(viewport, 0, 0, w, h); /* display the overlay surface */ key.dwColorSpaceLowValue = dd_frontbuffer->vtable->mask_color; @@ -444,19 +427,26 @@ static void gfx_directx_ovl_exit(struct BITMAP *bmp) { _enter_gfx_critical(); - if (bmp) + if (bmp) { + save_window_pos(); clear_bitmap(bmp); + } /* disconnect from the system driver */ win_gfx_driver = NULL; - /* destroy overlay surface */ + /* destroy the overlay surface */ if (overlay_surface) { hide_overlay(); - SetClassLong(allegro_wnd, GCL_HBRBACKGROUND, (LONG) original_brush); - DeleteObject(overlay_brush); gfx_directx_destroy_surf(overlay_surface); overlay_surface = NULL; + destroy_bitmap(background); + } + + /* destroy the viewport */ + if (viewport) { + free(viewport); + viewport = NULL; } /* unregister bitmap */ diff --git a/src/win/wddraw.c b/src/win/wddraw.c index 0d0119723b..c51343d55e 100644 --- a/src/win/wddraw.c +++ b/src/win/wddraw.c @@ -73,10 +73,10 @@ int init_directx(void) /* create_primary: * Low-level DirectDraw screen creation routine. */ -int create_primary(void) +int create_primary(int flip) { /* create primary surface */ - dd_prim_surface = gfx_directx_create_surface(0, 0, NULL, SURF_PRIMARY); + dd_prim_surface = gfx_directx_create_surface(0, 0, NULL, flip ? SURF_PRIMARY_COMPLEX : SURF_PRIMARY_SINGLE); if (!dd_prim_surface) { _TRACE("Can't create primary surface.\n"); return -1; @@ -212,7 +212,7 @@ int exit_directx(void) /* gfx_directx_init: */ -struct BITMAP *gfx_directx_init(GFX_DRIVER *drv, int w, int h, int v_w, int v_h, int color_depth) +struct BITMAP *gfx_directx_init(GFX_DRIVER *drv, int flip, int w, int h, int v_w, int v_h, int color_depth) { if ((v_w != w && v_w != 0) || (v_h != h && v_h != 0)) { ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Unsupported virtual resolution")); @@ -233,7 +233,7 @@ struct BITMAP *gfx_directx_init(GFX_DRIVER *drv, int w, int h, int v_w, int v_h, goto Error; /* create screen */ - if (create_primary() != 0) + if (create_primary(flip) != 0) goto Error; /* set color format */ diff --git a/src/win/wddraw.h b/src/win/wddraw.h index 74e3ef7816..da28520eef 100644 --- a/src/win/wddraw.h +++ b/src/win/wddraw.h @@ -46,7 +46,7 @@ AL_VAR(char *, pseudo_surf_mem); /* driver routines */ -AL_FUNC(BITMAP *, gfx_directx_init, (GFX_DRIVER *drv, int w, int h, int v_w, int v_h, int color_depth)); +AL_FUNC(BITMAP *, gfx_directx_init, (GFX_DRIVER *drv, int flip, int w, int h, int v_w, int v_h, int color_depth)); AL_FUNC(void, gfx_directx_exit, (BITMAP *bmp)); AL_FUNC(void, gfx_directx_sync, (void)); AL_FUNC(void, gfx_directx_set_palette, (AL_CONST RGB *p, int from, int to, int vsync)); @@ -64,7 +64,7 @@ AL_FUNC(GFX_MODE_LIST *, gfx_directx_fetch_mode_list, (void)); /* driver initialisation and shutdown (from wddraw.c) */ AL_FUNC(int, init_directx, (void)); -AL_FUNC(int, create_primary, (void)); +AL_FUNC(int, create_primary, (int flip)); AL_FUNC(int, create_clipper, (HWND hwnd)); AL_FUNC(int, create_palette, (LPDIRECTDRAWSURFACE2 surf)); AL_FUNC(int, setup_driver, (GFX_DRIVER * drv, int w, int h, int color_depth)); @@ -115,10 +115,11 @@ AL_FUNCPTR(void, ptr_gfx_directx_unlock, (BITMAP* bmp)); /* bitmap creation (from wddbmp.c) */ -#define SURF_PRIMARY 1 -#define SURF_OVERLAY 2 -#define SURF_SYSTEM 3 -#define SURF_VIDEO 4 +#define SURF_PRIMARY_COMPLEX 1 +#define SURF_PRIMARY_SINGLE 2 +#define SURF_OVERLAY 3 +#define SURF_SYSTEM 4 +#define SURF_VIDEO 5 AL_FUNC(LPDIRECTDRAWSURFACE2, gfx_directx_create_surface, (int w, int h, LPDDPIXELFORMAT pixel_format, int type)); AL_FUNC(BITMAP *, make_directx_bitmap, (LPDIRECTDRAWSURFACE2 surf, int w, int h, int id)); diff --git a/src/win/wddwin.c b/src/win/wddwin.c index 211bc8b678..48fdeb5b74 100644 --- a/src/win/wddwin.c +++ b/src/win/wddwin.c @@ -94,14 +94,10 @@ static WIN_GFX_DRIVER win_gfx_driver_windowed = static char gfx_driver_desc[256] = EMPTY_STRING; static LPDIRECTDRAWSURFACE2 offscreen_surface = NULL; -/* If the allegro color depth is not the same as the desktop color depth, - * we need a pre-converted offscreen surface that will be blitted to the window - * when in background, in order to ensure a proper clipping. - */ -static LPDIRECTDRAWSURFACE2 preconv_offscreen_surface = NULL; static RECT working_area; static COLORCONV_BLITTER_FUNC *colorconv_blit = NULL; -static int direct_updating_mode; +static int direct_updating_mode_enabled; /* configuration flag */ +static int direct_updating_mode_on; /* live flag */ static GFX_VTABLE _special_vtable; /* special vtable for offscreen bitmap */ @@ -132,9 +128,6 @@ static void switch_in_win(void) IDirectDrawSurface2_Restore(dd_prim_surface); - if (preconv_offscreen_surface) - IDirectDrawSurface2_Restore(preconv_offscreen_surface); - gfx_directx_restore(); _exit_gfx_critical(); @@ -147,9 +140,11 @@ static void switch_in_win(void) */ static void handle_window_enter_sysmode_win(void) { - if (colorconv_blit && direct_updating_mode) { - direct_updating_mode = FALSE; - _TRACE("direct updating mode off\n"); + if (direct_updating_mode_enabled && colorconv_blit) { + if (direct_updating_mode_on) { + direct_updating_mode_on = FALSE; + _TRACE("direct updating mode off\n"); + } } } @@ -160,9 +155,11 @@ static void handle_window_enter_sysmode_win(void) */ static void handle_window_exit_sysmode_win(void) { - if (colorconv_blit && !direct_updating_mode) { - direct_updating_mode = TRUE; - _TRACE("direct updating mode on\n"); + if (direct_updating_mode_enabled && colorconv_blit) { + if (!direct_updating_mode_on) { + direct_updating_mode_on = TRUE; + _TRACE("direct updating mode on\n"); + } } } @@ -202,6 +199,10 @@ static void paint_win(RECT *rect) if (IDirectDrawSurface2_IsLost(dd_prim_surface)) switch_in_win(); + /* clip the rectangle */ + rect->right = MIN(rect->right, gfx_directx_win.w); + rect->bottom = MIN(rect->bottom, gfx_directx_win.h); + update_window(rect); } @@ -242,15 +243,15 @@ static void update_matching_window(RECT* rect) -/* is_not_contained: +/* is_contained: * Helper to find the relative position of two rectangles. */ -static INLINE int is_not_contained(RECT *rect1, RECT *rect2) +static INLINE int is_contained(RECT *rect1, RECT *rect2) { - if ( (rect1->left < rect2->left) || - (rect1->top < rect2->top) || - (rect1->right > rect2->right) || - (rect1->bottom > rect2->bottom) ) + if ((rect1->left >= rect2->left) && + (rect1->top >= rect2->top) && + (rect1->right <= rect2->right) && + (rect1->bottom <= rect2->bottom)) return TRUE; else return FALSE; @@ -310,6 +311,9 @@ static int ddsurf_blit_ex(LPDIRECTDRAWSURFACE2 dest_surf, RECT *dest_rect, static void update_colorconv_window(RECT* rect) { RECT src_rect, dest_rect; + HDC src_dc, dest_dc; + HRESULT hr; + int direct; _enter_gfx_critical(); @@ -336,30 +340,46 @@ static void update_colorconv_window(RECT* rect) src_rect.bottom = gfx_directx_win.h; } - dest_rect = src_rect; + dest_rect = src_rect; ClientToScreen(allegro_wnd, (LPPOINT)&dest_rect); ClientToScreen(allegro_wnd, (LPPOINT)&dest_rect + 1); - if (!direct_updating_mode || is_not_contained(&dest_rect, &working_area) || - (GetForegroundWindow() != allegro_wnd)) { - /* first blit to the pre-converted offscreen buffer */ - if (ddsurf_blit_ex(preconv_offscreen_surface, &src_rect, - BMP_EXTRA(pseudo_screen)->surf, &src_rect) != 0) { - _exit_gfx_critical(); - return; - } - - /* blit preconverted offscreen buffer to the window (clipping done by DirectDraw) */ - IDirectDrawSurface2_Blt(dd_prim_surface, &dest_rect, - preconv_offscreen_surface, &src_rect, - 0, NULL); + direct = (direct_updating_mode_on && + is_contained(&dest_rect, &working_area) && + GetForegroundWindow() == allegro_wnd); + + if (direct) { + /* blit directly to the primary surface without clipping */ + ddsurf_blit_ex(dd_prim_surface, &dest_rect, + offscreen_surface, &src_rect); } else { - /* blit directly to the primary surface WITHOUT clipping */ - ddsurf_blit_ex(dd_prim_surface, &dest_rect, - BMP_EXTRA(pseudo_screen)->surf, &src_rect); + /* blit to the window using GDI */ + hr = IDirectDrawSurface2_GetDC(offscreen_surface, &src_dc); + if (FAILED(hr)) + goto End; + + dest_dc = GetDC(allegro_wnd); + if (!dest_dc) { + IDirectDrawSurface2_ReleaseDC(offscreen_surface, src_dc); + goto End; + } + + BitBlt(dest_dc, + src_rect.left, + src_rect.top, + src_rect.right - src_rect.left, + src_rect.bottom - src_rect.top, + src_dc, + src_rect.left, + src_rect.top, + SRCCOPY); + + ReleaseDC(allegro_wnd, dest_dc); + IDirectDrawSurface2_ReleaseDC(offscreen_surface, src_dc); } + End: _exit_gfx_critical(); } @@ -378,6 +398,7 @@ static int gfx_directx_show_video_bitmap_win(struct BITMAP *bitmap) pseudo_screen->vtable->release = gfx_directx_unlock_win; pseudo_screen->vtable->unwrite_bank = gfx_directx_unwrite_bank_win; pseudo_screen->write_bank = gfx_directx_write_bank_win; + gfx_directx_sync(); update_window(NULL); return 0; } @@ -410,7 +431,12 @@ static void gfx_directx_set_palette_win_8(AL_CONST struct RGB *p, int from, int */ static void gfx_directx_set_palette_win(AL_CONST struct RGB *p, int from, int to, int vsync) { + /* for the normal updating mode */ + gfx_directx_set_palette(p, from, to, FALSE); + + /* for the direct updating mode */ _set_colorconv_palette(p, from, to); + update_window(NULL); } @@ -439,6 +465,10 @@ static int wnd_set_windowed_coop(void) */ static int verify_color_depth (int color_depth) { + AL_CONST char *ddu; + char tmp1[64], tmp2[128]; + int i; + if ((gfx_directx_compare_color_depth(color_depth) == 0) && (color_depth != 8)) { /* the color depths match */ update_window = update_matching_window; @@ -455,7 +485,18 @@ static int verify_color_depth (int color_depth) return -1; update_window = update_colorconv_window; - direct_updating_mode = TRUE; + + /* read direct updating configuration variable */ + ddu = get_config_string(uconvert_ascii("graphics", tmp1), + uconvert_ascii("disable_direct_updating", tmp2), + NULL); + + if ((ddu) && ((i = ugetc(ddu)) != 0) && ((i == 'y') || (i == 'Y') || (i == '1'))) + direct_updating_mode_enabled = FALSE; + else + direct_updating_mode_enabled = TRUE; + + direct_updating_mode_on = direct_updating_mode_enabled; } return 0; @@ -469,21 +510,7 @@ static int verify_color_depth (int color_depth) static int create_offscreen(int w, int h, int color_depth) { if (colorconv_blit) { - /* create pre-converted offscreen surface in video memory */ - preconv_offscreen_surface = gfx_directx_create_surface(w, h, NULL, SURF_VIDEO); - - if (!preconv_offscreen_surface) { - _TRACE("Can't create preconverted offscreen surface in video memory.\n"); - - /* create pre-converted offscreen surface in plain memory */ - preconv_offscreen_surface = gfx_directx_create_surface(w, h, NULL, SURF_SYSTEM); - - if (!preconv_offscreen_surface) { - _TRACE("Can't create preconverted offscreen surface.\n"); - return -1; - } - } - + /* create offscreen surface in system memory */ offscreen_surface = gfx_directx_create_surface(w, h, dd_pixelformat, SURF_SYSTEM); } else { @@ -493,7 +520,7 @@ static int create_offscreen(int w, int h, int color_depth) if (!offscreen_surface) { _TRACE("Can't create offscreen surface in video memory.\n"); - /* create offscreen surface in plain memory */ + /* create offscreen surface in system memory */ offscreen_surface = gfx_directx_create_surface(w, h, NULL, SURF_SYSTEM); } } @@ -529,7 +556,6 @@ static void setup_driver_desc(void) */ static struct BITMAP *init_directx_win(int w, int h, int v_w, int v_h, int color_depth) { - RECT win_size; unsigned char *cmap; HRESULT hr; int i; @@ -559,25 +585,7 @@ static struct BITMAP *init_directx_win(int w, int h, int v_w, int v_h, int color if (finalize_directx_init() != 0) goto Error; - /* adjust window */ - win_size.left = wnd_x = 32; - win_size.right = 32 + w; - win_size.top = wnd_y = 32; - win_size.bottom = 32 + h; - wnd_width = w; - wnd_height = h; - - /* retrieve the size of the decorated window */ - AdjustWindowRect(&win_size, GetWindowLong(allegro_wnd, GWL_STYLE), FALSE); - - /* display the window */ - MoveWindow(allegro_wnd, win_size.left, win_size.top, - win_size.right - win_size.left, win_size.bottom - win_size.top, TRUE); - - /* check that the actual window size is the one requested */ - GetClientRect(allegro_wnd, &win_size); - if ( ((win_size.right - win_size.left) != w) || - ((win_size.bottom - win_size.top) != h) ) { + if (adjust_window(w, h) != 0) { _TRACE("window size not supported.\n"); ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Resolution not supported")); goto Error; @@ -587,7 +595,7 @@ static struct BITMAP *init_directx_win(int w, int h, int v_w, int v_h, int color get_working_area(&working_area); /* create primary surface */ - if (create_primary() != 0) + if (create_primary(FALSE) != 0) goto Error; /* create clipper */ @@ -627,6 +635,9 @@ static struct BITMAP *init_directx_win(int w, int h, int v_w, int v_h, int color if (color_depth == 8) { gfx_directx_win.set_palette = gfx_directx_set_palette_win; + if (create_palette(offscreen_surface) != 0) + goto Error; + /* init the core library color conversion functions */ if (gfx_directx_update_color_format(dd_prim_surface, desktop_depth) != 0) goto Error; @@ -688,8 +699,10 @@ static void gfx_directx_win_exit(struct BITMAP *bmp) { _enter_gfx_critical(); - if (bmp) + if (bmp) { + save_window_pos(); clear_bitmap(bmp); + } /* disconnect from the system driver */ win_gfx_driver = NULL; @@ -703,10 +716,6 @@ static void gfx_directx_win_exit(struct BITMAP *bmp) offscreen_surface = NULL; pseudo_screen = NULL; - /* destroy the pre-converted offscreen buffer */ - gfx_directx_destroy_surf(preconv_offscreen_surface); - preconv_offscreen_surface = NULL; - /* release the color conversion blitter */ if (colorconv_blit) { _release_colorconv_blitter(colorconv_blit); diff --git a/src/win/wdispsw.c b/src/win/wdispsw.c index b2228a3d9f..bab4e26422 100644 --- a/src/win/wdispsw.c +++ b/src/win/wdispsw.c @@ -210,21 +210,19 @@ void sys_switch_out(void) /* thread_switch_out: - * Called by threads that wants to be handled by system driver on switch out + * Handles a switch out event for the calling thread. + * Returns TRUE if the thread was blocked, FALSE otherwise. */ -void thread_switch_out() -{ - /* handle switch modes */ - switch(get_display_switch_mode()) - { - case SWITCH_AMNESIA: - case SWITCH_PAUSE: - WaitForSingleObject(_foreground_event, INFINITE); - break; +int thread_switch_out(void) +{ + int mode = get_display_switch_mode(); - default: - break; - } + if ((mode == SWITCH_AMNESIA) || (mode == SWITCH_PAUSE)) { + WaitForSingleObject(_foreground_event, INFINITE); + return TRUE; + } + + return FALSE; } diff --git a/src/win/wdsinput.c b/src/win/wdsinput.c index 87bf7ab36a..4811c402ed 100644 --- a/src/win/wdsinput.c +++ b/src/win/wdsinput.c @@ -61,7 +61,7 @@ static unsigned char *input_wave_data = NULL; #ifdef DEBUGMODE static char *ds_err(long err) { - static char err_str[32]; + static char err_str[64]; switch (err) { diff --git a/src/win/wdsndmix.c b/src/win/wdsndmix.c index 3c4538669f..4bd06cbd71 100644 --- a/src/win/wdsndmix.c +++ b/src/win/wdsndmix.c @@ -263,7 +263,7 @@ static void digi_dsoundmix_mixer_callback(void) #ifdef DEBUGMODE static char *ds_err(long err) { - static char err_str[32]; + static char err_str[64]; switch (err) { diff --git a/src/win/wdsound.c b/src/win/wdsound.c index 4f73fa4d7b..e85f7fe50a 100644 --- a/src/win/wdsound.c +++ b/src/win/wdsound.c @@ -191,14 +191,8 @@ static LPGUID driver_guids[MAX_DRIVERS]; */ static BOOL CALLBACK DSEnumCallback(LPGUID lpGuid, LPCSTR lpcstrDescription, LPCSTR lpcstrModule, LPVOID lpContext) { - if (num_drivers < MAX_DRIVERS) { - if (lpGuid) { - driver_guids[num_drivers] = malloc(sizeof(GUID)); - memcpy(driver_guids[num_drivers], lpGuid, sizeof(GUID)); - } - else - driver_guids[num_drivers] = NULL; - + if (lpGuid) { + driver_guids[num_drivers] = lpGuid; driver_names[num_drivers] = malloc(strlen(lpcstrDescription)+1); strcpy(driver_names[num_drivers], lpcstrDescription); num_drivers++; @@ -217,29 +211,32 @@ static BOOL CALLBACK DSEnumCallback(LPGUID lpGuid, LPCSTR lpcstrDescription, LPC _DRIVER_INFO *_get_win_digi_driver_list(void) { DIGI_DRIVER *driver; + HRESULT hr; int i; if (!driver_list) { - /* enumerate the DirectSound drivers */ - DirectSoundEnumerate(DSEnumCallback, NULL); - driver_list = _create_driver_list(); - /* pure DirectSound drivers */ - for (i=0; iid = DIGI_DIRECTX(i); - driver->ascii_name = driver_names[i]; + /* enumerate the DirectSound drivers */ + hr = DirectSoundEnumerate(DSEnumCallback, NULL); - _driver_list_append_driver(&driver_list, driver->id, driver, TRUE); - } + if (hr == DS_OK) { + /* pure DirectSound drivers */ + for (i=0; iid = DIGI_DIRECTX(i); + driver->ascii_name = driver_names[i]; + + _driver_list_append_driver(&driver_list, driver->id, driver, TRUE); + } - /* Allegro mixer to DirectSound drivers */ - for (i=0; iid, driver, TRUE); + _driver_list_append_driver(&driver_list, driver->id, driver, TRUE); + } } /* Allegro mixer to WaveOut drivers */ @@ -281,7 +278,7 @@ void _free_win_digi_driver_list(void) #ifdef DEBUGMODE static char *ds_err(long err) { - static char err_str[32]; + static char err_str[64]; switch (err) { @@ -556,7 +553,7 @@ static int digi_directsound_mixer_volume(int volume) /* create_dsound_buffer: * Worker function for creating a DirectSound buffer. */ -static LPDIRECTSOUNDBUFFER create_dsound_buffer(int len, int freq, int bits, int stereo) +static LPDIRECTSOUNDBUFFER create_dsound_buffer(int len, int freq, int bits, int stereo, int vol, int pan) { LPDIRECTSOUNDBUFFER snd_buf; PCMWAVEFORMAT pcmwf; @@ -597,6 +594,12 @@ static LPDIRECTSOUNDBUFFER create_dsound_buffer(int len, int freq, int bits, int return NULL; } + /* set volume */ + IDirectSoundBuffer_SetVolume(snd_buf, alleg_to_dsound_volume[MID(0, vol, 255)]); + + /* set pan */ + IDirectSoundBuffer_SetPan(snd_buf, alleg_to_dsound_pan[MID(0, pan, 255)]); + return snd_buf; } @@ -713,7 +716,9 @@ static void digi_directsound_init_voice(int voice, AL_CONST SAMPLE *sample) ds_voices[voice].ds_buffer = create_dsound_buffer(ds_voices[voice].len, ds_voices[voice].freq, ds_voices[voice].bits, - ds_voices[voice].stereo); + ds_voices[voice].stereo, + ds_voices[voice].vol, + ds_voices[voice].pan); if (!ds_voices[voice].ds_buffer) return; @@ -805,7 +810,9 @@ static void update_voice_buffers(int voice, int reversed, int bidir, int loop) ds_voices[voice].ds_loop_buffer = create_dsound_buffer(ds_voices[voice].loop_len * (bidir ? 2 : 1), ds_voices[voice].freq, ds_voices[voice].bits, - ds_voices[voice].stereo); + ds_voices[voice].stereo, + ds_voices[voice].vol, + ds_voices[voice].pan); update_loop_buffer = TRUE; } else if (update_bidir) { @@ -814,7 +821,9 @@ static void update_voice_buffers(int voice, int reversed, int bidir, int loop) ds_voices[voice].ds_loop_buffer = create_dsound_buffer(ds_voices[voice].loop_len * (bidir ? 2 : 1), ds_voices[voice].freq, ds_voices[voice].bits, - ds_voices[voice].stereo); + ds_voices[voice].stereo, + ds_voices[voice].vol, + ds_voices[voice].pan); update_loop_buffer = TRUE; } } diff --git a/src/win/wfile.c b/src/win/wfile.c index 8ea05ff77f..8b9498fb70 100644 --- a/src/win/wfile.c +++ b/src/win/wfile.c @@ -105,10 +105,6 @@ static void fill_ffblk(struct al_ffblk *info) -/* Windows specific flag: NTFS compressed files */ -#define FA_COMPRESSED 0x800 - - /* al_findfirst: * Initiates a directory search. */ @@ -128,8 +124,19 @@ int al_findfirst(AL_CONST char *pattern, struct al_ffblk *info, int attrib) /* attach it to the info structure */ info->ff_data = (void *) ff_data; - /* initialize it */ - ff_data->attrib = attrib | FA_COMPRESSED; + /* Windows defines specific flags for NTFS permissions: + * FA_TEMPORARY 0x0100 + * FA_SPARSE_FILE 0x0200 + * FA_REPARSE_POINT 0x0400 + * FA_COMPRESSED 0x0800 + * FA_OFFLINE 0x1000 + * FA_NOT_CONTENT_INDEXED 0x2000 + * FA_ENCRYPTED 0x4000 + * so we must set them in the mask by default; moreover, + * in order to avoid problems with flags added in the + * future, we simply set all bits past the first byte. + */ + ff_data->attrib = attrib | 0xFFFFFF00; /* start the search */ errno = *allegro_errno = 0; diff --git a/src/win/wgdi.c b/src/win/wgdi.c index 5add54b619..98535ba149 100644 --- a/src/win/wgdi.c +++ b/src/win/wgdi.c @@ -41,7 +41,7 @@ char *gdi_dirty_lines = NULL; /* used in WRITE_BANK() */ static struct BITMAP *gfx_gdi_init(int w, int h, int v_w, int v_h, int color_depth); -static void gfx_gdi_exit(struct BITMAP *b); +static void gfx_gdi_exit(struct BITMAP *bmp); static void gfx_gdi_set_palette(AL_CONST struct RGB *p, int from, int to, int vsync); static void gfx_gdi_vsync(void); /* hardware mouse cursor emulation */ @@ -447,30 +447,20 @@ static void gfx_gdi_unlock(struct BITMAP *bmp) */ static struct BITMAP *gfx_gdi_init(int w, int h, int v_w, int v_h, int color_depth) { - RECT win_size; - /* virtual screen are not supported */ if ((v_w!=0 && v_w!=w) || (v_h!=0 && v_h!=h)) return NULL; _enter_critical(); - /* resize window */ gfx_gdi.w = w; gfx_gdi.h = h; - win_size.left = wnd_x = 32; - win_size.right = 32 + w; - win_size.top = wnd_y = 32; - win_size.bottom = 32 + h; - wnd_width = w; - wnd_height = h; - - /* retrieve the size of the decorated window */ - AdjustWindowRect(&win_size, GetWindowLong(allegro_wnd, GWL_STYLE), FALSE); - /* display the window */ - MoveWindow(allegro_wnd, win_size.left, win_size.top, - win_size.right - win_size.left, win_size.bottom - win_size.top, TRUE); + if (adjust_window(w, h) != 0) { + _TRACE("window size not supported.\n"); + ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Resolution not supported")); + goto Error; + } /* the last flag serves as an end of loop delimiter */ gdi_dirty_lines = calloc(h+1, sizeof(char)); @@ -500,20 +490,29 @@ static struct BITMAP *gfx_gdi_init(int w, int h, int v_w, int v_h, int color_dep _exit_critical(); return gdi_screen; + + Error: + _exit_critical(); + + gfx_gdi_exit(NULL); + + return NULL; } /* gfx_gdi_exit: */ -static void gfx_gdi_exit(struct BITMAP *b) +static void gfx_gdi_exit(struct BITMAP *bmp) { _enter_critical(); _enter_gfx_critical(); - if (b) - clear_bitmap(b); + if (bmp) { + save_window_pos(); + clear_bitmap(bmp); + } /* stop timer */ remove_int(render_proc); diff --git a/src/win/wkeybd.c b/src/win/wkeybd.c index f8e5c119e0..ba8ac45598 100644 --- a/src/win/wkeybd.c +++ b/src/win/wkeybd.c @@ -63,7 +63,7 @@ KEYBOARD_DRIVER keyboard_directx = #define DINPUT_BUFFERSIZE 256 -static HANDLE key_thread = NULL; +HANDLE key_thread = NULL; static HANDLE key_thread_stop_event = NULL; static HANDLE key_input_event = NULL; static HANDLE key_input_processed_event = NULL; @@ -118,34 +118,41 @@ static char* dinput_err_str(long err) */ static void key_dinput_handle_scancode(unsigned char scancode, int pressed) { - /* three-finger salute for killing the program */ - if ((((scancode & 0x7f) == 0x4F) || ((scancode & 0x7f) == 0x53)) && - (three_finger_flag) && (_key_shifts & KB_CTRL_FLAG) && (_key_shifts & KB_ALT_FLAG)) { - _TRACE("Terminating application\n"); - ExitProcess(0); - } + /* ignore special Windows keys (alt+tab, alt+space, (ctrl|alt)+esc) */ + if (((scancode == DIK_TAB) && (_key_shifts & KB_ALT_FLAG)) + || ((scancode == DIK_SPACE) && (_key_shifts & KB_ALT_FLAG)) + || ((scancode == DIK_ESCAPE) && (_key_shifts & (KB_CTRL_FLAG | KB_ALT_FLAG)))) + return; - /* ignore special Windows keys (alt+tab, alt+space, (ctrl|alt)+esc, alt+F4) */ - if ((pressed) && - ((((scancode & 0x7f) == 0x0F) && (_key_shifts & KB_ALT_FLAG)) || - (((scancode & 0x7f) == 0x01) && (_key_shifts & (KB_CTRL_FLAG | KB_ALT_FLAG))) || - (((scancode & 0x7f) == 0x39) && (_key_shifts & KB_ALT_FLAG)) || - (((scancode & 0x7f) == 0x3E) && (_key_shifts & KB_ALT_FLAG)))) + /* alt+F4 triggers a WM_CLOSE under Windows */ + if ((scancode == DIK_F4) && (_key_shifts & KB_ALT_FLAG)) { + if (pressed) + PostMessage(allegro_wnd, WM_CLOSE, 0, 0); return; + } /* if not foreground, filter out press codes and handle only release codes */ - if (pressed == 0 || (app_foreground && !wnd_sysmenu)) { - if (scancode > 0x7F) { - _handle_pckey(0xE0); + if (!wnd_sysmenu || !pressed) { + + /* three-finger salute for killing the program */ + if (((scancode == DIK_END) || (scancode == DIK_NUMPAD1)) + && ((_key_shifts & KB_CTRL_FLAG) && (_key_shifts & KB_ALT_FLAG)) + && three_finger_flag) { + _TRACE("Terminating application\n"); + ExitProcess(0); /* unsafe */ } /* dirty hack to let Allegro for Windows use the DOS/Linux way of handling CapsLock */ if (((scancode == DIK_CAPITAL) || (scancode == DIK_LSHIFT) || (scancode == DIK_RSHIFT)) - && pressed && (_key_shifts & KB_CAPSLOCK_FLAG)) { + && pressed + && (_key_shifts & KB_CAPSLOCK_FLAG)) { keybd_event(VK_CAPITAL, 0, 0, 0); keybd_event(VK_CAPITAL, 0, KEYEVENTF_KEYUP, 0); } + if (scancode & 0x80) + _handle_pckey(0xE0); + _handle_pckey((scancode & 0x7F) | (pressed ? 0 : 0x80)); } } diff --git a/src/win/wmouse.c b/src/win/wmouse.c index ab829f7b49..8cb74916cc 100644 --- a/src/win/wmouse.c +++ b/src/win/wmouse.c @@ -68,7 +68,7 @@ MOUSE_DRIVER mouse_directx = #define DINPUT_BUFFERSIZE 256 -static HANDLE mouse_thread = NULL; +HANDLE mouse_thread = NULL; static HANDLE mouse_thread_stop_event = NULL; static HANDLE mouse_input_event = NULL; static LPDIRECTINPUT mouse_dinput = NULL; @@ -77,6 +77,8 @@ static LPDIRECTINPUTDEVICE mouse_dinput_device = NULL; static int dinput_buttons = 0; static int dinput_wheel = FALSE; +static int mouse_swap_button = FALSE; /* TRUE means buttons 1 and 2 are swapped */ + static int dinput_x = 0; /* tracked dinput positon */ static int dinput_y = 0; @@ -108,12 +110,25 @@ static int mymickey_oy = 0; #define COORD_TO_MICKEY_X(n) ((n) * mouse_sx) #define COORD_TO_MICKEY_Y(n) ((n) * mouse_sy) -#define CLEAR_MICKEYS() \ -{ \ - dinput_x = 0; \ - dinput_y = 0; \ - mymickey_ox = 0; \ - mymickey_oy = 0; \ +#define CLEAR_MICKEYS() \ +{ \ + if (gfx_driver && gfx_driver->windowed) { \ + POINT p; \ + \ + GetCursorPos(&p); \ + \ + p.x -= wnd_x; \ + p.y -= wnd_y; \ + \ + mymickey_ox = p.x; \ + mymickey_oy = p.y; \ + } \ + else { \ + dinput_x = 0; \ + dinput_y = 0; \ + mymickey_ox = 0; \ + mymickey_oy = 0; \ + } \ } #define READ_CURSOR_POS(p) \ @@ -125,10 +140,16 @@ static int mymickey_oy = 0; \ if ((p.x < mouse_minx) || (p.x > mouse_maxx) || \ (p.y < mouse_miny) || (p.y > mouse_maxy)) { \ - _mouse_on = FALSE; \ + if (_mouse_on) { \ + _mouse_on = FALSE; \ + wnd_set_syscursor(TRUE); \ + } \ } \ else { \ - _mouse_on = TRUE; \ + if (!_mouse_on) { \ + _mouse_on = TRUE; \ + wnd_set_syscursor(FALSE); \ + } \ _mouse_x = p.x; \ _mouse_y = p.y; \ } \ @@ -182,7 +203,6 @@ static char* dinput_err_str(long err) */ int mouse_dinput_acquire(void) { - POINT p; HRESULT hr; if (mouse_dinput_device) { @@ -195,20 +215,14 @@ int mouse_dinput_acquire(void) return -1; } - /* modify the cursor only if the mouse is installed in windowed mode */ - if (gfx_driver && gfx_driver->windowed) - READ_CURSOR_POS(p); - } - else { - if (gfx_driver && gfx_driver->windowed) - _mouse_on = FALSE; + /* the cursor may not be in the client area so we don't set _mouse_on */ + if (_mouse_on) + mouse_set_syscursor(FALSE); } - /* always hide the cursor in fullscreen mode */ + /* always hide the system cursor in fullscreen mode */ if (gfx_driver && !gfx_driver->windowed) - _mouse_on = TRUE; - - mouse_set_syscursor(); + mouse_set_syscursor(FALSE); return 0; } @@ -224,11 +238,12 @@ int mouse_dinput_unacquire(void) IDirectInputDevice_Unacquire(mouse_dinput_device); _mouse_b = 0; + _mouse_on = FALSE; } - _mouse_on = FALSE; - - mouse_set_syscursor(); + /* restore the system cursor except in fullscreen mode */ + if (!gfx_driver || gfx_driver->windowed) + mouse_set_syscursor(TRUE); return 0; } @@ -238,21 +253,20 @@ int mouse_dinput_unacquire(void) /* mouse_set_syscursor: * Changes the state of the system mouse cursor (called by the window thread). */ -int mouse_set_syscursor(void) +int mouse_set_syscursor(int state) { - static int mouse_was_on = FALSE; + static int count = 0; /* initial state of the internal ShowCursor() counter */ - if (_mouse_on) { - if (!mouse_was_on) - SetCursor(NULL); + if (state == TRUE) { + if (count < 0) + count = ShowCursor(TRUE); } else { - if (mouse_was_on) - SetCursor(LoadCursor(NULL, IDC_ARROW)); + if (count >= 0) + count = ShowCursor(FALSE); } - - mouse_was_on = _mouse_on; - return TRUE; + + return 0; } @@ -260,18 +274,20 @@ int mouse_set_syscursor(void) /* mouse_set_sysmenu: * Changes the state of the mouse when going to/from sysmenu mode (called by the window thread). */ -int mouse_set_sysmenu(void) +int mouse_set_sysmenu(int state) { POINT p; if (mouse_dinput_device) { - if (wnd_sysmenu) - _mouse_on = FALSE; - else + if (state == TRUE) { + if (_mouse_on) { + _mouse_on = FALSE; + mouse_set_syscursor(TRUE); + } + } + else { READ_CURSOR_POS(p); - - /* needed when the sysmenu is pulled down by ALT+Space */ - mouse_set_syscursor(); + } _handle_mouse_input(); } @@ -362,6 +378,9 @@ static int mouse_dinput_init(void) if (FAILED(hr)) goto Error; + /* Check to see if the buttons are swapped (left-hand) */ + mouse_swap_button = GetSystemMetrics(SM_SWAPBUTTON); + /* Set data format */ hr = IDirectInputDevice_SetDataFormat(mouse_dinput_device, &c_dfDIMouse); if (FAILED(hr)) @@ -385,6 +404,7 @@ static int mouse_dinput_init(void) /* Acquire the device */ _mouse_on = TRUE; + wnd_set_syscursor(FALSE); wnd_acquire_mouse(); return 0; @@ -472,19 +492,19 @@ static void mouse_directx_poll(void) case DIMOFS_BUTTON0: if (data & 0x80) { if (_mouse_on) - _mouse_b |= 1; + _mouse_b |= (mouse_swap_button ? 2 : 1); } else - _mouse_b &= ~1; + _mouse_b &= ~(mouse_swap_button ? 2 : 1); break; case DIMOFS_BUTTON1: if (data & 0x80) { if (_mouse_on) - _mouse_b |= 2; + _mouse_b |= (mouse_swap_button ? 1 : 2); } else - _mouse_b &= ~2; + _mouse_b &= ~(mouse_swap_button ? 1 : 2); break; case DIMOFS_BUTTON2: @@ -537,7 +557,10 @@ static void mouse_directx_poll(void) CLEAR_MICKEYS(); } - _mouse_on = TRUE; + if (!_mouse_on) { + _mouse_on = TRUE; + wnd_set_syscursor(FALSE); + } _handle_mouse_input(); } @@ -567,7 +590,7 @@ static void mouse_directx_thread(HANDLE setup_event) return; } - /* now the thread it running successfully, let's acknowledge */ + /* now the thread is running successfully, let's acknowledge */ SetEvent(setup_event); /* setup event array */ @@ -661,13 +684,13 @@ static void mouse_directx_position(int x, int y) mouse_mx = COORD_TO_MICKEY_X(x); mouse_my = COORD_TO_MICKEY_Y(y); + if (gfx_driver && gfx_driver->windowed) + SetCursorPos(x+wnd_x, y+wnd_y); + CLEAR_MICKEYS(); mymickey_x = mymickey_y = 0; - if (gfx_driver && gfx_driver->windowed) - SetCursorPos(x+wnd_x, y+wnd_y); - /* force mouse update */ SetEvent(mouse_input_event); diff --git a/src/win/wsystem.c b/src/win/wsystem.c index 312363af86..2e45f47f45 100644 --- a/src/win/wsystem.c +++ b/src/win/wsystem.c @@ -71,7 +71,7 @@ SYSTEM_DRIVER system_directx = NULL, /* AL_METHOD(void, created_sub_bitmap, (struct BITMAP *bmp)); */ NULL, /* AL_METHOD(int, destroy_bitmap, (struct BITMAP *bitmap)); */ NULL, /* AL_METHOD(void, read_hardware_palette, (void)); */ - NULL, /* AL_METHOD(void, set_palette_range, (struct RGB *p, int from, int to, int vsync)); */ + NULL, /* AL_METHOD(void, set_palette_range, (PALETTE p, int from, int to, int vsync)); */ NULL, /* AL_METHOD(struct GFX_VTABLE *, get_vtable, (int color_depth)); */ sys_directx_set_display_switch_mode, sys_directx_set_display_switch_callback, @@ -220,30 +220,14 @@ static void sys_directx_exit(void) */ static void sys_directx_get_executable_name(char *output, int size) { - unsigned char *cmd = GetCommandLine(); - int pos = 0; - int i = 0; - int q; + char *temp = malloc(size); - while ((cmd[i]) && (uisspace(cmd[i]))) - i++; - - if ((cmd[i] == '\'') || (cmd[i] == '"')) - q = cmd[i++]; + if (GetModuleFileName(allegro_inst, temp, size)) + do_uconvert(temp, U_ASCII, output, U_CURRENT, size); else - q = 0; - - size -= ucwidth(0); - - while ((cmd[i]) && ((q) ? (cmd[i] != q) : (!uisspace(cmd[i])))) { - size -= ucwidth(cmd[i]); - if (size < 0) - break; - - pos += usetc(output + pos, cmd[i++]); - } + usetc(output, 0); - usetc(output + pos, 0); + free(temp); } @@ -553,7 +537,7 @@ void thread_safe_trace(char *msg,...) char buf[256]; va_list ap; - /* todo: use vsnprintf() */ + /* todo, some day: use vsnprintf (C99) */ va_start(ap, msg); vsprintf(buf, msg, ap); va_end(ap); diff --git a/src/win/wtimer.c b/src/win/wtimer.c index fc8760a0ae..0b6fce1aaa 100644 --- a/src/win/wtimer.c +++ b/src/win/wtimer.c @@ -187,10 +187,10 @@ static void tim_win32_high_perf_thread(void *unused) QueryPerformanceCounter(&prev_tick); while (TRUE) { - /* wait for foreground */ if (WaitForSingleObject(_foreground_event, 0) == WAIT_TIMEOUT) { - thread_switch_out(); - QueryPerformanceCounter(&prev_tick); + /* restart counter if the thread was blocked */ + if (thread_switch_out()) + QueryPerformanceCounter(&prev_tick); } /* get current counter */ @@ -229,10 +229,10 @@ static void tim_win32_low_perf_thread(void *unused) prev_time = timeGetTime(); while (TRUE) { - /* wait for foreground */ if (WaitForSingleObject(_foreground_event, 0) == WAIT_TIMEOUT) { - thread_switch_out(); - prev_time = timeGetTime(); + /* restart time if the thread was blocked */ + if (thread_switch_out()) + prev_time = timeGetTime(); } /* get current time */ diff --git a/src/win/wwnd.c b/src/win/wwnd.c index e3d2a4f406..3f9c59b912 100644 --- a/src/win/wwnd.c +++ b/src/win/wwnd.c @@ -45,6 +45,9 @@ int wnd_width = 0; int wnd_height = 0; int wnd_sysmenu = FALSE; +static int last_wnd_x = -1; +static int last_wnd_y = -1; + /* graphics */ WIN_GFX_DRIVER *win_gfx_driver; CRITICAL_SECTION gfx_crit_sect; @@ -68,27 +71,124 @@ static UINT msg_acquire_keyboard = 0; static UINT msg_unacquire_keyboard = 0; static UINT msg_acquire_mouse = 0; static UINT msg_unacquire_mouse = 0; +static UINT msg_set_syscursor = 0; static UINT msg_suicide = 0; +/* window modules management */ +struct WINDOW_MODULES { + int keyboard; + int mouse; + int sound; + int digi_card; + int midi_card; + int sound_input; + int digi_input_card; + int midi_input_card; +}; + + + +/* init_window_modules: + * Initialises the modules that are specified by the WM argument. + */ +static int init_window_modules(struct WINDOW_MODULES *wm) +{ + if (wm->keyboard) + install_keyboard(); + + if (wm->mouse) + install_mouse(); + + if (wm->sound) + install_sound(wm->digi_card, wm->midi_card, NULL); + + if (wm->sound_input) + install_sound_input(wm->digi_input_card, wm->midi_input_card); + + return 0; +} + + + +/* exit_window_modules: + * Removes the modules that depend upon the main window: + * - keyboard (DirectInput), + * - mouse (DirectInput), + * - sound (DirectSound), + * - sound input (DirectSoundCapture). + * If WM is not NULL, record which modules are really removed. + */ +static void exit_window_modules(struct WINDOW_MODULES *wm) +{ + if (wm) + memset(wm, 0, sizeof(wm)); + + if (_keyboard_installed) { + if (wm) + wm->keyboard = TRUE; + + remove_keyboard(); + } + + if (_mouse_installed) { + if (wm) + wm->mouse = TRUE; + + remove_mouse(); + } + + if (_sound_installed) { + if (wm) { + wm->sound = TRUE; + wm->digi_card = digi_card; + wm->midi_card = midi_card; + } + + remove_sound(); + } + + if (_sound_input_installed) { + if (wm) { + wm->sound_input = TRUE; + wm->digi_input_card = digi_input_card; + wm->midi_input_card = midi_input_card; + } + + remove_sound_input(); + } +} + /* win_set_window: - * selects a user defined window for Allegro + * Selects an user-defined window for Allegro + * or the built-in window if NULL is passed. */ void win_set_window(HWND wnd) { - /* todo: add code to remove old window */ + struct WINDOW_MODULES wm; + + if (_allegro_count > 0) { + exit_window_modules(&wm); + exit_directx_window(); + } + user_wnd = wnd; + + if (_allegro_count > 0) { + init_directx_window(); + init_window_modules(&wm); + } } /* win_get_window: - * returns the allegro window handle + * Returns the Allegro window handle. */ HWND win_get_window(void) { - return (user_wnd ? user_wnd : allegro_wnd); + return allegro_wnd; } @@ -167,6 +267,16 @@ void wnd_unacquire_mouse(void) +/* wnd_set_syscursor: + * posts msg to window to set the system mouse cursor + */ +void wnd_set_syscursor(int state) +{ + PostMessage(allegro_wnd, msg_set_syscursor, state, 0); +} + + + /* directx_wnd_proc: * window proc for the Allegro window class */ @@ -189,6 +299,9 @@ static LRESULT CALLBACK directx_wnd_proc(HWND wnd, UINT message, WPARAM wparam, if (message == msg_unacquire_mouse) return mouse_dinput_unacquire(); + if (message == msg_set_syscursor) + return mouse_set_syscursor(wparam); + if (message == msg_suicide) { DestroyWindow(wnd); return 0; @@ -203,10 +316,13 @@ static LRESULT CALLBACK directx_wnd_proc(HWND wnd, UINT message, WPARAM wparam, case WM_DESTROY: if (user_wnd_proc) { - /* remove the DirectX stuff */ - remove_keyboard(); - remove_mouse(); - remove_sound(); + exit_window_modules(NULL); + + /* The system may have sent a WA_INACTIVE message, so we need + * to wake up the timer thread, supposing we are in SWITCH_PAUSE + * or SWITCH_AMNESIA mode. + */ + SetEvent(_foreground_event); } else { PostQuitMessage(0); @@ -269,10 +385,19 @@ static LRESULT CALLBACK directx_wnd_proc(HWND wnd, UINT message, WPARAM wparam, wnd_height = HIWORD(lparam); break; + case WM_ERASEBKGND: + /* Disable the default background eraser in order + * to prevent conflicts under Win2k/WinXP. + */ + if (!user_wnd_proc || win_gfx_driver) + return 1; + break; + case WM_PAINT: - if (win_gfx_driver && win_gfx_driver->paint) { + if (!user_wnd_proc || win_gfx_driver) { BeginPaint(wnd, &ps); - win_gfx_driver->paint(&ps.rcPaint); + if (win_gfx_driver && win_gfx_driver->paint) + win_gfx_driver->paint(&ps.rcPaint); EndPaint(wnd, &ps); return 0; } @@ -297,14 +422,9 @@ static LRESULT CALLBACK directx_wnd_proc(HWND wnd, UINT message, WPARAM wparam, return TRUE; break; - case WM_SETCURSOR: - if (!user_wnd_proc || _mouse_installed) - return mouse_set_syscursor(); - break; - case WM_INITMENUPOPUP: wnd_sysmenu = TRUE; - mouse_set_sysmenu(); + mouse_set_sysmenu(TRUE); if (win_gfx_driver && win_gfx_driver->enter_sysmode) win_gfx_driver->enter_sysmode(); @@ -313,15 +433,10 @@ static LRESULT CALLBACK directx_wnd_proc(HWND wnd, UINT message, WPARAM wparam, case WM_MENUSELECT: if ((HIWORD(wparam) == 0xFFFF) && (!lparam)) { wnd_sysmenu = FALSE; - mouse_set_sysmenu(); + mouse_set_sysmenu(FALSE); if (win_gfx_driver && win_gfx_driver->exit_sysmode) win_gfx_driver->exit_sysmode(); - - /* needed to get rid of the lost mouse pointer - * because the system doesn't send any WM_PAINT message. - */ - InvalidateRect(allegro_wnd, NULL, TRUE); } break; @@ -331,10 +446,24 @@ static LRESULT CALLBACK directx_wnd_proc(HWND wnd, UINT message, WPARAM wparam, (*user_close_proc)(); } else { - /* default window close message */ - if (MessageBox(wnd, ALLEGRO_WINDOW_CLOSE_MESSAGE, wnd_title, - MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) == IDYES) - ExitProcess(0); + /* display the default close box */ + char tmp[1024], title[WND_TITLE_SIZE*2]; + char *mesg; + + mesg = uconvert(get_config_text(ALLEGRO_WINDOW_CLOSE_MESSAGE), U_CURRENT, tmp, U_UNICODE, sizeof(tmp)); + do_uconvert(wnd_title, U_ASCII, title, U_UNICODE, sizeof(title)); + + if (MessageBoxW(wnd, (unsigned short *)mesg, (unsigned short *)title, + MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) == IDYES) { + if (mouse_thread) + TerminateThread(mouse_thread, 0); + if (key_thread) + TerminateThread(key_thread, 0); + TerminateThread(allegro_thread, 0); + SetEvent(_foreground_event); /* see comment in WM_DESTROY case */ + remove_timer(); + DestroyWindow(wnd); + } } return 0; } @@ -350,6 +479,65 @@ static LRESULT CALLBACK directx_wnd_proc(HWND wnd, UINT message, WPARAM wparam, +/* save_window_pos: + * Stores the position of the current window, before closing it, so it can be + * used as the initial position for the next window. + */ +void save_window_pos(void) +{ + last_wnd_x = wnd_x; + last_wnd_y = wnd_y; +} + + + +/* adjust_window: + * Moves and resizes the window if we have full control over it. + */ +int adjust_window(int w, int h) +{ + RECT working_area, win_size; + + if (!user_wnd) { + if (last_wnd_x < 0) { + /* first window placement: try to center it */ + SystemParametersInfo(SPI_GETWORKAREA, 0, &working_area, 0); + last_wnd_x = (working_area.left + working_area.right - w)/2; + last_wnd_y = (working_area.top + working_area.bottom - h)/2; + +#ifdef ALLEGRO_COLORCONV_ALIGNED_WIDTH + last_wnd_x &= 0xfffffffc; +#endif + } + + win_size.left = last_wnd_x; + win_size.top = last_wnd_y; + win_size.right = last_wnd_x+w; + win_size.bottom = last_wnd_y+h; + + /* retrieve the size of the decorated window */ + AdjustWindowRect(&win_size, GetWindowLong(allegro_wnd, GWL_STYLE), FALSE); + + /* display the window */ + MoveWindow(allegro_wnd, win_size.left, win_size.top, + win_size.right - win_size.left, win_size.bottom - win_size.top, TRUE); + + /* check that the actual window size is the one requested */ + GetClientRect(allegro_wnd, &win_size); + if (((win_size.right - win_size.left) != w) || ((win_size.bottom - win_size.top) != h)) + return -1; + + wnd_x = last_wnd_x; + wnd_y = last_wnd_y; + wnd_width = w; + wnd_height = h; + } + + return 0; +} + + + /* restore_window_style: */ void restore_window_style(void) @@ -365,35 +553,40 @@ void restore_window_style(void) */ static HWND create_directx_window(void) { + static int first = 1; + WNDCLASS wnd_class; char fname[1024]; HWND wnd; - WNDCLASS wnd_class; - - /* setup the window class */ - wnd_class.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; - wnd_class.lpfnWndProc = directx_wnd_proc; - wnd_class.cbClsExtra = 0; - wnd_class.cbWndExtra = 0; - wnd_class.hInstance = allegro_inst; - wnd_class.hIcon = LoadIcon(allegro_inst, "allegro_icon"); - if (!wnd_class.hIcon) - wnd_class.hIcon = LoadIcon(NULL, IDI_APPLICATION); - wnd_class.hCursor = LoadCursor(NULL, IDC_ARROW); - wnd_class.hbrBackground = CreateSolidBrush(0); - wnd_class.lpszMenuName = NULL; - wnd_class.lpszClassName = ALLEGRO_WND_CLASS; - - RegisterClass(&wnd_class); - /* what are we called? */ - get_executable_name(fname, sizeof(fname)); - ustrlwr(fname); - - usetc(get_extension(fname), 0); - if (ugetat(fname, -1) == '.') - usetat(fname, -1, 0); - - do_uconvert(get_filename(fname), U_CURRENT, wnd_title, U_ASCII, WND_TITLE_SIZE); + if (first) { + /* setup the window class */ + wnd_class.style = CS_HREDRAW | CS_VREDRAW; + wnd_class.lpfnWndProc = directx_wnd_proc; + wnd_class.cbClsExtra = 0; + wnd_class.cbWndExtra = 0; + wnd_class.hInstance = allegro_inst; + wnd_class.hIcon = LoadIcon(allegro_inst, "allegro_icon"); + if (!wnd_class.hIcon) + wnd_class.hIcon = LoadIcon(NULL, IDI_APPLICATION); + wnd_class.hCursor = LoadCursor(NULL, IDC_ARROW); + wnd_class.hbrBackground = GetStockObject(BLACK_BRUSH); + wnd_class.lpszMenuName = NULL; + wnd_class.lpszClassName = ALLEGRO_WND_CLASS; + + RegisterClass(&wnd_class); + + /* what are we called? */ + get_executable_name(fname, sizeof(fname)); + ustrlwr(fname); + + usetc(get_extension(fname), 0); + if (ugetat(fname, -1) == '.') + usetat(fname, -1, 0); + + do_uconvert(get_filename(fname), U_CURRENT, wnd_title, U_ASCII, WND_TITLE_SIZE); + + first = 0; + } /* create the window now */ wnd = CreateWindowEx(WS_EX_APPWINDOW, ALLEGRO_WND_CLASS, wnd_title, @@ -456,6 +649,7 @@ static void wnd_thread_proc(HANDLE setup_event) */ int init_directx_window(void) { + RECT win_rect; HANDLE events[2]; long result; @@ -465,6 +659,7 @@ int init_directx_window(void) msg_unacquire_keyboard = RegisterWindowMessage("Allegro keyboard unacquire proc"); msg_acquire_mouse = RegisterWindowMessage("Allegro mouse acquire proc"); msg_unacquire_mouse = RegisterWindowMessage("Allegro mouse unacquire proc"); + msg_set_syscursor = RegisterWindowMessage("Allegro mouse cursor proc"); msg_suicide = RegisterWindowMessage("Allegro window suicide"); /* prepare window for Allegro */ @@ -473,12 +668,19 @@ int init_directx_window(void) user_wnd_proc = (WNDPROC) SetWindowLong(user_wnd, GWL_WNDPROC, (long)directx_wnd_proc); if (!user_wnd_proc) return -1; + allegro_wnd = user_wnd; + + /* retrieve the window dimensions */ + GetWindowRect(allegro_wnd, &win_rect); + ClientToScreen(allegro_wnd, (LPPOINT)&win_rect); + ClientToScreen(allegro_wnd, (LPPOINT)&win_rect + 1); + wnd_x = win_rect.left; + wnd_y = win_rect.top; + wnd_width = win_rect.right - win_rect.left; + wnd_height = win_rect.bottom - win_rect.top; } else { - /* initialize gfx critical section */ - InitializeCriticalSection(&gfx_crit_sect); - /* create window thread */ events[0] = CreateEvent(NULL, FALSE, FALSE, NULL); /* acknowledges that thread is up */ events[1] = (HANDLE) _beginthread(wnd_thread_proc, 0, events[0]); @@ -500,6 +702,9 @@ int init_directx_window(void) return -1; } + /* initialize gfx critical section */ + InitializeCriticalSection(&gfx_crit_sect); + /* save window style */ old_style = GetWindowLong(allegro_wnd, GWL_STYLE); @@ -514,10 +719,12 @@ int init_directx_window(void) */ void exit_directx_window(void) { - if (user_wnd_proc) { + if (user_wnd) { /* restore old window proc */ SetWindowLong(user_wnd, GWL_WNDPROC, (long)user_wnd_proc); user_wnd_proc = NULL; + user_wnd = NULL; + allegro_wnd = NULL; } else { /* destroy the window: we cannot directly use DestroyWindow() @@ -528,7 +735,7 @@ void exit_directx_window(void) /* wait until the window thread ends */ WaitForSingleObject(wnd_thread, INFINITE); wnd_thread = NULL; - - DeleteCriticalSection(&gfx_crit_sect); } + + DeleteCriticalSection(&gfx_crit_sect); } diff --git a/src/x/xkeybd.c b/src/x/xkeybd.c index 4324e61ee1..6dc8da8b3f 100644 --- a/src/x/xkeybd.c +++ b/src/x/xkeybd.c @@ -134,18 +134,12 @@ static void _xwin_keydrv_handler(int pressed, int code) */ static void _xwin_keydrv_focused(int focused, int state) { - int i, mask; + int mask; if (focused) { mask = KB_SCROLOCK_FLAG | KB_NUMLOCK_FLAG | KB_CAPSLOCK_FLAG; _key_shifts = (_key_shifts & ~mask) | (state & mask); } - else { - for (i=0; i 4096) || (h > 4096) - || (vw > 4096) || (vh > 4096)) { - ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Unsupported screen size")); - return 0; - } - if (vw < w) vw = w; if (vh < h) @@ -712,6 +706,10 @@ static BITMAP *_xwin_private_create_screen(GFX_DRIVER *drv, int w, int h, #ifdef ALLEGRO_XWINDOWS_WITH_XF86VIDMODE if (fullscreen) { + AL_CONST char *fc; + char tmp1[64], tmp2[128]; + int i; + /* Switch video mode. */ if (!_xvidmode_private_set_fullscreen(w, h, 0, 0)) { ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Can not set video mode")); @@ -721,10 +719,19 @@ static BITMAP *_xwin_private_create_screen(GFX_DRIVER *drv, int w, int h, /* Hack: make the window fully visible and center cursor. */ XMoveWindow(_xwin.display, _xwin.window, 0, 0); XF86VidModeSetViewPort(_xwin.display, _xwin.screen, 0, 0); - XWarpPointer(_xwin.display, None, _xwin.window, 0, 0, 0, 0, 0, 0); - XWarpPointer(_xwin.display, None, _xwin.window, 0, 0, 0, 0, w - 1, 0); - XWarpPointer(_xwin.display, None, _xwin.window, 0, 0, 0, 0, 0, h - 1); - XWarpPointer(_xwin.display, None, _xwin.window, 0, 0, 0, 0, w - 1, h - 1); + + /* This chunk is disabled by default because of problems on KDE desktops. */ + fc = get_config_string(uconvert_ascii("graphics", tmp1), + uconvert_ascii("force_centering", tmp2), + NULL); + + if ((fc) && ((i = ugetc(fc)) != 0) && ((i == 'y') || (i == 'Y') || (i == '1'))) { + XWarpPointer(_xwin.display, None, _xwin.window, 0, 0, 0, 0, 0, 0); + XWarpPointer(_xwin.display, None, _xwin.window, 0, 0, 0, 0, w - 1, 0); + XWarpPointer(_xwin.display, None, _xwin.window, 0, 0, 0, 0, 0, h - 1); + XWarpPointer(_xwin.display, None, _xwin.window, 0, 0, 0, 0, w - 1, h - 1); + } + XWarpPointer(_xwin.display, None, _xwin.window, 0, 0, 0, 0, w / 2, h / 2); XSync(_xwin.display, False); @@ -768,8 +775,15 @@ BITMAP *_xwin_create_screen(GFX_DRIVER *drv, int w, int h, BITMAP *bmp; XLOCK(); bmp = _xwin_private_create_screen(drv, w, h, vw, vh, depth, fullscreen); - if (bmp == 0) + if (bmp == 0) { _xwin_private_destroy_screen(); + /* Work around a weird bug with some window managers (KWin, Window Maker). */ + if (fullscreen) { + bmp = _xwin_private_create_screen(drv, w, h, vw, vh, depth, fullscreen); + if (bmp == 0) + _xwin_private_destroy_screen(); + } + } XUNLOCK(); return bmp; } @@ -1103,8 +1117,10 @@ static int _xwin_private_create_ximage(int w, int h) _xwin.shminfo.readOnly = True; /* Attach shared memory to the X-server address space. */ - if (XShmAttach(_xwin.display, &_xwin.shminfo)) + if (XShmAttach(_xwin.display, &_xwin.shminfo)) { + XSync(_xwin.display, False); break; + } shmdt(_xwin.shminfo.shmaddr); } @@ -1488,6 +1504,18 @@ if (_xwin.bank_switch) \ /* * Functions for copying screen data to frame buffer. */ +#ifdef ALLEGRO_LITTLE_ENDIAN + #define DEFAULT_RGB_R_POS_24 (DEFAULT_RGB_R_SHIFT_24/8) + #define DEFAULT_RGB_G_POS_24 (DEFAULT_RGB_G_SHIFT_24/8) + #define DEFAULT_RGB_B_POS_24 (DEFAULT_RGB_B_SHIFT_24/8) +#elif defined ALLEGRO_BIG_ENDIAN + #define DEFAULT_RGB_R_POS_24 (2-DEFAULT_RGB_R_SHIFT_24/8) + #define DEFAULT_RGB_G_POS_24 (2-DEFAULT_RGB_G_SHIFT_24/8) + #define DEFAULT_RGB_B_POS_24 (2-DEFAULT_RGB_B_SHIFT_24/8) +#else + #error endianess not defined +#endif + #define MAKE_FAST_TRUECOLOR(name,stype,dtype,rshift,gshift,bshift,rmask,gmask,bmask) \ static void name(int sx, int sy, int sw, int sh) \ { \ @@ -1514,7 +1542,9 @@ static void name(int sx, int sy, int sw, int sh) dtype *d = (dtype*) (_xwin.buffer_line[y]) + sx; \ XWIN_BANK_SWITCH(y); \ for (x = sw - 1; x >= 0; s += 3, x--) { \ - *d++ = (_xwin.rmap[s[0]] | _xwin.gmap[s[1]] | _xwin.bmap[s[2]]); \ + *d++ = (_xwin.rmap[s[DEFAULT_RGB_R_POS_24]] \ + | _xwin.gmap[s[DEFAULT_RGB_G_POS_24]] \ + | _xwin.bmap[s[DEFAULT_RGB_B_POS_24]]); \ } \ } \ } @@ -1532,9 +1562,7 @@ static void name(int sx, int sy, int sw, int sh) color = (_xwin.rmap[(color >> (rshift)) & (rmask)] \ | _xwin.gmap[(color >> (gshift)) & (gmask)] \ | _xwin.bmap[(color >> (bshift)) & (bmask)]); \ - d[0] = (color & 0xFF); \ - d[1] = (color >> 8) & 0xFF; \ - d[2] = (color >> 16) & 0xFF; \ + WRITE3BYTES(d, color); \ } \ } \ } @@ -1548,10 +1576,10 @@ static void name(int sx, int sy, int sw, int sh) unsigned char *d = _xwin.buffer_line[y] + 3 * sx; \ XWIN_BANK_SWITCH(y); \ for (x = sw - 1; x >= 0; s += 3, d += 3, x--) { \ - unsigned long color = _xwin.rmap[s[0]] | _xwin.gmap[s[1]] | _xwin.bmap[s[2]]; \ - d[0] = (color & 0xFF); \ - d[1] = (color >> 8) & 0xFF; \ - d[2] = (color >> 16) & 0xFF; \ + unsigned long color = _xwin.rmap[s[DEFAULT_RGB_R_POS_24]] \ + | _xwin.gmap[s[DEFAULT_RGB_G_POS_24]] \ + | _xwin.bmap[s[DEFAULT_RGB_B_POS_24]]; \ + WRITE3BYTES(d, color); \ } \ } \ } @@ -1645,9 +1673,9 @@ static void name(int sx, int sy, int sw, int sh) dtype *d = (dtype*) (_xwin.buffer_line[y]) + sx; \ XWIN_BANK_SWITCH(y); \ for (x = sw - 1; x >= 0; s += 3, x--) { \ - *d++ = _xwin.cmap[((((unsigned long) s[0] << 4) & 0xF00) \ - | ((unsigned long) s[1] & 0xF0) \ - | (((unsigned long) s[2] >> 4) & 0x0F))]; \ + *d++ = _xwin.cmap[((((unsigned long) s[DEFAULT_RGB_R_POS_24] << 4) & 0xF00) \ + | ((unsigned long) s[DEFAULT_RGB_G_POS_24] & 0xF0) \ + | (((unsigned long) s[DEFAULT_RGB_B_POS_24] >> 4) & 0x0F))];\ } \ } \ } @@ -1711,7 +1739,9 @@ static void name(int sx, int sy, int sw, int sh) unsigned char *s = _xwin.screen_line[y] + 3 * sx; \ for (x = sx; x < (sx + sw); s += 3, x++) { \ XPutPixel(_xwin.ximage, x, y, \ - (_xwin.rmap[s[0]] | _xwin.gmap[s[1]] | _xwin.bmap[s[2]])); \ + (_xwin.rmap[s[DEFAULT_RGB_R_POS_24]] \ + | _xwin.gmap[s[DEFAULT_RGB_G_POS_24]] \ + | _xwin.bmap[s[DEFAULT_RGB_B_POS_24]])); \ } \ } \ } @@ -1762,9 +1792,9 @@ static void name(int sx, int sy, int sw, int sh) unsigned char *s = _xwin.screen_line[y] + 3 * sx; \ for (x = sx; x < (sx + sw); s += 3, x++) { \ XPutPixel(_xwin.ximage, x, y, \ - _xwin.cmap[((((unsigned long) s[0] << 4) & 0xF00) \ - | ((unsigned long) s[1] & 0xF0) \ - | (((unsigned long) s[2] >> 4) & 0x0F))]); \ + _xwin.cmap[((((unsigned long) s[DEFAULT_RGB_R_POS_24] << 4) & 0xF00) \ + | ((unsigned long) s[DEFAULT_RGB_G_POS_24] & 0xF0) \ + | (((unsigned long) s[DEFAULT_RGB_B_POS_24] >> 4) & 0x0F))]); \ } \ } \ } @@ -2013,8 +2043,15 @@ static void _xwin_private_process_event(XEvent *event) /* Losing input focus. */ if (_xwin_keyboard_focused) (*_xwin_keyboard_focused)(FALSE, 0); - for (kcode = 0; kcode < 256; kcode++) - _xwin_keycode_pressed[kcode] = FALSE; + for (kcode = 0; kcode < 256; kcode++) { + if (_xwin_keycode_pressed[kcode]) { + scode = _xwin.keycode_to_scancode[kcode]; + if ((scode > 0) && (_xwin_keyboard_interrupt != 0)) { + (*_xwin_keyboard_interrupt)(0, scode); + _xwin_keycode_pressed[kcode] = FALSE; + } + } + } break; case ButtonPress: /* Mouse button pressed. */ @@ -2088,8 +2125,8 @@ static void _xwin_private_process_event(XEvent *event) mouse_was_warped = 0; if (!_xwin.mouse_warped) { /* Move Allegro cursor to X-cursor. */ - dx = event->xmotion.x - _mouse_x; - dy = event->xmotion.y - _mouse_y; + dx = event->xmotion.x - (_mouse_x - _xwin.scroll_x); + dy = event->xmotion.y - (_mouse_y - _xwin.scroll_y); } if (((dx != 0) || (dy != 0)) && _xwin_mouse_interrupt) { if (_xwin.mouse_warped && (mouse_warp_now++ & 4)) { @@ -2123,8 +2160,8 @@ static void _xwin_private_process_event(XEvent *event) mouse_was_warped = 0; if (!_xwin.mouse_warped) { /* Move Allegro cursor to X-cursor. */ - dx = event->xcrossing.x - _mouse_x; - dy = event->xcrossing.y - _mouse_y; + dx = event->xcrossing.x - (_mouse_x - _xwin.scroll_x); + dy = event->xcrossing.y - (_mouse_y - _xwin.scroll_y); if (((dx != 0) || (dy != 0)) && _xwin_mouse_interrupt) (*_xwin_mouse_interrupt)(dx, dy, 0, mouse_buttons); } @@ -2152,7 +2189,7 @@ static void _xwin_private_process_event(XEvent *event) break; case ClientMessage: /* Window close request */ - if (event->xclient.data.l[0] == wm_delete_window) { + if ((Atom)event->xclient.data.l[0] == wm_delete_window) { if (_xwin.window_close_hook) _xwin.window_close_hook(); else @@ -2184,7 +2221,7 @@ static void _xwin_private_handle_input(void) /* Move X-cursor to Allegro cursor. */ XWarpPointer(_xwin.display, _xwin.window, _xwin.window, 0, 0, _xwin.window_width, _xwin.window_height, - _mouse_x, _mouse_y); + _mouse_x - _xwin.scroll_x, _mouse_y - _xwin.scroll_y); } #ifdef ALLEGRO_XWINDOWS_WITH_XF86DGA } @@ -2724,11 +2761,6 @@ static BITMAP *_xdga_private_create_screen(GFX_DRIVER *drv, int w, int h, h = 200; } - if ((w < 80) || (h < 80) || (w > 4096) || (h > 4096)) { - ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Unsupported screen size")); - return 0; - } - if (vw < w) vw = w; if (vh < h) diff --git a/tests/afinfo.c b/tests/afinfo.c index 06672997e6..50fdb50f46 100644 --- a/tests/afinfo.c +++ b/tests/afinfo.c @@ -217,18 +217,18 @@ MMAP af_linear_mem = NOMM; #ifdef ALLEGRO_DOS /* hooks to let the driver call BIOS routines */ -extern void _af_int86(), _af_call_rm(); +extern void _af_int86(void), _af_call_rm(void); #else /* no BIOS on this platform, my friend! */ -void nobios() { } +void nobios(void) { } #endif -void af_exit() +void af_exit(void) { int c; @@ -322,7 +322,7 @@ int load_vbeaf_driver(char *filename) -void initialise_freebeaf_extensions() +void initialise_freebeaf_extensions(void) { typedef unsigned long (*EXT_INIT_FUNC)(AF_DRIVER *af, unsigned long id); EXT_INIT_FUNC ext_init; @@ -377,7 +377,7 @@ void initialise_freebeaf_extensions() -static int initialise_vbeaf() +static int initialise_vbeaf(void) { int c; @@ -469,7 +469,7 @@ void print_af_attributes(unsigned long attrib) -int get_af_info() +int get_af_info(void) { static char *possible_filenames[] = { @@ -778,7 +778,7 @@ int main(int argc, char *argv[]) #else /* ifdef VBE/AF cool on this platform */ -int main() +int main(void) { allegro_init(); allegro_message("Sorry, the AFINFO program only works on DOS or Linux\n"); diff --git a/tests/akaitest.c b/tests/akaitest.c index 15253b3ba3..b77c89d24e 100644 --- a/tests/akaitest.c +++ b/tests/akaitest.c @@ -582,7 +582,7 @@ DIALOG the_dialog[] = -int main() +int main(void) { int i; diff --git a/tests/filetest.c b/tests/filetest.c index 819b1f7e67..91cd045321 100644 --- a/tests/filetest.c +++ b/tests/filetest.c @@ -91,7 +91,7 @@ static int fa_button_proc(int msg, DIALOG *d, int c) { int ret; - if (msg == MSG_CLICK) { + if ((msg == MSG_CLICK) || (msg == MSG_KEY)) { ret = d_check_proc(msg, d, c); if (d->flags & D_SELECTED) diff --git a/tests/miditest.c b/tests/miditest.c index db1c38098b..2819a445af 100644 --- a/tests/miditest.c +++ b/tests/miditest.c @@ -428,7 +428,7 @@ DIALOG thedialog[] = -int main() +int main(void) { allegro_init(); install_keyboard(); diff --git a/tests/test.c b/tests/test.c index 2e5d38f535..b5cca70d6c 100644 --- a/tests/test.c +++ b/tests/test.c @@ -87,7 +87,7 @@ void tm_tick(void) } } -END_OF_FUNCTION(tm_tick); +END_OF_FUNCTION(tm_tick) @@ -1442,7 +1442,7 @@ void blit_demo(void) void misc(void) { BITMAP *p; - fixed x, y, z; + volatile fixed x, y, z; clear_to_color(screen, palette_color[0]); textout(screen,font,"Timing some other routines...", xoff+44, 6, palette_color[15]); @@ -1810,7 +1810,7 @@ void int1(void) int_c1 = 0; } -END_OF_FUNCTION(int1); +END_OF_FUNCTION(int1) @@ -1820,7 +1820,7 @@ void int2(void) int_c2 = 0; } -END_OF_FUNCTION(int2); +END_OF_FUNCTION(int2) @@ -1830,7 +1830,7 @@ void int3(void) int_c3 = 0; } -END_OF_FUNCTION(int3); +END_OF_FUNCTION(int3) @@ -1882,7 +1882,7 @@ void fade(void) fade_color = 0; } -END_OF_FUNCTION(fade); +END_OF_FUNCTION(fade) @@ -4502,7 +4502,7 @@ DIALOG refresh_dlg[] = { d_ctext_proc, 114, 8, 1, 1, 0, 0, 0, 0, 0, 0, "Refresh Rate", NULL, NULL }, { d_button_proc, 132, 40, 81, 17, 0, 0, 0, D_EXIT, 0, 0, "OK", NULL, NULL }, { d_button_proc, 132, 64, 81, 17, 0, 0, 27, D_EXIT, 0, 0, "Cancel", NULL, NULL }, - { d_list_proc, 16, 28, 101, 68, 0, 0, 0, D_EXIT, 0, 0, refresh_getter, NULL, NULL }, + { d_list_proc, 16, 28, 101, 68, 0, 0, 0, D_EXIT, 0, 0, (void *)refresh_getter, NULL, NULL }, { d_yield_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } }; @@ -4673,4 +4673,4 @@ int main(void) return 0; } -END_OF_MAIN(); +END_OF_MAIN() diff --git a/tests/vesainfo.c b/tests/vesainfo.c index b5ac395fc7..5c0043b1e2 100644 --- a/tests/vesainfo.c +++ b/tests/vesainfo.c @@ -149,7 +149,7 @@ void get_string(char *s, unsigned long addr) -int get_vesa_info() +int get_vesa_info(void) { __dpmi_regs r; unsigned long mode_ptr; @@ -245,7 +245,7 @@ void print_flag(char *s) -void end_print_flag() +void end_print_flag(void) { if (in_flag) { printf(")\n"); @@ -509,7 +509,7 @@ int main(int argc, char *argv[]) #else /* ifdef ALLEGRO_DOS */ -int main() +int main(void) { allegro_init(); allegro_message("Sorry, the VESAINFO program only works on DOS\n"); diff --git a/todo.txt b/todo.txt index 3882607b1d..c71de08da8 100644 --- a/todo.txt +++ b/todo.txt @@ -18,7 +18,6 @@ General (Platform independant) todos: - check and/or fix compilation with gcc 3.0 - include dat2c once finished - remove joystick control from main part of setup -- configure --disable-constructor doesn't work because of part of alconfig.h DOS todos: --------------------------------------------------------------------------- @@ -28,7 +27,6 @@ DOS todos: Win32 todos: --------------------------------------------------------------------------- -- Fix the bug in the emergency exit mechanism when called from the DLL - Fix 'IE bars popup over a fullscreen DirectX window' bug - Investigate mouse problem with USB Wacom Tablet (bug #226445) @@ -100,7 +98,6 @@ Wishlist: - OSS MIDI pitch bend is wrong - size_t where appropriate (get more opinions first) - keyboard set_rate -- make zipwin.sh work with cygwin. Wishlist: (definitely post 4.0) --------------------------------------------------------------------------- diff --git a/tools/dat2s.c b/tools/dat2s.c index 8dc1a9cee4..820489a76a 100644 --- a/tools/dat2s.c +++ b/tools/dat2s.c @@ -27,6 +27,18 @@ #include "datedit.h" +/* unused callbacks for datedit.c */ +void datedit_msg(AL_CONST char *fmt, ...) { } +void datedit_startmsg(AL_CONST char *fmt, ...) { } +void datedit_endmsg(AL_CONST char *fmt, ...) { } +void datedit_error(AL_CONST char *fmt, ...) { } +int datedit_ask(AL_CONST char *fmt, ...) { return 0; } + + +/* this program is not portable! */ +#ifdef ALLEGRO_I386 + + #ifndef ALLEGRO_ASM_PREFIX #define ALLEGRO_ASM_PREFIX "" #endif @@ -50,14 +62,6 @@ static FILE *outfileheader = NULL; static void output_object(DATAFILE *object, char *name); -/* unused callbacks for datedit.c */ -void datedit_msg(AL_CONST char *fmt, ...) { } -void datedit_startmsg(AL_CONST char *fmt, ...) { } -void datedit_endmsg(AL_CONST char *fmt, ...) { } -void datedit_error(AL_CONST char *fmt, ...) { } -int datedit_ask(AL_CONST char *fmt, ...) { return 0; } - - static void usage(void) { @@ -325,7 +329,7 @@ static void output_rle_sprite(RLE_SPRITE *sprite, char *name) fprintf(outfile, "\t.long %-16d# color depth\n", bpp); fprintf(outfile, "\t.long %-16d# size\n", sprite->size); - write_data(sprite->dat, sprite->size); + write_data((unsigned char *)sprite->dat, sprite->size); fprintf(outfile, "\n"); } @@ -621,7 +625,7 @@ int main(int argc, char *argv[]) output_datafile(data, "data", TRUE); - #ifdef ALLEGRO_DJGPP + #ifdef ALLEGRO_USE_CONSTRUCTOR fprintf(outfile, ".text\n"); fprintf(outfile, ".balign 4\n"); @@ -660,18 +664,36 @@ int main(int argc, char *argv[]) delete_file(outfilenameheader); } else { - #ifdef ALLEGRO_DJGPP + #ifdef ALLEGRO_USE_CONSTRUCTOR + if (truecolor) { printf("\nI noticed some truecolor images, so you must call fixup_datafile()\n"); printf("before using this data! (after setting a video mode).\n"); } + #else + printf("\nI don't know how to do constructor functions on this platform, so you must\n"); printf("call fixup_datafile() before using this data! (after setting a video mode).\n"); + #endif } return err; } + +#else /* ifdef ALLEGRO_I386 */ + + +int main(void) +{ + allegro_init(); + allegro_message("Sorry, the DAT2S program only works on x86 processors\n"); + return 1; +} + + +#endif + END_OF_MAIN(); diff --git a/tools/datedit.c b/tools/datedit.c index 0b47bbfd24..a4482a9c2e 100644 --- a/tools/datedit.c +++ b/tools/datedit.c @@ -34,16 +34,16 @@ DATAFILE datedit_info = { info_msg, DAT_INFO, sizeof(info_msg), NULL }; static int file_datasize; -void (*grabber_sel_palette)() = NULL; -void (*grabber_select_property)() = NULL; -void (*grabber_get_grid_size)() = NULL; -void (*grabber_rebuild_list)() = NULL; -void (*grabber_get_selection_info)() = NULL; -int (*grabber_foreach_selection)() = NULL; -DATAFILE *(*grabber_single_selection)() = NULL; -void (*grabber_set_selection)() = NULL; -void (*grabber_busy_mouse)() = NULL; -void (*grabber_modified)() = NULL; +void (*grabber_sel_palette)(PALETTE pal) = NULL; +void (*grabber_select_property)(int type) = NULL; +void (*grabber_get_grid_size)(int *x, int *y) = NULL; +void (*grabber_rebuild_list)(void *old, int clear) = NULL; +void (*grabber_get_selection_info)(DATAFILE **dat, DATAFILE ***parent) = NULL; +int (*grabber_foreach_selection)(int (*proc)(DATAFILE *, int *, int), int *count, int *param, int param2) = NULL; +DATAFILE *(*grabber_single_selection)(void) = NULL; +void (*grabber_set_selection)(void *object) = NULL; +void (*grabber_busy_mouse)(int busy) = NULL; +void (*grabber_modified)(int modified) = NULL; BITMAP *grabber_graphic = NULL; PALETTE grabber_palette; diff --git a/tools/datedit.h b/tools/datedit.h index bc7c544f05..050fdd60a8 100644 --- a/tools/datedit.h +++ b/tools/datedit.h @@ -19,6 +19,10 @@ #ifndef DATEDIT_H #define DATEDIT_H +#ifdef __cplusplus + extern "C" { +#endif + #define DAT_INFO DAT_ID('i','n','f','o') #define DAT_ORIG DAT_ID('O','R','I','G') @@ -152,4 +156,8 @@ extern char grabber_graphic_origin[]; extern char grabber_graphic_date[]; +#ifdef __cplusplus + } +#endif + #endif diff --git a/tools/grabber.c b/tools/grabber.c index e4e177fd49..7176fcd5ac 100644 --- a/tools/grabber.c +++ b/tools/grabber.c @@ -64,6 +64,7 @@ static int busy_mouse = FALSE; static int entered_password = FALSE; static int no_sound = FALSE; +static int autodetect_card = GFX_AUTODETECT; static int view_proc(int, DIALOG *, int); @@ -2607,10 +2608,13 @@ static int sysinfo(void) case OSTYPE_DOSEMU: s = "Linux DOSEMU"; break; case OSTYPE_OPENDOS: s = "Caldera OpenDOS"; break; case OSTYPE_LINUX: s = "Linux"; break; + case OSTYPE_SUNOS: s = "SunOS/Solaris"; break; case OSTYPE_FREEBSD: s = "FreeBSD"; break; + case OSTYPE_NETBSD: s = "NetBSD"; break; + case OSTYPE_IRIX: s = "IRIX"; break; + case OSTYPE_QNX: s = "QNX"; break; case OSTYPE_UNIX: s = "Unix"; break; case OSTYPE_BEOS: s = "BeOS"; break; - case OSTYPE_QNX: s = "QNX"; break; case OSTYPE_MACOS: s = "MacOS"; break; default: s = "Unknown"; break; } @@ -2786,7 +2790,7 @@ static int add_new(int type) /* handle the new object command */ static int new_object(void) { - return add_new((int)active_menu->dp); + return add_new((int)((unsigned long)active_menu->dp)); } @@ -2929,7 +2933,7 @@ static int sheller(void) install_mouse(); install_timer(); - if (set_gfx_mode(GFX_AUTODETECT, oldw, oldh, 0, 0) != 0) { + if (set_gfx_mode(autodetect_card, oldw, oldh, 0, 0) != 0) { destroy_bitmap(my_mouse_pointer); my_mouse_pointer = NULL; destroy_bitmap(my_busy_pointer); @@ -3106,10 +3110,16 @@ int main(int argc, char *argv[]) allegro_init(); for (i=1; i 0) { set_color_depth(bpp); - ret = set_gfx_mode(GFX_AUTODETECT, w, h, 0, 0); + ret = set_gfx_mode(autodetect_card, w, h, 0, 0); } else { for (i=0; color_depths[i]; i++) { bpp = color_depths[i]; set_color_depth(bpp); - ret = set_gfx_mode(GFX_AUTODETECT, w, h, 0, 0); + ret = set_gfx_mode(autodetect_card, w, h, 0, 0); if (ret == 0) break; } @@ -3287,7 +3297,7 @@ int main(int argc, char *argv[]) tmpmenu.proc = new_object; tmpmenu.child = NULL; tmpmenu.flags = 0; - tmpmenu.dp = (void *)datedit_object_info[i]->type; + tmpmenu.dp = (void *)(unsigned long)datedit_object_info[i]->type; add_to_menu(new_menu, &tmpmenu, TRUE, NULL, NULL, 0); } diff --git a/tools/grabber.txt b/tools/grabber.txt index 7abfb0b156..9be5b9a737 100644 --- a/tools/grabber.txt +++ b/tools/grabber.txt @@ -123,9 +123,9 @@ the DAT_ID() macro. Allegro defines the standard properties: For autocropped bitmap objects, the amount of cropping at the top of the image. -The properties "HNAM", "HPRE", "XGRD", "YGRD", "BACK", "DITH" and "PACK", are -also used internally by the grabber, but you can use whatever other ID's you -like to store custom information about your objects. +You can use whatever other ID's you like to store custom information about +your objects (the grabber internally use some other properties stored in a +hidden DAT_INFO object, so they won't conflict with yours). @@ -141,6 +141,12 @@ The grabber accepts a few different commandline options: '-WxH' Sets the screen resolution, eg. -320x200, -1024x768 + + '-windowed' + Forces the grabber to start up in a window. + + '-fullscreen' + Forces the grabber to start up in fullscreen mode. '-nosound' Disables audio output. @@ -316,6 +322,9 @@ line dat utility. This accepts the following options: dat myfile.dat -e * -o c:\output\ + '-g x y w h' + Grabs bitmap data from a specific grid location. + '-h outputfile.h' Sets the output header file, for exporting object index definitions. This may be used on its own to produce a header file from an existing @@ -339,6 +348,15 @@ line dat utility. This accepts the following options: can be used to automatically update the file whenever any of the source data changes. + '-o output' + Sets the output file or directory when extracting data. + + '-p prefixstring' + Sets the prefix for the output header file. + + '-pal objectname' + Specifies which palette to use. + '-s0' - no strip: save everything '-s1' - strip grabber specific information from the file '-s2' - strip all object properties and names from the file @@ -346,6 +364,9 @@ line dat utility. This accepts the following options: strip properties from the datafile, or in combination with any other options. + '-t type' + Sets the object type when adding files. + '-transparency' Preserves transparency when converting between color depths. @@ -356,6 +377,12 @@ line dat utility. This accepts the following options: Selects verbose mode. This can be used in combination with any other options to produce more detailed output. + '-w' + Always updates the entire contents of the datafile. + + '-007 password' + Sets the file encryption key. + ' PROP=value' Sets properties for the specified objects. This works like environment variables, in that setting a property to an empty string removes it. diff --git a/tools/plugins/datgrid.c b/tools/plugins/datgrid.c index c345359b4f..d3772368cf 100644 --- a/tools/plugins/datgrid.c +++ b/tools/plugins/datgrid.c @@ -720,7 +720,7 @@ static int autocrop(void) /* initialisation code for the grab-from-grid plugin */ -void datgrid_init() +void datgrid_init(void) { int i; diff --git a/tools/plugins/datitype.c b/tools/plugins/datitype.c index 023da5ba09..c2a72e453b 100644 --- a/tools/plugins/datitype.c +++ b/tools/plugins/datitype.c @@ -107,7 +107,7 @@ static int do_changetype(DATAFILE *dat, int *param, int type) /* changes the type of bitmap data */ static int changetype(void) { - int type = (int)active_menu->dp; + int type = (int)((unsigned long)active_menu->dp); char buf[80]; int ret, n; int p = 0; @@ -198,7 +198,7 @@ static int do_changedepth(DATAFILE *dat, int *param, int depth) /* changes the color depth of bitmap data */ static int changedepth(void) { - int depth = (int)active_menu->dp; + int depth = (int)((unsigned long)active_menu->dp); char buf[80]; int ret, n; int p = 0; diff --git a/tools/plugins/plugins.txt b/tools/plugins/plugins.txt index e81131cf69..78ebb1c874 100644 --- a/tools/plugins/plugins.txt +++ b/tools/plugins/plugins.txt @@ -61,7 +61,7 @@ The Basics the datafile programs. This script has a different extension for each supported platform, so that your plugin can use different linker options depending on the compiler. The djgpp version uses .scr scripts, Watcom - uses .scw, MSVC uses .scv and Unix uses .scu. + uses .scw, MSVC/BCC use .scv, MinGW uses .scm and Unix uses .scu. There are no restrictions on what names you can give these files other than the required extensions, but to minimise the danger of namespace diff --git a/tools/win/wfixicon.c b/tools/win/wfixicon.c index f9b1f017d6..702d7f0a6d 100644 --- a/tools/win/wfixicon.c +++ b/tools/win/wfixicon.c @@ -300,8 +300,7 @@ int main(int argc, char *argv[]) f = pack_fopen(rc_name, F_WRITE); - strcpy(str, "allegro_icon ICON "); - strcat(str, argv[1]); + sprintf(str, "allegro_icon ICON %s\n", argv[1]); pack_fwrite(str, strlen(str), f); pack_fclose(f); diff --git a/tools/win/wfixicon.txt b/tools/win/wfixicon.txt index 61d3352c16..aad81b4d2a 100644 --- a/tools/win/wfixicon.txt +++ b/tools/win/wfixicon.txt @@ -59,7 +59,7 @@ The wfixicon utility accepts the following options: Allegro Windows executable, with the same effects as described above. -An example of use is provided in the Allegro distribution: once you have -compiled and properly installed the library, type 'make fixdemo' from the -main directory. - +An example of use is provided in the Allegro distribution: the demo program +gets a nice little icon (or an ugly one, it's up to you...) extracted from +its datafile (with the Borland C++ compiler you need to type 'make fixdemo' +from the main directory once you have properly installed the library). diff --git a/xmake.sh b/xmake.sh index 0b850c7350..a144f637c1 100755 --- a/xmake.sh +++ b/xmake.sh @@ -11,6 +11,7 @@ # for the target will be found with standard names. XC_PATH=/usr/local/cross-tools/i386-mingw32msvc/bin:/usr/local/cross-tools/bin +XPREFIX=i386-mingw32msvc- # 2. Put here the path for where things are to be installed. # You should have created the lib, info and include directories @@ -26,7 +27,7 @@ DJDIR=$INSTALL_BASE NATIVEPATH=$PATH PATH=$XC_PATH:$NATIVEPATH -export CROSSCOMPILE MINGDIR DJDIR NATIVEPATH PATH +export CROSSCOMPILE MINGDIR DJDIR NATIVEPATH PATH XPREFIX # Then run make and pass through all command line parameters to it.