mirror of
https://github.com/blendogames/quadrilateralcowboy.git
synced 2024-11-25 05:21:07 +00:00
Enhancement: Unix portability improvements
This commit is contained in:
parent
bbfd0dd909
commit
f51454127f
21 changed files with 45 additions and 37 deletions
|
@ -499,6 +499,12 @@ IF(APPLE)
|
|||
FIND_LIBRARY(IOKIT NAMES IOKit)
|
||||
FIND_LIBRARY(COREAUDIO NAMES CoreAudio)
|
||||
TARGET_LINK_LIBRARIES(qc PUBLIC objc ${OPENGL} ${OPENAL} ${COCOA} ${IOKIT} ${COREAUDIO})
|
||||
# Included OpenAL library doesn't currently compile or link correctly
|
||||
# Modern CMake versions include FindOpenAL module, so use it here
|
||||
ELSEIF(UNIX AND NOT LINUX)
|
||||
FIND_PACKAGE(OpenAL REQUIRED)
|
||||
INCLUDE_DIRECTORIES(${OPENAL_INCLUDE_DIR})
|
||||
TARGET_LINK_LIBRARIES(qc PUBLIC ${OPENAL_LIBRARY})
|
||||
ELSE()
|
||||
TARGET_LINK_LIBRARIES(qc PUBLIC openal)
|
||||
ENDIF()
|
||||
|
|
|
@ -802,7 +802,7 @@ void idTypeInfoGen::CreateTypeInfo( const char *path ) {
|
|||
idFileList *files;
|
||||
idParser src;
|
||||
|
||||
common->Printf( "Type Info Generator v"TYPE_INFO_GEN_VERSION" (c) 2004 id Software\n" );
|
||||
common->Printf( "Type Info Generator v" TYPE_INFO_GEN_VERSION " (c) 2004 id Software\n" );
|
||||
common->Printf( "%s\n", path );
|
||||
|
||||
files = fileSystem->ListFilesTree( path, ".cpp" );
|
||||
|
@ -904,7 +904,7 @@ void idTypeInfoGen::WriteTypeInfo( const char *fileName ) const {
|
|||
"/*\n"
|
||||
"===================================================================================\n"
|
||||
"\n"
|
||||
"\tThis file has been generated with the Type Info Generator v"TYPE_INFO_GEN_VERSION" (c) 2004 id Software\n"
|
||||
"\tThis file has been generated with the Type Info Generator v" TYPE_INFO_GEN_VERSION " (c) 2004 id Software\n"
|
||||
"\n"
|
||||
"\t%d constants\n"
|
||||
"\t%d enums\n"
|
||||
|
|
|
@ -2003,7 +2003,7 @@ void idMultiplayerGame::UpdateMainGui( void ) {
|
|||
mainGui->SetStateString( keyval->GetKey(), keyval->GetValue() );
|
||||
}
|
||||
mainGui->StateChanged( gameLocal.time );
|
||||
#if defined( __linux__ )
|
||||
#if defined( __unix__ )
|
||||
// replacing the oh-so-useful s_reverse with sound backend prompt
|
||||
mainGui->SetStateString( "driver_prompt", "1" );
|
||||
#else
|
||||
|
|
|
@ -108,7 +108,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// atm, we have no useful way to reconstruct the trace, so let's leave it off
|
||||
#define ID_BT_STUB
|
||||
#ifndef ID_BT_STUB
|
||||
#if defined( __linux__ )
|
||||
#if defined( __unix__ ) && !defined(MACOS_X)
|
||||
#if defined( _DEBUG )
|
||||
#define ID_BT_STUB
|
||||
#endif
|
||||
|
|
|
@ -66,7 +66,7 @@ idCVar com_asyncInput( "com_asyncInput", "0", CVAR_BOOL|CVAR_SYSTEM, "sample inp
|
|||
#define ASYNCSOUND_INFO "0: mix sound inline, 1: memory mapped async mix, 2: callback mixing, 3: write async mix"
|
||||
#if defined( MACOS_X )
|
||||
idCVar com_asyncSound( "com_asyncSound", "3", CVAR_INTEGER|CVAR_SYSTEM|CVAR_ROM, ASYNCSOUND_INFO );
|
||||
#elif defined( __linux__ )
|
||||
#elif defined( __unix__ )
|
||||
idCVar com_asyncSound( "com_asyncSound", "3", CVAR_INTEGER|CVAR_SYSTEM|CVAR_ROM, ASYNCSOUND_INFO );
|
||||
#else
|
||||
idCVar com_asyncSound( "com_asyncSound", "1", CVAR_INTEGER|CVAR_SYSTEM, ASYNCSOUND_INFO, 0, 1 );
|
||||
|
@ -2814,7 +2814,7 @@ void idCommonLocal::Init( int argc, const char **argv, const char *cmdline ) {
|
|||
#endif
|
||||
|
||||
// This hint improves relative mouse movement on linux
|
||||
#ifdef __LINUX__
|
||||
#ifdef __unix__
|
||||
SDL_SetHint(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, "1");
|
||||
#endif
|
||||
|
||||
|
|
|
@ -474,7 +474,7 @@ void idSessionLocal::SetMainMenuGuiVars( void ) {
|
|||
//bc
|
||||
//guiMsg->SetStateString( "visible_hasxp", fileSystem->HasD3XP() ? "1" : "0" );
|
||||
|
||||
#if defined( __linux__ )
|
||||
#if defined( __unix__ )
|
||||
guiMainMenu->SetStateString( "driver_prompt", "1" );
|
||||
#else
|
||||
guiMainMenu->SetStateString( "driver_prompt", "0" );
|
||||
|
@ -1358,7 +1358,7 @@ void idSessionLocal::HandleMainMenuCommands( const char *menuCommand ) {
|
|||
break;
|
||||
}
|
||||
} else {
|
||||
#ifndef __linux__
|
||||
#ifndef __unix__
|
||||
// also turn off OpenAL so we fully go back to legacy mixer
|
||||
cvarSystem->SetCVarBool( "s_useOpenAL", false );
|
||||
#endif
|
||||
|
|
|
@ -1485,7 +1485,7 @@ void idMultiplayerGame::UpdateMainGui( void ) {
|
|||
mainGui->SetStateString( keyval->GetKey(), keyval->GetValue() );
|
||||
}
|
||||
mainGui->StateChanged( gameLocal.time );
|
||||
#if defined( __linux__ )
|
||||
#if defined( __unix__ )
|
||||
// replacing the oh-so-useful s_reverse with sound backend prompt
|
||||
mainGui->SetStateString( "driver_prompt", "1" );
|
||||
#else
|
||||
|
|
|
@ -29,7 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "precompiled.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#if defined( MACOS_X )
|
||||
#if defined(__unix__)
|
||||
#include <signal.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
@ -152,7 +152,7 @@ dword PackColor( const idVec4 &color ) {
|
|||
dz = ColorFloatToByte( color.z );
|
||||
dw = ColorFloatToByte( color.w );
|
||||
|
||||
#if defined(_WIN32) || defined(__linux__) || (defined(MACOS_X) && !defined(__ppc__))
|
||||
#if defined(_WIN32) || defined(__unix__) || (defined(MACOS_X) && !defined(__ppc__))
|
||||
return ( dx << 0 ) | ( dy << 8 ) | ( dz << 16 ) | ( dw << 24 );
|
||||
#elif (defined(MACOS_X) && defined(__ppc__))
|
||||
return ( dx << 24 ) | ( dy << 16 ) | ( dz << 8 ) | ( dw << 0 );
|
||||
|
@ -167,7 +167,7 @@ UnpackColor
|
|||
================
|
||||
*/
|
||||
void UnpackColor( const dword color, idVec4 &unpackedColor ) {
|
||||
#if defined(_WIN32) || defined(__linux__) || (defined(MACOS_X) && !defined(__ppc__))
|
||||
#if defined(_WIN32) || defined(__unix__) || (defined(MACOS_X) && !defined(__ppc__))
|
||||
unpackedColor.Set( ( ( color >> 0 ) & 255 ) * ( 1.0f / 255.0f ),
|
||||
( ( color >> 8 ) & 255 ) * ( 1.0f / 255.0f ),
|
||||
( ( color >> 16 ) & 255 ) * ( 1.0f / 255.0f ),
|
||||
|
@ -194,7 +194,7 @@ dword PackColor( const idVec3 &color ) {
|
|||
dy = ColorFloatToByte( color.y );
|
||||
dz = ColorFloatToByte( color.z );
|
||||
|
||||
#if defined(_WIN32) || defined(__linux__) || (defined(MACOS_X) && !defined(__ppc__))
|
||||
#if defined(_WIN32) || defined(__unix__) || (defined(MACOS_X) && !defined(__ppc__))
|
||||
return ( dx << 0 ) | ( dy << 8 ) | ( dz << 16 );
|
||||
#elif (defined(MACOS_X) && defined(__ppc__))
|
||||
return ( dy << 16 ) | ( dz << 8 ) | ( dx << 0 );
|
||||
|
@ -209,7 +209,7 @@ UnpackColor
|
|||
================
|
||||
*/
|
||||
void UnpackColor( const dword color, idVec3 &unpackedColor ) {
|
||||
#if defined(_WIN32) || defined(__linux__) || (defined(MACOS_X) && !defined(__ppc__))
|
||||
#if defined(_WIN32) || defined(__unix__) || (defined(MACOS_X) && !defined(__ppc__))
|
||||
unpackedColor.Set( ( ( color >> 0 ) & 255 ) * ( 1.0f / 255.0f ),
|
||||
( ( color >> 8 ) & 255 ) * ( 1.0f / 255.0f ),
|
||||
( ( color >> 16 ) & 255 ) * ( 1.0f / 255.0f ) );
|
||||
|
@ -581,7 +581,7 @@ void AssertFailed( const char *file, int line, const char *expression ) {
|
|||
#else
|
||||
__asm int 0x03
|
||||
#endif
|
||||
#elif defined( __linux__ )
|
||||
#elif defined( __unix__ )
|
||||
#ifdef __i386__
|
||||
__asm__ __volatile__ ("int $0x03");
|
||||
#else
|
||||
|
|
|
@ -709,9 +709,9 @@ int idParser::ExpandBuiltinDefine( idToken *deftoken, define_t *define, idToken
|
|||
curtime = ctime(&t);
|
||||
(*token) = "\"";
|
||||
token->Append( curtime+4 );
|
||||
token[7] = '\0';
|
||||
token[7] = (const idStr) '\0';
|
||||
token->Append( curtime+20 );
|
||||
token[10] = '\0';
|
||||
token[10] = (const idStr) '\0';
|
||||
token->Append( "\"" );
|
||||
free(curtime);
|
||||
token->type = TT_STRING;
|
||||
|
@ -728,7 +728,7 @@ int idParser::ExpandBuiltinDefine( idToken *deftoken, define_t *define, idToken
|
|||
curtime = ctime(&t);
|
||||
(*token) = "\"";
|
||||
token->Append( curtime+11 );
|
||||
token[8] = '\0';
|
||||
token[8] = (const idStr) '\0';
|
||||
token->Append( "\"" );
|
||||
free(curtime);
|
||||
token->type = TT_STRING;
|
||||
|
|
|
@ -2044,7 +2044,7 @@ bool idFrustum::ProjectionBounds( const idBounds &bounds, idBounds &projectionBo
|
|||
return ProjectionBounds( idBox( bounds, vec3_origin, mat3_identity ), projectionBounds );
|
||||
}
|
||||
|
||||
#ifndef __linux__
|
||||
#ifndef __unix__
|
||||
|
||||
/*
|
||||
============
|
||||
|
|
|
@ -103,11 +103,12 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include <typeinfo>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#ifdef __linux__
|
||||
#include <unistd.h>
|
||||
#elif defined __APPLE__
|
||||
#if defined __APPLE__
|
||||
#include <algorithm>
|
||||
using std::min;
|
||||
// This covers Linux and the BSDs
|
||||
#elif defined __unix__
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------
|
||||
|
|
|
@ -361,7 +361,7 @@ void idTextureLevel::UpdateTile( int localX, int localY, int globalX, int global
|
|||
|
||||
if ( idMegaTexture::r_showMegaTextureLabels.GetBool() ) {
|
||||
// put a color marker in it
|
||||
byte color[4] = { 255 * localX / TILE_PER_LEVEL, 255 * localY / TILE_PER_LEVEL, 0, 0 };
|
||||
byte color[4] = { (byte)(255 * localX / TILE_PER_LEVEL), (byte)(255 * localY / TILE_PER_LEVEL), 0, 0 };
|
||||
for ( int x = 0 ; x < 8 ; x++ ) {
|
||||
for ( int y = 0 ; y < 8 ; y++ ) {
|
||||
*(int *)&data[ ( ( y + TILE_SIZE/2 - 4 ) * TILE_SIZE + x + TILE_SIZE/2 - 4 ) * 4 ] = *(int *)color;
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
#include "jversion.h"
|
||||
#include "jerror.h"
|
||||
|
||||
extern jpg_Error( const char *fmt, ... );
|
||||
extern jpg_Printf( const char *fmt, ... );
|
||||
extern void jpg_Error( const char *fmt, ... );
|
||||
extern void jpg_Printf( const char *fmt, ... );
|
||||
|
||||
#ifndef EXIT_FAILURE /* define exit() codes if not provided */
|
||||
#define EXIT_FAILURE 1
|
||||
|
|
|
@ -42,7 +42,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define GL_GLEXT_LEGACY
|
||||
#include <OpenGL/gl.h>
|
||||
|
||||
#elif defined( __linux__ )
|
||||
#elif defined( __unix__ )
|
||||
|
||||
// using our local glext.h
|
||||
// http://oss.sgi.com/projects/ogl-sample/ABI/
|
||||
|
@ -572,7 +572,7 @@ extern BOOL ( WINAPI * qwglSwapLayerBuffers)(HDC, UINT);
|
|||
|
||||
#endif // _WIN32
|
||||
|
||||
#if defined( __linux__ )
|
||||
#if defined( __unix__ )
|
||||
|
||||
//GLX Functions
|
||||
extern XVisualInfo * (*qglXChooseVisual)( Display *dpy, int screen, int *attribList );
|
||||
|
|
|
@ -366,7 +366,8 @@ void idSoundSystemLocal::Init() {
|
|||
soundCache = new idSoundCache();
|
||||
}
|
||||
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
// Changed this since __unix__ covers Mac OSX, Linux and the BSDs
|
||||
#if defined(__unix__)
|
||||
idSoundSystemLocal::s_useOpenAL.SetBool( true );
|
||||
#endif
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "../renderer/tr_local.h"
|
||||
|
||||
#if !defined(ID_GL_HARDLINK) && defined(__linux__)
|
||||
#if !defined(ID_GL_HARDLINK) && defined(__unix__)
|
||||
#include "linux/local.h"
|
||||
#endif
|
||||
|
||||
|
@ -68,7 +68,7 @@ GLimp_Init
|
|||
bool GLimp_Init(glimpParms_t parms) {
|
||||
common->Printf("Initializing OpenGL subsystem\n");
|
||||
|
||||
#if !defined(ID_GL_HARDLINK) && defined(__linux__)
|
||||
#if !defined(ID_GL_HARDLINK) && defined(__unix__)
|
||||
if ( !GLimp_dlopen() ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ bool GLimp_Init(glimpParms_t parms) {
|
|||
parms.width, parms.height, flags);
|
||||
|
||||
// set the icon for linux.
|
||||
#ifdef __linux__
|
||||
#ifdef __unix__
|
||||
SDL_Surface* iconSurface = SDL_LoadBMP("Icon.bmp");
|
||||
if (iconSurface)
|
||||
{
|
||||
|
|
|
@ -125,10 +125,10 @@ void idSysLocal::DLL_Unload( void* dllHandle ) {
|
|||
void idSysLocal::DLL_GetFileName( const char *baseName, char *dllName, int maxLength ) {
|
||||
#ifdef _WIN32
|
||||
idStr::snPrintf( dllName, maxLength, "%s" CPUSTRING ".dll", baseName );
|
||||
#elif defined( __linux__ )
|
||||
idStr::snPrintf( dllName, maxLength, "%s" CPUSTRING ".so", baseName );
|
||||
#elif defined( MACOS_X )
|
||||
idStr::snPrintf( dllName, maxLength, "%s" ".dylib", baseName );
|
||||
#elif defined( __unix__ )
|
||||
idStr::snPrintf( dllName, maxLength, "%s" CPUSTRING ".so", baseName );
|
||||
#else
|
||||
#error OS define is required
|
||||
#endif
|
||||
|
|
|
@ -133,7 +133,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
// Linux
|
||||
#ifdef __linux__
|
||||
#ifdef __unix__
|
||||
|
||||
#ifdef __i386__
|
||||
#define BUILD_STRING "linux-x86"
|
||||
|
|
|
@ -1871,7 +1871,7 @@ static void APIENTRY logViewport(GLint x, GLint y, GLsizei width, GLsizei height
|
|||
}
|
||||
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef __unix__
|
||||
|
||||
static XVisualInfo * APIENTRY logChooseVisual(Display *dpy, int screen, int *attribList) {
|
||||
// unknown type: "Display *" name: "dpy"
|
||||
|
|
|
@ -1386,7 +1386,7 @@ EXCEPTION_DISPOSITION __cdecl _except_handler( struct _EXCEPTION_RECORD *Excepti
|
|||
|
||||
#if defined(MACOS_X)
|
||||
#define UMP_SKU "OSX"
|
||||
#elif defined( __linux__ )
|
||||
#elif defined( __unix__ )
|
||||
#define UMP_SKU "Linux"
|
||||
#else
|
||||
#define UMP_SKU "Win32"
|
||||
|
|
|
@ -181,7 +181,7 @@ static void LinkEdge( optEdge_t *e ) {
|
|||
e->v2->edges = e;
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef __unix__
|
||||
|
||||
optVertex_t *FindOptVertex( idDrawVert *v, optimizeGroup_t *opt );
|
||||
|
||||
|
|
Loading…
Reference in a new issue