mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2024-12-03 17:32:30 +00:00
AStyle
This commit is contained in:
parent
9c2124718f
commit
05248cce6d
7 changed files with 70 additions and 70 deletions
|
@ -419,7 +419,7 @@ bool Sys_SignalWait( signalHandle_t& handle, int timeout )
|
|||
else
|
||||
{
|
||||
timespec ts;
|
||||
|
||||
|
||||
clock_gettime( CLOCK_REALTIME, &ts );
|
||||
|
||||
// DG: handle timeouts > 1s better
|
||||
|
|
|
@ -98,12 +98,12 @@ typedef enum
|
|||
//#define AL_ALEXT_PROTOTYPES
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenAL/al.h>
|
||||
#include <OpenAL/alc.h>
|
||||
#include <OpenAL/al.h>
|
||||
#include <OpenAL/alc.h>
|
||||
#else
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
#include <AL/alext.h>
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
#include <AL/alext.h>
|
||||
#endif
|
||||
|
||||
#include "OpenAL/AL_SoundSample.h"
|
||||
|
|
|
@ -220,9 +220,9 @@ double Sys_GetClockTicks()
|
|||
//#error unsupported CPU
|
||||
// RB begin
|
||||
struct timespec now;
|
||||
|
||||
|
||||
clock_gettime( CLOCK_MONOTONIC, &now );
|
||||
|
||||
|
||||
return now.tv_sec * 1000000000LL + now.tv_nsec;
|
||||
// RB end
|
||||
#endif
|
||||
|
@ -415,44 +415,44 @@ returns in megabytes
|
|||
================
|
||||
*/
|
||||
int Sys_GetSystemRam()
|
||||
{
|
||||
{
|
||||
int mb;
|
||||
|
||||
#if defined(__APPLE__)
|
||||
int mib[2];
|
||||
mib[0] = CTL_HW;
|
||||
mib[1] = HW_MEMSIZE;
|
||||
int64_t size = 0;
|
||||
size_t len = sizeof( size );
|
||||
if ( sysctl( mib, 2, &size, &len, NULL, 0 ) == 0 )
|
||||
{
|
||||
mb = size / ( 1024 * 1024 );
|
||||
mb = ( mb + 8 ) & ~15;
|
||||
return mb;
|
||||
}
|
||||
|
||||
common->Printf( "GetSystemRam: sysctl HW_MEMSIZE failed\n" );
|
||||
return 512;
|
||||
#else
|
||||
long count, page_size;
|
||||
|
||||
count = sysconf( _SC_PHYS_PAGES );
|
||||
if( count == -1 )
|
||||
{
|
||||
common->Printf( "GetSystemRam: sysconf _SC_PHYS_PAGES failed\n" );
|
||||
return 512;
|
||||
}
|
||||
page_size = sysconf( _SC_PAGE_SIZE );
|
||||
if( page_size == -1 )
|
||||
{
|
||||
common->Printf( "GetSystemRam: sysconf _SC_PAGE_SIZE failed\n" );
|
||||
return 512;
|
||||
}
|
||||
mb = ( int )( ( double )count * ( double )page_size / ( 1024 * 1024 ) );
|
||||
// round to the nearest 16Mb
|
||||
|
||||
#if defined(__APPLE__)
|
||||
int mib[2];
|
||||
mib[0] = CTL_HW;
|
||||
mib[1] = HW_MEMSIZE;
|
||||
int64_t size = 0;
|
||||
size_t len = sizeof( size );
|
||||
if( sysctl( mib, 2, &size, &len, NULL, 0 ) == 0 )
|
||||
{
|
||||
mb = size / ( 1024 * 1024 );
|
||||
mb = ( mb + 8 ) & ~15;
|
||||
return mb;
|
||||
#endif
|
||||
}
|
||||
|
||||
common->Printf( "GetSystemRam: sysctl HW_MEMSIZE failed\n" );
|
||||
return 512;
|
||||
#else
|
||||
long count, page_size;
|
||||
|
||||
count = sysconf( _SC_PHYS_PAGES );
|
||||
if( count == -1 )
|
||||
{
|
||||
common->Printf( "GetSystemRam: sysconf _SC_PHYS_PAGES failed\n" );
|
||||
return 512;
|
||||
}
|
||||
page_size = sysconf( _SC_PAGE_SIZE );
|
||||
if( page_size == -1 )
|
||||
{
|
||||
common->Printf( "GetSystemRam: sysconf _SC_PAGE_SIZE failed\n" );
|
||||
return 512;
|
||||
}
|
||||
mb = ( int )( ( double )count * ( double )page_size / ( 1024 * 1024 ) );
|
||||
// round to the nearest 16Mb
|
||||
mb = ( mb + 8 ) & ~15;
|
||||
return mb;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -198,9 +198,9 @@ Sys_Milliseconds
|
|||
|
||||
#ifdef __APPLE__
|
||||
// OS X doesn't have clock_gettime()
|
||||
int clock_gettime(clk_id_t clock, struct timespec *tp)
|
||||
int clock_gettime( clk_id_t clock, struct timespec* tp )
|
||||
{
|
||||
switch(clock)
|
||||
switch( clock )
|
||||
{
|
||||
case CLOCK_MONOTONIC_RAW:
|
||||
case CLOCK_MONOTONIC:
|
||||
|
@ -208,29 +208,29 @@ int clock_gettime(clk_id_t clock, struct timespec *tp)
|
|||
clock_serv_t clock_ref;
|
||||
mach_timespec_t tm;
|
||||
host_name_port_t self = mach_host_self();
|
||||
memset(&tm, 0, sizeof(tm));
|
||||
if (KERN_SUCCESS != host_get_clock_service(self, SYSTEM_CLOCK, &clock_ref))
|
||||
memset( &tm, 0, sizeof( tm ) );
|
||||
if( KERN_SUCCESS != host_get_clock_service( self, SYSTEM_CLOCK, &clock_ref ) )
|
||||
{
|
||||
mach_port_deallocate(mach_task_self(), self);
|
||||
mach_port_deallocate( mach_task_self(), self );
|
||||
return -1;
|
||||
}
|
||||
if (KERN_SUCCESS != clock_get_time(clock_ref, &tm))
|
||||
if( KERN_SUCCESS != clock_get_time( clock_ref, &tm ) )
|
||||
{
|
||||
mach_port_deallocate(mach_task_self(), self);
|
||||
mach_port_deallocate( mach_task_self(), self );
|
||||
return -1;
|
||||
}
|
||||
mach_port_deallocate(mach_task_self(), self);
|
||||
mach_port_deallocate(mach_task_self(), clock_ref);
|
||||
mach_port_deallocate( mach_task_self(), self );
|
||||
mach_port_deallocate( mach_task_self(), clock_ref );
|
||||
tp->tv_sec = tm.tv_sec;
|
||||
tp->tv_nsec = tm.tv_nsec;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case CLOCK_REALTIME:
|
||||
default:
|
||||
{
|
||||
struct timeval now;
|
||||
if (KERN_SUCCESS != gettimeofday(&now, NULL))
|
||||
if( KERN_SUCCESS != gettimeofday( &now, NULL ) )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ uint64 Sys_Microseconds()
|
|||
#else
|
||||
uint64 curtime;
|
||||
struct timespec ts;
|
||||
|
||||
|
||||
clock_gettime( D3_CLOCK_TO_USE, &ts );
|
||||
|
||||
if( !sys_microTimeBase )
|
||||
|
|
|
@ -61,7 +61,7 @@ char* Posix_ConsoleInput();
|
|||
|
||||
#ifdef __APPLE__
|
||||
enum clk_id_t { CLOCK_REALTIME, CLOCK_MONOTONIC, CLOCK_MONOTONIC_RAW };
|
||||
int clock_gettime(clk_id_t clock, struct timespec *tp);
|
||||
int clock_gettime( clk_id_t clock, struct timespec* tp );
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -935,7 +935,7 @@ sysEvent_t Sys_GetEvent()
|
|||
|
||||
return res_none;
|
||||
#endif
|
||||
|
||||
|
||||
case SDL_MOUSEMOTION:
|
||||
// DG: return event with absolute mouse-coordinates when in menu
|
||||
// to fix cursor problems in windowed mode
|
||||
|
@ -955,7 +955,7 @@ sysEvent_t Sys_GetEvent()
|
|||
|
||||
mouse_polls.Append( mouse_poll_t( M_DELTAX, ev.motion.xrel ) );
|
||||
mouse_polls.Append( mouse_poll_t( M_DELTAY, ev.motion.yrel ) );
|
||||
|
||||
|
||||
return res;
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
|
@ -963,7 +963,7 @@ sysEvent_t Sys_GetEvent()
|
|||
case SDL_FINGERUP:
|
||||
case SDL_FINGERMOTION:
|
||||
return res_none; // Avoid 'unknown event' spam when testing with touchpad
|
||||
|
||||
|
||||
case SDL_MOUSEWHEEL:
|
||||
res.evType = SE_KEY;
|
||||
|
||||
|
|
|
@ -188,10 +188,10 @@ bool GLimp_Init( glimpParms_t parms )
|
|||
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
|
||||
#ifdef __APPLE__
|
||||
r_useOpenGL32.SetInteger( 2 ); // only core profile is supported on OS X
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
r_useOpenGL32.SetInteger( 2 ); // only core profile is supported on OS X
|
||||
#endif
|
||||
|
||||
// RB begin
|
||||
if( r_useOpenGL32.GetInteger() > 0 )
|
||||
{
|
||||
|
@ -213,7 +213,7 @@ bool GLimp_Init( glimpParms_t parms )
|
|||
SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE );
|
||||
}
|
||||
// RB end
|
||||
|
||||
|
||||
// DG: set display num for fullscreen
|
||||
int windowPos = SDL_WINDOWPOS_UNDEFINED;
|
||||
if( parms.fullScreen > 0 )
|
||||
|
@ -242,7 +242,7 @@ bool GLimp_Init( glimpParms_t parms )
|
|||
windowPos,
|
||||
parms.width, parms.height, flags );
|
||||
// DG end
|
||||
|
||||
|
||||
context = SDL_GL_CreateContext( window );
|
||||
|
||||
if( !window )
|
||||
|
@ -307,10 +307,10 @@ bool GLimp_Init( glimpParms_t parms )
|
|||
common->Printf( "No usable GL mode found: %s", SDL_GetError() );
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
glewExperimental = GL_TRUE;
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
glewExperimental = GL_TRUE;
|
||||
#endif
|
||||
|
||||
GLenum glewResult = glewInit();
|
||||
if( GLEW_OK != glewResult )
|
||||
|
@ -322,7 +322,7 @@ bool GLimp_Init( glimpParms_t parms )
|
|||
{
|
||||
common->Printf( "Using GLEW %s\n", glewGetString( GLEW_VERSION ) );
|
||||
}
|
||||
|
||||
|
||||
// DG: disable cursor, we have two cursors in menu (because mouse isn't grabbed in menu)
|
||||
SDL_ShowCursor( SDL_DISABLE );
|
||||
// DG end
|
||||
|
|
Loading…
Reference in a new issue