Burned Dreamcast port at the stake

This commit is contained in:
Monster Iestyn 2017-09-29 18:19:34 +01:00
parent de4ea022c0
commit f4e535a64d
39 changed files with 69 additions and 1483 deletions

View File

@ -259,10 +259,8 @@ endif
ifdef NOHW
OPTS+=-DNOHW
else
ifndef DC
#Hurdler: not really supported and not tested recently
#OPTS+=-DUSE_PALETTED_TEXTURE
endif
OPTS+=-DHWRENDER
OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.o $(OBJDIR)/hw_light.o \
$(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o $(OBJDIR)/hw_trick.o
@ -547,11 +545,7 @@ ifdef PSP
all: pre-build $(BIN)/$(BINNAME) post-build
endif
ifdef DC
all: pre-build $(BIN)/$(BINNAME) post-build
endif
ifndef DC
ifndef PSP
ifndef XBOX
ifdef MINGW
@ -560,7 +554,6 @@ all: pre-build $(BIN)/$(EXENAME) dll
endif
endif
endif
endif
ifdef SDL
all: pre-build $(BIN)/$(EXENAME)
@ -748,16 +741,6 @@ endif
$(REMOVE) $(OBJDIR)/depend.ped
@echo "Created dependency file, depend.dep"
ifdef DC
$(OBJDIR)/v_video.o: v_video.c doomdef.h doomtype.h g_state.h m_swap.h r_local.h \
tables.h m_fixed.h screen.h command.h m_bbox.h r_main.h d_player.h \
p_pspr.h info.h d_think.h sounds.h p_mobj.h doomdata.h d_ticcmd.h \
r_data.h r_defs.h r_state.h r_bsp.h r_segs.h r_plane.h r_sky.h \
r_things.h r_draw.h v_video.h hu_stuff.h d_event.h w_wad.h console.h \
i_video.h z_zone.h doomstat.h d_clisrv.h d_netcmd.h
$(CC) $(CFLAGS) -fno-omit-frame-pointer $(WFLAGS) -c $< -o $@
endif
ifdef VALGRIND
$(OBJDIR)/z_zone.o: z_zone.c
$(CC) $(CFLAGS) $(WFLAGS) -DHAVE_VALGRIND $(VALGRIND_CFLAGS) -c $< -o $@
@ -799,55 +782,6 @@ $(OBJDIR)/%.o: %.s
$(OBJDIR)/SRB2.res: win32/Srb2win.rc win32/afxres.h win32/resource.h
$(WINDRES) -i $< -O rc $(WINDRESFLAGS) --include-dir=win32 -o $@ -O coff
ifdef DC
$(OBJDIR)/romdisk.img:
$(KOS_GENROMFS) -f romdisk.img -d ../data -v
$(OBJDIR)/romdisk.o: romdisk.img
$(KOS_BASE)/utils/bin2o/bin2o romdisk.img romdisk romdisk.o
$(OBJDIR)/dchelp.o: $(INTERFACE)/SRB2DC/dchelp.c
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
$(OBJDIR)/i_udp.o: $(INTERFACE)/SRB2DC/i_udp.c
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
$(BIN)/IP.BIN: $(INTERFACE)/SRB2DC/IP.BIN
$(CP) $< $@
$(BIN)/SRB2DC.cdi.pass1: $(INTERFACE)/SRB2DC/SELFBOOT.BIN
$(CP) $< $@
$(BIN)/$(BINNAME): $(BIN)/$(EXENAME)
$(KOS_OBJCOPY) -R .stack -O binary $< $@
$(BIN)/1ST_READ.BIN: $(BIN)/$(BINNAME) $(BIN)/scramble
$(BIN)/scramble $< $@
$(BIN)/scramble: $(INTERFACE)/SRB2DC/scramble.c
-$(MKDIR) $(BIN)
$(HOSTCC) $< -o $@
iso: $(BIN)/SRB2DC.iso
cdi: $(BIN)/SRB2DC.cdi
$(BIN)/SRB2DC.iso.pass1: $(BIN)/1ST_READ.BIN $(BIN)/IP.BIN
-$(MKDIR) $(BIN)/cdrom
$(CP) $(BIN)/1ST_READ.BIN $(D_FILES) $(BIN)/cdrom
$(MKISOFS) -l -r -o $@ $(BIN)/cdrom
$(BIN)/SRB2DC.iso.pass2: $(BIN)/SRB2DC.iso.pass1
$(DD) if=$< of=$@ bs=2048 skip=16 status=noxfer
$(BIN)/SRB2DC.iso: $(BIN)/SRB2DC.iso.pass2 $(BIN)/IP.BIN
@cat $(BIN)/IP.BIN $(BIN)/SRB2DC.iso.pass2 > $@
$(BIN)/SRB2DC.cdi: $(BIN)/SRB2DC.iso.pass2 $(BIN)/SRB2DC.cdi.pass1 $(BIN)/IP.BIN
@cat $(BIN)/SRB2DC.cdi.pass1 $(BIN)/IP.BIN $(BIN)/SRB2DC.iso.pass2 > $@
post-build: $(BIN)/1ST_READ.BIN
endif
ifdef XBOX
$(OBJDIR)/xboxhelp.o: $(INTERFACE)/SRB2XBOX/xboxhelp.c
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@

View File

@ -88,10 +88,6 @@ ifdef GCC295
GCC29=1
endif
ifdef DC
NOCASTALIGNWARN=1
endif
OLDWFLAGS:=$(WFLAGS)
# -W -Wno-unused
WFLAGS=-Wall
@ -221,7 +217,6 @@ endif
ifndef WINCE
ifndef XBOX
ifndef PSP
ifndef DC
ifndef WII
ifndef PS3N
ifndef LINUX
@ -244,7 +239,6 @@ endif
endif
endif
endif
endif
#determine the interface directory (where you put all i_*.c)
i_cdmus_o=$(OBJDIR)/i_cdmus.o
@ -382,15 +376,6 @@ ifdef PSP
BIN:=$(BIN)/PSP
NOUPX=1
else
ifdef DC
INTERFACE=sdl12
NONX86=1
SDL=1
SDL12=1
OBJDIR:=$(OBJDIR)/DC
BIN:=$(BIN)/DC
NOUPX=1
else
ifdef WINCE
INTERFACE=sdl12
NONX86=1
@ -419,7 +404,6 @@ endif
endif
endif
endif
endif
ifdef GP2X
ifdef SDL

View File

@ -1207,9 +1207,7 @@ void CONS_Printf(const char *fmt, ...)
va_end(argptr);
// echo console prints to log file
#ifndef _arch_dreamcast
DEBFILE(txt);
#endif
if (!con_started)
{

View File

@ -140,13 +140,8 @@ boolean advancedemo;
INT32 debugload = 0;
#endif
#ifdef _arch_dreamcast
char srb2home[256] = "/cd";
char srb2path[256] = "/cd";
#else
char srb2home[256] = ".";
char srb2path[256] = ".";
#endif
boolean usehome = true;
const char *pandf = "%s" PATHSEP "%s";
@ -822,11 +817,7 @@ static void IdentifyVersion(void)
else
#endif
{
#ifdef _arch_dreamcast
srb2waddir = "/cd";
#else
srb2waddir = ".";
#endif
}
}
@ -881,11 +872,7 @@ static void IdentifyVersion(void)
#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
{
#if defined (DC) && 0
const char *musicfile = "music_dc.dta";
#else
const char *musicfile = "music.dta";
#endif
const char *musicpath = va(pandf,srb2waddir,musicfile);
int ms = W_VerifyNMUSlumps(musicpath); // Don't forget the music!
if (ms == 1)
@ -1029,7 +1016,7 @@ void D_SRB2Main(void)
if (!userhome)
{
#if ((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__CYGWIN__) && !defined (DC) && !defined (PSP) && !defined(GP2X)
#if ((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__CYGWIN__) && !defined (PSP) && !defined(GP2X)
I_Error("Please set $HOME to your home directory\n");
#elif defined (_WIN32_WCE) && 0
if (dedicated)
@ -1072,10 +1059,6 @@ void D_SRB2Main(void)
}
configfile[sizeof configfile - 1] = '\0';
#ifdef _arch_dreamcast
strcpy(downloaddir, "/ram"); // the dreamcast's TMP
#endif
}
// rand() needs seeded regardless of password
@ -1447,10 +1430,6 @@ const char *D_Home(void)
#ifdef ANDROID
return "/data/data/org.srb2/";
#endif
#ifdef _arch_dreamcast
char VMUHOME[] = "HOME=/vmu/a1";
putenv(VMUHOME); //don't use I_PutEnv
#endif
if (M_CheckParm("-home") && M_IsNextParm())
userhome = M_GetNextParm();

View File

@ -1359,11 +1359,6 @@ boolean D_CheckNetGame(void)
netbuffer = (doomdata_t *)(void *)&doomcom->data;
#ifdef DEBUGFILE
#ifdef _arch_dreamcast
//debugfile = stderr;
if (debugfile)
CONS_Printf(M_GetText("debug output to: %s\n"), "STDERR");
#else
if (M_CheckParm("-debugfile"))
{
char filename[21];
@ -1381,7 +1376,6 @@ boolean D_CheckNetGame(void)
else
CONS_Alert(CONS_WARNING, M_GetText("cannot debug output to file %s!\n"), filename);
}
#endif
#endif
D_ClientServerInit();

View File

@ -244,7 +244,7 @@ INT32 cv_debug;
consvar_t cv_usemouse = {"use_mouse", "On", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_usemouse2 = {"use_mouse2", "Off", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse2, 0, NULL, NULL, 0, 0, NULL};
#if defined (DC) || defined (_XBOX) || defined (WMINPUT) || defined (_WII) //joystick 1 and 2
#if defined (_XBOX) || defined (WMINPUT) || defined (_WII) //joystick 1 and 2
consvar_t cv_usejoystick = {"use_joystick", "1", CV_SAVE|CV_CALL, usejoystick_cons_t,
I_InitJoystick, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_usejoystick2 = {"use_joystick2", "2", CV_SAVE|CV_CALL, usejoystick_cons_t,

View File

@ -932,7 +932,7 @@ size_t nameonlylength(const char *s)
filestatus_t checkfilemd5(char *filename, const UINT8 *wantedmd5sum)
{
#if defined (NOMD5) || defined (_arch_dreamcast)
#if defined (NOMD5)
(void)wantedmd5sum;
(void)filename;
#else
@ -967,9 +967,5 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
if (homecheck == FS_FOUND)
return filesearch(filename, srb2path, wantedmd5sum, completepath, 10);
#ifdef _arch_dreamcast
return filesearch(filename, "/cd", wantedmd5sum, completepath, 10);
#else
return filesearch(filename, ".", wantedmd5sum, completepath, 10);
#endif
}

View File

@ -28,7 +28,7 @@
// Use Mixer interface?
#ifdef HAVE_MIXER
//#if !defined(DC) && !defined(_WIN32_WCE) && !defined(_XBOX) && !defined(GP2X)
//#if !defined(_WIN32_WCE) && !defined(_XBOX) && !defined(GP2X)
#define SOUND SOUND_MIXER
#define NOHS // No HW3SOUND
#ifdef HW3SOUND
@ -381,7 +381,7 @@ enum {
};
// Name of local directory for config files and savegames
#if !defined(_arch_dreamcast) && !defined(_WIN32_WCE) && !defined(GP2X) && !defined(_WII) && !defined(_PS3)
#if !defined(_WIN32_WCE) && !defined(GP2X) && !defined(_WII) && !defined(_PS3)
#if (((defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON)) && !defined (__CYGWIN__)) && !defined (__APPLE__)
#define DEFAULTDIR ".srb2"
#else

View File

@ -51,19 +51,6 @@ typedef long ssize_t;
#if ((_MSC_VER <= 1200) && (!defined(PDWORD_PTR)))
#define PDWORD_PTR PDWORD
#endif
#elif defined (_arch_dreamcast) // KOS Dreamcast
#include <arch/types.h>
#define UINT8 unsigned char
#define SINT8 signed char
#define UINT16 uint16
#define INT16 int16
#define INT32 int
#define UINT32 unsigned int
#define INT64 int64
#define UINT64 uint64
#elif defined (__DJGPP__)
#define UINT8 unsigned char
#define SINT8 signed char
@ -154,7 +141,7 @@ typedef long ssize_t;
#endif
#endif //macintosh
#if defined (PC_DOS) || defined (_WIN32) || defined (_WII) || defined (_PSP) || defined (_arch_dreamcast) || defined (__HAIKU__) || defined(_NDS) || defined(_PS3)
#if defined (PC_DOS) || defined (_WIN32) || defined (_WII) || defined (_PSP) || defined (__HAIKU__) || defined(_NDS) || defined(_PS3)
#define HAVE_DOSSTR_FUNCS
#endif

View File

@ -332,11 +332,7 @@ static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"},
#endif
#else
{1, "X-Axis"}, {2, "Y-Axis"}, {-1, "X-Axis-"}, {-2, "Y-Axis-"},
#ifdef _arch_dreamcast
{3, "R-Trig"}, {4, "L-Trig"}, {-3, "R-Trig-"}, {-4, "L-Trig-"},
{5, "Alt X-Axis"}, {6, "Alt Y-Axis"}, {-5, "Alt X-Axis-"}, {-6, "Alt Y-Axis-"},
{7, "Triggers"}, {-7,"Triggers-"},
#elif defined (_XBOX)
#ifdef _XBOX
{3, "Alt X-Axis"}, {4, "Alt Y-Axis"}, {-3, "Alt X-Axis-"}, {-4, "Alt Y-Axis-"},
#else
#if JOYAXISSET > 1
@ -371,13 +367,8 @@ consvar_t cv_mousemove = {"mousemove", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, N
consvar_t cv_mousemove2 = {"mousemove2", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_analog = {"analog", "Off", CV_CALL, CV_OnOff, Analog_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_analog2 = {"analog2", "Off", CV_CALL, CV_OnOff, Analog2_OnChange, 0, NULL, NULL, 0, 0, NULL};
#ifdef DC
consvar_t cv_useranalog = {"useranalog", "On", CV_SAVE|CV_CALL, CV_OnOff, UserAnalog_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_useranalog2 = {"useranalog2", "On", CV_SAVE|CV_CALL, CV_OnOff, UserAnalog2_OnChange, 0, NULL, NULL, 0, 0, NULL};
#else
consvar_t cv_useranalog = {"useranalog", "Off", CV_SAVE|CV_CALL, CV_OnOff, UserAnalog_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_useranalog2 = {"useranalog2", "Off", CV_SAVE|CV_CALL, CV_OnOff, UserAnalog2_OnChange, 0, NULL, NULL, 0, 0, NULL};
#endif
static CV_PossibleValue_t directionchar_cons_t[] = {{0, "Camera"}, {1, "Movement"}, {0, NULL}};
@ -413,9 +404,7 @@ consvar_t cv_moveaxis = {"joyaxis_move", "None", CV_SAVE, joyaxis_cons_t, NULL,
#else
consvar_t cv_moveaxis = {"joyaxis_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
#endif
#ifdef _arch_dreamcast
consvar_t cv_sideaxis = {"joyaxis_side", "Triggers", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
#elif defined (_XBOX)
#ifdef _XBOX
consvar_t cv_sideaxis = {"joyaxis_side", "Alt X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_lookaxis = {"joyaxis_look", "Alt Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
#elif defined (PSP)
@ -444,9 +433,7 @@ consvar_t cv_firenaxis2 = {"joyaxis2_firenormal", "RAnalog", CV_SAVE, joyaxis_co
#else
consvar_t cv_turnaxis2 = {"joyaxis2_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_moveaxis2 = {"joyaxis2_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
#ifdef _arch_dreamcast
consvar_t cv_sideaxis2 = {"joyaxis2_side", "Triggers", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
#elif defined (_XBOX)
#ifdef _XBOX
consvar_t cv_sideaxis2 = {"joyaxis2_side", "Alt X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_lookaxis2 = {"joyaxis2_look", "Alt Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
#elif defined (_PSP)
@ -838,14 +825,6 @@ static INT32 JoyAxis(axis_input_e axissel)
axisval = -axisval;
flp = true;
}
#ifdef _arch_dreamcast
if (axisval == 7) // special case
{
retaxis = joyxmove[1] - joyymove[1];
goto skipDC;
}
else
#endif
if (axisval > JOYAXISSET*2 || axisval == 0) //not there in array or None
return 0;
@ -861,10 +840,6 @@ static INT32 JoyAxis(axis_input_e axissel)
retaxis = joyymove[axisval];
}
#ifdef _arch_dreamcast
skipDC:
#endif
if (retaxis < (-JOYAXISRANGE))
retaxis = -JOYAXISRANGE;
if (retaxis > (+JOYAXISRANGE))
@ -916,14 +891,7 @@ static INT32 Joy2Axis(axis_input_e axissel)
axisval = -axisval;
flp = true;
}
#ifdef _arch_dreamcast
if (axisval == 7) // special case
{
retaxis = joy2xmove[1] - joy2ymove[1];
goto skipDC;
}
else
#endif
if (axisval > JOYAXISSET*2 || axisval == 0) //not there in array or None
return 0;
@ -939,10 +907,6 @@ static INT32 Joy2Axis(axis_input_e axissel)
retaxis = joy2ymove[axisval];
}
#ifdef _arch_dreamcast
skipDC:
#endif
if (retaxis < (-JOYAXISRANGE))
retaxis = -JOYAXISRANGE;
if (retaxis > (+JOYAXISRANGE))

View File

@ -204,11 +204,9 @@ static keyname_t keynames[] =
{KEY_SCROLLLOCK, "SCROLLLOCK"},
// bill gates keys
#ifndef _arch_dreamcast
{KEY_LEFTWIN, "LEFTWIN"},
{KEY_RIGHTWIN, "RIGHTWIN"},
{KEY_MENU, "MENU"},
#endif
{KEY_LSHIFT, "LSHIFT"},
{KEY_RSHIFT, "RSHIFT"},
@ -270,7 +268,7 @@ static keyname_t keynames[] =
{KEY_MOUSE1+0,"MOUSE1"},
{KEY_MOUSE1+1,"MOUSE2"},
{KEY_MOUSE1+2,"MOUSE3"},
#if !defined (_arch_dreamcast) && !defined (_XBOX) && !defined (_PSP) && !defined (_WII)
#if !defined (_XBOX) && !defined (_PSP) && !defined (_WII)
{KEY_MOUSE1+3,"MOUSE4"},
{KEY_MOUSE1+4,"MOUSE5"},
{KEY_MOUSE1+5,"MOUSE6"},
@ -280,7 +278,7 @@ static keyname_t keynames[] =
{KEY_2MOUSE1+0,"SEC_MOUSE2"}, // BP: sorry my mouse handler swap button 1 and 2
{KEY_2MOUSE1+1,"SEC_MOUSE1"},
{KEY_2MOUSE1+2,"SEC_MOUSE3"},
#if !defined (_arch_dreamcast) && !defined (_XBOX) && !defined (_PSP) && !defined (_WII)
#if !defined (_XBOX) && !defined (_PSP) && !defined (_WII)
{KEY_2MOUSE1+3,"SEC_MOUSE4"},
{KEY_2MOUSE1+4,"SEC_MOUSE5"},
{KEY_2MOUSE1+5,"SEC_MOUSE6"},
@ -292,16 +290,7 @@ static keyname_t keynames[] =
{KEY_2MOUSEWHEELUP, "Wheel 2 UP"},
{KEY_2MOUSEWHEELDOWN, "Wheel 2 Down"},
#ifdef DC
{KEY_JOY1+0, "JOYC"},
{KEY_JOY1+1, "JOYB"},
{KEY_JOY1+2, "JOYA"},
{KEY_JOY1+3, "JOYS"},
{KEY_JOY1+4, "JOYZ"},
{KEY_JOY1+5, "JOYY"},
{KEY_JOY1+6, "JOYX"},
{KEY_JOY1+7, "JOYD"},
#elif defined (_XBOX)
#ifdef _XBOX
{KEY_JOY1+0, "JOYA"},
{KEY_JOY1+1, "JOYB"},
{KEY_JOY1+2, "JOYX"},
@ -414,7 +403,7 @@ static keyname_t keynames[] =
{KEY_JOY1+7, "JOY8"},
{KEY_JOY1+8, "JOY9"},
#endif
#if !defined (_arch_dreamcast) && !defined (NOMOREJOYBTN_1S)
#if !defined (NOMOREJOYBTN_1S)
// we use up to 32 buttons in DirectInput
{KEY_JOY1+9, "JOY10"},
{KEY_JOY1+10, "JOY11"},
@ -450,7 +439,6 @@ static keyname_t keynames[] =
{KEY_HAT1+5, "HATDOWN2"},
{KEY_HAT1+6, "HATLEFT2"},
{KEY_HAT1+7, "HATRIGHT2"},
#ifndef _arch_dreamcast
{KEY_HAT1+8, "HATUP3"},
{KEY_HAT1+9, "HATDOWN3"},
{KEY_HAT1+10, "HATLEFT3"},
@ -459,13 +447,12 @@ static keyname_t keynames[] =
{KEY_HAT1+13, "HATDOWN4"},
{KEY_HAT1+14, "HATLEFT4"},
{KEY_HAT1+15, "HATRIGHT4"},
#endif
#endif
{KEY_DBLMOUSE1+0, "DBLMOUSE1"},
{KEY_DBLMOUSE1+1, "DBLMOUSE2"},
{KEY_DBLMOUSE1+2, "DBLMOUSE3"},
#if !defined (_arch_dreamcast) && !defined (_XBOX) && !defined (_PSP) && !defined (_WII)
#if !defined (_XBOX) && !defined (_PSP) && !defined (_WII)
{KEY_DBLMOUSE1+3, "DBLMOUSE4"},
{KEY_DBLMOUSE1+4, "DBLMOUSE5"},
{KEY_DBLMOUSE1+5, "DBLMOUSE6"},
@ -475,7 +462,7 @@ static keyname_t keynames[] =
{KEY_DBL2MOUSE1+0, "DBLSEC_MOUSE2"}, // BP: sorry my mouse handler swap button 1 and 2
{KEY_DBL2MOUSE1+1, "DBLSEC_MOUSE1"},
{KEY_DBL2MOUSE1+2, "DBLSEC_MOUSE3"},
#if !defined (_arch_dreamcast) && !defined (_XBOX) && !defined (_PSP) && !defined (_WII)
#if !defined (_XBOX) && !defined (_PSP) && !defined (_WII)
{KEY_DBL2MOUSE1+3, "DBLSEC_MOUSE4"},
{KEY_DBL2MOUSE1+4, "DBLSEC_MOUSE5"},
{KEY_DBL2MOUSE1+5, "DBLSEC_MOUSE6"},
@ -483,16 +470,7 @@ static keyname_t keynames[] =
{KEY_DBL2MOUSE1+7, "DBLSEC_MOUSE8"},
#endif
#ifdef DC
{KEY_DBLJOY1+0, "DBLJOYC"},
{KEY_DBLJOY1+1, "DBLJOYB"},
{KEY_DBLJOY1+2, "DBLJOYA"},
{KEY_DBLJOY1+3, "DBLJOYS"},
{KEY_DBLJOY1+4, "DBLJOYZ"},
{KEY_DBLJOY1+5, "DBLJOYY"},
{KEY_DBLJOY1+6, "DBLJOYX"},
{KEY_DBLJOY1+7, "DBLJOYD"},
#elif defined (_XBOX)
#ifdef _XBOX
{KEY_DBLJOY1+0, "DBLJOYA"},
{KEY_DBLJOY1+1, "DBLJOYB"},
{KEY_DBLJOY1+2, "DBLJOYX"},
@ -604,7 +582,7 @@ static keyname_t keynames[] =
{KEY_DBLJOY1+6, "DBLJOY7"},
{KEY_DBLJOY1+7, "DBLJOY8"},
#endif
#if !defined (_arch_dreamcast) && !defined (NOMOREJOYBTN_1DBL)
#if !defined (NOMOREJOYBTN_1DBL)
{KEY_DBLJOY1+8, "DBLJOY9"},
{KEY_DBLJOY1+9, "DBLJOY10"},
{KEY_DBLJOY1+10, "DBLJOY11"},
@ -639,7 +617,6 @@ static keyname_t keynames[] =
{KEY_DBLHAT1+5, "DBLHATDOWN2"},
{KEY_DBLHAT1+6, "DBLHATLEFT2"},
{KEY_DBLHAT1+7, "DBLHATRIGHT2"},
#ifndef _arch_dreamcast
{KEY_DBLHAT1+8, "DBLHATUP3"},
{KEY_DBLHAT1+9, "DBLHATDOWN3"},
{KEY_DBLHAT1+10, "DBLHATLEFT3"},
@ -649,18 +626,8 @@ static keyname_t keynames[] =
{KEY_DBLHAT1+14, "DBLHATLEFT4"},
{KEY_DBLHAT1+15, "DBLHATRIGHT4"},
#endif
#endif
#ifdef DC
{KEY_2JOY1+0, "SEC_JOYC"},
{KEY_2JOY1+1, "SEC_JOYB"},
{KEY_2JOY1+2, "SEC_JOYA"},
{KEY_2JOY1+3, "SEC_JOYS"},
{KEY_2JOY1+4, "SEC_JOYZ"},
{KEY_2JOY1+5, "SEC_JOYY"},
{KEY_2JOY1+6, "SEC_JOYX"},
{KEY_2JOY1+7, "SEC_JOYD"},
#elif defined (_XBOX)
#ifdef _XBOX
{KEY_2JOY1+0, "SEC_JOYA"},
{KEY_2JOY1+1, "SEC_JOYB"},
{KEY_2JOY1+2, "SEC_JOYX"},
@ -752,7 +719,7 @@ static keyname_t keynames[] =
{KEY_2JOY1+6, "SEC_JOY7"},
{KEY_2JOY1+7, "SEC_JOY8"},
#endif
#if !defined (_arch_dreamcast) && !defined (NOMOREJOYBTN_2S)
#if !defined (NOMOREJOYBTN_2S)
// we use up to 32 buttons in DirectInput
{KEY_2JOY1+8, "SEC_JOY9"},
{KEY_2JOY1+9, "SEC_JOY10"},
@ -789,7 +756,6 @@ static keyname_t keynames[] =
{KEY_2HAT1+5, "SEC_HATDOWN2"},
{KEY_2HAT1+6, "SEC_HATLEFT2"},
{KEY_2HAT1+7, "SEC_HATRIGHT2"},
#ifndef _arch_dreamcast
{KEY_2HAT1+8, "SEC_HATUP3"},
{KEY_2HAT1+9, "SEC_HATDOWN3"},
{KEY_2HAT1+10, "SEC_HATLEFT3"},
@ -799,18 +765,8 @@ static keyname_t keynames[] =
{KEY_2HAT1+14, "SEC_HATLEFT4"},
{KEY_2HAT1+15, "SEC_HATRIGHT4"},
#endif
#endif
#ifdef DC
{KEY_DBL2JOY1+0, "DBLSEC_JOYC"},
{KEY_DBL2JOY1+1, "DBLSEC_JOYB"},
{KEY_DBL2JOY1+2, "DBLSEC_JOYA"},
{KEY_DBL2JOY1+3, "DBLSEC_JOYS"},
{KEY_DBL2JOY1+4, "DBLSEC_JOYZ"},
{KEY_DBL2JOY1+5, "DBLSEC_JOYY"},
{KEY_DBL2JOY1+6, "DBLSEC_JOYX"},
{KEY_DBL2JOY1+7, "DBLSEC_JOYD"},
#elif defined (_XBOX)
#ifdef _XBOX
{KEY_DBL2JOY1+0, "DBLSEC_JOYA"},
{KEY_DBL2JOY1+1, "DBLSEC_JOYB"},
{KEY_DBL2JOY1+2, "DBLSEC_JOYX"},
@ -902,7 +858,7 @@ static keyname_t keynames[] =
{KEY_DBL2JOY1+6, "DBLSEC_JOY7"},
{KEY_DBL2JOY1+7, "DBLSEC_JOY8"},
#endif
#if !defined (_arch_dreamcast) && !defined (NOMOREJOYBTN_2DBL)
#if !defined (NOMOREJOYBTN_2DBL)
{KEY_DBL2JOY1+8, "DBLSEC_JOY9"},
{KEY_DBL2JOY1+9, "DBLSEC_JOY10"},
{KEY_DBL2JOY1+10, "DBLSEC_JOY11"},
@ -937,7 +893,6 @@ static keyname_t keynames[] =
{KEY_DBL2HAT1+5, "DBLSEC_HATDOWN2"},
{KEY_DBL2HAT1+6, "DBLSEC_HATLEFT2"},
{KEY_DBL2HAT1+7, "DBLSEC_HATRIGHT2"},
#ifndef _arch_dreamcast
{KEY_DBL2HAT1+8, "DBLSEC_HATUP3"},
{KEY_DBL2HAT1+9, "DBLSEC_HATDOWN3"},
{KEY_DBL2HAT1+10, "DBLSEC_HATLEFT3"},
@ -947,7 +902,6 @@ static keyname_t keynames[] =
{KEY_DBL2HAT1+14, "DBLSEC_HATLEFT4"},
{KEY_DBL2HAT1+15, "DBLSEC_HATRIGHT4"},
#endif
#endif
};
@ -1049,60 +1003,7 @@ INT32 G_KeyStringtoNum(const char *keystr)
return 0;
}
#ifdef DC
void G_Controldefault(void)
{
gamecontrol[gc_forward ][0] = KEY_HAT1+0; //Up
gamecontrol[gc_forward ][1] = KEY_UPARROW;
gamecontrol[gc_backward ][0] = KEY_HAT1+1; //Down
gamecontrol[gc_backward ][1] = KEY_DOWNARROW;
//gamecontrol[gc_straferight][0] = '[';
//gamecontrol[gc_strafeleft ][0] = ']';
gamecontrol[gc_turnleft ][0] = KEY_HAT1+2; //Left
gamecontrol[gc_turnleft ][1] = KEY_LEFTARROW;
gamecontrol[gc_turnright ][0] = KEY_HAT1+3; //Right
gamecontrol[gc_turnright ][1] = KEY_RIGHTARROW;
gamecontrol[gc_weaponnext ][0] = ']';
gamecontrol[gc_weaponprev ][0] = '[';
gamecontrol[gc_fire ][0] = KEY_JOY1+6; //X
gamecontrol[gc_fire ][1] = KEY_RCTRL;
gamecontrol[gc_firenormal ][0] = KEY_JOY1+5; //Y
gamecontrol[gc_firenormal ][1] = ';';
gamecontrol[gc_tossflag ][0] = '\'';
gamecontrol[gc_use ][0] = KEY_JOY1+1; //B
gamecontrol[gc_use ][1] = '.';
gamecontrol[gc_camtoggle ][1] = ',';
gamecontrol[gc_camreset ][0] = 'c';
gamecontrol[gc_lookup ][0] = KEY_PGUP;
gamecontrol[gc_lookdown ][0] = KEY_PGDN;
gamecontrol[gc_centerview ][0] = KEY_END;
gamecontrol[gc_mouseaiming][0] = 's';
gamecontrol[gc_talkkey ][0] = 't';
gamecontrol[gc_teamkey ][0] = 'y';
gamecontrol[gc_scores ][0] = KEY_TAB;
gamecontrol[gc_jump ][0] = KEY_JOY1+2; //A
gamecontrol[gc_jump ][1] = '/';
gamecontrol[gc_console ][0] = KEY_CONSOLE;
gamecontrol[gc_console ][1] = KEY_F5;
//gamecontrolbis
gamecontrolbis[gc_forward ][0] = KEY_2HAT1+0;
gamecontrolbis[gc_forward ][1] = 'w';
gamecontrolbis[gc_backward ][0] = KEY_2HAT1+1;
gamecontrolbis[gc_backward ][1] = 's';
gamecontrolbis[gc_turnleft ][0] = KEY_2HAT1+2;
gamecontrolbis[gc_turnleft ][1] = 'a';
gamecontrolbis[gc_turnright ][0] = KEY_2HAT1+3;
gamecontrolbis[gc_turnright ][1] = 'd';
gamecontrolbis[gc_weaponnext][0] = 't';
gamecontrolbis[gc_weaponprev][0] = 'r';
gamecontrolbis[gc_fire ][0] = KEY_2JOY1+6; //X
gamecontrolbis[gc_firenormal][0] = KEY_2JOY1+5; //Y
gamecontrolbis[gc_use ][0] = KEY_2JOY1+1; //B
gamecontrolbis[gc_jump ][0] = KEY_2JOY1+2; //A
//gamecontrolbis[gc_straferight][0] = 'x';
//gamecontrolbis[gc_strafeleft ][0] = 'z';
}
#elif defined (_PSP)
#ifdef _PSP
void G_Controldefault(void)
{
gamecontrol[gc_forward ][0] = KEY_HAT1+0; // Up

View File

@ -23,12 +23,7 @@
#define NUMKEYS 256
#ifdef _arch_dreamcast
#define MOUSEBUTTONS 5
#define JOYBUTTONS 8 // 8 buttons
#define JOYHATS 2 // 2 hats
#define JOYAXISSET 3 // 3 Sets of 2 axises
#elif defined (_XBOX)
#ifdef _XBOX
#define MOUSEBUTTONS 5
#define JOYBUTTONS 12 // 12 buttons
#define JOYHATS 1 // 1 hat

View File

@ -27,7 +27,7 @@
#endif
#ifdef _PS3
#include <net/netdb.h>
#elif ! defined (_arch_dreamcast)
#else
#include <netdb.h>
#endif
#endif

View File

@ -62,16 +62,11 @@
#ifdef USE_WINSOCK1
#include <winsock.h>
#elif !defined (SCOUW2) && !defined (SCOUW7) && !defined (__OS2__)
#ifdef HAVE_LWIP
#include <lwip/inet.h>
#elif !defined (USE_WINSOCK)
#ifndef USE_WINSOCK
#include <arpa/inet.h>
#endif //normal BSD API
#ifdef HAVE_LWIP
#include <lwip/sockets.h>
#define ioctl lwip_ioctl
#elif !defined (USE_WINSOCK) //!HAVE_LWIP
#ifndef USE_WINSOCK
#ifdef __APPLE_CC__
#ifndef _BSD_SOCKLEN_T_
#define _BSD_SOCKLEN_T_
@ -81,14 +76,10 @@
#include <netinet/in.h>
#endif //normal BSD API
#if defined(_arch_dreamcast) && !defined(HAVE_LWIP)
#include <kos/net.h>
#elif defined(HAVE_LWIP)
#include <lwip/lwip.h>
#elif defined (_PS3)
#if defined (_PS3)
#include <net/select.h>
#include <net/net.h>
#elif !defined(USE_WINSOCK) //!HAVE_LWIP
#elif !defined(USE_WINSOCK)
#include <netdb.h>
#include <sys/ioctl.h>
#endif //normal BSD API
@ -96,10 +87,6 @@
#include <errno.h>
#include <time.h>
#ifdef _arch_dreamcast
#include "sdl12/SRB2DC/dchelp.h"
#endif
#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)
#include <sys/time.h>
#endif // UNIXCOMMON
@ -205,9 +192,7 @@ static UINT8 UPNP_support = TRUE;
#define SELECTTEST
#endif
#elif defined(HAVE_LWIP)
#define SELECTTEST
#elif !defined( _arch_dreamcast)
#else
#define SELECTTEST
#endif
@ -1165,12 +1150,6 @@ boolean I_InitTcpDriver(void)
CONS_Debug(DBG_NETPLAY, "WinSock description: %s\n",WSAData.szDescription);
CONS_Debug(DBG_NETPLAY, "WinSock System Status: %s\n",WSAData.szSystemStatus);
#endif
#ifdef HAVE_LWIP
lwip_kos_init();
#elif defined(_arch_dreamcast)
//return;
net_init();
#endif
#ifdef __DJGPP__
#ifdef WATTCP // Alam_GBC: survive bootp, dhcp, rarp and wattcp/pktdrv from failing to load
survive_eth = 1; // would be needed to not exit if pkt_eth_init() fails
@ -1274,11 +1253,6 @@ void I_ShutdownTcpDriver(void)
WS_addrinfocleanup();
WSACleanup();
#endif
#ifdef HAVE_LWIP
lwip_kos_shutdown();
#elif defined(_arch_dreamcast)
net_shutdown();
#endif
#ifdef __DJGPP__
#ifdef WATTCP // wattcp
//_outch = NULL;

View File

@ -124,7 +124,7 @@ void M_PushSpecialParameters(void)
/// \brief max args
#if defined (_arch_dreamcast) || defined (_XBOX) || defined (_WII)
#if defined (_XBOX) || defined (_WII)
#define MAXARGVS 1
#else
#define MAXARGVS 256

View File

@ -2432,7 +2432,6 @@ boolean M_Responder(event_t *ev)
itemOn = 0;
return true;
#ifndef DC
case KEY_F5: // Video Mode
if (modeattacking)
return true;
@ -2440,7 +2439,6 @@ boolean M_Responder(event_t *ev)
M_Options(0);
M_VideoModeMenu(0);
return true;
#endif
case KEY_F6: // Empty
return true;
@ -2828,9 +2826,8 @@ void M_ClearMenus(boolean callexitmenufunc)
if (currentMenu->quitroutine && callexitmenufunc && !currentMenu->quitroutine())
return; // we can't quit this menu (also used to set parameter from the menu)
#ifndef DC // Save the config file. I'm sick of crashing the game later and losing all my changes!
// Save the config file. I'm sick of crashing the game later and losing all my changes!
COM_BufAddText(va("saveconfig \"%s\" -silent\n", configfile));
#endif //Alam: But not on the Dreamcast's VMUs
if (currentMenu == &MessageDef) // Oh sod off!
currentMenu = &MainDef; // Not like it matters

View File

@ -58,7 +58,7 @@ typedef off_t off64_t;
#if defined (_WIN32)
#define PRIdS "Iu"
#elif defined (_PSP) || defined (_arch_dreamcast) || defined (DJGPP) || defined (_WII) || defined (_NDS) || defined (_PS3)
#elif defined (_PSP) || defined (DJGPP) || defined (_WII) || defined (_NDS) || defined (_PS3)
#define PRIdS "u"
#else
#define PRIdS "zu"

View File

@ -40,9 +40,7 @@ void M_SaveFrame(void);
void M_StopMovie(void);
// the file where game vars and settings are saved
#ifdef DC
#define CONFIGFILENAME "srb2dc.cfg"
#elif defined (PSP)
#ifdef PSP
#define CONFIGFILENAME "srb2psp.cfg"
#else
#define CONFIGFILENAME "config.cfg"

View File

@ -42,12 +42,6 @@
#include <sys/types.h>
#endif // __OS2__
#ifdef HAVE_LWIP
#include <lwip/inet.h>
#include <kos/net.h>
#include <lwip/lwip.h>
#define ioctl lwip_ioctl
#else
#include <arpa/inet.h>
#ifdef __APPLE_CC__
#ifndef _BSD_SOCKLEN_T_
@ -58,15 +52,10 @@
#include <netinet/in.h> // sockaddr_in
#ifdef _PS3
#include <net/select.h>
#elif !defined(_arch_dreamcast)
#else
#include <netdb.h> // getaddrinfo(),...
#include <sys/ioctl.h>
#endif
#endif
#ifdef _arch_dreamcast
#include "sdl12/SRB2DC/dchelp.h"
#endif
#include <sys/time.h> // timeval,... (TIMEOUT)
#include <errno.h>

View File

@ -62,7 +62,7 @@ consvar_t sndserver_arg = {"sndserver_arg", "-quiet", CV_SAVE, NULL, 0, NULL, NU
#define SURROUND
#endif
#if defined (_WIN32_WCE) || defined (DC) || defined(GP2X)
#if defined (_WIN32_WCE) || defined(GP2X)
consvar_t cv_samplerate = {"samplerate", "11025", 0, CV_Unsigned, NULL, 11025, NULL, NULL, 0, 0, NULL}; //Alam: For easy hacking?
#elif defined(_PSP) || defined(_WINDOWS)
consvar_t cv_samplerate = {"samplerate", "44100", 0, CV_Unsigned, NULL, 44100, NULL, NULL, 0, 0, NULL}; //Alam: For easy hacking?
@ -93,7 +93,7 @@ static void Captioning_OnChange(void)
consvar_t cv_closedcaptioning = {"closedcaptioning", "Off", CV_SAVE|CV_CALL, CV_OnOff, Captioning_OnChange, 0, NULL, NULL, 0, 0, NULL};
// number of channels available
#if defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined(GP2X)
#if defined (_WIN32_WCE) || defined (PSP) || defined(GP2X)
consvar_t cv_numChannels = {"snd_channels", "8", CV_SAVE|CV_CALL, CV_Unsigned, SetChannelsNum, 0, NULL, NULL, 0, 0, NULL};
#else
consvar_t cv_numChannels = {"snd_channels", "32", CV_SAVE|CV_CALL, CV_Unsigned, SetChannelsNum, 0, NULL, NULL, 0, 0, NULL};
@ -1379,7 +1379,7 @@ static boolean S_DigMusic(const char *mname, boolean looping)
void S_ChangeMusic(const char *mmusic, UINT16 mflags, boolean looping)
{
#if defined (DC) || defined (_WIN32_WCE) || defined (PSP) || defined(GP2X)
#if defined (_WIN32_WCE) || defined (PSP) || defined(GP2X)
S_ClearSfx();
#endif

View File

@ -169,7 +169,7 @@ void SCR_SetMode(void)
}*/
else
I_Error("unknown bytes per pixel mode %d\n", vid.bpp);
/*#if !defined (DC) && !defined (WII)
/*#if !defined (WII)
if (SCR_IsAspectCorrect(vid.width, vid.height))
CONS_Alert(CONS_WARNING, M_GetText("Resolution is not aspect-correct!\nUse a multiple of %dx%d\n"), BASEVIDWIDTH, BASEVIDHEIGHT);
#endif*/

View File

@ -28,7 +28,7 @@
#endif
// quickhack for V_Init()... to be cleaned up
#if defined (DC) || defined (_WIN32_WCE) || defined (PSP) || defined (NOPOSTPROCESSING)
#if defined (_WIN32_WCE) || defined (PSP) || defined (NOPOSTPROCESSING)
#define NUMSCREENS 2
#else
#define NUMSCREENS 5
@ -43,7 +43,7 @@
// we try to re-allocate a minimum of buffers for stability of the memory,
// so all the small-enough tables based on screen size, are allocated once
// and for all at the maximum size.
#if defined (_WIN32_WCE) || defined (DC) || defined (_PSP) || defined (_NDS)
#if defined (_WIN32_WCE) || defined (_PSP) || defined (_NDS)
#define MAXVIDWIDTH 320
#define MAXVIDHEIGHT 200
#elif defined (GP2X)

View File

@ -14,10 +14,6 @@ ifdef PANDORA
include sdl12/SRB2Pandora/Makefile.cfg
endif #ifdef PANDORA
ifdef DC
include sdl12/SRB2DC/Makefile.cfg
endif #ifdef DC
ifdef PS3N
include sdl12/SRB2PS3/Makefile.cfg
endif #ifdef PS3N

View File

@ -1 +0,0 @@
/scramble

Binary file not shown.

View File

@ -1,53 +0,0 @@
#
# Makefile.cfg for SRB2/Dreamcast
#
#include $(KOS_BASE)/Makefile.rules
#
#hmmm, the Dreamcast
#
HOSTCC:=$(CC)
CC=$(KOS_CC)
PREFIX=$(KOS_CC_BASE)/bin/$(KOS_CC_PREFIX)
OBJDUMP=$(PREFIX)-objdump
OBJCOPY=$(PREFIX)-objcopy
#NOHW=1 #No working MiniGL right now
NOHS=1 #No HWSound right now
ifndef LWIP
NONET=1 #No LWIP
endif
#i_net_o=$(OBJDIR)/i_udp.o #use KOS's UDP
#NOMIXER=1 #Basic sound only
NOIPX=1 #No IPX network code
NOPNG=1 #No Screenshot
OPTS=$(KOS_CFLAGS) -DUNIXCOMMON -DDC
ifndef NOHW
OPTS+=-DSTATIC_OPENGL -DMINI_GL_COMPATIBILITY -DKOS_GL_COMPATIBILITY
endif
SDL_CFLAGS?=-I$(KOS_BASE)/addons/include/SDL
SDL_LDFLAGS?=-lSDL
LDFLAGS=$(KOS_LDFLAGS)
LIBS:=$(KOS_LIBS) -lconio -lm
ifndef NOMIXER
LIBS:=-loggvorbisplay -lSDL $(LIBS)
endif
ifdef LWIP
OPTS+=-I$(KOS_BASE)/../kos-ports/lwip/kos/include -I$(KOS_BASE)/../kos-ports/lwip/lwip/src/include/ipv4 -I$(KOS_BASE)/../kos-ports/lwip/lwip/src/include -DIPv4
LIBS:=-llwip4 -lkosutils $(LIBS)
OPTS+=-DHAVE_LWIP
endif
ifndef NOHW
LIBS+=-lgl
endif
i_system_o+=$(OBJDIR)/dchelp.o
i_main_o=$(KOS_START) $(OBJDIR)/i_main.o $(OBJEXTRA)
# name of the exefile
EXENAME?=SRB2.elf
BINNAME?=SRB2.BIN

Binary file not shown.

View File

@ -1,19 +0,0 @@
#define VMU_width 48
#define VMU_height 32
static unsigned char VMU_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00,
0x00, 0x00, 0x58, 0x75, 0x00, 0x00, 0x00, 0x00, 0xee, 0xaa, 0x00, 0x00,
0x00, 0x86, 0x55, 0x55, 0x01, 0x00, 0x00, 0xda, 0xc8, 0xaf, 0x00, 0x00,
0x00, 0x62, 0x55, 0x54, 0x00, 0x00, 0x00, 0x32, 0xa2, 0x6c, 0x00, 0x00,
0x00, 0x5c, 0x55, 0xfd, 0x01, 0x00, 0x00, 0xac, 0x88, 0xaa, 0x02, 0x00,
0x00, 0x54, 0x75, 0x55, 0x05, 0x00, 0x00, 0xac, 0xbf, 0xaa, 0x0a, 0x00,
0x00, 0xd6, 0x61, 0x55, 0x15, 0x00, 0x00, 0xe9, 0xc0, 0xaa, 0x2a, 0x00,
0x00, 0x39, 0x40, 0x55, 0x55, 0x00, 0x00, 0x6d, 0xc0, 0xaa, 0xbe, 0x00,
0x00, 0x6d, 0x40, 0xd5, 0xc3, 0x00, 0x00, 0x6d, 0xc0, 0xea, 0x00, 0x00,
0x00, 0x29, 0x60, 0xf5, 0x00, 0x00, 0x00, 0x26, 0xe0, 0xfa, 0x00, 0x00,
0x00, 0x58, 0xb8, 0xbd, 0x00, 0x00, 0x00, 0x84, 0x07, 0xdf, 0x00, 0x00,
0x00, 0x08, 0x20, 0xae, 0x00, 0x00, 0x00, 0x30, 0xc0, 0x5f, 0x01, 0x00,
0x00, 0xc0, 0x3f, 0xb8, 0x01, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

View File

@ -1,134 +0,0 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// Copyright (C) 2006 by Sonic Team Jr.
//
// 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.
//
// DESCRIPTION:
// stub and replacement "ANSI" C functions for use on Dreamcast/KOS
//
//-----------------------------------------------------------------------------
#include <kos/fs.h>
#include <errno.h>
#ifndef HAVE_LWIP
#include <sys/socket.h>
#endif
#include "../../doomdef.h"
#include "dchelp.h"
int access(const char *path, int amode)
{
file_t handle = FILEHND_INVALID;
if (amode == F_OK || amode == R_OK)
handle=fs_open(path,O_RDONLY);
else if (amode == (R_OK|W_OK))
handle=fs_open(path,O_RDWR);
else if (amode == W_OK)
handle=fs_open(path,O_WRONLY);
if (handle != FILEHND_INVALID)
{
fs_close(handle);
return 0;
}
return -1;
}
double hypot(double x, double y)
{
double ax, yx, yx2, yx1;
if (abs(y) > abs(x)) // |y|>|x|
{
ax = abs(y); // |y| => ax
yx = (x/y);
}
else // |x|>|y|
{
ax = abs(x); // |x| => ax
yx = (x/y);
}
yx2 = yx*yx; // (x/y)^2
yx1 = sqrt(1+yx2); // (1 + (x/y)^2)^1/2
return ax*yx1; // |x|*((1 + (x/y)^2)^1/2)
}
#if !(defined (NONET) || defined (NOMD5))
#ifdef HAVE_LWIP
#include <lwip/lwip.h>
static uint8 ip[4];
static char *h_addr_listtmp[2] = {ip, NULL};
static struct hostent hostenttmp = {NULL, NULL, 0, 1, h_addr_listtmp};
struct hostent *gethostbyname(const char *name)
{
struct sockaddr_in dnssrv;
dnssrv.sin_family = AF_INET;
dnssrv.sin_port = htons(53);
dnssrv.sin_addr.s_addr = htonl(0x0a030202); ///< what?
if (lwip_gethostbyname(&dnssrv, name, ip) < 0)
return NULL;
else
return &hostenttmp;
}
#else
struct hostent *gethostbyname(const char *name)
{
(void)name;
return NULL;
}
int ioctl(int s, long cmd, void *argp)
{
return fs_ioctl(s, argp, cmd); //FIONBIO?
}
int select(int maxfdp1, void *readset, void *writeset, void *exceptset,
void *timeout)
{
(void)maxfdp1;
(void)readset;
(void)writeset;
(void)exceptset;
(void)timeout;
errno = EAFNOSUPPORT;
return -1;
}
int getsockopt (int s, int level, int optname, void *optval, socklen_t *optlen)
{
(void)s;
(void)level; //SOL_SOCKET
(void)optname; //SO_RCVBUF, SO_ERROR
(void)optval;
(void)optlen;
errno = EAFNOSUPPORT;
return -1;
}
int setsockopt (int s, int level, int optname, void *optval, socklen_t optlen)
{
(void)s;
(void)level; //SOL_SOCKET
(void)optname; //SO_REUSEADDR, SO_BROADCAST, SO_RCVBUF
(void)optval;
(void)optlen;
errno = EAFNOSUPPORT;
return -1;
}
#endif
#endif

View File

@ -1,51 +0,0 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// Copyright (C) 2006 by Sonic Team Jr.
//
// 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.
//
// DESCRIPTION:
// stub and replacement "ANSI" C functions for use on Dreamcast/KOS
//
//-----------------------------------------------------------------------------
#ifndef __I_DREAMCAST__
#define __I_DREAMCAST__
struct hostent
{
char *h_name; /* Official name of host. */
char **h_aliases; /* Alias list. */
int h_addrtype; /* Host address type. */
int h_length; /* Length of address. */
char **h_addr_list; /* List of addresses from name server. */
#define h_addr h_addr_list[0] /* Address, for backward compatibility. */
};
struct hostent *gethostbyname(const char *name);
#ifndef HAVE_LWIP
#define INADDR_NONE ((uint32) 0xffffffff)
#define INADDR_LOOPBACK ((uint32) 0x7f000001)
#define SOCK_STREAM 1
#define FIONBIO 0
#define SOL_SOCKET 0
#define SO_ERROR 0
#define SO_REUSEADDR 0
#define SO_BROADCAST 0
#define SO_RCVBUF 0
int ioctl(int s, long cmd, void *argp);
int select(int maxfdp1, void *readset, void *writeset, void *exceptset, void *timeout);
int getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen);
int setsockopt(int s, int level, int optname, void *optval, socklen_t optlen);
#endif
#endif

View File

@ -1,455 +0,0 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Portions Copyright (C) 2005 by Sonic Team Jr.
//
// 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 KOS UDP network interface
#include "../../doomdef.h"
#include "../../i_system.h"
#include "../../d_event.h"
#include "../../d_net.h"
#include "../../m_argv.h"
#include "../../doomstat.h"
#include "../../i_net.h"
#include "../../z_zone.h"
#include "../../i_tcp.h"
#include <kos/net.h>
//#include <net/net_ipv4.h>
#define NET_NONE 0x00000000
#define NET_LOCAL 0x0100007F
#define NET_ANY 0xFFFFFFFF
#define MAXBANS 20
typedef struct
{
uint32 host;
uint16 port;
} IPaddress;
static IPaddress clientaddress[MAXNETNODES+1];
static boolean nodeconnected[MAXNETNODES+1];
static int mysocket = 0;
static boolean init_KOSUDP_driver = false;
static size_t numbans = 0;
static IPaddress banned[MAXBANS];
static boolean KOSUDP_bannednode[MAXNETNODES+1]; /// \note do we really need the +1?
static inline int net_udp_sendto(int sock, const uint8 *data, int size, uint16 rem_port, uint32 rem_addr)
{
uint8 dst_ip[4] = {((uint8*)(&(rem_addr)))[0],
((uint8*)(&(rem_addr)))[1],
((uint8*)(&(rem_addr)))[2],
((uint8*)(&(rem_addr)))[3]};
return net_udp_send_raw(net_default_dev, clientaddress[0].port, rem_port, dst_ip, data, size);
(void)sock;
}
static inline int net_udp_recvfrom(int sock, uint8 *buf, int size, uint16 *rem_port, uint32 *rem_addr)
{
return net_udp_recv(sock, buf, size);
(void)rem_port;
(void)rem_addr;
}
static const char *KOSUDP_AddrToStr(IPaddress* sk)
{
static char s[22]; // 255.255.255.255:65535
sprintf(s,"%d.%d.%d.%d:%d",
((uint8*)(&(sk->host)))[3],
((uint8*)(&(sk->host)))[2],
((uint8*)(&(sk->host)))[1],
((uint8*)(&(sk->host)))[0],
net_ntohs(sk->port));
return s;
}
static const char *KOSUDP_GetNodeAddress(int node)
{
if (!nodeconnected[node])
return NULL;
return KOSUDP_AddrToStr(&clientaddress[node]);
}
static const char *KOSUDP_GetBanAddress(size_t ban)
{
if (ban > numbans)
return NULL;
return KOSUDP_AddrToStr(&banned[ban]);
}
static boolean KOSUDP_cmpaddr(IPaddress* a, IPaddress* b)
{
return (a->host == b->host && (b->port == 0 || a->port == b->port));
}
static SINT8 getfreenode(void)
{
SINT8 j;
for (j = 0; j < MAXNETNODES; j++)
if (!nodeconnected[j])
{
nodeconnected[j] = true;
return j;
}
return -1;
}
static void KOSUDP_Get(void)
{
int size;
size_t i;
SINT8 j;
IPaddress temp = {clientaddress[BROADCASTADDR].host,clientaddress[BROADCASTADDR].port};
size = net_udp_recvfrom(mysocket,(char *)&doomcom->data, MAXPACKETLENGTH, &temp.port, &temp.host);
if (size == 0)
{
doomcom->remotenode = -1; // no packet
return;
}
// find remote node number
for (i = 0; i < MAXNETNODES; i++)
if (KOSUDP_cmpaddr(&temp, &(clientaddress[i])))
{
doomcom->remotenode = (INT16)i; // good packet from a game player
doomcom->datalength = (INT16)size;
return;
}
// not found
// find a free slot
j = getfreenode();
if (j > 0)
{
M_Memcpy(&clientaddress[j], &temp, sizeof (temp));
DEBFILE(va("New node detected: node:%d address:%s\n", j,
KOSUDP_GetNodeAddress(j)));
doomcom->remotenode = (INT16)j; // good packet from a game player
doomcom->datalength = (INT16)size;
// check if it's a banned dude so we can send a refusal later
for (i = 0; i < numbans; i++)
if (KOSUDP_cmpaddr(&temp, &banned[i]))
{
KOSUDP_bannednode[j] = true;
DEBFILE("This dude has been banned\n");
break;
}
if (i == numbans)
KOSUDP_bannednode[j] = false;
return;
}
DEBFILE("New node detected: No more free slots\n");
doomcom->remotenode = -1; // no packet
}
#if 0
static boolean KOSUDP_CanSend(void)
{
return true;
}
#endif
static void KOSUDP_Send(void)
{
const IPaddress *nodeinfo;
if (!doomcom->remotenode || !nodeconnected[doomcom->remotenode])
return;
nodeinfo = clientaddress + doomcom->remotenode;
if (net_udp_sendto(mysocket, (char *)&doomcom->data, doomcom->datalength, nodeinfo->port, nodeinfo->host) == -1)
{
CONS_Printf("KOSUDP: error sending data\n");
}
}
static void KOSUDP_FreeNodenum(int numnode)
{
// can't disconnect from self :)
if (!numnode)
return;
DEBFILE(va("Free node %d (%s)\n", numnode, KOSUDP_GetNodeAddress(numnode)));
nodeconnected[numnode] = false;
memset(&clientaddress[numnode], 0, sizeof (IPaddress));
}
static int KOSUDP_Socket(void)
{
int temp = 0;
uint16 portnum = 0;
const uint32 hostip = net_default_dev?net_ntohl(net_ipv4_address(net_default_dev->ip_addr)):NET_LOCAL;
//Hurdler: I'd like to put a server and a client on the same computer
//Logan: Me too
//BP: in fact for client we can use any free port we want i have read
// in some doc that connect in udp can do it for us...
//Alam: where?
if (M_CheckParm("-clientport"))
{
if (!M_IsNextParm())
I_Error("syntax: -clientport <portnum>");
portnum = net_ntohs(atoi(M_GetNextParm()));
}
else
portnum = net_ntohs(sock_port);
temp = net_udp_sock_open(portnum, hostip, portnum, NET_NONE);
if (temp)
{
int btemp = net_udp_sock_open(portnum, hostip, portnum, NET_ANY);
clientaddress[0].port = portnum;
clientaddress[0].host = NET_NONE;
if (btemp)
{
clientaddress[BROADCASTADDR].port = net_ntohs(sock_port);
clientaddress[BROADCASTADDR].host = NET_ANY;
}
else
{
CONS_Printf("KOSUDP: can't setup broadcast sock\n");
net_udp_sock_close(temp);
return 0;
}
}
else
{
CONS_Printf("KOSUDP: can't setup main sock\n");
return 0;
}
doomcom->extratics = 1; // internet is very high ping
return temp;
}
static void I_ShutdownKOSUDPDriver(void)
{
//net_shutdown();
init_KOSUDP_driver = false;
}
static void I_InitKOSUDPDriver(void)
{
if (init_KOSUDP_driver)
I_ShutdownKOSUDPDriver();
else
net_init();
D_SetDoomcom();
memset(&clientaddress,0,sizeof (clientaddress));
init_KOSUDP_driver = true;
}
static void KOSUDP_CloseSocket(void)
{
if (mysocket)
net_udp_sock_close(mysocket);
mysocket = 0;
}
static SINT8 KOSUDP_NetMakeNodewPort(const char *hostname, const char* port)
{
SINT8 newnode;
uint16 portnum = net_ntohs(sock_port);
if (port && !port[0])
portnum = net_ntohs((UINT16)atoi(port));
newnode = getfreenode();
if (newnode == -1)
return -1;
// find ip of the server
clientaddress[newnode].port = portnum;
clientaddress[newnode].host = inet_addr(hostname);
if (clientaddress[newnode].host == NET_NONE)
{
free(hostname);
return -1;
}
return newnode;
}
static boolean KOSUDP_OpenSocket(void)
{
size_t i;
memset(clientaddress, 0, sizeof (clientaddress));
for (i = 0; i < MAXNETNODES; i++)
nodeconnected[i] = false;
//CONS_Printf("KOSUDP Code starting up\n");
nodeconnected[0] = true; // always connected to self
nodeconnected[BROADCASTADDR] = true;
I_NetSend = KOSUDP_Send;
I_NetGet = KOSUDP_Get;
I_NetCloseSocket = KOSUDP_CloseSocket;
I_NetFreeNodenum = KOSUDP_FreeNodenum;
I_NetMakeNodewPort = KOSUDP_NetMakeNodewPort;
//I_NetCanSend = KOSUDP_CanSend;
// build the socket but close it first
KOSUDP_CloseSocket();
mysocket = KOSUDP_Socket();
if (mysocket)
{
#if 0
// for select
myset = SDLNet_AllocSocketSet(1);
if (!myset)
{
CONS_Printf("SDL_Net: %s",SDLNet_GetError());
return false;
}
if (SDLNet_UDP_AddSocket(myset,mysocket) == -1)
{
CONS_Printf("SDL_Net: %s",SDLNet_GetError());
return false;
}
#endif
return true;
}
return false;
}
static boolean KOSUDP_Ban(int node)
{
if (numbans == MAXBANS)
return false;
M_Memcpy(&banned[numbans], &clientaddress[node], sizeof (IPaddress));
banned[numbans].port = 0'
numbans++;
return true;
}
static void KOSUDP_ClearBans(void)
{
numbans = 0;
}
//
// I_InitNetwork
// Only required for DOS, so this is more a dummy
//
boolean I_InitNetwork(void)
{
char serverhostname[255];
boolean ret = false;
//if (!M_CheckParm ("-kosnet"))
// return false;
// initilize the driver
I_InitKOSUDPDriver();
I_AddExitFunc(I_ShutdownKOSUDPDriver);
if (!init_KOSUDP_driver)
return false;
if (M_CheckParm("-udpport"))
{
if (M_IsNextParm())
sock_port = (UINT16)atoi(M_GetNextParm());
else
sock_port = 0;
}
// parse network game options,
if (M_CheckParm("-server") || dedicated)
{
server = true;
// If a number of clients (i.e. nodes) is specified, the server will wait for the clients
// to connect before starting.
// If no number is specified here, the server starts with 1 client, and others can join
// in-game.
// Since Boris has implemented join in-game, there is no actual need for specifying a
// particular number here.
// FIXME: for dedicated server, numnodes needs to be set to 0 upon start
/* if (M_IsNextParm())
doomcom->numnodes = (INT16)atoi(M_GetNextParm());
else */if (dedicated)
doomcom->numnodes = 0;
else
doomcom->numnodes = 1;
if (doomcom->numnodes < 0)
doomcom->numnodes = 0;
if (doomcom->numnodes > MAXNETNODES)
doomcom->numnodes = MAXNETNODES;
// server
servernode = 0;
// FIXME:
// ??? and now ?
// server on a big modem ??? 4*isdn
net_bandwidth = 16000;
hardware_MAXPACKETLENGTH = INETPACKETLENGTH;
ret = true;
}
else if (M_CheckParm("-connect"))
{
if (M_IsNextParm())
strcpy(serverhostname, M_GetNextParm());
else
serverhostname[0] = 0; // assuming server in the LAN, use broadcast to detect it
// server address only in ip
if (serverhostname[0])
{
COM_BufAddText("connect \"");
COM_BufAddText(serverhostname);
COM_BufAddText("\"\n");
// probably modem
hardware_MAXPACKETLENGTH = INETPACKETLENGTH;
}
else
{
// so we're on a LAN
COM_BufAddText("connect any\n");
net_bandwidth = 800000;
hardware_MAXPACKETLENGTH = MAXPACKETLENGTH;
}
}
I_NetOpenSocket = KOSUDP_OpenSocket;
I_Ban = KOSUDP_Ban;
I_ClearBans = KOSUDP_ClearBans;
I_GetNodeAddress = KOSUDP_GetNodeAddress;
I_GetBanAddress = KOSUDP_GetBanAddress;
bannednode = KOSUDP_bannednode;
return ret;
}

View File

@ -1,259 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#define MAXCHUNK (2048*1024)
static unsigned int seed;
void my_srand(unsigned int n)
{
seed = n & 0xffff;
}
unsigned int my_rand()
{
seed = (seed * 2109 + 9273) & 0x7fff;
return (seed + 0xc000) & 0xffff;
}
void load(FILE *fh, unsigned char *ptr, unsigned long sz)
{
if (fread(ptr, 1, sz, fh) != sz)
{
fprintf(stderr, "Read error!\n");
exit(1);
}
}
void load_chunk(FILE *fh, unsigned char *ptr, unsigned long sz)
{
static int idx[MAXCHUNK/32];
int i;
/* Convert chunk size to number of slices */
sz /= 32;
/* Initialize index table with unity,
so that each slice gets loaded exactly once */
for (i = 0; i < sz; i++)
idx[i] = i;
for (i = sz-1; i >= 0; --i)
{
/* Select a replacement index */
int x = (my_rand() * i) >> 16;
/* Swap */
int tmp = idx[i];
idx[i] = idx[x];
idx[x] = tmp;
/* Load resulting slice */
load(fh, ptr+32*idx[i], 32);
}
}
void load_file(FILE *fh, unsigned char *ptr, unsigned long filesz)
{
unsigned long chunksz;
my_srand(filesz);
/* Descramble 2 meg blocks for as long as possible, then
gradually reduce the window down to 32 bytes (1 slice) */
for (chunksz = MAXCHUNK; chunksz >= 32; chunksz >>= 1)
while (filesz >= chunksz)
{
load_chunk(fh, ptr, chunksz);
filesz -= chunksz;
ptr += chunksz;
}
/* Load final incomplete slice */
if (filesz)
load(fh, ptr, filesz);
}
void read_file(char *filename, unsigned char **ptr, unsigned long *sz)
{
FILE *fh = fopen(filename, "rb");
if (fh == NULL)
{
fprintf(stderr, "Can't open \"%s\".\n", filename);
exit(1);
}
if (fseek(fh, 0, SEEK_END)<0)
{
fprintf(stderr, "Seek error.\n");
exit(1);
}
*sz = ftell(fh);
*ptr = malloc(*sz);
if ( *ptr == NULL )
{
fprintf(stderr, "Out of memory.\n");
exit(1);
}
if (fseek(fh, 0, SEEK_SET)<0)
{
fprintf(stderr, "Seek error.\n");
exit(1);
}
load_file(fh, *ptr, *sz);
fclose(fh);
}
void save(FILE *fh, unsigned char *ptr, unsigned long sz)
{
if (fwrite(ptr, 1, sz, fh) != sz)
{
fprintf(stderr, "Write error!\n");
exit(1);
}
}
void save_chunk(FILE *fh, unsigned char *ptr, unsigned long sz)
{
static int idx[MAXCHUNK/32];
int i;
/* Convert chunk size to number of slices */
sz /= 32;
/* Initialize index table with unity,
so that each slice gets saved exactly once */
for (i = 0; i < sz; i++)
idx[i] = i;
for (i = sz-1; i >= 0; --i)
{
/* Select a replacement index */
int x = (my_rand() * i) >> 16;
/* Swap */
int tmp = idx[i];
idx[i] = idx[x];
idx[x] = tmp;
/* Save resulting slice */
save(fh, ptr+32*idx[i], 32);
}
}
void save_file(FILE *fh, unsigned char *ptr, unsigned long filesz)
{
unsigned long chunksz;
my_srand(filesz);
/* Descramble 2 meg blocks for as long as possible, then
gradually reduce the window down to 32 bytes (1 slice) */
for (chunksz = MAXCHUNK; chunksz >= 32; chunksz >>= 1)
while (filesz >= chunksz)
{
save_chunk(fh, ptr, chunksz);
filesz -= chunksz;
ptr += chunksz;
}
/* Save final incomplete slice */
if (filesz)
save(fh, ptr, filesz);
}
void write_file(char *filename, unsigned char *ptr, unsigned long sz)
{
FILE *fh = fopen(filename, "wb");
if (fh == NULL)
{
fprintf(stderr, "Can't open \"%s\".\n", filename);
exit(1);
}
save_file(fh, ptr, sz);
fclose(fh);
}
void descramble(char *src, char *dst)
{
unsigned char *ptr = NULL;
unsigned long sz = 0;
FILE *fh;
read_file(src, &ptr, &sz);
fh = fopen(dst, "wb");
if (fh == NULL)
{
fprintf(stderr, "Can't open \"%s\".\n", dst);
exit(1);
}
if ( fwrite(ptr, 1, sz, fh) != sz )
{
fprintf(stderr, "Write error.\n");
exit(1);
}
fclose(fh);
free(ptr);
}
void scramble(char *src, char *dst)
{
unsigned char *ptr = NULL;
unsigned long sz = 0;
FILE *fh;
fh = fopen(src, "rb");
if (fh == NULL)
{
fprintf(stderr, "Can't open \"%s\".\n", src);
exit(1);
}
if (fseek(fh, 0, SEEK_END)<0)
{
fprintf(stderr, "Seek error.\n");
exit(1);
}
sz = ftell(fh);
ptr = malloc(sz);
if ( ptr == NULL )
{
fprintf(stderr, "Out of memory.\n");
exit(1);
}
if (fseek(fh, 0, SEEK_SET)<0)
{
fprintf(stderr, "Seek error.\n");
exit(1);
}
if ( fread(ptr, 1, sz, fh) != sz )
{
fprintf(stderr, "Read error.\n");
exit(1);
}
fclose(fh);
write_file(dst, ptr, sz);
free(ptr);
}
int main(int argc, char *argv[])
{
int opt = 0;
if (argc > 1 && !strcmp(argv[1], "-d"))
opt ++;
if (argc != 3+opt)
{
fprintf(stderr, "Usage: %s [-d] from to\n", argv[0]);
exit(1);
}
if (opt)
descramble(argv[2], argv[3]);
else
scramble(argv[1], argv[2]);
return 0;
}

View File

@ -33,7 +33,7 @@
void ShowEndTxt(void)
{
#if !(defined (_WIN32_WCE) || defined (_XBOX) || defined (_arch_dreamcast))
#if !(defined (_WIN32_WCE) || defined (_XBOX))
INT32 i;
UINT16 j, att = 0;
INT32 nlflag = 1;

View File

@ -37,7 +37,7 @@
#pragma warning(default : 4214 4244)
#endif
#if defined (_XBOX) || defined (_arch_dreamcast) || defined(GP2X)
#if defined (_XBOX) || defined(GP2X)
#define NOLOADSO
#endif

View File

@ -19,7 +19,7 @@
#ifdef HAVE_SDL
#if defined (DC) || defined (_WIN32_WCE) || defined(GP2X) || defined(_PS3)
#if defined (_WIN32_WCE) || defined(GP2X) || defined(_PS3)
#define NOSDLCD
#endif

View File

@ -80,17 +80,6 @@ FILE *logstream = NULL;
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)
static inline VOID MakeCodeWritable(VOID)
{

View File

@ -56,18 +56,10 @@ typedef BOOL (WINAPI *p_SetProcessAffinityMask) (HANDLE, DWORD_PTR);
#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)
#include <conio.h>
#endif
#endif
#ifdef _MSC_VER
#pragma warning(disable : 4214 4244)
@ -85,7 +77,7 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
#pragma warning(default : 4214 4244)
#endif
#if SDL_VERSION_ATLEAST(1,2,7) && !defined (DC)
#if SDL_VERSION_ATLEAST(1,2,7)
#include "SDL_cpuinfo.h" // 1.2.7 or greater
#define HAVE_SDLCPUINFO
#endif
@ -93,7 +85,7 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
#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__) && !defined (_WII))
#if defined (__linux__)
#include <sys/vfs.h>
#else
@ -111,7 +103,7 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
#endif
#ifndef _PS3
#if defined (__linux__) || (defined (UNIXCOMMON) && !defined (_arch_dreamcast) && !defined (_PSP) && !defined (__HAIKU__) && !defined (_WII))
#if defined (__linux__) || (defined (UNIXCOMMON) && !defined (_PSP) && !defined (__HAIKU__) && !defined (_WII))
#ifndef NOTERMIOS
#include <termios.h>
#include <sys/ioctl.h> // ioctl
@ -146,14 +138,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)
#ifdef GP2X
#define DEFAULTWADLOCATION1 "/mnt/sd"
#define DEFAULTWADLOCATION2 "/mnt/sd/SRB2"
#define DEFAULTWADLOCATION3 "/tmp/mnt/sd"
@ -345,7 +330,7 @@ static void signal_handler(INT32 num)
}
#endif
#if defined (NDEBUG) && !defined (DC) && !defined (_WIN32_WCE)
#if defined (NDEBUG) && !defined (_WIN32_WCE)
FUNCNORETURN static ATTRNORETURN void quit_handler(int num)
{
signal(num, SIG_DFL); //default signal action
@ -707,17 +692,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
@ -737,7 +711,7 @@ static inline void I_ShutdownConsole(void){}
//
void I_StartupKeyboard (void)
{
#if defined (NDEBUG) && !defined (DC)
#if defined (NDEBUG)
#ifdef SIGILL
// signal(SIGILL , signal_handler);
#endif
@ -768,10 +742,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);
@ -1084,13 +1054,9 @@ 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)
{
@ -1209,15 +1175,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(SDL_JoystickIndex(JoyInfo.dev)), "pad");
@ -1375,13 +1337,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)
{
@ -1501,15 +1459,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(SDL_JoystickIndex(JoyInfo2.dev)), "pad");
@ -2154,13 +2108,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;
@ -2200,7 +2149,7 @@ 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?
#elif 0 //#elif !defined(GP2X) // GP2X have broken pthreads?
if (SDL_InitSubSystem(SDL_INIT_TIMER) < 0)
I_Error("SRB2: Needs SDL_Timer, Error: %s", SDL_GetError());
#endif
@ -2210,7 +2159,7 @@ void I_StartupTimer(void)
void I_Sleep(void)
{
#if !(defined (_arch_dreamcast) || defined (_XBOX))
#if !(defined (_XBOX))
if (cv_sleep.value != -1)
SDL_Delay(cv_sleep.value);
#endif
@ -2229,15 +2178,6 @@ INT32 I_StartupSystem(void)
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)
SDLlinked = SDL_Linked_Version();
@ -2292,9 +2232,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)
{
@ -2361,10 +2299,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);
@ -2448,9 +2384,7 @@ void I_Error(const char *error, ...)
I_ShutdownGraphics();
I_ShutdownInput();
I_ShutdownSystem();
#ifndef _arch_dreamcast
SDL_Quit();
#endif
#ifdef MAC_ALERT
va_start(argptr, error);
vsprintf(buffer, error, argptr);
@ -2540,7 +2474,7 @@ void I_ShutdownSystem(void)
void I_GetDiskFreeSpace(INT64 *freespace)
{
#if defined (_arch_dreamcast) || defined (_PSP)
#if defined (_PSP)
*freespace = 0;
#elif defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
#if defined (SOLARIS) || defined (__HAIKU__) || defined (_WII) || defined (_PS3)
@ -2896,12 +2830,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)
#if defined (_PSP)
// PSP
if (total)
*total = 32<<20;

View File

@ -35,11 +35,6 @@
#pragma warning(default : 4214 4244)
#endif
#if SDL_VERSION_ATLEAST(1,2,9) && defined (_arch_dreamcast)
#define HAVE_DCSDL
#include "SDL_dreamcast.h"
#endif
#if SDL_VERSION_ATLEAST(1,2,9) && defined (GP2X)
#define HAVE_GP2XSDL
#include "SDL_gp2x.h"
@ -59,7 +54,7 @@
#ifdef HAVE_IMAGE
#include "SDL_image.h"
#elseif !(defined (DC) || defined (_WIN32_WCE) || defined (PSP) || defined(GP2X))
#elseif !(defined (_WIN32_WCE) || defined (PSP) || defined(GP2X))
#define LOAD_XPM //I want XPM!
#include "IMG_xpm.c" //Alam: I don't want to add SDL_Image.dll/so
#define HAVE_IMAGE //I have SDL_Image, sortof
@ -75,16 +70,6 @@
#include "SDL_syswm.h"
#endif
#ifdef _arch_dreamcast
#include <conio/conio.h>
#include <dc/maple.h>
#include <dc/maple/vmu.h>
//#include "SRB2DC/VMU.xbm"
//#include <dc/pvr.h>
//#define malloc pvr_mem_malloc
//#define free pvr_mem_free
#endif
#if defined (_XBOX) && defined (__GNUC__)
#include <openxdk/debug.h>
#endif
@ -124,7 +109,7 @@
#endif
// maximum number of windowed modes (see windowedModes[][])
#if defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined(GP2X)
#if defined (_WIN32_WCE) || defined (PSP) || defined(GP2X)
#define MAXWINMODES (1)
#elif defined (WII)
#define MAXWINMODES (8)
@ -147,7 +132,7 @@ rendermode_t rendermode=render_soft;
boolean highcolor = false;
// synchronize page flipping with screen refresh
#if defined(DC) || (defined(GP2X) && !defined(HAVE_GP2XSDL))
#if defined(GP2X) && !defined(HAVE_GP2XSDL)
consvar_t cv_vidwait = {"vid_wait", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
#else
consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@ -176,11 +161,7 @@ static SDL_Surface *bufSurface = NULL;
static SDL_Surface *icoSurface = NULL;
static SDL_Color localPalette[256];
static SDL_Rect **modeList = NULL;
#ifdef DC
static Uint8 BitsPerPixel = 15;
#else
static Uint8 BitsPerPixel = 16;
#endif
static Uint16 realwidth = BASEVIDWIDTH;
static Uint16 realheight = BASEVIDHEIGHT;
#ifdef _WIN32_WCE
@ -195,7 +176,7 @@ static const Uint32 surfaceFlagsF = SDL_HWPALETTE|SDL_FULLSCREEN;
#endif
static SDL_bool mousegrabok = SDL_TRUE;
#define HalfWarpMouse(x,y) SDL_WarpMouse((Uint16)(x/2),(Uint16)(y/2))
#if defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined(GP2X)
#if defined (_WIN32_WCE) || defined (PSP) || defined(GP2X)
static SDL_bool videoblitok = SDL_TRUE;
#else
static SDL_bool videoblitok = SDL_FALSE;
@ -205,7 +186,7 @@ static SDL_bool exposevideo = SDL_FALSE;
// windowed video modes from which to choose from.
static INT32 windowedModes[MAXWINMODES][2] =
{
#if !(defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined (GP2X))
#if !(defined (_WIN32_WCE) || defined (PSP) || defined (GP2X))
#ifndef WII
#ifndef _PS3
{1920,1200}, // 1.60,6.00
@ -250,11 +231,6 @@ static void SDLSetMode(INT32 width, INT32 height, INT32 bpp, Uint32 flags)
#ifdef _WII
bpp = 16; // 8-bit mode poo
#endif
#ifdef DC
if (bpp < 15)
bpp = 15;
height = 240;
#endif
#ifdef PSP
bpp = 16;
#endif
@ -500,7 +476,6 @@ static INT32 SDLatekey(SDLKey sym)
rc = KEY_PLUSPAD;
break;
#ifndef _arch_dreamcast
case SDLK_LSUPER:
#ifdef HAVE_SDLMETAKEYS
case SDLK_LMETA:
@ -517,7 +492,6 @@ static INT32 SDLatekey(SDLKey sym)
case SDLK_MENU:
rc = KEY_MENU;
break;
#endif
default:
if (sym >= SDLK_SPACE && sym <= SDLK_DELETE)
@ -662,7 +636,7 @@ static void VID_Command_Info_f (void)
static void VID_Command_ModeList_f(void)
{
#if !defined (DC) && !defined (_WIN32_WCE) && !defined (_PSP) && !defined(GP2X)
#if !defined (_WIN32_WCE) && !defined (_PSP) && !defined(GP2X)
INT32 i;
#ifdef HWRENDER
if (rendermode == render_opengl)
@ -957,11 +931,8 @@ static inline void SDLJoyRemap(event_t *event)
static INT32 SDLJoyAxis(const Sint16 axis, evtype_t which)
{
#ifdef _arch_dreamcast // -128 to 127 SDL for DC have give us a smaller range
INT32 raxis = axis*8;
#else // -32768 to 32767
// -32768 to 32767
INT32 raxis = axis/32;
#endif
if (which == ev_joystick)
{
if (Joystick.bGamepadStyle)
@ -1261,9 +1232,6 @@ void I_OsPolling(void)
I_GetJoystickEvents();
I_GetJoystick2Events();
}
#ifdef _arch_dreamcast
//vmu_set_icon(VMU_bits);
#endif
I_GetMouseEvents();
@ -1302,7 +1270,7 @@ static inline boolean I_SkipFrame(void)
skip = !skip;
#if 0 //(defined (GP2X) || defined (PSP) || defined (_arch_dreamcast))
#if 0 //(defined (GP2X) || defined (PSP))
return skip;
#endif
@ -1885,9 +1853,6 @@ void I_StartupGraphics(void)
disable_fullscreen = M_CheckParm("-win");
keyboard_started = true;
#ifdef _arch_dreamcast
conio_shutdown();
#endif
#if !defined(HAVE_TTF)
#ifdef _WIN32 // Initialize Audio as well, otherwise Win32's DirectX can not use audio
@ -2096,9 +2061,7 @@ void I_ShutdownGraphics(void)
if (GLUhandle)
hwClose(GLUhandle);
#endif
#ifndef _arch_dreamcast
SDL_QuitSubSystem(SDL_INIT_VIDEO);
#endif
framebuffer = SDL_FALSE;
}
#endif

View File

@ -85,7 +85,7 @@
// 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)
#if defined (_WIN32_WCE) || defined (PSP) || defined(GP2X)
#define NUM_CHANNELS MIX_CHANNELS
#else
#define NUM_CHANNELS MIX_CHANNELS*4
@ -93,7 +93,7 @@
#define INDEXOFSFX(x) ((sfxinfo_t *)x - S_sfx)
#if defined (_WIN32_WCE) || defined (DC) || defined (PSP)
#if defined (_WIN32_WCE) || defined (PSP)
static Uint16 samplecount = 512; //Alam: .5KB samplecount at 11025hz is 46.439909297052154195011337868481ms of buffer
#elif defined(GP2X)
static Uint16 samplecount = 128;
@ -151,9 +151,7 @@ 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)
#ifdef GP2X
#define MIDI_PATH "/mnt/sd/srb2"
#define MIDI_PATH2 "/tmp/mnt/sd/srb2"
#else
@ -176,7 +174,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 defined (_WIN32_WCE) || defined (_XBOX) //|| defined(_WIN32) || defined(GP2X)
#undef USE_RWOPS
#endif
#endif
@ -1189,13 +1187,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
@ -1522,7 +1513,7 @@ 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 !(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));