Commit be13f106 by Monster Iestyn

ended NDS

parent 497512ee
......@@ -104,12 +104,6 @@ ifdef HAIKU
SDL=1
endif
ifdef NDS
# Include this before the main Makefile.cfg
EXENAME?=srb2.elf
include nds/Makefile.cfg
endif
include Makefile.cfg
ifdef DUMMY
......@@ -172,18 +166,6 @@ ifdef MACOSX
UNIXCOMMON=1
endif
ifdef NDS
NOPNG=1
NONET=1
#NOHW=1
NOHS=1
NOASM=1
NOIPX=1
NONX86=1
OBJS+=$(OBJDIR)/i_video.o
LIBS+=-lm
endif
ifdef SDL
#SDL 2.0
ifndef SDL12
......@@ -508,10 +490,6 @@ ifdef SDL
all: pre-build $(BIN)/$(EXENAME)
endif
ifdef NDS
all: $(BIN)/$(EXENAME:.elf=.nds)
endif
ifdef DUMMY
all: $(BIN)/$(EXENAME)
endif
......@@ -728,13 +706,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 NDS
$(BIN)/$(EXENAME:.elf=.nds): $(BIN)/$(EXENAME:.elf=.arm9)
$(NDSTOOL) -c $@ -9 $(BIN)/$(EXENAME:.elf=.arm9)
%.arm9: %.elf
$(OBJCOPY) -O binary $< $@
endif
ifdef MINGW
ifndef SDL
......
......@@ -216,7 +216,6 @@ ifndef FREEBSD
ifndef CYGWIN32
ifndef MINGW
ifndef SDL
ifndef NDS
ifndef DUMMY
DJGPPDOS=1
endif
......@@ -226,7 +225,6 @@ endif
endif
endif
endif
endif
#determine the interface directory (where you put all i_*.c)
i_cdmus_o=$(OBJDIR)/i_cdmus.o
......@@ -328,13 +326,6 @@ ifdef WINCE
SDL12=1
OBJDIR:=$(OBJDIR)/WinCE
BIN:=$(BIN)/WinCE
else
ifdef NDS
INTERFACE=nds
OBJDIR:=$(OBJDIR)/nds
BIN:=$(BIN)/nds
NOUPX=1
endif
endif
endif
endif
......
......@@ -44,10 +44,6 @@ static const UINT8 NOCLIMBBROWNS = (2*16);
static const UINT8 NOCLIMBYELLOWS = (11*16);
#ifdef _NDS
#undef BACKGROUND
#endif
// Automap colors
#define BACKGROUND DBLACK
#define YOURCOLORS DWHITE
......
......@@ -244,17 +244,10 @@ 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 (_NDS) //only one joystick
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", "0", CV_SAVE|CV_CALL, usejoystick_cons_t,
I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL};
#else //all esle, no joystick
consvar_t cv_usejoystick = {"use_joystick", "0", CV_SAVE|CV_CALL, usejoystick_cons_t,
I_InitJoystick, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_usejoystick2 = {"use_joystick2", "0", CV_SAVE|CV_CALL, usejoystick_cons_t,
I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL};
#endif
#if (defined (LJOYSTICK) || defined (HAVE_SDL))
#ifdef LJOYSTICK
consvar_t cv_joyport = {"joyport", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
......
......@@ -548,19 +548,15 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// Most modifications should probably enable this.
//#define SAVEGAME_OTHERVERSIONS
#if !defined (_NDS)
/// Shuffle's incomplete OpenGL sorting code.
#define SHUFFLE // This has nothing to do with sorting, why was it disabled?
#endif
#if !defined (_NDS)
/// Allow the use of the SOC RESETINFO command.
/// \note Builds that are tight on memory should disable this.
/// This stops the game from storing backups of the states, sprites, and mobjinfo tables.
/// Though this info is compressed under normal circumstances, it's still a lot of extra
/// memory that never gets touched.
#define ALLOW_RESETDATA
#endif
#ifndef NONET
/// Display a connection screen on join attempts.
......
......@@ -23,10 +23,6 @@
#include <windows.h>
#endif
#ifdef _NDS
#include <nds.h>
#endif
/* 7.18.1.1 Exact-width integer types */
#ifdef _MSC_VER
#define UINT8 unsigned __int8
......@@ -139,7 +135,7 @@ typedef long ssize_t;
#endif
#endif //macintosh
#if defined (PC_DOS) || defined (_WIN32) || defined (__HAIKU__) || defined(_NDS)
#if defined (PC_DOS) || defined (_WIN32) || defined (__HAIKU__)
#define HAVE_DOSSTR_FUNCS
#endif
......@@ -175,8 +171,6 @@ size_t strlcpy(char *dst, const char *src, size_t siz);
#define false FALSE // use windows types
#define true TRUE
#define boolean BOOL
#elif defined(_NDS)
#define boolean bool
#else
typedef enum {false, true} boolean;
#endif
......
......@@ -286,17 +286,6 @@ static keyname_t keynames[] =
{KEY_2MOUSEWHEELUP, "Wheel 2 UP"},
{KEY_2MOUSEWHEELDOWN, "Wheel 2 Down"},
#if defined (_NDS)
{KEY_JOY1+0, "JOYA"},
{KEY_JOY1+1, "JOYB"},
{KEY_JOY1+2, "JOYX"},
{KEY_JOY1+3, "JOYY"},
{KEY_JOY1+4, "JOYL"},
{KEY_JOY1+5, "JOYR"},
{KEY_JOY1+6, "JOYSTART"},
{KEY_JOY1+7, "JOYSELECT"},
#define NOMOREJOYBTN_1S
#else
{KEY_JOY1+0, "JOY1"},
{KEY_JOY1+1, "JOY2"},
{KEY_JOY1+2, "JOY3"},
......@@ -306,7 +295,6 @@ static keyname_t keynames[] =
{KEY_JOY1+6, "JOY7"},
{KEY_JOY1+7, "JOY8"},
{KEY_JOY1+8, "JOY9"},
#endif
#if !defined (NOMOREJOYBTN_1S)
// we use up to 32 buttons in DirectInput
{KEY_JOY1+9, "JOY10"},
......@@ -368,17 +356,6 @@ static keyname_t keynames[] =
{KEY_DBL2MOUSE1+6, "DBLSEC_MOUSE7"},
{KEY_DBL2MOUSE1+7, "DBLSEC_MOUSE8"},
#if defined (_NDS)
{KEY_DBLJOY1+0, "DBLJOYA"},
{KEY_DBLJOY1+1, "DBLJOYB"},
{KEY_DBLJOY1+2, "DBLJOYX"},
{KEY_DBLJOY1+3, "DBLJOYY"},
{KEY_DBLJOY1+4, "DBLJOYL"},
{KEY_DBLJOY1+5, "DBLJOYR"},
{KEY_DBLJOY1+6, "DBLJOYSTART"},
{KEY_DBLJOY1+7, "DBLJOYSELECT"},
#define NOMOREJOYBTN_1DBL
#else
{KEY_DBLJOY1+0, "DBLJOY1"},
{KEY_DBLJOY1+1, "DBLJOY2"},
{KEY_DBLJOY1+2, "DBLJOY3"},
......@@ -387,7 +364,6 @@ static keyname_t keynames[] =
{KEY_DBLJOY1+5, "DBLJOY6"},
{KEY_DBLJOY1+6, "DBLJOY7"},
{KEY_DBLJOY1+7, "DBLJOY8"},
#endif
#if !defined (NOMOREJOYBTN_1DBL)
{KEY_DBLJOY1+8, "DBLJOY9"},
{KEY_DBLJOY1+9, "DBLJOY10"},
......@@ -635,22 +611,6 @@ INT32 G_KeyStringtoNum(const char *keystr)
return 0;
}
#if defined (_NDS)
void G_Controldefault(void)
{
gamecontrol[gc_fire ][0] = KEY_JOY1+2; //X
gamecontrol[gc_forward ][0] = KEY_UPARROW;
gamecontrol[gc_backward ][0] = KEY_DOWNARROW;
gamecontrol[gc_jump ][0] = KEY_JOY1+0; //A
gamecontrol[gc_use ][0] = KEY_JOY1+3; //Y
gamecontrol[gc_strafeleft ][0] = KEY_JOY1+4; //L
gamecontrol[gc_straferight][0] = KEY_JOY1+5; //R
gamecontrol[gc_turnleft ][0] = KEY_LEFTARROW;
gamecontrol[gc_turnright ][0] = KEY_RIGHTARROW;
gamecontrol[gc_pause ][0] = KEY_JOY1+6; //Start
gamecontrol[gc_weaponnext ][0] = KEY_JOY1+7; //Select
}
#else
void G_Controldefault(void)
{
gamecontrol[gc_forward ][0] = 'w';
......@@ -688,7 +648,6 @@ void G_Controldefault(void)
gamecontrol[gc_console ][0] = KEY_CONSOLE;
gamecontrol[gc_pause ][0] = KEY_PAUSE;
}
#endif
void G_SaveKeySetting(FILE *f)
{
......
......@@ -41,14 +41,8 @@ typedef unsigned char FBOOLEAN;
// ==========================================================================
// byte value for paletted graphics, which represent the transparent color
#ifdef _NDS
// NDS is hardwired to use zero as transparent color
#define HWR_PATCHES_CHROMAKEY_COLORINDEX 0
#define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 1
#else
#define HWR_PATCHES_CHROMAKEY_COLORINDEX 255
#define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 130
#endif
// the chroma key color shows on border sprites, set it to black
#define HWR_PATCHES_CHROMAKEY_COLORVALUE (0x00000000) //RGBA format as in grSstWinOpen()
......
......@@ -5726,12 +5726,8 @@ if (0)
HWD.pfnSetSpecialState(HWD_SET_FOG_MODE, 0); // Turn it off
}
#ifndef _NDS
if (drawsky)
HWR_DrawSkyBackground(player);
#else
(void)HWR_DrawSkyBackground;
#endif
//Hurdler: it doesn't work in splitscreen mode
drawsky = splitscreen;
......@@ -5970,12 +5966,8 @@ if (0)
HWD.pfnSetSpecialState(HWD_SET_FOG_MODE, 0); // Turn it off
}
#ifndef _NDS
if (!skybox && drawsky) // Don't draw the regular sky if there's a skybox
HWR_DrawSkyBackground(player);
#else
(void)HWR_DrawSkyBackground;
#endif
//Hurdler: it doesn't work in splitscreen mode
drawsky = splitscreen;
......@@ -6225,12 +6217,7 @@ void HWR_Startup(void)
}
if (rendermode == render_opengl)
textureformat = patchformat =
#ifdef _NDS
GR_TEXFMT_P_8;
#else
GR_RGBA;
#endif
textureformat = patchformat = GR_RGBA;
startupdone = true;
}
......
......@@ -22,9 +22,7 @@
#endif
#elif !defined (__DJGPP__)
#include <sys/socket.h>
#ifndef _NDS
#include <arpa/inet.h>
#endif
#include <netdb.h>
#endif
......
......@@ -119,9 +119,7 @@
/*****************************************************************************/
/* nothing should be changed below */
#ifndef _NDS
typedef unsigned char u8;
#endif
typedef const u8 *LZF_STATE[1 << (HLOG)];
......
......@@ -58,7 +58,7 @@ typedef off_t off64_t;
#if defined (_WIN32)
#define PRIdS "Iu"
#elif defined (DJGPP) || defined (_NDS)
#elif defined (DJGPP)
#define PRIdS "u"
#else
#define PRIdS "zu"
......
# Adapted in part from devkitPRO makefiles.
NOMD5=1
# Check if DEVKITARM is set in the environment. If so, continue with compilation.
.SUFFIXES:
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
# use absolute paths because changing PATH variable breaks distcc
PREFIX := $(DEVKITARM)/bin/arm-eabi
NDSTOOL := $(DEVKITARM)/bin/ndstool
# Disable same warning flags
WFLAGS+=-Wno-inline -Wno-cast-align
WFLAGS+=-Wno-shadow -Wno-char-subscripts
WFLAGS+=-Wno-declaration-after-statement
WFLAGS+=-Wno-old-style-definition
WFLAGS+=-Wno-undef
WFLAGS+=-Wno-unsuffixed-float-constants
ifndef NOHW
OBJS+=$(OBJDIR)/r_nds3d.o
endif
ARCH = -mthumb -mthumb-interwork
LDFLAGS += -L$(DEVKITPRO)/libnds/lib -specs=ds_arm9.specs -g $(ARCH) -mno-fpu
LIBS += -lfat -lnds9
CFLAGS += -D_NDS -DARM9 -I$(DEVKITPRO)/libnds/include $(ARCH) -march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math
#include "../command.h"
#include "../s_sound.h"
#include "../i_sound.h"
//
// CD MUSIC I/O
//
UINT8 cdaudio_started = 0;
consvar_t cd_volume = {"cd_volume","31",CV_SAVE,soundvolume_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cdUpdate = {"cd_update","1",CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
void I_InitCD(void){}
void I_StopCD(void){}
void I_PauseCD(void){}
void I_ResumeCD(void){}
void I_ShutdownCD(void){}
void I_UpdateCD(void){}
void I_PlayCD(UINT8 track, UINT8 looping)
{
(void)track;
(void)looping;
}
boolean I_SetVolumeCD(int volume)
{
(void)volume;
return false;
}
#include "../doomdef.h"
#include "../d_main.h"
#include "../m_argv.h"
#include "../i_system.h"
int main(int argc, char **argv)
{
myargc = argc;
myargv = argv; /// \todo pull out path to exe from this string
CONS_Printf("I_StartupSystem...");
I_StartupSystem();
// startup SRB2
CONS_Printf("Setting up SRB2...\n");
D_SRB2Main();
CONS_Printf("Entering main game loop...\n");
// never return
D_SRB2Loop();
// return to OS
#ifndef __GNUC__
return 0;
#endif
}
#include "../i_net.h"
boolean I_InitNetwork(void)
{
return false;
}
#include "../i_sound.h"
UINT8 sound_started = 0;
void *I_GetSfx(sfxinfo_t *sfx)
{
(void)sfx;
return NULL;
}
void I_FreeSfx(sfxinfo_t *sfx)
{
(void)sfx;
}
void I_StartupSound(void){}
void I_ShutdownSound(void){}
//
// SFX I/O
//
INT32 I_StartSound(sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, INT32 priority)
{
(void)id;
(void)vol;
(void)sep;
(void)pitch;
(void)priority;
return -1;
}
void I_StopSound(INT32 handle)
{
(void)handle;
}
INT32 I_SoundIsPlaying(INT32 handle)
{
(void)handle;
return false;
}
void I_UpdateSoundParams(INT32 handle, INT32 vol, INT32 sep, INT32 pitch)
{
(void)handle;
(void)vol;
(void)sep;
(void)pitch;
}
void I_SetSfxVolume(INT32 volume)
{
(void)volume;
}
//
// MUSIC I/O
//
UINT8 music_started = 0;
void I_InitMusic(void){}
void I_ShutdownMusic(void){}
void I_PauseSong(INT32 handle)
{
(void)handle;
}
void I_ResumeSong(INT32 handle)
{
(void)handle;
}
//
// MIDI I/O
//
UINT8 midimusic_started = 0;
void I_InitMIDIMusic(void){}
void I_ShutdownMIDIMusic(void){}
void I_SetMIDIMusicVolume(INT32 volume)
{
(void)volume;
}
INT32 I_RegisterSong(void *data, size_t len)
{
(void)data;
(void)len;
return -1;
}
boolean I_PlaySong(INT32 handle, INT32 looping)
{
(void)handle;
(void)looping;
return false;
}
void I_StopSong(INT32 handle)
{
(void)handle;
}
void I_UnRegisterSong(INT32 handle)
{
(void)handle;
}
//
// DIGMUSIC I/O
//
UINT8 digmusic_started = 0;
void I_InitDigMusic(void){}
void I_ShutdownDigMusic(void){}
boolean I_StartDigSong(const char *musicname, INT32 looping)
{
(void)musicname;
(void)looping;
return false;
}
void I_StopDigSong(void){}
void I_SetDigMusicVolume(INT32 volume)
{
(void)volume;
}
boolean I_SetSongSpeed(float speed)
{
(void)speed;
return false;
}
boolean I_SetSongTrack(int track)
{
(void)track;
return false;
}
#include <nds.h>
#include <fat.h>
#include "../doomdef.h"
#include "../d_main.h"
#include "../i_system.h"
#include "../i_joy.h"
UINT8 graphics_started = 0;
UINT8 keyboard_started = 0;
static volatile tic_t ticcount;
UINT32 I_GetFreeMem(UINT32 *total)
{
*total = 0;
return 0;
}
tic_t I_GetTime(void)
{
return ticcount;
}
void I_Sleep(void){}
void I_GetEvent(void)
{
// Mappings of DS keys to SRB2 keys
UINT32 dskeys[] =
{
KEY_A,
KEY_B,
KEY_X,
KEY_Y,
KEY_L,
KEY_R,
KEY_START,
KEY_SELECT
};
event_t event;
UINT32 held, up, down;
UINT32 i;
// Check how the state has changed since last time
scanKeys();
// For the d-pad, we only care about the current state
held = keysHeld();
event.type = ev_joystick;
event.data1 = 0; // First (and only) axis set
if (held & KEY_LEFT) event.data2 = -1;
else if (held & KEY_RIGHT) event.data2 = 1;
else event.data2 = 0;
if (held & KEY_UP) event.data3 = -1;
else if (held & KEY_DOWN) event.data3 = 1;
else event.data3 = 0;
D_PostEvent(&event);
// For the buttons, we need to report changes in state
up = keysUp();
down = keysDown();
for (i = 0; i < sizeof(dskeys)/sizeof(dskeys[0]); i++)
{
// Has this button's state changed?
if ((up | down) & dskeys[i])
{
event.type = (up & dskeys[i]) ? ev_keyup : ev_keydown;
event.data1 = KEY_JOY1 + i;
D_PostEvent(&event);
}
}
}
void I_OsPolling(void)
{
I_GetEvent();
}
ticcmd_t *I_BaseTiccmd(void)
{
static ticcmd_t emptyticcmd;
return &emptyticcmd;
}
ticcmd_t *I_BaseTiccmd2(void)
{
static ticcmd_t emptyticcmd2;
return &emptyticcmd2;
}
void I_Quit(void)
{
exit(0);
}
void I_Error(const char *error, ...)
{
va_list argptr;
va_start(argptr, error);
viprintf(error, argptr);
va_end(argptr);
for(;;);
}
void I_Tactile(FFType Type, const JoyFF_t *Effect)
{
(void)Type;
(void)Effect;
}
void I_Tactile2(FFType Type, const JoyFF_t *Effect)
{
(void)Type;
(void)Effect;
}
void I_JoyScale(void){}
void I_JoyScale2(void){}
void I_InitJoystick(void)
{
Joystick.bGamepadStyle = true;
}
void I_InitJoystick2(void){}
INT32 I_NumJoys(void)
{
return 0;
}
const char *I_GetJoyName(INT32 joyindex)
{
(void)joyindex;
return NULL;
}
void I_SetupMumble(void)
{
}
#ifndef NOMUMBLE
void I_UpdateMumble(const mobj_t *mobj, const listener_t listener)
{
(void)mobj;
(void)listener;
}
#endif
void I_OutputMsg(const char *error, ...)
{
va_list argptr;
va_start(argptr, error);
viprintf(error, argptr);
va_end(argptr);