diff options
author | vittorioromeo <vittorio.romeo@outlook.com> | 2023-04-18 11:30:50 +0200 |
---|---|---|
committer | vittorioromeo <vittorio.romeo@outlook.com> | 2023-04-18 11:30:50 +0200 |
commit | 27112a568348798bf2609a2e38039a4da4e91634 (patch) | |
tree | 74fa8f0f9c047df942ae1a8ef78043478ace2299 | |
parent | 0e7043867fff010c8b02532d6af740274e54998a (diff) | |
parent | eccc230faa3204f5a0b830a914c40b1ca014809c (diff) |
Merge branch 'develop' of https://github.com/vittorioromeo/SSVOpenHexagon into develop
89 files changed, 2250 insertions, 701 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci_linux.yml index eaca082c..15eaf0f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci_linux.yml @@ -1,4 +1,4 @@ -name: CI +name: CI Linux # Trigger this workflow on push or pull request on: [push, pull_request] @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@v1 with: submodules: recursive - + - name: Install dependencies run: | sudo apt-get update @@ -33,19 +33,13 @@ jobs: cd build export LD_RUN_PATH="/opt/gcc-latest/lib64" cmake -GNinja -DCMAKE_BUILD_TYPE=RELEASE -DSSVOH_HEADLESS_TESTS=1 .. - + - name: Build run: ninja -C build - name: Copy artifacts run: | cp build/SSVOpenHexagon build/OHWorkshopUploader _RELEASE - cp build/_deps/sfml-build/lib/libsfml-*.so _RELEASE - mv _RELEASE/libsfml-audio.so _RELEASE/libsfml-audio.so.2.5 - mv _RELEASE/libsfml-graphics.so _RELEASE/libsfml-graphics.so.2.5 - mv _RELEASE/libsfml-network.so _RELEASE/libsfml-network.so.2.5 - mv _RELEASE/libsfml-system.so _RELEASE/libsfml-system.so.2.5 - mv _RELEASE/libsfml-window.so _RELEASE/libsfml-window.so.2.5 - name: Upload artifacts uses: actions/upload-artifact@v1 @@ -60,7 +54,7 @@ jobs: cp -R _RELEASE/Packs build cp -R _RELEASE/Packs build/test ninja -C build check - + - name: Check ldd run: | ldd build/test/test.Replay.t diff --git a/.github/workflows/ci_windows.yml b/.github/workflows/ci_windows.yml new file mode 100644 index 00000000..b35590aa --- /dev/null +++ b/.github/workflows/ci_windows.yml @@ -0,0 +1,60 @@ +name: CI Windows + +# Trigger this workflow on push or pull request +on: [push, pull_request] + +jobs: + build: + name: Build and test (windows) + + runs-on: windows-latest + + defaults: + run: + shell: msys2 {0} + + steps: + - name: Install dependencies + uses: msys2/setup-msys2@v2 + with: + install: >- + git + base-devel + mingw-w64-x86_64-gcc + mingw-w64-x86_64-cmake + mingw-w64-x86_64-openal + update: true + + - uses: actions/checkout@v1 + with: + submodules: recursive + + - name: CMake configure + run: | + cd build + cmake -GNinja -DCMAKE_BUILD_TYPE=RELEASE -DSSVOH_HEADLESS_TESTS=1 .. + + - name: Build + run: ninja -C build + + - name: Copy artifacts + run: | + cp build/SSVOpenHexagon*.exe build/OHWorkshopUploader.exe _RELEASE + cp build/_deps/zlib-build/libzlib.dll _RELEASE + cp /mingw64/bin/libwinpthread-1.dll _RELEASE + cp /mingw64/bin/libstdc++-6.dll _RELEASE + cp /mingw64/bin/libgcc_s_seh-1.dll _RELEASE + cp /mingw64/bin/libopenal-1.dll _RELEASE + cp _RELEASE/*.dll build/test + + - name: Upload artifacts + uses: actions/upload-artifact@v1 + with: + name: OpenHexagon-Windows + path: _RELEASE + + - name: Run tests + run: | + mkdir -p build/test + cp -R _RELEASE/Packs build/test + ninja -C build check diff --git a/CMakeLists.txt b/CMakeLists.txt index d0650e7c..06250245 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION 3.9) +# TODO: build timestamp +# string(TIMESTAMP CMAKE_TIMESTAMP) +# message(${CMAKE_TIMESTAMP}) + # # # ----------------------------------------------------------------------------- @@ -97,13 +101,14 @@ include(${CPM_DOWNLOAD_LOCATION}) # CPM: SFML # ----------------------------------------------------------------------------- -set(BUILD_SHARED_LIBS true) -set(SFML_STATIC_LIBRARIES false) +set(BUILD_SHARED_LIBS false) +set(SFML_STATIC_LIBRARIES true) +set(SFML_ENABLE_PCH true) CPMAddPackage( NAME SFML GITHUB_REPOSITORY vittorioromeo/SFML - GIT_TAG b00e5fcd76327ea2ff1c3ae23786a3d21d4449a1 + GIT_TAG dacceddbd1adee49c7bfd120266e200800550394 ) set_target_properties(sfml-system PROPERTIES UNITY_BUILD ON) @@ -125,7 +130,7 @@ set(LUAJIT_DISABLE_FFI ON CACHE BOOL "" FORCE) CPMAddPackage( NAME luajit GIT_REPOSITORY https://github.com/vittorioromeo/LuaJIT - GIT_TAG fa8feeb9580f233a397fb484d84c2108e26b2a00 + GIT_TAG 4dc5ffbf60b16e54274c470fcc022165685c96fe ) set(LUAJIT_DISABLE_FFI true) @@ -227,7 +232,7 @@ set(SODIUM_DISABLE_TESTS ON CACHE BOOL "" FORCE) CPMAddPackage( NAME boostpfr GITHUB_REPOSITORY boostorg/pfr - GIT_TAG ed28602c2cc7b330140e67412552ed7ec2e4fe8d + GIT_TAG b0bf18798c7037ca8a91a1cd2ad2e5798d8f6d46 DOWNLOAD_ONLY YES ) @@ -286,7 +291,7 @@ message(STATUS "initialized project ${PROJECT_NAME}") # Global unity builds # ----------------------------------------------------------------------------- -set(CMAKE_UNITY_BUILD ON) +set(CMAKE_UNITY_BUILD OFF) set(CMAKE_UNITY_BUILD_BATCH_SIZE 4) # diff --git a/_RELEASE/config.json b/_RELEASE/config.json index 23b1dd8f..dbd20441 100644 --- a/_RELEASE/config.json +++ b/_RELEASE/config.json @@ -12,6 +12,7 @@ "camera_shake_multiplier" : 1.0,
"darken_uneven_background_chunk" : true,
"debug" : false,
+ "disable_game_rendering" : false,
"draw_text_outlines" : true,
"first_time_playing" : false,
"flash_enabled" : true,
@@ -45,7 +46,7 @@ "no_pulse" : true,
"no_rotation" : false,
"no_sound" : false,
- "official" : false,
+ "official" : true,
"pixel_multiplier" : 1,
"play_swap_ready_sound" : true,
"player_focus_speed" : 4.6250,
@@ -262,9 +263,10 @@ "text_padding" : 8.0,
"text_scaling" : 1.0,
"timescale" : 1.0,
+ "use_lua_file_cache" : false,
"vsync" : false,
"windowed_auto_resolution" : false,
- "windowed_height" : 763,
- "windowed_width" : 1152,
- "zoom_factor" : 1.006553053855896
+ "windowed_height" : 901,
+ "windowed_width" : 1736,
+ "zoom_factor" : 0.8523862361907959
}
diff --git a/_RELEASE/libsdkencryptedappticket.so b/_RELEASE/libsdkencryptedappticket.so Binary files differindex 6250125f..fe77ac24 100644 --- a/_RELEASE/libsdkencryptedappticket.so +++ b/_RELEASE/libsdkencryptedappticket.so diff --git a/_RELEASE/libsteam_api.so b/_RELEASE/libsteam_api.so Binary files differindex b343945d..bbd3ff3f 100644 --- a/_RELEASE/libsteam_api.so +++ b/_RELEASE/libsteam_api.so diff --git a/_RELEASE/sdkencryptedappticket64.dll b/_RELEASE/sdkencryptedappticket64.dll Binary files differindex eef729c0..1fd4d50f 100644 --- a/_RELEASE/sdkencryptedappticket64.dll +++ b/_RELEASE/sdkencryptedappticket64.dll diff --git a/_RELEASE/steam_api64.dll b/_RELEASE/steam_api64.dll Binary files differindex 2154994c..45a49e96 100644 --- a/_RELEASE/steam_api64.dll +++ b/_RELEASE/steam_api64.dll diff --git a/_RELEASE/steam_api64.lib b/_RELEASE/steam_api64.lib Binary files differindex 2eada41f..663b11e5 100644 --- a/_RELEASE/steam_api64.lib +++ b/_RELEASE/steam_api64.lib diff --git a/art/steamart_new/eventcover.png b/art/steamart_new/eventcover.png Binary files differindex 9bc05a77..ee6f1984 100644 --- a/art/steamart_new/eventcover.png +++ b/art/steamart_new/eventcover.png diff --git a/art/steamart_new/eventcover.psd b/art/steamart_new/eventcover.psd Binary files differindex 1fb224df..d20a22bd 100644 --- a/art/steamart_new/eventcover.psd +++ b/art/steamart_new/eventcover.psd @@ -101,6 +101,7 @@ case $OSTYPE in rm -f "$RELEASE_DIR/sfml-system-3.dll" rm -f "$RELEASE_DIR/sfml-window-3.dll" rm -f "$RELEASE_DIR/openal32.dll" + rm -f "$RELEASE_DIR/libzlib.dll" rm -f "$RELEASE_DIR/libzlib1.dll" rm -f "$RELEASE_DIR/OHWorkshopUploader.exe" rm -f "$RELEASE_DIR/SSVOpenHexagon.exe" @@ -122,13 +123,8 @@ case $OSTYPE in make $THREAD_MAKE_COUNT # Moves artifacts to release folder - mv ./_deps/sfml-build/lib/sfml-audio-3.dll $RELEASE_DIR - mv ./_deps/sfml-build/lib/sfml-graphics-3.dll $RELEASE_DIR - mv ./_deps/sfml-build/lib/sfml-network-3.dll $RELEASE_DIR - mv ./_deps/sfml-build/lib/sfml-system-3.dll $RELEASE_DIR - mv ./_deps/sfml-build/lib/sfml-window-3.dll $RELEASE_DIR cp ./_deps/sfml-src/extlibs/bin/x64/openal32.dll $RELEASE_DIR - mv ./_deps/zlib-build/libzlib1.dll $RELEASE_DIR + mv ./_deps/zlib-build/libzlib.dll $RELEASE_DIR mv ./OHWorkshopUploader.exe $RELEASE_DIR mv ./SSVOpenHexagon.exe $RELEASE_DIR ;; diff --git a/build/copylibs.sh b/build/copylibs.sh index 173795b9..882a1d18 100644 --- a/build/copylibs.sh +++ b/build/copylibs.sh @@ -2,19 +2,7 @@ function copyTo { - cp ./_deps/imgui-sfml-build/libImGui-SFML_d.dll $1 & - - cp ./_deps/sfml-build/bin/sfml-graphics-d-3.dll $1 & - cp ./_deps/sfml-build/bin/sfml-system-d-3.dll $1 & - cp ./_deps/sfml-build/bin/sfml-window-d-3.dll $1 & - cp ./_deps/sfml-build/bin/sfml-network-d-3.dll $1 & - cp ./_deps/sfml-build/bin/sfml-audio-d-3.dll $1 & - - cp ./_deps/sfml-src/extlibs/bin/x64/openal32.dll $1 & - cp ./_deps/libsodium-cmake-build/libsodium.dll $1 & - cp ./_deps/luajit-build/src/libluajit.dll $1 & - cp ./_deps/zlib-build/libzlib1.dll $1 & - + cp ./_deps/zlib-build/libzlib.dll $1 & cp /c/msys64/mingw64/bin/libssp-0.dll $1 & cp /c/msys64/mingw64/bin/libstdc++-6.dll $1 & cp /c/msys64/mingw64/bin/libgcc_s_seh-1.dll $1 & diff --git a/buildlx/cpsyslibs.sh b/buildlx/cpsyslibs.sh new file mode 100644 index 00000000..b6d770bc --- /dev/null +++ b/buildlx/cpsyslibs.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +rm -Rf ./syslibs +mkdir -p ./syslibs +cp /usr/lib/libopenal.so.1 ./syslibs +cp /usr/lib/libvorbisenc.so.2 ./syslibs +cp /usr/lib/libvorbisfile.so.3 ./syslibs +cp /usr/lib/libvorbis.so.0 ./syslibs +cp /usr/lib/libogg.so.0 ./syslibs +cp /usr/lib/libFLAC.so.12 ./syslibs +cp /usr/lib/libdl.so.2 ./syslibs +cp /usr/lib/libXcursor.so.1 ./syslibs +cp /usr/lib/libXrandr.so.2 ./syslibs +cp /usr/lib/libXext.so.6 ./syslibs +cp /usr/lib/libXrender.so.1 ./syslibs +cp /usr/lib/libXfixes.so.3 ./syslibs +cp /usr/lib/libX11.so.6 ./syslibs +cp /usr/lib/libudev.so.1 ./syslibs +cp /usr/lib/libfreetype.so.6 ./syslibs +cp /usr/lib/libGL.so.1 ./syslibs +cp /usr/lib/libGLU.so.1 ./syslibs +cp /usr/lib/libstdc++.so.6 ./syslibs +cp /usr/lib/libm.so.6 ./syslibs +cp /usr/lib/libgcc_s.so.1 ./syslibs +cp /usr/lib/libc.so.6 ./syslibs +cp /usr/lib64/ld-linux-x86-64.so.2 ./syslibs +cp /usr/lib/libpthread.so.0 ./syslibs +cp /usr/lib/librt.so.1 ./syslibs +cp /usr/lib/libxcb.so.1 ./syslibs +cp /usr/lib/libcap.so.2 ./syslibs +cp /usr/lib/libbz2.so.1.0 ./syslibs +cp /usr/lib/libpng16.so.16 ./syslibs +cp /usr/lib/libharfbuzz.so.0 ./syslibs +cp /usr/lib/libbrotlidec.so.1 ./syslibs +cp /usr/lib/libGLdispatch.so.0 ./syslibs +cp /usr/lib/libGLX.so.0 ./syslibs +cp /usr/lib/libOpenGL.so.0 ./syslibs +cp /usr/lib/libXau.so.6 ./syslibs +cp /usr/lib/libXdmcp.so.6 ./syslibs +cp /usr/lib/libglib-2.0.so.0 ./syslibs +cp /usr/lib/libgraphite2.so.3 ./syslibs +cp /usr/lib/libbrotlicommon.so.1 ./syslibs +cp /usr/lib/libpcre2-8.so.0 ./syslibs diff --git a/buildlx/make_debug_client_linux_clang_0_cmake.sh b/buildlx/make_debug_client_linux_clang_0_cmake.sh index ec00e35f..3ba44c1b 100755 --- a/buildlx/make_debug_client_linux_clang_0_cmake.sh +++ b/buildlx/make_debug_client_linux_clang_0_cmake.sh @@ -17,5 +17,5 @@ cmake .. -G"Ninja" \ -Wall -Wextra -Wpedantic -Wno-braced-scalar-init -Wno-missing-field-initializers \ -D_GLIBCXX_ASSERTIONS=1 \ -fstack-protector -Wno-pragmas \ - -fsanitize=address" + -fsanitize=address -g3" diff --git a/buildlx/make_debug_client_linux_clang_2_copy.sh b/buildlx/make_debug_client_linux_clang_2_copy.sh index 2b2a0f30..fb92ac58 100755 --- a/buildlx/make_debug_client_linux_clang_2_copy.sh +++ b/buildlx/make_debug_client_linux_clang_2_copy.sh @@ -29,56 +29,4 @@ echo "| COPYING DEPS TO VBOX DRIVE |" echo "--------------------------------------------------------------------" echo "" -cp ./_deps/sfml-build/lib/libsfml-audio-d.so.3.0 ../_RELEASE -cp ./_deps/sfml-build/lib/libsfml-network-d.so.3.0 ../_RELEASE -cp ./_deps/luajit-build/src/libluajit.so ../_RELEASE cp ./_deps/zlib-build/libz.so.1 ../_RELEASE -cp ./_deps/libsodium-cmake-build/libsodium.so ../_RELEASE -cp ./_deps/imgui-sfml-build/libImGui-SFML.so ../_RELEASE -cp ./_deps/sfml-build/lib/libsfml-graphics-d.so.3.0 ../_RELEASE -cp ./_deps/sfml-build/lib/libsfml-window-d.so.3.0 ../_RELEASE -cp ./_deps/sfml-build/lib/libsfml-system-d.so.3.0 ../_RELEASE - -echo "" -echo "" -echo "--------------------------------------------------------------------" -echo "| COPYING SYSTEM DEPS TO VBOX DRIVE |" -echo "--------------------------------------------------------------------" -echo "" - -cp /usr/lib/libdl.so.2 ../_RELEASE -cp /usr/lib/libXcursor.so.1 ../_RELEASE -cp /usr/lib/libGL.so.1 ../_RELEASE -cp /usr/lib/libpthread.so.0 ../_RELEASE -cp /usr/lib/libstdc++.so.6 ../_RELEASE -cp /usr/lib/libm.so.6 ../_RELEASE -cp /usr/lib/libgcc_s.so.1 ../_RELEASE -cp /usr/lib/libc.so.6 ../_RELEASE -cp /usr/lib/libopenal.so.1 ../_RELEASE -cp /usr/lib/libvorbisenc.so.2 ../_RELEASE -cp /usr/lib/libvorbisfile.so.3 ../_RELEASE -cp /usr/lib/libvorbis.so.0 ../_RELEASE -cp /usr/lib/libogg.so.0 ../_RELEASE -cp /usr/lib/libFLAC.so.8 ../_RELEASE -cp /usr/lib64/ld-linux-x86-64.so.2 ../_RELEASE -cp /usr/lib/librt.so.1 ../_RELEASE -cp /usr/lib/libXrender.so.1 ../_RELEASE -cp /usr/lib/libXfixes.so.3 ../_RELEASE -cp /usr/lib/libX11.so.6 ../_RELEASE -cp /usr/lib/libfreetype.so.6 ../_RELEASE -cp /usr/lib/libXrandr.so.2 ../_RELEASE -cp /usr/lib/libudev.so.1 ../_RELEASE -cp /usr/lib/libGLdispatch.so.0 ../_RELEASE -cp /usr/lib/libGLX.so.0 ../_RELEASE -cp /usr/lib/libxcb.so.1 ../_RELEASE -cp /usr/lib/libbz2.so.1.0 ../_RELEASE -cp /usr/lib/libpng16.so.16 ../_RELEASE -cp /usr/lib/libharfbuzz.so.0 ../_RELEASE -cp /usr/lib/libbrotlidec.so.1 ../_RELEASE -cp /usr/lib/libXext.so.6 ../_RELEASE -cp /usr/lib/libXau.so.6 ../_RELEASE -cp /usr/lib/libXdmcp.so.6 ../_RELEASE -cp /usr/lib/libgraphite2.so.3 ../_RELEASE -cp /usr/lib/libglib-2.0.so.0 ../_RELEASE -cp /usr/lib/libbrotlicommon.so.1 ../_RELEASE -cp /usr/lib/libpcre.so.1 ../_RELEASE diff --git a/buildlx/make_debug_client_linux_gcc_0_cmake.sh b/buildlx/make_debug_client_linux_gcc_0_cmake.sh new file mode 100755 index 00000000..d58dfe72 --- /dev/null +++ b/buildlx/make_debug_client_linux_gcc_0_cmake.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -e + +echo "" +echo "" +echo "--------------------------------------------------------------------" +echo "| RUNNING CMAKE IN DEBUG MODE (NINJA) |" +echo "--------------------------------------------------------------------" +cmake .. -G"Ninja" \ + -DFORCE_COLORED_OUTPUT=1 \ + -DCMAKE_BUILD_TYPE=DEBUG \ + -DCMAKE_C_COMPILER="gcc" \ + -DCMAKE_CXX_COMPILER="g++" \ + -DCMAKE_CXX_FLAGS="\ + -O0 -fno-omit-frame-pointer \ + -Wall -Wextra -Wpedantic -Wno-braced-scalar-init -Wno-missing-field-initializers \ + -D_GLIBCXX_ASSERTIONS=1 \ + -fstack-protector -Wno-pragmas \ + -fsanitize=address -g3" + diff --git a/buildlx/make_release_client_vbox_2_copy.sh b/buildlx/make_release_client_vbox_2_copy.sh index 576fd446..52a5de02 100755 --- a/buildlx/make_release_client_vbox_2_copy.sh +++ b/buildlx/make_release_client_vbox_2_copy.sh @@ -29,56 +29,7 @@ echo "| COPYING DEPS TO VBOX DRIVE |" echo "--------------------------------------------------------------------" echo "" -cp ./_deps/sfml-build/lib/libsfml-audio.so.3.0 ../_RELEASE -cp ./_deps/sfml-build/lib/libsfml-network.so.3.0 ../_RELEASE -cp ./_deps/luajit-build/src/libluajit.so ../_RELEASE cp ./_deps/zlib-build/libz.so.1 ../_RELEASE -cp ./_deps/libsodium-cmake-build/libsodium.so ../_RELEASE -cp ./_deps/imgui-sfml-build/libImGui-SFML.so ../_RELEASE -cp ./_deps/sfml-build/lib/libsfml-graphics.so.3.0 ../_RELEASE -cp ./_deps/sfml-build/lib/libsfml-window.so.3.0 ../_RELEASE -cp ./_deps/sfml-build/lib/libsfml-system.so.3.0 ../_RELEASE - -echo "" -echo "" -echo "--------------------------------------------------------------------" -echo "| COPYING SYSTEM DEPS TO VBOX DRIVE |" -echo "--------------------------------------------------------------------" -echo "" - -cp /usr/lib/libdl.so.2 ../_RELEASE -cp /usr/lib/libXcursor.so.1 ../_RELEASE -cp /usr/lib/libGL.so.1 ../_RELEASE -cp /usr/lib/libpthread.so.0 ../_RELEASE -cp /usr/lib/libstdc++.so.6 ../_RELEASE -cp /usr/lib/libm.so.6 ../_RELEASE -cp /usr/lib/libgcc_s.so.1 ../_RELEASE -cp /usr/lib/libc.so.6 ../_RELEASE -cp /usr/lib/libopenal.so.1 ../_RELEASE -cp /usr/lib/libvorbisenc.so.2 ../_RELEASE -cp /usr/lib/libvorbisfile.so.3 ../_RELEASE -cp /usr/lib/libvorbis.so.0 ../_RELEASE -cp /usr/lib/libogg.so.0 ../_RELEASE -cp /usr/lib/libFLAC.so.8 ../_RELEASE -cp /usr/lib64/ld-linux-x86-64.so.2 ../_RELEASE -cp /usr/lib/librt.so.1 ../_RELEASE -cp /usr/lib/libXrender.so.1 ../_RELEASE -cp /usr/lib/libXfixes.so.3 ../_RELEASE -cp /usr/lib/libX11.so.6 ../_RELEASE -cp /usr/lib/libfreetype.so.6 ../_RELEASE -cp /usr/lib/libXrandr.so.2 ../_RELEASE -cp /usr/lib/libudev.so.1 ../_RELEASE -cp /usr/lib/libGLdispatch.so.0 ../_RELEASE -cp /usr/lib/libGLX.so.0 ../_RELEASE -cp /usr/lib/libxcb.so.1 ../_RELEASE -cp /usr/lib/libbz2.so.1.0 ../_RELEASE -cp /usr/lib/libpng16.so.16 ../_RELEASE -cp /usr/lib/libharfbuzz.so.0 ../_RELEASE -cp /usr/lib/libbrotlidec.so.1 ../_RELEASE -cp /usr/lib/libXext.so.6 ../_RELEASE -cp /usr/lib/libXau.so.6 ../_RELEASE -cp /usr/lib/libXdmcp.so.6 ../_RELEASE -cp /usr/lib/libgraphite2.so.3 ../_RELEASE -cp /usr/lib/libglib-2.0.so.0 ../_RELEASE -cp /usr/lib/libbrotlicommon.so.1 ../_RELEASE -cp /usr/lib/libpcre.so.1 ../_RELEASE +cp /lib/x86_64-linux-gnu/libopenal.so.1 ../_RELEASE +cp /lib/x86_64-linux-gnu/libFLAC.so.8 ../_RELEASE +cp /lib/x86_64-linux-gnu/libsndio.so.7 ./_RELEASE diff --git a/buildrel/copylibs.sh b/buildrel/copylibs.sh index 276275ce..882a1d18 100644 --- a/buildrel/copylibs.sh +++ b/buildrel/copylibs.sh @@ -2,19 +2,7 @@ function copyTo { - cp ./_deps/imgui-sfml-build/libImGui-SFML.dll $1 & - - cp ./_deps/sfml-build/bin/sfml-graphics-3.dll $1 & - cp ./_deps/sfml-build/bin/sfml-system-3.dll $1 & - cp ./_deps/sfml-build/bin/sfml-window-3.dll $1 & - cp ./_deps/sfml-build/bin/sfml-network-3.dll $1 & - cp ./_deps/sfml-build/bin/sfml-audio-3.dll $1 & - - cp ./_deps/sfml-src/extlibs/bin/x64/openal32.dll $1 & - cp ./_deps/libsodium-cmake-build/libsodium.dll $1 & - cp ./_deps/luajit-build/src/libluajit.dll $1 & - cp ./_deps/zlib-build/libzlib1.dll $1 & - + cp ./_deps/zlib-build/libzlib.dll $1 & cp /c/msys64/mingw64/bin/libssp-0.dll $1 & cp /c/msys64/mingw64/bin/libstdc++-6.dll $1 & cp /c/msys64/mingw64/bin/libgcc_s_seh-1.dll $1 & diff --git a/buildrel/make_release_client_win10_msys_0_cmake.sh b/buildrel/make_release_client_win10_msys_0_cmake.sh index 6602844a..1dc00baf 100644 --- a/buildrel/make_release_client_win10_msys_0_cmake.sh +++ b/buildrel/make_release_client_win10_msys_0_cmake.sh @@ -18,7 +18,7 @@ cmake .. -G"Ninja" \ -DCMAKE_CXX_FLAGS="\ -fuse-ld=lld \ -Wall -Wextra -Wpedantic -Wno-braced-scalar-init \ - -Wno-pragmas -Wno-missing-field-initializers \ + -Wno-pragmas -Wno-missing-field-initializers -Wno-array-bounds -Wno-restrict \ -Wno-stringop-overflow \ -O3 -DNDEBUG \ -frounding-math -fsignaling-nans -ffloat-store -ffp-contract=off \ diff --git a/include/SSVOpenHexagon/Components/CCustomWall.hpp b/include/SSVOpenHexagon/Components/CCustomWall.hpp index 1094ccad..a8c1ae0d 100644 --- a/include/SSVOpenHexagon/Components/CCustomWall.hpp +++ b/include/SSVOpenHexagon/Components/CCustomWall.hpp @@ -61,8 +61,10 @@ public: [[nodiscard, gnu::always_inline]] bool isOverlapping( const sf::Vector2f& point) const noexcept { - // TODO: use quadrilateral optimization here? - return Utils::pointInPolygon(_vertexPositions, point.x, point.y); + // Cannot use `pointInFourVertexPolygon` here due to vertex ordering + // requirements. + + return Utils::pointInPolygon<4>(_vertexPositions, point.x, point.y); } [[gnu::always_inline]] void setVertexPos( diff --git a/include/SSVOpenHexagon/Components/CPlayer.hpp b/include/SSVOpenHexagon/Components/CPlayer.hpp index 61c14c9e..3caab52f 100644 --- a/include/SSVOpenHexagon/Components/CPlayer.hpp +++ b/include/SSVOpenHexagon/Components/CPlayer.hpp @@ -21,15 +21,15 @@ class CCustomWall; class CPlayer { private: - sf::Vector2f _startPos; // Position at start of the level. + sf::Vector2f _startPos; // Position at start of the level. - sf::Vector2f _pos; // Actual position of player. + sf::Vector2f _pos; // Actual position of player. sf::Vector2f _prePushPos; // Position before the player is pushed by a wall. // Unlike `pos` it is not updated after a // successful wall push. - sf::Vector2f _lastPos; // Position of the player in the previous frame, + sf::Vector2f _lastPos; // Position of the player in the previous frame, // adjusted according to the current frame's radius. float _hue; @@ -42,12 +42,12 @@ private: bool _dead; bool _justSwapped; - bool _forcedMove; // Wherever player has been forcefully moved - // with a setPlayerAngle() call. Essential - // for proper behavior of collision calculation, - // especially on levels that make heavy usage of it. + bool _forcedMove; // Wherever player has been forcefully moved + // with a setPlayerAngle() call. Essential + // for proper behavior of collision calculation, + // especially on levels that make heavy usage of it. - float _radius; // Cached value of the radius in the current frame. + float _radius; // Cached value of the radius in the current frame. float _maxSafeDistance; // The maximum distance that there can be between // the current player position and the closest @@ -55,7 +55,7 @@ private: // overlaps with. If the closest position is further // away player cannot be saved. - float _currentSpeed; // Cached player speed in the current frame. + float _currentSpeed; // Cached player speed in the current frame. float _triangleWidth; // Visual width of the triangle, varies when focusing. float _triangleWidthTransitionTime; // From 0 to 1, when transitioning diff --git a/include/SSVOpenHexagon/Core/Replay.hpp b/include/SSVOpenHexagon/Core/Replay.hpp index d4628ba3..7dd78a49 100644 --- a/include/SSVOpenHexagon/Core/Replay.hpp +++ b/include/SSVOpenHexagon/Core/Replay.hpp @@ -146,6 +146,8 @@ struct replay_file [[nodiscard]] bool deserialize_from_packet(sf::Packet& p); [[nodiscard]] std::string create_filename() const; + + [[nodiscard]] double played_seconds() const noexcept; }; struct compressed_replay_file diff --git a/include/SSVOpenHexagon/Data/CapColor.hpp b/include/SSVOpenHexagon/Data/CapColor.hpp index 1c6df3e5..7e999da0 100644 --- a/include/SSVOpenHexagon/Data/CapColor.hpp +++ b/include/SSVOpenHexagon/Data/CapColor.hpp @@ -6,7 +6,7 @@ #include "SSVOpenHexagon/Data/ColorData.hpp" -#include <variant> +#include "SSVOpenHexagon/Utils/TinyVariant.hpp" namespace Json { class Value; @@ -28,11 +28,11 @@ struct ByIndex { int _index; }; } // namespace CapColorMode -using CapColor = std::variant< // - CapColorMode::Main, // - CapColorMode::MainDarkened, // - CapColorMode::ByIndex, // - ColorData // +using CapColor = vittorioromeo::tinyvariant< // + CapColorMode::Main, // + CapColorMode::MainDarkened, // + CapColorMode::ByIndex, // + ColorData // >; [[nodiscard]] CapColor parseCapColor(const ssvuj::Obj& obj) noexcept; diff --git a/include/SSVOpenHexagon/Global/Assert.hpp b/include/SSVOpenHexagon/Global/Assert.hpp index b34c9dc6..73c7b98a 100644 --- a/include/SSVOpenHexagon/Global/Assert.hpp +++ b/include/SSVOpenHexagon/Global/Assert.hpp @@ -4,8 +4,6 @@ #pragma once -#include <SSVUtils/Core/Common/LikelyUnlikely.hpp> - #include <vrm/pp/sep_to_str.hpp> namespace hg::Impl { @@ -23,7 +21,7 @@ namespace hg::Impl { constexpr const char* assert_code = \ VRM_PP_SEP_TOSTR(" ", VRM_PP_EMPTY(), __VA_ARGS__); \ \ - if(SSVU_UNLIKELY(!static_cast<bool>(__VA_ARGS__))) \ + if(!static_cast<bool>(__VA_ARGS__)) [[unlikely]] \ { \ ::hg::Impl::assertionFailure(assert_code, __FILE__, __LINE__); \ } \ diff --git a/include/SSVOpenHexagon/Global/Assets.hpp b/include/SSVOpenHexagon/Global/Assets.hpp index e4b07abc..601170e0 100644 --- a/include/SSVOpenHexagon/Global/Assets.hpp +++ b/include/SSVOpenHexagon/Global/Assets.hpp @@ -4,13 +4,9 @@ #pragma once -#include "SSVOpenHexagon/Data/ProfileData.hpp" -#include "SSVOpenHexagon/Data/LoadInfo.hpp" - #include "SSVOpenHexagon/Utils/UniquePtr.hpp" #include <cstddef> -#include <map> #include <optional> #include <string> #include <unordered_map> @@ -35,6 +31,8 @@ namespace Steam { class steam_manager; } +class ProfileData; +struct LoadInfo; class MusicData; class AssetStorage; struct LevelData; @@ -45,68 +43,8 @@ class StyleData; class HGAssets { private: - Steam::steam_manager* steamManager; - - bool levelsOnly{false}; - - Utils::UniquePtr<AssetStorage> assetStorage; - - std::unordered_map<std::string, LevelData> levelDatas; - std::unordered_map<std::string, std::vector<std::string>> - levelDataIdsByPack; - - std::unordered_map<std::string, PackData> packDatas; - - std::vector<PackInfo> packInfos; - std::vector<PackInfo> selectablePackInfos; - - std::unordered_map<std::string, std::string> musicPathMap; - std::map<std::string, MusicData> musicDataMap; - std::map<std::string, StyleData> styleDataMap; - std::map<std::string, ProfileData> profileDataMap; - ProfileData* currentProfilePtr{nullptr}; - - std::unordered_set<std::string> packIdsWithMissingDependencies; - - struct LoadedShader; - - std::unordered_map<std::string, LoadedShader> shaders; - std::unordered_map<std::string, std::size_t> shadersPathToId; - std::vector<sf::Shader*> shadersById; - - std::string buf; - - std::unordered_map<std::string, std::string> luaFileCache; - LoadInfo loadInfo; - - template <typename... Ts> - [[nodiscard]] std::string& concatIntoBuf(const Ts&...); - - [[nodiscard]] bool loadAllPackDatas(); - [[nodiscard]] bool loadAllPackAssets(const bool headless); - [[nodiscard]] bool loadWorkshopPackDatasFromCache(); - [[nodiscard]] bool verifyAllPackDependencies(); - [[nodiscard]] bool loadAllLocalProfiles(); - - [[nodiscard]] bool loadPackData(const ssvufs::Path& packPath); - - [[nodiscard]] bool loadPackAssets( - const PackData& packData, const bool headless); - - void loadPackAssets_loadShaders(const std::string& mPackId, - const ssvufs::Path& mPath, const bool headless); - void loadPackAssets_loadMusic( - const std::string& mPackId, const ssvufs::Path& mPath); - void loadPackAssets_loadMusicData( - const std::string& mPackId, const ssvufs::Path& mPath); - void loadPackAssets_loadStyleData( - const std::string& mPackId, const ssvufs::Path& mPath); - void loadPackAssets_loadLevelData( - const std::string& mPackId, const ssvufs::Path& mPath); - void loadPackAssets_loadCustomSounds( - const std::string& mPackId, const ssvufs::Path& mPath); - - [[nodiscard]] std::string getCurrentLocalProfileFilePath(); + class HGAssetsImpl; + Utils::UniquePtr<HGAssetsImpl> _impl; public: HGAssets(Steam::steam_manager* mSteamManager, bool mHeadless, @@ -114,10 +52,6 @@ public: ~HGAssets(); - // When the Steam API can not be retrieved, this set holds pack ids - // retrieved from the cache to try and load the workshop packs installed - std::unordered_set<std::string> cachedWorkshopPackIds; - [[nodiscard]] LoadInfo& getLoadResults(); [[nodiscard]] sf::Texture& getTexture(const std::string& mId); diff --git a/include/SSVOpenHexagon/Global/Config.hpp b/include/SSVOpenHexagon/Global/Config.hpp index a5db07f8..1024da5f 100644 --- a/include/SSVOpenHexagon/Global/Config.hpp +++ b/include/SSVOpenHexagon/Global/Config.hpp @@ -158,7 +158,7 @@ void setDisableGameRendering(bool x); [[nodiscard]] const std::string& getServerIp(); [[nodiscard]] unsigned short getServerPort(); [[nodiscard]] unsigned short getServerControlPort(); -[[nodiscard]] const std::vector<std::string> getServerLevelWhitelist(); +[[nodiscard]] const std::vector<std::string>& getServerLevelWhitelist(); [[nodiscard]] bool getSaveLastLoginUsername(); [[nodiscard]] const std::string& getLastLoginUsername(); [[nodiscard]] bool getShowLoginAtStartup(); @@ -218,8 +218,7 @@ void clearTriggerBind(ssvs::Input::Trigger& trig, const int index); void joystickBindsSanityCheck(); -[[nodiscard]] const std::string getJoystickBindNames( - const Joystick::Jid bindID); +[[nodiscard]] std::string getJoystickBindName(const Joystick::Jid bindID); using JoystickTriggerGetter = unsigned int (*)(); extern const std::array<JoystickTriggerGetter, diff --git a/include/SSVOpenHexagon/Global/PCH.hpp b/include/SSVOpenHexagon/Global/PCH.hpp index a28f3f14..8794d8cc 100644 --- a/include/SSVOpenHexagon/Global/PCH.hpp +++ b/include/SSVOpenHexagon/Global/PCH.hpp @@ -144,7 +144,6 @@ #include <SSVUtils/Core/Common/Common.hpp> #include <SSVUtils/Core/Common/Frametime.hpp> -#include <SSVUtils/Core/Common/LikelyUnlikely.hpp> #include <SSVUtils/Core/FileSystem/FileSystem.hpp> #include <SSVUtils/Core/Log/Log.hpp> #include <SSVUtils/Core/Utils/Containers.hpp> @@ -198,6 +197,7 @@ extern template class std::vector<std::string>; extern template class std::optional<int>; extern template class std::optional<std::size_t>; +extern template class std::optional<std::string>; extern template class std::unordered_map<std::string, float>; extern template class std::unordered_map<float, std::string>; diff --git a/include/SSVOpenHexagon/Online/Database.hpp b/include/SSVOpenHexagon/Online/Database.hpp index d9638c23..b28a10ba 100644 --- a/include/SSVOpenHexagon/Online/Database.hpp +++ b/include/SSVOpenHexagon/Online/Database.hpp @@ -10,7 +10,6 @@ #include <cstdint> #include <optional> #include <vector> -#include <chrono> // TODO (P2): remove reliance on steam ID for future platforms diff --git a/include/SSVOpenHexagon/SSVUtilsJson/JsonCpp/jsoncpp.inl b/include/SSVOpenHexagon/SSVUtilsJson/JsonCpp/jsoncpp.inl index 43fb4d95..461959e7 100644 --- a/include/SSVOpenHexagon/SSVUtilsJson/JsonCpp/jsoncpp.inl +++ b/include/SSVOpenHexagon/SSVUtilsJson/JsonCpp/jsoncpp.inl @@ -1780,9 +1780,11 @@ inline void Path::addPathInArg(const std::string&, const InArgs& in, InArgs::const_iterator& itInArg, PathArgument::Kind kind) { if(itInArg == in.end()) - {} + { + } else if((*itInArg)->kind_ != kind) - {} + { + } else args_.emplace_back(**itInArg); } diff --git a/include/SSVOpenHexagon/Utils/Concat.hpp b/include/SSVOpenHexagon/Utils/Concat.hpp index a77f317b..b4443671 100644 --- a/include/SSVOpenHexagon/Utils/Concat.hpp +++ b/include/SSVOpenHexagon/Utils/Concat.hpp @@ -58,7 +58,8 @@ template <std::size_t N> { const char* end = s; while(*end++ != 0) - {} + { + } return end - s - 1; } diff --git a/include/SSVOpenHexagon/Utils/FastVertexVector.hpp b/include/SSVOpenHexagon/Utils/FastVertexVector.hpp index 96a47979..3ad9670f 100644 --- a/include/SSVOpenHexagon/Utils/FastVertexVector.hpp +++ b/include/SSVOpenHexagon/Utils/FastVertexVector.hpp @@ -15,8 +15,6 @@ #include <SFML/Graphics/RenderTarget.hpp> #include <SFML/Graphics/Vertex.hpp> -#include <SSVUtils/Core/Common/LikelyUnlikely.hpp> - #include <cstddef> #include <cstring> @@ -51,14 +49,14 @@ public: void reserve(const std::size_t n) { - if(SSVU_LIKELY(_capacity >= n)) + if(_capacity >= n) [[likely]] { return; } auto new_data = Utils::makeUniqueArray<VertexUnion>(n); - if(SSVU_UNLIKELY(_data != nullptr)) + if(_data != nullptr) [[unlikely]] { std::memcpy( new_data.get(), _data.get(), sizeof(sf::Vertex) * _size); @@ -69,7 +67,7 @@ public: SSVOH_ASSERT(_capacity == 0); } - _data = std::move(new_data); + _data = SSVOH_MOVE(new_data); _capacity = n; } @@ -78,7 +76,7 @@ public: { SSVOH_ASSERT(_size + rhs._size <= _capacity); - if(SSVU_UNLIKELY(rhs.size() == 0)) + if(rhs.size() == 0) [[unlikely]] { return; } @@ -123,7 +121,7 @@ public: void draw(sf::RenderTarget& mRenderTarget, const sf::RenderStates& mRenderStates) const override { - if(SSVU_UNLIKELY(_data == nullptr)) + if(_data == nullptr) [[unlikely]] { SSVOH_ASSERT(_size == 0); SSVOH_ASSERT(_capacity == 0); diff --git a/include/SSVOpenHexagon/Utils/LuaMetadataProxy.hpp b/include/SSVOpenHexagon/Utils/LuaMetadataProxy.hpp index b3c7d7bd..9fbdbd9f 100644 --- a/include/SSVOpenHexagon/Utils/LuaMetadataProxy.hpp +++ b/include/SSVOpenHexagon/Utils/LuaMetadataProxy.hpp @@ -70,15 +70,14 @@ private: [&]<std::size_t... Is>(std::index_sequence<Is...>) { - (( // + (( // res += typeToStr(TypeWrapper< std::decay_t<typename AE::template NthArg<Is>>>{}), // res += ' ', // res += self->argNames.at(Is), // res += ", "), ...); - } - (std::make_index_sequence<AE::numArgs>{}); + }(std::make_index_sequence<AE::numArgs>{}); res.pop_back(); res.pop_back(); diff --git a/include/SSVOpenHexagon/Utils/LuaWrapper.hpp b/include/SSVOpenHexagon/Utils/LuaWrapper.hpp index a05e56e0..69de1f8a 100644 --- a/include/SSVOpenHexagon/Utils/LuaWrapper.hpp +++ b/include/SSVOpenHexagon/Utils/LuaWrapper.hpp @@ -919,11 +919,9 @@ private: template <typename... Args> [[gnu::always_inline]] inline int _push(const std::tuple<Args...>& t) { - return [ this, &t ]<int... Is>(std::integer_sequence<int, Is...>) - { + return [this, &t]<int... Is>(std::integer_sequence<int, Is...>) { return (this->_push(std::get<Is>(t)) + ... + 0); - } - (std::make_integer_sequence<int, sizeof...(Args)>{}); + }(std::make_integer_sequence<int, sizeof...(Args)>{}); } /**************************************************/ @@ -1099,12 +1097,11 @@ return table;*/ [[gnu::always_inline]] inline auto _read( const int index, std::tuple<Ts...> const* = nullptr) { - return [ this, index ]<int... Is>(std::integer_sequence<int, Is...>) + return [this, index]<int... Is>(std::integer_sequence<int, Is...>) { return std::make_tuple(this->_read( index + Is, static_cast<std::decay_t<Ts>*>(nullptr))...); - } - (std::make_integer_sequence<int, sizeof...(Ts)>{}); + }(std::make_integer_sequence<int, sizeof...(Ts)>{}); } [[gnu::always_inline]] inline constexpr std::tuple<> _read( diff --git a/include/SSVOpenHexagon/Utils/PointInPolygon.hpp b/include/SSVOpenHexagon/Utils/PointInPolygon.hpp index 8614fdd1..01b7ca09 100644 --- a/include/SSVOpenHexagon/Utils/PointInPolygon.hpp +++ b/include/SSVOpenHexagon/Utils/PointInPolygon.hpp @@ -5,16 +5,16 @@ #pragma once #include <SFML/System/Vector2.hpp> + namespace hg::Utils { -template <typename TC, typename T> +template <std::size_t N, typename TC, typename T> [[gnu::always_inline, gnu::pure, nodiscard]] inline bool pointInPolygon( - const TC& mVertices, T x, T y) noexcept + const TC& mVertices, const T x, const T y) noexcept { bool result{false}; - const auto size{mVertices.size()}; - for(decltype(size) i{0}, j{size - 1}; i < size; j = i++) + for(std::size_t i{0}, j{N - 1}; i < N; j = i++) { const auto& vI{mVertices[i]}; const auto& vJ{mVertices[j]}; @@ -29,6 +29,7 @@ template <typename TC, typename T> return result; } + [[gnu::always_inline, gnu::pure, nodiscard]] inline bool pointInFourVertexPolygon(const sf::Vector2f& a, const sf::Vector2f& b, const sf::Vector2f& c, const sf::Vector2f& d, diff --git a/include/SSVOpenHexagon/Utils/TinyVariant.hpp b/include/SSVOpenHexagon/Utils/TinyVariant.hpp new file mode 100644 index 00000000..e7edd326 --- /dev/null +++ b/include/SSVOpenHexagon/Utils/TinyVariant.hpp @@ -0,0 +1,738 @@ +#pragma once + +#include <cassert> +#include <cstdint> // TODO: remove dependency? +#include <initializer_list> // TODO: remove dependency? +#include <new> // TODO: remove dependency? + +#if ((__GNUC__ >= 10) || defined(__clang__)) && !defined(_MSC_VER) +#define TINYVARIANT_SUPPORTS_HAS_BUILTIN +#endif + +#ifdef TINYVARIANT_SUPPORTS_HAS_BUILTIN +#if __has_builtin(__make_integer_seq) +#define TINYVARIANT_USE_MAKE_INTEGER_SEQ +#elif __has_builtin(__integer_pack) +#define TINYVARIANT_USE_INTEGER_PACK +#else +#define TINYVARIANT_USE_STD_INDEX_SEQUENCE +#endif +#else +#define TINYVARIANT_USE_STD_INDEX_SEQUENCE +#endif + +#ifdef TINYVARIANT_USE_STD_INDEX_SEQUENCE +#include <utility> +#endif + +namespace vittorioromeo::impl { + +template <typename T> +T&& declval(); + +template <typename...> +struct common_type_between; + +template <typename T> +struct common_type_between<T> +{ + using type = T; +}; + +template <typename T> +struct common_type_between<T, T> +{ + using type = T; +}; + +template <typename T, typename U, typename... Rest> +struct common_type_between<T, U, Rest...> +{ + using type = typename common_type_between< + decltype(true ? declval<T>() : declval<U>()), Rest...>::type; +}; + +using sz_t = decltype(sizeof(int)); + +#ifdef TINYVARIANT_USE_STD_INDEX_SEQUENCE + +template <sz_t... Is> +using index_sequence = std::index_sequence<Is...>; + +#else + +template <sz_t...> +struct index_sequence +{}; + +#endif + +#ifdef TINYVARIANT_USE_MAKE_INTEGER_SEQ + +template <typename, sz_t... X> +struct index_sequence_helper +{ + using type = index_sequence<X...>; +}; + +template <sz_t N> +using index_sequence_up_to = + typename __make_integer_seq<index_sequence_helper, sz_t, N>::type; + +#elif defined(TINYVARIANT_USE_INTEGER_PACK) + +template <sz_t N> +using index_sequence_up_to = index_sequence<__integer_pack(N)...>; + +#elif defined(TINYVARIANT_USE_STD_INDEX_SEQUENCE) + +template <sz_t N> +using index_sequence_up_to = std::make_index_sequence<N>; + +#else + +#error "No integer sequence generation available." + +#endif + +template <typename, typename> +inline constexpr bool is_same_type = false; + +template <typename T> +inline constexpr bool is_same_type<T, T> = true; + +template <typename T> +[[nodiscard, gnu::always_inline]] constexpr T variadic_max( + std::initializer_list<T> il) noexcept +{ + T result = 0; + + for(T value : il) + { + if(value > result) + { + result = value; + } + } + + return result; +} + +template <sz_t N> +[[nodiscard, gnu::always_inline]] constexpr auto +smallest_int_type_for() noexcept +{ + if constexpr(N <= UINT8_MAX) + { + return std::uint8_t{}; + } + else if constexpr(N <= UINT16_MAX) + { + return std::uint16_t{}; + } + else if constexpr(N <= UINT32_MAX) + { + return std::uint32_t{}; + } + else if constexpr(N <= UINT64_MAX) + { + return std::uint64_t{}; + } + else + { + struct fail; + return fail{}; + } +} + +enum : sz_t +{ + bad_index = static_cast<sz_t>(-1) +}; + +template <typename T, typename... Ts> +[[nodiscard, gnu::always_inline]] constexpr sz_t index_of() noexcept +{ + constexpr bool matches[]{is_same_type<T, Ts>...}; + + for(sz_t i = 0; i < sizeof...(Ts); ++i) + { + if(matches[i]) + { + return i; + } + } + + return bad_index; +}; + +template <typename T> +struct type_wrapper +{ + using type = T; +}; + +template <sz_t N, typename T0 = void, typename T1 = void, typename T2 = void, + typename T3 = void, typename T4 = void, typename T5 = void, + typename T6 = void, typename T7 = void, typename T8 = void, + typename T9 = void, typename... Ts> +[[nodiscard, gnu::always_inline]] constexpr auto type_at_impl() noexcept +{ + // clang-format off + if constexpr(N == 0) { return type_wrapper<T0>{}; } + else if constexpr(N == 1) { return type_wrapper<T1>{}; } + else if constexpr(N == 2) { return type_wrapper<T2>{}; } + else if constexpr(N == 3) { return type_wrapper<T3>{}; } + else if constexpr(N == 4) { return type_wrapper<T4>{}; } + else if constexpr(N == 5) { return type_wrapper<T5>{}; } + else if constexpr(N == 6) { return type_wrapper<T6>{}; } + else if constexpr(N == 7) { return type_wrapper<T7>{}; } + else if constexpr(N == 8) { return type_wrapper<T8>{}; } + else if constexpr(N == 9) { return type_wrapper<T9>{}; } + else { return type_at_impl<N - 10, Ts...>(); } + // clang-format on +} + +template <sz_t N, typename... Ts> +using type_at = typename decltype(type_at_impl<N, Ts...>())::type; + +template <typename> +struct tinyvariant_inplace_type_t +{}; + +template <sz_t> +struct tinyvariant_inplace_index_t +{}; + +template <typename... Fs> +struct [[nodiscard]] overload_set : Fs... +{ + [[nodiscard, gnu::always_inline]] explicit overload_set(Fs&&... fs) noexcept + : Fs{static_cast<Fs&&>(fs)}... + {} + + using Fs::operator()...; +}; + +template <typename... Fs> +overload_set(Fs...) -> overload_set<Fs...>; + +template <typename T> +struct uncvref +{ + using type = T; +}; +template <typename T> +struct uncvref<T&> +{ + using type = T; +}; +template <typename T> +struct uncvref<T&&> +{ + using type = T; +}; +template <typename T> +struct uncvref<const T&> +{ + using type = T; +}; +template <typename T> +struct uncvref<const T&&> +{ + using type = T; +}; + +template <typename T> +using uncvref_t = typename uncvref<T>::type; + +template <typename T> +static constexpr bool is_reference = false; + +template <typename T> +static constexpr bool is_reference<T&> = true; + +template <typename T> +static constexpr bool is_reference<T&&> = true; + +struct void_type +{}; + +template <typename T> +struct regularize_void +{ + using type = T; +}; + +template <> +struct regularize_void<void> +{ + using type = void_type; +}; + +template <typename T> +using regularize_void_t = typename regularize_void<T>::type; + +template <typename... Ts> +using common_type_between_t = typename common_type_between<Ts...>::type; + +} // namespace vittorioromeo::impl + +namespace vittorioromeo { + +template <typename T> +inline constexpr impl::tinyvariant_inplace_type_t<T> tinyvariant_inplace_type{}; + +template <impl::sz_t N> +inline constexpr impl::tinyvariant_inplace_index_t<N> + tinyvariant_inplace_index{}; + +template <typename... Alternatives> +class [[nodiscard]] tinyvariant +{ +private: + using byte = unsigned char; + + enum : impl::sz_t + { + type_count = sizeof...(Alternatives), + max_alignment = impl::variadic_max({alignof(Alternatives)...}), + max_size = impl::variadic_max({sizeof(Alternatives)...}) + }; + + using index_type = decltype(impl::smallest_int_type_for<type_count>()); + + template <impl::sz_t I> + using nth_type = impl::type_at<I, Alternatives...>; + + template <typename T> + static constexpr impl::sz_t index_of = impl::index_of<T, Alternatives...>(); + + static constexpr impl::index_sequence_up_to<type_count> + alternative_index_sequence{}; + + alignas(max_alignment) byte _buffer[max_size]; + index_type _index; + +#if defined(__GNUC__) && !defined(__clang__) && (__GNUC__ >= 10) +#define TINYVARIANT_ALWAYS_INLINE_LAMBDA [[gnu::always_inline]] +#else +#define TINYVARIANT_ALWAYS_INLINE_LAMBDA +#endif + +#define TINYVARIANT_STATIC_ASSERT_INDEX_VALIDITY(I) \ + static_assert( \ + (I) != impl::bad_index, "Alternative type not supported by variant"); \ + \ + static_assert( \ + (I) >= 0 && (I) < type_count, "Alternative index out of range") + +#define TINYVARIANT_DO_WITH_CURRENT_INDEX_OBJ(obj, Is, ...) \ + do \ + { \ + if constexpr(sizeof...(Alternatives) == 1) \ + { \ + if(constexpr impl::sz_t Is = 0; (obj)._index == Is) \ + { \ + __VA_ARGS__; \ + } \ + } \ + else if constexpr(sizeof...(Alternatives) == 2) \ + { \ + if(constexpr impl::sz_t Is = 0; (obj)._index == Is) \ + { \ + __VA_ARGS__; \ + } \ + else if(constexpr impl::sz_t Is = 1; (obj)._index == Is) \ + { \ + __VA_ARGS__; \ + } \ + } \ + else \ + { \ + [&]<impl::sz_t... Is>(impl::index_sequence<Is...>) \ + TINYVARIANT_ALWAYS_INLINE_LAMBDA { \ + ((((obj)._index == Is) ? ((__VA_ARGS__), 0) : 0), ...); \ + }(alternative_index_sequence); \ + } \ + } \ + while(false) + +#define TINYVARIANT_DO_WITH_CURRENT_INDEX(Is, ...) \ + TINYVARIANT_DO_WITH_CURRENT_INDEX_OBJ((*this), Is, __VA_ARGS__) + + template <typename T, impl::sz_t I, typename... Args> + [[nodiscard, gnu::always_inline]] explicit tinyvariant( + impl::tinyvariant_inplace_type_t<T>, + impl::tinyvariant_inplace_index_t<I>, Args&&... args) noexcept + : _index{static_cast<index_type>(I)} + { + TINYVARIANT_STATIC_ASSERT_INDEX_VALIDITY(I); + new(_buffer) T{static_cast<Args&&>(args)...}; + } + + template <impl::sz_t I> + [[gnu::always_inline]] void destroy_at() noexcept + { + as<nth_type<I>>().~nth_type<I>(); + } + + template <impl::sz_t I, typename R, typename Visitor> + [[nodiscard, gnu::always_inline]] R recursive_visit_impl(Visitor&& visitor) + { + if constexpr(I < sizeof...(Alternatives) - 1) + { + return (_index == I) ? visitor(get_by_index<I>()) + : recursive_visit_impl<I + 1, R>( + static_cast<Visitor&&>(visitor)); + } + else + { + return visitor(get_by_index<I>()); + } + } + + template <impl::sz_t I, typename R, typename Visitor> + [[nodiscard, gnu::always_inline]] R recursive_visit_opt5_impl( + Visitor&& visitor) + { + if constexpr(I == 0 && sizeof...(Alternatives) == 5) + { + // clang-format off + return (_index == I + 0) ? visitor(get_by_index<I + 0>()) : + (_index == I + 1) ? visitor(get_by_index<I + 1>()) : + (_index == I + 2) ? visitor(get_by_index<I + 2>()) : + (_index == I + 3) ? visitor(get_by_index<I + 3>()) : + visitor(get_by_index<I + 4>()) ; + // clang-format on + } + else if constexpr(I + 4 < sizeof...(Alternatives)) + { + // clang-format off + return (_index == I + 0) ? visitor(get_by_index<I + 0>()) : + (_index == I + 1) ? visitor(get_by_index<I + 1>()) : + (_index == I + 2) ? visitor(get_by_index<I + 2>()) : + (_index == I + 3) ? visitor(get_by_index<I + 3>()) : + (_index == I + 4) ? visitor(get_by_index<I + 4>()) : + recursive_visit_opt5_impl<I + 5, R>(static_cast<Visitor&&>(visitor)); + // clang-format on + } + else + { + return recursive_visit_impl<I, R>(static_cast<Visitor&&>(visitor)); + } + } + + template <impl::sz_t I, typename R, typename Visitor> + [[nodiscard, gnu::always_inline]] R recursive_visit_opt10_impl( + Visitor&& visitor) + { + if constexpr(I + 9 < sizeof...(Alternatives)) + { + // clang-format off + return (_index == I + 0) ? visitor(get_by_index<I + 0>()) : + (_index == I + 1) ? visitor(get_by_index<I + 1>()) : + (_index == I + 2) ? visitor(get_by_index<I + 2>()) : + (_index == I + 3) ? visitor(get_by_index<I + 3>()) : + (_index == I + 4) ? visitor(get_by_index<I + 4>()) : + (_index == I + 5) ? visitor(get_by_index<I + 5>()) : + (_index == I + 6) ? visitor(get_by_index<I + 6>()) : + (_index == I + 7) ? visitor(get_by_index<I + 7>()) : + (_index == I + 8) ? visitor(get_by_index<I + 8>()) : + (_index == I + 9) ? visitor(get_by_index<I + 9>()) : + recursive_visit_opt10_impl<I + 10, R>(static_cast<Visitor&&>(visitor)); + // clang-format on + } + else + { + return recursive_visit_opt5_impl<I, R>( + static_cast<Visitor&&>(visitor)); + } + } + +public: + template <typename T, typename... Args> + [[nodiscard, gnu::always_inline]] explicit tinyvariant( + impl::tinyvariant_inplace_type_t<T> inplace_type, + Args&&... args) noexcept + : tinyvariant{inplace_type, tinyvariant_inplace_index<index_of<T>>, + static_cast<Args&&>(args)...} + {} + + template <impl::sz_t I, typename... Args> + [[nodiscard, gnu::always_inline]] explicit tinyvariant( + impl::tinyvariant_inplace_index_t<I> inplace_index, + Args&&... args) noexcept + : tinyvariant{tinyvariant_inplace_type<nth_type<I>>, inplace_index, + static_cast<Args&&>(args)...} + {} + + template <typename T> + [[nodiscard, gnu::always_inline]] explicit tinyvariant(T&& x) noexcept + : tinyvariant{tinyvariant_inplace_type<T>, static_cast<T&&>(x)} + {} + + [[nodiscard, gnu::always_inline]] explicit tinyvariant() noexcept + : tinyvariant{tinyvariant_inplace_index<0>} + {} + + [[gnu::always_inline]] tinyvariant(const tinyvariant& rhs) + : _index{rhs._index} + { + TINYVARIANT_DO_WITH_CURRENT_INDEX( + I, new(_buffer) nth_type<I>(static_cast<const nth_type<I>&>( + *reinterpret_cast<const nth_type<I>*>(rhs._buffer)))); + } + + [[gnu::always_inline]] tinyvariant(tinyvariant&& rhs) noexcept + : _index{rhs._index} + { + TINYVARIANT_DO_WITH_CURRENT_INDEX( + I, new(_buffer) nth_type<I>(static_cast<nth_type<I>&&>( + *reinterpret_cast<nth_type<I>*>(rhs._buffer)))); + } + + // Avoid forwarding constructor hijack. + [[gnu::always_inline]] tinyvariant(const tinyvariant&& rhs) noexcept + : tinyvariant{static_cast<const tinyvariant&>(rhs)} + {} + + // Avoid forwarding constructor hijack. + [[gnu::always_inline]] tinyvariant(tinyvariant& rhs) + : tinyvariant{static_cast<const tinyvariant&>(rhs)} + {} + + [[gnu::always_inline]] ~tinyvariant() + { + TINYVARIANT_DO_WITH_CURRENT_INDEX(I, destroy_at<I>()); + } + + [[gnu::always_inline]] tinyvariant& operator=(const tinyvariant& rhs) + { + if(this == &rhs) + { + return *this; + } + + TINYVARIANT_DO_WITH_CURRENT_INDEX(I, destroy_at<I>()); + + TINYVARIANT_DO_WITH_CURRENT_INDEX_OBJ( + rhs, I, (new(_buffer) nth_type<I>(rhs.template as<nth_type<I>>()))); + _index = rhs._index; + + return *this; + } + + [[gnu::always_inline]] tinyvariant& operator=(tinyvariant& rhs) + { + return ((*this) = static_cast<const tinyvariant&>(rhs)); + } + + [[gnu::always_inline]] tinyvariant& operator=(tinyvariant&& rhs) noexcept + { + TINYVARIANT_DO_WITH_CURRENT_INDEX(I, destroy_at<I>()); + + TINYVARIANT_DO_WITH_CURRENT_INDEX_OBJ(rhs, I, + (new(_buffer) nth_type<I>( + static_cast<nth_type<I>&&>(rhs.template as<nth_type<I>>())))); + _index = rhs._index; + + return *this; + } + + [[gnu::always_inline]] tinyvariant& operator=(const tinyvariant&& rhs) + { + return ((*this) = static_cast<const tinyvariant&>(rhs)); + } + + template <typename T> + [[gnu::always_inline]] tinyvariant& operator=(T&& x) + { + TINYVARIANT_DO_WITH_CURRENT_INDEX(I, destroy_at<I>()); + + using type = impl::uncvref_t<T>; + + new(_buffer) type{static_cast<T&&>(x)}; + _index = index_of<type>; + + return *this; + } + + template <typename T> + [[nodiscard, gnu::always_inline]] bool is() const noexcept + { + return _index == index_of<T>; + } + + [[nodiscard, gnu::always_inline]] bool has_index( + index_type index) const noexcept + { + return _index == index; + } + + template <typename T> + [[nodiscard, gnu::always_inline]] T& as() & noexcept + { + return *(reinterpret_cast<T*>(_buffer)); + } + + template <typename T> + [[nodiscard, gnu::always_inline]] const T& as() const& noexcept + { + return *(reinterpret_cast<const T*>(_buffer)); + } + + template <typename T> + [[nodiscard, gnu::always_inline]] T&& as() && noexcept + { + return static_cast<T&&>(*(reinterpret_cast<T*>(_buffer))); + } + + template <impl::sz_t I> + [[nodiscard, gnu::always_inline]] auto& get_by_index() & noexcept + { + TINYVARIANT_STATIC_ASSERT_INDEX_VALIDITY(I); + return as<nth_type<I>>(); + } + + template <impl::sz_t I> + [[nodiscard, gnu::always_inline]] const auto& get_by_index() const& noexcept + { + TINYVARIANT_STATIC_ASSERT_INDEX_VALIDITY(I); + return as<nth_type<I>>(); + } + + template <impl::sz_t I> + [[nodiscard, gnu::always_inline]] auto&& get_by_index() && noexcept + { + TINYVARIANT_STATIC_ASSERT_INDEX_VALIDITY(I); + return static_cast<nth_type<I>&&>(as<nth_type<I>>()); + } + + template <typename Visitor, typename R = decltype(impl::declval<Visitor>()( + impl::declval<nth_type<0>>()))> + [[nodiscard, gnu::always_inline]] R recursive_visit(Visitor&& visitor) & + { + if constexpr(sizeof...(Alternatives) >= 10) + { + return recursive_visit_opt10_impl<0, R>( + static_cast<Visitor&&>(visitor)); + } + else if constexpr(sizeof...(Alternatives) >= 5) + { + return recursive_visit_opt5_impl<0, R>( + static_cast<Visitor&&>(visitor)); + } + else + { + return recursive_visit_impl<0, R>(static_cast<Visitor&&>(visitor)); + } + } + + template <typename Visitor, typename R = decltype(impl::declval<Visitor>()( + impl::declval<nth_type<0>>()))> + [[nodiscard, gnu::always_inline]] R recursive_visit( + Visitor&& visitor) const& + { + if constexpr(sizeof...(Alternatives) >= 10) + { + return recursive_visit_opt10_impl<0, R>( + static_cast<Visitor&&>(visitor)); + } + else if constexpr(sizeof...(Alternatives) >= 5) + { + return recursive_visit_opt5_impl<0, R>( + static_cast<Visitor&&>(visitor)); + } + else + { + return recursive_visit_impl<0, R>(static_cast<Visitor&&>(visitor)); + } + } + + template <typename... Fs> + [[nodiscard, gnu::always_inline]] auto recursive_match( + Fs&&... fs) & -> decltype(recursive_visit(impl::overload_set{ + static_cast<Fs&&>(fs)...})) + { + return recursive_visit(impl::overload_set{static_cast<Fs&&>(fs)...}); + } + + template <typename... Fs> + [[nodiscard, gnu::always_inline]] auto recursive_match( + Fs&&... fs) const& -> decltype(recursive_visit(impl::overload_set{ + static_cast<Fs&&>(fs)...})) + { + return recursive_visit(impl::overload_set{static_cast<Fs&&>(fs)...}); + } + + template <typename Visitor, typename R = decltype(impl::declval<Visitor>()( + impl::declval<nth_type<0>>()))> + [[nodiscard, gnu::always_inline]] R linear_visit(Visitor&& visitor) & + { + if constexpr(impl::is_reference<R>) + { + impl::uncvref_t<R>* ret; + TINYVARIANT_DO_WITH_CURRENT_INDEX( + I, ret = &(visitor(get_by_index<I>()))); + return static_cast<R>(*ret); + } + else + { + alignas(R) byte ret_buffer[sizeof(R)]; + + TINYVARIANT_DO_WITH_CURRENT_INDEX( + I, new(ret_buffer) R(visitor(get_by_index<I>()))); + + return *(reinterpret_cast<R*>(ret_buffer)); + } + } + + + template <typename Visitor, typename R = decltype(impl::declval<Visitor>()( + impl::declval<nth_type<0>>()))> + [[nodiscard, gnu::always_inline]] R linear_visit(Visitor&& visitor) const& + { + if constexpr(impl::is_reference<R>) + { + impl::uncvref_t<R>* ret; + TINYVARIANT_DO_WITH_CURRENT_INDEX( + I, ret = &(visitor(get_by_index<I>()))); + return static_cast<R>(*ret); + } + else + { + alignas(R) byte ret_buffer[sizeof(R)]; + + TINYVARIANT_DO_WITH_CURRENT_INDEX( + I, new(ret_buffer) R(visitor(get_by_index<I>()))); + + return *(reinterpret_cast<R*>(ret_buffer)); + } + } + + template <typename... Fs> + [[nodiscard, gnu::always_inline]] auto linear_match( + Fs&&... fs) & -> decltype(linear_visit(impl::overload_set{ + static_cast<Fs&&>(fs)...})) + { + return linear_visit(impl::overload_set{static_cast<Fs&&>(fs)...}); + } + + template <typename... Fs> + [[nodiscard, gnu::always_inline]] auto linear_match( + Fs&&... fs) const& -> decltype(linear_visit(impl::overload_set{ + static_cast<Fs&&>(fs)...})) + { + return linear_visit(impl::overload_set{static_cast<Fs&&>(fs)...}); + } +}; + +#undef TINYVARIANT_DO_WITH_CURRENT_INDEX +#undef TINYVARIANT_STATIC_ASSERT_INDEX_VALIDITY + +#undef TINYVARIANT_USE_STD_INDEX_SEQUENCE +#undef TINYVARIANT_USE_INTEGER_PACK +#undef TINYVARIANT_USE_MAKE_INTEGER_SEQ + +} // namespace vittorioromeo diff --git a/prepare_release.sh b/prepare_release.sh index da6e28e4..e25b74b4 100644 --- a/prepare_release.sh +++ b/prepare_release.sh @@ -19,25 +19,15 @@ mkdir -p ./_PREPARED_RELEASE/Profiles cp ./_RELEASE/SSVOpenHexagon.exe ./_PREPARED_RELEASE cp ./_RELEASE/SSVOpenHexagon-Console.exe ./_PREPARED_RELEASE -cp ./_RELEASE/libzlib1.dll ./_PREPARED_RELEASE -cp ./_RELEASE/openal32.dll ./_PREPARED_RELEASE -cp ./_RELEASE/sfml-audio-3.dll ./_PREPARED_RELEASE -cp ./_RELEASE/sfml-graphics-3.dll ./_PREPARED_RELEASE -cp ./_RELEASE/sfml-network-3.dll ./_PREPARED_RELEASE -cp ./_RELEASE/sfml-system-3.dll ./_PREPARED_RELEASE -cp ./_RELEASE/sfml-window-3.dll ./_PREPARED_RELEASE -cp ./_RELEASE/libImGui-SFML.dll ./_PREPARED_RELEASE -cp ./_RELEASE/libluajit.dll ./_PREPARED_RELEASE +cp ./_RELEASE/libzlib.dll ./_PREPARED_RELEASE +cp ./_RELEASE/libopenal-1.dll ./_PREPARED_RELEASE cp ./_RELEASE/steam_api64.dll ./_PREPARED_RELEASE cp ./_RELEASE/discord_game_sdk.dll ./_PREPARED_RELEASE -cp ./_RELEASE/libsodium.dll ./_PREPARED_RELEASE cp ./_RELEASE/sdkencryptedappticket64.dll ./_PREPARED_RELEASE - -cp ./_RELEASE/libssp-0.dll ./_PREPARED_RELEASE cp ./_RELEASE/libstdc++-6.dll ./_PREPARED_RELEASE cp ./_RELEASE/libgcc_s_seh-1.dll ./_PREPARED_RELEASE cp ./_RELEASE/libwinpthread-1.dll ./_PREPARED_RELEASE -cp ./_RELEASE/libopenal-1.dll ./_PREPARED_RELEASE +cp ./_RELEASE/libssp-0.dll ./_PREPARED_RELEASE cp ./_RELEASE/steam_appid.txt ./_PREPARED_RELEASE cp ./_RELEASE/windowed.bat ./_PREPARED_RELEASE @@ -50,8 +40,20 @@ cp ./_RELEASE/noaudio.bat ./_PREPARED_RELEASE cp ./_RELEASE/OHWorkshopUploader.exe ./_PREPARED_RELEASE cd ./_PREPARED_RELEASE -upx -9 ./*.dll -upx -9 ./*.exe + +echo "PACKING WITH UPX" + +for x in ./*.dll; do + upx -9 $x & +done + +for x in ./*.exe; do + upx -9 $x & +done + +wait +echo "DONE PACKING WITH UPX" + cd .. cp -r ./_PREPARED_RELEASE ./_PREPARED_RELEASE_TEST diff --git a/prepare_release_linux.sh b/prepare_release_linux.sh index 29fc7f76..ed81fef4 100755 --- a/prepare_release_linux.sh +++ b/prepare_release_linux.sh @@ -19,29 +19,36 @@ mkdir -p ./_PREPARED_RELEASE_LINUX/Profiles cp ./_RELEASE/SSVOpenHexagonLinux ./_PREPARED_RELEASE_LINUX cp ./_RELEASE/OHWorkshopUploaderLinux ./_PREPARED_RELEASE_LINUX -cp ./_RELEASE/libImGui-SFML.so ./_PREPARED_RELEASE_LINUX -cp ./_RELEASE/libdiscord_game_sdk.so ./_PREPARED_RELEASE_LINUX -cp ./_RELEASE/libluajit.so ./_PREPARED_RELEASE_LINUX cp ./_RELEASE/libsdkencryptedappticket.so ./_PREPARED_RELEASE_LINUX -cp ./_RELEASE/libsfml-audio.so.3.0 ./_PREPARED_RELEASE_LINUX -cp ./_RELEASE/libsfml-graphics.so.3.0 ./_PREPARED_RELEASE_LINUX -cp ./_RELEASE/libsfml-network.so.3.0 ./_PREPARED_RELEASE_LINUX -cp ./_RELEASE/libsfml-system.so.3.0 ./_PREPARED_RELEASE_LINUX -cp ./_RELEASE/libsfml-window.so.3.0 ./_PREPARED_RELEASE_LINUX -cp ./_RELEASE/libsodium.so ./_PREPARED_RELEASE_LINUX -cp ./_RELEASE/libstdc++.so.6 ./_PREPARED_RELEASE_LINUX +cp ./_RELEASE/libdiscord_game_sdk.so ./_PREPARED_RELEASE_LINUX cp ./_RELEASE/libsteam_api.so ./_PREPARED_RELEASE_LINUX cp ./_RELEASE/libz.so.1 ./_PREPARED_RELEASE_LINUX +cp /lib/x86_64-linux-gnu/libopenal.so.1 ./_PREPARED_RELEASE_LINUX +cp /lib/x86_64-linux-gnu/libFLAC.so.8 ./_PREPARED_RELEASE_LINUX +cp /lib/x86_64-linux-gnu/libsndio.so.7 ./_PREPARED_RELEASE_LINUX cp ./_RELEASE/steam_appid.txt ./_PREPARED_RELEASE_LINUX cp ./_RELEASE/run_ssvopenhexagon_linux.sh ./_PREPARED_RELEASE_LINUX cd ./_PREPARED_RELEASE_LINUX + chmod +x ./*.so -upx -9 ./*.so -upx -9 ./SSVOpenHexagonLinux -upx -9 ./OHWorkshopUploaderLinux +chmod +x ./SSVOpenHexagonLinux +chmod +x ./OHWorkshopUploaderLinux + +# echo "PACKING WITH UPX" +# +# for x in ./*.so; do +# upx -9 $x & +# done +# +# upx -9 ./SSVOpenHexagonLinux & +# upx -9 ./OHWorkshopUploaderLinux & +# +# wait +# echo "DONE PACKING WITH UPX" + cd .. cp -r ./_PREPARED_RELEASE_LINUX ./_PREPARED_RELEASE_LINUX_TEST diff --git a/public/steam/isteamapplist.h b/public/steam/isteamapplist.h index e83a52be..eb574354 100644 --- a/public/steam/isteamapplist.h +++ b/public/steam/isteamapplist.h @@ -47,7 +47,7 @@ STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamAppList *, SteamAppList, STEAMAPPLIS //---------------------------------------------------------------------------------
-// Purpose: Sent when a new app is installed
+// Purpose: Sent when a new app is installed (not downloaded yet)
//---------------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( SteamAppInstalled_t, k_iSteamAppListCallbacks + 1 )
STEAM_CALLBACK_MEMBER( 0, AppId_t, m_nAppID ) // ID of the app that installs
diff --git a/public/steam/isteamapps.h b/public/steam/isteamapps.h index 6cd3ddb1..908a7627 100644 --- a/public/steam/isteamapps.h +++ b/public/steam/isteamapps.h @@ -108,6 +108,9 @@ public: // check if game is a timed trial with limited playtime
virtual bool BIsTimedTrial( uint32* punSecondsAllowed, uint32* punSecondsPlayed ) = 0;
+
+ // set current DLC AppID being played (or 0 if none). Allows Steam to track usage of major DLC extensions
+ virtual bool SetDlcContext( AppId_t nAppID ) = 0;
};
#define STEAMAPPS_INTERFACE_VERSION "STEAMAPPS_INTERFACE_VERSION008"
@@ -134,30 +137,6 @@ struct DlcInstalled_t };
-//-----------------------------------------------------------------------------
-// Purpose: possible results when registering an activation code
-//-----------------------------------------------------------------------------
-enum ERegisterActivationCodeResult
-{
- k_ERegisterActivationCodeResultOK = 0,
- k_ERegisterActivationCodeResultFail = 1,
- k_ERegisterActivationCodeResultAlreadyRegistered = 2,
- k_ERegisterActivationCodeResultTimeout = 3,
- k_ERegisterActivationCodeAlreadyOwned = 4,
-};
-
-
-//-----------------------------------------------------------------------------
-// Purpose: response to RegisterActivationCode()
-//-----------------------------------------------------------------------------
-struct RegisterActivationCodeResponse_t
-{
- enum { k_iCallback = k_iSteamAppsCallbacks + 8 };
- ERegisterActivationCodeResult m_eResult;
- uint32 m_unPackageRegistered; // package that was registered. Only set on success
-};
-
-
//---------------------------------------------------------------------------------
// Purpose: posted after the user gains executes a Steam URL with command line or query parameters
// such as steam://run/<appid>//-commandline/?param1=value1¶m2=value2¶m3=value3 etc
diff --git a/public/steam/isteamcontroller.h b/public/steam/isteamcontroller.h index ce9ff1e7..193a131a 100644 --- a/public/steam/isteamcontroller.h +++ b/public/steam/isteamcontroller.h @@ -21,9 +21,9 @@ #define STEAM_CONTROLLER_MAX_COUNT 16
-#define STEAM_CONTROLLER_MAX_ANALOG_ACTIONS 16
+#define STEAM_CONTROLLER_MAX_ANALOG_ACTIONS 24
-#define STEAM_CONTROLLER_MAX_DIGITAL_ACTIONS 128
+#define STEAM_CONTROLLER_MAX_DIGITAL_ACTIONS 256
#define STEAM_CONTROLLER_MAX_ORIGINS 8
@@ -448,6 +448,16 @@ enum EControllerActionOrigin k_EControllerActionOrigin_SteamDeck_Reserved19,
k_EControllerActionOrigin_SteamDeck_Reserved20,
+ k_EControllerActionOrigin_Switch_JoyConButton_N, // With a Horizontal JoyCon this will be Y or what would be Dpad Right when vertical
+ k_EControllerActionOrigin_Switch_JoyConButton_E, // X
+ k_EControllerActionOrigin_Switch_JoyConButton_S, // A
+ k_EControllerActionOrigin_Switch_JoyConButton_W, // B
+
+ k_EControllerActionOrigin_PS5_LeftGrip,
+ k_EControllerActionOrigin_PS5_RightGrip,
+ k_EControllerActionOrigin_PS5_LeftFn,
+ k_EControllerActionOrigin_PS5_RightFn,
+
k_EControllerActionOrigin_Count, // If Steam has added support for new controllers origins will go here.
k_EControllerActionOrigin_MaximumPossibleValue = 32767, // Origins are currently a maximum of 16 bits.
};
@@ -529,6 +539,7 @@ typedef uint64 ControllerAnalogActionHandle_t; #define ControllerAnalogActionData_t InputAnalogActionData_t
#define ControllerDigitalActionData_t InputDigitalActionData_t
#define ControllerMotionData_t InputMotionData_t
+#define ControllerMotionDataV2_t InputMotionDataV2_t
#else
struct ControllerAnalogActionData_t
{
diff --git a/public/steam/isteamdualsense.h b/public/steam/isteamdualsense.h new file mode 100644 index 00000000..08e43708 --- /dev/null +++ b/public/steam/isteamdualsense.h @@ -0,0 +1,169 @@ +/* SIE CONFIDENTIAL
+ * $PSLibId$
+ * Copyright (C) 2019 Sony Interactive Entertainment Inc.
+ * All Rights Reserved.
+ */
+
+
+#ifndef _SCE_PAD_TRIGGER_EFFECT_H
+#define _SCE_PAD_TRIGGER_EFFECT_H
+
+
+#define SCE_PAD_TRIGGER_EFFECT_TRIGGER_MASK_L2 0x01
+#define SCE_PAD_TRIGGER_EFFECT_TRIGGER_MASK_R2 0x02
+
+#define SCE_PAD_TRIGGER_EFFECT_PARAM_INDEX_FOR_L2 0
+#define SCE_PAD_TRIGGER_EFFECT_PARAM_INDEX_FOR_R2 1
+
+#define SCE_PAD_TRIGGER_EFFECT_TRIGGER_NUM 2
+
+/* Definition of control point num */
+#define SCE_PAD_TRIGGER_EFFECT_CONTROL_POINT_NUM 10
+
+typedef enum ScePadTriggerEffectMode{
+ SCE_PAD_TRIGGER_EFFECT_MODE_OFF,
+ SCE_PAD_TRIGGER_EFFECT_MODE_FEEDBACK,
+ SCE_PAD_TRIGGER_EFFECT_MODE_WEAPON,
+ SCE_PAD_TRIGGER_EFFECT_MODE_VIBRATION,
+ SCE_PAD_TRIGGER_EFFECT_MODE_MULTIPLE_POSITION_FEEDBACK,
+ SCE_PAD_TRIGGER_EFFECT_MODE_SLOPE_FEEDBACK,
+ SCE_PAD_TRIGGER_EFFECT_MODE_MULTIPLE_POSITION_VIBRATION,
+} ScePadTriggerEffectMode;
+
+/**
+ *E
+ * @brief parameter for setting the trigger effect to off mode.
+ * Off Mode: Stop trigger effect.
+ **/
+typedef struct ScePadTriggerEffectOffParam{
+ uint8_t padding[48];
+} ScePadTriggerEffectOffParam;
+
+/**
+ *E
+ * @brief parameter for setting the trigger effect to Feedback mode.
+ * Feedback Mode: The motor arm pushes back trigger.
+ * Trigger obtains stiffness at specified position.
+ **/
+typedef struct ScePadTriggerEffectFeedbackParam{
+ uint8_t position; /*E position where the strength of target trigger start changing(0~9). */
+ uint8_t strength; /*E strength that the motor arm pushes back target trigger(0~8 (0: Same as Off mode)). */
+ uint8_t padding[46];
+} ScePadTriggerEffectFeedbackParam;
+
+/**
+ *E
+ * @brief parameter for setting the trigger effect to Weapon mode.
+ * Weapon Mode: Emulate weapon like gun trigger.
+ **/
+typedef struct ScePadTriggerEffectWeaponParam{
+ uint8_t startPosition; /*E position where the stiffness of trigger start changing(2~7). */
+ uint8_t endPosition; /*E position where the stiffness of trigger finish changing(startPosition+1~8). */
+ uint8_t strength; /*E strength of gun trigger(0~8 (0: Same as Off mode)). */
+ uint8_t padding[45];
+} ScePadTriggerEffectWeaponParam;
+
+/**
+ *E
+ * @brief parameter for setting the trigger effect to Vibration mode.
+ * Vibration Mode: Vibrates motor arm around specified position.
+ **/
+typedef struct ScePadTriggerEffectVibrationParam{
+ uint8_t position; /*E position where the motor arm start vibrating(0~9). */
+ uint8_t amplitude; /*E vibration amplitude(0~8 (0: Same as Off mode)). */
+ uint8_t frequency; /*E vibration frequency(0~255[Hz] (0: Same as Off mode)). */
+ uint8_t padding[45];
+} ScePadTriggerEffectVibrationParam;
+
+/**
+ *E
+ * @brief parameter for setting the trigger effect to ScePadTriggerEffectMultiplePositionFeedbackParam mode.
+ * Multi Position Feedback Mode: The motor arm pushes back trigger.
+ * Trigger obtains specified stiffness at each control point.
+ **/
+typedef struct ScePadTriggerEffectMultiplePositionFeedbackParam{
+ uint8_t strength[SCE_PAD_TRIGGER_EFFECT_CONTROL_POINT_NUM]; /*E strength that the motor arm pushes back target trigger at position(0~8 (0: Same as Off mode)).
+ * strength[0] means strength of motor arm at position0.
+ * strength[1] means strength of motor arm at position1.
+ * ...
+ * */
+ uint8_t padding[38];
+} ScePadTriggerEffectMultiplePositionFeedbackParam;
+
+/**
+ *E
+ * @brief parameter for setting the trigger effect to Feedback3 mode.
+ * Slope Feedback Mode: The motor arm pushes back trigger between two spedified control points.
+ * Stiffness of the trigger is changing depending on the set place.
+ **/
+typedef struct ScePadTriggerEffectSlopeFeedbackParam{
+
+ uint8_t startPosition; /*E position where the strength of target trigger start changing(0~endPosition). */
+ uint8_t endPosition; /*E position where the strength of target trigger finish changing(startPosition+1~9). */
+ uint8_t startStrength; /*E strength when trigger's position is startPosition(1~8) */
+ uint8_t endStrength; /*E strength when trigger's position is endPosition(1~8) */
+ uint8_t padding[44];
+} ScePadTriggerEffectSlopeFeedbackParam;
+
+/**
+ *E
+ * @brief parameter for setting the trigger effect to Vibration2 mode.
+ * Multi Position Vibration Mode: Vibrates motor arm around specified control point.
+ * Trigger vibrates specified amplitude at each control point.
+ **/
+typedef struct ScePadTriggerEffectMultiplePositionVibrationParam{
+ uint8_t frequency; /*E vibration frequency(0~255 (0: Same as Off mode)) */
+ uint8_t amplitude[SCE_PAD_TRIGGER_EFFECT_CONTROL_POINT_NUM]; /*E vibration amplitude at position(0~8 (0: Same as Off mode)).
+ * amplitude[0] means amplitude of vibration at position0.
+ * amplitude[1] means amplitude of vibration at position1.
+ * ...
+ * */
+ uint8_t padding[37];
+} ScePadTriggerEffectMultiplePositionVibrationParam;
+
+/**
+ *E
+ * @brief parameter for setting the trigger effect mode.
+ **/
+typedef union ScePadTriggerEffectCommandData{
+ ScePadTriggerEffectOffParam offParam;
+ ScePadTriggerEffectFeedbackParam feedbackParam;
+ ScePadTriggerEffectWeaponParam weaponParam;
+ ScePadTriggerEffectVibrationParam vibrationParam;
+ ScePadTriggerEffectMultiplePositionFeedbackParam multiplePositionFeedbackParam;
+ ScePadTriggerEffectSlopeFeedbackParam slopeFeedbackParam;
+ ScePadTriggerEffectMultiplePositionVibrationParam multiplePositionVibrationParam;
+} ScePadTriggerEffectCommandData;
+
+/**
+ *E
+ * @brief parameter for setting the trigger effect.
+ **/
+typedef struct ScePadTriggerEffectCommand{
+ ScePadTriggerEffectMode mode;
+ uint8_t padding[4];
+ ScePadTriggerEffectCommandData commandData;
+} ScePadTriggerEffectCommand;
+
+/**
+ *E
+ * @brief parameter for the scePadSetTriggerEffect function.
+ **/
+typedef struct ScePadTriggerEffectParam{
+
+ uint8_t triggerMask; /*E Set trigger mask to activate trigger effect commands.
+ * SCE_PAD_TRIGGER_EFFECT_TRIGGER_MASK_L2 : 0x01
+ * SCE_PAD_TRIGGER_EFFECT_TRIGGER_MASK_R2 : 0x02
+ * */
+ uint8_t padding[7];
+
+ ScePadTriggerEffectCommand command[SCE_PAD_TRIGGER_EFFECT_TRIGGER_NUM]; /*E command[SCE_PAD_TRIGGER_EFFECT_PARAM_INDEX_FOR_L2] is for L2 trigger setting
+ * and param[SCE_PAD_TRIGGER_EFFECT_PARAM_INDEX_FOR_R2] is for R2 trgger setting.
+ * */
+} ScePadTriggerEffectParam;
+
+#if defined(__cplusplus) && __cplusplus >= 201103L
+static_assert( sizeof( ScePadTriggerEffectParam ) == 120, "ScePadTriggerEffectParam has incorrect size" );
+#endif
+
+#endif /* _SCE_PAD_TRIGGER_EFFECT_H */
diff --git a/public/steam/isteamfriends.h b/public/steam/isteamfriends.h index e0a0b0fd..d57231aa 100644 --- a/public/steam/isteamfriends.h +++ b/public/steam/isteamfriends.h @@ -514,7 +514,9 @@ enum EPersonaChange struct GameOverlayActivated_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 31 };
- uint8 m_bActive; // true if it's just been activated, false otherwise
+ uint8 m_bActive; // true if it's just been activated, false otherwise
+ bool m_bUserInitiated; // true if the user asked for the overlay to be activated/deactivated
+ AppId_t m_nAppID; // the appID of the game (should always be the current game)
};
diff --git a/public/steam/isteamgameserver.h b/public/steam/isteamgameserver.h index e7d1a1ab..73d3c4ee 100644 --- a/public/steam/isteamgameserver.h +++ b/public/steam/isteamgameserver.h @@ -152,7 +152,9 @@ public: // Retrieve ticket to be sent to the entity who wishes to authenticate you ( using BeginAuthSession API ).
// pcbTicket retrieves the length of the actual ticket.
- virtual HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0;
+ // SteamNetworkingIdentity is an optional parameter to hold the public IP address of the entity you are connecting to
+ // if an IP address is passed Steam will only allow the ticket to be used by an entity with that IP address
+ virtual HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket, const SteamNetworkingIdentity *pSnid ) = 0;
// Authenticate ticket ( from GetAuthSessionTicket ) from entity steamID to be sure it is valid and isnt reused
// Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse )
@@ -264,7 +266,7 @@ public: )
};
-#define STEAMGAMESERVER_INTERFACE_VERSION "SteamGameServer014"
+#define STEAMGAMESERVER_INTERFACE_VERSION "SteamGameServer015"
// Global accessor
inline ISteamGameServer *SteamGameServer();
diff --git a/public/steam/isteaminput.h b/public/steam/isteaminput.h index fa265ab9..0d2d48af 100644 --- a/public/steam/isteaminput.h +++ b/public/steam/isteaminput.h @@ -17,9 +17,9 @@ #define STEAM_INPUT_MAX_COUNT 16
-#define STEAM_INPUT_MAX_ANALOG_ACTIONS 16
+#define STEAM_INPUT_MAX_ANALOG_ACTIONS 24
-#define STEAM_INPUT_MAX_DIGITAL_ACTIONS 128
+#define STEAM_INPUT_MAX_DIGITAL_ACTIONS 256
#define STEAM_INPUT_MAX_ORIGINS 8
@@ -319,10 +319,10 @@ enum EInputActionOrigin k_EInputActionOrigin_Switch_LeftGrip_Upper, // Left JoyCon SL Button
k_EInputActionOrigin_Switch_RightGrip_Lower, // Right JoyCon SL Button
k_EInputActionOrigin_Switch_RightGrip_Upper, // Right JoyCon SR Button
- k_EInputActionOrigin_Switch_Reserved11,
- k_EInputActionOrigin_Switch_Reserved12,
- k_EInputActionOrigin_Switch_Reserved13,
- k_EInputActionOrigin_Switch_Reserved14,
+ k_EInputActionOrigin_Switch_JoyConButton_N, // With a Horizontal JoyCon this will be Y or what would be Dpad Right when vertical
+ k_EInputActionOrigin_Switch_JoyConButton_E, // X
+ k_EInputActionOrigin_Switch_JoyConButton_S, // A
+ k_EInputActionOrigin_Switch_JoyConButton_W, // B
k_EInputActionOrigin_Switch_Reserved15,
k_EInputActionOrigin_Switch_Reserved16,
k_EInputActionOrigin_Switch_Reserved17,
@@ -386,10 +386,10 @@ enum EInputActionOrigin k_EInputActionOrigin_PS5_Gyro_Yaw,
k_EInputActionOrigin_PS5_Gyro_Roll,
k_EInputActionOrigin_PS5_DPad_Move,
- k_EInputActionOrigin_PS5_Reserved1,
- k_EInputActionOrigin_PS5_Reserved2,
- k_EInputActionOrigin_PS5_Reserved3,
- k_EInputActionOrigin_PS5_Reserved4,
+ k_EInputActionOrigin_PS5_LeftGrip,
+ k_EInputActionOrigin_PS5_RightGrip,
+ k_EInputActionOrigin_PS5_LeftFn,
+ k_EInputActionOrigin_PS5_RightFn,
k_EInputActionOrigin_PS5_Reserved5,
k_EInputActionOrigin_PS5_Reserved6,
k_EInputActionOrigin_PS5_Reserved7,
@@ -643,12 +643,12 @@ struct InputDigitalActionData_t struct InputMotionData_t
{
- // Sensor-fused absolute rotation; will drift in heading
+ // Sensor-fused absolute rotation; will drift in heading toward average
float rotQuatX;
float rotQuatY;
float rotQuatZ;
float rotQuatW;
-
+
// Positional acceleration
float posAccelX;
float posAccelY;
@@ -660,6 +660,58 @@ struct InputMotionData_t float rotVelZ;
};
+
+struct InputMotionDataV2_t
+{
+ //
+ // Gyro post processing:
+ //
+
+ // Drift Corrected Quaternion is calculated after steam input controller calibration values have been applied.
+ // Rawest _useful_ version of a quaternion.
+ // Most camera implementations should use this by comparing last rotation against current rotation, and applying the difference to the in game camera (plus your own sensitivity tweaks)
+ // It is worth viewing
+ float driftCorrectedQuatX;
+ float driftCorrectedQuatY;
+ float driftCorrectedQuatZ;
+ float driftCorrectedQuatW;
+
+ // Sensor fusion corrects using accelerometer, and "average forward over time" for "forward".
+ // This can "ouija" your aim, so it's not so appropriate for camera controls (sensor fusion was originally made for racing game steering )
+ // Same result as from old InputMotionData_t::rotQuatX/Y/Z/W
+ float sensorFusionQuatX;
+ float sensorFusionQuatY;
+ float sensorFusionQuatZ;
+ float sensorFusionQuatW;
+
+ // Deferred Sensor fusion quaternion with deferred correction
+ // Reduces perception of "ouija" effect by only applying correction when the controller is below "low noise" thresholds,
+ // while the controller rotates fast - never when the user is attempting precision aim.
+ float deferredSensorFusionQuatX;
+ float deferredSensorFusionQuatY;
+ float deferredSensorFusionQuatZ;
+ float deferredSensorFusionQuatW;
+
+ // Same as accel but values are calibrated such that 1 unit = 1G.
+ // X = Right
+ // Y = Forward out through the joystick USB port.
+ // Z = Up through the joystick axis.
+ float gravityX;
+ float gravityY;
+ float gravityZ;
+
+ //
+ // Same as rotVel values in GetMotionData but values are calibrated to degrees per second.
+ // Local Space (controller relative)
+ // X = Pitch = left to right axis
+ // Y = Roll = axis through charging port
+ // Z = Yaw = axis through sticks
+ float degreesPerSecondX;
+ float degreesPerSecondY;
+ float degreesPerSecondZ;
+
+};
+
//-----------------------------------------------------------------------------
// Purpose: when callbacks are enabled this fires each time a controller action
// state changes
@@ -682,6 +734,11 @@ struct SteamInputActionEvent_t };
};
+//-----------------------------------------------------------------------------
+// Forward declaration for ScePadTriggerEffectParam, defined in isteamdualsense.h
+//-----------------------------------------------------------------------------
+struct ScePadTriggerEffectParam;
+
#pragma pack( pop )
typedef void ( *SteamInputActionEventCallbackPointer )( SteamInputActionEvent_t * );
@@ -892,9 +949,12 @@ public: // See isteamremoteplay.h for more information on Steam Remote Play sessions
virtual uint32 GetRemotePlaySessionID( InputHandle_t inputHandle ) = 0;
- // Get a bitmask of the Steam Input Configuration types opted in for the current session. Returns ESteamInputConfigurationEnableType values.?
+ // Get a bitmask of the Steam Input Configuration types opted in for the current session. Returns ESteamInputConfigurationEnableType values.
// Note: user can override the settings from the Steamworks Partner site so the returned values may not exactly match your default configuration
virtual uint16 GetSessionInputConfigurationSettings() = 0;
+
+ // Set the trigger effect for a DualSense controller
+ virtual void SetDualSenseTriggerEffect( InputHandle_t inputHandle, const ScePadTriggerEffectParam *pParam ) = 0;
};
#define STEAMINPUT_INTERFACE_VERSION "SteamInput006"
@@ -951,4 +1011,4 @@ struct SteamInputConfigurationLoaded_t #pragma pack( pop )
-#endif // ISTEAMINPUT_H
\ No newline at end of file +#endif // ISTEAMINPUT_H
diff --git a/public/steam/isteamparentalsettings.h b/public/steam/isteamparentalsettings.h index 66e18a06..ad435875 100644 --- a/public/steam/isteamparentalsettings.h +++ b/public/steam/isteamparentalsettings.h @@ -29,6 +29,7 @@ enum EParentalFeature k_EFeatureLibrary = 11,
k_EFeatureTest = 12,
k_EFeatureSiteLicense = 13,
+ k_EFeatureKioskMode = 14,
k_EFeatureMax
};
diff --git a/public/steam/isteamugc.h b/public/steam/isteamugc.h index 347e119b..560258ac 100644 --- a/public/steam/isteamugc.h +++ b/public/steam/isteamugc.h @@ -157,6 +157,15 @@ enum EItemPreviewType k_EItemPreviewType_ReservedMax = 255, // you can specify your own types above this value
};
+enum EUGCContentDescriptorID
+{
+ k_EUGCContentDescriptor_NudityOrSexualContent = 1,
+ k_EUGCContentDescriptor_FrequentViolenceOrGore = 2,
+ k_EUGCContentDescriptor_AdultOnlySexualContent = 3,
+ k_EUGCContentDescriptor_GratuitousSexualContent = 4,
+ k_EUGCContentDescriptor_AnyMatureContent = 5,
+};
+
const uint32 kNumUGCResultsPerPage = 50;
const uint32 k_cchDeveloperMetadataMax = 5000;
@@ -237,6 +246,8 @@ public: STEAM_FLAT_NAME( GetQueryFirstUGCKeyValueTag )
virtual bool GetQueryUGCKeyValueTag( UGCQueryHandle_t handle, uint32 index, const char *pchKey, STEAM_OUT_STRING_COUNT(cchValueSize) char *pchValue, uint32 cchValueSize ) = 0;
+ virtual uint32 GetQueryUGCContentDescriptors( UGCQueryHandle_t handle, uint32 index, EUGCContentDescriptorID *pvecDescriptors, uint32 cMaxEntries ) = 0;
+
// Release the request to free up memory, after retrieving results
virtual bool ReleaseQueryUGCRequest( UGCQueryHandle_t handle ) = 0;
@@ -293,6 +304,8 @@ public: virtual bool UpdateItemPreviewFile( UGCUpdateHandle_t handle, uint32 index, const char *pszPreviewFile ) = 0; // updates an existing preview file for this item. pszPreviewFile points to local file, which must be under 1MB in size
virtual bool UpdateItemPreviewVideo( UGCUpdateHandle_t handle, uint32 index, const char *pszVideoID ) = 0; // updates an existing preview video for this item
virtual bool RemoveItemPreview( UGCUpdateHandle_t handle, uint32 index ) = 0; // remove a preview by index starting at 0 (previews are sorted)
+ virtual bool AddContentDescriptor( UGCUpdateHandle_t handle, EUGCContentDescriptorID descid ) = 0;
+ virtual bool RemoveContentDescriptor( UGCUpdateHandle_t handle, EUGCContentDescriptorID descid ) = 0;
STEAM_CALL_RESULT( SubmitItemUpdateResult_t )
virtual SteamAPICall_t SubmitItemUpdate( UGCUpdateHandle_t handle, const char *pchChangeNote ) = 0; // commit update process started with StartItemUpdate()
@@ -371,7 +384,7 @@ public: virtual SteamAPICall_t GetWorkshopEULAStatus() = 0;
};
-#define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION016"
+#define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION017"
// Global interface accessor
inline ISteamUGC *SteamUGC();
diff --git a/public/steam/isteamuser.h b/public/steam/isteamuser.h index 54b9fa36..fc144836 100644 --- a/public/steam/isteamuser.h +++ b/public/steam/isteamuser.h @@ -124,7 +124,10 @@ public: // Retrieve ticket to be sent to the entity who wishes to authenticate you.
// pcbTicket retrieves the length of the actual ticket.
- virtual HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0;
+ // SteamNetworkingIdentity is an optional input parameter to hold the public IP address or SteamID of the entity you are connecting to
+ // if an IP address is passed Steam will only allow the ticket to be used by an entity with that IP address
+ // if a Steam ID is passed Steam will only allow the ticket to be used by that Steam ID
+ virtual HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket, const SteamNetworkingIdentity *pSteamNetworkingIdentity ) = 0;
// Authenticate ticket from entity steamID to be sure it is valid and isnt reused
// Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse )
@@ -210,7 +213,7 @@ public: };
-#define STEAMUSER_INTERFACE_VERSION "SteamUser021"
+#define STEAMUSER_INTERFACE_VERSION "SteamUser022"
// Global interface accessor
inline ISteamUser *SteamUser();
@@ -225,12 +228,13 @@ STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamUser *, SteamUser, STEAMUSER_INTERFA #error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
+
//-----------------------------------------------------------------------------
-// Purpose: called when a connections to the Steam back-end has been established
-// this means the Steam client now has a working connection to the Steam servers
-// usually this will have occurred before the game has launched, and should
+// Purpose: Called when an authenticated connection to the Steam back-end has been established.
+// This means the Steam client now has a working connection to the Steam servers.
+// Usually this will have occurred before the game has launched, and should
// only be seen if the user has dropped connection due to a networking issue
-// or a Steam server update
+// or a Steam server update.
//-----------------------------------------------------------------------------
struct SteamServersConnected_t
{
diff --git a/public/steam/isteamutils.h b/public/steam/isteamutils.h index d841f409..94743212 100644 --- a/public/steam/isteamutils.h +++ b/public/steam/isteamutils.h @@ -6,9 +6,6 @@ #ifndef ISTEAMUTILS_H
#define ISTEAMUTILS_H
-#ifdef _WIN32
-#pragma once
-#endif
#include "steam_api_common.h"
@@ -60,12 +57,6 @@ enum ETextFilteringContext };
-// function prototype for warning message hook
-#if defined( POSIX )
-#define __cdecl
-#endif
-extern "C" typedef void (__cdecl *SteamAPIWarningMessageHook_t)(int, const char *);
-
//-----------------------------------------------------------------------------
// Purpose: interface to user independent utility functions
//-----------------------------------------------------------------------------
@@ -317,6 +308,7 @@ struct GamepadTextInputDismissed_t enum { k_iCallback = k_iSteamUtilsCallbacks + 14 };
bool m_bSubmitted; // true if user entered & accepted text (Call ISteamUtils::GetEnteredGamepadTextInput() for text), false if canceled input
uint32 m_unSubmittedText;
+ AppId_t m_unAppID;
};
// k_iSteamUtilsCallbacks + 15 through 35 are taken
@@ -334,6 +326,15 @@ struct FloatingGamepadTextInputDismissed_t enum { k_iCallback = k_iSteamUtilsCallbacks + 38 };
};
+//-----------------------------------------------------------------------------
+// The text filtering dictionary has changed
+//-----------------------------------------------------------------------------
+struct FilterTextDictionaryChanged_t
+{
+ enum { k_iCallback = k_iSteamUtilsCallbacks + 39 };
+ int m_eLanguage; // One of ELanguage, or k_LegallyRequiredFiltering
+};
+
#pragma pack( pop )
#endif // ISTEAMUTILS_H
diff --git a/public/steam/lib/linux32/libsdkencryptedappticket.so b/public/steam/lib/linux32/libsdkencryptedappticket.so Binary files differindex 226554ea..2ec9bd8a 100644 --- a/public/steam/lib/linux32/libsdkencryptedappticket.so +++ b/public/steam/lib/linux32/libsdkencryptedappticket.so diff --git a/public/steam/lib/linux64/libsdkencryptedappticket.so b/public/steam/lib/linux64/libsdkencryptedappticket.so Binary files differindex 6250125f..fe77ac24 100644 --- a/public/steam/lib/linux64/libsdkencryptedappticket.so +++ b/public/steam/lib/linux64/libsdkencryptedappticket.so diff --git a/public/steam/lib/osx/libsdkencryptedappticket.dylib b/public/steam/lib/osx/libsdkencryptedappticket.dylib Binary files differindex 40787f17..6e785d4a 100644 --- a/public/steam/lib/osx/libsdkencryptedappticket.dylib +++ b/public/steam/lib/osx/libsdkencryptedappticket.dylib diff --git a/public/steam/matchmakingtypes.h b/public/steam/matchmakingtypes.h index 6446a573..b15af3fa 100644 --- a/public/steam/matchmakingtypes.h +++ b/public/steam/matchmakingtypes.h @@ -8,16 +8,6 @@ #ifndef MATCHMAKINGTYPES_H
#define MATCHMAKINGTYPES_H
-#ifdef _WIN32
-#pragma once
-#endif
-
-#ifdef POSIX
-#ifndef _snprintf
-#define _snprintf snprintf
-#endif
-#endif
-
#include <stdio.h>
#include <string.h>
@@ -68,9 +58,6 @@ public: servernetadr_t() : m_usConnectionPort( 0 ), m_usQueryPort( 0 ), m_unIP( 0 ) {}
void Init( unsigned int ip, uint16 usQueryPort, uint16 usConnectionPort );
-#ifdef NETADR_H
- netadr_t GetIPAndQueryPort();
-#endif
// Access the query port.
uint16 GetQueryPort() const;
@@ -113,13 +100,6 @@ inline void servernetadr_t::Init( unsigned int ip, uint16 usQueryPort, uint16 us m_usConnectionPort = usConnectionPort;
}
-#ifdef NETADR_H
-inline netadr_t servernetadr_t::GetIPAndQueryPort()
-{
- return netadr_t( m_unIP, m_usQueryPort );
-}
-#endif
-
inline uint16 servernetadr_t::GetQueryPort() const
{
return m_usQueryPort;
@@ -156,9 +136,9 @@ inline const char *servernetadr_t::ToString( uint32 unIP, uint16 usPort ) const static int nBuf = 0;
unsigned char *ipByte = (unsigned char *)&unIP;
#ifdef VALVE_BIG_ENDIAN
- _snprintf (s[nBuf], sizeof( s[nBuf] ), "%u.%u.%u.%u:%i", (int)(ipByte[0]), (int)(ipByte[1]), (int)(ipByte[2]), (int)(ipByte[3]), usPort );
+ snprintf(s[nBuf], sizeof( s[nBuf] ), "%u.%u.%u.%u:%i", (int)(ipByte[0]), (int)(ipByte[1]), (int)(ipByte[2]), (int)(ipByte[3]), usPort );
#else
- _snprintf (s[nBuf], sizeof( s[nBuf] ), "%u.%u.%u.%u:%i", (int)(ipByte[3]), (int)(ipByte[2]), (int)(ipByte[1]), (int)(ipByte[0]), usPort );
+ snprintf(s[nBuf], sizeof( s[nBuf] ), "%u.%u.%u.%u:%i", (int)(ipByte[3]), (int)(ipByte[2]), (int)(ipByte[1]), (int)(ipByte[0]), usPort );
#endif
const char *pchRet = s[nBuf];
++nBuf;
diff --git a/public/steam/steam_api.json b/public/steam/steam_api.json index 5ae79694..c93ba668 100644 --- a/public/steam/steam_api.json +++ b/public/steam/steam_api.json @@ -136,7 +136,9 @@ {
"callback_id": 331,
"fields": [
- { "fieldname":"m_bActive", "fieldtype":"uint8" }
+ { "fieldname":"m_bActive", "fieldtype":"uint8" },
+ { "fieldname":"m_bUserInitiated", "fieldtype":"bool" },
+ { "fieldname":"m_nAppID", "fieldtype":"AppId_t" }
],
"struct": "GameOverlayActivated_t"
},
@@ -347,7 +349,8 @@ "callback_id": 714,
"fields": [
{ "fieldname":"m_bSubmitted", "fieldtype":"bool" },
- { "fieldname":"m_unSubmittedText", "fieldtype":"uint32" }
+ { "fieldname":"m_unSubmittedText", "fieldtype":"uint32" },
+ { "fieldname":"m_unAppID", "fieldtype":"AppId_t" }
],
"struct": "GamepadTextInputDismissed_t"
},
@@ -362,6 +365,13 @@ "struct": "FloatingGamepadTextInputDismissed_t"
},
{
+ "callback_id": 739,
+ "fields": [
+ { "fieldname":"m_eLanguage", "fieldtype":"int" }
+ ],
+ "struct": "FilterTextDictionaryChanged_t"
+ },
+ {
"callback_id": 502,
"fields": [
{ "fieldname":"m_nIP", "fieldtype":"uint32" },
@@ -969,14 +979,6 @@ "struct": "DlcInstalled_t"
},
{
- "callback_id": 1008,
- "fields": [
- { "fieldname":"m_eResult", "fieldtype":"ERegisterActivationCodeResult" },
- { "fieldname":"m_unPackageRegistered", "fieldtype":"uint32" }
- ],
- "struct": "RegisterActivationCodeResponse_t"
- },
- {
"callback_id": 1014,
"fields": [],
"struct": "NewUrlLaunchParameters_t"
@@ -2099,7 +2101,8 @@ { "name":"k_EResultNoVerifiedPhone", "value":"123" },
{ "name":"k_EResultInsufficientBattery", "value":"124" },
{ "name":"k_EResultChargerRequired", "value":"125" },
- { "name":"k_EResultCachedCredentialInvalid", "value":"126" }
+ { "name":"k_EResultCachedCredentialInvalid", "value":"126" },
+ { "name":"K_EResultPhoneNumberIsVOIP", "value":"127" }
]
},
{
@@ -2161,7 +2164,8 @@ { "name":"k_EAuthSessionResponseAuthTicketCanceled", "value":"6" },
{ "name":"k_EAuthSessionResponseAuthTicketInvalidAlreadyUsed", "value":"7" },
{ "name":"k_EAuthSessionResponseAuthTicketInvalid", "value":"8" },
- { "name":"k_EAuthSessionResponsePublisherIssuedBan", "value":"9" }
+ { "name":"k_EAuthSessionResponsePublisherIssuedBan", "value":"9" },
+ { "name":"k_EAuthSessionResponseAuthTicketNetworkIdentityFailure", "value":"10" }
]
},
{
@@ -2235,6 +2239,7 @@ {
"enumname": "ENotificationPosition",
"values": [
+ { "name":"k_EPositionInvalid", "value":"-1" },
{ "name":"k_EPositionTopLeft", "value":"0" },
{ "name":"k_EPositionTopRight", "value":"1" },
{ "name":"k_EPositionBottomLeft", "value":"2" },
@@ -2743,16 +2748,6 @@ ]
},
{
- "enumname": "ERegisterActivationCodeResult",
- "values": [
- { "name":"k_ERegisterActivationCodeResultOK", "value":"0" },
- { "name":"k_ERegisterActivationCodeResultFail", "value":"1" },
- { "name":"k_ERegisterActivationCodeResultAlreadyRegistered", "value":"2" },
- { "name":"k_ERegisterActivationCodeResultTimeout", "value":"3" },
- { "name":"k_ERegisterActivationCodeAlreadyOwned", "value":"4" }
- ]
- },
- {
"enumname": "EP2PSessionError",
"values": [
{ "name":"k_EP2PSessionErrorNone", "value":"0" },
@@ -2849,6 +2844,7 @@ { "name":"k_EHTTPStatusCode304NotModified", "value":"304" },
{ "name":"k_EHTTPStatusCode305UseProxy", "value":"305" },
{ "name":"k_EHTTPStatusCode307TemporaryRedirect", "value":"307" },
+ { "name":"k_EHTTPStatusCode308PermanentRedirect", "value":"308" },
{ "name":"k_EHTTPStatusCode400BadRequest", "value":"400" },
{ "name":"k_EHTTPStatusCode401Unauthorized", "value":"401" },
{ "name":"k_EHTTPStatusCode402PaymentRequired", "value":"402" },
@@ -3152,10 +3148,10 @@ { "name":"k_EInputActionOrigin_Switch_LeftGrip_Upper", "value":"245" },
{ "name":"k_EInputActionOrigin_Switch_RightGrip_Lower", "value":"246" },
{ "name":"k_EInputActionOrigin_Switch_RightGrip_Upper", "value":"247" },
- { "name":"k_EInputActionOrigin_Switch_Reserved11", "value":"248" },
- { "name":"k_EInputActionOrigin_Switch_Reserved12", "value":"249" },
- { "name":"k_EInputActionOrigin_Switch_Reserved13", "value":"250" },
- { "name":"k_EInputActionOrigin_Switch_Reserved14", "value":"251" },
+ { "name":"k_EInputActionOrigin_Switch_JoyConButton_N", "value":"248" },
+ { "name":"k_EInputActionOrigin_Switch_JoyConButton_E", "value":"249" },
+ { "name":"k_EInputActionOrigin_Switch_JoyConButton_S", "value":"250" },
+ { "name":"k_EInputActionOrigin_Switch_JoyConButton_W", "value":"251" },
{ "name":"k_EInputActionOrigin_Switch_Reserved15", "value":"252" },
{ "name":"k_EInputActionOrigin_Switch_Reserved16", "value":"253" },
{ "name":"k_EInputActionOrigin_Switch_Reserved17", "value":"254" },
@@ -3217,10 +3213,10 @@ { "name":"k_EInputActionOrigin_PS5_Gyro_Yaw", "value":"310" },
{ "name":"k_EInputActionOrigin_PS5_Gyro_Roll", "value":"311" },
{ "name":"k_EInputActionOrigin_PS5_DPad_Move", "value":"312" },
- { "name":"k_EInputActionOrigin_PS5_Reserved1", "value":"313" },
- { "name":"k_EInputActionOrigin_PS5_Reserved2", "value":"314" },
- { "name":"k_EInputActionOrigin_PS5_Reserved3", "value":"315" },
- { "name":"k_EInputActionOrigin_PS5_Reserved4", "value":"316" },
+ { "name":"k_EInputActionOrigin_PS5_LeftGrip", "value":"313" },
+ { "name":"k_EInputActionOrigin_PS5_RightGrip", "value":"314" },
+ { "name":"k_EInputActionOrigin_PS5_LeftFn", "value":"315" },
+ { "name":"k_EInputActionOrigin_PS5_RightFn", "value":"316" },
{ "name":"k_EInputActionOrigin_PS5_Reserved5", "value":"317" },
{ "name":"k_EInputActionOrigin_PS5_Reserved6", "value":"318" },
{ "name":"k_EInputActionOrigin_PS5_Reserved7", "value":"319" },
@@ -3817,7 +3813,15 @@ { "name":"k_EControllerActionOrigin_SteamDeck_Reserved18", "value":"375" },
{ "name":"k_EControllerActionOrigin_SteamDeck_Reserved19", "value":"376" },
{ "name":"k_EControllerActionOrigin_SteamDeck_Reserved20", "value":"377" },
- { "name":"k_EControllerActionOrigin_Count", "value":"378" },
+ { "name":"k_EControllerActionOrigin_Switch_JoyConButton_N", "value":"378" },
+ { "name":"k_EControllerActionOrigin_Switch_JoyConButton_E", "value":"379" },
+ { "name":"k_EControllerActionOrigin_Switch_JoyConButton_S", "value":"380" },
+ { "name":"k_EControllerActionOrigin_Switch_JoyConButton_W", "value":"381" },
+ { "name":"k_EControllerActionOrigin_PS5_LeftGrip", "value":"382" },
+ { "name":"k_EControllerActionOrigin_PS5_RightGrip", "value":"383" },
+ { "name":"k_EControllerActionOrigin_PS5_LeftFn", "value":"384" },
+ { "name":"k_EControllerActionOrigin_PS5_RightFn", "value":"385" },
+ { "name":"k_EControllerActionOrigin_Count", "value":"386" },
{ "name":"k_EControllerActionOrigin_MaximumPossibleValue", "value":"32767" }
]
},
@@ -3951,6 +3955,16 @@ ]
},
{
+ "enumname": "EUGCContentDescriptorID",
+ "values": [
+ { "name":"k_EUGCContentDescriptor_NudityOrSexualContent", "value":"1" },
+ { "name":"k_EUGCContentDescriptor_FrequentViolenceOrGore", "value":"2" },
+ { "name":"k_EUGCContentDescriptor_AdultOnlySexualContent", "value":"3" },
+ { "name":"k_EUGCContentDescriptor_GratuitousSexualContent", "value":"4" },
+ { "name":"k_EUGCContentDescriptor_AnyMatureContent", "value":"5" }
+ ]
+ },
+ {
"enumname": "ESteamItemFlags",
"values": [
{ "name":"k_ESteamItemNoTrade", "value":"1" },
@@ -3975,7 +3989,8 @@ { "name":"k_EFeatureLibrary", "value":"11" },
{ "name":"k_EFeatureTest", "value":"12" },
{ "name":"k_EFeatureSiteLicense", "value":"13" },
- { "name":"k_EFeatureMax", "value":"14" }
+ { "name":"k_EFeatureKioskMode", "value":"14" },
+ { "name":"k_EFeatureMax", "value":"15" }
]
},
{
@@ -4555,7 +4570,7 @@ {
"kind": "user",
"name": "SteamUser",
- "name_flat": "SteamAPI_SteamUser_v021"
+ "name_flat": "SteamAPI_SteamUser_v022"
}
],
"classname": "ISteamUser",
@@ -4684,7 +4699,8 @@ "params": [
{ "paramname":"pTicket", "paramtype":"void *" },
{ "paramname":"cbMaxTicket", "paramtype":"int" },
- { "paramname":"pcbTicket", "paramtype":"uint32 *" }
+ { "paramname":"pcbTicket", "paramtype":"uint32 *" },
+ { "paramname":"pSteamNetworkingIdentity", "paramtype":"const SteamNetworkingIdentity *" }
],
"returntype": "HAuthTicket"
},
@@ -4830,7 +4846,7 @@ "returntype": "bool"
}
],
- "version_string": "SteamUser021"
+ "version_string": "SteamUser022"
},
{
"accessors": [
@@ -8026,6 +8042,14 @@ { "paramname":"punSecondsPlayed", "paramtype":"uint32 *" }
],
"returntype": "bool"
+ },
+ {
+ "methodname": "SetDlcContext",
+ "methodname_flat": "SteamAPI_ISteamApps_SetDlcContext",
+ "params": [
+ { "paramname":"nAppID", "paramtype":"AppId_t" }
+ ],
+ "returntype": "bool"
}
],
"version_string": "STEAMAPPS_INTERFACE_VERSION008"
@@ -9378,6 +9402,15 @@ "methodname_flat": "SteamAPI_ISteamInput_GetSessionInputConfigurationSettings",
"params": [],
"returntype": "uint16"
+ },
+ {
+ "methodname": "SetDualSenseTriggerEffect",
+ "methodname_flat": "SteamAPI_ISteamInput_SetDualSenseTriggerEffect",
+ "params": [
+ { "paramname":"inputHandle", "paramtype":"InputHandle_t" },
+ { "paramname":"pParam", "paramtype":"const ScePadTriggerEffectParam *" }
+ ],
+ "returntype": "void"
}
],
"version_string": "SteamInput006"
@@ -9717,12 +9750,12 @@ {
"kind": "user",
"name": "SteamUGC",
- "name_flat": "SteamAPI_SteamUGC_v016"
+ "name_flat": "SteamAPI_SteamUGC_v017"
},
{
"kind": "gameserver",
"name": "SteamGameServerUGC",
- "name_flat": "SteamAPI_SteamGameServerUGC_v016"
+ "name_flat": "SteamAPI_SteamGameServerUGC_v017"
}
],
"classname": "ISteamUGC",
@@ -9967,6 +10000,17 @@ "returntype": "bool"
},
{
+ "methodname": "GetQueryUGCContentDescriptors",
+ "methodname_flat": "SteamAPI_ISteamUGC_GetQueryUGCContentDescriptors",
+ "params": [
+ { "paramname":"handle", "paramtype":"UGCQueryHandle_t" },
+ { "paramname":"index", "paramtype":"uint32" },
+ { "paramname":"pvecDescriptors", "paramtype":"EUGCContentDescriptorID *" },
+ { "paramname":"cMaxEntries", "paramtype":"uint32" }
+ ],
+ "returntype": "uint32"
+ },
+ {
"methodname": "ReleaseQueryUGCRequest",
"methodname_flat": "SteamAPI_ISteamUGC_ReleaseQueryUGCRequest",
"params": [
@@ -10343,6 +10387,24 @@ "returntype": "bool"
},
{
+ "methodname": "AddContentDescriptor",
+ "methodname_flat": "SteamAPI_ISteamUGC_AddContentDescriptor",
+ "params": [
+ { "paramname":"handle", "paramtype":"UGCUpdateHandle_t" },
+ { "paramname":"descid", "paramtype":"EUGCContentDescriptorID" }
+ ],
+ "returntype": "bool"
+ },
+ {
+ "methodname": "RemoveContentDescriptor",
+ "methodname_flat": "SteamAPI_ISteamUGC_RemoveContentDescriptor",
+ "params": [
+ { "paramname":"handle", "paramtype":"UGCUpdateHandle_t" },
+ { "paramname":"descid", "paramtype":"EUGCContentDescriptorID" }
+ ],
+ "returntype": "bool"
+ },
+ {
"callresult": "SubmitItemUpdateResult_t",
"methodname": "SubmitItemUpdate",
"methodname_flat": "SteamAPI_ISteamUGC_SubmitItemUpdate",
@@ -10593,7 +10655,7 @@ "returntype": "SteamAPICall_t"
}
],
- "version_string": "STEAMUGC_INTERFACE_VERSION016"
+ "version_string": "STEAMUGC_INTERFACE_VERSION017"
},
{
"accessors": [
@@ -12657,7 +12719,7 @@ {
"kind": "gameserver",
"name": "SteamGameServer",
- "name_flat": "SteamAPI_SteamGameServer_v014"
+ "name_flat": "SteamAPI_SteamGameServer_v015"
}
],
"classname": "ISteamGameServer",
@@ -12849,7 +12911,8 @@ "params": [
{ "paramname":"pTicket", "paramtype":"void *" },
{ "paramname":"cbMaxTicket", "paramtype":"int" },
- { "paramname":"pcbTicket", "paramtype":"uint32 *" }
+ { "paramname":"pcbTicket", "paramtype":"uint32 *" },
+ { "paramname":"pSnid", "paramtype":"const SteamNetworkingIdentity *" }
],
"returntype": "HAuthTicket"
},
@@ -12993,7 +13056,7 @@ "returntype": "bool"
}
],
- "version_string": "SteamGameServer014"
+ "version_string": "SteamGameServer015"
},
{
"accessors": [
@@ -13415,6 +13478,29 @@ },
{
"fields": [
+ { "fieldname":"driftCorrectedQuatX", "fieldtype":"float" },
+ { "fieldname":"driftCorrectedQuatY", "fieldtype":"float" },
+ { "fieldname":"driftCorrectedQuatZ", "fieldtype":"float" },
+ { "fieldname":"driftCorrectedQuatW", "fieldtype":"float" },
+ { "fieldname":"sensorFusionQuatX", "fieldtype":"float" },
+ { "fieldname":"sensorFusionQuatY", "fieldtype":"float" },
+ { "fieldname":"sensorFusionQuatZ", "fieldtype":"float" },
+ { "fieldname":"sensorFusionQuatW", "fieldtype":"float" },
+ { "fieldname":"deferredSensorFusionQuatX", "fieldtype":"float" },
+ { "fieldname":"deferredSensorFusionQuatY", "fieldtype":"float" },
+ { "fieldname":"deferredSensorFusionQuatZ", "fieldtype":"float" },
+ { "fieldname":"deferredSensorFusionQuatW", "fieldtype":"float" },
+ { "fieldname":"gravityX", "fieldtype":"float" },
+ { "fieldname":"gravityY", "fieldtype":"float" },
+ { "fieldname":"gravityZ", "fieldtype":"float" },
+ { "fieldname":"degreesPerSecondX", "fieldtype":"float" },
+ { "fieldname":"degreesPerSecondY", "fieldtype":"float" },
+ { "fieldname":"degreesPerSecondZ", "fieldtype":"float" }
+ ],
+ "struct": "InputMotionDataV2_t"
+ },
+ {
+ "fields": [
{ "fieldname":"controllerHandle", "fieldtype":"InputHandle_t" },
{ "fieldname":"eEventType", "fieldtype":"ESteamInputActionEventType" },
{ "fieldname":"analogAction", "fieldtype":"SteamInputActionEvent_t::AnalogAction_t" }
diff --git a/public/steam/steam_api_common.h b/public/steam/steam_api_common.h index 7620a8de..f8e80d1a 100644 --- a/public/steam/steam_api_common.h +++ b/public/steam/steam_api_common.h @@ -9,9 +9,6 @@ #ifndef STEAM_API_COMMON_H
#define STEAM_API_COMMON_H
-#ifdef _WIN32
-#pragma once
-#endif
#include "steamtypes.h"
#include "steamclientpublic.h"
@@ -25,7 +22,7 @@ #else
#define S_API extern "C" __declspec( dllimport )
#endif // STEAM_API_EXPORTS
-#elif defined( GNUC )
+#elif defined( __GNUC__ )
#if defined( STEAM_API_EXPORTS )
#define S_API extern "C" __attribute__ ((visibility("default")))
#else
@@ -51,12 +48,18 @@ typedef int32 HSteamPipe;
// handle to single instance of a steam user
typedef int32 HSteamUser;
-// function prototype
-#if defined( POSIX )
-#define __cdecl
+
+// #define away __cdecl on posix.
+// This is really, really bad. We're sorry. But it's been this way for
+// a long time now and it's scary to change it, as there may be others that
+// depend on it.
+#ifndef _WIN32
+ #define __cdecl
#endif
-extern "C" typedef void (__cdecl *SteamAPIWarningMessageHook_t)(int, const char *);
-extern "C" typedef uint32 ( *SteamAPI_CheckCallbackRegistered_t )( int iCallbackNum );
+
+// function prototype
+extern "C" typedef void ( S_CALLTYPE *SteamAPIWarningMessageHook_t )( int, const char * );
+extern "C" typedef uint32 ( S_CALLTYPE *SteamAPI_CheckCallbackRegistered_t )( int iCallbackNum );
#if defined( __SNC__ )
#pragma diag_suppress=1700 // warning 1700: class "%s" has virtual functions but non-virtual destructor
#endif
diff --git a/public/steam/steam_api_flat.h b/public/steam/steam_api_flat.h index 02aaac94..9e851799 100644 --- a/public/steam/steam_api_flat.h +++ b/public/steam/steam_api_flat.h @@ -58,9 +58,9 @@ S_API ISteamRemotePlay * SteamAPI_ISteamClient_GetISteamRemotePlay( ISteamClient // ISteamUser
// A versioned accessor is exported by the library
-S_API ISteamUser *SteamAPI_SteamUser_v021();
+S_API ISteamUser *SteamAPI_SteamUser_v022();
// Inline, unversioned accessor to get the current version. Essentially the same as SteamUser(), but using this ensures that you are using a matching library.
-inline ISteamUser *SteamAPI_SteamUser() { return SteamAPI_SteamUser_v021(); }
+inline ISteamUser *SteamAPI_SteamUser() { return SteamAPI_SteamUser_v022(); }
S_API HSteamUser SteamAPI_ISteamUser_GetHSteamUser( ISteamUser* self );
S_API bool SteamAPI_ISteamUser_BLoggedOn( ISteamUser* self );
S_API uint64_steamid SteamAPI_ISteamUser_GetSteamID( ISteamUser* self );
@@ -74,7 +74,7 @@ S_API EVoiceResult SteamAPI_ISteamUser_GetAvailableVoice( ISteamUser* self, uint S_API EVoiceResult SteamAPI_ISteamUser_GetVoice( ISteamUser* self, bool bWantCompressed, void * pDestBuffer, uint32 cbDestBufferSize, uint32 * nBytesWritten, bool bWantUncompressed_Deprecated, void * pUncompressedDestBuffer_Deprecated, uint32 cbUncompressedDestBufferSize_Deprecated, uint32 * nUncompressBytesWritten_Deprecated, uint32 nUncompressedVoiceDesiredSampleRate_Deprecated );
S_API EVoiceResult SteamAPI_ISteamUser_DecompressVoice( ISteamUser* self, const void * pCompressed, uint32 cbCompressed, void * pDestBuffer, uint32 cbDestBufferSize, uint32 * nBytesWritten, uint32 nDesiredSampleRate );
S_API uint32 SteamAPI_ISteamUser_GetVoiceOptimalSampleRate( ISteamUser* self );
-S_API HAuthTicket SteamAPI_ISteamUser_GetAuthSessionTicket( ISteamUser* self, void * pTicket, int cbMaxTicket, uint32 * pcbTicket );
+S_API HAuthTicket SteamAPI_ISteamUser_GetAuthSessionTicket( ISteamUser* self, void * pTicket, int cbMaxTicket, uint32 * pcbTicket, const SteamNetworkingIdentity * pSteamNetworkingIdentity );
S_API EBeginAuthSessionResult SteamAPI_ISteamUser_BeginAuthSession( ISteamUser* self, const void * pAuthTicket, int cbAuthTicket, uint64_steamid steamID );
S_API void SteamAPI_ISteamUser_EndAuthSession( ISteamUser* self, uint64_steamid steamID );
S_API void SteamAPI_ISteamUser_CancelAuthTicket( ISteamUser* self, HAuthTicket hAuthTicket );
@@ -510,6 +510,7 @@ S_API SteamAPICall_t SteamAPI_ISteamApps_GetFileDetails( ISteamApps* self, const S_API int SteamAPI_ISteamApps_GetLaunchCommandLine( ISteamApps* self, char * pszCommandLine, int cubCommandLine );
S_API bool SteamAPI_ISteamApps_BIsSubscribedFromFamilySharing( ISteamApps* self );
S_API bool SteamAPI_ISteamApps_BIsTimedTrial( ISteamApps* self, uint32 * punSecondsAllowed, uint32 * punSecondsPlayed );
+S_API bool SteamAPI_ISteamApps_SetDlcContext( ISteamApps* self, AppId_t nAppID );
// ISteamNetworking
@@ -706,6 +707,7 @@ S_API EInputActionOrigin SteamAPI_ISteamInput_TranslateActionOrigin( ISteamInput S_API bool SteamAPI_ISteamInput_GetDeviceBindingRevision( ISteamInput* self, InputHandle_t inputHandle, int * pMajor, int * pMinor );
S_API uint32 SteamAPI_ISteamInput_GetRemotePlaySessionID( ISteamInput* self, InputHandle_t inputHandle );
S_API uint16 SteamAPI_ISteamInput_GetSessionInputConfigurationSettings( ISteamInput* self );
+S_API void SteamAPI_ISteamInput_SetDualSenseTriggerEffect( ISteamInput* self, InputHandle_t inputHandle, const ScePadTriggerEffectParam * pParam );
// ISteamController
@@ -751,14 +753,14 @@ S_API bool SteamAPI_ISteamController_GetControllerBindingRevision( ISteamControl // ISteamUGC
// A versioned accessor is exported by the library
-S_API ISteamUGC *SteamAPI_SteamUGC_v016();
+S_API ISteamUGC *SteamAPI_SteamUGC_v017();
// Inline, unversioned accessor to get the current version. Essentially the same as SteamUGC(), but using this ensures that you are using a matching library.
-inline ISteamUGC *SteamAPI_SteamUGC() { return SteamAPI_SteamUGC_v016(); }
+inline ISteamUGC *SteamAPI_SteamUGC() { return SteamAPI_SteamUGC_v017(); }
// A versioned accessor is exported by the library
-S_API ISteamUGC *SteamAPI_SteamGameServerUGC_v016();
+S_API ISteamUGC *SteamAPI_SteamGameServerUGC_v017();
// Inline, unversioned accessor to get the current version. Essentially the same as SteamGameServerUGC(), but using this ensures that you are using a matching library.
-inline ISteamUGC *SteamAPI_SteamGameServerUGC() { return SteamAPI_SteamGameServerUGC_v016(); }
+inline ISteamUGC *SteamAPI_SteamGameServerUGC() { return SteamAPI_SteamGameServerUGC_v017(); }
S_API UGCQueryHandle_t SteamAPI_ISteamUGC_CreateQueryUserUGCRequest( ISteamUGC* self, AccountID_t unAccountID, EUserUGCList eListType, EUGCMatchingUGCType eMatchingUGCType, EUserUGCListSortOrder eSortOrder, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage );
S_API UGCQueryHandle_t SteamAPI_ISteamUGC_CreateQueryAllUGCRequestPage( ISteamUGC* self, EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage );
S_API UGCQueryHandle_t SteamAPI_ISteamUGC_CreateQueryAllUGCRequestCursor( ISteamUGC* self, EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, const char * pchCursor );
@@ -777,6 +779,7 @@ S_API bool SteamAPI_ISteamUGC_GetQueryUGCAdditionalPreview( ISteamUGC* self, UGC S_API uint32 SteamAPI_ISteamUGC_GetQueryUGCNumKeyValueTags( ISteamUGC* self, UGCQueryHandle_t handle, uint32 index );
S_API bool SteamAPI_ISteamUGC_GetQueryUGCKeyValueTag( ISteamUGC* self, UGCQueryHandle_t handle, uint32 index, uint32 keyValueTagIndex, char * pchKey, uint32 cchKeySize, char * pchValue, uint32 cchValueSize );
S_API bool SteamAPI_ISteamUGC_GetQueryFirstUGCKeyValueTag( ISteamUGC* self, UGCQueryHandle_t handle, uint32 index, const char * pchKey, char * pchValue, uint32 cchValueSize );
+S_API uint32 SteamAPI_ISteamUGC_GetQueryUGCContentDescriptors( ISteamUGC* self, UGCQueryHandle_t handle, uint32 index, EUGCContentDescriptorID * pvecDescriptors, uint32 cMaxEntries );
S_API bool SteamAPI_ISteamUGC_ReleaseQueryUGCRequest( ISteamUGC* self, UGCQueryHandle_t handle );
S_API bool SteamAPI_ISteamUGC_AddRequiredTag( ISteamUGC* self, UGCQueryHandle_t handle, const char * pTagName );
S_API bool SteamAPI_ISteamUGC_AddRequiredTagGroup( ISteamUGC* self, UGCQueryHandle_t handle, const SteamParamStringArray_t * pTagGroups );
@@ -818,6 +821,8 @@ S_API bool SteamAPI_ISteamUGC_AddItemPreviewVideo( ISteamUGC* self, UGCUpdateHan S_API bool SteamAPI_ISteamUGC_UpdateItemPreviewFile( ISteamUGC* self, UGCUpdateHandle_t handle, uint32 index, const char * pszPreviewFile );
S_API bool SteamAPI_ISteamUGC_UpdateItemPreviewVideo( ISteamUGC* self, UGCUpdateHandle_t handle, uint32 index, const char * pszVideoID );
S_API bool SteamAPI_ISteamUGC_RemoveItemPreview( ISteamUGC* self, UGCUpdateHandle_t handle, uint32 index );
+S_API bool SteamAPI_ISteamUGC_AddContentDescriptor( ISteamUGC* self, UGCUpdateHandle_t handle, EUGCContentDescriptorID descid );
+S_API bool SteamAPI_ISteamUGC_RemoveContentDescriptor( ISteamUGC* self, UGCUpdateHandle_t handle, EUGCContentDescriptorID descid );
S_API SteamAPICall_t SteamAPI_ISteamUGC_SubmitItemUpdate( ISteamUGC* self, UGCUpdateHandle_t handle, const char * pchChangeNote );
S_API EItemUpdateStatus SteamAPI_ISteamUGC_GetItemUpdateProgress( ISteamUGC* self, UGCUpdateHandle_t handle, uint64 * punBytesProcessed, uint64 * punBytesTotal );
S_API SteamAPICall_t SteamAPI_ISteamUGC_SetUserItemVote( ISteamUGC* self, PublishedFileId_t nPublishedFileID, bool bVoteUp );
@@ -1118,9 +1123,9 @@ S_API bool SteamAPI_ISteamNetworkingUtils_SteamNetworkingIdentity_ParseString( I // ISteamGameServer
// A versioned accessor is exported by the library
-S_API ISteamGameServer *SteamAPI_SteamGameServer_v014();
+S_API ISteamGameServer *SteamAPI_SteamGameServer_v015();
// Inline, unversioned accessor to get the current version. Essentially the same as SteamGameServer(), but using this ensures that you are using a matching library.
-inline ISteamGameServer *SteamAPI_SteamGameServer() { return SteamAPI_SteamGameServer_v014(); }
+inline ISteamGameServer *SteamAPI_SteamGameServer() { return SteamAPI_SteamGameServer_v015(); }
S_API void SteamAPI_ISteamGameServer_SetProduct( ISteamGameServer* self, const char * pszProduct );
S_API void SteamAPI_ISteamGameServer_SetGameDescription( ISteamGameServer* self, const char * pszGameDescription );
S_API void SteamAPI_ISteamGameServer_SetModDir( ISteamGameServer* self, const char * pszModDir );
@@ -1145,7 +1150,7 @@ S_API void SteamAPI_ISteamGameServer_SetGameTags( ISteamGameServer* self, const S_API void SteamAPI_ISteamGameServer_SetGameData( ISteamGameServer* self, const char * pchGameData );
S_API void SteamAPI_ISteamGameServer_SetRegion( ISteamGameServer* self, const char * pszRegion );
S_API void SteamAPI_ISteamGameServer_SetAdvertiseServerActive( ISteamGameServer* self, bool bActive );
-S_API HAuthTicket SteamAPI_ISteamGameServer_GetAuthSessionTicket( ISteamGameServer* self, void * pTicket, int cbMaxTicket, uint32 * pcbTicket );
+S_API HAuthTicket SteamAPI_ISteamGameServer_GetAuthSessionTicket( ISteamGameServer* self, void * pTicket, int cbMaxTicket, uint32 * pcbTicket, const SteamNetworkingIdentity * pSnid );
S_API EBeginAuthSessionResult SteamAPI_ISteamGameServer_BeginAuthSession( ISteamGameServer* self, const void * pAuthTicket, int cbAuthTicket, uint64_steamid steamID );
S_API void SteamAPI_ISteamGameServer_EndAuthSession( ISteamGameServer* self, uint64_steamid steamID );
S_API void SteamAPI_ISteamGameServer_CancelAuthTicket( ISteamGameServer* self, HAuthTicket hAuthTicket );
diff --git a/public/steam/steam_api_internal.h b/public/steam/steam_api_internal.h index ac005a86..86defb10 100644 --- a/public/steam/steam_api_internal.h +++ b/public/steam/steam_api_internal.h @@ -54,12 +54,6 @@ S_API void S_CALLTYPE SteamAPI_UnregisterCallback( class CCallbackBase *pCallbac S_API void S_CALLTYPE SteamAPI_RegisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall );
S_API void S_CALLTYPE SteamAPI_UnregisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall );
-// disable this warning; this pattern need for steam callback registration
-#ifdef _MSVC_VER
-#pragma warning( push )
-#pragma warning( disable: 4355 ) // 'this' : used in base member initializer list
-#endif
-
#define _STEAM_CALLBACK_AUTO_HOOK( thisclass, func, param )
#define _STEAM_CALLBACK_HELPER( _1, _2, SELECTED, ... ) _STEAM_CALLBACK_##SELECTED
#define _STEAM_CALLBACK_SELECT( X, Y ) _STEAM_CALLBACK_HELPER X Y
@@ -244,6 +238,9 @@ class ISteamInput; class ISteamParties;
class ISteamRemotePlay;
+// Forward declare types
+struct SteamNetworkingIdentity;
+
//-----------------------------------------------------------------------------
// Purpose: Base values for callback identifiers, each callback must
// have a unique ID.
@@ -289,10 +286,6 @@ enum { k_iSteamRemotePlayCallbacks = 5700 }; enum { k_iSteamChatCallbacks = 5900 };
// NOTE: Internal "IClientXxx" callback IDs go in clientenums.h
-#ifdef _MSVC_VER
-#pragma warning( pop )
-#endif
-
// Macros used to annotate various Steamworks interfaces to generate the
// flat API
#ifdef API_GEN
diff --git a/public/steam/steamclientpublic.h b/public/steam/steamclientpublic.h index 876b6dbe..ee6b9783 100644 --- a/public/steam/steamclientpublic.h +++ b/public/steam/steamclientpublic.h @@ -79,7 +79,7 @@ enum EResult k_EResultAccountLogonDenied = 63, // account login denied due to 2nd factor authentication failure
k_EResultCannotUseOldPassword = 64, // The requested new password is not legal
k_EResultInvalidLoginAuthCode = 65, // account login denied due to auth code invalid
- k_EResultAccountLogonDeniedNoMail = 66, // account login denied due to 2nd factor auth failure - and no mail has been sent
+ k_EResultAccountLogonDeniedNoMail = 66, // account login denied due to 2nd factor auth failure - and no mail has been sent - partner site specific
k_EResultHardwareNotCapableOfIPT = 67, //
k_EResultIPTInitError = 68, //
k_EResultParentalControlRestricted = 69, // operation failed due to parental control restrictions for current user
@@ -140,6 +140,7 @@ enum EResult k_EResultInsufficientBattery = 124, // user device doesn't have enough battery charge currently to complete the action
k_EResultChargerRequired = 125, // The operation requires a charger to be plugged in, which wasn't present
k_EResultCachedCredentialInvalid = 126, // Cached credential was invalid - user must reauthenticate
+ K_EResultPhoneNumberIsVOIP = 127, // The phone number provided is a Voice Over IP number
};
// Error codes for use with the voice functions
@@ -207,6 +208,7 @@ enum EAuthSessionResponse k_EAuthSessionResponseAuthTicketInvalidAlreadyUsed = 7, // This ticket has already been used, it is not valid.
k_EAuthSessionResponseAuthTicketInvalid = 8, // This ticket is not from a user instance currently connected to steam.
k_EAuthSessionResponsePublisherIssuedBan = 9, // The user is banned for this game. The ban came via the web api and not VAC
+ k_EAuthSessionResponseAuthTicketNetworkIdentityFailure = 10, // The network identity in the ticket does not match the server authenticating the ticket
};
// results from UserHasLicenseForApp
@@ -309,6 +311,7 @@ enum EChatSteamIDInstanceFlags //-----------------------------------------------------------------------------
enum ENotificationPosition
{
+ k_EPositionInvalid = -1,
k_EPositionTopLeft = 0,
k_EPositionTopRight = 1,
k_EPositionBottomLeft = 2,
@@ -907,6 +910,14 @@ class CGameID {
public:
+ enum EGameIDType
+ {
+ k_EGameIDTypeApp = 0,
+ k_EGameIDTypeGameMod = 1,
+ k_EGameIDTypeShortcut = 2,
+ k_EGameIDTypeP2P = 3,
+ };
+
CGameID()
{
m_gameID.m_nType = k_EGameIDTypeApp;
@@ -937,12 +948,12 @@ public: m_gameID.m_nAppID = nAppID;
}
- CGameID( uint32 nAppID, uint32 nModID )
+ // Not validating anything .. use IsValid()
+ explicit CGameID( uint32 nAppID, uint32 nModID, CGameID::EGameIDType nType )
{
- m_ulGameID = 0;
m_gameID.m_nAppID = nAppID;
m_gameID.m_nModID = nModID;
- m_gameID.m_nType = k_EGameIDTypeGameMod;
+ m_gameID.m_nType = nType;
}
CGameID( const CGameID &that )
@@ -1001,10 +1012,14 @@ public: return m_gameID.m_nModID;
}
- uint32 AppID() const
+#if !defined(VALVE_SHORTCUT_DEBUG)
+ uint32 AppID( bool = false ) const
{
return m_gameID.m_nAppID;
}
+#else
+ uint32 AppID( bool bShortcutOK = false ) const;
+#endif
bool operator == ( const CGameID &rhs ) const
{
@@ -1030,13 +1045,15 @@ public: return m_gameID.m_nAppID != k_uAppIdInvalid;
case k_EGameIDTypeGameMod:
- return m_gameID.m_nAppID != k_uAppIdInvalid && m_gameID.m_nModID & 0x80000000;
+ return m_gameID.m_nAppID != k_uAppIdInvalid && (m_gameID.m_nModID & 0x80000000);
case k_EGameIDTypeShortcut:
- return (m_gameID.m_nModID & 0x80000000) != 0;
+ return m_gameID.m_nAppID == k_uAppIdInvalid
+ && (m_gameID.m_nModID & 0x80000000)
+ && m_gameID.m_nModID >= (5000 | 0x80000000); // k_unMaxExpectedLocalAppId - shortcuts are pushed beyond that range
case k_EGameIDTypeP2P:
- return m_gameID.m_nAppID == k_uAppIdInvalid && m_gameID.m_nModID & 0x80000000;
+ return m_gameID.m_nAppID == k_uAppIdInvalid && (m_gameID.m_nModID & 0x80000000);
default:
return false;
@@ -1053,14 +1070,6 @@ public: // Internal stuff. Use the accessors above if possible
//
- enum EGameIDType
- {
- k_EGameIDTypeApp = 0,
- k_EGameIDTypeGameMod = 1,
- k_EGameIDTypeShortcut = 2,
- k_EGameIDTypeP2P = 3,
- };
-
struct GameID_t
{
#ifdef VALVE_BIG_ENDIAN
@@ -1079,6 +1088,8 @@ public: uint64 m_ulGameID;
GameID_t m_gameID;
};
+
+ friend CGameID GameIDFromAppAndModPath( uint32 nAppID, const char *pchModPath );
};
#pragma pack( pop )
@@ -1134,7 +1145,7 @@ enum ESteamIPv6ConnectivityState // Define compile time assert macros to let us validate the structure sizes.
#define VALVE_COMPILE_TIME_ASSERT( pred ) typedef char compile_time_assert_type[(pred) ? 1 : -1];
-#if defined(__linux__) || defined(__APPLE__)
+#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
// The 32-bit version of gcc has the alignment requirement for uint64 and double set to
// 4 meaning that even with #pragma pack(8) these types will only be four-byte aligned.
// The 64-bit version of gcc has the alignment requirement for these types set to
diff --git a/public/steam/steamhttpenums.h b/public/steam/steamhttpenums.h index ff8551ef..ecb21ed7 100644 --- a/public/steam/steamhttpenums.h +++ b/public/steam/steamhttpenums.h @@ -62,6 +62,7 @@ enum EHTTPStatusCode k_EHTTPStatusCode305UseProxy = 305,
//k_EHTTPStatusCode306Unused = 306, (used in old HTTP spec, now unused in 1.1)
k_EHTTPStatusCode307TemporaryRedirect = 307,
+ k_EHTTPStatusCode308PermanentRedirect = 308,
// Error codes
k_EHTTPStatusCode400BadRequest = 400,
diff --git a/public/steam/steamnetworkingtypes.h b/public/steam/steamnetworkingtypes.h index ebcbdfd3..a1b93924 100644 --- a/public/steam/steamnetworkingtypes.h +++ b/public/steam/steamnetworkingtypes.h @@ -1699,7 +1699,7 @@ inline SteamNetworkingPOPID CalculateSteamNetworkingPOPIDFromString( const char //
// There is also extra paranoia to make sure the bytes are not treated as signed.
SteamNetworkingPOPID result = (uint32)(uint8)pszCode[0] << 16U;
- if ( pszCode[1] )
+ if ( result && pszCode[1] )
{
result |= ( (uint32)(uint8)pszCode[1] << 8U );
if ( pszCode[2] )
diff --git a/public/steam/steamtypes.h b/public/steam/steamtypes.h index 966aa122..49653c4a 100644 --- a/public/steam/steamtypes.h +++ b/public/steam/steamtypes.h @@ -1,27 +1,20 @@ -//========= Copyright © 1996-2008, Valve LLC, All rights reserved. ============
-//
-// Purpose:
-//
-//=============================================================================
+//========= Copyright 1996-2022, Valve LLC, All rights reserved. ============
#ifndef STEAMTYPES_H
#define STEAMTYPES_H
-#ifdef _WIN32
-#pragma once
-#endif
#define S_CALLTYPE __cdecl
+// WARNING: __cdecl is potentially #defined away in steam_api_common.h
// Steam-specific types. Defined here so this header file can be included in other code bases.
#ifndef WCHARTYPES_H
typedef unsigned char uint8;
#endif
-#if defined( __GNUC__ ) && !defined(_WIN32) && !defined(POSIX)
+#ifdef __GNUC__
#if __GNUC__ < 4
#error "Steamworks requires GCC 4.X (4.2 or 4.4 have been tested)"
#endif
- #define POSIX 1
#endif
#if defined(__LP64__) || defined(__x86_64__) || defined(_WIN64) || defined(__aarch64__) || defined(__s390x__)
diff --git a/release_checklist.md b/release_checklist.md index f5c02b3b..acb88d67 100644 --- a/release_checklist.md +++ b/release_checklist.md @@ -24,7 +24,7 @@ 1. `git push` from main development machine, check the branch -2. Start the `endeavouros64` VirtualBox virtual machine +2. Start the `ubuntu2204lts` VirtualBox virtual machine 3. Go into `SSVOpenHexagon` directory @@ -36,6 +36,10 @@ 7. The Linux client build will automatically be copied to the main development machine's drive +8. Run `/c/OHWorkspace/steamworks/sdk/tools/SteamPipeGUI.exe` and upload to Steam + + - Use depot ID `1358092`, build path `C:\OHWorkspace\SSVOpenHexagon\_PREPARED_RELEASE_LINUX` +- ## Windows Client 1. Run `SSVOpenHexagon/buildrel/make_release_client_win10_msys.sh` @@ -54,6 +58,8 @@ 4. Run `/c/OHWorkspace/steamworks/sdk/tools/SteamPipeGUI.exe` and upload to Steam + - Use depot ID `1358091`, build path `C:\OHWorkspace\SSVOpenHexagon\_PREPARED_RELEASE` + 5. For non-betas, go to <https://partner.steamgames.com/apps/builds/1358090>, log in with build account (not personal one), and put the latest build live ## Lua Reference @@ -86,4 +92,14 @@ 2. Put level validator strings in `Config.cpp`. -3. TODO +3. Upload workshop folders from `C:\Program Files (x86)\Steam\steamapps\workshop\content\1358090` to the server's `Packs` folder. + +4. Delete the server's `config.json` to re-create a new one. + +5. Restart the server and test. + +## Other + +- Ubuntu machine packages: + + - sudo apt-get install build-essential clang++-12 g++ g++-12 git libfreetype6-dev libgl1-mesa-dev libglew-dev libjpeg-dev libopenal-dev libpthread-stubs0-dev libsndfile1-dev libx11-dev libxrandr-dev lld ninja-build xorg-dev xserver-xorg-dev libudev-dev vim steam diff --git a/src/SSVOpenHexagon/Components/CPlayer.cpp b/src/SSVOpenHexagon/Components/CPlayer.cpp index efded9fb..e2409dde 100644 --- a/src/SSVOpenHexagon/Components/CPlayer.cpp +++ b/src/SSVOpenHexagon/Components/CPlayer.cpp @@ -353,7 +353,7 @@ template <typename Wall> const std::array<sf::Vector2f, 4> collisionPolygon{ wVertexes[i], wOldVertexes[i], wOldVertexes[j], wVertexes[j]}; - if(Utils::pointInPolygon(collisionPolygon, _lastPos.x, _lastPos.y)) + if(Utils::pointInPolygon<4>(collisionPolygon, _lastPos.x, _lastPos.y)) { // For a side to be an effective source of push it must have // intersected the player's positions circle both now and the diff --git a/src/SSVOpenHexagon/Core/BindControl.cpp b/src/SSVOpenHexagon/Core/BindControl.cpp index d3092d14..90c4af07 100644 --- a/src/SSVOpenHexagon/Core/BindControl.cpp +++ b/src/SSVOpenHexagon/Core/BindControl.cpp @@ -166,7 +166,7 @@ void JoystickBindControl::newJoystickBind(const unsigned int joy) [[nodiscard]] std::string JoystickBindControl::getName() const { std::string bindName = - Config::getJoystickBindNames(static_cast<Joystick::Jid>(ID)); + Config::getJoystickBindName(static_cast<Joystick::Jid>(ID)); if(waitingForBind) { diff --git a/src/SSVOpenHexagon/Core/CCustomWallManager.cpp b/src/SSVOpenHexagon/Core/CCustomWallManager.cpp index a3c38792..33faf39a 100644 --- a/src/SSVOpenHexagon/Core/CCustomWallManager.cpp +++ b/src/SSVOpenHexagon/Core/CCustomWallManager.cpp @@ -9,7 +9,6 @@ #include <SSVUtils/Core/Log/Log.hpp> #include <SSVUtils/Core/Utils/Containers.hpp> -#include <SSVUtils/Core/Common/LikelyUnlikely.hpp> namespace hg { @@ -24,7 +23,7 @@ namespace hg { [[nodiscard]] bool CCustomWallManager::checkValidHandle( const CCustomWallHandle h, const char* msg) { - if(SSVU_UNLIKELY(_handleAvailable[h])) + if(_handleAvailable[h]) [[unlikely]] { ssvu::lo("CustomWallManager") << "Attempted to " << msg << " of invalid custom wall " << h @@ -41,7 +40,7 @@ namespace hg { [[nodiscard]] bool CCustomWallManager::checkValidVertexIdx( const CCustomWallHandle h, const int vertexIdx, const char* msg) { - if(SSVU_UNLIKELY(vertexIdx < 0 || vertexIdx > 3)) + if(vertexIdx < 0 || vertexIdx > 3) [[unlikely]] { ssvu::lo("CustomWallManager") << "Invalid vertex index " << vertexIdx << " for custom wall " << h @@ -62,7 +61,7 @@ namespace hg { [[nodiscard]] CCustomWallHandle CCustomWallManager::create( void (*fAfterCreate)(CCustomWall&)) { - if(SSVU_UNLIKELY(_freeHandles.empty())) + if(_freeHandles.empty()) [[unlikely]] { const std::size_t reserveSize = 32 + _nextFreeHandle * 2; const std::size_t maxHandleIndex = _nextFreeHandle + reserveSize; @@ -109,7 +108,7 @@ void CCustomWallManager::destroyUnchecked(const CCustomWallHandle cwHandle) void CCustomWallManager::destroy(const CCustomWallHandle cwHandle) { - if(SSVU_UNLIKELY(_handleAvailable[cwHandle])) + if(_handleAvailable[cwHandle]) [[unlikely]] { ssvu::lo("CustomWallManager") << "Attempted to destroy invalid wall " << cwHandle << '\n'; @@ -178,7 +177,7 @@ void CCustomWallManager::setDeadly( void CCustomWallManager::setKillingSide( const CCustomWallHandle cwHandle, const std::uint8_t side) { - if(SSVU_UNLIKELY(side > 3u)) + if(side > 3u) [[unlikely]] { ssvu::lo("CustomWallManager") << "Attempted to set killing side with invalid value " << side @@ -319,7 +318,7 @@ void CCustomWallManager::clear() void CCustomWallManager::draw(Utils::FastVertexVectorTris& wallQuads) { - for(CCustomWallHandle h = 0; h < (int)_customWalls.size(); ++h) + for(CCustomWallHandle h = 0; h < static_cast<int>(_customWalls.size()); ++h) { if(!_handleAvailable[h]) { diff --git a/src/SSVOpenHexagon/Core/CustomTimelineManager.cpp b/src/SSVOpenHexagon/Core/CustomTimelineManager.cpp index 6f43e551..8a2bafb4 100644 --- a/src/SSVOpenHexagon/Core/CustomTimelineManager.cpp +++ b/src/SSVOpenHexagon/Core/CustomTimelineManager.cpp @@ -2,8 +2,6 @@ // License: Academic Free License ("AFL") v. 3.0 // AFL License page: https://opensource.org/licenses/AFL-3.0 -#pragma once - #include "SSVOpenHexagon/Core/CustomTimelineManager.hpp" #include "SSVOpenHexagon/Core/CustomTimeline.hpp" diff --git a/src/SSVOpenHexagon/Core/HGGraphics.cpp b/src/SSVOpenHexagon/Core/HGGraphics.cpp index 5835a2e3..5e730961 100644 --- a/src/SSVOpenHexagon/Core/HGGraphics.cpp +++ b/src/SSVOpenHexagon/Core/HGGraphics.cpp @@ -579,7 +579,7 @@ void HexagonGame::updateText(ssvu::FT mFT) if(!levelStatus.scoreOverridden) { - os << formatTime(rf._played_score / 60.0) << "s"; + os << formatTime(rf.played_seconds()) << "s"; } else { diff --git a/src/SSVOpenHexagon/Core/HGScripting.cpp b/src/SSVOpenHexagon/Core/HGScripting.cpp index 974b673c..85585dc2 100644 --- a/src/SSVOpenHexagon/Core/HGScripting.cpp +++ b/src/SSVOpenHexagon/Core/HGScripting.cpp @@ -75,6 +75,11 @@ void HexagonGame::initLua_Utils() addLuaFn(lua, "u_log", // [this](const std::string& mLog) { + if(window == nullptr) // headless + { + return; + } + ssvu::lo("lua") << mLog << '\n'; ilcCmdLog.emplace_back("[lua]: " + mLog + '\n'); }) diff --git a/src/SSVOpenHexagon/Core/HGUpdate.cpp b/src/SSVOpenHexagon/Core/HGUpdate.cpp index bbd1adc8..fb1453f8 100644 --- a/src/SSVOpenHexagon/Core/HGUpdate.cpp +++ b/src/SSVOpenHexagon/Core/HGUpdate.cpp @@ -314,7 +314,7 @@ void HexagonGame::update(ssvu::FT mFT, const float timescale) if(!Config::getBlackAndWhite()) { - styleData.update(mFT, pow(difficultyMult, 0.8f)); + styleData.update(mFT, std::pow(difficultyMult, 0.8f)); } player.updatePosition(getRadius()); diff --git a/src/SSVOpenHexagon/Core/HexagonClient.cpp b/src/SSVOpenHexagon/Core/HexagonClient.cpp index f9665963..2741c194 100644 --- a/src/SSVOpenHexagon/Core/HexagonClient.cpp +++ b/src/SSVOpenHexagon/Core/HexagonClient.cpp @@ -259,7 +259,7 @@ template <typename T> { SSVOH_CLOG_VERBOSE << "Sending registration request to server...\n"; - return sendEncrypted( // + return sendEncrypted( // CTSPRegister{ .steamId = steamId, // .name = name, // @@ -273,7 +273,7 @@ template <typename T> { SSVOH_CLOG_VERBOSE << "Sending login request to server...\n"; - return sendEncrypted( // + return sendEncrypted( // CTSPLogin{ .steamId = steamId, // .name = name, // @@ -293,7 +293,7 @@ template <typename T> { SSVOH_CLOG_VERBOSE << "Sending delete account request to server...\n"; - return sendEncrypted( // + return sendEncrypted( // CTSPDeleteAccount{ .steamId = steamId, // .passwordHash = passwordHash // @@ -306,7 +306,7 @@ template <typename T> { SSVOH_CLOG_VERBOSE << "Sending top scores request to server...\n"; - return sendEncrypted( // + return sendEncrypted( // CTSPRequestTopScores{ .loginToken = loginToken, // .levelValidator = levelValidator // @@ -319,7 +319,7 @@ template <typename T> { SSVOH_CLOG_VERBOSE << "Sending own score request to server...\n"; - return sendEncrypted( // + return sendEncrypted( // CTSPRequestOwnScore{ .loginToken = loginToken, // .levelValidator = levelValidator // @@ -333,7 +333,7 @@ template <typename T> SSVOH_CLOG_VERBOSE << "Sending top scores and own score request to server...\n"; - return sendEncrypted( // + return sendEncrypted( // CTSPRequestTopScoresAndOwnScore{ .loginToken = loginToken, // .levelValidator = levelValidator // @@ -346,7 +346,7 @@ template <typename T> { SSVOH_CLOG_VERBOSE << "Sending started game packet to server...\n"; - return sendEncrypted( // + return sendEncrypted( // CTSPStartedGame{ .loginToken = loginToken, // .levelValidator = levelValidator // @@ -361,7 +361,7 @@ template <typename T> SSVOH_CLOG_VERBOSE << "Sending compressed replay for level validator '" << levelValidator << "' to server...\n"; - return sendEncrypted( // + return sendEncrypted( // CTSPCompressedReplay{ .loginToken = loginToken, // .compressedReplayFile = compressedReplayFile // @@ -374,7 +374,7 @@ template <typename T> { SSVOH_CLOG_VERBOSE << "Sending status request to server...\n"; - return sendEncrypted( // + return sendEncrypted( // CTSPRequestServerStatus{ .loginToken = loginToken, // } // @@ -385,7 +385,7 @@ template <typename T> { SSVOH_CLOG_VERBOSE << "Sending ready to server...\n"; - return sendEncrypted( // + return sendEncrypted( // CTSPReady{ .loginToken = loginToken, // } // diff --git a/src/SSVOpenHexagon/Core/HexagonGame.cpp b/src/SSVOpenHexagon/Core/HexagonGame.cpp index a5ebcd01..5b5241bc 100644 --- a/src/SSVOpenHexagon/Core/HexagonGame.cpp +++ b/src/SSVOpenHexagon/Core/HexagonGame.cpp @@ -10,6 +10,7 @@ #include "SSVOpenHexagon/Data/StyleData.hpp" #include "SSVOpenHexagon/Data/PackData.hpp" #include "SSVOpenHexagon/Data/PackInfo.hpp" +#include "SSVOpenHexagon/Data/ProfileData.hpp" #include "SSVOpenHexagon/Global/Assert.hpp" #include "SSVOpenHexagon/Global/Assets.hpp" @@ -777,7 +778,7 @@ void HexagonGame::newGame(const std::string& mPackId, const std::string& mId, // Add joystick buttons if any and finalize message std::string joystickButton = - Config::getJoystickBindNames(Joystick::Jid::Restart); + Config::getJoystickBindName(Joystick::Jid::Restart); if(!status.restartInput.empty()) { if(!joystickButton.empty()) @@ -797,7 +798,7 @@ void HexagonGame::newGame(const std::string& mPackId, const std::string& mId, status.restartInput = "NO RESTART BUTTON SET\n"; } - joystickButton = Config::getJoystickBindNames(Joystick::Jid::Replay); + joystickButton = Config::getJoystickBindName(Joystick::Jid::Replay); if(!status.replayInput.empty()) { if(!joystickButton.empty()) diff --git a/src/SSVOpenHexagon/Core/HexagonServer.cpp b/src/SSVOpenHexagon/Core/HexagonServer.cpp index 7644d110..b5a179aa 100644 --- a/src/SSVOpenHexagon/Core/HexagonServer.cpp +++ b/src/SSVOpenHexagon/Core/HexagonServer.cpp @@ -178,7 +178,7 @@ template <typename T> [[nodiscard]] bool HexagonServer::sendLoginSuccess(ConnectedClient& c, const std::uint64_t loginToken, const std::string& loginName) { - return sendEncrypted(c, // + return sendEncrypted(c, // STCPLoginSuccess{ .loginToken = static_cast<std::uint64_t>(loginToken), // .loginName = loginName // @@ -217,7 +217,7 @@ template <typename T> const std::string& levelValidator, const std::vector<Database::ProcessedScore>& scores) { - return sendEncrypted(c, // + return sendEncrypted(c, // STCPTopScores{ .levelValidator = levelValidator, // .scores = scores // @@ -228,7 +228,7 @@ template <typename T> [[nodiscard]] bool HexagonServer::sendOwnScore(ConnectedClient& c, const std::string& levelValidator, const Database::ProcessedScore& score) { - return sendEncrypted(c, // + return sendEncrypted(c, // STCPOwnScore{ .levelValidator = levelValidator, // .score = score // @@ -241,7 +241,7 @@ template <typename T> const std::vector<Database::ProcessedScore>& scores, const std::optional<Database::ProcessedScore>& ownScore) { - return sendEncrypted(c, // + return sendEncrypted(c, // STCPTopScoresAndOwnScore{ .levelValidator = levelValidator, // .scores = scores, // @@ -254,7 +254,7 @@ template <typename T> const ProtocolVersion& protocolVersion, const GameVersion& gameVersion, const std::vector<std::string>& supportedLevelValidators) { - return sendEncrypted(c, // + return sendEncrypted(c, // STCPServerStatus{ .protocolVersion = protocolVersion, // .gameVersion = gameVersion, // @@ -654,7 +654,8 @@ void HexagonServer::runIteration_FlushLogs() const auto discard = [&](const auto&... reason) { SSVOH_SLOG << "Discarding replay from client '" << clientAddr << "', " - << Utils::concat(reason...) << '\n'; + << Utils::concat(reason...) << ", replay time was " + << rf.played_seconds() << "s\n"; return true; }; @@ -687,13 +688,16 @@ void HexagonServer::runIteration_FlushLogs() SSVOH_SLOG << "Processing replay from client '" << clientAddr << "' for level '" << levelValidator << "'\n"; + constexpr int maxProcessingSeconds = 5; + const std::optional<HexagonGame::GameExecutionResult> ger = _hexagonGame.runReplayUntilDeathAndGetScore( - rf, 5 /* maxProcessingSeconds */, 1.f /* timescale */); + rf, maxProcessingSeconds, 1.f /* timescale */); if(!ger.has_value()) { - return discard("max processing time exceeded"); + return discard( + "max processing time exceeded (", maxProcessingSeconds, "s)"); } const double replayTotalTime = ger->totalTimeSeconds; diff --git a/src/SSVOpenHexagon/Core/Joystick.cpp b/src/SSVOpenHexagon/Core/Joystick.cpp index fca3e14b..45e69c43 100644 --- a/src/SSVOpenHexagon/Core/Joystick.cpp +++ b/src/SSVOpenHexagon/Core/Joystick.cpp @@ -128,8 +128,6 @@ enum class AxisDir : int void update(const float deadzone) { - sf::Joystick::update(); // TODO: no need to call??? - constexpr unsigned int joyId = 0; auto& s = getJoystickState(); diff --git a/src/SSVOpenHexagon/Core/LuaScripting.cpp b/src/SSVOpenHexagon/Core/LuaScripting.cpp index 2f4b3f62..94201365 100644 --- a/src/SSVOpenHexagon/Core/LuaScripting.cpp +++ b/src/SSVOpenHexagon/Core/LuaScripting.cpp @@ -1130,20 +1130,21 @@ static void initStyleControl(Lua::LuaContext& lua, StyleData& styleData) "Sets the rotation offset of the background panels to `$0` degrees."); addLuaFn(lua, "s_setCapColorMain", // - [&styleData] { styleData.setCapColor(CapColorMode::Main{}); }) + [&styleData] { styleData.setCapColor(CapColor{CapColorMode::Main{}}); }) .doc( "Set the color of the center polygon to match the main style " "color."); addLuaFn(lua, "s_setCapColorMainDarkened", // - [&styleData] { styleData.setCapColor(CapColorMode::MainDarkened{}); }) + [&styleData] + { styleData.setCapColor(CapColor{CapColorMode::MainDarkened{}}); }) .doc( "Set the color of the center polygon to match the main style " "color, darkened."); addLuaFn(lua, "s_setCapColorByIndex", // [&styleData](int mIndex) - { styleData.setCapColor(CapColorMode::ByIndex{mIndex}); }) + { styleData.setCapColor(CapColor{CapColorMode::ByIndex{mIndex}}); }) .arg("index") .doc( "Set the color of the center polygon to match the style color with " diff --git a/src/SSVOpenHexagon/Core/MenuGame.cpp b/src/SSVOpenHexagon/Core/MenuGame.cpp index 4dcc6f7a..00a35f40 100644 --- a/src/SSVOpenHexagon/Core/MenuGame.cpp +++ b/src/SSVOpenHexagon/Core/MenuGame.cpp @@ -3053,7 +3053,8 @@ void MenuGame::setIndex(const int mIdx) // Set gameplay values diffMultIdx = 0; for(; levelData->difficultyMults.at(diffMultIdx) != 1.f; ++diffMultIdx) - {} + { + } try { diff --git a/src/SSVOpenHexagon/Core/Replay.cpp b/src/SSVOpenHexagon/Core/Replay.cpp index f440386a..079207ef 100644 --- a/src/SSVOpenHexagon/Core/Replay.cpp +++ b/src/SSVOpenHexagon/Core/Replay.cpp @@ -8,8 +8,6 @@ #include "SSVOpenHexagon/Utils/Concat.hpp" #include "SSVOpenHexagon/Utils/Timestamp.hpp" -#include <SSVUtils/Core/Common/LikelyUnlikely.hpp> - #include <SFML/Network/Packet.hpp> #include <zlib.h> @@ -29,17 +27,17 @@ namespace hg { ::std::cerr << "Failed [de]serialization operation '" << code << "'\n"; } -#define SSVOH_TRY(...) \ - do \ - { \ - __VA_ARGS__; \ - \ - if(SSVU_UNLIKELY(!result._success)) \ - { \ - printTryFailure(#__VA_ARGS__); \ - return result; \ - } \ - } \ +#define SSVOH_TRY(...) \ + do \ + { \ + __VA_ARGS__; \ + \ + if(!result._success) [[unlikely]] \ + { \ + printTryFailure(#__VA_ARGS__); \ + return result; \ + } \ + } \ while(false) static auto make_write(serialization_result& result, std::byte*& buffer, @@ -428,7 +426,12 @@ static constexpr std::size_t buf_size{2097152}; // 2MB const std::string tp_str = Utils::formatTimepoint(tp, "%Y%m%d_%H%M%S"); return Utils::concat(_version, '_', tp_str, '_', _player_name, '_', - _level_id, '_', _difficulty_mult, "x_", _played_score / 60.0, "s.ohr"); + _level_id, '_', _difficulty_mult, "x_", played_seconds(), "s.ohr"); +} + +[[nodiscard]] double replay_file::played_seconds() const noexcept +{ + return _played_score / 60.0; } [[nodiscard]] bool compressed_replay_file::serialize_to_file( diff --git a/src/SSVOpenHexagon/Core/Steam.cpp b/src/SSVOpenHexagon/Core/Steam.cpp index b46322c1..a5c10eb8 100644 --- a/src/SSVOpenHexagon/Core/Steam.cpp +++ b/src/SSVOpenHexagon/Core/Steam.cpp @@ -38,7 +38,7 @@ namespace hg::Steam { { // Using C API here because C++ one doesn't work with MinGW. - ISteamUser* steam_user = SteamAPI_SteamUser_v021(); + ISteamUser* steam_user = SteamAPI_SteamUser_v022(); if(!SteamAPI_ISteamUser_BLoggedOn(steam_user)) { diff --git a/src/SSVOpenHexagon/Core/main.cpp b/src/SSVOpenHexagon/Core/main.cpp index d4da8091..42f40408 100644 --- a/src/SSVOpenHexagon/Core/main.cpp +++ b/src/SSVOpenHexagon/Core/main.cpp @@ -199,6 +199,13 @@ getFirstCompressedReplayFilenameFromArgs(const std::vector<std::string>& args) hg::Steam::steam_manager steamManager; hg::Config::loadConfig({} /* overrideIds */); + hg::Config::setUseLuaFileCache(true); + + HG_SCOPE_GUARD({ + ssvu::lo("::main") << "Saving config...\n"; + hg::Config::saveConfig(); + ssvu::lo("::main") << "Done saving config\n"; + }); hg::HGAssets assets{ &steamManager, // @@ -275,6 +282,8 @@ getFirstCompressedReplayFilenameFromArgs(const std::vector<std::string>& args) hg::Config::loadConfig(args); hg::Config::reapplyResolution(); + // TODO (P0): server gets ALSA errors during asset load, is it loading + // musics/sounds? HG_SCOPE_GUARD({ ssvu::lo("::main") << "Saving config...\n"; hg::Config::saveConfig(); @@ -385,7 +394,7 @@ getFirstCompressedReplayFilenameFromArgs(const std::vector<std::string>& args) [&assets](const std::string& assetId) -> sf::SoundBuffer* { return assets.getSoundBuffer(assetId); }, // [&assets](const std::string& assetId) -> const std::string* - { return assets.getMusicPath(assetId); } // + { return assets.getMusicPath(assetId); } // }; audio.setSoundVolume(hg::Config::getSoundVolume()); @@ -427,7 +436,7 @@ getFirstCompressedReplayFilenameFromArgs(const std::vector<std::string>& args) mg->fnHGTriggerRefresh = [&](const ssvs::Input::Trigger& trigger, int bindId) // { - hg.refreshTrigger(trigger, bindId); // + hg.refreshTrigger(trigger, bindId); // }; mg->fnHGNewGame = [&](const std::string& packId, diff --git a/src/SSVOpenHexagon/Data/CapColor.cpp b/src/SSVOpenHexagon/Data/CapColor.cpp index ebffc4f0..5cec160d 100644 --- a/src/SSVOpenHexagon/Data/CapColor.cpp +++ b/src/SSVOpenHexagon/Data/CapColor.cpp @@ -21,12 +21,12 @@ namespace hg { if(str == "main") { - return CapColorMode::Main{}; + return CapColor{CapColorMode::Main{}}; } if(str == "main_darkened") { - return CapColorMode::MainDarkened{}; + return CapColor{CapColorMode::MainDarkened{}}; } } @@ -36,22 +36,23 @@ namespace hg { if(legacy) { const int index = ssvuj::getExtr<int>(obj, "index", 0); - return CapColorMode::ByIndex{index}; + return CapColor{CapColorMode::ByIndex{index}}; } else { - return ColorData{false, ssvuj::getExtr<bool>(obj, "dynamic", false), - ssvuj::getExtr<bool>(obj, "dynamic_offset", false), - ssvuj::getExtr<float>(obj, "dynamic_darkness", 1.f), - ssvuj::getExtr<float>(obj, "hue_shift", 0.f), - ssvuj::getExtr<float>(obj, "offset", 0.f), - ssvuj::getExtr<sf::Color>(obj, "value", sf::Color::White), - hg::pulse_from_json(obj)}; + return CapColor{ + ColorData{false, ssvuj::getExtr<bool>(obj, "dynamic", false), + ssvuj::getExtr<bool>(obj, "dynamic_offset", false), + ssvuj::getExtr<float>(obj, "dynamic_darkness", 1.f), + ssvuj::getExtr<float>(obj, "hue_shift", 0.f), + ssvuj::getExtr<float>(obj, "offset", 0.f), + ssvuj::getExtr<sf::Color>(obj, "value", sf::Color::White), + hg::pulse_from_json(obj)}}; } } // Fallback case: - return CapColorMode::ByIndex{0}; + return CapColor{CapColorMode::ByIndex{0}}; } } // namespace hg diff --git a/src/SSVOpenHexagon/Data/StyleData.cpp b/src/SSVOpenHexagon/Data/StyleData.cpp index 0db0a06e..2b48832d 100644 --- a/src/SSVOpenHexagon/Data/StyleData.cpp +++ b/src/SSVOpenHexagon/Data/StyleData.cpp @@ -56,11 +56,11 @@ StyleData::StyleData(const ssvuj::Obj& mRoot) ssvuj::getExtr<float>(mRoot, "3D_perspective_multiplier", 1.f)}, _3dOverrideColor{ssvuj::getExtr<sf::Color>( mRoot, "3D_override_color", sf::Color::Transparent)}, - mainColorData{ssvuj::getObj(mRoot, "main")}, // + mainColorData{ssvuj::getObj(mRoot, "main")}, // playerColor{ colorDataFromObjOrDefault(mRoot, "player_color", mainColorData)}, // textColor{ - colorDataFromObjOrDefault(mRoot, "text_color", mainColorData)}, // + colorDataFromObjOrDefault(mRoot, "text_color", mainColorData)}, // wallColor{colorDataFromObjOrDefault(mRoot, "wall_color", mainColorData)}, capColor{parseCapColor(ssvuj::getObj(mRoot, "cap_color"))} { @@ -341,9 +341,8 @@ StyleData::getColors() const noexcept sf::Color StyleData::getCapColorResult() const noexcept { - return Utils::match( - capColor, // - [this](CapColorMode::Main) { return getMainColor(); }, // + return capColor.linear_match( // + [this](CapColorMode::Main) { return getMainColor(); }, // [this](CapColorMode::MainDarkened) { return Utils::getColorDarkened(getMainColor(), 1.4f); }, // [this](CapColorMode::ByIndex x) { return getColor(x._index); }, // diff --git a/src/SSVOpenHexagon/Global/Assets.cpp b/src/SSVOpenHexagon/Global/Assets.cpp index 8e8f596e..112d96ef 100644 --- a/src/SSVOpenHexagon/Global/Assets.cpp +++ b/src/SSVOpenHexagon/Global/Assets.cpp @@ -6,14 +6,17 @@ #include "SSVOpenHexagon/Core/Steam.hpp" -#include "SSVOpenHexagon/Data/MusicData.hpp" #include "SSVOpenHexagon/Data/LevelData.hpp" -#include "SSVOpenHexagon/Data/StyleData.hpp" +#include "SSVOpenHexagon/Data/LoadInfo.hpp" +#include "SSVOpenHexagon/Data/MusicData.hpp" #include "SSVOpenHexagon/Data/PackData.hpp" #include "SSVOpenHexagon/Data/PackInfo.hpp" +#include "SSVOpenHexagon/Data/ProfileData.hpp" +#include "SSVOpenHexagon/Data/StyleData.hpp" #include "SSVOpenHexagon/Global/Assert.hpp" #include "SSVOpenHexagon/Global/AssetStorage.hpp" +#include "SSVOpenHexagon/Global/Macros.hpp" #include "SSVOpenHexagon/Global/UtilsJson.hpp" #include "SSVOpenHexagon/Global/Version.hpp" @@ -40,12 +43,183 @@ namespace hg { -struct HGAssets::LoadedShader +class HGAssets::HGAssetsImpl { - Utils::UniquePtr<sf::Shader> shader; - std::string path; - sf::Shader::Type shaderType; - std::size_t id; +private: + Steam::steam_manager* steamManager; + + bool levelsOnly{false}; + + Utils::UniquePtr<AssetStorage> assetStorage; + + std::unordered_map<std::string, LevelData> levelDatas; + std::unordered_map<std::string, std::vector<std::string>> + levelDataIdsByPack; + + std::unordered_map<std::string, PackData> packDatas; + + std::vector<PackInfo> packInfos; + std::vector<PackInfo> selectablePackInfos; + + std::unordered_map<std::string, std::string> musicPathMap; + std::map<std::string, MusicData> musicDataMap; + std::map<std::string, StyleData> styleDataMap; + std::map<std::string, ProfileData> profileDataMap; + ProfileData* currentProfilePtr{nullptr}; + + std::unordered_set<std::string> packIdsWithMissingDependencies; + + struct LoadedShader + { + Utils::UniquePtr<sf::Shader> shader; + std::string path; + sf::Shader::Type shaderType; + std::size_t id; + }; + + std::unordered_map<std::string, LoadedShader> shaders; + std::unordered_map<std::string, std::size_t> shadersPathToId; + std::vector<sf::Shader*> shadersById; + + std::string buf; + + std::unordered_map<std::string, std::string> luaFileCache; + LoadInfo loadInfo; + + // When the Steam API can not be retrieved, this set holds pack ids + // retrieved from the cache to try and load the workshop packs installed + std::unordered_set<std::string> cachedWorkshopPackIds; + + template <typename... Ts> + [[nodiscard]] std::string& concatIntoBuf(const Ts&...); + + [[nodiscard]] bool loadAllPackDatas(); + [[nodiscard]] bool loadAllPackAssets(const bool headless); + [[nodiscard]] bool loadWorkshopPackDatasFromCache(); + [[nodiscard]] bool verifyAllPackDependencies(); + [[nodiscard]] bool loadAllLocalProfiles(); + + [[nodiscard]] bool loadPackData(const ssvufs::Path& packPath); + + [[nodiscard]] bool loadPackAssets( + const PackData& packData, const bool headless); + + void loadPackAssets_loadShaders(const std::string& mPackId, + const ssvufs::Path& mPath, const bool headless); + void loadPackAssets_loadMusic( + const std::string& mPackId, const ssvufs::Path& mPath); + void loadPackAssets_loadMusicData( + const std::string& mPackId, const ssvufs::Path& mPath); + void loadPackAssets_loadStyleData( + const std::string& mPackId, const ssvufs::Path& mPath); + void loadPackAssets_loadLevelData( + const std::string& mPackId, const ssvufs::Path& mPath); + void loadPackAssets_loadCustomSounds( + const std::string& mPackId, const ssvufs::Path& mPath); + + [[nodiscard]] std::string getCurrentLocalProfileFilePath(); + +public: + HGAssetsImpl(Steam::steam_manager* mSteamManager, bool mHeadless, + bool mLevelsOnly = false); + + ~HGAssetsImpl(); + + [[nodiscard]] LoadInfo& getLoadResults(); + + [[nodiscard]] sf::Texture& getTexture(const std::string& mId); + [[nodiscard]] sf::Texture& getTextureOrNullTexture(const std::string& mId); + + [[nodiscard]] sf::Font& getFont(const std::string& mId); + [[nodiscard]] sf::Font& getFontOrNullFont(const std::string& mId); + + [[nodiscard]] bool isValidLevelId( + const std::string& mLevelId) const noexcept; + + [[nodiscard]] const LevelData& getLevelData( + const std::string& mAssetId) const; + + [[nodiscard]] bool packHasLevels(const std::string& mPackId); + + [[nodiscard]] const std::vector<std::string>& getLevelIdsByPack( + const std::string& mPackId); + + [[nodiscard]] const std::unordered_map<std::string, PackData>& + getPackDatas(); + + [[nodiscard]] bool isValidPackId(const std::string& mPackId) const noexcept; + + [[nodiscard]] const PackData& getPackData(const std::string& mPackId); + + [[nodiscard]] const std::vector<PackInfo>& + getSelectablePackInfos() const noexcept; + + [[nodiscard]] const PackData* findPackData( + const std::string& mPackDisambiguator, const std::string& mPackName, + const std::string& mPackAuthor) const noexcept; + + [[nodiscard]] const MusicData& getMusicData( + const std::string& mPackId, const std::string& mId); + [[nodiscard]] const StyleData& getStyleData( + const std::string& mPackId, const std::string& mId); + [[nodiscard]] sf::Shader* getShader( + const std::string& mPackId, const std::string& mId); + + [[nodiscard]] std::optional<std::size_t> getShaderId( + const std::string& mPackId, const std::string& mId); + [[nodiscard]] std::optional<std::size_t> getShaderIdByPath( + const std::string& mShaderPath); + [[nodiscard]] sf::Shader* getShaderByShaderId(const std::size_t mShaderId); + [[nodiscard]] bool isValidShaderId(const std::size_t mShaderId) const; + + void reloadAllShaders(); + [[nodiscard]] std::string reloadPack( + const std::string& mPackId, const std::string& mPath); + [[nodiscard]] std::string reloadLevel(const std::string& mPackId, + const std::string& mPath, const std::string& mId); + + [[nodiscard]] float getLocalScore(const std::string& mId); + void setLocalScore(const std::string& mId, float mScore); + + void saveCurrentLocalProfile(); + void saveAllProfiles(); + + [[nodiscard]] bool anyLocalProfileActive() const; + [[nodiscard]] ProfileData& getCurrentLocalProfile(); + [[nodiscard]] const ProfileData& getCurrentLocalProfile() const; + [[nodiscard]] ProfileData* getLocalProfileByName(const std::string& mName); + [[nodiscard]] const ProfileData* getLocalProfileByName( + const std::string& mName) const; + [[nodiscard]] std::size_t getLocalProfilesSize(); + [[nodiscard]] std::vector<std::string> getLocalProfileNames(); + + [[nodiscard]] bool pIsValidLocalProfile() const; + [[nodiscard]] const std::string& pGetName() const; + + void pSaveCurrent(); + void pSaveAll(); + void pSetCurrent(const std::string& mName); + void pCreate(const std::string& mName); + void pRemove(const std::string& mName); + + [[nodiscard]] sf::SoundBuffer* getSoundBuffer(const std::string& assetId); + + [[nodiscard]] const std::string* getMusicPath( + const std::string& assetId) const; + + [[nodiscard]] const std::unordered_map<std::string, LevelData>& + getLevelDatas() const noexcept; + + [[nodiscard]] const std::unordered_set<std::string>& + getPackIdsWithMissingDependencies() const noexcept; + + void addLocalProfile(ProfileData&& profileData); + + [[nodiscard]] std::unordered_map<std::string, std::string>& + getLuaFileCache(); + + [[nodiscard]] const std::unordered_map<std::string, std::string>& + getLuaFileCache() const; }; static void loadAssetsFromJson(AssetStorage& assetStorage, @@ -123,14 +297,15 @@ static void loadAssetsFromJson(AssetStorage& assetStorage, } template <typename... Ts> -[[nodiscard]] std::string& HGAssets::concatIntoBuf(const Ts&... xs) +[[nodiscard]] std::string& HGAssets::HGAssetsImpl::concatIntoBuf( + const Ts&... xs) { buf.clear(); Utils::concatInto(buf, xs...); return buf; } -HGAssets::HGAssets( +HGAssets::HGAssetsImpl::HGAssetsImpl( Steam::steam_manager* mSteamManager, bool mHeadless, bool mLevelsOnly) : steamManager{mSteamManager}, levelsOnly{mLevelsOnly}, @@ -215,12 +390,13 @@ HGAssets::HGAssets( << "ms\n"; } -HGAssets::~HGAssets() +HGAssets::HGAssetsImpl::~HGAssetsImpl() { ssvu::lo("HGAssets::~HGAssets") << "Cleaning up assets...\n"; } -[[nodiscard]] bool HGAssets::loadPackData(const ssvufs::Path& packPath) +[[nodiscard]] bool HGAssets::HGAssetsImpl::loadPackData( + const ssvufs::Path& packPath) { if(!ssvufs::Path{packPath + "/pack.json"}.isFile()) { @@ -286,23 +462,23 @@ HGAssets::~HGAssets() packInfos.emplace_back(PackInfo{packId, packPath}); - packDatas.emplace(packId, // + packDatas.emplace(packId, // PackData{ - .folderPath{packPath.getStr()}, // - .id{packId}, // - .disambiguator{std::move(packDisambiguator)}, // - .name{std::move(packName)}, // - .author{std::move(packAuthor)}, // - .description{std::move(packDescription)}, // - .version{packVersion}, // - .priority{packPriority}, // - .dependencies{getPackDependencies()} // + .folderPath{packPath.getStr()}, // + .id{packId}, // + .disambiguator{SSVOH_MOVE(packDisambiguator)}, // + .name{SSVOH_MOVE(packName)}, // + .author{SSVOH_MOVE(packAuthor)}, // + .description{SSVOH_MOVE(packDescription)}, // + .version{packVersion}, // + .priority{packPriority}, // + .dependencies{getPackDependencies()} // }); return true; } -[[nodiscard]] bool HGAssets::loadPackAssets( +[[nodiscard]] bool HGAssets::HGAssetsImpl::loadPackAssets( const PackData& packData, const bool headless) { const std::string& packPath{packData.folderPath}; @@ -375,12 +551,13 @@ HGAssets::~HGAssets() //********************************************** // LOAD -[[nodiscard]] LoadInfo& HGAssets::getLoadResults() +[[nodiscard]] LoadInfo& HGAssets::HGAssetsImpl::getLoadResults() { return loadInfo; } -[[nodiscard]] sf::Texture& HGAssets::getTexture(const std::string& mId) +[[nodiscard]] sf::Texture& HGAssets::HGAssetsImpl::getTexture( + const std::string& mId) { sf::Texture* ptr = assetStorage->getTexture(mId); SSVOH_ASSERT(ptr); @@ -388,7 +565,7 @@ HGAssets::~HGAssets() return *ptr; } -[[nodiscard]] sf::Texture& HGAssets::getTextureOrNullTexture( +[[nodiscard]] sf::Texture& HGAssets::HGAssetsImpl::getTextureOrNullTexture( const std::string& mId) { static sf::Texture nullTexture; @@ -397,7 +574,7 @@ HGAssets::~HGAssets() return ptr ? *ptr : nullTexture; } -[[nodiscard]] sf::Font& HGAssets::getFont(const std::string& mId) +[[nodiscard]] sf::Font& HGAssets::HGAssetsImpl::getFont(const std::string& mId) { sf::Font* ptr = assetStorage->getFont(mId); SSVOH_ASSERT(ptr); @@ -405,7 +582,8 @@ HGAssets::~HGAssets() return *ptr; } -[[nodiscard]] sf::Font& HGAssets::getFontOrNullFont(const std::string& mId) +[[nodiscard]] sf::Font& HGAssets::HGAssetsImpl::getFontOrNullFont( + const std::string& mId) { static sf::Font nullFont; sf::Font* ptr = assetStorage->getFont(mId); @@ -413,56 +591,58 @@ HGAssets::~HGAssets() return ptr ? *ptr : nullFont; } -[[nodiscard]] bool HGAssets::isValidLevelId( +[[nodiscard]] bool HGAssets::HGAssetsImpl::isValidLevelId( const std::string& mLevelId) const noexcept { return levelDatas.find(mLevelId) != levelDatas.end(); } -[[nodiscard]] const LevelData& HGAssets::getLevelData( +[[nodiscard]] const LevelData& HGAssets::HGAssetsImpl::getLevelData( const std::string& mAssetId) const { SSVOH_ASSERT(isValidLevelId(mAssetId)); return levelDatas.at(mAssetId); } -[[nodiscard]] bool HGAssets::packHasLevels(const std::string& mPackId) +[[nodiscard]] bool HGAssets::HGAssetsImpl::packHasLevels( + const std::string& mPackId) { return levelDataIdsByPack.count(mPackId) > 0; } -[[nodiscard]] const std::vector<std::string>& HGAssets::getLevelIdsByPack( - const std::string& mPackId) +[[nodiscard]] const std::vector<std::string>& +HGAssets::HGAssetsImpl::getLevelIdsByPack(const std::string& mPackId) { SSVOH_ASSERT(levelDataIdsByPack.count(mPackId) > 0); return levelDataIdsByPack.at(mPackId); } [[nodiscard]] const std::unordered_map<std::string, PackData>& -HGAssets::getPackDatas() +HGAssets::HGAssetsImpl::getPackDatas() { return packDatas; } -[[nodiscard]] bool HGAssets::isValidPackId( +[[nodiscard]] bool HGAssets::HGAssetsImpl::isValidPackId( const std::string& mPackId) const noexcept { return packDatas.find(mPackId) != packDatas.end(); } -[[nodiscard]] const PackData& HGAssets::getPackData(const std::string& mPackId) +[[nodiscard]] const PackData& HGAssets::HGAssetsImpl::getPackData( + const std::string& mPackId) { SSVOH_ASSERT(isValidPackId(mPackId)); return packDatas.at(mPackId); } [[nodiscard]] const std::vector<PackInfo>& -HGAssets::getSelectablePackInfos() const noexcept +HGAssets::HGAssetsImpl::getSelectablePackInfos() const noexcept { return selectablePackInfos; } -[[nodiscard]] const PackData* HGAssets::findPackData( +[[nodiscard]] const PackData* HGAssets::HGAssetsImpl::findPackData( const std::string& mPackDisambiguator, const std::string& mPackName, const std::string& mPackAuthor) const noexcept { @@ -479,7 +659,7 @@ HGAssets::getSelectablePackInfos() const noexcept return nullptr; } -[[nodiscard]] bool HGAssets::loadWorkshopPackDatasFromCache() +[[nodiscard]] bool HGAssets::HGAssetsImpl::loadWorkshopPackDatasFromCache() { if(!ssvufs::Path{"workshopCache.json"}.isFile()) { @@ -532,7 +712,7 @@ HGAssets::getSelectablePackInfos() const noexcept return true; } -[[nodiscard]] bool HGAssets::loadAllPackDatas() +[[nodiscard]] bool HGAssets::HGAssetsImpl::loadAllPackDatas() { if(!ssvufs::Path{"Packs/"}.isFolder()) { @@ -587,7 +767,8 @@ HGAssets::getSelectablePackInfos() const noexcept return true; } -[[nodiscard]] bool HGAssets::loadAllPackAssets(const bool headless) +[[nodiscard]] bool HGAssets::HGAssetsImpl::loadAllPackAssets( + const bool headless) { for(const auto& [packId, packData] : packDatas) { @@ -608,7 +789,7 @@ HGAssets::getSelectablePackInfos() const noexcept return true; } -[[nodiscard]] bool HGAssets::verifyAllPackDependencies() +[[nodiscard]] bool HGAssets::HGAssetsImpl::verifyAllPackDependencies() { // ------------------------------------------------------------------------ // Verify pack dependencies. @@ -655,17 +836,17 @@ HGAssets::getSelectablePackInfos() const noexcept return true; } -void HGAssets::addLocalProfile(ProfileData&& profileData) +void HGAssets::HGAssetsImpl::addLocalProfile(ProfileData&& profileData) { // Remove invalid level ids that might have been added to the files. Utils::erase_if(profileData.getFavoriteLevelIds(), [this](const std::string& favId) { return levelDatas.find(favId) == levelDatas.end(); }); - profileDataMap.emplace(profileData.getName(), std::move(profileData)); + profileDataMap.emplace(profileData.getName(), SSVOH_MOVE(profileData)); } -[[nodiscard]] bool HGAssets::loadAllLocalProfiles() +[[nodiscard]] bool HGAssets::HGAssetsImpl::loadAllLocalProfiles() { if(!ssvufs::Path{"Profiles/"}.isFolder()) { @@ -683,13 +864,13 @@ void HGAssets::addLocalProfile(ProfileData&& profileData) loadInfo.addFormattedError(error); ProfileData profileData{Utils::loadProfileFromJson(object)}; - addLocalProfile(std::move(profileData)); + addLocalProfile(SSVOH_MOVE(profileData)); } return true; } -void HGAssets::loadPackAssets_loadShaders( +void HGAssets::HGAssetsImpl::loadPackAssets_loadShaders( const std::string& mPackId, const ssvufs::Path& mPath, const bool headless) { if(headless) @@ -717,13 +898,13 @@ void HGAssets::loadPackAssets_loadShaders( SSVOH_ASSERT(shadersById.size() > 0); const std::size_t shaderId = shadersById.size() - 1; - LoadedShader ls{.shader{std::move(shader)}, + LoadedShader ls{.shader{SSVOH_MOVE(shader)}, .path{p}, .shaderType{shaderType}, .id{shaderId}}; shaders.emplace( - concatIntoBuf(mPackId, '_', p.getFileName()), std::move(ls)); + concatIntoBuf(mPackId, '_', p.getFileName()), SSVOH_MOVE(ls)); shadersPathToId.emplace(p, shaderId); @@ -736,7 +917,7 @@ void HGAssets::loadPackAssets_loadShaders( loadShadersOfType(".frag", sf::Shader::Type::Fragment); } -void HGAssets::loadPackAssets_loadCustomSounds( +void HGAssets::HGAssetsImpl::loadPackAssets_loadCustomSounds( const std::string& mPackId, const ssvufs::Path& mPath) { for(const auto& p : scanSingleByExt(mPath + "Sounds/", ".ogg")) @@ -752,7 +933,7 @@ void HGAssets::loadPackAssets_loadCustomSounds( } } -void HGAssets::loadPackAssets_loadMusic( +void HGAssets::HGAssetsImpl::loadPackAssets_loadMusic( const std::string& mPackId, const ssvufs::Path& mPath) { for(const auto& p : scanSingleByExt(mPath + "Music/", ".ogg")) @@ -764,7 +945,7 @@ void HGAssets::loadPackAssets_loadMusic( } } -void HGAssets::loadPackAssets_loadMusicData( +void HGAssets::HGAssetsImpl::loadPackAssets_loadMusicData( const std::string& mPackId, const ssvufs::Path& mPath) { for(const auto& p : scanSingleByExt(mPath + "Music/", ".json")) @@ -774,13 +955,13 @@ void HGAssets::loadPackAssets_loadMusicData( MusicData musicData{Utils::loadMusicFromJson(object)}; musicDataMap.emplace( - concatIntoBuf(mPackId, '_', musicData.id), std::move(musicData)); + concatIntoBuf(mPackId, '_', musicData.id), SSVOH_MOVE(musicData)); ++loadInfo.assets; } } -void HGAssets::loadPackAssets_loadStyleData( +void HGAssets::HGAssetsImpl::loadPackAssets_loadStyleData( const std::string& mPackId, const ssvufs::Path& mPath) { for(const auto& p : scanSingleByExt(mPath + "Styles/", ".json")) @@ -790,13 +971,13 @@ void HGAssets::loadPackAssets_loadStyleData( StyleData styleData{object}; styleDataMap.emplace( - concatIntoBuf(mPackId, '_', styleData.id), std::move(styleData)); + concatIntoBuf(mPackId, '_', styleData.id), SSVOH_MOVE(styleData)); ++loadInfo.assets; } } -void HGAssets::loadPackAssets_loadLevelData( +void HGAssets::HGAssetsImpl::loadPackAssets_loadLevelData( const std::string& mPackId, const ssvufs::Path& mPath) { for(const auto& p : scanSingleByExt(mPath + "Levels/", ".json")) @@ -808,7 +989,7 @@ void HGAssets::loadPackAssets_loadLevelData( const std::string& assetId = concatIntoBuf(mPackId, '_', levelData.id); levelDataIdsByPack[mPackId].emplace_back(assetId); - levelDatas.emplace(std::move(assetId), std::move(levelData)); + levelDatas.emplace(assetId, SSVOH_MOVE(levelData)); ++loadInfo.levels; } @@ -817,7 +998,7 @@ void HGAssets::loadPackAssets_loadLevelData( //********************************************** // PROFILE -void HGAssets::saveCurrentLocalProfile() +void HGAssets::HGAssetsImpl::saveCurrentLocalProfile() { if(currentProfilePtr == nullptr) { @@ -843,7 +1024,7 @@ void HGAssets::saveCurrentLocalProfile() ssvuj::writeToFile(profileRoot, getCurrentLocalProfileFilePath()); } -void HGAssets::saveAllProfiles() +void HGAssets::HGAssetsImpl::saveAllProfiles() { ssvuj::Obj currentVersion; @@ -876,7 +1057,7 @@ void HGAssets::saveAllProfiles() //********************************************** // GET -[[nodiscard]] const MusicData& HGAssets::getMusicData( +[[nodiscard]] const MusicData& HGAssets::HGAssetsImpl::getMusicData( const std::string& mPackId, const std::string& mId) { const std::string& assetId = concatIntoBuf(mPackId, '_', mId); @@ -893,7 +1074,7 @@ void HGAssets::saveAllProfiles() return it->second; } -[[nodiscard]] const StyleData& HGAssets::getStyleData( +[[nodiscard]] const StyleData& HGAssets::HGAssetsImpl::getStyleData( const std::string& mPackId, const std::string& mId) { const std::string& assetId = concatIntoBuf(mPackId, '_', mId); @@ -910,7 +1091,7 @@ void HGAssets::saveAllProfiles() return it->second; } -[[nodiscard]] sf::Shader* HGAssets::getShader( +[[nodiscard]] sf::Shader* HGAssets::HGAssetsImpl::getShader( const std::string& mPackId, const std::string& mId) { const std::string& assetId = concatIntoBuf(mPackId, '_', mId); @@ -925,7 +1106,7 @@ void HGAssets::saveAllProfiles() return it->second.shader.get(); } -[[nodiscard]] std::optional<std::size_t> HGAssets::getShaderId( +[[nodiscard]] std::optional<std::size_t> HGAssets::HGAssetsImpl::getShaderId( const std::string& mPackId, const std::string& mId) { const std::string& assetId = concatIntoBuf(mPackId, '_', mId); @@ -940,8 +1121,8 @@ void HGAssets::saveAllProfiles() return it->second.id; } -[[nodiscard]] std::optional<std::size_t> HGAssets::getShaderIdByPath( - const std::string& mShaderPath) +[[nodiscard]] std::optional<std::size_t> +HGAssets::HGAssetsImpl::getShaderIdByPath(const std::string& mShaderPath) { const auto it = shadersPathToId.find(mShaderPath); if(it == shadersPathToId.end()) @@ -955,7 +1136,7 @@ void HGAssets::saveAllProfiles() return it->second; } -[[nodiscard]] sf::Shader* HGAssets::getShaderByShaderId( +[[nodiscard]] sf::Shader* HGAssets::HGAssetsImpl::getShaderByShaderId( const std::size_t mShaderId) { if(!isValidShaderId(mShaderId)) @@ -966,7 +1147,8 @@ void HGAssets::saveAllProfiles() return shadersById[mShaderId]; } -[[nodiscard]] bool HGAssets::isValidShaderId(const std::size_t mShaderId) const +[[nodiscard]] bool HGAssets::HGAssetsImpl::isValidShaderId( + const std::size_t mShaderId) const { return mShaderId < shadersById.size(); } @@ -974,14 +1156,14 @@ void HGAssets::saveAllProfiles() //********************************************** // RELOAD -void HGAssets::reloadAllShaders() +void HGAssets::HGAssetsImpl::reloadAllShaders() { for(auto& [id, loadedShader] : shaders) { if(!loadedShader.shader->loadFromFile( loadedShader.path, loadedShader.shaderType)) { - ssvu::lo("hg::HGAssets::reloadAllShaders") + ssvu::lo("hg::HGAssetsImplImpl::reloadAllShaders") << "Failed to load shader '" << loadedShader.path << "'\n"; continue; @@ -989,7 +1171,7 @@ void HGAssets::reloadAllShaders() } } -[[nodiscard]] std::string HGAssets::reloadPack( +[[nodiscard]] std::string HGAssets::HGAssetsImpl::reloadPack( const std::string& mPackId, const std::string& mPath) { std::string temp, output; @@ -1009,7 +1191,7 @@ void HGAssets::reloadAllShaders() if(it == levelDatas.end()) { levelDataIdsByPack[mPackId].emplace_back(temp); - levelDatas.emplace(temp, std::move(levelData)); + levelDatas.emplace(temp, SSVOH_MOVE(levelData)); } else { @@ -1031,7 +1213,7 @@ void HGAssets::reloadAllShaders() StyleData styleData{ssvuj::getFromFile(p)}; temp = mPackId + "_" + styleData.id; - styleDataMap[temp] = std::move(styleData); + styleDataMap[temp] = SSVOH_MOVE(styleData); } output += "Styles successfully reloaded\n"; } @@ -1050,7 +1232,7 @@ void HGAssets::reloadAllShaders() Utils::loadMusicFromJson(ssvuj::getFromFile(p))}; temp = mPackId + "_" + musicData.id; - musicDataMap[temp] = std::move(musicData); + musicDataMap[temp] = SSVOH_MOVE(musicData); } output += "Music data successfully reloaded\n"; } @@ -1095,8 +1277,9 @@ void HGAssets::reloadAllShaders() return output; } -[[nodiscard]] std::string HGAssets::reloadLevel(const std::string& mPackId, - const std::string& mPath, const std::string& mId) +[[nodiscard]] std::string HGAssets::HGAssetsImpl::reloadLevel( + const std::string& mPackId, const std::string& mPath, + const std::string& mId) { std::string temp, output; @@ -1123,7 +1306,7 @@ void HGAssets::reloadAllShaders() if(it == levelDatas.end()) { levelDataIdsByPack[mPackId].emplace_back(temp); - levelDatas.emplace(temp, std::move(levelData)); + levelDatas.emplace(temp, SSVOH_MOVE(levelData)); } else { @@ -1150,7 +1333,7 @@ void HGAssets::reloadAllShaders() StyleData styleData{ssvuj::getFromFile(styleFile[0])}; temp = mPackId + "_" + levelData.styleId; - styleDataMap[temp] = std::move(styleData); + styleDataMap[temp] = SSVOH_MOVE(styleData); output += "style data " + levelData.styleId + ".json successfully loaded\n"; @@ -1178,7 +1361,7 @@ void HGAssets::reloadAllShaders() Utils::loadMusicFromJson(ssvuj::getFromFile(musicDataFile[0]))}; temp = mPackId + "_" + levelData.musicId; - musicDataMap[temp] = std::move(musicData); + musicDataMap[temp] = SSVOH_MOVE(musicData); output += "music data " + levelData.musicId + ".json successfully loaded\n"; @@ -1260,12 +1443,12 @@ void HGAssets::reloadAllShaders() //********************************************** // LOCAL SCORE -float HGAssets::getLocalScore(const std::string& mId) +float HGAssets::HGAssetsImpl::getLocalScore(const std::string& mId) { return getCurrentLocalProfile().getScore(mId); } -void HGAssets::setLocalScore(const std::string& mId, float mScore) +void HGAssets::HGAssetsImpl::setLocalScore(const std::string& mId, float mScore) { getCurrentLocalProfile().setScore(mId, mScore); } @@ -1273,79 +1456,85 @@ void HGAssets::setLocalScore(const std::string& mId, float mScore) //********************************************** // LOCAL PROFILE -[[nodiscard]] bool HGAssets::anyLocalProfileActive() const +[[nodiscard]] bool HGAssets::HGAssetsImpl::anyLocalProfileActive() const { return currentProfilePtr != nullptr; } -ProfileData& HGAssets::getCurrentLocalProfile() +ProfileData& HGAssets::HGAssetsImpl::getCurrentLocalProfile() { SSVOH_ASSERT(currentProfilePtr != nullptr); return *currentProfilePtr; } -ProfileData* HGAssets::getLocalProfileByName(const std::string& mName) +ProfileData* HGAssets::HGAssetsImpl::getLocalProfileByName( + const std::string& mName) { SSVOH_ASSERT(profileDataMap.contains(mName)); return &profileDataMap.find(mName)->second; } -const ProfileData& HGAssets::getCurrentLocalProfile() const +const ProfileData& HGAssets::HGAssetsImpl::getCurrentLocalProfile() const { SSVOH_ASSERT(currentProfilePtr != nullptr); return *currentProfilePtr; } -const ProfileData* HGAssets::getLocalProfileByName( +const ProfileData* HGAssets::HGAssetsImpl::getLocalProfileByName( const std::string& mName) const { SSVOH_ASSERT(profileDataMap.contains(mName)); return &profileDataMap.find(mName)->second; } -[[nodiscard]] std::string HGAssets::getCurrentLocalProfileFilePath() +[[nodiscard]] std::string +HGAssets::HGAssetsImpl::getCurrentLocalProfileFilePath() { return "Profiles/" + currentProfilePtr->getName() + ".json"; } -[[nodiscard]] std::size_t HGAssets::getLocalProfilesSize() +[[nodiscard]] std::size_t HGAssets::HGAssetsImpl::getLocalProfilesSize() { return profileDataMap.size(); } -[[nodiscard]] std::vector<std::string> HGAssets::getLocalProfileNames() +[[nodiscard]] std::vector<std::string> +HGAssets::HGAssetsImpl::getLocalProfileNames() { std::vector<std::string> result; + result.reserve(profileDataMap.size()); + for(auto& pair : profileDataMap) { result.emplace_back(pair.second.getName()); } + return result; } -[[nodiscard]] bool HGAssets::pIsValidLocalProfile() const +[[nodiscard]] bool HGAssets::HGAssetsImpl::pIsValidLocalProfile() const { return currentProfilePtr != nullptr; } -[[nodiscard]] const std::string& HGAssets::pGetName() const +[[nodiscard]] const std::string& HGAssets::HGAssetsImpl::pGetName() const { return getCurrentLocalProfile().getName(); } -void HGAssets::pSaveCurrent() +void HGAssets::HGAssetsImpl::pSaveCurrent() { saveCurrentLocalProfile(); } -void HGAssets::pSaveAll() +void HGAssets::HGAssetsImpl::pSaveAll() { saveAllProfiles(); } -void HGAssets::pSetCurrent(const std::string& mName) +void HGAssets::HGAssetsImpl::pSetCurrent(const std::string& mName) { const auto it = profileDataMap.find(mName); @@ -1353,7 +1542,7 @@ void HGAssets::pSetCurrent(const std::string& mName) currentProfilePtr = &it->second; } -void HGAssets::pCreate(const std::string& mName) +void HGAssets::HGAssetsImpl::pCreate(const std::string& mName) { ssvuj::Obj root; ssvuj::arch(root, "name", mName); @@ -1371,18 +1560,18 @@ void HGAssets::pCreate(const std::string& mName) } } -void HGAssets::pRemove(const std::string& mName) +void HGAssets::HGAssetsImpl::pRemove(const std::string& mName) { profileDataMap.erase(mName); } -[[nodiscard]] sf::SoundBuffer* HGAssets::getSoundBuffer( +[[nodiscard]] sf::SoundBuffer* HGAssets::HGAssetsImpl::getSoundBuffer( const std::string& assetId) { return assetStorage->getSoundBuffer(assetId); } -[[nodiscard]] const std::string* HGAssets::getMusicPath( +[[nodiscard]] const std::string* HGAssets::HGAssetsImpl::getMusicPath( const std::string& assetId) const { auto it = musicPathMap.find(assetId); @@ -1390,27 +1579,296 @@ void HGAssets::pRemove(const std::string& mName) } [[nodiscard]] const std::unordered_map<std::string, LevelData>& -HGAssets::getLevelDatas() const noexcept +HGAssets::HGAssetsImpl::getLevelDatas() const noexcept { return levelDatas; } [[nodiscard]] const std::unordered_set<std::string>& -HGAssets::getPackIdsWithMissingDependencies() const noexcept +HGAssets::HGAssetsImpl::getPackIdsWithMissingDependencies() const noexcept { return packIdsWithMissingDependencies; } [[nodiscard]] std::unordered_map<std::string, std::string>& -HGAssets::getLuaFileCache() +HGAssets::HGAssetsImpl::getLuaFileCache() { return luaFileCache; } [[nodiscard]] const std::unordered_map<std::string, std::string>& -HGAssets::getLuaFileCache() const +HGAssets::HGAssetsImpl::getLuaFileCache() const { return luaFileCache; } +// ---------------------------------------------------------------------------- + +HGAssets::HGAssets( + Steam::steam_manager* mSteamManager, bool mHeadless, bool mLevelsOnly) + : _impl(Utils::makeUnique<HGAssetsImpl>( + mSteamManager, mHeadless, mLevelsOnly)) +{} + +HGAssets::~HGAssets() = default; + +LoadInfo& HGAssets::getLoadResults() +{ + return _impl->getLoadResults(); +} + +sf::Texture& HGAssets::getTexture(const std::string& mId) +{ + return _impl->getTexture(mId); +} + +sf::Texture& HGAssets::getTextureOrNullTexture(const std::string& mId) +{ + return _impl->getTextureOrNullTexture(mId); +} + +sf::Font& HGAssets::getFont(const std::string& mId) +{ + return _impl->getFont(mId); +} + +sf::Font& HGAssets::getFontOrNullFont(const std::string& mId) +{ + return _impl->getFontOrNullFont(mId); +} + +bool HGAssets::isValidLevelId(const std::string& mLevelId) const noexcept +{ + return _impl->isValidLevelId(mLevelId); +} + +const LevelData& HGAssets::getLevelData(const std::string& mAssetId) const +{ + return _impl->getLevelData(mAssetId); +} + +bool HGAssets::packHasLevels(const std::string& mPackId) +{ + return _impl->packHasLevels(mPackId); +} + +const std::vector<std::string>& HGAssets::getLevelIdsByPack( + const std::string& mPackId) +{ + return _impl->getLevelIdsByPack(mPackId); +} + +const std::unordered_map<std::string, PackData>& HGAssets::getPackDatas() +{ + return _impl->getPackDatas(); +} + +bool HGAssets::isValidPackId(const std::string& mPackId) const noexcept +{ + return _impl->isValidPackId(mPackId); +} + +const PackData& HGAssets::getPackData(const std::string& mPackId) +{ + return _impl->getPackData(mPackId); +} + +const std::vector<PackInfo>& HGAssets::getSelectablePackInfos() const noexcept +{ + return _impl->getSelectablePackInfos(); +} + +const PackData* HGAssets::findPackData(const std::string& mPackDisambiguator, + const std::string& mPackName, const std::string& mPackAuthor) const noexcept +{ + return _impl->findPackData(mPackDisambiguator, mPackName, mPackAuthor); +} + +const MusicData& HGAssets::getMusicData( + const std::string& mPackId, const std::string& mId) +{ + return _impl->getMusicData(mPackId, mId); +} + +const StyleData& HGAssets::getStyleData( + const std::string& mPackId, const std::string& mId) +{ + return _impl->getStyleData(mPackId, mId); +} + +sf::Shader* HGAssets::getShader( + const std::string& mPackId, const std::string& mId) +{ + return _impl->getShader(mPackId, mId); +} + +std::optional<std::size_t> HGAssets::getShaderId( + const std::string& mPackId, const std::string& mId) +{ + return _impl->getShaderId(mPackId, mId); +} + +std::optional<std::size_t> HGAssets::getShaderIdByPath( + const std::string& mShaderPath) +{ + return _impl->getShaderIdByPath(mShaderPath); +} + +sf::Shader* HGAssets::getShaderByShaderId(const std::size_t mShaderId) +{ + return _impl->getShaderByShaderId(mShaderId); +} + +bool HGAssets::isValidShaderId(const std::size_t mShaderId) const +{ + return _impl->isValidShaderId(mShaderId); +} + +void HGAssets::reloadAllShaders() +{ + return _impl->reloadAllShaders(); +} + +std::string HGAssets::reloadPack( + const std::string& mPackId, const std::string& mPath) +{ + return _impl->reloadPack(mPackId, mPath); +} + +std::string HGAssets::reloadLevel(const std::string& mPackId, + const std::string& mPath, const std::string& mId) +{ + return _impl->reloadLevel(mPackId, mPath, mId); +} + +float HGAssets::getLocalScore(const std::string& mId) +{ + return _impl->getLocalScore(mId); +} + +void HGAssets::setLocalScore(const std::string& mId, float mScore) +{ + return _impl->setLocalScore(mId, mScore); +} + +void HGAssets::saveCurrentLocalProfile() +{ + return _impl->saveCurrentLocalProfile(); +} + +void HGAssets::saveAllProfiles() +{ + return _impl->saveAllProfiles(); +} + +bool HGAssets::anyLocalProfileActive() const +{ + return _impl->anyLocalProfileActive(); +} + +ProfileData& HGAssets::getCurrentLocalProfile() +{ + return _impl->getCurrentLocalProfile(); +} + +const ProfileData& HGAssets::getCurrentLocalProfile() const +{ + return _impl->getCurrentLocalProfile(); +} + +ProfileData* HGAssets::getLocalProfileByName(const std::string& mName) +{ + return _impl->getLocalProfileByName(mName); +} + +const ProfileData* HGAssets::getLocalProfileByName( + const std::string& mName) const +{ + return _impl->getLocalProfileByName(mName); +} + +std::size_t HGAssets::getLocalProfilesSize() +{ + return _impl->getLocalProfilesSize(); +} + +std::vector<std::string> HGAssets::getLocalProfileNames() +{ + return _impl->getLocalProfileNames(); +} + +bool HGAssets::pIsValidLocalProfile() const +{ + return _impl->pIsValidLocalProfile(); +} + +const std::string& HGAssets::pGetName() const +{ + return _impl->pGetName(); +} + +void HGAssets::pSaveCurrent() +{ + return _impl->pSaveCurrent(); +} + +void HGAssets::pSaveAll() +{ + return _impl->pSaveAll(); +} + +void HGAssets::pSetCurrent(const std::string& mName) +{ + return _impl->pSetCurrent(mName); +} + +void HGAssets::pCreate(const std::string& mName) +{ + return _impl->pCreate(mName); +} + +void HGAssets::pRemove(const std::string& mName) +{ + return _impl->pRemove(mName); +} + +sf::SoundBuffer* HGAssets::getSoundBuffer(const std::string& assetId) +{ + return _impl->getSoundBuffer(assetId); +} + +const std::string* HGAssets::getMusicPath(const std::string& assetId) const +{ + return _impl->getMusicPath(assetId); +} + +const std::unordered_map<std::string, LevelData>& +HGAssets::getLevelDatas() const noexcept +{ + return _impl->getLevelDatas(); +} + +const std::unordered_set<std::string>& +HGAssets::getPackIdsWithMissingDependencies() const noexcept +{ + return _impl->getPackIdsWithMissingDependencies(); +} + +void HGAssets::addLocalProfile(ProfileData&& profileData) +{ + return _impl->addLocalProfile(SSVOH_MOVE(profileData)); +} + +std::unordered_map<std::string, std::string>& HGAssets::getLuaFileCache() +{ + return _impl->getLuaFileCache(); +} + +const std::unordered_map<std::string, std::string>& +HGAssets::getLuaFileCache() const +{ + return _impl->getLuaFileCache(); +} + + } // namespace hg diff --git a/src/SSVOpenHexagon/Global/Config.cpp b/src/SSVOpenHexagon/Global/Config.cpp index 58f94d1c..acb57fd2 100644 --- a/src/SSVOpenHexagon/Global/Config.cpp +++ b/src/SSVOpenHexagon/Global/Config.cpp @@ -161,7 +161,72 @@ defaultServerLevelWhitelist() "ndeltalevels_NDigger_delta_1_underworld_m_1", "ndeltalevels_NDigger_delta_1_underworld_m_1.001", "ndeltalevels_NDigger_delta_1_viper_m_1", - "ndeltalevels_NDigger_delta_1_viper_m_1.001" + "ndeltalevels_NDigger_delta_1_viper_m_1.001", + + // Hunter & others - Open Hexagon League 2 - Pack [Steam Workshop] + "ohl2pack_Hunter_&_Maniac_Open_Hexagon_League_2_1_Automaton_m_1", + "ohl2pack_Hunter_&_Maniac_Open_Hexagon_League_2_1_Automaton_m_1.01", + "ohl2pack_Hunter_&_Maniac_Open_Hexagon_League_2_1_Ezekiel_m_1", + "ohl2pack_Hunter_&_Maniac_Open_Hexagon_League_2_1_Ezekiel_m_1.01", + "ohl2pack_Hunter_&_Maniac_Open_Hexagon_League_2_1_Frostbite_m_1", + "ohl2pack_Hunter_&_Maniac_Open_Hexagon_League_2_1_Frostbite_m_1.01", + "ohl2pack_Hunter_&_Maniac_Open_Hexagon_League_2_1_Insight_m_1", + "ohl2pack_Hunter_&_Maniac_Open_Hexagon_League_2_1_Insight_m_1.01", + "ohl2pack_Hunter_&_Maniac_Open_Hexagon_League_2_1_Neurodance_m_1", + "ohl2pack_Hunter_&_Maniac_Open_Hexagon_League_2_1_Neurodance_m_1.01", + "ohl2pack_Hunter_&_Maniac_Open_Hexagon_League_2_1_Partygoer_m_1", + "ohl2pack_Hunter_&_Maniac_Open_Hexagon_League_2_1_Partygoer_m_1.01", + "ohl2pack_Hunter_&_Maniac_Open_Hexagon_League_2_1_Technicolor_m_1", + "ohl2pack_Hunter_&_Maniac_Open_Hexagon_League_2_1_Technicolor_m_1.01", + "ohl2pack_Hunter_&_Maniac_Open_Hexagon_League_2_1_Toxine_m_1", + "ohl2pack_Hunter_&_Maniac_Open_Hexagon_League_2_1_Toxine_m_1.01", + "ohl2pack_Hunter_&_Maniac_Open_Hexagon_League_2_1_Vault_m_1", + "ohl2pack_Hunter_&_Maniac_Open_Hexagon_League_2_1_Vault_m_1.01", + "ohl2pack_Hunter_&_Maniac_Open_Hexagon_League_2_1_VaultFixed_m_1.02", + + // Hunter & others - Open Hexagon League 3 - Pack [Steam Workshop] + "ohl3pack_Hunter_&_Maniac_Open_Hexagon_League_3_1_Blitz_m_1", + "ohl3pack_Hunter_&_Maniac_Open_Hexagon_League_3_1_Blitz_m_1.01", + "ohl3pack_Hunter_&_Maniac_Open_Hexagon_League_3_1_Bloodlines_m_1", + "ohl3pack_Hunter_&_Maniac_Open_Hexagon_League_3_1_Bloodlines_m_1.01", + "ohl3pack_Hunter_&_Maniac_Open_Hexagon_League_3_1_Cybereye_m_1", + "ohl3pack_Hunter_&_Maniac_Open_Hexagon_League_3_1_Cybereye_m_1.01", + "ohl3pack_Hunter_&_Maniac_Open_Hexagon_League_3_1_Cyclone_m_1", + "ohl3pack_Hunter_&_Maniac_Open_Hexagon_League_3_1_Cyclone_m_1.01", + "ohl3pack_Hunter_&_Maniac_Open_Hexagon_League_3_1_Cyclone_m_1.015", + "ohl3pack_Hunter_&_Maniac_Open_Hexagon_League_3_1_Darkland_m_1", + "ohl3pack_Hunter_&_Maniac_Open_Hexagon_League_3_1_Darkland_m_1.01", + "ohl3pack_Hunter_&_Maniac_Open_Hexagon_League_3_1_Evirex_m_1", + "ohl3pack_Hunter_&_Maniac_Open_Hexagon_League_3_1_Evirex_m_1.01", + "ohl3pack_Hunter_&_Maniac_Open_Hexagon_League_3_1_Onyx_m_1", + "ohl3pack_Hunter_&_Maniac_Open_Hexagon_League_3_1_Onyx_m_1.01", + "ohl3pack_Hunter_&_Maniac_Open_Hexagon_League_3_1_Reactive_m_1", + "ohl3pack_Hunter_&_Maniac_Open_Hexagon_League_3_1_Reactive_m_1.01", + "ohl3pack_Hunter_&_Maniac_Open_Hexagon_League_3_1_Wilderness_m_1", + "ohl3pack_Hunter_&_Maniac_Open_Hexagon_League_3_1_Wilderness_m_1.01", + + // clang-format off + // Hunter & others - Open Hexagon League 3 - Pack [Steam Workshop] + "ohl4pack_Hunter_&_Fractal_&_zX_Open_Hexagon_League_4_1_Catharsis_m_1", + "ohl4pack_Hunter_&_Fractal_&_zX_Open_Hexagon_League_4_1_Catharsis_m_1.01", + "ohl4pack_Hunter_&_Fractal_&_zX_Open_Hexagon_League_4_1_Heartbeat_m_1", + "ohl4pack_Hunter_&_Fractal_&_zX_Open_Hexagon_League_4_1_Heartbeat_m_1.01", + "ohl4pack_Hunter_&_Fractal_&_zX_Open_Hexagon_League_4_1_Joululumi_m_1", + "ohl4pack_Hunter_&_Fractal_&_zX_Open_Hexagon_League_4_1_Joululumi_m_1.001", + "ohl4pack_Hunter_&_Fractal_&_zX_Open_Hexagon_League_4_1_JoululumiNormal_m_1", + "ohl4pack_Hunter_&_Fractal_&_zX_Open_Hexagon_League_4_1_JoululumiNormal_m_1.001", + "ohl4pack_Hunter_&_Fractal_&_zX_Open_Hexagon_League_4_1_Killerbox_m_1", + "ohl4pack_Hunter_&_Fractal_&_zX_Open_Hexagon_League_4_1_Killerbox_m_1.01", + "ohl4pack_Hunter_&_Fractal_&_zX_Open_Hexagon_League_4_1_Luminara_m_1", + "ohl4pack_Hunter_&_Fractal_&_zX_Open_Hexagon_League_4_1_Luminara_m_1.01", + "ohl4pack_Hunter_&_Fractal_&_zX_Open_Hexagon_League_4_1_Sharpshooter_m_1", + "ohl4pack_Hunter_&_Fractal_&_zX_Open_Hexagon_League_4_1_Sharpshooter_m_1.01", + "ohl4pack_Hunter_&_Fractal_&_zX_Open_Hexagon_League_4_1_Signal_m_1", + "ohl4pack_Hunter_&_Fractal_&_zX_Open_Hexagon_League_4_1_Signal_m_1.01", + "ohl4pack_Hunter_&_Fractal_&_zX_Open_Hexagon_League_4_1_eclipse_m_1", + "ohl4pack_Hunter_&_Fractal_&_zX_Open_Hexagon_League_4_1_eclipse_m_1.01", + "ohl4pack_Hunter_&_Fractal_&_zX_Open_Hexagon_League_4_1_teraflect_m_1" + // clang-format on // }; @@ -304,6 +369,8 @@ using cil = std::initializer_list<cmb>; X(disableGameRendering, bool, "disable_game_rendering", false) \ X_LINKEDVALUES_BINDS +// TODO: enable cache on server + namespace hg::Config { [[nodiscard]] static ssvuj::Obj& root() noexcept @@ -1202,7 +1269,7 @@ void setDisableGameRendering(bool x) return serverControlPort(); } -[[nodiscard]] const std::vector<std::string> getServerLevelWhitelist() +[[nodiscard]] const std::vector<std::string>& getServerLevelWhitelist() { return serverLevelWhitelist(); } @@ -1498,43 +1565,42 @@ const std::array<JoystickTriggerGetter, []() -> unsigned int { return joystickAddToFavorites(); }, []() -> unsigned int { return joystickFavoritesMenu(); }}; -const std::string getJoystickBindNames(const Joystick::Jid bindID) +std::string getJoystickBindName(const Joystick::Jid bindID) { - static constexpr std::array<std::array<std::string_view, 2>, 12> - buttonsNames{{{"A", "SQUARE"}, {"B", "CROSS"}, {"X", "CIRCLE"}, - {"Y", "TRIANGLE"}, {"LB", "L1"}, {"RB", "R1"}, {"BACK", "L2"}, - {"START", "R2"}, {"LEFT STICK", "SELECT"}, {"RIGHT STICK", "START"}, + static std::array<std::array<std::string, 2>, 12> buttonsNames{ + {{"A", "SQUARE"}, {"B", "CROSS"}, {"X", "CIRCLE"}, {"Y", "TRIANGLE"}, + {"LB", "L1"}, {"RB", "R1"}, {"BACK", "L2"}, {"START", "R2"}, + {"LEFT STICK", "SELECT"}, {"RIGHT STICK", "START"}, {"LT", "LEFT STICK"}, {"RT", "RIGHT STICK"}}}; - std::string bindName; const unsigned int value{joystickTriggerGetters[toSizeT(bindID)]()}; if(value == 33) { - bindName = ""; + return ""; } - else + + constexpr unsigned int msVendorId{0x045E}; + constexpr unsigned int sonyVendorId{0x54C}; + + const unsigned int vendorId{ + sf::Joystick::isConnected(0) + ? sf::Joystick::getIdentification(0).vendorId + : 0}; + + using namespace std::string_literals; + + if(vendorId == msVendorId) { - constexpr unsigned int msVendorId{0x045E}; - constexpr unsigned int sonyVendorId{0x54C}; - const unsigned int vendorId{ - sf::Joystick::isConnected(0) - ? sf::Joystick::getIdentification(0).vendorId - : 0}; - - switch(vendorId) - { - case msVendorId: - bindName = value >= 12 ? "" : buttonsNames[value][0]; - break; - case sonyVendorId: - bindName = value >= 12 ? "" : buttonsNames[value][1]; - break; - default: bindName = ssvu::toStr(value); break; - } + return value >= 12 ? "" : buttonsNames[value][0]; + } + + if(vendorId == sonyVendorId) + { + return value >= 12 ? "" : buttonsNames[value][1]; } - return bindName; + return ssvu::toStr(value); } //********************************************** diff --git a/src/SSVOpenHexagon/Global/Instantiations.cpp b/src/SSVOpenHexagon/Global/Instantiations.cpp index 247d8044..7a210583 100644 --- a/src/SSVOpenHexagon/Global/Instantiations.cpp +++ b/src/SSVOpenHexagon/Global/Instantiations.cpp @@ -10,6 +10,7 @@ template class std::vector<std::string>; template class std::optional<int>; template class std::optional<std::size_t>; +template class std::optional<std::string>; template class std::unordered_map<std::string, float>; template class std::unordered_map<float, std::string>; diff --git a/src/SSVOpenHexagon/Online/Database.cpp b/src/SSVOpenHexagon/Online/Database.cpp index c65ada0d..57be81f0 100644 --- a/src/SSVOpenHexagon/Online/Database.cpp +++ b/src/SSVOpenHexagon/Online/Database.cpp @@ -252,7 +252,7 @@ void removeAllStaleLoginTokens() std::uint32_t index = 0; for(const auto& row : query) { - result.push_back( // + result.push_back( // ProcessedScore{ .position = index, // .userName = std::get<0>(row), // diff --git a/src/SSVOpenHexagon/Utils/LuaMetadataProxy.cpp b/src/SSVOpenHexagon/Utils/LuaMetadataProxy.cpp index ea2b07f4..82c7f265 100644 --- a/src/SSVOpenHexagon/Utils/LuaMetadataProxy.cpp +++ b/src/SSVOpenHexagon/Utils/LuaMetadataProxy.cpp @@ -174,7 +174,8 @@ catch(...) ssvu::lo("LuaMetadataProxy") << "Failed to generate documentation\n"; } #else -{} +{ +} #endif LuaMetadataProxy& LuaMetadataProxy::arg( diff --git a/test/ReplayExecution.t.cpp b/test/ReplayExecution.t.cpp index 84e802fc..08c7b1df 100644 --- a/test/ReplayExecution.t.cpp +++ b/test/ReplayExecution.t.cpp @@ -2,9 +2,12 @@ // License: Academic Free License ("AFL") v. 3.0 // AFL License page: https://opensource.org/licenses/AFL-3.0 +#include "SSVOpenHexagon/Data/ProfileData.hpp" + #include "SSVOpenHexagon/Global/Assets.hpp" #include "SSVOpenHexagon/Global/Config.hpp" #include "SSVOpenHexagon/Global/Version.hpp" + #include "SSVOpenHexagon/Core/HexagonGame.hpp" #include "TestUtils.hpp" @@ -62,9 +65,7 @@ try std::optional<hg::replay_file> rf; hg.onDeathReplayCreated = [&](const hg::replay_file& newRf) - { - rf.emplace(newRf); - }; + { rf.emplace(newRf); }; hg.newGame(packs[i % packs.size()], levels[i % levels.size()], true /* firstPlay */, 1.f /* diffMult */, diff --git a/test/ReplayExecutionBenchmark.t.cpp b/test/ReplayExecutionBenchmark.t.cpp index ca841431..9f7f29bf 100644 --- a/test/ReplayExecutionBenchmark.t.cpp +++ b/test/ReplayExecutionBenchmark.t.cpp @@ -2,9 +2,12 @@ // License: Academic Free License ("AFL") v. 3.0 // AFL License page: https://opensource.org/licenses/AFL-3.0 +#include "SSVOpenHexagon/Data/ProfileData.hpp" + #include "SSVOpenHexagon/Global/Assets.hpp" #include "SSVOpenHexagon/Global/Config.hpp" #include "SSVOpenHexagon/Global/Version.hpp" + #include "SSVOpenHexagon/Core/HexagonGame.hpp" #include "TestUtils.hpp" diff --git a/test/TestUtils.hpp b/test/TestUtils.hpp index 99fbe484..2702e291 100644 --- a/test/TestUtils.hpp +++ b/test/TestUtils.hpp @@ -17,8 +17,6 @@ #define SA_TYPE(value, type) \ static_assert(::std::is_same_v<decltype value, TEST_IMPL_DEPARENS type>) -#define VRM_CORE_LIKELY(...) __builtin_expect(!!(__VA_ARGS__), 1) - namespace test_impl::impl { inline auto& get_ostringstream() noexcept @@ -81,7 +79,10 @@ void output_expected(TStream& s, const char* expected, const T& rhs_result) template <typename TF> void do_test(bool x, TF&& f) { - if(VRM_CORE_LIKELY(x)) return; + if(x) [[likely]] + { + return; + } auto& error(impl::clear_and_get_ostringstream()); f(error); diff --git a/vbox/build_and_upload_server.sh b/vbox/build_and_upload_server.sh index 15e7b82b..dfdc8633 100755 --- a/vbox/build_and_upload_server.sh +++ b/vbox/build_and_upload_server.sh @@ -18,18 +18,12 @@ echo "Done" && \ \ echo "Uploading build binary to server..." && \ scp "$OH_VBOX_ROOT/_RELEASE/SSVOpenHexagonVbox" "vittorioromeo@139.162.199.162:/home/vittorioromeo/OHWorkspace/SSVOpenHexagon/_RELEASE/SSVOpenHexagonVbox" && \ -scp "$OH_VBOX_ROOT/buildlx/_deps/sfml-build/lib/libsfml-audio.so.3.0" "vittorioromeo@139.162.199.162:/home/vittorioromeo/OHWorkspace/SSVOpenHexagon/buildlx/_deps/sfml-build/lib/libsfml-audio.so.3.0" && \ -scp "$OH_VBOX_ROOT/buildlx/_deps/sfml-build/lib/libsfml-network.so.3.0" "vittorioromeo@139.162.199.162:/home/vittorioromeo/OHWorkspace/SSVOpenHexagon/buildlx/_deps/sfml-build/lib/libsfml-network.so.3.0" && \ scp "$OH_VBOX_ROOT/buildlx/_deps/luajit-build/src/libluajit.so" "vittorioromeo@139.162.199.162:/home/vittorioromeo/OHWorkspace/SSVOpenHexagon/buildlx/_deps/luajit-build/src/libluajit.so" && \ scp "$OH_VBOX_ROOT/buildlx/_deps/zlib-build/libz.so.1" "vittorioromeo@139.162.199.162:/home/vittorioromeo/OHWorkspace/SSVOpenHexagon/buildlx/_deps/zlib-build/libz.so.1" && \ scp "$OH_VBOX_ROOT/buildlx/_deps/libsodium-cmake-build/libsodium.so" "vittorioromeo@139.162.199.162:/home/vittorioromeo/OHWorkspace/SSVOpenHexagon/buildlx/_deps/libsodium-cmake-build/libsodium.so" && \ scp "$OH_VBOX_ROOT/buildlx/_deps/imgui-sfml-build/libImGui-SFML.so" "vittorioromeo@139.162.199.162:/home/vittorioromeo/OHWorkspace/SSVOpenHexagon/buildlx/_deps/imgui-sfml-build/libImGui-SFML.so" && \ -scp "$OH_VBOX_ROOT/buildlx/_deps/sfml-build/lib/libsfml-graphics.so.3.0" "vittorioromeo@139.162.199.162:/home/vittorioromeo/OHWorkspace/SSVOpenHexagon/buildlx/_deps/sfml-build/lib/libsfml-graphics.so.3.0" && \ -scp "$OH_VBOX_ROOT/buildlx/_deps/sfml-build/lib/libsfml-window.so.3.0" "vittorioromeo@139.162.199.162:/home/vittorioromeo/OHWorkspace/SSVOpenHexagon/buildlx/_deps/sfml-build/lib/libsfml-window.so.3.0" && \ -scp "$OH_VBOX_ROOT/buildlx/_deps/sfml-build/lib/libsfml-system.so.3.0" "vittorioromeo@139.162.199.162:/home/vittorioromeo/OHWorkspace/SSVOpenHexagon/buildlx/_deps/sfml-build/lib/libsfml-system.so.3.0" && \ echo "Done" && \ \ echo "Running 'update_server.sh' on server..." && \ ssh vittorioromeo@139.162.199.162 -f "cd $OH_SERVER_ROOT/server && ./update_server.sh" && \ echo "Done" - |