From 83e62ea8a1a669421dab2303186bce8ef25d8ccd Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Fri, 30 Aug 2019 09:55:44 +0200 Subject: [PATCH] [hellfire] Set up build intergration --- .travis.yml | 23 +++++++++++++++++++++++ MakefileVC | 28 ++++++++++++++++++++++++---- Source/control.cpp | 2 ++ Source/diablo.cpp | 2 ++ Source/msgcmd.cpp | 2 ++ Source/multi.cpp | 2 ++ defs.h | 2 +- 7 files changed, 56 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 871a5065d..517aa12df 100644 --- a/.travis.yml +++ b/.travis.yml @@ -81,3 +81,26 @@ jobs: ./devilution-comparer generate-full Diablo.exe --no-mem-disp --truncate-to-original docker run -v $(pwd):/root/devilution diasurgical/riivaaja:stable ../spawn-status.sh .travis/are-we-d1-yet.sh "$(< accuracy.txt)" $DISCORD_WEBHOOK "Spawn 1.09b" + - stage: Riivaaja + name: "Hellfire 1.01: Calculate binary accuracy" + language: minimal + sudo: required + services: + - docker + addons: {} + script: + - | + set -e + wget https://github.com/diasurgical/devilution-comparer/releases/download/v0.4.0/devilution-comparer-v0.4.0-x86_64-unknown-linux-gnu.tar.xz + tar xf devilution-comparer-v0.4.0-x86_64-unknown-linux-gnu.tar.xz + rm comparer-config.toml + wget https://raw.githubusercontent.com/diasurgical/devilution-comparer/master/hellfire-comparer-config.toml -O comparer-config.toml + echo '#!/bin/sh' | sudo tee /bin/wine + echo 'docker run -v $(pwd):/root/devilution --entrypoint "/usr/bin/wine" diasurgical/riivaaja:stable $(basename $1) $2 $3' | sudo tee --append /bin/wine + sudo chmod +x /bin/wine + docker run -v $(pwd):/root/devilution -e MAKE_BUILD=pdb -e HELLFIRE=1 diasurgical/riivaaja:stable + dd if=/dev/zero bs=1 count=3072 of=hellfire.exe + dd if=Diablo.exe >> hellfire.exe + ./devilution-comparer generate-full hellfire.exe --no-mem-disp --truncate-to-original + docker run -v $(pwd):/root/devilution diasurgical/riivaaja:stable ../hellfire-status.sh + .travis/are-we-d1-yet.sh "$(< accuracy.txt)" $DISCORD_WEBHOOK "Hellfire 1.01" diff --git a/MakefileVC b/MakefileVC index 9c2998d88..384d4bd41 100644 --- a/MakefileVC +++ b/MakefileVC @@ -21,32 +21,52 @@ VC6_LIB_DIR = $(VC6_DIR)/Lib VC5_DIR ?= $(HOME)/DevStudio_5.10/VC VC5_BIN_DIR = $(VC5_DIR)/bin +VC5_INC_DIR = $(VC5_DIR)/include VC5_LIB_DIR = $(VC5_DIR)/lib IDE_DIR ?= $(VS6_DIR)/Common/MSDev98 IDE_BIN_DIR = $(IDE_DIR)/bin ifeq ($(OS),Windows_NT) - CL = $(VC6_BIN_DIR)/CL.EXE + CL5 = $(VC5_BIN_DIR)/CL.EXE + CL6 = $(VC6_BIN_DIR)/CL.EXE RC = $(IDE_BIN_DIR)/RC.EXE VC5_LINK = $(VC5_BIN_DIR)/link.exe VC6_LINK = $(VC6_BIN_DIR)/link.exe else - CL = wine $(VC6_BIN_DIR)/CL.EXE + CL5 = wine $(VC5_BIN_DIR)/CL.EXE + CL6 = wine $(VC6_BIN_DIR)/CL.EXE RC = wine $(IDE_BIN_DIR)/RC.EXE VC5_LINK = wine $(VC5_BIN_DIR)/link.exe VC6_LINK = wine $(VC6_BIN_DIR)/link.exe endif -CFLAGS=/nologo /c /GX /W3 /O1 /I $(VC6_INC_DIR) /FD /Gr /MT /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fp"Diablo.pch" /YX /Gm /Zi /FAs +ifeq ($(HELLFIRE),1) + CL = $(CL5) + VC_INC_DIR = $(VC5_INC_DIR) +else + CL = $(CL6) + VC_INC_DIR = $(VC6_INC_DIR) +endif + +CFLAGS=/nologo /c /GX /W3 /O1 /I $(VC_INC_DIR) /FD /Gr /MT /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fp"Diablo.pch" /YX /Gm /Zi /FAs LINKFLAGS=/nologo /subsystem:windows /machine:I386 /incremental:no +ifeq ($(HELLFIRE),1) + CFLAGS += /D "HELLFIRE" +endif + ifeq ($(SPAWN),1) CFLAGS += /D "SPAWN" endif ifeq ($(MAKE_BUILD),pdb) +ifeq ($(HELLFIRE),1) + VC_LINK = $(VC5_LINK) + LINKFLAGS += /pdb:"hellfire.pdb" /LIBPATH:$(VC5_LIB_DIR) /debug +else VC_LINK = $(VC6_LINK) LINKFLAGS += /pdb:"Diablo.pdb" /LIBPATH:$(VC6_LIB_DIR) /debug +endif else VC_LINK = $(VC5_LINK) LINKFLAGS += /LIBPATH:$(VC5_LIB_DIR) @@ -82,7 +102,7 @@ main_files: $(CL) $(CFLAGS) /Fo$@ $< diablo.res: Diablo.rc - $(RC) /i $(VC6_INC_DIR) /l 0x409 /fo $@ $< + $(RC) /i $(VC_INC_DIR) /l 0x409 /fo $@ $< clean: @$(RM) -v $(OBJS) diff --git a/Source/control.cpp b/Source/control.cpp index a1277ca16..57d38af4f 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -2541,7 +2541,9 @@ void control_reset_talk_msg(char *msg) pmask |= 1 << i; } +#ifndef HELLFIRE if (!msgcmd_add_server_cmd_W(sgszTalkMsg)) +#endif NetSendCmdString(pmask, sgszTalkMsg); } diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 9e15b6a64..d2a7079bd 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -167,7 +167,9 @@ void run_game_loop(unsigned int uMsg) } multi_process_network_packets(); game_loop(gbGameLoopStartup); +#ifndef HELLFIRE msgcmd_send_chat(); +#endif gbGameLoopStartup = FALSE; DrawAndBlit(); } diff --git a/Source/msgcmd.cpp b/Source/msgcmd.cpp index 5122c2c16..48d6004bb 100644 --- a/Source/msgcmd.cpp +++ b/Source/msgcmd.cpp @@ -1,3 +1,4 @@ +#ifndef HELLFIRE #include // for placement new #include // for offsetof #include // for typeid @@ -76,3 +77,4 @@ void msgcmd_add_server_cmd(const char *command) memcpy(msg->command, command, len); } } +#endif diff --git a/Source/multi.cpp b/Source/multi.cpp index 113539136..f3bc1db6a 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -608,7 +608,9 @@ void NetClose() tmsg_cleanup(); multi_event_handler(FALSE); SNetLeaveGame(3); +#ifndef HELLFIRE msgcmd_cmd_cleanup(); +#endif if (gbMaxPlayers > 1) Sleep(2000); } diff --git a/defs.h b/defs.h index a3434292d..b7ef60ead 100644 --- a/defs.h +++ b/defs.h @@ -172,7 +172,7 @@ typedef void (*_PVFV)(void); #endif // To apply to certain functions which have local variables aligned by 1 for unknown yet reason -#ifdef _MSC_VER +#if (_MSC_VER == 1200) #define ALIGN_BY_1 __declspec(align(1)) #else #define ALIGN_BY_1