mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-01 23:20:44 +00:00
Merge branch 'master' into glew and fixed a crash on Intel HD drivers
This commit is contained in:
commit
aefa4ac6e3
68 changed files with 3941 additions and 3693 deletions
|
@ -712,16 +712,10 @@ file(GLOB_RECURSE WIN32_INCLUDES sys/win32/*.h)
|
|||
#file(GLOB_RECURSE WIN32_SOURCES sys/win32/*.cpp)
|
||||
|
||||
set(WIN32_SOURCES
|
||||
sys/win32/win_achievements.cpp
|
||||
sys/win32/win_glimp.cpp
|
||||
sys/win32/win_input.cpp
|
||||
sys/win32/win_localuser.cpp
|
||||
sys/win32/win_main.cpp
|
||||
sys/win32/win_net.cpp
|
||||
sys/win32/win_savegame.cpp
|
||||
sys/win32/win_session_local.cpp
|
||||
sys/win32/win_shared.cpp
|
||||
sys/win32/win_signin.cpp
|
||||
sys/win32/win_snd.cpp
|
||||
sys/win32/win_syscon.cpp
|
||||
sys/win32/win_taskkeyhook.cpp
|
||||
|
@ -807,6 +801,9 @@ set(WIN32_RESOURCES
|
|||
file(GLOB POSIX_INCLUDES sys/posix/*.h)
|
||||
file(GLOB POSIX_SOURCES sys/posix/*.cpp)
|
||||
|
||||
file(GLOB COMMON_INCLUDES sys/common/*.h)
|
||||
file(GLOB COMMON_SOURCES sys/common/*.cpp)
|
||||
|
||||
file(GLOB SDL_INCLUDES sys/sdl/*.h)
|
||||
file(GLOB SDL_SOURCES sys/sdl/*.cpp)
|
||||
|
||||
|
@ -908,6 +905,9 @@ source_group("sys\\win32\\Resources" FILES ${WIN32_RESOURCES})
|
|||
source_group("sys\\posix" FILES ${POSIX_INCLUDES})
|
||||
source_group("sys\\posix" FILES ${POSIX_SOURCES})
|
||||
|
||||
source_group("sys\\common" FILES ${COMMON_INCLUDES})
|
||||
source_group("sys\\common" FILES ${COMMON_SOURCES})
|
||||
|
||||
source_group("sys\\sdl" FILES ${SDL_INCLUDES})
|
||||
source_group("sys\\sdl" FILES ${SDL_SOURCES})
|
||||
|
||||
|
@ -985,6 +985,7 @@ set(RBDOOM3_INCLUDES
|
|||
#${OGGVORBIS_INCLUDES}
|
||||
${UI_INCLUDES}
|
||||
${SWF_INCLUDES}
|
||||
${COMMON_INCLUDES}
|
||||
|
||||
#${COMPILER_INCLUDES}
|
||||
#${COMPILER_AAS_INCLUDES} ${COMPILER_AAS_SOURCES}
|
||||
|
@ -1010,6 +1011,7 @@ set(RBDOOM3_SOURCES
|
|||
#${OGGVORBIS_INCLUDES} ${OGGVORBIS_SOURCES}
|
||||
${UI_SOURCES}
|
||||
${SWF_SOURCES}
|
||||
${COMMON_SOURCES}
|
||||
|
||||
#${COMPILER_AAS_SOURCES}
|
||||
#${COMPILER_DMAP_SOURCES}
|
||||
|
@ -1368,7 +1370,7 @@ else()
|
|||
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
IF("${CMAKE_SYSTEM}" MATCHES "Linux")
|
||||
target_link_libraries(RBDoom3BFG
|
||||
idlib
|
||||
GL
|
||||
|
@ -1379,5 +1381,16 @@ else()
|
|||
${OPENAL_LIBRARY}
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
IF("${CMAKE_SYSTEM}" MATCHES "FreeBSD")
|
||||
target_link_libraries(RBDoom3BFG
|
||||
idlib
|
||||
GL
|
||||
pthread
|
||||
rt
|
||||
${SDLx_LIBRARY}
|
||||
${OPENAL_LIBRARY}
|
||||
)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
|
|
@ -27,7 +27,6 @@ If you have questions concerning this license or the applicable additional terms
|
|||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -279,7 +279,9 @@ idCVar g_gun_z( "g_gunZ", "0", CVAR_GAME | CVAR_ARCHIVE | CVAR_FLOAT,
|
|||
idCVar g_gunScale( "g_gunScale", "1", CVAR_GAME | CVAR_ARCHIVE | CVAR_FLOAT, "" );
|
||||
idCVar g_viewNodalX( "g_viewNodalX", "3", CVAR_GAME | CVAR_FLOAT, "" );
|
||||
idCVar g_viewNodalZ( "g_viewNodalZ", "6", CVAR_GAME | CVAR_FLOAT, "" );
|
||||
idCVar g_fov( "g_fov", "80", CVAR_GAME | CVAR_INTEGER | CVAR_NOCHEAT, "" );
|
||||
// RB: fixed missing CVAR_ARCHIVE
|
||||
idCVar g_fov( "g_fov", "80", CVAR_GAME | CVAR_ARCHIVE | CVAR_INTEGER | CVAR_NOCHEAT, "" );
|
||||
// RB end
|
||||
idCVar g_skipViewEffects( "g_skipViewEffects", "0", CVAR_GAME | CVAR_BOOL, "skip damage and other view effects" );
|
||||
idCVar g_mpWeaponAngleScale( "g_mpWeaponAngleScale", "0", CVAR_GAME | CVAR_FLOAT, "Control the weapon sway in MP" );
|
||||
|
||||
|
|
|
@ -219,12 +219,10 @@ void idMenuScreen_Shell_Stereoscopics::HideScreen( const mainMenuTransition_t tr
|
|||
common->Dialog().ClearDialog( msg );
|
||||
if( restart )
|
||||
{
|
||||
idStr cmdLine = Sys_GetCmdLine();
|
||||
if( cmdLine.Find( "com_skipIntroVideos" ) < 0 )
|
||||
{
|
||||
cmdLine.Append( " +set com_skipIntroVideos 1" );
|
||||
}
|
||||
Sys_ReLaunch( ( void* )cmdLine.c_str(), cmdLine.Length() );
|
||||
// DG: Sys_ReLaunch() doesn't need any options anymore
|
||||
// (the old way would have been unnecessarily painful on POSIX systems)
|
||||
Sys_ReLaunch();
|
||||
// DG end
|
||||
}
|
||||
return idSWFScriptVar();
|
||||
}
|
||||
|
|
|
@ -232,12 +232,10 @@ void idMenuScreen_Shell_SystemOptions::HideScreen( const mainMenuTransition_t tr
|
|||
common->Dialog().ClearDialog( msg );
|
||||
if( restart )
|
||||
{
|
||||
idStr cmdLine = Sys_GetCmdLine();
|
||||
if( cmdLine.Find( "com_skipIntroVideos" ) < 0 )
|
||||
{
|
||||
cmdLine.Append( " +set com_skipIntroVideos 1" );
|
||||
}
|
||||
Sys_ReLaunch( ( void* )cmdLine.c_str(), cmdLine.Length() );
|
||||
// DG: Sys_ReLaunch() doesn't need any options anymore
|
||||
// (the old way would have been unnecessarily painful on POSIX systems)
|
||||
Sys_ReLaunch();
|
||||
// DG end
|
||||
}
|
||||
return idSWFScriptVar();
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@ typedef enum
|
|||
CVAR_GUI = BIT( 6 ), // gui variable
|
||||
CVAR_GAME = BIT( 7 ), // game variable
|
||||
CVAR_TOOL = BIT( 8 ), // tool variable
|
||||
// original doom3 used to have CVAR_USERINFO ("sent to servers, available to menu") here
|
||||
CVAR_SERVERINFO = BIT( 10 ), // sent from servers, available to menu
|
||||
CVAR_NETWORKSYNC = BIT( 11 ), // cvar is synced from the server to clients
|
||||
CVAR_STATIC = BIT( 12 ), // statically declared, not user created
|
||||
|
|
|
@ -74,7 +74,9 @@ idCVar com_allowConsole( "com_allowConsole", "1", CVAR_BOOL | CVAR_SYSTEM | CVAR
|
|||
|
||||
idCVar com_developer( "developer", "0", CVAR_BOOL | CVAR_SYSTEM | CVAR_NOCHEAT, "developer mode" );
|
||||
idCVar com_speeds( "com_speeds", "0", CVAR_BOOL | CVAR_SYSTEM | CVAR_NOCHEAT, "show engine timings" );
|
||||
idCVar com_showFPS( "com_showFPS", "0", CVAR_BOOL | CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_NOCHEAT, "show frames rendered per second" );
|
||||
// DG: support "com_showFPS 2" for fps-only view like in classic doom3 => make it CVAR_INTEGER
|
||||
idCVar com_showFPS( "com_showFPS", "0", CVAR_INTEGER | CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_NOCHEAT, "show frames rendered per second. 0: off 1: default bfg values, 2: only show FPS (classic view)" );
|
||||
// DG end
|
||||
idCVar com_showMemoryUsage( "com_showMemoryUsage", "0", CVAR_BOOL | CVAR_SYSTEM | CVAR_NOCHEAT, "show total and per frame memory usage" );
|
||||
idCVar com_updateLoadSize( "com_updateLoadSize", "0", CVAR_BOOL | CVAR_SYSTEM | CVAR_NOCHEAT, "update the load size after loading a map" );
|
||||
|
||||
|
@ -87,7 +89,7 @@ idCVar preload_CommonAssets( "preload_CommonAssets", "1", CVAR_SYSTEM | CVAR_BOO
|
|||
idCVar net_inviteOnly( "net_inviteOnly", "1", CVAR_BOOL | CVAR_ARCHIVE, "whether or not the private server you create allows friends to join or invite only" );
|
||||
|
||||
// DG: add cvar for pause
|
||||
idCVar com_pause( "com_pause", "0", CVAR_BOOL | CVAR_SYSTEM , "set to 1 to pause game, to 0 to unpause again" );
|
||||
idCVar com_pause( "com_pause", "0", CVAR_BOOL | CVAR_SYSTEM | CVAR_NOCHEAT, "set to 1 to pause game, to 0 to unpause again" );
|
||||
// DG end
|
||||
|
||||
extern idCVar g_demoMode;
|
||||
|
|
|
@ -183,7 +183,7 @@ void idCommonLocal::VPrintf( const char* fmt, va_list args )
|
|||
#if defined(_WIN32)
|
||||
OutputDebugString( msg );
|
||||
#else
|
||||
printf( msg );
|
||||
printf( "%s", msg );
|
||||
#endif
|
||||
// RB end
|
||||
return;
|
||||
|
|
|
@ -240,6 +240,13 @@ float idConsoleLocal::DrawFPS( float y )
|
|||
|
||||
y += BIGCHAR_HEIGHT + 4;
|
||||
|
||||
// DG: "com_showFPS 2" means: show FPS only, like in classic doom3
|
||||
if( com_showFPS.GetInteger() == 2 )
|
||||
{
|
||||
return y;
|
||||
}
|
||||
// DG end
|
||||
|
||||
// print the resolution scale so we can tell when we are at reduced resolution
|
||||
idStr resolutionText;
|
||||
resolutionScale.GetConsoleText( resolutionText );
|
||||
|
|
|
@ -411,7 +411,10 @@ bool idFile_SaveGamePipelined::OpenForWriting( const char* const filename, bool
|
|||
{
|
||||
compressThread = new( TAG_IDFILE ) idSGFcompressThread();
|
||||
compressThread->sgf = this;
|
||||
compressThread->StartWorkerThread( "SGF_CompressThread", CORE_2B, THREAD_NORMAL );
|
||||
// DG: change threadname from "SGF_CompressThread" to "SGF_Compress", because Linux
|
||||
// has a 15 (+ \0) char limit for threadnames. also, "thread" in a threadname is redundant
|
||||
compressThread->StartWorkerThread( "SGF_Compress", CORE_2B, THREAD_NORMAL );
|
||||
// DG end
|
||||
}
|
||||
if( nativeFile != NULL && sgf_threads.GetInteger() >= 2 )
|
||||
{
|
||||
|
@ -468,7 +471,10 @@ bool idFile_SaveGamePipelined::OpenForWriting( idFile* file )
|
|||
{
|
||||
compressThread = new( TAG_IDFILE ) idSGFcompressThread();
|
||||
compressThread->sgf = this;
|
||||
compressThread->StartWorkerThread( "SGF_CompressThread", CORE_2B, THREAD_NORMAL );
|
||||
// DG: change threadname from "SGF_CompressThread" to "SGF_Compress", because Linux
|
||||
// has a 15 (+ \0) char limit for threadnames. also, "thread" in a threadname is redundant
|
||||
compressThread->StartWorkerThread( "SGF_Compress", CORE_2B, THREAD_NORMAL );
|
||||
// DG end
|
||||
}
|
||||
if( nativeFile != NULL && sgf_threads.GetInteger() >= 2 )
|
||||
{
|
||||
|
@ -810,7 +816,10 @@ bool idFile_SaveGamePipelined::OpenForReading( const char* const filename, bool
|
|||
{
|
||||
decompressThread = new( TAG_IDFILE ) idSGFdecompressThread();
|
||||
decompressThread->sgf = this;
|
||||
decompressThread->StartWorkerThread( "SGF_DecompressThread", CORE_2B, THREAD_NORMAL );
|
||||
// DG: change threadname from "SGF_DecompressThread" to "SGF_Decompress", because Linux
|
||||
// has a 15 (+ \0) char limit for threadnames. also, "thread" in a threadname is redundant
|
||||
decompressThread->StartWorkerThread( "SGF_Decompress", CORE_2B, THREAD_NORMAL );
|
||||
// DG end
|
||||
}
|
||||
if( nativeFile != NULL && sgf_threads.GetInteger() >= 2 )
|
||||
{
|
||||
|
@ -857,7 +866,10 @@ bool idFile_SaveGamePipelined::OpenForReading( idFile* file )
|
|||
{
|
||||
decompressThread = new( TAG_IDFILE ) idSGFdecompressThread();
|
||||
decompressThread->sgf = this;
|
||||
decompressThread->StartWorkerThread( "SGF_DecompressThread", CORE_1B, THREAD_NORMAL );
|
||||
// DG: change threadname from "SGF_DecompressThread" to "SGF_Decompress", because Linux
|
||||
// has a 15 (+ \0) char limit for threadnames. also, "thread" in a threadname is redundant
|
||||
decompressThread->StartWorkerThread( "SGF_Decompress", CORE_1B, THREAD_NORMAL );
|
||||
// DG end
|
||||
}
|
||||
if( nativeFile != NULL && sgf_threads.GetInteger() >= 2 )
|
||||
{
|
||||
|
|
|
@ -374,6 +374,7 @@ int idBitMsg::ReadBits( int numBits ) const
|
|||
}
|
||||
fraction = readData[readCount - 1];
|
||||
fraction >>= readBit;
|
||||
// this doesn't really do anything: the bits set to 0 here are already shifted to 0
|
||||
fraction &= ( 1 << get ) - 1;
|
||||
value |= fraction << valueBits;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// memory allocation all in one place
|
||||
//
|
||||
//===============================================================
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#undef new
|
||||
|
||||
/*
|
||||
|
|
|
@ -1107,7 +1107,13 @@ idJobThread::Start
|
|||
void idJobThread::Start( core_t core, unsigned int threadNum )
|
||||
{
|
||||
this->threadNum = threadNum;
|
||||
StartWorkerThread( va( "JobListProcessor_%d", threadNum ), core, THREAD_NORMAL, JOB_THREAD_STACK_SIZE );
|
||||
// DG: change threadname from "JobListProcessor_%d" to "JLProc_%d", because Linux
|
||||
// has a 15 (+ \0) char limit for threadnames.
|
||||
// furthermore: va is not thread safe, use snPrintf instead
|
||||
char name[16];
|
||||
idStr::snPrintf( name, 16, "JLProc_%d", threadNum );
|
||||
StartWorkerThread( name, core, THREAD_NORMAL, JOB_THREAD_STACK_SIZE );
|
||||
// DG end
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1493,4 +1499,4 @@ void idParallelJobManagerLocal::Submit( idParallelJobList_Threads* jobList, int
|
|||
threads[i].AddJobList( jobList );
|
||||
threads[i].SignalWork();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,17 +51,21 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// RB begin
|
||||
#if defined(__MINGW32__)
|
||||
//#include <sal.h> // RB: missing __analysis_assume
|
||||
#include <malloc.h> // DG: _alloca16 needs that
|
||||
|
||||
#ifndef __analysis_assume
|
||||
#define __analysis_assume( x )
|
||||
#endif
|
||||
|
||||
#include <malloc.h> // DG: _alloca16 needs that
|
||||
|
||||
#elif defined(__linux__)
|
||||
#include <malloc.h> // DG: _alloca16 needs that
|
||||
#include <signal.h>
|
||||
// RB end
|
||||
// Yamagi begin
|
||||
#elif defined(__FreeBSD__)
|
||||
#include <signal.h>
|
||||
#endif
|
||||
// RB end
|
||||
// Yamagi end
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <intrin.h>
|
||||
|
|
|
@ -93,8 +93,6 @@ that a thread can wait on for it to be raised. It's used to indicate data is av
|
|||
a thread has reached a specific point.
|
||||
================================================
|
||||
*/
|
||||
// RB begin
|
||||
#if defined(_WIN32)
|
||||
class idSysSignal
|
||||
{
|
||||
public:
|
||||
|
@ -132,36 +130,6 @@ private:
|
|||
idSysSignal( const idSysSignal& s ) {}
|
||||
void operator=( const idSysSignal& s ) {}
|
||||
};
|
||||
#else
|
||||
class idSysSignal
|
||||
{
|
||||
public:
|
||||
static const int WAIT_INFINITE = -1;
|
||||
|
||||
idSysSignal( bool manualReset = false );
|
||||
~idSysSignal();
|
||||
|
||||
void Raise();
|
||||
|
||||
void Clear();
|
||||
|
||||
// Wait returns true if the object is in a signalled state and
|
||||
// returns false if the wait timed out. Wait also clears the signalled
|
||||
// state when the signalled state is reached within the time out period.
|
||||
bool Wait( int timeout = WAIT_INFINITE );
|
||||
|
||||
private:
|
||||
pthread_mutex_t mutex;
|
||||
pthread_cond_t cond;
|
||||
bool signaled;
|
||||
int signalCounter;
|
||||
bool waiting;
|
||||
bool manualReset;
|
||||
|
||||
idSysSignal( const idSysSignal& s ) {}
|
||||
void operator=( const idSysSignal& s ) {}
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
================================================
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2012 Robert Beckebans
|
||||
Copyright (C) 2012-2013 Robert Beckebans
|
||||
Copyright (C) 2013 Daniel Gibson
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
|
@ -29,11 +30,63 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#pragma hdrstop
|
||||
#include "../../precompiled.h"
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <pthread_ng.h> // for pthread_set_name_np
|
||||
#endif
|
||||
|
||||
// DG: Note: On Linux you need at least (e)glibc 2.12 to be able to set the threadname
|
||||
//#define DEBUG_THREADS
|
||||
|
||||
typedef void* ( *pthread_function_t )( void* );
|
||||
|
||||
/*
|
||||
========================
|
||||
Sys_SetThreadName
|
||||
|
||||
caedes: This should be seen as a helper-function for Sys_CreateThread() only.
|
||||
(re)setting the name of a running thread seems like a bad idea and
|
||||
currently (fresh d3 bfg source) isn't done anyway.
|
||||
Furthermore SDL doesn't support it
|
||||
|
||||
========================
|
||||
*/
|
||||
#ifdef DEBUG_THREADS
|
||||
static int Sys_SetThreadName( pthread_t handle, const char* name )
|
||||
{
|
||||
int ret = 0;
|
||||
#ifdef __linux__
|
||||
// NOTE: linux only supports threadnames up to 16chars *including* terminating NULL
|
||||
// http://man7.org/linux/man-pages/man3/pthread_setname_np.3.html
|
||||
// on my machine a longer name (eg "JobListProcessor_0") caused an ENOENT error (instead of ERANGE)
|
||||
assert( strlen( name ) < 16 );
|
||||
|
||||
ret = pthread_setname_np( handle, name );
|
||||
if( ret != 0 )
|
||||
idLib::common->Printf( "Setting threadname \"%s\" failed, reason: %s (%i)\n", name, strerror( errno ), errno );
|
||||
// pthread_getname_np(pthread_t, char*, size_t)
|
||||
#elif defined(__FreeBSD__)
|
||||
// according to http://www.freebsd.org/cgi/man.cgi?query=pthread_set_name_np&sektion=3
|
||||
// the interface is void pthread_set_name_np(pthread_t tid, const char *name);
|
||||
pthread_set_name_np( handle, name ); // doesn't return anything
|
||||
// seems like there is no get_name equivalent
|
||||
#endif
|
||||
/* TODO: OSX:
|
||||
// according to http://stackoverflow.com/a/7989973
|
||||
// this needs to be called in the thread to be named!
|
||||
ret = pthread_setname_np(name);
|
||||
// int pthread_getname_np(pthread_t, char*, size_t);
|
||||
|
||||
// so we'd have to wrap the xthread_t function in Sys_CreateThread and set the name in the wrapping function...
|
||||
*/
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// TODO: Sys_GetThreadName() ?
|
||||
#endif // DEBUG_THREADS
|
||||
|
||||
|
||||
|
||||
/*
|
||||
========================
|
||||
Sys_Createthread
|
||||
|
@ -41,8 +94,6 @@ Sys_Createthread
|
|||
*/
|
||||
uintptr_t Sys_CreateThread( xthread_t function, void* parms, xthreadPriority priority, const char* name, core_t core, int stackSize, bool suspended )
|
||||
{
|
||||
//Sys_EnterCriticalSection();
|
||||
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init( &attr );
|
||||
|
||||
|
@ -58,37 +109,85 @@ uintptr_t Sys_CreateThread( xthread_t function, void* parms, xthreadPriority pri
|
|||
idLib::common->FatalError( "ERROR: pthread_create %s failed\n", name );
|
||||
return ( uintptr_t )0;
|
||||
}
|
||||
pthread_attr_destroy( &attr );
|
||||
|
||||
// RB: TODO pthread_setname_np is different on Linux, MacOSX and other systems
|
||||
#if defined(DEBUG_THREADS)
|
||||
if( pthread_setname_np( handle, name ) != 0 )
|
||||
if( Sys_SetThreadName( handle, name ) != 0 )
|
||||
{
|
||||
idLib::common->FatalError( "ERROR: pthread_setname_np %s failed\n", name );
|
||||
idLib::common->Warning( "Warning: pthread_setname_np %s failed\n", name );
|
||||
return ( uintptr_t )0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
TODO RB: support thread priorities?
|
||||
pthread_attr_destroy( &attr );
|
||||
|
||||
|
||||
#if 0
|
||||
// RB: realtime policies require root privileges
|
||||
|
||||
// all Linux threads have one of the following scheduling policies:
|
||||
|
||||
// SCHED_OTHER or SCHED_NORMAL: the default policy, priority: [-20..0..19], default 0
|
||||
|
||||
// SCHED_FIFO: first in/first out realtime policy
|
||||
|
||||
// SCHED_RR: round-robin realtime policy
|
||||
|
||||
// SCHED_BATCH: similar to SCHED_OTHER, but with a throughput orientation
|
||||
|
||||
// SCHED_IDLE: lower priority than SCHED_OTHER
|
||||
|
||||
int schedulePolicy = SCHED_OTHER;
|
||||
struct sched_param scheduleParam;
|
||||
|
||||
int error = pthread_getschedparam( handle, &schedulePolicy, &scheduleParam );
|
||||
if( error != 0 )
|
||||
{
|
||||
idLib::common->FatalError( "ERROR: pthread_getschedparam %s failed: %s\n", name, strerror( error ) );
|
||||
return ( uintptr_t )0;
|
||||
}
|
||||
|
||||
schedulePolicy = SCHED_FIFO;
|
||||
|
||||
int minPriority = sched_get_priority_min( schedulePolicy );
|
||||
int maxPriority = sched_get_priority_max( schedulePolicy );
|
||||
|
||||
if( priority == THREAD_HIGHEST )
|
||||
{
|
||||
SetThreadPriority( ( HANDLE )handle, THREAD_PRIORITY_HIGHEST ); // we better sleep enough to do this
|
||||
// we better sleep enough to do this
|
||||
scheduleParam.__sched_priority = maxPriority;
|
||||
}
|
||||
else if( priority == THREAD_ABOVE_NORMAL )
|
||||
{
|
||||
SetThreadPriority( ( HANDLE )handle, THREAD_PRIORITY_ABOVE_NORMAL );
|
||||
scheduleParam.__sched_priority = Lerp( minPriority, maxPriority, 0.75f );
|
||||
}
|
||||
else if( priority == THREAD_NORMAL )
|
||||
{
|
||||
scheduleParam.__sched_priority = Lerp( minPriority, maxPriority, 0.5f );
|
||||
}
|
||||
else if( priority == THREAD_BELOW_NORMAL )
|
||||
{
|
||||
SetThreadPriority( ( HANDLE )handle, THREAD_PRIORITY_BELOW_NORMAL );
|
||||
scheduleParam.__sched_priority = Lerp( minPriority, maxPriority, 0.25f );
|
||||
}
|
||||
else if( priority == THREAD_LOWEST )
|
||||
{
|
||||
SetThreadPriority( ( HANDLE )handle, THREAD_PRIORITY_LOWEST );
|
||||
scheduleParam.__sched_priority = minPriority;
|
||||
}
|
||||
*/
|
||||
|
||||
// set new priority
|
||||
error = pthread_setschedparam( handle, schedulePolicy, &scheduleParam );
|
||||
if( error != 0 )
|
||||
{
|
||||
idLib::common->FatalError( "ERROR: pthread_setschedparam( name = %s, policy = %i, priority = %i ) failed: %s\n", name, schedulePolicy, scheduleParam.__sched_priority, strerror( error ) );
|
||||
return ( uintptr_t )0;
|
||||
}
|
||||
|
||||
pthread_getschedparam( handle, &schedulePolicy, &scheduleParam );
|
||||
if( error != 0 )
|
||||
{
|
||||
idLib::common->FatalError( "ERROR: pthread_getschedparam %s failed: %s\n", name, strerror( error ) );
|
||||
return ( uintptr_t )0;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Under Linux, we don't set the thread affinity and let the OS deal with scheduling
|
||||
|
||||
|
@ -103,7 +202,14 @@ Sys_GetCurrentThreadID
|
|||
*/
|
||||
uintptr_t Sys_GetCurrentThreadID()
|
||||
{
|
||||
return pthread_self();
|
||||
/*
|
||||
* This cast is safe because pthread_self()
|
||||
* returns a pointer and uintptr_t is
|
||||
* designed to hold a pointer. The compiler
|
||||
* is just too stupid to know. :)
|
||||
* -- Yamagi
|
||||
*/
|
||||
return ( uintptr_t )pthread_self();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -156,8 +262,23 @@ void Sys_Yield()
|
|||
================================================================================================
|
||||
*/
|
||||
|
||||
idSysSignal::idSysSignal( bool manualReset )
|
||||
/*
|
||||
========================
|
||||
Sys_SignalCreate
|
||||
========================
|
||||
*/
|
||||
void Sys_SignalCreate( signalHandle_t& handle, bool manualReset )
|
||||
{
|
||||
// handle = CreateEvent( NULL, manualReset, FALSE, NULL );
|
||||
|
||||
handle.manualReset = manualReset;
|
||||
// if this is true, the signal is only set to nonsignaled when Clear() is called,
|
||||
// else it's "auto-reset" and the state is set to !signaled after a single waiting
|
||||
// thread has been released
|
||||
|
||||
// the inital state is always "not signaled"
|
||||
handle.signaled = false;
|
||||
handle.waiting = 0;
|
||||
#if 0
|
||||
pthread_mutexattr_t attr;
|
||||
|
||||
|
@ -167,119 +288,138 @@ idSysSignal::idSysSignal( bool manualReset )
|
|||
pthread_mutex_init( &mutex, &attr );
|
||||
pthread_mutexattr_destroy( &attr );
|
||||
#else
|
||||
pthread_mutex_init( &mutex, NULL );
|
||||
pthread_mutex_init( &handle.mutex, NULL );
|
||||
#endif
|
||||
|
||||
pthread_cond_init( &cond, NULL );
|
||||
pthread_cond_init( &handle.cond, NULL );
|
||||
|
||||
signaled = false;
|
||||
signalCounter = 0;
|
||||
waiting = false;
|
||||
this->manualReset = manualReset;
|
||||
}
|
||||
|
||||
idSysSignal::~idSysSignal()
|
||||
/*
|
||||
========================
|
||||
Sys_SignalDestroy
|
||||
========================
|
||||
*/
|
||||
void Sys_SignalDestroy( signalHandle_t& handle )
|
||||
{
|
||||
pthread_cond_destroy( &cond );
|
||||
pthread_mutex_destroy( &mutex );
|
||||
// CloseHandle( handle );
|
||||
handle.signaled = false;
|
||||
handle.waiting = 0;
|
||||
pthread_mutex_destroy( &handle.mutex );
|
||||
pthread_cond_destroy( &handle.cond );
|
||||
}
|
||||
|
||||
void idSysSignal::Raise()
|
||||
/*
|
||||
========================
|
||||
Sys_SignalRaise
|
||||
========================
|
||||
*/
|
||||
void Sys_SignalRaise( signalHandle_t& handle )
|
||||
{
|
||||
pthread_mutex_lock( &mutex );
|
||||
// SetEvent( handle );
|
||||
pthread_mutex_lock( &handle.mutex );
|
||||
|
||||
//if( waiting )
|
||||
if( handle.manualReset )
|
||||
{
|
||||
//pthread_cond_signal( &cond );
|
||||
//pthread_cond_broadcast( &cond );
|
||||
}
|
||||
//else
|
||||
if( !signaled )
|
||||
{
|
||||
// emulate Windows behaviour: if no thread is waiting, leave the signal on so next wait keeps going
|
||||
signaled = true;
|
||||
signalCounter++;
|
||||
|
||||
pthread_cond_signal( &cond );
|
||||
//pthread_cond_broadcast( &cond );
|
||||
}
|
||||
|
||||
pthread_mutex_unlock( &mutex );
|
||||
}
|
||||
|
||||
void idSysSignal::Clear()
|
||||
{
|
||||
pthread_mutex_lock( &mutex );
|
||||
|
||||
signaled = false;
|
||||
|
||||
pthread_mutex_unlock( &mutex );
|
||||
}
|
||||
|
||||
// Wait returns true if the object is in a signalled state and
|
||||
// returns false if the wait timed out. Wait also clears the signalled
|
||||
// state when the signalled state is reached within the time out period.
|
||||
bool idSysSignal::Wait( int timeout )
|
||||
{
|
||||
pthread_mutex_lock( &mutex );
|
||||
|
||||
int result = 0;
|
||||
|
||||
#if 1
|
||||
assert( !waiting ); // WaitForEvent from multiple threads? that wouldn't be good
|
||||
|
||||
if( signaled )
|
||||
{
|
||||
if( !manualReset )
|
||||
{
|
||||
// emulate Windows behaviour: signal has been raised already. clear and keep going
|
||||
signaled = false;
|
||||
result = 0;
|
||||
}
|
||||
// signaled until reset
|
||||
handle.signaled = true;
|
||||
// wake *all* threads waiting on this cond
|
||||
pthread_cond_broadcast( &handle.cond );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
|
||||
#if 0
|
||||
|
||||
int signalValue = signalCounter;
|
||||
//while( !signaled && signalValue == signalCounter )
|
||||
#endif
|
||||
// automode: signaled until first thread is released
|
||||
if( handle.waiting > 0 )
|
||||
{
|
||||
waiting = true;
|
||||
|
||||
if( timeout == WAIT_INFINITE )
|
||||
{
|
||||
result = pthread_cond_wait( &cond, &mutex );
|
||||
|
||||
assert( result == 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
timespec ts;
|
||||
clock_gettime( CLOCK_REALTIME, &ts );
|
||||
|
||||
ts.tv_nsec += ( timeout * 1000000 );
|
||||
|
||||
result = pthread_cond_timedwait( &cond, &mutex, &ts );
|
||||
|
||||
assert( result == 0 || ( timeout != idSysSignal::WAIT_INFINITE && result == ETIMEDOUT ) );
|
||||
}
|
||||
|
||||
waiting = false;
|
||||
// there are waiting threads => release one
|
||||
pthread_cond_signal( &handle.cond );
|
||||
}
|
||||
|
||||
if( !manualReset )
|
||||
else
|
||||
{
|
||||
signaled = false;
|
||||
// no waiting threads, save signal
|
||||
handle.signaled = true;
|
||||
// while the MSDN documentation is a bit unspecific about what happens
|
||||
// when SetEvent() is called n times without a wait inbetween
|
||||
// (will only one wait be successful afterwards or n waits?)
|
||||
// it seems like the signaled state is a flag, not a counter.
|
||||
// http://stackoverflow.com/a/13703585 claims the same.
|
||||
}
|
||||
}
|
||||
|
||||
pthread_mutex_unlock( &mutex );
|
||||
|
||||
return ( result == 0 );
|
||||
pthread_mutex_unlock( &handle.mutex );
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
Sys_SignalClear
|
||||
========================
|
||||
*/
|
||||
void Sys_SignalClear( signalHandle_t& handle )
|
||||
{
|
||||
// ResetEvent( handle );
|
||||
pthread_mutex_lock( &handle.mutex );
|
||||
|
||||
// TODO: probably signaled could be atomically changed?
|
||||
handle.signaled = false;
|
||||
|
||||
pthread_mutex_unlock( &handle.mutex );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================
|
||||
Sys_SignalWait
|
||||
========================
|
||||
*/
|
||||
bool Sys_SignalWait( signalHandle_t& handle, int timeout )
|
||||
{
|
||||
//DWORD result = WaitForSingleObject( handle, timeout == idSysSignal::WAIT_INFINITE ? INFINITE : timeout );
|
||||
//assert( result == WAIT_OBJECT_0 || ( timeout != idSysSignal::WAIT_INFINITE && result == WAIT_TIMEOUT ) );
|
||||
//return ( result == WAIT_OBJECT_0 );
|
||||
|
||||
int status;
|
||||
pthread_mutex_lock( &handle.mutex );
|
||||
|
||||
if( handle.signaled ) // there is a signal that hasn't been used yet
|
||||
{
|
||||
if( ! handle.manualReset ) // for auto-mode only one thread may be released - this one.
|
||||
handle.signaled = false;
|
||||
|
||||
status = 0; // success!
|
||||
}
|
||||
else // we'll have to wait for a signal
|
||||
{
|
||||
++handle.waiting;
|
||||
if( timeout == idSysSignal::WAIT_INFINITE )
|
||||
{
|
||||
status = pthread_cond_wait( &handle.cond, &handle.mutex );
|
||||
}
|
||||
else
|
||||
{
|
||||
timespec ts;
|
||||
clock_gettime( CLOCK_REALTIME, &ts );
|
||||
// DG: handle timeouts > 1s better
|
||||
ts.tv_nsec += ( timeout % 1000 ) * 1000000; // millisec to nanosec
|
||||
ts.tv_sec += timeout / 1000;
|
||||
if( ts.tv_nsec >= 1000000000 ) // nanoseconds are more than one second
|
||||
{
|
||||
ts.tv_nsec -= 1000000000; // remove one second in nanoseconds
|
||||
ts.tv_sec += 1; // add one second to seconds
|
||||
}
|
||||
// DG end
|
||||
status = pthread_cond_timedwait( &handle.cond, &handle.mutex, &ts );
|
||||
}
|
||||
--handle.waiting;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock( &handle.mutex );
|
||||
|
||||
assert( status == 0 || ( timeout != idSysSignal::WAIT_INFINITE && status == ETIMEDOUT ) );
|
||||
|
||||
return ( status == 0 );
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
================================================================================================
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#endif
|
||||
|
||||
|
||||
#elif defined(__linux__)
|
||||
#elif defined(__linux__) || defined(__FreeBSD__)
|
||||
|
||||
#if defined(__i386__)
|
||||
#define CPUSTRING "x86"
|
||||
|
@ -111,8 +111,13 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define CPUSTRING "x86_86"
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#define BUILD_STRING "freebsd-" CPUSTRING
|
||||
#define BUILD_OS_ID 3
|
||||
#else
|
||||
#define BUILD_STRING "linux-" CPUSTRING
|
||||
#define BUILD_OS_ID 2
|
||||
#endif
|
||||
|
||||
#define _alloca alloca
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include <windows.h> // for gl.h
|
||||
|
||||
#elif defined(__linux__)
|
||||
#elif defined(__linux__) || defined(__FreeBSD__)
|
||||
|
||||
#include <signal.h>
|
||||
#include <pthread.h>
|
||||
|
@ -117,7 +117,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#endif // #if defined(_WIN32)
|
||||
// RB end
|
||||
|
||||
#include <malloc.h> // no malloc.h on mac or unix
|
||||
#include <stdlib.h> // no malloc.h on mac or unix
|
||||
#undef FindText // fix namespace pollution
|
||||
|
||||
|
||||
|
@ -149,6 +149,9 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// RB: added <stdint.h> for missing uintptr_t with MinGW
|
||||
#include <stdint.h>
|
||||
// RB end
|
||||
// Yamagi: <stddef.h> for ptrdiff_t on FreeBSD
|
||||
#include <stddef.h>
|
||||
// Yamagi end
|
||||
|
||||
//-----------------------------------------------------
|
||||
|
||||
|
|
|
@ -45,8 +45,19 @@ typedef CRITICAL_SECTION mutexHandle_t;
|
|||
typedef HANDLE signalHandle_t;
|
||||
typedef LONG interlockedInt_t;
|
||||
#else
|
||||
|
||||
struct signalHandle_t
|
||||
{
|
||||
// DG: all this stuff is needed to emulate Window's Event API
|
||||
// (CreateEvent(), SetEvent(), WaitForSingleObject(), ...)
|
||||
pthread_cond_t cond;
|
||||
pthread_mutex_t mutex;
|
||||
int waiting; // number of threads waiting for a signal
|
||||
bool manualReset;
|
||||
bool signaled; // is it signaled right now?
|
||||
};
|
||||
|
||||
typedef pthread_mutex_t mutexHandle_t;
|
||||
typedef pthread_cond_t signalHandle_t;
|
||||
typedef int interlockedInt_t;
|
||||
#endif
|
||||
// RB end
|
||||
|
@ -195,15 +206,11 @@ uintptr_t Sys_CreateThread( xthread_t function, void* parms, xthreadPriority p
|
|||
void Sys_DestroyThread( uintptr_t threadHandle );
|
||||
void Sys_SetCurrentThreadName( const char* name );
|
||||
|
||||
// use alternative pthread implementation in idSysSignal
|
||||
#if defined(_WIN32)
|
||||
void Sys_SignalCreate( signalHandle_t& handle, bool manualReset );
|
||||
void Sys_SignalDestroy( signalHandle_t& handle );
|
||||
void Sys_SignalRaise( signalHandle_t& handle );
|
||||
void Sys_SignalClear( signalHandle_t& handle );
|
||||
bool Sys_SignalWait( signalHandle_t& handle, int timeout );
|
||||
#endif
|
||||
// RB end
|
||||
|
||||
void Sys_MutexCreate( mutexHandle_t& handle );
|
||||
void Sys_MutexDestroy( mutexHandle_t& handle );
|
||||
|
|
484
neo/libs/openal-soft/COPYING
Normal file
484
neo/libs/openal-soft/COPYING
Normal file
|
@ -0,0 +1,484 @@
|
|||
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is
|
||||
numbered 2 because it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some
|
||||
specially designated Free Software Foundation software, and to any
|
||||
other libraries whose authors decide to use it. You can use it for
|
||||
your libraries, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if
|
||||
you distribute copies of the library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link a program with the library, you must provide
|
||||
complete object files to the recipients so that they can relink them
|
||||
with the library, after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright
|
||||
the library, and (2) offer you this license which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
library. If the library is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original
|
||||
version, so that any problems introduced by others will not reflect on
|
||||
the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that companies distributing free
|
||||
software will individually obtain patent licenses, thus in effect
|
||||
transforming the program into proprietary software. To prevent this,
|
||||
we have made it clear that any patent must be licensed for everyone's
|
||||
free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary
|
||||
GNU General Public License, which was designed for utility programs. This
|
||||
license, the GNU Library General Public License, applies to certain
|
||||
designated libraries. This license is quite different from the ordinary
|
||||
one; be sure to read it in full, and don't assume that anything in it is
|
||||
the same as in the ordinary license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that
|
||||
they blur the distinction we usually make between modifying or adding to a
|
||||
program and simply using it. Linking a program with a library, without
|
||||
changing the library, is in some sense simply using the library, and is
|
||||
analogous to running a utility program or application program. However, in
|
||||
a textual and legal sense, the linked executable is a combined work, a
|
||||
derivative of the original library, and the ordinary General Public License
|
||||
treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General
|
||||
Public License for libraries did not effectively promote software
|
||||
sharing, because most developers did not use the libraries. We
|
||||
concluded that weaker conditions might promote sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the
|
||||
users of those programs of all benefit from the free status of the
|
||||
libraries themselves. This Library General Public License is intended to
|
||||
permit developers of non-free programs to use free libraries, while
|
||||
preserving your freedom as a user of such programs to change the free
|
||||
libraries that are incorporated in them. (We have not seen how to achieve
|
||||
this as regards changes in header files, but we have achieved it as regards
|
||||
changes in the actual functions of the Library.) The hope is that this
|
||||
will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, while the latter only
|
||||
works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary
|
||||
General Public License rather than by this special one.
|
||||
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which
|
||||
contains a notice placed by the copyright holder or other authorized
|
||||
party saying it may be distributed under the terms of this Library
|
||||
General Public License (also called "this License"). Each licensee is
|
||||
addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also compile or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the source code distributed need not include anything that is normally
|
||||
distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Library General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
656
neo/libs/openal-soft/include/AL/al.h
Normal file
656
neo/libs/openal-soft/include/AL/al.h
Normal file
|
@ -0,0 +1,656 @@
|
|||
#ifndef AL_AL_H
|
||||
#define AL_AL_H
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef AL_API
|
||||
#if defined(AL_LIBTYPE_STATIC)
|
||||
#define AL_API
|
||||
#elif defined(_WIN32)
|
||||
#define AL_API __declspec(dllimport)
|
||||
#else
|
||||
#define AL_API extern
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define AL_APIENTRY __cdecl
|
||||
#else
|
||||
#define AL_APIENTRY
|
||||
#endif
|
||||
|
||||
|
||||
/** Deprecated macro. */
|
||||
#define OPENAL
|
||||
#define ALAPI AL_API
|
||||
#define ALAPIENTRY AL_APIENTRY
|
||||
#define AL_INVALID (-1)
|
||||
#define AL_ILLEGAL_ENUM AL_INVALID_ENUM
|
||||
#define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION
|
||||
|
||||
/** Supported AL version. */
|
||||
#define AL_VERSION_1_0
|
||||
#define AL_VERSION_1_1
|
||||
|
||||
/** 8-bit boolean */
|
||||
typedef char ALboolean;
|
||||
|
||||
/** character */
|
||||
typedef char ALchar;
|
||||
|
||||
/** signed 8-bit 2's complement integer */
|
||||
typedef signed char ALbyte;
|
||||
|
||||
/** unsigned 8-bit integer */
|
||||
typedef unsigned char ALubyte;
|
||||
|
||||
/** signed 16-bit 2's complement integer */
|
||||
typedef short ALshort;
|
||||
|
||||
/** unsigned 16-bit integer */
|
||||
typedef unsigned short ALushort;
|
||||
|
||||
/** signed 32-bit 2's complement integer */
|
||||
typedef int ALint;
|
||||
|
||||
/** unsigned 32-bit integer */
|
||||
typedef unsigned int ALuint;
|
||||
|
||||
/** non-negative 32-bit binary integer size */
|
||||
typedef int ALsizei;
|
||||
|
||||
/** enumerated 32-bit value */
|
||||
typedef int ALenum;
|
||||
|
||||
/** 32-bit IEEE754 floating-point */
|
||||
typedef float ALfloat;
|
||||
|
||||
/** 64-bit IEEE754 floating-point */
|
||||
typedef double ALdouble;
|
||||
|
||||
/** void type (for opaque pointers only) */
|
||||
typedef void ALvoid;
|
||||
|
||||
|
||||
/* Enumerant values begin at column 50. No tabs. */
|
||||
|
||||
/** "no distance model" or "no buffer" */
|
||||
#define AL_NONE 0
|
||||
|
||||
/** Boolean False. */
|
||||
#define AL_FALSE 0
|
||||
|
||||
/** Boolean True. */
|
||||
#define AL_TRUE 1
|
||||
|
||||
|
||||
/**
|
||||
* Relative source.
|
||||
* Type: ALboolean
|
||||
* Range: [AL_TRUE, AL_FALSE]
|
||||
* Default: AL_FALSE
|
||||
*
|
||||
* Specifies if the Source has relative coordinates.
|
||||
*/
|
||||
#define AL_SOURCE_RELATIVE 0x202
|
||||
|
||||
|
||||
/**
|
||||
* Inner cone angle, in degrees.
|
||||
* Type: ALint, ALfloat
|
||||
* Range: [0 - 360]
|
||||
* Default: 360
|
||||
*
|
||||
* The angle covered by the inner cone, where the source will not attenuate.
|
||||
*/
|
||||
#define AL_CONE_INNER_ANGLE 0x1001
|
||||
|
||||
/**
|
||||
* Outer cone angle, in degrees.
|
||||
* Range: [0 - 360]
|
||||
* Default: 360
|
||||
*
|
||||
* The angle covered by the outer cone, where the source will be fully
|
||||
* attenuated.
|
||||
*/
|
||||
#define AL_CONE_OUTER_ANGLE 0x1002
|
||||
|
||||
/**
|
||||
* Source pitch.
|
||||
* Type: ALfloat
|
||||
* Range: [0.5 - 2.0]
|
||||
* Default: 1.0
|
||||
*
|
||||
* A multiplier for the frequency (sample rate) of the source's buffer.
|
||||
*/
|
||||
#define AL_PITCH 0x1003
|
||||
|
||||
/**
|
||||
* Source or listener position.
|
||||
* Type: ALfloat[3], ALint[3]
|
||||
* Default: {0, 0, 0}
|
||||
*
|
||||
* The source or listener location in three dimensional space.
|
||||
*
|
||||
* OpenAL, like OpenGL, uses a right handed coordinate system, where in a
|
||||
* frontal default view X (thumb) points right, Y points up (index finger), and
|
||||
* Z points towards the viewer/camera (middle finger).
|
||||
*
|
||||
* To switch from a left handed coordinate system, flip the sign on the Z
|
||||
* coordinate.
|
||||
*/
|
||||
#define AL_POSITION 0x1004
|
||||
|
||||
/**
|
||||
* Source direction.
|
||||
* Type: ALfloat[3], ALint[3]
|
||||
* Default: {0, 0, 0}
|
||||
*
|
||||
* Specifies the current direction in local space.
|
||||
* A zero-length vector specifies an omni-directional source (cone is ignored).
|
||||
*/
|
||||
#define AL_DIRECTION 0x1005
|
||||
|
||||
/**
|
||||
* Source or listener velocity.
|
||||
* Type: ALfloat[3], ALint[3]
|
||||
* Default: {0, 0, 0}
|
||||
*
|
||||
* Specifies the current velocity in local space.
|
||||
*/
|
||||
#define AL_VELOCITY 0x1006
|
||||
|
||||
/**
|
||||
* Source looping.
|
||||
* Type: ALboolean
|
||||
* Range: [AL_TRUE, AL_FALSE]
|
||||
* Default: AL_FALSE
|
||||
*
|
||||
* Specifies whether source is looping.
|
||||
*/
|
||||
#define AL_LOOPING 0x1007
|
||||
|
||||
/**
|
||||
* Source buffer.
|
||||
* Type: ALuint
|
||||
* Range: any valid Buffer.
|
||||
*
|
||||
* Specifies the buffer to provide sound samples.
|
||||
*/
|
||||
#define AL_BUFFER 0x1009
|
||||
|
||||
/**
|
||||
* Source or listener gain.
|
||||
* Type: ALfloat
|
||||
* Range: [0.0 - ]
|
||||
*
|
||||
* A value of 1.0 means unattenuated. Each division by 2 equals an attenuation
|
||||
* of about -6dB. Each multiplicaton by 2 equals an amplification of about
|
||||
* +6dB.
|
||||
*
|
||||
* A value of 0.0 is meaningless with respect to a logarithmic scale; it is
|
||||
* silent.
|
||||
*/
|
||||
#define AL_GAIN 0x100A
|
||||
|
||||
/**
|
||||
* Minimum source gain.
|
||||
* Type: ALfloat
|
||||
* Range: [0.0 - 1.0]
|
||||
*
|
||||
* The minimum gain allowed for a source, after distance and cone attenation is
|
||||
* applied (if applicable).
|
||||
*/
|
||||
#define AL_MIN_GAIN 0x100D
|
||||
|
||||
/**
|
||||
* Maximum source gain.
|
||||
* Type: ALfloat
|
||||
* Range: [0.0 - 1.0]
|
||||
*
|
||||
* The maximum gain allowed for a source, after distance and cone attenation is
|
||||
* applied (if applicable).
|
||||
*/
|
||||
#define AL_MAX_GAIN 0x100E
|
||||
|
||||
/**
|
||||
* Listener orientation.
|
||||
* Type: ALfloat[6]
|
||||
* Default: {0.0, 0.0, -1.0, 0.0, 1.0, 0.0}
|
||||
*
|
||||
* Effectively two three dimensional vectors. The first vector is the front (or
|
||||
* "at") and the second is the top (or "up").
|
||||
*
|
||||
* Both vectors are in local space.
|
||||
*/
|
||||
#define AL_ORIENTATION 0x100F
|
||||
|
||||
/**
|
||||
* Source state (query only).
|
||||
* Type: ALint
|
||||
* Range: [AL_INITIAL, AL_PLAYING, AL_PAUSED, AL_STOPPED]
|
||||
*/
|
||||
#define AL_SOURCE_STATE 0x1010
|
||||
|
||||
/** Source state value. */
|
||||
#define AL_INITIAL 0x1011
|
||||
#define AL_PLAYING 0x1012
|
||||
#define AL_PAUSED 0x1013
|
||||
#define AL_STOPPED 0x1014
|
||||
|
||||
/**
|
||||
* Source Buffer Queue size (query only).
|
||||
* Type: ALint
|
||||
*
|
||||
* The number of buffers queued using alSourceQueueBuffers, minus the buffers
|
||||
* removed with alSourceUnqueueBuffers.
|
||||
*/
|
||||
#define AL_BUFFERS_QUEUED 0x1015
|
||||
|
||||
/**
|
||||
* Source Buffer Queue processed count (query only).
|
||||
* Type: ALint
|
||||
*
|
||||
* The number of queued buffers that have been fully processed, and can be
|
||||
* removed with alSourceUnqueueBuffers.
|
||||
*
|
||||
* Looping sources will never fully process buffers because they will be set to
|
||||
* play again for when the source loops.
|
||||
*/
|
||||
#define AL_BUFFERS_PROCESSED 0x1016
|
||||
|
||||
/**
|
||||
* Source reference distance.
|
||||
* Type: ALfloat
|
||||
* Range: [0.0 - ]
|
||||
* Default: 1.0
|
||||
*
|
||||
* The distance in units that no attenuation occurs.
|
||||
*
|
||||
* At 0.0, no distance attenuation ever occurs on non-linear attenuation models.
|
||||
*/
|
||||
#define AL_REFERENCE_DISTANCE 0x1020
|
||||
|
||||
/**
|
||||
* Source rolloff factor.
|
||||
* Type: ALfloat
|
||||
* Range: [0.0 - ]
|
||||
* Default: 1.0
|
||||
*
|
||||
* Multiplier to exaggerate or diminish distance attenuation.
|
||||
*
|
||||
* At 0.0, no distance attenuation ever occurs.
|
||||
*/
|
||||
#define AL_ROLLOFF_FACTOR 0x1021
|
||||
|
||||
/**
|
||||
* Outer cone gain.
|
||||
* Type: ALfloat
|
||||
* Range: [0.0 - 1.0]
|
||||
* Default: 0.0
|
||||
*
|
||||
* The gain attenuation applied when the listener is outside of the source's
|
||||
* outer cone.
|
||||
*/
|
||||
#define AL_CONE_OUTER_GAIN 0x1022
|
||||
|
||||
/**
|
||||
* Source maximum distance.
|
||||
* Type: ALfloat
|
||||
* Range: [0.0 - ]
|
||||
* Default: +inf
|
||||
*
|
||||
* The distance above which the source is not attenuated any further with a
|
||||
* clamped distance model, or where attenuation reaches 0.0 gain for linear
|
||||
* distance models with a default rolloff factor.
|
||||
*/
|
||||
#define AL_MAX_DISTANCE 0x1023
|
||||
|
||||
/** Source buffer position, in seconds */
|
||||
#define AL_SEC_OFFSET 0x1024
|
||||
/** Source buffer position, in sample frames */
|
||||
#define AL_SAMPLE_OFFSET 0x1025
|
||||
/** Source buffer position, in bytes */
|
||||
#define AL_BYTE_OFFSET 0x1026
|
||||
|
||||
/**
|
||||
* Source type (query only).
|
||||
* Type: ALint
|
||||
* Range: [AL_STATIC, AL_STREAMING, AL_UNDETERMINED]
|
||||
*
|
||||
* A Source is Static if a Buffer has been attached using AL_BUFFER.
|
||||
*
|
||||
* A Source is Streaming if one or more Buffers have been attached using
|
||||
* alSourceQueueBuffers.
|
||||
*
|
||||
* A Source is Undetermined when it has the NULL buffer attached using
|
||||
* AL_BUFFER.
|
||||
*/
|
||||
#define AL_SOURCE_TYPE 0x1027
|
||||
|
||||
/** Source type value. */
|
||||
#define AL_STATIC 0x1028
|
||||
#define AL_STREAMING 0x1029
|
||||
#define AL_UNDETERMINED 0x1030
|
||||
|
||||
/** Buffer format specifier. */
|
||||
#define AL_FORMAT_MONO8 0x1100
|
||||
#define AL_FORMAT_MONO16 0x1101
|
||||
#define AL_FORMAT_STEREO8 0x1102
|
||||
#define AL_FORMAT_STEREO16 0x1103
|
||||
|
||||
/** Buffer frequency (query only). */
|
||||
#define AL_FREQUENCY 0x2001
|
||||
/** Buffer bits per sample (query only). */
|
||||
#define AL_BITS 0x2002
|
||||
/** Buffer channel count (query only). */
|
||||
#define AL_CHANNELS 0x2003
|
||||
/** Buffer data size (query only). */
|
||||
#define AL_SIZE 0x2004
|
||||
|
||||
/**
|
||||
* Buffer state.
|
||||
*
|
||||
* Not for public use.
|
||||
*/
|
||||
#define AL_UNUSED 0x2010
|
||||
#define AL_PENDING 0x2011
|
||||
#define AL_PROCESSED 0x2012
|
||||
|
||||
|
||||
/** No error. */
|
||||
#define AL_NO_ERROR 0
|
||||
|
||||
/** Invalid name paramater passed to AL call. */
|
||||
#define AL_INVALID_NAME 0xA001
|
||||
|
||||
/** Invalid enum parameter passed to AL call. */
|
||||
#define AL_INVALID_ENUM 0xA002
|
||||
|
||||
/** Invalid value parameter passed to AL call. */
|
||||
#define AL_INVALID_VALUE 0xA003
|
||||
|
||||
/** Illegal AL call. */
|
||||
#define AL_INVALID_OPERATION 0xA004
|
||||
|
||||
/** Not enough memory. */
|
||||
#define AL_OUT_OF_MEMORY 0xA005
|
||||
|
||||
|
||||
/** Context string: Vendor ID. */
|
||||
#define AL_VENDOR 0xB001
|
||||
/** Context string: Version. */
|
||||
#define AL_VERSION 0xB002
|
||||
/** Context string: Renderer ID. */
|
||||
#define AL_RENDERER 0xB003
|
||||
/** Context string: Space-separated extension list. */
|
||||
#define AL_EXTENSIONS 0xB004
|
||||
|
||||
|
||||
/**
|
||||
* Doppler scale.
|
||||
* Type: ALfloat
|
||||
* Range: [0.0 - ]
|
||||
* Default: 1.0
|
||||
*
|
||||
* Scale for source and listener velocities.
|
||||
*/
|
||||
#define AL_DOPPLER_FACTOR 0xC000
|
||||
AL_API void AL_APIENTRY alDopplerFactor(ALfloat value);
|
||||
|
||||
/**
|
||||
* Doppler velocity (deprecated).
|
||||
*
|
||||
* A multiplier applied to the Speed of Sound.
|
||||
*/
|
||||
#define AL_DOPPLER_VELOCITY 0xC001
|
||||
AL_API void AL_APIENTRY alDopplerVelocity(ALfloat value);
|
||||
|
||||
/**
|
||||
* Speed of Sound, in units per second.
|
||||
* Type: ALfloat
|
||||
* Range: [0.0001 - ]
|
||||
* Default: 343.3
|
||||
*
|
||||
* The speed at which sound waves are assumed to travel, when calculating the
|
||||
* doppler effect.
|
||||
*/
|
||||
#define AL_SPEED_OF_SOUND 0xC003
|
||||
AL_API void AL_APIENTRY alSpeedOfSound(ALfloat value);
|
||||
|
||||
/**
|
||||
* Distance attenuation model.
|
||||
* Type: ALint
|
||||
* Range: [AL_NONE, AL_INVERSE_DISTANCE, AL_INVERSE_DISTANCE_CLAMPED,
|
||||
* AL_LINEAR_DISTANCE, AL_LINEAR_DISTANCE_CLAMPED,
|
||||
* AL_EXPONENT_DISTANCE, AL_EXPONENT_DISTANCE_CLAMPED]
|
||||
* Default: AL_INVERSE_DISTANCE_CLAMPED
|
||||
*
|
||||
* The model by which sources attenuate with distance.
|
||||
*
|
||||
* None - No distance attenuation.
|
||||
* Inverse - Doubling the distance halves the source gain.
|
||||
* Linear - Linear gain scaling between the reference and max distances.
|
||||
* Exponent - Exponential gain dropoff.
|
||||
*
|
||||
* Clamped variations work like the non-clamped counterparts, except the
|
||||
* distance calculated is clamped between the reference and max distances.
|
||||
*/
|
||||
#define AL_DISTANCE_MODEL 0xD000
|
||||
AL_API void AL_APIENTRY alDistanceModel(ALenum distanceModel);
|
||||
|
||||
/** Distance model value. */
|
||||
#define AL_INVERSE_DISTANCE 0xD001
|
||||
#define AL_INVERSE_DISTANCE_CLAMPED 0xD002
|
||||
#define AL_LINEAR_DISTANCE 0xD003
|
||||
#define AL_LINEAR_DISTANCE_CLAMPED 0xD004
|
||||
#define AL_EXPONENT_DISTANCE 0xD005
|
||||
#define AL_EXPONENT_DISTANCE_CLAMPED 0xD006
|
||||
|
||||
/** Renderer State management. */
|
||||
AL_API void AL_APIENTRY alEnable(ALenum capability);
|
||||
AL_API void AL_APIENTRY alDisable(ALenum capability);
|
||||
AL_API ALboolean AL_APIENTRY alIsEnabled(ALenum capability);
|
||||
|
||||
/** State retrieval. */
|
||||
AL_API const ALchar* AL_APIENTRY alGetString(ALenum param);
|
||||
AL_API void AL_APIENTRY alGetBooleanv(ALenum param, ALboolean *values);
|
||||
AL_API void AL_APIENTRY alGetIntegerv(ALenum param, ALint *values);
|
||||
AL_API void AL_APIENTRY alGetFloatv(ALenum param, ALfloat *values);
|
||||
AL_API void AL_APIENTRY alGetDoublev(ALenum param, ALdouble *values);
|
||||
AL_API ALboolean AL_APIENTRY alGetBoolean(ALenum param);
|
||||
AL_API ALint AL_APIENTRY alGetInteger(ALenum param);
|
||||
AL_API ALfloat AL_APIENTRY alGetFloat(ALenum param);
|
||||
AL_API ALdouble AL_APIENTRY alGetDouble(ALenum param);
|
||||
|
||||
/**
|
||||
* Error retrieval.
|
||||
*
|
||||
* Obtain the first error generated in the AL context since the last check.
|
||||
*/
|
||||
AL_API ALenum AL_APIENTRY alGetError(void);
|
||||
|
||||
/**
|
||||
* Extension support.
|
||||
*
|
||||
* Query for the presence of an extension, and obtain any appropriate function
|
||||
* pointers and enum values.
|
||||
*/
|
||||
AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extname);
|
||||
AL_API void* AL_APIENTRY alGetProcAddress(const ALchar *fname);
|
||||
AL_API ALenum AL_APIENTRY alGetEnumValue(const ALchar *ename);
|
||||
|
||||
|
||||
/** Set Listener parameters */
|
||||
AL_API void AL_APIENTRY alListenerf(ALenum param, ALfloat value);
|
||||
AL_API void AL_APIENTRY alListener3f(ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
|
||||
AL_API void AL_APIENTRY alListenerfv(ALenum param, const ALfloat *values);
|
||||
AL_API void AL_APIENTRY alListeneri(ALenum param, ALint value);
|
||||
AL_API void AL_APIENTRY alListener3i(ALenum param, ALint value1, ALint value2, ALint value3);
|
||||
AL_API void AL_APIENTRY alListeneriv(ALenum param, const ALint *values);
|
||||
|
||||
/** Get Listener parameters */
|
||||
AL_API void AL_APIENTRY alGetListenerf(ALenum param, ALfloat *value);
|
||||
AL_API void AL_APIENTRY alGetListener3f(ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
|
||||
AL_API void AL_APIENTRY alGetListenerfv(ALenum param, ALfloat *values);
|
||||
AL_API void AL_APIENTRY alGetListeneri(ALenum param, ALint *value);
|
||||
AL_API void AL_APIENTRY alGetListener3i(ALenum param, ALint *value1, ALint *value2, ALint *value3);
|
||||
AL_API void AL_APIENTRY alGetListeneriv(ALenum param, ALint *values);
|
||||
|
||||
|
||||
/** Create Source objects. */
|
||||
AL_API void AL_APIENTRY alGenSources(ALsizei n, ALuint *sources);
|
||||
/** Delete Source objects. */
|
||||
AL_API void AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources);
|
||||
/** Verify a handle is a valid Source. */
|
||||
AL_API ALboolean AL_APIENTRY alIsSource(ALuint source);
|
||||
|
||||
/** Set Source parameters. */
|
||||
AL_API void AL_APIENTRY alSourcef(ALuint source, ALenum param, ALfloat value);
|
||||
AL_API void AL_APIENTRY alSource3f(ALuint source, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
|
||||
AL_API void AL_APIENTRY alSourcefv(ALuint source, ALenum param, const ALfloat *values);
|
||||
AL_API void AL_APIENTRY alSourcei(ALuint source, ALenum param, ALint value);
|
||||
AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum param, ALint value1, ALint value2, ALint value3);
|
||||
AL_API void AL_APIENTRY alSourceiv(ALuint source, ALenum param, const ALint *values);
|
||||
|
||||
/** Get Source parameters. */
|
||||
AL_API void AL_APIENTRY alGetSourcef(ALuint source, ALenum param, ALfloat *value);
|
||||
AL_API void AL_APIENTRY alGetSource3f(ALuint source, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
|
||||
AL_API void AL_APIENTRY alGetSourcefv(ALuint source, ALenum param, ALfloat *values);
|
||||
AL_API void AL_APIENTRY alGetSourcei(ALuint source, ALenum param, ALint *value);
|
||||
AL_API void AL_APIENTRY alGetSource3i(ALuint source, ALenum param, ALint *value1, ALint *value2, ALint *value3);
|
||||
AL_API void AL_APIENTRY alGetSourceiv(ALuint source, ALenum param, ALint *values);
|
||||
|
||||
|
||||
/** Play, replay, or resume (if paused) a list of Sources */
|
||||
AL_API void AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources);
|
||||
/** Stop a list of Sources */
|
||||
AL_API void AL_APIENTRY alSourceStopv(ALsizei n, const ALuint *sources);
|
||||
/** Rewind a list of Sources */
|
||||
AL_API void AL_APIENTRY alSourceRewindv(ALsizei n, const ALuint *sources);
|
||||
/** Pause a list of Sources */
|
||||
AL_API void AL_APIENTRY alSourcePausev(ALsizei n, const ALuint *sources);
|
||||
|
||||
/** Play, replay, or resume a Source */
|
||||
AL_API void AL_APIENTRY alSourcePlay(ALuint source);
|
||||
/** Stop a Source */
|
||||
AL_API void AL_APIENTRY alSourceStop(ALuint source);
|
||||
/** Rewind a Source (set playback postiton to beginning) */
|
||||
AL_API void AL_APIENTRY alSourceRewind(ALuint source);
|
||||
/** Pause a Source */
|
||||
AL_API void AL_APIENTRY alSourcePause(ALuint source);
|
||||
|
||||
/** Queue buffers onto a source */
|
||||
AL_API void AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei nb, const ALuint *buffers);
|
||||
/** Unqueue processed buffers from a source */
|
||||
AL_API void AL_APIENTRY alSourceUnqueueBuffers(ALuint source, ALsizei nb, ALuint *buffers);
|
||||
|
||||
|
||||
/** Create Buffer objects */
|
||||
AL_API void AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers);
|
||||
/** Delete Buffer objects */
|
||||
AL_API void AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *buffers);
|
||||
/** Verify a handle is a valid Buffer */
|
||||
AL_API ALboolean AL_APIENTRY alIsBuffer(ALuint buffer);
|
||||
|
||||
/** Specifies the data to be copied into a buffer */
|
||||
AL_API void AL_APIENTRY alBufferData(ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei freq);
|
||||
|
||||
/** Set Buffer parameters, */
|
||||
AL_API void AL_APIENTRY alBufferf(ALuint buffer, ALenum param, ALfloat value);
|
||||
AL_API void AL_APIENTRY alBuffer3f(ALuint buffer, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
|
||||
AL_API void AL_APIENTRY alBufferfv(ALuint buffer, ALenum param, const ALfloat *values);
|
||||
AL_API void AL_APIENTRY alBufferi(ALuint buffer, ALenum param, ALint value);
|
||||
AL_API void AL_APIENTRY alBuffer3i(ALuint buffer, ALenum param, ALint value1, ALint value2, ALint value3);
|
||||
AL_API void AL_APIENTRY alBufferiv(ALuint buffer, ALenum param, const ALint *values);
|
||||
|
||||
/** Get Buffer parameters. */
|
||||
AL_API void AL_APIENTRY alGetBufferf(ALuint buffer, ALenum param, ALfloat *value);
|
||||
AL_API void AL_APIENTRY alGetBuffer3f(ALuint buffer, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
|
||||
AL_API void AL_APIENTRY alGetBufferfv(ALuint buffer, ALenum param, ALfloat *values);
|
||||
AL_API void AL_APIENTRY alGetBufferi(ALuint buffer, ALenum param, ALint *value);
|
||||
AL_API void AL_APIENTRY alGetBuffer3i(ALuint buffer, ALenum param, ALint *value1, ALint *value2, ALint *value3);
|
||||
AL_API void AL_APIENTRY alGetBufferiv(ALuint buffer, ALenum param, ALint *values);
|
||||
|
||||
/** Pointer-to-function type, useful for dynamically getting AL entry points. */
|
||||
typedef void (AL_APIENTRY *LPALENABLE)(ALenum capability);
|
||||
typedef void (AL_APIENTRY *LPALDISABLE)(ALenum capability);
|
||||
typedef ALboolean (AL_APIENTRY *LPALISENABLED)(ALenum capability);
|
||||
typedef const ALchar* (AL_APIENTRY *LPALGETSTRING)(ALenum param);
|
||||
typedef void (AL_APIENTRY *LPALGETBOOLEANV)(ALenum param, ALboolean *values);
|
||||
typedef void (AL_APIENTRY *LPALGETINTEGERV)(ALenum param, ALint *values);
|
||||
typedef void (AL_APIENTRY *LPALGETFLOATV)(ALenum param, ALfloat *values);
|
||||
typedef void (AL_APIENTRY *LPALGETDOUBLEV)(ALenum param, ALdouble *values);
|
||||
typedef ALboolean (AL_APIENTRY *LPALGETBOOLEAN)(ALenum param);
|
||||
typedef ALint (AL_APIENTRY *LPALGETINTEGER)(ALenum param);
|
||||
typedef ALfloat (AL_APIENTRY *LPALGETFLOAT)(ALenum param);
|
||||
typedef ALdouble (AL_APIENTRY *LPALGETDOUBLE)(ALenum param);
|
||||
typedef ALenum (AL_APIENTRY *LPALGETERROR)(void);
|
||||
typedef ALboolean (AL_APIENTRY *LPALISEXTENSIONPRESENT)(const ALchar *extname);
|
||||
typedef void* (AL_APIENTRY *LPALGETPROCADDRESS)(const ALchar *fname);
|
||||
typedef ALenum (AL_APIENTRY *LPALGETENUMVALUE)(const ALchar *ename);
|
||||
typedef void (AL_APIENTRY *LPALLISTENERF)(ALenum param, ALfloat value);
|
||||
typedef void (AL_APIENTRY *LPALLISTENER3F)(ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
|
||||
typedef void (AL_APIENTRY *LPALLISTENERFV)(ALenum param, const ALfloat *values);
|
||||
typedef void (AL_APIENTRY *LPALLISTENERI)(ALenum param, ALint value);
|
||||
typedef void (AL_APIENTRY *LPALLISTENER3I)(ALenum param, ALint value1, ALint value2, ALint value3);
|
||||
typedef void (AL_APIENTRY *LPALLISTENERIV)(ALenum param, const ALint *values);
|
||||
typedef void (AL_APIENTRY *LPALGETLISTENERF)(ALenum param, ALfloat *value);
|
||||
typedef void (AL_APIENTRY *LPALGETLISTENER3F)(ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
|
||||
typedef void (AL_APIENTRY *LPALGETLISTENERFV)(ALenum param, ALfloat *values);
|
||||
typedef void (AL_APIENTRY *LPALGETLISTENERI)(ALenum param, ALint *value);
|
||||
typedef void (AL_APIENTRY *LPALGETLISTENER3I)(ALenum param, ALint *value1, ALint *value2, ALint *value3);
|
||||
typedef void (AL_APIENTRY *LPALGETLISTENERIV)(ALenum param, ALint *values);
|
||||
typedef void (AL_APIENTRY *LPALGENSOURCES)(ALsizei n, ALuint *sources);
|
||||
typedef void (AL_APIENTRY *LPALDELETESOURCES)(ALsizei n, const ALuint *sources);
|
||||
typedef ALboolean (AL_APIENTRY *LPALISSOURCE)(ALuint source);
|
||||
typedef void (AL_APIENTRY *LPALSOURCEF)(ALuint source, ALenum param, ALfloat value);
|
||||
typedef void (AL_APIENTRY *LPALSOURCE3F)(ALuint source, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
|
||||
typedef void (AL_APIENTRY *LPALSOURCEFV)(ALuint source, ALenum param, const ALfloat *values);
|
||||
typedef void (AL_APIENTRY *LPALSOURCEI)(ALuint source, ALenum param, ALint value);
|
||||
typedef void (AL_APIENTRY *LPALSOURCE3I)(ALuint source, ALenum param, ALint value1, ALint value2, ALint value3);
|
||||
typedef void (AL_APIENTRY *LPALSOURCEIV)(ALuint source, ALenum param, const ALint *values);
|
||||
typedef void (AL_APIENTRY *LPALGETSOURCEF)(ALuint source, ALenum param, ALfloat *value);
|
||||
typedef void (AL_APIENTRY *LPALGETSOURCE3F)(ALuint source, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
|
||||
typedef void (AL_APIENTRY *LPALGETSOURCEFV)(ALuint source, ALenum param, ALfloat *values);
|
||||
typedef void (AL_APIENTRY *LPALGETSOURCEI)(ALuint source, ALenum param, ALint *value);
|
||||
typedef void (AL_APIENTRY *LPALGETSOURCE3I)(ALuint source, ALenum param, ALint *value1, ALint *value2, ALint *value3);
|
||||
typedef void (AL_APIENTRY *LPALGETSOURCEIV)(ALuint source, ALenum param, ALint *values);
|
||||
typedef void (AL_APIENTRY *LPALSOURCEPLAYV)(ALsizei n, const ALuint *sources);
|
||||
typedef void (AL_APIENTRY *LPALSOURCESTOPV)(ALsizei n, const ALuint *sources);
|
||||
typedef void (AL_APIENTRY *LPALSOURCEREWINDV)(ALsizei n, const ALuint *sources);
|
||||
typedef void (AL_APIENTRY *LPALSOURCEPAUSEV)(ALsizei n, const ALuint *sources);
|
||||
typedef void (AL_APIENTRY *LPALSOURCEPLAY)(ALuint source);
|
||||
typedef void (AL_APIENTRY *LPALSOURCESTOP)(ALuint source);
|
||||
typedef void (AL_APIENTRY *LPALSOURCEREWIND)(ALuint source);
|
||||
typedef void (AL_APIENTRY *LPALSOURCEPAUSE)(ALuint source);
|
||||
typedef void (AL_APIENTRY *LPALSOURCEQUEUEBUFFERS)(ALuint source, ALsizei nb, const ALuint *buffers);
|
||||
typedef void (AL_APIENTRY *LPALSOURCEUNQUEUEBUFFERS)(ALuint source, ALsizei nb, ALuint *buffers);
|
||||
typedef void (AL_APIENTRY *LPALGENBUFFERS)(ALsizei n, ALuint *buffers);
|
||||
typedef void (AL_APIENTRY *LPALDELETEBUFFERS)(ALsizei n, const ALuint *buffers);
|
||||
typedef ALboolean (AL_APIENTRY *LPALISBUFFER)(ALuint buffer);
|
||||
typedef void (AL_APIENTRY *LPALBUFFERDATA)(ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei freq);
|
||||
typedef void (AL_APIENTRY *LPALBUFFERF)(ALuint buffer, ALenum param, ALfloat value);
|
||||
typedef void (AL_APIENTRY *LPALBUFFER3F)(ALuint buffer, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
|
||||
typedef void (AL_APIENTRY *LPALBUFFERFV)(ALuint buffer, ALenum param, const ALfloat *values);
|
||||
typedef void (AL_APIENTRY *LPALBUFFERI)(ALuint buffer, ALenum param, ALint value);
|
||||
typedef void (AL_APIENTRY *LPALBUFFER3I)(ALuint buffer, ALenum param, ALint value1, ALint value2, ALint value3);
|
||||
typedef void (AL_APIENTRY *LPALBUFFERIV)(ALuint buffer, ALenum param, const ALint *values);
|
||||
typedef void (AL_APIENTRY *LPALGETBUFFERF)(ALuint buffer, ALenum param, ALfloat *value);
|
||||
typedef void (AL_APIENTRY *LPALGETBUFFER3F)(ALuint buffer, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
|
||||
typedef void (AL_APIENTRY *LPALGETBUFFERFV)(ALuint buffer, ALenum param, ALfloat *values);
|
||||
typedef void (AL_APIENTRY *LPALGETBUFFERI)(ALuint buffer, ALenum param, ALint *value);
|
||||
typedef void (AL_APIENTRY *LPALGETBUFFER3I)(ALuint buffer, ALenum param, ALint *value1, ALint *value2, ALint *value3);
|
||||
typedef void (AL_APIENTRY *LPALGETBUFFERIV)(ALuint buffer, ALenum param, ALint *values);
|
||||
typedef void (AL_APIENTRY *LPALDOPPLERFACTOR)(ALfloat value);
|
||||
typedef void (AL_APIENTRY *LPALDOPPLERVELOCITY)(ALfloat value);
|
||||
typedef void (AL_APIENTRY *LPALSPEEDOFSOUND)(ALfloat value);
|
||||
typedef void (AL_APIENTRY *LPALDISTANCEMODEL)(ALenum distanceModel);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* AL_AL_H */
|
237
neo/libs/openal-soft/include/AL/alc.h
Normal file
237
neo/libs/openal-soft/include/AL/alc.h
Normal file
|
@ -0,0 +1,237 @@
|
|||
#ifndef AL_ALC_H
|
||||
#define AL_ALC_H
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef ALC_API
|
||||
#if defined(AL_LIBTYPE_STATIC)
|
||||
#define ALC_API
|
||||
#elif defined(_WIN32)
|
||||
#define ALC_API __declspec(dllimport)
|
||||
#else
|
||||
#define ALC_API extern
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define ALC_APIENTRY __cdecl
|
||||
#else
|
||||
#define ALC_APIENTRY
|
||||
#endif
|
||||
|
||||
|
||||
/** Deprecated macro. */
|
||||
#define ALCAPI ALC_API
|
||||
#define ALCAPIENTRY ALC_APIENTRY
|
||||
#define ALC_INVALID 0
|
||||
|
||||
/** Supported ALC version? */
|
||||
#define ALC_VERSION_0_1 1
|
||||
|
||||
/** Opaque device handle */
|
||||
typedef struct ALCdevice_struct ALCdevice;
|
||||
/** Opaque context handle */
|
||||
typedef struct ALCcontext_struct ALCcontext;
|
||||
|
||||
/** 8-bit boolean */
|
||||
typedef char ALCboolean;
|
||||
|
||||
/** character */
|
||||
typedef char ALCchar;
|
||||
|
||||
/** signed 8-bit 2's complement integer */
|
||||
typedef signed char ALCbyte;
|
||||
|
||||
/** unsigned 8-bit integer */
|
||||
typedef unsigned char ALCubyte;
|
||||
|
||||
/** signed 16-bit 2's complement integer */
|
||||
typedef short ALCshort;
|
||||
|
||||
/** unsigned 16-bit integer */
|
||||
typedef unsigned short ALCushort;
|
||||
|
||||
/** signed 32-bit 2's complement integer */
|
||||
typedef int ALCint;
|
||||
|
||||
/** unsigned 32-bit integer */
|
||||
typedef unsigned int ALCuint;
|
||||
|
||||
/** non-negative 32-bit binary integer size */
|
||||
typedef int ALCsizei;
|
||||
|
||||
/** enumerated 32-bit value */
|
||||
typedef int ALCenum;
|
||||
|
||||
/** 32-bit IEEE754 floating-point */
|
||||
typedef float ALCfloat;
|
||||
|
||||
/** 64-bit IEEE754 floating-point */
|
||||
typedef double ALCdouble;
|
||||
|
||||
/** void type (for opaque pointers only) */
|
||||
typedef void ALCvoid;
|
||||
|
||||
|
||||
/* Enumerant values begin at column 50. No tabs. */
|
||||
|
||||
/** Boolean False. */
|
||||
#define ALC_FALSE 0
|
||||
|
||||
/** Boolean True. */
|
||||
#define ALC_TRUE 1
|
||||
|
||||
/** Context attribute: <int> Hz. */
|
||||
#define ALC_FREQUENCY 0x1007
|
||||
|
||||
/** Context attribute: <int> Hz. */
|
||||
#define ALC_REFRESH 0x1008
|
||||
|
||||
/** Context attribute: AL_TRUE or AL_FALSE. */
|
||||
#define ALC_SYNC 0x1009
|
||||
|
||||
/** Context attribute: <int> requested Mono (3D) Sources. */
|
||||
#define ALC_MONO_SOURCES 0x1010
|
||||
|
||||
/** Context attribute: <int> requested Stereo Sources. */
|
||||
#define ALC_STEREO_SOURCES 0x1011
|
||||
|
||||
/** No error. */
|
||||
#define ALC_NO_ERROR 0
|
||||
|
||||
/** Invalid device handle. */
|
||||
#define ALC_INVALID_DEVICE 0xA001
|
||||
|
||||
/** Invalid context handle. */
|
||||
#define ALC_INVALID_CONTEXT 0xA002
|
||||
|
||||
/** Invalid enum parameter passed to an ALC call. */
|
||||
#define ALC_INVALID_ENUM 0xA003
|
||||
|
||||
/** Invalid value parameter passed to an ALC call. */
|
||||
#define ALC_INVALID_VALUE 0xA004
|
||||
|
||||
/** Out of memory. */
|
||||
#define ALC_OUT_OF_MEMORY 0xA005
|
||||
|
||||
|
||||
/** Runtime ALC version. */
|
||||
#define ALC_MAJOR_VERSION 0x1000
|
||||
#define ALC_MINOR_VERSION 0x1001
|
||||
|
||||
/** Context attribute list properties. */
|
||||
#define ALC_ATTRIBUTES_SIZE 0x1002
|
||||
#define ALC_ALL_ATTRIBUTES 0x1003
|
||||
|
||||
/** String for the default device specifier. */
|
||||
#define ALC_DEFAULT_DEVICE_SPECIFIER 0x1004
|
||||
/**
|
||||
* String for the given device's specifier.
|
||||
*
|
||||
* If device handle is NULL, it is instead a null-char separated list of
|
||||
* strings of known device specifiers (list ends with an empty string).
|
||||
*/
|
||||
#define ALC_DEVICE_SPECIFIER 0x1005
|
||||
/** String for space-separated list of ALC extensions. */
|
||||
#define ALC_EXTENSIONS 0x1006
|
||||
|
||||
|
||||
/** Capture extension */
|
||||
#define ALC_EXT_CAPTURE 1
|
||||
/**
|
||||
* String for the given capture device's specifier.
|
||||
*
|
||||
* If device handle is NULL, it is instead a null-char separated list of
|
||||
* strings of known capture device specifiers (list ends with an empty string).
|
||||
*/
|
||||
#define ALC_CAPTURE_DEVICE_SPECIFIER 0x310
|
||||
/** String for the default capture device specifier. */
|
||||
#define ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER 0x311
|
||||
/** Number of sample frames available for capture. */
|
||||
#define ALC_CAPTURE_SAMPLES 0x312
|
||||
|
||||
|
||||
/** Enumerate All extension */
|
||||
#define ALC_ENUMERATE_ALL_EXT 1
|
||||
/** String for the default extended device specifier. */
|
||||
#define ALC_DEFAULT_ALL_DEVICES_SPECIFIER 0x1012
|
||||
/**
|
||||
* String for the given extended device's specifier.
|
||||
*
|
||||
* If device handle is NULL, it is instead a null-char separated list of
|
||||
* strings of known extended device specifiers (list ends with an empty string).
|
||||
*/
|
||||
#define ALC_ALL_DEVICES_SPECIFIER 0x1013
|
||||
|
||||
|
||||
/** Context management. */
|
||||
ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCint* attrlist);
|
||||
ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent(ALCcontext *context);
|
||||
ALC_API void ALC_APIENTRY alcProcessContext(ALCcontext *context);
|
||||
ALC_API void ALC_APIENTRY alcSuspendContext(ALCcontext *context);
|
||||
ALC_API void ALC_APIENTRY alcDestroyContext(ALCcontext *context);
|
||||
ALC_API ALCcontext* ALC_APIENTRY alcGetCurrentContext(void);
|
||||
ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice(ALCcontext *context);
|
||||
|
||||
/** Device management. */
|
||||
ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *devicename);
|
||||
ALC_API ALCboolean ALC_APIENTRY alcCloseDevice(ALCdevice *device);
|
||||
|
||||
|
||||
/**
|
||||
* Error support.
|
||||
*
|
||||
* Obtain the most recent Device error.
|
||||
*/
|
||||
ALC_API ALCenum ALC_APIENTRY alcGetError(ALCdevice *device);
|
||||
|
||||
/**
|
||||
* Extension support.
|
||||
*
|
||||
* Query for the presence of an extension, and obtain any appropriate
|
||||
* function pointers and enum values.
|
||||
*/
|
||||
ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent(ALCdevice *device, const ALCchar *extname);
|
||||
ALC_API void* ALC_APIENTRY alcGetProcAddress(ALCdevice *device, const ALCchar *funcname);
|
||||
ALC_API ALCenum ALC_APIENTRY alcGetEnumValue(ALCdevice *device, const ALCchar *enumname);
|
||||
|
||||
/** Query function. */
|
||||
ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *device, ALCenum param);
|
||||
ALC_API void ALC_APIENTRY alcGetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *values);
|
||||
|
||||
/** Capture function. */
|
||||
ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize);
|
||||
ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice(ALCdevice *device);
|
||||
ALC_API void ALC_APIENTRY alcCaptureStart(ALCdevice *device);
|
||||
ALC_API void ALC_APIENTRY alcCaptureStop(ALCdevice *device);
|
||||
ALC_API void ALC_APIENTRY alcCaptureSamples(ALCdevice *device, ALCvoid *buffer, ALCsizei samples);
|
||||
|
||||
/** Pointer-to-function type, useful for dynamically getting ALC entry points. */
|
||||
typedef ALCcontext* (ALC_APIENTRY *LPALCCREATECONTEXT)(ALCdevice *device, const ALCint *attrlist);
|
||||
typedef ALCboolean (ALC_APIENTRY *LPALCMAKECONTEXTCURRENT)(ALCcontext *context);
|
||||
typedef void (ALC_APIENTRY *LPALCPROCESSCONTEXT)(ALCcontext *context);
|
||||
typedef void (ALC_APIENTRY *LPALCSUSPENDCONTEXT)(ALCcontext *context);
|
||||
typedef void (ALC_APIENTRY *LPALCDESTROYCONTEXT)(ALCcontext *context);
|
||||
typedef ALCcontext* (ALC_APIENTRY *LPALCGETCURRENTCONTEXT)(void);
|
||||
typedef ALCdevice* (ALC_APIENTRY *LPALCGETCONTEXTSDEVICE)(ALCcontext *context);
|
||||
typedef ALCdevice* (ALC_APIENTRY *LPALCOPENDEVICE)(const ALCchar *devicename);
|
||||
typedef ALCboolean (ALC_APIENTRY *LPALCCLOSEDEVICE)(ALCdevice *device);
|
||||
typedef ALCenum (ALC_APIENTRY *LPALCGETERROR)(ALCdevice *device);
|
||||
typedef ALCboolean (ALC_APIENTRY *LPALCISEXTENSIONPRESENT)(ALCdevice *device, const ALCchar *extname);
|
||||
typedef void* (ALC_APIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname);
|
||||
typedef ALCenum (ALC_APIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname);
|
||||
typedef const ALCchar* (ALC_APIENTRY *LPALCGETSTRING)(ALCdevice *device, ALCenum param);
|
||||
typedef void (ALC_APIENTRY *LPALCGETINTEGERV)(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *values);
|
||||
typedef ALCdevice* (ALC_APIENTRY *LPALCCAPTUREOPENDEVICE)(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize);
|
||||
typedef ALCboolean (ALC_APIENTRY *LPALCCAPTURECLOSEDEVICE)(ALCdevice *device);
|
||||
typedef void (ALC_APIENTRY *LPALCCAPTURESTART)(ALCdevice *device);
|
||||
typedef void (ALC_APIENTRY *LPALCCAPTURESTOP)(ALCdevice *device);
|
||||
typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)(ALCdevice *device, ALCvoid *buffer, ALCsizei samples);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* AL_ALC_H */
|
355
neo/libs/openal-soft/include/AL/alext.h
Normal file
355
neo/libs/openal-soft/include/AL/alext.h
Normal file
|
@ -0,0 +1,355 @@
|
|||
/**
|
||||
* OpenAL cross platform audio library
|
||||
* Copyright (C) 2008 by authors.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
* Or go to http://www.gnu.org/copyleft/lgpl.html
|
||||
*/
|
||||
|
||||
#ifndef AL_ALEXT_H
|
||||
#define AL_ALEXT_H
|
||||
|
||||
#include <stddef.h>
|
||||
/* Define int64_t and uint64_t types */
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
#include <inttypes.h>
|
||||
#elif defined(_WIN32) && defined(__GNUC__)
|
||||
#include <stdint.h>
|
||||
#elif defined(_WIN32)
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
/* Fallback if nothing above works */
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#include "alc.h"
|
||||
#include "al.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef AL_LOKI_IMA_ADPCM_format
|
||||
#define AL_LOKI_IMA_ADPCM_format 1
|
||||
#define AL_FORMAT_IMA_ADPCM_MONO16_EXT 0x10000
|
||||
#define AL_FORMAT_IMA_ADPCM_STEREO16_EXT 0x10001
|
||||
#endif
|
||||
|
||||
#ifndef AL_LOKI_WAVE_format
|
||||
#define AL_LOKI_WAVE_format 1
|
||||
#define AL_FORMAT_WAVE_EXT 0x10002
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_vorbis
|
||||
#define AL_EXT_vorbis 1
|
||||
#define AL_FORMAT_VORBIS_EXT 0x10003
|
||||
#endif
|
||||
|
||||
#ifndef AL_LOKI_quadriphonic
|
||||
#define AL_LOKI_quadriphonic 1
|
||||
#define AL_FORMAT_QUAD8_LOKI 0x10004
|
||||
#define AL_FORMAT_QUAD16_LOKI 0x10005
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_float32
|
||||
#define AL_EXT_float32 1
|
||||
#define AL_FORMAT_MONO_FLOAT32 0x10010
|
||||
#define AL_FORMAT_STEREO_FLOAT32 0x10011
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_double
|
||||
#define AL_EXT_double 1
|
||||
#define AL_FORMAT_MONO_DOUBLE_EXT 0x10012
|
||||
#define AL_FORMAT_STEREO_DOUBLE_EXT 0x10013
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_MULAW
|
||||
#define AL_EXT_MULAW 1
|
||||
#define AL_FORMAT_MONO_MULAW_EXT 0x10014
|
||||
#define AL_FORMAT_STEREO_MULAW_EXT 0x10015
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_ALAW
|
||||
#define AL_EXT_ALAW 1
|
||||
#define AL_FORMAT_MONO_ALAW_EXT 0x10016
|
||||
#define AL_FORMAT_STEREO_ALAW_EXT 0x10017
|
||||
#endif
|
||||
|
||||
#ifndef ALC_LOKI_audio_channel
|
||||
#define ALC_LOKI_audio_channel 1
|
||||
#define ALC_CHAN_MAIN_LOKI 0x500001
|
||||
#define ALC_CHAN_PCM_LOKI 0x500002
|
||||
#define ALC_CHAN_CD_LOKI 0x500003
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_MCFORMATS
|
||||
#define AL_EXT_MCFORMATS 1
|
||||
#define AL_FORMAT_QUAD8 0x1204
|
||||
#define AL_FORMAT_QUAD16 0x1205
|
||||
#define AL_FORMAT_QUAD32 0x1206
|
||||
#define AL_FORMAT_REAR8 0x1207
|
||||
#define AL_FORMAT_REAR16 0x1208
|
||||
#define AL_FORMAT_REAR32 0x1209
|
||||
#define AL_FORMAT_51CHN8 0x120A
|
||||
#define AL_FORMAT_51CHN16 0x120B
|
||||
#define AL_FORMAT_51CHN32 0x120C
|
||||
#define AL_FORMAT_61CHN8 0x120D
|
||||
#define AL_FORMAT_61CHN16 0x120E
|
||||
#define AL_FORMAT_61CHN32 0x120F
|
||||
#define AL_FORMAT_71CHN8 0x1210
|
||||
#define AL_FORMAT_71CHN16 0x1211
|
||||
#define AL_FORMAT_71CHN32 0x1212
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_MULAW_MCFORMATS
|
||||
#define AL_EXT_MULAW_MCFORMATS 1
|
||||
#define AL_FORMAT_MONO_MULAW 0x10014
|
||||
#define AL_FORMAT_STEREO_MULAW 0x10015
|
||||
#define AL_FORMAT_QUAD_MULAW 0x10021
|
||||
#define AL_FORMAT_REAR_MULAW 0x10022
|
||||
#define AL_FORMAT_51CHN_MULAW 0x10023
|
||||
#define AL_FORMAT_61CHN_MULAW 0x10024
|
||||
#define AL_FORMAT_71CHN_MULAW 0x10025
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_IMA4
|
||||
#define AL_EXT_IMA4 1
|
||||
#define AL_FORMAT_MONO_IMA4 0x1300
|
||||
#define AL_FORMAT_STEREO_IMA4 0x1301
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_STATIC_BUFFER
|
||||
#define AL_EXT_STATIC_BUFFER 1
|
||||
typedef ALvoid (AL_APIENTRY*PFNALBUFFERDATASTATICPROC)(const ALint,ALenum,ALvoid*,ALsizei,ALsizei);
|
||||
#ifdef AL_ALEXT_PROTOTYPES
|
||||
AL_API ALvoid AL_APIENTRY alBufferDataStatic(const ALint buffer, ALenum format, ALvoid *data, ALsizei len, ALsizei freq);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ALC_EXT_EFX
|
||||
#define ALC_EXT_EFX 1
|
||||
#include "efx.h"
|
||||
#endif
|
||||
|
||||
#ifndef ALC_EXT_disconnect
|
||||
#define ALC_EXT_disconnect 1
|
||||
#define ALC_CONNECTED 0x313
|
||||
#endif
|
||||
|
||||
#ifndef ALC_EXT_thread_local_context
|
||||
#define ALC_EXT_thread_local_context 1
|
||||
typedef ALCboolean (ALC_APIENTRY*PFNALCSETTHREADCONTEXTPROC)(ALCcontext *context);
|
||||
typedef ALCcontext* (ALC_APIENTRY*PFNALCGETTHREADCONTEXTPROC)(void);
|
||||
#ifdef AL_ALEXT_PROTOTYPES
|
||||
ALC_API ALCboolean ALC_APIENTRY alcSetThreadContext(ALCcontext *context);
|
||||
ALC_API ALCcontext* ALC_APIENTRY alcGetThreadContext(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_source_distance_model
|
||||
#define AL_EXT_source_distance_model 1
|
||||
#define AL_SOURCE_DISTANCE_MODEL 0x200
|
||||
#endif
|
||||
|
||||
#ifndef AL_SOFT_buffer_sub_data
|
||||
#define AL_SOFT_buffer_sub_data 1
|
||||
#define AL_BYTE_RW_OFFSETS_SOFT 0x1031
|
||||
#define AL_SAMPLE_RW_OFFSETS_SOFT 0x1032
|
||||
typedef ALvoid (AL_APIENTRY*PFNALBUFFERSUBDATASOFTPROC)(ALuint,ALenum,const ALvoid*,ALsizei,ALsizei);
|
||||
#ifdef AL_ALEXT_PROTOTYPES
|
||||
AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const ALvoid *data,ALsizei offset,ALsizei length);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef AL_SOFT_loop_points
|
||||
#define AL_SOFT_loop_points 1
|
||||
#define AL_LOOP_POINTS_SOFT 0x2015
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_FOLDBACK
|
||||
#define AL_EXT_FOLDBACK 1
|
||||
#define AL_EXT_FOLDBACK_NAME "AL_EXT_FOLDBACK"
|
||||
#define AL_FOLDBACK_EVENT_BLOCK 0x4112
|
||||
#define AL_FOLDBACK_EVENT_START 0x4111
|
||||
#define AL_FOLDBACK_EVENT_STOP 0x4113
|
||||
#define AL_FOLDBACK_MODE_MONO 0x4101
|
||||
#define AL_FOLDBACK_MODE_STEREO 0x4102
|
||||
typedef void (AL_APIENTRY*LPALFOLDBACKCALLBACK)(ALenum,ALsizei);
|
||||
typedef void (AL_APIENTRY*LPALREQUESTFOLDBACKSTART)(ALenum,ALsizei,ALsizei,ALfloat*,LPALFOLDBACKCALLBACK);
|
||||
typedef void (AL_APIENTRY*LPALREQUESTFOLDBACKSTOP)(void);
|
||||
#ifdef AL_ALEXT_PROTOTYPES
|
||||
AL_API void AL_APIENTRY alRequestFoldbackStart(ALenum mode,ALsizei count,ALsizei length,ALfloat *mem,LPALFOLDBACKCALLBACK callback);
|
||||
AL_API void AL_APIENTRY alRequestFoldbackStop(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ALC_EXT_DEDICATED
|
||||
#define ALC_EXT_DEDICATED 1
|
||||
#define AL_DEDICATED_GAIN 0x0001
|
||||
#define AL_EFFECT_DEDICATED_DIALOGUE 0x9001
|
||||
#define AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT 0x9000
|
||||
#endif
|
||||
|
||||
#ifndef AL_SOFT_buffer_samples
|
||||
#define AL_SOFT_buffer_samples 1
|
||||
/* Channel configurations */
|
||||
#define AL_MONO_SOFT 0x1500
|
||||
#define AL_STEREO_SOFT 0x1501
|
||||
#define AL_REAR_SOFT 0x1502
|
||||
#define AL_QUAD_SOFT 0x1503
|
||||
#define AL_5POINT1_SOFT 0x1504
|
||||
#define AL_6POINT1_SOFT 0x1505
|
||||
#define AL_7POINT1_SOFT 0x1506
|
||||
|
||||
/* Sample types */
|
||||
#define AL_BYTE_SOFT 0x1400
|
||||
#define AL_UNSIGNED_BYTE_SOFT 0x1401
|
||||
#define AL_SHORT_SOFT 0x1402
|
||||
#define AL_UNSIGNED_SHORT_SOFT 0x1403
|
||||
#define AL_INT_SOFT 0x1404
|
||||
#define AL_UNSIGNED_INT_SOFT 0x1405
|
||||
#define AL_FLOAT_SOFT 0x1406
|
||||
#define AL_DOUBLE_SOFT 0x1407
|
||||
#define AL_BYTE3_SOFT 0x1408
|
||||
#define AL_UNSIGNED_BYTE3_SOFT 0x1409
|
||||
|
||||
/* Storage formats */
|
||||
#define AL_MONO8_SOFT 0x1100
|
||||
#define AL_MONO16_SOFT 0x1101
|
||||
#define AL_MONO32F_SOFT 0x10010
|
||||
#define AL_STEREO8_SOFT 0x1102
|
||||
#define AL_STEREO16_SOFT 0x1103
|
||||
#define AL_STEREO32F_SOFT 0x10011
|
||||
#define AL_QUAD8_SOFT 0x1204
|
||||
#define AL_QUAD16_SOFT 0x1205
|
||||
#define AL_QUAD32F_SOFT 0x1206
|
||||
#define AL_REAR8_SOFT 0x1207
|
||||
#define AL_REAR16_SOFT 0x1208
|
||||
#define AL_REAR32F_SOFT 0x1209
|
||||
#define AL_5POINT1_8_SOFT 0x120A
|
||||
#define AL_5POINT1_16_SOFT 0x120B
|
||||
#define AL_5POINT1_32F_SOFT 0x120C
|
||||
#define AL_6POINT1_8_SOFT 0x120D
|
||||
#define AL_6POINT1_16_SOFT 0x120E
|
||||
#define AL_6POINT1_32F_SOFT 0x120F
|
||||
#define AL_7POINT1_8_SOFT 0x1210
|
||||
#define AL_7POINT1_16_SOFT 0x1211
|
||||
#define AL_7POINT1_32F_SOFT 0x1212
|
||||
|
||||
/* Buffer attributes */
|
||||
#define AL_INTERNAL_FORMAT_SOFT 0x2008
|
||||
#define AL_BYTE_LENGTH_SOFT 0x2009
|
||||
#define AL_SAMPLE_LENGTH_SOFT 0x200A
|
||||
#define AL_SEC_LENGTH_SOFT 0x200B
|
||||
|
||||
typedef void (AL_APIENTRY*LPALBUFFERSAMPLESSOFT)(ALuint,ALuint,ALenum,ALsizei,ALenum,ALenum,const ALvoid*);
|
||||
typedef void (AL_APIENTRY*LPALBUFFERSUBSAMPLESSOFT)(ALuint,ALsizei,ALsizei,ALenum,ALenum,const ALvoid*);
|
||||
typedef void (AL_APIENTRY*LPALGETBUFFERSAMPLESSOFT)(ALuint,ALsizei,ALsizei,ALenum,ALenum,ALvoid*);
|
||||
typedef ALboolean (AL_APIENTRY*LPALISBUFFERFORMATSUPPORTEDSOFT)(ALenum);
|
||||
#ifdef AL_ALEXT_PROTOTYPES
|
||||
AL_API void AL_APIENTRY alBufferSamplesSOFT(ALuint buffer, ALuint samplerate, ALenum internalformat, ALsizei samples, ALenum channels, ALenum type, const ALvoid *data);
|
||||
AL_API void AL_APIENTRY alBufferSubSamplesSOFT(ALuint buffer, ALsizei offset, ALsizei samples, ALenum channels, ALenum type, const ALvoid *data);
|
||||
AL_API void AL_APIENTRY alGetBufferSamplesSOFT(ALuint buffer, ALsizei offset, ALsizei samples, ALenum channels, ALenum type, ALvoid *data);
|
||||
AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum format);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef AL_SOFT_direct_channels
|
||||
#define AL_SOFT_direct_channels 1
|
||||
#define AL_DIRECT_CHANNELS_SOFT 0x1033
|
||||
#endif
|
||||
|
||||
#ifndef ALC_SOFT_loopback
|
||||
#define ALC_SOFT_loopback 1
|
||||
#define ALC_FORMAT_CHANNELS_SOFT 0x1990
|
||||
#define ALC_FORMAT_TYPE_SOFT 0x1991
|
||||
|
||||
/* Sample types */
|
||||
#define ALC_BYTE_SOFT 0x1400
|
||||
#define ALC_UNSIGNED_BYTE_SOFT 0x1401
|
||||
#define ALC_SHORT_SOFT 0x1402
|
||||
#define ALC_UNSIGNED_SHORT_SOFT 0x1403
|
||||
#define ALC_INT_SOFT 0x1404
|
||||
#define ALC_UNSIGNED_INT_SOFT 0x1405
|
||||
#define ALC_FLOAT_SOFT 0x1406
|
||||
|
||||
/* Channel configurations */
|
||||
#define ALC_MONO_SOFT 0x1500
|
||||
#define ALC_STEREO_SOFT 0x1501
|
||||
#define ALC_QUAD_SOFT 0x1503
|
||||
#define ALC_5POINT1_SOFT 0x1504
|
||||
#define ALC_6POINT1_SOFT 0x1505
|
||||
#define ALC_7POINT1_SOFT 0x1506
|
||||
|
||||
typedef ALCdevice* (ALC_APIENTRY*LPALCLOOPBACKOPENDEVICESOFT)(const ALCchar*);
|
||||
typedef ALCboolean (ALC_APIENTRY*LPALCISRENDERFORMATSUPPORTEDSOFT)(ALCdevice*,ALCsizei,ALCenum,ALCenum);
|
||||
typedef void (ALC_APIENTRY*LPALCRENDERSAMPLESSOFT)(ALCdevice*,ALCvoid*,ALCsizei);
|
||||
#ifdef AL_ALEXT_PROTOTYPES
|
||||
ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceName);
|
||||
ALC_API ALCboolean ALC_APIENTRY alcIsRenderFormatSupportedSOFT(ALCdevice *device, ALCsizei freq, ALCenum channels, ALCenum type);
|
||||
ALC_API void ALC_APIENTRY alcRenderSamplesSOFT(ALCdevice *device, ALCvoid *buffer, ALCsizei samples);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_STEREO_ANGLES
|
||||
#define AL_EXT_STEREO_ANGLES 1
|
||||
#define AL_STEREO_ANGLES 0x1030
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_SOURCE_RADIUS
|
||||
#define AL_EXT_SOURCE_RADIUS 1
|
||||
#define AL_SOURCE_RADIUS 0x1031
|
||||
#endif
|
||||
|
||||
#ifndef AL_SOFT_source_latency
|
||||
#define AL_SOFT_source_latency 1
|
||||
#define AL_SAMPLE_OFFSET_LATENCY_SOFT 0x1200
|
||||
#define AL_SEC_OFFSET_LATENCY_SOFT 0x1201
|
||||
typedef int64_t ALint64SOFT;
|
||||
typedef uint64_t ALuint64SOFT;
|
||||
typedef void (AL_APIENTRY*LPALSOURCEDSOFT)(ALuint,ALenum,ALdouble);
|
||||
typedef void (AL_APIENTRY*LPALSOURCE3DSOFT)(ALuint,ALenum,ALdouble,ALdouble,ALdouble);
|
||||
typedef void (AL_APIENTRY*LPALSOURCEDVSOFT)(ALuint,ALenum,const ALdouble*);
|
||||
typedef void (AL_APIENTRY*LPALGETSOURCEDSOFT)(ALuint,ALenum,ALdouble*);
|
||||
typedef void (AL_APIENTRY*LPALGETSOURCE3DSOFT)(ALuint,ALenum,ALdouble*,ALdouble*,ALdouble*);
|
||||
typedef void (AL_APIENTRY*LPALGETSOURCEDVSOFT)(ALuint,ALenum,ALdouble*);
|
||||
typedef void (AL_APIENTRY*LPALSOURCEI64SOFT)(ALuint,ALenum,ALint64SOFT);
|
||||
typedef void (AL_APIENTRY*LPALSOURCE3I64SOFT)(ALuint,ALenum,ALint64SOFT,ALint64SOFT,ALint64SOFT);
|
||||
typedef void (AL_APIENTRY*LPALSOURCEI64VSOFT)(ALuint,ALenum,const ALint64SOFT*);
|
||||
typedef void (AL_APIENTRY*LPALGETSOURCEI64SOFT)(ALuint,ALenum,ALint64SOFT*);
|
||||
typedef void (AL_APIENTRY*LPALGETSOURCE3I64SOFT)(ALuint,ALenum,ALint64SOFT*,ALint64SOFT*,ALint64SOFT*);
|
||||
typedef void (AL_APIENTRY*LPALGETSOURCEI64VSOFT)(ALuint,ALenum,ALint64SOFT*);
|
||||
#ifdef AL_ALEXT_PROTOTYPES
|
||||
AL_API void AL_APIENTRY alSourcedSOFT(ALuint source, ALenum param, ALdouble value);
|
||||
AL_API void AL_APIENTRY alSource3dSOFT(ALuint source, ALenum param, ALdouble value1, ALdouble value2, ALdouble value3);
|
||||
AL_API void AL_APIENTRY alSourcedvSOFT(ALuint source, ALenum param, const ALdouble *values);
|
||||
AL_API void AL_APIENTRY alGetSourcedSOFT(ALuint source, ALenum param, ALdouble *value);
|
||||
AL_API void AL_APIENTRY alGetSource3dSOFT(ALuint source, ALenum param, ALdouble *value1, ALdouble *value2, ALdouble *value3);
|
||||
AL_API void AL_APIENTRY alGetSourcedvSOFT(ALuint source, ALenum param, ALdouble *values);
|
||||
AL_API void AL_APIENTRY alSourcei64SOFT(ALuint source, ALenum param, ALint64SOFT value);
|
||||
AL_API void AL_APIENTRY alSource3i64SOFT(ALuint source, ALenum param, ALint64SOFT value1, ALint64SOFT value2, ALint64SOFT value3);
|
||||
AL_API void AL_APIENTRY alSourcei64vSOFT(ALuint source, ALenum param, const ALint64SOFT *values);
|
||||
AL_API void AL_APIENTRY alGetSourcei64SOFT(ALuint source, ALenum param, ALint64SOFT *value);
|
||||
AL_API void AL_APIENTRY alGetSource3i64SOFT(ALuint source, ALenum param, ALint64SOFT *value1, ALint64SOFT *value2, ALint64SOFT *value3);
|
||||
AL_API void AL_APIENTRY alGetSourcei64vSOFT(ALuint source, ALenum param, ALint64SOFT *values);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
3
neo/libs/openal-soft/include/AL/efx-creative.h
Normal file
3
neo/libs/openal-soft/include/AL/efx-creative.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* The tokens that would be defined here are already defined in efx.h. This
|
||||
* empty file is here to provide compatibility with Windows-based projects
|
||||
* that would include it. */
|
402
neo/libs/openal-soft/include/AL/efx-presets.h
Normal file
402
neo/libs/openal-soft/include/AL/efx-presets.h
Normal file
|
@ -0,0 +1,402 @@
|
|||
/* Reverb presets for EFX */
|
||||
|
||||
#ifndef EFX_PRESETS_H
|
||||
#define EFX_PRESETS_H
|
||||
|
||||
#ifndef EFXEAXREVERBPROPERTIES_DEFINED
|
||||
#define EFXEAXREVERBPROPERTIES_DEFINED
|
||||
typedef struct {
|
||||
float flDensity;
|
||||
float flDiffusion;
|
||||
float flGain;
|
||||
float flGainHF;
|
||||
float flGainLF;
|
||||
float flDecayTime;
|
||||
float flDecayHFRatio;
|
||||
float flDecayLFRatio;
|
||||
float flReflectionsGain;
|
||||
float flReflectionsDelay;
|
||||
float flReflectionsPan[3];
|
||||
float flLateReverbGain;
|
||||
float flLateReverbDelay;
|
||||
float flLateReverbPan[3];
|
||||
float flEchoTime;
|
||||
float flEchoDepth;
|
||||
float flModulationTime;
|
||||
float flModulationDepth;
|
||||
float flAirAbsorptionGainHF;
|
||||
float flHFReference;
|
||||
float flLFReference;
|
||||
float flRoomRolloffFactor;
|
||||
int iDecayHFLimit;
|
||||
} EFXEAXREVERBPROPERTIES, *LPEFXEAXREVERBPROPERTIES;
|
||||
#endif
|
||||
|
||||
/* Default Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_GENERIC \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.8913f, 1.0000f, 1.4900f, 0.8300f, 1.0000f, 0.0500f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0110f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_PADDEDCELL \
|
||||
{ 0.1715f, 1.0000f, 0.3162f, 0.0010f, 1.0000f, 0.1700f, 0.1000f, 1.0000f, 0.2500f, 0.0010f, { 0.0000f, 0.0000f, 0.0000f }, 1.2691f, 0.0020f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_ROOM \
|
||||
{ 0.4287f, 1.0000f, 0.3162f, 0.5929f, 1.0000f, 0.4000f, 0.8300f, 1.0000f, 0.1503f, 0.0020f, { 0.0000f, 0.0000f, 0.0000f }, 1.0629f, 0.0030f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_BATHROOM \
|
||||
{ 0.1715f, 1.0000f, 0.3162f, 0.2512f, 1.0000f, 1.4900f, 0.5400f, 1.0000f, 0.6531f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 3.2734f, 0.0110f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_LIVINGROOM \
|
||||
{ 0.9766f, 1.0000f, 0.3162f, 0.0010f, 1.0000f, 0.5000f, 0.1000f, 1.0000f, 0.2051f, 0.0030f, { 0.0000f, 0.0000f, 0.0000f }, 0.2805f, 0.0040f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_STONEROOM \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.7079f, 1.0000f, 2.3100f, 0.6400f, 1.0000f, 0.4411f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 1.1003f, 0.0170f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_AUDITORIUM \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.5781f, 1.0000f, 4.3200f, 0.5900f, 1.0000f, 0.4032f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 0.7170f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CONCERTHALL \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.5623f, 1.0000f, 3.9200f, 0.7000f, 1.0000f, 0.2427f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 0.9977f, 0.0290f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CAVE \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 1.0000f, 1.0000f, 2.9100f, 1.3000f, 1.0000f, 0.5000f, 0.0150f, { 0.0000f, 0.0000f, 0.0000f }, 0.7063f, 0.0220f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_ARENA \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.4477f, 1.0000f, 7.2400f, 0.3300f, 1.0000f, 0.2612f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 1.0186f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_HANGAR \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.3162f, 1.0000f, 10.0500f, 0.2300f, 1.0000f, 0.5000f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 1.2560f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CARPETEDHALLWAY \
|
||||
{ 0.4287f, 1.0000f, 0.3162f, 0.0100f, 1.0000f, 0.3000f, 0.1000f, 1.0000f, 0.1215f, 0.0020f, { 0.0000f, 0.0000f, 0.0000f }, 0.1531f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_HALLWAY \
|
||||
{ 0.3645f, 1.0000f, 0.3162f, 0.7079f, 1.0000f, 1.4900f, 0.5900f, 1.0000f, 0.2458f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 1.6615f, 0.0110f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_STONECORRIDOR \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.7612f, 1.0000f, 2.7000f, 0.7900f, 1.0000f, 0.2472f, 0.0130f, { 0.0000f, 0.0000f, 0.0000f }, 1.5758f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_ALLEY \
|
||||
{ 1.0000f, 0.3000f, 0.3162f, 0.7328f, 1.0000f, 1.4900f, 0.8600f, 1.0000f, 0.2500f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 0.9954f, 0.0110f, { 0.0000f, 0.0000f, 0.0000f }, 0.1250f, 0.9500f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_FOREST \
|
||||
{ 1.0000f, 0.3000f, 0.3162f, 0.0224f, 1.0000f, 1.4900f, 0.5400f, 1.0000f, 0.0525f, 0.1620f, { 0.0000f, 0.0000f, 0.0000f }, 0.7682f, 0.0880f, { 0.0000f, 0.0000f, 0.0000f }, 0.1250f, 1.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CITY \
|
||||
{ 1.0000f, 0.5000f, 0.3162f, 0.3981f, 1.0000f, 1.4900f, 0.6700f, 1.0000f, 0.0730f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 0.1427f, 0.0110f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_MOUNTAINS \
|
||||
{ 1.0000f, 0.2700f, 0.3162f, 0.0562f, 1.0000f, 1.4900f, 0.2100f, 1.0000f, 0.0407f, 0.3000f, { 0.0000f, 0.0000f, 0.0000f }, 0.1919f, 0.1000f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 1.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_QUARRY \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.3162f, 1.0000f, 1.4900f, 0.8300f, 1.0000f, 0.0000f, 0.0610f, { 0.0000f, 0.0000f, 0.0000f }, 1.7783f, 0.0250f, { 0.0000f, 0.0000f, 0.0000f }, 0.1250f, 0.7000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_PLAIN \
|
||||
{ 1.0000f, 0.2100f, 0.3162f, 0.1000f, 1.0000f, 1.4900f, 0.5000f, 1.0000f, 0.0585f, 0.1790f, { 0.0000f, 0.0000f, 0.0000f }, 0.1089f, 0.1000f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 1.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_PARKINGLOT \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 1.0000f, 1.0000f, 1.6500f, 1.5000f, 1.0000f, 0.2082f, 0.0080f, { 0.0000f, 0.0000f, 0.0000f }, 0.2652f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SEWERPIPE \
|
||||
{ 0.3071f, 0.8000f, 0.3162f, 0.3162f, 1.0000f, 2.8100f, 0.1400f, 1.0000f, 1.6387f, 0.0140f, { 0.0000f, 0.0000f, 0.0000f }, 3.2471f, 0.0210f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_UNDERWATER \
|
||||
{ 0.3645f, 1.0000f, 0.3162f, 0.0100f, 1.0000f, 1.4900f, 0.1000f, 1.0000f, 0.5963f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 7.0795f, 0.0110f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 1.1800f, 0.3480f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_DRUGGED \
|
||||
{ 0.4287f, 0.5000f, 0.3162f, 1.0000f, 1.0000f, 8.3900f, 1.3900f, 1.0000f, 0.8760f, 0.0020f, { 0.0000f, 0.0000f, 0.0000f }, 3.1081f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 1.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_DIZZY \
|
||||
{ 0.3645f, 0.6000f, 0.3162f, 0.6310f, 1.0000f, 17.2300f, 0.5600f, 1.0000f, 0.1392f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 0.4937f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 1.0000f, 0.8100f, 0.3100f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_PSYCHOTIC \
|
||||
{ 0.0625f, 0.5000f, 0.3162f, 0.8404f, 1.0000f, 7.5600f, 0.9100f, 1.0000f, 0.4864f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 2.4378f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 4.0000f, 1.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
/* Castle Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_CASTLE_SMALLROOM \
|
||||
{ 1.0000f, 0.8900f, 0.3162f, 0.3981f, 0.1000f, 1.2200f, 0.8300f, 0.3100f, 0.8913f, 0.0220f, { 0.0000f, 0.0000f, 0.0000f }, 1.9953f, 0.0110f, { 0.0000f, 0.0000f, 0.0000f }, 0.1380f, 0.0800f, 0.2500f, 0.0000f, 0.9943f, 5168.6001f, 139.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CASTLE_SHORTPASSAGE \
|
||||
{ 1.0000f, 0.8900f, 0.3162f, 0.3162f, 0.1000f, 2.3200f, 0.8300f, 0.3100f, 0.8913f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0230f, { 0.0000f, 0.0000f, 0.0000f }, 0.1380f, 0.0800f, 0.2500f, 0.0000f, 0.9943f, 5168.6001f, 139.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CASTLE_MEDIUMROOM \
|
||||
{ 1.0000f, 0.9300f, 0.3162f, 0.2818f, 0.1000f, 2.0400f, 0.8300f, 0.4600f, 0.6310f, 0.0220f, { 0.0000f, 0.0000f, 0.0000f }, 1.5849f, 0.0110f, { 0.0000f, 0.0000f, 0.0000f }, 0.1550f, 0.0300f, 0.2500f, 0.0000f, 0.9943f, 5168.6001f, 139.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CASTLE_LARGEROOM \
|
||||
{ 1.0000f, 0.8200f, 0.3162f, 0.2818f, 0.1259f, 2.5300f, 0.8300f, 0.5000f, 0.4467f, 0.0340f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0160f, { 0.0000f, 0.0000f, 0.0000f }, 0.1850f, 0.0700f, 0.2500f, 0.0000f, 0.9943f, 5168.6001f, 139.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CASTLE_LONGPASSAGE \
|
||||
{ 1.0000f, 0.8900f, 0.3162f, 0.3981f, 0.1000f, 3.4200f, 0.8300f, 0.3100f, 0.8913f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 1.4125f, 0.0230f, { 0.0000f, 0.0000f, 0.0000f }, 0.1380f, 0.0800f, 0.2500f, 0.0000f, 0.9943f, 5168.6001f, 139.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CASTLE_HALL \
|
||||
{ 1.0000f, 0.8100f, 0.3162f, 0.2818f, 0.1778f, 3.1400f, 0.7900f, 0.6200f, 0.1778f, 0.0560f, { 0.0000f, 0.0000f, 0.0000f }, 1.1220f, 0.0240f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5168.6001f, 139.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CASTLE_CUPBOARD \
|
||||
{ 1.0000f, 0.8900f, 0.3162f, 0.2818f, 0.1000f, 0.6700f, 0.8700f, 0.3100f, 1.4125f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 3.5481f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 0.1380f, 0.0800f, 0.2500f, 0.0000f, 0.9943f, 5168.6001f, 139.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CASTLE_COURTYARD \
|
||||
{ 1.0000f, 0.4200f, 0.3162f, 0.4467f, 0.1995f, 2.1300f, 0.6100f, 0.2300f, 0.2239f, 0.1600f, { 0.0000f, 0.0000f, 0.0000f }, 0.7079f, 0.0360f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.3700f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CASTLE_ALCOVE \
|
||||
{ 1.0000f, 0.8900f, 0.3162f, 0.5012f, 0.1000f, 1.6400f, 0.8700f, 0.3100f, 1.0000f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 1.4125f, 0.0340f, { 0.0000f, 0.0000f, 0.0000f }, 0.1380f, 0.0800f, 0.2500f, 0.0000f, 0.9943f, 5168.6001f, 139.5000f, 0.0000f, 0x1 }
|
||||
|
||||
/* Factory Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_FACTORY_SMALLROOM \
|
||||
{ 0.3645f, 0.8200f, 0.3162f, 0.7943f, 0.5012f, 1.7200f, 0.6500f, 1.3100f, 0.7079f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 1.7783f, 0.0240f, { 0.0000f, 0.0000f, 0.0000f }, 0.1190f, 0.0700f, 0.2500f, 0.0000f, 0.9943f, 3762.6001f, 362.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_FACTORY_SHORTPASSAGE \
|
||||
{ 0.3645f, 0.6400f, 0.2512f, 0.7943f, 0.5012f, 2.5300f, 0.6500f, 1.3100f, 1.0000f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0380f, { 0.0000f, 0.0000f, 0.0000f }, 0.1350f, 0.2300f, 0.2500f, 0.0000f, 0.9943f, 3762.6001f, 362.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_FACTORY_MEDIUMROOM \
|
||||
{ 0.4287f, 0.8200f, 0.2512f, 0.7943f, 0.5012f, 2.7600f, 0.6500f, 1.3100f, 0.2818f, 0.0220f, { 0.0000f, 0.0000f, 0.0000f }, 1.4125f, 0.0230f, { 0.0000f, 0.0000f, 0.0000f }, 0.1740f, 0.0700f, 0.2500f, 0.0000f, 0.9943f, 3762.6001f, 362.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_FACTORY_LARGEROOM \
|
||||
{ 0.4287f, 0.7500f, 0.2512f, 0.7079f, 0.6310f, 4.2400f, 0.5100f, 1.3100f, 0.1778f, 0.0390f, { 0.0000f, 0.0000f, 0.0000f }, 1.1220f, 0.0230f, { 0.0000f, 0.0000f, 0.0000f }, 0.2310f, 0.0700f, 0.2500f, 0.0000f, 0.9943f, 3762.6001f, 362.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_FACTORY_LONGPASSAGE \
|
||||
{ 0.3645f, 0.6400f, 0.2512f, 0.7943f, 0.5012f, 4.0600f, 0.6500f, 1.3100f, 1.0000f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0370f, { 0.0000f, 0.0000f, 0.0000f }, 0.1350f, 0.2300f, 0.2500f, 0.0000f, 0.9943f, 3762.6001f, 362.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_FACTORY_HALL \
|
||||
{ 0.4287f, 0.7500f, 0.3162f, 0.7079f, 0.6310f, 7.4300f, 0.5100f, 1.3100f, 0.0631f, 0.0730f, { 0.0000f, 0.0000f, 0.0000f }, 0.8913f, 0.0270f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0700f, 0.2500f, 0.0000f, 0.9943f, 3762.6001f, 362.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_FACTORY_CUPBOARD \
|
||||
{ 0.3071f, 0.6300f, 0.2512f, 0.7943f, 0.5012f, 0.4900f, 0.6500f, 1.3100f, 1.2589f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 1.9953f, 0.0320f, { 0.0000f, 0.0000f, 0.0000f }, 0.1070f, 0.0700f, 0.2500f, 0.0000f, 0.9943f, 3762.6001f, 362.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_FACTORY_COURTYARD \
|
||||
{ 0.3071f, 0.5700f, 0.3162f, 0.3162f, 0.6310f, 2.3200f, 0.2900f, 0.5600f, 0.2239f, 0.1400f, { 0.0000f, 0.0000f, 0.0000f }, 0.3981f, 0.0390f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.2900f, 0.2500f, 0.0000f, 0.9943f, 3762.6001f, 362.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_FACTORY_ALCOVE \
|
||||
{ 0.3645f, 0.5900f, 0.2512f, 0.7943f, 0.5012f, 3.1400f, 0.6500f, 1.3100f, 1.4125f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 1.0000f, 0.0380f, { 0.0000f, 0.0000f, 0.0000f }, 0.1140f, 0.1000f, 0.2500f, 0.0000f, 0.9943f, 3762.6001f, 362.5000f, 0.0000f, 0x1 }
|
||||
|
||||
/* Ice Palace Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_ICEPALACE_SMALLROOM \
|
||||
{ 1.0000f, 0.8400f, 0.3162f, 0.5623f, 0.2818f, 1.5100f, 1.5300f, 0.2700f, 0.8913f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 1.4125f, 0.0110f, { 0.0000f, 0.0000f, 0.0000f }, 0.1640f, 0.1400f, 0.2500f, 0.0000f, 0.9943f, 12428.5000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_ICEPALACE_SHORTPASSAGE \
|
||||
{ 1.0000f, 0.7500f, 0.3162f, 0.5623f, 0.2818f, 1.7900f, 1.4600f, 0.2800f, 0.5012f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 1.1220f, 0.0190f, { 0.0000f, 0.0000f, 0.0000f }, 0.1770f, 0.0900f, 0.2500f, 0.0000f, 0.9943f, 12428.5000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_ICEPALACE_MEDIUMROOM \
|
||||
{ 1.0000f, 0.8700f, 0.3162f, 0.5623f, 0.4467f, 2.2200f, 1.5300f, 0.3200f, 0.3981f, 0.0390f, { 0.0000f, 0.0000f, 0.0000f }, 1.1220f, 0.0270f, { 0.0000f, 0.0000f, 0.0000f }, 0.1860f, 0.1200f, 0.2500f, 0.0000f, 0.9943f, 12428.5000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_ICEPALACE_LARGEROOM \
|
||||
{ 1.0000f, 0.8100f, 0.3162f, 0.5623f, 0.4467f, 3.1400f, 1.5300f, 0.3200f, 0.2512f, 0.0390f, { 0.0000f, 0.0000f, 0.0000f }, 1.0000f, 0.0270f, { 0.0000f, 0.0000f, 0.0000f }, 0.2140f, 0.1100f, 0.2500f, 0.0000f, 0.9943f, 12428.5000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_ICEPALACE_LONGPASSAGE \
|
||||
{ 1.0000f, 0.7700f, 0.3162f, 0.5623f, 0.3981f, 3.0100f, 1.4600f, 0.2800f, 0.7943f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0250f, { 0.0000f, 0.0000f, 0.0000f }, 0.1860f, 0.0400f, 0.2500f, 0.0000f, 0.9943f, 12428.5000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_ICEPALACE_HALL \
|
||||
{ 1.0000f, 0.7600f, 0.3162f, 0.4467f, 0.5623f, 5.4900f, 1.5300f, 0.3800f, 0.1122f, 0.0540f, { 0.0000f, 0.0000f, 0.0000f }, 0.6310f, 0.0520f, { 0.0000f, 0.0000f, 0.0000f }, 0.2260f, 0.1100f, 0.2500f, 0.0000f, 0.9943f, 12428.5000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_ICEPALACE_CUPBOARD \
|
||||
{ 1.0000f, 0.8300f, 0.3162f, 0.5012f, 0.2239f, 0.7600f, 1.5300f, 0.2600f, 1.1220f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 1.9953f, 0.0160f, { 0.0000f, 0.0000f, 0.0000f }, 0.1430f, 0.0800f, 0.2500f, 0.0000f, 0.9943f, 12428.5000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_ICEPALACE_COURTYARD \
|
||||
{ 1.0000f, 0.5900f, 0.3162f, 0.2818f, 0.3162f, 2.0400f, 1.2000f, 0.3800f, 0.3162f, 0.1730f, { 0.0000f, 0.0000f, 0.0000f }, 0.3162f, 0.0430f, { 0.0000f, 0.0000f, 0.0000f }, 0.2350f, 0.4800f, 0.2500f, 0.0000f, 0.9943f, 12428.5000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_ICEPALACE_ALCOVE \
|
||||
{ 1.0000f, 0.8400f, 0.3162f, 0.5623f, 0.2818f, 2.7600f, 1.4600f, 0.2800f, 1.1220f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 0.8913f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.1610f, 0.0900f, 0.2500f, 0.0000f, 0.9943f, 12428.5000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
/* Space Station Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_SPACESTATION_SMALLROOM \
|
||||
{ 0.2109f, 0.7000f, 0.3162f, 0.7079f, 0.8913f, 1.7200f, 0.8200f, 0.5500f, 0.7943f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 1.4125f, 0.0130f, { 0.0000f, 0.0000f, 0.0000f }, 0.1880f, 0.2600f, 0.2500f, 0.0000f, 0.9943f, 3316.1001f, 458.2000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPACESTATION_SHORTPASSAGE \
|
||||
{ 0.2109f, 0.8700f, 0.3162f, 0.6310f, 0.8913f, 3.5700f, 0.5000f, 0.5500f, 1.0000f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 1.1220f, 0.0160f, { 0.0000f, 0.0000f, 0.0000f }, 0.1720f, 0.2000f, 0.2500f, 0.0000f, 0.9943f, 3316.1001f, 458.2000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPACESTATION_MEDIUMROOM \
|
||||
{ 0.2109f, 0.7500f, 0.3162f, 0.6310f, 0.8913f, 3.0100f, 0.5000f, 0.5500f, 0.3981f, 0.0340f, { 0.0000f, 0.0000f, 0.0000f }, 1.1220f, 0.0350f, { 0.0000f, 0.0000f, 0.0000f }, 0.2090f, 0.3100f, 0.2500f, 0.0000f, 0.9943f, 3316.1001f, 458.2000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPACESTATION_LARGEROOM \
|
||||
{ 0.3645f, 0.8100f, 0.3162f, 0.6310f, 0.8913f, 3.8900f, 0.3800f, 0.6100f, 0.3162f, 0.0560f, { 0.0000f, 0.0000f, 0.0000f }, 0.8913f, 0.0350f, { 0.0000f, 0.0000f, 0.0000f }, 0.2330f, 0.2800f, 0.2500f, 0.0000f, 0.9943f, 3316.1001f, 458.2000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPACESTATION_LONGPASSAGE \
|
||||
{ 0.4287f, 0.8200f, 0.3162f, 0.6310f, 0.8913f, 4.6200f, 0.6200f, 0.5500f, 1.0000f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0310f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.2300f, 0.2500f, 0.0000f, 0.9943f, 3316.1001f, 458.2000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPACESTATION_HALL \
|
||||
{ 0.4287f, 0.8700f, 0.3162f, 0.6310f, 0.8913f, 7.1100f, 0.3800f, 0.6100f, 0.1778f, 0.1000f, { 0.0000f, 0.0000f, 0.0000f }, 0.6310f, 0.0470f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.2500f, 0.2500f, 0.0000f, 0.9943f, 3316.1001f, 458.2000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPACESTATION_CUPBOARD \
|
||||
{ 0.1715f, 0.5600f, 0.3162f, 0.7079f, 0.8913f, 0.7900f, 0.8100f, 0.5500f, 1.4125f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 1.7783f, 0.0180f, { 0.0000f, 0.0000f, 0.0000f }, 0.1810f, 0.3100f, 0.2500f, 0.0000f, 0.9943f, 3316.1001f, 458.2000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPACESTATION_ALCOVE \
|
||||
{ 0.2109f, 0.7800f, 0.3162f, 0.7079f, 0.8913f, 1.1600f, 0.8100f, 0.5500f, 1.4125f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 1.0000f, 0.0180f, { 0.0000f, 0.0000f, 0.0000f }, 0.1920f, 0.2100f, 0.2500f, 0.0000f, 0.9943f, 3316.1001f, 458.2000f, 0.0000f, 0x1 }
|
||||
|
||||
/* Wooden Galleon Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_WOODEN_SMALLROOM \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.1122f, 0.3162f, 0.7900f, 0.3200f, 0.8700f, 1.0000f, 0.0320f, { 0.0000f, 0.0000f, 0.0000f }, 0.8913f, 0.0290f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 4705.0000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_WOODEN_SHORTPASSAGE \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.1259f, 0.3162f, 1.7500f, 0.5000f, 0.8700f, 0.8913f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 0.6310f, 0.0240f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 4705.0000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_WOODEN_MEDIUMROOM \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.1000f, 0.2818f, 1.4700f, 0.4200f, 0.8200f, 0.8913f, 0.0490f, { 0.0000f, 0.0000f, 0.0000f }, 0.8913f, 0.0290f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 4705.0000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_WOODEN_LARGEROOM \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.0891f, 0.2818f, 2.6500f, 0.3300f, 0.8200f, 0.8913f, 0.0660f, { 0.0000f, 0.0000f, 0.0000f }, 0.7943f, 0.0490f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 4705.0000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_WOODEN_LONGPASSAGE \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.1000f, 0.3162f, 1.9900f, 0.4000f, 0.7900f, 1.0000f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 0.4467f, 0.0360f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 4705.0000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_WOODEN_HALL \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.0794f, 0.2818f, 3.4500f, 0.3000f, 0.8200f, 0.8913f, 0.0880f, { 0.0000f, 0.0000f, 0.0000f }, 0.7943f, 0.0630f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 4705.0000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_WOODEN_CUPBOARD \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.1413f, 0.3162f, 0.5600f, 0.4600f, 0.9100f, 1.1220f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 1.1220f, 0.0280f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 4705.0000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_WOODEN_COURTYARD \
|
||||
{ 1.0000f, 0.6500f, 0.3162f, 0.0794f, 0.3162f, 1.7900f, 0.3500f, 0.7900f, 0.5623f, 0.1230f, { 0.0000f, 0.0000f, 0.0000f }, 0.1000f, 0.0320f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 4705.0000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_WOODEN_ALCOVE \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.1259f, 0.3162f, 1.2200f, 0.6200f, 0.9100f, 1.1220f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 0.7079f, 0.0240f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 4705.0000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
/* Sports Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_SPORT_EMPTYSTADIUM \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.4467f, 0.7943f, 6.2600f, 0.5100f, 1.1000f, 0.0631f, 0.1830f, { 0.0000f, 0.0000f, 0.0000f }, 0.3981f, 0.0380f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPORT_SQUASHCOURT \
|
||||
{ 1.0000f, 0.7500f, 0.3162f, 0.3162f, 0.7943f, 2.2200f, 0.9100f, 1.1600f, 0.4467f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 0.7943f, 0.0110f, { 0.0000f, 0.0000f, 0.0000f }, 0.1260f, 0.1900f, 0.2500f, 0.0000f, 0.9943f, 7176.8999f, 211.2000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPORT_SMALLSWIMMINGPOOL \
|
||||
{ 1.0000f, 0.7000f, 0.3162f, 0.7943f, 0.8913f, 2.7600f, 1.2500f, 1.1400f, 0.6310f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 0.7943f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.1790f, 0.1500f, 0.8950f, 0.1900f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPORT_LARGESWIMMINGPOOL \
|
||||
{ 1.0000f, 0.8200f, 0.3162f, 0.7943f, 1.0000f, 5.4900f, 1.3100f, 1.1400f, 0.4467f, 0.0390f, { 0.0000f, 0.0000f, 0.0000f }, 0.5012f, 0.0490f, { 0.0000f, 0.0000f, 0.0000f }, 0.2220f, 0.5500f, 1.1590f, 0.2100f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPORT_GYMNASIUM \
|
||||
{ 1.0000f, 0.8100f, 0.3162f, 0.4467f, 0.8913f, 3.1400f, 1.0600f, 1.3500f, 0.3981f, 0.0290f, { 0.0000f, 0.0000f, 0.0000f }, 0.5623f, 0.0450f, { 0.0000f, 0.0000f, 0.0000f }, 0.1460f, 0.1400f, 0.2500f, 0.0000f, 0.9943f, 7176.8999f, 211.2000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPORT_FULLSTADIUM \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.0708f, 0.7943f, 5.2500f, 0.1700f, 0.8000f, 0.1000f, 0.1880f, { 0.0000f, 0.0000f, 0.0000f }, 0.2818f, 0.0380f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPORT_STADIUMTANNOY \
|
||||
{ 1.0000f, 0.7800f, 0.3162f, 0.5623f, 0.5012f, 2.5300f, 0.8800f, 0.6800f, 0.2818f, 0.2300f, { 0.0000f, 0.0000f, 0.0000f }, 0.5012f, 0.0630f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.2000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
/* Prefab Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_PREFAB_WORKSHOP \
|
||||
{ 0.4287f, 1.0000f, 0.3162f, 0.1413f, 0.3981f, 0.7600f, 1.0000f, 1.0000f, 1.0000f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 1.1220f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_PREFAB_SCHOOLROOM \
|
||||
{ 0.4022f, 0.6900f, 0.3162f, 0.6310f, 0.5012f, 0.9800f, 0.4500f, 0.1800f, 1.4125f, 0.0170f, { 0.0000f, 0.0000f, 0.0000f }, 1.4125f, 0.0150f, { 0.0000f, 0.0000f, 0.0000f }, 0.0950f, 0.1400f, 0.2500f, 0.0000f, 0.9943f, 7176.8999f, 211.2000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_PREFAB_PRACTISEROOM \
|
||||
{ 0.4022f, 0.8700f, 0.3162f, 0.3981f, 0.5012f, 1.1200f, 0.5600f, 0.1800f, 1.2589f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 1.4125f, 0.0110f, { 0.0000f, 0.0000f, 0.0000f }, 0.0950f, 0.1400f, 0.2500f, 0.0000f, 0.9943f, 7176.8999f, 211.2000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_PREFAB_OUTHOUSE \
|
||||
{ 1.0000f, 0.8200f, 0.3162f, 0.1122f, 0.1585f, 1.3800f, 0.3800f, 0.3500f, 0.8913f, 0.0240f, { 0.0000f, 0.0000f, -0.0000f }, 0.6310f, 0.0440f, { 0.0000f, 0.0000f, 0.0000f }, 0.1210f, 0.1700f, 0.2500f, 0.0000f, 0.9943f, 2854.3999f, 107.5000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_PREFAB_CARAVAN \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.0891f, 0.1259f, 0.4300f, 1.5000f, 1.0000f, 1.0000f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 1.9953f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
/* Dome and Pipe Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_DOME_TOMB \
|
||||
{ 1.0000f, 0.7900f, 0.3162f, 0.3548f, 0.2239f, 4.1800f, 0.2100f, 0.1000f, 0.3868f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 1.6788f, 0.0220f, { 0.0000f, 0.0000f, 0.0000f }, 0.1770f, 0.1900f, 0.2500f, 0.0000f, 0.9943f, 2854.3999f, 20.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_PIPE_SMALL \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.3548f, 0.2239f, 5.0400f, 0.1000f, 0.1000f, 0.5012f, 0.0320f, { 0.0000f, 0.0000f, 0.0000f }, 2.5119f, 0.0150f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 2854.3999f, 20.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_DOME_SAINTPAULS \
|
||||
{ 1.0000f, 0.8700f, 0.3162f, 0.3548f, 0.2239f, 10.4800f, 0.1900f, 0.1000f, 0.1778f, 0.0900f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0420f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.1200f, 0.2500f, 0.0000f, 0.9943f, 2854.3999f, 20.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_PIPE_LONGTHIN \
|
||||
{ 0.2560f, 0.9100f, 0.3162f, 0.4467f, 0.2818f, 9.2100f, 0.1800f, 0.1000f, 0.7079f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 0.7079f, 0.0220f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 2854.3999f, 20.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_PIPE_LARGE \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.3548f, 0.2239f, 8.4500f, 0.1000f, 0.1000f, 0.3981f, 0.0460f, { 0.0000f, 0.0000f, 0.0000f }, 1.5849f, 0.0320f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 2854.3999f, 20.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_PIPE_RESONANT \
|
||||
{ 0.1373f, 0.9100f, 0.3162f, 0.4467f, 0.2818f, 6.8100f, 0.1800f, 0.1000f, 0.7079f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 1.0000f, 0.0220f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 2854.3999f, 20.0000f, 0.0000f, 0x0 }
|
||||
|
||||
/* Outdoors Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_OUTDOORS_BACKYARD \
|
||||
{ 1.0000f, 0.4500f, 0.3162f, 0.2512f, 0.5012f, 1.1200f, 0.3400f, 0.4600f, 0.4467f, 0.0690f, { 0.0000f, 0.0000f, -0.0000f }, 0.7079f, 0.0230f, { 0.0000f, 0.0000f, 0.0000f }, 0.2180f, 0.3400f, 0.2500f, 0.0000f, 0.9943f, 4399.1001f, 242.9000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_OUTDOORS_ROLLINGPLAINS \
|
||||
{ 1.0000f, 0.0000f, 0.3162f, 0.0112f, 0.6310f, 2.1300f, 0.2100f, 0.4600f, 0.1778f, 0.3000f, { 0.0000f, 0.0000f, -0.0000f }, 0.4467f, 0.0190f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 1.0000f, 0.2500f, 0.0000f, 0.9943f, 4399.1001f, 242.9000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_OUTDOORS_DEEPCANYON \
|
||||
{ 1.0000f, 0.7400f, 0.3162f, 0.1778f, 0.6310f, 3.8900f, 0.2100f, 0.4600f, 0.3162f, 0.2230f, { 0.0000f, 0.0000f, -0.0000f }, 0.3548f, 0.0190f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 1.0000f, 0.2500f, 0.0000f, 0.9943f, 4399.1001f, 242.9000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_OUTDOORS_CREEK \
|
||||
{ 1.0000f, 0.3500f, 0.3162f, 0.1778f, 0.5012f, 2.1300f, 0.2100f, 0.4600f, 0.3981f, 0.1150f, { 0.0000f, 0.0000f, -0.0000f }, 0.1995f, 0.0310f, { 0.0000f, 0.0000f, 0.0000f }, 0.2180f, 0.3400f, 0.2500f, 0.0000f, 0.9943f, 4399.1001f, 242.9000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_OUTDOORS_VALLEY \
|
||||
{ 1.0000f, 0.2800f, 0.3162f, 0.0282f, 0.1585f, 2.8800f, 0.2600f, 0.3500f, 0.1413f, 0.2630f, { 0.0000f, 0.0000f, -0.0000f }, 0.3981f, 0.1000f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.3400f, 0.2500f, 0.0000f, 0.9943f, 2854.3999f, 107.5000f, 0.0000f, 0x0 }
|
||||
|
||||
/* Mood Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_MOOD_HEAVEN \
|
||||
{ 1.0000f, 0.9400f, 0.3162f, 0.7943f, 0.4467f, 5.0400f, 1.1200f, 0.5600f, 0.2427f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0290f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0800f, 2.7420f, 0.0500f, 0.9977f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_MOOD_HELL \
|
||||
{ 1.0000f, 0.5700f, 0.3162f, 0.3548f, 0.4467f, 3.5700f, 0.4900f, 2.0000f, 0.0000f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 1.4125f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.1100f, 0.0400f, 2.1090f, 0.5200f, 0.9943f, 5000.0000f, 139.5000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_MOOD_MEMORY \
|
||||
{ 1.0000f, 0.8500f, 0.3162f, 0.6310f, 0.3548f, 4.0600f, 0.8200f, 0.5600f, 0.0398f, 0.0000f, { 0.0000f, 0.0000f, 0.0000f }, 1.1220f, 0.0000f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.4740f, 0.4500f, 0.9886f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
/* Driving Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_DRIVING_COMMENTATOR \
|
||||
{ 1.0000f, 0.0000f, 3.1623f, 0.5623f, 0.5012f, 2.4200f, 0.8800f, 0.6800f, 0.1995f, 0.0930f, { 0.0000f, 0.0000f, 0.0000f }, 0.2512f, 0.0170f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 1.0000f, 0.2500f, 0.0000f, 0.9886f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_DRIVING_PITGARAGE \
|
||||
{ 0.4287f, 0.5900f, 0.3162f, 0.7079f, 0.5623f, 1.7200f, 0.9300f, 0.8700f, 0.5623f, 0.0000f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0160f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.1100f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_DRIVING_INCAR_RACER \
|
||||
{ 0.0832f, 0.8000f, 0.3162f, 1.0000f, 0.7943f, 0.1700f, 2.0000f, 0.4100f, 1.7783f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 0.7079f, 0.0150f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 10268.2002f, 251.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_DRIVING_INCAR_SPORTS \
|
||||
{ 0.0832f, 0.8000f, 0.3162f, 0.6310f, 1.0000f, 0.1700f, 0.7500f, 0.4100f, 1.0000f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 0.5623f, 0.0000f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 10268.2002f, 251.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_DRIVING_INCAR_LUXURY \
|
||||
{ 0.2560f, 1.0000f, 0.3162f, 0.1000f, 0.5012f, 0.1300f, 0.4100f, 0.4600f, 0.7943f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 1.5849f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 10268.2002f, 251.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_DRIVING_FULLGRANDSTAND \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.2818f, 0.6310f, 3.0100f, 1.3700f, 1.2800f, 0.3548f, 0.0900f, { 0.0000f, 0.0000f, 0.0000f }, 0.1778f, 0.0490f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 10420.2002f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_DRIVING_EMPTYGRANDSTAND \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 1.0000f, 0.7943f, 4.6200f, 1.7500f, 1.4000f, 0.2082f, 0.0900f, { 0.0000f, 0.0000f, 0.0000f }, 0.2512f, 0.0490f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 10420.2002f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_DRIVING_TUNNEL \
|
||||
{ 1.0000f, 0.8100f, 0.3162f, 0.3981f, 0.8913f, 3.4200f, 0.9400f, 1.3100f, 0.7079f, 0.0510f, { 0.0000f, 0.0000f, 0.0000f }, 0.7079f, 0.0470f, { 0.0000f, 0.0000f, 0.0000f }, 0.2140f, 0.0500f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 155.3000f, 0.0000f, 0x1 }
|
||||
|
||||
/* City Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_CITY_STREETS \
|
||||
{ 1.0000f, 0.7800f, 0.3162f, 0.7079f, 0.8913f, 1.7900f, 1.1200f, 0.9100f, 0.2818f, 0.0460f, { 0.0000f, 0.0000f, 0.0000f }, 0.1995f, 0.0280f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.2000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CITY_SUBWAY \
|
||||
{ 1.0000f, 0.7400f, 0.3162f, 0.7079f, 0.8913f, 3.0100f, 1.2300f, 0.9100f, 0.7079f, 0.0460f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0280f, { 0.0000f, 0.0000f, 0.0000f }, 0.1250f, 0.2100f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CITY_MUSEUM \
|
||||
{ 1.0000f, 0.8200f, 0.3162f, 0.1778f, 0.1778f, 3.2800f, 1.4000f, 0.5700f, 0.2512f, 0.0390f, { 0.0000f, 0.0000f, -0.0000f }, 0.8913f, 0.0340f, { 0.0000f, 0.0000f, 0.0000f }, 0.1300f, 0.1700f, 0.2500f, 0.0000f, 0.9943f, 2854.3999f, 107.5000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CITY_LIBRARY \
|
||||
{ 1.0000f, 0.8200f, 0.3162f, 0.2818f, 0.0891f, 2.7600f, 0.8900f, 0.4100f, 0.3548f, 0.0290f, { 0.0000f, 0.0000f, -0.0000f }, 0.8913f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 0.1300f, 0.1700f, 0.2500f, 0.0000f, 0.9943f, 2854.3999f, 107.5000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CITY_UNDERPASS \
|
||||
{ 1.0000f, 0.8200f, 0.3162f, 0.4467f, 0.8913f, 3.5700f, 1.1200f, 0.9100f, 0.3981f, 0.0590f, { 0.0000f, 0.0000f, 0.0000f }, 0.8913f, 0.0370f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.1400f, 0.2500f, 0.0000f, 0.9920f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CITY_ABANDONED \
|
||||
{ 1.0000f, 0.6900f, 0.3162f, 0.7943f, 0.8913f, 3.2800f, 1.1700f, 0.9100f, 0.4467f, 0.0440f, { 0.0000f, 0.0000f, 0.0000f }, 0.2818f, 0.0240f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.2000f, 0.2500f, 0.0000f, 0.9966f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
/* Misc. Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_DUSTYROOM \
|
||||
{ 0.3645f, 0.5600f, 0.3162f, 0.7943f, 0.7079f, 1.7900f, 0.3800f, 0.2100f, 0.5012f, 0.0020f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0060f, { 0.0000f, 0.0000f, 0.0000f }, 0.2020f, 0.0500f, 0.2500f, 0.0000f, 0.9886f, 13046.0000f, 163.3000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CHAPEL \
|
||||
{ 1.0000f, 0.8400f, 0.3162f, 0.5623f, 1.0000f, 4.6200f, 0.6400f, 1.2300f, 0.4467f, 0.0320f, { 0.0000f, 0.0000f, 0.0000f }, 0.7943f, 0.0490f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.1100f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SMALLWATERROOM \
|
||||
{ 1.0000f, 0.7000f, 0.3162f, 0.4477f, 1.0000f, 1.5100f, 1.2500f, 1.1400f, 0.8913f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 1.4125f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.1790f, 0.1500f, 0.8950f, 0.1900f, 0.9920f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#endif /* EFX_PRESETS_H */
|
761
neo/libs/openal-soft/include/AL/efx.h
Normal file
761
neo/libs/openal-soft/include/AL/efx.h
Normal file
|
@ -0,0 +1,761 @@
|
|||
#ifndef AL_EFX_H
|
||||
#define AL_EFX_H
|
||||
|
||||
|
||||
#include "alc.h"
|
||||
#include "al.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ALC_EXT_EFX_NAME "ALC_EXT_EFX"
|
||||
|
||||
#define ALC_EFX_MAJOR_VERSION 0x20001
|
||||
#define ALC_EFX_MINOR_VERSION 0x20002
|
||||
#define ALC_MAX_AUXILIARY_SENDS 0x20003
|
||||
|
||||
|
||||
/* Listener properties. */
|
||||
#define AL_METERS_PER_UNIT 0x20004
|
||||
|
||||
/* Source properties. */
|
||||
#define AL_DIRECT_FILTER 0x20005
|
||||
#define AL_AUXILIARY_SEND_FILTER 0x20006
|
||||
#define AL_AIR_ABSORPTION_FACTOR 0x20007
|
||||
#define AL_ROOM_ROLLOFF_FACTOR 0x20008
|
||||
#define AL_CONE_OUTER_GAINHF 0x20009
|
||||
#define AL_DIRECT_FILTER_GAINHF_AUTO 0x2000A
|
||||
#define AL_AUXILIARY_SEND_FILTER_GAIN_AUTO 0x2000B
|
||||
#define AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO 0x2000C
|
||||
|
||||
|
||||
/* Effect properties. */
|
||||
|
||||
/* Reverb effect parameters */
|
||||
#define AL_REVERB_DENSITY 0x0001
|
||||
#define AL_REVERB_DIFFUSION 0x0002
|
||||
#define AL_REVERB_GAIN 0x0003
|
||||
#define AL_REVERB_GAINHF 0x0004
|
||||
#define AL_REVERB_DECAY_TIME 0x0005
|
||||
#define AL_REVERB_DECAY_HFRATIO 0x0006
|
||||
#define AL_REVERB_REFLECTIONS_GAIN 0x0007
|
||||
#define AL_REVERB_REFLECTIONS_DELAY 0x0008
|
||||
#define AL_REVERB_LATE_REVERB_GAIN 0x0009
|
||||
#define AL_REVERB_LATE_REVERB_DELAY 0x000A
|
||||
#define AL_REVERB_AIR_ABSORPTION_GAINHF 0x000B
|
||||
#define AL_REVERB_ROOM_ROLLOFF_FACTOR 0x000C
|
||||
#define AL_REVERB_DECAY_HFLIMIT 0x000D
|
||||
|
||||
/* EAX Reverb effect parameters */
|
||||
#define AL_EAXREVERB_DENSITY 0x0001
|
||||
#define AL_EAXREVERB_DIFFUSION 0x0002
|
||||
#define AL_EAXREVERB_GAIN 0x0003
|
||||
#define AL_EAXREVERB_GAINHF 0x0004
|
||||
#define AL_EAXREVERB_GAINLF 0x0005
|
||||
#define AL_EAXREVERB_DECAY_TIME 0x0006
|
||||
#define AL_EAXREVERB_DECAY_HFRATIO 0x0007
|
||||
#define AL_EAXREVERB_DECAY_LFRATIO 0x0008
|
||||
#define AL_EAXREVERB_REFLECTIONS_GAIN 0x0009
|
||||
#define AL_EAXREVERB_REFLECTIONS_DELAY 0x000A
|
||||
#define AL_EAXREVERB_REFLECTIONS_PAN 0x000B
|
||||
#define AL_EAXREVERB_LATE_REVERB_GAIN 0x000C
|
||||
#define AL_EAXREVERB_LATE_REVERB_DELAY 0x000D
|
||||
#define AL_EAXREVERB_LATE_REVERB_PAN 0x000E
|
||||
#define AL_EAXREVERB_ECHO_TIME 0x000F
|
||||
#define AL_EAXREVERB_ECHO_DEPTH 0x0010
|
||||
#define AL_EAXREVERB_MODULATION_TIME 0x0011
|
||||
#define AL_EAXREVERB_MODULATION_DEPTH 0x0012
|
||||
#define AL_EAXREVERB_AIR_ABSORPTION_GAINHF 0x0013
|
||||
#define AL_EAXREVERB_HFREFERENCE 0x0014
|
||||
#define AL_EAXREVERB_LFREFERENCE 0x0015
|
||||
#define AL_EAXREVERB_ROOM_ROLLOFF_FACTOR 0x0016
|
||||
#define AL_EAXREVERB_DECAY_HFLIMIT 0x0017
|
||||
|
||||
/* Chorus effect parameters */
|
||||
#define AL_CHORUS_WAVEFORM 0x0001
|
||||
#define AL_CHORUS_PHASE 0x0002
|
||||
#define AL_CHORUS_RATE 0x0003
|
||||
#define AL_CHORUS_DEPTH 0x0004
|
||||
#define AL_CHORUS_FEEDBACK 0x0005
|
||||
#define AL_CHORUS_DELAY 0x0006
|
||||
|
||||
/* Distortion effect parameters */
|
||||
#define AL_DISTORTION_EDGE 0x0001
|
||||
#define AL_DISTORTION_GAIN 0x0002
|
||||
#define AL_DISTORTION_LOWPASS_CUTOFF 0x0003
|
||||
#define AL_DISTORTION_EQCENTER 0x0004
|
||||
#define AL_DISTORTION_EQBANDWIDTH 0x0005
|
||||
|
||||
/* Echo effect parameters */
|
||||
#define AL_ECHO_DELAY 0x0001
|
||||
#define AL_ECHO_LRDELAY 0x0002
|
||||
#define AL_ECHO_DAMPING 0x0003
|
||||
#define AL_ECHO_FEEDBACK 0x0004
|
||||
#define AL_ECHO_SPREAD 0x0005
|
||||
|
||||
/* Flanger effect parameters */
|
||||
#define AL_FLANGER_WAVEFORM 0x0001
|
||||
#define AL_FLANGER_PHASE 0x0002
|
||||
#define AL_FLANGER_RATE 0x0003
|
||||
#define AL_FLANGER_DEPTH 0x0004
|
||||
#define AL_FLANGER_FEEDBACK 0x0005
|
||||
#define AL_FLANGER_DELAY 0x0006
|
||||
|
||||
/* Frequency shifter effect parameters */
|
||||
#define AL_FREQUENCY_SHIFTER_FREQUENCY 0x0001
|
||||
#define AL_FREQUENCY_SHIFTER_LEFT_DIRECTION 0x0002
|
||||
#define AL_FREQUENCY_SHIFTER_RIGHT_DIRECTION 0x0003
|
||||
|
||||
/* Vocal morpher effect parameters */
|
||||
#define AL_VOCAL_MORPHER_PHONEMEA 0x0001
|
||||
#define AL_VOCAL_MORPHER_PHONEMEA_COARSE_TUNING 0x0002
|
||||
#define AL_VOCAL_MORPHER_PHONEMEB 0x0003
|
||||
#define AL_VOCAL_MORPHER_PHONEMEB_COARSE_TUNING 0x0004
|
||||
#define AL_VOCAL_MORPHER_WAVEFORM 0x0005
|
||||
#define AL_VOCAL_MORPHER_RATE 0x0006
|
||||
|
||||
/* Pitchshifter effect parameters */
|
||||
#define AL_PITCH_SHIFTER_COARSE_TUNE 0x0001
|
||||
#define AL_PITCH_SHIFTER_FINE_TUNE 0x0002
|
||||
|
||||
/* Ringmodulator effect parameters */
|
||||
#define AL_RING_MODULATOR_FREQUENCY 0x0001
|
||||
#define AL_RING_MODULATOR_HIGHPASS_CUTOFF 0x0002
|
||||
#define AL_RING_MODULATOR_WAVEFORM 0x0003
|
||||
|
||||
/* Autowah effect parameters */
|
||||
#define AL_AUTOWAH_ATTACK_TIME 0x0001
|
||||
#define AL_AUTOWAH_RELEASE_TIME 0x0002
|
||||
#define AL_AUTOWAH_RESONANCE 0x0003
|
||||
#define AL_AUTOWAH_PEAK_GAIN 0x0004
|
||||
|
||||
/* Compressor effect parameters */
|
||||
#define AL_COMPRESSOR_ONOFF 0x0001
|
||||
|
||||
/* Equalizer effect parameters */
|
||||
#define AL_EQUALIZER_LOW_GAIN 0x0001
|
||||
#define AL_EQUALIZER_LOW_CUTOFF 0x0002
|
||||
#define AL_EQUALIZER_MID1_GAIN 0x0003
|
||||
#define AL_EQUALIZER_MID1_CENTER 0x0004
|
||||
#define AL_EQUALIZER_MID1_WIDTH 0x0005
|
||||
#define AL_EQUALIZER_MID2_GAIN 0x0006
|
||||
#define AL_EQUALIZER_MID2_CENTER 0x0007
|
||||
#define AL_EQUALIZER_MID2_WIDTH 0x0008
|
||||
#define AL_EQUALIZER_HIGH_GAIN 0x0009
|
||||
#define AL_EQUALIZER_HIGH_CUTOFF 0x000A
|
||||
|
||||
/* Effect type */
|
||||
#define AL_EFFECT_FIRST_PARAMETER 0x0000
|
||||
#define AL_EFFECT_LAST_PARAMETER 0x8000
|
||||
#define AL_EFFECT_TYPE 0x8001
|
||||
|
||||
/* Effect types, used with the AL_EFFECT_TYPE property */
|
||||
#define AL_EFFECT_NULL 0x0000
|
||||
#define AL_EFFECT_REVERB 0x0001
|
||||
#define AL_EFFECT_CHORUS 0x0002
|
||||
#define AL_EFFECT_DISTORTION 0x0003
|
||||
#define AL_EFFECT_ECHO 0x0004
|
||||
#define AL_EFFECT_FLANGER 0x0005
|
||||
#define AL_EFFECT_FREQUENCY_SHIFTER 0x0006
|
||||
#define AL_EFFECT_VOCAL_MORPHER 0x0007
|
||||
#define AL_EFFECT_PITCH_SHIFTER 0x0008
|
||||
#define AL_EFFECT_RING_MODULATOR 0x0009
|
||||
#define AL_EFFECT_AUTOWAH 0x000A
|
||||
#define AL_EFFECT_COMPRESSOR 0x000B
|
||||
#define AL_EFFECT_EQUALIZER 0x000C
|
||||
#define AL_EFFECT_EAXREVERB 0x8000
|
||||
|
||||
/* Auxiliary Effect Slot properties. */
|
||||
#define AL_EFFECTSLOT_EFFECT 0x0001
|
||||
#define AL_EFFECTSLOT_GAIN 0x0002
|
||||
#define AL_EFFECTSLOT_AUXILIARY_SEND_AUTO 0x0003
|
||||
|
||||
/* NULL Auxiliary Slot ID to disable a source send. */
|
||||
#define AL_EFFECTSLOT_NULL 0x0000
|
||||
|
||||
|
||||
/* Filter properties. */
|
||||
|
||||
/* Lowpass filter parameters */
|
||||
#define AL_LOWPASS_GAIN 0x0001
|
||||
#define AL_LOWPASS_GAINHF 0x0002
|
||||
|
||||
/* Highpass filter parameters */
|
||||
#define AL_HIGHPASS_GAIN 0x0001
|
||||
#define AL_HIGHPASS_GAINLF 0x0002
|
||||
|
||||
/* Bandpass filter parameters */
|
||||
#define AL_BANDPASS_GAIN 0x0001
|
||||
#define AL_BANDPASS_GAINLF 0x0002
|
||||
#define AL_BANDPASS_GAINHF 0x0003
|
||||
|
||||
/* Filter type */
|
||||
#define AL_FILTER_FIRST_PARAMETER 0x0000
|
||||
#define AL_FILTER_LAST_PARAMETER 0x8000
|
||||
#define AL_FILTER_TYPE 0x8001
|
||||
|
||||
/* Filter types, used with the AL_FILTER_TYPE property */
|
||||
#define AL_FILTER_NULL 0x0000
|
||||
#define AL_FILTER_LOWPASS 0x0001
|
||||
#define AL_FILTER_HIGHPASS 0x0002
|
||||
#define AL_FILTER_BANDPASS 0x0003
|
||||
|
||||
|
||||
/* Effect object function types. */
|
||||
typedef void (AL_APIENTRY *LPALGENEFFECTS)(ALsizei, ALuint*);
|
||||
typedef void (AL_APIENTRY *LPALDELETEEFFECTS)(ALsizei, const ALuint*);
|
||||
typedef ALboolean (AL_APIENTRY *LPALISEFFECT)(ALuint);
|
||||
typedef void (AL_APIENTRY *LPALEFFECTI)(ALuint, ALenum, ALint);
|
||||
typedef void (AL_APIENTRY *LPALEFFECTIV)(ALuint, ALenum, const ALint*);
|
||||
typedef void (AL_APIENTRY *LPALEFFECTF)(ALuint, ALenum, ALfloat);
|
||||
typedef void (AL_APIENTRY *LPALEFFECTFV)(ALuint, ALenum, const ALfloat*);
|
||||
typedef void (AL_APIENTRY *LPALGETEFFECTI)(ALuint, ALenum, ALint*);
|
||||
typedef void (AL_APIENTRY *LPALGETEFFECTIV)(ALuint, ALenum, ALint*);
|
||||
typedef void (AL_APIENTRY *LPALGETEFFECTF)(ALuint, ALenum, ALfloat*);
|
||||
typedef void (AL_APIENTRY *LPALGETEFFECTFV)(ALuint, ALenum, ALfloat*);
|
||||
|
||||
/* Filter object function types. */
|
||||
typedef void (AL_APIENTRY *LPALGENFILTERS)(ALsizei, ALuint*);
|
||||
typedef void (AL_APIENTRY *LPALDELETEFILTERS)(ALsizei, const ALuint*);
|
||||
typedef ALboolean (AL_APIENTRY *LPALISFILTER)(ALuint);
|
||||
typedef void (AL_APIENTRY *LPALFILTERI)(ALuint, ALenum, ALint);
|
||||
typedef void (AL_APIENTRY *LPALFILTERIV)(ALuint, ALenum, const ALint*);
|
||||
typedef void (AL_APIENTRY *LPALFILTERF)(ALuint, ALenum, ALfloat);
|
||||
typedef void (AL_APIENTRY *LPALFILTERFV)(ALuint, ALenum, const ALfloat*);
|
||||
typedef void (AL_APIENTRY *LPALGETFILTERI)(ALuint, ALenum, ALint*);
|
||||
typedef void (AL_APIENTRY *LPALGETFILTERIV)(ALuint, ALenum, ALint*);
|
||||
typedef void (AL_APIENTRY *LPALGETFILTERF)(ALuint, ALenum, ALfloat*);
|
||||
typedef void (AL_APIENTRY *LPALGETFILTERFV)(ALuint, ALenum, ALfloat*);
|
||||
|
||||
/* Auxiliary Effect Slot object function types. */
|
||||
typedef void (AL_APIENTRY *LPALGENAUXILIARYEFFECTSLOTS)(ALsizei, ALuint*);
|
||||
typedef void (AL_APIENTRY *LPALDELETEAUXILIARYEFFECTSLOTS)(ALsizei, const ALuint*);
|
||||
typedef ALboolean (AL_APIENTRY *LPALISAUXILIARYEFFECTSLOT)(ALuint);
|
||||
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTI)(ALuint, ALenum, ALint);
|
||||
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTIV)(ALuint, ALenum, const ALint*);
|
||||
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTF)(ALuint, ALenum, ALfloat);
|
||||
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTFV)(ALuint, ALenum, const ALfloat*);
|
||||
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTI)(ALuint, ALenum, ALint*);
|
||||
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTIV)(ALuint, ALenum, ALint*);
|
||||
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTF)(ALuint, ALenum, ALfloat*);
|
||||
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTFV)(ALuint, ALenum, ALfloat*);
|
||||
|
||||
#ifdef AL_ALEXT_PROTOTYPES
|
||||
AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects);
|
||||
AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, const ALuint *effects);
|
||||
AL_API ALboolean AL_APIENTRY alIsEffect(ALuint effect);
|
||||
AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue);
|
||||
AL_API ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, const ALint *piValues);
|
||||
AL_API ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flValue);
|
||||
AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, const ALfloat *pflValues);
|
||||
AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *piValue);
|
||||
AL_API ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *piValues);
|
||||
AL_API ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pflValue);
|
||||
AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pflValues);
|
||||
|
||||
AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters);
|
||||
AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, const ALuint *filters);
|
||||
AL_API ALboolean AL_APIENTRY alIsFilter(ALuint filter);
|
||||
AL_API ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint iValue);
|
||||
AL_API ALvoid AL_APIENTRY alFilteriv(ALuint filter, ALenum param, const ALint *piValues);
|
||||
AL_API ALvoid AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat flValue);
|
||||
AL_API ALvoid AL_APIENTRY alFilterfv(ALuint filter, ALenum param, const ALfloat *pflValues);
|
||||
AL_API ALvoid AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *piValue);
|
||||
AL_API ALvoid AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *piValues);
|
||||
AL_API ALvoid AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *pflValue);
|
||||
AL_API ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *pflValues);
|
||||
|
||||
AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots);
|
||||
AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint *effectslots);
|
||||
AL_API ALboolean AL_APIENTRY alIsAuxiliaryEffectSlot(ALuint effectslot);
|
||||
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint iValue);
|
||||
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, const ALint *piValues);
|
||||
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat flValue);
|
||||
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, const ALfloat *pflValues);
|
||||
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint *piValue);
|
||||
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, ALint *piValues);
|
||||
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat *pflValue);
|
||||
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *pflValues);
|
||||
#endif
|
||||
|
||||
/* Filter ranges and defaults. */
|
||||
|
||||
/* Lowpass filter */
|
||||
#define AL_LOWPASS_MIN_GAIN (0.0f)
|
||||
#define AL_LOWPASS_MAX_GAIN (1.0f)
|
||||
#define AL_LOWPASS_DEFAULT_GAIN (1.0f)
|
||||
|
||||
#define AL_LOWPASS_MIN_GAINHF (0.0f)
|
||||
#define AL_LOWPASS_MAX_GAINHF (1.0f)
|
||||
#define AL_LOWPASS_DEFAULT_GAINHF (1.0f)
|
||||
|
||||
/* Highpass filter */
|
||||
#define AL_HIGHPASS_MIN_GAIN (0.0f)
|
||||
#define AL_HIGHPASS_MAX_GAIN (1.0f)
|
||||
#define AL_HIGHPASS_DEFAULT_GAIN (1.0f)
|
||||
|
||||
#define AL_HIGHPASS_MIN_GAINLF (0.0f)
|
||||
#define AL_HIGHPASS_MAX_GAINLF (1.0f)
|
||||
#define AL_HIGHPASS_DEFAULT_GAINLF (1.0f)
|
||||
|
||||
/* Bandpass filter */
|
||||
#define AL_BANDPASS_MIN_GAIN (0.0f)
|
||||
#define AL_BANDPASS_MAX_GAIN (1.0f)
|
||||
#define AL_BANDPASS_DEFAULT_GAIN (1.0f)
|
||||
|
||||
#define AL_BANDPASS_MIN_GAINHF (0.0f)
|
||||
#define AL_BANDPASS_MAX_GAINHF (1.0f)
|
||||
#define AL_BANDPASS_DEFAULT_GAINHF (1.0f)
|
||||
|
||||
#define AL_BANDPASS_MIN_GAINLF (0.0f)
|
||||
#define AL_BANDPASS_MAX_GAINLF (1.0f)
|
||||
#define AL_BANDPASS_DEFAULT_GAINLF (1.0f)
|
||||
|
||||
|
||||
/* Effect parameter ranges and defaults. */
|
||||
|
||||
/* Standard reverb effect */
|
||||
#define AL_REVERB_MIN_DENSITY (0.0f)
|
||||
#define AL_REVERB_MAX_DENSITY (1.0f)
|
||||
#define AL_REVERB_DEFAULT_DENSITY (1.0f)
|
||||
|
||||
#define AL_REVERB_MIN_DIFFUSION (0.0f)
|
||||
#define AL_REVERB_MAX_DIFFUSION (1.0f)
|
||||
#define AL_REVERB_DEFAULT_DIFFUSION (1.0f)
|
||||
|
||||
#define AL_REVERB_MIN_GAIN (0.0f)
|
||||
#define AL_REVERB_MAX_GAIN (1.0f)
|
||||
#define AL_REVERB_DEFAULT_GAIN (0.32f)
|
||||
|
||||
#define AL_REVERB_MIN_GAINHF (0.0f)
|
||||
#define AL_REVERB_MAX_GAINHF (1.0f)
|
||||
#define AL_REVERB_DEFAULT_GAINHF (0.89f)
|
||||
|
||||
#define AL_REVERB_MIN_DECAY_TIME (0.1f)
|
||||
#define AL_REVERB_MAX_DECAY_TIME (20.0f)
|
||||
#define AL_REVERB_DEFAULT_DECAY_TIME (1.49f)
|
||||
|
||||
#define AL_REVERB_MIN_DECAY_HFRATIO (0.1f)
|
||||
#define AL_REVERB_MAX_DECAY_HFRATIO (2.0f)
|
||||
#define AL_REVERB_DEFAULT_DECAY_HFRATIO (0.83f)
|
||||
|
||||
#define AL_REVERB_MIN_REFLECTIONS_GAIN (0.0f)
|
||||
#define AL_REVERB_MAX_REFLECTIONS_GAIN (3.16f)
|
||||
#define AL_REVERB_DEFAULT_REFLECTIONS_GAIN (0.05f)
|
||||
|
||||
#define AL_REVERB_MIN_REFLECTIONS_DELAY (0.0f)
|
||||
#define AL_REVERB_MAX_REFLECTIONS_DELAY (0.3f)
|
||||
#define AL_REVERB_DEFAULT_REFLECTIONS_DELAY (0.007f)
|
||||
|
||||
#define AL_REVERB_MIN_LATE_REVERB_GAIN (0.0f)
|
||||
#define AL_REVERB_MAX_LATE_REVERB_GAIN (10.0f)
|
||||
#define AL_REVERB_DEFAULT_LATE_REVERB_GAIN (1.26f)
|
||||
|
||||
#define AL_REVERB_MIN_LATE_REVERB_DELAY (0.0f)
|
||||
#define AL_REVERB_MAX_LATE_REVERB_DELAY (0.1f)
|
||||
#define AL_REVERB_DEFAULT_LATE_REVERB_DELAY (0.011f)
|
||||
|
||||
#define AL_REVERB_MIN_AIR_ABSORPTION_GAINHF (0.892f)
|
||||
#define AL_REVERB_MAX_AIR_ABSORPTION_GAINHF (1.0f)
|
||||
#define AL_REVERB_DEFAULT_AIR_ABSORPTION_GAINHF (0.994f)
|
||||
|
||||
#define AL_REVERB_MIN_ROOM_ROLLOFF_FACTOR (0.0f)
|
||||
#define AL_REVERB_MAX_ROOM_ROLLOFF_FACTOR (10.0f)
|
||||
#define AL_REVERB_DEFAULT_ROOM_ROLLOFF_FACTOR (0.0f)
|
||||
|
||||
#define AL_REVERB_MIN_DECAY_HFLIMIT AL_FALSE
|
||||
#define AL_REVERB_MAX_DECAY_HFLIMIT AL_TRUE
|
||||
#define AL_REVERB_DEFAULT_DECAY_HFLIMIT AL_TRUE
|
||||
|
||||
/* EAX reverb effect */
|
||||
#define AL_EAXREVERB_MIN_DENSITY (0.0f)
|
||||
#define AL_EAXREVERB_MAX_DENSITY (1.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_DENSITY (1.0f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_DIFFUSION (0.0f)
|
||||
#define AL_EAXREVERB_MAX_DIFFUSION (1.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_DIFFUSION (1.0f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_GAIN (0.0f)
|
||||
#define AL_EAXREVERB_MAX_GAIN (1.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_GAIN (0.32f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_GAINHF (0.0f)
|
||||
#define AL_EAXREVERB_MAX_GAINHF (1.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_GAINHF (0.89f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_GAINLF (0.0f)
|
||||
#define AL_EAXREVERB_MAX_GAINLF (1.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_GAINLF (1.0f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_DECAY_TIME (0.1f)
|
||||
#define AL_EAXREVERB_MAX_DECAY_TIME (20.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_DECAY_TIME (1.49f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_DECAY_HFRATIO (0.1f)
|
||||
#define AL_EAXREVERB_MAX_DECAY_HFRATIO (2.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_DECAY_HFRATIO (0.83f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_DECAY_LFRATIO (0.1f)
|
||||
#define AL_EAXREVERB_MAX_DECAY_LFRATIO (2.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_DECAY_LFRATIO (1.0f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_REFLECTIONS_GAIN (0.0f)
|
||||
#define AL_EAXREVERB_MAX_REFLECTIONS_GAIN (3.16f)
|
||||
#define AL_EAXREVERB_DEFAULT_REFLECTIONS_GAIN (0.05f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_REFLECTIONS_DELAY (0.0f)
|
||||
#define AL_EAXREVERB_MAX_REFLECTIONS_DELAY (0.3f)
|
||||
#define AL_EAXREVERB_DEFAULT_REFLECTIONS_DELAY (0.007f)
|
||||
|
||||
#define AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ (0.0f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_LATE_REVERB_GAIN (0.0f)
|
||||
#define AL_EAXREVERB_MAX_LATE_REVERB_GAIN (10.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_LATE_REVERB_GAIN (1.26f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_LATE_REVERB_DELAY (0.0f)
|
||||
#define AL_EAXREVERB_MAX_LATE_REVERB_DELAY (0.1f)
|
||||
#define AL_EAXREVERB_DEFAULT_LATE_REVERB_DELAY (0.011f)
|
||||
|
||||
#define AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ (0.0f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_ECHO_TIME (0.075f)
|
||||
#define AL_EAXREVERB_MAX_ECHO_TIME (0.25f)
|
||||
#define AL_EAXREVERB_DEFAULT_ECHO_TIME (0.25f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_ECHO_DEPTH (0.0f)
|
||||
#define AL_EAXREVERB_MAX_ECHO_DEPTH (1.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_ECHO_DEPTH (0.0f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_MODULATION_TIME (0.04f)
|
||||
#define AL_EAXREVERB_MAX_MODULATION_TIME (4.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_MODULATION_TIME (0.25f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_MODULATION_DEPTH (0.0f)
|
||||
#define AL_EAXREVERB_MAX_MODULATION_DEPTH (1.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_MODULATION_DEPTH (0.0f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF (0.892f)
|
||||
#define AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF (1.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_AIR_ABSORPTION_GAINHF (0.994f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_HFREFERENCE (1000.0f)
|
||||
#define AL_EAXREVERB_MAX_HFREFERENCE (20000.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_HFREFERENCE (5000.0f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_LFREFERENCE (20.0f)
|
||||
#define AL_EAXREVERB_MAX_LFREFERENCE (1000.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_LFREFERENCE (250.0f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_ROOM_ROLLOFF_FACTOR (0.0f)
|
||||
#define AL_EAXREVERB_MAX_ROOM_ROLLOFF_FACTOR (10.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR (0.0f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_DECAY_HFLIMIT AL_FALSE
|
||||
#define AL_EAXREVERB_MAX_DECAY_HFLIMIT AL_TRUE
|
||||
#define AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT AL_TRUE
|
||||
|
||||
/* Chorus effect */
|
||||
#define AL_CHORUS_WAVEFORM_SINUSOID (0)
|
||||
#define AL_CHORUS_WAVEFORM_TRIANGLE (1)
|
||||
|
||||
#define AL_CHORUS_MIN_WAVEFORM (0)
|
||||
#define AL_CHORUS_MAX_WAVEFORM (1)
|
||||
#define AL_CHORUS_DEFAULT_WAVEFORM (1)
|
||||
|
||||
#define AL_CHORUS_MIN_PHASE (-180)
|
||||
#define AL_CHORUS_MAX_PHASE (180)
|
||||
#define AL_CHORUS_DEFAULT_PHASE (90)
|
||||
|
||||
#define AL_CHORUS_MIN_RATE (0.0f)
|
||||
#define AL_CHORUS_MAX_RATE (10.0f)
|
||||
#define AL_CHORUS_DEFAULT_RATE (1.1f)
|
||||
|
||||
#define AL_CHORUS_MIN_DEPTH (0.0f)
|
||||
#define AL_CHORUS_MAX_DEPTH (1.0f)
|
||||
#define AL_CHORUS_DEFAULT_DEPTH (0.1f)
|
||||
|
||||
#define AL_CHORUS_MIN_FEEDBACK (-1.0f)
|
||||
#define AL_CHORUS_MAX_FEEDBACK (1.0f)
|
||||
#define AL_CHORUS_DEFAULT_FEEDBACK (0.25f)
|
||||
|
||||
#define AL_CHORUS_MIN_DELAY (0.0f)
|
||||
#define AL_CHORUS_MAX_DELAY (0.016f)
|
||||
#define AL_CHORUS_DEFAULT_DELAY (0.016f)
|
||||
|
||||
/* Distortion effect */
|
||||
#define AL_DISTORTION_MIN_EDGE (0.0f)
|
||||
#define AL_DISTORTION_MAX_EDGE (1.0f)
|
||||
#define AL_DISTORTION_DEFAULT_EDGE (0.2f)
|
||||
|
||||
#define AL_DISTORTION_MIN_GAIN (0.01f)
|
||||
#define AL_DISTORTION_MAX_GAIN (1.0f)
|
||||
#define AL_DISTORTION_DEFAULT_GAIN (0.05f)
|
||||
|
||||
#define AL_DISTORTION_MIN_LOWPASS_CUTOFF (80.0f)
|
||||
#define AL_DISTORTION_MAX_LOWPASS_CUTOFF (24000.0f)
|
||||
#define AL_DISTORTION_DEFAULT_LOWPASS_CUTOFF (8000.0f)
|
||||
|
||||
#define AL_DISTORTION_MIN_EQCENTER (80.0f)
|
||||
#define AL_DISTORTION_MAX_EQCENTER (24000.0f)
|
||||
#define AL_DISTORTION_DEFAULT_EQCENTER (3600.0f)
|
||||
|
||||
#define AL_DISTORTION_MIN_EQBANDWIDTH (80.0f)
|
||||
#define AL_DISTORTION_MAX_EQBANDWIDTH (24000.0f)
|
||||
#define AL_DISTORTION_DEFAULT_EQBANDWIDTH (3600.0f)
|
||||
|
||||
/* Echo effect */
|
||||
#define AL_ECHO_MIN_DELAY (0.0f)
|
||||
#define AL_ECHO_MAX_DELAY (0.207f)
|
||||
#define AL_ECHO_DEFAULT_DELAY (0.1f)
|
||||
|
||||
#define AL_ECHO_MIN_LRDELAY (0.0f)
|
||||
#define AL_ECHO_MAX_LRDELAY (0.404f)
|
||||
#define AL_ECHO_DEFAULT_LRDELAY (0.1f)
|
||||
|
||||
#define AL_ECHO_MIN_DAMPING (0.0f)
|
||||
#define AL_ECHO_MAX_DAMPING (0.99f)
|
||||
#define AL_ECHO_DEFAULT_DAMPING (0.5f)
|
||||
|
||||
#define AL_ECHO_MIN_FEEDBACK (0.0f)
|
||||
#define AL_ECHO_MAX_FEEDBACK (1.0f)
|
||||
#define AL_ECHO_DEFAULT_FEEDBACK (0.5f)
|
||||
|
||||
#define AL_ECHO_MIN_SPREAD (-1.0f)
|
||||
#define AL_ECHO_MAX_SPREAD (1.0f)
|
||||
#define AL_ECHO_DEFAULT_SPREAD (-1.0f)
|
||||
|
||||
/* Flanger effect */
|
||||
#define AL_FLANGER_WAVEFORM_SINUSOID (0)
|
||||
#define AL_FLANGER_WAVEFORM_TRIANGLE (1)
|
||||
|
||||
#define AL_FLANGER_MIN_WAVEFORM (0)
|
||||
#define AL_FLANGER_MAX_WAVEFORM (1)
|
||||
#define AL_FLANGER_DEFAULT_WAVEFORM (1)
|
||||
|
||||
#define AL_FLANGER_MIN_PHASE (-180)
|
||||
#define AL_FLANGER_MAX_PHASE (180)
|
||||
#define AL_FLANGER_DEFAULT_PHASE (0)
|
||||
|
||||
#define AL_FLANGER_MIN_RATE (0.0f)
|
||||
#define AL_FLANGER_MAX_RATE (10.0f)
|
||||
#define AL_FLANGER_DEFAULT_RATE (0.27f)
|
||||
|
||||
#define AL_FLANGER_MIN_DEPTH (0.0f)
|
||||
#define AL_FLANGER_MAX_DEPTH (1.0f)
|
||||
#define AL_FLANGER_DEFAULT_DEPTH (1.0f)
|
||||
|
||||
#define AL_FLANGER_MIN_FEEDBACK (-1.0f)
|
||||
#define AL_FLANGER_MAX_FEEDBACK (1.0f)
|
||||
#define AL_FLANGER_DEFAULT_FEEDBACK (-0.5f)
|
||||
|
||||
#define AL_FLANGER_MIN_DELAY (0.0f)
|
||||
#define AL_FLANGER_MAX_DELAY (0.004f)
|
||||
#define AL_FLANGER_DEFAULT_DELAY (0.002f)
|
||||
|
||||
/* Frequency shifter effect */
|
||||
#define AL_FREQUENCY_SHIFTER_MIN_FREQUENCY (0.0f)
|
||||
#define AL_FREQUENCY_SHIFTER_MAX_FREQUENCY (24000.0f)
|
||||
#define AL_FREQUENCY_SHIFTER_DEFAULT_FREQUENCY (0.0f)
|
||||
|
||||
#define AL_FREQUENCY_SHIFTER_MIN_LEFT_DIRECTION (0)
|
||||
#define AL_FREQUENCY_SHIFTER_MAX_LEFT_DIRECTION (2)
|
||||
#define AL_FREQUENCY_SHIFTER_DEFAULT_LEFT_DIRECTION (0)
|
||||
|
||||
#define AL_FREQUENCY_SHIFTER_DIRECTION_DOWN (0)
|
||||
#define AL_FREQUENCY_SHIFTER_DIRECTION_UP (1)
|
||||
#define AL_FREQUENCY_SHIFTER_DIRECTION_OFF (2)
|
||||
|
||||
#define AL_FREQUENCY_SHIFTER_MIN_RIGHT_DIRECTION (0)
|
||||
#define AL_FREQUENCY_SHIFTER_MAX_RIGHT_DIRECTION (2)
|
||||
#define AL_FREQUENCY_SHIFTER_DEFAULT_RIGHT_DIRECTION (0)
|
||||
|
||||
/* Vocal morpher effect */
|
||||
#define AL_VOCAL_MORPHER_MIN_PHONEMEA (0)
|
||||
#define AL_VOCAL_MORPHER_MAX_PHONEMEA (29)
|
||||
#define AL_VOCAL_MORPHER_DEFAULT_PHONEMEA (0)
|
||||
|
||||
#define AL_VOCAL_MORPHER_MIN_PHONEMEA_COARSE_TUNING (-24)
|
||||
#define AL_VOCAL_MORPHER_MAX_PHONEMEA_COARSE_TUNING (24)
|
||||
#define AL_VOCAL_MORPHER_DEFAULT_PHONEMEA_COARSE_TUNING (0)
|
||||
|
||||
#define AL_VOCAL_MORPHER_MIN_PHONEMEB (0)
|
||||
#define AL_VOCAL_MORPHER_MAX_PHONEMEB (29)
|
||||
#define AL_VOCAL_MORPHER_DEFAULT_PHONEMEB (10)
|
||||
|
||||
#define AL_VOCAL_MORPHER_MIN_PHONEMEB_COARSE_TUNING (-24)
|
||||
#define AL_VOCAL_MORPHER_MAX_PHONEMEB_COARSE_TUNING (24)
|
||||
#define AL_VOCAL_MORPHER_DEFAULT_PHONEMEB_COARSE_TUNING (0)
|
||||
|
||||
#define AL_VOCAL_MORPHER_PHONEME_A (0)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_E (1)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_I (2)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_O (3)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_U (4)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_AA (5)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_AE (6)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_AH (7)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_AO (8)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_EH (9)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_ER (10)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_IH (11)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_IY (12)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_UH (13)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_UW (14)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_B (15)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_D (16)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_F (17)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_G (18)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_J (19)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_K (20)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_L (21)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_M (22)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_N (23)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_P (24)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_R (25)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_S (26)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_T (27)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_V (28)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_Z (29)
|
||||
|
||||
#define AL_VOCAL_MORPHER_WAVEFORM_SINUSOID (0)
|
||||
#define AL_VOCAL_MORPHER_WAVEFORM_TRIANGLE (1)
|
||||
#define AL_VOCAL_MORPHER_WAVEFORM_SAWTOOTH (2)
|
||||
|
||||
#define AL_VOCAL_MORPHER_MIN_WAVEFORM (0)
|
||||
#define AL_VOCAL_MORPHER_MAX_WAVEFORM (2)
|
||||
#define AL_VOCAL_MORPHER_DEFAULT_WAVEFORM (0)
|
||||
|
||||
#define AL_VOCAL_MORPHER_MIN_RATE (0.0f)
|
||||
#define AL_VOCAL_MORPHER_MAX_RATE (10.0f)
|
||||
#define AL_VOCAL_MORPHER_DEFAULT_RATE (1.41f)
|
||||
|
||||
/* Pitch shifter effect */
|
||||
#define AL_PITCH_SHIFTER_MIN_COARSE_TUNE (-12)
|
||||
#define AL_PITCH_SHIFTER_MAX_COARSE_TUNE (12)
|
||||
#define AL_PITCH_SHIFTER_DEFAULT_COARSE_TUNE (12)
|
||||
|
||||
#define AL_PITCH_SHIFTER_MIN_FINE_TUNE (-50)
|
||||
#define AL_PITCH_SHIFTER_MAX_FINE_TUNE (50)
|
||||
#define AL_PITCH_SHIFTER_DEFAULT_FINE_TUNE (0)
|
||||
|
||||
/* Ring modulator effect */
|
||||
#define AL_RING_MODULATOR_MIN_FREQUENCY (0.0f)
|
||||
#define AL_RING_MODULATOR_MAX_FREQUENCY (8000.0f)
|
||||
#define AL_RING_MODULATOR_DEFAULT_FREQUENCY (440.0f)
|
||||
|
||||
#define AL_RING_MODULATOR_MIN_HIGHPASS_CUTOFF (0.0f)
|
||||
#define AL_RING_MODULATOR_MAX_HIGHPASS_CUTOFF (24000.0f)
|
||||
#define AL_RING_MODULATOR_DEFAULT_HIGHPASS_CUTOFF (800.0f)
|
||||
|
||||
#define AL_RING_MODULATOR_SINUSOID (0)
|
||||
#define AL_RING_MODULATOR_SAWTOOTH (1)
|
||||
#define AL_RING_MODULATOR_SQUARE (2)
|
||||
|
||||
#define AL_RING_MODULATOR_MIN_WAVEFORM (0)
|
||||
#define AL_RING_MODULATOR_MAX_WAVEFORM (2)
|
||||
#define AL_RING_MODULATOR_DEFAULT_WAVEFORM (0)
|
||||
|
||||
/* Autowah effect */
|
||||
#define AL_AUTOWAH_MIN_ATTACK_TIME (0.0001f)
|
||||
#define AL_AUTOWAH_MAX_ATTACK_TIME (1.0f)
|
||||
#define AL_AUTOWAH_DEFAULT_ATTACK_TIME (0.06f)
|
||||
|
||||
#define AL_AUTOWAH_MIN_RELEASE_TIME (0.0001f)
|
||||
#define AL_AUTOWAH_MAX_RELEASE_TIME (1.0f)
|
||||
#define AL_AUTOWAH_DEFAULT_RELEASE_TIME (0.06f)
|
||||
|
||||
#define AL_AUTOWAH_MIN_RESONANCE (2.0f)
|
||||
#define AL_AUTOWAH_MAX_RESONANCE (1000.0f)
|
||||
#define AL_AUTOWAH_DEFAULT_RESONANCE (1000.0f)
|
||||
|
||||
#define AL_AUTOWAH_MIN_PEAK_GAIN (0.00003f)
|
||||
#define AL_AUTOWAH_MAX_PEAK_GAIN (31621.0f)
|
||||
#define AL_AUTOWAH_DEFAULT_PEAK_GAIN (11.22f)
|
||||
|
||||
/* Compressor effect */
|
||||
#define AL_COMPRESSOR_MIN_ONOFF (0)
|
||||
#define AL_COMPRESSOR_MAX_ONOFF (1)
|
||||
#define AL_COMPRESSOR_DEFAULT_ONOFF (1)
|
||||
|
||||
/* Equalizer effect */
|
||||
#define AL_EQUALIZER_MIN_LOW_GAIN (0.126f)
|
||||
#define AL_EQUALIZER_MAX_LOW_GAIN (7.943f)
|
||||
#define AL_EQUALIZER_DEFAULT_LOW_GAIN (1.0f)
|
||||
|
||||
#define AL_EQUALIZER_MIN_LOW_CUTOFF (50.0f)
|
||||
#define AL_EQUALIZER_MAX_LOW_CUTOFF (800.0f)
|
||||
#define AL_EQUALIZER_DEFAULT_LOW_CUTOFF (200.0f)
|
||||
|
||||
#define AL_EQUALIZER_MIN_MID1_GAIN (0.126f)
|
||||
#define AL_EQUALIZER_MAX_MID1_GAIN (7.943f)
|
||||
#define AL_EQUALIZER_DEFAULT_MID1_GAIN (1.0f)
|
||||
|
||||
#define AL_EQUALIZER_MIN_MID1_CENTER (200.0f)
|
||||
#define AL_EQUALIZER_MAX_MID1_CENTER (3000.0f)
|
||||
#define AL_EQUALIZER_DEFAULT_MID1_CENTER (500.0f)
|
||||
|
||||
#define AL_EQUALIZER_MIN_MID1_WIDTH (0.01f)
|
||||
#define AL_EQUALIZER_MAX_MID1_WIDTH (1.0f)
|
||||
#define AL_EQUALIZER_DEFAULT_MID1_WIDTH (1.0f)
|
||||
|
||||
#define AL_EQUALIZER_MIN_MID2_GAIN (0.126f)
|
||||
#define AL_EQUALIZER_MAX_MID2_GAIN (7.943f)
|
||||
#define AL_EQUALIZER_DEFAULT_MID2_GAIN (1.0f)
|
||||
|
||||
#define AL_EQUALIZER_MIN_MID2_CENTER (1000.0f)
|
||||
#define AL_EQUALIZER_MAX_MID2_CENTER (8000.0f)
|
||||
#define AL_EQUALIZER_DEFAULT_MID2_CENTER (3000.0f)
|
||||
|
||||
#define AL_EQUALIZER_MIN_MID2_WIDTH (0.01f)
|
||||
#define AL_EQUALIZER_MAX_MID2_WIDTH (1.0f)
|
||||
#define AL_EQUALIZER_DEFAULT_MID2_WIDTH (1.0f)
|
||||
|
||||
#define AL_EQUALIZER_MIN_HIGH_GAIN (0.126f)
|
||||
#define AL_EQUALIZER_MAX_HIGH_GAIN (7.943f)
|
||||
#define AL_EQUALIZER_DEFAULT_HIGH_GAIN (1.0f)
|
||||
|
||||
#define AL_EQUALIZER_MIN_HIGH_CUTOFF (4000.0f)
|
||||
#define AL_EQUALIZER_MAX_HIGH_CUTOFF (16000.0f)
|
||||
#define AL_EQUALIZER_DEFAULT_HIGH_CUTOFF (6000.0f)
|
||||
|
||||
|
||||
/* Source parameter value ranges and defaults. */
|
||||
#define AL_MIN_AIR_ABSORPTION_FACTOR (0.0f)
|
||||
#define AL_MAX_AIR_ABSORPTION_FACTOR (10.0f)
|
||||
#define AL_DEFAULT_AIR_ABSORPTION_FACTOR (0.0f)
|
||||
|
||||
#define AL_MIN_ROOM_ROLLOFF_FACTOR (0.0f)
|
||||
#define AL_MAX_ROOM_ROLLOFF_FACTOR (10.0f)
|
||||
#define AL_DEFAULT_ROOM_ROLLOFF_FACTOR (0.0f)
|
||||
|
||||
#define AL_MIN_CONE_OUTER_GAINHF (0.0f)
|
||||
#define AL_MAX_CONE_OUTER_GAINHF (1.0f)
|
||||
#define AL_DEFAULT_CONE_OUTER_GAINHF (1.0f)
|
||||
|
||||
#define AL_MIN_DIRECT_FILTER_GAINHF_AUTO AL_FALSE
|
||||
#define AL_MAX_DIRECT_FILTER_GAINHF_AUTO AL_TRUE
|
||||
#define AL_DEFAULT_DIRECT_FILTER_GAINHF_AUTO AL_TRUE
|
||||
|
||||
#define AL_MIN_AUXILIARY_SEND_FILTER_GAIN_AUTO AL_FALSE
|
||||
#define AL_MAX_AUXILIARY_SEND_FILTER_GAIN_AUTO AL_TRUE
|
||||
#define AL_DEFAULT_AUXILIARY_SEND_FILTER_GAIN_AUTO AL_TRUE
|
||||
|
||||
#define AL_MIN_AUXILIARY_SEND_FILTER_GAINHF_AUTO AL_FALSE
|
||||
#define AL_MAX_AUXILIARY_SEND_FILTER_GAINHF_AUTO AL_TRUE
|
||||
#define AL_DEFAULT_AUXILIARY_SEND_FILTER_GAINHF_AUTO AL_TRUE
|
||||
|
||||
|
||||
/* Listener parameter value ranges and defaults. */
|
||||
#define AL_MIN_METERS_PER_UNIT FLT_MIN
|
||||
#define AL_MAX_METERS_PER_UNIT FLT_MAX
|
||||
#define AL_DEFAULT_METERS_PER_UNIT (1.0f)
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* AL_EFX_H */
|
BIN
neo/libs/openal-soft/lib/win32/OpenAL32.lib
Normal file
BIN
neo/libs/openal-soft/lib/win32/OpenAL32.lib
Normal file
Binary file not shown.
27
neo/libs/openal-soft/readme.txt
Normal file
27
neo/libs/openal-soft/readme.txt
Normal file
|
@ -0,0 +1,27 @@
|
|||
OpenAL Soft Binary Distribution
|
||||
|
||||
These binaries are provided as a convenience. Users and developers may use it
|
||||
so they can use OpenAL Soft without having to build it from source.
|
||||
|
||||
Note that it is still expected to install the OpenAL redistributable provided
|
||||
by Creative Labs (at http://openal.org/), as that will provide the "router"
|
||||
OpenAL32.dll that applications talk to, and may provide extra drivers for the
|
||||
user's hardware. The DLLs provided here will simply add additional devices for
|
||||
applications to select from. If you do not wish to use the redistributable,
|
||||
then rename soft_oal.dll to OpenAL32.dll (note: even the 64-bit DLL should be
|
||||
named OpenAL32.dll)... just be aware this will prevent other system-installed
|
||||
OpenAL implementations from working.
|
||||
|
||||
To use the 32-bit DLL, copy it from the Win32 folder to the folder OpenAL32.dll
|
||||
is installed in.
|
||||
For 32-bit Windows, the Win32 DLL will typically go into the system32 folder.
|
||||
For 64-bit Windows, the Win32 DLL will typically go into the SysWOW64 folder.
|
||||
|
||||
To use the 64-bit DLL, copy it from the Win64 folder to the folder OpenAL32.dll
|
||||
is installed in. This will typically be the system32 folder.
|
||||
|
||||
The included openal-info32.exe and openal-info64.exe programs can be used to
|
||||
tell if the OpenAL Soft DLL is being detected. It should be run from a command
|
||||
shell, as the program will exit as soon as it's done printing information.
|
||||
|
||||
Have fun!
|
BIN
neo/libs/openal-soft/win32/OpenAL32.dll
Normal file
BIN
neo/libs/openal-soft/win32/OpenAL32.dll
Normal file
Binary file not shown.
|
@ -91,8 +91,9 @@ void idAutoRender::StartBackgroundAutoSwaps( autoRenderIconType_t iconType )
|
|||
// it is getting purged before our our first frame has been rendered.
|
||||
globalImages->UnbindAll();
|
||||
|
||||
|
||||
StartThread( "BackgroundAutoSwaps", CORE_0B, THREAD_NORMAL, AUTO_RENDER_STACK_SIZE );
|
||||
// DG: set name to "BGAutoSwaps" because Linux has a 16char (incl. \0) namelimit for threads
|
||||
StartThread( "BGAutoSwaps", CORE_0B, THREAD_NORMAL, AUTO_RENDER_STACK_SIZE );
|
||||
// DG end
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -300,4 +301,4 @@ void idAutoRender::RenderLoadingIcon( float fracX, float fracY, float size, floa
|
|||
renderProgManager.BindShader_TextureVertexColor();
|
||||
|
||||
RB_DrawElementsWithCounters( &backEnd.unitSquareSurface );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -310,99 +310,6 @@ void idRenderProgManager::LoadFragmentShader( int index )
|
|||
fragmentShaders[index].progId = ( GLuint ) LoadGLSLShader( GL_FRAGMENT_SHADER, fragmentShaders[index].name, fragmentShaders[index].uniforms );
|
||||
}
|
||||
|
||||
/*
|
||||
================================================================================================
|
||||
idRenderProgManager::LoadShader
|
||||
================================================================================================
|
||||
*/
|
||||
GLuint idRenderProgManager::LoadShader( GLenum target, const char* name, const char* startToken )
|
||||
{
|
||||
|
||||
idStr fullPath = "renderprogs\\gl\\";
|
||||
fullPath += name;
|
||||
|
||||
common->Printf( "%s", fullPath.c_str() );
|
||||
|
||||
char* fileBuffer = NULL;
|
||||
fileSystem->ReadFile( fullPath.c_str(), ( void** )&fileBuffer, NULL );
|
||||
if( fileBuffer == NULL )
|
||||
{
|
||||
common->Printf( ": File not found\n" );
|
||||
return INVALID_PROGID;
|
||||
}
|
||||
if( !R_IsInitialized() )
|
||||
{
|
||||
common->Printf( ": Renderer not initialized\n" );
|
||||
fileSystem->FreeFile( fileBuffer );
|
||||
return INVALID_PROGID;
|
||||
}
|
||||
|
||||
// vertex and fragment shaders are both be present in a single file, so
|
||||
// scan for the proper header to be the start point, and stamp a 0 in after the end
|
||||
char* start = strstr( ( char* )fileBuffer, startToken );
|
||||
if( start == NULL )
|
||||
{
|
||||
common->Printf( ": %s not found\n", startToken );
|
||||
fileSystem->FreeFile( fileBuffer );
|
||||
return INVALID_PROGID;
|
||||
}
|
||||
char* end = strstr( start, "END" );
|
||||
if( end == NULL )
|
||||
{
|
||||
common->Printf( ": END not found for %s\n", startToken );
|
||||
fileSystem->FreeFile( fileBuffer );
|
||||
return INVALID_PROGID;
|
||||
}
|
||||
end[3] = 0;
|
||||
|
||||
idStr program = start;
|
||||
program.Replace( "vertex.normal", "vertex.attrib[11]" );
|
||||
program.Replace( "vertex.texcoord[0]", "vertex.attrib[8]" );
|
||||
program.Replace( "vertex.texcoord", "vertex.attrib[8]" );
|
||||
|
||||
GLuint progId;
|
||||
glGenProgramsARB( 1, &progId );
|
||||
|
||||
glBindProgramARB( target, progId );
|
||||
glGetError();
|
||||
|
||||
glProgramStringARB( target, GL_PROGRAM_FORMAT_ASCII_ARB, program.Length(), program.c_str() );
|
||||
GLenum err = glGetError();
|
||||
|
||||
GLint ofs = -1;
|
||||
glGetIntegerv( GL_PROGRAM_ERROR_POSITION_ARB, &ofs );
|
||||
if( ( err == GL_INVALID_OPERATION ) || ( ofs != -1 ) )
|
||||
{
|
||||
if( err == GL_INVALID_OPERATION )
|
||||
{
|
||||
const GLubyte* str = glGetString( GL_PROGRAM_ERROR_STRING_ARB );
|
||||
common->Printf( "\nGL_PROGRAM_ERROR_STRING_ARB: %s\n", str );
|
||||
}
|
||||
else
|
||||
{
|
||||
common->Printf( "\nUNKNOWN ERROR\n" );
|
||||
}
|
||||
if( ofs < 0 )
|
||||
{
|
||||
common->Printf( "GL_PROGRAM_ERROR_POSITION_ARB < 0\n" );
|
||||
}
|
||||
else if( ofs >= program.Length() )
|
||||
{
|
||||
common->Printf( "error at end of shader\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
common->Printf( "error at %i:\n%s", ofs, program.c_str() + ofs );
|
||||
}
|
||||
glDeleteProgramsARB( 1, &progId );
|
||||
fileSystem->FreeFile( fileBuffer );
|
||||
return INVALID_PROGID;
|
||||
}
|
||||
common->Printf( "\n" );
|
||||
fileSystem->FreeFile( fileBuffer );
|
||||
return progId;
|
||||
}
|
||||
|
||||
/*
|
||||
================================================================================================
|
||||
idRenderProgManager::BindShader
|
||||
|
|
|
@ -368,7 +368,6 @@ protected:
|
|||
BindShader( builtinShaders[i], builtinShaders[i] );
|
||||
}
|
||||
|
||||
GLuint LoadShader( GLenum target, const char* name, const char* startToken );
|
||||
bool CompileGLSL( GLenum target, const char* name );
|
||||
GLuint LoadGLSLShader( GLenum target, const char* name, idList<int>& uniforms );
|
||||
void LoadGLSLProgram( const int programIndex, const int vertexShaderIndex, const int fragmentShaderIndex );
|
||||
|
|
|
@ -34,7 +34,9 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
idCVar r_skipStripDeadCode( "r_skipStripDeadCode", "0", CVAR_BOOL, "Skip stripping dead code" );
|
||||
idCVar r_useUniformArrays( "r_useUniformArrays", "1", CVAR_BOOL, "" );
|
||||
|
||||
// DG: the AMD drivers output a lot of useless warnings which are fscking annoying, added this CVar to suppress them
|
||||
idCVar r_displayGLSLCompilerMessages( "r_displayGLSLCompilerMessages", "1", CVAR_BOOL | CVAR_ARCHIVE, "Show info messages the GPU driver outputs when compiling the shaders" );
|
||||
// DG end
|
||||
|
||||
#define VERTEX_UNIFORM_ARRAY_NAME "_va_"
|
||||
#define FRAGMENT_UNIFORM_ARRAY_NAME "_fa_"
|
||||
|
@ -1190,7 +1192,7 @@ GLuint idRenderProgManager::LoadGLSLShader( GLenum target, const char* name, idL
|
|||
{
|
||||
//idLib::Printf( "%s program %s from %s compiled to run on hardware\n", typeName, GetName(), GetFileName() );
|
||||
}
|
||||
else
|
||||
else if( r_displayGLSLCompilerMessages.GetBool() ) // DG: check for the CVar I added above
|
||||
{
|
||||
idLib::Printf( "While compiling %s program %s\n", ( target == GL_FRAGMENT_SHADER ) ? "fragment" : "vertex" , inFile.c_str() );
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
|
@ -181,9 +182,11 @@ void RB_DrawElementsWithCounters( const drawSurf_t* surf )
|
|||
// DG: this happens all the time in the erebus1 map with blendlight.vfp,
|
||||
// so don't call assert (through verify) here until it's fixed (if fixable)
|
||||
// else the game crashes on linux when using debug builds
|
||||
|
||||
// FIXME: fix this properly if possible?
|
||||
// RB: yes but it would require an additional blend light skinned shader
|
||||
//if( !verify( renderProgManager.ShaderUsesJoints() ) )
|
||||
if( ! renderProgManager.ShaderUsesJoints() )
|
||||
if( !renderProgManager.ShaderUsesJoints() )
|
||||
// DG end
|
||||
{
|
||||
return;
|
||||
|
@ -2271,7 +2274,10 @@ static int RB_DrawShaderPasses( const drawSurf_t* const* const drawSurfs, const
|
|||
|
||||
GL_State( stageGLState );
|
||||
|
||||
renderProgManager.BindShader( newStage->glslProgram, newStage->glslProgram );
|
||||
// RB: CRITICAL BUGFIX: changed newStage->glslProgram to vertexProgram and fragmentProgram
|
||||
// otherwise it will result in an out of bounds crash in RB_DrawElementsWithCounters
|
||||
renderProgManager.BindShader( newStage->vertexProgram, newStage->fragmentProgram );
|
||||
// RB end
|
||||
|
||||
for( int j = 0; j < newStage->numVertexParms; j++ )
|
||||
{
|
||||
|
|
|
@ -1069,46 +1069,27 @@ struct glimpParms_t
|
|||
// So add PreInit for platforms that need it, others can just stub it.
|
||||
void GLimp_PreInit();
|
||||
|
||||
bool GLimp_Init( glimpParms_t parms );
|
||||
// If the desired mode can't be set satisfactorily, false will be returned.
|
||||
// If succesful, sets glConfig.nativeScreenWidth, glConfig.nativeScreenHeight, and glConfig.pixelAspect
|
||||
|
||||
// The renderer will then reset the glimpParms to "safe mode" of 640x480
|
||||
// fullscreen and try again. If that also fails, the error will be fatal.
|
||||
bool GLimp_Init( glimpParms_t parms );
|
||||
|
||||
bool GLimp_SetScreenParms( glimpParms_t parms );
|
||||
// will set up gl up with the new parms
|
||||
bool GLimp_SetScreenParms( glimpParms_t parms );
|
||||
|
||||
void GLimp_Shutdown();
|
||||
// Destroys the rendering context, closes the window, resets the resolution,
|
||||
// and resets the gamma ramps.
|
||||
void GLimp_Shutdown();
|
||||
|
||||
void GLimp_SetGamma( unsigned short red[256],
|
||||
unsigned short green[256],
|
||||
unsigned short blue[256] );
|
||||
// Sets the hardware gamma ramps for gamma and brightness adjustment.
|
||||
// These are now taken as 16 bit values, so we can take full advantage
|
||||
// of dacs with >8 bits of precision
|
||||
void GLimp_SetGamma( unsigned short red[256],
|
||||
unsigned short green[256],
|
||||
unsigned short blue[256] );
|
||||
|
||||
|
||||
bool GLimp_SpawnRenderThread( void ( *function )() );
|
||||
// Returns false if the system only has a single processor
|
||||
|
||||
void* GLimp_BackEndSleep();
|
||||
void GLimp_FrontEndSleep();
|
||||
void GLimp_WakeBackEnd( void* data );
|
||||
// these functions implement the dual processor syncronization
|
||||
|
||||
void GLimp_ActivateContext();
|
||||
void GLimp_DeactivateContext();
|
||||
// These are used for managing SMP handoffs of the OpenGL context
|
||||
// between threads, and as a performance tunining aid. Setting
|
||||
// 'r_skipRenderContext 1' will call GLimp_DeactivateContext() before
|
||||
// the 3D rendering code, and GLimp_ActivateContext() afterwards. On
|
||||
// most OpenGL implementations, this will result in all OpenGL calls
|
||||
// being immediate returns, which lets us guage how much time is
|
||||
// being spent inside OpenGL.
|
||||
|
||||
|
||||
/*
|
||||
============================================================
|
||||
|
|
|
@ -130,7 +130,7 @@ void idSoundVoice_OpenAL::Create( const idSoundSample* leadinSample_, const idSo
|
|||
alSourcef( openalSource, AL_ROLLOFF_FACTOR, 0.0f );
|
||||
|
||||
//if( ( loopingSample == NULL && leadinSample->openalBuffer != 0 ) || ( loopingSample != NULL && soundShader->entries[0]->hardwareBuffer ) )
|
||||
if( leadinSample->openalBuffer != NULL )
|
||||
if( leadinSample->openalBuffer != 0 )
|
||||
{
|
||||
alSourcei( openalSource, AL_BUFFER, 0 );
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#pragma hdrstop
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "win_achievements.h"
|
||||
#include "achievements.h"
|
||||
#include "../sys_session_local.h"
|
||||
|
||||
extern idCVar achievements_Verbose;
|
|
@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#pragma hdrstop
|
||||
#include "precompiled.h"
|
||||
#include "win_localuser.h"
|
||||
#include "localuser.h"
|
||||
|
||||
extern idCVar win_userPersistent;
|
||||
extern idCVar win_userOnline;
|
|
@ -38,6 +38,11 @@ extern idCVar savegame_error;
|
|||
|
||||
#define SAVEGAME_SENTINAL 0x12358932
|
||||
|
||||
// RB begin
|
||||
#ifndef _WIN32 // DG: unify win32 and posix savegames
|
||||
#define ERROR_SUCCESS 0
|
||||
#endif
|
||||
// RB end
|
||||
/*
|
||||
========================
|
||||
void Sys_ExecuteSavegameCommandAsync
|
||||
|
@ -176,7 +181,11 @@ int idSaveGameThread::Save()
|
|||
idFile* outputFile = fileSystem->OpenFileWrite( tempFileName, "fs_savePath" );
|
||||
if( outputFile == NULL )
|
||||
{
|
||||
#ifdef _WIN32 // DG: unify windows and posix savegames => replace GetLastError with strerror(errno)
|
||||
idLib::Warning( "[%s]: Couldn't open file for writing, %s. Error = %08x", __FUNCTION__, tempFileName.c_str(), GetLastError() );
|
||||
#else
|
||||
idLib::Warning( "[%s]: Couldn't open file for writing, %s. Error = %s", __FUNCTION__, tempFileName.c_str(), strerror( errno ) );
|
||||
#endif // DG end
|
||||
file->error = true;
|
||||
callback->errorCode = SAVEGAME_E_UNKNOWN;
|
||||
ret = -1;
|
||||
|
@ -194,7 +203,11 @@ int idSaveGameThread::Save()
|
|||
{
|
||||
if( ( size_t )outputFile->Write( block.data, block.bytes ) != block.bytes )
|
||||
{
|
||||
#ifdef _WIN32 // DG: unify windows and posix savegames => replace GetLastError with strerror(errno)
|
||||
idLib::Warning( "[%s]: Write failed. Error = %08x", __FUNCTION__, GetLastError() );
|
||||
#else
|
||||
idLib::Warning( "[%s]: Write failed. Error = %s", __FUNCTION__, strerror( errno ) );
|
||||
#endif // DG end
|
||||
file->error = true;
|
||||
callback->errorCode = SAVEGAME_E_INSUFFICIENT_ROOM;
|
||||
ret = -1;
|
||||
|
@ -214,7 +227,11 @@ int idSaveGameThread::Save()
|
|||
size_t size = outputFile->WriteBig( checksum );
|
||||
if( size != sizeof( checksum ) )
|
||||
{
|
||||
#ifdef _WIN32 // DG: unify windows and posix savegames => replace GetLastError with strerror(errno)
|
||||
idLib::Warning( "[%s]: Write failed. Error = %08x", __FUNCTION__, GetLastError() );
|
||||
#else
|
||||
idLib::Warning( "[%s]: Write failed. Error = %s", __FUNCTION__, strerror( errno ) );
|
||||
#endif // DG end
|
||||
file->error = true;
|
||||
callback->errorCode = SAVEGAME_E_INSUFFICIENT_ROOM;
|
||||
ret = -1;
|
||||
|
@ -225,7 +242,11 @@ int idSaveGameThread::Save()
|
|||
size_t size = outputFile->Write( file->GetDataPtr(), file->Length() );
|
||||
if( size != ( size_t )file->Length() )
|
||||
{
|
||||
#ifdef _WIN32 // DG: unify windows and posix savegames => replace GetLastError with strerror(errno)
|
||||
idLib::Warning( "[%s]: Write failed. Error = %08x", __FUNCTION__, GetLastError() );
|
||||
#else
|
||||
idLib::Warning( "[%s]: Write failed. Error = %s", __FUNCTION__, strerror( errno ) );
|
||||
#endif // DG end
|
||||
file->error = true;
|
||||
callback->errorCode = SAVEGAME_E_INSUFFICIENT_ROOM;
|
||||
ret = -1;
|
||||
|
@ -473,7 +494,7 @@ int idSaveGameThread::Enumerate()
|
|||
ret = -1;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32 // DG: unification of win32 and posix savagame code
|
||||
// Use the date from the directory
|
||||
WIN32_FILE_ATTRIBUTE_DATA attrData;
|
||||
BOOL attrRet = GetFileAttributesEx( file->GetFullPath(), GetFileExInfoStandard, &attrData );
|
||||
|
@ -500,6 +521,11 @@ int idSaveGameThread::Enumerate()
|
|||
itime.QuadPart /= second;
|
||||
details->date = itime.QuadPart;
|
||||
}
|
||||
#else
|
||||
// DG: just use the idFile object's timestamp - the windows code gets file attributes and
|
||||
// other complicated stuff like that.. I'm wonderin what that was good for.. this seems to work.
|
||||
details->date = file->Timestamp();
|
||||
#endif // DG end
|
||||
}
|
||||
else
|
||||
{
|
|
@ -14,15 +14,16 @@ Contains the windows implementation of the network session
|
|||
*/
|
||||
|
||||
#pragma hdrstop
|
||||
#include "../../idlib/precompiled.h"
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "../../framework/Common_local.h"
|
||||
#include "../sys_session_local.h"
|
||||
#include "../sys_stats.h"
|
||||
#include "../sys_savegame.h"
|
||||
#include "../sys_lobby_backend_direct.h"
|
||||
#include "../sys_voicechat.h"
|
||||
#include "posix_achievements.h"
|
||||
//#include "_local.h"
|
||||
#include "achievements.h"
|
||||
//#include "win_local.h"
|
||||
|
||||
/*
|
||||
========================
|
||||
|
@ -388,7 +389,7 @@ void idSessionLocalWin::Connect_f( const idCmdArgs& args )
|
|||
{
|
||||
if( args.Argc() < 2 )
|
||||
{
|
||||
idLib::Printf( "Usage: Connect to IP. Use with net_port. \n" );
|
||||
idLib::Printf( "Usage: Connect to IP. Use IP:Port to specify port (e.g. 10.0.0.1:1234) \n" );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -402,7 +403,13 @@ void idSessionLocalWin::Connect_f( const idCmdArgs& args )
|
|||
lobbyConnectInfo_t connectInfo;
|
||||
|
||||
Sys_StringToNetAdr( args.Argv( 1 ), &connectInfo.netAddr, true );
|
||||
connectInfo.netAddr.port = net_port.GetInteger();
|
||||
// DG: don't use net_port to select port to connect to
|
||||
// the port can be specified in the command, else the default port is used
|
||||
if( connectInfo.netAddr.port == 0 )
|
||||
{
|
||||
connectInfo.netAddr.port = 27015;
|
||||
}
|
||||
// DG end
|
||||
|
||||
ConnectAndMoveToLobby( GetPartyLobby(), connectInfo, false );
|
||||
}
|
||||
|
@ -600,7 +607,7 @@ idSessionLocalWin::EnsurePort
|
|||
*/
|
||||
void idSessionLocalWin::EnsurePort()
|
||||
{
|
||||
// Init the port using reqular windows sockets
|
||||
// Init the port using reqular sockets
|
||||
if( port.IsOpen() )
|
||||
{
|
||||
return; // Already initialized
|
||||
|
@ -608,6 +615,7 @@ void idSessionLocalWin::EnsurePort()
|
|||
|
||||
if( port.InitPort( net_port.GetInteger(), false ) )
|
||||
{
|
||||
// TODO: what about canJoinLocalHost when running two instances with different net_port values?
|
||||
canJoinLocalHost = false;
|
||||
}
|
||||
else
|
|
@ -28,10 +28,13 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#pragma hdrstop
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "../../framework/PlayerProfile.h"
|
||||
#include "../sys_session_local.h"
|
||||
#include "win_signin.h"
|
||||
|
||||
#include "signin.h"
|
||||
#ifndef _WIN32
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef _DEBUG
|
||||
idCVar win_userPersistent( "win_userPersistent", "1", CVAR_BOOL, "debugging cvar for profile persistence status" );
|
||||
idCVar win_userOnline( "win_userOnline", "1", CVAR_BOOL, "debugging cvar for profile online status" );
|
||||
|
@ -39,6 +42,11 @@ idCVar win_isInParty( "win_isInParty", "0", CVAR_BOOL, "debugging cvar for platf
|
|||
idCVar win_partyCount( "win_partyCount", "0", CVAR_INTEGER, "debugginc var for platform party count" );
|
||||
#endif
|
||||
|
||||
// DG: D3BFG got the username from steam, in the GPL release it just uses the hostname.
|
||||
// this adds a name to set a player name
|
||||
idCVar ui_name( "ui_name", "", CVAR_ARCHIVE, "player name - leave empty for default name (system's hostname)" );
|
||||
// DG end
|
||||
|
||||
/*
|
||||
========================
|
||||
idSignInManagerWin::Shutdown
|
||||
|
@ -104,10 +112,21 @@ void idSignInManagerWin::RegisterLocalUser( int inputDevice )
|
|||
}
|
||||
|
||||
static char machineName[128];
|
||||
DWORD len = 128;
|
||||
::GetComputerName( machineName, &len );
|
||||
// DG: support for ui_name
|
||||
const char* nameSource = ui_name.GetString();
|
||||
|
||||
const char* nameSource = machineName;
|
||||
if( idStr::Length( nameSource ) == 0 )
|
||||
{
|
||||
// ui_name was empty => default to hostname
|
||||
#ifdef _WIN32
|
||||
DWORD len = 128;
|
||||
::GetComputerName( machineName, &len );
|
||||
#else
|
||||
gethostname( machineName, sizeof( machineName ) );
|
||||
#endif
|
||||
nameSource = machineName;
|
||||
}
|
||||
// DG end
|
||||
|
||||
idStr name( nameSource );
|
||||
int nameLength = name.Length();
|
||||
|
@ -123,6 +142,8 @@ void idSignInManagerWin::RegisterLocalUser( int inputDevice )
|
|||
}
|
||||
}
|
||||
|
||||
idLib::Printf( "Added local user: %s\n", name.c_str() );
|
||||
|
||||
idLocalUserWin& localUser = *localUsers.Alloc();
|
||||
|
||||
localUser.Init( inputDevice, name.c_str(), localUsers.Num() );
|
|
@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#ifndef __POSIX_SIGNIN_H__
|
||||
#define __POSIX_SIGNIN_H__
|
||||
|
||||
#include "posix_localuser.h"
|
||||
#include "localuser.h"
|
||||
|
||||
/*
|
||||
================================================
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013 Daniel Gibson (changes for POSIX)
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
|
@ -25,28 +26,90 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
===========================================================================
|
||||
*/
|
||||
#pragma hdrstop
|
||||
#include "precompiled.h"
|
||||
|
||||
|
||||
/*
|
||||
================================================================================================
|
||||
Contains the NetworkSystem implementation specific to Win32.
|
||||
Contains the NetworkSystem implementation for SOCKET APIs, currently POSIX Systems (Linux, FreeBSD,
|
||||
OSX, ...) and Winsock (Windows...) are supported.
|
||||
Note that other POSIX systems may need some small changes, e.g. in Sys_InitNetworking()
|
||||
================================================================================================
|
||||
*/
|
||||
|
||||
#pragma hdrstop
|
||||
#include "precompiled.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <iptypes.h>
|
||||
#include <iphlpapi.h>
|
||||
|
||||
static WSADATA winsockdata;
|
||||
static bool winsockInitialized = false;
|
||||
static bool usingSocks = false;
|
||||
|
||||
//lint -e569 ioctl macros trigger this
|
||||
|
||||
// force these libs to be included, so users of idLib don't need to add them to every project
|
||||
#pragma comment(lib, "iphlpapi.lib" )
|
||||
#pragma comment(lib, "wsock32.lib" )
|
||||
|
||||
#else // ! _WIN32
|
||||
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/uio.h>
|
||||
#include <errno.h>
|
||||
#include <sys/select.h>
|
||||
#include <net/if.h>
|
||||
#if defined(MACOS_X) || defined(__FreeBSD__)
|
||||
#include <ifaddrs.h>
|
||||
#endif
|
||||
|
||||
#endif // _WIN32
|
||||
|
||||
/*
|
||||
================================================================================================
|
||||
|
||||
Some #defines and platform specific things etc to abstract differences between Winsocks and
|
||||
real POSIX sockets away..
|
||||
|
||||
================================================================================================
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#define Net_GetLastError WSAGetLastError
|
||||
|
||||
#define D3_NET_EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#define D3_NET_ECONNRESET WSAECONNRESET
|
||||
#define D3_NET_EADDRNOTAVAIL WSAEADDRNOTAVAIL
|
||||
|
||||
typedef ULONG in_addr_t;
|
||||
typedef int socklen_t;
|
||||
|
||||
static WSADATA winsockdata;
|
||||
static bool winsockInitialized = false;
|
||||
|
||||
#else // ! _WIN32
|
||||
|
||||
static int Net_GetLastError()
|
||||
{
|
||||
return errno;
|
||||
}
|
||||
|
||||
#define D3_NET_EWOULDBLOCK EWOULDBLOCK
|
||||
#define D3_NET_ECONNRESET ECONNRESET
|
||||
#define D3_NET_EADDRNOTAVAIL EADDRNOTAVAIL
|
||||
|
||||
typedef int SOCKET;
|
||||
#define closesocket(x) close(x)
|
||||
#define SOCKET_ERROR -1
|
||||
#define INVALID_SOCKET -1
|
||||
|
||||
#endif // _WIN32
|
||||
|
||||
/*
|
||||
================================================================================================
|
||||
|
@ -61,18 +124,23 @@ idCVar net_socksPort( "net_socksPort", "1080", CVAR_ARCHIVE | CVAR_INTEGER, "" )
|
|||
idCVar net_socksUsername( "net_socksUsername", "", CVAR_ARCHIVE, "" );
|
||||
idCVar net_socksPassword( "net_socksPassword", "", CVAR_ARCHIVE, "" );
|
||||
|
||||
idCVar net_ip( "net_ip", "localhost", 0, "local IP address" );
|
||||
idCVar net_ip( "net_ip", "localhost", CVAR_NOCHEAT, "local IP address" );
|
||||
|
||||
static struct sockaddr_in socksRelayAddr;
|
||||
|
||||
static SOCKET ip_socket;
|
||||
static SOCKET socks_socket;
|
||||
// static SOCKET ip_socket; FIXME: what was this about?
|
||||
|
||||
static bool usingSocks = false;
|
||||
static SOCKET socks_socket = 0;
|
||||
static char socksBuf[4096];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned long ip;
|
||||
unsigned long mask;
|
||||
// RB: 64 bit fixes, changed long to int
|
||||
// FIXME: IPv6?
|
||||
unsigned int ip;
|
||||
unsigned int mask;
|
||||
// RB end
|
||||
char addr[16];
|
||||
} net_interface;
|
||||
|
||||
|
@ -95,9 +163,10 @@ NET_ErrorString
|
|||
*/
|
||||
const char* NET_ErrorString()
|
||||
{
|
||||
int code;
|
||||
|
||||
code = WSAGetLastError();
|
||||
#ifndef _WIN32
|
||||
return strerror( errno );
|
||||
#else // _WIN32
|
||||
int code = WSAGetLastError();
|
||||
switch( code )
|
||||
{
|
||||
case WSAEINTR:
|
||||
|
@ -191,6 +260,7 @@ const char* NET_ErrorString()
|
|||
default:
|
||||
return "NO ERROR";
|
||||
}
|
||||
#endif // _WIN32
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -210,7 +280,7 @@ void Net_NetadrToSockadr( const netadr_t* a, sockaddr_in* s )
|
|||
else if( a->type == NA_IP || a->type == NA_LOOPBACK )
|
||||
{
|
||||
s->sin_family = AF_INET;
|
||||
s->sin_addr.s_addr = *( int* )a->ip;
|
||||
s->sin_addr.s_addr = *( ( in_addr_t* ) &a->ip );
|
||||
}
|
||||
|
||||
s->sin_port = htons( ( short )a->port );
|
||||
|
@ -221,16 +291,21 @@ void Net_NetadrToSockadr( const netadr_t* a, sockaddr_in* s )
|
|||
Net_SockadrToNetadr
|
||||
========================
|
||||
*/
|
||||
#define LOOPBACK_NET 0x7F000000 // 127.0.0.0
|
||||
#define LOOPBACK_PREFIX 0xFF000000 // /8 or 255.0.0.0
|
||||
void Net_SockadrToNetadr( sockaddr_in* s, netadr_t* a )
|
||||
{
|
||||
unsigned int ip;
|
||||
in_addr_t ip;
|
||||
if( s->sin_family == AF_INET )
|
||||
{
|
||||
ip = s->sin_addr.s_addr;
|
||||
*( unsigned int* )a->ip = ip;
|
||||
a->port = htons( s->sin_port );
|
||||
*( in_addr_t* )&a->ip = ip;
|
||||
a->port = ntohs( s->sin_port );
|
||||
// we store in network order, that loopback test is host order..
|
||||
ip = ntohl( ip );
|
||||
// DG: just comparing ip with INADDR_LOOPBACK is lame,
|
||||
// because all of 127.0.0.0/8 is loopback.
|
||||
// if( ( ip & LOOPBACK_PREFIX ) == LOOPBACK_NET )
|
||||
if( ip == INADDR_LOOPBACK )
|
||||
{
|
||||
a->type = NA_LOOPBACK;
|
||||
|
@ -260,11 +335,14 @@ static bool Net_ExtractPort( const char* src, char* buf, int bufsize, int* port
|
|||
return false;
|
||||
}
|
||||
*p = '\0';
|
||||
*port = strtol( p + 1, NULL, 10 );
|
||||
if( errno == ERANGE )
|
||||
|
||||
long lport = strtol( p + 1, NULL, 10 );
|
||||
if( lport == 0 || lport == LONG_MIN || lport == LONG_MAX )
|
||||
{
|
||||
*port = 0;
|
||||
return false;
|
||||
}
|
||||
*port = lport;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -275,6 +353,12 @@ Net_StringToSockaddr
|
|||
*/
|
||||
static bool Net_StringToSockaddr( const char* s, sockaddr_in* sadr, bool doDNSResolve )
|
||||
{
|
||||
/* NOTE: the doDNSResolve argument is ignored for two reasons:
|
||||
* 1. domains can start with numbers nowadays so the old heuristic to find out if it's
|
||||
* an IP (check if the first char is a digit) isn't reliable
|
||||
* 2. gethostbyname() works fine for IPs and doesn't do a lookup if the passed string
|
||||
* is an IP
|
||||
*/
|
||||
struct hostent* h;
|
||||
char buf[256];
|
||||
int port;
|
||||
|
@ -284,44 +368,19 @@ static bool Net_StringToSockaddr( const char* s, sockaddr_in* sadr, bool doDNSRe
|
|||
sadr->sin_family = AF_INET;
|
||||
sadr->sin_port = 0;
|
||||
|
||||
if( s[0] >= '0' && s[0] <= '9' )
|
||||
// try to remove the port first, otherwise the DNS gets confused into multiple timeouts
|
||||
// failed or not failed, buf is expected to contain the appropriate host to resolve
|
||||
if( Net_ExtractPort( s, buf, sizeof( buf ), &port ) )
|
||||
{
|
||||
unsigned long ret = inet_addr( s );
|
||||
if( ret != INADDR_NONE )
|
||||
{
|
||||
*( int* )&sadr->sin_addr = ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
// check for port
|
||||
if( !Net_ExtractPort( s, buf, sizeof( buf ), &port ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
ret = inet_addr( buf );
|
||||
if( ret == INADDR_NONE )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*( int* )&sadr->sin_addr = ret;
|
||||
sadr->sin_port = htons( port );
|
||||
}
|
||||
sadr->sin_port = htons( port );
|
||||
}
|
||||
else if( doDNSResolve )
|
||||
// buf contains the host, even if Net_ExtractPort returned false
|
||||
h = gethostbyname( buf );
|
||||
if( h == NULL )
|
||||
{
|
||||
// try to remove the port first, otherwise the DNS gets confused into multiple timeouts
|
||||
// failed or not failed, buf is expected to contain the appropriate host to resolve
|
||||
if( Net_ExtractPort( s, buf, sizeof( buf ), &port ) )
|
||||
{
|
||||
sadr->sin_port = htons( port );
|
||||
}
|
||||
h = gethostbyname( buf );
|
||||
if( h == 0 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*( int* )&sadr->sin_addr = *( int* )h->h_addr_list[0];
|
||||
return false;
|
||||
}
|
||||
sadr->sin_addr.s_addr = *( in_addr_t* ) h->h_addr_list[0];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -331,19 +390,16 @@ static bool Net_StringToSockaddr( const char* s, sockaddr_in* sadr, bool doDNSRe
|
|||
NET_IPSocket
|
||||
========================
|
||||
*/
|
||||
int NET_IPSocket( const char* net_interface, int port, netadr_t* bound_to )
|
||||
int NET_IPSocket( const char* bind_ip, int port, netadr_t* bound_to )
|
||||
{
|
||||
SOCKET newsocket;
|
||||
sockaddr_in address;
|
||||
unsigned long _true = 1;
|
||||
int i = 1;
|
||||
int err;
|
||||
|
||||
if( port != PORT_ANY )
|
||||
{
|
||||
if( net_interface )
|
||||
if( bind_ip )
|
||||
{
|
||||
idLib::Printf( "Opening IP socket: %s:%i\n", net_interface, port );
|
||||
idLib::Printf( "Opening IP socket: %s:%i\n", bind_ip, port );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -353,23 +409,38 @@ int NET_IPSocket( const char* net_interface, int port, netadr_t* bound_to )
|
|||
|
||||
if( ( newsocket = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP ) ) == INVALID_SOCKET )
|
||||
{
|
||||
err = WSAGetLastError();
|
||||
if( err != WSAEAFNOSUPPORT )
|
||||
{
|
||||
idLib::Printf( "WARNING: UDP_OpenSocket: socket: %s\n", NET_ErrorString() );
|
||||
}
|
||||
idLib::Printf( "WARNING: UDP_OpenSocket: socket: %s\n", NET_ErrorString() );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// make it non-blocking
|
||||
#ifdef _WIN32 // which has no fcntl()
|
||||
unsigned long _true = 1;
|
||||
if( ioctlsocket( newsocket, FIONBIO, &_true ) == SOCKET_ERROR )
|
||||
{
|
||||
idLib::Printf( "WARNING: UDP_OpenSocket: ioctl FIONBIO: %s\n", NET_ErrorString() );
|
||||
closesocket( newsocket );
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
int flags = fcntl( newsocket, F_GETFL, 0 );
|
||||
if( flags < 0 )
|
||||
{
|
||||
idLib::Printf( "WARNING: UDP_OpenSocket: fcntl F_GETFL: %s\n", NET_ErrorString() );
|
||||
closesocket( newsocket );
|
||||
return 0;
|
||||
}
|
||||
flags |= O_NONBLOCK;
|
||||
if( fcntl( newsocket, F_SETFL, flags ) < 0 )
|
||||
{
|
||||
idLib::Printf( "WARNING: UDP_OpenSocket: fcntl F_SETFL with O_NONBLOCK: %s\n", NET_ErrorString() );
|
||||
closesocket( newsocket );
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
// make it broadcast capable
|
||||
int i = 1;
|
||||
if( setsockopt( newsocket, SOL_SOCKET, SO_BROADCAST, ( char* )&i, sizeof( i ) ) == SOCKET_ERROR )
|
||||
{
|
||||
idLib::Printf( "WARNING: UDP_OpenSocket: setsockopt SO_BROADCAST: %s\n", NET_ErrorString() );
|
||||
|
@ -377,13 +448,13 @@ int NET_IPSocket( const char* net_interface, int port, netadr_t* bound_to )
|
|||
return 0;
|
||||
}
|
||||
|
||||
if( !net_interface || !net_interface[0] || !idStr::Icmp( net_interface, "localhost" ) )
|
||||
if( !bind_ip || !bind_ip[0] || !idStr::Icmp( bind_ip, "localhost" ) )
|
||||
{
|
||||
address.sin_addr.s_addr = INADDR_ANY;
|
||||
}
|
||||
else
|
||||
{
|
||||
Net_StringToSockaddr( net_interface, &address, true );
|
||||
Net_StringToSockaddr( bind_ip, &address, true );
|
||||
}
|
||||
|
||||
if( port == PORT_ANY )
|
||||
|
@ -408,8 +479,13 @@ int NET_IPSocket( const char* net_interface, int port, netadr_t* bound_to )
|
|||
// ( this used to be in idUDP::InitForPort )
|
||||
if( bound_to )
|
||||
{
|
||||
int len = sizeof( address );
|
||||
getsockname( newsocket, ( sockaddr* )&address, &len );
|
||||
socklen_t len = sizeof( address );
|
||||
if( getsockname( newsocket, ( struct sockaddr* )&address, &len ) == SOCKET_ERROR )
|
||||
{
|
||||
common->Printf( "ERROR: IPSocket: getsockname: %s\n", NET_ErrorString() );
|
||||
closesocket( newsocket );
|
||||
return 0;
|
||||
}
|
||||
Net_SockadrToNetadr( &address, bound_to );
|
||||
}
|
||||
|
||||
|
@ -451,7 +527,7 @@ void NET_OpenSocks( int port )
|
|||
return;
|
||||
}
|
||||
address.sin_family = AF_INET;
|
||||
address.sin_addr.s_addr = *( int* )h->h_addr_list[0];
|
||||
address.sin_addr.s_addr = *( in_addr_t* )h->h_addr_list[0];
|
||||
address.sin_port = htons( ( short )net_socksPort.GetInteger() );
|
||||
|
||||
if( connect( socks_socket, ( sockaddr* )&address, sizeof( address ) ) == SOCKET_ERROR )
|
||||
|
@ -630,16 +706,16 @@ bool Net_WaitForData( int netSocket, int timeout )
|
|||
}
|
||||
|
||||
FD_ZERO( &set );
|
||||
FD_SET( static_cast<unsigned int>( netSocket ), &set );
|
||||
FD_SET( netSocket, &set ); // TODO: winsocks may want an unsigned int for netSocket?
|
||||
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = timeout * 1000;
|
||||
tv.tv_sec = timeout / 1000;
|
||||
tv.tv_usec = ( timeout % 1000 ) * 1000;
|
||||
|
||||
ret = select( netSocket + 1, &set, NULL, NULL, &tv );
|
||||
|
||||
if( ret == -1 )
|
||||
{
|
||||
idLib::Printf( "Net_WaitForData select(): %s\n", strerror( errno ) );
|
||||
idLib::Printf( "Net_WaitForData select(): %s\n", NET_ErrorString() );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -661,7 +737,7 @@ bool Net_GetUDPPacket( int netSocket, netadr_t& net_from, char* data, int& size,
|
|||
{
|
||||
int ret;
|
||||
sockaddr_in from;
|
||||
int fromlen;
|
||||
socklen_t fromlen;
|
||||
int err;
|
||||
|
||||
if( !netSocket )
|
||||
|
@ -673,18 +749,20 @@ bool Net_GetUDPPacket( int netSocket, netadr_t& net_from, char* data, int& size,
|
|||
ret = recvfrom( netSocket, data, maxSize, 0, ( sockaddr* )&from, &fromlen );
|
||||
if( ret == SOCKET_ERROR )
|
||||
{
|
||||
err = WSAGetLastError();
|
||||
err = Net_GetLastError();
|
||||
|
||||
if( err == WSAEWOULDBLOCK || err == WSAECONNRESET )
|
||||
if( err == D3_NET_EWOULDBLOCK || err == D3_NET_ECONNRESET )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
char buf[1024];
|
||||
sprintf( buf, "Net_GetUDPPacket: %s\n", NET_ErrorString() );
|
||||
idLib::Printf( buf );
|
||||
|
||||
idLib::Printf( "Net_GetUDPPacket: %s\n", NET_ErrorString() );
|
||||
return false;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// TODO: WTF was this about?
|
||||
// DG: ip_socket is never initialized, so this is dead code
|
||||
// - and if netSocket is 0 (so this would be true) recvfrom above will already fail
|
||||
if( static_cast<unsigned int>( netSocket ) == ip_socket )
|
||||
{
|
||||
memset( from.sin_zero, 0, sizeof( from.sin_zero ) );
|
||||
|
@ -706,14 +784,16 @@ bool Net_GetUDPPacket( int netSocket, netadr_t& net_from, char* data, int& size,
|
|||
}
|
||||
else
|
||||
{
|
||||
#endif // 0
|
||||
|
||||
Net_SockadrToNetadr( &from, &net_from );
|
||||
#if 0 // this is ugly, but else astyle is confused
|
||||
}
|
||||
#endif
|
||||
|
||||
if( ret > maxSize )
|
||||
{
|
||||
char buf[1024];
|
||||
sprintf( buf, "Net_GetUDPPacket: oversize packet from %s\n", Sys_NetAdrToString( net_from ) );
|
||||
idLib::Printf( buf );
|
||||
idLib::Printf( "Net_GetUDPPacket: oversize packet from %s\n", Sys_NetAdrToString( net_from ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -756,20 +836,25 @@ void Net_SendUDPPacket( int netSocket, int length, const void* data, const netad
|
|||
}
|
||||
if( ret == SOCKET_ERROR )
|
||||
{
|
||||
int err = WSAGetLastError();
|
||||
|
||||
int err = Net_GetLastError();
|
||||
// some PPP links do not allow broadcasts and return an error
|
||||
if( ( err == WSAEADDRNOTAVAIL ) && ( to.type == NA_BROADCAST ) )
|
||||
if( ( err == D3_NET_EADDRNOTAVAIL ) && ( to.type == NA_BROADCAST ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// NOTE: WSAEWOULDBLOCK used to be silently ignored,
|
||||
// NOTE: EWOULDBLOCK used to be silently ignored,
|
||||
// but that means the packet will be dropped so I don't feel it's a good thing to ignore
|
||||
idLib::Printf( "UDP sendto error - packet dropped: %s\n", NET_ErrorString() );
|
||||
}
|
||||
}
|
||||
|
||||
static void ip_to_addr( const char ip[4], char* addr )
|
||||
{
|
||||
idStr::snPrintf( addr, 16, "%d.%d.%d.%d", ( unsigned char )ip[0], ( unsigned char )ip[1],
|
||||
( unsigned char )ip[2], ( unsigned char )ip[3] );
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
Sys_InitNetworking
|
||||
|
@ -777,13 +862,15 @@ Sys_InitNetworking
|
|||
*/
|
||||
void Sys_InitNetworking()
|
||||
{
|
||||
int r;
|
||||
|
||||
bool foundloopback = false;
|
||||
|
||||
#if defined(_WIN32) // DG: add win32 stuff here for socket networking code unification..
|
||||
if( winsockInitialized )
|
||||
{
|
||||
return;
|
||||
}
|
||||
r = WSAStartup( MAKEWORD( 1, 1 ), &winsockdata );
|
||||
int r = WSAStartup( MAKEWORD( 1, 1 ), &winsockdata );
|
||||
if( r )
|
||||
{
|
||||
idLib::Printf( "WARNING: Winsock initialization failed, returned %d\n", r );
|
||||
|
@ -798,7 +885,6 @@ void Sys_InitNetworking()
|
|||
DWORD dwRetVal = 0;
|
||||
PIP_ADDR_STRING pIPAddrString;
|
||||
ULONG ulOutBufLen;
|
||||
bool foundloopback;
|
||||
|
||||
num_interfaces = 0;
|
||||
foundloopback = false;
|
||||
|
@ -866,7 +952,153 @@ void Sys_InitNetworking()
|
|||
pAdapter = pAdapter->Next;
|
||||
}
|
||||
}
|
||||
free( pAdapterInfo );
|
||||
|
||||
#elif defined(MACOS_X) || defined(__FreeBSD__)
|
||||
// haven't been able to clearly pinpoint which standards or RFCs define SIOCGIFCONF, SIOCGIFADDR, SIOCGIFNETMASK ioctls
|
||||
// it seems fairly widespread, in Linux kernel ioctl, and in BSD .. so let's assume it's always available on our targets
|
||||
|
||||
unsigned int ip, mask;
|
||||
struct ifaddrs* ifap, *ifp;
|
||||
|
||||
num_interfaces = 0;
|
||||
|
||||
if( getifaddrs( &ifap ) < 0 )
|
||||
{
|
||||
common->FatalError( "InitNetworking: SIOCGIFCONF error - %s\n", strerror( errno ) );
|
||||
return;
|
||||
}
|
||||
|
||||
for( ifp = ifap; ifp; ifp = ifp->ifa_next )
|
||||
{
|
||||
if( ifp->ifa_addr->sa_family != AF_INET )
|
||||
continue;
|
||||
|
||||
if( !( ifp->ifa_flags & IFF_UP ) )
|
||||
continue;
|
||||
|
||||
if( !ifp->ifa_addr )
|
||||
continue;
|
||||
|
||||
if( !ifp->ifa_netmask )
|
||||
continue;
|
||||
|
||||
// RB: 64 bit fixes, changed long to int
|
||||
ip = ntohl( *( unsigned int* )&ifp->ifa_addr->sa_data[2] );
|
||||
mask = ntohl( *( unsigned int* )&ifp->ifa_netmask->sa_data[2] );
|
||||
// RB end
|
||||
|
||||
if( ip == INADDR_LOOPBACK )
|
||||
{
|
||||
foundloopback = true;
|
||||
common->Printf( "loopback\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
common->Printf( "%d.%d.%d.%d",
|
||||
( unsigned char )ifp->ifa_addr->sa_data[2],
|
||||
( unsigned char )ifp->ifa_addr->sa_data[3],
|
||||
( unsigned char )ifp->ifa_addr->sa_data[4],
|
||||
( unsigned char )ifp->ifa_addr->sa_data[5] );
|
||||
common->Printf( "/%d.%d.%d.%d\n",
|
||||
( unsigned char )ifp->ifa_netmask->sa_data[2],
|
||||
( unsigned char )ifp->ifa_netmask->sa_data[3],
|
||||
( unsigned char )ifp->ifa_netmask->sa_data[4],
|
||||
( unsigned char )ifp->ifa_netmask->sa_data[5] );
|
||||
}
|
||||
netint[ num_interfaces ].ip = ip;
|
||||
netint[ num_interfaces ].mask = mask;
|
||||
// DG: set netint addr
|
||||
ip_to_addr( &ifp->ifa_addr->sa_data[2], netint[ num_interfaces ].addr );
|
||||
// DG end
|
||||
num_interfaces++;
|
||||
}
|
||||
#else // not _WIN32, OSX or FreeBSD
|
||||
int s;
|
||||
char buf[ MAX_INTERFACES * sizeof( ifreq ) ];
|
||||
ifconf ifc;
|
||||
ifreq* ifr;
|
||||
int ifindex;
|
||||
unsigned int ip, mask;
|
||||
|
||||
num_interfaces = 0;
|
||||
|
||||
s = socket( AF_INET, SOCK_DGRAM, 0 );
|
||||
ifc.ifc_len = MAX_INTERFACES * sizeof( ifreq );
|
||||
ifc.ifc_buf = buf;
|
||||
if( ioctl( s, SIOCGIFCONF, &ifc ) < 0 )
|
||||
{
|
||||
common->FatalError( "InitNetworking: SIOCGIFCONF error - %s\n", strerror( errno ) );
|
||||
return;
|
||||
}
|
||||
ifindex = 0;
|
||||
while( ifindex < ifc.ifc_len )
|
||||
{
|
||||
common->Printf( "found interface %s - ", ifc.ifc_buf + ifindex );
|
||||
// find the type - ignore interfaces for which we can find we can't get IP and mask ( not configured )
|
||||
ifr = ( ifreq* )( ifc.ifc_buf + ifindex );
|
||||
if( ioctl( s, SIOCGIFADDR, ifr ) < 0 )
|
||||
{
|
||||
common->Printf( "SIOCGIFADDR failed: %s\n", strerror( errno ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ifr->ifr_addr.sa_family != AF_INET )
|
||||
{
|
||||
common->Printf( "not AF_INET\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
// RB: 64 bit fixes, changed long to int
|
||||
ip = ntohl( *( unsigned int* )&ifr->ifr_addr.sa_data[2] );
|
||||
// RB end
|
||||
if( ip == INADDR_LOOPBACK )
|
||||
{
|
||||
foundloopback = true;
|
||||
common->Printf( "loopback\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
common->Printf( "%d.%d.%d.%d",
|
||||
( unsigned char )ifr->ifr_addr.sa_data[2],
|
||||
( unsigned char )ifr->ifr_addr.sa_data[3],
|
||||
( unsigned char )ifr->ifr_addr.sa_data[4],
|
||||
( unsigned char )ifr->ifr_addr.sa_data[5] );
|
||||
}
|
||||
|
||||
// DG: set netint address before getting the mask
|
||||
ip_to_addr( &ifr->ifr_addr.sa_data[2], netint[ num_interfaces ].addr );
|
||||
// DG end
|
||||
|
||||
if( ioctl( s, SIOCGIFNETMASK, ifr ) < 0 )
|
||||
{
|
||||
common->Printf( " SIOCGIFNETMASK failed: %s\n", strerror( errno ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// RB: 64 bit fixes, changed long to int
|
||||
mask = ntohl( *( unsigned int* )&ifr->ifr_addr.sa_data[2] );
|
||||
// RB end
|
||||
if( ip != INADDR_LOOPBACK )
|
||||
{
|
||||
common->Printf( "/%d.%d.%d.%d\n",
|
||||
( unsigned char )ifr->ifr_addr.sa_data[2],
|
||||
( unsigned char )ifr->ifr_addr.sa_data[3],
|
||||
( unsigned char )ifr->ifr_addr.sa_data[4],
|
||||
( unsigned char )ifr->ifr_addr.sa_data[5] );
|
||||
}
|
||||
netint[ num_interfaces ].ip = ip;
|
||||
netint[ num_interfaces ].mask = mask;
|
||||
num_interfaces++;
|
||||
}
|
||||
}
|
||||
}
|
||||
ifindex += sizeof( ifreq );
|
||||
}
|
||||
#endif // all those operating systems..
|
||||
|
||||
// for some retarded reason, win32 doesn't count loopback as an adapter...
|
||||
// and because I'm extra-cautious I add this check on real operating systems as well :)
|
||||
if( !foundloopback && num_interfaces < MAX_INTERFACES )
|
||||
{
|
||||
idLib::Printf( "Sys_InitNetworking: adding loopback interface\n" );
|
||||
|
@ -874,7 +1106,6 @@ void Sys_InitNetworking()
|
|||
netint[num_interfaces].mask = ntohl( inet_addr( "255.0.0.0" ) );
|
||||
num_interfaces++;
|
||||
}
|
||||
free( pAdapterInfo );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -884,12 +1115,16 @@ Sys_ShutdownNetworking
|
|||
*/
|
||||
void Sys_ShutdownNetworking()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if( !winsockInitialized )
|
||||
{
|
||||
return;
|
||||
}
|
||||
WSACleanup();
|
||||
winsockInitialized = false;
|
||||
#endif
|
||||
if( usingSocks )
|
||||
closesocket( socks_socket );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -917,27 +1152,24 @@ Sys_NetAdrToString
|
|||
*/
|
||||
const char* Sys_NetAdrToString( const netadr_t a )
|
||||
{
|
||||
// DG: FIXME: those static buffers look fishy - I would feel better if they were
|
||||
// at least thread-local - so /maybe/ use ID_TLS here?
|
||||
// or maybe return an idStr and change calling code accordingly
|
||||
static int index = 0;
|
||||
static char buf[ 4 ][ 64 ]; // flip/flop
|
||||
char* s;
|
||||
|
||||
s = buf[index];
|
||||
index = ( index + 1 ) & 3;
|
||||
|
||||
if( a.type == NA_LOOPBACK )
|
||||
{
|
||||
if( a.port )
|
||||
{
|
||||
idStr::snPrintf( s, 64, "localhost:%i", a.port );
|
||||
}
|
||||
else
|
||||
{
|
||||
idStr::snPrintf( s, 64, "localhost" );
|
||||
}
|
||||
}
|
||||
else if( a.type == NA_IP )
|
||||
{
|
||||
if( a.type == NA_IP || a.type == NA_LOOPBACK )
|
||||
idStr::snPrintf( s, 64, "%i.%i.%i.%i:%i", a.ip[0], a.ip[1], a.ip[2], a.ip[3], a.port );
|
||||
else if( a.type == NA_BROADCAST )
|
||||
idStr::snPrintf( s, 64, "BROADCAST" );
|
||||
else if( a.type == NA_BAD )
|
||||
idStr::snPrintf( s, 64, "BAD_IP" );
|
||||
else
|
||||
{
|
||||
idStr::snPrintf( s, 64, "WTF_UNKNOWN_IP_TYPE_%i", a.type );
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
@ -959,12 +1191,19 @@ bool Sys_IsLANAddress( const netadr_t adr )
|
|||
return false;
|
||||
}
|
||||
|
||||
// NOTE: this function won't work reliably for addresses on the local net
|
||||
// that are connected through a router (i.e. no IP from that net is on any interface)
|
||||
// However, I don't expect most people to have such setups at home and the code
|
||||
// would get a lot more complex and less portable.
|
||||
// Furthermore, this function isn't even used currently
|
||||
if( num_interfaces )
|
||||
{
|
||||
int i;
|
||||
unsigned long* p_ip;
|
||||
unsigned long ip;
|
||||
p_ip = ( unsigned long* )&adr.ip[0];
|
||||
// DG: for 64bit compatibility, make these longs ints.
|
||||
unsigned int* p_ip;
|
||||
unsigned int ip;
|
||||
p_ip = ( unsigned int* )&adr.ip[0];
|
||||
// DG end
|
||||
ip = ntohl( *p_ip );
|
||||
|
||||
for( i = 0; i < num_interfaces; i++ )
|
||||
|
@ -994,6 +1233,7 @@ bool Sys_CompareNetAdrBase( const netadr_t a, const netadr_t b )
|
|||
|
||||
if( a.type == NA_LOOPBACK )
|
||||
{
|
||||
// DG: wtf is this comparison about, the comment above says "without the port"
|
||||
if( a.port == b.port )
|
||||
{
|
||||
return true;
|
||||
|
@ -1080,7 +1320,10 @@ idUDP::InitForPort
|
|||
*/
|
||||
bool idUDP::InitForPort( int portNumber )
|
||||
{
|
||||
netSocket = NET_IPSocket( net_ip.GetString(), portNumber, &bound_to );
|
||||
// DG: don't specify an IP to bind for (and certainly not net_ip)
|
||||
// => it'll listen on all addresses (0.0.0.0 / INADDR_ANY)
|
||||
netSocket = NET_IPSocket( NULL, portNumber, &bound_to );
|
||||
// DG end
|
||||
if( netSocket <= 0 )
|
||||
{
|
||||
netSocket = 0;
|
||||
|
@ -1113,24 +1356,17 @@ idUDP::GetPacket
|
|||
*/
|
||||
bool idUDP::GetPacket( netadr_t& from, void* data, int& size, int maxSize )
|
||||
{
|
||||
bool ret;
|
||||
|
||||
while( 1 )
|
||||
// DG: this fake while(1) loop pissed me off so I replaced it.. no functional change.
|
||||
if( ! Net_GetUDPPacket( netSocket, from, ( char* )data, size, maxSize ) )
|
||||
{
|
||||
|
||||
ret = Net_GetUDPPacket( netSocket, from, ( char* )data, size, maxSize );
|
||||
if( !ret )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
packetsRead++;
|
||||
bytesRead += size;
|
||||
|
||||
break;
|
||||
return false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
packetsRead++;
|
||||
bytesRead += size;
|
||||
|
||||
return true;
|
||||
// DG end
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1177,3 +1413,4 @@ void idUDP::SendPacket( const netadr_t to, const void* data, int size )
|
|||
|
||||
Net_SendUDPPacket( netSocket, size, data, to );
|
||||
}
|
||||
|
|
@ -38,6 +38,13 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
// DG: needed for Sys_ReLaunch()
|
||||
#include <dirent.h>
|
||||
|
||||
static const char** cmdargv = NULL;
|
||||
static int cmdargc = 0;
|
||||
// DG end
|
||||
|
||||
#ifdef ID_MCHECK
|
||||
#include <mcheck.h>
|
||||
#endif
|
||||
|
@ -46,7 +53,6 @@ static idStr basepath;
|
|||
static idStr savepath;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
Sys_DefaultSavePath
|
||||
|
@ -645,6 +651,7 @@ Sys_GetCmdLine
|
|||
*/
|
||||
const char* Sys_GetCmdLine()
|
||||
{
|
||||
// DG: don't use this, use cmdargv and cmdargc instead!
|
||||
return "TODO Sys_GetCmdLine";
|
||||
}
|
||||
|
||||
|
@ -653,9 +660,80 @@ const char* Sys_GetCmdLine()
|
|||
Sys_ReLaunch
|
||||
========================
|
||||
*/
|
||||
void Sys_ReLaunch( void* data, const unsigned int dataSize )
|
||||
void Sys_ReLaunch()
|
||||
{
|
||||
idLib::Error( "Could not start process: TODO Sys_ReLaunch() " );
|
||||
// DG: implementing this... basic old fork() exec() (+ setsid()) routine..
|
||||
// NOTE: this function used to have parameters: the commandline arguments, but as one string..
|
||||
// for Linux/Unix we want one char* per argument so we'll just add the friggin'
|
||||
// " +set com_skipIntroVideos 1" to the other commandline arguments in this function.
|
||||
|
||||
int ret = fork();
|
||||
if( ret < 0 )
|
||||
idLib::Error( "Sys_ReLaunch(): Couldn't fork(), reason: %s ", strerror( errno ) );
|
||||
|
||||
if( ret == 0 )
|
||||
{
|
||||
// child process
|
||||
|
||||
// get our own session so we don't depend on the (soon to be killed)
|
||||
// parent process anymore - else we'll freeze
|
||||
pid_t sId = setsid();
|
||||
if( sId == ( pid_t ) - 1 )
|
||||
{
|
||||
idLib::Error( "Sys_ReLaunch(): setsid() failed! Reason: %s ", strerror( errno ) );
|
||||
}
|
||||
|
||||
// close all FDs (except for stdin/out/err) so we don't leak FDs
|
||||
DIR* devfd = opendir( "/dev/fd" );
|
||||
if( devfd != NULL )
|
||||
{
|
||||
struct dirent entry;
|
||||
struct dirent* result;
|
||||
while( readdir_r( devfd, &entry, &result ) == 0 )
|
||||
{
|
||||
const char* filename = result->d_name;
|
||||
char* endptr = NULL;
|
||||
long int fd = strtol( filename, &endptr, 0 );
|
||||
if( endptr != filename && fd > STDERR_FILENO )
|
||||
close( fd );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
idLib::Warning( "Sys_ReLaunch(): Couldn't open /dev/fd/ - will leak file descriptors. Reason: %s", strerror( errno ) );
|
||||
}
|
||||
|
||||
// + 3 because "+set" "com_skipIntroVideos" "1" - and note that while we'll skip
|
||||
// one (the first) cmdargv argument, we need one more pointer for NULL at the end.
|
||||
int argc = cmdargc + 3;
|
||||
const char** argv = ( const char** )calloc( argc, sizeof( char* ) );
|
||||
|
||||
int i;
|
||||
for( i = 0; i < cmdargc - 1; ++i )
|
||||
argv[i] = cmdargv[i + 1]; // ignore cmdargv[0] == executable name
|
||||
|
||||
// add +set com_skipIntroVideos 1
|
||||
argv[i++] = "+set";
|
||||
argv[i++] = "com_skipIntroVideos";
|
||||
argv[i++] = "1";
|
||||
// execv expects NULL terminated array
|
||||
argv[i] = NULL;
|
||||
|
||||
const char* exepath = Sys_EXEPath();
|
||||
|
||||
errno = 0;
|
||||
execv( exepath, ( char** )argv );
|
||||
// we only get here if execv() fails, else the executable is restarted
|
||||
idLib::Error( "Sys_ReLaunch(): WTF exec() failed! Reason: %s ", strerror( errno ) );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// original process
|
||||
// just do a clean shutdown
|
||||
cmdSystem->AppendCommandText( "quit\n" );
|
||||
}
|
||||
// DG end
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -665,6 +743,10 @@ main
|
|||
*/
|
||||
int main( int argc, const char** argv )
|
||||
{
|
||||
// DG: needed for Sys_ReLaunch()
|
||||
cmdargc = argc;
|
||||
cmdargv = argv;
|
||||
// DG end
|
||||
#ifdef ID_MCHECK
|
||||
// must have -lmcheck linkage
|
||||
mcheck( abrt_func );
|
||||
|
|
|
@ -1,111 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
#pragma hdrstop
|
||||
#include "../../idlib/precompiled.h"
|
||||
|
||||
#include "posix_achievements.h"
|
||||
#include "../sys_session_local.h"
|
||||
|
||||
extern idCVar achievements_Verbose;
|
||||
|
||||
#define STEAM_ACHIEVEMENT_PREFIX "ach_"
|
||||
|
||||
/*
|
||||
========================
|
||||
idAchievementSystemWin::idAchievementSystemWin
|
||||
========================
|
||||
*/
|
||||
idAchievementSystemWin::idAchievementSystemWin()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idAchievementSystemWin::IsInitialized
|
||||
========================
|
||||
*/
|
||||
bool idAchievementSystemWin::IsInitialized()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
================================
|
||||
idAchievementSystemWin::AchievementUnlock
|
||||
================================
|
||||
*/
|
||||
void idAchievementSystemWin::AchievementUnlock( idLocalUser* user, int achievementID )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idAchievementSystemWin::AchievementLock
|
||||
========================
|
||||
*/
|
||||
void idAchievementSystemWin::AchievementLock( idLocalUser* user, const int achievementID )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idAchievementSystemWin::AchievementLockAll
|
||||
========================
|
||||
*/
|
||||
void idAchievementSystemWin::AchievementLockAll( idLocalUser* user, const int maxId )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idAchievementSystemWin::GetAchievementDescription
|
||||
========================
|
||||
*/
|
||||
bool idAchievementSystemWin::GetAchievementDescription( idLocalUser* user, const int achievementID, achievementDescription_t& data ) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idAchievementSystemWin::GetAchievementState
|
||||
========================
|
||||
*/
|
||||
bool idAchievementSystemWin::GetAchievementState( idLocalUser* user, idArray< bool, idAchievementSystem::MAX_ACHIEVEMENTS >& achievements ) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
================================
|
||||
idAchievementSystemWin::Pump
|
||||
================================
|
||||
*/
|
||||
void idAchievementSystemWin::Pump()
|
||||
{
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
#ifndef __POSIX_ACHIEVEMENTS_H__
|
||||
#define __POSIX_ACHIEVEMENTS_H__
|
||||
|
||||
/*
|
||||
================================================
|
||||
idAchievementSystemWin
|
||||
================================================
|
||||
*/
|
||||
class idAchievementSystemWin : public idAchievementSystem
|
||||
{
|
||||
public:
|
||||
idAchievementSystemWin();
|
||||
|
||||
bool IsInitialized();
|
||||
void AchievementUnlock( idLocalUser* user, const int achievementID );
|
||||
void AchievementLock( idLocalUser* user, const int achievementID );
|
||||
void AchievementLockAll( idLocalUser* user, const int maxId );
|
||||
void Pump();
|
||||
bool GetAchievementDescription( idLocalUser* user, const int id, achievementDescription_t& data ) const;
|
||||
bool GetAchievementState( idLocalUser* user, idArray< bool, idAchievementSystem::MAX_ACHIEVEMENTS >& achievements ) const;
|
||||
};
|
||||
|
||||
#endif // __POSIX_ACHIEVEMENTS_H__
|
|
@ -1,131 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#pragma hdrstop
|
||||
#include "../../idlib/precompiled.h"
|
||||
#include "posix_localuser.h"
|
||||
|
||||
extern idCVar win_userPersistent;
|
||||
extern idCVar win_userOnline;
|
||||
extern idCVar win_isInParty;
|
||||
extern idCVar win_partyCount;
|
||||
|
||||
/*
|
||||
========================
|
||||
idLocalUserWin::Init
|
||||
========================
|
||||
*/
|
||||
void idLocalUserWin::Init( int inputDevice_, const char* gamertag_, int numLocalUsers )
|
||||
{
|
||||
if( numLocalUsers == 1 ) // Check for 1, since this is now incremented before we get in here
|
||||
{
|
||||
// This is the master user
|
||||
gamertag = gamertag_;
|
||||
}
|
||||
else
|
||||
{
|
||||
// On steam, we need to generate a name based off the master user for split-screen users.
|
||||
// We use the number of users on the system to generate the name rather than the device
|
||||
// number so that it is always consistently "username (2)" for the second player.
|
||||
gamertag.Format( "%s (%i)", gamertag_, numLocalUsers );
|
||||
}
|
||||
|
||||
inputDevice = inputDevice_;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idLocalUserWin::IsProfileReady
|
||||
========================
|
||||
*/
|
||||
bool idLocalUserWin::IsProfileReady() const
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
return win_userPersistent.GetBool();
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idLocalUserWin::IsOnline
|
||||
========================
|
||||
*/
|
||||
bool idLocalUserWin::IsOnline() const
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
return win_userOnline.GetBool();
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idLocalUserWin::IsInParty
|
||||
========================
|
||||
*/
|
||||
bool idLocalUserWin::IsInParty() const
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
return win_isInParty.GetBool();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idLocalUserWin::GetPartyCount
|
||||
========================
|
||||
*/
|
||||
int idLocalUserWin::GetPartyCount() const
|
||||
{
|
||||
// TODO: Implement
|
||||
#ifdef _DEBUG
|
||||
return win_partyCount.GetInteger();
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idLocalUserWin::VerifyUserState
|
||||
========================
|
||||
*/
|
||||
bool idLocalUserWin::VerifyUserState( winUserState_t& state )
|
||||
{
|
||||
|
||||
if( state.inputDevice != inputDevice )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
#ifndef __POSIX_LOCALUSER_H__
|
||||
#define __POSIX_LOCALUSER_H__
|
||||
|
||||
// This is to quickly get/set the data needed for disc-swapping
|
||||
typedef struct
|
||||
{
|
||||
int inputDevice;
|
||||
} winUserState_t;
|
||||
|
||||
/*
|
||||
================================================
|
||||
idLocalUserWin
|
||||
================================================
|
||||
*/
|
||||
class idLocalUserWin : public idLocalUser
|
||||
{
|
||||
public:
|
||||
static const int MAX_GAMERTAG = 64; // max number of bytes for a gamertag
|
||||
static const int MAX_GAMERTAG_CHARS = 16; // max number of UTF-8 characters to show
|
||||
|
||||
idLocalUserWin() : inputDevice( 0 ) {}
|
||||
|
||||
//==========================================================================================
|
||||
// idLocalUser interface
|
||||
//==========================================================================================
|
||||
virtual bool IsProfileReady() const;
|
||||
virtual bool IsOnline() const;
|
||||
virtual bool IsInParty() const;
|
||||
virtual int GetPartyCount() const;
|
||||
virtual uint32 GetOnlineCaps() const
|
||||
{
|
||||
return ( IsPersistent() && IsOnline() ) ? ( CAP_IS_ONLINE | CAP_CAN_PLAY_ONLINE ) : 0;
|
||||
}
|
||||
virtual int GetInputDevice() const
|
||||
{
|
||||
return inputDevice;
|
||||
}
|
||||
virtual const char* GetGamerTag() const
|
||||
{
|
||||
return gamertag.c_str();
|
||||
}
|
||||
virtual void PumpPlatform() {}
|
||||
|
||||
//==========================================================================================
|
||||
// idLocalUserWin interface
|
||||
//==========================================================================================
|
||||
void SetInputDevice( int inputDevice_ )
|
||||
{
|
||||
inputDevice = inputDevice_;
|
||||
}
|
||||
void SetGamerTag( const char* gamerTag_ )
|
||||
{
|
||||
gamertag = gamerTag_;
|
||||
}
|
||||
winUserState_t GetUserState()
|
||||
{
|
||||
winUserState_t a = { inputDevice };
|
||||
return a;
|
||||
}
|
||||
bool VerifyUserState( winUserState_t& state );
|
||||
|
||||
void Init( int inputDevice_, const char* gamertag_, int numLocalUsers );
|
||||
|
||||
private:
|
||||
idStrStatic< MAX_GAMERTAG > gamertag;
|
||||
int inputDevice;
|
||||
};
|
||||
|
||||
#endif // __POSIX_LOCALUSER_H__
|
|
@ -182,6 +182,14 @@ Sys_Milliseconds
|
|||
timeval:tv_sec is an int:
|
||||
assuming this wraps every 0x7fffffff - ~68 years since the Epoch (1970) - we're safe till 2038
|
||||
using unsigned long data type to work right with Sys_XTimeToSysTime */
|
||||
|
||||
#ifdef CLOCK_MONOTONIC_RAW
|
||||
// use RAW monotonic clock if available (=> not subject to NTP etc)
|
||||
#define D3_CLOCK_TO_USE CLOCK_MONOTONIC_RAW
|
||||
#else
|
||||
#define D3_CLOCK_TO_USE CLOCK_MONOTONIC
|
||||
#endif
|
||||
|
||||
// RB: changed long to int
|
||||
unsigned int sys_timeBase = 0;
|
||||
// RB end
|
||||
|
@ -192,23 +200,12 @@ unsigned int sys_timeBase = 0;
|
|||
*/
|
||||
int Sys_Milliseconds()
|
||||
{
|
||||
// RB: clock_gettime should be a good replacement on Android
|
||||
// because gettimeofday() seemed to cause a 64 bit emulation and performance penalty
|
||||
#if defined(__ANDROID__)
|
||||
#if 0
|
||||
// DG: use clock_gettime on all platforms
|
||||
#if 1
|
||||
int curtime;
|
||||
struct timespec ts;
|
||||
|
||||
clock_gettime( CLOCK_MONOTONIC, &ts );
|
||||
|
||||
curtime = ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
|
||||
|
||||
return curtime;
|
||||
#else
|
||||
int curtime;
|
||||
struct timespec ts;
|
||||
|
||||
clock_gettime( CLOCK_MONOTONIC, &ts );
|
||||
clock_gettime( D3_CLOCK_TO_USE, &ts );
|
||||
|
||||
if( !sys_timeBase )
|
||||
{
|
||||
|
@ -219,24 +216,25 @@ int Sys_Milliseconds()
|
|||
curtime = ( ts.tv_sec - sys_timeBase ) * 1000 + ts.tv_nsec / 1000000;
|
||||
|
||||
return curtime;
|
||||
#endif
|
||||
// RB end
|
||||
#else
|
||||
// gettimeofday() implementation
|
||||
int curtime;
|
||||
struct timeval tp;
|
||||
|
||||
|
||||
gettimeofday( &tp, NULL );
|
||||
|
||||
|
||||
if( !sys_timeBase )
|
||||
{
|
||||
sys_timeBase = tp.tv_sec;
|
||||
return tp.tv_usec / 1000;
|
||||
}
|
||||
|
||||
|
||||
curtime = ( tp.tv_sec - sys_timeBase ) * 1000 + tp.tv_usec / 1000;
|
||||
|
||||
|
||||
return curtime;
|
||||
* /
|
||||
#endif
|
||||
// DG end
|
||||
}
|
||||
|
||||
// RB: added for BFG
|
||||
|
@ -270,15 +268,15 @@ uint64 Sys_Microseconds()
|
|||
|
||||
return curtime;
|
||||
#else
|
||||
int curtime;
|
||||
uint64 curtime;
|
||||
struct timespec ts;
|
||||
|
||||
clock_gettime( CLOCK_MONOTONIC, &ts );
|
||||
clock_gettime( D3_CLOCK_TO_USE, &ts );
|
||||
|
||||
if( !sys_microTimeBase )
|
||||
{
|
||||
sys_microTimeBase = ts.tv_sec;
|
||||
return ts.tv_nsec / 1000000;
|
||||
return ts.tv_nsec / 1000;
|
||||
}
|
||||
|
||||
curtime = ( ts.tv_sec - sys_microTimeBase ) * 1000000 + ts.tv_nsec / 1000;
|
||||
|
|
|
@ -1,758 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
|
||||
|
||||
Doom 3 Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/uio.h>
|
||||
#include <errno.h>
|
||||
#include <sys/select.h>
|
||||
#include <net/if.h>
|
||||
#if MACOS_X
|
||||
#include <ifaddrs.h>
|
||||
#endif
|
||||
|
||||
#include "../../idlib/precompiled.h"
|
||||
|
||||
idUDP clientPort, serverPort;
|
||||
|
||||
idCVar net_ip( "net_ip", "localhost", CVAR_SYSTEM, "local IP address" );
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// RB: 64 bit fixes, changed long to int
|
||||
unsigned int ip;
|
||||
unsigned int mask;
|
||||
// RB end
|
||||
} net_interface;
|
||||
|
||||
#define MAX_INTERFACES 32
|
||||
int num_interfaces = 0;
|
||||
net_interface netint[MAX_INTERFACES];
|
||||
|
||||
/*
|
||||
=============
|
||||
NetadrToSockadr
|
||||
=============
|
||||
*/
|
||||
static void NetadrToSockadr( const netadr_t* a, struct sockaddr_in* s )
|
||||
{
|
||||
memset( s, 0, sizeof( *s ) );
|
||||
|
||||
if( a->type == NA_BROADCAST )
|
||||
{
|
||||
s->sin_family = AF_INET;
|
||||
|
||||
s->sin_port = htons( ( short )a->port );
|
||||
*( int* ) &s->sin_addr = -1;
|
||||
}
|
||||
else if( a->type == NA_IP || a->type == NA_LOOPBACK )
|
||||
{
|
||||
s->sin_family = AF_INET;
|
||||
|
||||
*( int* ) &s->sin_addr = *( int* ) &a->ip;
|
||||
s->sin_port = htons( ( short )a->port );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
SockadrToNetadr
|
||||
=============
|
||||
*/
|
||||
static void SockadrToNetadr( struct sockaddr_in* s, netadr_t* a )
|
||||
{
|
||||
unsigned int ip = *( int* )&s->sin_addr;
|
||||
*( int* )&a->ip = ip;
|
||||
a->port = ntohs( s->sin_port );
|
||||
// we store in network order, that loopback test is host order..
|
||||
ip = ntohl( ip );
|
||||
if( ip == INADDR_LOOPBACK )
|
||||
{
|
||||
a->type = NA_LOOPBACK;
|
||||
}
|
||||
else
|
||||
{
|
||||
a->type = NA_IP;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
ExtractPort
|
||||
=============
|
||||
*/
|
||||
static bool ExtractPort( const char* src, char* buf, int bufsize, int* port )
|
||||
{
|
||||
char* p;
|
||||
strncpy( buf, src, bufsize );
|
||||
p = buf;
|
||||
p += Min( bufsize - 1, ( int )strlen( src ) );
|
||||
*p = '\0';
|
||||
p = strchr( buf, ':' );
|
||||
if( !p )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*p = '\0';
|
||||
*port = strtol( p + 1, NULL, 10 );
|
||||
if( ( *port == 0 && errno == EINVAL ) ||
|
||||
// RB: 64 bit fixes, changed LONG_ to INT_
|
||||
( ( *port == INT_MIN || *port == INT_MAX ) && errno == ERANGE ) )
|
||||
{
|
||||
// RB end
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
StringToSockaddr
|
||||
=============
|
||||
*/
|
||||
static bool StringToSockaddr( const char* s, struct sockaddr_in* sadr, bool doDNSResolve )
|
||||
{
|
||||
struct hostent* h;
|
||||
char buf[256];
|
||||
int port;
|
||||
|
||||
memset( sadr, 0, sizeof( *sadr ) );
|
||||
sadr->sin_family = AF_INET;
|
||||
|
||||
sadr->sin_port = 0;
|
||||
|
||||
if( s[0] >= '0' && s[0] <= '9' )
|
||||
{
|
||||
if( !inet_aton( s, &sadr->sin_addr ) )
|
||||
{
|
||||
// check for port
|
||||
if( !ExtractPort( s, buf, sizeof( buf ), &port ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if( !inet_aton( buf, &sadr->sin_addr ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
sadr->sin_port = htons( port );
|
||||
}
|
||||
}
|
||||
else if( doDNSResolve )
|
||||
{
|
||||
// try to remove the port first, otherwise the DNS gets confused into multiple timeouts
|
||||
// failed or not failed, buf is expected to contain the appropriate host to resolve
|
||||
if( ExtractPort( s, buf, sizeof( buf ), &port ) )
|
||||
{
|
||||
sadr->sin_port = htons( port );
|
||||
}
|
||||
if( !( h = gethostbyname( buf ) ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*( int* ) &sadr->sin_addr =
|
||||
*( int* ) h->h_addr_list[0];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
Sys_StringToAdr
|
||||
=============
|
||||
*/
|
||||
bool Sys_StringToNetAdr( const char* s, netadr_t* a, bool doDNSResolve )
|
||||
{
|
||||
struct sockaddr_in sadr;
|
||||
|
||||
if( !StringToSockaddr( s, &sadr, doDNSResolve ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SockadrToNetadr( &sadr, a );
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
Sys_NetAdrToString
|
||||
=============
|
||||
*/
|
||||
const char* Sys_NetAdrToString( const netadr_t a )
|
||||
{
|
||||
static char s[64];
|
||||
|
||||
if( a.type == NA_LOOPBACK )
|
||||
{
|
||||
if( a.port )
|
||||
{
|
||||
idStr::snPrintf( s, sizeof( s ), "localhost:%i", a.port );
|
||||
}
|
||||
else
|
||||
{
|
||||
idStr::snPrintf( s, sizeof( s ), "localhost" );
|
||||
}
|
||||
}
|
||||
else if( a.type == NA_IP )
|
||||
{
|
||||
idStr::snPrintf( s, sizeof( s ), "%i.%i.%i.%i:%i",
|
||||
a.ip[0], a.ip[1], a.ip[2], a.ip[3], a.port );
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
Sys_IsLANAddress
|
||||
==================
|
||||
*/
|
||||
bool Sys_IsLANAddress( const netadr_t adr )
|
||||
{
|
||||
int i;
|
||||
// RB: 64 bit fixes, changed long to int
|
||||
unsigned int* p_ip;
|
||||
unsigned int ip;
|
||||
// RB end
|
||||
|
||||
#if ID_NOLANADDRESS
|
||||
common->Printf( "Sys_IsLANAddress: ID_NOLANADDRESS\n" );
|
||||
return false;
|
||||
#endif
|
||||
|
||||
if( adr.type == NA_LOOPBACK )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if( adr.type != NA_IP )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !num_interfaces )
|
||||
{
|
||||
return false; // well, if there's no networking, there are no LAN addresses, right
|
||||
}
|
||||
|
||||
for( i = 0; i < num_interfaces; i++ )
|
||||
{
|
||||
// RB: 64 bit fixes, changed long to int
|
||||
p_ip = ( unsigned int* )&adr.ip[0];
|
||||
// RB end
|
||||
ip = ntohl( *p_ip );
|
||||
if( ( netint[i].ip & netint[i].mask ) == ( ip & netint[i].mask ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
Sys_CompareNetAdrBase
|
||||
|
||||
Compares without the port
|
||||
===================
|
||||
*/
|
||||
bool Sys_CompareNetAdrBase( const netadr_t a, const netadr_t b )
|
||||
{
|
||||
if( a.type != b.type )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( a.type == NA_LOOPBACK )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if( a.type == NA_IP )
|
||||
{
|
||||
if( a.ip[0] == b.ip[0] && a.ip[1] == b.ip[1] && a.ip[2] == b.ip[2] && a.ip[3] == b.ip[3] )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
common->Printf( "Sys_CompareNetAdrBase: bad address type\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
NET_InitNetworking
|
||||
====================
|
||||
*/
|
||||
void Sys_InitNetworking()
|
||||
{
|
||||
// haven't been able to clearly pinpoint which standards or RFCs define SIOCGIFCONF, SIOCGIFADDR, SIOCGIFNETMASK ioctls
|
||||
// it seems fairly widespread, in Linux kernel ioctl, and in BSD .. so let's assume it's always available on our targets
|
||||
|
||||
#if MACOS_X
|
||||
unsigned int ip, mask;
|
||||
struct ifaddrs* ifap, *ifp;
|
||||
|
||||
num_interfaces = 0;
|
||||
|
||||
if( getifaddrs( &ifap ) < 0 )
|
||||
{
|
||||
common->FatalError( "InitNetworking: SIOCGIFCONF error - %s\n", strerror( errno ) );
|
||||
return;
|
||||
}
|
||||
|
||||
for( ifp = ifap; ifp; ifp = ifp->ifa_next )
|
||||
{
|
||||
if( ifp->ifa_addr->sa_family != AF_INET )
|
||||
continue;
|
||||
|
||||
if( !( ifp->ifa_flags & IFF_UP ) )
|
||||
continue;
|
||||
|
||||
if( !ifp->ifa_addr )
|
||||
continue;
|
||||
|
||||
if( !ifp->ifa_netmask )
|
||||
continue;
|
||||
|
||||
// RB: 64 bit fixes, changed long to int
|
||||
ip = ntohl( *( unsigned int* )&ifp->ifa_addr->sa_data[2] );
|
||||
mask = ntohl( *( unsigned int* )&ifp->ifa_netmask->sa_data[2] );
|
||||
// RB end
|
||||
|
||||
if( ip == INADDR_LOOPBACK )
|
||||
{
|
||||
common->Printf( "loopback\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
common->Printf( "IP: %d.%d.%d.%d\n",
|
||||
( unsigned char )ifp->ifa_addr->sa_data[2],
|
||||
( unsigned char )ifp->ifa_addr->sa_data[3],
|
||||
( unsigned char )ifp->ifa_addr->sa_data[4],
|
||||
( unsigned char )ifp->ifa_addr->sa_data[5] );
|
||||
common->Printf( "NetMask: %d.%d.%d.%d\n",
|
||||
( unsigned char )ifp->ifa_netmask->sa_data[2],
|
||||
( unsigned char )ifp->ifa_netmask->sa_data[3],
|
||||
( unsigned char )ifp->ifa_netmask->sa_data[4],
|
||||
( unsigned char )ifp->ifa_netmask->sa_data[5] );
|
||||
}
|
||||
netint[ num_interfaces ].ip = ip;
|
||||
netint[ num_interfaces ].mask = mask;
|
||||
num_interfaces++;
|
||||
}
|
||||
#else
|
||||
int s;
|
||||
char buf[ MAX_INTERFACES * sizeof( ifreq ) ];
|
||||
ifconf ifc;
|
||||
ifreq* ifr;
|
||||
int ifindex;
|
||||
unsigned int ip, mask;
|
||||
|
||||
num_interfaces = 0;
|
||||
|
||||
s = socket( AF_INET, SOCK_DGRAM, 0 );
|
||||
ifc.ifc_len = MAX_INTERFACES * sizeof( ifreq );
|
||||
ifc.ifc_buf = buf;
|
||||
if( ioctl( s, SIOCGIFCONF, &ifc ) < 0 )
|
||||
{
|
||||
common->FatalError( "InitNetworking: SIOCGIFCONF error - %s\n", strerror( errno ) );
|
||||
return;
|
||||
}
|
||||
ifindex = 0;
|
||||
while( ifindex < ifc.ifc_len )
|
||||
{
|
||||
common->Printf( "found interface %s - ", ifc.ifc_buf + ifindex );
|
||||
// find the type - ignore interfaces for which we can find we can't get IP and mask ( not configured )
|
||||
ifr = ( ifreq* )( ifc.ifc_buf + ifindex );
|
||||
if( ioctl( s, SIOCGIFADDR, ifr ) < 0 )
|
||||
{
|
||||
common->Printf( "SIOCGIFADDR failed: %s\n", strerror( errno ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ifr->ifr_addr.sa_family != AF_INET )
|
||||
{
|
||||
common->Printf( "not AF_INET\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
// RB: 64 bit fixes, changed long to int
|
||||
ip = ntohl( *( unsigned int* )&ifr->ifr_addr.sa_data[2] );
|
||||
// RB end
|
||||
if( ip == INADDR_LOOPBACK )
|
||||
{
|
||||
common->Printf( "loopback\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
common->Printf( "%d.%d.%d.%d",
|
||||
( unsigned char )ifr->ifr_addr.sa_data[2],
|
||||
( unsigned char )ifr->ifr_addr.sa_data[3],
|
||||
( unsigned char )ifr->ifr_addr.sa_data[4],
|
||||
( unsigned char )ifr->ifr_addr.sa_data[5] );
|
||||
}
|
||||
if( ioctl( s, SIOCGIFNETMASK, ifr ) < 0 )
|
||||
{
|
||||
common->Printf( " SIOCGIFNETMASK failed: %s\n", strerror( errno ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// RB: 64 bit fixes, changed long to int
|
||||
mask = ntohl( *( unsigned int* )&ifr->ifr_addr.sa_data[2] );
|
||||
// RB end
|
||||
if( ip != INADDR_LOOPBACK )
|
||||
{
|
||||
common->Printf( "/%d.%d.%d.%d\n",
|
||||
( unsigned char )ifr->ifr_addr.sa_data[2],
|
||||
( unsigned char )ifr->ifr_addr.sa_data[3],
|
||||
( unsigned char )ifr->ifr_addr.sa_data[4],
|
||||
( unsigned char )ifr->ifr_addr.sa_data[5] );
|
||||
}
|
||||
netint[ num_interfaces ].ip = ip;
|
||||
netint[ num_interfaces ].mask = mask;
|
||||
num_interfaces++;
|
||||
}
|
||||
}
|
||||
}
|
||||
ifindex += sizeof( ifreq );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
IPSocket
|
||||
====================
|
||||
*/
|
||||
static int IPSocket( const char* net_interface, int port, netadr_t* bound_to = NULL )
|
||||
{
|
||||
int newsocket;
|
||||
struct sockaddr_in address;
|
||||
int i = 1;
|
||||
|
||||
if( net_interface )
|
||||
{
|
||||
common->Printf( "Opening IP socket: %s:%i\n", net_interface, port );
|
||||
}
|
||||
else
|
||||
{
|
||||
common->Printf( "Opening IP socket: localhost:%i\n", port );
|
||||
}
|
||||
|
||||
if( ( newsocket = socket( PF_INET, SOCK_DGRAM, IPPROTO_UDP ) ) == -1 )
|
||||
{
|
||||
common->Printf( "ERROR: IPSocket: socket: %s", strerror( errno ) );
|
||||
return 0;
|
||||
}
|
||||
// make it non-blocking
|
||||
int on = 1;
|
||||
if( ioctl( newsocket, FIONBIO, &on ) == -1 )
|
||||
{
|
||||
common->Printf( "ERROR: IPSocket: ioctl FIONBIO:%s\n",
|
||||
strerror( errno ) );
|
||||
return 0;
|
||||
}
|
||||
// make it broadcast capable
|
||||
if( setsockopt( newsocket, SOL_SOCKET, SO_BROADCAST, ( char* ) &i, sizeof( i ) ) == -1 )
|
||||
{
|
||||
common->Printf( "ERROR: IPSocket: setsockopt SO_BROADCAST:%s\n", strerror( errno ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( !net_interface || !net_interface[ 0 ]
|
||||
|| !idStr::Icmp( net_interface, "localhost" ) )
|
||||
{
|
||||
address.sin_addr.s_addr = INADDR_ANY;
|
||||
}
|
||||
else
|
||||
{
|
||||
StringToSockaddr( net_interface, &address, true );
|
||||
}
|
||||
|
||||
if( port == PORT_ANY )
|
||||
{
|
||||
address.sin_port = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
address.sin_port = htons( ( short ) port );
|
||||
}
|
||||
|
||||
address.sin_family = AF_INET;
|
||||
|
||||
if( bind( newsocket, ( const struct sockaddr* )&address, sizeof( address ) ) == -1 )
|
||||
{
|
||||
common->Printf( "ERROR: IPSocket: bind: %s\n", strerror( errno ) );
|
||||
close( newsocket );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( bound_to )
|
||||
{
|
||||
unsigned int len = sizeof( address );
|
||||
if( ( unsigned int )( getsockname( newsocket, ( struct sockaddr* )&address, ( socklen_t* )&len ) ) == -1 )
|
||||
{
|
||||
common->Printf( "ERROR: IPSocket: getsockname: %s\n", strerror( errno ) );
|
||||
close( newsocket );
|
||||
return 0;
|
||||
}
|
||||
SockadrToNetadr( &address, bound_to );
|
||||
}
|
||||
|
||||
return newsocket;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
Sys_GetLocalIPCount
|
||||
========================
|
||||
*/
|
||||
int Sys_GetLocalIPCount()
|
||||
{
|
||||
return num_interfaces;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
Sys_GetLocalIP
|
||||
========================
|
||||
*/
|
||||
const char* Sys_GetLocalIP( int i )
|
||||
{
|
||||
if( ( i < 0 ) || ( i >= num_interfaces ) )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char s[64];
|
||||
|
||||
unsigned char bytes[4];
|
||||
bytes[0] = netint[i].ip & 0xFF;
|
||||
bytes[1] = ( netint[i].ip >> 8 ) & 0xFF;
|
||||
bytes[2] = ( netint[i].ip >> 16 ) & 0xFF;
|
||||
bytes[3] = ( netint[i].ip >> 24 ) & 0xFF;
|
||||
|
||||
idStr::snPrintf( s, sizeof( s ), "%d.%d.%d.%d", bytes[0], bytes[1], bytes[2], bytes[3] );
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idUDP::idUDP
|
||||
==================
|
||||
*/
|
||||
idUDP::idUDP()
|
||||
{
|
||||
netSocket = 0;
|
||||
memset( &bound_to, 0, sizeof( bound_to ) );
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idUDP::~idUDP
|
||||
==================
|
||||
*/
|
||||
idUDP::~idUDP()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idUDP::Close
|
||||
==================
|
||||
*/
|
||||
void idUDP::Close()
|
||||
{
|
||||
if( netSocket )
|
||||
{
|
||||
close( netSocket );
|
||||
netSocket = 0;
|
||||
memset( &bound_to, 0, sizeof( bound_to ) );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idUDP::GetPacket
|
||||
==================
|
||||
*/
|
||||
bool idUDP::GetPacket( netadr_t& net_from, void* data, int& size, int maxSize )
|
||||
{
|
||||
int ret;
|
||||
struct sockaddr_in from;
|
||||
int fromlen;
|
||||
|
||||
if( !netSocket )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
fromlen = sizeof( from );
|
||||
ret = recvfrom( netSocket, data, maxSize, 0, ( struct sockaddr* ) &from, ( socklen_t* ) &fromlen );
|
||||
|
||||
if( ret == -1 )
|
||||
{
|
||||
if( errno == EWOULDBLOCK || errno == ECONNREFUSED )
|
||||
{
|
||||
// those commonly happen, don't verbose
|
||||
return false;
|
||||
}
|
||||
common->DPrintf( "idUDP::GetPacket recvfrom(): %s\n", strerror( errno ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
assert( ret < maxSize );
|
||||
|
||||
SockadrToNetadr( &from, &net_from );
|
||||
size = ret;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idUDP::GetPacketBlocking
|
||||
==================
|
||||
*/
|
||||
bool idUDP::GetPacketBlocking( netadr_t& net_from, void* data, int& size, int maxSize, int timeout )
|
||||
{
|
||||
fd_set set;
|
||||
struct timeval tv;
|
||||
int ret;
|
||||
|
||||
if( !netSocket )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( timeout < 0 )
|
||||
{
|
||||
return GetPacket( net_from, data, size, maxSize );
|
||||
}
|
||||
|
||||
FD_ZERO( &set );
|
||||
FD_SET( netSocket, &set );
|
||||
|
||||
tv.tv_sec = timeout / 1000;
|
||||
tv.tv_usec = ( timeout % 1000 ) * 1000;
|
||||
ret = select( netSocket + 1, &set, NULL, NULL, &tv );
|
||||
if( ret == -1 )
|
||||
{
|
||||
if( errno == EINTR )
|
||||
{
|
||||
common->DPrintf( "idUDP::GetPacketBlocking: select EINTR\n" );
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
common->Error( "idUDP::GetPacketBlocking: select failed: %s\n", strerror( errno ) );
|
||||
}
|
||||
}
|
||||
|
||||
if( ret == 0 )
|
||||
{
|
||||
// timed out
|
||||
return false;
|
||||
}
|
||||
struct sockaddr_in from;
|
||||
int fromlen;
|
||||
fromlen = sizeof( from );
|
||||
ret = recvfrom( netSocket, data, maxSize, 0, ( struct sockaddr* )&from, ( socklen_t* )&fromlen );
|
||||
if( ret == -1 )
|
||||
{
|
||||
// there should be no blocking errors once select declares things are good
|
||||
common->DPrintf( "idUDP::GetPacketBlocking: %s\n", strerror( errno ) );
|
||||
return false;
|
||||
}
|
||||
assert( ret < maxSize );
|
||||
SockadrToNetadr( &from, &net_from );
|
||||
size = ret;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idUDP::SendPacket
|
||||
==================
|
||||
*/
|
||||
void idUDP::SendPacket( const netadr_t to, const void* data, int size )
|
||||
{
|
||||
int ret;
|
||||
struct sockaddr_in addr;
|
||||
|
||||
if( to.type == NA_BAD )
|
||||
{
|
||||
common->Warning( "idUDP::SendPacket: bad address type NA_BAD - ignored" );
|
||||
return;
|
||||
}
|
||||
|
||||
if( !netSocket )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
NetadrToSockadr( &to, &addr );
|
||||
|
||||
ret = sendto( netSocket, data, size, 0, ( struct sockaddr* ) &addr, sizeof( addr ) );
|
||||
if( ret == -1 )
|
||||
{
|
||||
common->Printf( "idUDP::SendPacket ERROR: to %s: %s\n", Sys_NetAdrToString( to ), strerror( errno ) );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idUDP::InitForPort
|
||||
==================
|
||||
*/
|
||||
bool idUDP::InitForPort( int portNumber )
|
||||
{
|
||||
netSocket = IPSocket( net_ip.GetString(), portNumber, &bound_to );
|
||||
if( netSocket <= 0 )
|
||||
{
|
||||
netSocket = 0;
|
||||
memset( &bound_to, 0, sizeof( bound_to ) );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1,820 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#pragma hdrstop
|
||||
#include "../../idlib/precompiled.h"
|
||||
#include "../sys_session_local.h"
|
||||
#include "../sys_savegame.h"
|
||||
|
||||
idCVar savegame_winInduceDelay( "savegame_winInduceDelay", "0", CVAR_INTEGER, "on windows, this is a delay induced before any file operation occurs" );
|
||||
extern idCVar fs_savepath;
|
||||
extern idCVar saveGame_checksum;
|
||||
extern idCVar savegame_error;
|
||||
|
||||
#define SAVEGAME_SENTINAL 0x12358932
|
||||
|
||||
// RB begin
|
||||
#define ERROR_SUCCESS 0
|
||||
// RB end
|
||||
|
||||
/*
|
||||
========================
|
||||
void Sys_ExecuteSavegameCommandAsync
|
||||
========================
|
||||
*/
|
||||
void Sys_ExecuteSavegameCommandAsyncImpl( idSaveLoadParms* savegameParms )
|
||||
{
|
||||
assert( savegameParms != NULL );
|
||||
|
||||
session->GetSaveGameManager().GetSaveGameThread().data.saveLoadParms = savegameParms;
|
||||
|
||||
if( session->GetSaveGameManager().GetSaveGameThread().GetThreadHandle() == 0 )
|
||||
{
|
||||
session->GetSaveGameManager().GetSaveGameThread().StartWorkerThread( "Savegame", CORE_ANY );
|
||||
}
|
||||
|
||||
session->GetSaveGameManager().GetSaveGameThread().SignalWork();
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idLocalUser * GetLocalUserFromUserId
|
||||
========================
|
||||
*/
|
||||
idLocalUserWin* GetLocalUserFromSaveParms( const saveGameThreadArgs_t& data )
|
||||
{
|
||||
if( ( data.saveLoadParms != NULL ) && ( data.saveLoadParms->inputDeviceId >= 0 ) )
|
||||
{
|
||||
idLocalUser* user = session->GetSignInManager().GetLocalUserByInputDevice( data.saveLoadParms->inputDeviceId );
|
||||
if( user != NULL )
|
||||
{
|
||||
idLocalUserWin* userWin = static_cast< idLocalUserWin* >( user );
|
||||
if( userWin != NULL && data.saveLoadParms->userId == idStr::Hash( userWin->GetGamerTag() ) )
|
||||
{
|
||||
return userWin;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSaveGameThread::SaveGame
|
||||
========================
|
||||
*/
|
||||
int idSaveGameThread::Save()
|
||||
{
|
||||
idLocalUserWin* user = GetLocalUserFromSaveParms( data );
|
||||
if( user == NULL )
|
||||
{
|
||||
data.saveLoadParms->errorCode = SAVEGAME_E_INVALID_USER;
|
||||
return -1;
|
||||
}
|
||||
|
||||
idSaveLoadParms* callback = data.saveLoadParms;
|
||||
idStr saveFolder = "savegame";
|
||||
|
||||
saveFolder.AppendPath( callback->directory );
|
||||
|
||||
// Check for the required storage space.
|
||||
int64 requiredSizeBytes = 0;
|
||||
{
|
||||
for( int i = 0; i < callback->files.Num(); i++ )
|
||||
{
|
||||
idFile_SaveGame* file = callback->files[i];
|
||||
requiredSizeBytes += ( file->Length() + sizeof( unsigned int ) ); // uint for checksum
|
||||
if( file->type == SAVEGAMEFILE_PIPELINED )
|
||||
{
|
||||
requiredSizeBytes += MIN_SAVEGAME_SIZE_BYTES;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
// Check size of previous files if needed
|
||||
// ALL THE FILES RIGHT NOW---- could use pattern later...
|
||||
idStrList filesToDelete;
|
||||
if( ( callback->mode & SAVEGAME_MBF_DELETE_FILES ) && !callback->cancelled )
|
||||
{
|
||||
if( fileSystem->IsFolder( saveFolder.c_str(), "fs_savePath" ) == FOLDER_YES )
|
||||
{
|
||||
idFileList* files = fileSystem->ListFilesTree( saveFolder.c_str(), "*.*" );
|
||||
for( int i = 0; i < files->GetNumFiles(); i++ )
|
||||
{
|
||||
requiredSizeBytes -= fileSystem->GetFileLength( files->GetFile( i ) );
|
||||
filesToDelete.Append( files->GetFile( i ) );
|
||||
}
|
||||
fileSystem->FreeFileList( files );
|
||||
}
|
||||
}
|
||||
|
||||
// RB: disabled savegame and profile storage checks, because it fails sometimes without any clear reason
|
||||
/*
|
||||
// Inform user about size required if necessary
|
||||
if( requiredSizeBytes > 0 && !callback->cancelled )
|
||||
{
|
||||
user->StorageSizeAvailable( requiredSizeBytes, callback->requiredSpaceInBytes );
|
||||
if( callback->requiredSpaceInBytes > 0 )
|
||||
{
|
||||
// check to make sure savepath actually exists before erroring
|
||||
idStr directory = fs_savepath.GetString();
|
||||
directory += "\\"; // so it doesn't think the last part is a file and ignores in the directory creation
|
||||
fileSystem->CreateOSPath( directory ); // we can't actually check FileExists in production builds, so just try to create it
|
||||
user->StorageSizeAvailable( requiredSizeBytes, callback->requiredSpaceInBytes );
|
||||
|
||||
if( callback->requiredSpaceInBytes > 0 )
|
||||
{
|
||||
callback->errorCode = SAVEGAME_E_INSUFFICIENT_ROOM;
|
||||
// safe to return, haven't written any files yet
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
// RB end
|
||||
|
||||
// Delete all previous files if needed
|
||||
// ALL THE FILES RIGHT NOW---- could use pattern later...
|
||||
for( int i = 0; i < filesToDelete.Num() && !callback->cancelled; i++ )
|
||||
{
|
||||
fileSystem->RemoveFile( filesToDelete[i].c_str() );
|
||||
}
|
||||
|
||||
// Save the raw files.
|
||||
for( int i = 0; i < callback->files.Num() && ret == ERROR_SUCCESS && !callback->cancelled; i++ )
|
||||
{
|
||||
idFile_SaveGame* file = callback->files[i];
|
||||
|
||||
idStr fileName = saveFolder;
|
||||
fileName.AppendPath( file->GetName() );
|
||||
idStr tempFileName = va( "%s.temp", fileName.c_str() );
|
||||
|
||||
idFile* outputFile = fileSystem->OpenFileWrite( tempFileName, "fs_savePath" );
|
||||
if( outputFile == NULL )
|
||||
{
|
||||
idLib::Warning( "[%s]: Couldn't open file for writing, %s", __FUNCTION__, tempFileName.c_str() );
|
||||
file->error = true;
|
||||
callback->errorCode = SAVEGAME_E_UNKNOWN;
|
||||
ret = -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if( ( file->type & SAVEGAMEFILE_PIPELINED ) != 0 )
|
||||
{
|
||||
|
||||
idFile_SaveGamePipelined* inputFile = dynamic_cast< idFile_SaveGamePipelined* >( file );
|
||||
assert( inputFile != NULL );
|
||||
|
||||
blockForIO_t block;
|
||||
while( inputFile->NextWriteBlock( & block ) )
|
||||
{
|
||||
if( ( size_t )outputFile->Write( block.data, block.bytes ) != block.bytes )
|
||||
{
|
||||
idLib::Warning( "[%s]: Write failed.", __FUNCTION__ );
|
||||
file->error = true;
|
||||
callback->errorCode = SAVEGAME_E_INSUFFICIENT_ROOM;
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( ( file->type & SAVEGAMEFILE_BINARY ) || ( file->type & SAVEGAMEFILE_COMPRESSED ) )
|
||||
{
|
||||
if( saveGame_checksum.GetBool() )
|
||||
{
|
||||
unsigned int checksum = MD5_BlockChecksum( file->GetDataPtr(), file->Length() );
|
||||
size_t size = outputFile->WriteBig( checksum );
|
||||
if( size != sizeof( checksum ) )
|
||||
{
|
||||
idLib::Warning( "[%s]: Write failed.", __FUNCTION__ );
|
||||
file->error = true;
|
||||
callback->errorCode = SAVEGAME_E_INSUFFICIENT_ROOM;
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
size_t size = outputFile->Write( file->GetDataPtr(), file->Length() );
|
||||
if( size != ( size_t )file->Length() )
|
||||
{
|
||||
idLib::Warning( "[%s]: Write failed.", __FUNCTION__ );
|
||||
file->error = true;
|
||||
callback->errorCode = SAVEGAME_E_INSUFFICIENT_ROOM;
|
||||
ret = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
idLib::PrintfIf( saveGame_verbose.GetBool(), "Saved %s (%s)\n", fileName.c_str(), outputFile->GetFullPath() );
|
||||
}
|
||||
}
|
||||
|
||||
delete outputFile;
|
||||
|
||||
if( ret == ERROR_SUCCESS )
|
||||
{
|
||||
// Remove the old file
|
||||
if( !fileSystem->RenameFile( tempFileName, fileName, "fs_savePath" ) )
|
||||
{
|
||||
idLib::Warning( "Could not start to rename temporary file %s to %s.", tempFileName.c_str(), fileName.c_str() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fileSystem->RemoveFile( tempFileName );
|
||||
idLib::Warning( "Invalid write to temporary file %s.", tempFileName.c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
if( data.saveLoadParms->cancelled )
|
||||
{
|
||||
data.saveLoadParms->errorCode = SAVEGAME_E_CANCELLED;
|
||||
}
|
||||
|
||||
// Removed because it seemed a bit drastic
|
||||
#if 0
|
||||
// If there is an error, delete the partially saved folder
|
||||
if( callback->errorCode != SAVEGAME_E_NONE )
|
||||
{
|
||||
if( fileSystem->IsFolder( saveFolder, "fs_savePath" ) == FOLDER_YES )
|
||||
{
|
||||
idFileList* files = fileSystem->ListFilesTree( saveFolder, "/|*" );
|
||||
for( int i = 0; i < files->GetNumFiles(); i++ )
|
||||
{
|
||||
fileSystem->RemoveFile( files->GetFile( i ) );
|
||||
}
|
||||
fileSystem->FreeFileList( files );
|
||||
fileSystem->RemoveDir( saveFolder );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocal::LoadGame
|
||||
========================
|
||||
*/
|
||||
int idSaveGameThread::Load()
|
||||
{
|
||||
idSaveLoadParms* callback = data.saveLoadParms;
|
||||
idStr saveFolder = "savegame";
|
||||
|
||||
saveFolder.AppendPath( callback->directory );
|
||||
|
||||
if( fileSystem->IsFolder( saveFolder, "fs_savePath" ) != FOLDER_YES )
|
||||
{
|
||||
callback->errorCode = SAVEGAME_E_FOLDER_NOT_FOUND;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ret = ERROR_SUCCESS;
|
||||
for( int i = 0; i < callback->files.Num() && ret == ERROR_SUCCESS && !callback->cancelled; i++ )
|
||||
{
|
||||
idFile_SaveGame* file = callback->files[i];
|
||||
|
||||
idStr filename = saveFolder;
|
||||
filename.AppendPath( file->GetName() );
|
||||
|
||||
idFile* inputFile = fileSystem->OpenFileRead( filename.c_str() );
|
||||
if( inputFile == NULL )
|
||||
{
|
||||
file->error = true;
|
||||
if( !( file->type & SAVEGAMEFILE_OPTIONAL ) )
|
||||
{
|
||||
callback->errorCode = SAVEGAME_E_CORRUPTED;
|
||||
ret = -1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if( ( file->type & SAVEGAMEFILE_PIPELINED ) != 0 )
|
||||
{
|
||||
|
||||
idFile_SaveGamePipelined* outputFile = dynamic_cast< idFile_SaveGamePipelined* >( file );
|
||||
assert( outputFile != NULL );
|
||||
|
||||
size_t lastReadBytes = 0;
|
||||
blockForIO_t block;
|
||||
while( outputFile->NextReadBlock( &block, lastReadBytes ) && !callback->cancelled )
|
||||
{
|
||||
lastReadBytes = inputFile->Read( block.data, block.bytes );
|
||||
if( lastReadBytes != block.bytes )
|
||||
{
|
||||
// Notify end-of-file to the save game file which will cause all reads on the
|
||||
// other end of the pipeline to return zero bytes after the pipeline is drained.
|
||||
outputFile->NextReadBlock( NULL, lastReadBytes );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
size_t size = inputFile->Length();
|
||||
|
||||
unsigned int originalChecksum = 0;
|
||||
if( ( file->type & SAVEGAMEFILE_BINARY ) != 0 || ( file->type & SAVEGAMEFILE_COMPRESSED ) != 0 )
|
||||
{
|
||||
if( saveGame_checksum.GetBool() )
|
||||
{
|
||||
if( size >= sizeof( originalChecksum ) )
|
||||
{
|
||||
inputFile->ReadBig( originalChecksum );
|
||||
size -= sizeof( originalChecksum );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
file->SetLength( size );
|
||||
|
||||
size_t sizeRead = inputFile->Read( ( void* )file->GetDataPtr(), size );
|
||||
if( sizeRead != size )
|
||||
{
|
||||
file->error = true;
|
||||
callback->errorCode = SAVEGAME_E_CORRUPTED;
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
if( ( file->type & SAVEGAMEFILE_BINARY ) != 0 || ( file->type & SAVEGAMEFILE_COMPRESSED ) != 0 )
|
||||
{
|
||||
if( saveGame_checksum.GetBool() )
|
||||
{
|
||||
unsigned int checksum = MD5_BlockChecksum( file->GetDataPtr(), file->Length() );
|
||||
if( checksum != originalChecksum )
|
||||
{
|
||||
file->error = true;
|
||||
callback->errorCode = SAVEGAME_E_CORRUPTED;
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete inputFile;
|
||||
}
|
||||
|
||||
if( data.saveLoadParms->cancelled )
|
||||
{
|
||||
data.saveLoadParms->errorCode = SAVEGAME_E_CANCELLED;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSaveGameThread::Delete
|
||||
|
||||
This deletes a complete savegame directory
|
||||
========================
|
||||
*/
|
||||
int idSaveGameThread::Delete()
|
||||
{
|
||||
idSaveLoadParms* callback = data.saveLoadParms;
|
||||
idStr saveFolder = "savegame";
|
||||
|
||||
saveFolder.AppendPath( callback->directory );
|
||||
|
||||
int ret = ERROR_SUCCESS;
|
||||
if( fileSystem->IsFolder( saveFolder, "fs_savePath" ) == FOLDER_YES )
|
||||
{
|
||||
idFileList* files = fileSystem->ListFilesTree( saveFolder, "/|*" );
|
||||
for( int i = 0; i < files->GetNumFiles() && !callback->cancelled; i++ )
|
||||
{
|
||||
fileSystem->RemoveFile( files->GetFile( i ) );
|
||||
}
|
||||
fileSystem->FreeFileList( files );
|
||||
|
||||
fileSystem->RemoveDir( saveFolder );
|
||||
}
|
||||
else
|
||||
{
|
||||
callback->errorCode = SAVEGAME_E_FOLDER_NOT_FOUND;
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
if( data.saveLoadParms->cancelled )
|
||||
{
|
||||
data.saveLoadParms->errorCode = SAVEGAME_E_CANCELLED;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSaveGameThread::Enumerate
|
||||
========================
|
||||
*/
|
||||
int idSaveGameThread::Enumerate()
|
||||
{
|
||||
idSaveLoadParms* callback = data.saveLoadParms;
|
||||
idStr saveFolder = "savegame";
|
||||
|
||||
callback->detailList.Clear();
|
||||
|
||||
int ret = ERROR_SUCCESS;
|
||||
if( fileSystem->IsFolder( saveFolder, "fs_savePath" ) == FOLDER_YES )
|
||||
{
|
||||
idFileList* files = fileSystem->ListFilesTree( saveFolder, SAVEGAME_DETAILS_FILENAME );
|
||||
const idStrList& fileList = files->GetList();
|
||||
|
||||
for( int i = 0; i < fileList.Num() && !callback->cancelled; i++ )
|
||||
{
|
||||
idSaveGameDetails* details = callback->detailList.Alloc();
|
||||
// We have more folders on disk than we have room in our save detail list, stop trying to read them in and continue with what we have
|
||||
if( details == NULL )
|
||||
{
|
||||
break;
|
||||
}
|
||||
idStr directory = fileList[i];
|
||||
|
||||
idFile* file = fileSystem->OpenFileRead( directory.c_str() );
|
||||
|
||||
if( file != NULL )
|
||||
{
|
||||
// Read the DETAIL file for the enumerated data
|
||||
if( callback->mode & SAVEGAME_MBF_READ_DETAILS )
|
||||
{
|
||||
if( !SavegameReadDetailsFromFile( file, *details ) )
|
||||
{
|
||||
details->damaged = true;
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// DG: just use the idFile object's timestamp - the windows code gets file attributes and
|
||||
// other complicated stuff like that.. I'm wonderin what that was good for.. this seems to work.
|
||||
details->date = file->Timestamp();
|
||||
// DG end
|
||||
}
|
||||
else
|
||||
{
|
||||
details->damaged = true;
|
||||
}
|
||||
|
||||
// populate the game details struct
|
||||
directory = directory.StripFilename();
|
||||
details->slotName = directory.c_str() + saveFolder.Length() + 1; // Strip off the prefix too
|
||||
// JDC: I hit this all the time assert( fileSystem->IsFolder( directory.c_str(), "fs_savePath" ) == FOLDER_YES );
|
||||
}
|
||||
fileSystem->FreeFileList( files );
|
||||
}
|
||||
else
|
||||
{
|
||||
callback->errorCode = SAVEGAME_E_FOLDER_NOT_FOUND;
|
||||
ret = -3;
|
||||
}
|
||||
|
||||
if( data.saveLoadParms->cancelled )
|
||||
{
|
||||
data.saveLoadParms->errorCode = SAVEGAME_E_CANCELLED;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSaveGameThread::EnumerateFiles
|
||||
========================
|
||||
*/
|
||||
int idSaveGameThread::EnumerateFiles()
|
||||
{
|
||||
idSaveLoadParms* callback = data.saveLoadParms;
|
||||
idStr folder = "savegame";
|
||||
|
||||
folder.AppendPath( callback->directory );
|
||||
|
||||
callback->files.Clear();
|
||||
|
||||
int ret = ERROR_SUCCESS;
|
||||
if( fileSystem->IsFolder( folder, "fs_savePath" ) == FOLDER_YES )
|
||||
{
|
||||
// get listing of all the files, but filter out below
|
||||
idFileList* files = fileSystem->ListFilesTree( folder, "*.*" );
|
||||
|
||||
// look for the instance pattern
|
||||
for( int i = 0; i < files->GetNumFiles() && ret == 0 && !callback->cancelled; i++ )
|
||||
{
|
||||
idStr fullFilename = files->GetFile( i );
|
||||
idStr filename = fullFilename;
|
||||
filename.StripPath();
|
||||
|
||||
if( filename.IcmpPrefix( callback->pattern ) != 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if( !callback->postPattern.IsEmpty() && filename.Right( callback->postPattern.Length() ).IcmpPrefix( callback->postPattern ) != 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Read the DETAIL file for the enumerated data
|
||||
if( callback->mode & SAVEGAME_MBF_READ_DETAILS )
|
||||
{
|
||||
idSaveGameDetails& details = callback->description;
|
||||
idFile* uncompressed = fileSystem->OpenFileRead( fullFilename.c_str() );
|
||||
|
||||
if( uncompressed == NULL )
|
||||
{
|
||||
details.damaged = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !SavegameReadDetailsFromFile( uncompressed, details ) )
|
||||
{
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
delete uncompressed;
|
||||
}
|
||||
|
||||
// populate the game details struct
|
||||
details.slotName = callback->directory;
|
||||
assert( fileSystem->IsFolder( details.slotName, "fs_savePath" ) == FOLDER_YES );
|
||||
}
|
||||
|
||||
idFile_SaveGame* file = new( TAG_SAVEGAMES ) idFile_SaveGame( filename, SAVEGAMEFILE_AUTO_DELETE );
|
||||
callback->files.Append( file );
|
||||
}
|
||||
fileSystem->FreeFileList( files );
|
||||
}
|
||||
else
|
||||
{
|
||||
callback->errorCode = SAVEGAME_E_FOLDER_NOT_FOUND;
|
||||
ret = -3;
|
||||
}
|
||||
|
||||
if( data.saveLoadParms->cancelled )
|
||||
{
|
||||
data.saveLoadParms->errorCode = SAVEGAME_E_CANCELLED;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSaveGameThread::DeleteFiles
|
||||
========================
|
||||
*/
|
||||
int idSaveGameThread::DeleteFiles()
|
||||
{
|
||||
idSaveLoadParms* callback = data.saveLoadParms;
|
||||
idStr folder = "savegame";
|
||||
|
||||
folder.AppendPath( callback->directory );
|
||||
|
||||
// delete the explicitly requested files first
|
||||
for( int j = 0; j < callback->files.Num() && !callback->cancelled; ++j )
|
||||
{
|
||||
idFile_SaveGame* file = callback->files[j];
|
||||
idStr fullpath = folder;
|
||||
fullpath.AppendPath( file->GetName() );
|
||||
fileSystem->RemoveFile( fullpath );
|
||||
}
|
||||
|
||||
int ret = ERROR_SUCCESS;
|
||||
if( fileSystem->IsFolder( folder, "fs_savePath" ) == FOLDER_YES )
|
||||
{
|
||||
// get listing of all the files, but filter out below
|
||||
idFileList* files = fileSystem->ListFilesTree( folder, "*.*" );
|
||||
|
||||
// look for the instance pattern
|
||||
for( int i = 0; i < files->GetNumFiles() && !callback->cancelled; i++ )
|
||||
{
|
||||
idStr filename = files->GetFile( i );
|
||||
filename.StripPath();
|
||||
|
||||
// If there are post/pre patterns to match, make sure we adhere to the patterns
|
||||
if( callback->pattern.IsEmpty() || ( filename.IcmpPrefix( callback->pattern ) != 0 ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if( callback->postPattern.IsEmpty() || ( filename.Right( callback->postPattern.Length() ).IcmpPrefix( callback->postPattern ) != 0 ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
fileSystem->RemoveFile( files->GetFile( i ) );
|
||||
}
|
||||
fileSystem->FreeFileList( files );
|
||||
}
|
||||
else
|
||||
{
|
||||
callback->errorCode = SAVEGAME_E_FOLDER_NOT_FOUND;
|
||||
ret = -3;
|
||||
}
|
||||
|
||||
if( data.saveLoadParms->cancelled )
|
||||
{
|
||||
data.saveLoadParms->errorCode = SAVEGAME_E_CANCELLED;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSaveGameThread::DeleteAll
|
||||
|
||||
This deletes all savegame directories
|
||||
========================
|
||||
*/
|
||||
int idSaveGameThread::DeleteAll()
|
||||
{
|
||||
idSaveLoadParms* callback = data.saveLoadParms;
|
||||
idStr saveFolder = "savegame";
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
if( fileSystem->IsFolder( saveFolder, "fs_savePath" ) == FOLDER_YES )
|
||||
{
|
||||
idFileList* files = fileSystem->ListFilesTree( saveFolder, "/|*" );
|
||||
// remove directories after files
|
||||
for( int i = 0; i < files->GetNumFiles() && !callback->cancelled; i++ )
|
||||
{
|
||||
// contained files should always be first
|
||||
if( fileSystem->IsFolder( files->GetFile( i ), "fs_savePath" ) == FOLDER_YES )
|
||||
{
|
||||
fileSystem->RemoveDir( files->GetFile( i ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
fileSystem->RemoveFile( files->GetFile( i ) );
|
||||
}
|
||||
}
|
||||
fileSystem->FreeFileList( files );
|
||||
}
|
||||
else
|
||||
{
|
||||
callback->errorCode = SAVEGAME_E_FOLDER_NOT_FOUND;
|
||||
ret = -3;
|
||||
}
|
||||
|
||||
if( data.saveLoadParms->cancelled )
|
||||
{
|
||||
data.saveLoadParms->errorCode = SAVEGAME_E_CANCELLED;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSaveGameThread::Run
|
||||
========================
|
||||
*/
|
||||
int idSaveGameThread::Run()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
try
|
||||
{
|
||||
idLocalUserWin* user = GetLocalUserFromSaveParms( data );
|
||||
if( user != NULL && !user->IsStorageDeviceAvailable() )
|
||||
{
|
||||
data.saveLoadParms->errorCode = SAVEGAME_E_UNABLE_TO_SELECT_STORAGE_DEVICE;
|
||||
}
|
||||
|
||||
if( savegame_winInduceDelay.GetInteger() > 0 )
|
||||
{
|
||||
Sys_Sleep( savegame_winInduceDelay.GetInteger() );
|
||||
}
|
||||
|
||||
if( data.saveLoadParms->mode & SAVEGAME_MBF_SAVE )
|
||||
{
|
||||
ret = Save();
|
||||
}
|
||||
else if( data.saveLoadParms->mode & SAVEGAME_MBF_LOAD )
|
||||
{
|
||||
ret = Load();
|
||||
}
|
||||
else if( data.saveLoadParms->mode & SAVEGAME_MBF_ENUMERATE )
|
||||
{
|
||||
ret = Enumerate();
|
||||
}
|
||||
else if( data.saveLoadParms->mode & SAVEGAME_MBF_DELETE_FOLDER )
|
||||
{
|
||||
ret = Delete();
|
||||
}
|
||||
else if( data.saveLoadParms->mode & SAVEGAME_MBF_DELETE_ALL_FOLDERS )
|
||||
{
|
||||
ret = DeleteAll();
|
||||
}
|
||||
else if( data.saveLoadParms->mode & SAVEGAME_MBF_DELETE_FILES )
|
||||
{
|
||||
ret = DeleteFiles();
|
||||
}
|
||||
else if( data.saveLoadParms->mode & SAVEGAME_MBF_ENUMERATE_FILES )
|
||||
{
|
||||
ret = EnumerateFiles();
|
||||
}
|
||||
|
||||
// if something failed and no one set an error code, do it now.
|
||||
if( ret != 0 && data.saveLoadParms->errorCode == SAVEGAME_E_NONE )
|
||||
{
|
||||
data.saveLoadParms->errorCode = SAVEGAME_E_UNKNOWN;
|
||||
}
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// if anything horrible happens, leave it up to the savegame processors to handle in PostProcess().
|
||||
data.saveLoadParms->errorCode = SAVEGAME_E_UNKNOWN;
|
||||
}
|
||||
|
||||
// Make sure to cancel any save game file pipelines.
|
||||
if( data.saveLoadParms->errorCode != SAVEGAME_E_NONE )
|
||||
{
|
||||
data.saveLoadParms->CancelSaveGameFilePipelines();
|
||||
}
|
||||
|
||||
// Override error if cvar set
|
||||
if( savegame_error.GetInteger() != 0 )
|
||||
{
|
||||
data.saveLoadParms->errorCode = ( saveGameError_t )savegame_error.GetInteger();
|
||||
}
|
||||
|
||||
// Tell the waiting caller that we are done
|
||||
data.saveLoadParms->callbackSignal.Raise();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
Sys_SaveGameCheck
|
||||
========================
|
||||
*/
|
||||
void Sys_SaveGameCheck( bool& exists, bool& autosaveExists )
|
||||
{
|
||||
exists = false;
|
||||
autosaveExists = false;
|
||||
|
||||
const idStr autosaveFolderStr = AddSaveFolderPrefix( SAVEGAME_AUTOSAVE_FOLDER, idSaveGameManager::PACKAGE_GAME );
|
||||
const char* autosaveFolder = autosaveFolderStr.c_str();
|
||||
const char* saveFolder = "savegame";
|
||||
|
||||
if( fileSystem->IsFolder( saveFolder, "fs_savePath" ) == FOLDER_YES )
|
||||
{
|
||||
idFileList* files = fileSystem->ListFiles( saveFolder, "/" );
|
||||
const idStrList& fileList = files->GetList();
|
||||
|
||||
idLib::PrintfIf( saveGame_verbose.GetBool(), "found %d savegames\n", fileList.Num() );
|
||||
|
||||
for( int i = 0; i < fileList.Num(); i++ )
|
||||
{
|
||||
const char* directory = va( "%s/%s", saveFolder, fileList[i].c_str() );
|
||||
|
||||
if( fileSystem->IsFolder( directory, "fs_savePath" ) == FOLDER_YES )
|
||||
{
|
||||
exists = true;
|
||||
|
||||
idLib::PrintfIf( saveGame_verbose.GetBool(), "found savegame: %s\n", fileList[i].c_str() );
|
||||
|
||||
if( idStr::Icmp( fileList[i].c_str(), autosaveFolder ) == 0 )
|
||||
{
|
||||
autosaveExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fileSystem->FreeFileList( files );
|
||||
}
|
||||
}
|
|
@ -1,161 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#pragma hdrstop
|
||||
#include "../../idlib/precompiled.h"
|
||||
#include "../../framework/PlayerProfile.h"
|
||||
#include "../sys_session_local.h"
|
||||
#include "posix_signin.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef _DEBUG
|
||||
idCVar win_userPersistent( "win_userPersistent", "1", CVAR_BOOL, "debugging cvar for profile persistence status" );
|
||||
idCVar win_userOnline( "win_userOnline", "1", CVAR_BOOL, "debugging cvar for profile online status" );
|
||||
idCVar win_isInParty( "win_isInParty", "0", CVAR_BOOL, "debugging cvar for platform party status" );
|
||||
idCVar win_partyCount( "win_partyCount", "0", CVAR_INTEGER, "debugginc var for platform party count" );
|
||||
#endif
|
||||
|
||||
/*
|
||||
========================
|
||||
idSignInManagerWin::Shutdown
|
||||
========================
|
||||
*/
|
||||
void idSignInManagerWin::Shutdown()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSignInManagerWin::Pump
|
||||
========================
|
||||
*/
|
||||
void idSignInManagerWin::Pump()
|
||||
{
|
||||
|
||||
// If we have more users than we need, then set to the lower amount
|
||||
// (don't remove the master user though)
|
||||
if( localUsers.Num() > 1 && localUsers.Num() > maxDesiredLocalUsers )
|
||||
{
|
||||
localUsers.SetNum( maxDesiredLocalUsers );
|
||||
}
|
||||
|
||||
#ifndef ID_RETAIL
|
||||
// If we don't have enough, then make sure we do
|
||||
// NOTE - We always want at least one user on windows for now,
|
||||
// and this master user will always use controller 0
|
||||
while( localUsers.Num() < minDesiredLocalUsers )
|
||||
{
|
||||
RegisterLocalUser( localUsers.Num() );
|
||||
}
|
||||
#endif
|
||||
|
||||
// See if we need to save settings on any of the profiles
|
||||
for( int i = 0; i < localUsers.Num(); i++ )
|
||||
{
|
||||
localUsers[i].Pump();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSignInManagerWin::RemoveLocalUserByIndex
|
||||
========================
|
||||
*/
|
||||
void idSignInManagerWin::RemoveLocalUserByIndex( int index )
|
||||
{
|
||||
session->OnLocalUserSignout( &localUsers[index] );
|
||||
localUsers.RemoveIndex( index );
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSignInManagerWin::RegisterLocalUser
|
||||
========================
|
||||
*/
|
||||
void idSignInManagerWin::RegisterLocalUser( int inputDevice )
|
||||
{
|
||||
if( GetLocalUserByInputDevice( inputDevice ) != NULL )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static char machineName[128];
|
||||
gethostname( machineName, sizeof( machineName ) );
|
||||
|
||||
const char* nameSource = machineName;
|
||||
|
||||
idStr name( nameSource );
|
||||
int nameLength = name.Length();
|
||||
if( idStr::IsValidUTF8( nameSource, nameLength ) )
|
||||
{
|
||||
int nameIndex = 0;
|
||||
int numChars = 0;
|
||||
name.Empty();
|
||||
while( nameIndex < nameLength && numChars++ < idLocalUserWin::MAX_GAMERTAG_CHARS )
|
||||
{
|
||||
uint32 c = idStr::UTF8Char( nameSource, nameIndex );
|
||||
name.AppendUTF8Char( c );
|
||||
}
|
||||
}
|
||||
|
||||
idLocalUserWin& localUser = *localUsers.Alloc();
|
||||
|
||||
localUser.Init( inputDevice, name.c_str(), localUsers.Num() );
|
||||
localUser.SetLocalUserHandle( GetUniqueLocalUserHandle( localUser.GetGamerTag() ) );
|
||||
|
||||
session->OnLocalUserSignin( &localUser );
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSignInManagerWin::CreateNewUser
|
||||
========================
|
||||
*/
|
||||
bool idSignInManagerWin::CreateNewUser( winUserState_t& state )
|
||||
{
|
||||
//idScopedGlobalHeap everythingHereGoesInTheGlobalHeap; // users obviously persist across maps
|
||||
|
||||
RemoveAllLocalUsers();
|
||||
RegisterLocalUser( state.inputDevice );
|
||||
|
||||
if( localUsers.Num() > 0 )
|
||||
{
|
||||
if( !localUsers[0].VerifyUserState( state ) )
|
||||
{
|
||||
RemoveAllLocalUsers();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CONSOLE_COMMAND( testRemoveAllLocalUsers, "Forces removal of local users - mainly for PC testing", NULL )
|
||||
{
|
||||
session->GetSignInManager().RemoveAllLocalUsers();
|
||||
}
|
|
@ -26,12 +26,19 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
===========================================================================
|
||||
*/
|
||||
#include <SDL_cpuinfo.h>
|
||||
|
||||
#pragma hdrstop
|
||||
#include "../../idlib/precompiled.h"
|
||||
|
||||
//#include "win_local.h"
|
||||
// DG: SDL_*.h somehow needs the following functions, so #undef those silly
|
||||
// "don't use" #defines from Str.h
|
||||
#undef strcasecmp
|
||||
#undef strncmp
|
||||
#undef vsnprintf
|
||||
// DG end
|
||||
|
||||
#include <SDL_cpuinfo.h>
|
||||
|
||||
|
||||
#pragma warning(disable:4740) // warning C4740: flow in or out of inline asm code suppresses global optimization
|
||||
#pragma warning(disable:4731) // warning C4731: 'XXX' : frame pointer register 'ebx' modified by inline assembly code
|
||||
|
|
|
@ -31,6 +31,13 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "../../idlib/precompiled.h"
|
||||
|
||||
// DG: SDL.h somehow needs the following functions, so #undef those silly
|
||||
// "don't use" #defines from Str.h
|
||||
#undef strncmp
|
||||
#undef strcasecmp
|
||||
#undef vsnprintf
|
||||
// DG end
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
#include "renderer/tr_local.h"
|
||||
|
@ -72,7 +79,7 @@ const char* kbdNames[] =
|
|||
"english", "french", "german", "italian", "spanish", "turkish", "norwegian", NULL
|
||||
};
|
||||
|
||||
idCVar in_kbd( "in_kbd", "english", CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_NOCHEAT, "keyboard layout", kbdNames, idCmdSystem::ArgCompletion_String<kbdNames> );
|
||||
idCVar in_keyboard( "in_keyboard", "english", CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_NOCHEAT, "keyboard layout", kbdNames, idCmdSystem::ArgCompletion_String<kbdNames> );
|
||||
|
||||
struct kbd_poll_t
|
||||
{
|
||||
|
@ -552,7 +559,7 @@ void Sys_InitInput()
|
|||
SDL_EnableKeyRepeat( SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL );
|
||||
#endif
|
||||
|
||||
in_kbd.SetModified();
|
||||
in_keyboard.SetModified();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -587,9 +594,9 @@ unsigned char Sys_GetConsoleKey( bool shifted )
|
|||
{
|
||||
static unsigned char keys[2] = { '`', '~' };
|
||||
|
||||
if( in_kbd.IsModified() )
|
||||
if( in_keyboard.IsModified() )
|
||||
{
|
||||
idStr lang = in_kbd.GetString();
|
||||
idStr lang = in_keyboard.GetString();
|
||||
|
||||
if( lang.Length() )
|
||||
{
|
||||
|
@ -625,7 +632,7 @@ unsigned char Sys_GetConsoleKey( bool shifted )
|
|||
}
|
||||
}
|
||||
|
||||
in_kbd.ClearModified();
|
||||
in_keyboard.ClearModified();
|
||||
}
|
||||
|
||||
return shifted ? keys[1] : keys[0];
|
||||
|
@ -853,6 +860,16 @@ sysEvent_t Sys_GetEvent()
|
|||
}
|
||||
// DG end
|
||||
|
||||
#if ! SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
// DG: only do this for key-down, don't care about isChar from SDL_KeyToDoom3Key.
|
||||
// if unicode is not 0 and is translatable to ASCII it should work..
|
||||
if( ev.key.state == SDL_PRESSED && ( ev.key.keysym.unicode & 0xff80 ) == 0 )
|
||||
{
|
||||
c = ev.key.keysym.unicode & 0x7f;
|
||||
}
|
||||
// DG end
|
||||
#endif
|
||||
|
||||
// fall through
|
||||
case SDL_KEYUP:
|
||||
{
|
||||
|
@ -870,20 +887,17 @@ sysEvent_t Sys_GetEvent()
|
|||
|
||||
if( key == 0 )
|
||||
{
|
||||
unsigned char c;
|
||||
|
||||
|
||||
unsigned char uc = ev.key.keysym.unicode & 0xff;
|
||||
// check if its an unmapped console key
|
||||
if( ev.key.keysym.unicode == ( c = Sys_GetConsoleKey( false ) ) )
|
||||
if( uc == Sys_GetConsoleKey( false ) || uc == Sys_GetConsoleKey( true ) )
|
||||
{
|
||||
key = c;
|
||||
}
|
||||
else if( ev.key.keysym.unicode == ( c = Sys_GetConsoleKey( true ) ) )
|
||||
{
|
||||
key = c;
|
||||
key = K_GRAVE;
|
||||
c = K_BACKSPACE; // bad hack to get empty console inputline..
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ev.type == SDL_KEYDOWN )
|
||||
if( ev.type == SDL_KEYDOWN ) // FIXME: don't complain if this was an ASCII char and the console is open?
|
||||
common->Warning( "unmapped SDL key %d (0x%x) scancode %d", ev.key.keysym.sym, ev.key.keysym.unicode, ev.key.keysym.scancode );
|
||||
return res_none;
|
||||
}
|
||||
|
@ -898,13 +912,7 @@ sysEvent_t Sys_GetEvent()
|
|||
|
||||
if( key == K_BACKSPACE && ev.key.state == SDL_PRESSED )
|
||||
c = key;
|
||||
#if ! SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
if( ev.key.state == SDL_PRESSED && isChar && ( ev.key.keysym.unicode & 0xff00 ) == 0 )
|
||||
{
|
||||
c = ev.key.keysym.unicode & 0xff;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,11 +29,18 @@ If you have questions concerning this license or the applicable additional terms
|
|||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "../../idlib/precompiled.h"
|
||||
|
||||
// DG: SDL.h somehow needs the following functions, so #undef those silly
|
||||
// "don't use" #defines from Str.h
|
||||
#undef strncmp
|
||||
#undef strcasecmp
|
||||
#undef vsnprintf
|
||||
// DG end
|
||||
|
||||
#include <SDL.h>
|
||||
#include <SDL_syswm.h>
|
||||
|
||||
#include "../../idlib/precompiled.h"
|
||||
|
||||
#include "renderer/tr_local.h"
|
||||
#include "sdl_local.h"
|
||||
|
||||
|
@ -319,7 +326,7 @@ static int ScreenParmsHandleDisplayIndex( glimpParms_t parms )
|
|||
}
|
||||
else // -2 == use current display
|
||||
{
|
||||
displayIdx = SDL_GetWindowDisplay( window );
|
||||
displayIdx = SDL_GetWindowDisplayIndex( window );
|
||||
if( displayIdx < 0 ) // for some reason the display for the window couldn't be detected
|
||||
displayIdx = 0;
|
||||
}
|
||||
|
|
|
@ -339,6 +339,7 @@ void idLobby::Shutdown( bool retainMigrationInfo, bool skipGoodbye )
|
|||
idLobby::HandlePacket
|
||||
========================
|
||||
*/
|
||||
// TODO: remoteAddress const?
|
||||
void idLobby::HandlePacket( lobbyAddress_t& remoteAddress, idBitMsg fragMsg, idPacketProcessor::sessionId_t sessionID )
|
||||
{
|
||||
SCOPED_PROFILE_EVENT( "HandlePacket" );
|
||||
|
@ -589,7 +590,7 @@ void idLobby::HandlePacket( lobbyAddress_t& remoteAddress, idBitMsg fragMsg, idP
|
|||
idBitMsg reliableMsg( reliableData, reliableSize );
|
||||
reliableMsg.SetSize( reliableSize );
|
||||
|
||||
HandleReliableMsg( peerNum, reliableMsg );
|
||||
HandleReliableMsg( peerNum, reliableMsg, &remoteAddress );
|
||||
}
|
||||
|
||||
if( peerNum == -1 || !peers[ peerNum ].IsConnected() )
|
||||
|
@ -1575,7 +1576,7 @@ void idLobby::SendConnectionRequest()
|
|||
// Add the current version info to the handshake
|
||||
const unsigned int localChecksum = NetGetVersionChecksum(); // DG: use int instead of long for 64bit compatibility
|
||||
|
||||
NET_VERBOSE_PRINT( "NET: version = %i\n", localChecksum );
|
||||
NET_VERBOSE_PRINT( "NET: version = %u\n", localChecksum );
|
||||
|
||||
msg.WriteLong( localChecksum );
|
||||
msg.WriteUShort( peers[host].sessionID );
|
||||
|
@ -1760,7 +1761,7 @@ bool idLobby::CheckVersion( idBitMsg& msg, lobbyAddress_t peerAddress )
|
|||
{
|
||||
const unsigned int localChecksum = NetGetVersionChecksum(); // DG: use int instead of long for 64bit compatibility
|
||||
|
||||
NET_VERBOSE_PRINT( "NET: Comparing handshake version - localChecksum = %i, remoteChecksum = %i\n", localChecksum, remoteChecksum );
|
||||
NET_VERBOSE_PRINT( "NET: Comparing handshake version - localChecksum = %u, remoteChecksum = %u\n", localChecksum, remoteChecksum );
|
||||
return ( remoteChecksum == localChecksum );
|
||||
}
|
||||
return true;
|
||||
|
@ -1857,7 +1858,7 @@ int idLobby::HandleInitialPeerConnection( idBitMsg& msg, const lobbyAddress_t& p
|
|||
|
||||
if( !IsHost() )
|
||||
{
|
||||
NET_VERBOSE_PRINT( "NET: Got connectionless hello from peer %s on session, and we are not a host\n", peerAddress.ToString() );
|
||||
NET_VERBOSE_PRINT( "NET: Got connectionless hello from peer %s (num %i) on session, and we are not a host\n", peerAddress.ToString(), peerNum );
|
||||
SendGoodbye( peerAddress );
|
||||
return -1;
|
||||
}
|
||||
|
@ -2765,13 +2766,13 @@ const char* idLobby::GetPeerName( int peerNum ) const
|
|||
idLobby::HandleReliableMsg
|
||||
========================
|
||||
*/
|
||||
void idLobby::HandleReliableMsg( int p, idBitMsg& msg )
|
||||
void idLobby::HandleReliableMsg( int p, idBitMsg& msg, const lobbyAddress_t* remoteAddress /* = NULL */ )
|
||||
{
|
||||
peer_t& peer = peers[p];
|
||||
|
||||
int reliableType = msg.ReadByte();
|
||||
|
||||
//idLib::Printf(" Received reliable msg: %i \n", reliableType );
|
||||
NET_VERBOSE_PRINT( " Received reliable msg: %i \n", reliableType );
|
||||
|
||||
const lobbyType_t actingGameStateLobbyType = GetActingGameStateLobbyType();
|
||||
|
||||
|
@ -3021,8 +3022,17 @@ void idLobby::HandleReliableMsg( int p, idBitMsg& msg )
|
|||
|
||||
// Get connection info
|
||||
lobbyConnectInfo_t connectInfo;
|
||||
|
||||
connectInfo.ReadFromMsg( msg );
|
||||
|
||||
// DG: if connectInfo.ip = 0.0.0.0 just use remoteAddress
|
||||
// i.e. the IP used to connect to the lobby
|
||||
if( remoteAddress && *( ( int* )connectInfo.netAddr.ip ) == 0 )
|
||||
{
|
||||
connectInfo.netAddr = remoteAddress->netAddr;
|
||||
}
|
||||
// DG end
|
||||
|
||||
const lobbyType_t destLobbyType = ( lobbyType_t )msg.ReadByte();
|
||||
const bool waitForMembers = msg.ReadBool();
|
||||
|
||||
|
|
|
@ -624,7 +624,7 @@ public: // Turning this on for now, for the sake of getting this up and running
|
|||
const char* GetPeerName( int peerNum ) const;
|
||||
virtual const char* GetHostUserName() const;
|
||||
|
||||
void HandleReliableMsg( int p, idBitMsg& msg );
|
||||
void HandleReliableMsg( int p, idBitMsg& msg, const lobbyAddress_t* remoteAddress = NULL );
|
||||
|
||||
// Bandwidth / Qos / Throttling
|
||||
void BeginBandwidthTest();
|
||||
|
|
|
@ -31,6 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "sys_lobby_backend_direct.h"
|
||||
|
||||
extern idCVar net_port;
|
||||
extern idCVar net_ip;
|
||||
|
||||
extern idLobbyToSessionCB* lobbyToSessionCB;
|
||||
|
||||
|
@ -101,12 +102,15 @@ void idLobbyBackendDirect::JoinFromConnectInfo( const lobbyConnectInfo_t& connec
|
|||
{
|
||||
if( lobbyToSessionCB->CanJoinLocalHost() )
|
||||
{
|
||||
// TODO: "CanJoinLocalHost" == *must* join LocalHost ?!
|
||||
Sys_StringToNetAdr( "localhost", &address, true );
|
||||
address.port = net_port.GetInteger();
|
||||
NET_VERBOSE_PRINT( "NET: idLobbyBackendDirect::JoinFromConnectInfo(): canJoinLocalHost\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
address = connectInfo.netAddr;
|
||||
NET_VERBOSE_PRINT( "NET: idLobbyBackendDirect::JoinFromConnectInfo(): %s\n", Sys_NetAdrToString( address ) );
|
||||
}
|
||||
|
||||
state = STATE_READY;
|
||||
|
@ -176,7 +180,16 @@ lobbyConnectInfo_t idLobbyBackendDirect::GetConnectInfo()
|
|||
if( IsHost() )
|
||||
{
|
||||
// If we are the host, give them our ip address
|
||||
const char* ip = Sys_GetLocalIP( 0 );
|
||||
// DG: always using the first IP doesn't work, because on linux that's 127.0.0.1
|
||||
// and even if not, this causes trouble with NAT.
|
||||
// So either use net_ip or, if it's not set ("localhost"), use 0.0.0.0 which is
|
||||
// a special case the client will treat as "just use the IP I used for the lobby"
|
||||
// (which is the right behavior for the Direct backend, I guess).
|
||||
// the client special case is in idLobby::HandleReliableMsg
|
||||
const char* ip = net_ip.GetString();
|
||||
if( ip == NULL || idStr::Length( ip ) == 0 || idStr::Icmp( ip, "localhost" ) == 0 )
|
||||
ip = "0.0.0.0";
|
||||
// DG end
|
||||
Sys_StringToNetAdr( ip, &address, false );
|
||||
address.port = net_port.GetInteger();
|
||||
}
|
||||
|
|
|
@ -432,7 +432,9 @@ void Sys_Init();
|
|||
void Sys_Shutdown();
|
||||
void Sys_Error( const char* error, ... );
|
||||
const char* Sys_GetCmdLine();
|
||||
void Sys_ReLaunch( void* launchData, unsigned int launchDataSize );
|
||||
// DG: Sys_ReLaunch() doesn't need any options (and the old way is painful for POSIX systems)
|
||||
void Sys_ReLaunch();
|
||||
// DG end
|
||||
void Sys_Launch( const char* path, idCmdArgs& args, void* launchData, unsigned int launchDataSize );
|
||||
void Sys_SetLanguageFromSystem();
|
||||
const char* Sys_DefaultLanguage();
|
||||
|
|
|
@ -58,7 +58,7 @@ idCVar net_testPartyMemberConnectFail( "net_testPartyMemberConnectFail", "-1", C
|
|||
//FIXME: this could use a better name.
|
||||
idCVar net_offlineTransitionThreshold( "net_offlineTransitionThreshold", "1000", CVAR_INTEGER, "Time, in milliseconds, to wait before kicking back to the main menu when a profile losses backend connection during an online game" );
|
||||
|
||||
idCVar net_port( "net_port", "27015", CVAR_INTEGER, "host port number" ); // Port to host when using dedicated servers, port to broadcast on when looking for a dedicated server to connect to
|
||||
idCVar net_port( "net_port", "27015", CVAR_INTEGER | CVAR_NOCHEAT, "host port number" ); // Port to host when using dedicated servers, port to broadcast on when looking for a dedicated server to connect to
|
||||
idCVar net_headlessServer( "net_headlessServer", "0", CVAR_BOOL, "toggle to automatically host a game and allow peer[0] to control menus" );
|
||||
|
||||
const char* idSessionLocal::stateToString[ NUM_STATES ] =
|
||||
|
@ -110,7 +110,7 @@ unsigned int NetGetVersionChecksum()
|
|||
CRC32_FinishChecksum( ret );
|
||||
|
||||
NET_VERBOSE_PRINT( "NetGetVersionChecksum - string : %s\n", netVersion.string );
|
||||
NET_VERBOSE_PRINT( "NetGetVersionChecksum - checksum : %i\n", ret );
|
||||
NET_VERBOSE_PRINT( "NetGetVersionChecksum - checksum : %u\n", ret );
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
@ -1591,7 +1591,7 @@ idSession::~idSession()
|
|||
dedicatedServerSearch = NULL;
|
||||
}
|
||||
|
||||
idCVar net_verbose( "net_verbose", "0", CVAR_BOOL, "Print a bunch of message about the network session" );
|
||||
idCVar net_verbose( "net_verbose", "0", CVAR_BOOL | CVAR_NOCHEAT, "Print a bunch of message about the network session" );
|
||||
idCVar net_verboseResource( "net_verboseResource", "0", CVAR_BOOL, "Prints a bunch of message about network resources" );
|
||||
idCVar net_verboseReliable( "net_verboseReliable", "0", CVAR_BOOL, "Prints the more spammy messages about reliable network msgs" );
|
||||
idCVar si_splitscreen( "si_splitscreen", "0", CVAR_INTEGER, "force splitscreen" );
|
||||
|
@ -4592,7 +4592,7 @@ void idSessionLocal::ListServersCommon()
|
|||
// Add the current version info to the query
|
||||
const unsigned int localChecksum = NetGetVersionChecksum(); // DG: use int instead of long for 64bit compatibility
|
||||
|
||||
NET_VERBOSE_PRINT( "ListServers: Hash checksum: %i, broadcasting to: %s\n", localChecksum, address.ToString() );
|
||||
NET_VERBOSE_PRINT( "ListServers: Hash checksum: %u, broadcasting to: %s\n", localChecksum, address.ToString() );
|
||||
|
||||
msg.WriteLong( localChecksum );
|
||||
|
||||
|
|
|
@ -30,15 +30,10 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#undef private
|
||||
#undef protected
|
||||
|
||||
// RB begin
|
||||
#if defined(_WIN32)
|
||||
#include "win32/win_achievements.h"
|
||||
#include "win32/win_signin.h"
|
||||
#else
|
||||
#include "posix/posix_achievements.h"
|
||||
#include "posix/posix_signin.h"
|
||||
#endif
|
||||
// RB end
|
||||
// DG: achievements and signin is the same on windows, linux => put them in common dir
|
||||
#include "common/achievements.h"
|
||||
#include "common/signin.h"
|
||||
// DG end
|
||||
|
||||
#include "sys_lobby_backend.h"
|
||||
#include "sys_lobby.h"
|
||||
|
|
|
@ -1468,14 +1468,6 @@ void GLimp_Shutdown()
|
|||
win32.cdsFullscreen = 0;
|
||||
}
|
||||
|
||||
// close the thread so the handle doesn't dangle
|
||||
if( win32.renderThreadHandle )
|
||||
{
|
||||
common->Printf( "...closing smp thread\n" );
|
||||
CloseHandle( win32.renderThreadHandle );
|
||||
win32.renderThreadHandle = NULL;
|
||||
}
|
||||
|
||||
// restore gamma
|
||||
GLimp_RestoreGamma();
|
||||
}
|
||||
|
@ -1512,201 +1504,5 @@ void GLimp_SwapBuffers()
|
|||
}
|
||||
// RB end
|
||||
|
||||
/*
|
||||
===========================================================
|
||||
|
||||
SMP acceleration
|
||||
|
||||
===========================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
===================
|
||||
GLimp_ActivateContext
|
||||
===================
|
||||
*/
|
||||
void GLimp_ActivateContext()
|
||||
{
|
||||
if( !wglMakeCurrent( win32.hDC, win32.hGLRC ) )
|
||||
{
|
||||
win32.wglErrors++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
GLimp_DeactivateContext
|
||||
===================
|
||||
*/
|
||||
void GLimp_DeactivateContext()
|
||||
{
|
||||
glFinish();
|
||||
if( !wglMakeCurrent( win32.hDC, NULL ) )
|
||||
{
|
||||
win32.wglErrors++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
GLimp_RenderThreadWrapper
|
||||
===================
|
||||
*/
|
||||
static void GLimp_RenderThreadWrapper()
|
||||
{
|
||||
win32.glimpRenderThread();
|
||||
|
||||
// unbind the context before we die
|
||||
wglMakeCurrent( win32.hDC, NULL );
|
||||
}
|
||||
|
||||
/*
|
||||
=======================
|
||||
GLimp_SpawnRenderThread
|
||||
|
||||
Returns false if the system only has a single processor
|
||||
=======================
|
||||
*/
|
||||
bool GLimp_SpawnRenderThread( void ( *function )() )
|
||||
{
|
||||
SYSTEM_INFO info;
|
||||
|
||||
// check number of processors
|
||||
GetSystemInfo( &info );
|
||||
if( info.dwNumberOfProcessors < 2 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// create the IPC elements
|
||||
win32.renderCommandsEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
|
||||
win32.renderCompletedEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
|
||||
win32.renderActiveEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
|
||||
|
||||
win32.glimpRenderThread = function;
|
||||
|
||||
win32.renderThreadHandle = CreateThread(
|
||||
NULL, // LPSECURITY_ATTRIBUTES lpsa,
|
||||
0, // DWORD cbStack,
|
||||
( LPTHREAD_START_ROUTINE )GLimp_RenderThreadWrapper, // LPTHREAD_START_ROUTINE lpStartAddr,
|
||||
0, // LPVOID lpvThreadParm,
|
||||
0, // DWORD fdwCreate,
|
||||
&win32.renderThreadId );
|
||||
|
||||
if( !win32.renderThreadHandle )
|
||||
{
|
||||
common->Error( "GLimp_SpawnRenderThread: failed" );
|
||||
}
|
||||
|
||||
SetThreadPriority( win32.renderThreadHandle, THREAD_PRIORITY_ABOVE_NORMAL );
|
||||
#if 0
|
||||
// make sure they always run on different processors
|
||||
SetThreadAffinityMask( GetCurrentThread, 1 );
|
||||
SetThreadAffinityMask( win32.renderThreadHandle, 2 );
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//#define DEBUG_PRINTS
|
||||
|
||||
/*
|
||||
===================
|
||||
GLimp_BackEndSleep
|
||||
===================
|
||||
*/
|
||||
void* GLimp_BackEndSleep()
|
||||
{
|
||||
void* data;
|
||||
|
||||
#ifdef DEBUG_PRINTS
|
||||
OutputDebugString( "-->GLimp_BackEndSleep\n" );
|
||||
#endif
|
||||
ResetEvent( win32.renderActiveEvent );
|
||||
|
||||
// after this, the front end can exit GLimp_FrontEndSleep
|
||||
SetEvent( win32.renderCompletedEvent );
|
||||
|
||||
WaitForSingleObject( win32.renderCommandsEvent, INFINITE );
|
||||
|
||||
ResetEvent( win32.renderCompletedEvent );
|
||||
ResetEvent( win32.renderCommandsEvent );
|
||||
|
||||
data = win32.smpData;
|
||||
|
||||
// after this, the main thread can exit GLimp_WakeRenderer
|
||||
SetEvent( win32.renderActiveEvent );
|
||||
|
||||
#ifdef DEBUG_PRINTS
|
||||
OutputDebugString( "<--GLimp_BackEndSleep\n" );
|
||||
#endif
|
||||
return data;
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
GLimp_FrontEndSleep
|
||||
===================
|
||||
*/
|
||||
void GLimp_FrontEndSleep()
|
||||
{
|
||||
#ifdef DEBUG_PRINTS
|
||||
OutputDebugString( "-->GLimp_FrontEndSleep\n" );
|
||||
#endif
|
||||
WaitForSingleObject( win32.renderCompletedEvent, INFINITE );
|
||||
|
||||
#ifdef DEBUG_PRINTS
|
||||
OutputDebugString( "<--GLimp_FrontEndSleep\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
volatile bool renderThreadActive;
|
||||
|
||||
/*
|
||||
===================
|
||||
GLimp_WakeBackEnd
|
||||
===================
|
||||
*/
|
||||
void GLimp_WakeBackEnd( void* data )
|
||||
{
|
||||
int r;
|
||||
|
||||
#ifdef DEBUG_PRINTS
|
||||
OutputDebugString( "-->GLimp_WakeBackEnd\n" );
|
||||
#endif
|
||||
win32.smpData = data;
|
||||
|
||||
if( renderThreadActive )
|
||||
{
|
||||
common->FatalError( "GLimp_WakeBackEnd: already active" );
|
||||
}
|
||||
|
||||
r = WaitForSingleObject( win32.renderActiveEvent, 0 );
|
||||
if( r == WAIT_OBJECT_0 )
|
||||
{
|
||||
common->FatalError( "GLimp_WakeBackEnd: already signaled" );
|
||||
}
|
||||
|
||||
r = WaitForSingleObject( win32.renderCommandsEvent, 0 );
|
||||
if( r == WAIT_OBJECT_0 )
|
||||
{
|
||||
common->FatalError( "GLimp_WakeBackEnd: commands already signaled" );
|
||||
}
|
||||
|
||||
// after this, the renderer can continue through GLimp_RendererSleep
|
||||
SetEvent( win32.renderCommandsEvent );
|
||||
|
||||
r = WaitForSingleObject( win32.renderActiveEvent, 5000 );
|
||||
|
||||
if( r == WAIT_TIMEOUT )
|
||||
{
|
||||
common->FatalError( "GLimp_WakeBackEnd: WAIT_TIMEOUT" );
|
||||
}
|
||||
|
||||
#ifdef DEBUG_PRINTS
|
||||
OutputDebugString( "<--GLimp_WakeBackEnd\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -132,16 +132,6 @@ typedef struct
|
|||
LPDIRECTINPUTDEVICE8 g_pKeyboard;
|
||||
idJoystickWin32 g_Joystick;
|
||||
|
||||
HANDLE renderCommandsEvent;
|
||||
HANDLE renderCompletedEvent;
|
||||
HANDLE renderActiveEvent;
|
||||
HANDLE renderThreadHandle;
|
||||
unsigned long renderThreadId;
|
||||
void ( *glimpRenderThread )();
|
||||
void* smpData;
|
||||
int wglErrors;
|
||||
// SMP acceleration vars
|
||||
|
||||
} Win32Vars_t;
|
||||
|
||||
extern Win32Vars_t win32;
|
||||
|
|
|
@ -290,7 +290,7 @@ const char * Sys_GetCmdLine() {
|
|||
Sys_ReLaunch
|
||||
========================
|
||||
*/
|
||||
void Sys_ReLaunch( void * data, const unsigned int dataSize ) {
|
||||
void Sys_ReLaunch() {
|
||||
TCHAR szPathOrig[MAX_PRINT_MSG];
|
||||
STARTUPINFO si;
|
||||
PROCESS_INFORMATION pi;
|
||||
|
@ -298,7 +298,17 @@ void Sys_ReLaunch( void * data, const unsigned int dataSize ) {
|
|||
ZeroMemory( &si, sizeof(si) );
|
||||
si.cb = sizeof(si);
|
||||
|
||||
strcpy( szPathOrig, va( "\"%s\" %s", Sys_EXEPath(), (const char *)data ) );
|
||||
// DG: we don't have function arguments in Sys_ReLaunch() anymore, everyone only passed
|
||||
// the command-line +" +set com_skipIntroVideos 1" anyway and it was painful on POSIX systems
|
||||
// so let's just add it here.
|
||||
idStr cmdLine = Sys_GetCmdLine();
|
||||
if( cmdLine.Find( "com_skipIntroVideos" ) < 0 )
|
||||
{
|
||||
cmdLine.Append( " +set com_skipIntroVideos 1" );
|
||||
}
|
||||
|
||||
strcpy( szPathOrig, va( "\"%s\" %s", Sys_EXEPath(), cmdLine.c_str() ) );
|
||||
// DG end
|
||||
|
||||
CloseHandle( hProcessMutex );
|
||||
|
||||
|
|
|
@ -1,750 +0,0 @@
|
|||
/*
|
||||
================================================================================================
|
||||
CONFIDENTIAL AND PROPRIETARY INFORMATION/NOT FOR DISCLOSURE WITHOUT WRITTEN PERMISSION
|
||||
Copyright 2010 id Software LLC, a ZeniMax Media company. All Rights Reserved.
|
||||
================================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
================================================================================================
|
||||
|
||||
Contains the windows implementation of the network session
|
||||
|
||||
================================================================================================
|
||||
*/
|
||||
|
||||
#pragma hdrstop
|
||||
#include "precompiled.h"
|
||||
#include "../../framework/Common_local.h"
|
||||
#include "../sys_session_local.h"
|
||||
#include "../sys_stats.h"
|
||||
#include "../sys_savegame.h"
|
||||
#include "../sys_lobby_backend_direct.h"
|
||||
#include "../sys_voicechat.h"
|
||||
#include "win_achievements.h"
|
||||
#include "win_local.h"
|
||||
|
||||
/*
|
||||
========================
|
||||
Global variables
|
||||
========================
|
||||
*/
|
||||
|
||||
extern idCVar net_port;
|
||||
|
||||
class idLobbyToSessionCBLocal;
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::idSessionLocalWin
|
||||
========================
|
||||
*/
|
||||
class idSessionLocalWin : public idSessionLocal
|
||||
{
|
||||
friend class idLobbyToSessionCBLocal;
|
||||
|
||||
public:
|
||||
idSessionLocalWin();
|
||||
virtual ~idSessionLocalWin();
|
||||
|
||||
// idSessionLocal interface
|
||||
virtual void Initialize();
|
||||
virtual void Shutdown();
|
||||
|
||||
virtual void InitializeSoundRelatedSystems();
|
||||
virtual void ShutdownSoundRelatedSystems();
|
||||
|
||||
virtual void PlatformPump();
|
||||
|
||||
virtual void InviteFriends();
|
||||
virtual void InviteParty();
|
||||
virtual void ShowPartySessions();
|
||||
|
||||
virtual void ShowSystemMarketplaceUI() const;
|
||||
|
||||
virtual void ListServers( const idCallback& callback );
|
||||
virtual void CancelListServers();
|
||||
virtual int NumServers() const;
|
||||
virtual const serverInfo_t* ServerInfo( int i ) const;
|
||||
virtual void ConnectToServer( int i );
|
||||
virtual void ShowServerGamerCardUI( int i );
|
||||
|
||||
virtual void ShowLobbyUserGamerCardUI( lobbyUserID_t lobbyUserID );
|
||||
|
||||
virtual void ShowOnlineSignin() {}
|
||||
virtual void UpdateRichPresence() {}
|
||||
virtual void CheckVoicePrivileges() {}
|
||||
|
||||
virtual bool ProcessInputEvent( const sysEvent_t* ev );
|
||||
|
||||
// System UI
|
||||
virtual bool IsSystemUIShowing() const;
|
||||
virtual void SetSystemUIShowing( bool show );
|
||||
|
||||
// Invites
|
||||
virtual void HandleBootableInvite( int64 lobbyId = 0 );
|
||||
virtual void ClearBootableInvite();
|
||||
virtual void ClearPendingInvite();
|
||||
|
||||
virtual bool HasPendingBootableInvite();
|
||||
virtual void SetDiscSwapMPInvite( void* parm );
|
||||
virtual void* GetDiscSwapMPInviteParms();
|
||||
|
||||
virtual void EnumerateDownloadableContent();
|
||||
|
||||
virtual void HandleServerQueryRequest( lobbyAddress_t& remoteAddr, idBitMsg& msg, int msgType );
|
||||
virtual void HandleServerQueryAck( lobbyAddress_t& remoteAddr, idBitMsg& msg );
|
||||
|
||||
// Leaderboards
|
||||
virtual void LeaderboardUpload( lobbyUserID_t lobbyUserID, const leaderboardDefinition_t* leaderboard, const column_t* stats, const idFile_Memory* attachment = NULL );
|
||||
virtual void LeaderboardDownload( int sessionUserIndex, const leaderboardDefinition_t* leaderboard, int startingRank, int numRows, const idLeaderboardCallback& callback );
|
||||
virtual void LeaderboardDownloadAttachment( int sessionUserIndex, const leaderboardDefinition_t* leaderboard, int64 attachmentID );
|
||||
|
||||
// Scoring (currently just for TrueSkill)
|
||||
virtual void SetLobbyUserRelativeScore( lobbyUserID_t lobbyUserID, int relativeScore, int team ) {}
|
||||
|
||||
virtual void LeaderboardFlush();
|
||||
|
||||
virtual idNetSessionPort& GetPort( bool dedicated = false );
|
||||
virtual idLobbyBackend* CreateLobbyBackend( const idMatchParameters& p, float skillLevel, idLobbyBackend::lobbyBackendType_t lobbyType );
|
||||
virtual idLobbyBackend* FindLobbyBackend( const idMatchParameters& p, int numPartyUsers, float skillLevel, idLobbyBackend::lobbyBackendType_t lobbyType );
|
||||
virtual idLobbyBackend* JoinFromConnectInfo( const lobbyConnectInfo_t& connectInfo , idLobbyBackend::lobbyBackendType_t lobbyType );
|
||||
virtual void DestroyLobbyBackend( idLobbyBackend* lobbyBackend );
|
||||
virtual void PumpLobbies();
|
||||
virtual void JoinAfterSwap( void* joinID );
|
||||
|
||||
virtual bool GetLobbyAddressFromNetAddress( const netadr_t& netAddr, lobbyAddress_t& outAddr ) const;
|
||||
virtual bool GetNetAddressFromLobbyAddress( const lobbyAddress_t& lobbyAddress, netadr_t& outNetAddr ) const;
|
||||
|
||||
public:
|
||||
void Connect_f( const idCmdArgs& args );
|
||||
|
||||
private:
|
||||
void EnsurePort();
|
||||
|
||||
idLobbyBackend* CreateLobbyInternal( idLobbyBackend::lobbyBackendType_t lobbyType );
|
||||
|
||||
idArray< idLobbyBackend*, 3 > lobbyBackends;
|
||||
|
||||
idNetSessionPort port;
|
||||
bool canJoinLocalHost;
|
||||
|
||||
idLobbyToSessionCBLocal* lobbyToSessionCB;
|
||||
};
|
||||
|
||||
idSessionLocalWin sessionLocalWin;
|
||||
idSession* session = &sessionLocalWin;
|
||||
|
||||
/*
|
||||
========================
|
||||
idLobbyToSessionCBLocal
|
||||
========================
|
||||
*/
|
||||
class idLobbyToSessionCBLocal : public idLobbyToSessionCB
|
||||
{
|
||||
public:
|
||||
idLobbyToSessionCBLocal( idSessionLocalWin* sessionLocalWin_ ) : sessionLocalWin( sessionLocalWin_ ) { }
|
||||
|
||||
virtual bool CanJoinLocalHost() const
|
||||
{
|
||||
sessionLocalWin->EnsurePort();
|
||||
return sessionLocalWin->canJoinLocalHost;
|
||||
}
|
||||
virtual class idLobbyBackend* GetLobbyBackend( idLobbyBackend::lobbyBackendType_t type ) const
|
||||
{
|
||||
return sessionLocalWin->lobbyBackends[ type ];
|
||||
}
|
||||
|
||||
private:
|
||||
idSessionLocalWin* sessionLocalWin;
|
||||
};
|
||||
|
||||
idLobbyToSessionCBLocal lobbyToSessionCBLocal( &sessionLocalWin );
|
||||
idLobbyToSessionCB* lobbyToSessionCB = &lobbyToSessionCBLocal;
|
||||
|
||||
class idVoiceChatMgrWin : public idVoiceChatMgr
|
||||
{
|
||||
public:
|
||||
virtual bool GetLocalChatDataInternal( int talkerIndex, byte* data, int& dataSize )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual void SubmitIncomingChatDataInternal( int talkerIndex, const byte* data, int dataSize ) { }
|
||||
virtual bool TalkerHasData( int talkerIndex )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual bool RegisterTalkerInternal( int index )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
virtual void UnregisterTalkerInternal( int index ) { }
|
||||
};
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::idSessionLocalWin
|
||||
========================
|
||||
*/
|
||||
idSessionLocalWin::idSessionLocalWin()
|
||||
{
|
||||
signInManager = new( TAG_SYSTEM ) idSignInManagerWin;
|
||||
saveGameManager = new( TAG_SAVEGAMES ) idSaveGameManager();
|
||||
voiceChat = new( TAG_SYSTEM ) idVoiceChatMgrWin();
|
||||
lobbyToSessionCB = new( TAG_SYSTEM ) idLobbyToSessionCBLocal( this );
|
||||
|
||||
canJoinLocalHost = false;
|
||||
|
||||
lobbyBackends.Zero();
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::idSessionLocalWin
|
||||
========================
|
||||
*/
|
||||
idSessionLocalWin::~idSessionLocalWin()
|
||||
{
|
||||
delete voiceChat;
|
||||
delete lobbyToSessionCB;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::Initialize
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::Initialize()
|
||||
{
|
||||
idSessionLocal::Initialize();
|
||||
|
||||
// The shipping path doesn't load title storage
|
||||
// Instead, we inject values through code which is protected through steam DRM
|
||||
titleStorageVars.Set( "MAX_PLAYERS_ALLOWED", "8" );
|
||||
titleStorageLoaded = true;
|
||||
|
||||
// First-time check for downloadable content once game is launched
|
||||
EnumerateDownloadableContent();
|
||||
|
||||
GetPartyLobby().Initialize( idLobby::TYPE_PARTY, sessionCallbacks );
|
||||
GetGameLobby().Initialize( idLobby::TYPE_GAME, sessionCallbacks );
|
||||
GetGameStateLobby().Initialize( idLobby::TYPE_GAME_STATE, sessionCallbacks );
|
||||
|
||||
achievementSystem = new( TAG_SYSTEM ) idAchievementSystemWin();
|
||||
achievementSystem->Init();
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::Shutdown
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::Shutdown()
|
||||
{
|
||||
NET_VERBOSE_PRINT( "NET: Shutdown\n" );
|
||||
idSessionLocal::Shutdown();
|
||||
|
||||
MoveToMainMenu();
|
||||
|
||||
// Wait until we fully shutdown
|
||||
while( localState != STATE_IDLE && localState != STATE_PRESS_START )
|
||||
{
|
||||
Pump();
|
||||
}
|
||||
|
||||
if( achievementSystem != NULL )
|
||||
{
|
||||
achievementSystem->Shutdown();
|
||||
delete achievementSystem;
|
||||
achievementSystem = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::InitializeSoundRelatedSystems
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::InitializeSoundRelatedSystems()
|
||||
{
|
||||
if( voiceChat != NULL )
|
||||
{
|
||||
voiceChat->Init( NULL );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::ShutdownSoundRelatedSystems
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::ShutdownSoundRelatedSystems()
|
||||
{
|
||||
if( voiceChat != NULL )
|
||||
{
|
||||
voiceChat->Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::PlatformPump
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::PlatformPump()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::InviteFriends
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::InviteFriends()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::InviteParty
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::InviteParty()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::ShowPartySessions
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::ShowPartySessions()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::ShowSystemMarketplaceUI
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::ShowSystemMarketplaceUI() const
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::ListServers
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::ListServers( const idCallback& callback )
|
||||
{
|
||||
ListServersCommon();
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::CancelListServers
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::CancelListServers()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::NumServers
|
||||
========================
|
||||
*/
|
||||
int idSessionLocalWin::NumServers() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::ServerInfo
|
||||
========================
|
||||
*/
|
||||
const serverInfo_t* idSessionLocalWin::ServerInfo( int i ) const
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::ConnectToServer
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::ConnectToServer( int i )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::Connect_f
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::Connect_f( const idCmdArgs& args )
|
||||
{
|
||||
if( args.Argc() < 2 )
|
||||
{
|
||||
idLib::Printf( "Usage: Connect to IP. Use with net_port. \n" );
|
||||
return;
|
||||
}
|
||||
|
||||
Cancel();
|
||||
|
||||
if( signInManager->GetMasterLocalUser() == NULL )
|
||||
{
|
||||
signInManager->RegisterLocalUser( 0 );
|
||||
}
|
||||
|
||||
lobbyConnectInfo_t connectInfo;
|
||||
|
||||
Sys_StringToNetAdr( args.Argv( 1 ), &connectInfo.netAddr, true );
|
||||
connectInfo.netAddr.port = net_port.GetInteger();
|
||||
|
||||
ConnectAndMoveToLobby( GetPartyLobby(), connectInfo, false );
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
void Connect_f
|
||||
========================
|
||||
*/
|
||||
CONSOLE_COMMAND( connect, "Connect to the specified IP", NULL )
|
||||
{
|
||||
sessionLocalWin.Connect_f( args );
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::ShowServerGamerCardUI
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::ShowServerGamerCardUI( int i )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::ShowLobbyUserGamerCardUI(
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::ShowLobbyUserGamerCardUI( lobbyUserID_t lobbyUserID )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::ProcessInputEvent
|
||||
========================
|
||||
*/
|
||||
bool idSessionLocalWin::ProcessInputEvent( const sysEvent_t* ev )
|
||||
{
|
||||
if( GetSignInManager().ProcessInputEvent( ev ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::IsSystemUIShowing
|
||||
========================
|
||||
*/
|
||||
bool idSessionLocalWin::IsSystemUIShowing() const
|
||||
{
|
||||
// DG: wtf, !win32.activeApp doesn't belong here, this is totally confusing and hacky.
|
||||
// pause (when losing focus or invoking explicitly) is now handled properly by com_pause
|
||||
return isSysUIShowing;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::SetSystemUIShowing
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::SetSystemUIShowing( bool show )
|
||||
{
|
||||
isSysUIShowing = show;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::HandleServerQueryRequest
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::HandleServerQueryRequest( lobbyAddress_t& remoteAddr, idBitMsg& msg, int msgType )
|
||||
{
|
||||
NET_VERBOSE_PRINT( "HandleServerQueryRequest from %s\n", remoteAddr.ToString() );
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::HandleServerQueryAck
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::HandleServerQueryAck( lobbyAddress_t& remoteAddr, idBitMsg& msg )
|
||||
{
|
||||
NET_VERBOSE_PRINT( "HandleServerQueryAck from %s\n", remoteAddr.ToString() );
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::ClearBootableInvite
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::ClearBootableInvite()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::ClearPendingInvite
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::ClearPendingInvite()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::HandleBootableInvite
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::HandleBootableInvite( int64 lobbyId )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::HasPendingBootableInvite
|
||||
========================
|
||||
*/
|
||||
bool idSessionLocalWin::HasPendingBootableInvite()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocal::SetDiscSwapMPInvite
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::SetDiscSwapMPInvite( void* parm )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocal::GetDiscSwapMPInviteParms
|
||||
========================
|
||||
*/
|
||||
void* idSessionLocalWin::GetDiscSwapMPInviteParms()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::EnumerateDownloadableContent
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::EnumerateDownloadableContent()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::LeaderboardUpload
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::LeaderboardUpload( lobbyUserID_t lobbyUserID, const leaderboardDefinition_t* leaderboard, const column_t* stats, const idFile_Memory* attachment )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::LeaderboardFlush
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::LeaderboardFlush()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::LeaderboardDownload
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::LeaderboardDownload( int sessionUserIndex, const leaderboardDefinition_t* leaderboard, int startingRank, int numRows, const idLeaderboardCallback& callback )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::LeaderboardDownloadAttachment
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::LeaderboardDownloadAttachment( int sessionUserIndex, const leaderboardDefinition_t* leaderboard, int64 attachmentID )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::EnsurePort
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::EnsurePort()
|
||||
{
|
||||
// Init the port using reqular windows sockets
|
||||
if( port.IsOpen() )
|
||||
{
|
||||
return; // Already initialized
|
||||
}
|
||||
|
||||
if( port.InitPort( net_port.GetInteger(), false ) )
|
||||
{
|
||||
canJoinLocalHost = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Assume this is another instantiation on the same machine, and just init using any available port
|
||||
port.InitPort( PORT_ANY, false );
|
||||
canJoinLocalHost = true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::GetPort
|
||||
========================
|
||||
*/
|
||||
idNetSessionPort& idSessionLocalWin::GetPort( bool dedicated )
|
||||
{
|
||||
EnsurePort();
|
||||
return port;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::CreateLobbyBackend
|
||||
========================
|
||||
*/
|
||||
idLobbyBackend* idSessionLocalWin::CreateLobbyBackend( const idMatchParameters& p, float skillLevel, idLobbyBackend::lobbyBackendType_t lobbyType )
|
||||
{
|
||||
idLobbyBackend* lobbyBackend = CreateLobbyInternal( lobbyType );
|
||||
lobbyBackend->StartHosting( p, skillLevel, lobbyType );
|
||||
return lobbyBackend;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::FindLobbyBackend
|
||||
========================
|
||||
*/
|
||||
idLobbyBackend* idSessionLocalWin::FindLobbyBackend( const idMatchParameters& p, int numPartyUsers, float skillLevel, idLobbyBackend::lobbyBackendType_t lobbyType )
|
||||
{
|
||||
idLobbyBackend* lobbyBackend = CreateLobbyInternal( lobbyType );
|
||||
lobbyBackend->StartFinding( p, numPartyUsers, skillLevel );
|
||||
return lobbyBackend;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::JoinFromConnectInfo
|
||||
========================
|
||||
*/
|
||||
idLobbyBackend* idSessionLocalWin::JoinFromConnectInfo( const lobbyConnectInfo_t& connectInfo, idLobbyBackend::lobbyBackendType_t lobbyType )
|
||||
{
|
||||
idLobbyBackend* lobbyBackend = CreateLobbyInternal( lobbyType );
|
||||
lobbyBackend->JoinFromConnectInfo( connectInfo );
|
||||
return lobbyBackend;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::DestroyLobbyBackend
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::DestroyLobbyBackend( idLobbyBackend* lobbyBackend )
|
||||
{
|
||||
assert( lobbyBackend != NULL );
|
||||
assert( lobbyBackends[lobbyBackend->GetLobbyType()] == lobbyBackend );
|
||||
|
||||
lobbyBackends[lobbyBackend->GetLobbyType()] = NULL;
|
||||
|
||||
lobbyBackend->Shutdown();
|
||||
delete lobbyBackend;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::PumpLobbies
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::PumpLobbies()
|
||||
{
|
||||
assert( lobbyBackends[idLobbyBackend::TYPE_PARTY] == NULL || lobbyBackends[idLobbyBackend::TYPE_PARTY]->GetLobbyType() == idLobbyBackend::TYPE_PARTY );
|
||||
assert( lobbyBackends[idLobbyBackend::TYPE_GAME] == NULL || lobbyBackends[idLobbyBackend::TYPE_GAME]->GetLobbyType() == idLobbyBackend::TYPE_GAME );
|
||||
assert( lobbyBackends[idLobbyBackend::TYPE_GAME_STATE] == NULL || lobbyBackends[idLobbyBackend::TYPE_GAME_STATE]->GetLobbyType() == idLobbyBackend::TYPE_GAME_STATE );
|
||||
|
||||
// Pump lobbyBackends
|
||||
for( int i = 0; i < lobbyBackends.Num(); i++ )
|
||||
{
|
||||
if( lobbyBackends[i] != NULL )
|
||||
{
|
||||
lobbyBackends[i]->Pump();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::CreateLobbyInternal
|
||||
========================
|
||||
*/
|
||||
idLobbyBackend* idSessionLocalWin::CreateLobbyInternal( idLobbyBackend::lobbyBackendType_t lobbyType )
|
||||
{
|
||||
EnsurePort();
|
||||
idLobbyBackend* lobbyBackend = new( TAG_NETWORKING ) idLobbyBackendDirect();
|
||||
|
||||
lobbyBackend->SetLobbyType( lobbyType );
|
||||
|
||||
assert( lobbyBackends[lobbyType] == NULL );
|
||||
lobbyBackends[lobbyType] = lobbyBackend;
|
||||
|
||||
return lobbyBackend;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::JoinAfterSwap
|
||||
========================
|
||||
*/
|
||||
void idSessionLocalWin::JoinAfterSwap( void* joinID )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::GetLobbyAddressFromNetAddress
|
||||
========================
|
||||
*/
|
||||
bool idSessionLocalWin::GetLobbyAddressFromNetAddress( const netadr_t& netAddr, lobbyAddress_t& outAddr ) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idSessionLocalWin::GetNetAddressFromLobbyAddress
|
||||
========================
|
||||
*/
|
||||
bool idSessionLocalWin::GetNetAddressFromLobbyAddress( const lobbyAddress_t& lobbyAddress, netadr_t& outNetAddr ) const
|
||||
{
|
||||
return false;
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
#ifndef __WIN_SIGNIN_H__
|
||||
#define __WIN_SIGNIN_H__
|
||||
|
||||
#include "win_localuser.h"
|
||||
|
||||
/*
|
||||
================================================
|
||||
idSignInManagerWin
|
||||
================================================
|
||||
*/
|
||||
class idSignInManagerWin : public idSignInManagerBase
|
||||
{
|
||||
public:
|
||||
|
||||
idSignInManagerWin() : dlcVersionChecked( false ) {}
|
||||
virtual ~idSignInManagerWin() {}
|
||||
|
||||
//==========================================================================================
|
||||
// idSignInManagerBase interface
|
||||
//==========================================================================================
|
||||
virtual void Pump();
|
||||
virtual void Shutdown();
|
||||
virtual int GetNumLocalUsers() const
|
||||
{
|
||||
return localUsers.Num();
|
||||
}
|
||||
virtual idLocalUser* GetLocalUserByIndex( int index )
|
||||
{
|
||||
return &localUsers[index];
|
||||
}
|
||||
virtual const idLocalUser* GetLocalUserByIndex( int index ) const
|
||||
{
|
||||
return &localUsers[index];
|
||||
}
|
||||
virtual void RemoveLocalUserByIndex( int index );
|
||||
virtual void RegisterLocalUser( int inputDevice ); // Register a local user to the passed in controller
|
||||
|
||||
bool CreateNewUser( winUserState_t& state );
|
||||
|
||||
private:
|
||||
idStaticList< idLocalUserWin, MAX_INPUT_DEVICES > localUsers;
|
||||
bool dlcVersionChecked;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue