Merge branch 'master' into next
16
SRB2.cbp
|
@ -33,7 +33,7 @@ HW3SOUND for 3D hardware sound support
|
|||
<Add option="-g" />
|
||||
<Add option="`sdl-config --cflags`" />
|
||||
<Add option="-DDIRECTFULLSCREEN" />
|
||||
<Add option="-DSDL" />
|
||||
<Add option="-DHAVE_SDL" />
|
||||
<Add option="-DPARANOIA" />
|
||||
<Add option="-DRANGECHECK" />
|
||||
<Add option="-D_DEBUG" />
|
||||
|
@ -56,7 +56,7 @@ HW3SOUND for 3D hardware sound support
|
|||
<Add option="-g" />
|
||||
<Add option="`sdl-config --cflags`" />
|
||||
<Add option="-DDIRECTFULLSCREEN" />
|
||||
<Add option="-DSDL" />
|
||||
<Add option="-DHAVE_SDL" />
|
||||
<Add option="-DNDEBUG" />
|
||||
<Add option="-DCOMPVERSION" />
|
||||
<Add option="-DHAVE_BLUA" />
|
||||
|
@ -77,7 +77,7 @@ HW3SOUND for 3D hardware sound support
|
|||
<Add option="`sdl-config --cflags`" />
|
||||
<Add option="`libpng-config --cflags`" />
|
||||
<Add option="-DDIRECTFULLSCREEN" />
|
||||
<Add option="-DSDL" />
|
||||
<Add option="-DHAVE_SDL" />
|
||||
<Add option="-DHAVE_MIXER" />
|
||||
<Add option="-DHWRENDER" />
|
||||
<Add option="-DHW3SOUND" />
|
||||
|
@ -107,7 +107,7 @@ HW3SOUND for 3D hardware sound support
|
|||
<Add option="`sdl-config --cflags`" />
|
||||
<Add option="`libpng-config --cflags`" />
|
||||
<Add option="-DDIRECTFULLSCREEN" />
|
||||
<Add option="-DSDL" />
|
||||
<Add option="-DHAVE_SDL" />
|
||||
<Add option="-DHAVE_MIXER" />
|
||||
<Add option="-DHWRENDER" />
|
||||
<Add option="-DHW3SOUND" />
|
||||
|
@ -138,7 +138,7 @@ HW3SOUND for 3D hardware sound support
|
|||
<Add option="-D__USE_MINGW_ANSI_STDIO=0" />
|
||||
<Add option="-DUSE_WGL_SWAP" />
|
||||
<Add option="-DDIRECTFULLSCREEN" />
|
||||
<Add option="-DSDL" />
|
||||
<Add option="-DHAVE_SDL" />
|
||||
<Add option="-DHAVE_MIXER" />
|
||||
<Add option="-DHWRENDER" />
|
||||
<Add option="-DHW3SOUND" />
|
||||
|
@ -185,7 +185,7 @@ HW3SOUND for 3D hardware sound support
|
|||
<Add option="-D__USE_MINGW_ANSI_STDIO=0" />
|
||||
<Add option="-DUSE_WGL_SWAP" />
|
||||
<Add option="-DDIRECTFULLSCREEN" />
|
||||
<Add option="-DSDL" />
|
||||
<Add option="-DHAVE_SDL" />
|
||||
<Add option="-DHAVE_MIXER" />
|
||||
<Add option="-DHAVE_FMOD" />
|
||||
<Add option="-DHWRENDER" />
|
||||
|
@ -551,7 +551,7 @@ HW3SOUND for 3D hardware sound support
|
|||
<Add option="-DSTDC_HEADERS" />
|
||||
<Add option="-DUSE_WGL_SWAP" />
|
||||
<Add option="-DDIRECTFULLSCREEN" />
|
||||
<Add option="-DSDL" />
|
||||
<Add option="-DHAVE_SDL" />
|
||||
<Add option="-DHAVE_MIXER" />
|
||||
<Add option="-DHWRENDER" />
|
||||
<Add option="-DHW3SOUND" />
|
||||
|
@ -592,7 +592,7 @@ HW3SOUND for 3D hardware sound support
|
|||
<Add option="-DSTDC_HEADERS" />
|
||||
<Add option="-DUSE_WGL_SWAP" />
|
||||
<Add option="-DDIRECTFULLSCREEN" />
|
||||
<Add option="-DSDL" />
|
||||
<Add option="-DHAVE_SDL" />
|
||||
<Add option="-DHAVE_MIXER" />
|
||||
<Add option="-DHWRENDER" />
|
||||
<Add option="-DHW3SOUND" />
|
||||
|
|
8
Srb2.dev
|
@ -2228,7 +2228,7 @@ Includes=libs/libpng-src;libs/zlib;libs
|
|||
Libs=libs/libpng-src/projects;libs/zlib/win32;libs/miniupnpc/mingw32
|
||||
ResourceIncludes=src/win32
|
||||
MakeIncludes=comptime.mk;cpdebug.mk
|
||||
Compiler=-DNDEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-Os_@@_-g_@@_-gdwarf-2_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DSDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_
|
||||
Compiler=-DNDEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-Os_@@_-g_@@_-gdwarf-2_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DHAVE_SDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_
|
||||
CppCompiler=-Os_@@_-g_@@_-gdwarf-2_@@_
|
||||
Linker=-lSDL_@@_-lSDL_Mixer_@@_-lpng32_@@_-lz32_@@_-lminiupnpc_@@_-lws2_32_@@_-liphlpapi_@@_-mconsole_@@_
|
||||
PreprocDefines=NORMALSRB2_@@_
|
||||
|
@ -2305,7 +2305,7 @@ Includes=libs/libpng-src;libs/zlib;libs
|
|||
Libs=libs/libpng-src/projects;libs/zlib/win32;libs/miniupnpc/mingw32
|
||||
ResourceIncludes=src/win32
|
||||
MakeIncludes=comptime.mk;cpdebug.mk
|
||||
Compiler=-D_DEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-O0_@@_-g_@@_-gdwarf-2_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DSDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_
|
||||
Compiler=-D_DEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-O0_@@_-g_@@_-gdwarf-2_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DHAVE_SDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_
|
||||
CppCompiler=-O0_@@_-g_@@_-gdwarf-2_@@_
|
||||
Linker=-lSDL_@@_-lSDL_Mixer_@@_-lpng32_@@_-lz32_@@_-lminiupnpc_@@_-lws2_32_@@_-liphlpapi_@@_-mconsole_@@_
|
||||
PreprocDefines=NORMALSRB2_@@_
|
||||
|
@ -2386,7 +2386,7 @@ Includes=libs/libpng-src;libs/zlib;libs
|
|||
Libs=libs/libpng-src/projects;libs/zlib/win32;libs/miniupnpc/mingw64
|
||||
ResourceIncludes=src/win32
|
||||
MakeIncludes=comptime.mk;cpdebug.mk
|
||||
Compiler=-DNDEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-Os_@@_-g_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DSDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_
|
||||
Compiler=-DNDEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-Os_@@_-g_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DHAVE_SDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_
|
||||
CppCompiler=-Os_@@_-g_@@_
|
||||
Linker=-lSDL_@@_-lSDL_Mixer_@@_-lpng64_@@_-lz64_@@_-lminiupnpc_@@_-lws2_32_@@_-liphlpapi_@@_-mconsole_@@_
|
||||
PreprocDefines=NORMALSRB2_@@_
|
||||
|
@ -2413,7 +2413,7 @@ Includes=libs/libpng-src;libs/zlib;libs
|
|||
Libs=libs/libpng-src/projects;libs/zlib/win32;libs/miniupnpc/mingw64
|
||||
ResourceIncludes=src/win32
|
||||
MakeIncludes=comptime.mk;cpdebug.mk
|
||||
Compiler=-D_DEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-O0_@@_-g_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DSDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_
|
||||
Compiler=-D_DEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-O0_@@_-g_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DHAVE_SDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_
|
||||
CppCompiler=-O0_@@_-g_@@_
|
||||
Linker=-lSDL_@@_-lSDL_Mixer_@@_-lpng64_@@_-lz64_@@_-lminiupnpc_@@_-lws2_32_@@_-liphlpapi_@@_-mconsole_@@_
|
||||
PreprocDefines=NORMALSRB2_@@_
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# -DPC_DOS -> use DOS specific code (eg:textmode stuff)...
|
||||
# -DLINUX -> use for the GNU/Linux specific
|
||||
# -D_WINDOWS -> use for the Win32/DirectX specific
|
||||
# -DSDL -> use for the SDL interface
|
||||
# -DHAVE_SDL -> use for the SDL interface
|
||||
#
|
||||
# Sets:
|
||||
# Compile the DGJPP/DOS version with 'make WATTCP=1'
|
||||
|
|
|
@ -230,7 +230,6 @@ ifdef DUMMY
|
|||
BIN:=$(BIN)/dummy
|
||||
else
|
||||
ifdef LINUX
|
||||
INTERFACE=sdl
|
||||
NASMFORMAT=elf -DLINUX
|
||||
SDL=1
|
||||
ifndef NOGETTEXT
|
||||
|
|
|
@ -1139,7 +1139,7 @@ void CONS_Printf(const char *fmt, ...)
|
|||
// if not in display loop, force screen update
|
||||
if (con_startup)
|
||||
{
|
||||
#if (defined (_WINDOWS)) || (defined (__OS2__) && !defined (SDL))
|
||||
#if (defined (_WINDOWS)) || (defined (__OS2__) && !defined (HAVE_SDL))
|
||||
static lumpnum_t con_backpic_lumpnum = UINT32_MAX;
|
||||
patch_t *con_backpic;
|
||||
|
||||
|
|
10
src/d_main.c
|
@ -731,7 +731,7 @@ static void IdentifyVersion(void)
|
|||
char *srb2wad1, *srb2wad2;
|
||||
const char *srb2waddir = NULL;
|
||||
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL)
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||
// change to the directory where 'srb2.srb' is found
|
||||
srb2waddir = I_LocateWad();
|
||||
#endif
|
||||
|
@ -757,7 +757,7 @@ static void IdentifyVersion(void)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined (macintosh) && !defined (SDL)
|
||||
#if defined (macintosh) && !defined (HAVE_SDL)
|
||||
// cwd is always "/" when app is dbl-clicked
|
||||
if (!stricmp(srb2waddir, "/"))
|
||||
srb2waddir = I_GetWadDir();
|
||||
|
@ -804,7 +804,7 @@ static void IdentifyVersion(void)
|
|||
// Add our crappy patches to fix our bugs
|
||||
D_AddFile(va(pandf,srb2waddir,"patch.dta"));
|
||||
|
||||
#if !defined (SDL) || defined (HAVE_MIXER)
|
||||
#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
|
||||
{
|
||||
#if defined (DC) && 0
|
||||
const char *musicfile = "music_dc.dta";
|
||||
|
@ -929,7 +929,7 @@ void D_SRB2Main(void)
|
|||
D_Titlebar(srb2, title);
|
||||
#endif
|
||||
|
||||
#if defined (__OS2__) && !defined (SDL)
|
||||
#if defined (__OS2__) && !defined (HAVE_SDL)
|
||||
// set PM window title
|
||||
snprintf(pmData->title, sizeof (pmData->title),
|
||||
"Sonic Robo Blast 2" VERSIONSTRING ": %s",
|
||||
|
@ -1136,7 +1136,7 @@ void D_SRB2Main(void)
|
|||
|
||||
G_LoadGameData();
|
||||
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL)
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||
VID_PrepareModeList(); // Regenerate Modelist according to cv_fullscreen
|
||||
#endif
|
||||
|
||||
|
|
|
@ -258,7 +258,7 @@ consvar_t cv_usejoystick = {"use_joystick", "0", CV_SAVE|CV_CALL, usejoystick_co
|
|||
consvar_t cv_usejoystick2 = {"use_joystick2", "0", CV_SAVE|CV_CALL, usejoystick_cons_t,
|
||||
I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL};
|
||||
#endif
|
||||
#if (defined (LJOYSTICK) || defined (SDL))
|
||||
#if (defined (LJOYSTICK) || defined (HAVE_SDL))
|
||||
#ifdef LJOYSTICK
|
||||
consvar_t cv_joyport = {"joyport", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_joyport2 = {"joyport2", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; //Alam: for later
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#define SOUND_FMOD 3
|
||||
|
||||
#ifndef SOUND
|
||||
#ifdef SDL
|
||||
#ifdef HAVE_SDL
|
||||
|
||||
// Use Mixer interface?
|
||||
#ifdef HAVE_MIXER
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "hw_dll.h"
|
||||
#include "hws_data.h"
|
||||
|
||||
#if defined (SDL) || !defined (HWD)
|
||||
#if defined (HAVE_SDL) || !defined (HWD)
|
||||
EXPORT void HWRAPI(Shutdown) (void);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if defined (VID_X11) && !defined (SDL)
|
||||
#if defined (VID_X11) && !defined (HAVE_SDL)
|
||||
#include <GL/glx.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -32,12 +32,12 @@
|
|||
// STANDARD DLL EXPORTS
|
||||
// ==========================================================================
|
||||
|
||||
#ifdef SDL
|
||||
#ifdef HAVE_SDL
|
||||
#undef VID_X11
|
||||
#endif
|
||||
|
||||
EXPORT boolean HWRAPI(Init) (I_Error_t ErrorFunction);
|
||||
#ifndef SDL
|
||||
#ifndef HAVE_SDL
|
||||
EXPORT void HWRAPI(Shutdown) (void);
|
||||
#endif
|
||||
#ifdef _WINDOWS
|
||||
|
@ -116,7 +116,7 @@ struct hwdriver_s
|
|||
HookXwin pfnHookXwin;
|
||||
GetRenderer pfnGetRenderer;
|
||||
#endif
|
||||
#ifndef SDL
|
||||
#ifndef HAVE_SDL
|
||||
Shutdown pfnShutdown;
|
||||
#endif
|
||||
#ifdef SHUFFLE
|
||||
|
|
|
@ -163,7 +163,7 @@ static I_Error_t I_Error_GL = NULL;
|
|||
// : else do nothing
|
||||
// Returns :
|
||||
// -----------------+
|
||||
#if !(defined (SDL) && defined (STATIC3DS))
|
||||
#if !(defined (HAVE_SDL) && defined (STATIC3DS))
|
||||
FUNCPRINTF void DBG_Printf(const char *lpFmt, ...)
|
||||
{
|
||||
#ifdef DEBUG_TO_FILE
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#ifndef _R_OPENGL_H_
|
||||
#define _R_OPENGL_H_
|
||||
|
||||
#ifdef SDL
|
||||
#ifdef HAVE_SDL
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4214 4244)
|
||||
|
@ -50,7 +50,7 @@
|
|||
|
||||
#undef DEBUG_TO_FILE // maybe defined in previous *.h
|
||||
#define DEBUG_TO_FILE // output debugging msgs to ogllog.txt
|
||||
#if defined ( SDL ) && !defined ( LOGMESSAGES )
|
||||
#if defined ( HAVE_SDL ) && !defined ( LOGMESSAGES )
|
||||
#undef DEBUG_TO_FILE
|
||||
#endif
|
||||
|
||||
|
@ -109,7 +109,7 @@ extern PFNglGetString pglGetString;
|
|||
|
||||
extern const GLubyte *gl_extensions;
|
||||
extern RGBA_t myPaletteData[];
|
||||
#ifndef SDL
|
||||
#ifndef HAVE_SDL
|
||||
extern FILE *logstream;
|
||||
#endif
|
||||
extern GLint screen_width;
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#undef DEBUG_TO_FILE
|
||||
#define DEBUG_TO_FILE
|
||||
|
||||
#if defined ( SDL ) && !defined ( LOGMESSAGES )
|
||||
#if defined ( HAVE_SDL ) && !defined ( LOGMESSAGES )
|
||||
#undef DEBUG_TO_FILE
|
||||
#endif
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ FILE *logstream = NULL;
|
|||
#define MAXCHANNEL 1024
|
||||
|
||||
#undef DEBUG_TO_FILE
|
||||
#if defined ( SDL ) && !defined ( LOGMESSAGES )
|
||||
#if defined ( HAVE_SDL ) && !defined ( LOGMESSAGES )
|
||||
#define DEBUG_TO_FILE
|
||||
#endif
|
||||
|
||||
|
@ -1187,7 +1187,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, // handle to DLL module
|
|||
}
|
||||
return TRUE; // Successful DLL_PROCESS_ATTACH.
|
||||
}
|
||||
#elif !defined (SDL)
|
||||
#elif !defined (HAVE_SDL)
|
||||
|
||||
// **************************************************************************
|
||||
// FUNCTIONS
|
||||
|
|
|
@ -31,7 +31,7 @@ FILE* logstream = NULL;
|
|||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#ifndef SDL // let not make a logstream here is we are inline the HW3D in the SDL binary
|
||||
#ifndef HAVE_SDL // let not make a logstream here is we are inline the HW3D in the SDL binary
|
||||
FILE* logstream = NULL;
|
||||
#endif
|
||||
#endif
|
||||
|
@ -49,7 +49,7 @@ FILE* logstream = NULL;
|
|||
#include "../hw3dsdrv.h"
|
||||
|
||||
//#undef DEBUG_TO_FILE
|
||||
//#if defined ( SDL ) && !defined ( LOGMESSAGES )
|
||||
//#if defined ( HAVE_SDL ) && !defined ( LOGMESSAGES )
|
||||
#define DEBUG_TO_FILE
|
||||
//#endif
|
||||
|
||||
|
|
|
@ -1110,7 +1110,7 @@ static menuitem_t OP_VideoOptionsMenu[] =
|
|||
{IT_SUBMENU|IT_STRING, NULL, "3D Card Options...", &OP_OpenGLOptionsDef, 20},
|
||||
#endif
|
||||
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL)
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||
{IT_STRING|IT_CVAR, NULL, "Fullscreen", &cv_fullscreen, 30},
|
||||
#endif
|
||||
|
||||
|
@ -6827,7 +6827,7 @@ static void M_VideoModeMenu(INT32 choice)
|
|||
|
||||
memset(modedescs, 0, sizeof(modedescs));
|
||||
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL)
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||
VID_PrepareModeList(); // FIXME: hack
|
||||
#endif
|
||||
vidm_nummodes = 0;
|
||||
|
|
11
src/m_misc.c
|
@ -47,8 +47,11 @@
|
|||
#include "hardware/hw_main.h"
|
||||
#endif
|
||||
|
||||
#ifdef SDL
|
||||
#ifdef HAVE_SDL
|
||||
#include "sdl/hwsym_sdl.h"
|
||||
#ifdef __linux__
|
||||
typedef off_t off64_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (_WIN32)
|
||||
|
@ -651,7 +654,7 @@ static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png
|
|||
char Movietxt[] = "SRB2 Movie";
|
||||
size_t i;
|
||||
char interfacetxt[] =
|
||||
#ifdef SDL
|
||||
#ifdef HAVE_SDL
|
||||
"SDL";
|
||||
#elif defined (_WINDOWS)
|
||||
"DirectX";
|
||||
|
@ -806,7 +809,7 @@ static inline boolean M_PNGLib(void)
|
|||
pnglib = GetModuleHandleA("libpng12.dll");
|
||||
if (!pnglib)
|
||||
pnglib = GetModuleHandleA("libpng13.dll");
|
||||
#elif defined (SDL)
|
||||
#elif defined (HAVE_SDL)
|
||||
#ifdef __APPLE__
|
||||
pnglib = hwOpen("libpng.dylib");
|
||||
#else
|
||||
|
@ -815,7 +818,7 @@ static inline boolean M_PNGLib(void)
|
|||
#endif
|
||||
if (!pnglib)
|
||||
return false;
|
||||
#ifdef SDL
|
||||
#ifdef HAVE_SDL
|
||||
apng_set_acTL = hwSym("png_set_acTL", pnglib);
|
||||
apng_write_frame_head = hwSym("png_write_frame_head", pnglib);
|
||||
apng_write_frame_tail = hwSym("png_write_frame_tail", pnglib);
|
||||
|
|
|
@ -253,7 +253,7 @@ void S_RegisterSoundStuff(void)
|
|||
CV_RegisterVar(&surround);
|
||||
CV_RegisterVar(&cv_samplerate);
|
||||
|
||||
#if defined (macintosh) && !defined (SDL) // mp3 playlist stuff
|
||||
#if defined (macintosh) && !defined (HAVE_SDL) // mp3 playlist stuff
|
||||
{
|
||||
INT32 i;
|
||||
for (i = 0; i < PLAYLIST_LENGTH; i++)
|
||||
|
@ -761,7 +761,7 @@ void S_PauseSound(void)
|
|||
}
|
||||
|
||||
// pause cd music
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL)
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||
I_PauseCD();
|
||||
#else
|
||||
I_StopCD();
|
||||
|
@ -1050,7 +1050,7 @@ static boolean S_MIDIMusic(musicinfo_t *music, boolean looping)
|
|||
|
||||
// load & register it
|
||||
music->data = W_CacheLumpNum(music->lumpnum, PU_MUSIC);
|
||||
#if defined (macintosh) && !defined (SDL)
|
||||
#if defined (macintosh) && !defined (HAVE_SDL)
|
||||
music->handle = I_RegisterSong(music_num);
|
||||
#else
|
||||
music->handle = I_RegisterSong(music->data, W_LumpLength(music->lumpnum));
|
||||
|
@ -1154,7 +1154,7 @@ void S_StopMusic(void)
|
|||
I_StopSong(mus_playing->handle);
|
||||
I_UnRegisterSong(mus_playing->handle);
|
||||
|
||||
#ifndef SDL //SDL uses RWOPS
|
||||
#ifndef HAVE_SDL //SDL uses RWOPS
|
||||
Z_ChangeTag(mus_playing->data, PU_CACHE);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ extern CV_PossibleValue_t soundvolume_cons_t[];
|
|||
//part of i_cdmus.c
|
||||
extern consvar_t cd_volume, cdUpdate;
|
||||
|
||||
#if defined (macintosh) && !defined (SDL)
|
||||
#if defined (macintosh) && !defined (HAVE_SDL)
|
||||
typedef enum
|
||||
{
|
||||
music_normal,
|
||||
|
|
|
@ -30,6 +30,10 @@ ifdef NOTERMIOS
|
|||
endif
|
||||
endif
|
||||
|
||||
ifdef LINUX64
|
||||
OPTS+=-DLINUX64
|
||||
endif
|
||||
|
||||
#
|
||||
#here is Solaris
|
||||
#
|
||||
|
@ -89,4 +93,4 @@ ifndef NOHW
|
|||
endif
|
||||
|
||||
# name of the exefile
|
||||
EXENAME?=lsdlsrb2
|
||||
EXENAME?=lsdl2srb2
|
||||
|
|
|
@ -43,9 +43,9 @@ SDL_CFLAGS?=$(shell $(PKG_CONFIG) $(SDL_PKGCONFIG) --cflags)
|
|||
SDL_LDFLAGS?=$(shell $(PKG_CONFIG) $(SDL_PKGCONFIG) --libs)
|
||||
else
|
||||
ifdef PREFIX
|
||||
SDL_CONFIG?=$(PREFIX)-sdl-config
|
||||
SDL_CONFIG?=$(PREFIX)-sdl2-config
|
||||
else
|
||||
SDL_CONFIG?=sdl-config
|
||||
SDL_CONFIG?=sdl2-config
|
||||
endif
|
||||
|
||||
ifdef STATIC
|
||||
|
@ -67,7 +67,7 @@ endif
|
|||
|
||||
OBJS+=$(OBJDIR)/i_video.o $(OBJDIR)/dosstr.o $(OBJDIR)/endtxt.o $(OBJDIR)/hwsym_sdl.o
|
||||
|
||||
OPTS+=-DDIRECTFULLSCREEN -DSDL
|
||||
OPTS+=-DDIRECTFULLSCREEN -DHAVE_SDL
|
||||
|
||||
ifndef NOHW
|
||||
OBJS+=$(OBJDIR)/r_opengl.o $(OBJDIR)/ogl_sdl.o
|
||||
|
@ -95,33 +95,28 @@ endif
|
|||
endif
|
||||
endif
|
||||
|
||||
ifdef FILTERS
|
||||
OBJS+=$(OBJDIR)/filters.o $(OBJDIR)/hq2x.o $(OBJDIR)/lq2x.o
|
||||
OPTS+=-DHAVE_FILTER
|
||||
endif
|
||||
|
||||
ifdef NOMIXER
|
||||
i_sound_o=$(OBJDIR)/sdl_sound.o
|
||||
else
|
||||
i_sound_o=$(OBJDIR)/mixer_sound.o
|
||||
OPTS+=-DHAVE_MIXER
|
||||
SDL_LDFLAGS+=-lSDL_mixer
|
||||
SDL_LDFLAGS+=-lSDL2_mixer
|
||||
endif
|
||||
|
||||
ifdef SDL_TTF
|
||||
OPTS+=-DHAVE_TTF
|
||||
SDL_LDFLAGS+=-lSDL_ttf -lfreetype -lz
|
||||
SDL_LDFLAGS+=-lSDL2_ttf -lfreetype -lz
|
||||
OBJS+=$(OBJDIR)/i_ttf.o
|
||||
endif
|
||||
|
||||
#ifdef SDL_IMAGE
|
||||
# OPTS+=-DHAVE_IMAGE
|
||||
# SDL_LDFLAGS+=-lSDL_image
|
||||
#endif
|
||||
ifdef SDL_IMAGE
|
||||
OPTS+=-DHAVE_IMAGE
|
||||
SDL_LDFLAGS+=-lSDL2_image
|
||||
endif
|
||||
|
||||
ifdef SDL_NET
|
||||
OPTS+=-DHAVE_SDLNET
|
||||
SDL_LDFLAGS+=-lSDL_net
|
||||
SDL_LDFLAGS+=-lSDL2_net
|
||||
endif
|
||||
|
||||
ifdef SDLMAIN
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
|
@ -145,7 +145,7 @@
|
|||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
|
@ -202,7 +202,7 @@
|
|||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeaderOutputFile>.\..\..\objs\VC10\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch</PrecompiledHeaderOutputFile>
|
||||
|
@ -258,7 +258,7 @@
|
|||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeaderOutputFile>.\..\..\objs\VC10\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch</PrecompiledHeaderOutputFile>
|
||||
|
@ -1461,4 +1461,4 @@
|
|||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""$(ProjectDir)..\..\libs\libpng-src";"$(ProjectDir)..\..\libs\zlib""
|
||||
PreprocessorDefinitions="_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
|
||||
PreprocessorDefinitions="_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
|
@ -145,7 +145,7 @@
|
|||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""$(ProjectDir)..\..\libs\libpng-src";"$(ProjectDir)..\..\libs\zlib""
|
||||
PreprocessorDefinitions="_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
|
||||
PreprocessorDefinitions="_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
|
@ -248,7 +248,7 @@
|
|||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories=""$(ProjectDir)..\..\libs\libpng-src";"$(ProjectDir)..\..\libs\zlib""
|
||||
PreprocessorDefinitions="NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
|
||||
PreprocessorDefinitions="NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
PrecompiledHeaderFile=".\..\..\objs\VC9\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch"
|
||||
|
@ -350,7 +350,7 @@
|
|||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories=""$(ProjectDir)..\..\libs\libpng-src";"$(ProjectDir)..\..\libs\zlib""
|
||||
PreprocessorDefinitions="NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
|
||||
PreprocessorDefinitions="NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
PrecompiledHeaderFile=".\..\..\objs\VC9\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch"
|
||||
|
|
|
@ -45,7 +45,7 @@ MTL=midl.exe
|
|||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /G5 /W3 /GX /Zi /Ot /Og /Oi /Op /Oy /Ob1 /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "NDEBUG" /D "SDLMAIN" /D "NO_STDIO_REDIRECT" /D "USE_WGL_SWAP" /D "DIRECTFULLSCREEN" /D "SDL" /D "HWRENDER" /D "HW3SOUND" /D "HAVE_FILTER" /D "HAVE_MIXER" /D "USEASM" /D "HAVE_PNG" /FR /FD /GF /c
|
||||
# ADD CPP /nologo /G5 /W3 /GX /Zi /Ot /Og /Oi /Op /Oy /Ob1 /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "NDEBUG" /D "SDLMAIN" /D "NO_STDIO_REDIRECT" /D "USE_WGL_SWAP" /D "DIRECTFULLSCREEN" /D "HAVE_SDL" /D "HWRENDER" /D "HW3SOUND" /D "HAVE_FILTER" /D "HAVE_MIXER" /D "USEASM" /D "HAVE_PNG" /FR /FD /GF /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
# SUBTRACT RSC /x
|
||||
|
@ -72,7 +72,7 @@ LINK32=link.exe
|
|||
# PROP Target_Dir ""
|
||||
MTL=midl.exe
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /G6 /W4 /WX /Gm /GX /ZI /Od /Op /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "_DEBUG" /D "USE_WGL_SWAP" /D "DIRECTFULLSCREEN" /D "SDL" /D "HWRENDER" /D "HW3SOUND" /D "HAVE_FILTER" /D "HAVE_MIXER" /D "USEASM" /D "HAVE_PNG" /FR /FD /GZ /c
|
||||
# ADD CPP /nologo /G6 /W4 /WX /Gm /GX /ZI /Od /Op /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "_DEBUG" /D "USE_WGL_SWAP" /D "DIRECTFULLSCREEN" /D "HAVE_SDL" /D "HWRENDER" /D "HW3SOUND" /D "HAVE_FILTER" /D "HAVE_MIXER" /D "USEASM" /D "HAVE_PNG" /FR /FD /GZ /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#pragma warning(disable : 4214 4244)
|
||||
#endif
|
||||
|
||||
#ifdef SDL
|
||||
#ifdef HAVE_SDL
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
|
|
|
@ -1,588 +1,38 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
//
|
||||
// This program 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 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \brief cd music interface
|
||||
///
|
||||
|
||||
#ifdef SDL
|
||||
|
||||
#if defined (DC) || defined (_WIN32_WCE) || defined(GP2X) || defined(_PS3)
|
||||
#define NOSDLCD
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#ifndef NOSDLCD
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4214 4244)
|
||||
#endif
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(default : 4214 4244)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#include "../doomtype.h"
|
||||
#include "../i_sound.h"
|
||||
#include "../command.h"
|
||||
#include "../m_argv.h"
|
||||
#include "../s_sound.h"
|
||||
#include "../i_sound.h"
|
||||
|
||||
#define MAX_CD_TRACKS 256
|
||||
//
|
||||
// CD MUSIC I/O
|
||||
//
|
||||
|
||||
#ifdef _XBOX
|
||||
INT32 SDL_SYS_CDInit(void)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
void SDL_SYS_CDQuit(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
UINT8 cdaudio_started = 0; // for system startup/shutdown
|
||||
UINT8 cdaudio_started = 0;
|
||||
|
||||
consvar_t cd_volume = {"cd_volume","31",CV_SAVE,soundvolume_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cdUpdate = {"cd_update","1",CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
#ifndef NOSDLCD
|
||||
static SDL_bool cdValid = SDL_FALSE;
|
||||
static SDL_bool cdPlaying = SDL_FALSE;
|
||||
static SDL_bool wasPlaying = SDL_FALSE;
|
||||
static SDL_bool cdEnabled = SDL_FALSE;
|
||||
static SDL_bool playLooping = SDL_FALSE;
|
||||
static Uint8 playTrack = 0;
|
||||
static Uint8 maxTrack = MAX_CD_TRACKS-1;
|
||||
static Uint8 cdRemap[MAX_CD_TRACKS];
|
||||
static INT32 cdvolume = -1;
|
||||
static SDL_CD *cdrom = NULL;
|
||||
static CDstatus cdStatus = CD_ERROR;
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* function: CDAudio_GetAudioDiskInfo
|
||||
*
|
||||
* description:
|
||||
* set number of tracks if CD is available
|
||||
*
|
||||
**************************************************************************/
|
||||
static INT32 CDAudio_GetAudioDiskInfo(void)
|
||||
void I_InitCD(void){}
|
||||
|
||||
void I_StopCD(void){}
|
||||
|
||||
void I_PauseCD(void){}
|
||||
|
||||
void I_ResumeCD(void){}
|
||||
|
||||
void I_ShutdownCD(void){}
|
||||
|
||||
void I_UpdateCD(void){}
|
||||
|
||||
void I_PlayCD(UINT8 track, UINT8 looping)
|
||||
{
|
||||
cdValid = SDL_FALSE;
|
||||
maxTrack = 0;
|
||||
|
||||
if (!cdrom)
|
||||
return 0;//Alam: Lies!
|
||||
|
||||
cdStatus = SDL_CDStatus(cdrom);
|
||||
|
||||
if (!CD_INDRIVE(cdStatus))
|
||||
{
|
||||
CONS_Printf("%s", M_GetText("No CD in drive\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (cdStatus == CD_ERROR)
|
||||
{
|
||||
CONS_Printf(M_GetText("CD Error: %s\n"), SDL_GetError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
cdValid = SDL_TRUE;
|
||||
maxTrack = (Uint8)cdrom->numtracks;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* function: I_EjectCD
|
||||
*
|
||||
* description:
|
||||
*
|
||||
*
|
||||
**************************************************************************/
|
||||
static void I_EjectCD(void)
|
||||
{
|
||||
if (!cdrom || !cdEnabled)
|
||||
return; // no cd init'd
|
||||
|
||||
I_StopCD();
|
||||
|
||||
if (SDL_CDEject(cdrom))
|
||||
CONS_Printf("%s", M_GetText("CD eject failed\n"));
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* function: Command_Cd_f
|
||||
*
|
||||
* description:
|
||||
* handles all CD commands from the console
|
||||
*
|
||||
**************************************************************************/
|
||||
static void Command_Cd_f (void)
|
||||
{
|
||||
const char *command;
|
||||
size_t ret, n;
|
||||
|
||||
if (!cdaudio_started)
|
||||
return;
|
||||
|
||||
if (COM_Argc() < 2)
|
||||
{
|
||||
CONS_Printf ("%s", M_GetText("cd [on] [off] [remap] [reset] [select]\n"
|
||||
" [open] [info] [play <track>] [resume]\n"
|
||||
" [stop] [pause] [loop <track>]\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
command = COM_Argv (1);
|
||||
|
||||
if (!strncmp(command, "on", 2))
|
||||
{
|
||||
cdEnabled = SDL_TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strncmp(command, "off", 3))
|
||||
{
|
||||
I_StopCD();
|
||||
cdEnabled = SDL_FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strncmp(command, "select", 6))
|
||||
{
|
||||
INT32 newcddrive;
|
||||
newcddrive = atoi(COM_Argv(2));
|
||||
command = SDL_CDName(newcddrive);
|
||||
I_StopCD();
|
||||
cdEnabled = SDL_FALSE;
|
||||
SDL_CDClose(cdrom);
|
||||
cdrom = SDL_CDOpen(newcddrive);
|
||||
if (cdrom)
|
||||
{
|
||||
cdEnabled = SDL_TRUE;
|
||||
CONS_Printf(M_GetText("Opened CD-ROM drive %s\n"), command ? command : COM_Argv(2));
|
||||
}
|
||||
else CONS_Printf(M_GetText("Couldn't open CD-ROM drive %s: %s\n"), command ? command : COM_Argv(2), SDL_GetError());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strncmp(command, "remap", 5))
|
||||
{
|
||||
ret = COM_Argc() - 2;
|
||||
if (ret <= 0)
|
||||
{
|
||||
for (n = 1; n < MAX_CD_TRACKS; n++)
|
||||
{
|
||||
if (cdRemap[n] != n)
|
||||
CONS_Printf(" %s -> %u\n", sizeu1(n), cdRemap[n]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (n = 1; n <= ret; n++)
|
||||
cdRemap[n] = (Uint8)atoi(COM_Argv (n+1));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strncmp(command, "reset", 5))
|
||||
{
|
||||
if (!cdrom) return;
|
||||
cdEnabled = SDL_TRUE;
|
||||
I_StopCD();
|
||||
for (n = 0; n < MAX_CD_TRACKS; n++)
|
||||
cdRemap[n] = (Uint8)n;
|
||||
CDAudio_GetAudioDiskInfo();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cdValid)
|
||||
{
|
||||
if (CDAudio_GetAudioDiskInfo()==-1 && !cdValid)
|
||||
{
|
||||
CONS_Printf("%s", M_GetText("No CD in drive\n"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!strncmp(command, "open", 4))
|
||||
{
|
||||
I_EjectCD();
|
||||
cdValid = SDL_FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strncmp(command, "info", 4))
|
||||
{
|
||||
CONS_Printf(M_GetText("%u tracks\n"), maxTrack);
|
||||
if (cdPlaying)
|
||||
CONS_Printf(M_GetText("Currently %s track %u\n"), playLooping ? M_GetText("looping") : M_GetText("playing"), playTrack);
|
||||
else if (wasPlaying)
|
||||
CONS_Printf(M_GetText("Paused %s track %u\n"), playLooping ? M_GetText("looping") : M_GetText("playing"), playTrack);
|
||||
CONS_Printf(M_GetText("Volume is %d\n"), cdvolume);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strncmp(command, "play", 4))
|
||||
{
|
||||
I_PlayCD((UINT8)atoi(COM_Argv (2)), SDL_FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strncmp(command, "loop", 4))
|
||||
{
|
||||
I_PlayCD((UINT8)atoi(COM_Argv (2)), true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strncmp(command, "stop", 4))
|
||||
{
|
||||
I_StopCD();
|
||||
return;
|
||||
}
|
||||
if (!strncmp(command, "pause", 5))
|
||||
{
|
||||
I_PauseCD();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strncmp(command, "resume", 6))
|
||||
{
|
||||
I_ResumeCD();
|
||||
return;
|
||||
}
|
||||
|
||||
CONS_Printf(M_GetText("Invalid CD command \"CD %s\"\n"), COM_Argv(1));
|
||||
}
|
||||
#endif
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* function: StopCD
|
||||
*
|
||||
* description:
|
||||
*
|
||||
*
|
||||
**************************************************************************/
|
||||
void I_StopCD(void)
|
||||
{
|
||||
#ifndef NOSDLCD
|
||||
if (!cdrom || !cdEnabled)
|
||||
return;
|
||||
|
||||
if (!(cdPlaying || wasPlaying))
|
||||
return;
|
||||
|
||||
if (SDL_CDStop(cdrom))
|
||||
I_OutputMsg("cdromstop failed\n");
|
||||
|
||||
wasPlaying = SDL_FALSE;
|
||||
cdPlaying = SDL_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* function: PauseCD
|
||||
*
|
||||
* description:
|
||||
*
|
||||
*
|
||||
**************************************************************************/
|
||||
void I_PauseCD (void)
|
||||
{
|
||||
#ifndef NOSDLCD
|
||||
if (!cdrom || !cdEnabled)
|
||||
return;
|
||||
|
||||
if (!cdPlaying)
|
||||
return;
|
||||
|
||||
if (SDL_CDPause(cdrom))
|
||||
I_OutputMsg("cdrompause failed\n");
|
||||
|
||||
wasPlaying = cdPlaying;
|
||||
cdPlaying = SDL_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* function: ResumeCD
|
||||
*
|
||||
* description:
|
||||
*
|
||||
*
|
||||
**************************************************************************/
|
||||
// continue after a pause
|
||||
void I_ResumeCD (void)
|
||||
{
|
||||
#ifndef NOSDLCD
|
||||
if (!cdrom || !cdEnabled)
|
||||
return;
|
||||
|
||||
if (!cdValid)
|
||||
return;
|
||||
|
||||
if (!wasPlaying)
|
||||
return;
|
||||
|
||||
if (cd_volume.value == 0)
|
||||
return;
|
||||
|
||||
if (SDL_CDResume(cdrom))
|
||||
I_OutputMsg("cdromresume failed\n");
|
||||
|
||||
cdPlaying = SDL_TRUE;
|
||||
wasPlaying = SDL_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* function: ShutdownCD
|
||||
*
|
||||
* description:
|
||||
*
|
||||
*
|
||||
**************************************************************************/
|
||||
void I_ShutdownCD (void)
|
||||
{
|
||||
#ifndef NOSDLCD
|
||||
if (!cdaudio_started)
|
||||
return;
|
||||
|
||||
I_StopCD();
|
||||
|
||||
CONS_Printf("I_ShutdownCD: ");
|
||||
SDL_CDClose(cdrom);
|
||||
cdrom = NULL;
|
||||
cdaudio_started = false;
|
||||
CONS_Printf("%s", M_GetText("shut down\n"));
|
||||
SDL_QuitSubSystem(SDL_INIT_CDROM);
|
||||
cdEnabled = SDL_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* function: InitCD
|
||||
*
|
||||
* description:
|
||||
* Initialize the first CD drive SDL detects and add console command 'cd'
|
||||
*
|
||||
**************************************************************************/
|
||||
void I_InitCD (void)
|
||||
{
|
||||
#ifndef NOSDLCD
|
||||
INT32 i;
|
||||
|
||||
// Has been checked in d_main.c, but doesn't hurt here
|
||||
if (M_CheckParm ("-nocd"))
|
||||
return;
|
||||
|
||||
CONS_Printf("%s", M_GetText("I_InitCD: Init CD audio\n"));
|
||||
|
||||
// Initialize SDL first
|
||||
if (SDL_InitSubSystem(SDL_INIT_CDROM) < 0)
|
||||
{
|
||||
CONS_Printf(M_GetText("Couldn't initialize SDL CDROM: %s\n"), SDL_GetError());
|
||||
return;
|
||||
}
|
||||
|
||||
// Open drive
|
||||
cdrom = SDL_CDOpen(0);
|
||||
|
||||
if (!cdrom)
|
||||
{
|
||||
const char *cdName = SDL_CDName(0);
|
||||
if (!cdName)
|
||||
CONS_Printf(M_GetText("Couldn't open CD-ROM drive %s: %s\n"), "\b", SDL_GetError());
|
||||
else
|
||||
CONS_Printf(M_GetText("Couldn't open CD-ROM drive %s: %s\n"), cdName, SDL_GetError());
|
||||
//return;
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_CD_TRACKS; i++)
|
||||
cdRemap[i] = (Uint8)i;
|
||||
|
||||
cdaudio_started = true;
|
||||
if (cdrom) cdEnabled = SDL_TRUE;
|
||||
|
||||
if (CDAudio_GetAudioDiskInfo()==-1)
|
||||
{
|
||||
CONS_Printf("%s", M_GetText("No CD in drive\n"));
|
||||
cdValid = SDL_FALSE;
|
||||
}
|
||||
|
||||
COM_AddCommand ("cd", Command_Cd_f);
|
||||
|
||||
CONS_Printf("%s", M_GetText("CD audio Initialized\n"));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
/**************************************************************************
|
||||
*
|
||||
* function: UpdateCD
|
||||
*
|
||||
* description:
|
||||
* sets CD volume (may have changed) and initiates play evey 2 seconds
|
||||
* in case the song has elapsed
|
||||
*
|
||||
**************************************************************************/
|
||||
void I_UpdateCD (void)
|
||||
{
|
||||
#ifndef NOSDLCD
|
||||
static Uint32 lastchk = 0;
|
||||
|
||||
if (!cdEnabled || !cdrom)
|
||||
return;
|
||||
|
||||
I_SetVolumeCD(cd_volume.value);
|
||||
|
||||
if (cdPlaying && lastchk < SDL_GetTicks())
|
||||
{
|
||||
lastchk = SDL_GetTicks() + 2000; //two seconds between chks
|
||||
|
||||
if (CDAudio_GetAudioDiskInfo()==-1)
|
||||
{
|
||||
cdPlaying = SDL_FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (cdStatus != CD_PLAYING && cdStatus != CD_PAUSED)
|
||||
{
|
||||
cdPlaying = SDL_FALSE;
|
||||
if (playLooping)
|
||||
I_PlayCD(playTrack, true);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* function: PlayCD
|
||||
*
|
||||
* description:
|
||||
* play the requested track and set the looping flag
|
||||
* pauses the CD if volume is 0
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
void I_PlayCD (UINT8 track, UINT8 looping)
|
||||
{
|
||||
#ifdef NOSDLCD
|
||||
(void)track;
|
||||
(void)looping;
|
||||
#else
|
||||
if (!cdrom || !cdEnabled)
|
||||
return;
|
||||
|
||||
if (!cdValid)
|
||||
{
|
||||
CDAudio_GetAudioDiskInfo();
|
||||
if (!cdValid)
|
||||
return;
|
||||
}
|
||||
|
||||
track = cdRemap[track];
|
||||
|
||||
if (track < 1 || track > maxTrack)
|
||||
{
|
||||
CONS_Printf(M_GetText("Bad track number %u.\n"), track);
|
||||
return;
|
||||
}
|
||||
|
||||
// don't try to play a non-audio track
|
||||
if (cdrom->track[track].type == SDL_DATA_TRACK)
|
||||
{
|
||||
CONS_Printf(M_GetText("Track %u is not audio\n"), track);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cdPlaying)
|
||||
{
|
||||
if (playTrack == track)
|
||||
return;
|
||||
I_StopCD();
|
||||
}
|
||||
|
||||
if (SDL_CDPlayTracks(cdrom, track, 0, 1, 0))
|
||||
{
|
||||
CONS_Printf(M_GetText("Error playing track %d: %s\n"), track, SDL_GetError());
|
||||
return;
|
||||
}
|
||||
|
||||
playLooping = looping;
|
||||
playTrack = (Uint8)track;
|
||||
cdPlaying = SDL_TRUE;
|
||||
|
||||
if (cd_volume.value == 0)
|
||||
I_PauseCD();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* function: SetVolumeCD
|
||||
*
|
||||
* description:
|
||||
* SDL does not support setting the CD volume
|
||||
* use pause instead and toggle between full and no music
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
boolean I_SetVolumeCD (INT32 volume)
|
||||
boolean I_SetVolumeCD(int volume)
|
||||
{
|
||||
#ifdef NOSDLCD
|
||||
(void)volume;
|
||||
#else
|
||||
if (volume != cdvolume)
|
||||
{
|
||||
if (volume > 0 && volume < 16)
|
||||
{
|
||||
CV_SetValue(&cd_volume, 31);
|
||||
cdvolume = 31;
|
||||
I_ResumeCD();
|
||||
}
|
||||
else if (volume > 15 && volume < 31)
|
||||
{
|
||||
CV_SetValue(&cd_volume, 0);
|
||||
cdvolume = 0;
|
||||
I_PauseCD();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -48,7 +48,7 @@ PSP_MAIN_THREAD_NAME("SRB2");
|
|||
PSP_MAIN_THREAD_STACK_SIZE_KB(256);
|
||||
#endif
|
||||
|
||||
#ifdef SDL
|
||||
#ifdef HAVE_SDL
|
||||
|
||||
#ifdef HAVE_TTF
|
||||
#include "SDL.h"
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "../i_tcp.h"
|
||||
|
||||
#ifdef SDL
|
||||
#ifdef HAVE_SDL
|
||||
|
||||
#ifdef HAVE_SDLNET
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
|
|||
#pragma warning(disable : 4214 4244)
|
||||
#endif
|
||||
|
||||
#ifdef SDL
|
||||
#ifdef HAVE_SDL
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
|
@ -996,8 +996,8 @@ void I_GetJoystickEvents(void)
|
|||
UINT64 joyhats = 0;
|
||||
#if 0
|
||||
UINT64 joybuttons = 0;
|
||||
Sint16 axisx, axisy;
|
||||
#endif
|
||||
Sint16 axisx, axisy;
|
||||
|
||||
if (!joystick_started) return;
|
||||
|
||||
|
@ -1070,7 +1070,6 @@ void I_GetJoystickEvents(void)
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// send joystick axis positions
|
||||
event.type = ev_joystick;
|
||||
|
||||
|
@ -1123,7 +1122,6 @@ void I_GetJoystickEvents(void)
|
|||
}
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/** \brief Open joystick handle
|
||||
|
@ -1156,7 +1154,7 @@ static int joy_open(const char *fname)
|
|||
{
|
||||
CONS_Printf(M_GetText("Cannot use joystick #%d/(%s), it doesn't exist\n"),joyindex,fname);
|
||||
for (i = 0; i < num_joy; i++)
|
||||
CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickName(i));
|
||||
CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i));
|
||||
I_ShutdownJoystick();
|
||||
return -1;
|
||||
}
|
||||
|
@ -1177,7 +1175,7 @@ static int joy_open(const char *fname)
|
|||
{
|
||||
CONS_Printf(M_GetText("Found %d joysticks on this system\n"), num_joy);
|
||||
for (i = 0; i < num_joy; i++)
|
||||
CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickName(i));
|
||||
CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i));
|
||||
}
|
||||
else
|
||||
CONS_Printf("%s", M_GetText("Found no joysticks on this system\n"));
|
||||
|
@ -1185,7 +1183,6 @@ static int joy_open(const char *fname)
|
|||
}
|
||||
|
||||
JoyInfo.dev = SDL_JoystickOpen(joyindex-1);
|
||||
CONS_Printf(M_GetText("Joystick: %s\n"), SDL_JoystickName(joyindex-1));
|
||||
|
||||
if (JoyInfo.dev == NULL)
|
||||
{
|
||||
|
@ -1195,6 +1192,7 @@ static int joy_open(const char *fname)
|
|||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf(M_GetText("Joystick: %s\n"), SDL_JoystickName(JoyInfo.dev));
|
||||
JoyInfo.axises = SDL_JoystickNumAxes(JoyInfo.dev);
|
||||
if (JoyInfo.axises > JOYAXISSET*2)
|
||||
JoyInfo.axises = JOYAXISSET*2;
|
||||
|
@ -1219,7 +1217,7 @@ static int joy_open(const char *fname)
|
|||
JoyInfo.balls = SDL_JoystickNumBalls(JoyInfo.dev);
|
||||
#endif
|
||||
|
||||
//Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(SDL_JoystickIndex(JoyInfo.dev)), "pad");
|
||||
//Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(JoyInfo.dev), "pad");
|
||||
|
||||
return JoyInfo.axises;
|
||||
}
|
||||
|
@ -1290,8 +1288,8 @@ void I_GetJoystick2Events(void)
|
|||
UINT64 joyhats = 0;
|
||||
#if 0
|
||||
INT64 joybuttons = 0;
|
||||
INT32 axisx, axisy;
|
||||
#endif
|
||||
INT32 axisx, axisy;
|
||||
|
||||
if (!joystick2_started)
|
||||
return;
|
||||
|
@ -1361,7 +1359,6 @@ void I_GetJoystick2Events(void)
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// send joystick axis positions
|
||||
event.type = ev_joystick2;
|
||||
|
||||
|
@ -1416,7 +1413,6 @@ void I_GetJoystick2Events(void)
|
|||
}
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
@ -1448,7 +1444,7 @@ static int joy_open2(const char *fname)
|
|||
{
|
||||
CONS_Printf(M_GetText("Cannot use joystick #%d/(%s), it doesn't exist\n"),joyindex,fname);
|
||||
for (i = 0; i < num_joy; i++)
|
||||
CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickName(i));
|
||||
CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i));
|
||||
I_ShutdownJoystick2();
|
||||
return -1;
|
||||
}
|
||||
|
@ -1469,7 +1465,7 @@ static int joy_open2(const char *fname)
|
|||
{
|
||||
CONS_Printf(M_GetText("Found %d joysticks on this system\n"), num_joy);
|
||||
for (i = 0; i < num_joy; i++)
|
||||
CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickName(i));
|
||||
CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i));
|
||||
}
|
||||
else
|
||||
CONS_Printf("%s", M_GetText("Found no joysticks on this system\n"));
|
||||
|
@ -1477,7 +1473,6 @@ static int joy_open2(const char *fname)
|
|||
}
|
||||
|
||||
JoyInfo2.dev = SDL_JoystickOpen(joyindex-1);
|
||||
CONS_Printf(M_GetText("Joystick2: %s\n"), SDL_JoystickName(joyindex-1));
|
||||
|
||||
if (!JoyInfo2.dev)
|
||||
{
|
||||
|
@ -1487,6 +1482,7 @@ static int joy_open2(const char *fname)
|
|||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf(M_GetText("Joystick2: %s\n"), SDL_JoystickName(JoyInfo2.dev));
|
||||
JoyInfo2.axises = SDL_JoystickNumAxes(JoyInfo2.dev);
|
||||
if (JoyInfo2.axises > JOYAXISSET*2)
|
||||
JoyInfo2.axises = JOYAXISSET*2;
|
||||
|
@ -1511,7 +1507,7 @@ static int joy_open2(const char *fname)
|
|||
JoyInfo2.balls = SDL_JoystickNumBalls(JoyInfo2.dev);
|
||||
#endif
|
||||
|
||||
//Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(SDL_JoystickIndex(JoyInfo2.dev)), "pad");
|
||||
//Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(JoyInfo2.dev), "pad");
|
||||
|
||||
return JoyInfo2.axises;
|
||||
}
|
||||
|
@ -1582,11 +1578,11 @@ const char *I_GetJoyName(INT32 joyindex)
|
|||
if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
|
||||
{
|
||||
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != -1)
|
||||
joyname = SDL_JoystickName(joyindex);
|
||||
joyname = SDL_JoystickNameForIndex(joyindex);
|
||||
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
|
||||
}
|
||||
else
|
||||
joyname = SDL_JoystickName(joyindex);
|
||||
joyname = SDL_JoystickNameForIndex(joyindex);
|
||||
return joyname;
|
||||
}
|
||||
|
||||
|
@ -2219,7 +2215,7 @@ void I_Sleep(void)
|
|||
INT32 I_StartupSystem(void)
|
||||
{
|
||||
SDL_version SDLcompiled;
|
||||
const SDL_version *SDLlinked;
|
||||
SDL_version SDLlinked;
|
||||
#ifdef _XBOX
|
||||
#ifdef __GNUC__
|
||||
char DP[] =" Sonic Robo Blast 2!\n";
|
||||
|
@ -2240,12 +2236,12 @@ INT32 I_StartupSystem(void)
|
|||
#endif
|
||||
#endif
|
||||
SDL_VERSION(&SDLcompiled)
|
||||
SDLlinked = SDL_Linked_Version();
|
||||
SDL_GetVersion(&SDLlinked);
|
||||
I_StartupConsole();
|
||||
I_OutputMsg("Compiled for SDL version: %d.%d.%d\n",
|
||||
SDLcompiled.major, SDLcompiled.minor, SDLcompiled.patch);
|
||||
I_OutputMsg("Linked with SDL version: %d.%d.%d\n",
|
||||
SDLlinked->major, SDLlinked->minor, SDLlinked->patch);
|
||||
SDLlinked.major, SDLlinked.minor, SDLlinked.patch);
|
||||
#if 0 //#ifdef GP2X //start up everything
|
||||
if (SDL_Init(SDL_INIT_NOPARACHUTE|SDL_INIT_EVERYTHING) < 0)
|
||||
#else
|
||||
|
@ -2875,7 +2871,7 @@ const char *I_LocateWad(void)
|
|||
return waddir;
|
||||
}
|
||||
|
||||
#ifdef LINUX
|
||||
#if defined(LINUX) || defined(LINUX64)
|
||||
#define MEMINFO_FILE "/proc/meminfo"
|
||||
#define MEMTOTAL "MemTotal:"
|
||||
#define MEMFREE "MemFree:"
|
||||
|
@ -2931,7 +2927,25 @@ UINT32 I_GetFreeMem(UINT32 *total)
|
|||
if (total)
|
||||
*total = 32 << 20;
|
||||
return 32 << 20;
|
||||
#elif defined (LINUX)
|
||||
#elif (defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX)
|
||||
MEMORYSTATUS info;
|
||||
|
||||
info.dwLength = sizeof (MEMORYSTATUS);
|
||||
GlobalMemoryStatus( &info );
|
||||
if (total)
|
||||
*total = (UINT32)info.dwTotalPhys;
|
||||
return (UINT32)info.dwAvailPhys;
|
||||
#elif defined (__OS2__)
|
||||
UINT32 pr_arena;
|
||||
|
||||
if (total)
|
||||
DosQuerySysInfo( QSV_TOTPHYSMEM, QSV_TOTPHYSMEM,
|
||||
(PVOID) total, sizeof (UINT32));
|
||||
DosQuerySysInfo( QSV_MAXPRMEM, QSV_MAXPRMEM,
|
||||
(PVOID) &pr_arena, sizeof (UINT32));
|
||||
|
||||
return pr_arena;
|
||||
#elif defined (LINUX) || defined (LINUX64)
|
||||
/* Linux */
|
||||
char buf[1024];
|
||||
char *memTag;
|
||||
|
@ -2975,24 +2989,6 @@ UINT32 I_GetFreeMem(UINT32 *total)
|
|||
if (total)
|
||||
*total = totalKBytes << 10;
|
||||
return freeKBytes << 10;
|
||||
#elif (defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX)
|
||||
MEMORYSTATUS info;
|
||||
|
||||
info.dwLength = sizeof (MEMORYSTATUS);
|
||||
GlobalMemoryStatus( &info );
|
||||
if (total)
|
||||
*total = (UINT32)info.dwTotalPhys;
|
||||
return (UINT32)info.dwAvailPhys;
|
||||
#elif defined (__OS2__)
|
||||
UINT32 pr_arena;
|
||||
|
||||
if (total)
|
||||
DosQuerySysInfo( QSV_TOTPHYSMEM, QSV_TOTPHYSMEM,
|
||||
(PVOID) total, sizeof (UINT32));
|
||||
DosQuerySysInfo( QSV_MAXPRMEM, QSV_MAXPRMEM,
|
||||
(PVOID) &pr_arena, sizeof (UINT32));
|
||||
|
||||
return pr_arena;
|
||||
#else
|
||||
// Guess 48 MB.
|
||||
if (total)
|
||||
|
@ -3039,8 +3035,8 @@ const CPUInfoFlags *I_CPUInfo(void)
|
|||
WIN_CPUInfo.SSE2 = SDL_HasSSE2();
|
||||
WIN_CPUInfo.AltiVec = SDL_HasAltiVec();
|
||||
}
|
||||
WIN_CPUInfo.MMXExt = SDL_HasMMXExt();
|
||||
WIN_CPUInfo.AMD3DNowExt = SDL_Has3DNowExt();
|
||||
WIN_CPUInfo.MMXExt = SDL_FALSE; //SDL_HasMMXExt(); No longer in SDL2
|
||||
WIN_CPUInfo.AMD3DNowExt = SDL_FALSE; //SDL_Has3DNowExt(); No longer in SDL2
|
||||
#endif
|
||||
GetSystemInfo(&SI);
|
||||
WIN_CPUInfo.CPUs = SI.dwNumberOfProcessors;
|
||||
|
@ -3052,9 +3048,9 @@ const CPUInfoFlags *I_CPUInfo(void)
|
|||
memset(&SDL_CPUInfo,0,sizeof (CPUInfoFlags));
|
||||
SDL_CPUInfo.RDTSC = SDL_HasRDTSC();
|
||||
SDL_CPUInfo.MMX = SDL_HasMMX();
|
||||
SDL_CPUInfo.MMXExt = SDL_HasMMXExt();
|
||||
SDL_CPUInfo.MMXExt = SDL_FALSE; //SDL_HasMMXExt(); No longer in SDL2
|
||||
SDL_CPUInfo.AMD3DNow = SDL_Has3DNow();
|
||||
SDL_CPUInfo.AMD3DNowExt = SDL_Has3DNowExt();
|
||||
SDL_CPUInfo.AMD3DNowExt = SDL_FALSE; //SDL_Has3DNowExt(); No longer in SDL2
|
||||
SDL_CPUInfo.SSE = SDL_HasSSE();
|
||||
SDL_CPUInfo.SSE2 = SDL_HasSSE2();
|
||||
SDL_CPUInfo.AltiVec = SDL_HasAltiVec();
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
/// \file
|
||||
/// \brief SDL_ttf interface code. Necessary for platforms with no framebuffer console systems.
|
||||
|
||||
#if defined(SDL) && defined(HAVE_TTF)
|
||||
#if defined(HAVE_SDL) && defined(HAVE_TTF)
|
||||
#include "SDL.h"
|
||||
#include "SDL_ttf.h"
|
||||
#include "../doomdef.h"
|
||||
|
|
1568
src/sdl/i_video.c
|
@ -1264,7 +1264,7 @@
|
|||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
MAC_ALERT,
|
||||
SDLMAIN,
|
||||
SDL,
|
||||
HAVE_SDL,
|
||||
HAVE_MIXER,
|
||||
HAVE_PNG,
|
||||
HAVE_BLUA,
|
||||
|
@ -1386,7 +1386,7 @@
|
|||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
MAC_ALERT,
|
||||
SDLMAIN,
|
||||
SDL,
|
||||
HAVE_SDL,
|
||||
HAVE_MIXER,
|
||||
HAVE_PNG,
|
||||
HAVE_BLUA,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../doomdef.h"
|
||||
|
||||
#if defined(SDL) && defined(HAVE_MIXER) && SOUND==SOUND_MIXER
|
||||
#if defined(HAVE_SDL) && defined(HAVE_MIXER) && SOUND==SOUND_MIXER
|
||||
|
||||
#include "../sounds.h"
|
||||
#include "../s_sound.h"
|
||||
|
@ -617,7 +617,7 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
|
|||
}
|
||||
#endif
|
||||
|
||||
music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len));
|
||||
music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len), SDL_FALSE);
|
||||
if (!music)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError());
|
||||
|
@ -778,7 +778,7 @@ void I_SetMIDIMusicVolume(UINT8 volume)
|
|||
|
||||
INT32 I_RegisterSong(void *data, size_t len)
|
||||
{
|
||||
music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len));
|
||||
music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len), SDL_FALSE);
|
||||
if (!music)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError());
|
||||
|
|
|
@ -21,10 +21,12 @@
|
|||
#pragma warning(disable : 4214 4244)
|
||||
#endif
|
||||
|
||||
#ifdef SDL
|
||||
#ifdef HAVE_SDL
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
#include "sdlmain.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(default : 4214 4244)
|
||||
#endif
|
||||
|
@ -62,19 +64,11 @@ PFNglGetIntegerv pglGetIntegerv;
|
|||
PFNglGetString pglGetString;
|
||||
#endif
|
||||
|
||||
#ifdef _PSP
|
||||
static const Uint32 WOGLFlags = SDL_HWSURFACE|SDL_OPENGL/*|SDL_RESIZABLE*/;
|
||||
static const Uint32 FOGLFlags = SDL_HWSURFACE|SDL_OPENGL|SDL_FULLSCREEN;
|
||||
#else
|
||||
static const Uint32 WOGLFlags = SDL_OPENGL/*|SDL_RESIZABLE*/;
|
||||
static const Uint32 FOGLFlags = SDL_OPENGL|SDL_FULLSCREEN;
|
||||
#endif
|
||||
|
||||
/** \brief SDL video display surface
|
||||
*/
|
||||
SDL_Surface *vidSurface = NULL;
|
||||
INT32 oglflags = 0;
|
||||
void *GLUhandle = NULL;
|
||||
SDL_GLContext sdlglcontext = 0;
|
||||
|
||||
#ifndef STATIC_OPENGL
|
||||
void *GetGLFunc(const char *proc)
|
||||
|
@ -156,36 +150,13 @@ boolean LoadGL(void)
|
|||
|
||||
\return if true, changed video mode
|
||||
*/
|
||||
boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen)
|
||||
boolean OglSdlSurface(INT32 w, INT32 h)
|
||||
{
|
||||
INT32 cbpp;
|
||||
Uint32 OGLFlags;
|
||||
const GLvoid *glvendor = NULL, *glrenderer = NULL, *glversion = NULL;
|
||||
|
||||
cbpp = cv_scr_depth.value < 16 ? 16 : cv_scr_depth.value;
|
||||
|
||||
if (vidSurface)
|
||||
{
|
||||
//Alam: SDL_Video system free vidSurface for me
|
||||
#ifdef VOODOOSAFESWITCHING
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
SDL_InitSubSystem(SDL_INIT_VIDEO);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (isFullscreen)
|
||||
OGLFlags = FOGLFlags;
|
||||
else
|
||||
OGLFlags = WOGLFlags;
|
||||
|
||||
cbpp = SDL_VideoModeOK(w, h, cbpp, OGLFlags);
|
||||
if (cbpp < 16)
|
||||
return true; //Alam: Let just say we did, ok?
|
||||
|
||||
vidSurface = SDL_SetVideoMode(w, h, cbpp, OGLFlags);
|
||||
if (!vidSurface)
|
||||
return false;
|
||||
|
||||
glvendor = pglGetString(GL_VENDOR);
|
||||
// Get info and extensions.
|
||||
//BP: why don't we make it earlier ?
|
||||
|
@ -200,55 +171,21 @@ boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen)
|
|||
DBG_Printf("Extensions : %s\n", gl_extensions);
|
||||
oglflags = 0;
|
||||
|
||||
#ifdef _WIN32
|
||||
// BP: disable advenced feature that don't work on somes hardware
|
||||
// Hurdler: Now works on G400 with bios 1.6 and certified drivers 6.04
|
||||
if (strstr(glrenderer, "810")) oglflags |= GLF_NOZBUFREAD;
|
||||
#elif defined (unix) || defined (UNIXCOMMON)
|
||||
// disable advanced features not working on somes hardware
|
||||
if (strstr(glrenderer, "G200")) oglflags |= GLF_NOTEXENV;
|
||||
if (strstr(glrenderer, "G400")) oglflags |= GLF_NOTEXENV;
|
||||
#endif
|
||||
DBG_Printf("oglflags : 0x%X\n", oglflags );
|
||||
|
||||
#ifdef USE_PALETTED_TEXTURE
|
||||
if (isExtAvailable("GL_EXT_paletted_texture", gl_extensions))
|
||||
glColorTableEXT = SDL_GL_GetProcAddress("glColorTableEXT");
|
||||
else
|
||||
glColorTableEXT = NULL;
|
||||
#endif
|
||||
|
||||
#ifdef USE_WGL_SWAP
|
||||
if (isExtAvailable("WGL_EXT_swap_control", gl_extensions))
|
||||
wglSwapIntervalEXT = SDL_GL_GetProcAddress("wglSwapIntervalEXT");
|
||||
else
|
||||
wglSwapIntervalEXT = NULL;
|
||||
#else
|
||||
if (isExtAvailable("GLX_SGI_swap_control", gl_extensions))
|
||||
glXSwapIntervalSGIEXT = SDL_GL_GetProcAddress("glXSwapIntervalSGI");
|
||||
else
|
||||
glXSwapIntervalSGIEXT = NULL;
|
||||
#endif
|
||||
|
||||
#ifndef KOS_GL_COMPATIBILITY
|
||||
if (isExtAvailable("GL_EXT_texture_filter_anisotropic", gl_extensions))
|
||||
pglGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maximumAnisotropy);
|
||||
else
|
||||
#endif
|
||||
maximumAnisotropy = 0;
|
||||
maximumAnisotropy = 1;
|
||||
|
||||
granisotropicmode_cons_t[1].value = maximumAnisotropy;
|
||||
|
||||
SDL_GL_SetSwapInterval(cv_vidwait.value ? 1 : 0);
|
||||
|
||||
SetModelView(w, h);
|
||||
SetStates();
|
||||
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
HWR_Startup();
|
||||
#ifdef KOS_GL_COMPATIBILITY
|
||||
textureformatGL = GL_ARGB4444;
|
||||
#else
|
||||
textureformatGL = cbpp > 16 ? GL_RGBA : GL_RGB5_A1;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -264,17 +201,11 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
|||
static boolean oldwaitvbl = false;
|
||||
if (oldwaitvbl != waitvbl)
|
||||
{
|
||||
#ifdef USE_WGL_SWAP
|
||||
if (wglSwapIntervalEXT)
|
||||
wglSwapIntervalEXT(waitvbl);
|
||||
#else
|
||||
if (glXSwapIntervalSGIEXT)
|
||||
glXSwapIntervalSGIEXT(waitvbl);
|
||||
#endif
|
||||
SDL_GL_SetSwapInterval(waitvbl ? 1 : 0);
|
||||
}
|
||||
oldwaitvbl = waitvbl;
|
||||
|
||||
SDL_GL_SwapBuffers();
|
||||
SDL_GL_SwapWindow(window);
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI( OglSdlSetPalette) (RGBA_t *palette, RGBA_t *pgamma)
|
||||
|
@ -283,10 +214,6 @@ EXPORT void HWRAPI( OglSdlSetPalette) (RGBA_t *palette, RGBA_t *pgamma)
|
|||
UINT32 redgamma = pgamma->s.red, greengamma = pgamma->s.green,
|
||||
bluegamma = pgamma->s.blue;
|
||||
|
||||
#if 0 // changing the gamma to 127 is a bad idea
|
||||
i = SDL_SetGamma(byteasfloat(redgamma), byteasfloat(greengamma), byteasfloat(bluegamma));
|
||||
#endif
|
||||
if (i == 0) redgamma = greengamma = bluegamma = 0x7F; //Alam: cool
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
myPaletteData[i].s.red = (UINT8)MIN((palette[i].s.red * redgamma) /127, 255);
|
||||
|
@ -294,20 +221,6 @@ EXPORT void HWRAPI( OglSdlSetPalette) (RGBA_t *palette, RGBA_t *pgamma)
|
|||
myPaletteData[i].s.blue = (UINT8)MIN((palette[i].s.blue * bluegamma) /127, 255);
|
||||
myPaletteData[i].s.alpha = palette[i].s.alpha;
|
||||
}
|
||||
#ifdef USE_PALETTED_TEXTURE
|
||||
if (glColorTableEXT)
|
||||
{
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
palette_tex[(3*i)+0] = palette[i].s.red;
|
||||
palette_tex[(3*i)+1] = palette[i].s.green;
|
||||
palette_tex[(3*i)+2] = palette[i].s.blue;
|
||||
}
|
||||
glColorTableEXT(GL_TEXTURE_2D, GL_RGB8, 256, GL_RGB, GL_UNSIGNED_BYTE, palette_tex);
|
||||
}
|
||||
#endif
|
||||
// on a chang<6E>de palette, il faut recharger toutes les textures
|
||||
// jaja, und noch viel mehr ;-)
|
||||
Flush();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,13 +18,16 @@
|
|||
|
||||
#include "../v_video.h"
|
||||
|
||||
extern SDL_Surface *vidSurface;
|
||||
extern void *GLUhandle;
|
||||
|
||||
boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen);
|
||||
boolean OglSdlSurface(INT32 w, INT32 h);
|
||||
|
||||
void OglSdlFinishUpdate(boolean vidwait);
|
||||
|
||||
extern SDL_Window *window;
|
||||
extern SDL_Renderer *renderer;
|
||||
extern SDL_GLContext sdlglcontext;
|
||||
|
||||
#ifdef _CREATE_DLL_
|
||||
EXPORT void HWRAPI( OglSdlSetPalette ) (RGBA_t *palette, RGBA_t *pgamma);
|
||||
#endif
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#pragma warning(disable : 4214 4244)
|
||||
#endif
|
||||
|
||||
#if defined(SDL) && SOUND==SOUND_SDL
|
||||
#if defined(HAVE_SDL) && SOUND==SOUND_SDL
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
|
@ -856,6 +856,7 @@ FUNCINLINE static ATTRINLINE void I_UpdateStream16S(Uint8 *stream, int len)
|
|||
|
||||
if (Snd_Mutex) SDL_LockMutex(Snd_Mutex);
|
||||
|
||||
|
||||
// Mix sounds into the mixing buffer.
|
||||
// Loop over len
|
||||
while (len--)
|
||||
|
@ -945,6 +946,7 @@ FUNCINLINE static ATTRINLINE void I_UpdateStream16M(Uint8 *stream, int len)
|
|||
|
||||
if (Snd_Mutex) SDL_LockMutex(Snd_Mutex);
|
||||
|
||||
|
||||
// Mix sounds into the mixing buffer.
|
||||
// Loop over len
|
||||
while (len--)
|
||||
|
@ -1050,10 +1052,7 @@ static void SDLCALL I_UpdateStream(void *userdata, Uint8 *stream, int len)
|
|||
if (!sound_started || !userdata)
|
||||
return;
|
||||
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
if (musicStarted)
|
||||
memset(stream, 0x00, len); // only work in !AUDIO_U8, that needs 0x80
|
||||
#endif
|
||||
memset(stream, 0x00, len); // only work in !AUDIO_U8, that needs 0x80
|
||||
|
||||
if ((audio.channels != 1 && audio.channels != 2) ||
|
||||
(audio.format != AUDIO_S8 && audio.format != AUDIO_S16SYS))
|
||||
|
@ -1320,8 +1319,8 @@ void I_StartupSound(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
char ad[100];
|
||||
CONS_Printf(M_GetText(" Starting up with audio driver : %s\n"), SDL_AudioDriverName(ad, (int)sizeof ad));
|
||||
//char ad[100];
|
||||
//CONS_Printf(M_GetText(" Starting up with audio driver : %s\n"), SDL_AudioDriverName(ad, (int)sizeof ad));
|
||||
}
|
||||
samplecount = audio.samples;
|
||||
CV_SetValue(&cv_samplerate, audio.freq);
|
||||
|
@ -1782,7 +1781,9 @@ static boolean I_StartGMESong(const char *musicname, boolean looping)
|
|||
gme_set_user_data(emu, data);
|
||||
gme_set_user_cleanup(emu, I_CleanupGME);
|
||||
gme_start_track(emu, 0);
|
||||
#ifdef HAVE_MIXER
|
||||
gme_set_fade(emu, Digfade);
|
||||
#endif
|
||||
|
||||
Snd_LockAudio();
|
||||
localdata.gme_emu = emu;
|
||||
|
@ -2027,4 +2028,4 @@ static void SDLCALL I_FinishMusic(void)
|
|||
if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex);
|
||||
}
|
||||
#endif
|
||||
#endif //SDL
|
||||
#endif //HAVE_SDL
|
||||
|
|
|
@ -22,6 +22,11 @@
|
|||
extern SDL_bool consolevent;
|
||||
extern SDL_bool framebuffer;
|
||||
|
||||
#include "../m_fixed.h"
|
||||
|
||||
// SDL2 stub macro
|
||||
#define SDL2STUB(name) CONS_Printf("SDL2: stubbed: %s:%d\n", __func__, __LINE__)
|
||||
|
||||
/** \brief The JoyInfo_s struct
|
||||
|
||||
info about joystick
|
||||
|
|
506
src/sdl12/IMG_xpm.c
Normal file
|
@ -0,0 +1,506 @@
|
|||
/*
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1999-2004 Sam Lantinga
|
||||
|
||||
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
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* $Id: IMG_xpm.c,v 1.10 2004/01/04 22:04:38 slouken Exp $ */
|
||||
|
||||
/*
|
||||
* XPM (X PixMap) image loader:
|
||||
*
|
||||
* Supports the XPMv3 format, EXCEPT:
|
||||
* - hotspot coordinates are ignored
|
||||
* - only colour ('c') colour symbols are used
|
||||
* - rgb.txt is not used (for portability), so only RGB colours
|
||||
* are recognized (#rrggbb etc) - only a few basic colour names are
|
||||
* handled
|
||||
*
|
||||
* The result is an 8bpp indexed surface if possible, otherwise 32bpp.
|
||||
* The colourkey is correctly set if transparency is used.
|
||||
*
|
||||
* Besides the standard API, also provides
|
||||
*
|
||||
* SDL_Surface *IMG_ReadXPMFromArray(char **xpm)
|
||||
*
|
||||
* that reads the image data from an XPM file included in the C source.
|
||||
*
|
||||
* TODO: include rgb.txt here. The full table (from solaris 2.6) only
|
||||
* requires about 13K in binary form.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
//#include "SDL_image.h"
|
||||
|
||||
|
||||
#ifdef LOAD_XPM
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
#if 0
|
||||
int IMG_isXPM(SDL_RWops *src)
|
||||
{
|
||||
char magic[9];
|
||||
|
||||
return (SDL_RWread(src, magic, sizeof (magic), 1)
|
||||
&& memcmp(magic, "/* XPM */", 9) == 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Hash table to look up colors from pixel strings */
|
||||
#define STARTING_HASH_SIZE 256
|
||||
|
||||
struct hash_entry {
|
||||
char *key;
|
||||
Uint32 color;
|
||||
struct hash_entry *next;
|
||||
};
|
||||
|
||||
struct color_hash {
|
||||
struct hash_entry **table;
|
||||
struct hash_entry *entries; /* array of all entries */
|
||||
struct hash_entry *next_free;
|
||||
size_t size;
|
||||
int maxnum;
|
||||
};
|
||||
|
||||
static int hash_key(const char *key, int cpp, size_t size)
|
||||
{
|
||||
int hash;
|
||||
|
||||
hash = 0;
|
||||
while ( cpp-- > 0 ) {
|
||||
hash = hash * 33 + *key++;
|
||||
}
|
||||
return (int)(hash & (size - 1));
|
||||
}
|
||||
|
||||
static struct color_hash *create_colorhash(int maxnum)
|
||||
{
|
||||
size_t bytes;
|
||||
int s;
|
||||
struct color_hash *hash;
|
||||
|
||||
/* we know how many entries we need, so we can allocate
|
||||
everything here */
|
||||
hash = malloc(sizeof *hash);
|
||||
if (!hash)
|
||||
return NULL;
|
||||
|
||||
/* use power-of-2 sized hash table for decoding speed */
|
||||
for (s = STARTING_HASH_SIZE; s < maxnum; s <<= 1)
|
||||
;
|
||||
hash->size = s;
|
||||
hash->maxnum = maxnum;
|
||||
bytes = hash->size * sizeof (struct hash_entry **);
|
||||
hash->entries = NULL; /* in case malloc fails */
|
||||
hash->table = malloc(bytes);
|
||||
if (!hash->table)
|
||||
return NULL;
|
||||
memset(hash->table, 0, bytes);
|
||||
hash->entries = malloc(maxnum * sizeof (struct hash_entry));
|
||||
if (!hash->entries)
|
||||
{
|
||||
free(hash->table);
|
||||
return NULL;
|
||||
}
|
||||
hash->next_free = hash->entries;
|
||||
return hash;
|
||||
}
|
||||
|
||||
static int add_colorhash(struct color_hash *hash,
|
||||
char *key, int cpp, Uint32 color)
|
||||
{
|
||||
const int indexkey = hash_key(key, cpp, hash->size);
|
||||
struct hash_entry *e = hash->next_free++;
|
||||
e->color = color;
|
||||
e->key = key;
|
||||
e->next = hash->table[indexkey];
|
||||
hash->table[indexkey] = e;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* fast lookup that works if cpp == 1 */
|
||||
#define QUICK_COLORHASH(hash, key) ((hash)->table[*(const Uint8 *)(key)]->color)
|
||||
|
||||
static Uint32 get_colorhash(struct color_hash *hash, const char *key, int cpp)
|
||||
{
|
||||
struct hash_entry *entry = hash->table[hash_key(key, cpp, hash->size)];
|
||||
while (entry) {
|
||||
if (memcmp(key, entry->key, cpp) == 0)
|
||||
return entry->color;
|
||||
entry = entry->next;
|
||||
}
|
||||
return 0; /* garbage in - garbage out */
|
||||
}
|
||||
|
||||
static void free_colorhash(struct color_hash *hash)
|
||||
{
|
||||
if (hash && hash->table) {
|
||||
free(hash->table);
|
||||
free(hash->entries);
|
||||
free(hash);
|
||||
}
|
||||
}
|
||||
|
||||
/* portable case-insensitive string comparison */
|
||||
static int string_equal(const char *a, const char *b, size_t n)
|
||||
{
|
||||
while (*a && *b && n) {
|
||||
if (toupper((unsigned char)*a) != toupper((unsigned char)*b))
|
||||
return 0;
|
||||
a++;
|
||||
b++;
|
||||
n--;
|
||||
}
|
||||
return *a == *b;
|
||||
}
|
||||
|
||||
#undef ARRAYSIZE
|
||||
#define ARRAYSIZE(a) (int)(sizeof (a) / sizeof ((a)[0]))
|
||||
|
||||
/*
|
||||
* convert colour spec to RGB (in 0xrrggbb format).
|
||||
* return 1 if successful.
|
||||
*/
|
||||
static int color_to_rgb(const char *spec, size_t speclen, Uint32 *rgb)
|
||||
{
|
||||
/* poor man's rgb.txt */
|
||||
static struct { const char *name; Uint32 rgb; } known[] = {
|
||||
{"none", 0xffffffff},
|
||||
{"black", 0x00000000},
|
||||
{"white", 0x00ffffff},
|
||||
{"red", 0x00ff0000},
|
||||
{"green", 0x0000ff00},
|
||||
{"blue", 0x000000ff}
|
||||
};
|
||||
|
||||
if (spec[0] == '#') {
|
||||
char buf[7];
|
||||
switch (speclen) {
|
||||
case 4:
|
||||
buf[0] = buf[1] = spec[1];
|
||||
buf[2] = buf[3] = spec[2];
|
||||
buf[4] = buf[5] = spec[3];
|
||||
break;
|
||||
case 7:
|
||||
memcpy(buf, spec + 1, 6);
|
||||
break;
|
||||
case 13:
|
||||
buf[0] = spec[1];
|
||||
buf[1] = spec[2];
|
||||
buf[2] = spec[5];
|
||||
buf[3] = spec[6];
|
||||
buf[4] = spec[9];
|
||||
buf[5] = spec[10];
|
||||
break;
|
||||
}
|
||||
buf[6] = '\0';
|
||||
*rgb = (Uint32)strtol(buf, NULL, 16);
|
||||
return 1;
|
||||
} else {
|
||||
int i;
|
||||
for (i = 0; i < ARRAYSIZE(known); i++)
|
||||
if (string_equal(known[i].name, spec, speclen)) {
|
||||
*rgb = known[i].rgb;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
static char *linebuf;
|
||||
static int buflen;
|
||||
static const char *error;
|
||||
|
||||
/*
|
||||
* Read next line from the source.
|
||||
* If len > 0, it's assumed to be at least len chars (for efficiency).
|
||||
* Return NULL and set error upon EOF or parse error.
|
||||
*/
|
||||
static const char *get_next_line(const char ***lines, SDL_RWops *src, int len)
|
||||
{
|
||||
char *linebufnew;
|
||||
if (lines) {
|
||||
return *(*lines)++;
|
||||
} else {
|
||||
char c;
|
||||
int n;
|
||||
do {
|
||||
if (SDL_RWread(src, &c, 1, 1) <= 0) {
|
||||
error = "Premature end of data";
|
||||
return NULL;
|
||||
}
|
||||
} while (c != '"');
|
||||
if (len) {
|
||||
len += 4; /* "\",\n\0" */
|
||||
if (len > buflen){
|
||||
buflen = len;
|
||||
linebufnew = realloc(linebuf, buflen);
|
||||
if(!linebufnew) {
|
||||
free(linebuf);
|
||||
error = "Out of memory";
|
||||
return NULL;
|
||||
}
|
||||
linebuf = linebufnew;
|
||||
}
|
||||
if (SDL_RWread(src, linebuf, len - 1, 1) <= 0) {
|
||||
error = "Premature end of data";
|
||||
return NULL;
|
||||
}
|
||||
n = len - 2;
|
||||
} else {
|
||||
n = 0;
|
||||
do {
|
||||
if (n >= buflen - 1) {
|
||||
if (buflen == 0)
|
||||
buflen = 16;
|
||||
buflen *= 2;
|
||||
linebufnew = realloc(linebuf, buflen);
|
||||
if(!linebufnew) {
|
||||
free(linebuf);
|
||||
error = "Out of memory";
|
||||
return NULL;
|
||||
}
|
||||
linebuf = linebufnew;
|
||||
}
|
||||
if (SDL_RWread(src, linebuf + n, 1, 1) <= 0) {
|
||||
error = "Premature end of data";
|
||||
return NULL;
|
||||
}
|
||||
} while (linebuf[n++] != '"');
|
||||
n--;
|
||||
}
|
||||
linebuf[n] = '\0';
|
||||
return linebuf;
|
||||
}
|
||||
}
|
||||
|
||||
#define SKIPSPACE(p) \
|
||||
do { \
|
||||
while (isspace((unsigned char)*(p))) \
|
||||
++(p); \
|
||||
} while (0)
|
||||
|
||||
#define SKIPNONSPACE(p) \
|
||||
do { \
|
||||
while (!isspace((unsigned char)*(p)) && *p) \
|
||||
++(p); \
|
||||
} while (0)
|
||||
|
||||
/* read XPM from either array or RWops */
|
||||
static SDL_Surface *load_xpm(const char **xpm, SDL_RWops *src)
|
||||
{
|
||||
SDL_Surface *image = NULL;
|
||||
int indexc;
|
||||
int x, y;
|
||||
int w, h, ncolors, cpp;
|
||||
int indexed;
|
||||
Uint8 *dst;
|
||||
struct color_hash *colors = NULL;
|
||||
SDL_Color *im_colors = NULL;
|
||||
char *keystrings = NULL, *nextkey;
|
||||
const char *line;
|
||||
const char ***xpmlines = NULL;
|
||||
int pixels_len;
|
||||
|
||||
error = NULL;
|
||||
linebuf = NULL;
|
||||
buflen = 0;
|
||||
|
||||
if (xpm)
|
||||
xpmlines = &xpm;
|
||||
|
||||
line = get_next_line(xpmlines, src, 0);
|
||||
if (!line)
|
||||
goto done;
|
||||
/*
|
||||
* The header string of an XPMv3 image has the format
|
||||
*
|
||||
* <width> <height> <ncolors> <cpp> [ <hotspot_x> <hotspot_y> ]
|
||||
*
|
||||
* where the hotspot coords are intended for mouse cursors.
|
||||
* Right now we don't use the hotspots but it should be handled
|
||||
* one day.
|
||||
*/
|
||||
if (sscanf(line, "%d %d %d %d", &w, &h, &ncolors, &cpp) != 4
|
||||
|| w <= 0 || h <= 0 || ncolors <= 0 || cpp <= 0) {
|
||||
error = "Invalid format description";
|
||||
goto done;
|
||||
}
|
||||
|
||||
keystrings = malloc(ncolors * cpp);
|
||||
if (!keystrings) {
|
||||
error = "Out of memory";
|
||||
goto done;
|
||||
}
|
||||
nextkey = keystrings;
|
||||
|
||||
/* Create the new surface */
|
||||
if (ncolors <= 256) {
|
||||
indexed = 1;
|
||||
image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 8,
|
||||
0, 0, 0, 0);
|
||||
im_colors = image->format->palette->colors;
|
||||
image->format->palette->ncolors = ncolors;
|
||||
} else {
|
||||
indexed = 0;
|
||||
image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32,
|
||||
0xff0000, 0x00ff00, 0x0000ff, 0);
|
||||
}
|
||||
if (!image) {
|
||||
/* Hmm, some SDL error (out of memory?) */
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Read the colors */
|
||||
colors = create_colorhash(ncolors);
|
||||
if (!colors) {
|
||||
error = "Out of memory";
|
||||
goto done;
|
||||
}
|
||||
for (indexc = 0; indexc < ncolors; ++indexc ) {
|
||||
const char *p;
|
||||
line = get_next_line(xpmlines, src, 0);
|
||||
if (!line)
|
||||
goto done;
|
||||
|
||||
p = line + cpp + 1;
|
||||
|
||||
/* parse a colour definition */
|
||||
for (;;) {
|
||||
char nametype;
|
||||
const char *colname;
|
||||
Uint32 rgb, pixel;
|
||||
|
||||
SKIPSPACE(p);
|
||||
if (!*p) {
|
||||
error = "colour parse error";
|
||||
goto done;
|
||||
}
|
||||
nametype = *p;
|
||||
SKIPNONSPACE(p);
|
||||
SKIPSPACE(p);
|
||||
colname = p;
|
||||
SKIPNONSPACE(p);
|
||||
if (nametype == 's')
|
||||
continue; /* skip symbolic colour names */
|
||||
|
||||
if (!color_to_rgb(colname, p - colname, &rgb))
|
||||
continue;
|
||||
|
||||
memcpy(nextkey, line, cpp);
|
||||
if (indexed) {
|
||||
SDL_Color *c = im_colors + indexc;
|
||||
c->r = (Uint8)(rgb >> 16);
|
||||
c->g = (Uint8)(rgb >> 8);
|
||||
c->b = (Uint8)(rgb);
|
||||
pixel = indexc;
|
||||
} else
|
||||
pixel = rgb;
|
||||
add_colorhash(colors, nextkey, cpp, pixel);
|
||||
nextkey += cpp;
|
||||
if (rgb == 0xffffffff)
|
||||
SDL_SetColorKey(image, SDL_SRCCOLORKEY, pixel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Read the pixels */
|
||||
pixels_len = w * cpp;
|
||||
dst = image->pixels;
|
||||
for (y = 0; y < h; y++) {
|
||||
line = get_next_line(xpmlines, src, pixels_len);
|
||||
if (indexed) {
|
||||
/* optimization for some common cases */
|
||||
if (cpp == 1)
|
||||
for (x = 0; x < w; x++)
|
||||
dst[x] = (Uint8)QUICK_COLORHASH(colors,
|
||||
line + x);
|
||||
else
|
||||
for (x = 0; x < w; x++)
|
||||
dst[x] = (Uint8)get_colorhash(colors,
|
||||
line + x * cpp,
|
||||
cpp);
|
||||
} else {
|
||||
for (x = 0; x < w; x++)
|
||||
((Uint32*)dst)[x] = get_colorhash(colors,
|
||||
line + x * cpp,
|
||||
cpp);
|
||||
}
|
||||
dst += image->pitch;
|
||||
}
|
||||
|
||||
done:
|
||||
if (error) {
|
||||
SDL_FreeSurface(image);
|
||||
image = NULL;
|
||||
SDL_SetError(error);
|
||||
}
|
||||
free(keystrings);
|
||||
free_colorhash(colors);
|
||||
free(linebuf);
|
||||
return(image);
|
||||
}
|
||||
|
||||
/* Load a XPM type image from an RWops datasource */
|
||||
#if 0
|
||||
SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src)
|
||||
{
|
||||
if ( !src ) {
|
||||
/* The error message has been set in SDL_RWFromFile */
|
||||
return NULL;
|
||||
}
|
||||
return load_xpm(NULL, src);
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline SDL_Surface *IMG_ReadXPMFromArray(const char **xpm)
|
||||
{
|
||||
return load_xpm(xpm, NULL);
|
||||
}
|
||||
|
||||
#else /* not LOAD_XPM */
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
#if 0
|
||||
int IMG_isXPM(SDL_RWops *src)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Load a XPM type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline SDL_Surface *IMG_ReadXPMFromArray(const char **xpm)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif /* not LOAD_XPM */
|
17
src/sdl12/MakeCYG.cfg
Normal file
|
@ -0,0 +1,17 @@
|
|||
#
|
||||
# sdl/makeCYG.cfg for SRB2/Cygwin
|
||||
#
|
||||
|
||||
#
|
||||
#Cygwin, for debugging
|
||||
|
||||
NOHW=1
|
||||
NOHS=1
|
||||
NOASM=1
|
||||
|
||||
OPTS+=-DLINUX
|
||||
|
||||
i_system_o+=$(OBJDIR)/SRB2.res
|
||||
|
||||
# name of the exefile
|
||||
EXENAME?=lsdlsrb2.exe
|
92
src/sdl12/MakeNIX.cfg
Normal file
|
@ -0,0 +1,92 @@
|
|||
#
|
||||
# sdl/makeNIX.cfg for SRB2/?nix
|
||||
#
|
||||
|
||||
#Valgrind support
|
||||
ifdef VALGRIND
|
||||
VALGRIND_PKGCONFIG?=valgrind
|
||||
VALGRIND_CFLAGS?=$(shell $(PKG_CONFIG) $(VALGRIND_PKGCONFIG) --cflags)
|
||||
VALGRIND_LDFLAGS?=$(shell $(PKG_CONFIG) $(VALGRIND_PKGCONFIG) --libs)
|
||||
ZDEBUG=1
|
||||
LIBS+=$(VALGRIND_LDFLAGS)
|
||||
ifdef GCC46
|
||||
WFLAGS+=-Wno-error=unused-but-set-variable
|
||||
WFLAGS+=-Wno-unused-but-set-variable
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
#here is GNU/Linux and other
|
||||
#
|
||||
|
||||
OPTS=-DUNIXCOMMON
|
||||
|
||||
#LDFLAGS = -L/usr/local/lib
|
||||
LIBS=-lm
|
||||
ifdef LINUX
|
||||
LIBS+=-lrt
|
||||
ifdef NOTERMIOS
|
||||
OPTS+=-DNOTERMIOS
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
#here is Solaris
|
||||
#
|
||||
ifdef SOLARIS
|
||||
NOIPX=1
|
||||
NOASM=1
|
||||
OPTS+=-DSOLARIS -DINADDR_NONE=INADDR_ANY -DBSD_COMP
|
||||
OPTS+=-I/usr/local/include -I/opt/sfw/include
|
||||
LDFLAGS+=-L/opt/sfw/lib
|
||||
LIBS+=-lsocket -lnsl
|
||||
endif
|
||||
|
||||
#
|
||||
#here is FreeBSD
|
||||
#
|
||||
ifdef FREEBSD
|
||||
OPTS+=-DLINUX -DFREEBSD -I/usr/X11R6/include
|
||||
SDL_CONFIG?=sdl11-config
|
||||
LDFLAGS+=-L/usr/X11R6/lib
|
||||
LIBS+=-lipx -lkvm
|
||||
endif
|
||||
|
||||
#
|
||||
#here is GP2x (arm-gp2x-linux)
|
||||
#
|
||||
ifdef GP2X
|
||||
PNG_CONFIG?=$(PREFIX)-libpng12-config
|
||||
ifdef STATIC #need a better setting name
|
||||
CFLAGS+=-I$(OPEN2X)/include
|
||||
ifndef NOMIXER
|
||||
LIBS+=-lvorbisidec
|
||||
ifdef MIKMOD
|
||||
LIBS+=-lmikmod
|
||||
endif
|
||||
ifdef SMPEGLIB
|
||||
LIBS+=-lsmpeg
|
||||
LD=$(CXX)
|
||||
endif
|
||||
endif
|
||||
NONET=1
|
||||
endif
|
||||
ifndef ARCHNAME
|
||||
"error"
|
||||
endif
|
||||
NONX86=1
|
||||
NOHW=1
|
||||
NOHS=1
|
||||
NOMD5=1
|
||||
WFLAGS+=-O0
|
||||
OPTS+=-DGP2X -ffast-math -mcpu=arm920t
|
||||
EXENAME?=SRB2GP2X.gpe
|
||||
endif
|
||||
|
||||
ifndef NOHW
|
||||
OPTS+=-I/usr/X11R6/include
|
||||
LDFLAGS+=-L/usr/X11R6/lib
|
||||
endif
|
||||
|
||||
# name of the exefile
|
||||
EXENAME?=lsdlsrb2
|
163
src/sdl12/Makefile.cfg
Normal file
|
@ -0,0 +1,163 @@
|
|||
#
|
||||
# sdl/makefile.cfg for SRB2/SDL
|
||||
#
|
||||
|
||||
#
|
||||
#SDL...., *looks at Alam*, THIS IS A MESS!
|
||||
#
|
||||
|
||||
ifdef UNIXCOMMON
|
||||
include sdl/MakeNIX.cfg
|
||||
endif
|
||||
|
||||
ifdef PANDORA
|
||||
include sdl/SRB2Pandora/Makefile.cfg
|
||||
endif #ifdef PANDORA
|
||||
|
||||
ifdef DC
|
||||
include sdl/SRB2DC/Makefile.cfg
|
||||
endif #ifdef DC
|
||||
|
||||
ifdef PS3N
|
||||
include sdl/SRB2PS3/Makefile.cfg
|
||||
endif #ifdef PS3N
|
||||
|
||||
ifdef PSP
|
||||
include sdl/SRB2PSP/Makefile.cfg
|
||||
endif #ifdef PSP
|
||||
|
||||
ifdef XBOX
|
||||
include sdl/SRB2XBOX/Makefile.cfg
|
||||
endif #ifdef XBOX
|
||||
|
||||
ifdef WINCE
|
||||
include sdl/SRB2CE/Makefile.cfg
|
||||
endif #ifef WINCE
|
||||
|
||||
ifdef CYGWIN32
|
||||
include sdl/MakeCYG.cfg
|
||||
endif #ifdef CYGWIN32
|
||||
|
||||
ifdef SDL_PKGCONFIG
|
||||
SDL_CFLAGS?=$(shell $(PKG_CONFIG) $(SDL_PKGCONFIG) --cflags)
|
||||
SDL_LDFLAGS?=$(shell $(PKG_CONFIG) $(SDL_PKGCONFIG) --libs)
|
||||
else
|
||||
ifdef PREFIX
|
||||
SDL_CONFIG?=$(PREFIX)-sdl-config
|
||||
else
|
||||
SDL_CONFIG?=sdl-config
|
||||
endif
|
||||
|
||||
ifdef STATIC
|
||||
SDL_CFLAGS?=$(shell $(SDL_CONFIG) --cflags)
|
||||
SDL_LDFLAGS?=$(shell $(SDL_CONFIG) --static-libs)
|
||||
else
|
||||
SDL_CFLAGS?=$(shell $(SDL_CONFIG) --cflags)
|
||||
SDL_LDFLAGS?=$(shell $(SDL_CONFIG) --libs)
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
#use the x86 asm code
|
||||
ifndef CYGWIN32
|
||||
ifndef NOASM
|
||||
USEASM=1
|
||||
endif
|
||||
endif
|
||||
|
||||
OBJS+=$(OBJDIR)/i_video.o $(OBJDIR)/dosstr.o $(OBJDIR)/endtxt.o $(OBJDIR)/hwsym_sdl.o
|
||||
|
||||
OPTS+=-DDIRECTFULLSCREEN -DSDL
|
||||
|
||||
ifndef NOHW
|
||||
OBJS+=$(OBJDIR)/r_opengl.o $(OBJDIR)/ogl_sdl.o
|
||||
endif
|
||||
|
||||
ifndef NOHS
|
||||
ifdef OPENAL
|
||||
OBJS+=$(OBJDIR)/s_openal.o
|
||||
OPTS+=-DSTATIC3DS
|
||||
STATICHS=1
|
||||
else
|
||||
ifdef FMOD
|
||||
OBJS+=$(OBJDIR)/s_fmod.o
|
||||
OPTS+=-DSTATIC3DS
|
||||
STATICHS=1
|
||||
else
|
||||
ifdef MINGW
|
||||
ifdef DS3D
|
||||
OBJS+=$(OBJDIR)/s_ds3d.o
|
||||
OPTS+=-DSTATIC3DS
|
||||
STATICHS=1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef FILTERS
|
||||
OBJS+=$(OBJDIR)/filters.o $(OBJDIR)/hq2x.o $(OBJDIR)/lq2x.o
|
||||
OPTS+=-DHAVE_FILTER
|
||||
endif
|
||||
|
||||
ifdef NOMIXER
|
||||
i_sound_o=$(OBJDIR)/sdl_sound.o
|
||||
else
|
||||
i_sound_o=$(OBJDIR)/mixer_sound.o
|
||||
OPTS+=-DHAVE_MIXER
|
||||
SDL_LDFLAGS+=-lSDL_mixer
|
||||
endif
|
||||
|
||||
ifdef SDL_TTF
|
||||
OPTS+=-DHAVE_TTF
|
||||
SDL_LDFLAGS+=-lSDL_ttf -lfreetype -lz
|
||||
OBJS+=$(OBJDIR)/i_ttf.o
|
||||
endif
|
||||
|
||||
#ifdef SDL_IMAGE
|
||||
# OPTS+=-DHAVE_IMAGE
|
||||
# SDL_LDFLAGS+=-lSDL_image
|
||||
#endif
|
||||
|
||||
ifdef SDL_NET
|
||||
OPTS+=-DHAVE_SDLNET
|
||||
SDL_LDFLAGS+=-lSDL_net
|
||||
endif
|
||||
|
||||
ifdef SDLMAIN
|
||||
OPTS+=-DSDLMAIN
|
||||
else
|
||||
ifdef MINGW
|
||||
SDL_CFLAGS+=-Umain
|
||||
SDL_LDFLAGS+=-mconsole
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef NOHW
|
||||
ifdef OPENAL
|
||||
ifdef MINGW
|
||||
LIBS:=-lopenal32 $(LIBS)
|
||||
else
|
||||
LIBS:=-lopenal $(LIBS)
|
||||
endif
|
||||
else
|
||||
ifdef MINGW
|
||||
ifdef DS3D
|
||||
LIBS:=-ldsound -luuid $(LIBS)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# FIXME: DevkitPPC and ready-compiled SDL Wii require these things to be in a silly order
|
||||
ifdef WII
|
||||
include sdl/SRB2WII/Makefile.cfg
|
||||
endif #ifdef WII
|
||||
|
||||
CFLAGS+=$(SDL_CFLAGS)
|
||||
LIBS:=$(SDL_LDFLAGS) $(LIBS)
|
||||
ifndef WII
|
||||
ifdef STATIC
|
||||
LIBS+=$(shell $(SDL_CONFIG) --static-libs)
|
||||
endif
|
||||
endif
|
80
src/sdl12/SDL_icon.xpm
Normal file
|
@ -0,0 +1,80 @@
|
|||
/* XPM */
|
||||
static const char * SDL_icon_xpm[] = {
|
||||
"32 32 45 1",
|
||||
" c None",
|
||||
". c #6B6BFF",
|
||||
"+ c #3D00B9",
|
||||
"@ c #4848FF",
|
||||
"# c #2525FF",
|
||||
"$ c #310096",
|
||||
"% c #003196",
|
||||
"& c #003DB9",
|
||||
"* c #620096",
|
||||
"= c #6E6E6E",
|
||||
"- c #966200",
|
||||
"; c #250073",
|
||||
"> c #626262",
|
||||
", c #FF8F6B",
|
||||
"' c #FFC66B",
|
||||
") c #FFAB8E",
|
||||
"! c #000080",
|
||||
"~ c #B6B6B6",
|
||||
"{ c #929292",
|
||||
"] c #FFD48E",
|
||||
"^ c #0000B9",
|
||||
"/ c #565656",
|
||||
"( c #868686",
|
||||
"_ c #808080",
|
||||
": c #C0C0C0",
|
||||
"< c #DADADA",
|
||||
"[ c #F2F2F2",
|
||||
"} c #FFFFFF",
|
||||
"| c #CECECE",
|
||||
"1 c #AAAAAA",
|
||||
"2 c #E6E6E6",
|
||||
"3 c #000096",
|
||||
"4 c #AB8EFF",
|
||||
"5 c #190050",
|
||||
"6 c #000000",
|
||||
"7 c #8E8EFF",
|
||||
"8 c #3E3E3E",
|
||||
"9 c #7A7A7A",
|
||||
"0 c #0E0E0E",
|
||||
"a c #9E9E9E",
|
||||
"b c #001950",
|
||||
"c c #C2C2C2",
|
||||
"d c #323232",
|
||||
"e c #002573",
|
||||
"f c #A0A0A4",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" .+@##@. ",
|
||||
" @@.@#######@ ",
|
||||
" @@....######### ",
|
||||
" .. .@.....@+##$%%%&&% ",
|
||||
" ..@# @@....@+#*=-;%%%%% ",
|
||||
" ..@#@......@>,')!%%%$ ",
|
||||
" ~..$#.........{])^#+%/ ",
|
||||
" +##@.........()^@@@@@_ ",
|
||||
" $####@........#=#######+ ",
|
||||
" +######....@@##^#########_ ",
|
||||
" +#####=:<<:+##############/ ",
|
||||
"[<=####{<}}}}|###############= ",
|
||||
" }1###=2}}}}}}.############### ",
|
||||
" }<3#3~}}}}}}}4################ ",
|
||||
" }<5#6:}}}}}}}7################/",
|
||||
" }:6861}}}}}}}.########$$ 9 .@$",
|
||||
" }:0a6~}}}}}}}@######5b ",
|
||||
"22cd262}}}}}}2######5b$ ",
|
||||
" 2>1a}}}}}}}{(*###%be## ",
|
||||
" 860)1<[22c1)]]+##be### ",
|
||||
" ~)]]]))))]]]]]=#bb#### ",
|
||||
" )]]]]]]]]](]]=eb$#### ",
|
||||
" :]]]]]]]]]'9bbb$##### ",
|
||||
" ),'''''( >db+### ",
|
||||
" =##f ",
|
||||
" { ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
12
src/sdl12/SDL_main/SDL_dummy_main.c
Normal file
|
@ -0,0 +1,12 @@
|
|||
/* Include the SDL main definition header */
|
||||
#include "SDL_main.h"
|
||||
|
||||
#ifdef main
|
||||
#undef main
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
return(SDL_main(argc, argv));
|
||||
}
|
||||
#else
|
||||
/* Nothing to do on this platform */;
|
||||
#endif
|
11
src/sdl12/SDL_main/SDL_macosx_main.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
|
||||
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
|
||||
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
|
||||
|
||||
Feel free to customize this file to suit your needs
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface SDLMain : NSObject
|
||||
@end
|
374
src/sdl12/SDL_main/SDL_macosx_main.m
Normal file
|
@ -0,0 +1,374 @@
|
|||
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
|
||||
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
|
||||
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
|
||||
|
||||
Feel free to customize this file to suit your needs
|
||||
*/
|
||||
|
||||
#import "SDL.h"
|
||||
#import "SDL_macosx_main.h"
|
||||
#import <sys/param.h> /* for MAXPATHLEN */
|
||||
#import <unistd.h>
|
||||
|
||||
/* For some reaon, Apple removed setAppleMenu from the headers in 10.4,
|
||||
but the method still is there and works. To avoid warnings, we declare
|
||||
it ourselves here. */
|
||||
@interface NSApplication(SDL_Missing_Methods)
|
||||
- (void)setAppleMenu:(NSMenu *)menu;
|
||||
@end
|
||||
|
||||
/* Use this flag to determine whether we use SDLMain.nib or not */
|
||||
#define SDL_USE_NIB_FILE 0
|
||||
|
||||
/* Use this flag to determine whether we use CPS (docking) or not */
|
||||
#define SDL_USE_CPS 1
|
||||
#if SDL_USE_CPS
|
||||
/* Portions of CPS.h */
|
||||
typedef struct CPSProcessSerNum
|
||||
{
|
||||
UInt32 lo;
|
||||
UInt32 hi;
|
||||
} CPSProcessSerNum;
|
||||
|
||||
extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
|
||||
extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
|
||||
extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);
|
||||
|
||||
#endif /* SDL_USE_CPS */
|
||||
|
||||
static int gArgc;
|
||||
static char **gArgv;
|
||||
static BOOL gFinderLaunch;
|
||||
|
||||
static void addArgument(const char *value)
|
||||
{
|
||||
if(!gArgc)
|
||||
gArgv = (char **)malloc(sizeof(*gArgv));
|
||||
else
|
||||
{
|
||||
char **newgArgv = (char **)realloc(gArgv, sizeof(*gArgv) * (gArgc + 1));
|
||||
if (!newgArgv)
|
||||
{
|
||||
newgArgv = malloc(sizeof(*gArgv) * (gArgc + 1));
|
||||
memcpy(newgArgv, gArgv, sizeof(*gArgv) * gArgc);
|
||||
free(gArgv);
|
||||
}
|
||||
gArgv = newgArgv;
|
||||
}
|
||||
gArgc++;
|
||||
gArgv[gArgc - 1] = (char *)malloc(sizeof(char) * (strlen(value) + 1));
|
||||
strcpy(gArgv[gArgc - 1], value);
|
||||
}
|
||||
|
||||
static NSString *getApplicationName(void)
|
||||
{
|
||||
NSDictionary *dict;
|
||||
NSString *appName = NULL;
|
||||
|
||||
/* Determine the application name */
|
||||
dict = ( NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
|
||||
if (dict)
|
||||
appName = [dict objectForKey: @"CFBundleName"];
|
||||
|
||||
if (![appName length])
|
||||
appName = [[NSProcessInfo processInfo] processName];
|
||||
|
||||
return appName;
|
||||
}
|
||||
|
||||
#if SDL_USE_NIB_FILE
|
||||
/* A helper category for NSString */
|
||||
@interface NSString (ReplaceSubString)
|
||||
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString;
|
||||
@end
|
||||
#endif
|
||||
|
||||
@interface SDLApplication : NSApplication
|
||||
@end
|
||||
|
||||
@implementation SDLApplication
|
||||
/* Invoked from the Quit menu item */
|
||||
- (void)terminate:(id)sender
|
||||
{
|
||||
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
|
||||
(void)sender;
|
||||
#endif
|
||||
/* Post a SDL_QUIT event */
|
||||
SDL_Event event;
|
||||
event.type = SDL_QUIT;
|
||||
SDL_PushEvent(&event);
|
||||
}
|
||||
@end
|
||||
|
||||
/* The main class of the application, the application's delegate */
|
||||
@implementation SDLMain
|
||||
|
||||
/* Set the working directory to the .app's parent directory */
|
||||
- (void) setupWorkingDirectory:(BOOL)shouldChdir
|
||||
{
|
||||
if (shouldChdir)
|
||||
{
|
||||
char parentdir[MAXPATHLEN];
|
||||
CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
|
||||
CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url);
|
||||
if (CFURLGetFileSystemRepresentation(url2, true, (UInt8 *)parentdir, MAXPATHLEN))
|
||||
{
|
||||
assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */
|
||||
}
|
||||
CFRelease(url);
|
||||
CFRelease(url2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if SDL_USE_NIB_FILE
|
||||
|
||||
/* Fix menu to contain the real app name instead of "SDL App" */
|
||||
- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName
|
||||
{
|
||||
NSRange aRange;
|
||||
NSEnumerator *enumerator;
|
||||
NSMenuItem *menuItem;
|
||||
|
||||
aRange = [[aMenu title] rangeOfString:@"SDL App"];
|
||||
if (aRange.length != 0)
|
||||
[aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]];
|
||||
|
||||
enumerator = [[aMenu itemArray] objectEnumerator];
|
||||
while ((menuItem = [enumerator nextObject]))
|
||||
{
|
||||
aRange = [[menuItem title] rangeOfString:@"SDL App"];
|
||||
if (aRange.length != 0)
|
||||
[menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]];
|
||||
if ([menuItem hasSubmenu])
|
||||
[self fixMenu:[menuItem submenu] withAppName:appName];
|
||||
}
|
||||
[ aMenu sizeToFit ];
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void setApplicationMenu(void)
|
||||
{
|
||||
/* warning: this code is very odd */
|
||||
NSMenu *appleMenu;
|
||||
NSMenuItem *menuItem;
|
||||
NSString *title;
|
||||
NSString *appName;
|
||||
|
||||
appName = getApplicationName();
|
||||
appleMenu = [[NSMenu alloc] initWithTitle:@""];
|
||||
|
||||
/* Add menu items */
|
||||
title = [@"About " stringByAppendingString:appName];
|
||||
[appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
|
||||
|
||||
[appleMenu addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
title = [@"Hide " stringByAppendingString:appName];
|
||||
[appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];
|
||||
|
||||
menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
|
||||
[menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
|
||||
|
||||
[appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
|
||||
|
||||
[appleMenu addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
title = [@"Quit " stringByAppendingString:appName];
|
||||
[appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
|
||||
|
||||
|
||||
/* Put menu into the menubar */
|
||||
menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
|
||||
[menuItem setSubmenu:appleMenu];
|
||||
[[NSApp mainMenu] addItem:menuItem];
|
||||
|
||||
/* Tell the application object that this is now the application menu */
|
||||
[NSApp setAppleMenu:appleMenu];
|
||||
|
||||
/* Finally give up our references to the objects */
|
||||
[appleMenu release];
|
||||
[menuItem release];
|
||||
}
|
||||
|
||||
/* Create a window menu */
|
||||
static void setupWindowMenu(void)
|
||||
{
|
||||
NSMenu *windowMenu;
|
||||
NSMenuItem *windowMenuItem;
|
||||
NSMenuItem *menuItem;
|
||||
|
||||
windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
|
||||
|
||||
/* "Minimize" item */
|
||||
menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
|
||||
[windowMenu addItem:menuItem];
|
||||
[menuItem release];
|
||||
|
||||
/* Put menu into the menubar */
|
||||
windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
|
||||
[windowMenuItem setSubmenu:windowMenu];
|
||||
[[NSApp mainMenu] addItem:windowMenuItem];
|
||||
|
||||
/* Tell the application object that this is now the window menu */
|
||||
[NSApp setWindowsMenu:windowMenu];
|
||||
|
||||
/* Finally give up our references to the objects */
|
||||
[windowMenu release];
|
||||
[windowMenuItem release];
|
||||
}
|
||||
|
||||
/* Replacement for NSApplicationMain */
|
||||
static void CustomApplicationMain (int argc, char **argv)
|
||||
{
|
||||
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
#endif
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
SDLMain *sdlMain;
|
||||
|
||||
/* Ensure the application object is initialised */
|
||||
[SDLApplication sharedApplication];
|
||||
|
||||
#if SDL_USE_CPS
|
||||
{
|
||||
CPSProcessSerNum PSN;
|
||||
/* Tell the dock about us */
|
||||
if (!CPSGetCurrentProcess(&PSN))
|
||||
if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
|
||||
if (!CPSSetFrontProcess(&PSN))
|
||||
[SDLApplication sharedApplication];
|
||||
}
|
||||
#endif /* SDL_USE_CPS */
|
||||
|
||||
/* Set up the menubar */
|
||||
[NSApp setMainMenu:[[NSMenu alloc] init]];
|
||||
setApplicationMenu();
|
||||
setupWindowMenu();
|
||||
|
||||
/* Create SDLMain and make it the app delegate */
|
||||
sdlMain = [[SDLMain alloc] init];
|
||||
[NSApp setDelegate:sdlMain];
|
||||
|
||||
/* Start the main event loop */
|
||||
[NSApp run];
|
||||
|
||||
[sdlMain release];
|
||||
[pool release];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
|
||||
{
|
||||
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
|
||||
(void)theApplication;
|
||||
#endif
|
||||
addArgument("-iwad");
|
||||
addArgument([filename UTF8String]);
|
||||
return YES;
|
||||
}
|
||||
|
||||
/* Called when the internal event loop has just started running */
|
||||
- (void) applicationDidFinishLaunching: (NSNotification *) note
|
||||
{
|
||||
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
|
||||
(void)note;
|
||||
#endif
|
||||
int status;
|
||||
|
||||
/* Set the working directory to the .app's parent directory */
|
||||
[self setupWorkingDirectory:gFinderLaunch];
|
||||
|
||||
#if SDL_USE_NIB_FILE
|
||||
/* Set the main menu to contain the real app name instead of "SDL App" */
|
||||
[self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()];
|
||||
#endif
|
||||
|
||||
if (!getenv("SRB2WADDIR"))
|
||||
setenv("SRB2WADDIR", [[[NSBundle mainBundle] resourcePath] UTF8String], 1);
|
||||
|
||||
/* Hand off to main application code */
|
||||
status = SDL_main (gArgc, gArgv);
|
||||
|
||||
/* We're done, thank you for playing */
|
||||
exit(status);
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@implementation NSString (ReplaceSubString)
|
||||
|
||||
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString
|
||||
{
|
||||
size_t bufferSize;
|
||||
size_t selfLen = [self length];
|
||||
size_t aStringLen = [aString length];
|
||||
unichar *buffer;
|
||||
NSRange localRange;
|
||||
NSString *result;
|
||||
|
||||
bufferSize = selfLen + aStringLen - aRange.length;
|
||||
buffer = NSAllocateMemoryPages(bufferSize*sizeof(unichar));
|
||||
|
||||
/* Get first part into buffer */
|
||||
localRange.location = 0;
|
||||
localRange.length = aRange.location;
|
||||
[self getCharacters:buffer range:localRange];
|
||||
|
||||
/* Get middle part into buffer */
|
||||
localRange.location = 0;
|
||||
localRange.length = aStringLen;
|
||||
[aString getCharacters:(buffer+aRange.location) range:localRange];
|
||||
|
||||
/* Get last part into buffer */
|
||||
localRange.location = aRange.location + aRange.length;
|
||||
localRange.length = selfLen - localRange.location;
|
||||
[self getCharacters:(buffer+aRange.location+aStringLen) range:localRange];
|
||||
|
||||
/* Build output string */
|
||||
result = [NSString stringWithCharacters:buffer length:bufferSize];
|
||||
|
||||
NSDeallocateMemoryPages(buffer, bufferSize);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
#ifdef main
|
||||
# undef main
|
||||
#endif
|
||||
|
||||
|
||||
/* Main entry point to executable - should *not* be SDL_main! */
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
|
||||
/* Copy the arguments into a global variable */
|
||||
|
||||
/* This is passed if we are launched by double-clicking */
|
||||
if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
|
||||
gArgc = 1;
|
||||
gFinderLaunch = YES;
|
||||
} else {
|
||||
gArgc = argc;
|
||||
gFinderLaunch = NO;
|
||||
}
|
||||
gArgv = argv;
|
||||
|
||||
/* Some additional arguments we always want to run with. */
|
||||
//addArgument("-opengl");
|
||||
|
||||
#if SDL_USE_NIB_FILE
|
||||
[SDLApplication poseAsClass:[NSApplication class]];
|
||||
NSApplicationMain (argc, argv);
|
||||
#else
|
||||
CustomApplicationMain (argc, argv);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
7
src/sdl12/SDL_main/SDL_openxdk_main.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
/* Include the SDL main definition header */
|
||||
#include "SDL_main.h"
|
||||
|
||||
void XBoxStartup()
|
||||
{
|
||||
SDL_main(0, NULL); /// \todo ?
|
||||
}
|
406
src/sdl12/SDL_main/SDL_win32_main.c
Normal file
|
@ -0,0 +1,406 @@
|
|||
/*
|
||||
SDL_main.c, placed in the public domain by Sam Lantinga 4/13/98
|
||||
|
||||
The WinMain function -- calls your program's main() function
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#define RPC_NO_WINDOWS_H
|
||||
#include <windows.h>
|
||||
#include <malloc.h> /* For _alloca() */
|
||||
|
||||
#include <tchar.h>
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
# define DIR_SEPERATOR TEXT("\\")
|
||||
# define _tgetcwd(str,len) wcscpy(str,TEXT(""))
|
||||
# define setbuf(f,b)
|
||||
# define setvbuf(w,x,y,z)
|
||||
# define _tremove(x) DeleteFile(x)
|
||||
#else
|
||||
# define DIR_SEPERATOR TEXT("/")
|
||||
# include <direct.h>
|
||||
#endif
|
||||
|
||||
/* Include the SDL main definition header */
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4214 4244)
|
||||
#endif
|
||||
#include "SDL.h"
|
||||
#include "SDL_main.h"
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(default : 4214 4244)
|
||||
#endif
|
||||
#include "../../win32/win_dbg.h"
|
||||
#define USE_MESSAGEBOX
|
||||
|
||||
#ifdef main
|
||||
# ifndef _WIN32_WCE_EMULATION
|
||||
# undef main
|
||||
# endif /* _WIN32_WCE_EMULATION */
|
||||
#endif /* main */
|
||||
|
||||
/* The standard output files */
|
||||
//#ifdef _WIN32_WCE
|
||||
//#define STDOUT_FILE TEXT("/Storage Card/SRB2DEMO/stdout.txt")
|
||||
//#define STDERR_FILE TEXT("/Storage Card/SRB2DEMO/stderr.txt")
|
||||
//#else
|
||||
#define STDOUT_FILE TEXT("stdout.txt")
|
||||
#define STDERR_FILE TEXT("stderr.txt")
|
||||
//#endif
|
||||
|
||||
#ifndef NO_STDIO_REDIRECT
|
||||
static TCHAR stdoutPath[MAX_PATH];
|
||||
static TCHAR stderrPath[MAX_PATH];
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32_WCE) && _WIN32_WCE < 300
|
||||
/* seems to be undefined in Win CE although in online help */
|
||||
#define isspace(a) (((CHAR)a == ' ') || ((CHAR)a == '\t'))
|
||||
|
||||
/* seems to be undefined in Win CE although in online help */
|
||||
char *strrchr(char *str, int c)
|
||||
{
|
||||
char *p;
|
||||
|
||||
/* Skip to the end of the string */
|
||||
p=str;
|
||||
while (*p)
|
||||
p++;
|
||||
|
||||
/* Look for the given character */
|
||||
while ( (p >= str) && (*p != (CHAR)c) )
|
||||
p--;
|
||||
|
||||
/* Return NULL if character not found */
|
||||
if ( p < str ) {
|
||||
p = NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
#endif /* _WIN32_WCE < 300 */
|
||||
|
||||
/* Parse a command line buffer into arguments */
|
||||
static int ParseCommandLine(char *cmdline, char **argv)
|
||||
{
|
||||
char *bufp;
|
||||
int argc;
|
||||
|
||||
argc = 0;
|
||||
for ( bufp = cmdline; *bufp; ) {
|
||||
/* Skip leading whitespace */
|
||||
while ( isspace(*bufp) ) {
|
||||
++bufp;
|
||||
}
|
||||
/* Skip over argument */
|
||||
if ( *bufp == '"' ) {
|
||||
++bufp;
|
||||
if ( *bufp ) {
|
||||
if ( argv ) {
|
||||
argv[argc] = bufp;
|
||||
}
|
||||
++argc;
|
||||
}
|
||||
/* Skip over word */
|
||||
while ( *bufp && (*bufp != '"') ) {
|
||||
++bufp;
|
||||
}
|
||||
} else {
|
||||
if ( *bufp ) {
|
||||
if ( argv ) {
|
||||
argv[argc] = bufp;
|
||||
}
|
||||
++argc;
|
||||
}
|
||||
/* Skip over word */
|
||||
while ( *bufp && ! isspace(*bufp) ) {
|
||||
++bufp;
|
||||
}
|
||||
}
|
||||
if ( *bufp ) {
|
||||
if ( argv ) {
|
||||
*bufp = '\0';
|
||||
}
|
||||
++bufp;
|
||||
}
|
||||
}
|
||||
if ( argv ) {
|
||||
argv[argc] = NULL;
|
||||
}
|
||||
return(argc);
|
||||
}
|
||||
|
||||
/* Show an error message */
|
||||
static void ShowError(const char *title, const char *message)
|
||||
{
|
||||
/* If USE_MESSAGEBOX is defined, you need to link with user32.lib */
|
||||
#ifdef USE_MESSAGEBOX
|
||||
MessageBoxA(NULL,
|
||||
message,
|
||||
title,
|
||||
MB_ICONEXCLAMATION|MB_OK);
|
||||
#else
|
||||
fprintf(stderr, "%s: %s\n", title, message);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Pop up an out of memory message, returns to Windows */
|
||||
static BOOL OutOfMemory(void)
|
||||
{
|
||||
ShowError("Fatal Error", "Out of memory - aborting");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Remove the output files if there was no output written */
|
||||
static void __cdecl cleanup_output(void)
|
||||
{
|
||||
#ifndef NO_STDIO_REDIRECT
|
||||
FILE *file;
|
||||
int empty;
|
||||
#endif
|
||||
|
||||
/* Flush the output in case anything is queued */
|
||||
fclose(stdout);
|
||||
fclose(stderr);
|
||||
|
||||
#ifndef NO_STDIO_REDIRECT
|
||||
/* See if the files have any output in them */
|
||||
if ( stdoutPath[0] ) {
|
||||
file = _tfopen(stdoutPath, TEXT("rb"));
|
||||
if ( file ) {
|
||||
empty = (fgetc(file) == EOF) ? 1 : 0;
|
||||
fclose(file);
|
||||
if ( empty ) {
|
||||
_tremove(stdoutPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( stderrPath[0] ) {
|
||||
file = _tfopen(stderrPath, TEXT("rb"));
|
||||
if ( file ) {
|
||||
empty = (fgetc(file) == EOF) ? 1 : 0;
|
||||
fclose(file);
|
||||
if ( empty ) {
|
||||
_tremove(stderrPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(_WIN32_WCE)
|
||||
/* The VC++ compiler needs main defined */
|
||||
#define console_main main
|
||||
#endif
|
||||
|
||||
/* This is where execution begins [console apps] */
|
||||
int console_main(int argc, char *argv[])
|
||||
{
|
||||
size_t n;
|
||||
int st;
|
||||
char *bufp, *appname;
|
||||
|
||||
/* Get the class name from argv[0] */
|
||||
appname = argv[0];
|
||||
if ( (bufp=strrchr(argv[0], '\\')) != NULL ) {
|
||||
appname = bufp+1;
|
||||
} else
|
||||
if ( (bufp=strrchr(argv[0], '/')) != NULL ) {
|
||||
appname = bufp+1;
|
||||
}
|
||||
|
||||
if ( (bufp=strrchr(appname, '.')) == NULL )
|
||||
n = strlen(appname);
|
||||
else
|
||||
n = (bufp-appname);
|
||||
|
||||
bufp = (char *)alloca(n+1);
|
||||
if ( bufp == NULL ) {
|
||||
return OutOfMemory();
|
||||
}
|
||||
strncpy(bufp, appname, n);
|
||||
bufp[n] = '\0';
|
||||
appname = bufp;
|
||||
|
||||
/* Load SDL dynamic link library */
|
||||
if ( SDL_Init(SDL_INIT_NOPARACHUTE) < 0 ) {
|
||||
ShowError("WinMain() error", SDL_GetError());
|
||||
return(FALSE);
|
||||
}
|
||||
atexit(cleanup_output);
|
||||
atexit(SDL_Quit);
|
||||
|
||||
#ifndef DISABLE_VIDEO
|
||||
#if 0
|
||||
/* Create and register our class *
|
||||
DJM: If we do this here, the user nevers gets a chance to
|
||||
putenv(SDL_WINDOWID). This is already called later by
|
||||
the (DIB|DX5)_CreateWindow function, so it should be
|
||||
safe to comment it out here.
|
||||
if ( SDL_RegisterApp(appname, CS_BYTEALIGNCLIENT,
|
||||
GetModuleHandle(NULL)) < 0 ) {
|
||||
ShowError("WinMain() error", SDL_GetError());
|
||||
exit(1);
|
||||
}*/
|
||||
#else
|
||||
/* Sam:
|
||||
We still need to pass in the application handle so that
|
||||
DirectInput will initialize properly when SDL_RegisterApp()
|
||||
is called later in the video initialization.
|
||||
*/
|
||||
SDL_SetModuleHandle(GetModuleHandle(NULL));
|
||||
#endif /* 0 */
|
||||
#endif /* !DISABLE_VIDEO */
|
||||
|
||||
/* Run the application main() code */
|
||||
st = SDL_main(argc, argv);
|
||||
|
||||
/* Exit cleanly, calling atexit() functions */
|
||||
//exit(0);
|
||||
cleanup_output();
|
||||
SDL_Quit();
|
||||
|
||||
/* Hush little compiler, don't you cry... */
|
||||
return st;
|
||||
}
|
||||
|
||||
/* This is where execution begins [windowed apps] */
|
||||
#ifdef _WIN32_WCE
|
||||
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPWSTR szCmdLine, int sw)
|
||||
#else
|
||||
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
|
||||
#endif
|
||||
{
|
||||
HINSTANCE handle;
|
||||
int Result = -1;
|
||||
char **argv;
|
||||
int argc;
|
||||
LPSTR cmdline;
|
||||
#ifdef _WIN32_WCE
|
||||
size_t nLen;
|
||||
LPTSTR bufp;
|
||||
#else
|
||||
LPSTR bufp;
|
||||
#endif
|
||||
#ifndef NO_STDIO_REDIRECT
|
||||
FILE *newfp;
|
||||
#endif
|
||||
|
||||
/* Start up DDHELP.EXE before opening any files, so DDHELP doesn't
|
||||
keep them open. This is a hack.. hopefully it will be fixed
|
||||
someday. DDHELP.EXE starts up the first time DDRAW.DLL is loaded.
|
||||
*/
|
||||
hPrev = hInst = NULL;
|
||||
sw = 0;
|
||||
handle = LoadLibrary(TEXT("DDRAW.DLL"));
|
||||
if ( handle != NULL ) {
|
||||
FreeLibrary(handle);
|
||||
}
|
||||
|
||||
#ifndef NO_STDIO_REDIRECT
|
||||
_tgetcwd( stdoutPath, sizeof( stdoutPath ) );
|
||||
_tcscat( stdoutPath, DIR_SEPERATOR STDOUT_FILE );
|
||||
|
||||
/* Redirect standard input and standard output */
|
||||
newfp = _tfreopen(stdoutPath, TEXT("w"), stdout);
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
if ( newfp == NULL ) { /* This happens on NT */
|
||||
#if !defined(stdout)
|
||||
stdout = _tfopen(stdoutPath, TEXT("w"));
|
||||
#else
|
||||
newfp = _tfopen(stdoutPath, TEXT("w"));
|
||||
if ( newfp ) {
|
||||
*stdout = *newfp;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif /* _WIN32_WCE */
|
||||
|
||||
_tgetcwd( stderrPath, sizeof( stderrPath ) );
|
||||
_tcscat( stderrPath, DIR_SEPERATOR STDERR_FILE );
|
||||
|
||||
newfp = _tfreopen(stderrPath, TEXT("w"), stderr);
|
||||
#ifndef _WIN32_WCE
|
||||
if ( newfp == NULL ) { /* This happens on NT */
|
||||
#if !defined(stderr)
|
||||
stderr = _tfopen(stderrPath, TEXT("w"));
|
||||
#else
|
||||
newfp = _tfopen(stderrPath, TEXT("w"));
|
||||
if ( newfp ) {
|
||||
*stderr = *newfp;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif /* _WIN32_WCE */
|
||||
|
||||
setvbuf(stdout, NULL, _IOLBF, BUFSIZ); /* Line buffered */
|
||||
setbuf(stderr, NULL); /* No buffering */
|
||||
#endif /* !NO_STDIO_REDIRECT */
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
nLen = wcslen(szCmdLine)+128+1;
|
||||
bufp = (wchar_t *)alloca(nLen*2);
|
||||
wcscpy (bufp, TEXT("\""));
|
||||
GetModuleFileName(NULL, bufp+1, 128-3);
|
||||
wcscpy (bufp+wcslen(bufp), TEXT("\" "));
|
||||
wcsncpy(bufp+wcslen(bufp), szCmdLine,nLen-wcslen(bufp));
|
||||
nLen = wcslen(bufp)+1;
|
||||
cmdline = (char *)alloca(nLen);
|
||||
if ( cmdline == NULL ) {
|
||||
return OutOfMemory();
|
||||
}
|
||||
WideCharToMultiByte(CP_ACP, 0, bufp, -1, cmdline, nLen, NULL, NULL);
|
||||
#else
|
||||
szCmdLine = NULL;
|
||||
/* Grab the command line (use alloca() on Windows) */
|
||||
bufp = GetCommandLineA();
|
||||
cmdline = (LPSTR)alloca(strlen(bufp)+1);
|
||||
if ( cmdline == NULL ) {
|
||||
return OutOfMemory();
|
||||
}
|
||||
strcpy(cmdline, bufp);
|
||||
#endif
|
||||
|
||||
/* Parse it into argv and argc */
|
||||
argc = ParseCommandLine(cmdline, NULL);
|
||||
argv = (char **)alloca((argc+1)*(sizeof *argv));
|
||||
if ( argv == NULL ) {
|
||||
return OutOfMemory();
|
||||
}
|
||||
ParseCommandLine(cmdline, argv);
|
||||
|
||||
#ifdef BUGTRAP
|
||||
/* Try BugTrap. */
|
||||
if(InitBugTrap())
|
||||
Result = console_main(argc, argv);
|
||||
else
|
||||
{
|
||||
#endif
|
||||
|
||||
/* Run the main program (after a little SDL initialization) */
|
||||
#ifndef _WIN32_WCE
|
||||
__try
|
||||
#endif
|
||||
{
|
||||
Result = console_main(argc, argv);
|
||||
}
|
||||
#ifndef _WIN32_WCE
|
||||
__except ( RecordExceptionInfo(GetExceptionInformation()))
|
||||
{
|
||||
SetUnhandledExceptionFilter(EXCEPTION_CONTINUE_SEARCH); //Do nothing here.
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BUGTRAP
|
||||
} /* BT failure clause. */
|
||||
|
||||
/* This is safe even if BT didn't start. */
|
||||
ShutdownBugTrap();
|
||||
#endif
|
||||
|
||||
return Result;
|
||||
}
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
39
src/sdl12/SRB2Pandora/Makefile.cfg
Normal file
|
@ -0,0 +1,39 @@
|
|||
# Quick Pandora target to make a compliant SRB2 PND file.
|
||||
|
||||
PNDNAME=SRB2.pnd
|
||||
PNDDIR=$(BIN)/pnd
|
||||
ICON=sdl/SRB2Pandora/icon.png
|
||||
PXML=sdl/SRB2Pandora/PXML.xml
|
||||
|
||||
SED=sed
|
||||
CAT=cat
|
||||
CP=cp
|
||||
XARGS=xargs
|
||||
FOR=for
|
||||
WGET=wget -P $(PNDDIR) -c -nc
|
||||
|
||||
SHXARGS:=$(XARGS)
|
||||
SHSED:=$(SED)
|
||||
|
||||
ifndef ECHO
|
||||
CP:=@$(CP)
|
||||
CAT:=@$(CAT)
|
||||
SED:=@$(SED)
|
||||
XARGS:=@$(XARGS)
|
||||
FOR:=@(FOR)
|
||||
endif
|
||||
|
||||
$(BIN)/$(PNDNAME): $(BIN)/$(EXENAME)
|
||||
@echo Linking $(PNDNAME)...
|
||||
$(MKDIR) $(PNDDIR)
|
||||
$(CP) $(BIN)/$(EXENAME) $(PNDDIR)
|
||||
$(CP) $(ICON) $(PNDDIR)
|
||||
$(CP) $(PXML) $(PNDDIR)
|
||||
ifdef WITHDATA
|
||||
$(FOR) datafile in $(shell echo $(D_FILES) | $(SHSED) 's/\.srb/\.wad/' | $(SHXARGS) -n 1 basename); do \
|
||||
$(WGET) http://alam.srb2.org/SRB2/2.0.6-Final/Resources/$$datafile; \
|
||||
done
|
||||
endif
|
||||
$(MKISOFS) -l -r -o $@ $(PNDDIR)
|
||||
$(CAT) $(PXML) >> $@
|
||||
$(REMOVE) -r $(PNDDIR)
|
17
src/sdl12/SRB2Pandora/PXML.xml
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<PXML xmlns="http://openpandora.org/namespaces/PXML">
|
||||
<application id="srb2.pandora.v20" appdata="srb2">
|
||||
<title lang="en_US">Sonic Robo Blast 2</title>
|
||||
<title lang="ja_JA">ソニック・ロボ・ブラスト・2</title>
|
||||
<description lang="en_US">A 3D Sonic fangame with a huge fanbase developing custom content, including characters, levels, and even large-scale modifications</description>
|
||||
<version major="2" minor="0" release="6" build="1" />
|
||||
<exec command="lsdlsrb2" background="true" standalone="true" x11="ignore"/>
|
||||
<author name="Sonic Team Junior" website="http://www.srb2.org/" email="stjr@srb2.org"/>
|
||||
<icon src="icon.png"/>
|
||||
<categories>
|
||||
<category name="Game">
|
||||
<subcategory name="ActionGame" />
|
||||
</category>
|
||||
</categories>
|
||||
</application>
|
||||
</PXML>
|
BIN
src/sdl12/SRB2Pandora/icon.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
1464
src/sdl12/Srb2SDL-vc10.vcxproj
Normal file
5845
src/sdl12/Srb2SDL-vc9.vcproj
Normal file
1057
src/sdl12/Srb2SDL.dsp
Normal file
74
src/sdl12/Srb2SDL.dsw
Normal file
|
@ -0,0 +1,74 @@
|
|||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "Srb2SDL"=.\Srb2SDL.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name libpng
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name zlib
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "libpng"="..\..\libs\libpng-src\projects\visualc6\libpng.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name zlib
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "s_openal"=..\hardware\s_openal\s_openal.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "zlib"=..\..\libs\zlib\projects\visualc6\zlib.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
BIN
src/sdl12/Srb2SDL.ico
Normal file
After Width: | Height: | Size: 2.2 KiB |
38
src/sdl12/dosstr.c
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// This file is in the public domain.
|
||||
// (Re)written by Graue in 2006.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \brief String uppercasing/lowercasing functions for non-DOS non-Win32
|
||||
/// systems
|
||||
|
||||
#include "../doomtype.h"
|
||||
|
||||
#ifndef HAVE_DOSSTR_FUNCS
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
int strupr(char *n)
|
||||
{
|
||||
while (*n != '\0')
|
||||
{
|
||||
*n = toupper(*n);
|
||||
n++;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int strlwr(char *n)
|
||||
{
|
||||
while (*n != '\0')
|
||||
{
|
||||
*n = tolower(*n);
|
||||
n++;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
236
src/sdl12/endtxt.c
Normal file
|
@ -0,0 +1,236 @@
|
|||
/*
|
||||
* Function to write the SRB2 end message text
|
||||
*
|
||||
* Copyright (C) 1998 by Udo Munk <udo@umserver.umnet.de>
|
||||
*
|
||||
* This code is provided AS IS and there are no guarantees, none.
|
||||
* Feel free to share and modify.
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \brief Support to show ENDOOM text
|
||||
///
|
||||
/// Loads the lump ENDOOM, set up the console to print
|
||||
/// out the colors and text
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// need this 19990118 by Kin
|
||||
#include "../doomdef.h"
|
||||
#include "../w_wad.h"
|
||||
#include "../z_zone.h"
|
||||
#include "endtxt.h"
|
||||
/** \brief The ShowEndTxt function
|
||||
|
||||
|
||||
Prints out the ENDOOM the way DOOM.EXE/DOOM2.EXE did for Win32 or Linux/GNU
|
||||
|
||||
\return void
|
||||
|
||||
|
||||
*/
|
||||
|
||||
void ShowEndTxt(void)
|
||||
{
|
||||
#if !(defined (_WIN32_WCE) || defined (_XBOX) || defined (_arch_dreamcast))
|
||||
INT32 i;
|
||||
UINT16 j, att = 0;
|
||||
INT32 nlflag = 1;
|
||||
#ifdef _WIN32
|
||||
HANDLE co = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
DWORD mode, bytesWritten;
|
||||
CONSOLE_SCREEN_BUFFER_INFO backupcon;
|
||||
COORD resizewin = {80,-1};
|
||||
CHAR let = 0;
|
||||
#endif
|
||||
UINT16 *ptext;
|
||||
void *data;
|
||||
lumpnum_t endoomnum = W_GetNumForName("ENDOOM");
|
||||
//char *col;
|
||||
|
||||
/* if the xterm has more then 80 columns we need to add nl's */
|
||||
/* doesn't work, COLUMNS is not in the environment at this time ???
|
||||
col = I_getenv("COLUMNS");
|
||||
if (col) {
|
||||
if (atoi(col) > 80)
|
||||
nlflag++;
|
||||
}
|
||||
*/
|
||||
|
||||
/* get the lump with the text */
|
||||
data = ptext = W_CacheLumpNum(endoomnum, PU_CACHE);
|
||||
|
||||
#ifdef _WIN32
|
||||
if (co == INVALID_HANDLE_VALUE || GetFileType(co) != FILE_TYPE_CHAR || !GetConsoleMode(co, &mode)) // test if it a good handle
|
||||
{
|
||||
Z_Free(data);
|
||||
return;
|
||||
}
|
||||
|
||||
backupcon.wAttributes = FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE; // Just in case
|
||||
GetConsoleScreenBufferInfo(co, &backupcon); //Store old state
|
||||
resizewin.Y = backupcon.dwSize.Y;
|
||||
if (backupcon.dwSize.X < resizewin.X)
|
||||
SetConsoleScreenBufferSize(co, resizewin);
|
||||
|
||||
for (i=1; i<=80*25; i++) // print 80x25 text and deal with the attributes too
|
||||
{
|
||||
j = (UINT16)(*ptext >> 8); // attribute first
|
||||
let = (char)(*ptext & 0xff); // text second
|
||||
if (j != att) // attribute changed?
|
||||
{
|
||||
att = j; // save current attribute
|
||||
SetConsoleTextAttribute(co, j); //set fg and bg color for buffer
|
||||
}
|
||||
|
||||
WriteConsoleA(co, &let, 1, &bytesWritten, NULL); // now the text
|
||||
|
||||
if (nlflag && !(i % 80) && backupcon.dwSize.X > resizewin.X) // do we need a nl?
|
||||
{
|
||||
att = backupcon.wAttributes;
|
||||
SetConsoleTextAttribute(co, att); // all attributes off
|
||||
WriteConsoleA(co, "\n", 1, &bytesWritten, NULL); // newline to console
|
||||
}
|
||||
ptext++;
|
||||
}
|
||||
SetConsoleTextAttribute(co, backupcon.wAttributes); // all attributes off
|
||||
#else
|
||||
/* print 80x25 text and deal with the attributes too */
|
||||
for (i=1; i<=80*25; i++) {
|
||||
/* attribute first */
|
||||
/* attribute changed? */
|
||||
if ((j = *ptext >> 8) != att) {
|
||||
/* save current attribute */
|
||||
att = j;
|
||||
/* set new attribute, forground color first */
|
||||
printf("\033[");
|
||||
switch (j & 0x0f) {
|
||||
case 0: /* black */
|
||||
printf("30");
|
||||
break;
|
||||
case 1: /* blue */
|
||||
printf("34");
|
||||
break;
|
||||
case 2: /* green */
|
||||
printf("32");
|
||||
break;
|
||||
case 3: /* cyan */
|
||||
printf("36");
|
||||
break;
|
||||
case 4: /* red */
|
||||
printf("31");
|
||||
break;
|
||||
case 5: /* magenta */
|
||||
printf("35");
|
||||
break;
|
||||
case 6: /* brown */
|
||||
printf("33");
|
||||
break;
|
||||
case 7: /* bright grey */
|
||||
printf("37");
|
||||
break;
|
||||
case 8: /* dark grey */
|
||||
printf("1;30");
|
||||
break;
|
||||
case 9: /* bright blue */
|
||||
printf("1;34");
|
||||
break;
|
||||
case 10: /* bright green */
|
||||
printf("1;32");
|
||||
break;
|
||||
case 11: /* bright cyan */
|
||||
printf("1;36");
|
||||
break;
|
||||
case 12: /* bright red */
|
||||
printf("1;31");
|
||||
break;
|
||||
case 13: /* bright magenta */
|
||||
printf("1;35");
|
||||
break;
|
||||
case 14: /* yellow */
|
||||
printf("1;33");
|
||||
break;
|
||||
case 15: /* white */
|
||||
printf("1;37");
|
||||
break;
|
||||
}
|
||||
printf("m");
|
||||
/* now background color */
|
||||
printf("\033[");
|
||||
switch ((j >> 4) & 0x0f) {
|
||||
case 0: /* black */
|
||||
printf("40");
|
||||
break;
|
||||
case 1: /* blue */
|
||||
printf("44");
|
||||
break;
|
||||
case 2: /* green */
|
||||
printf("42");
|
||||
break;
|
||||
case 3: /* cyan */
|
||||
printf("46");
|
||||
break;
|
||||
case 4: /* red */
|
||||
printf("41");
|
||||
break;
|
||||
case 5: /* magenta */
|
||||
printf("45");
|
||||
break;
|
||||
case 6: /* brown */
|
||||
printf("43");
|
||||
break;
|
||||
case 7: /* bright grey */
|
||||
printf("47");
|
||||
break;
|
||||
case 8: /* dark grey */
|
||||
printf("1;40");
|
||||
break;
|
||||
case 9: /* bright blue */
|
||||
printf("1;44");
|
||||
break;
|
||||
case 10: /* bright green */
|
||||
printf("1;42");
|
||||
break;
|
||||
case 11: /* bright cyan */
|
||||
printf("1;46");
|
||||
break;
|
||||
case 12: /* bright red */
|
||||
printf("1;41");
|
||||
break;
|
||||
case 13: /* bright magenta */
|
||||
printf("1;45");
|
||||
break;
|
||||
case 14: /* yellow */
|
||||
printf("1;43");
|
||||
break;
|
||||
case 15: /* white */
|
||||
printf("1;47");
|
||||
break;
|
||||
}
|
||||
printf("m");
|
||||
}
|
||||
|
||||
/* now the text */
|
||||
printf("%c",*ptext++ & 0xff);
|
||||
|
||||
/* do we need a nl? */
|
||||
if (nlflag)
|
||||
{
|
||||
if (!(i % 80))
|
||||
{
|
||||
printf("\033[0m");
|
||||
att = 0;
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
/* all attributes off */
|
||||
printf("\033[0m");
|
||||
#endif
|
||||
if (nlflag)
|
||||
printf("\n");
|
||||
|
||||
Z_Free(data);
|
||||
#endif
|
||||
}
|
24
src/sdl12/endtxt.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
//
|
||||
// This program 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 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \brief Support to show ENDOOM text
|
||||
|
||||
#ifndef __ENDTXT__
|
||||
#define __ENDTXT__
|
||||
|
||||
void ShowEndTxt (void);
|
||||
|
||||
#endif
|