Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 58 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ jobs:
needs: version
steps:
- uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install libsdl2-dev
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@v1
with:
version: sdl3-latest
cmake-generator: Ninja
- name: Compile
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
Expand All @@ -45,6 +47,12 @@ jobs:
needs: version
steps:
- uses: actions/checkout@v4
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@v1
with:
version: sdl3-latest
cmake-generator: Ninja
- name: Compile
run: |
cmake -S . -B build -G "Visual Studio 17 2022"
Expand All @@ -65,6 +73,12 @@ jobs:
needs: version
steps:
- uses: actions/checkout@v4
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@v1
with:
version: sdl3-latest
cmake-generator: Ninja
- name: Compile
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
Expand All @@ -85,6 +99,12 @@ jobs:
needs: version
steps:
- uses: actions/checkout@v4
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@v1
with:
version: sdl3-latest
cmake-generator: Ninja
- name: Import Code Signing Certificate
if: github.ref_name == 'main'
run: |
Expand Down Expand Up @@ -138,6 +158,12 @@ jobs:
uses: mymindstorm/setup-emsdk@v13
with:
version: 3.1.58
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@v1
with:
version: sdl3-latest
cmake-generator: Ninja
- name: Compile
run: |
emcmake cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
Expand All @@ -153,10 +179,16 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@v1
with:
version: sdl3-latest
cmake-generator: Ninja
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install libsdl2-dev zlib1g-dev libjpeg-dev libopenal-dev \
sudo apt-get install libsdl3-dev zlib1g-dev libjpeg-dev libopenal-dev \
libogg-dev libvorbis-dev libopus-dev libopusfile-dev libcurl4-openssl-dev
- name: Compile
run: |
Expand All @@ -167,11 +199,17 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@v1
with:
version: sdl3-latest
cmake-generator: Ninja
- name: Install Dependencies
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install gcc-multilib libsdl2-dev:i386
sudo apt-get install gcc-multilib libsdl3-dev:i386
- name: Compile
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-m32 -msse -msse2"
Expand All @@ -181,11 +219,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@v1
with:
version: sdl3-latest
cmake-generator: Ninja
- name: Compile
uses: vmactions/freebsd-vm@v1
with:
prepare: |
pkg install -y cmake ninja devel/sdl20
pkg install -y cmake ninja devel/sdl30
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build
Expand All @@ -194,11 +238,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@v1
with:
version: sdl3-latest
cmake-generator: Ninja
- name: Compile
uses: vmactions/openbsd-vm@v1
with:
prepare: |
pkg_add cmake ninja sdl2
pkg_add cmake ninja sdl3
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ This is a reminder for how official installers should be built:
providing pak0.pk3 and the patch pk3s are not referred to or included in the
installer.

* Please include at least a libSDL2 so/dylib/dll on every platform.
* Please include at least a libSDL3 so/dylib/dll on every platform.

* Please include an OpenAL so/dylib/dll, since every platform should be using
it by now.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ If you aren't there, then this isn't ioquake3, it's someone else's project.
Some of the major features currently implemented are:

* CMake meta-build system
* SDL 2 backend
* SDL 3 backend
* OpenAL sound API support (multiple speaker support and better sound
quality)
* Full x86_64 support on Linux
Expand Down Expand Up @@ -109,7 +109,7 @@ For *nix,
1. `git clone git://github.com/ioquake/ioq3.git`
2. `cd ioq3`
3. Install dependencies according to your operating system's instructions.
for apt-based systems, `sudo apt install cmake libsdl2-dev`
for apt-based systems, `sudo apt install cmake libsdl3-dev`
4. `cmake -S . -B build -DCMAKE_BUILD_TYPE=Release`
5. `cmake --build build`
6. The resulting files will be in the `build` directory.
Expand Down
41 changes: 19 additions & 22 deletions cmake/libraries/sdl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ endif()

if(EMSCRIPTEN)
# Emscripten provides its own self contained SDL setup
list(APPEND CLIENT_COMPILE_OPTIONS -sUSE_SDL=2)
list(APPEND CLIENT_LINK_OPTIONS -sUSE_SDL=2)
list(APPEND CLIENT_COMPILE_OPTIONS -sUSE_SDL=3)
list(APPEND CLIENT_LINK_OPTIONS -sUSE_SDL=3)
return()
endif()

set(INTERNAL_SDL_DIR ${SOURCE_DIR}/thirdparty/SDL2-2.32.8)
set(INTERNAL_SDL_DIR ${SOURCE_DIR}/thirdparty/SDL3-3.4.8)

include(utils/arch)

Expand All @@ -19,7 +19,7 @@ if(WIN32 OR APPLE)
endif()

if(USE_INTERNAL_SDL AND HAVE_INTERNAL_SDL)
set(SDL2_INCLUDE_DIRS ${INTERNAL_SDL_DIR}/include)
set(SDL3_INCLUDE_DIRS ${INTERNAL_SDL_DIR}/include)
list(APPEND CLIENT_DEFINITIONS USE_INTERNAL_SDL_HEADERS)
list(APPEND RENDERER_DEFINITIONS USE_INTERNAL_SDL_HEADERS)

Expand All @@ -33,32 +33,29 @@ if(USE_INTERNAL_SDL AND HAVE_INTERNAL_SDL)
endif()

if(MINGW)
set(SDL2_LIBRARIES
${LIB_DIR}/libSDL2main.a
${LIB_DIR}/libSDL2.dll.a)
set(SDL3_LIBRARIES
${LIB_DIR}/libSDL3.dll.a)
elseif(MSVC)
set(SDL2_LIBRARIES
${LIB_DIR}/SDL2main.lib
${LIB_DIR}/SDL2.lib)
set(SDL3_LIBRARIES
${LIB_DIR}/SDL3.lib)
endif()

list(APPEND CLIENT_DEPLOY_LIBRARIES ${LIB_DIR}/SDL2.dll)
list(APPEND CLIENT_DEPLOY_LIBRARIES ${LIB_DIR}/SDL3.dll)
elseif(APPLE)
set(SDL2_LIBRARIES
${SOURCE_DIR}/thirdparty/libs/macos/libSDL2main.a
${SOURCE_DIR}/thirdparty/libs/macos/libSDL2-2.0.0.dylib)
set(SDL3_LIBRARIES
${SOURCE_DIR}/thirdparty/libs/macos/libSDL3-3.0.0.dylib)
list(APPEND CLIENT_DEPLOY_LIBRARIES
${SOURCE_DIR}/thirdparty/libs/macos/libSDL2-2.0.0.dylib)
${SOURCE_DIR}/thirdparty/libs/macos/libSDL3-3.0.0.dylib)
else()
message(FATAL_ERROR "HAVE_INTERNAL_SDL set incorrectly; file a bug")
endif()
else()
find_package(SDL2 REQUIRED)
find_package(SDL3 REQUIRED)
endif()

list(APPEND CLIENT_LIBRARIES ${SDL2_LIBRARIES})
list(APPEND CLIENT_INCLUDE_DIRS ${SDL2_INCLUDE_DIRS})
list(APPEND CLIENT_COMPILE_OPTIONS ${SDL2_CFLAGS_OTHER})
list(APPEND RENDERER_LIBRARIES ${SDL2_LIBRARIES})
list(APPEND RENDERER_INCLUDE_DIRS ${SDL2_INCLUDE_DIRS})
list(APPEND RENDERER_COMPILE_OPTIONS ${SDL2_CFLAGS_OTHER})
list(APPEND CLIENT_LIBRARIES ${SDL3_LIBRARIES})
list(APPEND CLIENT_INCLUDE_DIRS ${SDL3_INCLUDE_DIRS})
list(APPEND CLIENT_COMPILE_OPTIONS ${SDL3_CFLAGS_OTHER})
list(APPEND RENDERER_LIBRARIES ${SDL3_LIBRARIES})
list(APPEND RENDERER_INCLUDE_DIRS ${SDL3_INCLUDE_DIRS})
list(APPEND RENDERER_COMPILE_OPTIONS ${SDL3_CFLAGS_OTHER})
2 changes: 1 addition & 1 deletion code/client/cl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3273,7 +3273,7 @@ void CL_InitRef( void ) {
Com_Error(ERR_FATAL, "Failed to load renderer");
}

GetRefAPI = Sys_LoadFunction(rendererLib, "GetRefAPI");
GetRefAPI = (GetRefAPI_t) Sys_LoadFunction(rendererLib, "GetRefAPI");
if(!GetRefAPI)
{
Com_Error(ERR_FATAL, "Can't load symbol GetRefAPI: '%s'", Sys_LibraryError());
Expand Down
6 changes: 6 additions & 0 deletions code/client/keycodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,12 @@ typedef enum {
K_PAD0_PADDLE4, /* Xbox Elite paddle P4 */
K_PAD0_TOUCHPAD, /* PS4/PS5 touchpad button */

K_PAD0_MISC2, /* Additional button */
K_PAD0_MISC3, /* Additional button */
K_PAD0_MISC4, /* Additional button */
K_PAD0_MISC5, /* Additional button */
K_PAD0_MISC6, /* Additional button */

// Pseudo-key that brings the console down
K_CONSOLE,

Expand Down
6 changes: 3 additions & 3 deletions code/renderercommon/qgl.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define __QGL_H__

#ifdef USE_INTERNAL_SDL_HEADERS
# include "SDL_opengl.h"
# include "SDL3/SDL_opengl.h"
#else
# include <SDL_opengl.h>
# include <SDL3/SDL_opengl.h>
#endif

extern void (APIENTRYP qglActiveTextureARB) (GLenum texture);
Expand All @@ -43,7 +43,7 @@ extern void (APIENTRYP qglUnlockArraysEXT) (void);
//===========================================================================

// GL function loader, based on https://gist.github.com/rygorous/16796a0c876cf8a5f542caddb55bce8a
// get missing functions from code/SDL2/include/SDL_opengl.h
// get missing functions from code/thirdparty/SDL3/include/SDL3/SDL_opengl.h

// OpenGL 1.0/1.1, OpenGL ES 1.0, and OpenGL 3.2 core profile
#define QGL_1_1_PROCS \
Expand Down
4 changes: 2 additions & 2 deletions code/renderergl2/tr_extensions.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// tr_extensions.c - extensions needed by the renderer not in sdl_glimp.c

#ifdef USE_INTERNAL_SDL_HEADERS
# include "SDL.h"
# include "SDL3/SDL.h"
#else
# include <SDL.h>
# include <SDL3/SDL.h>
#endif

#include "tr_local.h"
Expand Down
6 changes: 4 additions & 2 deletions code/sdl/sdl_gamma.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifdef USE_INTERNAL_SDL_HEADERS
# include "SDL.h"
# include "SDL3/SDL.h"
#else
# include <SDL.h>
# include <SDL3/SDL.h>
#endif

#include "../renderercommon/tr_common.h"
Expand All @@ -38,6 +38,7 @@ GLimp_SetGamma
*/
void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned char blue[256] )
{
#if 0 // !!! FIXME: use a shader, sorry. gamma/brightness is removed from SDL3, since it doesn't work on many systems, or changes the whole desktop (possibly permanently if the app crashes).
Uint16 table[3][256];
int i, j;

Expand Down Expand Up @@ -81,5 +82,6 @@ void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned
{
ri.Printf( PRINT_DEVELOPER, "SDL_SetWindowGammaRamp() failed: %s\n", SDL_GetError() );
}
#endif
}

Loading
Loading