Make dummy compile again, if SDL is explicitly set to 0

This commit is contained in:
GoldenTails 2022-10-10 00:30:23 -05:00
parent 892ffbe01b
commit ba55947ee6
9 changed files with 35 additions and 19 deletions

View file

@ -31,8 +31,8 @@
# MINGW=1, MINGW64=1 - Windows (MinGW toolchain) # MINGW=1, MINGW64=1 - Windows (MinGW toolchain)
# UNIX=1 - Generic Unix like system # UNIX=1 - Generic Unix like system
# FREEBSD=1 # FREEBSD=1
# SDL=1 - Use SDL backend. SDL is the only backend though # SDL=1 - Use SDL backend. SDL is the only implemented backend though.
# and thus, always enabled. # If disabled, a dummy backend will be used.
# #
# A list of supported GCC versions can be found in # A list of supported GCC versions can be found in
# Makefile.d/detect.mk -- search 'gcc_versions'. # Makefile.d/detect.mk -- search 'gcc_versions'.

View file

@ -17,7 +17,6 @@ all_systems:=\
UNIX\ UNIX\
LINUX\ LINUX\
FREEBSD\ FREEBSD\
SDL\
# check for user specified system # check for user specified system
ifeq (,$(filter $(all_systems),$(.VARIABLES))) ifeq (,$(filter $(all_systems),$(.VARIABLES)))

View file

@ -18,7 +18,7 @@ opts+=-I/usr/X11R6/include
libs+=-L/usr/X11R6/lib libs+=-L/usr/X11R6/lib
endif endif
SDL=1 SDL?=1
# In common usage. # In common usage.
ifdef LINUX ifdef LINUX

View file

@ -64,6 +64,8 @@ ifdef UNIX
include Makefile.d/nix.mk include Makefile.d/nix.mk
endif endif
ifdef SDL ifeq ($(SDL), 1)
include Makefile.d/sdl.mk include Makefile.d/sdl.mk
else
include Makefile.d/dummy.mk
endif endif

View file

@ -19,7 +19,7 @@ libs+=-ladvapi32 -lkernel32 -lmsvcrt -luser32
nasm_format:=win32 nasm_format:=win32
SDL=1 SDL?=1
ifndef NOHW ifndef NOHW
opts+=-DUSE_WGL_SWAP opts+=-DUSE_WGL_SWAP
@ -76,6 +76,7 @@ else
lib:=../libs/SDL2_mixer/$(mingw) lib:=../libs/SDL2_mixer/$(mingw)
endif endif
ifdef SDL2
mixer_opts:=-I$(lib)/include/SDL2 mixer_opts:=-I$(lib)/include/SDL2
mixer_libs:=-L$(lib)/lib mixer_libs:=-L$(lib)/lib
@ -85,6 +86,7 @@ SDL_opts:=-I$(lib)/include/SDL2\
SDL_libs:=-L$(lib)/lib $(mixer_libs)\ SDL_libs:=-L$(lib)/lib $(mixer_libs)\
-lmingw32 -lSDL2main -lSDL2 -mwindows -lmingw32 -lSDL2main -lSDL2 -mwindows
$(eval $(call _set,SDL)) $(eval $(call _set,SDL))
endif
lib:=../libs/zlib lib:=../libs/zlib
ZLIB_opts:=-I$(lib) ZLIB_opts:=-I$(lib)

View file

@ -392,8 +392,6 @@ unset_bit_array (bitarray_t * const array, const int value)
array[value >> 3] &= ~(1<<(value & 7)); array[value >> 3] &= ~(1<<(value & 7));
} }
#ifdef HAVE_SDL
typedef UINT64 precise_t; typedef UINT64 precise_t;
#endif
#endif //__DOOMTYPE__ #endif //__DOOMTYPE__

5
src/dummy/Sourcefile Normal file
View file

@ -0,0 +1,5 @@
i_net.c
i_system.c
i_main.c
i_video.c
i_sound.c

View file

@ -139,29 +139,24 @@ boolean I_LoadSong(char *data, size_t len)
void I_UnloadSong(void) void I_UnloadSong(void)
{ {
(void)handle;
} }
boolean I_PlaySong(boolean looping) boolean I_PlaySong(boolean looping)
{ {
(void)handle;
(void)looping; (void)looping;
return false; return false;
} }
void I_StopSong(void) void I_StopSong(void)
{ {
(void)handle;
} }
void I_PauseSong(void) void I_PauseSong(void)
{ {
(void)handle;
} }
void I_ResumeSong(void) void I_ResumeSong(void)
{ {
(void)handle;
} }
void I_SetMusicVolume(UINT8 volume) void I_SetMusicVolume(UINT8 volume)
@ -188,18 +183,20 @@ void I_StopFadingSong(void)
{ {
} }
boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms, void (*callback)(void)); boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms, void (*callback)(void))
{ {
(void)target_volume; (void)target_volume;
(void)source_volume; (void)source_volume;
(void)ms; (void)ms;
(void)callback;
return false; return false;
} }
boolean I_FadeSong(UINT8 target_volume, UINT32 ms, void (*callback)(void)); boolean I_FadeSong(UINT8 target_volume, UINT32 ms, void (*callback)(void))
{ {
(void)target_volume; (void)target_volume;
(void)ms; (void)ms;
(void)callback;
return false; return false;
} }

View file

@ -1,6 +1,9 @@
#include "../doomdef.h" #include "../doomdef.h"
#include "../doomtype.h"
#include "../i_system.h" #include "../i_system.h"
FILE *logstream = NULL;
UINT8 graphics_started = 0; UINT8 graphics_started = 0;
UINT8 keyboard_started = 0; UINT8 keyboard_started = 0;
@ -16,11 +19,17 @@ tic_t I_GetTime(void)
return 0; return 0;
} }
int I_GetTimeMicros(void) precise_t I_GetPreciseTime(void)
{ {
return 0; return 0;
} }
int I_PreciseToMicros(precise_t d)
{
(void)d;
return 0;
}
void I_Sleep(void){} void I_Sleep(void){}
void I_GetEvent(void){} void I_GetEvent(void){}
@ -96,8 +105,6 @@ void I_StartupMouse(void){}
void I_StartupMouse2(void){} void I_StartupMouse2(void){}
void I_StartupKeyboard(void){}
INT32 I_GetKey(void) INT32 I_GetKey(void)
{ {
return 0; return 0;
@ -176,12 +183,18 @@ INT32 I_ClipboardCopy(const char *data, size_t size)
return -1; return -1;
} }
char *I_ClipboardPaste(void) const char *I_ClipboardPaste(void)
{ {
return NULL; return NULL;
} }
void I_RegisterSysCommands(void) {} void I_RegisterSysCommands(void) {}
void I_GetCursorPosition(INT32 *x, INT32 *y)
{
(void)x;
(void)y;
}
#include "../sdl/dosstr.c" #include "../sdl/dosstr.c"