diff --git a/.travis.yml b/.travis.yml index e3545da10..871a5065d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,17 +21,10 @@ env: - MAKE_BUILD=make - MAKE_BUILD=debug -before_script: - - touch storm.dll - - touch diabloui.dll - script: - if [ $MAKE_BUILD = make ]; then make; fi - if [ $MAKE_BUILD = debug ]; then make debug; fi -after_script: - - make clean - stages: - Riivaaja - test @@ -39,15 +32,15 @@ stages: jobs: include: - stage: Riivaaja - name: "Build using Riivaaja (original toolset)" + name: "Diablo 1.09b: original toolchain" language: minimal sudo: required services: - docker addons: {} script: docker run -v $(pwd):/root/devilution diasurgical/riivaaja:stable - - stage: test - name: "Riivaaja: Calculate binary accuracy" + - stage: Riivaaja + name: "Diablo 1.09b: Calculate binary accuracy" language: minimal sudo: required services: @@ -63,10 +56,28 @@ jobs: 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 COPYPROT=1 diasurgical/riivaaja:stable + docker run -v $(pwd):/root/devilution -e MAKE_BUILD=pdb diasurgical/riivaaja:stable ./devilution-comparer generate-full Diablo.exe --no-mem-disp --truncate-to-original docker run -v $(pwd):/root/devilution diasurgical/riivaaja:stable ../status.sh - after_success: + .travis/are-we-d1-yet.sh "$(< accuracy.txt)" $DISCORD_WEBHOOK "Diablo 1.09b" + - stage: Riivaaja + name: "Spawn 1.09: Calculate binary accuracy" + language: minimal + sudo: required + services: + - docker + addons: {} + script: - | set -e - .travis/are-we-d1-yet.sh "$(< accuracy.txt)" $DISCORD_WEBHOOK + 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/shareware-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 SPAWN=1 diasurgical/riivaaja:stable + ./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" diff --git a/.travis/are-we-d1-yet.sh b/.travis/are-we-d1-yet.sh index d87a656ca..e2b38edbb 100755 --- a/.travis/are-we-d1-yet.sh +++ b/.travis/are-we-d1-yet.sh @@ -2,8 +2,11 @@ # based on https://github.com/k3rn31p4nic/travis-ci-discord-webhook -# Only run for commits/builds on master, not for PRs for now -if [[ "$TRAVIS_BRANCH" != "master" || $TRAVIS_PULL_REQUEST != "false" ]]; then +# Only run for commits/builds on master|hellfire, not for PRs for now +if [[ "$TRAVIS_BRANCH" != "master" && "$TRAVIS_BRANCH" != "hellfire" ]]; then + exit +fi +if [[ $TRAVIS_PULL_REQUEST != "false" ]]; then exit fi @@ -30,7 +33,7 @@ WEBHOOK_DATA='{ "avatar_url": "https://travis-ci.com/images/logos/TravisCI-Mascot-1.png", "embeds": [ { "author": { - "name": "Job #'"$TRAVIS_JOB_NUMBER"' (Build #'"$TRAVIS_BUILD_NUMBER"')", + "name": "'"$3"' #'"$TRAVIS_JOB_NUMBER"' (Build #'"$TRAVIS_BUILD_NUMBER"')", "url": "https://travis-ci.org/'"$TRAVIS_REPO_SLUG"'/builds/'"$TRAVIS_BUILD_ID"'", "icon_url": "https://travis-ci.com/images/logos/TravisCI-Mascot-1.png" }, diff --git a/MakefileVC b/MakefileVC index 5a2caa4e1..9c2998d88 100644 --- a/MakefileVC +++ b/MakefileVC @@ -1,6 +1,4 @@ -VC5_DIR ?= $(HOME)/DevStudio_5.10/VC - -# The $(VS6_DIR) directory is a copy of the "Microsoft Visual Studio" directory. +# The $(VC5_DIR)/.. and $(VS6_DIR) directories are copies "Microsoft Visual Studio". # # To get a working setup on Linux or other "portable" copies of VS, # the following DLLs have to be copied to the @@ -20,6 +18,9 @@ VC6_BIN_DIR = $(VC6_DIR)/Bin VC6_INC_DIR = $(VC6_DIR)/Include VC6_LIB_DIR = $(VC6_DIR)/Lib +VC5_DIR ?= $(HOME)/DevStudio_5.10/VC + +VC5_BIN_DIR = $(VC5_DIR)/bin VC5_LIB_DIR = $(VC5_DIR)/lib IDE_DIR ?= $(VS6_DIR)/Common/MSDev98 @@ -27,22 +28,18 @@ IDE_BIN_DIR = $(IDE_DIR)/bin ifeq ($(OS),Windows_NT) CL = $(VC6_BIN_DIR)/CL.EXE RC = $(IDE_BIN_DIR)/RC.EXE - VC5_LINK = $(VC5_DIR)/bin/link.exe + VC5_LINK = $(VC5_BIN_DIR)/link.exe VC6_LINK = $(VC6_BIN_DIR)/link.exe else CL = wine $(VC6_BIN_DIR)/CL.EXE RC = wine $(IDE_BIN_DIR)/RC.EXE - VC5_LINK = wine $(VC5_DIR)/bin/link.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 LINKFLAGS=/nologo /subsystem:windows /machine:I386 /incremental:no -ifeq ($(COPYPROT),1) - CFLAGS += /D "COPYPROT" -endif - ifeq ($(SPAWN),1) CFLAGS += /D "SPAWN" endif @@ -51,8 +48,8 @@ ifeq ($(MAKE_BUILD),pdb) VC_LINK = $(VC6_LINK) LINKFLAGS += /pdb:"Diablo.pdb" /LIBPATH:$(VC6_LIB_DIR) /debug else - VC_LINK=$(VC5_LINK) - LINKFLAGS+= /LIBPATH:$(VC5_LIB_DIR) + VC_LINK = $(VC5_LINK) + LINKFLAGS += /LIBPATH:$(VC5_LIB_DIR) endif all: Diablo.exe @@ -85,7 +82,7 @@ main_files: $(CL) $(CFLAGS) /Fo$@ $< diablo.res: Diablo.rc - $(RC) /i $(VC6_INC_DIR) /i $(VC6_DIR)/MFC/Include /l 0x409 /fo $@ $< + $(RC) /i $(VC6_INC_DIR) /l 0x409 /fo $@ $< clean: @$(RM) -v $(OBJS) diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 843687a92..9e15b6a64 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -487,25 +487,24 @@ void diablo_init_screen() BOOL diablo_find_window(LPCSTR lpClassName) { - HWND result; // eax - HWND v2; // esi - HWND v3; // eax - HWND v4; // edi - - result = FindWindow(lpClassName, 0); - v2 = result; - if (!result) - return 0; + HWND hWnd, active; + + hWnd = FindWindow(lpClassName, 0); + if (!hWnd) + return FALSE; + + active = GetLastActivePopup(hWnd); + if (active) + hWnd = active; - v3 = GetLastActivePopup(result); - if (v3) - v2 = v3; - v4 = GetTopWindow(v2); - if (!v4) - v4 = v2; - SetForegroundWindow(v2); - SetFocus(v4); - return 1; + active = GetTopWindow(hWnd); + if (!active) + active = hWnd; + + SetForegroundWindow(hWnd); + SetFocus(active); + + return TRUE; } void diablo_reload_process(HINSTANCE hInstance) diff --git a/Source/player.cpp b/Source/player.cpp index 7de84291d..0ea6a1915 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -320,34 +320,40 @@ void InitPlrGFXMem(int pnum) DWORD GetPlrGFXSize(char *szCel) { - char prefix[16]; - char pszName[256]; - HANDLE file; int c, a, w; - DWORD size, result; + DWORD dwSize, dwMaxSize; + HANDLE hsFile; + char pszName[256]; + char Type[16]; - size = 0; - result = 0; - a = 0; - w = 0; + dwMaxSize = 0; - for (c = 0; c < sizeof(ClassStrTbl) / sizeof(ClassStrTbl[0]); c++) { + for (c = 0; c < sizeof(ClassStrTbl) / sizeof(*ClassStrTbl); c++) { +#ifdef SPAWN + if (c != 0) + continue; +#endif for (a = 0; ArmourChar[a]; a++) { +#ifdef SPAWN + if (&ArmourChar[a] != &ArmourChar[0]) + break; +#endif for (w = 0; WepChar[w]; w++) { // BUGFIX loads non-existing animagions; DT is only for N, BT is only for U, D & H - sprintf(prefix, "%c%c%c", CharChar[c], ArmourChar[a], WepChar[w]); - sprintf(pszName, "PlrGFX\\%s\\%s\\%s%s.CL2", ClassStrTbl[c], prefix, prefix, szCel); - if (WOpenFile(pszName, &file, TRUE)) { - size = WGetFileSize(file, 0); - WCloseFile(file); - if (result <= size) { - result = size; + sprintf(Type, "%c%c%c", CharChar[c], ArmourChar[a], WepChar[w]); + sprintf(pszName, "PlrGFX\\%s\\%s\\%s%s.CL2", ClassStrTbl[c], Type, Type, szCel); + if (WOpenFile(pszName, &hsFile, TRUE)) { + /// ASSERT: assert(hsFile); + dwSize = WGetFileSize(hsFile, NULL); + WCloseFile(hsFile); + if (dwMaxSize <= dwSize) { + dwMaxSize = dwSize; } } } } } - return result; + return dwMaxSize; } void FreePlayerGFX(int pnum)