1
0
Fork 0
forked from len0rd/rockbox

sdl: Remove platform-specific code

Also nuke the Makefiles of Duke Nukem 3D (pun intended).

Change-Id: If2707cf079bfb9299347f9c5f980780134b6ecda
This commit is contained in:
Vencislav Atanasov 2019-07-28 23:31:50 +03:00
parent e19857e712
commit 183e45e8d0
No known key found for this signature in database
GPG key ID: 4B991E20465BE1F1
49 changed files with 53 additions and 2191 deletions

View file

@ -33,11 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "SDL.h"
#ifdef _WIN32
#include "../../../Engine/src/windows/inttypes.h"
#else
#include <inttypes.h>
#endif
enum DPMI_Errors
{

View file

@ -32,11 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define __FX_MAN_H
#include "sndcards.h"
#ifdef _WIN32
#include "../../Engine/src/windows/inttypes.h"
#else
#include <inttypes.h>
#endif
#include <inttypes.h>
typedef struct
{

View file

@ -856,121 +856,3 @@ int TS_LockMemory
}
#endif
/*
// Converts a hex byte to an integer
static int btoi
(
unsigned char bcd
)
{
unsigned b;
unsigned c;
unsigned d;
b = bcd / 16;
c = bcd - b * 16;
d = b * 10 + c;
return( d );
}
static void RestoreRealTimeClock
(
void
)
{
int read;
int i;
int hr;
int min;
int sec;
int cent;
int yr;
int mo;
int day;
int year;
union REGS inregs;
// Read Real Time Clock Time.
read = FALSE;
inregs.h.ah = 0x02;
for( i = 1; i <= 3; i++ )
{
int386( 0x1A, &inregs, &inregs );
if ( inregs.x.cflag == 0 )
{
read = TRUE;
}
}
if ( read )
{
//and convert BCD to integer format
hr = btoi( inregs.h.ch );
min = btoi( inregs.h.cl );
sec = btoi( inregs.h.dh );
// Read Real Time Clock Date.
inregs.h.ah = 0x04;
int386( 0x1A, &inregs, &inregs );
if ( inregs.x.cflag == 0 )
{
//and convert BCD to integer format
cent = btoi( inregs.h.ch );
yr = btoi( inregs.h.cl );
mo = btoi( inregs.h.dh );
day = btoi( inregs.h.dl );
year = cent * 100 + yr;
// Set System Time.
inregs.h.ch = hr;
inregs.h.cl = min;
inregs.h.dh = sec;
inregs.h.dl = 0;
inregs.h.ah = 0x2D;
int386( 0x21, &inregs, &inregs );
// Set System Date.
inregs.w.cx = year;
inregs.h.dh = mo;
inregs.h.dl = day;
inregs.h.ah = 0x2B;
int386( 0x21, &inregs, &inregs );
}
}
}
*/
/*
struct dostime_t time;
struct dosdate_t date;
outp(0x70,0);
time.second=inp(0x71);
outp(0x70,2);
time.minute=inp(0x71);
outp(0x70,4);
time.hour=inp(0x71);
outp(0x70,7);
date.day=inp(0x71);
outp(0x70,8);
date.month=inp(0x71);
outp(0x70,9);
date.year=inp(0x71);
time.second=(time.second&0x0f)+((time.second>>4)*10);
time.minute=(time.minute&0x0f)+((time.minute>>4)*10);
time.hour=(time.hour&0x0f)+((time.hour>>4)*10);
date.day=(date.day&0x0f)+((date.day>>4)*10);
date.month=(date.month&0x0f)+((date.month>>4)*10);
date.year=(date.year&0x0f)+((date.year>>4)*10);
_dos_settime(&time);
_dos_setdate(&date);
*/

View file

@ -24,11 +24,6 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------
#if PLATFORM_DOS
#include <conio.h>
#include <dos.h>
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@ -698,18 +693,11 @@ void CONFIG_ReadSetup( void )
}
SCRIPT_GetNumber( scripthandle, "Sound Setup", "FXDevice",&FXDevice);
#if !PLATFORM_DOS // reimplementation of ASS expects a "SoundScape".
if (FXDevice != NumSoundCards)
FXDevice = SoundScape;
#endif
SCRIPT_GetNumber( scripthandle, "Sound Setup", "MusicDevice",&MusicDevice);
//#if !PLATFORM_DOS // reimplementation of ASS expects a "SoundScape".
// if (MusicDevice != NumSoundCards)
// MusicDevice = SoundScape;
//#endif
// FIX_00015: Forced NumVoices=8, NumChannels=2, NumBits=16, MixRate=44100, ScreenMode = x(
// (ScreenMode has no meaning anymore)

View file

@ -1,11 +1,7 @@
#ifndef _CVARDEFS_H_
#define _CVARDEFS_H_
#ifdef _WIN32
#include "../../Engine/src/windows/inttypes.h"
#else
#include <inttypes.h>
#endif
#include <inttypes.h>
void CVARDEFS_Init();
void CVARDEFS_Render();

View file

@ -4,11 +4,7 @@
#define REGCONVAR(varname, varhelp, variable, function) CVAR_RegisterCvar(varname, varhelp, &variable, &function)
#define REGCONFUNC(varname, varhelp, function) CVAR_RegisterCvar(varname, varhelp, NULL, &function)
#ifdef _WIN32
#include "../../Engine/src/windows/inttypes.h"
#else
#include <inttypes.h>
#endif
#include <inttypes.h>
typedef void (*function_t) (void* binding);

View file

@ -28,11 +28,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
#include "platform.h"
#ifdef _WIN32
#include "../../Engine/src/windows/inttypes.h"
#else
#include <inttypes.h>
#endif
#include <fcntl.h>
#include <time.h>
@ -50,26 +46,6 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
#endif
#endif
#if PLATFORM_DOS
#include <dos.h>
#include <bios.h>
#include <io.h>
#define PATH_SEP_CHAR '\\'
#define PATH_SEP_STR "\\"
#endif
#if PLATFORM_UNIX && !defined(ROCKBOX)
#include "dukeunix.h"
#endif
#if PLATFORM_MACOSX
#include "dukeunix.h"
#endif
#if PLATFORM_WIN32
#include "dukewin.h"
#endif
#ifdef ROCKBOX
#define PLATFORM_ROCKBOX 1
#endif
@ -524,11 +500,6 @@ extern struct player_struct ps[MAXPLAYERS];
extern struct player_orig po[MAXPLAYERS];
extern struct user_defs ud;
// ported build engine has this, too. --ryan.
#if PLATFORM_DOS
extern short int moustat;
#endif
extern short int global_random;
extern int32_t scaredfallz;
extern char buf[80]; //My own generic input buffer

View file

@ -32,25 +32,6 @@
#define O_BINARY 0
#endif
struct find_t
{
DIR *dir;
char pattern[MAX_PATH];
char name[MAX_PATH];
};
int _dos_findfirst(char *filename, int x, struct find_t *f);
int _dos_findnext(struct find_t *f);
struct dosdate_t
{
uint8_t day;
uint8_t month;
unsigned int year;
uint8_t dayofweek;
};
void _dos_getdate(struct dosdate_t *date);
#ifndef min
#define min(x, y) ((x) < (y) ? (x) : (y))
#endif

View file

@ -1,100 +0,0 @@
//
// dukeunix.h
// Duke3D
//
// Created by fabien sanglard on 12-12-12.
// Copyright (c) 2012 fabien sanglard. All rights reserved.
//
#ifndef Duke3D_dukeunix_h
#define Duke3D_dukeunix_h
#define cdecl
#define __far
#define __interrupt
//#define STUBBED(x)
#ifdef __SUNPRO_C
#define STUBBED(x) fprintf(stderr,"STUB: %s (??? %s:%d)\n",x,__FILE__,__LINE__)
#else
#define STUBBED(x) fprintf(stderr,"STUB: %s (%s, %s:%d)\n",x,__FUNCTION__,__FILE__,__LINE__)
#endif
#define PATH_SEP_CHAR '/'
#define PATH_SEP_STR "/"
#define ROOTDIR "/"
#define CURDIR "./"
#ifndef O_BINARY
#define O_BINARY 0
#endif
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h>
#include <assert.h>
struct find_t
{
DIR *dir;
char pattern[MAX_PATH];
char name[MAX_PATH];
};
int _dos_findfirst(char *filename, int x, struct find_t *f);
int _dos_findnext(struct find_t *f);
struct dosdate_t
{
uint8_t day;
uint8_t month;
unsigned int year;
uint8_t dayofweek;
};
void _dos_getdate(struct dosdate_t *date);
#ifndef min
#define min(x, y) ((x) < (y) ? (x) : (y))
#endif
#ifndef max
#define max(x, y) ((x) > (y) ? (x) : (y))
#endif
#ifndef strcmpi
#define strcmpi(x, y) strcasecmp(x, y)
#endif
#ifdef DC
#undef stderr
#undef stdout
#undef getchar
/* kos compat */
#define stderr ((FILE*)2)
#define stdout ((FILE*)2)
#define Z_AvailHeap() ((10 * 1024) * 1024)
#else
// 64 megs should be enough for anybody. :) --ryan.
#define Z_AvailHeap() ((64 * 1024) * 1024)
#endif
#define printchrasm(x,y,ch) printf("%c", (uint8_t ) (ch & 0xFF))
#ifdef __GNUC__
#define GCC_PACK1_EXT __attribute__((packed,aligned(1)))
#endif
// FCS: Game.c features calls to mkdir without the proper flags.
// Giving all access is ugly but it is just game OK !
#define mkdir(X) mkdir(X,0777)
#define getch getchar
#endif

View file

@ -1,86 +0,0 @@
#ifndef _INCL_DUKEWIN_H_
#define _INCL_DUKEWIN_H_ 1
#ifndef _MSC_VER /* might need this. */
typedef int32_t int32_t __int64;
#endif
#pragma warning(disable:4761)
#if USE_SDL
#include "SDL.h"
#endif
#ifdef _DEBUG
#define STUBBED(x) printf("STUB: %s in %s:%d\n", x, __FILE__, __LINE__)
#else
#define STUBBED(x)
#endif
#define PATH_SEP_CHAR '\\'
#define PATH_SEP_STR "\\"
#include <sys/stat.h>
#include <io.h>
#include <assert.h>
struct find_t
{
int32_t handle;
struct _finddata_t data;
uint8_t name[MAX_PATH];
};
int _dos_findfirst(uint8_t *filename, int x, struct find_t *f);
int _dos_findnext(struct find_t *f);
struct dosdate_t
{
uint8_t day;
uint8_t month;
unsigned int year;
uint8_t dayofweek;
};
void _dos_getdate(struct dosdate_t *date);
#ifndef min
#define min(x, y) ((x) < (y) ? (x) : (y))
#endif
#ifndef max
#define max(x, y) ((x) > (y) ? (x) : (y))
#endif
#ifdef FP_OFF
#undef FP_OFF
#endif
#define FP_OFF(x) ((int32_t) (x))
// 64 megs should be enough for anybody. :) --ryan.
#define Z_AvailHeap() ((64 * 1024) * 1024)
#define printchrasm(x,y,ch) printf("%c", (uint8_t ) (ch & 0xFF))
#define cdecl
#define open _open
#define O_BINARY _O_BINARY
#define O_RDONLY _O_RDONLY
#define O_WRONLY _O_WRONLY
#define O_RDWR _O_RDWR
#define O_TRUNC _O_TRUNC
#define O_CREAT _O_CREAT
#define S_IREAD _S_IREAD
#define S_IWRITE _S_IWRITE
#define S_IRDWR _S_IRDWR
#define S_IRUSR S_IREAD
#define S_IWUSR S_IWRITE
#define S_IRGRP 0
#define S_IWGRP 0
#define F_OK 0
#define HAVE_PRAGMA_PACK 1
#endif

View file

@ -24,11 +24,7 @@
*/
//-------------------------------------------------------------------------
#ifdef _WIN32
#include <windows.h>
#else
#include "SDL.h"
#endif
#include "types.h"
@ -113,38 +109,12 @@ void pitch_test( void );
uint8_t restorepalette,screencapt,nomorelogohack;
int sendmessagecommand = -1;
#if PLATFORM_DOS
task *TimerPtr=NULL;
#endif
extern int32_t lastvisinc;
// Build Engine port implements this. --ryan.
#if PLATFORM_DOS
static void timerhandler(task *unused)
{
totalclock++;
}
void inittimer()
{
TimerPtr = TS_ScheduleTask( timerhandler,TICRATE, 1, NULL );
TS_Dispatch();
}
void uninittimer(void)
{
if (TimerPtr)
TS_Terminate( TimerPtr );
TimerPtr = NULL;
TS_Shutdown();
}
#else
void timerhandler(void)
{
totalclock++;
}
#endif
int gametext(int x,int y,char *t,uint8_t s,short dabits)
{
@ -2471,11 +2441,7 @@ GOTOHERE:
if(true)
{
if(*t == ' ' && *(t+1) == 0) *t = 0;
#if PLATFORM_DOS // Is there a good reason for this? --ryan.
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
#else
printf("\n%s\n",t);
#endif
}
// CTW END - MODIFICATION
}
@ -7818,18 +7784,11 @@ void Startup(void)
if(networkmode == 255)
networkmode = 1;
#ifdef PLATFORM_DOS
puts("Checking music inits.");
MusicStartup();
puts("Checking sound inits.");
SoundStartup();
#else
/* SBF - wasn't sure if swapping them would harm anything. */
puts("Checking sound inits.");
SoundStartup();
puts("Checking music inits.");
MusicStartup();
#endif
// AutoAim
if(nHostForceDisableAutoaim)
@ -8019,64 +7978,6 @@ void getnames(void)
const char* const baseDir="duke3d*.grp";
#ifdef _WIN32
void findGRPToUse(uint8_t * groupfilefullpath)
{
WIN32_FIND_DATA FindFileData;
HANDLE hFind = INVALID_HANDLE_VALUE;
int i=0,kbdKey ;
char groupfile[9][512];
int grpID ;
if(getGameDir()[0] != '\0')
{
sprintf(groupfilefullpath, "%s\\%s", getGameDir(), baseDir);
hFind = FindFirstFile(groupfilefullpath, &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
sprintf(groupfilefullpath, "%s", baseDir);
}
else
FindClose(hFind);
}
else
sprintf(groupfilefullpath, "%s", baseDir);
printf("Searching '%d':\n\n",groupfilefullpath);
hFind = FindFirstFile(groupfilefullpath,&FindFileData);
if ( hFind==INVALID_HANDLE_VALUE )
Error(EXIT_SUCCESS, "Can't find '%s'\n", groupfilefullpath);
do
{
i++;
sprintf(groupfile[i-1], "%s", FindFileData.cFileName);
printf("Found GRP #%d:\t%d Bytes\t %s \n", i, FindFileData.nFileSizeLow, groupfile[i-1]);
} while ( FindNextFile(hFind, &FindFileData) && i < 9 );
if(i==1)
grpID = 0;
else
{
printf("\n-> Choose a base GRP file from 1 to %c: ",'0' + i);
do
kbdKey = getch();
while(kbdKey < '1' || kbdKey > ('0' + i));
printf("%c\n", kbdKey);
grpID = groupfile[kbdKey-'1'];
}
FindClose(hFind);
if (strlen(getGameDir()) == 0)
sprintf(groupfilefullpath, "./%s", groupfile[grpID]);
else
sprintf(groupfilefullpath, "%s//%s", getGameDir(), groupfile[grpID]);
}
#else
int dukeGRP_Match(char* filename,int length)
{
@ -8126,8 +8027,6 @@ void findGRPToUse(char * groupfilefullpath){
}
}
#endif
static int load_duke3d_groupfile(void)
{
// FIX_00032: Added multi base GRP manager. Use duke3d*.grp to handle multiple grp.

View file

@ -1155,11 +1155,7 @@ uint8_t parsecommand(int readfromGRP)
break;
}
}
#ifdef PLATFORM_UNIX
volume_names[j][i] = '\0';
#else
volume_names[j][i-1] = '\0';
#endif
return 0;
case 108:
scriptptr--;
@ -1182,11 +1178,7 @@ uint8_t parsecommand(int readfromGRP)
break;
}
}
#if defined(PLATFORM_UNIX) || defined(PLATFORM_ROCKBOX)
skill_names[j][i] = '\0';
#else
skill_names[j][i-1] = '\0';
#endif
return 0;
case 0:
@ -1212,11 +1204,7 @@ uint8_t parsecommand(int readfromGRP)
break;
}
}
#if defined(PLATFORM_UNIX) || defined(PLATFORM_ROCKBOX)
level_names[j*11+k][i] = '\0';
#else
level_names[j*11+k][i-1] = '\0';
#endif
while( *textptr == ' ' ) textptr++;
partime[j*11+k] =
@ -1247,11 +1235,7 @@ uint8_t parsecommand(int readfromGRP)
break;
}
}
#ifdef PLATFORM_UNIX
level_names[j*11+k][i] = '\0';
#else
level_names[j*11+k][i-1] = '\0';
#endif
return 0;
case 79:
@ -1570,11 +1554,7 @@ void loadefs(char *filenam, char *mptr, int readfromGRP)
//ud.conCRC[0] = crc32_update((uint8_t *)textptr, fs, ud.conCRC[0]);
}
#ifdef PLATFORM_UNIX
textptr[fs - 1] = 0;
#else
textptr[fs - 2] = 0;
#endif
clearbuf(actorscrptr,MAXSPRITES,0L);
clearbufbyte(actortype,MAXSPRITES,0L);

View file

@ -76,11 +76,6 @@ int32_t gc,neartaghitdist,lockclock,max_player_health,max_armour_amount,max_ammo
struct weaponhit hittype[MAXSPRITES];
short spriteq[1024],spriteqloc,spriteqamount=64;
// ported build engine has this, too. --ryan.
#if PLATFORM_DOS
short moustat = 0;
#endif
struct animwalltype animwall[MAXANIMWALLS];
short numanimwalls;
int32_t *animateptr[MAXANIMATES], animategoal[MAXANIMATES], animatevel[MAXANIMATES], animatecnt;
@ -232,7 +227,6 @@ int32_t *curipos[MAXINTERPOLATIONS];
void FixFilePath(char *filename)
{
#if PLATFORM_UNIX || PLATFORM_ROCKBOX
uint8_t *ptr;
uint8_t *lastsep = filename;
@ -304,74 +298,8 @@ void FixFilePath(char *filename)
return;
}
}
#endif
}
#if PLATFORM_DOS
/* no-op. */
#elif PLATFORM_WIN32
int _dos_findfirst(uint8_t *filename, int x, struct find_t *f)
{
int32_t rc = _findfirst(filename, &f->data);
f->handle = rc;
if (rc != -1)
{
strncpy(f->name, f->data.name, sizeof (f->name) - 1);
f->name[sizeof (f->name) - 1] = '\0';
return(0);
}
return(1);
}
int _dos_findnext(struct find_t *f)
{
int rc = 0;
if (f->handle == -1)
return(1); /* invalid handle. */
rc = _findnext(f->handle, &f->data);
if (rc == -1)
{
_findclose(f->handle);
f->handle = -1;
return(1);
}
strncpy(f->name, f->data.name, sizeof (f->name) - 1);
f->name[sizeof (f->name) - 1] = '\0';
return(0);
}
#elif defined(PLATFORM_UNIX) || defined(PLATFORM_MACOSX) || defined(PLATFORM_ROCKBOX)
int _dos_findfirst(char *filename, int x, struct find_t *f)
{
char *ptr;
if (strlen(filename) >= sizeof (f->pattern))
return(1);
strcpy(f->pattern, filename);
FixFilePath(f->pattern);
ptr = strrchr(f->pattern, PATH_SEP_CHAR);
if (ptr == NULL)
{
ptr = filename;
f->dir = opendir(CURDIR);
}
else
{
*ptr = '\0';
f->dir = opendir(f->pattern);
memmove(f->pattern, ptr + 1, strlen(ptr + 1) + 1);
}
return(_dos_findnext(f));
}
static int check_pattern_nocase(const char *x, const char *y)
{
if ((x == NULL) || (y == NULL))
@ -409,53 +337,6 @@ static int check_pattern_nocase(const char *x, const char *y)
return(*x == *y); /* it's a match (both should be EOS). */
}
int _dos_findnext(struct find_t *f)
{
struct dirent *dent;
if (f->dir == NULL)
return(1); /* no such dir or we're just done searching. */
while ((dent = readdir(f->dir)) != NULL)
{
if (check_pattern_nocase(f->pattern, dent->d_name))
{
if (strlen(dent->d_name) < sizeof (f->name))
{
strcpy(f->name, dent->d_name);
return(0); /* match. */
}
}
}
closedir(f->dir);
f->dir = NULL;
return(1); /* no match in whole directory. */
}
#else
#error please define for your platform.
#endif
#if !PLATFORM_DOS
void _dos_getdate(struct dosdate_t *date)
{
time_t curtime = time(NULL);
if (date == NULL) {
return;
}
memset(date, 0, sizeof(struct dosdate_t));
date->day = 1;
date->month = 1;
date->year = 1970;
date->dayofweek = 4;
}
#endif
int FindDistance2D(int ix, int iy)
{
int t;
@ -560,11 +441,7 @@ int32 SafeOpenAppend (const char *_filename, int32 filetype)
filename[sizeof (filename) - 1] = '\0';
FixFilePath(filename);
#if (defined PLATFORM_WIN32)
handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_APPEND );
#else
handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_APPEND , 0666);
#endif
if (handle == -1)
Error (EXIT_FAILURE, "Error opening for append %s: %s",filename,strerror(errno));
@ -579,11 +456,7 @@ boolean SafeFileExists ( const char * _filename )
filename[sizeof (filename) - 1] = '\0';
FixFilePath(filename);
#if( defined PLATFORM_WIN32)
return(access(filename, 6) == 0);
#else
return(rb->file_exists(filename));
#endif
return(rb->file_exists(filename));
}
@ -595,12 +468,8 @@ int32 SafeOpenWrite (const char *_filename, int32 filetype)
filename[sizeof (filename) - 1] = '\0';
FixFilePath(filename);
#if (defined PLATFORM_WIN32)
handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_TRUNC );
#else
handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_TRUNC
, 0666);
#endif
if (handle == -1)
Error (EXIT_FAILURE, "Error opening %s: %s",filename,strerror(errno));
@ -783,7 +652,6 @@ void SwapIntelShortArray(short *s, int num)
Stolen for Duke3D, too.
*/
#if PLATFORM_UNIX
uint8_t *strlwr(uint8_t *s)
{
uint8_t *p = s;
@ -858,13 +726,11 @@ uint8_t *ultoa(uint32_t value, uint8_t *string, int radix)
return string;
}
#endif
char ApogeePath[256];
int setup_homedir (void)
{
#if PLATFORM_UNIX
int err;
snprintf (ApogeePath, sizeof (ApogeePath), "%s/.duke3d/", getenv ("HOME"));
@ -877,9 +743,6 @@ int setup_homedir (void)
strerror (errno));
return -1;
}
#else
sprintf(ApogeePath, ".%s", PATH_SEP_STR);
#endif
return 0;
}

View file

@ -18,23 +18,11 @@ int FindDistance3D(int ix, int iy, int iz);
void Shutdown(void);
#ifndef LITTLE_ENDIAN
#ifdef __APPLE__
#else
#define LITTLE_ENDIAN 1234
#endif
#define LITTLE_ENDIAN 1234
#endif
#ifndef BIG_ENDIAN
#ifdef __APPLE__
#else
#define BIG_ENDIAN 4321
#endif
#endif
#if PLATFORM_WIN32
#ifndef BYTE_ORDER
#define BYTE_ORDER LITTLE_ENDIAN
#endif
#define BIG_ENDIAN 4321
#endif
#ifdef ROCKBOX
@ -45,15 +33,6 @@ void Shutdown(void);
#endif
#endif
#ifdef __APPLE__
#if __powerpc__
#define BYTE_ORDER BIG_ENDIAN
#else
// Defined in endian.h
// #define BYTE_ORDER LITTLE_ENDIAN
#endif
#endif
#ifndef BYTE_ORDER
#error Please define your platform.
#endif

View file

@ -1245,83 +1245,10 @@ void dispnames(void)
}
// This is the same thing as was in build.c ...
// We DO have a _dos_findfirst implementation now...maybe use that instead?
// --ryan.
#if ORIGINAL_DUKE3D_GETFILENAMES
int getfilenames(uint8_t kind[6])
{
short type;
struct find_t fileinfo;
if (strcmp(kind,"SUBD") == 0)
{
strcpy(kind,"*.*");
if (_dos_findfirst(kind,_A_SUBDIR,&fileinfo) != 0)
return(-1);
type = 1;
}
else
{
if (_dos_findfirst(kind,_A_NORMAL,&fileinfo) != 0)
return(-1);
type = 0;
}
do
{
if ((type == 0) || ((fileinfo.attrib&16) > 0))
if ((fileinfo.name[0] != '.') || (fileinfo.name[1] != 0))
{
strcpy(menuname[menunamecnt],fileinfo.name);
menuname[menunamecnt][16] = type;
menunamecnt++;
}
}
while (_dos_findnext(&fileinfo) == 0);
return(0);
}
#else
int getfilenames(char kind[6])
{
/* !!! FIXME: Visual C? */
#if (defined __WATCOMC__)
short type;
struct find_t fileinfo;
if (strcmp(kind,"SUBD") == 0)
{
strcpy(kind,"*.*");
if (_dos_findfirst(kind,_A_SUBDIR,&fileinfo) != 0)
return(-1);
type = 1;
}
else
{
if (_dos_findfirst(kind,_A_NORMAL,&fileinfo) != 0)
return(-1);
type = 0;
}
do
{
if ((type == 0) || ((fileinfo.attrib&16) > 0))
if ((fileinfo.name[0] != '.') || (fileinfo.name[1] != 0))
{
strcpy(menuname[menunamecnt],fileinfo.name);
menuname[menunamecnt][16] = type;
menunamecnt++;
}
}
while (_dos_findnext(&fileinfo) == 0);
#elif (defined PLATFORM_UNIX)
DIR *dir;
struct dirent *dent;
struct stat statbuf;
int add_this;
uint8_t *ptr = NULL;
int len = 0;
@ -1330,7 +1257,7 @@ int getfilenames(char kind[6])
if (strcmp(kind,"SUBD") == 0)
subdirs = 1;
dir = opendir(getGamedir());
dir = opendir(getGameDir());
if (dir == NULL)
return(-1);
@ -1340,46 +1267,39 @@ int getfilenames(char kind[6])
dent = readdir(dir);
if (dent != NULL)
{
if (stat(dent->d_name, &statbuf) == 0)
{
if (subdirs)
{
if (S_ISDIR(statbuf.st_mode))
add_this = 1;
} /* if */
else
{
/* need to expand support if this assertion ever fails. */
assert(stricmp(kind, "*.MAP") == 0);
len = strlen(dent->d_name);
if (len >= 5)
{
ptr = ((uint8_t *) dent->d_name) + len;
ptr += strlen(ptr) - 4;
if (stricmp(ptr, ".MAP") == 0)
add_this = 1;
} /* if */
} /* else */
if (subdirs)
{
if (rb->dir_exists(dent->d_name))
add_this = 1;
} /* if */
else
{
/* need to expand support if this assertion ever fails. */
assert(stricmp(kind, "*.MAP") == 0);
len = strlen(dent->d_name);
if (len >= 5)
{
ptr = ((uint8_t *) dent->d_name) + len;
ptr += strlen(ptr) - 4;
if (stricmp(ptr, ".MAP") == 0)
add_this = 1;
} /* if */
} /* else */
if (add_this)
{
strcpy(menuname[menunamecnt],dent->d_name);
menuname[menunamecnt][16] = subdirs;
menunamecnt++;
} /* if */
} /* if */
if (add_this)
{
strcpy(menuname[menunamecnt],dent->d_name);
menuname[menunamecnt][16] = subdirs;
menunamecnt++;
} /* if */
} /* if */
} while (dent != NULL);
closedir(dir);
#endif
return(0);
}
#endif
void sortfilenames()
{
uint8_t sortbuffer[17];

View file

@ -24,10 +24,6 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------
#if PLATFORM_DOS
#include <conio.h>
#endif
#include <stdio.h>
#include <string.h>
#include "../../Game/src/types.h"

View file

@ -27,11 +27,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
#ifndef _types_public
#define _types_public
#ifdef _WIN32
#include "../../Engine/src/windows/inttypes.h"
#else
#include <inttypes.h>
#endif
#include <inttypes.h>
#ifdef __cplusplus
extern "C" {

View file

@ -30,11 +30,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
//
//***************************************************************************
#ifdef _WIN32
#include "../../Engine/src/windows/inttypes.h"
#else
#include <inttypes.h>
#endif
#include <inttypes.h>
#ifndef _util_lib_public
#define _util_lib_public