This commit is contained in:
Rachael Alexanderson 2021-01-29 22:52:33 -05:00
commit b9e37ff0f4
8 changed files with 22 additions and 24 deletions

View file

@ -48,20 +48,15 @@ THIS SOFTWARE.
* compiling to deal with, which means we can't run the generation * compiling to deal with, which means we can't run the generation
* program on the target. * program on the target.
*/ */
#if defined(__x86_64__) #if defined(__x86_64__) || defined(__arm64__)
#define IEEE_8087 #define IEEE_8087
#define Arith_Kind_ASL 1 #define Arith_Kind_ASL 1
#define Long int #define Long int
#define Intcast (int)(long) #define Intcast (int)(long)
#define Double_Align #define Double_Align
#define X64_bit_pointers #define X64_bit_pointers
#elif defined(__i386__)
#define IEEE_8087
#define Arith_Kind_ASL 1
#else #else
#define IEEE_MC68k #error Unsupported architecture
#define Arith_Kind_ASL 2
#define Double_Align
#endif #endif
#else #else
#include "arith.h" #include "arith.h"

View file

@ -202,7 +202,7 @@ THIS SOFTWARE.
* all ia32 compilers had phased out extended precision. * all ia32 compilers had phased out extended precision.
*/ */
#elif defined(__APPLE__) #elif defined(__APPLE__)
#if defined(__x86_64__) || defined(__i386__) #if defined(__x86_64__) || defined(__arm64__)
#define f_QNAN 0xffc00000 #define f_QNAN 0xffc00000
#define d_QNAN0 0x0 #define d_QNAN0 0x0
#define d_QNAN1 0xfff80000 #define d_QNAN1 0xfff80000
@ -216,18 +216,7 @@ THIS SOFTWARE.
#define ldus_QNAN3 0xc000 #define ldus_QNAN3 0xc000
#define ldus_QNAN4 0xffff #define ldus_QNAN4 0xffff
#else #else
#define f_QNAN 0xffc00000 #error Unsupported architecture
#define d_QNAN0 0xfff80000
#define d_QNAN1 0x0
#define ld_QNAN0 0xfff80000
#define ld_QNAN1 0x0
#define ld_QNAN2 0x0
#define ld_QNAN3 0x0
#define ldus_QNAN0 0xfff8
#define ldus_QNAN1 0x0
#define ldus_QNAN2 0x0
#define ldus_QNAN3 0x0
#define ldus_QNAN4 0x0
#endif #endif
#else #else
#include "gd_qnan.h" #include "gd_qnan.h"

View file

@ -41,7 +41,7 @@ public:
int Explode(unsigned char *out, unsigned int outsize, FileReader &in, unsigned int insize, int flags); int Explode(unsigned char *out, unsigned int outsize, FileReader &in, unsigned int insize, int flags);
}; };
class CExplosionError : CRecoverableError class CExplosionError : public CRecoverableError
{ {
public: public:
CExplosionError(const char *message) : CRecoverableError(message) {} CExplosionError(const char *message) : CRecoverableError(message) {}

View file

@ -837,6 +837,7 @@ void FileSystem::InitHashChains (void)
{ {
unsigned int i, j; unsigned int i, j;
NumEntries = FileInfo.Size();
Hashes.Resize(8 * NumEntries); Hashes.Resize(8 * NumEntries);
// Mark all buckets as empty // Mark all buckets as empty
memset(Hashes.Data(), -1, Hashes.Size() * sizeof(Hashes[0])); memset(Hashes.Data(), -1, Hashes.Size() * sizeof(Hashes[0]));
@ -1522,10 +1523,11 @@ const char *FileSystem::GetResourceFileFullName (int rfnum) const noexcept
bool FileSystem::CreatePathlessCopy(const char *name, int id, int /*flags*/) bool FileSystem::CreatePathlessCopy(const char *name, int id, int /*flags*/)
{ {
FString name2, type2, path; FString name2=name, type2, path;
// The old code said 'filename' and ignored the path, this looked like a bug. // The old code said 'filename' and ignored the path, this looked like a bug.
auto lump = FindFile(name); FixPathSeperator(name2);
auto lump = FindFile(name2);
if (lump < 0) return false; // Does not exist. if (lump < 0) return false; // Does not exist.
auto oldlump = FileInfo[lump]; auto oldlump = FileInfo[lump];

View file

@ -312,6 +312,7 @@ bool FHardwareTexture::BindOrCreate(FTexture *tex, int texunit, int clampmode, i
{ {
glTextureBytes = 1; glTextureBytes = 1;
forcenofilter = true; forcenofilter = true;
needmipmap = false;
} }
int w = 0, h = 0; int w = 0, h = 0;

View file

@ -99,5 +99,7 @@ inline void fillshort(void* buff, size_t count, uint16_t clear)
} }
} }
template<typename T> inline constexpr T Sgn(const T& val) { return (val > 0) - (val < 0); }
#endif #endif

View file

@ -7,8 +7,11 @@
__forceinline constexpr int32_t MulScale(int32_t a, int32_t b, int32_t shift) { return (int32_t)(((int64_t)a * b) >> shift); } __forceinline constexpr int32_t MulScale(int32_t a, int32_t b, int32_t shift) { return (int32_t)(((int64_t)a * b) >> shift); }
__forceinline constexpr double MulScaleF(double a, double b, int32_t shift) { return (a * b) * (1. / (uint32_t(1) << shift)); }
__forceinline constexpr int32_t DMulScale(int32_t a, int32_t b, int32_t c, int32_t d, int32_t shift) { return (int32_t)(((int64_t)a * b + (int64_t)c * d) >> shift); } __forceinline constexpr int32_t DMulScale(int32_t a, int32_t b, int32_t c, int32_t d, int32_t shift) { return (int32_t)(((int64_t)a * b + (int64_t)c * d) >> shift); }
__forceinline constexpr int32_t TMulScale(int32_t a, int32_t b, int32_t c, int32_t d, int32_t e, int32_t f, int32_t shift) { return (int32_t)(((int64_t)a * b + (int64_t)c * d + (int64_t)e * f) >> shift); }
__forceinline constexpr int32_t DivScale(int32_t a, int32_t b, int shift) { return (int32_t)(((int64_t)a << shift) / b); } __forceinline constexpr int32_t DivScale(int32_t a, int32_t b, int shift) { return (int32_t)(((int64_t)a << shift) / b); }
__forceinline constexpr int64_t DivScaleL(int64_t a, int64_t b, int shift) { return ((a << shift) / b); }
#include "xs_Float.h" #include "xs_Float.h"

View file

@ -746,6 +746,11 @@ bool MapLoader::LoadExtendedNodes (FileReader &dalump, uint32_t id)
catch (const CRecoverableError& err) catch (const CRecoverableError& err)
{ {
Printf("Error loading nodes: %s.\n", err.what()); Printf("Error loading nodes: %s.\n", err.what());
ForceNodeBuild = true;
Level->subsectors.Clear();
Level->segs.Clear();
Level->nodes.Clear();
return false; return false;
} }
} }
@ -758,7 +763,8 @@ bool MapLoader::LoadExtendedNodes (FileReader &dalump, uint32_t id)
catch (CRecoverableError &error) catch (CRecoverableError &error)
{ {
Printf("Error loading nodes: %s\n", error.GetMessage()); Printf("Error loading nodes: %s\n", error.GetMessage());
ForceNodeBuild = true;
Level->subsectors.Clear(); Level->subsectors.Clear();
Level->segs.Clear(); Level->segs.Clear();
Level->nodes.Clear(); Level->nodes.Clear();