diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 56ae71a87..5523bcc77 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,7 +42,7 @@ jobs: - runner: ubuntu-latest preset: linux-cross-arm64 cc: gcc - cxx: g++++ + cxx: g++ name: Linux-cross-arm64 build_type: - Debug diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fefaa13a7..4220381b1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,7 @@ jobs: - name: Generate git hash and tarball run: | sudo apt update - sudo apt install -y ninja-build cmake g++ libsdl2-dev zlib1g-dev + sudo apt install -y ninja-build cmake g++ zlib1g-dev cmake --preset linux cmake --build --preset linux -t get_git_hash cmake --build --preset linux -t package_source diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 30561661d..000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "third_party/plog"] - path = third_party/plog - url = https://github.com/SergiusTheBest/plog.git diff --git a/BUILD.md b/BUILD.md index 8033a10e7..ef4d0132a 100644 --- a/BUILD.md +++ b/BUILD.md @@ -2,7 +2,15 @@ # Building Descent 3 Open Source ## Dependencies -The build process uses [**CMake**](https://cmake.org/) and, by default, [**Ninja**](https://ninja-build.org/). You must install these; the project cannot locate them for you. The source code depends on [**SDL2**](https://github.com/libsdl-org/SDL/tree/SDL2) and [**zlib**](https://github.com/madler/zlib). You can supply these dependencies yourself via your system's library management tools, or the build system can locate the dependencies for you using [vcpkg](https://github.com/microsoft/vcpkg), a cross-platform dependency-management system developed by Microsoft. The official builds source their dependencies from vcpkg. +The build process uses [**CMake**](https://cmake.org/) and, by default, [**Ninja**](https://ninja-build.org/). You must install these; the project cannot locate them for you. The source code also depends on third-party libraries that are not provided as part of the repository: +- [**SDL3**](https://wiki.libsdl.org/SDL3/FrontPage) which is used as the base to handle video, audio and input. +- [**cpp-httplib**](https://github.com/yhirose/cpp-httplib) as a HTTP client to download levels. +- [**glm**](https://github.com/g-truc/glm) providing useful additions to OpenGL. +- [**plog**](https://github.com/SergiusTheBest/plog) for logging +- [**zlib**](https://www.zlib.net/) as a compression utility +- [**gtest**](https://github.com/google/googletest) (optional) for testing. + +You can supply these dependencies yourself via your system's library management tools, or the build system can locate the dependencies for you using [vcpkg](https://github.com/microsoft/vcpkg), a cross-platform dependency-management system developed by Microsoft. The official builds source their dependencies from vcpkg. ## Installing and using vcpkg * When building for Windows, vcpkg is already installed and configured when using any of the Visual Studio command prompts (either actual Command Prompt, or PowerShell). @@ -132,11 +140,11 @@ Once CMake finishes, the built files will be put in `builds/mac/build/Debug` or * If you would like to manage the code dependencies yourself: * APT users ```sh - sudo apt install -y --no-install-recommends libsdl2-dev zlib1g-dev libcpp-httplib-dev libgtest-dev libglm-dev + sudo apt install -y --no-install-recommends libsdl3-dev zlib1g-dev libcpp-httplib-dev libgtest-dev libglm-dev ``` * DNF users ```sh - sudo dnf install -y SDL2-devel zlib-devel cpp-httplib-devel gtest glm-devel + sudo dnf install -y SDL3-devel zlib-devel cpp-httplib-devel gtest glm-devel ``` 3. **Clone the Descent3 source code.** @@ -195,5 +203,5 @@ cmake --preset linux -DENABLE_LOGGER=ON | `ENABLE_MEM_RTL` | Enable Real-time library memory management functions (disable to verbose memory allocations). | `ON` | | `FORCE_COLORED_OUTPUT` | Always produce ANSI-colored compiler warnings/errors (GCC/Clang only; esp. useful with Ninja). | `OFF` | | `FORCE_PORTABLE_INSTALL` | Install all files into local directory defined by `CMAKE_INSTALL_PREFIX`. | `ON` | -| `USE_EXTERNAL_PLOG` | Use system plog library. | `OFF` | + | `OFF` | | `USE_VCPKG` | Explicitly control whether or not to use vcpkg for dependency resolution. `ON` requires the environment variable `VCPKG_ROOT` to be set. | Determined by the existence of `VCPKG_ROOT` in the environment: If it exists, vcpkg is used. | diff --git a/CMakeLists.txt b/CMakeLists.txt index b204b4327..59a0bafc3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,8 +9,9 @@ endif() set(USE_VCPKG "DEFAULT" CACHE STRING "Use vcpkg for dependency management. DEFAULT defers to existence of $VCPKG_ROOT environment variable.") set_property(CACHE USE_VCPKG PROPERTY STRINGS "DEFAULT" "ON" "OFF") -if(USE_VCPKG) +if(NOT USE_VCPKG STREQUAL "OFF") if(DEFINED ENV{VCPKG_ROOT}) + if (CMAKE_TOOLCHAIN_FILE) cmake_path(ABSOLUTE_PATH CMAKE_TOOLCHAIN_FILE NORMALIZE OUTPUT_VARIABLE VCPKG_CHAINLOAD_TOOLCHAIN_FILE) endif() @@ -42,7 +43,6 @@ option(ENABLE_MEM_RTL "Enable Real-time library memory management functions (dis option(FATAL_GL_ERRORS "Check OpenGL calls and raise exceptions on errors." OFF) option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored compiler warnings/errors (GCC/Clang only; esp. useful with Ninja)." OFF) option(FORCE_PORTABLE_INSTALL "Install all files into local directory defined by CMAKE_INSTALL_PREFIX" ON) -option(USE_EXTERNAL_PLOG "Use system plog library instead bundled" OFF) if(CMAKE_SYSTEM_NAME STREQUAL "Windows") option(BUILD_EDITOR "Build internal editor" OFF) endif() @@ -159,23 +159,18 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU" add_compile_options("-Wno-multichar;-Wall") endif() +find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3) find_package(glm REQUIRED) find_package(httplib REQUIRED) -find_package(SDL2 REQUIRED) -# Some versions of the SDL2 find_package set SDL2_INCLUDE_DIR and some set a plural SDL2_INCLUDE_DIRS. Check both. -message("SDL2 Include Dir is ${SDL2_INCLUDE_DIR} ${SDL2_INCLUDE_DIRS}") -if(USE_EXTERNAL_PLOG) - find_package(plog REQUIRED) -endif() +find_package(ZLIB REQUIRED) +find_package(plog REQUIRED) if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") message("Building for Linux") add_compile_definitions(POSIX __LINUX__ _USE_OGL_ACTIVE_TEXTURES PRIMARY_HOG=\"d3-linux.hog\") - set(PLATFORM_INCLUDES "lib/linux" ${SDL2_INCLUDE_DIR} ${SDL2_INCLUDE_DIRS}) elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") message("Building for MAC OSX") add_compile_definitions(POSIX MACOSX=1 _USE_OGL_ACTIVE_TEXTURES PRIMARY_HOG=\"d3-osx.hog\") - set(PLATFORM_INCLUDES "lib/linux" ${SDL2_INCLUDE_DIR} ${SDL2_INCLUDE_DIRS}) elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") # Windows.h defines to avoid as many issues as possible. add_compile_definitions(WIN32_LEAN_AND_MEAN NOMINMAX NODRAWTEXT NOBITMAP NOMCX NOSERVICE PRIMARY_HOG=\"d3-win.hog\" @@ -191,8 +186,6 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") add_compile_definitions(WIN32 _CRT_SECURE_NO_WARNINGS _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_DEPRECATE) - set(PLATFORM_INCLUDES "lib/win/DirectX" "lib/win") - set(CMAKE_FIND_LIBRARY_PREFIXES "") set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib") @@ -221,8 +214,6 @@ endif() add_compile_definitions($<$:RELEASE>) add_compile_definitions($<$:_DEBUG>) -find_package(ZLIB REQUIRED) - if(ENABLE_LOGGER) message("Enabling Logging") add_compile_definitions(LOGGER) @@ -240,7 +231,10 @@ include_directories( "lib" # TODO: Remove after untying all modules "linux" # -*- "Descent3" - ${PLATFORM_INCLUDES} + $<$: + "lib/win/DirectX" + "lib/win" + > ) add_subdirectory(third_party) diff --git a/Descent3/CMakeLists.txt b/Descent3/CMakeLists.txt index 91fd9ebe5..e1e32e168 100644 --- a/Descent3/CMakeLists.txt +++ b/Descent3/CMakeLists.txt @@ -312,7 +312,7 @@ file(GLOB_RECURSE INCS "../lib/*.h") add_executable(Descent3 WIN32 MACOSX_BUNDLE ${D3Icon} ${HEADERS} ${CPPS} ${INCS} ${MANIFEST} ${RC_FILE}) target_link_libraries(Descent3 PRIVATE - SDL2::SDL2 + SDL3::SDL3 2dlib AudioEncode bitmap @@ -343,7 +343,7 @@ target_link_libraries(Descent3 PRIVATE unzip vecmat ${PLATFORM_LIBS}) -target_include_directories(Descent3 PRIVATE ${PROJECT_BINARY_DIR}/lib) +target_include_directories(Descent3 PRIVATE ${PROJECT_BINARY_DIR}/lib ${SDL3_INCLUDE_DIRS}) target_link_options(Descent3 PRIVATE $<$:/DEBUG:FULL>) set_target_properties(Descent3 PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/build") add_dependencies(Descent3 diff --git a/Descent3/config.cpp b/Descent3/config.cpp index d5dc55033..5abf772d8 100644 --- a/Descent3/config.cpp +++ b/Descent3/config.cpp @@ -691,10 +691,10 @@ struct video_menu { sheet->NewGroup(TXT_MONITOR, 0, 180); vsync = sheet->AddLongCheckBox(TXT_CFG_VSYNCENABLED, (Render_preferred_state.vsync_on != 0)); -#if !defined(POSIX) + sheet->AddText(""); sheet->AddLongButton(TXT_AUTO_GAMMA, IDV_AUTOGAMMA); -#endif + return sheet; }; @@ -736,13 +736,11 @@ struct video_menu { // process void process(int res) { -#if !defined(POSIX) switch (res) { case IDV_AUTOGAMMA: config_gamma(); break; } -#endif }; }; diff --git a/Descent3/menu.cpp b/Descent3/menu.cpp index 450ff2b41..21df635a4 100644 --- a/Descent3/menu.cpp +++ b/Descent3/menu.cpp @@ -112,7 +112,7 @@ * * 169 4/16/99 11:56a Matt * Changed directplay code to be "ifdef _WIN32" instead of "ifndef - * __LINUX__" so it will work on the Mac. + * SDL_PLATFORM_LINUX" so it will work on the Mac. * * 168 4/15/99 1:40a Jeff * changes for linux compile diff --git a/Descent3/multi_connect.cpp b/Descent3/multi_connect.cpp index 492068f1b..7059c682e 100644 --- a/Descent3/multi_connect.cpp +++ b/Descent3/multi_connect.cpp @@ -96,7 +96,7 @@ * * 61 4/16/99 11:56a Matt * Changed directplay code to be "ifdef _WIN32" instead of "ifndef - * __LINUX__" so it will work on the Mac. + * SDL_PLATFORM_LINUX" so it will work on the Mac. * * 60 4/15/99 1:41a Jeff * changes for linux compile diff --git a/Descent3/multi_dll_mgr.cpp b/Descent3/multi_dll_mgr.cpp index d377dbc6f..1ec0e14a4 100644 --- a/Descent3/multi_dll_mgr.cpp +++ b/Descent3/multi_dll_mgr.cpp @@ -90,7 +90,7 @@ * * 61 4/16/99 11:56a Matt * Changed directplay code to be "ifdef _WIN32" instead of "ifndef - * __LINUX__" so it will work on the Mac. + * SDL_PLATFORM_LINUX" so it will work on the Mac. * * 60 4/16/99 12:15a Jeff * linux wants stdcall modifiers before parens, unlike windows diff --git a/Descent3/multi_ui.cpp b/Descent3/multi_ui.cpp index 090e26eca..d847c12e3 100644 --- a/Descent3/multi_ui.cpp +++ b/Descent3/multi_ui.cpp @@ -100,7 +100,7 @@ * * 82 4/16/99 11:56a Matt * Changed directplay code to be "ifdef _WIN32" instead of "ifndef - * __LINUX__" so it will work on the Mac. + * SDL_PLATFORM_LINUX" so it will work on the Mac. * * 81 4/15/99 3:36p Kevin * Added mouselook UI stuff to the multiplayer options menu diff --git a/Descent3/sdlmain.cpp b/Descent3/sdlmain.cpp index 98352e5eb..29a0080c0 100644 --- a/Descent3/sdlmain.cpp +++ b/Descent3/sdlmain.cpp @@ -33,7 +33,7 @@ #include #endif -#include +#include #include "appdatabase.h" #include "application.h" @@ -175,27 +175,27 @@ class oeD3LnxDatabase final : public oeLnxAppDatabase { } }; -int sdlKeyFilter(const SDL_Event *event); -int sdlMouseButtonUpFilter(const SDL_Event *event); -int sdlMouseButtonDownFilter(const SDL_Event *event); -int sdlMouseWheelFilter(const SDL_Event *event); -int sdlMouseMotionFilter(const SDL_Event *event); +bool sdlKeyFilter(const SDL_Event *event); +bool sdlMouseButtonUpFilter(const SDL_Event *event); +bool sdlMouseButtonDownFilter(const SDL_Event *event); +bool sdlMouseWheelFilter(const SDL_Event *event); +bool sdlMouseMotionFilter(const SDL_Event *event); -int SDLCALL d3SDLEventFilter(void *userdata, SDL_Event *event) { +bool SDLCALL d3SDLEventFilter(void *userdata, SDL_Event *event) { switch (event->type) { - case SDL_KEYUP: - case SDL_KEYDOWN: + case SDL_EVENT_KEY_UP: + case SDL_EVENT_KEY_DOWN: return (sdlKeyFilter(event)); - case SDL_JOYBALLMOTION: - case SDL_MOUSEMOTION: + case SDL_EVENT_JOYSTICK_BALL_MOTION: + case SDL_EVENT_MOUSE_MOTION: return (sdlMouseMotionFilter(event)); - case SDL_MOUSEBUTTONUP: + case SDL_EVENT_MOUSE_BUTTON_UP: return (sdlMouseButtonUpFilter(event)); - case SDL_MOUSEBUTTONDOWN: + case SDL_EVENT_MOUSE_BUTTON_DOWN: return (sdlMouseButtonDownFilter(event)); - case SDL_MOUSEWHEEL: + case SDL_EVENT_MOUSE_WHEEL: return (sdlMouseWheelFilter(event)); - case SDL_QUIT: + case SDL_EVENT_QUIT: SDL_Quit(); _exit(0); break; @@ -244,7 +244,7 @@ int main(int argc, char *argv[]) { #endif int rc = SDL_Init(SDL_INIT_AUDIO | SDL_INIT_VIDEO); - if (rc != 0) { + if (!rc) { LOG_FATAL.printf("SDL: SDL_Init() failed: %d: %s!", rc, SDL_GetError()); return (0); } @@ -273,7 +273,6 @@ int main(int argc, char *argv[]) { flags |= APPFLAG_NOMOUSECAPTURE; ddio_MouseSetGrab(false); } - SDL_SetRelativeMouseMode(ddio_MouseGetGrab() ? SDL_TRUE : SDL_FALSE); if (!FindArg("-sharedmemory")) { flags |= APPFLAG_NOSHAREDMEMORY; diff --git a/Descent3/terrainrender.cpp b/Descent3/terrainrender.cpp index 65e912f3e..36411f10e 100644 --- a/Descent3/terrainrender.cpp +++ b/Descent3/terrainrender.cpp @@ -2870,7 +2870,7 @@ int DrawTerrainTrianglesSoftware(int index, int bm_handle, int upper_left, int l } } #endif - #endif//__LINUX__ + #endif//SDL_PLATFORM_LINUX */ return 0; } diff --git a/ddebug/CMakeLists.txt b/ddebug/CMakeLists.txt index 8d4aec7d6..0abf935fa 100644 --- a/ddebug/CMakeLists.txt +++ b/ddebug/CMakeLists.txt @@ -23,6 +23,7 @@ target_include_directories(ddebug PUBLIC ${PROJECT_SOURCE_DIR}/ddebug > PRIVATE ${PROJECT_BINARY_DIR}/lib # For d3_version.h + ${SDL3_INCLUDE_DIRS} ) target_link_libraries(ddebug PRIVATE $<$: @@ -30,6 +31,6 @@ target_link_libraries(ddebug PRIVATE misc > PUBLIC - SDL2::SDL2 + SDL3::SDL3 logger ) diff --git a/ddebug/lnxdebug.cpp b/ddebug/lnxdebug.cpp index 4541f3b2a..09fd48683 100644 --- a/ddebug/lnxdebug.cpp +++ b/ddebug/lnxdebug.cpp @@ -39,7 +39,7 @@ */ #include -#include +#include #include "debug.h" diff --git a/ddebug/pserror.h b/ddebug/pserror.h index 4daf644e9..24d5ad861 100644 --- a/ddebug/pserror.h +++ b/ddebug/pserror.h @@ -149,7 +149,7 @@ #ifndef PSERROR_H #define PSERROR_H -#include +#include #include "debug.h" #include "log.h" diff --git a/ddio/CMakeLists.txt b/ddio/CMakeLists.txt index b2f7d4468..af496c6ec 100644 --- a/ddio/CMakeLists.txt +++ b/ddio/CMakeLists.txt @@ -28,7 +28,7 @@ set(CPPS ) add_library(ddio STATIC ${HEADERS} ${CPPS}) target_link_libraries(ddio PRIVATE - SDL2::SDL2 + SDL3::SDL3 ddebug logger mem @@ -37,6 +37,7 @@ target_include_directories(ddio PUBLIC $ + ${SDL3_INCLUDE_DIRS} ) if(BUILD_TESTING) diff --git a/ddio/lnxkey_sdl.cpp b/ddio/lnxkey_sdl.cpp index a36cfd4ea..f8403e439 100644 --- a/ddio/lnxkey_sdl.cpp +++ b/ddio/lnxkey_sdl.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -64,12 +64,11 @@ * $NoKeywords: $ */ -#include +#include #include "ddio.h" #include "pserror.h" - extern volatile struct tLnxKeys { union { int up_ticks; @@ -89,7 +88,7 @@ int sdlkey_to_ddiocode[27] = {0, KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, KEY_F, K static inline uint8_t sdlkeycode_to_keycode(uint32_t sdlkeycode) { // unceremoniously taken from Heretic source code with a few modifications. // (by Outrage. Not Loki. We know better. :) --ryan.) - int rc = sdlkeycode; + uint32_t rc = sdlkeycode; switch (rc) { case SDLK_DELETE: @@ -293,10 +292,10 @@ static inline uint8_t sdlkeycode_to_keycode(uint32_t sdlkeycode) { case SDLK_BACKSLASH: rc = KEY_BACKSLASH; break; - case SDLK_BACKQUOTE: + case SDLK_GRAVE: rc = KEY_LAPOSTRO; break; - case SDLK_QUOTE: + case SDLK_APOSTROPHE: rc = KEY_RAPOSTRO; break; case SDLK_SEMICOLON: @@ -326,8 +325,8 @@ static inline uint8_t sdlkeycode_to_keycode(uint32_t sdlkeycode) { // convert 'a' - 'z' to 0-27, and then convert to ddio format. default: - if (rc >= SDLK_a && rc <= SDLK_z) { - rc = (rc - SDLK_a) + 1; + if (rc >= SDLK_A && rc <= SDLK_Z) { + rc = (rc - SDLK_A) + 1; } else { rc = 0; } @@ -339,57 +338,56 @@ static inline uint8_t sdlkeycode_to_keycode(uint32_t sdlkeycode) { return (uint8_t)rc; } -int sdlKeyFilter(const SDL_Event *event) { +bool sdlKeyFilter(const SDL_Event *event) { uint8_t kc = 0; - if ((event->type != SDL_KEYUP) && (event->type != SDL_KEYDOWN)) - return (1); + if ((event->type != SDL_EVENT_KEY_UP) && (event->type != SDL_EVENT_KEY_DOWN)) + return true; - switch (event->key.state) { - case SDL_PRESSED: - if (event->key.repeat) break; // ignore these, we only want to know if it's a first time pressed, not a key-repeat. - kc = sdlkeycode_to_keycode(event->key.keysym.sym); - if (event->key.keysym.mod & KMOD_CTRL) { + if (event->key.down) { + if (event->key.repeat) { + return false; // ignore these, we only want to know if it's a first time pressed, not a key-repeat. + } + kc = sdlkeycode_to_keycode(event->key.key); + if (event->key.mod & SDL_KMOD_CTRL) { + extern SDL_Window *GSDLWindow; switch (kc) { case KEY_G: // toggle grabbed input. bool grab = !ddio_MouseGetGrab(); ddio_MouseSetGrab(grab); - SDL_SetRelativeMouseMode((SDL_bool)grab); - return 0; + SDL_SetWindowRelativeMouseMode(GSDLWindow, grab); + return false; } // switch } // if - else if (event->key.keysym.mod & KMOD_ALT) { + else if (event->key.mod & SDL_KMOD_ALT) { if ((kc == KEY_ENTER) || (kc == KEY_PADENTER)) { extern SDL_Window *GSDLWindow; Uint32 flags = SDL_GetWindowFlags(GSDLWindow); - // (In SDL2, SDL_WINDOW_FULLSCREEN_DESKTOP is SDL_WINDOW_FULLSCREEN plus an extra bit set, so just check for _any_ fullscreen in this bitwise AND.) if (flags & SDL_WINDOW_FULLSCREEN) { - flags &= ~SDL_WINDOW_FULLSCREEN_DESKTOP; + flags &= ~SDL_WINDOW_FULLSCREEN; } else { - flags |= SDL_WINDOW_FULLSCREEN_DESKTOP; + flags |= SDL_WINDOW_FULLSCREEN; } SDL_SetWindowFullscreen(GSDLWindow, flags); - return(0); + return false; } // if } // else if LKeys[kc].down_time = timer_GetTime(); LKeys[kc].status = true; ddio_UpdateKeyState(kc, true); - break; - case SDL_RELEASED: - kc = sdlkeycode_to_keycode(event->key.keysym.sym); + } else { + kc = sdlkeycode_to_keycode(event->key.key); if (LKeys[kc].status) { LKeys[kc].up_time = timer_GetTime(); LKeys[kc].status = false; ddio_UpdateKeyState(kc, false); } // if - break; - } // switch + } - return (0); + return false; } // sdlKeyFilter bool ddio_sdl_InternalKeyInit(ddio_init_info *init_info) { diff --git a/ddio/lnxmouse.cpp b/ddio/lnxmouse.cpp index f2fc6806d..12f41152e 100644 --- a/ddio/lnxmouse.cpp +++ b/ddio/lnxmouse.cpp @@ -82,7 +82,7 @@ // ---------------------------------------------------------------------------- #include -#include +#include #include "pserror.h" #include "psclass.h" @@ -189,8 +189,8 @@ void ddio_MouseMode(int mode) { Mouse_mode = mode; } // virtual coordinate system for mouse (match to video resolution set for optimal mouse usage. void ddio_MouseSetVCoords(int width, int height) { ddio_MouseSetLimits(0, 0, width, height); } -int sdlMouseButtonDownFilter(SDL_Event const *event) { - ASSERT(event->type == SDL_MOUSEBUTTONDOWN); +bool sdlMouseButtonDownFilter(SDL_Event const *event) { + ASSERT(event->type == SDL_EVENT_MOUSE_BUTTON_DOWN); const SDL_MouseButtonEvent *ev = &event->button; t_mse_event mevt; @@ -258,11 +258,11 @@ int sdlMouseButtonDownFilter(SDL_Event const *event) { // mprintf(0, "MOUSE Button 7: Down\n"); } - return (0); + return false; } -int sdlMouseButtonUpFilter(SDL_Event const *event) { - ASSERT(event->type == SDL_MOUSEBUTTONUP); +bool sdlMouseButtonUpFilter(SDL_Event const *event) { + ASSERT(event->type == SDL_EVENT_MOUSE_BUTTON_UP); const SDL_MouseButtonEvent *ev = &event->button; t_mse_event mevt; @@ -332,11 +332,11 @@ int sdlMouseButtonUpFilter(SDL_Event const *event) { // mprintf(0, "MOUSE Button 7: Up\n"); } - return (0); + return false; } -int sdlMouseWheelFilter(SDL_Event const *event) { - ASSERT(event->type == SDL_MOUSEWHEEL); +bool sdlMouseWheelFilter(SDL_Event const *event) { + ASSERT(event->type == SDL_EVENT_MOUSE_WHEEL); const SDL_MouseWheelEvent *ev = &event->wheel; t_mse_event mevt; @@ -383,11 +383,11 @@ int sdlMouseWheelFilter(SDL_Event const *event) { // mprintf(0, "MOUSE Scrollwheel: Rolled Down\n"); } - return 0; + return false; } -int sdlMouseMotionFilter(SDL_Event const *event) { - if (event->type == SDL_JOYBALLMOTION) { +bool sdlMouseMotionFilter(SDL_Event const *event) { + if (event->type == SDL_EVENT_JOYSTICK_BALL_MOTION) { DDIO_mouse_state.dx = event->jball.xrel / 100; DDIO_mouse_state.dy = event->jball.yrel / 100; DDIO_mouse_state.x += DDIO_mouse_state.dx; @@ -417,7 +417,7 @@ int sdlMouseMotionFilter(SDL_Event const *event) { if (DDIO_mouse_state.y >= DDIO_mouse_state.b) DDIO_mouse_state.y = DDIO_mouse_state.b - 1; - return (0); + return false; } // This function will handle all mouse events. diff --git a/ddio/sdlcontroller.cpp b/ddio/sdlcontroller.cpp index 50027325d..6c5c3728d 100644 --- a/ddio/sdlcontroller.cpp +++ b/ddio/sdlcontroller.cpp @@ -530,7 +530,7 @@ bool sdlgameController::get_packet(int id, ct_packet *packet, ct_format alt_form val = get_axis_value(controller, value, alt_format, (m_ElementList[id].flags[i] & CTFNF_INVERT) ? true : false); if (m_ElementList[id].flags[i] & CTFNF_INVERT) { if (alt_format == ctDigital) { - val = (std::abs(val) < FLT_EPSILON) ? 1.0f : 0.0f; + val = (std::abs(val) < SDL_FLT_EPSILON) ? 1.0f : 0.0f; } else if (alt_format == ctAnalog) { val = -val; } @@ -557,12 +557,12 @@ bool sdlgameController::get_packet(int id, ct_packet *packet, ct_format alt_form val = 0.0f; } - if (std::abs(val) > FLT_EPSILON) + if (std::abs(val) > SDL_FLT_EPSILON) break; } skip_packet_read: - if (std::abs(val) > FLT_EPSILON) + if (std::abs(val) > SDL_FLT_EPSILON) packet->flags |= CTPK_ELEMENTACTIVE; packet->value = val; @@ -811,7 +811,7 @@ void sdlgameController::extctl_getpos(int id) { // handle buttons for (int i = 0; i < CT_MAX_BUTTONS; i++) { // case if we read time before doing this again. - if ((ji.buttons & (1 << i)) && (std::abs(m_ExtCtlStates[id].btnstarts[i]) < FLT_EPSILON)) + if ((ji.buttons & (1 << i)) && (std::abs(m_ExtCtlStates[id].btnstarts[i]) < SDL_FLT_EPSILON)) m_ExtCtlStates[id].btnstarts[i] = timer_val; if ((ji.buttons & (1 << i)) && !(m_ExtCtlStates[id].buttons & (1 << i))) { m_ExtCtlStates[id].btnpresses[i]++; @@ -836,7 +836,7 @@ void sdlgameController::mouse_geteval() { return; } - if (std::abs(g_accum_frame_time) > FLT_EPSILON) + if (std::abs(g_accum_frame_time) > SDL_FLT_EPSILON) return; btnmask = (unsigned)ddio_MouseGetState(&x, &y, &dx, &dy); @@ -1221,7 +1221,7 @@ float sdlgameController::get_axis_value(int8_t controller, uint8_t axis, ct_form return val; axis++; - if ((axis == CT_X_AXIS) && (ctldev->id == CTID_MOUSE) && (std::abs(val) > FLT_EPSILON)) { + if ((axis == CT_X_AXIS) && (ctldev->id == CTID_MOUSE) && (std::abs(val) > SDL_FLT_EPSILON)) { matrix orient; if (!(Players[Player_num].controller_bitflags & PCBF_HEADINGLEFT)) { @@ -1244,7 +1244,7 @@ float sdlgameController::get_axis_value(int8_t controller, uint8_t axis, ct_form ObjSetOrient(&Objects[Players[Player_num].objnum], &Objects[Players[Player_num].objnum].orient); return 0; } - if ((axis == CT_Y_AXIS) && (ctldev->id == CTID_MOUSE) && (std::abs(val) > FLT_EPSILON)) { + if ((axis == CT_Y_AXIS) && (ctldev->id == CTID_MOUSE) && (std::abs(val) > SDL_FLT_EPSILON)) { matrix orient; if (!(Players[Player_num].controller_bitflags & PCBF_PITCHUP)) { diff --git a/ddio/sdljoy.cpp b/ddio/sdljoy.cpp index 054d61435..5c0d79ea2 100644 --- a/ddio/sdljoy.cpp +++ b/ddio/sdljoy.cpp @@ -68,7 +68,7 @@ #include #include -#include +#include // rcg06182000 need this for specific joystick stuff. #include "args.h" @@ -100,7 +100,7 @@ static bool joy_InitStick(tJoystick joy, char *server_adr); bool joy_Init() { // reinitialize joystick if already initialized. joy_Close(); - if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) < 0) { + if (!SDL_InitSubSystem(SDL_INIT_JOYSTICK)) { LOG_ERROR << "Could not initialize Joystick"; return false; } @@ -141,15 +141,15 @@ static bool joy_InitStick(tJoystick joy, char *server_adr) { if (server_adr) { return false; } - SDL_Joystick *stick = SDL_JoystickOpen(joy); + SDL_Joystick *stick = SDL_OpenJoystick(joy); Joysticks[joy].handle = stick; if (stick) { tJoyInfo caps; memset(&caps, 0, (sizeof(caps))); - strncpy(caps.name, SDL_JoystickNameForIndex(joy), sizeof(caps.name) - 1); - caps.num_btns = SDL_JoystickNumButtons(stick); - int axes = SDL_JoystickNumAxes(stick); + strncpy(caps.name, SDL_GetJoystickNameForID(joy), sizeof(caps.name) - 1); + caps.num_btns = SDL_GetNumJoystickButtons(stick); + int axes = SDL_GetNumJoystickAxes(stick); switch (axes) { default: // Fall through to 6 axes @@ -180,7 +180,7 @@ static bool joy_InitStick(tJoystick joy, char *server_adr) { case 0: break; } - int hats = SDL_JoystickNumHats(stick); + int hats = SDL_GetNumJoystickHats(stick); switch (hats) { default: // Fall through to 4 hats @@ -206,7 +206,7 @@ static bool joy_InitStick(tJoystick joy, char *server_adr) { // closes connection with controller. static void joy_CloseStick(tJoystick joy) { - SDL_JoystickClose(Joysticks[joy].handle); + SDL_CloseJoystick(Joysticks[joy].handle); Joysticks[joy].handle = nullptr; } @@ -285,30 +285,30 @@ void joy_GetPos(tJoystick joy, tJoyPos *pos) { mask = Joysticks[joy].caps.axes_mask; if (mask & JOYFLAG_XVALID) { - pos->x = SDL_JoystickGetAxis(stick, 0); + pos->x = SDL_GetJoystickAxis(stick, 0); } if (mask & JOYFLAG_YVALID) { - pos->y = SDL_JoystickGetAxis(stick, 1); + pos->y = SDL_GetJoystickAxis(stick, 1); } if (mask & JOYFLAG_ZVALID) { - pos->z = SDL_JoystickGetAxis(stick, 2); + pos->z = SDL_GetJoystickAxis(stick, 2); } if (mask & JOYFLAG_RVALID) { - pos->r = SDL_JoystickGetAxis(stick, 3); + pos->r = SDL_GetJoystickAxis(stick, 3); } if (mask & JOYFLAG_UVALID) { - pos->u = SDL_JoystickGetAxis(stick, 4); + pos->u = SDL_GetJoystickAxis(stick, 4); } if (mask & JOYFLAG_VVALID) { - pos->v = SDL_JoystickGetAxis(stick, 5); + pos->v = SDL_GetJoystickAxis(stick, 5); } for (i = 0; i < JOYPOV_NUM; ++i) { if (mask & (JOYFLAG_POVVALID << i)) { - pos->pov[i] = map_hat(SDL_JoystickGetHat(stick, i)); + pos->pov[i] = map_hat(SDL_GetJoystickHat(stick, i)); } } for (i = Joysticks[joy].caps.num_btns; i >= 0; --i) { - if (SDL_JoystickGetButton(stick, i)) { + if (SDL_GetJoystickButton(stick, i)) { pos->buttons |= (1 << i); } } @@ -318,22 +318,26 @@ void joy_GetPos(tJoystick joy, tJoyPos *pos) { static int joyGetNumDevs(void) { int found = 0; + int joyCount = 0; + SDL_JoystickID *joysticks = SDL_GetJoysticks(&joyCount); + // rcg06182000 add support for specific joydev. int rc = FindArgChar("-joystick", 'j'); specificJoy = -1; if ((rc > 0) && (GameArgs[rc + 1] != NULL)) { specificJoy = atoi(GameArgs[rc + 1]); - if ((specificJoy >= 0) && (specificJoy < SDL_NumJoysticks())) { + if ((specificJoy >= 0) && (specificJoy < joyCount)) { found = 1; } else { specificJoy = -1; } } if (specificJoy < 0) { - found = SDL_NumJoysticks(); + found = joyCount; } LOG_INFO.printf("Joystick: Found %d joysticks.", found); + SDL_free(joysticks); return found; } diff --git a/editor/CMakeLists.txt b/editor/CMakeLists.txt index d85f30b3e..4a523008e 100644 --- a/editor/CMakeLists.txt +++ b/editor/CMakeLists.txt @@ -564,7 +564,7 @@ set(SOURCE set(CMAKE_MFC_FLAG 1) # Editor only works in Windows, because of MFC and DirectX dependencies -set(PLATFORM_LIBS linux wsock32.lib winmm.lib dd_grwin32 win32 SDL2::SDL2) +set(PLATFORM_LIBS linux wsock32.lib winmm.lib dd_grwin32 win32 SDL3::SDL3) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO /NODEFAULTLIB:LIBC") @@ -574,6 +574,7 @@ target_include_directories(Descent3Editor PRIVATE ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/manage ${PROJECT_BINARY_DIR}/lib + {SDL3_INCLUDE_DIRS} ) target_compile_definitions(Descent3Editor PUBLIC _AFXDLL EDITOR) diff --git a/lib/lnxscreenmode.h b/lib/lnxscreenmode.h index ce916350d..96e950008 100644 --- a/lib/lnxscreenmode.h +++ b/lib/lnxscreenmode.h @@ -52,7 +52,7 @@ #ifndef __LNXVIDEOMODE_H__ #define __LNXVIDEOMODE_H__ -#include +#include #define MODE_OK 0 #define MODE_HSYNC 1 /* hsync out of range */ diff --git a/lib/networking.h b/lib/networking.h index 67321a9d5..e94885338 100644 --- a/lib/networking.h +++ b/lib/networking.h @@ -209,8 +209,8 @@ static inline void INADDR_GET_SUN_SUNB(struct in_addr *st, uint8_t *s_b1, uint8_ #include // rcg06212000 my SDL adds. -#include "SDL.h" -#include "SDL_thread.h" +#include +#include #define SOCKET int #define BOOL bool diff --git a/lib/pstypes.h b/lib/pstypes.h index 33a16aa1a..978dad26e 100644 --- a/lib/pstypes.h +++ b/lib/pstypes.h @@ -26,7 +26,7 @@ // terminating NULL, so a buffer to hold a filename needs to be PSFILENAME_LEN+1 bytes long. #define PSFILENAME_LEN 35 -#if !defined(__APPLE__) +#if !defined(SDL_PLATFORM_APPLE) #define HOST_BIGENDIAN @HOST_BIGENDIAN @ #else #if defined(__BIG_ENDIAN__) diff --git a/libmve/CMakeLists.txt b/libmve/CMakeLists.txt index 6d5b10e12..2458a3842 100644 --- a/libmve/CMakeLists.txt +++ b/libmve/CMakeLists.txt @@ -16,10 +16,11 @@ set(CPPS add_library(libmve STATIC ${HEADERS} ${CPPS}) target_link_libraries(libmve PRIVATE ddio - SDL2::SDL2 + SDL3::SDL3 ) target_include_directories(libmve PUBLIC $ + ${SDL3_INCLUDE_DIRS} ) diff --git a/libmve/movie_sound.cpp b/libmve/movie_sound.cpp index 875c3ec04..64406feb3 100644 --- a/libmve/movie_sound.cpp +++ b/libmve/movie_sound.cpp @@ -23,31 +23,28 @@ namespace D3 { MovieSoundDevice::MovieSoundDevice(int sample_rate, uint16_t sample_size, uint8_t channels, bool is_compressed) { SDL_AudioSpec spec{}; spec.freq = sample_rate; - spec.format = (sample_size == 2) ? AUDIO_S16LSB : AUDIO_U8; + spec.format = (sample_size == 2) ? SDL_AUDIO_S16LE : SDL_AUDIO_U8; spec.channels = channels; - m_device_id = SDL_OpenAudioDevice(nullptr, 0, &spec, nullptr, 0); - m_is_compressed = is_compressed; - m_sample_size = sample_size; + this->stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &spec, nullptr, nullptr); + this->m_is_compressed = is_compressed; + this->m_sample_size = sample_size; }; MovieSoundDevice::~MovieSoundDevice() { - if (m_device_id > 0) { - SDL_CloseAudioDevice(m_device_id); - m_device_id = 0; + if (this->stream != nullptr) { + SDL_CloseAudioDevice(SDL_GetAudioStreamDevice(this->stream)); } } -void MovieSoundDevice::FillBuffer(char *stream, int len) const { - SDL_QueueAudio(m_device_id, stream, len); -}; +void MovieSoundDevice::FillBuffer(char *buffer, int len) const { SDL_PutAudioStreamData(this->stream, buffer, len); }; -void MovieSoundDevice::Play() { SDL_PauseAudioDevice(m_device_id, 0); } +void MovieSoundDevice::Play() { SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(this->stream)); } -void MovieSoundDevice::Stop() { SDL_PauseAudioDevice(m_device_id, 1); } +void MovieSoundDevice::Stop() { SDL_PauseAudioDevice(SDL_GetAudioStreamDevice(this->stream)); } -void MovieSoundDevice::Lock() { SDL_LockAudioDevice(m_device_id); } +void MovieSoundDevice::Lock() {} -void MovieSoundDevice::Unlock() { SDL_UnlockAudioDevice(m_device_id); } +void MovieSoundDevice::Unlock() {} } // namespace D3 diff --git a/libmve/movie_sound.h b/libmve/movie_sound.h index fcaf8aafc..03d8f185b 100644 --- a/libmve/movie_sound.h +++ b/libmve/movie_sound.h @@ -19,7 +19,7 @@ #ifndef LIBMVE_MOVIE_SOUND_H_ #define LIBMVE_MOVIE_SOUND_H_ -#include +#include #include "sound_interface.h" @@ -28,7 +28,7 @@ namespace D3 { /// Implementation class for sound device used on movie playback. class MovieSoundDevice : ISoundDevice { private: - SDL_AudioDeviceID m_device_id = 0; + SDL_AudioStream* stream = nullptr; uint16_t m_sample_size = 0; public: @@ -46,7 +46,7 @@ class MovieSoundDevice : ISoundDevice { * Check if sound device is properly initialized * @return true on success */ - [[nodiscard]] bool IsInitialized() const { return m_device_id > 0; } + [[nodiscard]] bool IsInitialized() const { return this->stream != nullptr; } /** * Fill internal audio stream to be played diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index f4db42537..105fb9521 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -19,9 +19,10 @@ target_include_directories(linux PUBLIC $ + ${SDL3_INCLUDE_DIRS} ) target_link_libraries(linux PRIVATE ddebug ddio - SDL2::SDL2 + SDL3::SDL3 ) diff --git a/linux/lnxdata.cpp b/linux/lnxdata.cpp index ea79dd869..204126c14 100644 --- a/linux/lnxdata.cpp +++ b/linux/lnxdata.cpp @@ -44,7 +44,7 @@ #include #include -#include +#include #if defined(POSIX) #include diff --git a/netcon/descent3onlineclient/CMakeLists.txt b/netcon/descent3onlineclient/CMakeLists.txt index adf8bd7fb..d6262a7dd 100644 --- a/netcon/descent3onlineclient/CMakeLists.txt +++ b/netcon/descent3onlineclient/CMakeLists.txt @@ -22,7 +22,9 @@ target_link_libraries(Descent3_Online_TCP_IP PRIVATE module ui $<$:ws2_32> + SDL3::SDL3 ) +target_include_directories(Descent3_Online_TCP_IP PRIVATE ${SDL3_INCLUDE_DIRS}) if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") set_target_properties(Descent3_Online_TCP_IP PROPERTIES SUFFIX ".dylib") endif() diff --git a/netcon/inetfile/CMakeLists.txt b/netcon/inetfile/CMakeLists.txt index caf2a71b2..e37f778b6 100644 --- a/netcon/inetfile/CMakeLists.txt +++ b/netcon/inetfile/CMakeLists.txt @@ -12,9 +12,13 @@ target_link_libraries(inetfile PRIVATE ) target_link_libraries(inetfile PUBLIC httplib::httplib # For some reason, linking it privately causes issues at runtime + SDL3::SDL3 ) target_include_directories(inetfile PUBLIC $ + mem ) +target_include_directories(inetfile PRIVATE ${SDL3_INCLUDE_DIRS}) + diff --git a/netcon/lanclient/CMakeLists.txt b/netcon/lanclient/CMakeLists.txt index 1ef045abc..82ca3da64 100644 --- a/netcon/lanclient/CMakeLists.txt +++ b/netcon/lanclient/CMakeLists.txt @@ -14,7 +14,9 @@ target_link_libraries(Direct_TCP_IP PRIVATE module ui $<$:ws2_32> + SDL3::SDL3 ) +target_include_directories(Direct_TCP_IP PRIVATE ${SDL3_INCLUDE_DIRS}) if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") set_target_properties(Direct_TCP_IP PROPERTIES SUFFIX ".dylib") endif() diff --git a/netcon/mtclient/CMakeLists.txt b/netcon/mtclient/CMakeLists.txt index 98e64e320..a1480164e 100644 --- a/netcon/mtclient/CMakeLists.txt +++ b/netcon/mtclient/CMakeLists.txt @@ -24,7 +24,9 @@ target_link_libraries(Parallax_Online PRIVATE module ui $<$:ws2_32> + SDL3::SDL3 ) +target_include_directories(Parallax_Online PRIVATE ${SDL3_INCLUDE_DIRS}) if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") set_target_properties(Parallax_Online PROPERTIES SUFFIX ".dylib") endif() diff --git a/netgames/dmfc/CMakeLists.txt b/netgames/dmfc/CMakeLists.txt index f0d5a0279..1ca6f3ecd 100644 --- a/netgames/dmfc/CMakeLists.txt +++ b/netgames/dmfc/CMakeLists.txt @@ -28,10 +28,11 @@ add_definitions(-DOUTRAGE_VERSION) add_library(dmfc STATIC ${HEADERS} ${CPPS}) target_link_libraries(dmfc PUBLIC - SDL2::SDL2 + SDL3::SDL3 grtext misc module physics ddio ) +target_include_directories(dmfc PRIVATE ${SDL3_INCLUDE_DIRS}) \ No newline at end of file diff --git a/netgames/includes/DMFC.h b/netgames/includes/DMFC.h index be10f7305..38a5f81f4 100644 --- a/netgames/includes/DMFC.h +++ b/netgames/includes/DMFC.h @@ -56,7 +56,7 @@ * all mangles symbol names fixed. Finished making interface functions. * * 120 6/12/99 10:59p Jeff - * fixed messed up #ifdef for __LINUX__ + * fixed messed up #ifdef for SDL_PLATFORM_LINUX * * 119 6/10/99 6:31p Jeff * fixed mprintf define @@ -291,7 +291,7 @@ #include #include #include -#include +#include #include "gamedll_header.h" #include "DMFCKeyCodes.h" diff --git a/networking/networking.cpp b/networking/networking.cpp index 95d8d40b4..5343b9174 100644 --- a/networking/networking.cpp +++ b/networking/networking.cpp @@ -2053,8 +2053,8 @@ static async_dns_lookup *lastaslu = NULL; #if defined(POSIX) int CDECLCALL gethostbynameworker(void *parm); -#include "SDL.h" -#include "SDL_thread.h" +#include +#include // rcg06192000 use SDL threads. // #include diff --git a/overlays/dbus/cmake.dep.patch b/overlays/dbus/cmake.dep.patch new file mode 100644 index 000000000..ac827f0c2 --- /dev/null +++ b/overlays/dbus/cmake.dep.patch @@ -0,0 +1,15 @@ +diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt +index 8cde1ffe0..d4d09f223 100644 +--- a/tools/CMakeLists.txt ++++ b/tools/CMakeLists.txt +@@ -91,7 +91,9 @@ endif() + add_executable(dbus-launch ${dbus_launch_SOURCES}) + target_link_libraries(dbus-launch ${DBUS_LIBRARIES}) + if(DBUS_BUILD_X11) +- target_link_libraries(dbus-launch ${X11_LIBRARIES} ) ++ find_package(Threads REQUIRED) ++ target_link_libraries(dbus-launch ${X11_LIBRARIES} ${X11_xcb_LIB} ${X11_Xau_LIB} ${X11_Xdmcp_LIB} Threads::Threads) ++ target_include_directories(dbus-launch PRIVATE ${X11_INCLUDE_DIR}) + endif() + install(TARGETS dbus-launch ${INSTALL_TARGETS_DEFAULT_ARGS}) + diff --git a/overlays/dbus/getpeereid.patch b/overlays/dbus/getpeereid.patch new file mode 100644 index 000000000..5cd2309e3 --- /dev/null +++ b/overlays/dbus/getpeereid.patch @@ -0,0 +1,26 @@ +diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake +index b7f3702..e2336ba 100644 +--- a/cmake/ConfigureChecks.cmake ++++ b/cmake/ConfigureChecks.cmake +@@ -51,6 +51,7 @@ check_symbol_exists(closefrom "unistd.h" HAVE_CLOSEFROM) # + check_symbol_exists(environ "unistd.h" HAVE_DECL_ENVIRON) + check_symbol_exists(fstatfs "sys/vfs.h" HAVE_FSTATFS) + check_symbol_exists(getgrouplist "grp.h" HAVE_GETGROUPLIST) # dbus-sysdeps.c ++check_symbol_exists(getpeereid "sys/types.h;unistd.h" HAVE_GETPEEREID) # dbus-sysdeps.c, + check_symbol_exists(getpeerucred "ucred.h" HAVE_GETPEERUCRED) # dbus-sysdeps.c, dbus-sysdeps-win.c + check_symbol_exists(getpwnam_r "errno.h;pwd.h" HAVE_GETPWNAM_R) # dbus-sysdeps-util-unix.c + check_symbol_exists(getrandom "sys/random.h" HAVE_GETRANDOM) +diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake +index 77fc19c..2f25643 100644 +--- a/cmake/config.h.cmake ++++ b/cmake/config.h.cmake +@@ -140,6 +140,9 @@ + /* Define to 1 if you have getgrouplist */ + #cmakedefine HAVE_GETGROUPLIST 1 + ++/* Define to 1 if you have getpeereid */ ++#cmakedefine HAVE_GETPEEREID 1 ++ + /* Define to 1 if you have getpeerucred */ + #cmakedefine HAVE_GETPEERUCRED 1 + diff --git a/overlays/dbus/libsystemd.patch b/overlays/dbus/libsystemd.patch new file mode 100644 index 000000000..74193dc40 --- /dev/null +++ b/overlays/dbus/libsystemd.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d3ec71b..932066a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -141,6 +141,10 @@ if(DBUS_LINUX) + if(ENABLE_SYSTEMD AND SYSTEMD_FOUND) + set(DBUS_BUS_ENABLE_SYSTEMD ON) + set(HAVE_SYSTEMD ${SYSTEMD_FOUND}) ++ pkg_check_modules(SYSTEMD libsystemd IMPORTED_TARGET) ++ set(SYSTEMD_LIBRARIES PkgConfig::SYSTEMD CACHE INTERNAL "") ++ else() ++ set(SYSTEMD_LIBRARIES "" CACHE INTERNAL "") + endif() + option(ENABLE_USER_SESSION "enable user-session semantics for session bus under systemd" OFF) + set(DBUS_ENABLE_USER_SESSION ${ENABLE_USER_SESSION}) diff --git a/overlays/dbus/pkgconfig.patch b/overlays/dbus/pkgconfig.patch new file mode 100644 index 000000000..635814870 --- /dev/null +++ b/overlays/dbus/pkgconfig.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index caef738..b878f42 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -724,11 +724,11 @@ add_custom_target(help-options + # + if(DBUS_ENABLE_PKGCONFIG) + set(PLATFORM_LIBS pthread ${LIBRT}) +- if(PKG_CONFIG_FOUND) +- # convert lists of link libraries into -lstdc++ -lm etc.. +- foreach(LIB ${CMAKE_C_IMPLICIT_LINK_LIBRARIES} ${PLATFORM_LIBS}) +- set(LIBDBUS_LIBS "${LIBDBUS_LIBS} -l${LIB}") +- endforeach() ++ if(1) ++ set(LIBDBUS_LIBS "${CMAKE_THREAD_LIBS_INIT}") ++ if(LIBRT) ++ string(APPEND LIBDBUS_LIBS " -lrt") ++ endif() + set(original_prefix "${CMAKE_INSTALL_PREFIX}") + if(DBUS_RELOCATABLE) + set(pkgconfig_prefix "\${pcfiledir}/../..") diff --git a/overlays/dbus/portfile.cmake b/overlays/dbus/portfile.cmake new file mode 100644 index 000000000..1ae2fd677 --- /dev/null +++ b/overlays/dbus/portfile.cmake @@ -0,0 +1,92 @@ +vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) + +vcpkg_from_gitlab( + GITLAB_URL https://gitlab.freedesktop.org/ + OUT_SOURCE_PATH SOURCE_PATH + REPO dbus/dbus + REF "dbus-${VERSION}" + SHA512 8e476b408514e6540c36beb84e8025827c22cda8958b6eb74d22b99c64765eb3cd5a6502aea546e3e5f0534039857b37edee89c659acef40e7cab0939947d4af + HEAD_REF master + PATCHES + cmake.dep.patch + pkgconfig.patch + getpeereid.patch # missing check from configure.ac + libsystemd.patch +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS options + FEATURES + systemd ENABLE_SYSTEMD + x11 DBUS_BUILD_X11 + x11 CMAKE_REQUIRE_FIND_PACKAGE_X11 +) + +unset(ENV{DBUSDIR}) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DDBUS_BUILD_TESTS=OFF + -DDBUS_ENABLE_DOXYGEN_DOCS=OFF + -DDBUS_ENABLE_XML_DOCS=OFF + -DDBUS_INSTALL_SYSTEM_LIBS=OFF + #-DDBUS_SERVICE=ON + -DDBUS_WITH_GLIB=OFF + -DTHREADS_PREFER_PTHREAD_FLAG=ON + -DXSLTPROC_EXECUTABLE=FALSE + "-DCMAKE_INSTALL_SYSCONFDIR=${CURRENT_PACKAGES_DIR}/etc/${PORT}" + "-DWITH_SYSTEMD_SYSTEMUNITDIR=lib/systemd/system" + "-DWITH_SYSTEMD_USERUNITDIR=lib/systemd/user" + "-DDBUS_SESSION_SOCKET_DIR=/tmp" # cf vcpkg #40031 / #40038 + ${options} + OPTIONS_RELEASE + -DDBUS_DISABLE_ASSERT=OFF + -DDBUS_ENABLE_STATS=OFF + -DDBUS_ENABLE_VERBOSE_MODE=OFF + MAYBE_UNUSED_VARIABLES + DBUS_BUILD_X11 + DBUS_WITH_GLIB + ENABLE_SYSTEMD + THREADS_PREFER_PTHREAD_FLAG + WITH_SYSTEMD_SYSTEMUNITDIR + WITH_SYSTEMD_USERUNITDIR +) +vcpkg_cmake_install() +vcpkg_copy_pdbs() +vcpkg_cmake_config_fixup(PACKAGE_NAME "DBus1" CONFIG_PATH "lib/cmake/DBus1") +vcpkg_fixup_pkgconfig() + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/share" + "${CURRENT_PACKAGES_DIR}/debug/var/" + "${CURRENT_PACKAGES_DIR}/etc" + "${CURRENT_PACKAGES_DIR}/share/dbus-1/services" + "${CURRENT_PACKAGES_DIR}/share/dbus-1/session.d" + "${CURRENT_PACKAGES_DIR}/share/dbus-1/system-services" + "${CURRENT_PACKAGES_DIR}/share/dbus-1/system.d" + "${CURRENT_PACKAGES_DIR}/share/dbus-1/system.conf" + "${CURRENT_PACKAGES_DIR}/share/dbus-1/system.conf" + "${CURRENT_PACKAGES_DIR}/share/doc" + "${CURRENT_PACKAGES_DIR}/var" +) + +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/dbus-1/session.conf" "${CURRENT_PACKAGES_DIR}/etc/dbus/dbus-1/session.conf" "") +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/dbus-1/session.conf" "${CURRENT_PACKAGES_DIR}/etc/dbus/dbus-1/session.d" "") +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/dbus-1/session.conf" "${CURRENT_PACKAGES_DIR}/etc/dbus/dbus-1/session-local.conf" "") + +set(TOOLS daemon launch monitor run-session send test-tool update-activation-environment) +if(VCPKG_TARGET_IS_WINDOWS) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}") + file(RENAME "${CURRENT_PACKAGES_DIR}/bin/dbus-env.bat" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/dbus-env.bat") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/dbus-env.bat" "${CURRENT_PACKAGES_DIR}" "%~dp0/../..") +else() + list(APPEND TOOLS cleanup-sockets uuidgen) +endif() +list(TRANSFORM TOOLS PREPEND "dbus-" ) +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + vcpkg_copy_tools(TOOL_NAMES ${TOOLS} SEARCH_DIR ${CURRENT_PACKAGES_DIR}/debug/bin DESTINATION "${CURRENT_PACKAGES_DIR}/debug/tools/${PORT}") +endif() +vcpkg_copy_tools(TOOL_NAMES ${TOOLS} AUTO_CLEAN) + +file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/overlays/dbus/vcpkg.json b/overlays/dbus/vcpkg.json new file mode 100644 index 000000000..53e68a390 --- /dev/null +++ b/overlays/dbus/vcpkg.json @@ -0,0 +1,44 @@ +{ + "name": "dbus", + "version": "1.15.8", + "port-version": 5, + "description": "D-Bus specification and reference implementation, including libdbus and dbus-daemon", + "homepage": "https://gitlab.freedesktop.org/dbus/dbus", + "license": "AFL-2.1 OR GPL-2.0-or-later", + "supports": "!uwp & !staticcrt & !android & !ios", + "dependencies": [ + "expat", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "default-features": [ + { + "name": "systemd", + "platform": "linux" + } + ], + "features": { + "systemd": { + "description": "Build with systemd at_console support", + "supports": "linux", + "dependencies": [ + { + "name": "libsystemd", + "platform": "linux" + } + ] + }, + "x11": { + "description": "Build with X11 autolaunch support", + "dependencies": [ + "libx11" + ] + } + } +} diff --git a/renderer/CMakeLists.txt b/renderer/CMakeLists.txt index 51faa986a..9d58c029c 100644 --- a/renderer/CMakeLists.txt +++ b/renderer/CMakeLists.txt @@ -31,10 +31,10 @@ set(CPPS ) add_library(renderer STATIC ${HEADERS} ${CPPS}) -target_include_directories(renderer PRIVATE ${GENERATED_HEADERS}) +target_include_directories(renderer PRIVATE ${GENERATED_HEADERS} ${SDL3_INCLUDE_DIRS}) target_link_libraries(renderer PRIVATE glm::glm - SDL2::SDL2 + SDL3::SDL3 bitmap ddebug ddio diff --git a/renderer/HardwareOpenGL.cpp b/renderer/HardwareOpenGL.cpp index 40f48f027..1ef1893dc 100644 --- a/renderer/HardwareOpenGL.cpp +++ b/renderer/HardwareOpenGL.cpp @@ -22,7 +22,10 @@ #include #include #include -#include + +// TODO: Use SDL_FunctionPointer properly instead +#define SDL_FUNCTION_POINTER_IS_VOID_POINTER +#include #if defined(WIN32) #include @@ -46,7 +49,7 @@ #include "config.h" #include "rtperformance.h" #include "HardwareInternal.h" -#include "../Descent3/args.h" +#include "args.h" #include "NewBitmap.h" #include "shaders.h" #include "ShaderProgram.h" @@ -135,6 +138,10 @@ struct Renderer { shader_.setUniform1f("u_fog_end", farz); } + void setGammaCorrection(float gamma) { + shader_.setUniform1f("u_gamma", gamma); + } + void setFogColor(ddgr_color color) { shader_.setUniform4fv("u_fog_color", GR_COLOR_RED(color) / 255.0f, GR_COLOR_GREEN(color) / 255.0f, GR_COLOR_BLUE(color) / 255.0f, 1); @@ -362,13 +369,7 @@ int opengl_Setup(oeApplication *app, const int *width, const int *height) { } } - bool fullscreen = true; - - if (FindArgChar("-fullscreen", 'f')) { - fullscreen = true; - } else if (FindArgChar("-windowed", 'w')) { - fullscreen = false; - } + bool fullscreen = FindArgChar("-windowed", 'w') == 0; if (!Already_loaded) { char gl_library[256]; @@ -417,35 +418,59 @@ int opengl_Setup(oeApplication *app, const int *width, const int *height) { SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2); SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); - Uint32 flags = SDL_WINDOW_OPENGL; - - if (fullscreen) { - flags |= SDL_WINDOW_FULLSCREEN_DESKTOP; - } if (!GSDLWindow) { - int display = 0; - if (int display_arg = FindArg("-display"); display_arg != 0) { + int display_num = 0; + int display_arg = FindArg("-display"); + int display_count = 0; + + SDL_DisplayID* displays = SDL_GetDisplays(&display_count); + + if (display_arg != 0) { if (const char * arg_index_str = GetArg (display_arg + 1); arg_index_str == nullptr) { LOG_WARNING << "No parameter for -display given"; } else { int arg_index = atoi(arg_index_str); - int display_count = SDL_GetNumVideoDisplays(); if ((arg_index < 0) || (arg_index >= display_count)) { LOG_WARNING.printf( "Parameter for -display must be in the range 0..%i", display_count-1 ); } else { - display = arg_index; + display_num = arg_index; } } } - GSDLWindow = SDL_CreateWindow("Descent 3", SDL_WINDOWPOS_UNDEFINED_DISPLAY(display), SDL_WINDOWPOS_UNDEFINED_DISPLAY(display), winw, winh, flags); + + int display_id = displays[display_num]; + SDL_free(displays); + + //High-DPI support + { + float scale = SDL_GetDisplayContentScale(display_id); + LOG_WARNING.printf("Using content scale %f", scale); + winw = std::floor(static_cast(winw)*scale); + winh = std::floor(static_cast(winh)*scale); + } + + + SDL_PropertiesID props = SDL_CreateProperties(); + SDL_SetStringProperty(props, SDL_PROP_WINDOW_CREATE_TITLE_STRING, "Descent 3"); + SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_X_NUMBER, SDL_WINDOWPOS_UNDEFINED_DISPLAY(display_id)); + SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_Y_NUMBER, SDL_WINDOWPOS_UNDEFINED_DISPLAY(display_id)); + SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER, winw); + SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER, winh); + SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_FLAGS_NUMBER, SDL_WINDOW_OPENGL); + GSDLWindow = SDL_CreateWindowWithProperties(props); + SDL_DestroyProperties(props); if (!GSDLWindow) { LOG_ERROR.printf("OpenGL: SDL window creation failed: %s", SDL_GetError()); return 0; } + + bool grabMouse = FindArgChar("-nomousegrab", 'm') == 0; + SDL_SetWindowRelativeMouseMode(GSDLWindow, grabMouse); + + SDL_SetWindowFullscreen(GSDLWindow, fullscreen); } else { SDL_SetWindowSize(GSDLWindow, winw, winh); - SDL_SetWindowFullscreen(GSDLWindow, flags); } if (!GSDLGLContext) { @@ -462,7 +487,7 @@ int opengl_Setup(oeApplication *app, const int *width, const int *height) { LoadGLFnPtrs(); } catch (std::exception const& ex) { // TODO: more raii-esque construction and cleanup here - SDL_GL_DeleteContext(GSDLGLContext); + SDL_GL_DestroyContext(GSDLGLContext); GSDLGLContext = nullptr; SDL_DestroyWindow(GSDLWindow); GSDLWindow = nullptr; @@ -519,21 +544,13 @@ int opengl_Setup(oeApplication *app, const int *width, const int *height) { dglDeleteRenderbuffers(1, &GOpenGLRBOColor); dglDeleteRenderbuffers(1, &GOpenGLRBODepth); GOpenGLFBO = GOpenGLRBOColor = GOpenGLRBODepth = 0; - SDL_GL_DeleteContext(GSDLGLContext); + SDL_GL_DestroyContext(GSDLGLContext); SDL_DestroyWindow(GSDLWindow); GSDLGLContext = nullptr; GSDLWindow = nullptr; return 0; } - // rcg09182000 gamma fun. - // rcg01112000 --nogamma fun. - if (!FindArgChar("-nogamma", 'M')) { - Uint16 ramp[256]; - SDL_CalculateGammaRamp(Render_preferred_state.gamma, ramp); - SDL_SetWindowGammaRamp(GSDLWindow, ramp, ramp, ramp); - } - if (ParentApplication) { reinterpret_cast(ParentApplication)->set_sizepos(0, 0, *width, *height); } @@ -724,7 +741,7 @@ void opengl_Close(const bool just_resizing) { if (GSDLGLContext) { SDL_GL_MakeCurrent(nullptr, nullptr); - SDL_GL_DeleteContext(GSDLGLContext); + SDL_GL_DestroyContext(GSDLGLContext); GSDLGLContext = nullptr; GOpenGLFBOWidth = GOpenGLFBOHeight = GOpenGLFBO = GOpenGLRBOColor = GOpenGLRBODepth = 0; } @@ -1145,6 +1162,7 @@ void gpu_DrawFlatPolygon3D(g3Point **p, int nv) { // Sets the gamma correction value void rend_SetGammaValue(float val) { gpu_preferred_state.gamma = val; + gRenderer->setGammaCorrection(val); LOG_DEBUG.printf("Setting gamma to %f", val); } @@ -1457,7 +1475,7 @@ void rend_Flip() { // if we're rendering to an FBO, scale to the window framebuffer! if (GOpenGLFBO != 0) { int w, h; - SDL_GL_GetDrawableSize(GSDLWindow, &w, &h); + SDL_GetWindowSizeInPixels(GSDLWindow, &w, &h); int scaledHeight, scaledWidth; if (w < h) { diff --git a/renderer/dyna_gl.h b/renderer/dyna_gl.h index f4d3c6eac..239db9802 100644 --- a/renderer/dyna_gl.h +++ b/renderer/dyna_gl.h @@ -25,7 +25,7 @@ #include #define GL_GLEXT_PROTOTYPES -#include +#include #include "descent.h" #include "log.h" @@ -87,6 +87,7 @@ struct FnPtr { extern char loadedLibrary[_MAX_PATH]; static module OpenGLDLLInst; + static std::vector> inits_; static void LoadGLFnPtrs() { for (auto &[ptr, name, optional] : inits_) { @@ -100,7 +101,7 @@ static void LoadGLFnPtrs() { template FnPtr::FnPtr(std::string_view name, bool optional) : fn_{} { - inits_.push_back(std::make_tuple(reinterpret_cast(&fn_), name, optional)); + inits_.push_back(std::make_tuple(reinterpret_cast(&fn_), name, optional)); } static module *LoadOpenGLDLL(const char *dllname) { diff --git a/renderer/shaders/fragment.glsl b/renderer/shaders/fragment.glsl index a39be0b94..e129a6999 100644 --- a/renderer/shaders/fragment.glsl +++ b/renderer/shaders/fragment.glsl @@ -32,6 +32,7 @@ uniform bool u_fog_enable; uniform vec4 u_fog_color; uniform float u_fog_start; uniform float u_fog_end; +uniform float u_gamma; // Gamma correction float branchless_invert_or_zero(in float value) { // sign() returns 1 if val > 0, -1 if val < 0, and 0 if val == 0 @@ -55,4 +56,5 @@ void main() // fog_factor must also be 1. invert u_fog_enable (so that it is 1 when disabled) and take the max. fog_factor = max(fog_factor, float(!u_fog_enable)); out_color = out_color * fog_factor + (1 - fog_factor) * u_fog_color; -} \ No newline at end of file + out_color.rgb = pow(out_color.rgb, vec3(1.0/u_gamma)); +} diff --git a/sndlib/CMakeLists.txt b/sndlib/CMakeLists.txt index 4d79d5e5f..d74ceef14 100644 --- a/sndlib/CMakeLists.txt +++ b/sndlib/CMakeLists.txt @@ -26,10 +26,11 @@ target_link_libraries(sndlib PRIVATE mem stream_audio physics - SDL2::SDL2 + SDL3::SDL3 ) target_include_directories(sndlib PUBLIC $ + ${SDL3_INCLUDE_DIRS} ) diff --git a/sndlib/sdlsound.cpp b/sndlib/sdlsound.cpp index 4d7f1b171..3c517c017 100644 --- a/sndlib/sdlsound.cpp +++ b/sndlib/sdlsound.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include "pserror.h" #include "mem.h" @@ -46,7 +46,7 @@ static int sound_buffer_size = MAX_SOUNDS_PLAYING_AT_ONCE; lnxsound *ll_sound_ptr; // A peroidic mixer that uses the primary buffer as a stream buffer -static void StreamAudio(void *user_ptr, Uint8 *stream, int len); +void StreamAudio(void *userdata, SDL_AudioStream *stream, int additional_amount, int total_amount); lnxsound::lnxsound() : llsSystem() { ll_sound_ptr = this; @@ -93,20 +93,18 @@ int lnxsound::InitSoundLib(char mixer_type, oeApplication *sos, uint8_t max_soun } spec.freq = SOUNDLIB_SAMPLE_RATE; - spec.format = SOUNDLIB_SAMPLE_SIZE == 8 ? AUDIO_U8 : AUDIO_S16SYS; + spec.format = SOUNDLIB_SAMPLE_SIZE == 8 ? SDL_AUDIO_U8 : SDL_AUDIO_S16; spec.channels = SOUNDLIB_CHANNELS; - spec.samples = sampleCount; - spec.callback = StreamAudio; - spec.userdata = &m_mixer; - sound_device = SDL_OpenAudioDevice(nullptr, 0, &spec, nullptr, 0); + this->sound_stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &spec, StreamAudio, &m_mixer); + this->sound_device = SDL_GetAudioStreamDevice(sound_stream); if (sound_device == 0) { strcpy(m_error_text, SDL_GetError()); return false; } LOG_INFO << "Sound: Hardware configured. Kicking off stream thread..."; - SDL_PauseAudioDevice(sound_device, 0); + SDL_ResumeAudioDevice(sound_device); m_total_sounds_played = 0; m_cur_sounds_played = 0; @@ -757,6 +755,15 @@ void lnxsound_ErrorText(const char *fmt, ...) { } // A peroidic mixer that uses the primary buffer as a stream buffer -static void StreamAudio(void *user_ptr, Uint8 *stream, int len) { - ((software_mixer *)user_ptr)->StreamMixer((char *)stream, len); +void StreamAudio(void *userdata, SDL_AudioStream *stream, int additional_amount, int total_amount) +{ + if (additional_amount > 0) { + Uint8 *data = SDL_stack_alloc(Uint8, additional_amount); + if (data) { + // StreamAudio(userdata, data, additional_amount); + ((software_mixer *)userdata)->StreamMixer((char *)data, additional_amount); + SDL_PutAudioStreamData(stream, data, additional_amount); + SDL_stack_free(data); + } + } } diff --git a/sndlib/sdlsound.h b/sndlib/sdlsound.h index 3cb727af4..eadd26fcf 100644 --- a/sndlib/sdlsound.h +++ b/sndlib/sdlsound.h @@ -19,7 +19,7 @@ #ifndef __LINUX_DD_SOUND_H_ #define __LINUX_DD_SOUND_H_ -#include +#include #include "ssl_lib.h" #include "mixer.h" @@ -143,7 +143,8 @@ class lnxsound final : public llsSystem { int m_primary_frequency; // Set to the primary buffers frequency -- cmphack int m_primary_alignment; - SDL_AudioDeviceID sound_device; + SDL_AudioDeviceID sound_device = 0; + SDL_AudioStream* sound_stream = nullptr; bool in_at_exit; bool m_in_sound_frame; bool m_pending_actions; diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index c7acb1faa..a98e85ab4 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -2,13 +2,3 @@ set(CMAKE_FOLDER "third_party") add_subdirectory(libacm) add_subdirectory(stb) - -if(USE_EXTERNAL_PLOG) - find_package(plog REQUIRED) -else() - if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/plog/CMakeLists.txt) - message(FATAL_ERROR "plog third-party directory could not be found. " - "Please run 'submodule update --init --recursive' in the source directory.") - endif() - add_subdirectory(plog) -endif() diff --git a/third_party/plog b/third_party/plog deleted file mode 160000 index e21baecd4..000000000 --- a/third_party/plog +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e21baecd4753f14da64ede979c5a19302618b752 diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json new file mode 100644 index 000000000..95a67c09c --- /dev/null +++ b/vcpkg-configuration.json @@ -0,0 +1,5 @@ +{ + "overlay-ports": [ + "overlays" + ] +} diff --git a/vcpkg.json b/vcpkg.json index 0368d2af7..2492e9fc0 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,34 +1,27 @@ { - "builtin-baseline": "e60236ee051183f1122066bee8c54a0b47c43a60", + "builtin-baseline": "0bd7ec5b305428b0529397d512c3757695edf26b", "dependencies": [ "cpp-httplib", "glm", "gtest", "plog", - "zlib", { - "name": "sdl2", - "version>=": "2.30.8", - "features": ["x11", "wayland", "alsa"], - "default-features": false, - "platform": "linux & !native" - }, - { - "name": "sdl2", - "version>=": "2.30.8", + "name": "sdl3", + "version>=": "3.2.4", "features": ["x11","wayland", "alsa"], - "platform": "linux & native" + "platform": "linux" }, { - "name": "sdl2", - "version>=": "2.30.8", + "name": "sdl3", + "version>=": "3.2.4", "platform": "!linux" - } + }, + "zlib" ], "overrides": [ { - "name": "sdl2", - "version": "2.30.8" + "name": "sdl3", + "version": "3.2.4" } - ] -} \ No newline at end of file + ] +}