diff --git a/Makefile b/Makefile index a72b4bc4..61dc2237 100755 --- a/Makefile +++ b/Makefile @@ -84,6 +84,13 @@ endif # Detect the architecture ifeq ($(YQ2_OSTYPE), Windows) +ifdef MINGW_CHOST +ifeq ($(MINGW_CHOST), x86_64-w64-mingw32) +YQ2_ARCH ?= x86_64 +else # i686-w64-mingw32 +YQ2_ARCH ?= i386 +endif +else # windows, but MINGW_CHOST not defined ifdef PROCESSOR_ARCHITEW6432 # 64 bit Windows YQ2_ARCH ?= $(PROCESSOR_ARCHITEW6432) @@ -91,6 +98,7 @@ else # 32 bit Windows YQ2_ARCH ?= $(PROCESSOR_ARCHITECTURE) endif +endif # windows but MINGW_CHOST not defined else # Normalize some abiguous YQ2_ARCH strings YQ2_ARCH ?= $(shell uname -m | sed -e 's/i.86/i386/' -e 's/amd64/x86_64/' -e 's/^arm.*/arm/') @@ -196,13 +204,12 @@ endif # ---------- -# If we're building with gcc for i386 let's define -ffloat-store. -# This helps the old and crappy x87 FPU to produce correct values. -# Would be nice if Clang had something comparable. +# Using the default x87 float math on 32bit x86 causes rounding trouble +# -ffloat-store could work around that, but the better solution is to +# just enforce SSE - every x86 CPU since Pentium3 supports that +# and this should even improve the performance on old CPUs ifeq ($(YQ2_ARCH), i386) -ifeq ($(COMPILER), gcc) -override CFLAGS += -ffloat-store -endif +override CFLAGS += -msse -mfpmath=sse endif # Force SSE math on x86_64. All sane compilers should do this @@ -353,6 +360,7 @@ all: config client server game ref_gl1 ref_gl3 ref_soft ref_vk config: @echo "Build configuration" @echo "============================" + @echo "YQ2_ARCH = $(YQ2_ARCH) COMPILER = $(COMPILER)" @echo "WITH_CURL = $(WITH_CURL)" @echo "WITH_OPENAL = $(WITH_OPENAL)" @echo "WITH_REFVK = $(WITH_REFVK)" diff --git a/src/game/savegame/savegame.c b/src/game/savegame/savegame.c index 3889c93b..30d604e9 100644 --- a/src/game/savegame/savegame.c +++ b/src/game/savegame/savegame.c @@ -71,7 +71,7 @@ * load older savegames. This should be bumped if the files * in tables/ are changed, otherwise strange things may happen. */ -#define SAVEGAMEVER "YQ2-3" +#define SAVEGAMEVER "YQ2-4" #ifndef BUILD_DATE #define BUILD_DATE __DATE__ @@ -851,7 +851,35 @@ ReadGame(const char *filename) fread(str_os, sizeof(str_os), 1, f); fread(str_arch, sizeof(str_arch), 1, f); + // for several released versions (up to incl. 7.45), the official Win32 binaries + // accidentally had the YQ2ARCH "AMD64" instead of "i386" set due to a bug in the Makefile + // so add this workaround for savegames before version 4 (the version was bumped for this fix) + qboolean amd64quirk = false; +#if defined(_WIN32) && (defined(__i386__) || defined(_M_IX86)) + amd64quirk = (strcmp(str_arch, "AMD64") == 0); +#endif + if (!strcmp(str_ver, SAVEGAMEVER)) + { + save_ver = 4; + + if (strcmp(str_game, GAMEVERSION)) + { + fclose(f); + gi.error("Savegame from another game.so.\n"); + } + else if (strcmp(str_os, YQ2OSTYPE)) + { + fclose(f); + gi.error("Savegame from another os.\n"); + } + else if (strcmp(str_arch, YQ2ARCH)) + { + fclose(f); + gi.error("Savegame from another architecture.\n"); + } + } + else if (!strcmp(str_ver, "YQ2-3")) { save_ver = 3; @@ -865,7 +893,7 @@ ReadGame(const char *filename) fclose(f); gi.error("Savegame from another os.\n"); } - else if (strcmp(str_arch, YQ2ARCH)) + else if (strcmp(str_arch, YQ2ARCH) && !amd64quirk) { fclose(f); gi.error("Savegame from another architecture.\n"); @@ -885,7 +913,7 @@ ReadGame(const char *filename) fclose(f); gi.error("Savegame from another os.\n"); } - else if (strcmp(str_arch, YQ2ARCH)) + else if (strcmp(str_arch, YQ2ARCH) && !amd64quirk) { fclose(f); gi.error("Savegame from another architecture.\n");