From 33a397c04ba0412fc612ec538d2300575246ccd9 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 1 Sep 2009 02:08:53 +0000 Subject: [PATCH] - Basic Mac support: Everything compiles but does not yet link. SVN r1780 (trunk) --- docs/rh-log.txt | 1 + dumb/src/it/filter.cpp | 2 + lzma/C/Types.h | 4 + src/CMakeLists.txt | 85 +++++++++++++-------- src/doomdef.h | 4 +- src/farchive.cpp | 8 +- src/m_alloc.cpp | 10 ++- src/m_joy.h | 2 + src/m_misc.cpp | 10 +-- src/m_swap.h | 52 ++++++++++++- src/nodebuild.h | 4 +- src/oplsynth/music_opldumper_mididevice.cpp | 2 +- src/p_acs.cpp | 4 +- src/p_writemap.cpp | 10 +-- src/r_blend.h | 2 +- src/r_draw.cpp | 38 ++++++++- src/r_translate.cpp | 4 +- src/sdl/crashcatcher.c | 2 +- src/sdl/i_system.cpp | 17 +++++ src/sound/fmodsound.cpp | 4 + src/sound/music_dumb.cpp | 3 +- src/sound/music_mus_midiout.cpp | 2 +- src/sound/music_timidity_mididevice.cpp | 6 +- src/stats.h | 2 +- src/timidity/instrum_dls.cpp | 4 +- src/v_draw.cpp | 2 +- src/v_palette.cpp | 2 + 27 files changed, 215 insertions(+), 71 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 621461fba2..5f79917b94 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,5 @@ August 31, 2009 +- Basic Mac support: Everything compiles but does not yet link. - Replaced the use of autoconf's WORDS_BIGENDIAN with __BIG_ENDIAN__, since latter comes predefined by GCC. diff --git a/dumb/src/it/filter.cpp b/dumb/src/it/filter.cpp index b21682e819..5eb1f09eae 100644 --- a/dumb/src/it/filter.cpp +++ b/dumb/src/it/filter.cpp @@ -1,3 +1,4 @@ +#if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) #if defined(_DEBUG) && defined(_MSC_VER) #include #endif @@ -277,3 +278,4 @@ static void it_filter_sse(DUMB_CLICK_REMOVER *cr, IT_FILTER_STATE *state, sample state->currsample = currsample; state->prevsample = prevsample; } +#endif diff --git a/lzma/C/Types.h b/lzma/C/Types.h index 818d92d5d0..958b2af2de 100644 --- a/lzma/C/Types.h +++ b/lzma/C/Types.h @@ -34,6 +34,10 @@ typedef int SRes; #define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; } #endif +#if defined(__APPLE__) && !__LP64__ +#define _LZMA_UINT32_IS_ULONG +#endif + #ifndef ZCONF_H typedef unsigned char Byte; #endif diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d3f67baaa3..3b8740693a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -124,21 +124,43 @@ if( WIN32 ) setupapi oleaut32 ) else( WIN32 ) - option( NO_GTK "Disable GTK+ dialogs (Not applicable to Windows)" ) - option( VALGRIND "Add special Valgrind sequences to self-modifying code" ) + if( APPLE ) + set( FMOD_SEARCH_PATHS "/Developer/FMOD Programmers API Mac/api" ) + set( FMOD_INC_PATH_SUFFIXES PATH_SUFFIXES inc ) + set( FMOD_LIB_PATH_SUFFIXES PATH_SUFFIXES lib ) + set( NO_GTK ON ) + else( APPLE ) + option( NO_GTK "Disable GTK+ dialogs (Not applicable to Windows)" ) + option( VALGRIND "Add special Valgrind sequences to self-modifying code" ) - set( FMOD_SEARCH_PATHS - /usr/local/include - /usr/local/include/fmodex - /usr/include - /usr/include/fmodex - /opt/local/include - /opt/local/include/fmodex - /opt/include - /opt/include/fmodex ) - set( FMOD_INC_PATH_SUFFIXES PATH_SUFFIXES fmodex ) + set( FMOD_SEARCH_PATHS + /usr/local/include + /usr/local/include/fmodex + /usr/include + /usr/include/fmodex + /opt/local/include + /opt/local/include/fmodex + /opt/include + /opt/include/fmodex ) + set( FMOD_INC_PATH_SUFFIXES PATH_SUFFIXES fmodex ) + + # Use GTK+ for the IWAD picker, if available. + if( NOT NO_GTK ) + pkg_check_modules( GTK2 gtk+-2.0 ) + if( GTK2_FOUND ) + set( ZDOOM_LIBS ${ZDOOM_LIBS} ${GTK2_LIBRARIES} ) + include_directories( ${GTK2_INCLUDE_DIRS} ) + else( GTK2_FOUND ) + set( NO_GTK ON ) + endif( GTK2_FOUND ) + endif( NOT NO_GTK ) + endif( APPLE ) set( NASM_NAMES nasm ) - + + if( NO_GTK ) + add_definitions( -DNO_GTK=1 ) + endif( NO_GTK ) + # Non-Windows version also needs SDL find_package( SDL ) if( NOT SDL_FOUND ) @@ -147,21 +169,6 @@ else( WIN32 ) set( ZDOOM_LIBS "${SDL_LIBRARY}" ) include_directories( "${SDL_INCLUDE_DIR}" ) - # Use GTK+ for the IWAD picker, if available. - if( NOT NO_GTK ) - pkg_check_modules( GTK2 gtk+-2.0 ) - if( GTK2_FOUND ) - set( ZDOOM_LIBS ${ZDOOM_LIBS} ${GTK2_LIBRARIES} ) - include_directories( ${GTK2_INCLUDE_DIRS} ) - else( GTK2_FOUND ) - set( NO_GTK ON ) - endif( GTK2_FOUND ) - endif( NOT NO_GTK ) - - if( NO_GTK ) - add_definitions( -DNO_GTK=1 ) - endif( NO_GTK ) - find_path( FPU_CONTROL_DIR fpu_control.h ) if( FPU_CONTROL_DIR ) include_directories( ${FPU_CONTROL_DIR} ) @@ -206,15 +213,15 @@ endif( FMOD_INCLUDE_DIR ) # Search for FMOD library -if( WIN32 ) +if( WIN32 OR APPLE ) find_library( FMOD_LIBRARY ${FMOD_LIB_NAME} PATHS ${FMOD_SEARCH_PATHS} ${FMOD_LIB_PATH_SUFFIXES} ) -else( WIN32 ) +else( WIN32 OR APPLE ) find_library( FMOD_LIBRARY NAMES ${FMOD_VERSIONS} PATHS ${FMOD_LOCAL_LIB_DIRS} ) -endif( WIN32 ) +endif( WIN32 OR APPLE ) if( FMOD_LIBRARY ) message( STATUS "FMOD library found at ${FMOD_LIBRARY}" ) @@ -225,6 +232,13 @@ endif( FMOD_LIBRARY ) # Search for NASM +if( CMAKE_SYSTEM_PROCESSOR MATCHES powerpc ) + if( NOT NO_ASM ) + message( STATUS "Disabling assembly code for PowerPC." ) + set( NO_ASM ON ) + endif( NOT NO_ASM ) +endif( CMAKE_SYSTEM_PROCESSOR MATCHES powerpc ) + if( NOT NO_ASM ) if( UNIX AND X64 ) find_program( GAS_PATH as ) @@ -484,10 +498,17 @@ add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) +if( CMAKE_SYSTEM_PROCESSOR MATCHES powerpc ) + set( X86_SOURCES ) +else( CMAKE_SYSTEM_PROCESSOR MATCHES powerpc ) + set( X86_SOURCES nodebuild_classify_sse2.cpp x86.cpp ) +endif( CMAKE_SYSTEM_PROCESSOR MATCHES powerpc ) + add_executable( zdoom WIN32 autostart.cpp ${ASM_SOURCES} ${SYSTEM_SOURCES} + ${SSE_SOURCES} am_map.cpp b_bot.cpp b_func.cpp @@ -550,7 +571,6 @@ add_executable( zdoom WIN32 name.cpp nodebuild.cpp nodebuild_classify_nosse2.cpp - nodebuild_classify_sse2.cpp nodebuild_events.cpp nodebuild_extract.cpp nodebuild_gl.cpp @@ -629,7 +649,6 @@ add_executable( zdoom WIN32 v_video.cpp w_wad.cpp wi_stuff.cpp - x86.cpp zstrformat.cpp zstring.cpp g_doom/a_doommisc.cpp diff --git a/src/doomdef.h b/src/doomdef.h index 3892e8001b..c6402addd7 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -348,9 +348,9 @@ enum #define BLINKTHRESHOLD (4*32) #ifndef __BIG_ENDIAN__ -#define MAKE_ID(a,b,c,d) ((a)|((b)<<8)|((c)<<16)|((d)<<24)) +#define MAKE_ID(a,b,c,d) ((DWORD)((a)|((b)<<8)|((c)<<16)|((d)<<24))) #else -#define MAKE_ID(a,b,c,d) ((d)|((c)<<8)|((b)<<16)|((a)<<24)) +#define MAKE_ID(a,b,c,d) ((DWORD)((d)|((c)<<8)|((b)<<16)|((a)<<24))) #endif #endif // __DOOMDEF_H__ diff --git a/src/farchive.cpp b/src/farchive.cpp index 1a6fba5bf8..f8992b81cc 100644 --- a/src/farchive.cpp +++ b/src/farchive.cpp @@ -80,10 +80,10 @@ #define OLD_SPRITE ((BYTE)12) // Reference to an old sprite name follows #ifdef __BIG_ENDIAN__ -static inline WORD SWAP_WORD(x) { return x; } -static inline DWORD SWAP_DWORD(x) { return x; } -static inline QWORD SWAP_QWORD(x) { return x; } -static inline void SWAP_FLOAT(x) { } +static inline WORD SWAP_WORD(WORD x) { return x; } +static inline DWORD SWAP_DWORD(DWORD x) { return x; } +static inline QWORD SWAP_QWORD(QWORD x) { return x; } +static inline void SWAP_FLOAT(float x) { } static inline void SWAP_DOUBLE(double &dst, double src) { dst = src; } #else #ifdef _MSC_VER diff --git a/src/m_alloc.cpp b/src/m_alloc.cpp index 5271325e73..569b5c94dc 100644 --- a/src/m_alloc.cpp +++ b/src/m_alloc.cpp @@ -32,12 +32,16 @@ ** */ -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) #include #include +#elif defined(__APPLE__) +#include +#include #else #include #endif + #include "i_system.h" #include "dobject.h" @@ -46,7 +50,9 @@ #define _malloc_dbg(s,b,f,l) malloc(s) #define _realloc_dbg(p,s,b,f,l) realloc(p,s) #endif -#ifndef _WIN32 +#if defined(__APPLE__) +#define _msize(p) malloc_size(p) +#elif !defined(_WIN32) #define _msize(p) malloc_usable_size(p) // from glibc/FreeBSD #endif diff --git a/src/m_joy.h b/src/m_joy.h index 92771762b4..2c939f679f 100644 --- a/src/m_joy.h +++ b/src/m_joy.h @@ -20,6 +20,8 @@ enum EJoyAxis // Generic configuration interface for a controller. struct NOVTABLE IJoystickConfig { + virtual ~IJoystickConfig() = 0; + virtual FString GetName() = 0; virtual float GetSensitivity() = 0; virtual void SetSensitivity(float scale) = 0; diff --git a/src/m_misc.cpp b/src/m_misc.cpp index 1592df6a8b..c5fead1158 100644 --- a/src/m_misc.cpp +++ b/src/m_misc.cpp @@ -298,7 +298,7 @@ static long ParseCommandLine (const char *args, int *argc, char **argv) } -#ifdef unix +#if defined(unix) || defined(__APPLE__) FString GetUserFile (const char *file, bool nodir) { FString path; @@ -447,10 +447,10 @@ void WritePCXfile (FILE *file, const BYTE *buffer, const PalEntry *palette, pcx.bits_per_pixel = 8; // 256 (or more) colors pcx.xmin = 0; pcx.ymin = 0; - pcx.xmax = LittleShort(width-1); - pcx.ymax = LittleShort(height-1); - pcx.hdpi = LittleShort(75); - pcx.vdpi = LittleShort(75); + pcx.xmax = LittleShort((unsigned short)(width-1)); + pcx.ymax = LittleShort((unsigned short)(height-1)); + pcx.hdpi = LittleShort((unsigned short)75); + pcx.vdpi = LittleShort((unsigned short)75); memset (pcx.palette, 0, sizeof(pcx.palette)); pcx.reserved = 0; pcx.color_planes = (color_type == SS_PAL) ? 1 : 3; // chunky image diff --git a/src/m_swap.h b/src/m_swap.h index 8379461b4b..473e4b3c7e 100644 --- a/src/m_swap.h +++ b/src/m_swap.h @@ -27,6 +27,56 @@ // Endianess handling. // WAD files are stored little endian. + +#ifdef __APPLE__ +#include + +inline short LittleShort(short x) +{ + return (short)CFSwapInt16LittleToHost((uint16_t)x); +} + +inline unsigned short LittleShort(unsigned short x) +{ + return CFSwapInt16LittleToHost(x); +} + +inline short LittleShort(int x) +{ + return CFSwapInt16LittleToHost((uint16_t)x); +} + +inline int LittleLong(int x) +{ + return CFSwapInt32LittleToHost((uint32_t)x); +} + +inline unsigned int LittleLong(unsigned int x) +{ + return CFSwapInt32LittleToHost(x); +} + +inline short BigShort(short x) +{ + return (short)CFSwapInt16BigToHost((uint16_t)x); +} + +inline unsigned short BigShort(unsigned short x) +{ + return CFSwapInt16BigToHost(x); +} + +inline int BigLong(int x) +{ + return CFSwapInt32BigToHost((uint32_t)x); +} + +inline unsigned int BigLong(unsigned int x) +{ + return CFSwapInt32BigToHost(x); +} + +#else #ifdef __BIG_ENDIAN__ // Swap 16bit, that is, MSB and LSB byte. @@ -123,5 +173,5 @@ inline int BigLong (int x) #endif #endif // __BIG_ENDIAN__ - +#endif // __APPLE__ #endif // __M_SWAP_H__ diff --git a/src/nodebuild.h b/src/nodebuild.h index 1e0a2efaf7..d142a289b6 100644 --- a/src/nodebuild.h +++ b/src/nodebuild.h @@ -272,7 +272,9 @@ inline int FNodeBuilder::PointOnSide (int x, int y, int x1, int y1, int dx, int inline int FNodeBuilder::ClassifyLine (node_t &node, const FPrivSeg *seg, int &sidev1, int &sidev2) { -#ifdef __SSE2__ +#if !defined(_M_IX86) && !defined(_M_X64) && !defined(__i386__) && !defined(__amd64__) + return ClassifyLine2 (node, seg, sidev1, sidev2); +#elif defined(__SSE2__) // If compiling with SSE2 support everywhere, just use the SSE2 version. return ClassifyLineSSE2 (node, seg, sidev1, sidev2); #elif defined(_MSC_VER) && _MSC_VER < 1300 diff --git a/src/oplsynth/music_opldumper_mididevice.cpp b/src/oplsynth/music_opldumper_mididevice.cpp index 39ff5717da..bbc4c9ec4e 100644 --- a/src/oplsynth/music_opldumper_mididevice.cpp +++ b/src/oplsynth/music_opldumper_mididevice.cpp @@ -214,7 +214,7 @@ void DiskWriterIO::OPLdeinit() fseek(File, 12, SEEK_SET); len[0] = LittleLong(CurIntTime); - len[1] = LittleLong(where_am_i - 24); + len[1] = LittleLong(DWORD(where_am_i - 24)); fwrite(len, 4, 2, File); } fclose(File); diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 1a7d9575b5..ac3bfff100 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -1832,8 +1832,8 @@ void DACSThinker::Serialize (FArchive &arc) if (RunningScripts[i]) arc << RunningScripts[i] << i; } - DLevelScript *nil = NULL; - arc << nil; + DLevelScript *nilptr = NULL; + arc << nilptr; } else { diff --git a/src/p_writemap.cpp b/src/p_writemap.cpp index 47af3b37e3..9261ee9040 100644 --- a/src/p_writemap.cpp +++ b/src/p_writemap.cpp @@ -19,7 +19,7 @@ static int WriteBLOCKMAP (FILE *file); static int WriteBEHAVIOR (FILE *file); #define APPEND(pos,name) \ - lumps[pos].FilePos = LittleLong(ftell (file)); \ + lumps[pos].FilePos = LittleLong((int)ftell (file)); \ lumps[pos].Size = LittleLong(Write##name (file)); \ memcpy (lumps[pos].Name, #name, sizeof(#name)-1); @@ -101,8 +101,8 @@ static int WriteTHINGS (FILE *file) mt.x = LittleShort(short(mo->x >> FRACBITS)); mt.y = LittleShort(short(mo->y >> FRACBITS)); mt.angle = LittleShort(short(MulScale32 (mo->angle >> ANGLETOFINESHIFT, 360))); - mt.type = LittleShort(1); - mt.flags = LittleShort(7|224|MTF_SINGLE); + mt.type = LittleShort((short)1); + mt.flags = LittleShort((short)(7|224|MTF_SINGLE)); fwrite (&mt, sizeof(mt), 1, file); return sizeof (mt); } @@ -184,7 +184,7 @@ static int WriteSEGS (FILE *file) ms.v1 = LittleShort(short(segs[i].v1 - vertexes)); ms.v2 = LittleShort(short(segs[i].v2 - vertexes)); ms.linedef = LittleShort(short(segs[i].linedef - lines)); - ms.side = LittleShort(DWORD(segs[i].sidedef - sides) == segs[i].linedef->sidenum[0] ? 0 : 1); + ms.side = DWORD(segs[i].sidedef - sides) == segs[i].linedef->sidenum[0] ? 0 : LittleShort((short)1); ms.angle = LittleShort(short(R_PointToAngle2 (segs[i].v1->x, segs[i].v1->y, segs[i].v2->x, segs[i].v2->y)>>16)); fwrite (&ms, sizeof(ms), 1, file); } @@ -247,7 +247,7 @@ static int WriteSECTORS (FILE *file) ms.ceilingheight = LittleShort(short(sectors[i].GetPlaneTexZ(sector_t::ceiling) >> FRACBITS)); uppercopy (ms.floorpic, GetTextureName (sectors[i].GetTexture(sector_t::floor))); uppercopy (ms.ceilingpic, GetTextureName (sectors[i].GetTexture(sector_t::ceiling))); - ms.lightlevel = LittleShort(sectors[i].lightlevel); + ms.lightlevel = LittleShort((short)sectors[i].lightlevel); ms.special = LittleShort(sectors[i].special); ms.tag = LittleShort(sectors[i].tag); fwrite (&ms, sizeof(ms), 1, file); diff --git a/src/r_blend.h b/src/r_blend.h index a7c9e49d37..fbc478c121 100644 --- a/src/r_blend.h +++ b/src/r_blend.h @@ -129,7 +129,7 @@ private: operator int() const { return STYLE_Normal; } }; -extern const FRenderStyle LegacyRenderStyles[STYLE_Count]; +extern FRenderStyle LegacyRenderStyles[STYLE_Count]; inline FRenderStyle &FRenderStyle::operator= (ERenderStyle legacy) { diff --git a/src/r_draw.cpp b/src/r_draw.cpp index c634650aa3..c9bb8fbec2 100644 --- a/src/r_draw.cpp +++ b/src/r_draw.cpp @@ -125,7 +125,11 @@ FDynamicColormap ShadeFakeColormap[16]; BYTE identitymap[256]; // Convert legacy render styles to flexible render styles. -const FRenderStyle LegacyRenderStyles[STYLE_Count] = + +// Apple's GCC 4.0.1 apparently wants to initialize the AsDWORD member of FRenderStyle +// rather than the struct before it, which goes against the standard. +#ifndef __APPLE__ +FRenderStyle LegacyRenderStyles[STYLE_Count] = { /* STYLE_None */ {{ STYLEOP_None, STYLEALPHA_Zero, STYLEALPHA_Zero, 0 }}, /* STYLE_Normal */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1 }}, @@ -138,6 +142,38 @@ const FRenderStyle LegacyRenderStyles[STYLE_Count] = /* STYLE_Shaded */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed }}, /* STYLE_TranslucentStencil */{{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_ColorIsFixed }}, }; +#else +FRenderStyle LegacyRenderStyles[STYLE_Count]; + +static const BYTE Styles[STYLE_Count * 4] = +{ + STYLEOP_None, STYLEALPHA_Zero, STYLEALPHA_Zero, 0, + STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1, + STYLEOP_Fuzz, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0, + STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_TransSoulsAlpha, + STYLEOP_FuzzOrAdd, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0, + STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1 | STYLEF_ColorIsFixed, + STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0, + STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, 0, + STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed, + STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_ColorIsFixed, +}; + +static struct LegacyInit +{ + LegacyInit() + { + for (int i = 0; i < STYLE_Count; ++i) + { + LegacyRenderStyles[i].BlendOp = Styles[i*4]; + LegacyRenderStyles[i].SrcAlpha = Styles[i*4+1]; + LegacyRenderStyles[i].DestAlpha = Styles[i*4+2]; + LegacyRenderStyles[i].Flags = Styles[i*4+3]; + } + } +} DoLegacyInit; + +#endif FArchive &operator<< (FArchive &arc, FRenderStyle &style) { diff --git a/src/r_translate.cpp b/src/r_translate.cpp index 43bd7bd0b3..b7d3300de6 100644 --- a/src/r_translate.cpp +++ b/src/r_translate.cpp @@ -729,8 +729,8 @@ void R_InitTranslationTables () // Full alpha for (i = 0; i < 16; ++i) { - ShadeFakeColormap[i].Color = -1; - ShadeFakeColormap[i].Desaturate = -1; + ShadeFakeColormap[i].Color = ~0u; + ShadeFakeColormap[i].Desaturate = ~0u; ShadeFakeColormap[i].Next = NULL; ShadeFakeColormap[i].Maps = table; diff --git a/src/sdl/crashcatcher.c b/src/sdl/crashcatcher.c index f1d5f26cd1..3a4c5a0ce4 100644 --- a/src/sdl/crashcatcher.c +++ b/src/sdl/crashcatcher.c @@ -383,7 +383,7 @@ int cc_install_handlers(int num_signals, int *signals, const char *logfile, int sa.sa_sigaction = crash_catcher; -#ifndef __FreeBSD__ +#if !defined(__FreeBSD__) && !defined(__APPLE__) sa.sa_flags = SA_ONESHOT | SA_NODEFER | SA_SIGINFO; #else sa.sa_flags = SA_NODEFER | SA_SIGINFO; diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp index b24b2e04a3..6b942a8cf9 100644 --- a/src/sdl/i_system.cpp +++ b/src/sdl/i_system.cpp @@ -511,7 +511,11 @@ bool I_WriteIniFailed () static const char *pattern; +#ifdef __APPLE__ +static int matchfile (struct dirent *ent) +#else static int matchfile (const struct dirent *ent) +#endif { return fnmatch (pattern, ent->d_name, FNM_NOESCAPE) == 0; } @@ -643,3 +647,16 @@ unsigned int I_MakeRNGSeed() return seed; } +#if !defined(__amd64__) && !defined(__i386__) +extern "C" CPUInfo CPU; + +void CheckCPUID(CPUInfo *cpu) +{ + memset(cpu, 0, sizeof(*cpu)); + cpu->DataL1LineSize = 32; // Assume a 32-byte cache line +} + +void DumpCPUInfo(const CPUInfo *cpu) +{ +} +#endif diff --git a/src/sound/fmodsound.cpp b/src/sound/fmodsound.cpp index 0a09e69a01..2fc37322de 100644 --- a/src/sound/fmodsound.cpp +++ b/src/sound/fmodsound.cpp @@ -44,7 +44,11 @@ extern HWND Window; #define FALSE 0 #define TRUE 1 #endif +#ifdef __APPLE__ +#include +#else #include +#endif #include "templates.h" #include "fmodsound.h" diff --git a/src/sound/music_dumb.cpp b/src/sound/music_dumb.cpp index 3ba117fd11..3b6f29c5c3 100644 --- a/src/sound/music_dumb.cpp +++ b/src/sound/music_dumb.cpp @@ -73,8 +73,7 @@ protected: static bool read(SoundStream *stream, void *buff, int len, void *userdata); }; -#pragma pack(push) -#pragma pack(1) +#pragma pack(push, 1) typedef struct tagITFILEHEADER { diff --git a/src/sound/music_mus_midiout.cpp b/src/sound/music_mus_midiout.cpp index b46cbbaa7b..fcdf704bd0 100644 --- a/src/sound/music_mus_midiout.cpp +++ b/src/sound/music_mus_midiout.cpp @@ -33,7 +33,7 @@ // HEADER FILES ------------------------------------------------------------ -#ifndef __FreeBSD__ +#if !defined(__FreeBSD__) && !defined(__APPLE__) #include #else #include diff --git a/src/sound/music_timidity_mididevice.cpp b/src/sound/music_timidity_mididevice.cpp index a96b06bcc9..a13f46e61f 100644 --- a/src/sound/music_timidity_mididevice.cpp +++ b/src/sound/music_timidity_mididevice.cpp @@ -663,7 +663,7 @@ TimidityWaveWriterMIDIDevice::TimidityWaveWriterMIDIDevice(const char *filename, if (3 != fwrite(work, 4, 3, File)) goto fail; fmt.ChunkID = MAKE_ID('f','m','t',' '); - fmt.ChunkLen = LittleLong(sizeof(fmt) - 8); + fmt.ChunkLen = LittleLong(DWORD(sizeof(fmt) - 8)); fmt.FormatTag = LittleShort(0xFFFE); // WAVE_FORMAT_EXTENSIBLE fmt.Channels = LittleShort(2); fmt.SamplesPerSec = LittleLong((int)Renderer->rate); @@ -712,12 +712,12 @@ TimidityWaveWriterMIDIDevice::~TimidityWaveWriterMIDIDevice() DWORD size; // data chunk size - size = LittleLong(pos - 8); + size = LittleLong(DWORD(pos - 8)); if (0 == fseek(File, 4, SEEK_SET)) { if (1 == fwrite(&size, 4, 1, File)) { - size = LittleLong(pos - 12 - sizeof(FmtChunk) - 8); + size = LittleLong(DWORD(pos - 12 - sizeof(FmtChunk) - 8)); if (0 == fseek(File, 4 + sizeof(FmtChunk) + 4, SEEK_CUR)) { if (1 == fwrite(&size, 4, 1, File)) diff --git a/src/stats.h b/src/stats.h index 65be6867a6..13608f7502 100644 --- a/src/stats.h +++ b/src/stats.h @@ -36,7 +36,7 @@ #include "zstring.h" -#ifdef unix +#ifndef _WIN32 #ifdef NO_CLOCK_GETTIME class cycle_t diff --git a/src/timidity/instrum_dls.cpp b/src/timidity/instrum_dls.cpp index 5be96f7169..0243461e61 100644 --- a/src/timidity/instrum_dls.cpp +++ b/src/timidity/instrum_dls.cpp @@ -435,8 +435,8 @@ static void Parse_wlnk(DLS_Data *data, RIFF_Chunk *chunk, DLS_Region *region) WAVELINK *wlnk = (WAVELINK *)chunk->data; wlnk->fusOptions = LittleShort(wlnk->fusOptions); wlnk->usPhaseGroup = LittleShort(wlnk->usPhaseGroup); - wlnk->ulChannel = LittleShort(wlnk->ulChannel); - wlnk->ulTableIndex = LittleShort(wlnk->ulTableIndex); + wlnk->ulChannel = LittleLong((unsigned int)wlnk->ulChannel); + wlnk->ulTableIndex = LittleLong((unsigned int)wlnk->ulTableIndex); region->wlnk = wlnk; } diff --git a/src/v_draw.cpp b/src/v_draw.cpp index 33933427c0..659a2f5026 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -578,7 +578,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, int x, int y, DWORD tag, va_l break; case DTA_RenderStyle: - parms->style = va_arg (tags, FRenderStyle); + parms->style.AsDWORD = va_arg (tags, DWORD); break; } tag = va_arg (tags, DWORD); diff --git a/src/v_palette.cpp b/src/v_palette.cpp index 504a47cb29..921093433e 100644 --- a/src/v_palette.cpp +++ b/src/v_palette.cpp @@ -488,6 +488,7 @@ void DoBlending (const PalEntry *from, PalEntry *to, int count, int r, int g, in to[i] = t; } } +#if defined(_M_X64) || defined(_M_IX86) || defined(__i386__) || defined(__amd64__) else if (CPU.bSSE2) { if (count >= 4) @@ -503,6 +504,7 @@ void DoBlending (const PalEntry *from, PalEntry *to, int count, int r, int g, in to += not3count; } } +#endif #ifdef X86_ASM else if (CPU.bMMX) {