From ae827dbd86b23c806864c85a759a08f03a4335ef Mon Sep 17 00:00:00 2001 From: David Carlier Date: Mon, 22 Jul 2024 21:44:06 +0100 Subject: [PATCH 1/2] client sound fade_data is only really used later. --- src/client/sound/sound.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/client/sound/sound.c b/src/client/sound/sound.c index 513c5bfa..79f88e65 100644 --- a/src/client/sound/sound.c +++ b/src/client/sound/sound.c @@ -385,7 +385,7 @@ S_GetStatistics(const byte *data, int sound_length, int width, int channels, // calculate attack/fade length byte *sound_data = (byte *)data; byte *delay_data = sound_data; - byte *fade_data = sound_data; + byte *fade_data; byte *sound_end = sound_data + sound_length; short sound_sample = 0; short sound_treshold = sound_max / 2; @@ -401,7 +401,6 @@ S_GetStatistics(const byte *data, int sound_length, int width, int channels, /* delay_data == (short *)(data + info.dataofs) */ *begin_length = (sound_data - delay_data) / channels; delay_data = sound_data; - fade_data = sound_data; /* attack calculate */ do From 180050b9a30d9dff7fdba17454509d1ecc2c4de0 Mon Sep 17 00:00:00 2001 From: Yamagi Date: Sun, 11 Aug 2024 13:03:12 +0200 Subject: [PATCH 2/2] Add Github Workflows to create test build for Linux, MacOS and Win32. This is should make testing for normal endusers easier by providing prebuild binaries for them. It also serves as a simple CI by compiling every commit and Pull Request for Linux, MacOS and Win32. And it saves time, because (Windows) test build must no longer created by hand. * Windows is build for Win32 only. We won't add a Win64, because there's no point in having a 64 bit Windows release and it would break most existing mods. Savegames are also not compatible between 32 and 64 but builds. * MacOS is build to get some test exposure and to publish up to date binaries to users. This doesn't mean that MacOS is now officially supported. It stays community supported. The binaries are untested, because I have no Mac. PRs are welcome. ;) * Linux is build with ubuntu-latest, which is the last LTS release. The binaries should work on most other distros. Windows includes all required dependencies. As a difference to release builds the curl.dll is taken from upstream and not a cut down custom build. MacOS and Linux do not ship the dependencies, users should install them through Brew or their distro. Github strips file permission when zipping the assets. A work around would be to create a tar archive and zip that, but that is ugly. I opted against it, users must mark the binaries executable by hand. These workflows trigger at each push to the master master branch and at each new or edited pull request. Special features like SDL3 are not supported at this time. --- .github/workflows/linux.yml | 59 ++++++++++++++++++++++++++ .github/workflows/macos.yml | 60 ++++++++++++++++++++++++++ .github/workflows/win32.yml | 84 +++++++++++++++++++++++++++++++++++++ 3 files changed, 203 insertions(+) create mode 100644 .github/workflows/linux.yml create mode 100644 .github/workflows/macos.yml create mode 100644 .github/workflows/win32.yml diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 00000000..d579bb17 --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,59 @@ +name: Testbuild for Linux +run-name: testbuild_linux +on: + push: + branches: + - 'master' + pull_request: + types: + - opened + - edited +concurrency: + # Cancel concurrent workflows for the same PR or commit hash. + group: ${{github.workflow}}-${{github.event_name == 'pull_request' && github.head_ref || github.sha}} + cancel-in-progress: true +jobs: + build_ubuntu_x64_64: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - env: ubuntu + steps: + - name: Install build dependencies + run: | + sudo apt update + sudo apt install libgl1-mesa-dev libsdl2-dev libopenal-dev libcurl4-openssl-dev + - name: Check out repository code + uses: actions/checkout@v4 + - name: Build + run: | + # Public runners come with 2 CPUs. + make -j2 + - name: Create testbuild package + run: | + # Create release directory tree + mkdir -p publish/quake2-linux-${{github.sha}}/misc/docs + # Copy release assets + cp -r release/* publish/quake2-linux-${{github.sha}}/ + # Copy misc assets + cp -r stuff/yq2.cfg publish/quake2-linux-${{github.sha}}/misc/yq2.cfg + cp -r stuff/mapfixes publish/quake2-linux-${{github.sha}}/misc + cp LICENSE publish/quake2-linux-${{github.sha}}/misc/docs/LICENSE.txt + cp README.md publish/quake2-linux-${{github.sha}}/misc/docs/README.txt + cp doc/010_index.md publish/quake2-linux-${{github.sha}}/misc/docs/010_index.txt + cp doc/020_installation.md publish/quake2-linux-${{github.sha}}/misc/docs/020_installation.txt + cp doc/030_configuration.md publish/quake2-linux-${{github.sha}}/misc/docs/030_configuration.txt + cp doc/040_cvarlist.md publish/quake2-linux-${{github.sha}}/misc/docs/040_cvarlist.txt + cp doc/050_commands.md publish/quake2-linux-${{github.sha}}/misc/docs/050_commands.txt + cp doc/060_multiplayer.md publish/quake2-linux-${{github.sha}}/misc/docs/060_multiplayer.txt + cp doc/070_packaging.md publish/quake2-linux-${{github.sha}}/misc/docs/070_packaging.txt + cp doc/080_contributing.md publish/quake2-linux-${{github.sha}}/misc/docs/080_contributing.txt + cp doc/090_filelists.md publish/quake2-linux-${{github.sha}}/misc/docs/090_filelists.md + - name: Upload testbuild package + uses: actions/upload-artifact@v4 + with: + name: quake2-linux-${{github.sha}} + path: publish/ + if-no-files-found: error diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 00000000..95b92194 --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,60 @@ +name: Testbuild for MacOS +run-name: testbuild_macos +on: + push: + branches: + - 'master' + pull_request: + types: + - opened + - edited +concurrency: + # Cancel concurrent workflows for the same PR or commit hash. + group: ${{github.workflow}}-${{github.event_name == 'pull_request' && github.head_ref || github.sha}} + cancel-in-progress: true +jobs: + build_macos_aarch64: + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + include: + - env: macos + steps: + - name: Install build dependencies + run: | + brew update + brew install sdl2 openal-soft make + brew upgrade + - name: Check out repository code + uses: actions/checkout@v4 + - name: Build + run: | + # Public runners come with 3 CPUs. + gmake -j3 + - name: Create testbuild package + run: | + # Create release directory tree + mkdir -p publish/quake2-macos-${{github.sha}}/misc/docs + # Copy release assets + cp -r release/* publish/quake2-macos-${{github.sha}}/ + # Copy misc assets + cp -r stuff/yq2.cfg publish/quake2-macos-${{github.sha}}/misc/yq2.cfg + cp -r stuff/mapfixes publish/quake2-macos-${{github.sha}}/misc + cp LICENSE publish/quake2-macos-${{github.sha}}/misc/docs/LICENSE.txt + cp README.md publish/quake2-macos-${{github.sha}}/misc/docs/README.txt + cp doc/010_index.md publish/quake2-macos-${{github.sha}}/misc/docs/010_index.txt + cp doc/020_installation.md publish/quake2-macos-${{github.sha}}/misc/docs/020_installation.txt + cp doc/030_configuration.md publish/quake2-macos-${{github.sha}}/misc/docs/030_configuration.txt + cp doc/040_cvarlist.md publish/quake2-macos-${{github.sha}}/misc/docs/040_cvarlist.txt + cp doc/050_commands.md publish/quake2-macos-${{github.sha}}/misc/docs/050_commands.txt + cp doc/060_multiplayer.md publish/quake2-macos-${{github.sha}}/misc/docs/060_multiplayer.txt + cp doc/070_packaging.md publish/quake2-macos-${{github.sha}}/misc/docs/070_packaging.txt + cp doc/080_contributing.md publish/quake2-macos-${{github.sha}}/misc/docs/080_contributing.txt + cp doc/090_filelists.md publish/quake2-macos-${{github.sha}}/misc/docs/090_filelists.md + - name: Upload testbuild package + uses: actions/upload-artifact@v4 + with: + name: quake2-macos-${{github.sha}} + path: publish/ + if-no-files-found: error diff --git a/.github/workflows/win32.yml b/.github/workflows/win32.yml new file mode 100644 index 00000000..613c35ce --- /dev/null +++ b/.github/workflows/win32.yml @@ -0,0 +1,84 @@ +name: Testbuild for Win32 +run-name: testbuild_win32 +on: + push: + branches: + - 'master' + pull_request: + types: + - opened + - edited +concurrency: + # Cancel concurrent workflows for the same PR or commit hash. + group: ${{github.workflow}}-${{github.event_name == 'pull_request' && github.head_ref || github.sha}} + cancel-in-progress: true +jobs: + build_mingw_x86_32: + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + include: + - { sys: mingw32, env: i686 } + steps: + - uses: msys2/setup-msys2@v2 + with: + msystem: ${{matrix.sys}} + update: true + install: >- + git + make + zip + unzip + mingw-w64-${{matrix.env}}-curl + mingw-w64-${{matrix.env}}-gcc + mingw-w64-${{matrix.env}}-make + mingw-w64-${{matrix.env}}-openal + mingw-w64-${{matrix.env}}-SDL2 + mingw-w64-${{matrix.env}}-wget + - name: Check out repository code + uses: actions/checkout@v4 + - name: Build + shell: msys2 {0} + run: | + # Public runners come with 2 CPUs. + make -j2 + - name: Create testbuild package + shell: msys2 {0} + run: | + # Create release directory tree + mkdir -p publish/quake2-win32-${{github.sha}}/misc/docs + # Copy release assets + cp -r release/* publish/quake2-win32-${{github.sha}}/ + # Copy misc assets + cp -r stuff/yq2.cfg publish/quake2-win32-${{github.sha}}/misc/yq2.cfg + cp -r stuff/mapfixes publish/quake2-win32-${{github.sha}}/misc + cp LICENSE publish/quake2-win32-${{github.sha}}/misc/docs/LICENSE.txt + cp README.md publish/quake2-win32-${{github.sha}}/misc/docs/README.txt + cp doc/010_index.md publish/quake2-win32-${{github.sha}}/misc/docs/010_index.txt + cp doc/020_installation.md publish/quake2-win32-${{github.sha}}/misc/docs/020_installation.txt + cp doc/030_configuration.md publish/quake2-win32-${{github.sha}}/misc/docs/030_configuration.txt + cp doc/040_cvarlist.md publish/quake2-win32-${{github.sha}}/misc/docs/040_cvarlist.txt + cp doc/050_commands.md publish/quake2-win32-${{github.sha}}/misc/docs/050_commands.txt + cp doc/060_multiplayer.md publish/quake2-win32-${{github.sha}}/misc/docs/060_multiplayer.txt + cp doc/070_packaging.md publish/quake2-win32-${{github.sha}}/misc/docs/070_packaging.txt + cp doc/080_contributing.md publish/quake2-win32-${{github.sha}}/misc/docs/080_contributing.txt + cp doc/090_filelists.md publish/quake2-win32-${{github.sha}}/misc/docs/090_filelists.md + # SDL2 + wget -c https://github.com/libsdl-org/SDL/releases/download/release-2.30.6/SDL2-2.30.6-win32-x86.zip + unzip -o SDL2-2.30.6-win32-x86.zip + cp SDL2.dll publish/quake2-win32-${{github.sha}}/ + # openal-soft + wget -c https://www.openal-soft.org/openal-binaries/openal-soft-1.23.1-bin.zip + unzip -o openal-soft-1.23.1-bin.zip + cp openal-soft-1.23.1-bin/bin/Win32/soft_oal.dll publish/quake2-win32-${{github.sha}}/openal32.dll + # curl (releases use a custom build curl.dll) + wget -c https://curl.se/windows/dl-8.9.1_1/curl-8.9.1_1-win32-mingw.zip + unzip -o curl-8.9.1_1-win32-mingw.zip + cp curl-8.9.1_1-win32-mingw/bin/libcurl.dll publish/quake2-win32-${{github.sha}}/curl.dll + - name: Upload testbuild package + uses: actions/upload-artifact@v4 + with: + name: quake2-win32-${{github.sha}} + path: publish/ + if-no-files-found: error