mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
- cleaned out a tiny bit of the garbage that has accumulated in compat.h.
This file really needs to go away, we do not need this kind of "compatibility".
This commit is contained in:
parent
fd1e63b996
commit
f8a807e3bb
10 changed files with 14 additions and 192 deletions
|
@ -400,7 +400,7 @@ void CDemo::LoadDemoInfo(void)
|
|||
auto pDemo = &pFirstDemo;
|
||||
at59ef = 0;
|
||||
char zFN[BMAX_PATH];
|
||||
Bsnprintf(zFN, BMAX_PATH, "%s%s*.dem", M_GetDemoPath().GetChars(), BloodIniPre);
|
||||
snprintf(zFN, BMAX_PATH, "%s%s*.dem", M_GetDemoPath().GetChars(), BloodIniPre);
|
||||
TArray<FString> demos;
|
||||
D_AddWildFile(demos, zFN);
|
||||
for (auto &filename : demos)
|
||||
|
|
|
@ -829,7 +829,6 @@ int32_t engineInit(void);
|
|||
int32_t enginePostInit(void);
|
||||
void engineUnInit(void);
|
||||
void initspritelists(void);
|
||||
int32_t engineFatalError(char const * msg);
|
||||
|
||||
int32_t engineLoadBoard(const char *filename, char flags, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum);
|
||||
int32_t engineLoadMHK(const char *filename);
|
||||
|
|
|
@ -447,28 +447,6 @@ typedef int32_t ssize_t;
|
|||
typedef size_t bsize_t;
|
||||
typedef ssize_t bssize_t;
|
||||
|
||||
typedef FILE BFILE;
|
||||
|
||||
#define BO_BINARY O_BINARY
|
||||
#define BO_TEXT O_TEXT
|
||||
#define BO_RDONLY O_RDONLY
|
||||
#define BO_WRONLY O_WRONLY
|
||||
#define BO_RDWR O_RDWR
|
||||
#define BO_APPEND O_APPEND
|
||||
#define BO_CREAT O_CREAT
|
||||
#define BO_TRUNC O_TRUNC
|
||||
#define BS_IRGRP S_IRGRP
|
||||
#define BS_IWGRP S_IWGRP
|
||||
#define BS_IEXEC S_IEXEC
|
||||
#define BS_IFIFO S_IFIFO
|
||||
#define BS_IFCHR S_IFCHR
|
||||
#define BS_IFBLK S_IFBLK
|
||||
#define BS_IFDIR S_IFDIR
|
||||
#define BS_IFREG S_IFREG
|
||||
#define BSEEK_SET SEEK_SET
|
||||
#define BSEEK_CUR SEEK_CUR
|
||||
#define BSEEK_END SEEK_END
|
||||
|
||||
#define BMAX_PATH 256
|
||||
|
||||
#define Bassert assert
|
||||
|
@ -498,45 +476,13 @@ typedef FILE BFILE;
|
|||
#define Btoupper toupper
|
||||
#define Btolower tolower
|
||||
#define Bmemcpy memcpy
|
||||
#define Bmemmove memmove
|
||||
#define Bmemchr memchr
|
||||
#define Bmemset memset
|
||||
#define Bmemcmp memcmp
|
||||
#define Bscanf scanf
|
||||
#define Bprintf printf
|
||||
#define Bsscanf sscanf
|
||||
#define Bsprintf sprintf
|
||||
#define Bvfprintf vfprintf
|
||||
#define Bgetenv getenv
|
||||
#define Butime utime
|
||||
|
||||
|
||||
////////// Standard library wrappers //////////
|
||||
|
||||
#ifdef __ANDROID__
|
||||
# define BS_IWRITE S_IWUSR
|
||||
# define BS_IREAD S_IRUSR
|
||||
#else
|
||||
# define BS_IWRITE S_IWRITE
|
||||
# define BS_IREAD S_IREAD
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) && defined(_MSC_VER)
|
||||
# define Bstrdup _strdup
|
||||
# define Bchdir _chdir
|
||||
# define Bgetcwd _getcwd
|
||||
#else
|
||||
# define Bstrdup strdup
|
||||
# define Bchdir chdir
|
||||
# define Bgetcwd getcwd
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# define Btell(h) lseek(h,0,SEEK_CUR)
|
||||
#else
|
||||
# define Btell tell
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define Bstrcasecmp _stricmp
|
||||
# define Bstrncasecmp _strnicmp
|
||||
|
@ -548,67 +494,22 @@ typedef FILE BFILE;
|
|||
# define Bstrncasecmp strncasecmp
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# define Bsnprintf _snprintf
|
||||
# define Bvsnprintf _vsnprintf
|
||||
#else
|
||||
# define Bsnprintf snprintf
|
||||
# define Bvsnprintf vsnprintf
|
||||
#endif
|
||||
|
||||
#define Btime() time(NULL)
|
||||
|
||||
#if defined(_WIN32)
|
||||
# define Bmkdir(s,x) mkdir(s)
|
||||
#else
|
||||
# define Bmkdir mkdir
|
||||
#endif
|
||||
|
||||
// XXX: different across 32- and 64-bit archs (e.g.
|
||||
// parsing the decimal representation of 0xffffffff,
|
||||
// 4294967295 -- long is signed, so strtol would
|
||||
// return LONG_MAX (== 0x7fffffff on 32-bit archs))
|
||||
|
||||
static FORCE_INLINE int32_t atoi_safe(const char *str) { return (int32_t)Bstrtol(str, NULL, 10); }
|
||||
static inline int32_t atoi_safe(const char *str) { return (int32_t)strtoll(str, NULL, 10); }
|
||||
|
||||
#define Batoi(x) atoi_safe(x)
|
||||
#define Batol(str) (strtol(str, NULL, 10))
|
||||
#define Batof(str) (strtod(str, NULL))
|
||||
|
||||
#if defined BITNESS64 && (defined __SSE2__ || defined _MSC_VER)
|
||||
#include <emmintrin.h>
|
||||
static FORCE_INLINE int32_t Blrintf(const float x)
|
||||
static constexpr inline int Blrintf(const double x)
|
||||
{
|
||||
__m128 xx = _mm_load_ss(&x);
|
||||
return _mm_cvtss_si32(xx);
|
||||
return int(x);
|
||||
}
|
||||
#elif defined (_MSC_VER)
|
||||
static FORCE_INLINE int32_t Blrintf(const float x)
|
||||
{
|
||||
int n;
|
||||
__asm fld x;
|
||||
__asm fistp n;
|
||||
return n;
|
||||
}
|
||||
#else
|
||||
#define Blrintf(x) ((int32_t)lrintf(x))
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
# define Bsqrt __builtin_sqrt
|
||||
# define Bsqrtf __builtin_sqrtf
|
||||
#else
|
||||
# define Bsqrt sqrt
|
||||
# define Bsqrtf sqrtf
|
||||
#endif
|
||||
|
||||
// redefined for apple/ppc, which chokes on stderr when linking...
|
||||
#if defined EDUKE32_OSX && defined __BIG_ENDIAN__
|
||||
# define ERRprintf(fmt, ...) printf(fmt, ## __VA_ARGS__)
|
||||
#else
|
||||
# define ERRprintf(fmt, ...) fprintf(stderr, fmt, ## __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
class ExitEvent : public std::exception
|
||||
{
|
||||
int reason;
|
||||
|
@ -715,15 +616,6 @@ struct integers_of_size<sizeof(int64_t)>
|
|||
|
||||
////////// Typedefs //////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
// for use in SFINAE constructs in place of the pointer trick (to which 0 can unintentionally be implicitly cast)
|
||||
struct Dummy FINAL
|
||||
{
|
||||
FORCE_INLINE CONSTEXPR Dummy() : dummy(0) { }
|
||||
char dummy;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64__)
|
||||
// for 32-bit pointers in x86_64 code, such as `gcc -mx32`
|
||||
typedef uint64_t reg_t;
|
||||
|
@ -1118,7 +1010,7 @@ void *handle_memerr(void *);
|
|||
|
||||
static FORCE_INLINE char *xstrdup(const char *s)
|
||||
{
|
||||
char *ptr = Bstrdup(s);
|
||||
char *ptr = strdup(s);
|
||||
return (EDUKE32_PREDICT_TRUE(ptr != NULL)) ? ptr : (char *)handle_memerr(ptr);
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ int32_t maybe_append_ext(char *wbuf, int32_t wbufsiz, const char *fn, const char
|
|||
Bassert((intptr_t)wbuf != (intptr_t)fn); // no aliasing
|
||||
|
||||
// If 'fn' has no extension suffixed, append one.
|
||||
return (Bsnprintf(wbuf, wbufsiz, "%s%s", fn, haveext ? "" : ext) >= wbufsiz);
|
||||
return (snprintf(wbuf, wbufsiz, "%s%s", fn, haveext ? "" : ext) >= wbufsiz);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -6847,63 +6847,6 @@ psky_t * tileSetupSky(int32_t const tilenum)
|
|||
return newPsky;
|
||||
}
|
||||
|
||||
//
|
||||
// Exported Engine Functions
|
||||
//
|
||||
|
||||
#if !defined _WIN32 && defined DEBUGGINGAIDS && !defined GEKKO
|
||||
#ifdef GEKKO
|
||||
#define __rtems__
|
||||
#define _POSIX_REALTIME_SIGNALS
|
||||
#endif
|
||||
#include <signal.h>
|
||||
static void sighandler(int sig, siginfo_t *info, void *ctx)
|
||||
{
|
||||
const char *s;
|
||||
UNREFERENCED_PARAMETER(ctx);
|
||||
switch (sig)
|
||||
{
|
||||
case SIGFPE:
|
||||
switch (info->si_code)
|
||||
{
|
||||
case FPE_INTDIV:
|
||||
s = "FPE_INTDIV (integer divide by zero)"; break;
|
||||
case FPE_INTOVF:
|
||||
s = "FPE_INTOVF (integer overflow)"; break;
|
||||
case FPE_FLTDIV:
|
||||
s = "FPE_FLTDIV (floating-point divide by zero)"; break;
|
||||
case FPE_FLTOVF:
|
||||
s = "FPE_FLTOVF (floating-point overflow)"; break;
|
||||
case FPE_FLTUND:
|
||||
s = "FPE_FLTUND (floating-point underflow)"; break;
|
||||
case FPE_FLTRES:
|
||||
s = "FPE_FLTRES (floating-point inexact result)"; break;
|
||||
case FPE_FLTINV:
|
||||
s = "FPE_FLTINV (floating-point invalid operation)"; break;
|
||||
case FPE_FLTSUB:
|
||||
s = "FPE_FLTSUB (floating-point subscript out of range)"; break;
|
||||
default:
|
||||
s = "?! (unknown)"; break;
|
||||
}
|
||||
ERRprintf("Caught SIGFPE at address %p, code %s. Aborting.\n", info->si_addr, s);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
abort();
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// E_FatalError
|
||||
//
|
||||
int32_t engineFatalError(char const * const msg)
|
||||
{
|
||||
engineerrstr = msg;
|
||||
initprintf("ERROR: %s\n", engineerrstr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
//
|
||||
// preinitengine
|
||||
//
|
||||
|
@ -7002,18 +6945,6 @@ int32_t engineInit(void)
|
|||
if (!mdinited) mdinit();
|
||||
#endif
|
||||
|
||||
#ifdef LUNATIC
|
||||
if (L_CreateState(&g_engState, "eng", NULL))
|
||||
return engineFatalError("Failed creating engine Lua state!");
|
||||
|
||||
{
|
||||
static char const * const luastr = "_LUNATIC_AUX=true; decl=require('ffi').cdef; require'defs_common'";
|
||||
|
||||
if (L_RunString(&g_engState, luastr, -1, "eng"))
|
||||
return engineFatalError("Failed setting up engine Lua state");
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -7023,11 +6954,11 @@ int32_t engineInit(void)
|
|||
int32_t enginePostInit(void)
|
||||
{
|
||||
if (!(paletteloaded & PALETTE_MAIN))
|
||||
return engineFatalError("No palette found.");
|
||||
I_FatalError("No palette found.");
|
||||
if (!(paletteloaded & PALETTE_SHADE))
|
||||
return engineFatalError("No shade table found.");
|
||||
I_FatalError("No shade table found.");
|
||||
if (!(paletteloaded & PALETTE_TRANSLUC))
|
||||
return engineFatalError("No translucency table found.");
|
||||
I_FatalError("No translucency table found.");
|
||||
|
||||
palettePostLoadTables();
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ static FORCE_INLINE int32_t yax_isislandwall(int32_t line, int32_t cf) { return
|
|||
#ifdef YAX_DEBUG
|
||||
extern char m32_debugstr[64][128];
|
||||
extern int32_t m32_numdebuglines;
|
||||
# define yaxdebug(fmt, ...) do { if (m32_numdebuglines<64) Bsnprintf(m32_debugstr[m32_numdebuglines++], 128, fmt, ##__VA_ARGS__); } while (0)
|
||||
# define yaxdebug(fmt, ...) do { if (m32_numdebuglines<64) snprintf(m32_debugstr[m32_numdebuglines++], 128, fmt, ##__VA_ARGS__); } while (0)
|
||||
# define yaxprintf(fmt, ...) do { initprintf(fmt, ##__VA_ARGS__); } while (0)
|
||||
#else
|
||||
# define yaxdebug(fmt, ...)
|
||||
|
|
|
@ -47,7 +47,7 @@ static void G_AddDemo(const char* param)
|
|||
// -d<filename>:<num>[,<num>]
|
||||
// profiling options
|
||||
*(colon++) = 0;
|
||||
Bsscanf(colon, "%d,%d", &framespertic, &numrepeats);
|
||||
sscanf(colon, "%d,%d", &framespertic, &numrepeats);
|
||||
}
|
||||
|
||||
Demo_SetFirst(tempbuf);
|
||||
|
|
|
@ -375,7 +375,7 @@ static void Demo_DisplayProfStatus(void)
|
|||
lastpercent = percent;
|
||||
|
||||
videoClearScreen(0);
|
||||
Bsnprintf(buf, sizeof(buf), "timing... %d/%d game tics (%d %%)",
|
||||
snprintf(buf, sizeof(buf), "timing... %d/%d game tics (%d %%)",
|
||||
g_demo_cnt, g_demo_totalCnt, percent);
|
||||
gametext_center(60, buf);
|
||||
videoNextPage();
|
||||
|
|
|
@ -45,7 +45,7 @@ static void G_AddDemo(const char* param)
|
|||
// -d<filename>:<num>[,<num>]
|
||||
// profiling options
|
||||
*(colon++) = 0;
|
||||
Bsscanf(colon, "%d,%d", &framespertic, &numrepeats);
|
||||
sscanf(colon, "%d,%d", &framespertic, &numrepeats);
|
||||
}
|
||||
|
||||
Demo_SetFirst(tempbuf);
|
||||
|
|
|
@ -375,7 +375,7 @@ static void Demo_DisplayProfStatus(void)
|
|||
lastpercent = percent;
|
||||
|
||||
videoClearScreen(0);
|
||||
Bsnprintf(buf, sizeof(buf), "timing... %d/%d game tics (%d %%)",
|
||||
snprintf(buf, sizeof(buf), "timing... %d/%d game tics (%d %%)",
|
||||
g_demo_cnt, g_demo_totalCnt, percent);
|
||||
gametext_center(60, buf);
|
||||
videoNextPage();
|
||||
|
|
Loading…
Reference in a new issue