mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Add dedicated server build
This commit is contained in:
parent
fa690e0190
commit
77e83ddebb
12 changed files with 2379 additions and 3 deletions
18
src/Makefile.d/dedicated.mk
Normal file
18
src/Makefile.d/dedicated.mk
Normal file
|
@ -0,0 +1,18 @@
|
|||
makedir:=$(makedir)/Dedicated
|
||||
|
||||
sources+=$(call List,dedicated/Sourcefile)
|
||||
|
||||
opts+=-DDEDICATED
|
||||
|
||||
ifdef FREEBSD
|
||||
# on FreeBSD, we have to link to libpthread explicitly
|
||||
libs+=-lpthread
|
||||
endif
|
||||
|
||||
ifndef NOTHREADS
|
||||
opts+=-DHAVE_THREADS
|
||||
sources+=dedicated/i_threads.c
|
||||
endif
|
||||
|
||||
NOOPENMPT=1
|
||||
NOHW=1
|
|
@ -65,6 +65,8 @@ endif
|
|||
|
||||
ifeq ($(SDL), 1)
|
||||
include Makefile.d/sdl.mk
|
||||
else ifeq ($(DEDICATED), 1)
|
||||
include Makefile.d/dedicated.mk
|
||||
else
|
||||
include Makefile.d/dummy.mk
|
||||
endif
|
||||
|
|
|
@ -1295,7 +1295,7 @@ void D_SRB2Main(void)
|
|||
#endif
|
||||
|
||||
// for dedicated server
|
||||
#if !defined (_WINDOWS) //already check in win_main.c
|
||||
#if !defined (_WINDOWS) && !defined (DEDICATED) //already check in win_main.c
|
||||
dedicated = M_CheckParm("-dedicated") != 0;
|
||||
#endif
|
||||
|
||||
|
|
5
src/dedicated/Sourcefile
Normal file
5
src/dedicated/Sourcefile
Normal file
|
@ -0,0 +1,5 @@
|
|||
i_net.c
|
||||
i_system.c
|
||||
i_main.c
|
||||
i_video.c
|
||||
i_sound.c
|
189
src/dedicated/i_main.c
Normal file
189
src/dedicated/i_main.c
Normal file
|
@ -0,0 +1,189 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2023 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file d_main.c
|
||||
/// \brief Main program, simply calls D_SRB2Main and D_SRB2Loop, the high level loop.
|
||||
|
||||
#include "../doomdef.h"
|
||||
#include "../m_argv.h"
|
||||
#include "../d_main.h"
|
||||
#include "../m_misc.h"/* path shit */
|
||||
#include "../i_system.h"
|
||||
#include "../netcode/d_clisrv.h"
|
||||
|
||||
#if defined (__GNUC__) || defined (__unix__)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
#include "time.h" // For log timestamps
|
||||
|
||||
#ifdef LOGMESSAGES
|
||||
FILE *logstream = NULL;
|
||||
char logfilename[1024];
|
||||
#endif
|
||||
|
||||
#ifndef DOXYGEN
|
||||
#ifndef O_TEXT
|
||||
#define O_TEXT 0
|
||||
#endif
|
||||
|
||||
#ifndef O_SEQUENTIAL
|
||||
#define O_SEQUENTIAL 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (_WIN32)
|
||||
#include "../win32/win_dbg.h"
|
||||
typedef BOOL (WINAPI *p_IsDebuggerPresent)(VOID);
|
||||
#endif
|
||||
|
||||
#ifdef LOGMESSAGES
|
||||
static void InitLogging(void)
|
||||
{
|
||||
const char *logdir = NULL;
|
||||
time_t my_time;
|
||||
struct tm * timeinfo;
|
||||
const char *format;
|
||||
const char *reldir;
|
||||
int left;
|
||||
boolean fileabs;
|
||||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
|
||||
const char *link;
|
||||
#endif
|
||||
|
||||
logdir = D_Home();
|
||||
|
||||
my_time = time(NULL);
|
||||
timeinfo = localtime(&my_time);
|
||||
|
||||
if (M_CheckParm("-logfile") && M_IsNextParm())
|
||||
{
|
||||
format = M_GetNextParm();
|
||||
fileabs = M_IsPathAbsolute(format);
|
||||
}
|
||||
else
|
||||
{
|
||||
format = "log-%Y-%m-%d_%H-%M-%S.txt";
|
||||
fileabs = false;
|
||||
}
|
||||
|
||||
if (fileabs)
|
||||
{
|
||||
strftime(logfilename, sizeof logfilename, format, timeinfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (M_CheckParm("-logdir") && M_IsNextParm())
|
||||
reldir = M_GetNextParm();
|
||||
else
|
||||
reldir = "logs";
|
||||
|
||||
if (M_IsPathAbsolute(reldir))
|
||||
{
|
||||
left = snprintf(logfilename, sizeof logfilename,
|
||||
"%s"PATHSEP, reldir);
|
||||
}
|
||||
else
|
||||
#ifdef DEFAULTDIR
|
||||
if (logdir)
|
||||
{
|
||||
left = snprintf(logfilename, sizeof logfilename,
|
||||
"%s"PATHSEP DEFAULTDIR PATHSEP"%s"PATHSEP, logdir, reldir);
|
||||
}
|
||||
else
|
||||
#endif/*DEFAULTDIR*/
|
||||
{
|
||||
left = snprintf(logfilename, sizeof logfilename,
|
||||
"."PATHSEP"%s"PATHSEP, reldir);
|
||||
}
|
||||
|
||||
strftime(&logfilename[left], sizeof logfilename - left,
|
||||
format, timeinfo);
|
||||
}
|
||||
|
||||
M_MkdirEachUntil(logfilename,
|
||||
M_PathParts(logdir) - 1,
|
||||
M_PathParts(logfilename) - 1, 0755);
|
||||
|
||||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
|
||||
logstream = fopen(logfilename, "w");
|
||||
#ifdef DEFAULTDIR
|
||||
if (logdir)
|
||||
link = va("%s/"DEFAULTDIR"/latest-log.txt", logdir);
|
||||
else
|
||||
#endif/*DEFAULTDIR*/
|
||||
link = "latest-log.txt";
|
||||
unlink(link);
|
||||
if (symlink(logfilename, link) == -1)
|
||||
{
|
||||
I_OutputMsg("Error symlinking latest-log.txt: %s\n", strerror(errno));
|
||||
}
|
||||
#else/*defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)*/
|
||||
logstream = fopen("latest-log.txt", "wt+");
|
||||
#endif/*defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)*/
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/** \brief The main function
|
||||
|
||||
\param argc number of arg
|
||||
\param *argv string table
|
||||
|
||||
\return int
|
||||
*/
|
||||
#if defined (__GNUC__) && (__GNUC__ >= 4)
|
||||
#pragma GCC diagnostic ignored "-Wmissing-noreturn"
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
myargc = argc;
|
||||
myargv = argv; /// \todo pull out path to exe from this string
|
||||
|
||||
dedicated = true;
|
||||
|
||||
#ifdef LOGMESSAGES
|
||||
if (!M_CheckParm("-nolog"))
|
||||
InitLogging();
|
||||
#endif/*LOGMESSAGES*/
|
||||
|
||||
//I_OutputMsg("I_StartupSystem() ...\n");
|
||||
I_StartupSystem();
|
||||
#if defined (_WIN32)
|
||||
LoadLibraryA("exchndl.dll");
|
||||
#ifndef __MINGW32__
|
||||
prevExceptionFilter = SetUnhandledExceptionFilter(RecordExceptionInfo);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// startup SRB2
|
||||
CONS_Printf("Setting up SRB2...\n");
|
||||
D_SRB2Main();
|
||||
#ifdef LOGMESSAGES
|
||||
if (!M_CheckParm("-nolog"))
|
||||
CONS_Printf("Logfile: %s\n", logfilename);
|
||||
#endif
|
||||
CONS_Printf("Entering main game loop...\n");
|
||||
// never return
|
||||
D_SRB2Loop();
|
||||
|
||||
#ifdef BUGTRAP
|
||||
// This is safe even if BT didn't start.
|
||||
ShutdownBugTrap();
|
||||
#endif
|
||||
|
||||
// return to OS
|
||||
return 0;
|
||||
}
|
7
src/dedicated/i_net.c
Normal file
7
src/dedicated/i_net.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include "../netcode/i_net.h"
|
||||
|
||||
boolean I_InitNetwork(void)
|
||||
{
|
||||
// NOTE: this is no longer used.
|
||||
return false;
|
||||
}
|
214
src/dedicated/i_sound.c
Normal file
214
src/dedicated/i_sound.c
Normal file
|
@ -0,0 +1,214 @@
|
|||
#include "../i_sound.h"
|
||||
|
||||
UINT8 sound_started = 0;
|
||||
|
||||
void *I_GetSfx(sfxinfo_t *sfx)
|
||||
{
|
||||
(void)sfx;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void I_FreeSfx(sfxinfo_t *sfx)
|
||||
{
|
||||
(void)sfx;
|
||||
}
|
||||
|
||||
void I_StartupSound(void){}
|
||||
|
||||
void I_ShutdownSound(void){}
|
||||
|
||||
void I_UpdateSound(void){};
|
||||
|
||||
//
|
||||
// SFX I/O
|
||||
//
|
||||
|
||||
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel)
|
||||
{
|
||||
(void)id;
|
||||
(void)vol;
|
||||
(void)sep;
|
||||
(void)pitch;
|
||||
(void)priority;
|
||||
(void)channel;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void I_StopSound(INT32 handle)
|
||||
{
|
||||
(void)handle;
|
||||
}
|
||||
|
||||
boolean I_SoundIsPlaying(INT32 handle)
|
||||
{
|
||||
(void)handle;
|
||||
return false;
|
||||
}
|
||||
|
||||
void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep, UINT8 pitch)
|
||||
{
|
||||
(void)handle;
|
||||
(void)vol;
|
||||
(void)sep;
|
||||
(void)pitch;
|
||||
}
|
||||
|
||||
void I_SetSfxVolume(UINT8 volume)
|
||||
{
|
||||
(void)volume;
|
||||
}
|
||||
|
||||
/// ------------------------
|
||||
// MUSIC SYSTEM
|
||||
/// ------------------------
|
||||
|
||||
void I_InitMusic(void){}
|
||||
|
||||
void I_ShutdownMusic(void){}
|
||||
|
||||
/// ------------------------
|
||||
// MUSIC PROPERTIES
|
||||
/// ------------------------
|
||||
|
||||
musictype_t I_SongType(void)
|
||||
{
|
||||
return MU_NONE;
|
||||
}
|
||||
|
||||
boolean I_SongPlaying(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean I_SongPaused(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ------------------------
|
||||
// MUSIC EFFECTS
|
||||
/// ------------------------
|
||||
|
||||
boolean I_SetSongSpeed(float speed)
|
||||
{
|
||||
(void)speed;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ------------------------
|
||||
// MUSIC SEEKING
|
||||
/// ------------------------
|
||||
|
||||
UINT32 I_GetSongLength(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
boolean I_SetSongLoopPoint(UINT32 looppoint)
|
||||
{
|
||||
(void)looppoint;
|
||||
return false;
|
||||
}
|
||||
|
||||
UINT32 I_GetSongLoopPoint(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
boolean I_SetSongPosition(UINT32 position)
|
||||
{
|
||||
(void)position;
|
||||
return false;
|
||||
}
|
||||
|
||||
UINT32 I_GetSongPosition(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// ------------------------
|
||||
// MUSIC PLAYBACK
|
||||
/// ------------------------
|
||||
|
||||
boolean I_LoadSong(char *data, size_t len)
|
||||
{
|
||||
(void)data;
|
||||
(void)len;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void I_UnloadSong(void)
|
||||
{
|
||||
}
|
||||
|
||||
boolean I_PlaySong(boolean looping)
|
||||
{
|
||||
(void)looping;
|
||||
return false;
|
||||
}
|
||||
|
||||
void I_StopSong(void)
|
||||
{
|
||||
}
|
||||
|
||||
void I_PauseSong(void)
|
||||
{
|
||||
}
|
||||
|
||||
void I_ResumeSong(void)
|
||||
{
|
||||
}
|
||||
|
||||
void I_SetMusicVolume(UINT8 volume)
|
||||
{
|
||||
(void)volume;
|
||||
}
|
||||
|
||||
boolean I_SetSongTrack(INT32 track)
|
||||
{
|
||||
(void)track;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ------------------------
|
||||
// MUSIC FADING
|
||||
/// ------------------------
|
||||
|
||||
void I_SetInternalMusicVolume(UINT8 volume)
|
||||
{
|
||||
(void)volume;
|
||||
}
|
||||
|
||||
void I_StopFadingSong(void)
|
||||
{
|
||||
}
|
||||
|
||||
boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms, void (*callback)(void))
|
||||
{
|
||||
(void)target_volume;
|
||||
(void)source_volume;
|
||||
(void)ms;
|
||||
(void)callback;
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean I_FadeSong(UINT8 target_volume, UINT32 ms, void (*callback)(void))
|
||||
{
|
||||
(void)target_volume;
|
||||
(void)ms;
|
||||
(void)callback;
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean I_FadeOutStopSong(UINT32 ms)
|
||||
{
|
||||
(void)ms;
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean I_FadeInPlaySong(UINT32 ms, boolean looping)
|
||||
{
|
||||
(void)ms;
|
||||
(void)looping;
|
||||
return false;
|
||||
}
|
1524
src/dedicated/i_system.c
Normal file
1524
src/dedicated/i_system.c
Normal file
File diff suppressed because it is too large
Load diff
333
src/dedicated/i_threads.c
Normal file
333
src/dedicated/i_threads.c
Normal file
|
@ -0,0 +1,333 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2020-2023 by James R.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file i_threads.c
|
||||
/// \brief Multithreading abstraction
|
||||
|
||||
#if defined (__unix__) || (!defined(__APPLE__) && defined (UNIXCOMMON))
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include "../i_threads.h"
|
||||
#include "../doomdef.h"
|
||||
#include "../doomtype.h"
|
||||
|
||||
typedef struct thread_s thread_t;
|
||||
|
||||
struct thread_s
|
||||
{
|
||||
thread_t *next;
|
||||
void *userdata;
|
||||
I_thread_fn func;
|
||||
pthread_t thread;
|
||||
};
|
||||
|
||||
// we use a linked list to avoid moving memory blocks when allocating new threads.
|
||||
static thread_t *thread_list;
|
||||
static pthread_mutex_t thread_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
static void *HandleThread(void *data)
|
||||
{
|
||||
thread_t *thread = data;
|
||||
thread->func(thread->userdata);
|
||||
|
||||
pthread_mutex_lock(&thread_lock);
|
||||
thread->func = NULL;
|
||||
pthread_mutex_unlock(&thread_lock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void I_spawn_thread(const char *name, I_thread_fn entry, void *userdata)
|
||||
{
|
||||
thread_t *thread;
|
||||
(void)name;
|
||||
pthread_mutex_lock(&thread_lock);
|
||||
thread = thread_list;
|
||||
while (thread != NULL)
|
||||
{
|
||||
if (thread->func == NULL)
|
||||
{
|
||||
// join with the exited thread to release it's resources.
|
||||
pthread_join(thread->thread, NULL);
|
||||
break;
|
||||
}
|
||||
thread = thread->next;
|
||||
}
|
||||
if (thread == NULL)
|
||||
{
|
||||
thread = malloc(sizeof(thread_t));
|
||||
thread->next = thread_list;
|
||||
thread_list = thread;
|
||||
}
|
||||
|
||||
thread->func = entry;
|
||||
thread->userdata = userdata;
|
||||
pthread_create(&thread->thread, NULL, HandleThread, thread);
|
||||
pthread_mutex_unlock(&thread_lock);
|
||||
}
|
||||
|
||||
int I_thread_is_stopped(void)
|
||||
{
|
||||
thread_t *thread;
|
||||
pthread_mutex_lock(&thread_lock);
|
||||
thread = thread_list;
|
||||
while (thread != NULL)
|
||||
{
|
||||
if (thread->func != NULL)
|
||||
{
|
||||
pthread_mutex_unlock(&thread_lock);
|
||||
return false;
|
||||
}
|
||||
thread = thread->next;
|
||||
}
|
||||
pthread_mutex_unlock(&thread_lock);
|
||||
return true;
|
||||
}
|
||||
|
||||
void I_start_threads(void)
|
||||
{
|
||||
}
|
||||
|
||||
void I_stop_threads(void)
|
||||
{
|
||||
thread_t *thread = thread_list;
|
||||
while (thread != NULL)
|
||||
{
|
||||
// join with all threads here, since finished threads haven't been awaited yet.
|
||||
pthread_join(thread->thread, NULL);
|
||||
thread = thread->next;
|
||||
}
|
||||
}
|
||||
|
||||
void I_lock_mutex(I_mutex *anchor)
|
||||
{
|
||||
if (*anchor == NULL)
|
||||
{
|
||||
pthread_mutexattr_t attr;
|
||||
pthread_mutexattr_init(&attr);
|
||||
|
||||
// SRB2 relies on lock recursion, so we need a mutex configured for that.
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
||||
*anchor = malloc(sizeof(pthread_mutex_t));
|
||||
pthread_mutex_init(*anchor, &attr);
|
||||
pthread_mutexattr_destroy(&attr);
|
||||
}
|
||||
pthread_mutex_lock(*anchor);
|
||||
}
|
||||
|
||||
void I_unlock_mutex(I_mutex id)
|
||||
{
|
||||
pthread_mutex_unlock(id);
|
||||
}
|
||||
|
||||
void I_hold_cond(I_cond *cond_anchor, I_mutex mutex_id)
|
||||
{
|
||||
I_Assert(mutex_id != NULL);
|
||||
if (*cond_anchor == NULL)
|
||||
{
|
||||
*cond_anchor = malloc(sizeof(pthread_cond_t));
|
||||
pthread_cond_init(*cond_anchor, NULL);
|
||||
}
|
||||
pthread_cond_wait(*cond_anchor, mutex_id);
|
||||
}
|
||||
|
||||
void I_wake_one_cond(I_cond *anchor)
|
||||
{
|
||||
if (*anchor == NULL)
|
||||
{
|
||||
*anchor = malloc(sizeof(pthread_cond_t));
|
||||
pthread_cond_init(*anchor, NULL);
|
||||
}
|
||||
pthread_cond_signal(*anchor);
|
||||
}
|
||||
|
||||
void I_wake_all_cond(I_cond *anchor)
|
||||
{
|
||||
if (*anchor == NULL)
|
||||
{
|
||||
*anchor = malloc(sizeof(pthread_t));
|
||||
pthread_cond_init(*anchor, NULL);
|
||||
}
|
||||
pthread_cond_broadcast(*anchor);
|
||||
}
|
||||
#elif defined (_WIN32)
|
||||
#include <windows.h>
|
||||
|
||||
#include "../i_threads.h"
|
||||
#include "../doomdef.h"
|
||||
#include "../doomtype.h"
|
||||
|
||||
typedef struct thread_s thread_t;
|
||||
|
||||
struct thread_s
|
||||
{
|
||||
thread_t *next;
|
||||
void *userdata;
|
||||
I_thread_fn func;
|
||||
HANDLE thread;
|
||||
DWORD thread_id;
|
||||
};
|
||||
|
||||
// we use a linked list to avoid moving memory blocks when allocating new threads.
|
||||
static thread_t *thread_list;
|
||||
static CRITICAL_SECTION thread_lock;
|
||||
|
||||
static DWORD HandleThread(void *data)
|
||||
{
|
||||
thread_t *thread = data;
|
||||
thread->func(thread->userdata);
|
||||
|
||||
EnterCriticalSection(&thread_lock);
|
||||
thread->func = NULL;
|
||||
LeaveCriticalSection(&thread_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void I_spawn_thread(const char *name, I_thread_fn entry, void *userdata)
|
||||
{
|
||||
thread_t *thread;
|
||||
(void)name;
|
||||
EnterCriticalSection(&thread_lock);
|
||||
thread = thread_list;
|
||||
while (thread != NULL)
|
||||
{
|
||||
if (thread->func == NULL)
|
||||
{
|
||||
CloseHandle(thread->thread);
|
||||
break;
|
||||
}
|
||||
thread = thread->next;
|
||||
}
|
||||
if (thread == NULL)
|
||||
{
|
||||
thread = malloc(sizeof(thread_t));
|
||||
thread->next = thread_list;
|
||||
thread_list = thread;
|
||||
}
|
||||
|
||||
thread->func = entry;
|
||||
thread->userdata = userdata;
|
||||
thread->thread = CreateThread(NULL, 0, HandleThread, thread, 0, &thread->thread_id);
|
||||
LeaveCriticalSection(&thread_lock);
|
||||
}
|
||||
|
||||
int I_thread_is_stopped(void)
|
||||
{
|
||||
thread_t *thread;
|
||||
EnterCriticalSection(&thread_lock);
|
||||
thread = thread_list;
|
||||
while (thread != NULL)
|
||||
{
|
||||
if (thread->func != NULL)
|
||||
{
|
||||
LeaveCriticalSection(&thread_lock);
|
||||
return false;
|
||||
}
|
||||
thread = thread->next;
|
||||
}
|
||||
LeaveCriticalSection(&thread_lock);
|
||||
return true;
|
||||
}
|
||||
|
||||
void I_start_threads(void)
|
||||
{
|
||||
InitializeCriticalSection(&thread_lock);
|
||||
}
|
||||
|
||||
void I_stop_threads(void)
|
||||
{
|
||||
thread_t *thread = thread_list;
|
||||
while (thread != NULL)
|
||||
{
|
||||
WaitForSingleObject(thread->thread, INFINITE);
|
||||
CloseHandle(thread->thread);
|
||||
thread = thread->next;
|
||||
}
|
||||
DeleteCriticalSection(&thread_lock);
|
||||
}
|
||||
|
||||
void I_lock_mutex(I_mutex *anchor)
|
||||
{
|
||||
if (*anchor == NULL)
|
||||
{
|
||||
*anchor = malloc(sizeof(CRITICAL_SECTION));
|
||||
InitializeCriticalSection(*anchor);
|
||||
}
|
||||
EnterCriticalSection(*anchor);
|
||||
}
|
||||
|
||||
void I_unlock_mutex(I_mutex id)
|
||||
{
|
||||
LeaveCriticalSection(id);
|
||||
}
|
||||
|
||||
void I_hold_cond(I_cond *cond_anchor, I_mutex mutex_id)
|
||||
{
|
||||
I_Assert(mutex_id != NULL);
|
||||
if (*cond_anchor == NULL)
|
||||
{
|
||||
*cond_anchor = malloc(sizeof(CONDITION_VARIABLE));
|
||||
InitializeConditionVariable(*cond_anchor);
|
||||
}
|
||||
SleepConditionVariableCS(*cond_anchor, mutex_id, INFINITE);
|
||||
}
|
||||
|
||||
void I_wake_one_cond(I_cond *anchor)
|
||||
{
|
||||
WakeConditionVariable(*anchor);
|
||||
}
|
||||
|
||||
void I_wake_all_cond(I_cond *anchor)
|
||||
{
|
||||
WakeAllConditionVariable(*anchor);
|
||||
}
|
||||
#else
|
||||
void I_spawn_thread(const char *name, I_thread_fn entry, void *userdata)
|
||||
{
|
||||
(void)name;
|
||||
entry(userdata);
|
||||
}
|
||||
|
||||
int I_thread_is_stopped(void)
|
||||
{
|
||||
}
|
||||
|
||||
void I_start_threads(void)
|
||||
{
|
||||
}
|
||||
|
||||
void I_stop_threads(void)
|
||||
{
|
||||
}
|
||||
|
||||
void I_lock_mutex(I_mutex *anchor)
|
||||
{
|
||||
(void)anchor;
|
||||
}
|
||||
|
||||
void I_unlock_mutex(I_mutex id)
|
||||
{
|
||||
(void)id;
|
||||
}
|
||||
|
||||
void I_hold_cond(I_cond *cond_anchor, I_mutex mutex_id)
|
||||
{
|
||||
(void)cond_anchor;
|
||||
(void)mutex_id;
|
||||
}
|
||||
|
||||
void I_wake_one_cond(I_cond *anchor)
|
||||
{
|
||||
(void)anchor;
|
||||
}
|
||||
|
||||
void I_wake_all_cond(I_cond *anchor)
|
||||
{
|
||||
(void)anchor;
|
||||
}
|
||||
#endif
|
81
src/dedicated/i_video.c
Normal file
81
src/dedicated/i_video.c
Normal file
|
@ -0,0 +1,81 @@
|
|||
#include "../doomdef.h"
|
||||
#include "../command.h"
|
||||
#include "../i_video.h"
|
||||
|
||||
rendermode_t rendermode = render_none;
|
||||
rendermode_t chosenrendermode = render_none;
|
||||
|
||||
boolean highcolor = false;
|
||||
|
||||
boolean allow_fullscreen = false;
|
||||
|
||||
consvar_t cv_vidwait = CVAR_INIT ("vid_wait", "On", CV_SAVE, CV_OnOff, NULL);
|
||||
|
||||
void I_StartupGraphics(void){}
|
||||
void I_ShutdownGraphics(void){}
|
||||
|
||||
void VID_StartupOpenGL(void){}
|
||||
|
||||
void I_SetPalette(RGBA_t *palette)
|
||||
{
|
||||
(void)palette;
|
||||
}
|
||||
|
||||
INT32 VID_NumModes(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
INT32 VID_GetModeForSize(INT32 w, INT32 h)
|
||||
{
|
||||
(void)w;
|
||||
(void)h;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void VID_PrepareModeList(void){}
|
||||
|
||||
INT32 VID_SetMode(INT32 modenum)
|
||||
{
|
||||
(void)modenum;
|
||||
return 0;
|
||||
}
|
||||
|
||||
boolean VID_CheckRenderer(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void VID_CheckGLLoaded(rendermode_t oldrender)
|
||||
{
|
||||
(void)oldrender;
|
||||
}
|
||||
|
||||
const char *VID_GetModeName(INT32 modenum)
|
||||
{
|
||||
(void)modenum;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
UINT32 I_GetRefreshRate(void) { return 35; }
|
||||
|
||||
void I_UpdateNoBlit(void){}
|
||||
|
||||
void I_FinishUpdate(void){}
|
||||
|
||||
void I_UpdateNoVsync(void) {}
|
||||
|
||||
void I_WaitVBL(INT32 count)
|
||||
{
|
||||
(void)count;
|
||||
}
|
||||
|
||||
void I_ReadScreen(UINT8 *scr)
|
||||
{
|
||||
(void)scr;
|
||||
}
|
||||
|
||||
void I_BeginRead(void){}
|
||||
|
||||
void I_EndRead(void){}
|
||||
|
|
@ -6488,7 +6488,6 @@ static CV_PossibleValue_t glfiltermode_cons_t[]= {{HWD_SET_TEXTUREFILTER_POINTSA
|
|||
CV_PossibleValue_t glanisotropicmode_cons_t[] = {{1, "MIN"}, {16, "MAX"}, {0, NULL}};
|
||||
|
||||
consvar_t cv_glshaders = CVAR_INIT ("gr_shaders", "On", CV_SAVE, glshaders_cons_t, NULL);
|
||||
consvar_t cv_glallowshaders = CVAR_INIT ("gr_allowclientshaders", "On", CV_NETVAR, CV_OnOff, NULL);
|
||||
|
||||
#ifdef ALAM_LIGHTING
|
||||
consvar_t cv_gldynamiclighting = CVAR_INIT ("gr_dynamiclighting", "On", CV_SAVE, CV_OnOff, NULL);
|
||||
|
@ -6547,7 +6546,6 @@ void HWR_AddCommands(void)
|
|||
CV_RegisterVar(&cv_glfakecontrast);
|
||||
CV_RegisterVar(&cv_glshearing);
|
||||
CV_RegisterVar(&cv_glshaders);
|
||||
CV_RegisterVar(&cv_glallowshaders);
|
||||
|
||||
CV_RegisterVar(&cv_glfiltermode);
|
||||
CV_RegisterVar(&cv_glanisotropicmode);
|
||||
|
|
|
@ -393,6 +393,9 @@ consvar_t cv_ps_descriptor = CVAR_INIT ("ps_descriptor", "Average", 0, ps_descri
|
|||
|
||||
consvar_t cv_freedemocamera = CVAR_INIT("freedemocamera", "Off", CV_SAVE, CV_OnOff, NULL);
|
||||
|
||||
// NOTE: this should be in hw_main.c, but we can't put it there as it breaks dedicated build
|
||||
consvar_t cv_glallowshaders = CVAR_INIT ("gr_allowclientshaders", "On", CV_NETVAR, CV_OnOff, NULL);
|
||||
|
||||
char timedemo_name[256];
|
||||
boolean timedemo_csv;
|
||||
char timedemo_csv_id[256];
|
||||
|
@ -526,6 +529,8 @@ void D_RegisterServerCommands(void)
|
|||
// for master server connection
|
||||
AddMServCommands();
|
||||
|
||||
CV_RegisterVar(&cv_glallowshaders);
|
||||
|
||||
// p_mobj.c
|
||||
CV_RegisterVar(&cv_itemrespawntime);
|
||||
CV_RegisterVar(&cv_itemrespawn);
|
||||
|
|
Loading…
Reference in a new issue