From 8867476913dec98bd657e75ccb5ffe79404ae7ec Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Mon, 22 Jul 2002 02:17:10 +0000 Subject: [PATCH] OS X stuff --- arch/linux/findfile.c | 13 ++----------- arch/ogl/gr.c | 39 ++++++++++----------------------------- arch/ogl/ogl.c | 28 ++++++---------------------- arch/sdl/init.c | 33 +++++---------------------------- arch/sdl/joy.c | 26 ++++++-------------------- include/byteswap.h | 5 ++--- include/ogl_init.h | 4 ++++ include/pstypes.h | 2 +- main/console.c | 11 +++++++---- main/state.c | 13 ++++++++++--- mem/mem.c | 16 +++++----------- 11 files changed, 58 insertions(+), 132 deletions(-) diff --git a/arch/linux/findfile.c b/arch/linux/findfile.c index a1cc47e0..abeb97d4 100644 --- a/arch/linux/findfile.c +++ b/arch/linux/findfile.c @@ -1,17 +1,8 @@ +/* $ Id: $ */ /* - * $Source: /cvs/cvsroot/d2x/arch/linux/findfile.c,v $ - * $Revision: 1.4 $ - * $Author: bradleyb $ - * $Date: 2001-10-19 07:39:25 $ * * Linux findfile functions * - * $Log: not supported by cvs2svn $ - * Revision 1.3 2001/10/19 07:29:36 bradleyb - * Brought linux networking in line with d1x, moved some arch/linux_* stuff to arch/linux/ - * - * Revision 1.2 2001/01/29 13:35:08 bradleyb - * Fixed build system, minor fixes * */ @@ -39,7 +30,7 @@ int FileFindFirst(char *search_str, FILEFINDSTRUCT *ffstruct) Assert(ffstruct != NULL); r = glob(search_str, 0, NULL, &glob_a); - if (r == GLOB_NOMATCH) return -1; + if (r) return 1; glob_whichfile = 0; diff --git a/arch/ogl/gr.c b/arch/ogl/gr.c index 0065c5bb..e6d4f550 100644 --- a/arch/ogl/gr.c +++ b/arch/ogl/gr.c @@ -1,35 +1,8 @@ +/* $ Id: $ */ /* - * $Source: /cvs/cvsroot/d2x/arch/ogl/gr.c,v $ - * $Revision: 1.5 $ - * $Author: bradleyb $ - * $Date: 2001-11-09 06:53:37 $ * - * // OGL video functions. - Added 9/15/99 Matthew Mueller + * OGL video functions. - Added 9/15/99 Matthew Mueller * - * $Log: not supported by cvs2svn $ - * Revision 1.4 2001/11/08 10:19:52 bradleyb - * use new d_realloc function, so mem manager doesn't die - * - * Revision 1.3 2001/11/04 09:00:25 bradleyb - * Enable d1x-style hud_message - * - * Revision 1.2 2001/10/31 07:35:47 bradleyb - * Sync with d1x - * - * Revision 1.1 2001/10/25 08:25:34 bradleyb - * Finished moving stuff to arch/blah. I know, it's ugly, but It'll be easier to sync with d1x. - * - * Revision 1.7 2001/10/25 02:23:48 bradleyb - * formatting fix - * - * Revision 1.6 2001/10/18 23:59:23 bradleyb - * Changed __ENV_LINUX__ to __linux__ - * - * Revision 1.5 2001/10/12 00:18:40 bradleyb - * Switched from Cygwin to mingw32 on MS boxes. Vastly improved compilability. - * - * Revision 1.4 2001/01/29 13:47:52 bradleyb - * Fixed build, some minor cleanups. * */ @@ -44,7 +17,11 @@ #include #endif +#ifdef __MACOSX__ +//#include +#else //#include +#endif #include #include #include @@ -71,7 +48,11 @@ #define DECLARE_VARS #include "ogl_init.h" +#ifdef __MACOSX__ +#include +#else #include +#endif int ogl_voodoohack=0; diff --git a/arch/ogl/ogl.c b/arch/ogl/ogl.c index 936878e6..eb5103d4 100644 --- a/arch/ogl/ogl.c +++ b/arch/ogl/ogl.c @@ -1,29 +1,8 @@ +/* $ Id: $ */ /* - * $Source: /cvs/cvsroot/d2x/arch/ogl/ogl.c,v $ - * $Revision: 1.2 $ - * $Author: bradleyb $ - * $Date: 2001-10-31 07:35:47 $ * * Graphics support functions for OpenGL. * - * $Log: not supported by cvs2svn $ - * Revision 1.1 2001/10/25 08:25:34 bradleyb - * Finished moving stuff to arch/blah. I know, it's ugly, but It'll be easier to sync with d1x. - * - * Revision 1.7 2001/10/12 00:18:40 bradleyb - * Switched from Cygwin to mingw32 on MS boxes. Vastly improved compilability. - * - * Revision 1.6 2001/10/09 03:00:08 bradleyb - * opengl improvments (following d1x changes) - * - * Revision 1.5 2001/10/09 02:38:52 bradleyb - * re-imported d1x version of this file - * - * Revision 1.4 2001/01/31 16:31:14 bradleyb - * OpenGL support under Cygwin/SDL - * - * Revision 1.3 2001/01/29 13:47:52 bradleyb - * Fixed build, some minor cleanups. * */ @@ -36,8 +15,13 @@ #include #include #endif +#ifdef __MACOSX__ +#include +#include +#else #include #include +#endif #include #include diff --git a/arch/sdl/init.c b/arch/sdl/init.c index 3a1485e6..093ad888 100644 --- a/arch/sdl/init.c +++ b/arch/sdl/init.c @@ -1,29 +1,8 @@ +/* $ Id: $ */ /* - * $Source: /cvs/cvsroot/d2x/arch/sdl/init.c,v $ - * $Revision: 1.9 $ - * $Author: bradleyb $ - * $Date: 2002-07-16 22:37:14 $ * * SDL architecture support * - * $Log: not supported by cvs2svn $ - * Revision 1.8 2001/12/03 02:45:02 bradleyb - * fix formatting - * - * Revision 1.7 2001/12/03 02:43:02 bradleyb - * lots of makefile fixes, and sdl joystick stuff - * - * Revision 1.6 2001/11/14 03:56:16 bradleyb - * SDL joystick stuff - * - * Revision 1.5 2001/10/31 07:41:54 bradleyb - * Sync with d1x - * - * Revision 1.4 2001/10/19 09:45:02 bradleyb - * Moved arch/sdl_* to arch/sdl - * - * Revision 1.4 2001/01/29 13:35:09 bradleyb - * Fixed build system, minor fixes * */ @@ -49,14 +28,12 @@ void sdl_close() void arch_sdl_init() { - // Initialise the library - if (SDL_Init(SDL_INIT_JOYSTICK #if defined(SDL_VIDEO) || defined(SDL_GL_VIDEO) - | SDL_INIT_VIDEO -#endif - ) < 0) { - Error("SDL library initialisation failed: %s.",SDL_GetError()); + if (SDL_Init(SDL_INIT_VIDEO) < 0) + { + Error("SDL library video initialisation failed: %s.",SDL_GetError()); } +#endif #ifdef SDL_INPUT if (!FindArg("-nomouse")) d_mouse_init(); diff --git a/arch/sdl/joy.c b/arch/sdl/joy.c index 3b838e9c..1aa5ba22 100644 --- a/arch/sdl/joy.c +++ b/arch/sdl/joy.c @@ -1,27 +1,8 @@ +/* $ Id: $ */ /* - * $Source: /cvs/cvsroot/d2x/arch/sdl/joy.c,v $ - * $Revision: 1.5 $ - * $Author: bradleyb $ - * $Date: 2002-07-16 22:03:45 $ * * SDL joystick support * - * $Log: not supported by cvs2svn $ - * Revision 1.4 2002/03/23 09:13:00 bradleyb - * SDL Joystick works\! - * - * Revision 1.3 2002/03/05 12:13:33 bradleyb - * SDL joystick stuff mostly done - * - * Revision 1.2 2001/12/03 02:43:02 bradleyb - * lots of makefile fixes, and sdl joystick stuff - * - * Revision 1.1 2001/10/24 09:25:05 bradleyb - * Moved input stuff to arch subdirs, as in d1x. - * - * Revision 1.1 2001/10/10 03:01:29 bradleyb - * Replacing win32 joystick (broken) with SDL joystick (stubs) - * * */ @@ -113,6 +94,11 @@ int joy_init() { int i,j,n; + if (SDL_Init(SDL_INIT_JOYSTICK) < 0) { + con_printf(CON_VERBOSE, "sdl-joystick: initialisation failed: %s.",SDL_GetError()); + return 0; + } + memset(&Joystick,0,sizeof(Joystick)); n = SDL_NumJoysticks(); diff --git a/include/byteswap.h b/include/byteswap.h index be6868ce..2933aa90 100644 --- a/include/byteswap.h +++ b/include/byteswap.h @@ -1,3 +1,4 @@ +/* $ Id: $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -11,8 +12,6 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ - - #ifndef _BYTESWAP_H #define _BYTESWAP_H @@ -24,7 +23,7 @@ extern uint swapint(uint i); #endif #define SWAPSHORT(x) (((ubyte)x << 8) | (((ushort)x) >> 8)) -#define SWAPINT(x) ((x<<24) | (((ulong)x) >> 24) | ((x &0x0000ff00) << 8) | ((x & 0x00ff00000) >> 8)) +#define SWAPINT(x) ((x<<24) | (((uint)x) >> 24) | ((x &0x0000ff00) << 8) | ((x & 0x00ff0000) >> 8)) #ifndef WORDS_BIGENDIAN //MACINTOSH #define INTEL_INT(x) x diff --git a/include/ogl_init.h b/include/ogl_init.h index c4a2df64..53782101 100644 --- a/include/ogl_init.h +++ b/include/ogl_init.h @@ -15,7 +15,11 @@ #include "loadgl.h" int ogl_init_load_library(void); #else +#ifdef __MACOSX__ +#include +#else #include +#endif //######hack, since multi texture support is not working #undef GL_ARB_multitexture #undef GL_SGIS_multitexture diff --git a/include/pstypes.h b/include/pstypes.h index 80930dd1..75267cd6 100644 --- a/include/pstypes.h +++ b/include/pstypes.h @@ -41,7 +41,7 @@ typedef uint64_t u_int64_t; typedef uint32_t u_int32_t; typedef uint16_t u_int16_t; -#elif defined __linux__ +#elif defined __unix__ # include # define _MAX_PATH 1024 # define _MAX_DIR 256 diff --git a/main/console.c b/main/console.c index 09f2192f..a5ec6ce4 100644 --- a/main/console.c +++ b/main/console.c @@ -1,12 +1,15 @@ /* * $Source: /cvs/cvsroot/d2x/main/console.c,v $ - * $Revision: 1.5 $ - * $Author: bradleyb $ - * $Date: 2001-10-19 09:47:34 $ + * $Revision: 1.6 $ + * $Author: btb $ + * $Date: 2002-07-22 02:17:10 $ * * FIXME: put description here * * $Log: not supported by cvs2svn $ + * Revision 1.5 2001/10/19 09:47:34 bradleyb + * RCS headers added + * * */ @@ -25,7 +28,7 @@ #include "console.h" #include "cmd.h" -#if defined(__linux__) || defined(__MINGW32__) +#ifndef __MSDOS__ int text_console_enabled = 1; #else int isvga(); diff --git a/main/state.c b/main/state.c index b4c70e0b..88f92ba1 100644 --- a/main/state.c +++ b/main/state.c @@ -13,13 +13,16 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. /* * $Source: /cvs/cvsroot/d2x/main/state.c,v $ - * $Revision: 1.5 $ - * $Author: bradleyb $ - * $Date: 2001-11-09 11:40:25 $ + * $Revision: 1.6 $ + * $Author: btb $ + * $Date: 2002-07-22 02:17:10 $ * * Game save/restore functions * * $Log: not supported by cvs2svn $ + * Revision 1.5 2001/11/09 11:40:25 bradleyb + * Enabled savegame thumbnails under OpenGL + * * */ @@ -43,8 +46,12 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #endif #ifdef OGL +#ifdef __MACOSX__ +#include +#else #include #endif +#endif #include "pstypes.h" #include "pa_enabl.h" //$$POLY_ACC diff --git a/mem/mem.c b/mem/mem.c index 52a0c31b..67ec22ef 100644 --- a/mem/mem.c +++ b/mem/mem.c @@ -1,3 +1,4 @@ +/* $ Id: $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -12,19 +13,9 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ /* - * $Source: /cvs/cvsroot/d2x/mem/mem.c,v $ - * $Revision: 1.7 $ - * $Author: bradleyb $ - * $Date: 2001-11-09 06:56:41 $ * * Files for debugging memory allocator * - * $Log: not supported by cvs2svn $ - * Revision 1.6 2001/11/08 10:17:40 bradleyb - * added d_realloc/mem_realloc functions - * - * Revision 1.5 2001/10/19 08:06:20 bradleyb - * Partial application of linux/alpha patch. Courtesy of Falk Hueffner * */ @@ -43,8 +34,11 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include #include #include +#ifdef __MACOSX__ +#include +#else #include - +#endif #include "pstypes.h" #include "mono.h" #include "error.h" -- 2.39.2