From 1b74c5ff46438e8d363011019da5d9e6e58ee801 Mon Sep 17 00:00:00 2001 From: Stephen G Date: Thu, 18 Apr 2024 11:39:21 -0700 Subject: [PATCH 01/32] build system refactors, improvements --- .github/workflows/Windows-CI.yml | 44 +++++++++---------- engine/CMakePresets.json | 17 ++++--- .../custom-triplets/x64-windows-win10.cmake | 6 +++ engine/vcpkg-configuration.json | 6 +-- engine/vcpkg.json | 4 +- script/bootstrap.ps1 | 14 +++--- 6 files changed, 50 insertions(+), 41 deletions(-) create mode 100644 engine/custom-triplets/x64-windows-win10.cmake diff --git a/.github/workflows/Windows-CI.yml b/.github/workflows/Windows-CI.yml index 5292514802..95c4385fb8 100644 --- a/.github/workflows/Windows-CI.yml +++ b/.github/workflows/Windows-CI.yml @@ -35,8 +35,8 @@ jobs: VCPKG_ROOT: '${{ github.workspace }}/v' # Tells vcpkg where binary packages are stored. VCPKG_DEFAULT_BINARY_CACHE: '${{ github.workspace }}/vbincache' - ## Let's use GitHub Action cache as storage for the vcpkg Binary Caching feature. - #VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite' + # Let's use GitHub Action cache as storage for the vcpkg Binary Caching feature. + VCPKG_BINARY_SOURCES: 'x-gha,readwrite' VCPKG_DEFAULT_TRIPLET: x64-windows VCPKG_DEFAULT_HOST_TRIPLET: x64-windows PYTHONHOME: '${{ github.workspace }}/v/packages/python3_x64-windows/tools/python3' @@ -60,31 +60,31 @@ jobs: shell: bash - name: install-cmake - uses: lukka/get-cmake@359fbae4b163fa01633e6de228fa7f2a31ab1fc7 #v3.26.1 + uses: lukka/get-cmake@4931ab1fc1604964c055eb330edb3f6b26ba0cfa #v3.29.2 with: - cmakeVersion: 3.26.1 + cmakeVersion: 3.29.2 ninjaVersion: 1.11.1 - # # Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg's binary caching - # # when it is being run afterward by CMake. - # - name: restore-vcpkg - # uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 #v3.3.1 - # with: - # # The first path is the location of vcpkg: it contains the vcpkg executable and data files, as long as the - # # built package archives (aka binary cache) which are located by VCPKG_DEFAULT_BINARY_CACHE env var. - # # The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages. - # path: | - # ${{ env.VCPKG_ROOT }} - # !${{ env.VCPKG_ROOT }}/buildtrees - # !${{ env.VCPKG_ROOT }}/packages - # !${{ env.VCPKG_ROOT }}/downloads - # !${{ env.VCPKG_ROOT }}/installed - # # The key is composed in a way that it gets properly invalidated whenever a different version of vcpkg is being used. - # key: | - # ${{ hashFiles( '.git/modules/vcpkg/HEAD' )}} + # Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg's binary caching + # when it is being run afterward by CMake. + - name: restore-vcpkg + uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 #v3.3.1 + with: + # The first path is the location of vcpkg: it contains the vcpkg executable and data files, as long as the + # built package archives (aka binary cache) which are located by VCPKG_DEFAULT_BINARY_CACHE env var. + # The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages. + path: | + ${{ env.VCPKG_ROOT }} + !${{ env.VCPKG_ROOT }}/buildtrees + !${{ env.VCPKG_ROOT }}/packages + !${{ env.VCPKG_ROOT }}/downloads + !${{ env.VCPKG_ROOT }}/installed + # The key is composed in a way that it gets properly invalidated whenever a different version of vcpkg is being used. + key: | + ${{ hashFiles( '.git/modules/vcpkg/HEAD' )}} - name: install-vcpkg - #if: steps.cache.outputs.cache-hit != 'true' + if: steps.cache.outputs.cache-hit != 'true' run: | git clone https://github.com/vegastrike/vcpkg-local.git ${{ env.VCPKG_ROOT }} ${{ env.VCPKG_ROOT }}\bootstrap-vcpkg.bat -disableMetrics diff --git a/engine/CMakePresets.json b/engine/CMakePresets.json index 50944c6d30..546555ffa7 100644 --- a/engine/CMakePresets.json +++ b/engine/CMakePresets.json @@ -279,12 +279,17 @@ "displayName": "Windows Default", "description": "Default build for Windows", "environment": { - "VCPKG_DEFAULT_TRIPLET": "x64-windows", - "VCPKG_DEFAULT_HOST_TRIPLET": "x64-windows", - "VCPKG_TARGET_TRIPLET": "x64-windows", - "VCPKG_HOST_TRIPLET": "x64-windows" + "VCPKG_TARGET_TRIPLET": "x64-windows-win10", + "VCPKG_HOST_TRIPLET": "x64-windows-win10" + }, + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": { + "value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "type": "FILEPATH" + }, + "VCPKG_TARGET_TRIPLET": "x64-windows-win10", + "VCPKG_HOST_TRIPLET": "x64-windows-win10" }, - "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", "debug": { "output": true, "find": true @@ -326,7 +331,7 @@ "hidden": true, "inherits": "windows-default", "displayName": "Ninja on Windows", - "generator": "Ninja", + "generator": "Ninja Multi-Config", "condition": { "type": "equals", "lhs": "${hostSystemName}", diff --git a/engine/custom-triplets/x64-windows-win10.cmake b/engine/custom-triplets/x64-windows-win10.cmake new file mode 100644 index 0000000000..86fcd42071 --- /dev/null +++ b/engine/custom-triplets/x64-windows-win10.cmake @@ -0,0 +1,6 @@ +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic) + +set(VCPKG_C_FLAGS "${VCPKG_C_FLAGS} /DBOOST_ALL_DYN_LINK /DBOOST_USE_WINAPI_VERSION=0x0A00 /D_WIN32_WINNT=0x0A00 /DWINVER=0x0A00") +set(VCPKG_CXX_FLAGS "${VCPKG_CXX_FLAGS} /DBOOST_ALL_DYN_LINK /DBOOST_USE_WINAPI_VERSION=0x0A00 /D_WIN32_WINNT=0x0A00 /DWINVER=0x0A00") diff --git a/engine/vcpkg-configuration.json b/engine/vcpkg-configuration.json index 81539fafef..fce0cec112 100644 --- a/engine/vcpkg-configuration.json +++ b/engine/vcpkg-configuration.json @@ -1,8 +1,4 @@ { "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg-configuration.schema.json", - "default-registry": { - "kind": "git", - "baseline": "45c660987c371515ddcc5c355e7989c0d652b85f", - "repository": "https://github.com/vegastrike/vcpkg-local" - } + "overlay-triplets": [ "./custom-triplets" ] } diff --git a/engine/vcpkg.json b/engine/vcpkg.json index 3f98a5b5c4..d1e6597b2e 100644 --- a/engine/vcpkg.json +++ b/engine/vcpkg.json @@ -2,6 +2,7 @@ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "vega-strike", "version-string": "0.9.0", + "builtin-baseline": "a34c873a9717a888f58dc05268dea15592c2f0ff", "dependencies": [ "boost-python", "boost-log", @@ -13,6 +14,8 @@ "boost-chrono", "boost-atomic", "boost-assign", + "boost-format", + "egl-registry", "expat", "freeglut", "libpng", @@ -20,7 +23,6 @@ "libvorbis", "openal-soft", "opengl", - "opengl-registry", "openssl", "sdl1", "sdl2", diff --git a/script/bootstrap.ps1 b/script/bootstrap.ps1 index 2e9409a6a7..0fee8c53f2 100644 --- a/script/bootstrap.ps1 +++ b/script/bootstrap.ps1 @@ -26,18 +26,18 @@ param( [String]$VCPKG_PARENT_DIR = "C:\Projects" ) -Set-Variable -Name CMAKE_VERSION -Value "3.26.1" +Set-Variable -Name CMAKE_VERSION -Value "3.28" -New-Item "$VCKPG_PARENT_DIR" -ItemType Directory -Force -Push-Location "$VCKPG_PARENT_DIR" +New-Item "$VCPKG_PARENT_DIR" -ItemType Directory -Force +Push-Location "$VCPKG_PARENT_DIR" git clone https://github.com/vegastrike/vcpkg-local.git ./v .\v\bootstrap-vcpkg.bat -disableMetrics -[Environment]::SetEnvironmentVariable('VCPKG_ROOT', "$VCKPG_PARENT_DIR\v", 'User') -$env:VCPKG_ROOT = "$VCKPG_PARENT_DIR\v" +[Environment]::SetEnvironmentVariable('VCPKG_ROOT', "$VCPKG_PARENT_DIR\v", 'User') +$env:VCPKG_ROOT = "$VCPKG_PARENT_DIR\v" $path = [Environment]::GetEnvironmentVariable('PATH', 'User') -$newPath = $path + ";$VCKPG_PARENT_DIR\v\downloads\tools\cmake-$CMAKE_VERSION-windows\cmake-$CMAKE_VERSION-windows-i386\bin" +$newPath = $path + ";$VCPKG_PARENT_DIR\v\downloads\tools\cmake-$CMAKE_VERSION-windows\cmake-$CMAKE_VERSION-windows-i386\bin" [Environment]::SetEnvironmentVariable('PATH', $newPath, 'User') $env:PATH = $newPath @@ -47,7 +47,7 @@ $env:VCPKG_DEFAULT_TRIPLET = $triplet [Environment]::SetEnvironmentVariable('VCPKG_DEFAULT_HOST_TRIPLET', $triplet, 'User') $env:VCPKG_DEFAULT_HOST_TRIPLET = $triplet -$pythonHome = "$VCKPG_PARENT_DIR\v\packages\python3_x64-windows\tools\python3" +$pythonHome = "$VCPKG_PARENT_DIR\v\packages\python3_x64-windows\tools\python3" [Environment]::SetEnvironmentVariable('PYTHONHOME', $pythonHome, 'User') $env:PYTHONHOME = $pythonHome From 9607bfab830039c8db0fc76868ff584873982738 Mon Sep 17 00:00:00 2001 From: Stephen G Date: Thu, 18 Apr 2024 11:40:24 -0700 Subject: [PATCH 02/32] 3 C++ source files: fix some errors, bugs --- engine/src/audio/Exceptions.h | 14 ++++++-------- engine/src/gfx/mesh_gfx.cpp | 1 + engine/src/vs_logging.h | 20 ++++++++++---------- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/engine/src/audio/Exceptions.h b/engine/src/audio/Exceptions.h index 60e627ee24..7350925261 100644 --- a/engine/src/audio/Exceptions.h +++ b/engine/src/audio/Exceptions.h @@ -1,10 +1,8 @@ -/** +/* * Exceptions.h * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike - * contributors - * Copyright (C) 2022-2023 Stephen G. Tuggy, Benjamen R. Meyer + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -17,11 +15,11 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ #ifndef VEGA_STRIKE_ENGINE_AUDIO_EXCEPTIONS_H #define VEGA_STRIKE_ENGINE_AUDIO_EXCEPTIONS_H @@ -140,7 +138,7 @@ class EndOfStreamException : public Exception { class CorruptStreamException : public Exception { bool fatal; public: - CorruptStreamException(const CorruptStreamException &other) : Exception(other) { + CorruptStreamException(const CorruptStreamException &other) : Exception(other), fatal(true) { } explicit CorruptStreamException(bool _fatal) diff --git a/engine/src/gfx/mesh_gfx.cpp b/engine/src/gfx/mesh_gfx.cpp index 91f2d7c4b1..7e784982ab 100644 --- a/engine/src/gfx/mesh_gfx.cpp +++ b/engine/src/gfx/mesh_gfx.cpp @@ -458,6 +458,7 @@ Mesh::~Mesh() { resetIter = true; cachedHashItem = hashItem + 1; } + //delete hashItem; hashers->erase(hashItem); if (hashers->empty()) { bfxmHashTable.Delete(hash_name); diff --git a/engine/src/vs_logging.h b/engine/src/vs_logging.h index d37bf2c971..f61fc00c04 100644 --- a/engine/src/vs_logging.h +++ b/engine/src/vs_logging.h @@ -24,16 +24,16 @@ #include -#include -#include -#include -//#include -#include -#include -#include -#include -#include -#include +#include "boost/move/utility_core.hpp" +#include "boost/smart_ptr/shared_ptr.hpp" +#include "boost/format.hpp" +//#include "boost/log/sources/logger.hpp" +#include "boost/log/sources/severity_logger.hpp" +#include "boost/log/sources/record_ostream.hpp" +#include "boost/log/sinks/sync_frontend.hpp" +#include "boost/log/sinks/text_file_backend.hpp" +#include "boost/log/sinks/text_ostream_backend.hpp" +#include "boost/filesystem.hpp" namespace VegaStrikeLogging { From 2c033d6e8382593a3060c125ddd99d65112d4583 Mon Sep 17 00:00:00 2001 From: Stephen G Date: Fri, 19 Apr 2024 17:59:11 -0700 Subject: [PATCH 03/32] Some logging refactoring, plus some work on the subscript-out-of-range crash that has been occurring in GFXDeleteTexture(int handle) --- engine/src/audio/test.cpp | 6 +- engine/src/cmd/basecomputer.cpp | 8 ++- engine/src/cmd/script/director.cpp | 5 +- engine/src/exit_unit_tests.cpp | 6 +- engine/src/gamemenu.cpp | 8 ++- engine/src/gfx/aux_texture.cpp | 16 ++++-- engine/src/gfx/particle.cpp | 12 ++-- engine/src/gfx/sprite.h | 12 ++-- engine/src/gldrv/gl_texture.cpp | 28 ++++++---- engine/src/in_kb.h | 10 +++- engine/src/main.cpp | 12 ++-- engine/src/python/init.cpp | 7 +-- engine/src/savegame.cpp | 5 +- engine/src/star_system.cpp | 6 +- engine/src/vega_py_run.cpp | 3 +- engine/src/vs_logging.cpp | 90 ++++++++++++++++++++++-------- engine/src/vs_logging.h | 51 ++++++++++++----- 17 files changed, 182 insertions(+), 103 deletions(-) diff --git a/engine/src/audio/test.cpp b/engine/src/audio/test.cpp index cc977cd719..09e6be4eb5 100644 --- a/engine/src/audio/test.cpp +++ b/engine/src/audio/test.cpp @@ -1,7 +1,7 @@ /* * test.cpp * - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -15,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -665,7 +665,7 @@ void closeRenderer() { } void VSExit(int code) { - VegaStrikeLogging::vega_logger()->FlushLogs(); + VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogsProgramExiting(); exit(code); } diff --git a/engine/src/cmd/basecomputer.cpp b/engine/src/cmd/basecomputer.cpp index 63f243cf58..84165c80e7 100644 --- a/engine/src/cmd/basecomputer.cpp +++ b/engine/src/cmd/basecomputer.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, Mike Byron, pyramid3d, Stephen G. Tuggy, + * basecomputer.cpp + * + * Copyright (C) 2001-2024 Daniel Horn, Mike Byron, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -13,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -4273,7 +4275,7 @@ void trackPrice(int whichplayer, const Cargo &item, float price, const string &s } } - VegaStrikeLogging::vega_logger()->FlushLogs(); + VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogs(); highest.clear(); highest.resize(recordedHighestPrices.size()); diff --git a/engine/src/cmd/script/director.cpp b/engine/src/cmd/script/director.cpp index f6112ed566..c6a7fad89b 100644 --- a/engine/src/cmd/script/director.cpp +++ b/engine/src/cmd/script/director.cpp @@ -1,7 +1,7 @@ /* * director.cpp * - * Copyright (C) 2001-2023 Daniel Horn, Alexander Rawass, pyramid3d, + * Copyright (C) 2001-2024 Daniel Horn, Alexander Rawass, pyramid3d, * Stephen G. Tuggy, and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -10,7 +10,7 @@ * * Vega Strike is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Vega Strike is distributed in the hope that it will be useful, @@ -94,7 +94,6 @@ void Mission::DirectorLoop() { VS_LOG_AND_FLUSH(fatal, "void Mission::DirectorLoop(): Python error occurred"); PyErr_Print(); PyErr_Clear(); - VegaStrikeLogging::vega_logger()->FlushLogs(); } throw; } diff --git a/engine/src/exit_unit_tests.cpp b/engine/src/exit_unit_tests.cpp index 2636b5cc23..02ce37a4aa 100644 --- a/engine/src/exit_unit_tests.cpp +++ b/engine/src/exit_unit_tests.cpp @@ -3,7 +3,7 @@ * * Implementation of VSExit for unit tests * - * Copyright (C) 2001-2022 Daniel Horn, Stephen G. Tuggy, + * Copyright (C) 2001-2024 Daniel Horn, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -17,7 +17,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -29,6 +29,6 @@ #include "vs_logging.h" void VSExit(int code) { - VegaStrikeLogging::vega_logger()->FlushLogs(); + VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogsProgramExiting(); exit(code); } diff --git a/engine/src/gamemenu.cpp b/engine/src/gamemenu.cpp index 7e43380187..ab983edaec 100644 --- a/engine/src/gamemenu.cpp +++ b/engine/src/gamemenu.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * gamemenu.cpp + * + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -13,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -459,7 +461,7 @@ bool GameMenu::processMainMenuButton(const EventCommandId &command, Control *con } bool GameMenu::processExitGameButton(const EventCommandId &command, Control *control) { - VegaStrikeLogging::vega_logger()->FlushLogs(); + VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogsProgramExiting(); winsys_exit(0); return true; } diff --git a/engine/src/gfx/aux_texture.cpp b/engine/src/gfx/aux_texture.cpp index b53da486cc..be788cd04d 100644 --- a/engine/src/gfx/aux_texture.cpp +++ b/engine/src/gfx/aux_texture.cpp @@ -1,10 +1,8 @@ -/** +/* * aux_texture.cpp * - * Copyright (C) 2001-2002 Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, Roy Falk, - * and other Vega Strike contributors - * Copyright (C) 2021-2022 Stephen G. Tuggy + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Roy Falk, and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -558,7 +556,13 @@ Texture::~Texture() { } else { original->refcount--; if (original->refcount == 0) { - delete original; + if (original == this) { + VS_LOG(debug, "In Texture::~Texture() in aux_texture.cpp: original->refcount == 0, but original == this, so not deleting again. (We are already in the destructor.)"); + } else { + VS_LOG(trace, "In Texture::~Texture() in aux_texture.cpp: original->refcount == 0, and original != this, so deleting original"); + delete original; + original = nullptr; + } } } } diff --git a/engine/src/gfx/particle.cpp b/engine/src/gfx/particle.cpp index 019f011fce..7760c7ac5b 100644 --- a/engine/src/gfx/particle.cpp +++ b/engine/src/gfx/particle.cpp @@ -1,7 +1,7 @@ /* * particle.cpp * - * Copyright (c) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Copyright (c) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike Contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -10,16 +10,16 @@ * * Vega Strike is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ @@ -311,7 +311,7 @@ void ParticleTrail::DrawAndUpdate() { } particleVert.clear(); - particleVert.reserve(particles.size() * (3 + 4)); + particleVert.reserve(particles.size() * (static_cast(3) + 4)); std::back_insert_iterator > v(particleVert); for (size_t i = 0; i < nparticles; ++i) { const QVector &loc = particles[i].location; @@ -395,7 +395,7 @@ void ParticleTrail::DrawAndUpdate() { } particleVert.clear(); - particleVert.reserve(nparticles * vertsPerParticle * (3 + 4 + 2)); + particleVert.reserve(nparticles * vertsPerParticle * (static_cast(3 + 4) + 2)); std::back_insert_iterator > v(particleVert); for (size_t i = 0; i < nparticles; ++i) { SetQuadVertex(particles[i].location, particles[i].color, particles[i].size, pgrow, ptrans, v, kCameraPosition); diff --git a/engine/src/gfx/sprite.h b/engine/src/gfx/sprite.h index 150ec7b166..bf8db8dee1 100644 --- a/engine/src/gfx/sprite.h +++ b/engine/src/gfx/sprite.h @@ -1,5 +1,7 @@ -/* - * Copyright (C) 2001-2023 Daniel Horn, Alan Shieh, klaussfreire, +/* + * sprite.h + * + * Copyright (C) 2001-2024 Daniel Horn, Alan Shieh, klaussfreire, * surfdargent, dan_w, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, * and other Vega Strike contributors. * @@ -14,12 +16,14 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Vega Strike. If not, see . */ + + #ifndef VEGA_STRIKE_ENGINE_GFX_SPRITE_H #define VEGA_STRIKE_ENGINE_GFX_SPRITE_H @@ -47,7 +51,7 @@ class VSSprite { bool isAnimation; //For private use only - VSSprite() : surface(0) { + VSSprite() : surface(nullptr), isAnimation(false), rotation(0.0F), maxs(0.0F), maxt(0.0F), heighto2(0.0F), widtho2(0.0F), xcenter(0.0F), ycenter(0.0F) { } public: diff --git a/engine/src/gldrv/gl_texture.cpp b/engine/src/gldrv/gl_texture.cpp index fec050b630..abd11fab78 100644 --- a/engine/src/gldrv/gl_texture.cpp +++ b/engine/src/gldrv/gl_texture.cpp @@ -1,7 +1,7 @@ /* * gl_texture.cpp * - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -15,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -463,8 +463,8 @@ static void DownSampleTexture(unsigned char **newbuf, amask >>= 1, tshift++, hshift++; } int tmask = (1 << tshift) - 1; - *newbuf = (unsigned char *) malloc(newheight * newwidth * pixsize * sizeof(unsigned char)); - unsigned int temp[32 * 4]; + *newbuf = (unsigned char*)malloc(static_cast(newheight) * newwidth * pixsize * sizeof(unsigned char)); + unsigned int temp[32 * 4]{}; unsigned char *orow = (*newbuf); const unsigned char *irow = oldbuf; for (i = 0; i < newheight; i++, orow += ostride, irow += rowstride) { @@ -510,7 +510,7 @@ static void DownSampleTexture(unsigned char **newbuf, //Specific purpose downsampler: 2x2 averaging //a) Very little overhead //b) Very common case (mipmap generation) - *newbuf = (unsigned char *) malloc(newheight * newwidth * pixsize * sizeof(unsigned char)); + *newbuf = (unsigned char*)malloc(static_cast(newheight) * newwidth * pixsize * sizeof(unsigned char)); unsigned char *orow = (*newbuf); int ostride = newwidth * pixsize; int istride = width * pixsize; @@ -1093,11 +1093,18 @@ GFXBOOL /*GFXDRVAPI*/ GFXTransferTexture(unsigned char *buffer, } void /*GFXDRVAPI*/ GFXDeleteTexture(int handle) { + if (handle < 0) { + VS_LOG(error, (boost::format("GFXDeleteTexture(int handle) called with invalid, negative handle value %1%") % handle)); + return; + } else if (handle >= textures.size()) { + VS_LOG(error, (boost::format("GFXDeleteTexture(int handle) called with invalid handle value %1%, which is greater than textures.size(): %2%") % handle % textures.size())); + return; + } if (textures[handle].alive) { - glDeleteTextures(1, &textures[handle].name); - for (size_t i = 0; i < sizeof(activetexture) / sizeof(int); ++i) { - if (activetexture[i] == handle) { - activetexture[i] = -1; + glDeleteTextures(1, &textures[handle].name); // Is this correct? - SGT 2024-04-18 + for (int & each_texture : activetexture) { + if (each_texture == handle) { + each_texture = -1; } } } @@ -1110,7 +1117,7 @@ void /*GFXDRVAPI*/ GFXDeleteTexture(int handle) { void GFXInitTextureManager() { for (size_t handle = 0; handle < textures.size(); ++handle) { - textures[handle].palette = NULL; + textures[handle].palette = nullptr; textures[handle].width = textures[handle].height = textures[handle].iwidth = textures[handle].iheight = 0; textures[handle].texturestage = 0; textures[handle].name = 0; @@ -1123,6 +1130,7 @@ void GFXInitTextureManager() { } void GFXDestroyAllTextures() { + // TODO: There's got to be a more efficient way to do this -- SGT 2024-04-18 for (size_t handle = 0; handle < textures.size(); handle++) { GFXDeleteTexture(handle); } diff --git a/engine/src/in_kb.h b/engine/src/in_kb.h index 5899fbb3e6..4c4c419eff 100644 --- a/engine/src/in_kb.h +++ b/engine/src/in_kb.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, + * in_kb.h + * + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -13,12 +15,14 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Vega Strike. If not, see . */ + + #ifndef VEGA_STRIKE_ENGINE_IN_KB_H #define VEGA_STRIKE_ENGINE_IN_KB_H @@ -42,7 +46,7 @@ static void DefaultKBHandler(const KBData &, KBSTATE newState) // FIXME ? struct HandlerCall { KBHandler function; KBData data; - KBSTATE state; + KBSTATE state{ KBSTATE::RESET }; // This variable was uninitialized. Is this a good initial value for it? HandlerCall() { function = DefaultKBHandler; diff --git a/engine/src/main.cpp b/engine/src/main.cpp index 12b96fd2f3..2eab4b6dbb 100644 --- a/engine/src/main.cpp +++ b/engine/src/main.cpp @@ -1,8 +1,8 @@ /* * main.cpp * - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, - * and other Vega Strike contributors. + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -142,7 +142,7 @@ int readCommandLineOptions(int argc, char **argv); // FIXME: Code should throw exception instead of calling winsys_exit // Should it really? - stephengtuggy 2020-10-25 void VSExit(int code) { Music::CleanupMuzak(); - VegaStrikeLogging::vega_logger()->FlushLogs(); + VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogsProgramExiting(); winsys_exit(code); } @@ -151,7 +151,7 @@ void cleanup(void) { // stephengtuggy 2020-10-30: Output message both to the console and to the logs printf("Thank you for playing!\n"); VS_LOG(info, "Thank you for playing!"); - VegaStrikeLogging::vega_logger()->FlushLogs(); + VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogsProgramExiting(); if (_Universe != NULL) { _Universe->WriteSaveGame(true); } @@ -330,7 +330,7 @@ int main(int argc, char *argv[]) { home_subdir_path = home_path; } - VegaStrikeLogging::vega_logger()->InitLoggingPart2(g_game.vsdebug, home_subdir_path); + VegaStrikeLogging::VegaStrikeLogger::instance().InitLoggingPart2(g_game.vsdebug, home_subdir_path); // can use the vegastrike config variable to read in the default mission if (game_options()->force_client_connect) { @@ -400,8 +400,6 @@ int main(int argc, char *argv[]) { delete _Universe; CleanupUnitTables(); - // Just to be sure -- stephengtuggy 2020-07-27 - VegaStrikeLogging::vega_logger()->FlushLogs(); return 0; } diff --git a/engine/src/python/init.cpp b/engine/src/python/init.cpp index 1f8965406b..29d28b9794 100644 --- a/engine/src/python/init.cpp +++ b/engine/src/python/init.cpp @@ -1,7 +1,7 @@ /* * init.cpp * - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -15,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -121,7 +121,6 @@ void Python::reseterrors() { VS_LOG_AND_FLUSH(error, "void Python::reseterrors(): Python error occurred"); PyErr_Print(); PyErr_Clear(); - VegaStrikeLogging::vega_logger()->FlushLogs(); } } @@ -242,7 +241,7 @@ void Python::test() { //vs_config->setVariable("data","test","NULL"); //VSFileSystem::vs_fprintf(stdout, "%s", vs_config->getVariable("data","test", string()).c_str()); //VSFileSystem::vs_fprintf(stdout, "output %s\n", PythonIOString::buffer.str()); - VegaStrikeLogging::vega_logger()->FlushLogs(); + VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogs(); } #endif diff --git a/engine/src/savegame.cpp b/engine/src/savegame.cpp index 9c433a10c7..268d40e284 100644 --- a/engine/src/savegame.cpp +++ b/engine/src/savegame.cpp @@ -1,8 +1,8 @@ /* * savegame.cpp * - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, - * and other Vega Strike contributors. + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Roy Falk, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -879,7 +879,6 @@ void SaveGame::LoadSavedMissions() { VS_LOG_AND_FLUSH(error, "void SaveGame::LoadSavedMissions(): Python error occurred"); PyErr_Print(); PyErr_Clear(); - VegaStrikeLogging::vega_logger()->FlushLogs(); } else { throw; } diff --git a/engine/src/star_system.cpp b/engine/src/star_system.cpp index 48dad075a2..7bd4fbe8c5 100644 --- a/engine/src/star_system.cpp +++ b/engine/src/star_system.cpp @@ -1,7 +1,7 @@ /* * star_system.cpp * - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -15,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -684,7 +684,6 @@ void StarSystem::ExecuteUnitAI() { VS_LOG_AND_FLUSH(fatal, "void StarSystem::ExecuteUnitAI(): Python error occurred"); PyErr_Print(); PyErr_Clear(); - VegaStrikeLogging::vega_logger()->FlushLogs(); } throw; } @@ -928,7 +927,6 @@ void StarSystem::UpdateUnitsPhysics(bool firstframe) { "void StarSystem::UpdateUnitPhysics( bool firstframe ): Msg D: Python error occurred"); PyErr_Print(); PyErr_Clear(); - VegaStrikeLogging::vega_logger()->FlushLogs(); } throw; } diff --git a/engine/src/vega_py_run.cpp b/engine/src/vega_py_run.cpp index 15bf11415f..cf5114361f 100644 --- a/engine/src/vega_py_run.cpp +++ b/engine/src/vega_py_run.cpp @@ -1,7 +1,7 @@ /* * vega_py_run.cpp * - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -49,7 +49,6 @@ void VegaPyRunString(char *py_snippet) { VS_LOG_AND_FLUSH(error, "VegaPyRunString: Python error occurred"); PyErr_Print(); PyErr_Clear(); - VegaStrikeLogging::vega_logger()->FlushLogs(); } //#endif } diff --git a/engine/src/vs_logging.cpp b/engine/src/vs_logging.cpp index 0bae2e555d..eab4b6be4a 100644 --- a/engine/src/vs_logging.cpp +++ b/engine/src/vs_logging.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2021-2022 Daniel Horn, Stephen G. Tuggy and + * vs_logging.cpp + * + * Copyright (C) 2001-2024 Daniel Horn, Stephen G. Tuggy and * other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -13,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -32,7 +34,7 @@ #include #include #include -//#include +#include #include #include #include @@ -45,7 +47,7 @@ namespace VegaStrikeLogging { // void exitProgram(int code) // { // Music::CleanupMuzak(); -// VegaStrikeLogging::vega_logger()->FlushLogs(); +// VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogs(); // winsys_exit(code); // } @@ -72,7 +74,7 @@ void VegaStrikeLogger::InitLoggingPart2(const uint8_t debug_level, break; } - file_log_sink_ = boost::log::add_file_log + boost::shared_ptr file_log_back_end_ = boost::make_shared ( boost::log::keywords::file_name = logging_dir_name + "/" + "vegastrike_%Y-%m-%d_%H_%M_%S.%f.log", /*< file name pattern >*/ @@ -83,53 +85,80 @@ void VegaStrikeLogger::InitLoggingPart2(const uint8_t debug_level, boost::log::keywords::format = "[%TimeStamp%]: %Message%", /*< log record format >*/ boost::log::keywords::auto_flush = - true, /*false,*/ /*< whether to auto flush to the file after every line >*/ + false, /*true,*/ /*< whether to auto flush to the file after every line >*/ boost::log::keywords::min_free_space = 2UL * 1024UL * 1024UL * 1024UL /*< stop boost::log when there's only 2 GiB free space left >*/ ); + file_log_sink_ = boost::make_shared(file_log_back_end_, boost::null_deleter()); + logging_core_->add_sink(file_log_sink_); console_log_sink_->set_filter(severity >= fatal); } void VegaStrikeLogger::FlushLogs() { if (console_log_sink_) { + console_log_sink_->feed_records(); console_log_sink_->flush(); } if (file_log_sink_) { + file_log_sink_->feed_records(); file_log_sink_->flush(); } - fflush(stdout); - fflush(stderr); + std::cout << std::flush; + std::cerr << std::flush; + std::clog << std::flush; } -VegaStrikeLogger::VegaStrikeLogger() { +void VegaStrikeLogger::FlushLogsProgramExiting() { + if (console_log_sink_) { + logging_core_->remove_sink(console_log_sink_); + console_log_sink_->stop(); + console_log_sink_->feed_records(); + console_log_sink_->flush(); + } + if (file_log_sink_) { + logging_core_->remove_sink(file_log_sink_); + file_log_sink_->stop(); + file_log_sink_->feed_records(); + file_log_sink_->flush(); + } + + console_log_sink_.reset(); + file_log_sink_.reset(); + + std::cout << std::flush; + std::cerr << std::flush; + std::clog << std::flush; +} + +VegaStrikeLogger::VegaStrikeLogger() : slg_(), file_log_sink_(nullptr) { logging_core_ = boost::log::core::get(); boost::log::add_common_attributes(); - slg_ = boost::make_shared>(); - console_log_sink_ = boost::log::add_console_log + boost::shared_ptr console_log_back_end_ = boost::make_shared ( - std::cerr, + boost::shared_ptr(&std::cerr, boost::null_deleter()), boost::log::keywords::format = "%Message%", /*< log record format specific to the console >*/ boost::log::keywords::auto_flush = - true /*false*/ /*< whether to do the equivalent of fflush(stdout) after every msg >*/ + false /*true*/ /*< whether to do the equivalent of fflush(stdout) after every msg >*/ ); - file_log_sink_ = nullptr; + console_log_sink_ = boost::make_shared(console_log_back_end_, boost::null_deleter()); + logging_core_->add_sink(console_log_sink_); } VegaStrikeLogger::~VegaStrikeLogger() { - FlushLogs(); + FlushLogsProgramExiting(); } void VegaStrikeLogger::Log(const vega_log_level level, const std::string &message) { - boost::log::record rec = slg_->open_record(boost::log::keywords::severity = level); + boost::log::record rec = slg_.open_record(boost::log::keywords::severity = level); if (rec) { boost::log::record_ostream strm(rec); strm << message; strm.flush(); - slg_->push_record(boost::move(rec)); + slg_.push_record(boost::move(rec)); } } @@ -138,14 +167,20 @@ void VegaStrikeLogger::LogAndFlush(const vega_log_level level, const std::string FlushLogs(); } +void VegaStrikeLogger::LogFlushExit(const vega_log_level level, const std::string& message, const int exit_code = -50) { + Log(level, message); + FlushLogsProgramExiting(); + exit(exit_code); +} + void VegaStrikeLogger::Log(const vega_log_level level, const char *message) { - boost::log::record rec = slg_->open_record(boost::log::keywords::severity = level); + boost::log::record rec = slg_.open_record(boost::log::keywords::severity = level); if (rec) { boost::log::record_ostream strm(rec); strm << message; strm.flush(); - slg_->push_record(boost::move(rec)); + slg_.push_record(boost::move(rec)); } } @@ -154,14 +189,20 @@ void VegaStrikeLogger::LogAndFlush(const vega_log_level level, const char *messa FlushLogs(); } +void VegaStrikeLogger::LogFlushExit(const vega_log_level level, const char* message, const int exit_code = -50) { + Log(level, message); + FlushLogsProgramExiting(); + exit(exit_code); +} + void VegaStrikeLogger::Log(const vega_log_level level, const boost::basic_format &message) { - boost::log::record rec = slg_->open_record(boost::log::keywords::severity = level); + boost::log::record rec = slg_.open_record(boost::log::keywords::severity = level); if (rec) { boost::log::record_ostream strm(rec); strm << message; strm.flush(); - slg_->push_record(boost::move(rec)); + slg_.push_record(boost::move(rec)); } } @@ -170,9 +211,10 @@ void VegaStrikeLogger::LogAndFlush(const vega_log_level level, const boost::basi FlushLogs(); } -boost::shared_ptr vega_logger() { - static const boost::shared_ptr VEGA_LOGGER = boost::make_shared(); - return VEGA_LOGGER; +void VegaStrikeLogger::LogFlushExit(const vega_log_level level, const boost::basic_format& message, const int exit_code = -50) { + Log(level, message); + FlushLogsProgramExiting(); + exit(exit_code); } } // namespace VegaStrikeLogging diff --git a/engine/src/vs_logging.h b/engine/src/vs_logging.h index f61fc00c04..fb1c38f70b 100644 --- a/engine/src/vs_logging.h +++ b/engine/src/vs_logging.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2021-2023 Daniel Horn, Stephen G. Tuggy, Benjamen R. Meyer, and + * vs_logging.h + * + * Copyright (C) 2021-2024 Daniel Horn, Stephen G. Tuggy, Benjamen R. Meyer, and * other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -13,12 +15,14 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Vega Strike. If not, see . */ + + #ifndef VEGA_STRIKE_ENGINE_VS_LOGGING_H #define VEGA_STRIKE_ENGINE_VS_LOGGING_H @@ -26,10 +30,12 @@ #include "boost/move/utility_core.hpp" #include "boost/smart_ptr/shared_ptr.hpp" +#include "boost/smart_ptr/make_shared_object.hpp" #include "boost/format.hpp" //#include "boost/log/sources/logger.hpp" #include "boost/log/sources/severity_logger.hpp" #include "boost/log/sources/record_ostream.hpp" +#include "boost/log/sinks/async_frontend.hpp" #include "boost/log/sinks/sync_frontend.hpp" #include "boost/log/sinks/text_file_backend.hpp" #include "boost/log/sinks/text_ostream_backend.hpp" @@ -50,39 +56,54 @@ enum vega_log_level { BOOST_LOG_ATTRIBUTE_KEYWORD(severity, "Severity", vega_log_level) -typedef boost::log::sinks::synchronous_sink ConsoleLogSink; -typedef boost::log::sinks::synchronous_sink FileLogSink; +typedef boost::log::sinks::text_ostream_backend ConsoleLogBackEnd; +typedef boost::log::sinks::text_file_backend FileLogBackEnd; +typedef boost::log::sinks::asynchronous_sink ConsoleLogSink; +typedef boost::log::sinks::asynchronous_sink FileLogSink; -#define VS_LOG(log_level, log_message) \ - do { \ - VegaStrikeLogging::vega_logger()->Log(VegaStrikeLogging::vega_log_level::log_level, (log_message)); \ +#define VS_LOG(log_level, log_message) \ + do { \ + VegaStrikeLogging::VegaStrikeLogger::instance().Log(VegaStrikeLogging::vega_log_level::log_level, (log_message)); \ } while (false) -#define VS_LOG_AND_FLUSH(log_level, log_message) \ - do { \ - VegaStrikeLogging::vega_logger()->LogAndFlush(VegaStrikeLogging::vega_log_level::log_level, (log_message)); \ +#define VS_LOG_AND_FLUSH(log_level, log_message) \ + do { \ + VegaStrikeLogging::VegaStrikeLogger::instance().LogAndFlush(VegaStrikeLogging::vega_log_level::log_level, (log_message)); \ } while (false) +//#define VS_LOG_FLUSH_EXIT(log_level, log_message) -class VegaStrikeLogger { +struct VegaStrikeLogger { private: boost::log::core_ptr logging_core_; - boost::shared_ptr> slg_; + boost::log::sources::severity_logger_mt slg_; boost::shared_ptr console_log_sink_; boost::shared_ptr file_log_sink_; -public: +private: VegaStrikeLogger(); ~VegaStrikeLogger(); + +public: + static VegaStrikeLogger& instance() { + static VegaStrikeLogger logger_instance; + return logger_instance; + } + void InitLoggingPart2(const uint8_t debug_level, const boost::filesystem::path &vega_strike_home_dir); void FlushLogs(); + void FlushLogsProgramExiting(); void Log(const vega_log_level level, const std::string& message); void Log(const vega_log_level level, const char * message); void Log(const vega_log_level level, const boost::basic_format& message); void LogAndFlush(const vega_log_level level, const std::string& message); + void LogFlushExit(const vega_log_level level, const std::string& message, const int exit_code); void LogAndFlush(const vega_log_level level, const char * message); + void LogFlushExit(const vega_log_level level, const char* message, const int exit_code); void LogAndFlush(const vega_log_level level, const boost::basic_format& message); -}; + void LogFlushExit(const vega_log_level level, const boost::basic_format& message, const int exit_code); -extern boost::shared_ptr vega_logger(); + VegaStrikeLogger(const VegaStrikeLogger &) = delete; + VegaStrikeLogger& operator = (const VegaStrikeLogger&) = delete; +}; } // namespace VegaStrikeLogging From b3d5ac985382c69008d6d76901267992f69f6701 Mon Sep 17 00:00:00 2001 From: Stephen G Date: Sun, 21 Apr 2024 13:15:54 -0700 Subject: [PATCH 04/32] vs_logging.cpp: Fix a couple of compiler errors --- engine/src/vs_logging.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/src/vs_logging.cpp b/engine/src/vs_logging.cpp index eab4b6be4a..87c95b3b9e 100644 --- a/engine/src/vs_logging.cpp +++ b/engine/src/vs_logging.cpp @@ -89,7 +89,7 @@ void VegaStrikeLogger::InitLoggingPart2(const uint8_t debug_level, boost::log::keywords::min_free_space = 2UL * 1024UL * 1024UL * 1024UL /*< stop boost::log when there's only 2 GiB free space left >*/ ); - file_log_sink_ = boost::make_shared(file_log_back_end_, boost::null_deleter()); + file_log_sink_ = boost::make_shared(file_log_back_end_); logging_core_->add_sink(file_log_sink_); console_log_sink_->set_filter(severity >= fatal); @@ -143,7 +143,7 @@ VegaStrikeLogger::VegaStrikeLogger() : slg_(), file_log_sink_(nullptr) { boost::log::keywords::auto_flush = false /*true*/ /*< whether to do the equivalent of fflush(stdout) after every msg >*/ ); - console_log_sink_ = boost::make_shared(console_log_back_end_, boost::null_deleter()); + console_log_sink_ = boost::make_shared(console_log_back_end_); logging_core_->add_sink(console_log_sink_); } From c73ae6cf0ceef9c79e3abba71a20969f06df22fb Mon Sep 17 00:00:00 2001 From: Stephen G Date: Sun, 21 Apr 2024 13:18:03 -0700 Subject: [PATCH 05/32] CMakePresets.json: Rename "windows-default" configuration to "windows-base" --- engine/CMakePresets.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engine/CMakePresets.json b/engine/CMakePresets.json index 546555ffa7..27eb917d3c 100644 --- a/engine/CMakePresets.json +++ b/engine/CMakePresets.json @@ -273,7 +273,7 @@ } }, { - "name": "windows-default", + "name": "windows-base", "hidden": true, "inherits": "default", "displayName": "Windows Default", @@ -303,7 +303,7 @@ { "name": "VS2019Win64", "hidden": true, - "inherits": "windows-default", + "inherits": "windows-base", "displayName": "Visual Studio 2019 on Windows x64", "generator": "Visual Studio 16 2019", "architecture": "X64", @@ -316,7 +316,7 @@ { "name": "VS2022Win64", "hidden": true, - "inherits": "windows-default", + "inherits": "windows-base", "displayName": "Visual Studio 2022 on Windows x64", "generator": "Visual Studio 17 2022", "architecture": "X64", @@ -329,7 +329,7 @@ { "name": "ninja-windows", "hidden": true, - "inherits": "windows-default", + "inherits": "windows-base", "displayName": "Ninja on Windows", "generator": "Ninja Multi-Config", "condition": { From 1e7ce8b357679c79c32928d04a94a99136e9ff12 Mon Sep 17 00:00:00 2001 From: Stephen G Date: Mon, 22 Apr 2024 22:33:30 -0700 Subject: [PATCH 06/32] Updated a bunch of files --- .github/dependabot.yml | 11 ++++ .github/workflows/Windows-Release.yml | 2 +- engine/launcher/general.cpp | 12 +++-- engine/objconv/asteroidgen.cpp | 8 +-- engine/objconv/basemaker/base_maker.cpp | 8 +-- .../objconv/basemaker/base_maker_texture.cpp | 8 +-- engine/objconv/basemaker/sprite.h | 10 ++-- engine/objconv/trisort.cpp | 8 +-- engine/src/aldrv/al_globals.cpp | 12 ++--- engine/src/aldrv/al_globals.h | 14 +++-- engine/src/aldrv/al_init.cpp | 11 ++-- engine/src/aldrv/al_listen.cpp | 11 ++-- engine/src/aldrv/al_sound.cpp | 12 ++--- .../audio/renderers/OpenAL/OpenALRenderer.cpp | 2 +- engine/src/audio/renderers/OpenAL/al.h | 14 +++-- engine/src/cg_global.h | 11 ++-- engine/src/cmd/ai/flykeyboard.h | 14 +++-- engine/src/cmd/collide_map.h | 10 ++-- engine/src/cmd/script/c_alike/c_alike.h | 36 ++++++------- engine/src/endianness.h | 10 ++-- engine/src/gfx/mesh_gfx.cpp | 8 +-- engine/src/gfx/star.cpp | 11 ++-- engine/src/gfx/vsimage.cpp | 8 +-- engine/src/gfxlib.h | 16 ++---- engine/src/gldrv/gl_globals.h | 8 +-- engine/src/gldrv/gl_include.h | 10 ++-- engine/src/gldrv/gl_init.cpp | 22 +++----- engine/src/gldrv/gl_init.h | 15 +++--- engine/src/gldrv/gl_program.cpp | 8 +-- engine/src/gldrv/gl_texture.cpp | 4 +- engine/src/gldrv/winsys.cpp | 27 +++------- engine/src/gldrv/winsys.h | 34 ++++--------- engine/src/gui/button.h | 10 ++-- engine/src/gui/text_area.h | 8 +-- engine/src/macosx_math.cpp | 8 +-- engine/src/macosx_math.h | 10 ++-- engine/src/precompiled.h | 10 ++-- engine/src/universe.cpp | 12 +++-- engine/src/vegastrike.h | 8 +-- engine/vcpkg.json | 2 +- script/bootstrap-on-macos.sh | 51 +++++++++++++++++++ script/brew-install-for-cmake.sh | 50 ++++++++++++++++++ 42 files changed, 324 insertions(+), 240 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 script/bootstrap-on-macos.sh create mode 100644 script/brew-install-for-cmake.sh diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000..53b7916472 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +!defined__APPLE__ && defined__MACH__v!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__r!defined__APPLE__ && defined__MACH__s!defined__APPLE__ && defined__MACH__i!defined__APPLE__ && defined__MACH__o!defined__APPLE__ && defined__MACH__n!defined__APPLE__ && defined__MACH__:!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__2!defined__APPLE__ && defined__MACH__ +!defined__APPLE__ && defined__MACH__u!defined__APPLE__ && defined__MACH__p!defined__APPLE__ && defined__MACH__d!defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__s!defined__APPLE__ && defined__MACH__:!defined__APPLE__ && defined__MACH__ +!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__-!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__p!defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__c!defined__APPLE__ && defined__MACH__k!defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__g!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__-!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__c!defined__APPLE__ && defined__MACH__o!defined__APPLE__ && defined__MACH__s!defined__APPLE__ && defined__MACH__y!defined__APPLE__ && defined__MACH__s!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__m!defined__APPLE__ && defined__MACH__:!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__"!defined__APPLE__ && defined__MACH__g!defined__APPLE__ && defined__MACH__i!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__h!defined__APPLE__ && defined__MACH__u!defined__APPLE__ && defined__MACH__b!defined__APPLE__ && defined__MACH__-!defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__c!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__i!defined__APPLE__ && defined__MACH__o!defined__APPLE__ && defined__MACH__n!defined__APPLE__ && defined__MACH__s!defined__APPLE__ && defined__MACH__"!defined__APPLE__ && defined__MACH__ +!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__d!defined__APPLE__ && defined__MACH__i!defined__APPLE__ && defined__MACH__r!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__c!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__o!defined__APPLE__ && defined__MACH__r!defined__APPLE__ && defined__MACH__y!defined__APPLE__ && defined__MACH__:!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__"!defined__APPLE__ && defined__MACH__/!defined__APPLE__ && defined__MACH__"!defined__APPLE__ && defined__MACH__ +!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__s!defined__APPLE__ && defined__MACH__c!defined__APPLE__ && defined__MACH__h!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__d!defined__APPLE__ && defined__MACH__u!defined__APPLE__ && defined__MACH__l!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__:!defined__APPLE__ && defined__MACH__ +!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__#!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__C!defined__APPLE__ && defined__MACH__h!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__c!defined__APPLE__ && defined__MACH__k!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__f!defined__APPLE__ && defined__MACH__o!defined__APPLE__ && defined__MACH__r!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__u!defined__APPLE__ && defined__MACH__p!defined__APPLE__ && defined__MACH__d!defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__s!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__o!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__G!defined__APPLE__ && defined__MACH__i!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__H!defined__APPLE__ && defined__MACH__u!defined__APPLE__ && defined__MACH__b!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__A!defined__APPLE__ && defined__MACH__c!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__i!defined__APPLE__ && defined__MACH__o!defined__APPLE__ && defined__MACH__n!defined__APPLE__ && defined__MACH__s!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__v!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__r!defined__APPLE__ && defined__MACH__y!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__w!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__k!defined__APPLE__ && defined__MACH__ +!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__i!defined__APPLE__ && defined__MACH__n!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__r!defined__APPLE__ && defined__MACH__v!defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__l!defined__APPLE__ && defined__MACH__:!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__"!defined__APPLE__ && defined__MACH__w!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__k!defined__APPLE__ && defined__MACH__l!defined__APPLE__ && defined__MACH__y!defined__APPLE__ && defined__MACH__"!defined__APPLE__ && defined__MACH__ +!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__l!defined__APPLE__ && defined__MACH__l!defined__APPLE__ && defined__MACH__o!defined__APPLE__ && defined__MACH__w!defined__APPLE__ && defined__MACH__:!defined__APPLE__ && defined__MACH__ +!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__#!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__A!defined__APPLE__ && defined__MACH__l!defined__APPLE__ && defined__MACH__l!defined__APPLE__ && defined__MACH__o!defined__APPLE__ && defined__MACH__w!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__b!defined__APPLE__ && defined__MACH__o!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__h!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__d!defined__APPLE__ && defined__MACH__i!defined__APPLE__ && defined__MACH__r!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__c!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__n!defined__APPLE__ && defined__MACH__d!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__i!defined__APPLE__ && defined__MACH__n!defined__APPLE__ && defined__MACH__d!defined__APPLE__ && defined__MACH__i!defined__APPLE__ && defined__MACH__r!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__c!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__u!defined__APPLE__ && defined__MACH__p!defined__APPLE__ && defined__MACH__d!defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__s!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__f!defined__APPLE__ && defined__MACH__o!defined__APPLE__ && defined__MACH__r!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__l!defined__APPLE__ && defined__MACH__l!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__p!defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__c!defined__APPLE__ && defined__MACH__k!defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__g!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__s!defined__APPLE__ && defined__MACH__ +!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__-!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__d!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__p!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__n!defined__APPLE__ && defined__MACH__d!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__n!defined__APPLE__ && defined__MACH__c!defined__APPLE__ && defined__MACH__y!defined__APPLE__ && defined__MACH__-!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__y!defined__APPLE__ && defined__MACH__p!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__:!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__"!defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__l!defined__APPLE__ && defined__MACH__l!defined__APPLE__ && defined__MACH__"!defined__APPLE__ && defined__MACH__ +!defined__APPLE__ && defined__MACH__ \ No newline at end of file diff --git a/.github/workflows/Windows-Release.yml b/.github/workflows/Windows-Release.yml index 7cb4e38872..30b9aa000e 100644 --- a/.github/workflows/Windows-Release.yml +++ b/.github/workflows/Windows-Release.yml @@ -111,7 +111,7 @@ jobs: GTEST_COLOR: 1 run: .\script\test.ps1 -Generator ${{ matrix.cmake-generator }} -EnablePIE ${{ matrix.enable-pie }} -BuildType ${{ matrix.build-type }} - - name: Upload artifacts + - name: Upload artifacts uses: skx/github-action-publish-binaries@44887b225ceca96efd8a912d39c09ad70312af31 # master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/engine/launcher/general.cpp b/engine/launcher/general.cpp index 13bcbb89cb..7d488235b2 100644 --- a/engine/launcher/general.cpp +++ b/engine/launcher/general.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, David Ranger, pyramid3d, + * general.cpp + * + * Copyright (C) 2001-2024 Daniel Horn, David Ranger, pyramid3d, * Stephen G. Tuggy, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -13,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -24,7 +26,7 @@ * This allows it to be used with other programs with minimal changes */ #include "general.h" -#if defined(__APPLE__) || defined(MACOSX) +#if defined(__APPLE__) && defined(__MACH__) #include // For MAXPATHLEN #endif #ifdef __MINGW32__ @@ -492,7 +494,7 @@ int isdir(const char *file) { glob_t *FindPath(char *path, int type) { glob_t *FILES = new glob_t; string mypath(path); -#if defined(__APPLE__) || defined(MACOSX) +#if defined(__APPLE__) && defined(__MACH__) char thispath[MAXPATHLEN]; #else char thispath[800000]; @@ -504,7 +506,7 @@ glob_t *FindPath(char *path, int type) { dirent *entry; unsigned int cur; char *newpath = 0; -#if defined(__APPLE__) || defined(MACOSX) +#if defined(__APPLE__) && defined(__MACH__) getcwd(thispath, MAXPATHLEN); #else getcwd(thispath, 790000); diff --git a/engine/objconv/asteroidgen.cpp b/engine/objconv/asteroidgen.cpp index 4aad7557cd..7dfcd39935 100644 --- a/engine/objconv/asteroidgen.cpp +++ b/engine/objconv/asteroidgen.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * asteroidgen.cpp + * + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -13,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -30,7 +32,7 @@ #define M_PI 3.14159265358979323846264338328 #endif #include -#ifdef __APPLE__ +#if defined(__APPLE__) && defined(__MACH__) #define sqrtf sqrt #define cosf cos #define sinf sin diff --git a/engine/objconv/basemaker/base_maker.cpp b/engine/objconv/basemaker/base_maker.cpp index 693d3b2eba..da479c466d 100644 --- a/engine/objconv/basemaker/base_maker.cpp +++ b/engine/objconv/basemaker/base_maker.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * base_maker.cpp + * + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -13,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -46,7 +48,7 @@ #include //for mkdir #include -#if defined (__APPLE__) || defined (MACOSX) +#if defined(__APPLE__) && defined(__MACH__) #include #include #else diff --git a/engine/objconv/basemaker/base_maker_texture.cpp b/engine/objconv/basemaker/base_maker_texture.cpp index a5a5a0c486..7d11c51308 100644 --- a/engine/objconv/basemaker/base_maker_texture.cpp +++ b/engine/objconv/basemaker/base_maker_texture.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * base_maker_texture.cpp + * + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -13,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -325,7 +327,7 @@ void Texture::loadTexture(FILE *file, TextureTransform tt) { handle = (unsigned int) -1; return; } -#ifdef __APPLE__ +#if defined(__APPLE__) && defined(__MACH__) glGenTextures( 1, (GLuint*) &handle ); #else glGenTextures(1, &handle); diff --git a/engine/objconv/basemaker/sprite.h b/engine/objconv/basemaker/sprite.h index 56fe296a8a..4c5a8221d0 100644 --- a/engine/objconv/basemaker/sprite.h +++ b/engine/objconv/basemaker/sprite.h @@ -1,6 +1,8 @@ /* - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, - * and other Vega Strike contributors. + * sprite.h + * + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -13,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -28,7 +30,7 @@ #include "gfx/hud.h" #include "vs_globals.h" -#if defined (__APPLE__) || defined (MACOSX) +#if defined(__APPLE__) && defined(__MACH__) #include #include #else diff --git a/engine/objconv/trisort.cpp b/engine/objconv/trisort.cpp index f314f6a3ef..ccb31282e8 100644 --- a/engine/objconv/trisort.cpp +++ b/engine/objconv/trisort.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * trisort.cpp + * + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -13,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -29,7 +31,7 @@ #include #include "trisort.h" -#ifdef __APPLE__ +#if defined(__APPLE__) && defined(__MACH__) #define sqrtf sqrt #endif diff --git a/engine/src/aldrv/al_globals.cpp b/engine/src/aldrv/al_globals.cpp index aaaa75d5e2..3f5c85315f 100644 --- a/engine/src/aldrv/al_globals.cpp +++ b/engine/src/aldrv/al_globals.cpp @@ -1,10 +1,8 @@ -/** +/* * al_globals.cpp * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike - * contributors - * Copyright (C) 2022 Stephen G. Tuggy + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -17,11 +15,11 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ diff --git a/engine/src/aldrv/al_globals.h b/engine/src/aldrv/al_globals.h index a7a5b8ce51..ba3ba70a97 100644 --- a/engine/src/aldrv/al_globals.h +++ b/engine/src/aldrv/al_globals.h @@ -1,10 +1,8 @@ -/** +/* * al_globals.h * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike - * contributors - * Copyright (C) 2023 Stephen G. Tuggy, Benjamen R. Meyer + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -17,11 +15,11 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ #ifndef VEGA_STRIKE_ENGINE_AL_GLOBALS_H #define VEGA_STRIKE_ENGINE_AL_GLOBALS_H @@ -33,7 +31,7 @@ #include #ifdef HAVE_AL -#ifdef __APPLE__ +#if defined(__APPLE__) && defined(__MACH__) #include #else #include diff --git a/engine/src/aldrv/al_init.cpp b/engine/src/aldrv/al_init.cpp index fddcb00dd6..c08911e43d 100644 --- a/engine/src/aldrv/al_init.cpp +++ b/engine/src/aldrv/al_init.cpp @@ -1,9 +1,8 @@ /* * al_init.cpp * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike contributors - * Copyright (C) 2021-2022 Stephen G. Tuggy + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -16,16 +15,16 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ #ifdef HAVE_AL -#ifdef __APPLE__ +#if defined(__APPLE__) && defined(__MACH__) #include #include #define KeyMap AppleKeyMap diff --git a/engine/src/aldrv/al_listen.cpp b/engine/src/aldrv/al_listen.cpp index 91fff10820..231e428704 100644 --- a/engine/src/aldrv/al_listen.cpp +++ b/engine/src/aldrv/al_listen.cpp @@ -1,9 +1,8 @@ /* * al_listen.cpp * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike contributors - * Copyright (C) 2021-2022 Stephen G. Tuggy + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -16,16 +15,16 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ #ifdef HAVE_AL -#ifdef __APPLE__ +#if defined(__APPLE__) && defined(__MACH__) #include #else #include diff --git a/engine/src/aldrv/al_sound.cpp b/engine/src/aldrv/al_sound.cpp index 4aca3bb2e7..173922a77a 100644 --- a/engine/src/aldrv/al_sound.cpp +++ b/engine/src/aldrv/al_sound.cpp @@ -1,10 +1,8 @@ /* * al_sound.cpp * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Nachum Barcohen, Roy Falk, Stephen G. Tuggy, - * and other Vega Strike contributors - * Copyright (C) 2021-2022 Stephen G. Tuggy + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -17,11 +15,11 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ @@ -182,7 +180,7 @@ void blutLoadWAVMemory(ALbyte *memory, ALenum } } -#ifdef __APPLE__ +#if defined(__APPLE__) && defined(__MACH__) #include #include //#include diff --git a/engine/src/audio/renderers/OpenAL/OpenALRenderer.cpp b/engine/src/audio/renderers/OpenAL/OpenALRenderer.cpp index cd5bf3ed27..ad4d2436d9 100644 --- a/engine/src/audio/renderers/OpenAL/OpenALRenderer.cpp +++ b/engine/src/audio/renderers/OpenAL/OpenALRenderer.cpp @@ -151,7 +151,7 @@ struct RendererData { #ifdef _WIN32 deviceSpecifier = "DirectSound3D"; #else - #ifdef __APPLE__ + #if defined(__APPLE__) && defined(__MACH__) deviceSpecifier = "sdl"; #endif #endif diff --git a/engine/src/audio/renderers/OpenAL/al.h b/engine/src/audio/renderers/OpenAL/al.h index 22d34bced0..388048eb65 100644 --- a/engine/src/audio/renderers/OpenAL/al.h +++ b/engine/src/audio/renderers/OpenAL/al.h @@ -1,10 +1,8 @@ -/** +/* * al.h * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike - * contributors - * Copyright (C) 2022-2023 Stephen G. Tuggy, Benjamen R. Meyer + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -17,16 +15,16 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ #ifndef VEGA_STRIKE_ENGINE_AUDIO_RENDERERS_OPENAL_AL_H #define VEGA_STRIKE_ENGINE_AUDIO_RENDERERS_OPENAL_AL_H -#ifdef __APPLE__ +#if defined(__APPLE__) && defined(__MACH__) #include #include #else diff --git a/engine/src/cg_global.h b/engine/src/cg_global.h index a21cfd01ba..c0718a1cd3 100644 --- a/engine/src/cg_global.h +++ b/engine/src/cg_global.h @@ -1,9 +1,8 @@ /* * cg_global.h * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike contributors - * Copyright (C) 2021-2023 Stephen G. Tuggy, Benjamen R. Meyer + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -16,18 +15,18 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ #ifndef VEGA_STRIKE_ENGINE_CG_GLOBAL_H #define VEGA_STRIKE_ENGINE_CG_GLOBAL_H #if defined (CG_SUPPORT) -#if defined (__APPLE__) || defined (MACOSX) +#if defined(__APPLE__) && defined(__MACH__) #define MACOS 1 #elif !defined (WIN32) #define UNIX 1 diff --git a/engine/src/cmd/ai/flykeyboard.h b/engine/src/cmd/ai/flykeyboard.h index dcde8f78fe..7778325c27 100644 --- a/engine/src/cmd/ai/flykeyboard.h +++ b/engine/src/cmd/ai/flykeyboard.h @@ -1,10 +1,8 @@ -/** +/* * flykeyboard.h * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike - * contributors - * Copyright (C) 2022-2023 Stephen G. Tuggy, Benjamen R. Meyer + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -17,17 +15,17 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ #ifndef VEGA_STRIKE_ENGINE_CMD_AI_FLY_KEYBOARD_H #define VEGA_STRIKE_ENGINE_CMD_AI_FLY_KEYBOARD_H #include "in.h" -#if defined (__APPLE__) || defined (MACOSX) +#if defined(__APPLE__) && defined(__MACH__) #include #else #include diff --git a/engine/src/cmd/collide_map.h b/engine/src/cmd/collide_map.h index db74b864da..e59a55f919 100644 --- a/engine/src/cmd/collide_map.h +++ b/engine/src/cmd/collide_map.h @@ -1,7 +1,7 @@ /* * collide_map.h * - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * Benjamen R. Meyer, and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -15,11 +15,11 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ #ifndef VEGA_STRIKE_ENGINE_CMD_COLLIDE_MAP_H #define VEGA_STRIKE_ENGINE_CMD_COLLIDE_MAP_H @@ -52,7 +52,7 @@ class Collidable { void SetPosition(const QVector &bpos) { //in case we want to drop in an xtra radius parameter when we get performance testing this->position = bpos; -#ifdef __APPLE__ +#if defined(__APPLE__) && defined(__MACH__) if ( !FINITE( getKey() ) ) position = QVector( 0, 0, 0 ); //hack for now @@ -98,7 +98,7 @@ class Collidable { ref.bolt_index = bolt_index; radius = -speed * SIMULATION_ATOM; if ( -#ifdef __APPLE__ +#if defined(__APPLE__) && defined(__MACH__) !FINITE( radius ) #else ISNAN(radius) diff --git a/engine/src/cmd/script/c_alike/c_alike.h b/engine/src/cmd/script/c_alike/c_alike.h index 9d71cfaa0d..76c3aab3ba 100644 --- a/engine/src/cmd/script/c_alike/c_alike.h +++ b/engine/src/cmd/script/c_alike/c_alike.h @@ -1,23 +1,25 @@ -/* - * Vega Strike - * Copyright (C) 2001-2002 Daniel Horn - * Copyright (C) 2022-2023 Stephen G. Tuggy, Benjamen R. Meyer - * - * http://vegastrike.sourceforge.net/ +/* + * c_alike.h + * + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, + * and other Vega Strike contributors. + * + * https://github.com/vegastrike/Vega-Strike-Engine-Source * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, + * This file is part of Vega Strike. + * + * Vega Strike is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with Vega Strike. If not, see . */ // NO HEADER GUARD @@ -32,7 +34,7 @@ #include #elif defined(HAVE_LINUX_MALLOC_H) #include -#elif defined(__APPLE__) || defined(MACOSX) +#elif defined(__APPLE__) && defined(__MACH__) #include #elif defined(HAVE_MALLOC_H) #include diff --git a/engine/src/endianness.h b/engine/src/endianness.h index 459c4d10e4..61b9787e86 100644 --- a/engine/src/endianness.h +++ b/engine/src/endianness.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, + * endianness.h + * + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -13,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -42,7 +44,7 @@ double DONTUSE__NXSwapBigDoubleToLittleEndian(double x); #endif //defined (IRIX) #endif //defined (__HAIKU__) -#if defined (__APPLE__) +#if defined (__APPLE__) && defined(__MACH__) #if defined (__BIG_ENDIAN__) #if defined (__x86_64__) #include @@ -60,7 +62,7 @@ double DONTUSE__NXSwapBigDoubleToLittleEndian(double x); #define le16_to_cpu( x ) (x) #define le64_to_cpu( x ) (x) #endif //defined (__BIG_ENDIAN__) -#else //defined (__APPLE__) +#else //defined (__APPLE__) && defined(__MACH__) #if defined (IRIX) || (defined (__SVR4) && defined (__sun )) #include # if BYTE_ORDER == BIG_ENDIAN /* depends on MIPSEB or MIPSEL and SGIAPI */ diff --git a/engine/src/gfx/mesh_gfx.cpp b/engine/src/gfx/mesh_gfx.cpp index 7e784982ab..5979a792f5 100644 --- a/engine/src/gfx/mesh_gfx.cpp +++ b/engine/src/gfx/mesh_gfx.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, surfdargent, hellcatv, ace123, + * mesh_gfx.cpp + * + * Copyright (C) 2001-2024 Daniel Horn, surfdargent, hellcatv, ace123, * klaussfreire, dan_w, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * @@ -14,7 +16,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -2071,7 +2073,7 @@ void Mesh::initTechnique(const std::string &xmltechnique) { string effective; if (Decal.size() > 1 || getEnvMap()) { //Use shader-ified technique for multitexture or environment-mapped meshes -#ifdef __APPLE__ +#if defined(__APPLE__) && defined(__MACH__) static string shader_technique = vs_config->getVariable( "graphics", "default_full_technique", "mac" ); #else static string shader_technique = vs_config->getVariable("graphics", "default_full_technique", "default"); diff --git a/engine/src/gfx/star.cpp b/engine/src/gfx/star.cpp index 752b2bc928..ecad7de42a 100644 --- a/engine/src/gfx/star.cpp +++ b/engine/src/gfx/star.cpp @@ -1,9 +1,8 @@ /* * star.cpp * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike contributors - * Copyright (C) 2021-2022 Stephen G. Tuggy + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -16,11 +15,11 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ @@ -37,7 +36,7 @@ #include "universe.h" #include "vs_logging.h" -#if defined (__APPLE__) || defined (MACOSX) +#if defined(__APPLE__) && defined(__MACH__) #include #else #include diff --git a/engine/src/gfx/vsimage.cpp b/engine/src/gfx/vsimage.cpp index af9baa1090..b81f750fae 100644 --- a/engine/src/gfx/vsimage.cpp +++ b/engine/src/gfx/vsimage.cpp @@ -1,7 +1,7 @@ /* * vsimage.cpp * - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -15,17 +15,17 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ #include "vsimage.h" -#if defined (__APPLE__) || defined (MACOSX) +#if defined(__APPLE__) && defined(__MACH__) # include # include #else diff --git a/engine/src/gfxlib.h b/engine/src/gfxlib.h index ddbee14d5c..83b3e009f7 100644 --- a/engine/src/gfxlib.h +++ b/engine/src/gfxlib.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, + * gfxlib.h + * + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -13,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -32,16 +34,6 @@ #define GFXDRVAPI #endif //defined (_WIN32) && !defined (__CYGWIN__) -/* - * #if 0 - * #if defined(__APPLE__) || defined(MACOSX) - * #include - * #else - * #include - * #endif - * #endif - */ - #include #include class Matrix; diff --git a/engine/src/gldrv/gl_globals.h b/engine/src/gldrv/gl_globals.h index 074f28a669..429cb4012c 100644 --- a/engine/src/gldrv/gl_globals.h +++ b/engine/src/gldrv/gl_globals.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2023 Daniel Horn, Alan Shieh, pyramid3d, + * gl_globals.h + * + * Copyright (C) 2001-2024 Daniel Horn, Alan Shieh, pyramid3d, * Stephen G. Tuggy, Benjamen R. Meyer, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -13,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -100,7 +102,7 @@ struct GFXStats #include #include #endif -#if defined (__APPLE__) || defined (MACOSX) +#if defined(__APPLE__) && defined(__MACH__) #include //#if defined( GL_INIT_CPP) || defined( GL_MISC_CPP) || defined( GL_STATE_CPP) #if defined (GL_ARB_vertex_program) && defined (GL_ARB_fragment_program) diff --git a/engine/src/gldrv/gl_include.h b/engine/src/gldrv/gl_include.h index 5c94db9481..81dc20f80b 100644 --- a/engine/src/gldrv/gl_include.h +++ b/engine/src/gldrv/gl_include.h @@ -1,6 +1,8 @@ /* - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, - * and other Vega Strike contributors. + * gl_include.h + * + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -13,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -23,7 +25,7 @@ #ifndef VEGA_STRIKE_ENGINE_GLDRV_GL_INCLUDE_H #define VEGA_STRIKE_ENGINE_GLDRV_GL_INCLUDE_H -#if defined (__APPLE__) || defined (MACOSX) +#if defined(__APPLE__) && defined(__MACH__) # include #else # include diff --git a/engine/src/gldrv/gl_init.cpp b/engine/src/gldrv/gl_init.cpp index 8596ec0402..3bf4951dfd 100644 --- a/engine/src/gldrv/gl_init.cpp +++ b/engine/src/gldrv/gl_init.cpp @@ -1,7 +1,7 @@ /* * gl_init.cpp * - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -15,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -40,23 +40,13 @@ #if !defined (_WIN32) && !defined (__CYGWIN__) -//#if !(defined(__APPLE__) || defined(MACOSX)) -//#define GL_GLEXT_PROTOTYPES 1 -//#define GLX_GLXEXT_PROTOTYPES 1 -//#define GLX_GLXEXT_LEGACY 1 - -//# include -//# include -//# include -//#endif - #include #else #ifndef NOMINMAX #define NOMINMAX #endif //tells VCC not to generate min/max macros -// #if defined (__APPLE__) || defined (MACOSX) +// #if defined(__APPLE__) && defined(__MACH__) // #include // #else #define GL_TEXTURE_CUBE_MAP_SEAMLESS_ARB 0x884F @@ -64,7 +54,7 @@ #include #endif #define GL_GLEXT_PROTOTYPES 1 -#if defined (__APPLE__) || defined (MACOSX) +#if defined(__APPLE__) && defined(__MACH__) #include #include #include @@ -260,7 +250,7 @@ void init_opengl_extensions() { #ifndef NO_COMPILEDVERTEXARRAY_SUPPORT if (vsExtensionSupported("GL_EXT_compiled_vertex_array") && game_options()->LockVertexArrays) { -#ifdef __APPLE__ +#if defined(__APPLE__) && defined(__MACH__) #ifndef __APPLE_PANTHER_GCC33_CLI__ #if defined (glLockArraysEXT) && defined (glUnlockArraysEXT) glLockArraysEXT_p = &glLockArraysEXT; @@ -281,7 +271,7 @@ void init_opengl_extensions() { #endif VS_LOG(trace, "OpenGL::GL_EXT_compiled_vertex_array supported"); } else { -#ifdef __APPLE__ +#if defined(__APPLE__) && defined(__MACH__) glLockArraysEXT_p = nullptr; glUnlockArraysEXT_p = nullptr; #endif diff --git a/engine/src/gldrv/gl_init.h b/engine/src/gldrv/gl_init.h index 0c85fad020..a74fd305c8 100644 --- a/engine/src/gldrv/gl_init.h +++ b/engine/src/gldrv/gl_init.h @@ -1,9 +1,8 @@ -/** +/* * gl_init.h * - * Copyright (C) 2001-2002 Daniel Horn - * Copyright (C) 2020-2023 pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, and other Vega Strike - * contributors + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -11,16 +10,16 @@ * * Vega Strike is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ #ifndef VEGA_STRIKE_ENGINE_GLDRV_GL_INIT_H #define VEGA_STRIKE_ENGINE_GLDRV_GL_INIT_H @@ -62,7 +61,7 @@ typedef void (*PFNGLLOCKARRAYSEXTPROC)( GLint first, GLsizei count ); typedef void (*PFNGLUNLOCKARRAYSEXTPROC)( void ); #elif !defined (_WIN32) -#if defined (__APPLE__) || defined (MACOSX) +#if defined(__APPLE__) && defined(__MACH__) #include #include #else diff --git a/engine/src/gldrv/gl_program.cpp b/engine/src/gldrv/gl_program.cpp index 75b5770ac2..28673755f8 100644 --- a/engine/src/gldrv/gl_program.cpp +++ b/engine/src/gldrv/gl_program.cpp @@ -1,7 +1,7 @@ /* * gl_program.cpp * - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -15,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -395,7 +395,7 @@ static int hifiprog = 0; // THIS IS STUPID! -#ifdef __APPLE__ +#if defined(__APPLE__) && defined(__MACH__) std::string hifiProgramName = "mac"; std::string lowfiProgramName = "maclite"; #else @@ -410,7 +410,7 @@ int getDefaultProgram() { if (!initted) { // THIS IS STUPID, Also why is lofi not configurable ? -#ifdef __APPLE__ +#if defined(__APPLE__) && defined(__MACH__) hifiProgramName = game_options()->mac_shader_name; #else hifiProgramName = game_options()->shader_name; diff --git a/engine/src/gldrv/gl_texture.cpp b/engine/src/gldrv/gl_texture.cpp index abd11fab78..149fa30ed1 100644 --- a/engine/src/gldrv/gl_texture.cpp +++ b/engine/src/gldrv/gl_texture.cpp @@ -123,7 +123,7 @@ bool isPowerOfTwo(int num, int &which) { return true; } -#ifdef __APPLE__ +#if defined(__APPLE__) && defined(__MACH__) static GLint round2( GLint n ) { @@ -403,7 +403,7 @@ GFXBOOL /*GFXDRVAPI*/ GFXCreateTexture(int width, void /*GFXDRVAPI*/ GFXPrioritizeTexture(unsigned int handle, float priority) { glPrioritizeTextures(1, -#if defined (__APPLE__) +#if defined (__APPLE__) && defined(__MACH__) (GLuint*) #endif &handle, &priority); diff --git a/engine/src/gldrv/winsys.cpp b/engine/src/gldrv/winsys.cpp index 79e396840d..272d3adce6 100644 --- a/engine/src/gldrv/winsys.cpp +++ b/engine/src/gldrv/winsys.cpp @@ -1,25 +1,10 @@ /* - * Tux Racer - * Copyright (C) 1999-2001 Jasmin F. Patry + * winsys.cpp + * + * Incorporated into Vega Strike from Tux Racer * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Incorporated into Vega Strike - * - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, - * and other Vega Strike contributors. + * Copyright (C) 1999-2024 Jasmin F. Patry, Daniel Horn, pyramid3d, + * Benjamen R. Meyer, Stephen G. Tuggy, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -753,7 +738,7 @@ void winsys_init( int *argc, char **argv, char const *window_title, char const * gl_options.color_depth = game_options()->colordepth; glutInit( argc, argv ); if (game_options()->glut_stencil) { -#ifdef __APPLE__ +#if defined(__APPLE__) && defined(__MACH__) if ( !(glutInitDisplayMode( GLUT_RGBA|GLUT_DEPTH|GLUT_DOUBLE|GLUT_STENCIL ), 1) ) glutInitDisplayMode( GLUT_RGBA|GLUT_DEPTH|GLUT_DOUBLE ); #else diff --git a/engine/src/gldrv/winsys.h b/engine/src/gldrv/winsys.h index 06fdd8463b..b1b7f11ba4 100644 --- a/engine/src/gldrv/winsys.h +++ b/engine/src/gldrv/winsys.h @@ -1,26 +1,10 @@ /* - * Tux Racer - * Copyright (C) 1999-2001 Jasmin F. Patry - * Copyright (C) 2023 Benjamen R. Meyer + * winsys.h * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * Incorporated into Vega Strike from Tux Racer * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Incorporated into Vega Strike - * - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, - * and other Vega Strike contributors. + * Copyright (C) 1999-2024 Jasmin F. Patry, Daniel Horn, pyramid3d, + * Benjamen R. Meyer, Stephen G. Tuggy, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -51,7 +35,7 @@ #if defined( SDL_WINDOWING ) && defined (HAVE_SDL) # include "SDL2/SDL.h" #elif defined( HAVE_GLUT ) -#if defined(__APPLE__) || defined(MACOSX) +#if defined(__APPLE__) && defined(__MACH__) #include #else #include @@ -100,13 +84,13 @@ typedef enum { WSK_TAB = '\t', WSK_ESCAPE = 27, WSK_BACKSPACE = -#ifdef __APPLE__ +#if defined(__APPLE__) && defined(__MACH__) 127, #else 8, #endif WSK_DELETE = -#ifdef __APPLE__ +#if defined(__APPLE__) && defined(__MACH__) 8, #else 127, @@ -227,13 +211,13 @@ typedef enum { WSK_TAB = '\t', WSK_ESCAPE = 27, WSK_BACKSPACE = -#ifdef __APPLE__ +#if defined(__APPLE__) && defined(__MACH__) 127, #else 8, #endif WSK_DELETE = -#ifdef __APPLE__ +#if defined(__APPLE__) && defined(__MACH__) 8, #else 127, diff --git a/engine/src/gui/button.h b/engine/src/gui/button.h index 14d266bc82..17a3632030 100644 --- a/engine/src/gui/button.h +++ b/engine/src/gui/button.h @@ -1,6 +1,8 @@ /* - * Copyright (C) 2001-2023 Daniel Horn, David Ranger, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, - * and other Vega Strike contributors. + * button.h + * + * Copyright (C) 2001-2024 Daniel Horn, David Ranger, pyramid3d, + * Stephen G. Tuggy, Benjamen R. Meyer, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -13,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -28,7 +30,7 @@ * The only external functions it requires that aren't provided by system libs are in glut_support.h */ -#if defined (__APPLE__) || defined (MACOSX) +#if defined(__APPLE__) && defined(__MACH__) #include #include #else diff --git a/engine/src/gui/text_area.h b/engine/src/gui/text_area.h index b232415aab..8d8937ae11 100644 --- a/engine/src/gui/text_area.h +++ b/engine/src/gui/text_area.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2023 Daniel Horn, David Ranger, pyramid3d, + * text_area.h + * + * Copyright (C) 2001-2024 Daniel Horn, David Ranger, pyramid3d, * Stephen G. Tuggy, Benjamen R. Meyer, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -13,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -35,7 +37,7 @@ //There are places where a float is converted to an int. This define takes extra steps to convert without a warning (float -> char -> int) #define NO_WARNINGS -#if defined (__APPLE__) || defined (MACOSX) +#if defined(__APPLE__) && defined(__MACH__) #include #include #else diff --git a/engine/src/macosx_math.cpp b/engine/src/macosx_math.cpp index b7623560d7..a3f3b26433 100644 --- a/engine/src/macosx_math.cpp +++ b/engine/src/macosx_math.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * macosx_math.cpp + * + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -13,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -23,7 +25,7 @@ #include #include #include "posh.h" -#if defined (__APPLE__) +#if defined (__APPLE__) && defined(__MACH__) //these stuffs are included in OSX 10.4 and above--so just check for x86 #include #include diff --git a/engine/src/macosx_math.h b/engine/src/macosx_math.h index cccef2bc15..041a41fe7a 100644 --- a/engine/src/macosx_math.h +++ b/engine/src/macosx_math.h @@ -1,6 +1,8 @@ /* - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, - * and other Vega Strike contributors. + * macosx_math.h + * + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -13,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -25,7 +27,7 @@ /// works on *any* float... INF is 0x7ffffff and -INF is -(1<<31) NaN is 0 extern int float_to_int(float); extern int double_to_int(float); //works on *any* float -#if defined (__APPLE__) || defined (MACOSX) +#if defined(__APPLE__) && defined(__MACH__) #include extern float sqrtf( float v ); extern float cosf( float v ); diff --git a/engine/src/precompiled.h b/engine/src/precompiled.h index ff806236da..4b8cae670d 100644 --- a/engine/src/precompiled.h +++ b/engine/src/precompiled.h @@ -1,6 +1,8 @@ /* - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, - * and other Vega Strike contributors. + * precompiled.h + * + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -13,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -51,7 +53,7 @@ #define GL_GLEXT_PROTOTYPES 1 -#if defined (__APPLE__) || defined (MACOSX) +#if defined(__APPLE__) && defined(__MACH__) #include #include #else //defined (__APPLE__) || defined (MACOSX) diff --git a/engine/src/universe.cpp b/engine/src/universe.cpp index ceb935368d..4eabb25d0b 100644 --- a/engine/src/universe.cpp +++ b/engine/src/universe.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * universe.cpp + * + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -13,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -40,7 +42,7 @@ #include "in_kb.h" #include "in_kb_data.h" #include "in_main.h" -#if defined (__APPLE__) +#if defined (__APPLE__) && defined(__MACH__) #import #endif #include "savegame.h" @@ -324,13 +326,13 @@ void CleanupUnitTables() { // Constructors and Init Universe::Universe(int argc, char **argv, const char *galaxy_str) { //Select drivers -#if defined (__APPLE__) +#if defined (__APPLE__) && defined(__MACH__) //get the current working directory so when glut trashes it we can restore. char pwd[MAXPATHLEN]; getcwd( pwd, MAXPATHLEN ); #endif GFXInit(argc, argv); -#if defined (__APPLE__) +#if defined (__APPLE__) && defined(__MACH__) //Restore it chdir( pwd ); #endif diff --git a/engine/src/vegastrike.h b/engine/src/vegastrike.h index 41fed397ea..93e2054a12 100644 --- a/engine/src/vegastrike.h +++ b/engine/src/vegastrike.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, + * vegastrike.h + * + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -13,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -67,7 +69,7 @@ extern float AUDIO_ATOM; #endif //defined (WIN32) || defined (__CYGWIN__) #ifndef NO_GFX - #if defined (__APPLE__) || defined (MACOSX) + #if defined(__APPLE__) && defined(__MACH__) #include #include #include diff --git a/engine/vcpkg.json b/engine/vcpkg.json index d1e6597b2e..e7d79b999e 100644 --- a/engine/vcpkg.json +++ b/engine/vcpkg.json @@ -2,7 +2,7 @@ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "vega-strike", "version-string": "0.9.0", - "builtin-baseline": "a34c873a9717a888f58dc05268dea15592c2f0ff", + "builtin-baseline": "da4b78d35084ec4e9808aa02017028da03b8d2ab", "dependencies": [ "boost-python", "boost-log", diff --git a/script/bootstrap-on-macos.sh b/script/bootstrap-on-macos.sh new file mode 100644 index 0000000000..9b81772402 --- /dev/null +++ b/script/bootstrap-on-macos.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +# +# bootstrap-on-macos.sh +# +# Copyright (C) 2023-2024 Stephen G. Tuggy and other +# Vega Strike contributors +# +# This file is part of Vega Strike. +# +# Vega Strike is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Vega Strike is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Vega Strike. If not, see . + +set -e + +declare -a packages_to_install=("openssl@3" "python@3.11" "python@3.12" "boost" "boost-python3" "gtk+3" "gtkglext" "sdl12-compat" "sdl2" "mesa" "mesa-glu" "freeglut" "openal-soft" "cmake" "expat" "jpeg" "libpng" "libvorbis") +declare -a links_to_delete=("2to3" "idle3" "pydoc3" "python3" "python3-config" "2to3-3.11" "idle3.11" "pydoc3.11" "python3.11" "python3.11-config" "2to3-3.12" "idle3.12" "pydoc3.12" "python3.12" "python3.12-config") + +for i in "${links_to_delete[@]}" +do + link_path="/usr/local/bin/$i" + if [ -f "$link_path" ] + then + rm "/usr/local/bin/$i" + fi +done + +brew update + +for j in "${packages_to_install[@]}" +do + brew install "$j" + PACKAGE_INSTALLED_PREFIX=$(brew --prefix "$j") + PACKAGE_INSTALLED_BIN="$PACKAGE_INSTALLED_PREFIX/bin" + export PATH="$PACKAGE_INSTALLED_BIN:$PATH" + export CMAKE_PREFIX_PATH="$PACKAGE_INSTALLED_PREFIX:$CMAKE_PREFIX_PATH" +done + +ln -s /usr/local/include/GL /usr/local/include/OpenGL +ln -s /usr/local/include/GL /usr/local/include/GLUT +OPENALDIR=$(brew --prefix openal-soft) +export OPENALDIR diff --git a/script/brew-install-for-cmake.sh b/script/brew-install-for-cmake.sh new file mode 100644 index 0000000000..f4f600ef2b --- /dev/null +++ b/script/brew-install-for-cmake.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +#==================================== +# @file : brew-install-for-cmake.sh +# @brief : installs a package with Homebrew, keg-only, then registers that package's +# include, lib, bin, etc. directories for use by CMake +# @usage : script/brew-install-for-cmake.sh +# @param : first, the brew formula name, optionally including a version suffix +# second, a truthy value indicating whether or not to leave it linked +#==================================== +# Copyright (C) 2023-2024 Stephen G. Tuggy and other +# Vega Strike contributors +# +# This file is part of Vega Strike. +# +# Vega Strike is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Vega Strike is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Vega Strike. If not, see . + +set -e + +PACKAGE_SPEC="$1" +LEAVE_LINKED="$2" + +#export HOMEBREW_NO_AUTO_UPDATE=1 +#export HOMEBREW_NO_INSTALL_UPGRADE=1 +#export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 + +if ! brew list "$PACKAGE_SPEC" &>/dev/null; then + if "$LEAVE_LINKED"; then + brew install --force --overwrite "$PACKAGE_SPEC" + else + brew install "$PACKAGE_SPEC" + brew unlink "$PACKAGE_SPEC" + fi +fi +PACKAGE_INSTALLED_PREFIX=$(brew --prefix "$PACKAGE_SPEC") +PACKAGE_INSTALLED_BIN="$PACKAGE_INSTALLED_PREFIX/bin" +#PACKAGE_INSTALLED_INCLUDE="$PACKAGE_INSTALLED_PREFIX/include" +#PACKAGE_INSTALLED_LIB="$PACKAGE_INSTALLED_PREFIX/lib" +export PATH="$PACKAGE_INSTALLED_BIN:$PATH" +export CMAKE_PREFIX_PATH="$PACKAGE_INSTALLED_PREFIX:$CMAKE_PREFIX_PATH" From 6303ae0e62fcc8c3d3aa64ac8f1ff17a3369c474 Mon Sep 17 00:00:00 2001 From: Stephen G Date: Mon, 22 Apr 2024 23:17:30 -0700 Subject: [PATCH 07/32] .github/workflows/*.yml: Various updates, fixes, and syncing with other branches' versions of the workflows --- .github/workflows/Windows-CI.yml | 48 +++++++------ .github/workflows/Windows-Release.yml | 74 +++++++++++--------- .github/workflows/codeql.yml | 2 +- .github/workflows/fortify-on-demand-scan.yml | 2 +- .github/workflows/gh-actions-pr.yml | 4 +- .github/workflows/gh-actions-release.yml | 4 +- .github/workflows/macos-ci.yml | 4 +- .github/workflows/macos-release.yml | 20 +++--- 8 files changed, 87 insertions(+), 71 deletions(-) diff --git a/.github/workflows/Windows-CI.yml b/.github/workflows/Windows-CI.yml index 95c4385fb8..aedb1ed4d1 100644 --- a/.github/workflows/Windows-CI.yml +++ b/.github/workflows/Windows-CI.yml @@ -39,13 +39,12 @@ jobs: VCPKG_BINARY_SOURCES: 'x-gha,readwrite' VCPKG_DEFAULT_TRIPLET: x64-windows VCPKG_DEFAULT_HOST_TRIPLET: x64-windows - PYTHONHOME: '${{ github.workspace }}/v/packages/python3_x64-windows/tools/python3' # Steps represent a sequence of tasks that will be executed as part of the job steps: # Set env vars needed for vcpkg to leverage the GitHub Action cache as a storage # for Binary Caching. - - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 #v6.4.1 + - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1 with: script: | core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); @@ -53,7 +52,12 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 + uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f #v4.1.3 + + - name: Setup Python + uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d #v5.1.0 + with: + python-version: 3.11 - name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'" run: mkdir -p $VCPKG_DEFAULT_BINARY_CACHE @@ -65,28 +69,28 @@ jobs: cmakeVersion: 3.29.2 ninjaVersion: 1.11.1 - # Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg's binary caching - # when it is being run afterward by CMake. - - name: restore-vcpkg - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 #v3.3.1 - with: - # The first path is the location of vcpkg: it contains the vcpkg executable and data files, as long as the - # built package archives (aka binary cache) which are located by VCPKG_DEFAULT_BINARY_CACHE env var. - # The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages. - path: | - ${{ env.VCPKG_ROOT }} - !${{ env.VCPKG_ROOT }}/buildtrees - !${{ env.VCPKG_ROOT }}/packages - !${{ env.VCPKG_ROOT }}/downloads - !${{ env.VCPKG_ROOT }}/installed - # The key is composed in a way that it gets properly invalidated whenever a different version of vcpkg is being used. - key: | - ${{ hashFiles( '.git/modules/vcpkg/HEAD' )}} + # Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg's binary caching + # when it is being run afterward by CMake. + - name: restore-vcpkg + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 #v4.0.2 + with: + # The first path is the location of vcpkg: it contains the vcpkg executable and data files, as long as the + # built package archives (aka binary cache) which are located by VCPKG_DEFAULT_BINARY_CACHE env var. + # The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages. + path: | + ${{ env.VCPKG_ROOT }} + !${{ env.VCPKG_ROOT }}/buildtrees + !${{ env.VCPKG_ROOT }}/packages + !${{ env.VCPKG_ROOT }}/downloads + !${{ env.VCPKG_ROOT }}/installed + # The key is composed in a way that it gets properly invalidated whenever a different version of vcpkg is being used. + key: | + ${{ os.release }}-${{ hashFiles( './engine/vcpkg.json' )}} - name: install-vcpkg if: steps.cache.outputs.cache-hit != 'true' run: | - git clone https://github.com/vegastrike/vcpkg-local.git ${{ env.VCPKG_ROOT }} + git clone https://github.com/Microsoft/vcpkg.git ${{ env.VCPKG_ROOT }} ${{ env.VCPKG_ROOT }}\bootstrap-vcpkg.bat -disableMetrics - name: run-build-script @@ -101,7 +105,7 @@ jobs: run: .\script\test.ps1 -Generator ${{ matrix.cmake-generator }} -EnablePIE ${{ matrix.enable-pie }} -BuildType ${{ matrix.build-type }} - name: Upload test results - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 #v3.1.3 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3 if: failure() with: name: test_results_xml diff --git a/.github/workflows/Windows-Release.yml b/.github/workflows/Windows-Release.yml index 30b9aa000e..708dcc0bf9 100644 --- a/.github/workflows/Windows-Release.yml +++ b/.github/workflows/Windows-Release.yml @@ -1,4 +1,4 @@ -name: Windows-CI +name: Windows-Release # Controls when the action will run. on: @@ -37,11 +37,10 @@ jobs: VCPKG_ROOT: '${{ github.workspace }}/v' # Tells vcpkg where binary packages are stored. VCPKG_DEFAULT_BINARY_CACHE: '${{ github.workspace }}/vbincache' - ## Let's use GitHub Action cache as storage for the vcpkg Binary Caching feature. - #VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite' + # Let's use GitHub Action cache as storage for the vcpkg Binary Caching feature. + VCPKG_BINARY_SOURCES: 'x-gha,readwrite' VCPKG_DEFAULT_TRIPLET: x64-windows VCPKG_DEFAULT_HOST_TRIPLET: x64-windows - PYTHONHOME: '${{ github.workspace }}/v/packages/python3_x64-windows/tools/python3' TAG_NAME: '${{ github.ref_name }}' # Steps represent a sequence of tasks that will be executed as part of the job @@ -49,7 +48,7 @@ jobs: # Set env vars needed for vcpkg to leverage the GitHub Action cache as a storage # for Binary Caching. # Also process the `github.sha` value to produce the SHORT_SHA we'll need later - - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 #v6.4.1 + - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1 with: script: | const git_sha = context.sha.substring(0, 7) @@ -64,40 +63,45 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 + uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f #v4.1.3 + + - name: Setup Python + uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d #v5.1.0 + with: + python-version: 3.11 - name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'" run: mkdir -p $VCPKG_DEFAULT_BINARY_CACHE shell: bash - name: install-cmake - uses: lukka/get-cmake@359fbae4b163fa01633e6de228fa7f2a31ab1fc7 #v3.26.1 + uses: lukka/get-cmake@4931ab1fc1604964c055eb330edb3f6b26ba0cfa #v3.29.2 with: - cmakeVersion: 3.26.1 + cmakeVersion: 3.29.2 ninjaVersion: 1.11.1 - # # Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg's binary caching - # # when it is being run afterward by CMake. - # - name: restore-vcpkg - # uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 #v3.3.1 - # with: - # # The first path is the location of vcpkg: it contains the vcpkg executable and data files, as long as the - # # built package archives (aka binary cache) which are located by VCPKG_DEFAULT_BINARY_CACHE env var. - # # The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages. - # path: | - # ${{ env.VCPKG_ROOT }} - # !${{ env.VCPKG_ROOT }}/buildtrees - # !${{ env.VCPKG_ROOT }}/packages - # !${{ env.VCPKG_ROOT }}/downloads - # !${{ env.VCPKG_ROOT }}/installed - # # The key is composed in a way that it gets properly invalidated whenever a different version of vcpkg is being used. - # key: | - # ${{ hashFiles( '.git/modules/vcpkg/HEAD' )}} + # Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg's binary caching + # when it is being run afterward by CMake. + - name: restore-vcpkg + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 #v4.0.2 + with: + # The first path is the location of vcpkg: it contains the vcpkg executable and data files, as long as the + # built package archives (aka binary cache) which are located by VCPKG_DEFAULT_BINARY_CACHE env var. + # The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages. + path: | + ${{ env.VCPKG_ROOT }} + !${{ env.VCPKG_ROOT }}/buildtrees + !${{ env.VCPKG_ROOT }}/packages + !${{ env.VCPKG_ROOT }}/downloads + !${{ env.VCPKG_ROOT }}/installed + # The key is composed in a way that it gets properly invalidated whenever a different version of vcpkg is being used. + key: | + ${{ os.release }}-${{ hashFiles( './engine/vcpkg.json' )}} - name: install-vcpkg - #if: steps.cache.outputs.cache-hit != 'true' + if: steps.cache.outputs.cache-hit != 'true' run: | - git clone https://github.com/vegastrike/vcpkg-local.git ${{ env.VCPKG_ROOT }} + git clone https://github.com/Microsoft/vcpkg.git ${{ env.VCPKG_ROOT }} ${{ env.VCPKG_ROOT }}\bootstrap-vcpkg.bat -disableMetrics - name: run-build-script @@ -111,10 +115,14 @@ jobs: GTEST_COLOR: 1 run: .\script\test.ps1 -Generator ${{ matrix.cmake-generator }} -EnablePIE ${{ matrix.enable-pie }} -BuildType ${{ matrix.build-type }} - - name: Upload artifacts - uses: skx/github-action-publish-binaries@44887b225ceca96efd8a912d39c09ad70312af31 # master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ARTIFACT_EXT: ${{ matrix.ARTIFACT_EXT }} + - name: Upload test results + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3 + if: failure() with: - path: "${{ github.workspace }}/**/*.zip" + name: test_results_xml + path: ${{github.workspace}}/build/test-results/**/*.xml + + #- name: Upload artifacts + # uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3 + # with: + # path: "${{ github.workspace }}/build/**/*.zip" diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 8c2988ca8f..5390b6d9a4 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -21,7 +21,7 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 + uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f #v4.1.3 with: fetch-depth: 2 diff --git a/.github/workflows/fortify-on-demand-scan.yml b/.github/workflows/fortify-on-demand-scan.yml index c0a5371990..c1444ecd8f 100644 --- a/.github/workflows/fortify-on-demand-scan.yml +++ b/.github/workflows/fortify-on-demand-scan.yml @@ -16,7 +16,7 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f #v4.1.3 - name: Fortify on Demand Scan # You may pin to the exact commit or the version. diff --git a/.github/workflows/gh-actions-pr.yml b/.github/workflows/gh-actions-pr.yml index 9c10df36a4..39b1cca45c 100644 --- a/.github/workflows/gh-actions-pr.yml +++ b/.github/workflows/gh-actions-pr.yml @@ -149,7 +149,7 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 + uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f #v4.1.3 with: fetch-depth: 2 submodules: false @@ -185,7 +185,7 @@ jobs: # run: ctest -V - name: Upload test results - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 #v3.1.3 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3 if: failure() with: name: test_results_xml diff --git a/.github/workflows/gh-actions-release.yml b/.github/workflows/gh-actions-release.yml index 20c58b9a2b..7d2de404fd 100644 --- a/.github/workflows/gh-actions-release.yml +++ b/.github/workflows/gh-actions-release.yml @@ -119,7 +119,7 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 + uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f #v4.1.3 with: fetch-depth: 2 submodules: false @@ -142,7 +142,7 @@ jobs: IS_RELEASE: 1 run: script/cibuild $FLAGS - name: Upload the artifacts - uses: skx/github-action-publish-binaries@44887b225ceca96efd8a912d39c09ad70312af31 # master + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ARTIFACT_EXT: ${{ matrix.ARTIFACT_EXT }} diff --git a/.github/workflows/macos-ci.yml b/.github/workflows/macos-ci.yml index f4c4df8a1e..27298f89d0 100644 --- a/.github/workflows/macos-ci.yml +++ b/.github/workflows/macos-ci.yml @@ -66,7 +66,7 @@ jobs: run: brew install openal-soft - name: Check out repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 + uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f #v4.1.3 with: fetch-depth: 2 submodules: false @@ -92,7 +92,7 @@ jobs: run: ctest -V - name: Upload test results - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 #v3.1.3 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3 if: failure() with: name: test_results_xml diff --git a/.github/workflows/macos-release.yml b/.github/workflows/macos-release.yml index f2c437a901..e3bc834ac3 100644 --- a/.github/workflows/macos-release.yml +++ b/.github/workflows/macos-release.yml @@ -1,4 +1,4 @@ -name: 'MacOS-CI' +name: 'MacOS-Release' on: release: @@ -68,7 +68,7 @@ jobs: run: brew install openal-soft - name: Check out repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 + uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f #v4.1.3 with: fetch-depth: 2 submodules: false @@ -99,10 +99,14 @@ jobs: GTEST_COLOR: 1 run: ctest -V - - name: Upload the artifacts - uses: skx/github-action-publish-binaries@44887b225ceca96efd8a912d39c09ad70312af31 # master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ARTIFACT_EXT: ${{ matrix.ARTIFACT_EXT }} + - name: Upload test results + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3 + if: failure() with: - args: "packages/*.${{ matrix.ARTIFACT_EXT }}" + name: test_results_xml + path: ${{github.workspace}}/build/test-results/**/*.xml + + #- name: Upload the artifacts + # uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3 + # with: + # args: "packages/*.${{ matrix.ARTIFACT_EXT }}" From bf7b2199ad6d23bee983c8b039f71fe21a5b81cd Mon Sep 17 00:00:00 2001 From: Stephen G Date: Mon, 22 Apr 2024 23:35:07 -0700 Subject: [PATCH 08/32] Fix one more CI issue --- .github/workflows/Windows-CI.yml | 2 +- .github/workflows/Windows-Release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Windows-CI.yml b/.github/workflows/Windows-CI.yml index aedb1ed4d1..de390c2518 100644 --- a/.github/workflows/Windows-CI.yml +++ b/.github/workflows/Windows-CI.yml @@ -85,7 +85,7 @@ jobs: !${{ env.VCPKG_ROOT }}/installed # The key is composed in a way that it gets properly invalidated whenever a different version of vcpkg is being used. key: | - ${{ os.release }}-${{ hashFiles( './engine/vcpkg.json' )}} + ${{ matrix.os }}-${{ hashFiles( './engine/vcpkg.json' )}} - name: install-vcpkg if: steps.cache.outputs.cache-hit != 'true' diff --git a/.github/workflows/Windows-Release.yml b/.github/workflows/Windows-Release.yml index 708dcc0bf9..0c636f8334 100644 --- a/.github/workflows/Windows-Release.yml +++ b/.github/workflows/Windows-Release.yml @@ -96,7 +96,7 @@ jobs: !${{ env.VCPKG_ROOT }}/installed # The key is composed in a way that it gets properly invalidated whenever a different version of vcpkg is being used. key: | - ${{ os.release }}-${{ hashFiles( './engine/vcpkg.json' )}} + ${{ matrix.os }}-${{ hashFiles( './engine/vcpkg.json' )}} - name: install-vcpkg if: steps.cache.outputs.cache-hit != 'true' From cee2a0071c75923ef83519724f6b68ff06dda46f Mon Sep 17 00:00:00 2001 From: Stephen G Date: Tue, 23 Apr 2024 09:24:17 -0700 Subject: [PATCH 09/32] particle.cpp/.h: Initialize all fields; delete texture only if refcount drops to zero --- engine/src/gfx/particle.cpp | 8 ++++++-- engine/src/gfx/particle.h | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/engine/src/gfx/particle.cpp b/engine/src/gfx/particle.cpp index 7760c7ac5b..d01ff21389 100644 --- a/engine/src/gfx/particle.cpp +++ b/engine/src/gfx/particle.cpp @@ -225,8 +225,12 @@ ParticleTrail::Config::Config(const std::string &prefix) { ParticleTrail::Config::~Config() { if (texture != nullptr) { - delete texture; - texture = nullptr; + texture->refcount--; + if (texture->refcount <= 0) + { + delete texture; + texture = nullptr; + } } } diff --git a/engine/src/gfx/particle.h b/engine/src/gfx/particle.h index 859c915614..a408259e74 100644 --- a/engine/src/gfx/particle.h +++ b/engine/src/gfx/particle.h @@ -1,7 +1,7 @@ /* * particle.h * - * Copyright (c) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, + * Copyright (c) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, * and other Vega Strike Contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -10,12 +10,12 @@ * * Vega Strike is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -68,14 +68,14 @@ class ParticleTrail { std::string prefix; bool initialized; - bool use; - bool use_points; - bool pblend; - bool psmooth; - float pgrow; - float ptrans; - float pfade; - float psize; + bool use{}; + bool use_points{}; + bool pblend{}; + bool psmooth{}; + float pgrow{}; + float ptrans{}; + float pfade{}; + float psize{}; Texture *texture; explicit Config(const std::string &prefix); From 658d82da9fb0ddd2d42e9beef980ed6d0737c559 Mon Sep 17 00:00:00 2001 From: Stephen G Date: Tue, 23 Apr 2024 11:00:38 -0700 Subject: [PATCH 10/32] 34 .cpp and .h files: Switch to VS_LOG_FLUSH_EXIT or similar where applicable --- engine/src/aldrv/al_init.cpp | 48 ----------------- engine/src/cg_global.cpp | 13 ++--- engine/src/cmd/ai/communication_xml.cpp | 12 ++--- engine/src/cmd/ai/event_xml.cpp | 7 ++- engine/src/cmd/ai/script.cpp | 8 +-- engine/src/cmd/base_interface.cpp | 5 +- engine/src/cmd/bolt.cpp | 13 ++--- engine/src/cmd/csv.cpp | 11 ++-- engine/src/cmd/jump_capable.cpp | 14 +++-- engine/src/cmd/role_bitmask.cpp | 18 +++---- engine/src/cmd/script/director.cpp | 3 +- engine/src/cmd/script/mission.cpp | 5 +- engine/src/cmd/script/mission.h | 9 ++-- engine/src/cmd/unit_generic.cpp | 4 +- engine/src/configuration/game_config.cpp | 5 +- .../tests/configuration_tests.cpp | 12 ++--- engine/src/configxml.cpp | 7 +-- engine/src/easydom.h | 7 +-- engine/src/gfx/camera.cpp | 12 ++--- engine/src/gfx/mesh_bin.cpp | 5 +- engine/src/gfx/mesh_bxm.cpp | 10 ++-- engine/src/gfx/mesh_xml.cpp | 13 +++-- engine/src/gldrv/gl_quad_list.cpp | 6 ++- engine/src/gldrv/winsys.cpp | 41 +++------------ engine/src/main.cpp | 6 +-- engine/src/main_loop.cpp | 5 +- engine/src/pk3.cpp | 15 +++--- engine/src/savegame.cpp | 13 +++-- engine/src/star_system.cpp | 3 +- engine/src/universe_util_generic.cpp | 13 ++--- engine/src/vega_cast_utils.h | 14 ++--- engine/src/vega_string_utils.h | 5 +- engine/src/vs_logging.h | 17 +++--- engine/src/vsfilesystem.cpp | 52 ++++++++----------- 34 files changed, 165 insertions(+), 266 deletions(-) diff --git a/engine/src/aldrv/al_init.cpp b/engine/src/aldrv/al_init.cpp index c08911e43d..231b803bec 100644 --- a/engine/src/aldrv/al_init.cpp +++ b/engine/src/aldrv/al_init.cpp @@ -53,54 +53,6 @@ #endif static void fixup_function_pointers(void) { - /* UNCOMMENT AS NEEDED - * talcGetAudioChannel = (ALfloat (*)(ALuint channel)) - * GP("alcGetAudioChannel_LOKI"); - * talcSetAudioChannel = (void (*)(ALuint channel, ALfloat volume)) - * GP("alcSetAudioChannel_LOKI"); - * - * talMute = (void (*)(ALvoid)) GP("alMute_LOKI"); - * talUnMute = (void (*)(ALvoid)) GP("alUnMute_LOKI"); - * - * talReverbScale = (void (*)(ALuint sid, ALfloat param)) - * GP("alReverbScale_LOKI"); - * talReverbDelay = (void (*)(ALuint sid, ALfloat param)) - * GP("alReverbDelay_LOKI"); - * - * talBombOnError = (void (*)(void)) - * GP("alBombOnError_LOKI"); - * - * if(talBombOnError == NULL) { - * VS_LOG_AND_FLUSH(fatal, "Could not GetProcAddress alBombOnError_LOKI"); - * VSExit(1); - * } - * - * talBufferi = (void (*)(ALuint, ALenum, ALint )) - * GP("alBufferi_LOKI"); - * - * if(talBufferi == NULL) { - * VS_LOG_AND_FLUSH(fatal, "Could not GetProcAddress alBufferi_LOKI"); - * VSExit(1); - * } - * - * alCaptureInit = (ALboolean (*)( ALenum, ALuint, ALsizei )) GP("alCaptureInit_EXT"); - * alCaptureDestroy = (ALboolean (*)( ALvoid )) GP("alCaptureDestroy_EXT"); - * alCaptureStart = (ALboolean (*)( ALvoid )) GP("alCaptureStart_EXT"); - * alCaptureStop = (ALboolean (*)( ALvoid )) GP("alCaptureStop_EXT"); - * alCaptureGetData = (ALsizei (*)( ALvoid*, ALsizei, ALenum, ALuint )) GP("alCaptureGetData_EXT"); - * - * talBufferAppendData = (ALuint (*)(ALuint, ALenum, ALvoid *, ALint, ALint)) GP("alBufferAppendData_LOKI"); - * talBufferAppendWriteData = (ALuint (*)(ALuint, ALenum, ALvoid *, ALint, ALint, ALenum)) GP("alBufferAppendWriteData_LOKI"); - * - * talGenStreamingBuffers = (void (*)(ALsizei n, ALuint *bids )) GP("alGenStreamingBuffers_LOKI"); - * if( talGenStreamingBuffers == NULL ) { - * VS_LOG_AND_FLUSH(fatal, "Could not GP alGenStreamingBuffers_LOKI"); - * VSExit(1); - * } - * - * - * - */ } #endif diff --git a/engine/src/cg_global.cpp b/engine/src/cg_global.cpp index 2ad2152451..18abbaed3f 100644 --- a/engine/src/cg_global.cpp +++ b/engine/src/cg_global.cpp @@ -1,10 +1,8 @@ /* * cg_global.cpp * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike - * contributors - * Copyright (C) 2021 Stephen G. Tuggy + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -17,11 +15,11 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ @@ -46,8 +44,7 @@ void CG_Cloak::cgLoadMedia( std::string pathname, std::string filename ) media.path.push_back( pathname ); std::string mediafile = media.get_file( filename ); if (mediafile == "") { - VS_LOG_AND_FLUSH(fatal, (boost::format("Unable to load %1%, exiting...") % filename)); - VSExit( 0 ); + VS_LOG_FLUSH_EXIT(fatal, (boost::format("Unable to load %1%, exiting...") % filename), 0); } this->vertexProgram = cgCreateProgramFromFile( this->shaderContext, CG_SOURCE, mediafile.data(), diff --git a/engine/src/cmd/ai/communication_xml.cpp b/engine/src/cmd/ai/communication_xml.cpp index 8297cf48d4..a40afa1129 100644 --- a/engine/src/cmd/ai/communication_xml.cpp +++ b/engine/src/cmd/ai/communication_xml.cpp @@ -1,9 +1,8 @@ /* * communication_xml.cpp * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike contributors - * Copyright (C) 2021-2022 Stephen G. Tuggy + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy + * and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -16,11 +15,11 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ @@ -173,7 +172,8 @@ void FSM::LoadXML(const char *filename) { VSFile f; VSError err = f.OpenReadOnly(filename, CommFile); if (err > Ok) { - VS_LOG_AND_FLUSH(fatal, (boost::format("Failed to open Communications file '%1%' -- aborting!\n") % filename)); + VS_LOG(fatal, (boost::format("Failed to open Communications file '%1%' -- aborting!\n") % filename)); + VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogsProgramExiting(); assert(0); return; } diff --git a/engine/src/cmd/ai/event_xml.cpp b/engine/src/cmd/ai/event_xml.cpp index d2283c244e..0a4421315b 100644 --- a/engine/src/cmd/ai/event_xml.cpp +++ b/engine/src/cmd/ai/event_xml.cpp @@ -1,9 +1,8 @@ /* * event_xml.cpp * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike contributors - * Copyright (C) 2021-2022 Stephen G. Tuggy + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -209,7 +208,7 @@ void LoadAI(const char *filename, ElemAttrMap &result, const string &faction) { VS_LOG(warning, (boost::format("ai file again %1% again not found") % full_filename)); err = f.OpenReadOnly("default.agg.xml", AiFile); if (err > Ok) { - VS_LOG(error, "ai file again default.agg.xml again not found"); + VS_LOG_AND_FLUSH(error, "ai file again default.agg.xml again not found"); return; //Who knows what will happen now? Crash? // TODO: VSExit()? } } diff --git a/engine/src/cmd/ai/script.cpp b/engine/src/cmd/ai/script.cpp index 33849ff00c..bf9d9f2432 100644 --- a/engine/src/cmd/ai/script.cpp +++ b/engine/src/cmd/ai/script.cpp @@ -1,9 +1,8 @@ /* * script.cpp * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike contributors - * Copyright (C) 2021-2022 Stephen G. Tuggy + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -11,7 +10,7 @@ * * Vega Strike is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Vega Strike is distributed in the hope that it will be useful, @@ -104,6 +103,7 @@ static HardCodedMap MakeHardCodedScripts() { tmp.insert(MyPair("roll perpendicular slow", &RollFacePerpendicularSlow)); tmp.insert(MyPair("roll perpendicular fast", &RollFacePerpendicularFast)); if (tmp.find("roll perpendicular fast") == tmp.end()) { + VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogsProgramExiting(); VSExit(1); } return tmp; diff --git a/engine/src/cmd/base_interface.cpp b/engine/src/cmd/base_interface.cpp index 714bfa3a2c..b0864b7fae 100644 --- a/engine/src/cmd/base_interface.cpp +++ b/engine/src/cmd/base_interface.cpp @@ -1,7 +1,7 @@ /* * base_interface.cpp * - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -1398,7 +1398,8 @@ void BaseInterface::Room::Talk::Click(BaseInterface *base, float x, float y, int } } } else { - VS_LOG_AND_FLUSH(fatal, "\nThere are no things to say...\n"); + VS_LOG(fatal, "\nThere are no things to say...\n"); + VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogsProgramExiting(); assert(0); } } diff --git a/engine/src/cmd/bolt.cpp b/engine/src/cmd/bolt.cpp index 459ae520bb..1963ed5ef8 100644 --- a/engine/src/cmd/bolt.cpp +++ b/engine/src/cmd/bolt.cpp @@ -1,8 +1,8 @@ /* * bolt.cpp * - * Copyright (C) Daniel Horn - * Copyright (C) 2021-2022 Stephen G. Tuggy + * Copyright (C) 2001-2024 Daniel Horn, Stephen G. Tuggy, + * and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -10,16 +10,16 @@ * * Vega Strike is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ @@ -238,7 +238,8 @@ void Bolt::Destroy(unsigned int index) { vec->pop_back(); //pop that back up } else { - VS_LOG_AND_FLUSH(fatal, "Bolt Fault Nouveau! Not found in draw queue! No Chance to recover"); + VS_LOG(fatal, "Bolt Fault Nouveau! Not found in draw queue! No Chance to recover"); + VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogsProgramExiting(); assert(0); } } diff --git a/engine/src/cmd/csv.cpp b/engine/src/cmd/csv.cpp index a537de5400..1425d47705 100644 --- a/engine/src/cmd/csv.cpp +++ b/engine/src/cmd/csv.cpp @@ -1,9 +1,8 @@ /* * csv.cpp * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike contributors - * Copyright (C) 2021-2022 Stephen G. Tuggy + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -247,7 +246,8 @@ CSVTable::Merge(const CSVTable &other) { local = columns.insert(std::pair(it->first, key.size() - 1)).first; } if (it->second >= int(colmap.size())) { - VS_LOG_AND_FLUSH(fatal, (boost::format("WTF column %1%?") % it->second)); + VS_LOG(fatal, (boost::format("WTF column %1%?") % it->second)); + VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogsProgramExiting(); abort(); } VS_LOG(debug, (boost::format(" %1% (%2%) -> %3%") % it->first % it->second % local->second)); @@ -389,8 +389,7 @@ CSVTable *loadCSVTableList(const string &csvfiles, VSFileSystem::VSFileType file } thisFile.Close(); } else if (critical) { - VS_LOG_AND_FLUSH(fatal, (boost::format("Could not load CSV database at '%1%'") % tmp)); - VSExit(2); + VS_LOG_FLUSH_EXIT(fatal, (boost::format("Could not load CSV database at '%1%'") % tmp), 2); } } if (where2 == string::npos) { diff --git a/engine/src/cmd/jump_capable.cpp b/engine/src/cmd/jump_capable.cpp index 571b470fb7..98cf2e3cda 100644 --- a/engine/src/cmd/jump_capable.cpp +++ b/engine/src/cmd/jump_capable.cpp @@ -1,9 +1,8 @@ /* * jump_capable.cpp * - * Copyright (C) Daniel Horn - * Copyright (C) 2021 Roy Falk and Stephen G. Tuggy - * Copyright (C) 2022 Stephen G. Tuggy + * Copyright (C) 2001-2024 Daniel Horn, Roy Falk, Stephen G. Tuggy, + * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -11,16 +10,16 @@ * * Vega Strike is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ @@ -607,8 +606,7 @@ bool JumpCapable::TransferUnitToSystem(StarSystem *Current) { activeStarSystem = Current; return true; } else { - VS_LOG_AND_FLUSH(fatal, "Fatal Error: cannot remove starship from critical system"); - VSExit(-4); + VS_LOG_FLUSH_EXIT(fatal, "Fatal Error: cannot remove starship from critical system", -4); } return false; } diff --git a/engine/src/cmd/role_bitmask.cpp b/engine/src/cmd/role_bitmask.cpp index f4d6969abb..92672cf3dc 100644 --- a/engine/src/cmd/role_bitmask.cpp +++ b/engine/src/cmd/role_bitmask.cpp @@ -1,9 +1,8 @@ /* * role_bitmask.cpp * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike contributors - * Copyright (C) 2021-2022 Stephen G. Tuggy + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -59,8 +58,7 @@ std::vector> &getAllRolePriorities() { std::vector &getPriority(unsigned char rolerow) { if (rolerow > getAllRolePriorities().size()) { - VS_LOG_AND_FLUSH(fatal, "FATAL ERROR ROLE OUT OF RANGE"); - VSExit(1); + VS_LOG_FLUSH_EXIT(fatal, "FATAL ERROR ROLE OUT OF RANGE", 1); } return getAllRolePriorities()[rolerow]; } @@ -101,22 +99,20 @@ std::vector > buildscripts() { std::vector vec = readCSV(temp); if (siz && getAllRolePriorities()[0].size() != vec.size()) { - VS_LOG_AND_FLUSH(fatal, + VS_LOG_FLUSH_EXIT(fatal, (boost::format( "FATAL error in hash map... column %1% in ai/VegaEvents.csv does not line up with that item in ai/VegaPriorities.csv\n") - % ((unsigned int) vec.size()))); - VSExit(-5); + % ((unsigned int) vec.size())), -5); } if (vec.size()) { vec.erase(vec.begin()); } for (unsigned int j = 0; j < vec.size(); j++) { if (getRole(vec[j]) != j) { - VS_LOG_AND_FLUSH(fatal, + VS_LOG_FLUSH_EXIT(fatal, (boost::format( "FATAL error in hash map... column %1% in ai/VegaEvents.csv does not line up with that item in ai/VegaPriorities.csv\n") - % j)); - VSExit(-5); + % j), -5); } } unsigned int i = 0; diff --git a/engine/src/cmd/script/director.cpp b/engine/src/cmd/script/director.cpp index c6a7fad89b..12cfe6f2f6 100644 --- a/engine/src/cmd/script/director.cpp +++ b/engine/src/cmd/script/director.cpp @@ -91,7 +91,8 @@ void Mission::DirectorLoop() { } catch (...) { if (PyErr_Occurred()) { - VS_LOG_AND_FLUSH(fatal, "void Mission::DirectorLoop(): Python error occurred"); + VS_LOG(fatal, "void Mission::DirectorLoop(): Python error occurred"); + VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogsProgramExiting(); PyErr_Print(); PyErr_Clear(); } diff --git a/engine/src/cmd/script/mission.cpp b/engine/src/cmd/script/mission.cpp index fa565ddffb..b76b57a708 100644 --- a/engine/src/cmd/script/mission.cpp +++ b/engine/src/cmd/script/mission.cpp @@ -1,7 +1,7 @@ /* * mission.cpp * - * Copyright (C) 2001-2023 Daniel Horn, Alexander Rawass, pyramid3d, + * Copyright (C) 2001-2024 Daniel Horn, Alexander Rawass, pyramid3d, * Stephen G. Tuggy, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -88,8 +88,7 @@ void Mission::ConstructMission(const char *configfile, const std::string &script top = domf.LoadXML(configfile); static bool dontpanic = false; if (top == NULL && !dontpanic) { - VS_LOG_AND_FLUSH(fatal, (boost::format("Panic exit - mission file %1% not found") % configfile)); - VSExit(0); + VS_LOG_FLUSH_EXIT(fatal, (boost::format("Panic exit - mission file %1% not found") % configfile), 0); } else { dontpanic = true; } diff --git a/engine/src/cmd/script/mission.h b/engine/src/cmd/script/mission.h index ddb9056f87..82f53fed77 100644 --- a/engine/src/cmd/script/mission.h +++ b/engine/src/cmd/script/mission.h @@ -1,10 +1,8 @@ /* * mission.h * - * Copyright (C) 2001-2002 Daniel Horn - * Copyright (C) Alexander Rawass - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike contributors - * Copyright (C) 2021-2023 Stephen G. Tuggy, Benjamen R. Meyer + * Copyright (C) 2001-2024 Daniel Horn, Alexander Rawass , + * pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -303,7 +301,8 @@ class varInst { } varInst() { - VS_LOG_AND_FLUSH(fatal, "varInst() obsolete"); + VS_LOG(fatal, "varInst() obsolete"); + VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogsProgramExiting(); assert(0); } diff --git a/engine/src/cmd/unit_generic.cpp b/engine/src/cmd/unit_generic.cpp index ce51e2e6a0..1f4899261a 100644 --- a/engine/src/cmd/unit_generic.cpp +++ b/engine/src/cmd/unit_generic.cpp @@ -1,7 +1,7 @@ /* * unit_generic.cpp * - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -341,7 +341,7 @@ Unit::~Unit() { VS_LOG(error, (boost::format("Assumed exit on unit %1%(if not quitting, report error)") % name)); } if (ucref) { - VS_LOG_AND_FLUSH(fatal, "DISASTER AREA!!!!"); + VS_LOG_FLUSH_EXIT(fatal, "DISASTER AREA!!!!", -10); } VS_LOG(trace, (boost::format("Deallocating unit %1$s addr=%2$x refs=%3$d") % name.get().c_str() % this % ucref)); diff --git a/engine/src/configuration/game_config.cpp b/engine/src/configuration/game_config.cpp index af76a1561b..4f18f6ce1c 100644 --- a/engine/src/configuration/game_config.cpp +++ b/engine/src/configuration/game_config.cpp @@ -1,7 +1,7 @@ /* * game_config.cpp * - * Copyright (C) 2020-2022 Daniel Horn, Roy Falk, Stephen G. Tuggy, David Wales, + * Copyright (C) 2020-2024 Daniel Horn, Roy Falk, Stephen G. Tuggy, David Wales, * and other Vega Strike Contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -75,8 +75,7 @@ void vega_config::GameConfig::LoadGameConfig(const std::string &filename) { if (boost::filesystem::exists(filename)) { VS_LOG(debug, (boost::format("%1%: Found game config at '%2%'") % __func__ % filename)); } else { - VS_LOG_AND_FLUSH(fatal, (boost::format("%1%: Could not find game config at '%2%'") % __func__ % filename)); -// VSExit + VS_LOG_FLUSH_EXIT(fatal, (boost::format("%1%: Could not find game config at '%2%'") % __func__ % filename), 404); } pt::read_xml(filename, temp_ptree, boost::property_tree::xml_parser::no_comments); // pt::write_xml(filename + ".out.xml", temp_ptree); diff --git a/engine/src/configuration/tests/configuration_tests.cpp b/engine/src/configuration/tests/configuration_tests.cpp index 866108cd10..20a7c843da 100644 --- a/engine/src/configuration/tests/configuration_tests.cpp +++ b/engine/src/configuration/tests/configuration_tests.cpp @@ -1,7 +1,7 @@ /* * configuration_tests.cpp * - * Copyright (C) 2021-2022 Daniel Horn, Roy Falk, David Wales, + * Copyright (C) 2021-2024 Daniel Horn, Roy Falk, David Wales, * Stephen G. Tuggy, and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -10,12 +10,12 @@ * * Vega Strike is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -83,10 +83,4 @@ TEST(LoadConfig, Sanity) { EXPECT_EQ(test_string2, "hello"); EXPECT_EQ(escaped_string2, "#FF0000Hello\r\nthere!#000000"); -// VS_LOG_AND_FLUSH(fatal, "Starting GetFloat performance test"); -// for (int i = 0; i < 1000000; ++i) { -// vega_config::GetGameConfig().GetFloat("test.subsection.subsection_float_variable", 11.1F); -// } -// VS_LOG_AND_FLUSH(fatal, "Finished GetFloat performance test"); - } diff --git a/engine/src/configxml.cpp b/engine/src/configxml.cpp index c4969f4d2b..c1a7bcc52e 100644 --- a/engine/src/configxml.cpp +++ b/engine/src/configxml.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, Alexander Rawass, pyramid3d, Stephen G. Tuggy, + * configxml.cpp + * + * Copyright (C) 2001-2024 Daniel Horn, Alexander Rawass, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -39,8 +41,7 @@ VegaConfig::VegaConfig(const char *configfile) { configNodeFactory domf; configNode *top = (configNode *) domf.LoadXML(configfile); if (top == nullptr) { - VS_LOG_AND_FLUSH(fatal, "Panic exit - no configuration"); - VSExit(0); + VS_LOG_FLUSH_EXIT(fatal, "Panic exit - no configuration", 0); } variables = nullptr; colors = nullptr; diff --git a/engine/src/easydom.h b/engine/src/easydom.h index e79913f9f6..bf5a2209bd 100644 --- a/engine/src/easydom.h +++ b/engine/src/easydom.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2023 Daniel Horn, Alexander Rawass, pyramid3d, + * easydom.h + * + * Copyright (C) 2001-2024 Daniel Horn, Alexander Rawass, pyramid3d, * Stephen G. Tuggy, Benjamen R. Meyer, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -280,8 +282,7 @@ class easyDomFactory { doTextBuffer(); domNodeType *stacktop = nodestack.top(); if (stacktop->Name() != name) { - VS_LOG_AND_FLUSH(fatal, (boost::format("error: expected %1% , got %2%") % stacktop->Name() % name)); - VSExit(1); + VS_LOG_FLUSH_EXIT(fatal, (boost::format("error: expected %1% , got %2%") % stacktop->Name() % name), 1); } else { nodestack.pop(); } diff --git a/engine/src/gfx/camera.cpp b/engine/src/gfx/camera.cpp index d1a65a4998..509a8d34a9 100644 --- a/engine/src/gfx/camera.cpp +++ b/engine/src/gfx/camera.cpp @@ -1,7 +1,7 @@ /* * camera.cpp * - * Copyright (C) 2001-2022 Daniel Horn, Alan Shieh, pyramid3d, + * Copyright (C) 2001-2024 Daniel Horn, Alan Shieh, pyramid3d, * Stephen G. Tuggy, and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -10,16 +10,16 @@ * * Vega Strike is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ @@ -211,8 +211,8 @@ void Camera::SetPosition(const QVector &origin, const Vector &vel, const Vector Coord = origin; changed = GFXTRUE; } else { - VS_LOG_AND_FLUSH(fatal, "fatal error in camera"); - VSExit(-3); // What value should this return? -- stephengtuggy 2021-09-06 + // What value should this return? -- stephengtuggy 2021-09-06 + VS_LOG_FLUSH_EXIT(fatal, "fatal error in camera", -3); } } diff --git a/engine/src/gfx/mesh_bin.cpp b/engine/src/gfx/mesh_bin.cpp index 289884b7cb..e8802cdb51 100644 --- a/engine/src/gfx/mesh_bin.cpp +++ b/engine/src/gfx/mesh_bin.cpp @@ -1,7 +1,7 @@ /* * mesh_bin.cpp * - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -78,8 +78,7 @@ void Mesh::LoadBinary(const char *filename, int faction) { VSFile fp; VSError err = fp.OpenReadOnly(filename, MeshFile); if (err > Ok) { - VS_LOG_AND_FLUSH(fatal, (boost::format("Failed to load file %1$s") % filename)); - VSExit(1); + VS_LOG_FLUSH_EXIT(fatal, (boost::format("Failed to load file %1$s") % filename), 1); } TexNameLength = readi(fp); if (TexNameLength) { diff --git a/engine/src/gfx/mesh_bxm.cpp b/engine/src/gfx/mesh_bxm.cpp index bbf027985b..91f1c4f5b9 100644 --- a/engine/src/gfx/mesh_bxm.cpp +++ b/engine/src/gfx/mesh_bxm.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * mesh_bxm.cpp + * + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -319,12 +321,14 @@ vector Mesh::LoadMeshes(VSFileSystem::VSFile &Inputfile, #else uint32bit Inputlength = Inputfile.Size(); if (Inputlength < sizeof(uint32bit) * 13 || Inputlength > (1 << 30)) { - VS_LOG_AND_FLUSH(fatal, (boost::format("Corrupt file %1%, aborting") % Inputfile.GetFilename())); + VS_LOG(fatal, (boost::format("Corrupt file %1%, aborting") % Inputfile.GetFilename())); + VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogsProgramExiting(); abort(); } inmemfile = (chunk32 *) malloc(Inputlength); if (!inmemfile) { - VS_LOG_AND_FLUSH(fatal, "Buffer allocation failed, Aborting"); + VS_LOG(fatal, "Buffer allocation failed, Aborting"); + VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogsProgramExiting(); exit(-2); } Inputfile.Read(inmemfile, Inputlength); diff --git a/engine/src/gfx/mesh_xml.cpp b/engine/src/gfx/mesh_xml.cpp index a5039a5793..cf0fa90934 100644 --- a/engine/src/gfx/mesh_xml.cpp +++ b/engine/src/gfx/mesh_xml.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, chuck_starchaser, pyramid3d, + * mesh_xml.cpp + * + * Copyright (C) 2001-2024 Daniel Horn, chuck_starchaser, pyramid3d, * Stephen G. Tuggy, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -1186,12 +1188,10 @@ void LaunchConverter(const char *input, const char *output, const char *args = " soundserver_path = VSFileSystem::datadir + "/mesher"; firstarg = string("\"") + soundserver_path + string("\""); pid = execlp(soundserver_path.c_str(), soundserver_path.c_str(), input, output, args, NULL); - VS_LOG_AND_FLUSH(fatal, "Unable to spawn converter"); - VSExit(-1); + VS_LOG_FLUSH_EXIT(fatal, "Unable to spawn converter", -1); } else { if (pid == -1) { - VS_LOG_AND_FLUSH(fatal, "Unable to spawn converter"); - VSExit(-1); + VS_LOG_FLUSH_EXIT(fatal, "Unable to spawn converter", -1); } int mystat = 0; waitpid(pid, &mystat, 0); @@ -1427,8 +1427,7 @@ void Mesh::LoadXML(VSFileSystem::VSFile &f, XML_ParserFree(parser); //Now, copy everything into the mesh data structures if (xml->load_stage != 5) { - VS_LOG_AND_FLUSH(fatal, "Warning: mesh load possibly failed"); - VSExit(-1); + VS_LOG_FLUSH_EXIT(fatal, "Warning: mesh load possibly failed", -1); } PostProcessLoading(xml, textureOverride); numlods = xml->lod.size() + 1; diff --git a/engine/src/gldrv/gl_quad_list.cpp b/engine/src/gldrv/gl_quad_list.cpp index 216cc95bc4..6fd7a264cc 100644 --- a/engine/src/gldrv/gl_quad_list.cpp +++ b/engine/src/gldrv/gl_quad_list.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, Alan Shieh, pyramid3d, + * gl_quad_list.cpp + * + * Copyright (C) 2001-2024 Daniel Horn, Alan Shieh, pyramid3d, * Stephen G. Tuggy, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -82,7 +84,7 @@ int GFXQuadList::AddQuad(const GFXVertex *vertices, const GFXColorVertex *color) } int *tmp = (int *) realloc(quadassignments, numVertices * sizeof(int) / 4); if (tmp == nullptr) { - VS_LOG_AND_FLUSH(fatal, "Error reallocating quadassignments!"); + VS_LOG_FLUSH_EXIT(fatal, "Error reallocating quadassignments!", -1); return -1; } else { quadassignments = tmp; diff --git a/engine/src/gldrv/winsys.cpp b/engine/src/gldrv/winsys.cpp index 272d3adce6..e48ebf4ea3 100644 --- a/engine/src/gldrv/winsys.cpp +++ b/engine/src/gldrv/winsys.cpp @@ -243,54 +243,27 @@ static bool setup_sdl_video_mode(int *argc, char **argv) { if(!window) { std::cerr << "No window\n" << std::flush; - VSExit(1); + VS_LOG_FLUSH_EXIT(fatal, "No window", 1); } SDL_GL_CreateContext(window); screen = SDL_GetWindowSurface(window); //SDL_CreateRenderer(window, -1, video_flags); if (!screen) { - - VS_LOG(info, (boost::format("Couldn't initialize video: %1%") % SDL_GetError())); - VSExit(1); - - /*for (int counter = 0; window == nullptr && counter < 2; ++counter) { - for (int bpd = 4; bpd > 1; --bpd) { - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, bpd * 8); - if ((screen = SDL_SetVideoMode(width, height, bpp, video_flags | SDL_ANYFORMAT)) - == NULL) { - VS_LOG_AND_FLUSH(error, - (boost::format("Couldn't initialize video bpp %1% depth %2%: %3%") - % bpp - % (bpd * 8) - % SDL_GetError())); - } else { - break; - } - } - if (screen == NULL) { - SDL_GL_SetAttribute(SDL_GL_RED_SIZE, otherattributes); - SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, otherattributes); - SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, otherattributes); - gl_options.color_depth = bpp = otherbpp; - } - } - if (screen == NULL) { - VS_LOG_AND_FLUSH(fatal, "FAILED to initialize video"); - VSExit(1); - }*/ + VS_LOG_FLUSH_EXIT(fatal, (boost::format("Couldn't initialize video: %1%") % SDL_GetError()), 1); } std::string version = (const char *) glGetString(GL_RENDERER); if (version == "GDI Generic") { if (game_options()->gl_accelerated_visual) { VS_LOG(error, "GDI Generic software driver reported, trying to reset."); + VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogsProgramExiting(); SDL_Quit(); game_options()->gl_accelerated_visual = false; return false; } else { VS_LOG(error, "GDI Generic software driver reported, reset failed.\n"); - VS_LOG(error, "Please make sure a graphics card driver is installed and functioning properly.\n"); + VS_LOG_AND_FLUSH(error, "Please make sure a graphics card driver is installed and functioning properly.\n"); } } @@ -327,7 +300,8 @@ void winsys_init(int *argc, char **argv, char const *window_title, char const *i * Initialize SDL */ if (SDL_Init(sdl_flags) < 0) { - VS_LOG_AND_FLUSH(fatal, (boost::format("Couldn't initialize SDL: %1%") % SDL_GetError())); + VS_LOG(fatal, (boost::format("Couldn't initialize SDL: %1%") % SDL_GetError())); + VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogsProgramExiting(); exit(1); // stephengtuggy 2020-07-27 - I would use VSExit here, but that calls winsys_exit, which I'm not sure will work if winsys_init hasn't finished yet. } @@ -770,7 +744,8 @@ void winsys_init( int *argc, char **argv, char const *window_title, char const * glutWindow = glutCreateWindow( window_title ); if (glutWindow == 0) { - VS_LOG_AND_FLUSH(fatal, "Couldn't create a window."); + VS_LOG(fatal, "Couldn't create a window."); + VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogsProgramExiting(); exit( 1 ); // stephengtuggy 2020-07-27 - I would use VSExit here, but that calls winsys_exit, which I'm not sure will work if winsys_init hasn't finished yet. } } diff --git a/engine/src/main.cpp b/engine/src/main.cpp index 2eab4b6dbb..ed07497a85 100644 --- a/engine/src/main.cpp +++ b/engine/src/main.cpp @@ -363,8 +363,7 @@ int main(int argc, char *argv[]) { #if defined(HAVE_SDL) #ifndef NO_SDL_JOYSTICK if (SDL_InitSubSystem(SDL_INIT_JOYSTICK)) { - VS_LOG_AND_FLUSH(fatal, (boost::format("Couldn't initialize SDL: %1%") % SDL_GetError())); - VSExit(1); + VS_LOG_FLUSH_EXIT(fatal, (boost::format("Couldn't initialize SDL: %1%") % SDL_GetError()), 1); } #endif #endif @@ -587,9 +586,8 @@ void bootstrap_main_loop() { if (!ignore_network) { //In network mode, test if all player sections are present if (pname.empty()) { - VS_LOG_AND_FLUSH(fatal, (boost::format("Missing or incomplete section for player %1%") % p)); cleanexit = true; - VSExit(1); + VS_LOG_FLUSH_EXIT(fatal, (boost::format("Missing or incomplete section for player %1%") % p), 1); } } playername.push_back(pname); diff --git a/engine/src/main_loop.cpp b/engine/src/main_loop.cpp index e843a6c32a..08450249a0 100644 --- a/engine/src/main_loop.cpp +++ b/engine/src/main_loop.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * main_loop.cpp + * + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -274,6 +276,7 @@ void QuitNow() { delete forcefeedback; forcefeedback = nullptr; } + VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogsProgramExiting(); VSExit(0); } } diff --git a/engine/src/pk3.cpp b/engine/src/pk3.cpp index 6fd2605b8a..a8443080b4 100644 --- a/engine/src/pk3.cpp +++ b/engine/src/pk3.cpp @@ -1,4 +1,6 @@ /* + * pk3.cpp + * * Copyright 2002-2003 LibPK3, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -48,8 +50,8 @@ */ /* - * Further Modified by Stephen G. Tuggy 2021-09-06 - * - Use VS_LOG or VS_LOG_AND_FLUSH instead of BOOST_LOG_TRIVIAL + * Further Modified by Stephen G. Tuggy 2021-09-06 and 2024-04-23 + * - Use VS_LOG, VS_LOG_AND_FLUSH, etc. instead of BOOST_LOG_TRIVIAL */ #include "pk3.h" @@ -207,8 +209,7 @@ bool CPK3::CheckPK3(FILE *f) { dh.correctByteOrder(); //Check if (dh.sig != TZipDirHeader::SIGNATURE) { - VS_LOG_AND_FLUSH(fatal, "PK3 -- BAD DIR HEADER SIGNATURE, NOT A PK3 FILE !"); - VSExit(1); + VS_LOG_FLUSH_EXIT(fatal, "PK3 -- BAD DIR HEADER SIGNATURE, NOT A PK3 FILE !", 1); return false; } //Go to the beginning of the directory. @@ -217,8 +218,7 @@ bool CPK3::CheckPK3(FILE *f) { //Allocate the data buffer, and read the whole thing. m_pDirData = new char[dh.dirSize + dh.nDirEntries * sizeof(*m_papDir)]; if (!m_pDirData) { - VS_LOG_AND_FLUSH(fatal, "PK3 -- ERROR ALLOCATING DATA BUFFER !"); - VSExit(1); + VS_LOG_FLUSH_EXIT(fatal, "PK3 -- ERROR ALLOCATING DATA BUFFER !", 1); return false; } memset(m_pDirData, 0, dh.dirSize + dh.nDirEntries * sizeof(*m_papDir)); @@ -237,8 +237,7 @@ bool CPK3::CheckPK3(FILE *f) { m_papDir[i] = &fh; //Check the directory entry integrity. if (fh.sig != TZipDirFileHeader::SIGNATURE) { - VS_LOG_AND_FLUSH(fatal, "PK3 -- ERROR BAD DIRECTORY SIGNATURE !"); - VSExit(1); + VS_LOG_FLUSH_EXIT(fatal, "PK3 -- ERROR BAD DIRECTORY SIGNATURE !", 1); ret = false; } else { pfh += sizeof(fh); diff --git a/engine/src/savegame.cpp b/engine/src/savegame.cpp index 268d40e284..dfac5697e9 100644 --- a/engine/src/savegame.cpp +++ b/engine/src/savegame.cpp @@ -93,15 +93,13 @@ std::string GetHelperPlayerSaveGame(int num) { f.Write("\n", 1); f.Close(); } else { - VS_LOG_AND_FLUSH(fatal, + VS_LOG_FLUSH_EXIT(fatal, (boost::format("!!! ERROR : Creating default save.4.x.txt file : %1%") - % f.GetFullPath())); - VSExit(1); + % f.GetFullPath()), 1); } err = f.OpenReadOnly("save.4.x.txt", UnknownFile); if (err > Ok) { - VS_LOG_AND_FLUSH(fatal, "!!! ERROR : Opening the default save we just created"); - VSExit(1); + VS_LOG_FLUSH_EXIT(fatal, "!!! ERROR : Opening the default save we just created", 1); } } if (err <= Ok) { @@ -292,7 +290,7 @@ bool isUtf8SaveGame(std::string filename) { if (check.validUtf8(savegame)) { return true; } else { - VS_LOG_AND_FLUSH(fatal, (boost::format("ERROR: save file %1% is not UTF-8") % path)); + VS_LOG_FLUSH_EXIT(fatal, (boost::format("ERROR: save file %1% is not UTF-8") % path), -8); return false; } } @@ -338,7 +336,8 @@ void SaveGame::SetPlayerLocation(const QVector &v) { if ((FINITE(v.i) && FINITE(v.j) && FINITE(v.k))) { PlayerLocation = v; } else { - VS_LOG_AND_FLUSH(fatal, "NaN ERROR saving unit"); + VS_LOG(fatal, "NaN ERROR saving unit"); + VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogsProgramExiting(); assert(FINITE(v.i) && FINITE(v.j) && FINITE(v.k)); PlayerLocation.Set(1, 1, 1); } diff --git a/engine/src/star_system.cpp b/engine/src/star_system.cpp index 7bd4fbe8c5..c6049d2f7e 100644 --- a/engine/src/star_system.cpp +++ b/engine/src/star_system.cpp @@ -681,7 +681,8 @@ void StarSystem::ExecuteUnitAI() { } catch (const boost::python::error_already_set &) { if (PyErr_Occurred()) { - VS_LOG_AND_FLUSH(fatal, "void StarSystem::ExecuteUnitAI(): Python error occurred"); + VS_LOG(fatal, "void StarSystem::ExecuteUnitAI(): Python error occurred"); + VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogsProgramExiting(); PyErr_Print(); PyErr_Clear(); } diff --git a/engine/src/universe_util_generic.cpp b/engine/src/universe_util_generic.cpp index 6f3aa23764..e432b4d2a7 100644 --- a/engine/src/universe_util_generic.cpp +++ b/engine/src/universe_util_generic.cpp @@ -1,7 +1,7 @@ /* * universe_util_generic.cpp * - * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -940,18 +940,13 @@ namespace UniverseUtil { << lf; } catch (boost::filesystem::filesystem_error &fse) { - VS_LOG_AND_FLUSH(fatal, "boost::filesystem::filesystem_error encountered:"); - VS_LOG_AND_FLUSH(fatal, fse.what()); - VSExit(-6); + VS_LOG_FLUSH_EXIT(fatal, (boost::format("boost::filesystem::filesystem_error encountered: %1%") % fse.what()), -6); } catch (std::exception &e) { - VS_LOG_AND_FLUSH(fatal, "std::exception encountered:"); - VS_LOG_AND_FLUSH(fatal, e.what()); - VSExit(-6); + VS_LOG_FLUSH_EXIT(fatal, (boost::format("std::exception encountered: %1%") % e.what()), -6); } catch (...) { - VS_LOG_AND_FLUSH(fatal, "unknown exception type encountered!"); - VSExit(-6); + VS_LOG_FLUSH_EXIT(fatal, "unknown exception type encountered!", -6); } ss << "Credits: " << static_cast(creds) diff --git a/engine/src/vega_cast_utils.h b/engine/src/vega_cast_utils.h index 8a7db5477f..c8c45ff002 100644 --- a/engine/src/vega_cast_utils.h +++ b/engine/src/vega_cast_utils.h @@ -1,7 +1,7 @@ /* * vega_cast_utils.h * - * Copyright (C) 2001-2023 Daniel Horn, Stephen G. Tuggy, Benjamen R. Meyer, + * Copyright (C) 2001-2024 Daniel Horn, Stephen G. Tuggy, Benjamen R. Meyer, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -36,12 +36,10 @@ inline TargetType* vega_dynamic_cast_ptr(SourceType* from) { try { ret_val = dynamic_cast(from); } catch (std::bad_cast& e) { - VS_LOG_AND_FLUSH(fatal, (boost::format("Fatal Error '%1%' casting type %2%* to %3%*") % e.what() % typeid(SourceType).name() % typeid(TargetType).name())); - VSExit(-422); + VS_LOG_FLUSH_EXIT(fatal, (boost::format("Fatal Error '%1%' casting type %2%* to %3%*") % e.what() % typeid(SourceType).name() % typeid(TargetType).name()), -422); } if (ret_val == nullptr) { - VS_LOG_AND_FLUSH(fatal, (boost::format("Fatal Failure to Cast type %1%* to %2%* -- nullptr encountered") % typeid(SourceType).name() % typeid(TargetType).name())); - VSExit(-422); + VS_LOG_FLUSH_EXIT(fatal, (boost::format("Fatal Failure to Cast type %1%* to %2%* -- nullptr encountered") % typeid(SourceType).name() % typeid(TargetType).name()), -422); } return ret_val; } @@ -52,12 +50,10 @@ inline const TargetType* vega_dynamic_const_cast_ptr(const SourceType* from) { try { ret_val = dynamic_cast(from); } catch (std::bad_cast& e) { - VS_LOG_AND_FLUSH(fatal, (boost::format("Fatal Error '%1%' casting type %2%* to %3%*") % e.what() % typeid(SourceType).name() % typeid(TargetType).name())); - VSExit(-422); + VS_LOG_FLUSH_EXIT(fatal, (boost::format("Fatal Error '%1%' casting type %2%* to %3%*") % e.what() % typeid(SourceType).name() % typeid(TargetType).name()), -422); } if (ret_val == nullptr) { - VS_LOG_AND_FLUSH(fatal, (boost::format("Fatal Failure to Cast type %1%* to %2%* -- nullptr encountered") % typeid(SourceType).name() % typeid(TargetType).name())); - VSExit(-422); + VS_LOG_FLUSH_EXIT(fatal, (boost::format("Fatal Failure to Cast type %1%* to %2%* -- nullptr encountered") % typeid(SourceType).name() % typeid(TargetType).name()), -422); } return ret_val; } diff --git a/engine/src/vega_string_utils.h b/engine/src/vega_string_utils.h index 224f7625ec..0471b34921 100644 --- a/engine/src/vega_string_utils.h +++ b/engine/src/vega_string_utils.h @@ -1,7 +1,7 @@ /* * vega_string_utils.h * - * Copyright (C) 2001-2023 Daniel Horn, Stephen G. Tuggy, Benjamen R. Meyer, + * Copyright (C) 2001-2024 Daniel Horn, Stephen G. Tuggy, Benjamen R. Meyer, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -38,8 +38,7 @@ inline char *vega_str_dup(const char *string) { alloc = (char *)malloc(buf_size); if (alloc == nullptr) { - VS_LOG_AND_FLUSH(fatal, "Out of memory"); - VSExit(-1); + VS_LOG_FLUSH_EXIT(fatal, "Out of memory", -1); } strncpy(alloc, string, buf_size); alloc[buf_size - 1] = '\0'; diff --git a/engine/src/vs_logging.h b/engine/src/vs_logging.h index fb1c38f70b..5cddf34e20 100644 --- a/engine/src/vs_logging.h +++ b/engine/src/vs_logging.h @@ -61,15 +61,18 @@ typedef boost::log::sinks::text_file_backend FileLogBackEnd; typedef boost::log::sinks::asynchronous_sink ConsoleLogSink; typedef boost::log::sinks::asynchronous_sink FileLogSink; -#define VS_LOG(log_level, log_message) \ - do { \ - VegaStrikeLogging::VegaStrikeLogger::instance().Log(VegaStrikeLogging::vega_log_level::log_level, (log_message)); \ +#define VS_LOG(log_level, log_message) \ + do { \ + VegaStrikeLogging::VegaStrikeLogger::instance().Log(VegaStrikeLogging::vega_log_level::log_level, (log_message)); \ } while (false) -#define VS_LOG_AND_FLUSH(log_level, log_message) \ - do { \ - VegaStrikeLogging::VegaStrikeLogger::instance().LogAndFlush(VegaStrikeLogging::vega_log_level::log_level, (log_message)); \ +#define VS_LOG_AND_FLUSH(log_level, log_message) \ + do { \ + VegaStrikeLogging::VegaStrikeLogger::instance().LogAndFlush(VegaStrikeLogging::vega_log_level::log_level, (log_message)); \ + } while (false) +#define VS_LOG_FLUSH_EXIT(log_level, log_message, exit_code) \ + do { \ + VegaStrikeLogging::VegaStrikeLogger::instance().LogFlushExit(VegaStrikeLogging::vega_log_level::log_level, (log_message), (exit_code)); \ } while (false) -//#define VS_LOG_FLUSH_EXIT(log_level, log_message) struct VegaStrikeLogger { private: diff --git a/engine/src/vsfilesystem.cpp b/engine/src/vsfilesystem.cpp index 083930b7e8..d96454e081 100644 --- a/engine/src/vsfilesystem.cpp +++ b/engine/src/vsfilesystem.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, Nachum Barcohen, Roy Falk, + * vsfilesystem.cpp + * + * Copyright (C) 2001-2024 Daniel Horn, Nachum Barcohen, Roy Falk, * pyramid3d, Stephen G. Tuggy, and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -13,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -472,13 +474,11 @@ void InitHomeDirectory() if (conversionResult == 0) { userdir = mbcsPath; } else { - VS_LOG_AND_FLUSH(fatal, "!!! Fatal Error converting user's home directory to MBCS"); - VSExit(1); + VS_LOG_FLUSH_EXIT(fatal, "!!! Fatal Error converting user's home directory to MBCS", 1); } } else { - VS_LOG_AND_FLUSH(fatal, "!!! Fatal Error getting user's home directory"); CoTaskMemFree(pszPath); - VSExit(1); + VS_LOG_FLUSH_EXIT(fatal, "!!! Fatal Error getting user's home directory", 1); } boost::filesystem::path home_path{userdir}; @@ -498,8 +498,7 @@ void InitHomeDirectory() { pwent = getpwuid(getuid()); chome_path = pwent->pw_dir; if (!DirectoryExists(chome_path)) { - VS_LOG_AND_FLUSH(fatal, "!!! ERROR : home directory not found"); - VSExit(1); + VS_LOG_FLUSH_EXIT(fatal, "!!! ERROR : home directory not found", 1); } string user_home_path(chome_path); homedir = user_home_path + "/" + HOMESUBDIR; @@ -576,8 +575,7 @@ void InitDataDirectory() { } if (chdir(datadir.c_str()) < 0) { - VS_LOG_AND_FLUSH(fatal, "Error changing to datadir"); - VSExit(1); + VS_LOG_FLUSH_EXIT(fatal, "Error changing to datadir", 1); } if (nullptr != getcwd(tmppath, VS_PATH_BUF_SIZE - 1)) { datadir = string(tmppath); @@ -684,8 +682,7 @@ void LoadConfig(string subdir) { VS_LOG_AND_FLUSH(fatal, (boost::format("CONFIGFILE - No config found in data dir : %1%") % (datadir + "/" + config_file))); - VS_LOG_AND_FLUSH(fatal, "CONFIG FILE NOT FOUND !!!"); - VSExit(1); + VS_LOG_FLUSH_EXIT(fatal, "CONFIG FILE NOT FOUND !!!", 1); } } } else if (!subdir.empty()) { @@ -715,8 +712,7 @@ void LoadConfig(string subdir) { if (true == legacy_data_dir_mode) { VS_LOG(info, (boost::format("DATADIR - No datadir specified in config file, using : %1%") % datadir)); } else { - VS_LOG_AND_FLUSH(fatal, "DATADIR - No datadir specified in config file"); - VSExit(1); + VS_LOG_FLUSH_EXIT(fatal, "DATADIR - No datadir specified in config file", 1); } } @@ -727,11 +723,10 @@ void LoadConfig(string subdir) { try { Galaxy galaxy = Galaxy(universe_file); } catch (std::exception &e) { - VS_LOG_AND_FLUSH(fatal, + VS_LOG_FLUSH_EXIT(fatal, (boost::format( "Error while loading configuration. Did you specify the asset directory? Error: %1%") - % e.what())); - VSExit(1); + % e.what()), 1); } } @@ -1044,7 +1039,8 @@ void CreateDirectoryAbs(const char *filename) { #endif ); if (err < 0 && errno != EEXIST) { - VS_LOG_AND_FLUSH(fatal, (boost::format("Errno=%1% - FAILED TO CREATE : %2%") % errno % filename)); + VS_LOG(fatal, (boost::format("Errno=%1% - FAILED TO CREATE : %2%") % errno % filename)); + VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogsProgramExiting(); GetError("CreateDirectory"); VSExit(1); } @@ -1491,8 +1487,7 @@ void VSFile::checkExtracted() { //File is not opened so we open it and add it in the pk3 file map CPK3 *pk3newfile = new CPK3; if (!pk3newfile->Open(full_vol_path.c_str())) { - VS_LOG_AND_FLUSH(fatal, (boost::format("!!! ERROR : opening volume : %1%") % full_vol_path)); - VSExit(1); + VS_LOG_FLUSH_EXIT(fatal, (boost::format("!!! ERROR : opening volume : %1%") % full_vol_path), 1); } std::pair pk3_pair(full_vol_path, pk3newfile); pk3_opened_files.insert(pk3_pair); @@ -1580,11 +1575,10 @@ VSError VSFile::OpenReadOnly(const char *file, VSFileType type) { err = FileNotFound; } else { if ((this->fp = fopen(filestr.c_str(), "rb")) == nullptr) { - VS_LOG_AND_FLUSH(fatal, + VS_LOG_FLUSH_EXIT(fatal, (boost::format( "!!! SERIOUS ERROR : failed to open Unknown file %1% - this should not happen") - % filestr)); - VSExit(1); + % filestr), 1); } this->valid = true; if (VSFS_DEBUG() > 1) { @@ -1842,8 +1836,7 @@ size_t VSFile::Write(const void *ptr, size_t length) { size_t nbwritten = fwrite(ptr, 1, length, this->fp); return nbwritten; } else { - VS_LOG_AND_FLUSH(fatal, "!!! ERROR : Writing is not supported within resource/volume files"); - VSExit(1); + VS_LOG_FLUSH_EXIT(fatal, "!!! ERROR : Writing is not supported within resource/volume files", 1); } return Ok; } @@ -1857,8 +1850,7 @@ VSError VSFile::WriteLine(const void *ptr) { if (!UseVolumes[alt_type] || this->volume_type == VSFSNone) { fputs((const char *) ptr, this->fp); } else { - VS_LOG_AND_FLUSH(fatal, "!!! ERROR : Writing is not supported within resource/volume files"); - VSExit(1); + VS_LOG_FLUSH_EXIT(fatal, "!!! ERROR : Writing is not supported within resource/volume files", 1); } return Ok; } @@ -1875,8 +1867,7 @@ int VSFile::Fprintf(const char *format, ...) { va_end(ap); return retVal; } else { - VS_LOG_AND_FLUSH(fatal, "!!! ERROR : Writing is not supported within resource/volume files"); - VSExit(1); + VS_LOG_FLUSH_EXIT(fatal, "!!! ERROR : Writing is not supported within resource/volume files", 1); } return 0; } @@ -1984,8 +1975,7 @@ void VSFile::Clear() { VSExit(1); } } else { - VS_LOG_AND_FLUSH(fatal, "!!! ERROR : Writing is not supported within resource/volume files"); - VSExit(1); + VS_LOG_FLUSH_EXIT(fatal, "!!! ERROR : Writing is not supported within resource/volume files", 1); } } From 423a6a5bb7fb853d458ff01cf8758404cbfce05e Mon Sep 17 00:00:00 2001 From: Stephen G Date: Tue, 23 Apr 2024 11:07:01 -0700 Subject: [PATCH 11/32] vs_logging.cpp: ... --- engine/src/vs_logging.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engine/src/vs_logging.cpp b/engine/src/vs_logging.cpp index 87c95b3b9e..e6d7c89ec7 100644 --- a/engine/src/vs_logging.cpp +++ b/engine/src/vs_logging.cpp @@ -123,12 +123,12 @@ void VegaStrikeLogger::FlushLogsProgramExiting() { file_log_sink_->flush(); } - console_log_sink_.reset(); - file_log_sink_.reset(); - std::cout << std::flush; std::cerr << std::flush; std::clog << std::flush; + + console_log_sink_.reset(); + file_log_sink_.reset(); } VegaStrikeLogger::VegaStrikeLogger() : slg_(), file_log_sink_(nullptr) { From 4343ea902925db951c870547e6b74e9965ecd889 Mon Sep 17 00:00:00 2001 From: Stephen G Date: Tue, 23 Apr 2024 11:10:39 -0700 Subject: [PATCH 12/32] vs_logging.cpp: ... --- engine/src/vs_logging.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/src/vs_logging.cpp b/engine/src/vs_logging.cpp index e6d7c89ec7..666465c3a5 100644 --- a/engine/src/vs_logging.cpp +++ b/engine/src/vs_logging.cpp @@ -85,7 +85,7 @@ void VegaStrikeLogger::InitLoggingPart2(const uint8_t debug_level, boost::log::keywords::format = "[%TimeStamp%]: %Message%", /*< log record format >*/ boost::log::keywords::auto_flush = - false, /*true,*/ /*< whether to auto flush to the file after every line >*/ + true, /*false,*/ /*< whether to auto flush to the file after every line >*/ boost::log::keywords::min_free_space = 2UL * 1024UL * 1024UL * 1024UL /*< stop boost::log when there's only 2 GiB free space left >*/ ); @@ -141,7 +141,7 @@ VegaStrikeLogger::VegaStrikeLogger() : slg_(), file_log_sink_(nullptr) { boost::log::keywords::format = "%Message%", /*< log record format specific to the console >*/ boost::log::keywords::auto_flush = - false /*true*/ /*< whether to do the equivalent of fflush(stdout) after every msg >*/ + true /*false*/ /*< whether to do the equivalent of fflush(stdout) after every msg >*/ ); console_log_sink_ = boost::make_shared(console_log_back_end_); logging_core_->add_sink(console_log_sink_); From 5a2aaf48b2aa19e8badea316f88d49295da9542e Mon Sep 17 00:00:00 2001 From: Stephen G Date: Tue, 23 Apr 2024 11:18:12 -0700 Subject: [PATCH 13/32] vs_logging.cpp: ... --- engine/src/vs_logging.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engine/src/vs_logging.cpp b/engine/src/vs_logging.cpp index 666465c3a5..c305c1f715 100644 --- a/engine/src/vs_logging.cpp +++ b/engine/src/vs_logging.cpp @@ -126,6 +126,8 @@ void VegaStrikeLogger::FlushLogsProgramExiting() { std::cout << std::flush; std::cerr << std::flush; std::clog << std::flush; + fflush(stdout); + fflush(stderr); console_log_sink_.reset(); file_log_sink_.reset(); From b4d36b6a28401acb90dfcc181aec8a6040590504 Mon Sep 17 00:00:00 2001 From: Stephen G Date: Tue, 23 Apr 2024 11:31:15 -0700 Subject: [PATCH 14/32] vs_logging.cpp: ... --- engine/src/vs_logging.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/engine/src/vs_logging.cpp b/engine/src/vs_logging.cpp index c305c1f715..cf2ef737aa 100644 --- a/engine/src/vs_logging.cpp +++ b/engine/src/vs_logging.cpp @@ -111,13 +111,13 @@ void VegaStrikeLogger::FlushLogs() { void VegaStrikeLogger::FlushLogsProgramExiting() { if (console_log_sink_) { - logging_core_->remove_sink(console_log_sink_); + // logging_core_->remove_sink(console_log_sink_); console_log_sink_->stop(); console_log_sink_->feed_records(); console_log_sink_->flush(); } if (file_log_sink_) { - logging_core_->remove_sink(file_log_sink_); + // logging_core_->remove_sink(file_log_sink_); file_log_sink_->stop(); file_log_sink_->feed_records(); file_log_sink_->flush(); @@ -129,11 +129,13 @@ void VegaStrikeLogger::FlushLogsProgramExiting() { fflush(stdout); fflush(stderr); + logging_core_->remove_all_sinks(); console_log_sink_.reset(); file_log_sink_.reset(); } VegaStrikeLogger::VegaStrikeLogger() : slg_(), file_log_sink_(nullptr) { + boost::filesystem::path::imbue(std::locale("C")); logging_core_ = boost::log::core::get(); boost::log::add_common_attributes(); From 452652da9fa29227d2b1f9e8fdffcabdcd512891 Mon Sep 17 00:00:00 2001 From: Stephen G Date: Tue, 23 Apr 2024 12:18:50 -0700 Subject: [PATCH 15/32] vs_logging.cpp/.h: ... --- engine/src/vs_logging.cpp | 35 +++++++++++++++++++++++++++-------- engine/src/vs_logging.h | 9 ++++++++- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/engine/src/vs_logging.cpp b/engine/src/vs_logging.cpp index cf2ef737aa..fd341a113d 100644 --- a/engine/src/vs_logging.cpp +++ b/engine/src/vs_logging.cpp @@ -74,7 +74,7 @@ void VegaStrikeLogger::InitLoggingPart2(const uint8_t debug_level, break; } - boost::shared_ptr file_log_back_end_ = boost::make_shared + file_log_back_end_ = boost::make_shared ( boost::log::keywords::file_name = logging_dir_name + "/" + "vegastrike_%Y-%m-%d_%H_%M_%S.%f.log", /*< file name pattern >*/ @@ -85,9 +85,9 @@ void VegaStrikeLogger::InitLoggingPart2(const uint8_t debug_level, boost::log::keywords::format = "[%TimeStamp%]: %Message%", /*< log record format >*/ boost::log::keywords::auto_flush = - true, /*false,*/ /*< whether to auto flush to the file after every line >*/ - boost::log::keywords::min_free_space = 2UL * 1024UL * 1024UL - * 1024UL /*< stop boost::log when there's only 2 GiB free space left >*/ + false, /*true,*/ /*< whether to auto flush to the file after every line >*/ + boost::log::keywords::min_free_space = 5UL * 1024UL * 1024UL + * 1024UL /*< stop boost::log when there's only 5 GiB free space left >*/ ); file_log_sink_ = boost::make_shared(file_log_back_end_); logging_core_->add_sink(file_log_sink_); @@ -96,6 +96,7 @@ void VegaStrikeLogger::InitLoggingPart2(const uint8_t debug_level, } void VegaStrikeLogger::FlushLogs() { + logging_core_->flush(); if (console_log_sink_) { console_log_sink_->feed_records(); console_log_sink_->flush(); @@ -104,24 +105,34 @@ void VegaStrikeLogger::FlushLogs() { file_log_sink_->feed_records(); file_log_sink_->flush(); } + std::cout << std::flush; std::cerr << std::flush; std::clog << std::flush; + fflush(stdout); + fflush(stderr); } void VegaStrikeLogger::FlushLogsProgramExiting() { + logging_core_->flush(); if (console_log_sink_) { // logging_core_->remove_sink(console_log_sink_); console_log_sink_->stop(); console_log_sink_->feed_records(); console_log_sink_->flush(); } + if (console_log_back_end_) { + console_log_back_end_->flush(); + } if (file_log_sink_) { // logging_core_->remove_sink(file_log_sink_); file_log_sink_->stop(); file_log_sink_->feed_records(); file_log_sink_->flush(); } + if (file_log_back_end_) { + file_log_back_end_->flush(); + } std::cout << std::flush; std::cerr << std::flush; @@ -132,20 +143,28 @@ void VegaStrikeLogger::FlushLogsProgramExiting() { logging_core_->remove_all_sinks(); console_log_sink_.reset(); file_log_sink_.reset(); + console_log_back_end_.reset(); + file_log_back_end_.reset(); } -VegaStrikeLogger::VegaStrikeLogger() : slg_(), file_log_sink_(nullptr) { +BOOST_LOG_GLOBAL_LOGGER_INIT(my_logger, severity_logger_mt) { + boost::log::sources::severity_logger_mt lg; + boost::log::add_common_attributes(); + return lg; +} + +VegaStrikeLogger::VegaStrikeLogger() : slg_(my_logger::get()), file_log_sink_(nullptr) { boost::filesystem::path::imbue(std::locale("C")); logging_core_ = boost::log::core::get(); - boost::log::add_common_attributes(); + // slg_ = my_logger::get(); - boost::shared_ptr console_log_back_end_ = boost::make_shared + console_log_back_end_ = boost::make_shared ( boost::shared_ptr(&std::cerr, boost::null_deleter()), boost::log::keywords::format = "%Message%", /*< log record format specific to the console >*/ boost::log::keywords::auto_flush = - true /*false*/ /*< whether to do the equivalent of fflush(stdout) after every msg >*/ + false /*true*/ /*< whether to do the equivalent of fflush(stdout) after every msg >*/ ); console_log_sink_ = boost::make_shared(console_log_back_end_); logging_core_->add_sink(console_log_sink_); diff --git a/engine/src/vs_logging.h b/engine/src/vs_logging.h index 5cddf34e20..1670950998 100644 --- a/engine/src/vs_logging.h +++ b/engine/src/vs_logging.h @@ -32,7 +32,10 @@ #include "boost/smart_ptr/shared_ptr.hpp" #include "boost/smart_ptr/make_shared_object.hpp" #include "boost/format.hpp" +#include "boost/log/sources/global_logger_storage.hpp" //#include "boost/log/sources/logger.hpp" +#include "boost/log/core.hpp" +#include "boost/log/expressions.hpp" #include "boost/log/sources/severity_logger.hpp" #include "boost/log/sources/record_ostream.hpp" #include "boost/log/sinks/async_frontend.hpp" @@ -54,6 +57,8 @@ enum vega_log_level { fatal }; +BOOST_LOG_GLOBAL_LOGGER(my_logger, boost::log::sources::severity_logger_mt) + BOOST_LOG_ATTRIBUTE_KEYWORD(severity, "Severity", vega_log_level) typedef boost::log::sinks::text_ostream_backend ConsoleLogBackEnd; @@ -77,7 +82,9 @@ typedef boost::log::sinks::asynchronous_sink FileLogSink; struct VegaStrikeLogger { private: boost::log::core_ptr logging_core_; - boost::log::sources::severity_logger_mt slg_; + boost::log::sources::severity_logger_mt& slg_; + boost::shared_ptr console_log_back_end_; + boost::shared_ptr file_log_back_end_; boost::shared_ptr console_log_sink_; boost::shared_ptr file_log_sink_; From 2d05a1f1999379944c0b4dab04d5608a8903a54e Mon Sep 17 00:00:00 2001 From: Stephen G Date: Tue, 23 Apr 2024 15:07:33 -0700 Subject: [PATCH 16/32] vs_logging.cpp: ... --- engine/src/vs_logging.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/engine/src/vs_logging.cpp b/engine/src/vs_logging.cpp index fd341a113d..6648062007 100644 --- a/engine/src/vs_logging.cpp +++ b/engine/src/vs_logging.cpp @@ -116,18 +116,16 @@ void VegaStrikeLogger::FlushLogs() { void VegaStrikeLogger::FlushLogsProgramExiting() { logging_core_->flush(); if (console_log_sink_) { - // logging_core_->remove_sink(console_log_sink_); + logging_core_->remove_sink(console_log_sink_); console_log_sink_->stop(); - console_log_sink_->feed_records(); console_log_sink_->flush(); } if (console_log_back_end_) { console_log_back_end_->flush(); } if (file_log_sink_) { - // logging_core_->remove_sink(file_log_sink_); + logging_core_->remove_sink(file_log_sink_); file_log_sink_->stop(); - file_log_sink_->feed_records(); file_log_sink_->flush(); } if (file_log_back_end_) { @@ -153,7 +151,7 @@ BOOST_LOG_GLOBAL_LOGGER_INIT(my_logger, severity_logger_mt) { return lg; } -VegaStrikeLogger::VegaStrikeLogger() : slg_(my_logger::get()), file_log_sink_(nullptr) { +VegaStrikeLogger::VegaStrikeLogger() : slg_(my_logger::get()), file_log_sink_(nullptr), file_log_back_end_(nullptr) { boost::filesystem::path::imbue(std::locale("C")); logging_core_ = boost::log::core::get(); // slg_ = my_logger::get(); From f933e9b9795b53f05af7e2c00f1c3197d68e65af Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Wed, 24 Apr 2024 18:30:14 -0700 Subject: [PATCH 17/32] Omitting old Fedora, Debian, and Red Hat builds, and including newer ones --- .github/workflows/gh-actions-pr.yml | 24 +++++----------- .github/workflows/gh-actions-release.yml | 28 +++---------------- engine/CMakeLists.txt | 35 ++++++++++++++++++------ 3 files changed, 38 insertions(+), 49 deletions(-) diff --git a/.github/workflows/gh-actions-pr.yml b/.github/workflows/gh-actions-pr.yml index 39b1cca45c..e5d7d1264c 100644 --- a/.github/workflows/gh-actions-pr.yml +++ b/.github/workflows/gh-actions-pr.yml @@ -81,11 +81,6 @@ jobs: OpenGL_GL_PREFERENCE: 'GLVND' ENABLE_PIE: 'OFF' allow_failure: false - - FROM: 'debian:buster' - COMPILER: 'clang' - OpenGL_GL_PREFERENCE: 'GLVND' - ENABLE_PIE: 'OFF' - allow_failure: false - FROM: 'opensuse/leap:15.5' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' @@ -101,27 +96,27 @@ jobs: OpenGL_GL_PREFERENCE: 'GLVND' ENABLE_PIE: 'ON' allow_failure: false - - FROM: 'fedora:38' + - FROM: 'fedora:40' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'LEGACY' ENABLE_PIE: 'ON' allow_failure: true - - FROM: 'fedora:38' + - FROM: 'fedora:40' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' ENABLE_PIE: 'ON' allow_failure: true - - FROM: 'fedora:37' + - FROM: 'fedora:39' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' ENABLE_PIE: 'ON' allow_failure: false - - FROM: 'rockylinux:9.1' + - FROM: 'rockylinux:9.3' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' ENABLE_PIE: 'ON' allow_failure: false - - FROM: 'rockylinux:8.7' + - FROM: 'rockylinux:8.9' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' ENABLE_PIE: 'ON' @@ -176,13 +171,8 @@ jobs: IS_RELEASE: 0 run: script/cibuild $FLAGS - # This is run from inside the Docker container, by script/docker-entrypoint.sh - # - name: Test - # working-directory: ${{github.workspace}}/build - # env: - # GTEST_OUTPUT: xml - # GTEST_COLOR: 1 - # run: ctest -V + # The tests are run from inside the Docker container, by script/docker-entrypoint.sh. + # No need to run them explicitly from here. - name: Upload test results uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3 diff --git a/.github/workflows/gh-actions-release.yml b/.github/workflows/gh-actions-release.yml index 7d2de404fd..bf3bef58bd 100644 --- a/.github/workflows/gh-actions-release.yml +++ b/.github/workflows/gh-actions-release.yml @@ -20,11 +20,6 @@ jobs: fail-fast: false matrix: include: - - FROM: 'ubuntu:mantic' - COMPILER: 'clang' - OpenGL_GL_PREFERENCE: 'LEGACY' - ENABLE_PIE: 'OFF' - ARTIFACT_EXT: 'deb' - FROM: 'ubuntu:mantic' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' @@ -71,16 +66,6 @@ jobs: OpenGL_GL_PREFERENCE: 'GLVND' ENABLE_PIE: 'OFF' ARTIFACT_EXT: 'deb' - - FROM: 'debian:buster' - COMPILER: 'clang' - OpenGL_GL_PREFERENCE: 'GLVND' - ENABLE_PIE: 'OFF' - ARTIFACT_EXT: 'deb' - - FROM: 'opensuse/leap:15.5' - COMPILER: 'clang' - OpenGL_GL_PREFERENCE: 'LEGACY' - ENABLE_PIE: 'ON' - ARTIFACT_EXT: 'rpm' - FROM: 'opensuse/leap:15.5' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' @@ -91,27 +76,22 @@ jobs: OpenGL_GL_PREFERENCE: 'GLVND' ENABLE_PIE: 'ON' ARTIFACT_EXT: 'rpm' - - FROM: 'fedora:38' - COMPILER: 'clang' - OpenGL_GL_PREFERENCE: 'LEGACY' - ENABLE_PIE: 'ON' - ARTIFACT_EXT: 'rpm' - - FROM: 'fedora:38' + - FROM: 'fedora:40' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' ENABLE_PIE: 'ON' ARTIFACT_EXT: 'rpm' - - FROM: 'fedora:37' + - FROM: 'fedora:39' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' ENABLE_PIE: 'ON' ARTIFACT_EXT: 'rpm' - - FROM: 'rockylinux:9.1' + - FROM: 'rockylinux:9.3' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' ENABLE_PIE: 'ON' ARTIFACT_EXT: 'rpm' - - FROM: 'rockylinux:8.7' + - FROM: 'rockylinux:8.9' COMPILER: 'clang' OpenGL_GL_PREFERENCE: 'GLVND' ENABLE_PIE: 'ON' diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index a27a9fc5b8..7678c50ba0 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -9,7 +9,7 @@ # to change build target (in Release, RelWithDebInfo, Debug, Profiler) # > cmake -DCMAKE_BUILD_TYPE=Debug #==================================== -# Copyright (C) 2001-2023 safemode, Anth0rx, pyramid, Roy Falk, +# Copyright (C) 2001-2024 safemode, Anth0rx, pyramid, Roy Falk, # Nachum Barcohen, Rune Morling, Stephen G. Tuggy, Benjamen Meyer, s0600204, # Evert Vorster, and other Vega Strike contributors. # @@ -1621,7 +1621,7 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) MESSAGE (SEND_WARNING "!! Unsupported version of openSUSE") SET(CPACK_RPM_PACKAGE_REQUIRES "") ENDIF (LINUX_VERSION_ID VERSION_EQUAL 15.2 OR LINUX_VERSION_ID VERSION_EQUAL 15.3) - ELSEIF (LINUX_ID STREQUAL fedora AND LINUX_VERSION_ID VERSION_GREATER_EQUAL 30 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 37) + ELSEIF (LINUX_ID STREQUAL fedora AND LINUX_VERSION_ID VERSION_GREATER_EQUAL 30 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 40) IF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 34) SET(CPACK_RPM_PACKAGE_REQUIRES "python3, boost-python3") ELSEIF (LINUX_VERSION_ID VERSION_EQUAL 32 OR LINUX_VERSION_ID VERSION_EQUAL 33) @@ -1632,16 +1632,35 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) SET(CPACK_RPM_PACKAGE_REQUIRES "python37, boost-python3") ENDIF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 34) SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") - ELSEIF (LINUX_ID STREQUAL centos AND LINUX_VERSION_ID STREQUAL "8") - SET(CPACK_RPM_PACKAGE_REQUIRES "boost-python3") - SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") + ELSEIF (LINUX_ID STREQUAL centos) + IF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 8.0 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 8.9) + SET(CPACK_RPM_PACKAGE_REQUIRES "python39, boost-python3") + SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") + ELSEIF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 9.0 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 9.3) + SET(CPACK_RPM_PACKAGE_REQUIRES "python3, boost-python3") + SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") + ELSE () + MESSAGE(SEND_WARNING "!! We do not currently support this version of CentOS.") + SET(CPACK_RPM_PACKAGE_REQUIRES "") + ENDIF () ELSEIF (LINUX_ID STREQUAL rhel OR LINUX_ID STREQUAL redhat) - SET(CPACK_RPM_PACKAGE_REQUIRES "boost-python3") - SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") + IF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 8.0 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 8.9) + SET(CPACK_RPM_PACKAGE_REQUIRES "python39, boost-python3") + SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") + ELSEIF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 9.0 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 9.3) + SET(CPACK_RPM_PACKAGE_REQUIRES "python3, boost-python3") + SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") + ELSE () + MESSAGE(SEND_WARNING "!! This version of Red Hat is not currently supported.") + SET(CPACK_RPM_PACKAGE_REQUIRES "") + ENDIF () ELSEIF (LINUX_ID STREQUAL rocky) - IF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 8.0 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 9.1) + IF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 8.0 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 8.9) SET(CPACK_RPM_PACKAGE_REQUIRES "python39, boost-python3") SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") + ELSEIF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 9.0 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 9.3) + SET(CPACK_RPM_PACKAGE_REQUIRES "python3, boost-python3") + SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") ELSE () MESSAGE(SEND_WARNING "!! This version of Rocky Linux is not currently supported.") SET(CPACK_RPM_PACKAGE_REQUIRES "") From b47f4261cfbe39c25d326272e147ce81f9d197e6 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Wed, 24 Apr 2024 18:47:13 -0700 Subject: [PATCH 18/32] Fix dependabot.yml --- .github/dependabot.yml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 53b7916472..1a69049371 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,11 +1,10 @@ -!defined__APPLE__ && defined__MACH__v!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__r!defined__APPLE__ && defined__MACH__s!defined__APPLE__ && defined__MACH__i!defined__APPLE__ && defined__MACH__o!defined__APPLE__ && defined__MACH__n!defined__APPLE__ && defined__MACH__:!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__2!defined__APPLE__ && defined__MACH__ -!defined__APPLE__ && defined__MACH__u!defined__APPLE__ && defined__MACH__p!defined__APPLE__ && defined__MACH__d!defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__s!defined__APPLE__ && defined__MACH__:!defined__APPLE__ && defined__MACH__ -!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__-!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__p!defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__c!defined__APPLE__ && defined__MACH__k!defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__g!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__-!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__c!defined__APPLE__ && defined__MACH__o!defined__APPLE__ && defined__MACH__s!defined__APPLE__ && defined__MACH__y!defined__APPLE__ && defined__MACH__s!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__m!defined__APPLE__ && defined__MACH__:!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__"!defined__APPLE__ && defined__MACH__g!defined__APPLE__ && defined__MACH__i!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__h!defined__APPLE__ && defined__MACH__u!defined__APPLE__ && defined__MACH__b!defined__APPLE__ && defined__MACH__-!defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__c!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__i!defined__APPLE__ && defined__MACH__o!defined__APPLE__ && defined__MACH__n!defined__APPLE__ && defined__MACH__s!defined__APPLE__ && defined__MACH__"!defined__APPLE__ && defined__MACH__ -!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__d!defined__APPLE__ && defined__MACH__i!defined__APPLE__ && defined__MACH__r!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__c!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__o!defined__APPLE__ && defined__MACH__r!defined__APPLE__ && defined__MACH__y!defined__APPLE__ && defined__MACH__:!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__"!defined__APPLE__ && defined__MACH__/!defined__APPLE__ && defined__MACH__"!defined__APPLE__ && defined__MACH__ -!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__s!defined__APPLE__ && defined__MACH__c!defined__APPLE__ && defined__MACH__h!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__d!defined__APPLE__ && defined__MACH__u!defined__APPLE__ && defined__MACH__l!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__:!defined__APPLE__ && defined__MACH__ -!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__#!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__C!defined__APPLE__ && defined__MACH__h!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__c!defined__APPLE__ && defined__MACH__k!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__f!defined__APPLE__ && defined__MACH__o!defined__APPLE__ && defined__MACH__r!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__u!defined__APPLE__ && defined__MACH__p!defined__APPLE__ && defined__MACH__d!defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__s!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__o!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__G!defined__APPLE__ && defined__MACH__i!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__H!defined__APPLE__ && defined__MACH__u!defined__APPLE__ && defined__MACH__b!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__A!defined__APPLE__ && defined__MACH__c!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__i!defined__APPLE__ && defined__MACH__o!defined__APPLE__ && defined__MACH__n!defined__APPLE__ && defined__MACH__s!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__v!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__r!defined__APPLE__ && defined__MACH__y!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__w!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__k!defined__APPLE__ && defined__MACH__ -!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__i!defined__APPLE__ && defined__MACH__n!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__r!defined__APPLE__ && defined__MACH__v!defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__l!defined__APPLE__ && defined__MACH__:!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__"!defined__APPLE__ && defined__MACH__w!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__k!defined__APPLE__ && defined__MACH__l!defined__APPLE__ && defined__MACH__y!defined__APPLE__ && defined__MACH__"!defined__APPLE__ && defined__MACH__ -!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__l!defined__APPLE__ && defined__MACH__l!defined__APPLE__ && defined__MACH__o!defined__APPLE__ && defined__MACH__w!defined__APPLE__ && defined__MACH__:!defined__APPLE__ && defined__MACH__ -!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__#!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__A!defined__APPLE__ && defined__MACH__l!defined__APPLE__ && defined__MACH__l!defined__APPLE__ && defined__MACH__o!defined__APPLE__ && defined__MACH__w!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__b!defined__APPLE__ && defined__MACH__o!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__h!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__d!defined__APPLE__ && defined__MACH__i!defined__APPLE__ && defined__MACH__r!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__c!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__n!defined__APPLE__ && defined__MACH__d!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__i!defined__APPLE__ && defined__MACH__n!defined__APPLE__ && defined__MACH__d!defined__APPLE__ && defined__MACH__i!defined__APPLE__ && defined__MACH__r!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__c!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__u!defined__APPLE__ && defined__MACH__p!defined__APPLE__ && defined__MACH__d!defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__s!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__f!defined__APPLE__ && defined__MACH__o!defined__APPLE__ && defined__MACH__r!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__l!defined__APPLE__ && defined__MACH__l!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__p!defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__c!defined__APPLE__ && defined__MACH__k!defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__g!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__s!defined__APPLE__ && defined__MACH__ -!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__-!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__d!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__p!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__n!defined__APPLE__ && defined__MACH__d!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__n!defined__APPLE__ && defined__MACH__c!defined__APPLE__ && defined__MACH__y!defined__APPLE__ && defined__MACH__-!defined__APPLE__ && defined__MACH__t!defined__APPLE__ && defined__MACH__y!defined__APPLE__ && defined__MACH__p!defined__APPLE__ && defined__MACH__e!defined__APPLE__ && defined__MACH__:!defined__APPLE__ && defined__MACH__ !defined__APPLE__ && defined__MACH__"!defined__APPLE__ && defined__MACH__a!defined__APPLE__ && defined__MACH__l!defined__APPLE__ && defined__MACH__l!defined__APPLE__ && defined__MACH__"!defined__APPLE__ && defined__MACH__ -!defined__APPLE__ && defined__MACH__ \ No newline at end of file +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every week + interval: "weekly" + allow: + # Allow both direct and indirect updates for all packages + - dependency-type: "all" From 05ed4f594f806a17b7900e9bcf187efe7dc5ecf6 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Wed, 24 Apr 2024 18:58:48 -0700 Subject: [PATCH 19/32] CMakeLists.txt: Fix Python version for Rocky Linux 8.9 (and equivalent CentOS and RHEL versions) --- engine/CMakeLists.txt | 58 +++++++++++-------------------------------- 1 file changed, 14 insertions(+), 44 deletions(-) diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index 7678c50ba0..c58bf547a0 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -78,45 +78,6 @@ ENDIF () # If a release is missing this value, then version `1` can be assumed. SET(VEGASTRIKE_ASSETS_API_VERSION "2") -#IF (COMMAND cmake_policy) -# CMAKE_POLICY (SET CMP0003 NEW) -#ENDIF (COMMAND cmake_policy) -# -## VERSION Policy -#IF (POLICY CMP0048) -# CMAKE_POLICY (SET CMP0048 NEW) -#ENDIF (POLICY CMP0048) -# -## Used to be that without this, CMake couldn't find pow() -- at least not on my Windows machine. -#IF (POLICY CMP0066) -# CMAKE_POLICY (SET CMP0066 NEW) -#ENDIF () -# -## FindOpenGL prefers GLVND by default when available. But there is an option to override that. -#IF (POLICY CMP0072) -# CMAKE_POLICY (SET CMP0072 NEW) -#ENDIF (POLICY CMP0072) -# -## find_package() uses _ROOT variables -#IF (POLICY CMP0074) -# CMAKE_POLICY (SET CMP0074 NEW) -#ENDIF (POLICY CMP0074) -# -## Include file check macros honor CMAKE_REQUIRED_LIBRARIES -#IF (POLICY CMP0075) -# CMAKE_POLICY (SET CMP0075 NEW) -#ENDIF () -# -## Concerning link time flags for turning on or off Position Independent Executables (PIE) -#IF (POLICY CMP0083) -# CMAKE_POLICY (SET CMP0083 NEW) -#ENDIF () -# -## MSVC runtime library flags are selected by an abstraction. Supported by CMake 3.15 and up -#IF (POLICY CMP0091) -# CMAKE_POLICY (SET CMP0091 NEW) -#ENDIF () - PROJECT(Vega_Strike VERSION "${VEGASTRIKE_VERSION_MAJOR}.${VEGASTRIKE_VERSION_MINOR}.${VEGASTRIKE_VERSION_PATCH}" #.${VEGASTRIKE_VERSION_TWEAK} # CMake only allows numeric version components, unfortunately. @@ -1633,9 +1594,12 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) ENDIF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 34) SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") ELSEIF (LINUX_ID STREQUAL centos) - IF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 8.0 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 8.9) + IF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 8.0 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 8.7) SET(CPACK_RPM_PACKAGE_REQUIRES "python39, boost-python3") SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") + ELSEIF (LINUX_VERSION_ID VERSION_EQUAL 8.9) + SET(CPACK_RPM_PACKAGE_REQUIRES "python311, boost-python3") + SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") ELSEIF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 9.0 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 9.3) SET(CPACK_RPM_PACKAGE_REQUIRES "python3, boost-python3") SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") @@ -1644,9 +1608,12 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) SET(CPACK_RPM_PACKAGE_REQUIRES "") ENDIF () ELSEIF (LINUX_ID STREQUAL rhel OR LINUX_ID STREQUAL redhat) - IF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 8.0 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 8.9) + IF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 8.0 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 8.7) SET(CPACK_RPM_PACKAGE_REQUIRES "python39, boost-python3") SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") + ELSEIF (LINUX_VERSION_ID VERSION_EQUAL 8.9) + SET(CPACK_RPM_PACKAGE_REQUIRES "python311, boost-python3") + SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") ELSEIF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 9.0 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 9.3) SET(CPACK_RPM_PACKAGE_REQUIRES "python3, boost-python3") SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") @@ -1655,12 +1622,15 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) SET(CPACK_RPM_PACKAGE_REQUIRES "") ENDIF () ELSEIF (LINUX_ID STREQUAL rocky) - IF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 8.0 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 8.9) + IF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 8.0 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 8.7) SET(CPACK_RPM_PACKAGE_REQUIRES "python39, boost-python3") SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") + ELSEIF (LINUX_VERSION_ID VERSION_EQUAL 8.9) + SET(CPACK_RPM_PACKAGE_REQUIRES "python311, boost-python3") + SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") ELSEIF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 9.0 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 9.3) - SET(CPACK_RPM_PACKAGE_REQUIRES "python3, boost-python3") - SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") + SET(CPACK_RPM_PACKAGE_REQUIRES "python3, boost-python3") + SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") ELSE () MESSAGE(SEND_WARNING "!! This version of Rocky Linux is not currently supported.") SET(CPACK_RPM_PACKAGE_REQUIRES "") From 9bfd1bdc8c8cb9a038af4b58a31e238e143668c6 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Wed, 24 Apr 2024 19:05:28 -0700 Subject: [PATCH 20/32] mesh_gfx.cpp: Omit a line of code that was commented out anyway --- engine/src/gfx/mesh_gfx.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/engine/src/gfx/mesh_gfx.cpp b/engine/src/gfx/mesh_gfx.cpp index 5979a792f5..1cc7979342 100644 --- a/engine/src/gfx/mesh_gfx.cpp +++ b/engine/src/gfx/mesh_gfx.cpp @@ -460,7 +460,6 @@ Mesh::~Mesh() { resetIter = true; cachedHashItem = hashItem + 1; } - //delete hashItem; hashers->erase(hashItem); if (hashers->empty()) { bfxmHashTable.Delete(hash_name); From 9691dfbda7a857cb3332e7b3c698d9242b5115d8 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Wed, 24 Apr 2024 19:41:05 -0700 Subject: [PATCH 21/32] CMakeLists.txt: Get the package name right for Python 3.11 on CentOS 8.8/8.9 and equivalent RHEL and Rocky Linux versions --- engine/CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index c58bf547a0..0d1fdaee88 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -1597,8 +1597,8 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) IF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 8.0 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 8.7) SET(CPACK_RPM_PACKAGE_REQUIRES "python39, boost-python3") SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") - ELSEIF (LINUX_VERSION_ID VERSION_EQUAL 8.9) - SET(CPACK_RPM_PACKAGE_REQUIRES "python311, boost-python3") + ELSEIF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 8.8 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 8.9) + SET(CPACK_RPM_PACKAGE_REQUIRES "python3.11, boost-python3") SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") ELSEIF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 9.0 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 9.3) SET(CPACK_RPM_PACKAGE_REQUIRES "python3, boost-python3") @@ -1611,8 +1611,8 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) IF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 8.0 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 8.7) SET(CPACK_RPM_PACKAGE_REQUIRES "python39, boost-python3") SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") - ELSEIF (LINUX_VERSION_ID VERSION_EQUAL 8.9) - SET(CPACK_RPM_PACKAGE_REQUIRES "python311, boost-python3") + ELSEIF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 8.8 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 8.9) + SET(CPACK_RPM_PACKAGE_REQUIRES "python3.11, boost-python3") SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") ELSEIF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 9.0 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 9.3) SET(CPACK_RPM_PACKAGE_REQUIRES "python3, boost-python3") @@ -1625,8 +1625,8 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) IF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 8.0 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 8.7) SET(CPACK_RPM_PACKAGE_REQUIRES "python39, boost-python3") SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") - ELSEIF (LINUX_VERSION_ID VERSION_EQUAL 8.9) - SET(CPACK_RPM_PACKAGE_REQUIRES "python311, boost-python3") + ELSEIF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 8.8 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 8.9) + SET(CPACK_RPM_PACKAGE_REQUIRES "python3.11, boost-python3") SET(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, libjpeg-turbo, libpng, freeglut, gtk3, libvorbis, openal-soft, SDL, libglvnd, expat, boost-log, boost-system, boost-filesystem, boost-thread, boost-regex, boost-chrono, boost-atomic") ELSEIF (LINUX_VERSION_ID VERSION_GREATER_EQUAL 9.0 AND LINUX_VERSION_ID VERSION_LESS_EQUAL 9.3) SET(CPACK_RPM_PACKAGE_REQUIRES "python3, boost-python3") From 98924cb507dafea700c906e093ede0afcbe44376 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Wed, 24 Apr 2024 20:23:07 -0700 Subject: [PATCH 22/32] script/bootstrap: Update to match latest version from build-system-docker-images --- script/bootstrap | 254 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 250 insertions(+), 4 deletions(-) diff --git a/script/bootstrap b/script/bootstrap index 9c985be16b..acd98ca521 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -9,7 +9,7 @@ # @param : just one parameter, either a 1 or a 0, to indicate whether or not to # UPDATE_ALL_SYSTEM_PACKAGES #==================================== -# Copyright (C) 2020-2023 Stephen G. Tuggy and other Vega Strike contributors +# Copyright (C) 2020-2024 Stephen G. Tuggy and other Vega Strike contributors # # This file is part of Vega Strike. # @@ -20,16 +20,16 @@ # # Vega Strike is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with Vega Strike. If not, see . +# along with Vega Strike. If not, see . set -e echo "------------------------------" -echo "--- bootstrap | 2023-11-24 ---" +echo "--- bootstrap | 2024-04-24 ---" echo "------------------------------" UPDATE_ALL_SYSTEM_PACKAGES="$1" @@ -881,6 +881,48 @@ function bootstrapOnFedora () make \ clang ;; + 39) + dnf install -y \ + git \ + cmake \ + boost-devel \ + freeglut-devel \ + gcc-c++ \ + openal-soft-devel \ + sdl12-compat-devel \ + SDL2-devel \ + libvorbis-devel \ + libglvnd-devel \ + libjpeg-turbo-devel \ + libpng-devel \ + expat-devel \ + gtk3-devel \ + python3-devel \ + rpm-build \ + make \ + clang + ;; + 40) + dnf install -y \ + git \ + cmake \ + boost-devel \ + freeglut-devel \ + gcc-c++ \ + openal-soft-devel \ + sdl12-compat-devel \ + SDL2-devel \ + libvorbis-devel \ + libglvnd-devel \ + libjpeg-turbo-devel \ + libpng-devel \ + expat-devel \ + gtk3-devel \ + python3-devel \ + rpm-build \ + make \ + clang + ;; *) echo "Sorry, this version of Fedora is unsupported" exit 2 @@ -1149,6 +1191,56 @@ function bootstrapOnRedHat () make \ clang ;; + "8.8") + dnf -y install dnf-plugins-core + dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm + dnf config-manager --set-enabled PowerTools + dnf -y install \ + git \ + cmake \ + python3.11-devel \ + boost-devel \ + boost-python3-devel \ + freeglut-devel \ + gcc-c++ \ + openal-soft-devel \ + SDL-devel \ + SDL2-devel \ + libvorbis-devel \ + libglvnd-devel \ + libjpeg-turbo-devel \ + libpng-devel \ + expat-devel \ + gtk3-devel \ + rpm-build \ + make \ + clang + ;; + "8.9") + dnf -y install dnf-plugins-core + dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm + dnf config-manager --set-enabled PowerTools + dnf -y install \ + git \ + cmake \ + python3.11-devel \ + boost-devel \ + boost-python3-devel \ + freeglut-devel \ + gcc-c++ \ + openal-soft-devel \ + SDL-devel \ + SDL2-devel \ + libvorbis-devel \ + libglvnd-devel \ + libjpeg-turbo-devel \ + libpng-devel \ + expat-devel \ + gtk3-devel \ + rpm-build \ + make \ + clang + ;; "9.0") dnf -y install dnf-plugins-core dnf config-manager --set-enabled devel @@ -1199,6 +1291,56 @@ function bootstrapOnRedHat () make \ clang ;; + "9.2") + dnf -y install dnf-plugins-core + dnf config-manager --set-enabled devel + dnf -y update + dnf -y install \ + git \ + cmake \ + boost-devel \ + boost-python3-devel \ + freeglut-devel \ + gcc-c++ \ + openal-soft-devel \ + sdl12-compat-devel \ + SDL2-devel \ + libvorbis-devel \ + libglvnd-devel \ + libjpeg-turbo-devel \ + libpng-devel \ + expat-devel \ + gtk3-devel \ + python3-devel \ + rpm-build \ + make \ + clang + ;; + "9.3") + dnf -y install dnf-plugins-core + dnf config-manager --set-enabled devel + dnf -y update + dnf -y install \ + git \ + cmake \ + boost-devel \ + boost-python3-devel \ + freeglut-devel \ + gcc-c++ \ + openal-soft-devel \ + sdl12-compat-devel \ + SDL2-devel \ + libvorbis-devel \ + libglvnd-devel \ + libjpeg-turbo-devel \ + libpng-devel \ + expat-devel \ + gtk3-devel \ + python3-devel \ + rpm-build \ + make \ + clang + ;; *) echo "Sorry, this version of Red Hat is unsupported" exit 2 @@ -1425,6 +1567,60 @@ function bootstrapOnRockyLinux () make \ clang ;; + "8.8") + dnf -y install dnf-plugins-core + dnf -y install epel-release + dnf config-manager --enable epel + dnf config-manager --set-enabled powertools + dnf -y update + dnf -y install \ + git \ + cmake \ + python3.11-devel \ + boost-devel \ + boost-python3-devel \ + freeglut-devel \ + gcc-c++ \ + openal-soft-devel \ + SDL-devel \ + SDL2-devel \ + libvorbis-devel \ + libglvnd-devel \ + libjpeg-turbo-devel \ + libpng-devel \ + expat-devel \ + gtk3-devel \ + rpm-build \ + make \ + clang + ;; + "8.9") + dnf -y install dnf-plugins-core + dnf -y install epel-release + dnf config-manager --enable epel + dnf config-manager --set-enabled powertools + dnf -y update + dnf -y install \ + git \ + cmake \ + python3.11-devel \ + boost-devel \ + boost-python3-devel \ + freeglut-devel \ + gcc-c++ \ + openal-soft-devel \ + SDL-devel \ + SDL2-devel \ + libvorbis-devel \ + libglvnd-devel \ + libjpeg-turbo-devel \ + libpng-devel \ + expat-devel \ + gtk3-devel \ + rpm-build \ + make \ + clang + ;; "9.0") dnf -y install dnf-plugins-core dnf config-manager --set-enabled devel @@ -1475,6 +1671,56 @@ function bootstrapOnRockyLinux () make \ clang ;; + "9.2") + dnf -y install dnf-plugins-core + dnf config-manager --set-enabled devel + dnf -y update + dnf -y install \ + git \ + cmake \ + boost-devel \ + boost-python3-devel \ + freeglut-devel \ + gcc-c++ \ + openal-soft-devel \ + sdl12-compat-devel \ + SDL2-devel \ + libvorbis-devel \ + libglvnd-devel \ + libjpeg-turbo-devel \ + libpng-devel \ + expat-devel \ + gtk3-devel \ + python3-devel \ + rpm-build \ + make \ + clang + ;; + "9.3") + dnf -y install dnf-plugins-core + dnf config-manager --set-enabled devel + dnf -y update + dnf -y install \ + git \ + cmake \ + boost-devel \ + boost-python3-devel \ + freeglut-devel \ + gcc-c++ \ + openal-soft-devel \ + sdl12-compat-devel \ + SDL2-devel \ + libvorbis-devel \ + libglvnd-devel \ + libjpeg-turbo-devel \ + libpng-devel \ + expat-devel \ + gtk3-devel \ + python3-devel \ + rpm-build \ + make \ + clang + ;; *) echo "Sorry, this version of Rocky Linux is unsupported" exit 2 From 4716afe4f6e59c16378998cbb19df8d56ac37011 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Wed, 24 Apr 2024 21:39:01 -0700 Subject: [PATCH 23/32] vs_logging.cpp/.h: Switch back to synchronous sinks. Also switch back to the #include form instead of #include "..." --- engine/src/vs_logging.cpp | 1 + engine/src/vs_logging.h | 36 ++++++++++++++++++------------------ 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/engine/src/vs_logging.cpp b/engine/src/vs_logging.cpp index 6648062007..681be5d206 100644 --- a/engine/src/vs_logging.cpp +++ b/engine/src/vs_logging.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include diff --git a/engine/src/vs_logging.h b/engine/src/vs_logging.h index 1670950998..d87ea2a961 100644 --- a/engine/src/vs_logging.h +++ b/engine/src/vs_logging.h @@ -28,21 +28,21 @@ #include -#include "boost/move/utility_core.hpp" -#include "boost/smart_ptr/shared_ptr.hpp" -#include "boost/smart_ptr/make_shared_object.hpp" -#include "boost/format.hpp" -#include "boost/log/sources/global_logger_storage.hpp" -//#include "boost/log/sources/logger.hpp" -#include "boost/log/core.hpp" -#include "boost/log/expressions.hpp" -#include "boost/log/sources/severity_logger.hpp" -#include "boost/log/sources/record_ostream.hpp" -#include "boost/log/sinks/async_frontend.hpp" -#include "boost/log/sinks/sync_frontend.hpp" -#include "boost/log/sinks/text_file_backend.hpp" -#include "boost/log/sinks/text_ostream_backend.hpp" -#include "boost/filesystem.hpp" +#include +#include +#include +#include +#include +//#include +#include +#include +#include +#include +#include +#include +#include +#include +#include namespace VegaStrikeLogging { @@ -63,8 +63,8 @@ BOOST_LOG_ATTRIBUTE_KEYWORD(severity, "Severity", vega_log_level) typedef boost::log::sinks::text_ostream_backend ConsoleLogBackEnd; typedef boost::log::sinks::text_file_backend FileLogBackEnd; -typedef boost::log::sinks::asynchronous_sink ConsoleLogSink; -typedef boost::log::sinks::asynchronous_sink FileLogSink; +typedef boost::log::sinks::synchronous_sink ConsoleLogSink; +typedef boost::log::sinks::synchronous_sink FileLogSink; #define VS_LOG(log_level, log_message) \ do { \ @@ -79,7 +79,7 @@ typedef boost::log::sinks::asynchronous_sink FileLogSink; VegaStrikeLogging::VegaStrikeLogger::instance().LogFlushExit(VegaStrikeLogging::vega_log_level::log_level, (log_message), (exit_code)); \ } while (false) -struct VegaStrikeLogger { +class VegaStrikeLogger { private: boost::log::core_ptr logging_core_; boost::log::sources::severity_logger_mt& slg_; From 1fe59722840ba2e6c989bf057832e9bf4cfd731b Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Wed, 24 Apr 2024 22:24:20 -0700 Subject: [PATCH 24/32] vs_logging.cpp: More fixes --- engine/src/vs_logging.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engine/src/vs_logging.cpp b/engine/src/vs_logging.cpp index 681be5d206..787348df63 100644 --- a/engine/src/vs_logging.cpp +++ b/engine/src/vs_logging.cpp @@ -99,11 +99,11 @@ void VegaStrikeLogger::InitLoggingPart2(const uint8_t debug_level, void VegaStrikeLogger::FlushLogs() { logging_core_->flush(); if (console_log_sink_) { - console_log_sink_->feed_records(); +// console_log_sink_->feed_records(); console_log_sink_->flush(); } if (file_log_sink_) { - file_log_sink_->feed_records(); +// file_log_sink_->feed_records(); file_log_sink_->flush(); } @@ -118,7 +118,7 @@ void VegaStrikeLogger::FlushLogsProgramExiting() { logging_core_->flush(); if (console_log_sink_) { logging_core_->remove_sink(console_log_sink_); - console_log_sink_->stop(); +// console_log_sink_->stop(); console_log_sink_->flush(); } if (console_log_back_end_) { @@ -126,7 +126,7 @@ void VegaStrikeLogger::FlushLogsProgramExiting() { } if (file_log_sink_) { logging_core_->remove_sink(file_log_sink_); - file_log_sink_->stop(); +// file_log_sink_->stop(); file_log_sink_->flush(); } if (file_log_back_end_) { @@ -152,7 +152,7 @@ BOOST_LOG_GLOBAL_LOGGER_INIT(my_logger, severity_logger_mt) { return lg; } -VegaStrikeLogger::VegaStrikeLogger() : slg_(my_logger::get()), file_log_sink_(nullptr), file_log_back_end_(nullptr) { +VegaStrikeLogger::VegaStrikeLogger() : slg_(my_logger::get()), file_log_back_end_(nullptr), file_log_sink_(nullptr) { boost::filesystem::path::imbue(std::locale("C")); logging_core_ = boost::log::core::get(); // slg_ = my_logger::get(); From 46109c38d1da55272af9b318476d0144a6d717d3 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Thu, 25 Apr 2024 00:40:31 -0700 Subject: [PATCH 25/32] Update bootstrap-on-macos.sh and brew-install-for-cmake.sh. Also comment out Rocky Linux 8.9 CI builds for now. --- .github/workflows/gh-actions-pr.yml | 10 +++++----- .github/workflows/gh-actions-release.yml | 10 +++++----- script/bootstrap-on-macos.sh | 4 ++-- script/brew-install-for-cmake.sh | 0 4 files changed, 12 insertions(+), 12 deletions(-) mode change 100644 => 100755 script/brew-install-for-cmake.sh diff --git a/.github/workflows/gh-actions-pr.yml b/.github/workflows/gh-actions-pr.yml index e5d7d1264c..99afb99d4b 100644 --- a/.github/workflows/gh-actions-pr.yml +++ b/.github/workflows/gh-actions-pr.yml @@ -116,11 +116,11 @@ jobs: OpenGL_GL_PREFERENCE: 'GLVND' ENABLE_PIE: 'ON' allow_failure: false - - FROM: 'rockylinux:8.9' - COMPILER: 'clang' - OpenGL_GL_PREFERENCE: 'GLVND' - ENABLE_PIE: 'ON' - allow_failure: false + #- FROM: 'rockylinux:8.9' + # COMPILER: 'clang' + # OpenGL_GL_PREFERENCE: 'GLVND' + # ENABLE_PIE: 'ON' + # allow_failure: false #- FROM: 'manjarolinux/base' # COMPILER: 'clang' # OpenGL_GL_PREFERENCE: 'LEGACY' diff --git a/.github/workflows/gh-actions-release.yml b/.github/workflows/gh-actions-release.yml index bf3bef58bd..0cff70cbc3 100644 --- a/.github/workflows/gh-actions-release.yml +++ b/.github/workflows/gh-actions-release.yml @@ -91,11 +91,11 @@ jobs: OpenGL_GL_PREFERENCE: 'GLVND' ENABLE_PIE: 'ON' ARTIFACT_EXT: 'rpm' - - FROM: 'rockylinux:8.9' - COMPILER: 'clang' - OpenGL_GL_PREFERENCE: 'GLVND' - ENABLE_PIE: 'ON' - ARTIFACT_EXT: 'rpm' + #- FROM: 'rockylinux:8.9' + # COMPILER: 'clang' + # OpenGL_GL_PREFERENCE: 'GLVND' + # ENABLE_PIE: 'ON' + # ARTIFACT_EXT: 'rpm' steps: - name: Check out repository diff --git a/script/bootstrap-on-macos.sh b/script/bootstrap-on-macos.sh index 9b81772402..0058c4128e 100644 --- a/script/bootstrap-on-macos.sh +++ b/script/bootstrap-on-macos.sh @@ -38,7 +38,7 @@ brew update for j in "${packages_to_install[@]}" do - brew install "$j" + brew list "$j" &>/dev/null || brew install "$j" PACKAGE_INSTALLED_PREFIX=$(brew --prefix "$j") PACKAGE_INSTALLED_BIN="$PACKAGE_INSTALLED_PREFIX/bin" export PATH="$PACKAGE_INSTALLED_BIN:$PATH" @@ -47,5 +47,5 @@ done ln -s /usr/local/include/GL /usr/local/include/OpenGL ln -s /usr/local/include/GL /usr/local/include/GLUT -OPENALDIR=$(brew --prefix openal-soft) +OPENALDIR="$(brew --prefix openal-soft)" export OPENALDIR diff --git a/script/brew-install-for-cmake.sh b/script/brew-install-for-cmake.sh old mode 100644 new mode 100755 From 056b9756f7811c8352374fc5d7b3907c38d87a3e Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Thu, 25 Apr 2024 00:57:01 -0700 Subject: [PATCH 26/32] Update bootstrap-on-macos.sh again... --- script/bootstrap-on-macos.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/script/bootstrap-on-macos.sh b/script/bootstrap-on-macos.sh index 0058c4128e..70c2dfb953 100644 --- a/script/bootstrap-on-macos.sh +++ b/script/bootstrap-on-macos.sh @@ -49,3 +49,7 @@ ln -s /usr/local/include/GL /usr/local/include/OpenGL ln -s /usr/local/include/GL /usr/local/include/GLUT OPENALDIR="$(brew --prefix openal-soft)" export OPENALDIR + +echo "PATH=$PATH" +echo "CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH" +echo "OPENALDIR=$OPENALDIR" From e9461bc9be5ba9ae7fd423fe7e0b319f1ab08971 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Thu, 25 Apr 2024 04:59:09 -0700 Subject: [PATCH 27/32] CMakeLists.txt: Only link to `UTIL_LIB` if it was found --- engine/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index 0d1fdaee88..200b48e6e9 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -580,9 +580,9 @@ ELSE (NOT BEOS) FIND_LIBRARY(UTIL_LIB network) ENDIF (NOT BEOS) -IF (NOT WIN32) +IF (UTIL_LIB) SET(TST_LIBS ${TST_LIBS} ${UTIL_LIB}) -ENDIF (NOT WIN32) +ENDIF () # Still need to add CEGUI and OGRE find packages From 0772ee88136a45f31a99673717826f08a9f2b455 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Thu, 25 Apr 2024 06:32:21 -0700 Subject: [PATCH 28/32] vs_logging.cpp/.h: More fixes. Getting more console output now --- engine/src/vs_logging.cpp | 71 ++++++++++++++++++++------------------- engine/src/vs_logging.h | 2 +- 2 files changed, 37 insertions(+), 36 deletions(-) diff --git a/engine/src/vs_logging.cpp b/engine/src/vs_logging.cpp index 787348df63..97009f036c 100644 --- a/engine/src/vs_logging.cpp +++ b/engine/src/vs_logging.cpp @@ -24,6 +24,7 @@ #include "vs_logging.h" +#include "vs_exit.h" #include #include @@ -86,7 +87,7 @@ void VegaStrikeLogger::InitLoggingPart2(const uint8_t debug_level, boost::log::keywords::format = "[%TimeStamp%]: %Message%", /*< log record format >*/ boost::log::keywords::auto_flush = - false, /*true,*/ /*< whether to auto flush to the file after every line >*/ + true, /*false,*/ /*< whether to auto flush to the file after every line >*/ boost::log::keywords::min_free_space = 5UL * 1024UL * 1024UL * 1024UL /*< stop boost::log when there's only 5 GiB free space left >*/ ); @@ -98,14 +99,14 @@ void VegaStrikeLogger::InitLoggingPart2(const uint8_t debug_level, void VegaStrikeLogger::FlushLogs() { logging_core_->flush(); - if (console_log_sink_) { -// console_log_sink_->feed_records(); - console_log_sink_->flush(); - } - if (file_log_sink_) { -// file_log_sink_->feed_records(); - file_log_sink_->flush(); - } +// if (console_log_sink_) { +//// console_log_sink_->feed_records(); +// console_log_sink_->flush(); +// } +// if (file_log_sink_) { +//// file_log_sink_->feed_records(); +// file_log_sink_->flush(); +// } std::cout << std::flush; std::cerr << std::flush; @@ -116,22 +117,22 @@ void VegaStrikeLogger::FlushLogs() { void VegaStrikeLogger::FlushLogsProgramExiting() { logging_core_->flush(); - if (console_log_sink_) { - logging_core_->remove_sink(console_log_sink_); -// console_log_sink_->stop(); - console_log_sink_->flush(); - } - if (console_log_back_end_) { - console_log_back_end_->flush(); - } - if (file_log_sink_) { - logging_core_->remove_sink(file_log_sink_); -// file_log_sink_->stop(); - file_log_sink_->flush(); - } - if (file_log_back_end_) { - file_log_back_end_->flush(); - } +// if (console_log_sink_) { +// logging_core_->remove_sink(console_log_sink_); +//// console_log_sink_->stop(); +// console_log_sink_->flush(); +// } +// if (console_log_back_end_) { +// console_log_back_end_->flush(); +// } +// if (file_log_sink_) { +// logging_core_->remove_sink(file_log_sink_); +//// file_log_sink_->stop(); +// file_log_sink_->flush(); +// } +// if (file_log_back_end_) { +// file_log_back_end_->flush(); +// } std::cout << std::flush; std::cerr << std::flush; @@ -139,11 +140,10 @@ void VegaStrikeLogger::FlushLogsProgramExiting() { fflush(stdout); fflush(stderr); - logging_core_->remove_all_sinks(); - console_log_sink_.reset(); - file_log_sink_.reset(); - console_log_back_end_.reset(); - file_log_back_end_.reset(); +// console_log_sink_.reset(); +// file_log_sink_.reset(); +// console_log_back_end_.reset(); +// file_log_back_end_.reset(); } BOOST_LOG_GLOBAL_LOGGER_INIT(my_logger, severity_logger_mt) { @@ -153,7 +153,7 @@ BOOST_LOG_GLOBAL_LOGGER_INIT(my_logger, severity_logger_mt) { } VegaStrikeLogger::VegaStrikeLogger() : slg_(my_logger::get()), file_log_back_end_(nullptr), file_log_sink_(nullptr) { - boost::filesystem::path::imbue(std::locale("C")); + boost::filesystem::path::imbue(std::locale("")); logging_core_ = boost::log::core::get(); // slg_ = my_logger::get(); @@ -163,7 +163,7 @@ VegaStrikeLogger::VegaStrikeLogger() : slg_(my_logger::get()), file_log_back_end boost::log::keywords::format = "%Message%", /*< log record format specific to the console >*/ boost::log::keywords::auto_flush = - false /*true*/ /*< whether to do the equivalent of fflush(stdout) after every msg >*/ + true /*false*/ /*< whether to do the equivalent of fflush(stdout) after every msg >*/ ); console_log_sink_ = boost::make_shared(console_log_back_end_); logging_core_->add_sink(console_log_sink_); @@ -171,6 +171,7 @@ VegaStrikeLogger::VegaStrikeLogger() : slg_(my_logger::get()), file_log_back_end VegaStrikeLogger::~VegaStrikeLogger() { FlushLogsProgramExiting(); + logging_core_->remove_all_sinks(); } void VegaStrikeLogger::Log(const vega_log_level level, const std::string &message) { @@ -192,7 +193,7 @@ void VegaStrikeLogger::LogAndFlush(const vega_log_level level, const std::string void VegaStrikeLogger::LogFlushExit(const vega_log_level level, const std::string& message, const int exit_code = -50) { Log(level, message); FlushLogsProgramExiting(); - exit(exit_code); + VSExit(exit_code); } void VegaStrikeLogger::Log(const vega_log_level level, const char *message) { @@ -214,7 +215,7 @@ void VegaStrikeLogger::LogAndFlush(const vega_log_level level, const char *messa void VegaStrikeLogger::LogFlushExit(const vega_log_level level, const char* message, const int exit_code = -50) { Log(level, message); FlushLogsProgramExiting(); - exit(exit_code); + VSExit(exit_code); } void VegaStrikeLogger::Log(const vega_log_level level, const boost::basic_format &message) { @@ -236,7 +237,7 @@ void VegaStrikeLogger::LogAndFlush(const vega_log_level level, const boost::basi void VegaStrikeLogger::LogFlushExit(const vega_log_level level, const boost::basic_format& message, const int exit_code = -50) { Log(level, message); FlushLogsProgramExiting(); - exit(exit_code); + VSExit(exit_code); } } // namespace VegaStrikeLogging diff --git a/engine/src/vs_logging.h b/engine/src/vs_logging.h index d87ea2a961..c4090544ab 100644 --- a/engine/src/vs_logging.h +++ b/engine/src/vs_logging.h @@ -76,7 +76,7 @@ typedef boost::log::sinks::synchronous_sink FileLogSink; } while (false) #define VS_LOG_FLUSH_EXIT(log_level, log_message, exit_code) \ do { \ - VegaStrikeLogging::VegaStrikeLogger::instance().LogFlushExit(VegaStrikeLogging::vega_log_level::log_level, (log_message), (exit_code)); \ + VegaStrikeLogging::VegaStrikeLogger::instance().LogFlushExit(VegaStrikeLogging::vega_log_level::log_level, (log_message), exit_code); \ } while (false) class VegaStrikeLogger { From 3c7ac3c6c2ef443edd7a528b98102ea93e86154a Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Thu, 25 Apr 2024 06:49:35 -0700 Subject: [PATCH 29/32] winsys.cpp: Have `winsys_exit(...)` actually exit the program --- engine/src/gldrv/winsys.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/src/gldrv/winsys.cpp b/engine/src/gldrv/winsys.cpp index e48ebf4ea3..ae0723b9b6 100644 --- a/engine/src/gldrv/winsys.cpp +++ b/engine/src/gldrv/winsys.cpp @@ -493,14 +493,14 @@ void winsys_atexit(winsys_atexit_func_t func) { * Exits the program * \author jfpatry * \date Created: 2000-10-20 - * \date Modified: 2000-10-20 + * \date Modified: 2024-04-25 */ void winsys_exit(int code) { winsys_shutdown(); if (atexit_func) { (*atexit_func)(); } - // exit( code ); + exit( code ); } #else From 9f0c39323c24acfb8d6fc0ce46a606f030602f9c Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Thu, 25 Apr 2024 08:43:41 -0700 Subject: [PATCH 30/32] More on logging, plus startup and shutdown sequences --- engine/src/main.cpp | 33 ++++++++++----------- engine/src/vs_logging.cpp | 2 +- engine/src/vsfilesystem.cpp | 58 ++++++++++++++++++++----------------- engine/src/vsfilesystem.h | 2 +- 4 files changed, 49 insertions(+), 46 deletions(-) diff --git a/engine/src/main.cpp b/engine/src/main.cpp index ed07497a85..cec2edbd9a 100644 --- a/engine/src/main.cpp +++ b/engine/src/main.cpp @@ -253,11 +253,11 @@ int main(int argc, char *argv[]) { // when the program name is `vegastrike-engine` then enforce that the data directory must be specified // if the program name is `vegastrike` then enable legacy mode where the current path is assumed. legacy_data_dir_mode = (program_name == "vegastrike") || (program_name == "vegastrike.exe"); - std::cerr << "Legacy Mode: " << (legacy_data_dir_mode ? "TRUE" : "FALSE") << std::endl; + VS_LOG(important_info, (boost::format("Legacy Mode: %1%") % legacy_data_dir_mode)); if (legacy_data_dir_mode) { VSFileSystem::datadir = boost::filesystem::current_path().string(); - std::cerr << "Saving current directory (" << VSFileSystem::datadir << ") as DATA_DIR" << std::endl; + VS_LOG(important_info, (boost::format("Saving current directory (%1%) as DATA_DIR") % VSFileSystem::datadir)); } if (!program_directory_path.empty()) // Changing to an empty path does bad things @@ -273,9 +273,9 @@ int main(int argc, char *argv[]) { char pwd[8192] = ""; if (nullptr != getcwd(pwd, 8191)) { pwd[8191] = '\0'; - VS_LOG(info, (boost::format(" In path %1%") % pwd)); + VS_LOG(important_info, (boost::format(" In path %1%") % pwd)); } else { - VS_LOG(info, " In path <>"); + VS_LOG(error, " In path <>"); } } #ifdef _WIN32 @@ -300,23 +300,21 @@ int main(int argc, char *argv[]) { //this sets up the vegastrike config variable setup_game_data(); //loads the configuration file .vegastrike/vegastrike.config from home dir if such exists - { - std::string subdir = ParseCommandLine(argc, argv); - VS_LOG(info, (boost::format("GOT SUBDIR ARG = %1%") % subdir)); - if (CONFIGFILE == 0) { - CONFIGFILE = new char[42]; - sprintf(CONFIGFILE, "vegastrike.config"); - } - //Specify the config file and the possible mod subdir to play - VSFileSystem::InitPaths(CONFIGFILE, subdir); - // home_subdir_path = boost::filesystem::canonical(boost::filesystem::path(subdir)); + std::string subdir = ParseCommandLine(argc, argv); + VS_LOG(important_info, (boost::format("GOT SUBDIR ARG = %1%") % subdir)); + if (CONFIGFILE == 0) { + CONFIGFILE = new char[42]; + sprintf(CONFIGFILE, "vegastrike.config"); } + //Specify the config file and the possible mod subdir to play + VSFileSystem::InitPaths(CONFIGFILE, subdir); + // home_subdir_path = boost::filesystem::canonical(boost::filesystem::path(subdir)); // now that the user config file has been loaded from disk, update the global configuration struct values configuration()->OverrideDefaultsWithUserConfiguration(); // If no debug argument is supplied, set to what the config file has. - if (g_game.vsdebug == '0') { + if (g_game.vsdebug == '0' || g_game.vsdebug == '\0') { g_game.vsdebug = configuration()->logging.vsdebug; } @@ -339,7 +337,7 @@ int main(int argc, char *argv[]) { if (mission_name[0] == '\0') { strncpy(mission_name, game_options()->default_mission.c_str(), 1023); mission_name[1023] = '\0'; - VS_LOG(info, (boost::format("MISSION_NAME is empty using : %1%") % mission_name)); + VS_LOG(important_info, (boost::format("MISSION_NAME is empty using : %1%") % mission_name)); } int exitcode; @@ -867,8 +865,7 @@ std::string ParseCommandLine(int argc, char **lpCmdLine) { } if (false == legacy_data_dir_mode) { if (true == VSFileSystem::datadir.empty()) { - std::cout << "Data directory not specified." << std::endl; - exit(1); + VS_LOG_FLUSH_EXIT(fatal, "Data directory not specified.", 1); } } diff --git a/engine/src/vs_logging.cpp b/engine/src/vs_logging.cpp index 97009f036c..0df491f9c7 100644 --- a/engine/src/vs_logging.cpp +++ b/engine/src/vs_logging.cpp @@ -94,7 +94,7 @@ void VegaStrikeLogger::InitLoggingPart2(const uint8_t debug_level, file_log_sink_ = boost::make_shared(file_log_back_end_); logging_core_->add_sink(file_log_sink_); - console_log_sink_->set_filter(severity >= fatal); + console_log_sink_->set_filter(severity >= important_info); } void VegaStrikeLogger::FlushLogs() { diff --git a/engine/src/vsfilesystem.cpp b/engine/src/vsfilesystem.cpp index d96454e081..5e6a779aac 100644 --- a/engine/src/vsfilesystem.cpp +++ b/engine/src/vsfilesystem.cpp @@ -620,7 +620,9 @@ void InitDataDirectory() { //Config file has been loaded from data dir but now we look at the specified moddir in order //to see if we should use a mod config file void LoadConfig(string subdir) { - bool found = false; + bool config_file_found = false; + bool mod_found = false; + bool data_dir_found = false; bool foundweapons = false; //First check if we have a config file in homedir+"/"+subdir or in datadir+"/"+subdir weapon_list = "weapon_list.xml"; @@ -628,72 +630,74 @@ void LoadConfig(string subdir) { modname = subdir; if (DirectoryExists(homedir + "/mods/" + subdir)) { if (FileExists(homedir + "/mods/" + subdir, config_file) >= 0) { - VS_LOG(info, + VS_LOG(important_info, (boost::format("CONFIGFILE - Found a config file in home mod directory, using : %1%") % (homedir + "/mods/" + subdir + "/" + config_file))); + config_file = homedir + "/mods/" + subdir + "/" + config_file; + mod_found = true; + config_file_found = true; if (FileExists(homedir + "/mods/" + subdir, "weapon_list.xml") >= 0) { weapon_list = homedir + "/mods/" + subdir + "/weapon_list.xml"; foundweapons = true; } - config_file = homedir + "/mods/" + subdir + "/" + config_file; - found = true; } } - if (!found) { + if (!mod_found) { VS_LOG(warning, (boost::format("WARNING : couldn't find a mod named '%1%' in homedir/mods") % subdir)); } if (DirectoryExists(moddir + "/" + subdir)) { if (FileExists(moddir + "/" + subdir, config_file) >= 0) { - if (!found) { - VS_LOG(info, + if (!config_file_found) { + VS_LOG(important_info, (boost::format("CONFIGFILE - Found a config file in mods directory, using : %1%") % (moddir + "/" + subdir + "/" + config_file))); + config_file = moddir + "/" + subdir + "/" + config_file; + config_file_found = true; } if ((!foundweapons) && FileExists(moddir + "/" + subdir, "weapon_list.xml") >= 0) { weapon_list = moddir + "/" + subdir + "/weapon_list.xml"; foundweapons = true; } - if (!found) { - config_file = moddir + "/" + subdir + "/" + config_file; - } - found = true; } } else { VS_LOG(error, (boost::format("ERROR : couldn't find a mod named '%1%' in datadir/mods") % subdir)); } //} } - if (!found) { - //Next check if we have a config file in homedir if we haven't found one for mod + if (!config_file_found) { + //Next check if we have a config file in homedir if we haven't config_file_found one for mod if (FileExists(homedir, config_file) >= 0) { - VS_LOG(info, + VS_LOG(important_info, (boost::format("CONFIGFILE - Found a config file in home directory, using : %1%") % (homedir + "/" + config_file))); config_file = homedir + "/" + config_file; + config_file_found = true; } else { - VS_LOG(info, (boost::format("CONFIGFILE - No config found in home : %1%") % (homedir + "/" + config_file))); + VS_LOG(important_info, (boost::format("CONFIGFILE - No config config_file_found in home : %1%") % (homedir + "/" + config_file))); if (FileExists(datadir, config_file) >= 0) { - VS_LOG(info, - (boost::format("CONFIGFILE - No home config file found, using datadir config file : %1%") + VS_LOG(important_info, + (boost::format("CONFIGFILE - No home config file config_file_found, using datadir config file : %1%") % (datadir + "/" + config_file))); //We didn't find a config file in home_path so we load the data_path one config_file = datadir + "/" + config_file; + config_file_found = true; } else { VS_LOG_AND_FLUSH(fatal, - (boost::format("CONFIGFILE - No config found in data dir : %1%") + (boost::format("CONFIGFILE - No config config_file_found in data dir : %1%") % (datadir + "/" + config_file))); VS_LOG_FLUSH_EXIT(fatal, "CONFIG FILE NOT FOUND !!!", 1); } } } else if (!subdir.empty()) { - VS_LOG(info, (boost::format("Using Mod Directory %1%") % moddir)); + VS_LOG(important_info, (boost::format("Using Mod Directory %1%") % moddir)); CreateDirectoryHome("mods"); CreateDirectoryHome("mods/" + subdir); homedir = homedir + "/mods/" + subdir; + mod_found = true; } //Delete the default config in order to reallocate it with the right one (if it is a mod) if (vs_config) { - VS_LOG(info, "reallocating vs_config "); + VS_LOG(important_info, "reallocating vs_config "); delete vs_config; } @@ -705,13 +709,15 @@ void LoadConfig(string subdir) { //Now check if there is a data directory specified in it //NOTE : THIS IS NOT A GOOD IDEA TO HAVE A DATADIR SPECIFIED IN THE CONFIG FILE if (!game_options()->datadir.empty()) { - //We found a path to data in config file - VS_LOG(info, (boost::format("DATADIR - Found a datadir in config, using : %1%") % game_options()->datadir)); + //We config_file_found a path to data in config file + VS_LOG(important_info, (boost::format("DATADIR - Found a datadir in config, using : %1%") % game_options()->datadir)); datadir = game_options()->datadir; + data_dir_found = true; } else { if (true == legacy_data_dir_mode) { - VS_LOG(info, (boost::format("DATADIR - No datadir specified in config file, using : %1%") % datadir)); - } else { + VS_LOG(important_info, (boost::format("DATADIR - No datadir specified in config file, using : %1%") % datadir)); + data_dir_found = true; + } else if (!data_dir_found) { VS_LOG_FLUSH_EXIT(fatal, "DATADIR - No datadir specified in config file", 1); } } @@ -836,7 +842,7 @@ void InitMods() { // free(dirlist); } -void InitPaths(string conf, string subdir) { +void InitPaths(std::string conf, std::string subdir) { config_file = std::move(conf); current_path.emplace_back(""); @@ -1035,7 +1041,7 @@ void CreateDirectoryAbs(const char *filename) { if (!DirectoryExists(filename)) { err = mkdir(filename #if !defined (_WIN32) || defined (__CYGWIN__) - , 0xFFFFFFFF + , 0xFFFF #endif ); if (err < 0 && errno != EEXIST) { diff --git a/engine/src/vsfilesystem.h b/engine/src/vsfilesystem.h index f6624c3059..4e90878f62 100644 --- a/engine/src/vsfilesystem.h +++ b/engine/src/vsfilesystem.h @@ -264,7 +264,7 @@ std::string GetCorrectStarSysPath(const std::string &, bool &autogenerated); */ //Initialize paths -void InitPaths(std::string conf, std::string subdir = ""); +void InitPaths(std::string conf, std::string subdir); void InitDataDirectory(); void InitHomeDirectory(); void LoadConfig(std::string subdir = ""); From 379f82e77878cd587fac2ce4e104485bd8a08777 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Thu, 25 Apr 2024 09:22:13 -0700 Subject: [PATCH 31/32] vsfilesystem.cpp: ... --- engine/src/vsfilesystem.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/engine/src/vsfilesystem.cpp b/engine/src/vsfilesystem.cpp index 5e6a779aac..23b7c9e920 100644 --- a/engine/src/vsfilesystem.cpp +++ b/engine/src/vsfilesystem.cpp @@ -528,7 +528,7 @@ void InitDataDirectory() { // %{appdata%} // data_paths.push_back(); #else - data_paths.push_back("/usr/share/vegastrike"); + data_paths.emplace_back("/usr/share/vegastrike"); #endif } @@ -563,10 +563,10 @@ void InitDataDirectory() { for (auto & data_path : data_paths) { //Test if the dir exist and contains config_file if (FileExists(data_path, config_file) >= 0) { - VS_LOG(info, (boost::format("Found data in %1%") % data_path)); + VS_LOG(important_info, (boost::format("Found data in %1%") % data_path)); if (nullptr != getcwd(tmppath, VS_PATH_BUF_SIZE - 1)) { if (data_path.substr(0, 1) == ".") { - datadir = string(tmppath) + "/" + data_path; + datadir = std::string(tmppath) + "/" + data_path; } else { datadir = data_path; } @@ -578,12 +578,12 @@ void InitDataDirectory() { VS_LOG_FLUSH_EXIT(fatal, "Error changing to datadir", 1); } if (nullptr != getcwd(tmppath, VS_PATH_BUF_SIZE - 1)) { - datadir = string(tmppath); + datadir = std::string(tmppath); } else { VS_LOG(error, "Cannot get current path: path too long"); } - VS_LOG(info, (boost::format("Using %1% as data directory") % datadir)); + VS_LOG(important_info, (boost::format("Using %1% as data directory") % datadir)); break; } } @@ -622,7 +622,7 @@ void InitDataDirectory() { void LoadConfig(string subdir) { bool config_file_found = false; bool mod_found = false; - bool data_dir_found = false; + bool data_dir_found = (!datadir.empty()); bool foundweapons = false; //First check if we have a config file in homedir+"/"+subdir or in datadir+"/"+subdir weapon_list = "weapon_list.xml"; From 2b212588aa7b64a5b1bd9896d089526d1640dda3 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Thu, 25 Apr 2024 09:59:06 -0700 Subject: [PATCH 32/32] ... --- .../audio/renderers/OpenAL/OpenALRenderer.cpp | 6 ++- engine/src/vs_logging.cpp | 53 ++----------------- engine/src/vs_logging.h | 1 - 3 files changed, 7 insertions(+), 53 deletions(-) diff --git a/engine/src/audio/renderers/OpenAL/OpenALRenderer.cpp b/engine/src/audio/renderers/OpenAL/OpenALRenderer.cpp index ad4d2436d9..606882fb7a 100644 --- a/engine/src/audio/renderers/OpenAL/OpenALRenderer.cpp +++ b/engine/src/audio/renderers/OpenAL/OpenALRenderer.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * OpenALRenderer.cpp + * + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -13,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License diff --git a/engine/src/vs_logging.cpp b/engine/src/vs_logging.cpp index 0df491f9c7..1959cdbcbb 100644 --- a/engine/src/vs_logging.cpp +++ b/engine/src/vs_logging.cpp @@ -29,14 +29,11 @@ #include #include -#include #include #include #include #include #include -#include -#include #include #include #include @@ -46,13 +43,6 @@ namespace VegaStrikeLogging { -// void exitProgram(int code) -// { -// Music::CleanupMuzak(); -// VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogs(); -// winsys_exit(code); -// } - void VegaStrikeLogger::InitLoggingPart2(const uint8_t debug_level, const boost::filesystem::path &vega_strike_home_dir) { @@ -76,7 +66,7 @@ void VegaStrikeLogger::InitLoggingPart2(const uint8_t debug_level, break; } - file_log_back_end_ = boost::make_shared + file_log_sink_ = boost::log::add_file_log ( boost::log::keywords::file_name = logging_dir_name + "/" + "vegastrike_%Y-%m-%d_%H_%M_%S.%f.log", /*< file name pattern >*/ @@ -91,23 +81,12 @@ void VegaStrikeLogger::InitLoggingPart2(const uint8_t debug_level, boost::log::keywords::min_free_space = 5UL * 1024UL * 1024UL * 1024UL /*< stop boost::log when there's only 5 GiB free space left >*/ ); - file_log_sink_ = boost::make_shared(file_log_back_end_); - logging_core_->add_sink(file_log_sink_); console_log_sink_->set_filter(severity >= important_info); } void VegaStrikeLogger::FlushLogs() { logging_core_->flush(); -// if (console_log_sink_) { -//// console_log_sink_->feed_records(); -// console_log_sink_->flush(); -// } -// if (file_log_sink_) { -//// file_log_sink_->feed_records(); -// file_log_sink_->flush(); -// } - std::cout << std::flush; std::cerr << std::flush; std::clog << std::flush; @@ -117,33 +96,11 @@ void VegaStrikeLogger::FlushLogs() { void VegaStrikeLogger::FlushLogsProgramExiting() { logging_core_->flush(); -// if (console_log_sink_) { -// logging_core_->remove_sink(console_log_sink_); -//// console_log_sink_->stop(); -// console_log_sink_->flush(); -// } -// if (console_log_back_end_) { -// console_log_back_end_->flush(); -// } -// if (file_log_sink_) { -// logging_core_->remove_sink(file_log_sink_); -//// file_log_sink_->stop(); -// file_log_sink_->flush(); -// } -// if (file_log_back_end_) { -// file_log_back_end_->flush(); -// } - std::cout << std::flush; std::cerr << std::flush; std::clog << std::flush; fflush(stdout); fflush(stderr); - -// console_log_sink_.reset(); -// file_log_sink_.reset(); -// console_log_back_end_.reset(); -// file_log_back_end_.reset(); } BOOST_LOG_GLOBAL_LOGGER_INIT(my_logger, severity_logger_mt) { @@ -155,18 +112,14 @@ BOOST_LOG_GLOBAL_LOGGER_INIT(my_logger, severity_logger_mt) { VegaStrikeLogger::VegaStrikeLogger() : slg_(my_logger::get()), file_log_back_end_(nullptr), file_log_sink_(nullptr) { boost::filesystem::path::imbue(std::locale("")); logging_core_ = boost::log::core::get(); - // slg_ = my_logger::get(); - - console_log_back_end_ = boost::make_shared + console_log_sink_ = boost::log::add_console_log ( - boost::shared_ptr(&std::cerr, boost::null_deleter()), + std::cerr, boost::log::keywords::format = "%Message%", /*< log record format specific to the console >*/ boost::log::keywords::auto_flush = true /*false*/ /*< whether to do the equivalent of fflush(stdout) after every msg >*/ ); - console_log_sink_ = boost::make_shared(console_log_back_end_); - logging_core_->add_sink(console_log_sink_); } VegaStrikeLogger::~VegaStrikeLogger() { diff --git a/engine/src/vs_logging.h b/engine/src/vs_logging.h index c4090544ab..044103bb00 100644 --- a/engine/src/vs_logging.h +++ b/engine/src/vs_logging.h @@ -33,7 +33,6 @@ #include #include #include -//#include #include #include #include