mirror of
				https://github.com/KartKrewDev/RingRacers.git
				synced 2025-10-30 08:01:28 +00:00 
			
		
		
		
	Removed all support for Dreamcast, XBox, PSP, PS3, GP2X, Wii, and WinCE from files in the sdl/ folder. If you wanted these ports, use the SDL 1.2 code in sdl12
Also removed GP2X setup from sdl/MakeNIX.cfg, use sdl12 for that too
This commit is contained in:
		
							parent
							
								
									dcb23e01c0
								
							
						
					
					
						commit
						a33bb70a0c
					
				
					 10 changed files with 40 additions and 432 deletions
				
			
		| 
						 | 
				
			
			@ -65,37 +65,6 @@ ifdef MACOSX
 | 
			
		|||
	LIBS+=-framework CoreFoundation
 | 
			
		||||
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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,7 +33,6 @@
 | 
			
		|||
 | 
			
		||||
void ShowEndTxt(void)
 | 
			
		||||
{
 | 
			
		||||
#if !(defined (_WIN32_WCE) || defined (_XBOX) || defined (_arch_dreamcast))
 | 
			
		||||
	INT32 i;
 | 
			
		||||
	UINT16 j, att = 0;
 | 
			
		||||
	INT32 nlflag = 1;
 | 
			
		||||
| 
						 | 
				
			
			@ -232,5 +231,4 @@ void ShowEndTxt(void)
 | 
			
		|||
		printf("\n");
 | 
			
		||||
 | 
			
		||||
	Z_Free(data);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,10 +37,6 @@
 | 
			
		|||
#pragma warning(default : 4214 4244)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined (_XBOX) || defined (_arch_dreamcast) || defined(GP2X)
 | 
			
		||||
#define NOLOADSO
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef NOLOADSO
 | 
			
		||||
#include "SDL_loadso.h"
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,28 +26,6 @@
 | 
			
		|||
#include <unistd.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef _WII
 | 
			
		||||
#include <limits.h>
 | 
			
		||||
#include <network.h>
 | 
			
		||||
#include <fat.h>
 | 
			
		||||
#ifdef REMOTE_DEBUGGING
 | 
			
		||||
#include <debug.h>
 | 
			
		||||
#endif
 | 
			
		||||
static char wiicwd[PATH_MAX] = "sd:/";
 | 
			
		||||
static char localip[16] = {0};
 | 
			
		||||
static char gateway[16] = {0};
 | 
			
		||||
static char netmask[16] = {0};
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef _PSP
 | 
			
		||||
#include <pspmoduleinfo.h>
 | 
			
		||||
#include <pspthreadman.h>
 | 
			
		||||
PSP_HEAP_SIZE_KB(24*1024);
 | 
			
		||||
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER | PSP_THREAD_ATTR_VFPU);
 | 
			
		||||
PSP_MAIN_THREAD_NAME("SRB2");
 | 
			
		||||
PSP_MAIN_THREAD_STACK_SIZE_KB(256);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_SDL
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_TTF
 | 
			
		||||
| 
						 | 
				
			
			@ -79,23 +57,12 @@ FILE *logstream = NULL;
 | 
			
		|||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined (_WIN32) && !defined (_XBOX)
 | 
			
		||||
#if defined (_WIN32)
 | 
			
		||||
#include "../win32/win_dbg.h"
 | 
			
		||||
typedef BOOL (WINAPI *p_IsDebuggerPresent)(VOID);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef _arch_dreamcast
 | 
			
		||||
#include <arch/arch.h>
 | 
			
		||||
KOS_INIT_FLAGS(INIT_DEFAULT
 | 
			
		||||
//| INIT_NET
 | 
			
		||||
//| INIT_MALLOCSTATS
 | 
			
		||||
//| INIT_QUIET
 | 
			
		||||
//| INIT_OCRAM
 | 
			
		||||
//| INIT_NO_DCLOAD
 | 
			
		||||
);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined (_WIN32) && !defined (_XBOX) && !defined (_WIN32_WCE)
 | 
			
		||||
#if defined (_WIN32)
 | 
			
		||||
static inline VOID MakeCodeWritable(VOID)
 | 
			
		||||
{
 | 
			
		||||
#ifdef USEASM // Disable write-protection of code segment
 | 
			
		||||
| 
						 | 
				
			
			@ -136,13 +103,6 @@ static inline VOID MakeCodeWritable(VOID)
 | 
			
		|||
 | 
			
		||||
	\return	int
 | 
			
		||||
*/
 | 
			
		||||
#if defined (_XBOX) && defined (__GNUC__)
 | 
			
		||||
void XBoxStartup()
 | 
			
		||||
{
 | 
			
		||||
	const char *logdir = NULL;
 | 
			
		||||
	myargc = -1;
 | 
			
		||||
	myargv = NULL;
 | 
			
		||||
#else
 | 
			
		||||
#ifdef FORCESDLMAIN
 | 
			
		||||
int SDL_main(int argc, char **argv)
 | 
			
		||||
#else
 | 
			
		||||
| 
						 | 
				
			
			@ -152,56 +112,19 @@ int main(int argc, char **argv)
 | 
			
		|||
	const char *logdir = NULL;
 | 
			
		||||
	myargc = argc;
 | 
			
		||||
	myargv = argv; /// \todo pull out path to exe from this string
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_TTF
 | 
			
		||||
#ifdef _PS3
 | 
			
		||||
	// apparently there is a bug in SDL_PSL1GHT which needs this to be set to work around
 | 
			
		||||
	SDL_setenv("SDL_VIDEODRIVER", "psl1ght", 1);
 | 
			
		||||
	I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO, SDL_SWSURFACE|SDL_DOUBLEBUF);
 | 
			
		||||
#elif defined(_WIN32)
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
	I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO|SDL_INIT_AUDIO, SDL_SWSURFACE);
 | 
			
		||||
#else
 | 
			
		||||
	I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO, SDL_SWSURFACE);
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef _PS3
 | 
			
		||||
	// initialise controllers.
 | 
			
		||||
	//ioPadInit(7);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
// init Wii-specific stuff
 | 
			
		||||
#ifdef _WII
 | 
			
		||||
	// Start network
 | 
			
		||||
	if_config(localip, netmask, gateway, TRUE);
 | 
			
		||||
 | 
			
		||||
#ifdef REMOTE_DEBUGGING
 | 
			
		||||
#if REMOTE_DEBUGGING == 0
 | 
			
		||||
	DEBUG_Init(GDBSTUB_DEVICE_TCP, GDBSTUB_DEF_TCPPORT); // Port 2828
 | 
			
		||||
#elif REMOTE_DEBUGGING > 2
 | 
			
		||||
	DEBUG_Init(GDBSTUB_DEVICE_TCP, REMOTE_DEBUGGING); // Custom Port
 | 
			
		||||
#elif REMOTE_DEBUGGING < 0
 | 
			
		||||
	DEBUG_Init(GDBSTUB_DEVICE_USB, GDBSTUB_DEF_CHANNEL); // Slot 1
 | 
			
		||||
#else
 | 
			
		||||
	DEBUG_Init(GDBSTUB_DEVICE_USB, REMOTE_DEBUGGING-1); // Custom Slot
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
	// Start FAT filesystem
 | 
			
		||||
	fatInitDefault();
 | 
			
		||||
 | 
			
		||||
	if (getcwd(wiicwd, PATH_MAX))
 | 
			
		||||
		I_PutEnv(va("HOME=%ssrb2wii", wiicwd));
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	logdir = D_Home();
 | 
			
		||||
 | 
			
		||||
#ifdef LOGMESSAGES
 | 
			
		||||
#if defined(_WIN32_WCE) || defined(GP2X)
 | 
			
		||||
	logstream = fopen(va("%s.log",argv[0]), "wt");
 | 
			
		||||
#elif defined (_WII)
 | 
			
		||||
	logstream = fopen(va("%s/log.txt",logdir), "wt");
 | 
			
		||||
#elif defined (DEFAULTDIR)
 | 
			
		||||
#ifdef DEFAULTDIR
 | 
			
		||||
	if (logdir)
 | 
			
		||||
		logstream = fopen(va("%s/"DEFAULTDIR"/log.txt",logdir), "wt");
 | 
			
		||||
	else
 | 
			
		||||
| 
						 | 
				
			
			@ -211,8 +134,7 @@ int main(int argc, char **argv)
 | 
			
		|||
 | 
			
		||||
	//I_OutputMsg("I_StartupSystem() ...\n");
 | 
			
		||||
	I_StartupSystem();
 | 
			
		||||
#if defined (_WIN32) && !defined (_XBOX)
 | 
			
		||||
#ifndef _WIN32_WCE
 | 
			
		||||
#if defined (_WIN32)
 | 
			
		||||
	{
 | 
			
		||||
#if 0 // just load the DLL
 | 
			
		||||
		p_IsDebuggerPresent pfnIsDebuggerPresent = (p_IsDebuggerPresent)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsDebuggerPresent");
 | 
			
		||||
| 
						 | 
				
			
			@ -221,16 +143,13 @@ int main(int argc, char **argv)
 | 
			
		|||
			&& !InitBugTrap()
 | 
			
		||||
#endif
 | 
			
		||||
			)
 | 
			
		||||
#endif
 | 
			
		||||
		{
 | 
			
		||||
			LoadLibraryA("exchndl.dll");
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
	prevExceptionFilter = SetUnhandledExceptionFilter(RecordExceptionInfo);
 | 
			
		||||
#ifndef _WIN32_WCE
 | 
			
		||||
	MakeCodeWritable();
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
	// startup SRB2
 | 
			
		||||
	CONS_Printf("Setting up SRB2...\n");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,19 +26,12 @@
 | 
			
		|||
#include "../config.h.in"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef _WIN32_WCE
 | 
			
		||||
#include <signal.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef _XBOX
 | 
			
		||||
#include "SRB2XBOX/xboxhelp.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined (_WIN32) && !defined (_XBOX)
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
#define RPC_NO_WINDOWS_H
 | 
			
		||||
#include <windows.h>
 | 
			
		||||
#include "../doomtype.h"
 | 
			
		||||
#ifndef _WIN32_WCE
 | 
			
		||||
typedef BOOL (WINAPI *p_GetDiskFreeSpaceExA)(LPCSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER);
 | 
			
		||||
typedef BOOL (WINAPI *p_IsProcessorFeaturePresent) (DWORD);
 | 
			
		||||
typedef DWORD (WINAPI *p_timeGetTime) (void);
 | 
			
		||||
| 
						 | 
				
			
			@ -46,7 +39,6 @@ typedef UINT (WINAPI *p_timeEndPeriod) (UINT);
 | 
			
		|||
typedef HANDLE (WINAPI *p_OpenFileMappingA) (DWORD, BOOL, LPCSTR);
 | 
			
		||||
typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -59,18 +51,10 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
 | 
			
		|||
#include <fcntl.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef _arch_dreamcast
 | 
			
		||||
#include <arch/gdb.h>
 | 
			
		||||
#include <arch/timer.h>
 | 
			
		||||
#include <conio/conio.h>
 | 
			
		||||
#include <dc/pvr.h>
 | 
			
		||||
void __set_fpscr(long); // in libgcc / kernel's startup.s?
 | 
			
		||||
#else
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#if defined (_WIN32) && !defined (_WIN32_WCE) && !defined (_XBOX)
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
#include <conio.h>
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef _MSC_VER
 | 
			
		||||
#pragma warning(disable : 4214 4244)
 | 
			
		||||
| 
						 | 
				
			
			@ -88,15 +72,10 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
 | 
			
		|||
#pragma warning(default : 4214 4244)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef DC
 | 
			
		||||
#include "SDL_cpuinfo.h"
 | 
			
		||||
#define HAVE_SDLCPUINFO
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef _PSP
 | 
			
		||||
//#include <pspiofilemgr.h>
 | 
			
		||||
#elif !defined(_PS3)
 | 
			
		||||
#if defined (__unix__) || defined(__APPLE__) || (defined (UNIXCOMMON) && !defined (_arch_dreamcast) && !defined (__HAIKU__) && !defined (_WII))
 | 
			
		||||
#if defined (__unix__) || defined(__APPLE__) || (defined (UNIXCOMMON) && !defined (__HAIKU__))
 | 
			
		||||
#if defined (__linux__)
 | 
			
		||||
#include <sys/vfs.h>
 | 
			
		||||
#else
 | 
			
		||||
| 
						 | 
				
			
			@ -111,20 +90,17 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
 | 
			
		|||
#include <sys/vmmeter.h>
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef _PS3
 | 
			
		||||
#if defined (__linux__) || (defined (UNIXCOMMON) && !defined (_arch_dreamcast) && !defined (_PSP) && !defined (__HAIKU__) && !defined (_WII))
 | 
			
		||||
#if defined (__linux__) || (defined (UNIXCOMMON) && !defined (__HAIKU__))
 | 
			
		||||
#ifndef NOTERMIOS
 | 
			
		||||
#include <termios.h>
 | 
			
		||||
#include <sys/ioctl.h> // ioctl
 | 
			
		||||
#define HAVE_TERMIOS
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef NOMUMBLE
 | 
			
		||||
#if defined (__linux__) && !defined(_PS3) // need -lrt
 | 
			
		||||
#ifdef __linux__ // need -lrt
 | 
			
		||||
#include <sys/mman.h>
 | 
			
		||||
#ifdef MAP_FAILED
 | 
			
		||||
#define HAVE_SHM
 | 
			
		||||
| 
						 | 
				
			
			@ -132,7 +108,7 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
 | 
			
		|||
#include <wchar.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined (_WIN32) && !defined (_WIN32_WCE) && !defined (_XBOX)
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
#define HAVE_MUMBLE
 | 
			
		||||
#define WINMUMBLE
 | 
			
		||||
#elif defined (HAVE_SHM)
 | 
			
		||||
| 
						 | 
				
			
			@ -140,10 +116,6 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
 | 
			
		|||
#endif
 | 
			
		||||
#endif // NOMUMBLE
 | 
			
		||||
 | 
			
		||||
#ifdef _WIN32_WCE
 | 
			
		||||
#include "SRB2CE/cehelp.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef O_BINARY
 | 
			
		||||
#define O_BINARY 0
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -153,44 +125,7 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
 | 
			
		|||
#endif
 | 
			
		||||
 | 
			
		||||
// Locations for searching the srb2.srb
 | 
			
		||||
#ifdef _arch_dreamcast
 | 
			
		||||
#define DEFAULTWADLOCATION1 "/cd"
 | 
			
		||||
#define DEFAULTWADLOCATION2 "/pc"
 | 
			
		||||
#define DEFAULTWADLOCATION3 "/pc/home/alam/srb2code/data"
 | 
			
		||||
#define DEFAULTSEARCHPATH1 "/cd"
 | 
			
		||||
#define DEFAULTSEARCHPATH2 "/pc"
 | 
			
		||||
//#define DEFAULTSEARCHPATH3 "/pc/home/alam/srb2code/data"
 | 
			
		||||
#elif defined (GP2X)
 | 
			
		||||
#define DEFAULTWADLOCATION1 "/mnt/sd"
 | 
			
		||||
#define DEFAULTWADLOCATION2 "/mnt/sd/SRB2"
 | 
			
		||||
#define DEFAULTWADLOCATION3 "/tmp/mnt/sd"
 | 
			
		||||
#define DEFAULTWADLOCATION4 "/tmp/mnt/sd/SRB2"
 | 
			
		||||
#define DEFAULTSEARCHPATH1 "/mnt/sd"
 | 
			
		||||
#define DEFAULTSEARCHPATH2 "/tmp/mnt/sd"
 | 
			
		||||
#elif defined (_WII)
 | 
			
		||||
#define NOCWD
 | 
			
		||||
#define NOHOME
 | 
			
		||||
#define NEED_SDL_GETENV
 | 
			
		||||
#define DEFAULTWADLOCATION1 "sd:/srb2wii"
 | 
			
		||||
#define DEFAULTWADLOCATION2 "usb:/srb2wii"
 | 
			
		||||
#define DEFAULTSEARCHPATH1 "sd:/srb2wii"
 | 
			
		||||
#define DEFAULTSEARCHPATH2 "usb:/srb2wii"
 | 
			
		||||
// PS3: TODO: this will need modification most likely
 | 
			
		||||
#elif defined (_PS3)
 | 
			
		||||
#define NOCWD
 | 
			
		||||
#define NOHOME
 | 
			
		||||
#define DEFAULTWADLOCATION1 "/dev_hdd0/game/SRB2-PS3_/USRDIR/etc"
 | 
			
		||||
#define DEFAULTWADLOCATION2 "/dev_usb/SRB2PS3"
 | 
			
		||||
#define DEFAULTSEARCHPATH1 "/dev_hdd0/game/SRB2-PS3_/USRDIR/etc"
 | 
			
		||||
#define DEFAULTSEARCHPATH2 "/dev_usb/SRB2PS3"
 | 
			
		||||
#elif defined (_PSP)
 | 
			
		||||
#define NOCWD
 | 
			
		||||
#define NOHOME
 | 
			
		||||
#define DEFAULTWADLOCATION1 "host0:/bin/Resources"
 | 
			
		||||
#define DEFAULTWADLOCATION2 "ms0:/PSP/GAME/SRB2PSP"
 | 
			
		||||
#define DEFAULTSEARCHPATH1 "host0:/"
 | 
			
		||||
#define DEFAULTSEARCHPATH2 "ms0:/PSP/GAME/SRB2PSP"
 | 
			
		||||
#elif defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
 | 
			
		||||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
 | 
			
		||||
#define DEFAULTWADLOCATION1 "/usr/local/share/games/SRB2"
 | 
			
		||||
#define DEFAULTWADLOCATION2 "/usr/local/games/SRB2"
 | 
			
		||||
#define DEFAULTWADLOCATION3 "/usr/share/games/SRB2"
 | 
			
		||||
| 
						 | 
				
			
			@ -198,23 +133,6 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
 | 
			
		|||
#define DEFAULTSEARCHPATH1 "/usr/local/games"
 | 
			
		||||
#define DEFAULTSEARCHPATH2 "/usr/games"
 | 
			
		||||
#define DEFAULTSEARCHPATH3 "/usr/local"
 | 
			
		||||
#elif defined (_XBOX)
 | 
			
		||||
#define NOCWD
 | 
			
		||||
#ifdef __GNUC__
 | 
			
		||||
#include <openxdk/debug.h>
 | 
			
		||||
#endif
 | 
			
		||||
#define DEFAULTWADLOCATION1 "c:\\srb2"
 | 
			
		||||
#define DEFAULTWADLOCATION2 "d:\\srb2"
 | 
			
		||||
#define DEFAULTWADLOCATION3 "e:\\srb2"
 | 
			
		||||
#define DEFAULTWADLOCATION4 "f:\\srb2"
 | 
			
		||||
#define DEFAULTWADLOCATION5 "g:\\srb2"
 | 
			
		||||
#define DEFAULTWADLOCATION6 "h:\\srb2"
 | 
			
		||||
#define DEFAULTWADLOCATION7 "i:\\srb2"
 | 
			
		||||
#elif defined (_WIN32_WCE)
 | 
			
		||||
#define NOCWD
 | 
			
		||||
#define NOHOME
 | 
			
		||||
#define DEFAULTWADLOCATION1 "\\Storage Card\\SRB2DEMO"
 | 
			
		||||
#define DEFAULTSEARCHPATH1 "\\Storage Card"
 | 
			
		||||
#elif defined (_WIN32)
 | 
			
		||||
#define DEFAULTWADLOCATION1 "c:\\games\\srb2"
 | 
			
		||||
#define DEFAULTWADLOCATION2 "\\games\\srb2"
 | 
			
		||||
| 
						 | 
				
			
			@ -270,9 +188,6 @@ static void JoyReset(SDLJoyInfo_t *JoySet)
 | 
			
		|||
{
 | 
			
		||||
	if (JoySet->dev)
 | 
			
		||||
	{
 | 
			
		||||
#ifdef GP2X //GP2X's SDL does an illegal free on the 1st joystick...
 | 
			
		||||
		if (SDL_JoystickIndex(JoySet->dev) != 0)
 | 
			
		||||
#endif
 | 
			
		||||
		SDL_JoystickClose(JoySet->dev);
 | 
			
		||||
	}
 | 
			
		||||
	JoySet->dev = NULL;
 | 
			
		||||
| 
						 | 
				
			
			@ -308,7 +223,6 @@ SDL_bool framebuffer = SDL_FALSE;
 | 
			
		|||
 | 
			
		||||
UINT8 keyboard_started = false;
 | 
			
		||||
 | 
			
		||||
#if !defined (DC)
 | 
			
		||||
FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num)
 | 
			
		||||
{
 | 
			
		||||
	//static char msg[] = "oh no! back to reality!\r\n";
 | 
			
		||||
| 
						 | 
				
			
			@ -362,7 +276,6 @@ FUNCNORETURN static ATTRNORETURN void quit_handler(int num)
 | 
			
		|||
	raise(num);
 | 
			
		||||
	I_Quit();
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_TERMIOS
 | 
			
		||||
// TERMIOS console code from Quake3: thank you!
 | 
			
		||||
| 
						 | 
				
			
			@ -487,9 +400,7 @@ static void I_StartupConsole(void)
 | 
			
		|||
	signal(SIGTTIN, SIG_IGN);
 | 
			
		||||
	signal(SIGTTOU, SIG_IGN);
 | 
			
		||||
 | 
			
		||||
#if !defined(GP2X) //read is bad on GP2X
 | 
			
		||||
	consolevent = !M_CheckParm("-noconsole");
 | 
			
		||||
#endif
 | 
			
		||||
	framebuffer = M_CheckParm("-framebuffer");
 | 
			
		||||
 | 
			
		||||
	if (framebuffer)
 | 
			
		||||
| 
						 | 
				
			
			@ -577,7 +488,7 @@ void I_GetConsoleEvents(void)
 | 
			
		|||
	(void)d;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#elif defined (_WIN32) && !(defined (_XBOX) || defined (_WIN32_WCE))
 | 
			
		||||
#elif defined (_WIN32)
 | 
			
		||||
static BOOL I_ReadyConsole(HANDLE ci)
 | 
			
		||||
{
 | 
			
		||||
	DWORD gotinput;
 | 
			
		||||
| 
						 | 
				
			
			@ -716,17 +627,6 @@ static inline void I_ShutdownConsole(void){}
 | 
			
		|||
void I_GetConsoleEvents(void){}
 | 
			
		||||
static inline void I_StartupConsole(void)
 | 
			
		||||
{
 | 
			
		||||
#ifdef _arch_dreamcast
 | 
			
		||||
	char title[] = "SRB2 for Dreamcast!\n";
 | 
			
		||||
	__set_fpscr(0x00040000); /* ignore FPU underflow */
 | 
			
		||||
	//printf("\nHello world!\n\n");
 | 
			
		||||
	pvr_init_defaults();
 | 
			
		||||
	conio_init(CONIO_TTY_PVR, CONIO_INPUT_LINE);
 | 
			
		||||
	conio_set_theme(CONIO_THEME_MATRIX);
 | 
			
		||||
	conio_clear();
 | 
			
		||||
	conio_putstr(title);
 | 
			
		||||
	//printf("\nHello world!\n\n");
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef _DEBUG
 | 
			
		||||
	consolevent = !M_CheckParm("-noconsole");
 | 
			
		||||
#else
 | 
			
		||||
| 
						 | 
				
			
			@ -746,7 +646,6 @@ static inline void I_ShutdownConsole(void){}
 | 
			
		|||
//
 | 
			
		||||
void I_StartupKeyboard (void)
 | 
			
		||||
{
 | 
			
		||||
#if !defined (DC)
 | 
			
		||||
#ifdef SIGINT
 | 
			
		||||
	signal(SIGINT , quit_handler);
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -763,7 +662,6 @@ void I_StartupKeyboard (void)
 | 
			
		|||
	signal(SIGSEGV , signal_handler);
 | 
			
		||||
	signal(SIGABRT , signal_handler);
 | 
			
		||||
	signal(SIGFPE , signal_handler);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
| 
						 | 
				
			
			@ -775,10 +673,6 @@ void I_OutputMsg(const char *fmt, ...)
 | 
			
		|||
	XBOXSTATIC char txt[8192];
 | 
			
		||||
	va_list  argptr;
 | 
			
		||||
 | 
			
		||||
#ifdef _arch_dreamcast
 | 
			
		||||
	if (!keyboard_started) conio_printf(fmt);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	va_start(argptr,fmt);
 | 
			
		||||
	vsprintf(txt, fmt, argptr);
 | 
			
		||||
	va_end(argptr);
 | 
			
		||||
| 
						 | 
				
			
			@ -788,7 +682,7 @@ void I_OutputMsg(const char *fmt, ...)
 | 
			
		|||
	DEFAULTFONTBGR, DEFAULTFONTBGG, DEFAULTFONTBGB, DEFAULTFONTBGA, txt);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined (_WIN32) && !defined (_XBOX) && defined (_MSC_VER)
 | 
			
		||||
#if defined (_WIN32) && defined (_MSC_VER)
 | 
			
		||||
	OutputDebugStringA(txt);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -803,7 +697,7 @@ void I_OutputMsg(const char *fmt, ...)
 | 
			
		|||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined (_WIN32) && !defined (_XBOX) && !defined(_WIN32_WCE)
 | 
			
		||||
#if defined (_WIN32)
 | 
			
		||||
#ifdef DEBUGFILE
 | 
			
		||||
	if (debugfile != stderr)
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -917,22 +811,12 @@ INT32 I_GetKey (void)
 | 
			
		|||
//
 | 
			
		||||
void I_JoyScale(void)
 | 
			
		||||
{
 | 
			
		||||
#ifdef GP2X
 | 
			
		||||
	if (JoyInfo.dev && SDL_JoystickIndex(JoyInfo.dev) == 0)
 | 
			
		||||
		Joystick.bGamepadStyle = true;
 | 
			
		||||
	else
 | 
			
		||||
#endif
 | 
			
		||||
	Joystick.bGamepadStyle = cv_joyscale.value==0;
 | 
			
		||||
	JoyInfo.scale = Joystick.bGamepadStyle?1:cv_joyscale.value;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void I_JoyScale2(void)
 | 
			
		||||
{
 | 
			
		||||
#ifdef GP2X
 | 
			
		||||
	if (JoyInfo2.dev && SDL_JoystickIndex(JoyInfo2.dev) == 0)
 | 
			
		||||
		Joystick.bGamepadStyle = true;
 | 
			
		||||
	else
 | 
			
		||||
#endif
 | 
			
		||||
	Joystick2.bGamepadStyle = cv_joyscale2.value==0;
 | 
			
		||||
	JoyInfo2.scale = Joystick2.bGamepadStyle?1:cv_joyscale2.value;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1035,11 +919,6 @@ void I_GetJoystickEvents(void)
 | 
			
		|||
					event.type = ev_keydown;
 | 
			
		||||
				else
 | 
			
		||||
					event.type = ev_keyup;
 | 
			
		||||
#ifdef _PSP
 | 
			
		||||
				if (i == 12)
 | 
			
		||||
					event.data1 = KEY_ESCAPE;
 | 
			
		||||
				else
 | 
			
		||||
#endif
 | 
			
		||||
				event.data1 = KEY_JOY1 + i;
 | 
			
		||||
				D_PostEvent(&event);
 | 
			
		||||
			}
 | 
			
		||||
| 
						 | 
				
			
			@ -1090,13 +969,11 @@ void I_GetJoystickEvents(void)
 | 
			
		|||
			axisy = SDL_JoystickGetAxis(JoyInfo.dev, i*2 + 1);
 | 
			
		||||
		else axisy = 0;
 | 
			
		||||
 | 
			
		||||
#ifdef _arch_dreamcast // -128 to 127
 | 
			
		||||
		axisx = axisx*8;
 | 
			
		||||
		axisy = axisy*8;
 | 
			
		||||
#else // -32768 to 32767
 | 
			
		||||
 | 
			
		||||
		// -32768 to 32767
 | 
			
		||||
		axisx = axisx/32;
 | 
			
		||||
		axisy = axisy/32;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		if (Joystick.bGamepadStyle)
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			@ -1214,15 +1091,11 @@ static int joy_open(const char *fname)
 | 
			
		|||
		if (JoyInfo.buttons > JOYBUTTONS)
 | 
			
		||||
			JoyInfo.buttons = JOYBUTTONS;
 | 
			
		||||
 | 
			
		||||
#ifdef DC
 | 
			
		||||
		JoyInfo.hats = 0;
 | 
			
		||||
#else
 | 
			
		||||
		JoyInfo.hats = SDL_JoystickNumHats(JoyInfo.dev);
 | 
			
		||||
		if (JoyInfo.hats > JOYHATS)
 | 
			
		||||
			JoyInfo.hats = JOYHATS;
 | 
			
		||||
 | 
			
		||||
		JoyInfo.balls = SDL_JoystickNumBalls(JoyInfo.dev);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		//Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(JoyInfo.dev), "pad");
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1379,13 +1252,9 @@ void I_GetJoystick2Events(void)
 | 
			
		|||
			axisy = SDL_JoystickGetAxis(JoyInfo2.dev, i*2 + 1);
 | 
			
		||||
		else axisy = 0;
 | 
			
		||||
 | 
			
		||||
#ifdef _arch_dreamcast // -128 to 127
 | 
			
		||||
		axisx = axisx*8;
 | 
			
		||||
		axisy = axisy*8;
 | 
			
		||||
#else // -32768 to 32767
 | 
			
		||||
		// -32768 to 32767
 | 
			
		||||
		axisx = axisx/32;
 | 
			
		||||
		axisy = axisy/32;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		if (Joystick2.bGamepadStyle)
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			@ -1504,15 +1373,11 @@ static int joy_open2(const char *fname)
 | 
			
		|||
		if (JoyInfo2.buttons > JOYBUTTONS)
 | 
			
		||||
			JoyInfo2.buttons = JOYBUTTONS;
 | 
			
		||||
 | 
			
		||||
#ifdef DC
 | 
			
		||||
		JoyInfo2.hats = 0;
 | 
			
		||||
#else
 | 
			
		||||
		JoyInfo2.hats = SDL_JoystickNumHats(JoyInfo2.dev);
 | 
			
		||||
		if (JoyInfo2.hats > JOYHATS)
 | 
			
		||||
			JoyInfo2.hats = JOYHATS;
 | 
			
		||||
 | 
			
		||||
		JoyInfo2.balls = SDL_JoystickNumBalls(JoyInfo2.dev);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		//Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(JoyInfo2.dev), "pad");
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1796,7 +1661,7 @@ static void I_ShutdownMouse2(void)
 | 
			
		|||
	if (fdmouse2 != -1) close(fdmouse2);
 | 
			
		||||
	mouse2_started = 0;
 | 
			
		||||
}
 | 
			
		||||
#elif defined (_WIN32) && !defined (_XBOX)
 | 
			
		||||
#elif defined (_WIN32)
 | 
			
		||||
 | 
			
		||||
static HANDLE mouse2filehandle = INVALID_HANDLE_VALUE;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1994,7 +1859,7 @@ void I_StartupMouse2(void)
 | 
			
		|||
	}
 | 
			
		||||
	mouse2_started = 1;
 | 
			
		||||
	I_AddExitFunc(I_ShutdownMouse2);
 | 
			
		||||
#elif defined (_WIN32) && !defined (_XBOX)
 | 
			
		||||
#elif defined (_WIN32)
 | 
			
		||||
	DCB dcb;
 | 
			
		||||
 | 
			
		||||
	if (mouse2filehandle != INVALID_HANDLE_VALUE)
 | 
			
		||||
| 
						 | 
				
			
			@ -2089,7 +1954,7 @@ FUNCMATH ticcmd_t *I_BaseTiccmd2(void)
 | 
			
		|||
	return &emptycmd2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
 | 
			
		||||
#if defined (_WIN32)
 | 
			
		||||
static HMODULE winmm = NULL;
 | 
			
		||||
static DWORD starttickcount = 0; // hack for win2k time bug
 | 
			
		||||
static p_timeGetTime pfntimeGetTime = NULL;
 | 
			
		||||
| 
						 | 
				
			
			@ -2159,13 +2024,8 @@ static void I_ShutdownTimer(void)
 | 
			
		|||
//
 | 
			
		||||
tic_t I_GetTime (void)
 | 
			
		||||
{
 | 
			
		||||
#ifdef _arch_dreamcast
 | 
			
		||||
	static Uint64 basetime = 0;
 | 
			
		||||
	       Uint64 ticks = timer_ms_gettime64(); //using timer_ms_gettime64 instand of SDL_GetTicks for the Dreamcast
 | 
			
		||||
#else
 | 
			
		||||
	static Uint32 basetime = 0;
 | 
			
		||||
	       Uint32 ticks = SDL_GetTicks();
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (!basetime)
 | 
			
		||||
		basetime = ticks;
 | 
			
		||||
| 
						 | 
				
			
			@ -2174,11 +2034,7 @@ tic_t I_GetTime (void)
 | 
			
		|||
 | 
			
		||||
	ticks = (ticks*TICRATE);
 | 
			
		||||
 | 
			
		||||
#if 0 //#ifdef _WIN32_WCE
 | 
			
		||||
	ticks = (ticks/10);
 | 
			
		||||
#else
 | 
			
		||||
	ticks = (ticks/1000);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	return (tic_t)ticks;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -2189,7 +2045,7 @@ tic_t I_GetTime (void)
 | 
			
		|||
//
 | 
			
		||||
FUNCMATH void I_StartupTimer(void)
 | 
			
		||||
{
 | 
			
		||||
#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
	// for win2k time bug
 | 
			
		||||
	if (M_CheckParm("-gettickcount"))
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			@ -2205,9 +2061,6 @@ FUNCMATH void I_StartupTimer(void)
 | 
			
		|||
		pfntimeGetTime = (p_timeGetTime)GetProcAddress(winmm, "timeGetTime");
 | 
			
		||||
	}
 | 
			
		||||
	I_AddExitFunc(I_ShutdownTimer);
 | 
			
		||||
#elif 0 //#elif !defined (_arch_dreamcast) && !defined(GP2X) // the DC have it own timer and GP2X have broken pthreads?
 | 
			
		||||
	if (SDL_InitSubSystem(SDL_INIT_TIMER) < 0)
 | 
			
		||||
		I_Error("SRB2: Needs SDL_Timer, Error: %s", SDL_GetError());
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2215,35 +2068,14 @@ FUNCMATH void I_StartupTimer(void)
 | 
			
		|||
 | 
			
		||||
void I_Sleep(void)
 | 
			
		||||
{
 | 
			
		||||
#if !(defined (_arch_dreamcast) || defined (_XBOX))
 | 
			
		||||
	if (cv_sleep.value != -1)
 | 
			
		||||
		SDL_Delay(cv_sleep.value);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
INT32 I_StartupSystem(void)
 | 
			
		||||
{
 | 
			
		||||
	SDL_version SDLcompiled;
 | 
			
		||||
	SDL_version SDLlinked;
 | 
			
		||||
#ifdef _XBOX
 | 
			
		||||
#ifdef __GNUC__
 | 
			
		||||
	char DP[] ="      Sonic Robo Blast 2!\n";
 | 
			
		||||
	debugPrint(DP);
 | 
			
		||||
#endif
 | 
			
		||||
	unlink("e:/Games/SRB2/stdout.txt");
 | 
			
		||||
	freopen("e:/Games/SRB2/stdout.txt", "w+", stdout);
 | 
			
		||||
	unlink("e:/Games/SRB2/stderr.txt");
 | 
			
		||||
	freopen("e:/Games/SRB2/stderr.txt", "w+", stderr);
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef _arch_dreamcast
 | 
			
		||||
#ifdef _DEBUG
 | 
			
		||||
	//gdb_init();
 | 
			
		||||
#endif
 | 
			
		||||
	printf(__FILE__":%i\n",__LINE__);
 | 
			
		||||
#ifdef _DEBUG
 | 
			
		||||
	//gdb_breakpoint();
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
	SDL_VERSION(&SDLcompiled)
 | 
			
		||||
	SDL_GetVersion(&SDLlinked);
 | 
			
		||||
	I_StartupConsole();
 | 
			
		||||
| 
						 | 
				
			
			@ -2251,11 +2083,7 @@ INT32 I_StartupSystem(void)
 | 
			
		|||
	 SDLcompiled.major, SDLcompiled.minor, SDLcompiled.patch);
 | 
			
		||||
	I_OutputMsg("Linked with SDL version: %d.%d.%d\n",
 | 
			
		||||
	 SDLlinked.major, SDLlinked.minor, SDLlinked.patch);
 | 
			
		||||
#if 0 //#ifdef GP2X //start up everything
 | 
			
		||||
	if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
 | 
			
		||||
#else
 | 
			
		||||
	if (SDL_Init(0) < 0)
 | 
			
		||||
#endif
 | 
			
		||||
		I_Error("SRB2: SDL System Error: %s", SDL_GetError()); //Alam: Oh no....
 | 
			
		||||
#ifndef NOMUMBLE
 | 
			
		||||
	I_SetupMumble();
 | 
			
		||||
| 
						 | 
				
			
			@ -2297,9 +2125,7 @@ void I_Quit(void)
 | 
			
		|||
	I_ShutdownGraphics();
 | 
			
		||||
	I_ShutdownInput();
 | 
			
		||||
	I_ShutdownSystem();
 | 
			
		||||
#ifndef _arch_dreamcast
 | 
			
		||||
	SDL_Quit();
 | 
			
		||||
#endif
 | 
			
		||||
	/* if option -noendtxt is set, don't print the text */
 | 
			
		||||
	if (!M_CheckParm("-noendtxt") && W_CheckNumForName("ENDOOM") != LUMPERROR)
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			@ -2308,10 +2134,6 @@ void I_Quit(void)
 | 
			
		|||
	}
 | 
			
		||||
death:
 | 
			
		||||
	W_Shutdown();
 | 
			
		||||
#ifdef GP2X
 | 
			
		||||
	chdir("/usr/gp2x");
 | 
			
		||||
	execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL);
 | 
			
		||||
#endif
 | 
			
		||||
	exit(0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2364,10 +2186,8 @@ void I_Error(const char *error, ...)
 | 
			
		|||
			I_ShutdownInput();
 | 
			
		||||
		if (errorcount == 7)
 | 
			
		||||
			I_ShutdownSystem();
 | 
			
		||||
#ifndef _arch_dreamcast
 | 
			
		||||
		if (errorcount == 8)
 | 
			
		||||
			SDL_Quit();
 | 
			
		||||
#endif
 | 
			
		||||
		if (errorcount == 9)
 | 
			
		||||
		{
 | 
			
		||||
			M_SaveConfig(NULL);
 | 
			
		||||
| 
						 | 
				
			
			@ -2386,12 +2206,6 @@ void I_Error(const char *error, ...)
 | 
			
		|||
				buffer, NULL);
 | 
			
		||||
 | 
			
		||||
			W_Shutdown();
 | 
			
		||||
 | 
			
		||||
#ifdef GP2X
 | 
			
		||||
			chdir("/usr/gp2x");
 | 
			
		||||
			execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
			exit(-1); // recursive errors detected
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -2427,9 +2241,7 @@ void I_Error(const char *error, ...)
 | 
			
		|||
	I_ShutdownGraphics();
 | 
			
		||||
	I_ShutdownInput();
 | 
			
		||||
	I_ShutdownSystem();
 | 
			
		||||
#ifndef _arch_dreamcast
 | 
			
		||||
	SDL_Quit();
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	// Implement message box with SDL_ShowSimpleMessageBox,
 | 
			
		||||
	// which should fail gracefully if it can't put a message box up
 | 
			
		||||
| 
						 | 
				
			
			@ -2449,11 +2261,6 @@ void I_Error(const char *error, ...)
 | 
			
		|||
	*(INT32 *)2 = 4; //Alam: Debug!
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef GP2X
 | 
			
		||||
	chdir("/usr/gp2x");
 | 
			
		||||
	execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	exit(-1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2516,7 +2323,7 @@ void I_ShutdownSystem(void)
 | 
			
		|||
	for (c = MAX_QUIT_FUNCS-1; c >= 0; c--)
 | 
			
		||||
		if (quit_funcs[c])
 | 
			
		||||
			(*quit_funcs[c])();
 | 
			
		||||
#ifdef  LOGMESSAGES
 | 
			
		||||
#ifdef LOGMESSAGES
 | 
			
		||||
	if (logstream)
 | 
			
		||||
	{
 | 
			
		||||
		I_OutputMsg("I_ShutdownSystem(): end of logstream.\n");
 | 
			
		||||
| 
						 | 
				
			
			@ -2529,10 +2336,8 @@ void I_ShutdownSystem(void)
 | 
			
		|||
 | 
			
		||||
void I_GetDiskFreeSpace(INT64 *freespace)
 | 
			
		||||
{
 | 
			
		||||
#if defined (_arch_dreamcast) || defined (_PSP)
 | 
			
		||||
	*freespace = 0;
 | 
			
		||||
#elif defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
 | 
			
		||||
#if defined (SOLARIS) || defined (__HAIKU__) || defined (_WII) || defined (_PS3)
 | 
			
		||||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
 | 
			
		||||
#if defined (SOLARIS) || defined (__HAIKU__)
 | 
			
		||||
	*freespace = INT32_MAX;
 | 
			
		||||
	return;
 | 
			
		||||
#else // Both Linux and BSD have this, apparently.
 | 
			
		||||
| 
						 | 
				
			
			@ -2544,7 +2349,7 @@ void I_GetDiskFreeSpace(INT64 *freespace)
 | 
			
		|||
	}
 | 
			
		||||
	*freespace = stfs.f_bavail * stfs.f_bsize;
 | 
			
		||||
#endif
 | 
			
		||||
#elif (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
 | 
			
		||||
#elif defined (_WIN32)
 | 
			
		||||
	static p_GetDiskFreeSpaceExA pfnGetDiskFreeSpaceEx = NULL;
 | 
			
		||||
	static boolean testwin95 = false;
 | 
			
		||||
	ULARGE_INTEGER usedbytes, lfreespace;
 | 
			
		||||
| 
						 | 
				
			
			@ -2575,13 +2380,6 @@ void I_GetDiskFreeSpace(INT64 *freespace)
 | 
			
		|||
 | 
			
		||||
char *I_GetUserName(void)
 | 
			
		||||
{
 | 
			
		||||
#ifdef GP2X
 | 
			
		||||
	static char username[MAXPLAYERNAME] = "GP2XUSER";
 | 
			
		||||
	return username;
 | 
			
		||||
#elif defined (PSP)
 | 
			
		||||
	static char username[MAXPLAYERNAME] = "PSPUSER";
 | 
			
		||||
	return username;
 | 
			
		||||
#elif !(defined (_WIN32_WCE) || defined (_XBOX))
 | 
			
		||||
	static char username[MAXPLAYERNAME];
 | 
			
		||||
	char *p;
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
| 
						 | 
				
			
			@ -2613,7 +2411,6 @@ char *I_GetUserName(void)
 | 
			
		|||
 | 
			
		||||
	if (strcmp(username, "") != 0)
 | 
			
		||||
		return username;
 | 
			
		||||
#endif
 | 
			
		||||
	return NULL; // dummy for platform independent version
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2622,7 +2419,7 @@ INT32 I_mkdir(const char *dirname, INT32 unixright)
 | 
			
		|||
//[segabor]
 | 
			
		||||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) || defined (__CYGWIN__) || defined (__OS2__)
 | 
			
		||||
	return mkdir(dirname, unixright);
 | 
			
		||||
#elif (defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX)
 | 
			
		||||
#elif defined (_WIN32)
 | 
			
		||||
	UNREFERENCED_PARAMETER(unixright); /// \todo should implement ntright under nt...
 | 
			
		||||
	return CreateDirectoryA(dirname, NULL);
 | 
			
		||||
#else
 | 
			
		||||
| 
						 | 
				
			
			@ -2636,9 +2433,6 @@ char *I_GetEnv(const char *name)
 | 
			
		|||
{
 | 
			
		||||
#ifdef NEED_SDL_GETENV
 | 
			
		||||
	return SDL_getenv(name);
 | 
			
		||||
#elif defined(_WIN32_WCE)
 | 
			
		||||
	(void)name;
 | 
			
		||||
	return NULL;
 | 
			
		||||
#else
 | 
			
		||||
	return getenv(name);
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -2648,8 +2442,6 @@ INT32 I_PutEnv(char *variable)
 | 
			
		|||
{
 | 
			
		||||
#ifdef NEED_SDL_GETENV
 | 
			
		||||
	return SDL_putenv(variable);
 | 
			
		||||
#elif defined(_WIN32_WCE)
 | 
			
		||||
	return ((variable)?-1:0);
 | 
			
		||||
#else
 | 
			
		||||
	return putenv(variable);
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -2789,15 +2581,6 @@ static const char *locateWad(void)
 | 
			
		|||
	if (((envstr = I_GetEnv("SRB2WADDIR")) != NULL) && isWadPathOk(envstr))
 | 
			
		||||
		return envstr;
 | 
			
		||||
 | 
			
		||||
#if defined(_WIN32_WCE) || defined(_PS3) || defined(_PSP)
 | 
			
		||||
	// examine argv[0]
 | 
			
		||||
	strcpy(returnWadPath, myargv[0]);
 | 
			
		||||
	pathonly(returnWadPath);
 | 
			
		||||
	I_PutEnv(va("HOME=%s",returnWadPath));
 | 
			
		||||
	if (isWadPathOk(returnWadPath))
 | 
			
		||||
		return returnWadPath;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef NOCWD
 | 
			
		||||
	I_OutputMsg(",.");
 | 
			
		||||
	// examine current dir
 | 
			
		||||
| 
						 | 
				
			
			@ -2916,9 +2699,9 @@ const char *I_LocateWad(void)
 | 
			
		|||
	if (waddir)
 | 
			
		||||
	{
 | 
			
		||||
		// change to the directory where we found srb2.srb
 | 
			
		||||
#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
 | 
			
		||||
#if defined (_WIN32)
 | 
			
		||||
		SetCurrentDirectoryA(waddir);
 | 
			
		||||
#elif !defined (_WIN32_WCE) && !defined (_PS3)
 | 
			
		||||
#else
 | 
			
		||||
		if (chdir(waddir) == -1)
 | 
			
		||||
			I_OutputMsg("Couldn't change working directory\n");
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -2935,17 +2718,7 @@ const char *I_LocateWad(void)
 | 
			
		|||
// quick fix for compil
 | 
			
		||||
UINT32 I_GetFreeMem(UINT32 *total)
 | 
			
		||||
{
 | 
			
		||||
#if defined (_arch_dreamcast)
 | 
			
		||||
	//Dreamcast!
 | 
			
		||||
	if (total)
 | 
			
		||||
		*total = 16<<20;
 | 
			
		||||
	return 8<<20;
 | 
			
		||||
#elif defined (_PSP)
 | 
			
		||||
	// PSP
 | 
			
		||||
	if (total)
 | 
			
		||||
		*total = 32<<20;
 | 
			
		||||
	return 16<<20;
 | 
			
		||||
#elif defined (FREEBSD)
 | 
			
		||||
#ifdef FREEBSD
 | 
			
		||||
	struct vmmeter sum;
 | 
			
		||||
	kvm_t *kd;
 | 
			
		||||
	struct nlist namelist[] =
 | 
			
		||||
| 
						 | 
				
			
			@ -2982,7 +2755,7 @@ UINT32 I_GetFreeMem(UINT32 *total)
 | 
			
		|||
	if (total)
 | 
			
		||||
		*total = 32 << 20;
 | 
			
		||||
	return 32 << 20;
 | 
			
		||||
#elif (defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX)
 | 
			
		||||
#elif defined (_WIN32)
 | 
			
		||||
	MEMORYSTATUS info;
 | 
			
		||||
 | 
			
		||||
	info.dwLength = sizeof (MEMORYSTATUS);
 | 
			
		||||
| 
						 | 
				
			
			@ -3054,7 +2827,7 @@ UINT32 I_GetFreeMem(UINT32 *total)
 | 
			
		|||
 | 
			
		||||
const CPUInfoFlags *I_CPUInfo(void)
 | 
			
		||||
{
 | 
			
		||||
#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
 | 
			
		||||
#if defined (_WIN32)
 | 
			
		||||
	static CPUInfoFlags WIN_CPUInfo;
 | 
			
		||||
	SYSTEM_INFO SI;
 | 
			
		||||
	p_IsProcessorFeaturePresent pfnCPUID = (p_IsProcessorFeaturePresent)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsProcessorFeaturePresent");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,10 +26,7 @@
 | 
			
		|||
#include "i_ttf.h"
 | 
			
		||||
 | 
			
		||||
// Search directories to find aforementioned TTF file.
 | 
			
		||||
#ifdef _PS3
 | 
			
		||||
#include <sysutil/video.h>
 | 
			
		||||
#define FONTSEARCHPATH1 "/dev_hdd0/game/SRB2-PS3_/USRDIR/etc"
 | 
			
		||||
#elif defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
 | 
			
		||||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
 | 
			
		||||
#define FONTSEARCHPATH1 "/usr/share/fonts"
 | 
			
		||||
#define FONTSEARCHPATH2 "/usr/local/share/fonts"
 | 
			
		||||
#define FONTSEARCHPATH3 "/usr/games/SRB2"
 | 
			
		||||
| 
						 | 
				
			
			@ -233,16 +230,9 @@ void I_StartupTTF(UINT32 fontpointsize, Uint32 initflags, Uint32 vidmodeflags)
 | 
			
		|||
{
 | 
			
		||||
	char *fontpath = NULL;
 | 
			
		||||
	INT32 fontstatus = -1;
 | 
			
		||||
#ifdef _PS3
 | 
			
		||||
	videoState state;
 | 
			
		||||
	videoGetState(0, 0, &state);
 | 
			
		||||
	videoGetResolution(state.displayMode.resolution, &res);
 | 
			
		||||
	bitsperpixel = 24;
 | 
			
		||||
#else
 | 
			
		||||
	res.width = 320;
 | 
			
		||||
	res.height = 200;
 | 
			
		||||
	bitsperpixel = 8;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	// what's the point of trying to display an error?
 | 
			
		||||
	// SDL_ttf is not started, can't display anything to screen (presumably)...
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -57,13 +57,12 @@ int currentfonthinting;
 | 
			
		|||
int currentfontoutline;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef _PS3
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
	UINT16 width;
 | 
			
		||||
	UINT16 height;
 | 
			
		||||
} VideoResolution;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
UINT8 bitsperpixel;
 | 
			
		||||
 | 
			
		||||
typedef enum
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -47,7 +47,7 @@
 | 
			
		|||
 | 
			
		||||
#include "../doomdef.h"
 | 
			
		||||
 | 
			
		||||
#if defined (_WIN32)
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
#include "SDL_syswm.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,12 +43,10 @@
 | 
			
		|||
#define HAVE_ZLIB
 | 
			
		||||
 | 
			
		||||
#ifndef _MSC_VER
 | 
			
		||||
#ifndef _WII
 | 
			
		||||
#ifndef _LARGEFILE64_SOURCE
 | 
			
		||||
#define _LARGEFILE64_SOURCE
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef _LFS64_LARGEFILE
 | 
			
		||||
#define _LFS64_LARGEFILE
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,7 +49,7 @@
 | 
			
		|||
#define MIX_CHANNELS 8
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined (_WIN32) && !defined (_WIN32_WCE) && !defined (_XBOX)
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
#include <direct.h>
 | 
			
		||||
#elif defined (__GNUC__)
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -85,21 +85,11 @@
 | 
			
		|||
//  mixing buffer, and the samplerate of the raw data.
 | 
			
		||||
 | 
			
		||||
// Needed for calling the actual sound output.
 | 
			
		||||
#if defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined(GP2X)
 | 
			
		||||
#define NUM_CHANNELS            MIX_CHANNELS
 | 
			
		||||
#else
 | 
			
		||||
#define NUM_CHANNELS            MIX_CHANNELS*4
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define INDEXOFSFX(x) ((sfxinfo_t *)x - S_sfx)
 | 
			
		||||
 | 
			
		||||
#if defined (_WIN32_WCE) || defined (DC) || defined (PSP)
 | 
			
		||||
static Uint16 samplecount = 512; //Alam: .5KB samplecount at 11025hz is 46.439909297052154195011337868481ms of buffer
 | 
			
		||||
#elif defined(GP2X)
 | 
			
		||||
static Uint16 samplecount = 128;
 | 
			
		||||
#else
 | 
			
		||||
static Uint16 samplecount = 1024; //Alam: 1KB samplecount at 22050hz is 46.439909297052154195011337868481ms of buffer
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
typedef struct chan_struct
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -151,17 +141,10 @@ static SDL_bool musicStarted = SDL_FALSE;
 | 
			
		|||
#ifdef HAVE_MIXER
 | 
			
		||||
static SDL_mutex *Msc_Mutex = NULL;
 | 
			
		||||
/* FIXME: Make this file instance-specific */
 | 
			
		||||
#ifdef _arch_dreamcast
 | 
			
		||||
#define MIDI_PATH     "/ram"
 | 
			
		||||
#elif defined(GP2X)
 | 
			
		||||
#define MIDI_PATH     "/mnt/sd/srb2"
 | 
			
		||||
#define MIDI_PATH2    "/tmp/mnt/sd/srb2"
 | 
			
		||||
#else
 | 
			
		||||
#define MIDI_PATH     srb2home
 | 
			
		||||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
 | 
			
		||||
#define MIDI_PATH2    "/tmp"
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
#define MIDI_TMPFILE  "srb2music"
 | 
			
		||||
#define MIDI_TMPFILE2 "srb2wav"
 | 
			
		||||
static INT32 musicvol = 62;
 | 
			
		||||
| 
						 | 
				
			
			@ -176,7 +159,7 @@ static SDL_bool canlooping = SDL_TRUE;
 | 
			
		|||
 | 
			
		||||
#if SDL_MIXER_VERSION_ATLEAST(1,2,7)
 | 
			
		||||
#define USE_RWOPS // ok, USE_RWOPS is in here
 | 
			
		||||
#if defined (DC) || defined (_WIN32_WCE) || defined (_XBOX) //|| defined(_WIN32) || defined(GP2X)
 | 
			
		||||
#if 0 // defined(_WIN32)
 | 
			
		||||
#undef USE_RWOPS
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -1188,13 +1171,6 @@ void I_StartupSound(void)
 | 
			
		|||
#endif
 | 
			
		||||
#ifndef HAVE_MIXER
 | 
			
		||||
	nomidimusic = nodigimusic = true;
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef DC
 | 
			
		||||
	//nosound = true;
 | 
			
		||||
#ifdef HAVE_MIXER
 | 
			
		||||
	nomidimusic = true;
 | 
			
		||||
	nodigimusic = true;
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	memset(channels, 0, sizeof (channels)); //Alam: Clean it
 | 
			
		||||
| 
						 | 
				
			
			@ -1243,13 +1219,7 @@ void I_StartupSound(void)
 | 
			
		|||
		audio.samples /= 2;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#if defined (_PSP)  && defined (HAVE_MIXER) // Bug in PSP's SDL_OpenAudio, can not open twice
 | 
			
		||||
	I_SetChannels();
 | 
			
		||||
	sound_started = true;
 | 
			
		||||
	Snd_Mutex = SDL_CreateMutex();
 | 
			
		||||
#else
 | 
			
		||||
	if (nosound)
 | 
			
		||||
#endif
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
#ifdef HW3SOUND
 | 
			
		||||
| 
						 | 
				
			
			@ -1302,7 +1272,7 @@ void I_StartupSound(void)
 | 
			
		|||
			snddev.bps = 16;
 | 
			
		||||
			snddev.sample_rate = audio.freq;
 | 
			
		||||
			snddev.numsfxs = NUMSFX;
 | 
			
		||||
#if defined (_WIN32) && !defined (_XBOX)
 | 
			
		||||
#if defined (_WIN32)
 | 
			
		||||
			snddev.cooplevel = 0x00000002;
 | 
			
		||||
			snddev.hWnd = vid.WndParent;
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -1520,9 +1490,7 @@ void I_InitMusic(void)
 | 
			
		|||
	I_OutputMsg("Compiled for SDL_mixer version: %d.%d.%d\n",
 | 
			
		||||
	            MIXcompiled.major, MIXcompiled.minor, MIXcompiled.patch);
 | 
			
		||||
#ifdef MIXER_POS
 | 
			
		||||
#ifndef _WII
 | 
			
		||||
	if (MIXlinked->major == 1 && MIXlinked->minor == 2 && MIXlinked->patch < 7)
 | 
			
		||||
#endif
 | 
			
		||||
		canlooping = SDL_FALSE;
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef USE_RWOPS
 | 
			
		||||
| 
						 | 
				
			
			@ -1531,13 +1499,11 @@ void I_InitMusic(void)
 | 
			
		|||
#endif
 | 
			
		||||
	I_OutputMsg("Linked with SDL_mixer version: %d.%d.%d\n",
 | 
			
		||||
	            MIXlinked->major, MIXlinked->minor, MIXlinked->patch);
 | 
			
		||||
#if !(defined (DC) || defined (PSP) || defined(GP2X) || defined (WII))
 | 
			
		||||
	if (audio.freq < 44100 && !M_CheckParm ("-freq")) //I want atleast 44Khz
 | 
			
		||||
	{
 | 
			
		||||
		audio.samples = (Uint16)(audio.samples*(INT32)(44100/audio.freq));
 | 
			
		||||
		audio.freq = 44100; //Alam: to keep it around the same XX ms
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (sound_started
 | 
			
		||||
#ifdef HW3SOUND
 | 
			
		||||
| 
						 | 
				
			
			@ -1929,7 +1895,7 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
 | 
			
		|||
		if (loopstart > 0)
 | 
			
		||||
		{
 | 
			
		||||
			loopstartDig = (double)((44.1l+loopstart) / 44100.0l); //8 PCM chucks off and PCM to secs
 | 
			
		||||
//#ifdef GP2X//#ifdef PARANOIA
 | 
			
		||||
//#ifdef PARANOIA
 | 
			
		||||
			//I_OutputMsg("I_StartDigSong: setting looping point to %ul PCMs(%f seconds)\n", loopstart, loopstartDig);
 | 
			
		||||
//#endif
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue