From 291099751e8482decfd1623ed105f22711806547 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 6 Mar 2017 09:51:50 +0200 Subject: [PATCH 1/7] Added basic AppVeyor configuration Things to do: dependencies for sound backends and Windows XP support --- .appveyor.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 000000000..508746db6 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,23 @@ +version: "{build}" + +os: Visual Studio 2015 + +platform: + - Win32 + - x64 + +configuration: + - Debug + - Release + +before_build: + - cmd: md build + - cmd: cd build + - cmd: if "%platform%"=="Win32" set CMAKE_GENERATOR_NAME=Visual Studio 14 2015 + - cmd: if "%platform%"=="x64" set CMAKE_GENERATOR_NAME=Visual Studio 14 2015 Win64 + - cmd: cmake -G "%CMAKE_GENERATOR_NAME%" -DCMAKE_BUILD_TYPE=%configuration% .. + +build: + project: build\GZDoom.sln + parallel: true + verbosity: minimal From f28bdf12a07a7bd86d74e2c7db1fce98fee8e472 Mon Sep 17 00:00:00 2001 From: ZZYZX Date: Mon, 6 Mar 2017 06:29:30 +0200 Subject: [PATCH 2/7] StaticEventHandler.InputProcess should not alter playsim directly --- wadsrc/static/zscript/events.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/zscript/events.txt b/wadsrc/static/zscript/events.txt index e1c2b485a..c6c01c54f 100755 --- a/wadsrc/static/zscript/events.txt +++ b/wadsrc/static/zscript/events.txt @@ -318,7 +318,7 @@ class StaticEventHandler : Object native play version("2.4") // virtual native ui bool UiProcess(UiEvent e); - virtual native bool InputProcess(InputEvent e); + virtual native ui bool InputProcess(InputEvent e); // virtual native ui void ConsoleProcess(ConsoleEvent e); From 4eb9f662cbdab3211885d131725c5ee36f0791b9 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 6 Mar 2017 10:30:35 +0200 Subject: [PATCH 3/7] Fixed compilation with Clang src/scripting/backend/codegen.cpp:8568:10: error: cannot initialize return object of type 'FxExpression *' with an rvalue of type 'bool' --- src/scripting/backend/codegen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index 06f8757c3..3c3240ac0 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -8565,7 +8565,7 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx) if (!CheckAccessibility(ctx.Version)) { delete this; - return false; + return nullptr; } // This should never happen. if (Self == nullptr && (Function->Variants[0].Flags & VARF_Method)) From f4b0435e66451baf43603d9b7076d8f16128f70e Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 6 Mar 2017 10:20:10 +0200 Subject: [PATCH 4/7] Added basic Travis CI configuration Build with GCC 5.4 and Clang 3.9 on Ubuntu Linux and Clang from Xcode 8.2 on Apple's macOS Build with all dependencies except FMOD --- .travis.yml | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..61a770769 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,73 @@ +language: c++ +dist: trusty +sudo: required + +matrix: + include: + - os: osx + osx_image: xcode8.2 + env: + - CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Debug -DCMAKE_OSX_DEPLOYMENT_TARGET=10.7" + + - os: osx + osx_image: xcode8.2 + env: + - CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_DEPLOYMENT_TARGET=10.7 -DFORCE_INTERNAL_ZLIB=YES -DFORCE_INTERNAL_JPEG=YES -DFORCE_INTERNAL_BZIP2=YES -DFORCE_INTERNAL_GME=YES" + + - os: linux + compiler: gcc + env: + - GCC_VERSION=5 + - CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release" + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - kubuntu-backports + packages: + - g++-5 + - libsdl2-dev + - libgme-dev + - libopenal-dev + - libmpg123-dev + - libsndfile-dev + - libfluidsynth-dev + - libgtk-3-dev + + - os: linux + compiler: clang + env: + - CLANG_VERSION=3.9 + - CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=RelWithDebInfo -DDYN_OPENAL=NO -DDYN_FLUIDSYNTH=NO" + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - llvm-toolchain-trusty-3.9 + - kubuntu-backports + packages: + - clang-3.9 + - libstdc++-5-dev + - libsdl2-dev + - libgme-dev + - libopenal-dev + - libmpg123-dev + - libsndfile-dev + - libfluidsynth-dev + - libgtk-3-dev + +before_install: + - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; brew install mpg123 libsndfile fluidsynth; fi + - if [ -n "$GCC_VERSION" ]; then export CC="gcc-${GCC_VERSION}" CXX="g++-${GCC_VERSION}"; fi + - if [ -n "$CLANG_VERSION" ]; then export CC="clang-${CLANG_VERSION}" CXX="clang++-${CLANG_VERSION}"; fi + - $CC --version + - $CXX --version + +script: + - mkdir build + - cd build + - cmake ${CMAKE_OPTIONS} .. + - make -j2 + +notifications: + email: false From 21ecd714ec0e21d4abedbaa5a5548a3041ec5f4a Mon Sep 17 00:00:00 2001 From: ZZYZX Date: Mon, 6 Mar 2017 11:25:30 +0200 Subject: [PATCH 5/7] Added a way to tell apart console-executed events from code-executed SendNetworkEvent --- src/d_net.cpp | 5 +++-- src/events.cpp | 19 ++++++++++++------- src/events.h | 9 ++++++--- wadsrc/static/zscript/events.txt | 3 +++ 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/d_net.cpp b/src/d_net.cpp index 6ba77bc2a..f9bd55d88 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -2676,7 +2676,8 @@ void Net_DoCommand (int type, BYTE **stream, int player) int arg[3] = { 0, 0, 0 }; for (int i = 0; i < 3; i++) arg[i] = ReadLong(stream); - E_Console(player, s, arg[0], arg[1], arg[2]); + bool manual = ReadByte(stream); + E_Console(player, s, arg[0], arg[1], arg[2], manual); } break; @@ -2727,7 +2728,7 @@ void Net_SkipCommand (int type, BYTE **stream) break; case DEM_NETEVENT: - skip = strlen((char *)(*stream)) + 14; + skip = strlen((char *)(*stream)) + 15; break; case DEM_SUMMON2: diff --git a/src/events.cpp b/src/events.cpp index 9946a1059..08e4b328d 100755 --- a/src/events.cpp +++ b/src/events.cpp @@ -117,7 +117,7 @@ bool E_UnregisterHandler(DStaticEventHandler* handler) return true; } -bool E_SendNetworkEvent(FString name, int arg1, int arg2, int arg3) +bool E_SendNetworkEvent(FString name, int arg1, int arg2, int arg3, bool manual) { if (gamestate != GS_LEVEL) return false; @@ -128,6 +128,7 @@ bool E_SendNetworkEvent(FString name, int arg1, int arg2, int arg3) Net_WriteLong(arg1); Net_WriteLong(arg2); Net_WriteLong(arg3); + Net_WriteByte(manual); return true; } @@ -433,10 +434,10 @@ bool E_Responder(event_t* ev) return false; } -void E_Console(int player, FString name, int arg1, int arg2, int arg3) +void E_Console(int player, FString name, int arg1, int arg2, int arg3, bool manual) { for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next) - handler->ConsoleProcess(player, name, arg1, arg2, arg3); + handler->ConsoleProcess(player, name, arg1, arg2, arg3, manual); } bool E_CheckUiProcessors() @@ -523,6 +524,7 @@ DEFINE_FIELD_X(InputEvent, DInputEvent, MouseY); DEFINE_FIELD_X(ConsoleEvent, DConsoleEvent, Player) DEFINE_FIELD_X(ConsoleEvent, DConsoleEvent, Name) DEFINE_FIELD_X(ConsoleEvent, DConsoleEvent, Args) +DEFINE_FIELD_X(ConsoleEvent, DConsoleEvent, IsManual) DEFINE_ACTION_FUNCTION(DStaticEventHandler, SetOrder) { @@ -545,7 +547,7 @@ DEFINE_ACTION_FUNCTION(DEventHandler, SendNetworkEvent) PARAM_INT(arg3); // - ACTION_RETURN_BOOL(E_SendNetworkEvent(name, arg1, arg2, arg3)); + ACTION_RETURN_BOOL(E_SendNetworkEvent(name, arg1, arg2, arg3, false)); } DEFINE_ACTION_FUNCTION(DEventHandler, Create) @@ -1091,10 +1093,11 @@ static DConsoleEvent* E_SetupConsoleEvent() e->Name = ""; for (size_t i = 0; i < countof(e->Args); i++) e->Args[i] = 0; + e->IsManual = false; return e; } -void DStaticEventHandler::ConsoleProcess(int player, FString name, int arg1, int arg2, int arg3) +void DStaticEventHandler::ConsoleProcess(int player, FString name, int arg1, int arg2, int arg3, bool manual) { if (player < 0) { @@ -1111,6 +1114,7 @@ void DStaticEventHandler::ConsoleProcess(int player, FString name, int arg1, int e->Args[0] = arg1; e->Args[1] = arg2; e->Args[2] = arg3; + e->IsManual = manual; VMValue params[2] = { (DStaticEventHandler*)this, e }; GlobalVMStack.Call(func, params, 2, nullptr, 0, nullptr); @@ -1131,6 +1135,7 @@ void DStaticEventHandler::ConsoleProcess(int player, FString name, int arg1, int e->Args[0] = arg1; e->Args[1] = arg2; e->Args[2] = arg3; + e->IsManual = manual; VMValue params[2] = { (DStaticEventHandler*)this, e }; GlobalVMStack.Call(func, params, 2, nullptr, 0, nullptr); @@ -1162,7 +1167,7 @@ CCMD(event) for (int i = 0; i < argn; i++) arg[i] = atoi(argv[2 + i]); // call locally - E_Console(-1, argv[1], arg[0], arg[1], arg[2]); + E_Console(-1, argv[1], arg[0], arg[1], arg[2], true); } } @@ -1187,6 +1192,6 @@ CCMD(netevent) for (int i = 0; i < argn; i++) arg[i] = atoi(argv[2 + i]); // call networked - E_SendNetworkEvent(argv[1], arg[0], arg[1], arg[2]); + E_SendNetworkEvent(argv[1], arg[0], arg[1], arg[2], true); } } diff --git a/src/events.h b/src/events.h index b83890223..d41c2e26d 100755 --- a/src/events.h +++ b/src/events.h @@ -58,10 +58,10 @@ void E_PlayerDisconnected(int num); // this executes on events. bool E_Responder(event_t* ev); // splits events into InputProcess and UiProcess // this executes on console/net events. -void E_Console(int player, FString name, int arg1, int arg2, int arg3); +void E_Console(int player, FString name, int arg1, int arg2, int arg3, bool manual); // send networked event. unified function. -bool E_SendNetworkEvent(FString name, int arg1, int arg2, int arg3); +bool E_SendNetworkEvent(FString name, int arg1, int arg2, int arg3, bool manual); // check if there is anything that should receive GUI events bool E_CheckUiProcessors(); @@ -152,7 +152,7 @@ public: bool UiProcess(event_t* ev); // - void ConsoleProcess(int player, FString name, int arg1, int arg2, int arg3); + void ConsoleProcess(int player, FString name, int arg1, int arg2, int arg3, bool manual); }; class DEventHandler : public DStaticEventHandler { @@ -300,10 +300,13 @@ public: // FString Name; int Args[3]; + // + bool IsManual; DConsoleEvent() { Player = -1; + IsManual = false; } }; diff --git a/wadsrc/static/zscript/events.txt b/wadsrc/static/zscript/events.txt index c6c01c54f..d7e39e1c0 100755 --- a/wadsrc/static/zscript/events.txt +++ b/wadsrc/static/zscript/events.txt @@ -275,8 +275,11 @@ class ConsoleEvent : BaseEvent native version("2.4") // for net events, this will be the activator. // for UI events, this is always -1, and you need to check if level is loaded and use players[consoleplayer]. native readonly int Player; + // this is the name and args as specified in SendNetworkEvent or event/netevent CCMDs native readonly String Name; native readonly int Args[3]; + // this will be true if the event is fired from the console by event/netevent CCMD + native readonly bool IsManual; } class StaticEventHandler : Object native play version("2.4") From cf23deef746f0662dd3ae53bf67b21a9766d8412 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 6 Mar 2017 18:05:06 +0200 Subject: [PATCH 6/7] Fixed ssize_t type definition for mpg123 (affects MSVC x64 only) According to MinGW headers (which is used for compiling libmpg123) ssize_t type must be 64-bit in size on 64-bit Windows Moreover it was impossible to build GZDoom with the recent versions of libmpg123 because of wrong type redifinition Tested MP3 music on Deus Vult II with Release x64 and OpenAL backend --- src/sound/mpg123_decoder.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sound/mpg123_decoder.h b/src/sound/mpg123_decoder.h index 051473abb..59e1df2ca 100644 --- a/src/sound/mpg123_decoder.h +++ b/src/sound/mpg123_decoder.h @@ -6,7 +6,8 @@ #ifdef HAVE_MPG123 #ifdef _MSC_VER -typedef int ssize_t; +#include +typedef ptrdiff_t ssize_t; #endif #include "mpg123.h" From e111b0b92ea405428b07680b63e76b84c66e1655 Mon Sep 17 00:00:00 2001 From: Major Cooke Date: Mon, 6 Mar 2017 10:26:08 -0600 Subject: [PATCH 7/7] Fixed: Deprecated functions could not act because FxVMFunctionCall::CheckAccessibility returned false on warning. --- src/scripting/backend/codegen.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index 3c3240ac0..49aba7ec5 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -8516,7 +8516,6 @@ bool FxVMFunctionCall::CheckAccessibility(const VersionInfo &ver) if ((Function->Variants[0].Flags & VARF_Deprecated) && Function->mVersion >= ver) { ScriptPosition.Message(MSG_WARNING, "Accessing deprecated function %s - deprecated since %d.%d.%d", Function->SymbolName.GetChars(), Function->mVersion.major, Function->mVersion.minor, Function->mVersion.revision); - return false; } return true; }