From 3defddee56b03da681f6aebc16f321eb14ff3292 Mon Sep 17 00:00:00 2001 From: GP Garcia Date: Sun, 19 May 2024 12:04:23 -0500 Subject: [PATCH] Updated to GodotSteam Server 3.3, updated GA files --- .github/actions/build-godot/action.yml | 70 + .../action.yml | 33 +- .../actions/download-godotsteam/action.yml | 20 + .../action.yml | 72 +- .github/actions/godot-build/action.yml | 44 - .github/actions/godot-cache/action.yml | 22 - .github/actions/godot-mono/action.yml | 64 - .../actions/godot-windows-build/action.yml | 41 - .github/actions/godot-windows-mono/action.yml | 63 - .../actions/godotsteam-download/action.yml | 13 - .../action.yml | 40 +- .github/actions/prep-macos/action.yml | 57 + .github/actions/setup-cache/action.yml | 33 + .../action.yml | 61 +- .github/actions/upload-artifact/action.yml | 46 +- .../upload-steam-redistributable/action.yaml | 34 + .github/workflows/build-artifact-linux.yml | 161 + .github/workflows/build-artifact-macos.yml | 152 + .github/workflows/build-artifact-windows.yml | 166 + .github/workflows/build-linux-artifact.yml | 161 - .github/workflows/build-macos-artifact.yml | 229 -- .github/workflows/build-releases.yml | 252 +- .github/workflows/build-server-artifact.yml | 227 -- .../workflows/build-windows32-artifact.yml | 151 - .../workflows/build-windows64-artifact.yml | 150 - .github/workflows/create-bundle-templates.yml | 99 + .github/workflows/create-bundle.yml | 81 + .github/workflows/setup-env.yml | 57 + README.md | 37 +- doc_classes/SteamServer.xml | 837 ++--- godotsteam_server.cpp | 3009 ++++++----------- godotsteam_server.h | 2475 +++++++------- godotsteam_server_constants.h | 55 +- 33 files changed, 3792 insertions(+), 5220 deletions(-) create mode 100644 .github/actions/build-godot/action.yml rename .github/actions/{godot-download => download-godot}/action.yml (94%) create mode 100644 .github/actions/download-godotsteam/action.yml rename .github/actions/{steamworks-download => download-steamworks}/action.yml (76%) delete mode 100644 .github/actions/godot-build/action.yml delete mode 100644 .github/actions/godot-cache/action.yml delete mode 100644 .github/actions/godot-mono/action.yml delete mode 100644 .github/actions/godot-windows-build/action.yml delete mode 100644 .github/actions/godot-windows-mono/action.yml delete mode 100644 .github/actions/godotsteam-download/action.yml rename .github/actions/{godot-linux-toolchain => prep-buildroot}/action.yml (69%) create mode 100644 .github/actions/prep-macos/action.yml create mode 100644 .github/actions/setup-cache/action.yml rename .github/actions/{godot-deps => setup-dependencies}/action.yml (67%) create mode 100644 .github/actions/upload-steam-redistributable/action.yaml create mode 100644 .github/workflows/build-artifact-linux.yml create mode 100644 .github/workflows/build-artifact-macos.yml create mode 100644 .github/workflows/build-artifact-windows.yml delete mode 100644 .github/workflows/build-linux-artifact.yml delete mode 100644 .github/workflows/build-macos-artifact.yml delete mode 100644 .github/workflows/build-server-artifact.yml delete mode 100644 .github/workflows/build-windows32-artifact.yml delete mode 100644 .github/workflows/build-windows64-artifact.yml create mode 100644 .github/workflows/create-bundle-templates.yml create mode 100644 .github/workflows/create-bundle.yml create mode 100644 .github/workflows/setup-env.yml diff --git a/.github/actions/build-godot/action.yml b/.github/actions/build-godot/action.yml new file mode 100644 index 0000000..664941f --- /dev/null +++ b/.github/actions/build-godot/action.yml @@ -0,0 +1,70 @@ +name: Build Godot + + +description: Build Godot with the provided options + + +inputs: + binary: + description: The finished binary's name + default: '' + + buildroot: + description: Build root to add to the PATH before building Godot, if Linux + default: '' + + target: + description: The SCONS target (debug/release_debug/release) + default: "debug" + + tests: + description: If tests are to be built + default: false + + platform: + description: The Godot platform to build + required: false + + export: + description: New GodotSteam export name + default: '' + + sconsflags: + default: '' + + scons-cache: + description: The scons cache path + default: "${{ github.workspace }}/.scons-cache/" + + scons-cache-limit: + description: The scons cache size limit + # actions/cache has 10 GiB limit, and GitHub runners have a 14 GiB disk. + # Limit to 7 GiB to avoid having the extracted cache fill the disk. + default: 7168 + + +runs: + using: "composite" + + steps: + - name: SCONS Build + shell: bash + env: + SCONSFLAGS: ${{ inputs.sconsflags }} + SCONS_CACHE: ${{ inputs.scons-cache }} + SCONS_CACHE_LIMIT: ${{ inputs.scons-cache-limit }} + run: | + echo "Building with flags:" ${{ env.SCONSFLAGS }} + + if [[ ${{ inputs.buildroot != '' }} ]]; then + echo "Using buildroot at ${{ inputs.buildroot }}" + fi + + ${{ inputs.buildroot != '' && format('PATH={0}:$PATH', inputs.buildroot) || '' }} scons p=${{ inputs.platform }} production=yes target=${{ inputs.target }} tests=${{ inputs.tests }} ${{ env.SCONSFLAGS }} + ls -l bin/ + + - name: Rename Export + shell: bash + if: ${{ inputs.binary != '' }} + run: | + mv bin/${{ inputs.binary }} bin/${{ inputs.export }} \ No newline at end of file diff --git a/.github/actions/godot-download/action.yml b/.github/actions/download-godot/action.yml similarity index 94% rename from .github/actions/godot-download/action.yml rename to .github/actions/download-godot/action.yml index 8ad0752..384200a 100644 --- a/.github/actions/godot-download/action.yml +++ b/.github/actions/download-godot/action.yml @@ -1,14 +1,21 @@ -name: Download Godot source code -description: Download and extract the Godot source code for use in compiling -inputs: - version: - description: Version of Godot source code to download - default: "3.5.3-stable" -runs: - using: "composite" - steps: - - name: Download and extract Godot - shell: bash - run: | - curl -fLO https://github.com/godotengine/godot/archive/${{ inputs.version }}.tar.gz +name: Download Godot source code + + +description: Download and extract the Godot source code for use in compiling + + +inputs: + version: + description: Version of Godot source code to download + default: "3.5.3-stable" + + +runs: + using: "composite" + + steps: + - name: Download and extract Godot + shell: bash + run: | + curl -fLO https://github.com/godotengine/godot/archive/${{ inputs.version }}.tar.gz tar -xvzf ${{ inputs.version }}.tar.gz --strip-components 1 --exclude=".github" \ No newline at end of file diff --git a/.github/actions/download-godotsteam/action.yml b/.github/actions/download-godotsteam/action.yml new file mode 100644 index 0000000..9c58759 --- /dev/null +++ b/.github/actions/download-godotsteam/action.yml @@ -0,0 +1,20 @@ +name: Download GodotSteam + + +description: Download and extract the GodotSteam source code for use in compiling + + +runs: + using: "composite" + + steps: + - name: Download and extract GodotSteam + uses: actions/checkout@v4 + with: + path: "godotsteam_server" + ref: "godot3" + + - name: Copy GodotSteam + shell: bash + run: | + cp -r godotsteam_server ./modules/godotsteam_server \ No newline at end of file diff --git a/.github/actions/steamworks-download/action.yml b/.github/actions/download-steamworks/action.yml similarity index 76% rename from .github/actions/steamworks-download/action.yml rename to .github/actions/download-steamworks/action.yml index 2eb308f..d92dc9f 100644 --- a/.github/actions/steamworks-download/action.yml +++ b/.github/actions/download-steamworks/action.yml @@ -1,32 +1,42 @@ -name: Download Steamworks SDK -description: Download and extract the Steamworks SDK from our secret repository -inputs: - path: - description: Where to dump this - default: "steamworks" - repository: - description: CoaguCo's private SDK repo - default: "" - token: - description: CoaguCo's repo token for access - default: "" - ref: - description: The Steamworks SDK tag used - default: "sdk-1.58" -runs: - using: "composite" - steps: - - name: Download Steamworks SDK - uses: actions/checkout@v4 - with: - path: ${{ inputs.path }} - repository: ${{ inputs.repository }} - token: ${{ inputs.token }} - ref: ${{ inputs.ref }} - - - name: Copy Steamworks - shell: bash - run: | - mkdir ./modules/godotsteam_server/sdk/public - cp -r steamworks/public ./modules/godotsteam_server/sdk +name: Download Steamworks SDK + + +description: Download and extract the Steamworks SDK from our secret repository + + +inputs: + path: + description: Where to dump this + default: "steamworks" + + repository: + description: GodotSteam's private SDK repo + default: "It's a secret..." + + token: + description: GodotSteam's repo token for access + default: "It's a secret..." + + ref: + description: The Steamworks SDK tag used + default: "sdk-1.59" + + +runs: + using: "composite" + + steps: + - name: Download Steamworks SDK + uses: actions/checkout@v4 + with: + path: ${{ inputs.path }} + repository: ${{ inputs.repository }} + token: ${{ inputs.token }} + ref: ${{ inputs.ref }} + + - name: Copy Steamworks + shell: bash + run: | + mkdir ./modules/godotsteam_server/sdk/public + cp -r steamworks/public ./modules/godotsteam_server/sdk cp -r steamworks/redistributable_bin ./modules/godotsteam_server/sdk \ No newline at end of file diff --git a/.github/actions/godot-build/action.yml b/.github/actions/godot-build/action.yml deleted file mode 100644 index 06c3492..0000000 --- a/.github/actions/godot-build/action.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Build Godot -description: Build Godot with the provided options. -inputs: - buildroot: - description: Build root to add to the PATH before building godot - default: "" - target: - description: The scons target (debug/release_debug/release). - default: "debug" - tools: - description: If tools are to be built. - default: false - tests: - description: If tests are to be built. - default: false - platform: - description: The Godot platform to build. - required: false - sconsflags: - default: "" - scons-cache: - description: The scons cache path. - default: "${{ github.workspace }}/.scons-cache/" - scons-cache-limit: - description: The scons cache size limit. - # actions/cache has 10 GiB limit, and GitHub runners have a 14 GiB disk. - # Limit to 7 GiB to avoid having the extracted cache fill the disk. - default: 7168 -runs: - using: "composite" - steps: - - name: Scons Build - shell: bash - env: - SCONSFLAGS: ${{ inputs.sconsflags }} - SCONS_CACHE: ${{ inputs.scons-cache }} - SCONS_CACHE_LIMIT: ${{ inputs.scons-cache-limit }} - run: | - echo "Building with flags:" ${{ env.SCONSFLAGS }} - if [[ ${{ inputs.buildroot != '' }} ]]; then - echo "Using buildroot at ${{ inputs.buildroot }}" - fi - ${{ inputs.buildroot != '' && format('PATH={0}:$PATH', inputs.buildroot) || '' }} scons p=${{ inputs.platform }} production=yes target=${{ inputs.target }} tools=${{ inputs.tools }} tests=${{ inputs.tests }} ${{ env.SCONSFLAGS }} - ls -l bin/ diff --git a/.github/actions/godot-cache/action.yml b/.github/actions/godot-cache/action.yml deleted file mode 100644 index 46567f3..0000000 --- a/.github/actions/godot-cache/action.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Setup Godot build cache -description: Setup Godot build cache. -inputs: - cache-name: - description: The cache base name (job name by default). - default: "${{github.job}}" - scons-cache: - description: The scons cache path. - default: "${{github.workspace}}/.scons-cache/" -runs: - using: "composite" - steps: - # Upload cache on completion and check it out now - - name: Load .scons_cache directory - uses: actions/cache@v4 - with: - path: ${{inputs.scons-cache}} - key: ${{inputs.cache-name}}-${{env.GODOT_BASE_VERSION}}-${{github.ref}}-${{github.sha}} - restore-keys: | - ${{inputs.cache-name}}-${{env.GODOT_BASE_VERSION}}-${{github.ref}}-${{github.sha}} - ${{inputs.cache-name}}-${{env.GODOT_BASE_VERSION}}-${{github.ref}} - ${{inputs.cache-name}}-${{env.GODOT_BASE_VERSION}} \ No newline at end of file diff --git a/.github/actions/godot-mono/action.yml b/.github/actions/godot-mono/action.yml deleted file mode 100644 index ac35892..0000000 --- a/.github/actions/godot-mono/action.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: Setup mono -description: Setup mono builds and mono base class libraries. -inputs: - mono-release: - description: The release file to download. - default: "" - mono-bcl: - description: The release bcl file to download. - default: "" - mono-installs-path: - description: Path to dump the mono-release into. - default: $HOME/mono-installs - mono-bcl-path: - description: Path to dump the mono-bcl into. - default: $HOME/mono-bcls - mono-build-repo: - description: Github repository to download the prebuilt mono releaes from - default: "" - mono-build-tag: - description: Release tag to download from the mono-build-repo - default: "" -runs: - using: "composite" - steps: - - name: Setup default inputs - shell: bash - run: | - echo "INPUT_MONO_BUILD_REPO=${{ inputs.mono-build-repo != '' && inputs.mono-build-repo || env.GODOT_MONO_BUILD_REPO }}" >> $GITHUB_ENV - echo "INPUT_MONO_BUILD_TAG=${{ inputs.mono-build-tag != '' && inputs.mono-build-tag || env.GODOT_MONO_BUILD_TAG }}" >> $GITHUB_ENV - - - name: Download mono release ${{ inputs.mono-release }} - if: ${{ inputs.mono-release != '' }} - uses: dsaltares/fetch-gh-release-asset@master - with: - # Hacky fix since env aren't passing through - repo: "godotengine/godot-mono-builds" - version: "tags/release-5299efd" - file: "${{ inputs.mono-release }}.zip" - - - name: Extract mono release - if: ${{ inputs.mono-release != '' }} - shell: bash - run: | - 7z x "${{ inputs.mono-release }}.zip" -o${{ inputs.mono-installs-path }} - - - name: Download mono base class library ${{ inputs.mono-bcl }} - if: ${{ inputs.mono-bcl != '' }} - uses: dsaltares/fetch-gh-release-asset@master - with: - # Hacky fix since env aren't passing through - repo: "godotengine/godot-mono-builds" - version: "tags/release-5299efd" - file: "${{ inputs.mono-bcl }}.zip" - - - name: Extract mono base class library - if: ${{ inputs.mono-bcl != '' }} - shell: bash - run: | - mkdir -p ${{ inputs.mono-bcl-path }} - 7z x "${{ inputs.mono-bcl }}.zip" -otemp - pushd temp - mv -v * ${{ inputs.mono-bcl-path }} - popd - rm -r temp \ No newline at end of file diff --git a/.github/actions/godot-windows-build/action.yml b/.github/actions/godot-windows-build/action.yml deleted file mode 100644 index c81b4a6..0000000 --- a/.github/actions/godot-windows-build/action.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Build Godot -description: Build Godot with the provided options. -inputs: - buildroot: - description: Build root to add to the PATH before building godot - default: "" - target: - description: The scons target (debug/release_debug/release). - default: "debug" - tools: - description: If tools are to be built. - default: false - tests: - description: If tests are to be built. - default: false - platform: - description: The Godot platform to build. - required: false - sconsflags: - default: "" - scons-cache: - description: The scons cache path. - default: "${{ github.workspace }}/.scons-cache/" - scons-cache-limit: - description: The scons cache size limit. - # actions/cache has 10 GiB limit, and GitHub runners have a 14 GiB disk. - # Limit to 7 GiB to avoid having the extracted cache fill the disk. - default: 7168 -runs: - using: "composite" - steps: - - name: Scons Build - shell: pwsh - env: - SCONSFLAGS: ${{ inputs.sconsflags }} - SCONS_CACHE: ${{ inputs.scons-cache }} - SCONS_CACHE_LIMIT: ${{ inputs.scons-cache-limit }} - run: | - echo "Building with flags:" ${{ env.SCONSFLAGS }} - scons p=${{ inputs.platform }} target=${{ inputs.target }} tools=${{ inputs.tools }} tests=${{ inputs.tests }} ${{ env.SCONSFLAGS }} - ls -l bin/ diff --git a/.github/actions/godot-windows-mono/action.yml b/.github/actions/godot-windows-mono/action.yml deleted file mode 100644 index 9e3f5bd..0000000 --- a/.github/actions/godot-windows-mono/action.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: Setup Mono -description: Setup mono builds and mono base class libraries. -inputs: - mono-release: - description: The release file to download. - default: "" - mono-bcl: - description: The release bcl file to download. - default: "" - mono-installs-path: - description: Path to dump the mono-release into. - default: $HOME/mono-installs - mono-bcl-path: - description: Path to dump the mono-bcl into. - default: $HOME/mono-bcls - mono-build-repo: - description: Github repository to download the prebuilt mono releaes from - default: "" - mono-build-tag: - description: Release tag to download from the mono-build-repo - default: "" -runs: - using: "composite" - steps: - - name: Setup default inputs - shell: pwsh - run: | - echo "INPUT_MONO_BUILD_REPO=${{ inputs.mono-build-repo != '' && inputs.mono-build-repo || env.GODOT_MONO_BUILD_REPO }}" >> $GITHUB_ENV - echo "INPUT_MONO_BUILD_TAG=${{ inputs.mono-build-tag != '' && inputs.mono-build-tag || env.GODOT_MONO_BUILD_TAG }}" >> $GITHUB_ENV - - - name: Download mono release ${{ inputs.mono-release }} - if: ${{ inputs.mono-release != '' }} - uses: dsaltares/fetch-gh-release-asset@master - with: - # Hacky fix since env aren't passing through - repo: "godotengine/godot-mono-builds" - version: "tags/release-5299efd" - file: "${{ inputs.mono-release }}.zip" - - - name: Extract mono release - if: ${{ inputs.mono-release != '' }} - shell: pwsh - run: | - 7z x "${{ inputs.mono-release }}.zip" -o${{ inputs.mono-installs-path }} - - - name: Download mono base class library ${{ inputs.mono-bcl }} - if: ${{ inputs.mono-bcl != '' }} - uses: dsaltares/fetch-gh-release-asset@master - with: - repo: "godotengine/godot-mono-builds" - version: "tags/release-5299efd" - file: "${{ inputs.mono-bcl }}.zip" - - - name: Extract mono base class library - if: ${{ inputs.mono-bcl != '' }} - shell: pwsh - run: | - mkdir -p ${{ inputs.mono-bcl-path }} - 7z x "${{ inputs.mono-bcl }}.zip" -otemp - pushd temp - mv -v * ${{ inputs.mono-bcl-path }} - popd - rm -r temp \ No newline at end of file diff --git a/.github/actions/godotsteam-download/action.yml b/.github/actions/godotsteam-download/action.yml deleted file mode 100644 index 8e766f0..0000000 --- a/.github/actions/godotsteam-download/action.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Download GodotSteam Server -description: Download and extract the GodotSteam Server source code for use in compiling -runs: - using: "composite" - steps: - - name: Download and extract GodotSteam Server - uses: actions/checkout@v4 - with: - path: "godotsteam_server" - - name: Copy GodotSteam Server Module - shell: bash - run: | - cp -r godotsteam_server ./modules/godotsteam_server \ No newline at end of file diff --git a/.github/actions/godot-linux-toolchain/action.yml b/.github/actions/prep-buildroot/action.yml similarity index 69% rename from .github/actions/godot-linux-toolchain/action.yml rename to .github/actions/prep-buildroot/action.yml index a9e7b03..27c405b 100644 --- a/.github/actions/godot-linux-toolchain/action.yml +++ b/.github/actions/prep-buildroot/action.yml @@ -1,17 +1,25 @@ -name: Setup Linux toolchain -description: Setup Linux toolchain for making Linux builds of Godot. -inputs: - toolchain-name: - description: The release tag to use. - default: "x86_64-godot-linux-gnu_sdk-buildroot" - -runs: - using: "composite" - steps: - - name: Download toolchain - shell: bash - run: | - curl -fLO https://download.tuxfamily.org/godotengine/toolchains/linux/2021-02-11/${{ inputs.toolchain-name }}.tar.bz2 - tar -xf ${{ inputs.toolchain-name }}.tar.bz2 - chmod +x "${{ inputs.toolchain-name }}/relocate-sdk.sh" +name: Setup Linux Buildroot + + +description: Setup Linux buildroot for making Linux builds of Godot + + +inputs: + toolchain-name: + description: The release tag to use + default: "x86_64-godot-linux-gnu_sdk-buildroot" + + +runs: + using: "composite" + + steps: + - name: Download Buildroot + shell: bash + run: | + curl -fLO https://download.tuxfamily.org/godotengine/toolchains/linux/2021-02-11/${{ inputs.toolchain-name }}.tar.bz2 + + tar -xf ${{ inputs.toolchain-name }}.tar.bz2 + chmod +x "${{ inputs.toolchain-name }}/relocate-sdk.sh" + "${{ inputs.toolchain-name }}/relocate-sdk.sh" \ No newline at end of file diff --git a/.github/actions/prep-macos/action.yml b/.github/actions/prep-macos/action.yml new file mode 100644 index 0000000..0289d98 --- /dev/null +++ b/.github/actions/prep-macos/action.yml @@ -0,0 +1,57 @@ +name: Prep MacOS For Packaging + + +description: Combine x86_64 and arm64 into Universal + + +inputs: + target: + description: Which packaging are we prepping + default: 'editor' +runs: + using: "composite" + steps: + - name: Create Universal Editor + if: ${{ inputs.target == 'editor' }} + shell: bash + run: | + ls -la bin/ + + lipo -create bin/godot.osx.opt.tools.x86_64 bin/godot.osx.opt.tools.arm64 -output bin/godot.osx.editor.universal + + cp -r misc/dist/osx_tools.app bin/GodotSteamServer.app + mkdir -p bin/GodotSteamServer.app/Contents/MacOS + + cp bin/godot.osx.editor.universal bin/GodotSteamServer.app/Contents/MacOS/Godot + chmod +x bin/GodotSteamServer.app/Contents/MacOS/Godot + + cp modules/godotsteam_server/sdk/redistributable_bin/osx/libsteam_api.dylib bin/GodotSteamServer.app/Contents/MacOS/ + + cd bin/ + zip -q -9 -r macos_editor.zip GodotSteamServer.app + cd ../ + ls -la bin/ + + - name: Create Universal Templates + if: ${{ inputs.target == 'templates' }} + shell: bash + run: | + ls -la bin/ + + lipo -create bin/godot.osx.opt.debug.x86_64 bin/godot.osx.opt.debug.arm64 -output bin/godot.osx.template.debug.64 + lipo -create bin/godot.osx.opt.x86_64 bin/godot.osx.opt.arm64 -output bin/godot.osx.template.64 + $STRIP bin/godot.osx.template.64 + + cp -r misc/dist/osx_template.app bin/ + mkdir -p bin/osx_template.app/Contents/MacOS + + cp bin/godot.osx.template.64 bin/osx_template.app/Contents/MacOS/godot_osx_release.64 + cp bin/godot.osx.template.debug.64 bin/osx_template.app/Contents/MacOS/godot_osx_debug.64 + chmod +x bin/osx_template.app/Contents/MacOS/godot_osx* + + cp modules/godotsteam/sdk/redistributable_bin/osx/libsteam_api.dylib bin/osx_template.app/Contents/MacOS/ + + cd bin/ + zip -q -9 -r macos.zip osx_template.app + cd ../ + ls -la bin/ \ No newline at end of file diff --git a/.github/actions/setup-cache/action.yml b/.github/actions/setup-cache/action.yml new file mode 100644 index 0000000..ed4d8a5 --- /dev/null +++ b/.github/actions/setup-cache/action.yml @@ -0,0 +1,33 @@ +name: Setup Build Cache + + +description: Setup SCONS build cache + + +inputs: + cache-name: + description: The cache base name (job name by default) + default: "${{ github.job }}" + + scons-cache: + description: The scons cache path + default: "${{ github.workspace }}/.scons-cache/" + + godot-base: + description: Base version of Godot + default: "3.5.3" + + +runs: + using: "composite" + + steps: + - name: Load .scons_cache directory + uses: actions/cache@v4 + with: + path: ${{ inputs.scons-cache }} + key: ${{ inputs.cache-name }}-${{ inputs.godot-base }}-${{ github.ref }}-${{ github.sha }} + restore-keys: | + ${{ inputs.cache-name }}-${{ inputs.godot-base }}-${{ github.ref }}-${{ github.sha }} + ${{ inputs.cache-name }}-${{ inputs.godot-base }}-${{ github.ref }} + ${{ inputs.cache-name }}-${{ inputs.godot-base }} \ No newline at end of file diff --git a/.github/actions/godot-deps/action.yml b/.github/actions/setup-dependencies/action.yml similarity index 67% rename from .github/actions/godot-deps/action.yml rename to .github/actions/setup-dependencies/action.yml index 458ea2f..fedf03d 100644 --- a/.github/actions/godot-deps/action.yml +++ b/.github/actions/setup-dependencies/action.yml @@ -1,27 +1,34 @@ -name: Setup python and scons -description: Setup python, install the pip version of scons. -inputs: - python-version: - description: The python version to use. - default: "3.x" - python-arch: - description: The python architecture. - default: "x64" -runs: - using: "composite" - steps: - # Use python 3.x release (works cross platform) - - name: Set up Python 3.x - uses: actions/setup-python@v5 - with: - # Semantic version range syntax or exact version of a Python version - python-version: ${{ inputs.python-version }} - # Optional - x64 or x86 architecture, defaults to x64 - architecture: ${{ inputs.python-arch }} - - - name: Setup scons - shell: bash - run: | - python -c "import sys; print(sys.version)" - python -m pip install scons - scons --version \ No newline at end of file +name: Setup Python and SCONS + + +description: Setup Python and install the pip version of SCONS + + +inputs: + python-version: + description: The Python version to use + default: "3.x" + + python-arch: + description: The Python architecture + default: "x64" + + +runs: + using: "composite" + + steps: + # Use python 3.x release (works cross platform) + - name: Set up Python 3.x + uses: actions/setup-python@v5 + with: + # Semantic version range syntax or exact version of a Python version + python-version: ${{ inputs.python-version }} + # Optional - x64 or x86 architecture, defaults to x64 + architecture: ${{ inputs.python-arch }} + + - name: Setup SCONS + shell: bash + run: | + python -c "import sys; print(sys.version)" + python -m pip install scons \ No newline at end of file diff --git a/.github/actions/upload-artifact/action.yml b/.github/actions/upload-artifact/action.yml index 5a9a38a..f1d1e53 100644 --- a/.github/actions/upload-artifact/action.yml +++ b/.github/actions/upload-artifact/action.yml @@ -1,20 +1,28 @@ -name: Upload GodotSteam artifact -description: Upload the GodotSteam artifact. -inputs: - name: - description: The artifact name. - default: "${{ github.job }}" - path: - description: The path to upload. - required: true - default: "bin" -runs: - using: "composite" - steps: - - name: Upload GodotSteam Artifact - uses: actions/upload-artifact@v4 - with: - name: ${{ inputs.name }} - path: ${{ inputs.path }} - overwrite: true +name: Upload GodotSteam artifact + + +description: Upload the GodotSteam artifact + + +inputs: + name: + description: The artifact name + default: "${{ github.job }}" + + path: + description: The path to upload + required: true + default: "./bin/" + + +runs: + using: "composite" + + steps: + - name: Upload GodotSteam Server Artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.name }} + path: ${{ inputs.path }} + overwrite: true retention-days: 14 \ No newline at end of file diff --git a/.github/actions/upload-steam-redistributable/action.yaml b/.github/actions/upload-steam-redistributable/action.yaml new file mode 100644 index 0000000..8691424 --- /dev/null +++ b/.github/actions/upload-steam-redistributable/action.yaml @@ -0,0 +1,34 @@ +name: Upload Steam Redistributable + + +description: Upload the Steam redistributable file for packaging + + +inputs: + name: + description: The artifact name + required: true + default: false + + path: + description: Path to the redistributable + required: true + default: "" + + redist: + description: Redistributable file's name + required: true + default: "steam_api.dll" + + +runs: + using: "composite" + + steps: + - name: Upload Steam Redistributable + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.name }} + path: ./modules/godotsteam_server/sdk/redistributable_bin/${{ inputs.path}}${{ inputs.redist }} + overwrite: true + retention-days: 14 \ No newline at end of file diff --git a/.github/workflows/build-artifact-linux.yml b/.github/workflows/build-artifact-linux.yml new file mode 100644 index 0000000..07ac191 --- /dev/null +++ b/.github/workflows/build-artifact-linux.yml @@ -0,0 +1,161 @@ +on: + workflow_call: + inputs: + godot_tag: + required: true + type: string + + godot_version: + required: true + type: string + + steamworks_sdk_tag: + required: true + type: string + + secrets: + steamworks_sdk_repo: + required: true + + steamworks_sdk_repo_token: + required: true + + +jobs: + build-linux: + runs-on: ubuntu-latest + + + name: Linux ${{ matrix.name }} + + + strategy: + fail-fast: false + matrix: + include: + - name: Editor and Templates + cache-name: linux + platform: x11 + editor-name: godot.x11.opt.tools.64 + editor-name-new: godotsteam_server.${{ inputs.godot_version }}.editor.linux.64 + debug-name: godot.x11.opt.debug.64 + debug-name-new: godotsteam_server.${{ inputs.godot_version }}.debug.template.linux.64 + release-name: godot.x11.opt.64 + release-name-new: godotsteam_server.${{ inputs.godot_version }}.template.linux.64 + + - name: Headless Editor and Templates + cache-name: server + platform: server + editor-name: godot.x11.opt.tools.64 + editor-name-new: godotsteam_server.headless.${{ inputs.godot_version }}.editor.linux.64 + debug-name: godot.x11.opt.debug.64 + debug-name-new: godotsteam_server.headless.${{ inputs.godot_version }}.debug.template.linux.64 + release-name: godot.x11.opt.64 + release-name-new: godotsteam_server.headless.${{ inputs.godot_version }}.template.linux.64 + + + steps: + - uses: actions/checkout@v4 + + # Download Godot to start + - name: Download Godot + uses: ./.github/actions/download-godot + with: + version: ${{ inputs.godot_tag }} + + # Download GodotSteam Server + - name: Download GodotSteam Server + uses: ./.github/actions/download-godotsteam + + # Download Steamworks SDK + - name: Download Steamworks SDK + uses: ./.github/actions/download-steamworks + with: + path: "steamworks" + repository: ${{ secrets.steamworks_sdk_repo }} + token: ${{ secrets.steamworks_sdk_repo_token }} + ref: ${{ inputs.steamworks_sdk_tag }} + + # Setting up the Linux buildroot for older versions + - name: Setup Linux Buildroot (x64_64) + uses: ./.github/actions/prep-buildroot + with: + toolchain-name: "x86_64-godot-linux-gnu_sdk-buildroot" + + # Get that cache money + - name: Setup Build Cache + uses: ./.github/actions/setup-cache + with: + cache-name: ${{ matrix.cache-name }} + godot-base: ${{ inputs.godot_tag }} + continue-on-error: true + + # Setup Python and SCONS + - name: Setup Python and SCONS + uses: ./.github/actions/setup-dependencies + + # Compiling editor + - name: Editor Compilation + uses: ./.github/actions/build-godot + with: + buildroot: "${{ github.workspace }}/x86_64-godot-linux-gnu_sdk-buildroot/bin" + sconsflags: bits=64 tools=yes + platform: ${{ matrix.platform }} + target: release_debug + binary: ${{ matrix.editor-name }} + export: ${{ matrix.editor-name-new }} + + - name: Upload Editor + uses: ./.github/actions/upload-artifact + with: + name: ${{ matrix.cache-name }}-editor + path: ./bin/${{ matrix.editor-name-new }} + + - name: Clear bin + run: | + rm -rf bin + + # Compiling templates + - name: Debug Template Compilation (target=template_debug) + uses: ./.github/actions/build-godot + with: + buildroot: "${{ github.workspace }}/x86_64-godot-linux-gnu_sdk-buildroot/bin" + sconsflags: bits=64 tools=no + platform: ${{ matrix.platform }} + target: release_debug + binary: ${{ matrix.debug-name }} + export: ${{ matrix.debug-name-new }} + + - name: Upload Debug Template + uses: ./.github/actions/upload-artifact + with: + name: ${{ matrix.cache-name }}-debug-template + path: ./bin/${{ matrix.debug-name-new }} + + - name: Release Template Compilation (target=template_release) + uses: ./.github/actions/build-godot + with: + buildroot: "${{ github.workspace }}/x86_64-godot-linux-gnu_sdk-buildroot/bin" + sconsflags: bits=64 debug_symbols=no tools=no + platform: ${{ matrix.platform }} + target: release + binary: ${{ matrix.release-name }} + export: ${{ matrix.release-name-new }} + + - name: Upload Release Template + uses: ./.github/actions/upload-artifact + with: + name: ${{ matrix.cache-name }}-release-template + path: ./bin/${{ matrix.release-name-new }} + + - name: Clear bin + run: | + rm -rf bin + + # Upload the Steam redistributable for packaging + - name: Upload Linux Steam File + uses: ./.github/actions/upload-steam-redistributable + with: + name: ${{ matrix.cache-name }}-steam + path: linux64/ + redist: libsteam_api.so \ No newline at end of file diff --git a/.github/workflows/build-artifact-macos.yml b/.github/workflows/build-artifact-macos.yml new file mode 100644 index 0000000..9da98b0 --- /dev/null +++ b/.github/workflows/build-artifact-macos.yml @@ -0,0 +1,152 @@ +on: + workflow_call: + inputs: + godot_tag: + required: true + type: string + + godot_version: + required: true + type: string + + steamworks_sdk_tag: + required: true + type: string + + secrets: + steamworks_sdk_repo: + required: true + + steamworks_sdk_repo_token: + required: true + + +jobs: + build-macos: + runs-on: macos-latest + + + name: Mac ${{ matrix.name }} + + + env: + STRIP: "strip -u -r" + + + strategy: + fail-fast: false + matrix: + include: + - name: Editor and Templates + cache-name: macos + + + steps: + - uses: actions/checkout@v4 + + # Download Godot to start + - name: Download Godot + uses: ./.github/actions/download-godot + with: + version: ${{ inputs.godot_tag }} + + # Download GodotSteam Server + - name: Download GodotSteam Server + uses: ./.github/actions/download-godotsteam + + # Download Steamworks SDK + - name: Download Steamworks SDK + uses: ./.github/actions/download-steamworks + with: + path: "steamworks" + repository: ${{ secrets.steamworks_sdk_repo }} + token: ${{ secrets.steamworks_sdk_repo_token }} + ref: ${{ inputs.steamworks_sdk_tag }} + + # Get that cache money + - name: Setup Build Cache + uses: ./.github/actions/setup-cache + with: + cache-name: ${{ matrix.cache-name }} + godot-base: inputs.godot_tag + continue-on-error: true + + # Setup Python and SCONS + - name: Setup Python and SCONS + uses: ./.github/actions/setup-dependencies + + # Compiling editors + - name: Editor Compilation (arch=x86_64) + uses: ./.github/actions/build-godot + with: + sconsflags: arch=x86_64 tools=yes + platform: osx + target: release_debug + + - name: Editor Compilation (arch=arm64) + uses: ./.github/actions/build-godot + with: + sconsflags: arch=arm64 tools=yes + platform: osx + target: release_debug + + # Create Mac Universal package + - name: Package Editor (arch=arm64, x86_64) + uses: ./.github/actions/prep-macos + with: + target: 'editor' + + - name: Upload Editor + uses: ./.github/actions/upload-artifact + with: + name: ${{ matrix.cache-name }}-editor + path: bin/macos_editor.zip + + - name: Clear bin + run: | + rm -rf bin + + # Compiling templates + - name: Debug Template Compilation (arch=x86_64, target=release_debug) + uses: ./.github/actions/build-godot + with: + sconsflags: arch=x86_64 tools=no + platform: osx + target: release_debug + + - name: Debug Template Compilation (arch=arm64, target=release_debug) + uses: ./.github/actions/build-godot + with: + sconsflags: arch=arm64 debug_symbols=no tools=no + platform: osx + target: release_debug + + - name: Release Template Compilation (arch=x86_64, target=release) + uses: ./.github/actions/build-godot + with: + sconsflags: arch=x86_64 tools=no + platform: osx + target: release + + - name: Release template Compilation (arch=arm64, target=release) + uses: ./.github/actions/build-godot + with: + sconsflags: arch=arm64 debug_symbols=no tools=no + platform: osx + target: release + + # Create Mac Universal package + - name: Package Templates (arch=arm64, x86_64) + uses: ./.github/actions/prep-macos + with: + target: 'templates' + + - name: Upload Mac Template App + uses: ./.github/actions/upload-artifact + with: + name: macos-template-app + path: bin/macos.zip + + - name: Clear bin + run: | + rm -rf bin \ No newline at end of file diff --git a/.github/workflows/build-artifact-windows.yml b/.github/workflows/build-artifact-windows.yml new file mode 100644 index 0000000..9b64b0f --- /dev/null +++ b/.github/workflows/build-artifact-windows.yml @@ -0,0 +1,166 @@ +on: + workflow_call: + inputs: + godot_tag: + required: true + type: string + + godot_version: + required: true + type: string + + steamworks_sdk_tag: + required: true + type: string + + secrets: + steamworks_sdk_repo: + required: true + + steamworks_sdk_repo_token: + required: true + + +jobs: + build-windows: + runs-on: windows-latest + + + name: Windows ${{ matrix.name }} + + + strategy: + fail-fast: false + matrix: + include: + - name: Editor and Templates (64-bit) + bits: 64 + cache-name: windows64 + editor-name: godot.windows.opt.tools.64.exe + editor-name-new: godotsteam_server.${{ inputs.godot_version }}.editor.windows.64.exe + debug-name: godot.windows.opt.debug.64.exe + debug-name-new: godotsteam_server.${{ inputs.godot_version }}.debug.template.windows.64.exe + release-name: godot.windows.opt.64.exe + release-name-new: godotsteam_server.${{ inputs.godot_version }}.template.windows.64.exe + steam-redist: steam_api64.dll + steam-redist-bin: win64/ + steam-redist-bits: 64 + + - name: Editor and Templates (32-bit) + bits: 32 + cache-name: windows32 + editor-name: godot.windows.opt.tools.32.exe + editor-name-new: godotsteam_server.${{ inputs.godot_version }}.editor.windows.32.exe + debug-name: godot.windows.opt.debug.32.exe + debug-name-new: godotsteam_server.${{ inputs.godot_version }}.debug.template.windows.32.exe + release-name: godot.windows.opt.32.exe + release-name-new: godotsteam_server.${{ inputs.godot_version }}.template.windows.32.exe + steam-redist: steam_api.dll + steam-redist-bin: "" + steam-redist-bits: 32 + + + steps: + - uses: actions/checkout@v4 + + # Download Godot to start + - name: Download Godot + uses: ./.github/actions/download-godot + with: + version: ${{ inputs.godot_tag }} + + # Preempt the missing bin folder + - name: Preempt missing Bin Folder + shell: bash + run: | + mkdir ./bin/ + + # Download GodotSteam Server + - name: Download GodotSteam Server + uses: ./.github/actions/download-godotsteam + + # Download Steamworks SDK + - name: Download Steamworks SDK + uses: ./.github/actions/download-steamworks + with: + path: "steamworks" + repository: ${{ secrets.steamworks_sdk_repo }} + token: ${{ secrets.steamworks_sdk_repo_token }} + ref: ${{ inputs.steamworks_sdk_tag }} + + # Get that cache money + - name: Setup Build Cache + uses: ./.github/actions/setup-cache + with: + cache-name: ${{ matrix.cache-name }} + godot-base: inputs.godot_tag + continue-on-error: true + + # Setup Python and SCONS + - name: Setup Python and SCONS + uses: ./.github/actions/setup-dependencies + + # Compiling editor + - name: ${{ matrix.bits }}-bit Editor Compilation + uses: ./.github/actions/build-godot + with: + sconsflags: bits=${{ matrix.bits }} tools=yes + platform: windows + target: release_debug + binary: ${{ matrix.editor-name }} + export: ${{ matrix.editor-name-new }} + + - name: Upload ${{ matrix.bits }}-bit Editor + uses: ./.github/actions/upload-artifact + with: + name: ${{ matrix.cache-name }}-editor + path: ./bin/${{ matrix.editor-name-new }} + + - name: Clear bin + shell: bash + run: | + rm -rf bin + + # Compiling templates + - name: ${{ matrix.bits }}-bit Debug Template Compilation (target=template_debug) + uses: ./.github/actions/build-godot + with: + sconsflags: bits=${{ matrix.bits }} tools=no + platform: windows + target: release_debug + binary: ${{ matrix.debug-name }} + export: ${{ matrix.debug-name-new }} + + - name: Upload ${{ matrix.bits }}-bit Debug Template + uses: ./.github/actions/upload-artifact + with: + name: ${{ matrix.cache-name }}-debug-template + path: ./bin/${{ matrix.debug-name-new }} + + - name: ${{ matrix.bits }}-bit Release Template Compilation (target=template_release) + uses: ./.github/actions/build-godot + with: + sconsflags: bits=${{ matrix.bits }} debug_symbols=no tools=no + platform: windows + target: release + binary: ${{ matrix.release-name }} + export: ${{ matrix.release-name-new }} + + - name: Upload ${{ matrix.bits }}-bit Release Template + uses: ./.github/actions/upload-artifact + with: + name: ${{ matrix.cache-name }}-release-template + path: ./bin/${{ matrix.release-name-new }} + + - name: Clear bin + shell: bash + run: | + rm -rf bin + + # Upload the Steam redistributable for packaging + - name: Upload Windows ${{ matrix.steam-redist-bits}}-bit Steam File + uses: ./.github/actions/upload-steam-redistributable + with: + name: windows${{ matrix.steam-redist-bits }}-steam + path: ${{ matrix.steam-redist-bin }} + redist: ${{ matrix.steam-redist }} diff --git a/.github/workflows/build-linux-artifact.yml b/.github/workflows/build-linux-artifact.yml deleted file mode 100644 index 6ab26f2..0000000 --- a/.github/workflows/build-linux-artifact.yml +++ /dev/null @@ -1,161 +0,0 @@ -on: - workflow_call: - inputs: - steamworks_sdk_tag: - required: true - type: string - godot_tag: - required: true - type: string - secrets: - steamworks_sdk_repo: - required: true - steamworks_sdk_repo_token: - required: true - - -jobs: - build-linux: - runs-on: "ubuntu-latest" - - name: Linux ${{ matrix.name }} - - env: - SCONSFLAGS: mono_static=yes - - strategy: - fail-fast: false - matrix: - include: - - name: Editor & Templates - cache-name: linux - build-mono: false - - - name: Editor & Templates w/ Mono - cache-name: linux-mono - build-mono: true - - steps: - - uses: actions/checkout@v4 - - # Download Godot to start - - name: Download Godot - uses: ./.github/actions/godot-download - with: - version: ${{ inputs.godot_tag }} - - # Download GodotSteam Server - - name: Download GodotSteam Server - uses: ./.github/actions/godotsteam-download - - # Download Steamworks SDK - - name: Download Steamworks SDK - uses: ./.github/actions/steamworks-download - with: - path: "steamworks" - repository: ${{ secrets.steamworks_sdk_repo }} - token: ${{ secrets.steamworks_sdk_repo_token }} - ref: ${{ inputs.steamworks_sdk_tag }} - - - name: Move .so For Mono - shell: bash - run: | - mkdir ./bin/ - cp ./modules/godotsteam_server/sdk/redistributable_bin/linux64/libsteam_api.so ./bin/ - ls ./bin/ - - # Setting up the Linux toolchain for older versions - - name: Setup Linux Toolchain (x86_64) - uses: ./.github/actions/godot-linux-toolchain - with: - toolchain-name: "x86_64-godot-linux-gnu_sdk-buildroot" - - # Get that cache set up - - name: Setup Godot build cache - uses: ./.github/actions/godot-cache - with: - cache-name: ${{ matrix.cache-name }} - continue-on-error: true - - # Setup Python and Scons - - name: Setup Python and Scons - uses: ./.github/actions/godot-deps - - # Setup Mono - - name: Setup Mono (x86_64) - if: ${{ matrix.build-mono }} - uses: ./.github/actions/godot-mono - with: - mono-release: "linux-x86_64" - mono-bcl: "bcl-desktop" - - - name: Mono precompilation - if: ${{ matrix.build-mono }} - uses: ./.github/actions/godot-build - with: - buildroot: "${{ github.workspace }}/x86_64-godot-linux-gnu_sdk-buildroot/bin" - sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }} module_mono_enabled=yes mono_glue=no copy_mono_root=yes mono_bcl=$HOME/mono-bcls/desktop-bcl/net_4_x mono_prefix=$HOME/mono-installs/desktop-linux-x86_64-release - platform: linuxbsd - tools: true - - # Generate Mono glue - - name: Generate Mono glue code - if: ${{ matrix.build-mono }} - run: | - DRI_PRIME=0 xvfb-run "./bin/godot.x11.tools.64.mono" --generate-mono-glue modules/mono/glue || true - - - name: Set Mono Scons flags - if: ${{ matrix.build-mono }} - run: | - echo "MONO_SCONSFLAGS=module_mono_enabled=yes mono_glue=yes copy_mono_root=yes mono_bcl=$HOME/mono-bcls/desktop-bcl/net_4_x" >> $GITHUB_ENV - - - name: Clear bin - run: | - rm -rf bin - - # Compiling editors - - name: Editor compilation (bits=64) - uses: ./.github/actions/godot-build - with: - buildroot: "${{ github.workspace }}/x86_64-godot-linux-gnu_sdk-buildroot/bin" - sconsflags: ${{ env.SCONSFLAGS }} ${{ env.MONO_SCONSFLAGS }} ${{ matrix.sconsflags }} bits=64 ${{ matrix.build-mono && 'mono_prefix=$HOME/mono-installs/desktop-linux-x86_64-release' || '' }} - platform: linuxbsd - target: release_debug - tools: true - - - name: Upload editor (bits=64) - uses: ./.github/actions/upload-artifact - with: - name: ${{ matrix.cache-name }}-server-editor-64 - - - name: Clear bin - run: | - rm -rf bin - - # Compiling templates - - name: Debug Template compilation (tools=false, bits=64, target=release_debug) - uses: ./.github/actions/godot-build - with: - buildroot: "${{ github.workspace }}/x86_64-godot-linux-gnu_sdk-buildroot/bin" - sconsflags: ${{ env.SCONSFLAGS }} ${{ env.MONO_SCONSFLAGS }} ${{ matrix.sconsflags }} bits=64 ${{ matrix.build-mono && 'mono_prefix=$HOME/mono-installs/desktop-linux-x86_64-release' || '' }} - platform: linuxbsd - target: release_debug - tools: false - - - name: Release Template compilation (tools=false, bits=64, target=release) - uses: ./.github/actions/godot-build - with: - buildroot: "${{ github.workspace }}/x86_64-godot-linux-gnu_sdk-buildroot/bin" - sconsflags: ${{ env.SCONSFLAGS }} ${{ env.MONO_SCONSFLAGS }} ${{ matrix.sconsflags }} bits=64 ${{ matrix.build-mono && 'mono_prefix=$HOME/mono-installs/desktop-linux-x86_64-release' || '' }} debug_symbols=no - platform: linuxbsd - target: release - tools: false - - - name: Upload Templates (bits=64) - uses: ./.github/actions/upload-artifact - with: - name: ${{ matrix.cache-name }}-templates-64 - - - name: Clear bin - run: | - rm -rf bin \ No newline at end of file diff --git a/.github/workflows/build-macos-artifact.yml b/.github/workflows/build-macos-artifact.yml deleted file mode 100644 index bd0d8ad..0000000 --- a/.github/workflows/build-macos-artifact.yml +++ /dev/null @@ -1,229 +0,0 @@ -on: - workflow_call: - inputs: - steamworks_sdk_tag: - required: true - type: string - godot_tag: - required: true - type: string - secrets: - steamworks_sdk_repo: - required: true - steamworks_sdk_repo_token: - required: true - - -jobs: - build-macos: - runs-on: "macos-latest" - - name: macOS ${{ matrix.name }} - - env: - SCONSFLAGS: - STRIP: "strip -u -r" - - strategy: - fail-fast: false - matrix: - include: - - name: Editor & Templates - cache-name: macos - build-mono: false - - - name: Editor & Templates w/ Mono - cache-name: macos-mono - build-mono: true - - steps: - - uses: actions/checkout@v4 - - # Download Godot to start - - name: Download Godot - uses: ./.github/actions/godot-download - with: - version: ${{ inputs.godot_tag }} - - # Download GodotSteam Server - - name: Download GodotSteam Server - uses: ./.github/actions/godotsteam-download - - # Download Steamworks SDK - - name: Download Steamworks SDK - uses: ./.github/actions/steamworks-download - with: - path: "steamworks" - repository: ${{ secrets.steamworks_sdk_repo }} - token: ${{ secrets.steamworks_sdk_repo_token }} - ref: ${{ inputs.steamworks_sdk_tag }} - - - name: Move .dylib For Mono - shell: bash - run: | - mkdir ./bin/ - cp ./modules/godotsteam_server/sdk/redistributable_bin/osx/libsteam_api.dylib ./bin/ - ls ./bin/ - - # Get that cache set up - - name: Setup Godot build cache - uses: ./.github/actions/godot-cache - with: - cache-name: ${{ matrix.cache-name }} - continue-on-error: true - - # Setup Python and Scons - - name: Setup Python and Scons - uses: ./.github/actions/godot-deps - - # Setup Mono - - name: Setup Mono (x86_64) - if: ${{ matrix.build-mono }} - uses: ./.github/actions/godot-mono - with: - mono-release: "osx-x86_64" - mono-bcl: "bcl-desktop" - - - name: Setup mono (arm64) - if: ${{ matrix.build-mono }} - uses: ./.github/actions/godot-mono - with: - mono-release: "osx-arm64" - - - name: Mono precompilation - if: ${{ matrix.build-mono }} - uses: ./.github/actions/godot-build - with: - sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }} module_mono_enabled=yes mono_glue=no - platform: osx - tools: true - - # Generate Mono glue - - name: Generate Mono glue code - if: ${{ matrix.build-mono }} - run: | - DRI_PRIME=0 "./bin/godot.osx.tools.64.mono" --generate-mono-glue modules/mono/glue - - - name: Set Mono Scons flags - if: ${{ matrix.build-mono }} - run: | - echo "MONO_SCONSFLAGS=module_mono_enabled=yes mono_glue=yes copy_mono_root=yes mono_bcl=$HOME/mono-bcls/desktop-bcl/net_4_x" >> $GITHUB_ENV - - - name: Clear bin - run: | - rm -rf bin - - # Compilng editors - - name: Editor compilation (arch=x86_64) - uses: ./.github/actions/godot-build - with: - sconsflags: ${{ env.SCONSFLAGS }} ${{ env.MONO_SCONSFLAGS }} ${{ matrix.sconsflags }} arch=x86_64 ${{ matrix.build-mono && 'mono_prefix=$HOME/mono-installs/desktop-osx-x86_64-release' || '' }} - platform: osx - target: release_debug - tools: true - - - name: Dylib Wrangling - if: ${{ matrix.build-mono }} - run: | - # Note: A bit of dylib wrangling involved as x86_64 and arm64 builds both generate GodotSharp - # so the second build overrides the first, but we need to lipo the libs to make them universal. - # We also need to ensure that /etc/mono/config has the proper filenames (keep arm64 as the last - # build so that we rely on its config, which has libmono-native.dylib instead of - # libmono-native-compat.dylib). - mkdir -p tmp-lib/{x86_64,arm64} - cp bin/GodotSharp/Mono/lib/*.dylib tmp-lib/x86_64/ - - - name: Editor compilation (arch=arm64) - uses: ./.github/actions/godot-build - with: - sconsflags: ${{ env.SCONSFLAGS }} ${{ env.MONO_SCONSFLAGS }} ${{ matrix.sconsflags }} arch=arm64 ${{ matrix.build-mono && 'mono_prefix=$HOME/mono-installs/desktop-osx-arm64-release' || '' }} - platform: osx - target: release_debug - tools: true - - - name: Dylib Wrangling - if: ${{ matrix.build-mono }} - run: | - cp bin/GodotSharp/Mono/lib/*.dylib tmp-lib/arm64/ - echo "tmp-lib:" - find tmp-lib | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/|-\1/" - - - name: Package Editor (arch=arm64, x86_64) - run: | - lipo -create bin/godot.osx.opt.tools.x86_64${{ matrix.build-mono && '.mono' || '' }} \ - bin/godot.osx.opt.tools.arm64${{ matrix.build-mono && '.mono' || '' }} \ - -output bin/godot.osx.opt.tools.universal${{ matrix.build-mono && '.mono' || '' }} - $STRIP bin/godot.osx.opt.tools.universal${{ matrix.build-mono && '.mono' || '' }} - - if ${{ matrix.build-mono }}; then - # Make universal versions of the dylibs we use. - lipo -create tmp-lib/x86_64/libmono-native.dylib tmp-lib/arm64/libmono-native.dylib -output tmp-lib/libmono-native.dylib - lipo -create tmp-lib/x86_64/libMonoPosixHelper.dylib tmp-lib/arm64/libMonoPosixHelper.dylib -output tmp-lib/libMonoPosixHelper.dylib - # Somehow only included in x86_64 build. - cp tmp-lib/x86_64/libmono-btls-shared.dylib tmp-lib/ - - cp -f tmp-lib/*.dylib bin/GodotSharp/Mono/lib/ - fi - - - name: Upload Editor - uses: ./.github/actions/upload-artifact - with: - name: ${{ matrix.cache-name }}-editor - - - name: Clear bin - run: | - rm -rf bin - - # Compiling templates - - name: Debug Template compilation (tools=false, arch=x86_64, target=release_debug) - uses: ./.github/actions/godot-build - with: - sconsflags: ${{ env.SCONSFLAGS }} ${{ env.MONO_SCONSFLAGS }} ${{ matrix.sconsflags }} arch=x86_64 ${{ matrix.build-mono && 'mono_prefix=$HOME/mono-installs/desktop-osx-x86_64-release' || '' }} - platform: osx - target: release_debug - tools: false - - - name: Release template compilation (tools=false, arch=arm64, target=release_debug) - uses: ./.github/actions/godot-build - with: - sconsflags: ${{ env.SCONSFLAGS }} ${{ env.MONO_SCONSFLAGS }} ${{ matrix.sconsflags }} arch=arm64 ${{ matrix.build-mono && 'mono_prefix=$HOME/mono-installs/desktop-osx-arm64-release' || '' }} - platform: osx - target: release_debug - tools: false - - - name: Debug Template compilation (tools=false, arch=x86_64, target=release) - uses: ./.github/actions/godot-build - with: - sconsflags: ${{ env.SCONSFLAGS }} ${{ env.MONO_SCONSFLAGS }} ${{ matrix.sconsflags }} arch=x86_64 ${{ matrix.build-mono && 'mono_prefix=$HOME/mono-installs/desktop-osx-x86_64-release' || '' }} debug_symbols=no - platform: osx - target: release - tools: false - - - name: Release template compilation (tools=false, arch=arm64, target=release) - uses: ./.github/actions/godot-build - with: - sconsflags: ${{ env.SCONSFLAGS }} ${{ env.MONO_SCONSFLAGS }} ${{ matrix.sconsflags }} arch=arm64 ${{ matrix.build-mono && 'mono_prefix=$HOME/mono-installs/desktop-osx-arm64-release' || '' }} debug_symbols=no - platform: osx - target: release - tools: false - - - name: Package Templates (arch=arm64, x86_64) - run: | - lipo -create bin/godot.osx.opt.debug.x86_64${{ matrix.build-mono && '.mono' || '' }} bin/godot.osx.opt.debug.arm64${{ matrix.build-mono && '.mono' || '' }} -output bin/godot.osx.opt.debug.universal${{ matrix.build-mono && '.mono' || '' }} - $STRIP bin/godot.osx.opt.debug.universal${{ matrix.build-mono && '.mono' || '' }} - lipo -create bin/godot.osx.opt.x86_64${{ matrix.build-mono && '.mono' || '' }} bin/godot.osx.opt.arm64${{ matrix.build-mono && '.mono' || '' }} -output bin/godot.osx.opt.universal${{ matrix.build-mono && '.mono' || '' }} - $STRIP bin/godot.osx.opt.universal${{ matrix.build-mono && '.mono' || '' }} - - if ${{ matrix.build-mono }}; then - cp -f tmp-lib/*.dylib bin/data.mono.osx.64.release/Mono/lib/ - cp -f tmp-lib/*.dylib bin/data.mono.osx.64.release_debug/Mono/lib/ - fi - - - name: Upload Templates - uses: ./.github/actions/upload-artifact - with: - name: ${{ matrix.cache-name }}-templates - - - name: Clear bin - run: | - rm -rf bin \ No newline at end of file diff --git a/.github/workflows/build-releases.yml b/.github/workflows/build-releases.yml index c36f474..1e2b51e 100644 --- a/.github/workflows/build-releases.yml +++ b/.github/workflows/build-releases.yml @@ -1,5 +1,6 @@ name: Build Releases + on: workflow_dispatch: inputs: @@ -7,210 +8,119 @@ on: description: 'Steamworks SDK Github tag:' required: true type: string - default: 'sdk-1.58' + default: 'sdk-1.59' + godot_tag: description: 'Godot Github tag:' required: true type: string default: '3.5.3-stable' + godotsteam_version: description: 'GodotSteam Server version number:' required: true type: string - default: '3.1' + default: '3.3' -# Global Settings -# SCONS_CACHE for windows must be set in the build environment -env: - # Used for cache key as well as for downloading the correct Godot version. - GODOT_BASE_VERSION: 3.5.3 - GODOT_BASE_VERSION_STATUS: stable - GODOT_VERSION_STATUS: custom - GODOT_MONO_BUILD_TAG: release-5299efd # mono-6.12.0.182 - GODOT_MONO_BUILD_REPO: godotengine/godot-mono-builds +jobs: + env-setup: + uses: ./.github/workflows/setup-env.yml + with: + godot_tag: ${{ inputs.godot_tag }} + godotsteam_version: ${{ inputs.godotsteam_version }} + steamworks_sdk_tag: ${{ inputs.steamworks_sdk_tag }} -jobs: build-linux: - uses: ./.github/workflows/build-linux-artifact.yml + needs: [env-setup] + uses: ./.github/workflows/build-artifact-linux.yml with: - steamworks_sdk_tag: ${{ inputs.steamworks_sdk_tag }} godot_tag: ${{ inputs.godot_tag }} + godot_version: ${{ needs.env-setup.outputs.godot_version }} + steamworks_sdk_tag: ${{ inputs.steamworks_sdk_tag }} secrets: steamworks_sdk_repo: ${{ secrets.STEAMWORKS_SDK_REPO }} steamworks_sdk_repo_token: ${{ secrets.STEAMWORKS_SDK_REPO_TOKEN }} - build-macos: - uses: ./.github/workflows/build-macos-artifact.yml + + create-linux-bundle: + needs: [env-setup, build-linux] + uses: ./.github/workflows/create-bundle.yml with: - steamworks_sdk_tag: ${{ inputs.steamworks_sdk_tag }} - godot_tag: ${{ inputs.godot_tag }} - secrets: - steamworks_sdk_repo: ${{ secrets.STEAMWORKS_SDK_REPO }} - steamworks_sdk_repo_token: ${{ secrets.STEAMWORKS_SDK_REPO_TOKEN }} + artifact_type: linux + platform: 'Linux' + zip_prefix: linux64 + zip_tag: ${{ needs.env-setup.outputs.zip_tag }} + - build-server: - uses: ./.github/workflows/build-server-artifact.yml + create-linux-headless-bundle: + needs: [env-setup, build-linux] + uses: ./.github/workflows/create-bundle.yml with: - steamworks_sdk_tag: ${{ inputs.steamworks_sdk_tag }} - godot_tag: ${{ inputs.godot_tag }} - secrets: - steamworks_sdk_repo: ${{ secrets.STEAMWORKS_SDK_REPO }} - steamworks_sdk_repo_token: ${{ secrets.STEAMWORKS_SDK_REPO_TOKEN }} + artifact_type: server + platform: 'Linux Headless' + zip_prefix: linux64 + zip_tag: ${{ needs.env-setup.outputs.zip_tag }} + - build-windows-32: - uses: ./.github/workflows/build-windows32-artifact.yml + build-windows: + needs: [env-setup] + uses: ./.github/workflows/build-artifact-windows.yml with: - steamworks_sdk_tag: ${{ inputs.steamworks_sdk_tag }} godot_tag: ${{ inputs.godot_tag }} + godot_version: ${{ needs.env-setup.outputs.godot_version }} + steamworks_sdk_tag: ${{ inputs.steamworks_sdk_tag }} secrets: steamworks_sdk_repo: ${{ secrets.STEAMWORKS_SDK_REPO }} steamworks_sdk_repo_token: ${{ secrets.STEAMWORKS_SDK_REPO_TOKEN }} - build-windows-64: - uses: ./.github/workflows/build-windows64-artifact.yml + + create-windows32-bundle: + needs: [env-setup, build-windows] + uses: ./.github/workflows/create-bundle.yml + with: + artifact_type: windows32 + platform: 'Windows32' + zip_prefix: win32 + zip_tag: ${{ needs.env-setup.outputs.zip_tag }} + + + create-windows64-bundle: + needs: [env-setup, build-windows] + uses: ./.github/workflows/create-bundle.yml + with: + artifact_type: windows64 + platform: 'Windows64' + zip_prefix: win64 + zip_tag: ${{ needs.env-setup.outputs.zip_tag }} + + + build-macos: + needs: [env-setup] + uses: ./.github/workflows/build-artifact-macos.yml with: - steamworks_sdk_tag: ${{ inputs.steamworks_sdk_tag }} godot_tag: ${{ inputs.godot_tag }} + godot_version: ${{ needs.env-setup.outputs.godot_version }} + steamworks_sdk_tag: ${{ inputs.steamworks_sdk_tag }} secrets: steamworks_sdk_repo: ${{ secrets.STEAMWORKS_SDK_REPO }} steamworks_sdk_repo_token: ${{ secrets.STEAMWORKS_SDK_REPO_TOKEN }} - bundle-export-templates: - needs: - [build-linux, build-macos, build-server, build-windows-32, build-windows-64] - name: Bundle Export Templates - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - - name: Templates - build-mono: false - - - name: Templates w/ Mono - build-mono: true - steps: - - uses: actions/checkout@v4 - - - name: Download Godot - uses: ./.github/actions/godot-download - with: - version: ${{ env.GODOT_BASE_VERSION }}-${{ env.GODOT_BASE_VERSION_STATUS }} - - - name: Download Linux Templates (bits=64) - uses: actions/download-artifact@v4 - with: - name: linux-${{ matrix.build-mono && 'mono-' || '' }}templates-64 - path: linux-${{ matrix.build-mono && 'mono-' || '' }}templates-64 - - - name: Download Linux Templates (bits=32) - uses: actions/download-artifact@v4 - with: - name: linux-${{ matrix.build-mono && 'mono-' || '' }}templates-32 - path: linux-${{ matrix.build-mono && 'mono-' || '' }}templates-32 - - - name: Download Windows Templates (bits=64) - uses: actions/download-artifact@v4 - with: - name: windows-${{ matrix.build-mono && 'mono-' || '' }}templates-64 - path: windows-${{ matrix.build-mono && 'mono-' || '' }}templates-64 - - - name: Download Windows Templates (bits=32) - uses: actions/download-artifact@v4 - with: - name: windows-${{ matrix.build-mono && 'mono-' || '' }}templates-32 - path: windows-${{ matrix.build-mono && 'mono-' || '' }}templates-32 - - - name: Download MacOS Templates - uses: actions/download-artifact@v4 - with: - name: macos-${{ matrix.build-mono && 'mono-' || '' }}templates - path: macos-${{ matrix.build-mono && 'mono-' || '' }}templates - - - name: Download Linux Mono Editor (bits=64) - uses: actions/download-artifact@v4 - if: ${{ matrix.build-mono }} - with: - name: linux-mono-editor-64 - path: linux-mono-editor-64 - - - name: Download Windows Mono Editor (bits=64) - uses: actions/download-artifact@v4 - if: ${{ matrix.build-mono }} - with: - name: windows-mono-editor-64 - path: windows-mono-editor-64 - - - name: Debug Print - run: | - ls -a - - - name: Setup ENV Vars - run: | - echo "TEMPLATES_VERSION=${{ format('{0}.{1}', env.GODOT_BASE_VERSION, env.GODOT_VERSION_STATUS) }}${{ matrix.build-mono && '.mono' || '' }}" >> $GITHUB_ENV - - echo "RELDIR=$HOME/releases" >> $GITHUB_ENV - echo "GODOT_BASENAME=GodotSteam_Server_v${{ format('{0}-{1}', env.GODOT_BASE_VERSION, env.GODOT_VERSION_STATUS) }}" >> $GITHUB_ENV - echo "TEMPLATES_DIR=$HOME/templates" >> $GITHUB_ENV - - - name: Setup Directories - run: | - mkdir -p ${{ env.TEMPLATES_DIR }} - mkdir -p ${{ env.RELDIR }} - - - name: Bundle Linux - run: | - if ${{ matrix.build-mono }}; then - cp -rp linux-mono-templates-64/data.mono.x11.64.* ${{ env.TEMPLATES_DIR }}/ - cp -rp linux-mono-templates-32/data.mono.x11.32.* ${{ env.TEMPLATES_DIR }}/ - mkdir -p ${{ env.TEMPLATES_DIR }}/bcl - cp -r linux-mono-editor-64/GodotSharp/Mono/lib/mono/4.5/ ${{ env.TEMPLATES_DIR }}/bcl/net_4_x - fi - cp linux-${{ matrix.build-mono && 'mono-' || '' }}templates-64/godot.x11.opt.64${{ matrix.build-mono && '.mono' || '' }} ${{ env.TEMPLATES_DIR }}/linux_x11_64_release - cp linux-${{ matrix.build-mono && 'mono-' || '' }}templates-64/godot.x11.opt.debug.64${{ matrix.build-mono && '.mono' || '' }} ${{ env.TEMPLATES_DIR }}/linux_x11_64_debug - cp linux-${{ matrix.build-mono && 'mono-' || '' }}templates-32/godot.x11.opt.32${{ matrix.build-mono && '.mono' || '' }} ${{ env.TEMPLATES_DIR }}/linux_x11_32_release - cp linux-${{ matrix.build-mono && 'mono-' || '' }}templates-32/godot.x11.opt.debug.32${{ matrix.build-mono && '.mono' || '' }} ${{ env.TEMPLATES_DIR }}/linux_x11_32_debug - strip ${{ env.TEMPLATES_DIR }}/linux_x11_* - - - name: Bundle Windows - run: | - if ${{ matrix.build-mono }}; then - cp -rp windows-mono-templates-64/data.mono.windows.64.* ${{ env.TEMPLATES_DIR }}/ - cp -rp windows-mono-templates-32/data.mono.windows.32.* ${{ env.TEMPLATES_DIR }}/ - mkdir -p ${{ env.TEMPLATES_DIR }}/bcl - cp -r windows-mono-editor-64/GodotSharp/Mono/lib/mono/4.5/ ${{ env.TEMPLATES_DIR }}/bcl/net_4_x_win - fi - cp windows-${{ matrix.build-mono && 'mono-' || '' }}templates-64/godot.windows.opt.64${{ matrix.build-mono && '.mono' || '' }}.exe ${{ env.TEMPLATES_DIR }}/windows_64_release.exe - cp windows-${{ matrix.build-mono && 'mono-' || '' }}templates-64/godot.windows.opt.debug.64${{ matrix.build-mono && '.mono' || '' }}.exe ${{ env.TEMPLATES_DIR }}/windows_64_debug.exe - cp windows-${{ matrix.build-mono && 'mono-' || '' }}templates-32/godot.windows.opt.32${{ matrix.build-mono && '.mono' || '' }}.exe ${{ env.TEMPLATES_DIR }}/windows_32_release.exe - cp windows-${{ matrix.build-mono && 'mono-' || '' }}templates-32/godot.windows.opt.debug.32${{ matrix.build-mono && '.mono' || '' }}.exe ${{ env.TEMPLATES_DIR }}/windows_32_debug.exe - strip ${{ env.TEMPLATES_DIR }}/windows*.exe - - - name: Bundle MacOS - run: | - rm -rf osx_template.app - cp -r misc/dist/osx_template.app . - mkdir -p osx_template.app/Contents/MacOS - cp macos-${{ matrix.build-mono && 'mono-' || '' }}templates/godot.osx.opt.universal${{ matrix.build-mono && '.mono' || '' }} osx_template.app/Contents/MacOS/godot_osx_release.64 - cp macos-${{ matrix.build-mono && 'mono-' || '' }}templates/godot.osx.opt.debug.universal${{ matrix.build-mono && '.mono' || '' }} osx_template.app/Contents/MacOS/godot_osx_debug.64 - if ${{ matrix.build-mono }}; then - cp -rp macos-mono-templates/data.mono.osx.64.* osx_template.app/Contents/Resources/ - fi - chmod +x osx_template.app/Contents/MacOS/godot_osx* - zip -q -9 -r "${{ env.TEMPLATES_DIR }}/osx.zip" osx_template.app - rm -rf osx_template.app - - - name: Create Templates TPZ - run: | - echo "${{ env.TEMPLATES_VERSION }}" > ${{ env.TEMPLATES_DIR }}/version.txt - pushd ${{ env.TEMPLATES_DIR }}/.. - zip -q -9 -r -D "${{ env.RELDIR }}/${{ env.GODOT_BASENAME }}_export-templates${{ matrix.build-mono && '-mono' || '' }}.tpz" templates/* - popd - - - name: Upload Export Templates TPZ - uses: ./.github/actions/upload-artifact - with: - path: ${{ env.RELDIR }}/${{ env.GODOT_BASENAME }}_export-templates${{ matrix.build-mono && '-mono' || '' }}.tpz - name: export-templates${{ matrix.build-mono && '-mono' || '' }} \ No newline at end of file + + create-macos-bundle: + needs: [env-setup, build-macos] + uses: ./.github/workflows/create-bundle.yml + with: + artifact_type: macos + platform: 'MacOS' + zip_prefix: macos + zip_tag: ${{ needs.env-setup.outputs.zip_tag }} + + + create-template-bundle: + needs: [env-setup, build-linux, build-windows, build-macos] + uses: ./.github/workflows/create-bundle-templates.yml + with: + is_mono: false + zip_tag: ${{ needs.env-setup.outputs.zip_tag }} \ No newline at end of file diff --git a/.github/workflows/build-server-artifact.yml b/.github/workflows/build-server-artifact.yml deleted file mode 100644 index addf795..0000000 --- a/.github/workflows/build-server-artifact.yml +++ /dev/null @@ -1,227 +0,0 @@ -on: - workflow_call: - inputs: - steamworks_sdk_tag: - required: true - type: string - godot_tag: - required: true - type: string - secrets: - steamworks_sdk_repo: - required: true - steamworks_sdk_repo_token: - required: true - - -jobs: - build-server: - runs-on: "ubuntu-latest" - - name: Server ${{ matrix.name }} - - env: - SCONSFLAGS: - - strategy: - fail-fast: false - matrix: - include: - - name: Editor & Templates - cache-name: server - build-mono: false - - - name: Editor & Templates w/ Mono - cache-name: server-mono - build-mono: true - - steps: - - uses: actions/checkout@v4 - - # Download Godot to start - - name: Download Godot - uses: ./.github/actions/godot-download - with: - version: ${{ inputs.godot_tag }} - - # Download GodotSteam Server - - name: Download GodotSteam Server - uses: ./.github/actions/godotsteam-download - - # Download Steamworks SDK - - name: Download Steamworks SDK - uses: ./.github/actions/steamworks-download - with: - path: "steamworks" - repository: ${{ secrets.steamworks_sdk_repo }} - token: ${{ secrets.steamworks_sdk_repo_token }} - ref: ${{ inputs.steamworks_sdk_tag }} - - - name: Move .so For Mono - shell: bash - run: | - mkdir ./bin/ - cp ./modules/godotsteam_server/sdk/redistributable_bin/linux64/libsteam_api.so ./bin/ - ls ./bin/ - - # Setting up the Linux toolchain for older versions - - name: Setup Linux Toolchain (x86_64) - uses: ./.github/actions/godot-linux-toolchain - with: - toolchain-name: "x86_64-godot-linux-gnu_sdk-buildroot" - - - name: Setup Linux Toolchain (i686) - uses: ./.github/actions/godot-linux-toolchain - with: - toolchain-name: "i686-godot-linux-gnu_sdk-buildroot" - - # Get that cache set up - - name: Setup Godot build cache - uses: ./.github/actions/godot-cache - with: - cache-name: ${{ matrix.cache-name }} - continue-on-error: true - - # Setup Python and Scons - - name: Setup Python and Scons - uses: ./.github/actions/godot-deps - - # Setup Linux dependencies (look how that lines up) - - name: Linux dependencies - shell: bash - run: | - sudo apt-get install xvfb libc6-dev - - # Setup Mono - - name: Setup Mono (x86_64) - if: ${{ matrix.build-mono }} - uses: ./.github/actions/godot-mono - with: - mono-build-repo: ${{ env.GODOT_MONO_LINUX_BUILD_REPO }} - mono-build-tag: ${{ env.GODOT_MONO_LINUX_BUILD_TAG }} - mono-release: "linux-x86_64" - mono-bcl: "bcl-desktop" - - - name: Setup Mono (x86) - if: ${{ matrix.build-mono }} - uses: ./.github/actions/godot-mono - with: - mono-build-repo: ${{ env.GODOT_MONO_LINUX_BUILD_REPO }} - mono-build-tag: ${{ env.GODOT_MONO_LINUX_BUILD_TAG }} - mono-release: "linux-x86" - - - name: Mono precompilation - if: ${{ matrix.build-mono }} - uses: ./.github/actions/godot-build - with: - buildroot: "${{ github.workspace }}/x86_64-godot-linux-gnu_sdk-buildroot/bin" - sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }} module_mono_enabled=yes mono_glue=no mono_bcl=$HOME/mono-bcls/desktop-bcl/net_4_x mono_prefix=$HOME/mono-installs/desktop-linux-x86_64-release - platform: linuxbsd - tools: true - - # Generate Mono glue - - name: Generate Mono glue code - if: ${{ matrix.build-mono }} - run: | - DRI_PRIME=0 xvfb-run "./bin/godot.x11.tools.64.mono" --generate-mono-glue modules/mono/glue || true - - - name: Set Mono scons flags - if: ${{ matrix.build-mono }} - run: | - echo "MONO_SCONSFLAGS=module_mono_enabled=yes mono_glue=yes copy_mono_root=yes mono_bcl=$HOME/mono-bcls/desktop-bcl/net_4_x" >> $GITHUB_ENV - - - name: Clear bin - run: | - rm -rf bin - - # Compiling editors - - name: Editor compilation (bits=64) - uses: ./.github/actions/godot-build - with: - buildroot: "${{ github.workspace }}/x86_64-godot-linux-gnu_sdk-buildroot/bin" - sconsflags: ${{ env.SCONSFLAGS }} ${{ env.MONO_SCONSFLAGS }} ${{ matrix.sconsflags }} bits=64 ${{ matrix.build-mono && 'mono_prefix=$HOME/mono-installs/desktop-linux-x86_64-release' || '' }} - platform: server - target: release_debug - tools: true - - - name: Upload Editor (bits=64) - uses: ./.github/actions/upload-artifact - with: - name: ${{ matrix.cache-name }}-editor-64 - - - name: Clear bin - run: | - rm -rf bin - - - name: Editor compilation (bits=32) - uses: ./.github/actions/godot-build - with: - buildroot: "${{ github.workspace }}/i686-godot-linux-gnu_sdk-buildroot/bin" - sconsflags: ${{ env.SCONSFLAGS }} ${{ env.MONO_SCONSFLAGS }} ${{ matrix.sconsflags }} bits=32 ${{ matrix.build-mono && 'mono_prefix=$HOME/mono-installs/desktop-linux-x86-release' || '' }} - platform: server - target: release_debug - tools: true - - - name: Upload Editor (bits=32) - uses: ./.github/actions/upload-artifact - with: - name: ${{ matrix.cache-name }}-editor-32 - - - name: Clear bin - run: | - rm -rf bin - - # Compiling templates - - name: Debug Template compilation (tools=false, bits=64, target=release_debug) - uses: ./.github/actions/godot-build - with: - buildroot: "${{ github.workspace }}/x86_64-godot-linux-gnu_sdk-buildroot/bin" - sconsflags: ${{ env.SCONSFLAGS }} ${{ env.MONO_SCONSFLAGS }} ${{ matrix.sconsflags }} bits=64 ${{ matrix.build-mono && 'mono_prefix=$HOME/mono-installs/desktop-linux-x86_64-release' || '' }} - platform: server - target: release_debug - tools: false - - - name: Release template compilation (tools=false, bits=64, target=release) - uses: ./.github/actions/godot-build - with: - buildroot: "${{ github.workspace }}/x86_64-godot-linux-gnu_sdk-buildroot/bin" - sconsflags: ${{ env.SCONSFLAGS }} ${{ env.MONO_SCONSFLAGS }} ${{ matrix.sconsflags }} bits=64 ${{ matrix.build-mono && 'mono_prefix=$HOME/mono-installs/desktop-linux-x86_64-release' || '' }} debug_symbols=no - platform: server - target: release - tools: false - - - name: Upload Templates (bits=64) - uses: ./.github/actions/upload-artifact - with: - name: ${{ matrix.cache-name }}-templates-64 - - - name: Clear bin - run: | - rm -rf bin - - - name: Debug Template compilation (tools=false, bits=32, target=release_debug) - uses: ./.github/actions/godot-build - with: - buildroot: "${{ github.workspace }}/i686-godot-linux-gnu_sdk-buildroot/bin" - sconsflags: ${{ env.SCONSFLAGS }} ${{ env.MONO_SCONSFLAGS }} ${{ matrix.sconsflags }} bits=32 ${{ matrix.build-mono && 'mono_prefix=$HOME/mono-installs/desktop-linux-x86-release' || '' }} - platform: server - target: release_debug - tools: false - - - name: Release template compilation (tools=false, bits=32, target=release) - uses: ./.github/actions/godot-build - with: - buildroot: "${{ github.workspace }}/i686-godot-linux-gnu_sdk-buildroot/bin" - sconsflags: ${{ env.SCONSFLAGS }} ${{ env.MONO_SCONSFLAGS }} ${{ matrix.sconsflags }} bits=32 ${{ matrix.build-mono && 'mono_prefix=$HOME/mono-installs/desktop-linux-x86-release' || '' }} debug_symbols=no - platform: server - target: release - tools: false - - - name: Upload Templates (bits=32) - uses: ./.github/actions/upload-artifact - with: - name: ${{ matrix.cache-name }}-templates-32 - - - name: Clear bin - run: | - rm -rf bin \ No newline at end of file diff --git a/.github/workflows/build-windows32-artifact.yml b/.github/workflows/build-windows32-artifact.yml deleted file mode 100644 index 0ce3301..0000000 --- a/.github/workflows/build-windows32-artifact.yml +++ /dev/null @@ -1,151 +0,0 @@ -on: - workflow_call: - inputs: - steamworks_sdk_tag: - required: true - type: string - godot_tag: - required: true - type: string - secrets: - steamworks_sdk_repo: - required: true - steamworks_sdk_repo_token: - required: true - - -jobs: - build-windows32: - runs-on: "windows-latest" - name: Windows 32 ${{ matrix.name }} - env: - SCONSFLAGS: - strategy: - fail-fast: false - matrix: - include: - - name: Editor & Templates - cache-name: windows-32 - artifact-name: windows - build-mono: false - - - name: Editor & Templates w/ Mono - cache-name: windows-32-mono - artifact-name: windows-mono - build-mono: true - - steps: - - uses: actions/checkout@v4 - - # Download Godot to start - - name: Download Godot - uses: ./.github/actions/godot-download - with: - version: ${{ inputs.godot_tag }} - - - name: Preempty Missing bin/ - run: | - mkdir ./bin/ - - # Download GodotSteam Server - - name: Download GodotSteam Server - uses: ./.github/actions/godotsteam-download - - # Download Steamworks SDK - - name: Download Steamworks SDK - uses: ./.github/actions/steamworks-download - with: - path: "steamworks" - repository: ${{ secrets.steamworks_sdk_repo }} - token: ${{ secrets.steamworks_sdk_repo_token }} - ref: ${{ inputs.steamworks_sdk_tag }} - - - name: Move .dll For Mono - shell: bash - run: | - cp ./modules/godotsteam_server/sdk/redistributable_bin/steam_api.dll ./bin/ - ls ./bin/ - - # Get that cache set up - - name: Setup Godot build cache - uses: ./.github/actions/godot-cache - with: - cache-name: ${{ matrix.cache-name }} - continue-on-error: true - - # Setup Python and Scons - - name: Setup Python and Scons - uses: ./.github/actions/godot-deps - - # Setup Mono - # Assume Mono is already installed on the runner - - name: Setup Mono (x86) - if: ${{ matrix.build-mono }} - uses: ./.github/actions/godot-windows-mono - with: - mono-bcl: "bcl-desktop-win32" - mono-release: "windows-x86" - - - name: Mono precompilation - if: ${{ matrix.build-mono }} - uses: ./.github/actions/godot-windows-build - with: - sconsflags: mono_static=yes module_mono_enabled=yes mono_glue=no copy_mono_root=yes mono_bcl=$HOME/mono-bcls/desktop-win32-bcl/net_4_x-win32 mono_prefix="$HOME/mono-installs/desktop-windows-x86-release" - platform: windows - tools: true - - # Generate Mono glue - - name: Generate Mono glue code - if: ${{ matrix.build-mono }} - run: | - DRI_PRIME=0 xvfb-run "./bin/godot.windows.opt.tools.32.mono.exe" --generate-mono-glue modules/mono/glue || true - - - name: Set Mono Scons flags - if: ${{ matrix.build-mono }} - run: | - echo "MONO_SCONSFLAGS=module_mono_enabled=yes mono_glue=yes copy_mono_root=yes mono_bcl=$HOME/mono-bcls/desktop-win32-bcl/net_4_x-win32" >> $GITHUB_ENV - - # Compiling editors - - name: Editor compilation (bits=32) - uses: ./.github/actions/godot-windows-build - with: - sconsflags: ${{ env.SCONSFLAGS }} ${{ env.MONO_SCONSFLAGS }} ${{ matrix.sconsflags }} bits=32 ${{ matrix.build-mono && 'mono_prefix=$HOME/mono-installs/desktop-windows-x86-release' || '' }} - platform: windows - target: release_debug - tools: true - - - name: Upload editor (bits=32) - uses: ./.github/actions/upload-artifact - with: - name: ${{ matrix.artifact-name }}-editor-32 - - - name: Clear bin - run: | - rm -r -fo bin - - # Compiling templates - - name: Debug Template compilation (tools=false, bits=32, target=release_debug) - uses: ./.github/actions/godot-build - with: - sconsflags: ${{ env.SCONSFLAGS }} ${{ env.MONO_SCONSFLAGS }} ${{ matrix.sconsflags }} bits=32 ${{ matrix.build-mono && 'mono_prefix=$HOME/mono-installs/desktop-windows-x86-release' || '' }} - platform: windows - target: release_debug - tools: false - - - name: Release Template compilation (tools=false, bits=32, target=release) - uses: ./.github/actions/godot-build - with: - sconsflags: ${{ env.SCONSFLAGS }} ${{ env.MONO_SCONSFLAGS }} ${{ matrix.sconsflags }} bits=32 ${{ matrix.build-mono && 'mono_prefix=$HOME/mono-installs/desktop-windows-x86-release' || '' }} debug_symbols=no - platform: windows - target: release - tools: false - - - name: Upload Templates (bits=32) - uses: ./.github/actions/upload-artifact - with: - name: ${{ matrix.artifact-name }}-templates-32 - - - name: Clear bin - shell: pwsh - run: | - rm -r -fo bin \ No newline at end of file diff --git a/.github/workflows/build-windows64-artifact.yml b/.github/workflows/build-windows64-artifact.yml deleted file mode 100644 index 43cea03..0000000 --- a/.github/workflows/build-windows64-artifact.yml +++ /dev/null @@ -1,150 +0,0 @@ -on: - workflow_call: - inputs: - steamworks_sdk_tag: - required: true - type: string - godot_tag: - required: true - type: string - secrets: - steamworks_sdk_repo: - required: true - steamworks_sdk_repo_token: - required: true - - -jobs: - build-windows64: - runs-on: "windows-latest" - name: Windows 64 ${{ matrix.name }} - env: - SCONSFLAGS: - strategy: - fail-fast: false - matrix: - include: - - name: Editor & Templates - cache-name: windows-64 - artifact-name: windows - build-mono: false - - - name: Editor & Templates w/ Mono - cache-name: windows-64-mono - artifact-name: windows-mono - build-mono: true - - steps: - - uses: actions/checkout@v4 - - # Download Godot to start - - name: Download Godot - uses: ./.github/actions/godot-download - with: - version: ${{ inputs.godot_tag }} - - - name: Preempty Missing bin/ - run: | - mkdir ./bin/ - - # Download GodotSteam Server - - name: Download GodotSteam Server - uses: ./.github/actions/godotsteam-download - - # Download Steamworks SDK - - name: Download Steamworks SDK - uses: ./.github/actions/steamworks-download - with: - path: "steamworks" - repository: ${{ secrets.steamworks_sdk_repo }} - token: ${{ secrets.steamworks_sdk_repo_token }} - ref: ${{ inputs.steamworks_sdk_tag }} - - - name: Move .dll For Mono - shell: bash - run: | - cp ./modules/godotsteam_server/sdk/redistributable_bin/win64/steam_api64.dll ./bin/ - ls ./bin/ - - # Get that cache set up - - name: Setup Godot build cache - uses: ./.github/actions/godot-cache - with: - cache-name: ${{ matrix.cache-name }} - continue-on-error: true - - # Setup Python and Scons - - name: Setup Python and Scons - uses: ./.github/actions/godot-deps - - # Setup Mono - # Assume Mono is already installed on the runner - - name: Setup Mono (x86_64) - if: ${{ matrix.build-mono }} - uses: ./.github/actions/godot-windows-mono - with: - mono-bcl: "bcl-desktop-win32" - mono-release: "windows-x86_64" - - - name: Mono precompilation - if: ${{ matrix.build-mono }} - uses: ./.github/actions/godot-windows-build - with: - sconsflags: mono_static=yes module_mono_enabled=yes mono_glue=no copy_mono_root=yes mono_bcl=$HOME/mono-bcls/desktop-bcl/net_4_x mono_prefix=$HOME/mono-installs/desktop-windows-x86_64-release - platform: windows - tools: true - - # Generate Mono glue - - name: Generate Mono glue code - if: ${{ matrix.build-mono }} - run: | - DRI_PRIME=0 xvfb-run "./bin/godot.windows.opt.tools.64.mono.exe" --generate-mono-glue modules/mono/glue || true - - - name: Set Mono scons flags - if: ${{ matrix.build-mono }} - run: | - echo "MONO_SCONSFLAGS=module_mono_enabled=yes mono_glue=yes copy_mono_root=yes mono_bcl=$HOME/mono-bcls/desktop-bcl/net_4_x" >> $GITHUB_ENV - - # Compiling editors - - name: Compilation (bits=64) - uses: ./.github/actions/godot-windows-build - with: - sconsflags: ${{ env.SCONSFLAGS }} ${{ env.MONO_SCONSFLAGS }} ${{ matrix.sconsflags }} bits=64 ${{ matrix.build-mono && 'mono_prefix=$HOME/mono-installs/desktop-windows-x86_64-release' || '' }} - platform: windows - target: release_debug - tools: true - - - name: Upload Editor (bits=64) - uses: ./.github/actions/upload-artifact - with: - name: ${{ matrix.artifact-name }}-editor-64 - - - name: Clear bin - run: | - rm -r -fo bin - - # Compiling templates - - name: Debug Template compilation (tools=false, bits=64, target=release_debug) - uses: ./.github/actions/godot-windows-build - with: - sconsflags: ${{ env.SCONSFLAGS }} ${{ env.MONO_SCONSFLAGS }} ${{ matrix.sconsflags }} bits=64 ${{ matrix.build-mono && 'mono_prefix=$HOME/mono-installs/desktop-windows-x86_64-release' || '' }} - platform: windows - target: release_debug - tools: false - - - name: Release Template compilation (tools=false, bits=64, target=release) - uses: ./.github/actions/godot-windows-build - with: - sconsflags: ${{ env.SCONSFLAGS }} ${{ env.MONO_SCONSFLAGS }} ${{ matrix.sconsflags }} bits=64 ${{ matrix.build-mono && 'mono_prefix=$HOME/mono-installs/desktop-windows-x86_64-release' || '' }} debug_symbols=no - platform: windows - target: release - tools: false - - - name: Upload Templates (bits=64) - uses: ./.github/actions/upload-artifact - with: - name: ${{ matrix.artifact-name }}-templates-64 - - - name: Clear bin - run: | - rm -r -fo bin \ No newline at end of file diff --git a/.github/workflows/create-bundle-templates.yml b/.github/workflows/create-bundle-templates.yml new file mode 100644 index 0000000..2b0b557 --- /dev/null +++ b/.github/workflows/create-bundle-templates.yml @@ -0,0 +1,99 @@ +on: + workflow_call: + inputs: + is_mono: + required: true + type: boolean + + zip_tag: + required: true + type: string + + +jobs: + create-template-bundle: + runs-on: ubuntu-latest + + name: Create Template Bundle + + steps: + - uses: actions/checkout@v4 + + # Windows templates and Steam redistributables + - name: Download Windows 64-bit Release Template + if: ${{ inputs.is_mono != true }} + uses: actions/download-artifact@v4 + with: + name: windows64-release-template + path: files + + - name: Download Windows 32-bit Release Template + if: ${{ inputs.is_mono != true }} + uses: actions/download-artifact@v4 + with: + name: windows32-release-template + path: files + + - name: Download Windows 64-bit Debug Template + if: ${{ inputs.is_mono != true }} + uses: actions/download-artifact@v4 + with: + name: windows64-debug-template + path: files + + - name: Download Windows 32-bit Debug Template + if: ${{ inputs.is_mono != true }} + uses: actions/download-artifact@v4 + with: + name: windows64-debug-template + path: files + + - name: Download Windows 64-bit Steam Redistributable + if: ${{ inputs.is_mono != true }} + uses: actions/download-artifact@v4 + with: + name: windows64-steam + path: files + + - name: Download Windows 32-bit Steam Redistributable + if: ${{ inputs.is_mono != true }} + uses: actions/download-artifact@v4 + with: + name: windows32-steam + path: files + + # Linux templates and Steam redistributable + - name: Download Linux ${{ inputs.is_mono && 'Mono ' || '' }}Release Template + uses: actions/download-artifact@v4 + with: + name: linux-${{ inputs.is_mono && 'mono-' || '' }}release-template + path: files + + - name: Download Linux ${{ inputs.is_mono && 'Mono ' || '' }}Debug Template + uses: actions/download-artifact@v4 + with: + name: linux-${{ inputs.is_mono && 'mono-' || '' }}debug-template + path: files + + - name: Download Linux Steam Redistributable + uses: actions/download-artifact@v4 + with: + name: linux-steam + path: files + + # Mac templates + - name: Download MacOS ${{ inputs.is_mono && 'Mono ' || '' }}Template App + uses: actions/download-artifact@v4 + with: + name: macos${{ inputs.is_mono && '-mono' || '' }}-template-app + path: files + + - name: Create ${{ inputs.is_mono && 'Mono ' || '' }}Template Bundle + run: | + zip -j godotsteam-${{ inputs.zip_tag }}-${{ inputs.is_mono && 'mono-' || '' }}templates.zip files/* + + - name: Upload ${{ inputs.is_mono && 'Mono ' || '' }}Template Bundle Artifact + uses: ./.github/actions/upload-artifact + with: + name: godotsteam-${{ inputs.zip_tag }}-${{ inputs.is_mono && 'mono-' || '' }}templates.zip + path: godotsteam-${{ inputs.zip_tag }}-${{ inputs.is_mono && 'mono-' || '' }}templates.zip \ No newline at end of file diff --git a/.github/workflows/create-bundle.yml b/.github/workflows/create-bundle.yml new file mode 100644 index 0000000..3d3f69c --- /dev/null +++ b/.github/workflows/create-bundle.yml @@ -0,0 +1,81 @@ +on: + workflow_call: + inputs: + artifact_type: + required: true + type: string + + platform: + required: true + type: string + + zip_prefix: + required: true + type: string + + zip_tag: + required: true + type: string + + +jobs: + create-bundle: + runs-on: ubuntu-latest + + name: Create ${{ inputs.platform }} Bundle + + steps: + - uses: actions/checkout@v4 + + - name: Download ${{ inputs.platform }} Editor + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.artifact_type }}-editor + path: files + + - name: Download ${{ inputs.platform }} Release Template + if: ${{ inputs.platform != 'MacOS' }} + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.artifact_type }}-release-template + path: files + + - name: Download ${{ inputs.platform }} Debug Template + if: ${{ inputs.platform != 'MacOS' }} + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.artifact_type }}-debug-template + path: files + + - name: Download ${{ inputs.platform }} Template App + if: ${{ inputs.platform == 'MacOS' }} + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.artifact_type }}-template-app + path: files + + - name: Download ${{ inputs.platform }} Steam Redistributable + if: ${{ inputs.platform != 'MacOS' }} + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.artifact_type }}-steam + path: files + + - name: Create Mac Bundle + if: ${{ inputs.platform == 'MacOS' }} + run: | + ls -la files/ + unzip files/macos_editor.zip -d files/ + zip -j ${{ inputs.zip_prefix }}-${{ inputs.zip_tag }}.zip files/* + + - name: Create ${{ inputs.platform }} Bundle + if: ${{ inputs.platform != 'MacOS' }} + run: | + ls -la files/ + zip -j ${{ inputs.zip_prefix }}-${{ inputs.zip_tag }}.zip files/* + + - name: Upload ${{ inputs.platform }} Bundle Artifact + uses: ./.github/actions/upload-artifact + with: + name: ${{ inputs.zip_prefix }}-${{ inputs.zip_tag }}.zip + path: ${{ inputs.zip_prefix }}-${{ inputs.zip_tag }}.zip \ No newline at end of file diff --git a/.github/workflows/setup-env.yml b/.github/workflows/setup-env.yml new file mode 100644 index 0000000..4557f2a --- /dev/null +++ b/.github/workflows/setup-env.yml @@ -0,0 +1,57 @@ +on: + workflow_call: + inputs: + godot_tag: + required: true + type: string + + godotsteam_version: + required: true + type: string + + steamworks_sdk_tag: + required: true + type: string + + + outputs: + godot_version: + description: The shortened Godot version for file names + value: ${{ jobs.env-setup.outputs.godot_version }} + + zip_tag: + description: The full zip tag for releases + value: ${{ jobs.env-setup.outputs.zip_tag }} + + +jobs: + env-setup: + runs-on: ubuntu-latest + + name: Setup ENV Variables + + outputs: + godot_version: ${{ steps.set_godot_version.outputs.godot_version }} + zip_tag: ${{ steps.set_zip_tag.outputs.zip_tag }} + + steps: + - name: Set The Zip Tag For Packaging + id: set_zip_tag + run: | + sdktag=${{ inputs.steamworks_sdk_tag }} + sdktag=${sdktag//[.]/} + gsver=${{ inputs.godotsteam_version }} + gtag=${{ inputs.godot_tag }} + gtag=${gtag//[.]/} + tag=g${gtag%-*}-s${sdktag:0-3}-gss${gsver//[.]/} + echo "Zip tag: ${tag}" + echo "zip_tag=${tag}" >> $GITHUB_OUTPUT + + - name: Set The Godot Version For Packaging + id: set_godot_version + run: | + gv=${{ inputs.godot_tag }} + gv=${gv//[.]/} + gv=${gv%-*} + echo "Godot version: ${gv}" + echo "godot_version=${gv}" >> $GITHUB_OUTPUT \ No newline at end of file diff --git a/README.md b/README.md index ce5f2d7..b97bad2 100644 --- a/README.md +++ b/README.md @@ -18,16 +18,25 @@ Feel free to chat with us about GodotSteam on the [CoaguCo Discord server](https Current Build --- -You can [download pre-compiled versions _(currently v3.1)_ of this repo here](https://github.com/CoaguCo-Industries/GodotSteam-Server/releases). +You can [download pre-compiled versions of this repo here](https://github.com/CoaguCo-Industries/GodotSteam-Server/releases). -**Version 3.2 Changes** -- Added: new Remote Storage enum to WorkshopFileType -- Added: two new UGC enums to ItemState and ItemPreviewType -- Added: new Remote Play enum, form factor for VR headset -- Added: two new result enums; not supported and family size limit exceeded -- Added: three new enums to NetworkingConfigValue -- Added: new general constant ACCOUNT_ID_INVALID -- Changed: k_ESteamNetworkingConfig_SDRClient_DebugTicketAddress was replaced by k_ESteamNetworkingConfig_SDRClient_DevTicket, value is the same but reference changed +**Version 3.3 Changes** +- Changed: constants list to add missing and remove unused +- Changed: Networking Messages, Sockets, and Utils now use Steam IDs instead of identity system +- Changed: various bits and pieces +- Changed: IP logic for all related functions +- Changed: UserUGCListSortOrder enums for readability +- Changed: UGCContentDescriptorID enums for readability +- Changed: `getResultStatus()` now returns the integer / enum +- Changed: `getAuthSessionTicket()` now defaults to 0 for Steam ID +- Fixed: wrong string IP conversions, ***thanks to jeremybeier*** +- Fixed: typo with UGC_MATCHING_UGC_TYPE_ITEMS enum +- Fixed: minor case issue with Workshop enums +- Fixed: typo with NETWORKING_CONFIG_TYPE_STRING enum +- Removed: unnecessary enums +- Removed: Networking Types identity system and related bits +- Removed: P2P Networking constants as they are duplicates of the P2PSend enum +- Removed: `getIdentity()` as it is redundant now [You can read more change-logs here](https://godotsteam.com/changelog/server3/). @@ -36,10 +45,16 @@ Compatibility While rare, sometimes Steamworks SDK updates will break compatilibity with older GodotSteam versions. Any compatability breaks are noted below. API files (dll, so, dylib) _should_ still work for older version. Steamworks SDK Version | GodotSteam Version ----|---|--- +---|--- 1.59 or newer | 3.2 or newer 1.58a or older | 3.1 or older +Versions of GodotSteam that have compatibility breaks introduced. + +GodotSteam Version | Broken Compatibility +---|--- +3.3| Networking identity system removed, replaced with Steam IDs + Known Issues --- - **Using MinGW causes crashes.** I strong recommend you **do not use MinGW** to compile at this time. @@ -52,7 +67,7 @@ Alternatively, you can just [download the pre-compiled versions in our Releases Donate --- -Pull-requests are the best way to help the project out but you can also donate through [Github Sponsors](https://github.com/sponsors/Gramps), [Ko-Fi](https://ko-fi.com/grampsgarcia) or [Paypal](https://www.paypal.me/sithlordkyle)! +Pull-requests are the best way to help the project out but you can also donate through [Github Sponsors](https://github.com/sponsors/Gramps)! License --- diff --git a/doc_classes/SteamServer.xml b/doc_classes/SteamServer.xml index ebc5fc6..539d4d0 100644 --- a/doc_classes/SteamServer.xml +++ b/doc_classes/SteamServer.xml @@ -1,32 +1,32 @@ - + Steamworks SDK / API for the Godot Game Engine. An open-source and fully functional Steamworks SDK / API module and plug-in for the Godot Game Engine. - Full documentation and tutorials are available at https://godotsteam.com/. + Full documentation and tutorials are available at https://godotSteamServer.com/. - https://godotsteam.com/tutorials/achievement_icons/ - https://godotsteam.com/tutorials/authentication/ - https://godotsteam.com/tutorials/auto_matchmaking/ - https://godotsteam.com/tutorials/avatars/ - https://godotsteam.com/tutorials/c-sharp/ - https://godotsteam.com/tutorials/common_issues/ - https://godotsteam.com/tutorials/exporting_shipping/ - https://godotsteam.com/tutorials/friends_lobbies/ - https://godotsteam.com/tutorials/initializing/ - https://godotsteam.com/tutorials/leaderboards/ - https://godotsteam.com/tutorials/linux_caveats/ - https://godotsteam.com/tutorials/lobbies/ - https://godotsteam.com/tutorials/mac_caveats/ - https://godotsteam.com/tutorials/mac_export/ - https://godotsteam.com/tutorials/p2p/ - https://godotsteam.com/tutorials/remove_steam/ - https://godotsteam.com/tutorials/rich_presence/ - https://godotsteam.com/tutorials/stats_achievements/ - https://godotsteam.com/tutorials/workshop/ + https://godotSteamServer.com/tutorials/achievement_icons/ + https://godotSteamServer.com/tutorials/authentication/ + https://godotSteamServer.com/tutorials/auto_matchmaking/ + https://godotSteamServer.com/tutorials/avatars/ + https://godotSteamServer.com/tutorials/c-sharp/ + https://godotSteamServer.com/tutorials/common_issues/ + https://godotSteamServer.com/tutorials/exporting_shipping/ + https://godotSteamServer.com/tutorials/friends_lobbies/ + https://godotSteamServer.com/tutorials/initializing/ + https://godotSteamServer.com/tutorials/leaderboards/ + https://godotSteamServer.com/tutorials/linux_caveats/ + https://godotSteamServer.com/tutorials/lobbies/ + https://godotSteamServer.com/tutorials/mac_caveats/ + https://godotSteamServer.com/tutorials/mac_export/ + https://godotSteamServer.com/tutorials/p2p/ + https://godotSteamServer.com/tutorials/remove_steam/ + https://godotSteamServer.com/tutorials/rich_presence/ + https://godotSteamServer.com/tutorials/stats_achievements/ + https://godotSteamServer.com/tutorials/workshop/ @@ -38,7 +38,7 @@ - + This allows the game to specify accept an incoming packet. This needs to be called before a real connection is established to a remote host, the game will get a chance to say whether or not the remote user is allowed to talk to them. When a remote user that you haven't sent a packet to recently, tries to first send you a packet, your game will receive a callback [signal SteamServer.p2p_session_request]. This callback contains the Steam ID of the user who wants to send you a packet. In response to this callback, you'll want to see if it's someone you want to talk to (for example, if they're in a lobby with you), and if so, accept the connection; otherwise if you don't want to talk to the user, just ignore the request. If the user continues to send you packets, another [signal SteamServer.p2p_session_request] will be posted periodically. If you've called [method SteamServer.sendP2PPacket] on the other user, this implicitly accepts the session request. @@ -47,7 +47,7 @@ - + Call this in response to a [signal SteamServer.network_messages_session_request] callback. [signal SteamServer.network_messages_session_request] callbacks are posted when a user tries to send you a message, and you haven't tried to talk to them first. If you don't want to talk to them, just ignore the request. If the user continues to send you messages, [signal SteamServer.network_messages_session_request] callbacks will continue to be posted periodically. Returns false if there is no session with the user pending or otherwise. If there is an existing active session, this function will return true, even if it is not pending. @@ -90,21 +90,6 @@ [b]Note:[/b] This must be set before you send a UGC Query handle using [method SteamServer.sendQueryUGCRequest]. - - - - - Add a new IP address struct and store it for use. When this networking IP address is used in other functions, you will always use the [b]reference_name[/b] to use this struct. - - - - - - - Create a new network identity struct and store it for use. When this network identity is used in other functions, you will always use the reference_name to use this struct. - You will have to set the IP, Steam ID, string, or bytes with other functions below otherwise the identity is invalid. - - @@ -122,7 +107,7 @@ - + Adds an additional preview file for the item. Then the format of the image should be one that both the web and the application (if necessary) can render, and must be under 1MB. Suggested formats include JPG, PNG and GIF. @@ -149,7 +134,7 @@ - + Grant a specific one-time promotional item to the current user. @@ -159,7 +144,7 @@ - + Grant a specific one-time promotional item to the current user. @@ -222,7 +207,7 @@ - + @@ -265,20 +250,6 @@ Clears the whole list of key/values that are sent in rules queries. - - - - - IP Address - Set everything to zero. E.g. [::]:0. - - - - - - - Clear a network identity's data. - - @@ -293,7 +264,7 @@ - + Call this when you're done talking to a user on a specific channel. Once all open channels to a user have been closed, the open session to the user will be closed, and any new data from this user will trigger a [signal SteamServer.network_messages_session_request] callback. @@ -320,7 +291,7 @@ - + Closes a P2P channel when you're done talking to a user on the specific channel. @@ -329,7 +300,7 @@ - + This should be called when you're done communicating with a user, as this will free up all of the resources allocated for the connection under-the-hood. If the remote user tries to send data to you again, a new [signal SteamServer.p2p_session_request] callback will be posted. @@ -337,7 +308,7 @@ - + Call this when you're done talking to a user to immediately free up resources under-the-hood. If the remote user tries to send data to you again, another [signal SteamServer.network_messages_session_request] callback will be posted. [b]Note:[/b] sessions that go unused for a few minutes are automatically timed out. @@ -372,7 +343,7 @@ - + @@ -385,7 +356,7 @@ - + @@ -395,7 +366,7 @@ - + @@ -432,7 +403,7 @@ - + Initializes a new HTTP request. Requires the method such as GET or POST and the absolute URL for the request. Both http and https are supported, so this string must start with "http://" or "https://" and should look like "http://store.steampowered.com/app/10/" or similar. This call returns a handle that you can use to make further calls to setup and then send the HTTP request with [method SteamServer.sendHTTPRequest] or [method SteamServer.sendHTTPRequestAndStreamResponse]. Don't forget to free the HTTP request when you're done with it to prevent leaking memory by calling [method SteamServer.releaseHTTPRequest]. @@ -452,7 +423,7 @@ - + Creates a new workshop item with no content attached yet. Triggers a [signal SteamServer.item_created] callback. @@ -487,7 +458,7 @@ Alternately you can pass an empty array. - + Create a new poll group. @@ -496,8 +467,8 @@ - - + + @@ -523,9 +494,9 @@ - - - + + + @@ -540,8 +511,8 @@ - - + + Create a pair of connections that are talking to each other, e.g. a loopback connection. This is very useful for testing, or so that your client/server code can work the same even when you are running a local "server". The two connections will immediately be placed into the connected state, and no callbacks will be posted immediately. After this, if you close either connection, the other connection will receive a callback, exactly as if they were communicating over the network. You must close both sides in order to fully clean up the resources! @@ -627,11 +598,11 @@ - + - - - + + + Grant one item in exchange for a set of other items. This can be used to implement crafting recipes or transmutations, or items which unpack themselves into other items (e.g., a chest). @@ -650,9 +621,9 @@ - + - + Grants specific items to the current user, for developers only. This API is only intended for prototyping - it is only usable by Steam accounts that belong to the publisher group for your game. @@ -662,7 +633,7 @@ - + Start retrieving all items in the current users inventory. The inventory handle, which is also stored internally. It will overwrite any previously stored inventory handle. @@ -680,7 +651,7 @@ - + Retrieve an authentication ticket to be sent to the entity who wishes to authenticate you. After calling this you can send the ticket to the entity where they can then call [method SteamServer.beginAuthSession] to verify this entities integrity. @@ -696,7 +667,7 @@ - + Query our readiness to participate in authenticated communications. A [signal SteamServer.network_authentication_status] callback is posted any time this status changes, but you can use this function to query it at any time. @@ -718,8 +689,8 @@ - - + + Get a configuration value. @@ -731,7 +702,7 @@ - + Returns info about a configuration value. For values to pass to config_value, check the SDK's listing. next_value can be used to iterate through all of the known configuration values. The returned dictionary contains the following keys: [b]type (int), scope (int), and next_value (int).[/b] @@ -825,20 +796,6 @@ [/codeblock] - - - - - Returns null if not generic bytes type. - - - - - - - Returns null if not generic string type. - - @@ -906,67 +863,6 @@ Returns the value of the SDR_LISTEN_PORT environment variable. This is the UDP server your server will be listening on. This will configured automatically for you in production environments. - - - - Get a list of all IP address structs and their names. - The returned array contains a list of: - [codeblock] - â”–â•´this_address (dictionary) - â” â•´reference_name (string) - â” â•´localhost (bool) - â”–â•´ip_address (int) - [/codeblock] - - - - - - - Returns IP in host byte order (e.g. aa.bb.cc.dd as 0xaabbccdd). Returns 0 if IP is not mapped IPv4. - - - - - - Get a list of all known network identities. - The returned array contains a list of: - [codeblock] - â”–â•´this_identity (dictionary) - â” â•´reference_name (string) - â” â•´steam_id (int) - â”–â•´type (int) - [/codeblock] - - - - - - Get the identity assigned to this interface. - E.g. on Steam, this is the user's Steam ID, or for the gameserver interface, the Steam ID assigned to the gameserver. Returns false and sets the result to an invalid identity if we don't know our identity yet. (E.g. GameServer has not logged in. On Steam, the user will know their SteamID even if they are not signed into SteamServer.) - - - - - - - Returns null if we are not an IP address. - - - - - - - Return back a Steam ID32 or 0 if identity is not a Steam ID. - - - - - - - Returns 0 if identity is not a Steam ID. - - @@ -1009,7 +905,7 @@ - + After a successful call to [method SteamServer.requestPrices], you can call this method to get the pricing for a specific item definition. @@ -1047,8 +943,7 @@ - - + Gets the state of a subset of the current user's inventory. The subset is specified by an array of item instance IDs. @@ -1065,8 +960,9 @@ - + + Returns local IP and port that a listen socket created using [method SteamServer.createListenSocketIP] is bound to. [b]Note:[/b] This is not how you find out your public IP that clients can connect to. @@ -1112,12 +1008,6 @@ [/codeblock] - - - - After a successful call to [method SteamServer.requestPrices], this will return the number of item definitions with valid pricing. - - @@ -1126,7 +1016,7 @@ - + Fills out a dictionary with details about the connection like whether or not there is an active connection; number of bytes queued on the connection; the last error code, if any; whether or not a relay server is being used; and the IP and Port of the remote user, if known. This should only needed for debugging purposes. @@ -1155,13 +1045,6 @@ Get list of all POP IDs. Returns the number of entries that were filled into your list. - - - - - Retrieve this identity's Playstation Network ID. - - @@ -1350,7 +1233,7 @@ - + Retrieve various statistics of an individual workshop item after receiving a querying UGC call result. The returned dictionary contains the following keys: @@ -1389,7 +1272,7 @@ - + Fetch current status of the relay network. [signal SteamServer.relay_network_status] is also a callback. It will be triggered on both the user and gameserver interfaces any time the status changes, or ping measurement starts or stops. @@ -1444,7 +1327,7 @@ - + Find out the status of an asynchronous inventory result handle. This is a polling equivalent to registering a callback function for [signal SteamServer.inventory_result_ready]. @@ -1468,7 +1351,7 @@ - + @@ -1476,17 +1359,17 @@ Returns the value of connection state or 0 if no connection exists with specified peer. You may pass false for either get_connection or get_status if you do not need the corresponding details. Note that sessions time out after a while, so if a connection fails, or [method SteamServer.sendMessageToUser] returns 3, you cannot wait indefinitely to obtain the reason for failure. - + - - Retrieve this identity's Google Stadia ID. + Gets the Steam ID of the game server. - + + - Gets the Steam ID of the game server. + Convert a SteamID64 into a SteamID. @@ -1513,6 +1396,7 @@ + Return the user's community content descriptor preferences. @@ -1551,13 +1435,6 @@ Asynchronously retrieves data about whether the user accepted the Workshop EULA for the current app. - - - - - Retrieve this identity's XBox pair ID. - - @@ -1588,7 +1465,7 @@ - + Indicate our desire to be ready participate in authenticated communications. If we are currently not ready, then steps will be taken to obtain the necessary certificates. (This includes a certificate for us, as well as any CA certificates needed to authenticate peers.) @@ -1609,47 +1486,63 @@ This is helpful if you want to support multiple game servers running out of the same install folder. - + - + - Return true if this identity is localhost. (Either IPv6 ::1, or IPv4 127.0.0.1). + Is this an anonymous account? - + - + - Return true if IP is mapped IPv4. + Is this an anonymous user account? Used to create an account or reset a password, but do not try to do this. - + - - Return true if the IP is ::0. (Doesn't check port.). + Valve has no notes about this but we assume it just returns true/false if the server is considered secure. - + - + - Return true if we are the invalid type. Does not make any other validity checks (e.g. is SteamID actually valid). + Is this a chat account ID? - + - + - Return true if this identity is localhost. + Is this a clan account ID? - + + - Valve has no notes about this but we assume it just returns true/false if the server is considered secure. + Is this a faked up Steam ID for a PSN friend account? + + + + + + + Is this an individual user account ID? + + + + + Is this a lobby account ID? + + + + @@ -1685,22 +1578,6 @@ You usually don't need to check for this yourself. All of the API calls that rely on this will check internally. Forcefully disabling stuff when the player loses access is usually not a very good experience for the player and you could be preventing them from accessing APIs that do not need a live connection to SteamServer. - - - - - - Parse an IP address and optional port. If a port is not present, it is set to 0. (This means that you cannot tell if a zero port was explicitly specified.). - - - - - - - - Parse back a string that was generated using ToString. If we don't understand the string, but it looks "reasonable" (it matches the pattern type:type-data and doesn't have any funky characters, etc), then we will return true, and the type is set to k_ESteamNetworkingIdentityType_UnknownType (0). False will only be returned if the string looks invalid. - - @@ -1724,7 +1601,7 @@ The returned dictionary contains the following keys: [codeblock] â” â•´data (PoolByteArray) - â”–â•´steam_id_remote (int) + â”–â•´remote_steam_id (int) [/codeblock] @@ -1897,12 +1774,12 @@ These stats are not automatically updated; you'll need to call this function again to refresh any data that may have change. To keep from using too much memory, an least recently used cache (LRU) is maintained and other user's stats will occasionally be unloaded. When this happens a [signal SteamServer.user_stats_unloaded] callback is sent. After receiving this callback the user's stats will be unavailable until this function is called again. The equivalent function for the local user is [method SteamServer.requestCurrentStats]. - Triggers a [signal SteamServer.user_stats_received] callback. + Triggers a [signal SteamServer.stats_received] callback. - + Reset the identity associated with this instance. Any open connections are closed. Any previous certificates, etc are discarded. You can pass a specific identity that you want to use, or you can pass NULL, in which case the identity will be invalid until you set it using [nethod SteamServer.setCertificate]. [b]Note:[/b] This function is not actually supported on Steam! It is included for use on other platforms where the active user can sign out and a new user can sign in. @@ -1961,12 +1838,12 @@ - + - Sends a message to the specified host via identity_reference. If we don't already have a session with that user, a session is implicitly created. There might be some handshaking that needs to happen before we can actually begin sending message data. If this handshaking fails and we can't get through, an error will be posted via the callback [signal SteamServer.network_messages_session_failed]. There is no notification when the operation succeeds. (You should have the peer send a reply for this purpose.) + Sends a message to the specified host via Steam ID. If we don't already have a session with that user, a session is implicitly created. There might be some handshaking that needs to happen before we can actually begin sending message data. If this handshaking fails and we can't get through, an error will be posted via the callback [signal SteamServer.network_messages_session_failed]. There is no notification when the operation succeeds. (You should have the peer send a reply for this purpose.) Sending a message to a host will also implicitly accept any incoming connection from that host. [b]flags[/b] is a bitmask of k_nSteamNetworkingSend_xxx options. [b]channel[/b] is a routing number you can use to help route message to different systems. You'll have to call [method SteamServer.receiveMessagesOnChannel] with the same channel number in order to retrieve the data on the other end. @@ -1988,9 +1865,9 @@ - + - + Sends a P2P packet to the specified user. @@ -2080,7 +1957,7 @@ - + @@ -2114,7 +1991,7 @@ - + Set a configuration value. @@ -2123,7 +2000,7 @@ - + Set a configuration value. @@ -2132,20 +2009,12 @@ - + Set a configuration value. - - - - - - Set connection details for players once game is found so they can connect to this server. - - @@ -2195,25 +2064,9 @@ Don't set this unless it actually changes, its only uploaded to the master once; when acknowledged. - - - - - - Returns false if invalid size. - - - - - - - - Returns false if invalid length. - - - + Set a configuration value. @@ -2221,7 +2074,7 @@ - + Set a configuration value. @@ -2229,7 +2082,7 @@ - + Set a configuration value. @@ -2330,63 +2183,6 @@ This doesn't clobber the normal user agent, it just adds the extra info on the end. Sending NULL or an empty string resets the user agent info to the default value. - - - - - - - Sets to IPv4 mapped address. IP and port are in host byte order. - - - - - - - - - Set IPv6 address. IP is interpreted as bytes, so there are no endian issues. (Same as inaddr_in6.) The IP can be a mapped IPv4 address. - - - - - - - - Set to the IPv6 localhost address ::1, and the specified port. - - - - - - - - Set to specified IP:port. - - - - - - - Set to localhost. (We always use IPv6 ::1 for this, not 127.0.0.1). - - - - - - - - Set a 32-bit Steam ID. - - - - - - - - Takes SteamID as raw 64-bit number. - - @@ -2411,7 +2207,7 @@ - + Sets arbitrary metadata for an item. This metadata can be returned from queries without having to download and install the actual content. The metadata must be limited to the size defined by k_cchDeveloperMetadataMax (5000). @@ -2432,7 +2228,7 @@ - + Sets arbitrary developer specified tags on an item. Each tag must be limited to 255 characters. Tag names can only include printable characters, excluding ','. @@ -2464,7 +2260,7 @@ - + Sets the visibility of an item. @@ -2522,14 +2318,6 @@ [b]Note:[/b] This is required for all game servers and can only be set before calling [method SteamServer.logOn] or [method SteamServer.logOnAnonymous]. - - - - - - Set the Playstation Network ID for this identity. - - @@ -2600,6 +2388,13 @@ [b]Note:[/b] This must be set before you submit the UGC query handle using [method SteamServer.submitItemUpdate]. + + + + + Set the region the server is located in. + + @@ -2706,14 +2501,6 @@ Sets the name of the spectator server. This is only used if spectator port is nonzero. - - - - - - Set the Google Stadia ID for this identity. - - @@ -2767,14 +2554,6 @@ Sets / updates the value of a given stat for the specified user. - - - - - - Set the Xbox Pairwise ID for this identity. - - @@ -2802,7 +2581,7 @@ - + Starts the purchase process for the user, given a "shopping cart" of item definitions that the user would like to buy. The user will be prompted in the Steam Overlay to complete the purchase in their local currency, funding their Steam Wallet if necessary, etc. If the purchase process was started successfully, then order_id and transaction_id will be valid in the [signal SteamServer.inventory_start_purchase_result] call result. @@ -2876,23 +2655,8 @@ If you call this with suspend set to true then downloads will be suspended until you resume them by setting suspend to false or when the game ends. - - - - - - Print to a string, with or without the port. Mapped IPv4 addresses are printed as dotted decimal (12.34.56.78), otherwise this will print the canonical form according to RFC5952. If you include the port, IPv6 will be surrounded by brackets, e.g. [::1:2]:80. Your buffer should be at least k_cchMaxString (128) bytes to avoid truncation. - - - - - - - Print to a human-readable string. This is suitable for debug messages or any other time you need to encode the identity as a string. It has a URL-like format type:type-data. Your buffer should be at least k_cchMaxString (128) bytes big to avoid truncation. - - - + @@ -2905,7 +2669,7 @@ - + Trigger an item drop if the user has played a long enough period of time. @@ -3041,13 +2805,33 @@ - + A struct used to describe a "fake IP" we have been assigned to use as an identifier. This callback is posted when [method SteamServer.beginAsyncRequestFakeIP]completes. + + + + Response when reading a file with [method Steam.fileReadAsync]. + + + + + + + + Response to a file being shared. + + + + + + Response when writing a file asyncrounously with [method Steam.fileWriteAsync]. + + @@ -3166,12 +2950,18 @@ - + Called when an item update has completed. Emits signal in response to function [method SteamServer.submitItemUpdate]. + + + One or more files for this app have changed locally after syncing to remote session changes. + [b]Note:[/b] only posted if this happens during the local app session. + + @@ -3213,14 +3003,14 @@ - + Called when a user sends a packet and it fails. - + Called when a user sends a packet. @@ -3300,10 +3090,9 @@ Called when workshop item playtime tracking has started. - - - - + + + Called when the latest stats and achievements for a specific user (including the local user) have been received from the server. @@ -3393,6 +3182,8 @@ + + @@ -3405,6 +3196,10 @@ + + + + @@ -3421,41 +3216,85 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + - + @@ -3503,12 +3342,6 @@ - - - - - - @@ -3521,40 +3354,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -3593,48 +3392,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -3751,6 +3508,10 @@ + + + + @@ -3767,6 +3528,8 @@ + + @@ -3783,6 +3546,8 @@ + + @@ -3853,7 +3618,7 @@ - + @@ -3901,6 +3666,8 @@ + + @@ -3949,12 +3716,14 @@ - + + + @@ -3997,6 +3766,8 @@ + + @@ -4147,16 +3918,6 @@ - - - - - - - - - - @@ -4177,54 +3938,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -4505,6 +4218,10 @@ + + + + @@ -4549,17 +4266,17 @@ - + - + - + - + - + - + @@ -4645,22 +4362,6 @@ - - - - - - - - - - - - - - - - @@ -4679,19 +4380,19 @@ - + - + - + - + - + - + - + @@ -4721,7 +4422,7 @@ - + @@ -4739,13 +4440,15 @@ - + - + + + diff --git a/godotsteam_server.cpp b/godotsteam_server.cpp index d702054..b161109 100644 --- a/godotsteam_server.cpp +++ b/godotsteam_server.cpp @@ -10,31 +10,23 @@ #endif -///////////////////////////////////////////////// ///// HEADER INCLUDES ///////////////////////////////////////////////// // // Include GodotSteam Server header #include "godotsteam_server.h" -#include "godotsteam_server_constants.h" - -// Include some Godot headers -#include "core/io/ip_address.h" -#include "core/io/ip.h" // Include some system headers #include "fstream" #include "vector" -///////////////////////////////////////////////// ///// STEAM SINGLETON? STEAM SINGLETON ///////////////////////////////////////////////// // SteamServer* SteamServer::singleton = NULL; -///////////////////////////////////////////////// ///// STEAM OBJECT WITH CALLBACKS ///////////////////////////////////////////////// // @@ -94,33 +86,149 @@ SteamServer::SteamServer(): } -///////////////////////////////////////////////// ///// INTERNAL FUNCTIONS ///////////////////////////////////////////////// // -// Get the Steam singleton, obviously -SteamServer* SteamServer::get_singleton(){ - return singleton; +// Helper function to turn an array of options into an array of SteamNetworkingConfigValue_t structs +const SteamNetworkingConfigValue_t *SteamServer::convertOptionsArray(Array options) { + // Get the number of option arrays in the array. + int options_size = options.size(); + // Create the array for options. + SteamNetworkingConfigValue_t *option_array = new SteamNetworkingConfigValue_t[options_size]; + // If there are options + if (options_size > 0) { + // Populate the options + for (int i = 0; i < options_size; i++) { + SteamNetworkingConfigValue_t this_option; + Array sent_option = options[i]; + // Get the configuration value. + // This is a convoluted way of doing it but can't seem to cast the value as an enum so here we are. + ESteamNetworkingConfigValue this_value = ESteamNetworkingConfigValue((int)sent_option[0]); + if ((int)sent_option[1] == 1) { + this_option.SetInt32(this_value, sent_option[2]); + } + else if ((int)sent_option[1] == 2) { + this_option.SetInt64(this_value, sent_option[2]); + } + else if ((int)sent_option[1] == 3) { + this_option.SetFloat(this_value, sent_option[2]); + } + else if ((int)sent_option[1] == 4) { + char *this_string = { 0 }; + String passed_string = sent_option[2]; + strcpy(this_string, passed_string.utf8().get_data()); + this_option.SetString(this_value, this_string); + } + else { + Object *this_pointer; + this_pointer = sent_option[2]; + this_option.SetPtr(this_value, this_pointer); + } + option_array[i] = this_option; + } + } + return option_array; } // Creating a Steam ID for internal use -CSteamID SteamServer::createSteamID(uint64_t steam_id, int account_type){ +CSteamID SteamServer::createSteamID(uint64_t steam_id, AccountType account_type) { CSteamID converted_steam_id; - if(account_type < 0 || account_type >= k_EAccountTypeMax){ - account_type = 1; + if (account_type < 0 || account_type >= AccountType(k_EAccountTypeMax)) { + account_type = ACCOUNT_TYPE_INDIVIDUAL; } converted_steam_id.Set(steam_id, k_EUniversePublic, EAccountType(account_type)); return converted_steam_id; } +// Get the Steam singleton, obviously +SteamServer* SteamServer::get_singleton(){ + return singleton; +} + +// Convert a Steam ID to a Steam Identity +SteamNetworkingIdentity SteamServer::getIdentityFromSteamID(uint64_t steam_id) { + SteamNetworkingIdentity remote_identity; + remote_identity.SetSteamID64(steam_id); + return remote_identity; +} + +// Convert a string IP address to an integer +uint32 SteamServer::getIPFromString(String ip_string) { + uint32 ip_address = 0; + + SteamNetworkingIPAddr this_address; + this_address.Clear(); + + if (this_address.ParseString(ip_string.utf8().get_data())) { + ip_address = this_address.GetIPv4(); + } + return ip_address; +} + +// Convert a Steam IP Address object to an integer +uint32 SteamServer::getIPFromSteamIP(SteamNetworkingIPAddr this_address) { + return this_address.GetIPv4(); +} + +// Get the Steam ID from an identity struct +uint64_t SteamServer::getSteamIDFromIdentity(SteamNetworkingIdentity this_identity) { + uint64_t this_steam_id = this_identity.GetSteamID64(); + return this_steam_id; +} + +// Convert an integer to a Steam IP Address +SteamNetworkingIPAddr SteamServer::getSteamIPFromInt(uint32 ip_integer) { + SteamNetworkingIPAddr this_address; + this_address.Clear(); + + if (ip_integer > 0) { + this_address.SetIPv4(ip_integer, 0); + } + return this_address; +} + +// Convert an IP string to a Steam IP Address +SteamNetworkingIPAddr SteamServer::getSteamIPFromString(String ip_string) { + SteamNetworkingIPAddr this_address; + this_address.Clear(); + + if (this_address.ParseString(ip_string.utf8().get_data())) { + this_address.GetIPv4(); + } + return this_address; +} + +// Convert an integer IP address to a string +String SteamServer::getStringFromIP(uint32 ip_integer) { + String ip_address = ""; + + SteamNetworkingIPAddr this_address; + this_address.Clear(); + + if (ip_integer > 0) { + this_address.SetIPv4(ip_integer, 0); + char this_ip[16]; + this_address.ToString(this_ip, 16, false); + ip_address = String(this_ip); + } + return ip_address; +} + +// Convert a Steam IP Address to a string +String SteamServer::getStringFromSteamIP(SteamNetworkingIPAddr this_address) { + char this_ip[16]; + this_address.ToString(this_ip, 16, false); + return String(this_ip); +} + -///////////////////////////////////////////////// ///// MAIN FUNCTIONS ///////////////////////////////////////////////// // -// No official notes, but should be checking if the server is secured. -bool SteamServer::isServerSecure(){ - return SteamGameServer_BSecure(); +// Convert a SteamID64 into a SteamID +uint32_t SteamServer::getSteamID32(uint64_t steam_id) { + CSteamID this_steam_id = (uint64)steam_id; + return this_steam_id.GetAccountID(); } // Gets the server's Steam ID. @@ -128,39 +236,57 @@ uint64_t SteamServer::getServerSteamID(){ return SteamGameServer_GetSteamID(); } +// Is this an anonymous account? +bool SteamServer::isAnonAccount(uint64_t steam_id) { + CSteamID this_steam_id = (uint64)steam_id; + return this_steam_id.BAnonAccount(); +} + +// Is this an anonymous user account? Used to create an account or reset a password, but do not try to do this. +bool SteamServer::isAnonUserAccount(uint64_t steam_id) { + CSteamID this_steam_id = (uint64)steam_id; + return this_steam_id.BAnonUserAccount(); +} + +// Is this a chat account ID? +bool SteamServer::isChatAccount(uint64_t steam_id) { + CSteamID this_steam_id = (uint64)steam_id; + return this_steam_id.BChatAccount(); +} + +// Is this a clan account ID? +bool SteamServer::isClanAccount(uint64_t steam_id) { + CSteamID this_steam_id = (uint64)steam_id; + return this_steam_id.BClanAccount(); +} + +// Is this a faked up Steam ID for a PSN friend account? +bool SteamServer::isConsoleUserAccount(uint64_t steam_id) { + CSteamID this_steam_id = (uint64)steam_id; + return this_steam_id.BConsoleUserAccount(); +} + +// Is this an individual user account ID? +bool SteamServer::isIndividualAccount(uint64_t steam_id) { + CSteamID this_steam_id = (uint64)steam_id; + return this_steam_id.BIndividualAccount(); +} + +// Is this a lobby account ID? +bool SteamServer::isLobby(uint64_t steam_id) { + CSteamID this_steam_id = (uint64)steam_id; + return this_steam_id.IsLobby(); +} + +// No official notes, but should be checking if the server is secured. +bool SteamServer::isServerSecure(){ + return SteamGameServer_BSecure(); +} + // Initialize SteamGameServer client and interface objects, and set server properties which may not be changed. // After calling this function, you should set any additional server parameters, and then logOnAnonymous() or logOn(). bool SteamServer::serverInit(const String& ip, uint16 game_port, uint16 query_port, ServerMode server_mode, const String& version_number){ - // Convert the server mode back - EServerMode mode; - if(server_mode == 1){ - mode = eServerModeNoAuthentication; - } - else if(server_mode == 2){ - mode = eServerModeAuthentication; - } - else{ - mode = eServerModeAuthenticationAndSecure; - } - - uint32_t ip_address = 0; - if(!ip.empty() || ip != "0"){ - // Resolve address and convert it from IP_Address string to uint32_t - IP_Address address; - if(ip.is_valid_ip_address()){ - address = ip; - } - else{ - address = IP::get_singleton()->resolve_hostname(ip, IP::TYPE_IPV4); - } - // Resolution failed - if(!address.is_valid()){ - return false; - } - ip_address = *((uint32_t *)address.get_ipv4()); - } - - if(!SteamGameServer_Init(ip_address, game_port, query_port, mode, version_number.utf8().get_data())){ + if(!SteamGameServer_Init(getIPFromString(ip), game_port, query_port, (EServerMode)server_mode, version_number.utf8().get_data())){ return false; } return true; @@ -170,37 +296,9 @@ bool SteamServer::serverInit(const String& ip, uint16 game_port, uint16 query_po // After calling this function, you should set any additional server parameters, and then logOnAnonymous() or logOn(). // On success STEAM_API_INIT_RESULT_OK is returned. Otherwise, if error_message is non-NULL, it will receive a non-localized message that explains the reason for the failure Dictionary SteamServer::serverInitEx(const String& ip, uint16 game_port, uint16 query_port, ServerMode server_mode, const String& version_number){ - // Convert the server mode back - EServerMode mode; - if(server_mode == 1){ - mode = eServerModeNoAuthentication; - } - else if(server_mode == 2){ - mode = eServerModeAuthentication; - } - else{ - mode = eServerModeAuthenticationAndSecure; - } - - uint32_t ip_address = 0; - if(!ip.empty() || ip != "0"){ - // Resolve address and convert it from IP_Address string to uint32_t - IP_Address address; - if(ip.is_valid_ip_address()){ - address = ip; - } - else{ - address = IP::get_singleton()->resolve_hostname(ip, IP::TYPE_IPV4); - } - // Resolution failed - if(address.is_valid()){ - ip_address = *((uint32_t *)address.get_ipv4()); - } - } - char error_message[STEAM_MAX_ERROR_MESSAGE] = "Server initialized successfully"; ESteamAPIInitResult initialize_result = k_ESteamAPIInitResult_FailedGeneric; - initialize_result = SteamGameServer_InitEx(ip_address, game_port, query_port, mode, version_number.utf8().get_data(), &error_message); + initialize_result = SteamGameServer_InitEx(getIPFromString(ip), game_port, query_port, (EServerMode)server_mode, version_number.utf8().get_data(), &error_message); Dictionary server_initialize; server_initialize["status"] = initialize_result; @@ -220,7 +318,6 @@ void SteamServer::serverShutdown(){ } -///////////////////////////////////////////////// ///// GAME SERVER FUNCTIONS ///////////////////////////////////////////////// // @@ -416,7 +513,7 @@ void SteamServer::setRegion(const String& region){ // NOTE: These functions are player list management / authentication. // // Retrieve ticket to be sent to the entity who wishes to authenticate you (using BeginAuthSession API). -Dictionary SteamServer::getAuthSessionTicket(const String& identity_reference){ +Dictionary SteamServer::getAuthSessionTicket(uint64_t remote_steam_id){ // Create the dictionary to use Dictionary auth_ticket; if(SteamGameServer() != NULL){ @@ -424,11 +521,9 @@ Dictionary SteamServer::getAuthSessionTicket(const String& identity_reference){ uint32_t ticket_size = 1024; PoolByteArray buffer; buffer.resize(ticket_size); - // If no reference is passed, just use NULL - // Not pretty but will work for now - if(identity_reference != ""){ - const SteamNetworkingIdentity identity = networking_identities[identity_reference.utf8().get_data()]; - id = SteamGameServer()->GetAuthSessionTicket(buffer.write().ptr(), ticket_size, &ticket_size, &identity); + if(remote_steam_id == 0){ + SteamNetworkingIdentity auth_identity = getIdentityFromSteamID(remote_steam_id); + id = SteamGameServer()->GetAuthSessionTicket(buffer.write().ptr(), ticket_size, &ticket_size, &auth_identity); } else{ id = SteamGameServer()->GetAuthSessionTicket(buffer.write().ptr(), ticket_size, &ticket_size, NULL); @@ -494,20 +589,7 @@ Dictionary SteamServer::handleIncomingPacket(int packet, const String& ip, uint1 } PoolByteArray data; data.resize(packet); - // Resolve address and convert it from IP_Address string to uint32_t - IP_Address address; - if(ip.is_valid_ip_address()){ - address = ip; - } - else{ - address = IP::get_singleton()->resolve_hostname(ip, IP::TYPE_IPV4); - } - // Resolution failed - if(!address.is_valid()){ - return result; - } - uint32_t ip4 = *((uint32_t *)address.get_ipv4()); - if(SteamGameServer()->HandleIncomingPacket(data.write().ptr(), packet, ip4, port)){ + if(SteamGameServer()->HandleIncomingPacket(data.write().ptr(), packet, getIPFromString(ip), port)){ result["data"] = data; } return result; @@ -575,7 +657,6 @@ void SteamServer::computeNewPlayerCompatibility(uint64_t steam_id){ } -///////////////////////////////////////////////// ///// GAME SERVER STATS ///////////////////////////////////////////////// // @@ -684,126 +765,124 @@ bool SteamServer::updateUserAvgRateStat(uint64_t steam_id, const String& name, f } - -///////////////////////////////////////////////// ///// HTTP ///////////////////////////////////////////////// // // Creates a cookie container to store cookies during the lifetime of the process. This API is just for during process lifetime, after steam restarts no cookies are persisted and you have no way to access the cookie container across repeat executions of your process. -uint32_t SteamServer::createCookieContainer(bool allow_responses_to_modify){ - if(SteamHTTP() == NULL){ +uint32_t SteamServer::createCookieContainer(bool allow_responses_to_modify) { + if (SteamHTTP() == NULL) { return 0; } return SteamHTTP()->CreateCookieContainer(allow_responses_to_modify); } // Initializes a new HTTP request. -uint32_t SteamServer::createHTTPRequest(HTTPMethod request_method, const String& absolute_url){ - if(SteamHTTP() != NULL){ +uint32_t SteamServer::createHTTPRequest(HTTPMethod request_method, const String &absolute_url) { + if (SteamHTTP() != NULL) { return SteamHTTP()->CreateHTTPRequest((EHTTPMethod)request_method, absolute_url.utf8().get_data()); } return HTTPREQUEST_INVALID_HANDLE; } // Defers a request which has already been sent by moving it at the back of the queue. -bool SteamServer::deferHTTPRequest(uint32 request_handle){ - if(SteamHTTP() == NULL){ +bool SteamServer::deferHTTPRequest(uint32 request_handle) { + if (SteamHTTP() == NULL) { return false; } return SteamHTTP()->DeferHTTPRequest(request_handle); } // Gets progress on downloading the body for the request. -float SteamServer::getHTTPDownloadProgressPct(uint32 request_handle){ +float SteamServer::getHTTPDownloadProgressPct(uint32 request_handle) { float percent_one = 0.0; - if(SteamHTTP() != NULL){ + if (SteamHTTP() != NULL) { SteamHTTP()->GetHTTPDownloadProgressPct(request_handle, &percent_one); } return percent_one; } // Check if the reason the request failed was because we timed it out (rather than some harder failure). -bool SteamServer::getHTTPRequestWasTimedOut(uint32 request_handle){ +bool SteamServer::getHTTPRequestWasTimedOut(uint32 request_handle) { bool was_timed_out = false; - if(SteamHTTP() != NULL){ + if (SteamHTTP() != NULL) { SteamHTTP()->GetHTTPRequestWasTimedOut(request_handle, &was_timed_out); } return was_timed_out; } // Gets the body data from an HTTP response. -PoolByteArray SteamServer::getHTTPResponseBodyData(uint32 request_handle, uint32 buffer_size){ +PoolByteArray SteamServer::getHTTPResponseBodyData(uint32 request_handle, uint32 buffer_size) { PoolByteArray body_data; body_data.resize(buffer_size); - if(SteamHTTP() != NULL){ + if (SteamHTTP() != NULL) { SteamHTTP()->GetHTTPResponseBodyData(request_handle, body_data.write().ptr(), buffer_size); } return body_data; } // Gets the size of the body data from an HTTP response. -uint32 SteamServer::getHTTPResponseBodySize(uint32 request_handle){ +uint32 SteamServer::getHTTPResponseBodySize(uint32 request_handle) { uint32 body_size = 0; - if(SteamHTTP() != NULL){ + if (SteamHTTP() != NULL) { SteamHTTP()->GetHTTPResponseBodySize(request_handle, &body_size); } return body_size; } // Checks if a header is present in an HTTP response and returns its size. -uint32 SteamServer::getHTTPResponseHeaderSize(uint32 request_handle, const String& header_name){ +uint32 SteamServer::getHTTPResponseHeaderSize(uint32 request_handle, const String &header_name) { uint32 response_header_size = 0; - if(SteamHTTP() != NULL){ + if (SteamHTTP() != NULL) { SteamHTTP()->GetHTTPResponseHeaderSize(request_handle, header_name.utf8().get_data(), &response_header_size); } return response_header_size; } // Gets a header value from an HTTP response. -uint8 SteamServer::getHTTPResponseHeaderValue(uint32 request_handle, const String& header_name, uint32 buffer_size){ +uint8 SteamServer::getHTTPResponseHeaderValue(uint32 request_handle, const String &header_name, uint32 buffer_size) { uint8 value_buffer = 0; - if(SteamHTTP() != NULL){ + if (SteamHTTP() != NULL) { SteamHTTP()->GetHTTPResponseHeaderValue(request_handle, header_name.utf8().get_data(), &value_buffer, buffer_size); } return value_buffer; } // Gets the body data from a streaming HTTP response. -uint8 SteamServer::getHTTPStreamingResponseBodyData(uint32 request_handle, uint32 offset, uint32 buffer_size){ +uint8 SteamServer::getHTTPStreamingResponseBodyData(uint32 request_handle, uint32 offset, uint32 buffer_size) { uint8 body_data_buffer = 0; - if(SteamHTTP() != NULL){ + if (SteamHTTP() != NULL) { SteamHTTP()->GetHTTPStreamingResponseBodyData(request_handle, offset, &body_data_buffer, buffer_size); } return body_data_buffer; } // Prioritizes a request which has already been sent by moving it at the front of the queue. -bool SteamServer::prioritizeHTTPRequest(uint32 request_handle){ - if(SteamHTTP() == NULL){ +bool SteamServer::prioritizeHTTPRequest(uint32 request_handle) { + if (SteamHTTP() == NULL) { return false; } return SteamHTTP()->PrioritizeHTTPRequest(request_handle); } // Releases a cookie container, freeing the memory allocated within Steam. -bool SteamServer::releaseCookieContainer(uint32 cookie_handle){ - if(SteamHTTP() == NULL){ +bool SteamServer::releaseCookieContainer(uint32 cookie_handle) { + if (SteamHTTP() == NULL) { return false; } return SteamHTTP()->ReleaseCookieContainer(cookie_handle); } // Releases an HTTP request handle, freeing the memory allocated within Steam. -bool SteamServer::releaseHTTPRequest(uint32 request_handle){ - if(SteamHTTP() == NULL){ +bool SteamServer::releaseHTTPRequest(uint32 request_handle) { + if (SteamHTTP() == NULL) { return false; } return SteamHTTP()->ReleaseHTTPRequest(request_handle); } // Sends an HTTP request. -bool SteamServer::sendHTTPRequest(uint32 request_handle){ - if(SteamHTTP() == NULL){ +bool SteamServer::sendHTTPRequest(uint32 request_handle) { + if (SteamHTTP() == NULL) { return false; } SteamAPICall_t call_handle; @@ -811,8 +890,8 @@ bool SteamServer::sendHTTPRequest(uint32 request_handle){ } // Sends an HTTP request and streams the response back in chunks. -bool SteamServer::sendHTTPRequestAndStreamResponse(uint32 request_handle){ - if(SteamHTTP() == NULL){ +bool SteamServer::sendHTTPRequestAndStreamResponse(uint32 request_handle) { + if (SteamHTTP() == NULL) { return false; } SteamAPICall_t call_handle; @@ -820,99 +899,98 @@ bool SteamServer::sendHTTPRequestAndStreamResponse(uint32 request_handle){ } // Adds a cookie to the specified cookie container that will be used with future requests. -bool SteamServer::setHTTPCookie(uint32 cookie_handle, const String& host, const String& url, const String& cookie){ - if(SteamHTTP() == NULL){ +bool SteamServer::setHTTPCookie(uint32 cookie_handle, const String &host, const String &url, const String &cookie) { + if (SteamHTTP() == NULL) { return false; } return SteamHTTP()->SetCookie(cookie_handle, host.utf8().get_data(), url.utf8().get_data(), cookie.utf8().get_data()); } // Set an absolute timeout in milliseconds for the HTTP request. This is the total time timeout which is different than the network activity timeout which is set with SetHTTPRequestNetworkActivityTimeout which can bump everytime we get more data. -bool SteamServer::setHTTPRequestAbsoluteTimeoutMS(uint32 request_handle, uint32 milliseconds){ - if(SteamHTTP() == NULL){ +bool SteamServer::setHTTPRequestAbsoluteTimeoutMS(uint32 request_handle, uint32 milliseconds) { + if (SteamHTTP() == NULL) { return false; } return SteamHTTP()->SetHTTPRequestAbsoluteTimeoutMS(request_handle, milliseconds); } // Set a context value for the request, which will be returned in the HTTPRequestCompleted_t callback after sending the request. This is just so the caller can easily keep track of which callbacks go with which request data. Must be called before sending the request. -bool SteamServer::setHTTPRequestContextValue(uint32 request_handle, uint64_t context_value){ - if(SteamHTTP() == NULL){ +bool SteamServer::setHTTPRequestContextValue(uint32 request_handle, uint64_t context_value) { + if (SteamHTTP() == NULL) { return false; } return SteamHTTP()->SetHTTPRequestContextValue(request_handle, context_value); } // Associates a cookie container to use for an HTTP request. -bool SteamServer::setHTTPRequestCookieContainer(uint32 request_handle, uint32 cookie_handle){ - if(SteamHTTP() == NULL){ +bool SteamServer::setHTTPRequestCookieContainer(uint32 request_handle, uint32 cookie_handle) { + if (SteamHTTP() == NULL) { return false; } return SteamHTTP()->SetHTTPRequestCookieContainer(request_handle, cookie_handle); } // Set a GET or POST parameter value on the HTTP request. Must be called prior to sending the request. -bool SteamServer::setHTTPRequestGetOrPostParameter(uint32 request_handle, const String& name, const String& value){ - if(SteamHTTP() == NULL){ +bool SteamServer::setHTTPRequestGetOrPostParameter(uint32 request_handle, const String &name, const String &value) { + if (SteamHTTP() == NULL) { return false; } return SteamHTTP()->SetHTTPRequestGetOrPostParameter(request_handle, name.utf8().get_data(), value.utf8().get_data()); } // Set a request header value for the HTTP request. Must be called before sending the request. -bool SteamServer::setHTTPRequestHeaderValue(uint32 request_handle, const String& header_name, const String& header_value){ - if(SteamHTTP() == NULL){ +bool SteamServer::setHTTPRequestHeaderValue(uint32 request_handle, const String &header_name, const String &header_value) { + if (SteamHTTP() == NULL) { return false; } return SteamHTTP()->SetHTTPRequestHeaderValue(request_handle, header_name.utf8().get_data(), header_value.utf8().get_data()); } // Set the timeout in seconds for the HTTP request. -bool SteamServer::setHTTPRequestNetworkActivityTimeout(uint32 request_handle, uint32 timeout_seconds){ - if(SteamHTTP() == NULL){ +bool SteamServer::setHTTPRequestNetworkActivityTimeout(uint32 request_handle, uint32 timeout_seconds) { + if (SteamHTTP() == NULL) { return false; } return SteamHTTP()->SetHTTPRequestNetworkActivityTimeout(request_handle, timeout_seconds); } // Sets the body for an HTTP Post request. -uint8 SteamServer::setHTTPRequestRawPostBody(uint32 request_handle, const String& content_type, uint32 body_length){ +uint8 SteamServer::setHTTPRequestRawPostBody(uint32 request_handle, const String &content_type, uint32 body_length) { uint8 body = 0; - if(SteamHTTP()){ + if (SteamHTTP()) { SteamHTTP()->SetHTTPRequestRawPostBody(request_handle, content_type.utf8().get_data(), &body, body_length); } return body; } // Sets that the HTTPS request should require verified SSL certificate via machines certificate trust store. This currently only works Windows and macOS. -bool SteamServer::setHTTPRequestRequiresVerifiedCertificate(uint32 request_handle, bool require_verified_certificate){ - if(SteamHTTP() == NULL){ +bool SteamServer::setHTTPRequestRequiresVerifiedCertificate(uint32 request_handle, bool require_verified_certificate) { + if (SteamHTTP() == NULL) { return false; } return SteamHTTP()->SetHTTPRequestRequiresVerifiedCertificate(request_handle, require_verified_certificate); } // Set additional user agent info for a request. -bool SteamServer::setHTTPRequestUserAgentInfo(uint32 request_handle, const String& user_agent_info){ - if(SteamHTTP() == NULL){ +bool SteamServer::setHTTPRequestUserAgentInfo(uint32 request_handle, const String &user_agent_info) { + if (SteamHTTP() == NULL) { return false; } return SteamHTTP()->SetHTTPRequestUserAgentInfo(request_handle, user_agent_info.utf8().get_data()); } -///////////////////////////////////////////////// ///// INVENTORY +///// +///// When dealing with any inventory handles, you should call CheckResultSteamID on the result handle when it completes to verify that a remote player is not pretending to have a different user's inventory. +///// Also, you must call DestroyResult on the provided inventory result when you are done with it. ///////////////////////////////////////////////// // -// When dealing with any inventory handles, you should call CheckResultSteamID on the result handle when it completes to verify that a remote player is not pretending to have a different user's inventory. -// Also, you must call DestroyResult on the provided inventory result when you are done with it. -//! // Grant a specific one-time promotional item to the current user. -int32 SteamServer::addPromoItem(uint32 item){ +int32 SteamServer::addPromoItem(uint32 item) { int32 new_inventory_handle = 0; - if(SteamInventory() != NULL){ - if(SteamInventory()->AddPromoItem(&new_inventory_handle, item)){ + if (SteamInventory() != NULL) { + if (SteamInventory()->AddPromoItem(&new_inventory_handle, item)) { // Update the internally stored handle inventory_handle = new_inventory_handle; } @@ -921,15 +999,15 @@ int32 SteamServer::addPromoItem(uint32 item){ } // Grant a specific one-time promotional items to the current user. -int32 SteamServer::addPromoItems(PoolIntArray items){ +int32 SteamServer::addPromoItems(PoolIntArray items) { int32 new_inventory_handle = 0; - if(SteamInventory() != NULL){ + if (SteamInventory() != NULL) { int count = items.size(); SteamItemDef_t *new_items = new SteamItemDef_t[items.size()]; - for(int i = 0; i < count; i++){ + for (int i = 0; i < count; i++) { new_items[i] = items[i]; } - if(SteamInventory()->AddPromoItems(&new_inventory_handle, new_items, count)){ + if (SteamInventory()->AddPromoItems(&new_inventory_handle, new_items, count)) { // Update the internally stored handle inventory_handle = new_inventory_handle; } @@ -939,35 +1017,35 @@ int32 SteamServer::addPromoItems(PoolIntArray items){ } // Checks whether an inventory result handle belongs to the specified Steam ID. -bool SteamServer::checkResultSteamID(uint64_t steam_id_expected, int32 this_inventory_handle){ - if(SteamInventory() == NULL){ +bool SteamServer::checkResultSteamID(uint64_t steam_id_expected, int32 this_inventory_handle) { + if (SteamInventory() == NULL) { return false; } CSteamID steam_id = (uint64)steam_id_expected; // If no inventory handle is passed, use internal one - if(this_inventory_handle == 0){ + if (this_inventory_handle == 0) { this_inventory_handle = inventory_handle; } return SteamInventory()->CheckResultSteamID((SteamInventoryResult_t)this_inventory_handle, steam_id); } // Consumes items from a user's inventory. If the quantity of the given item goes to zero, it is permanently removed. -int32 SteamServer::consumeItem(uint64_t item_consume, uint32 quantity){ +int32 SteamServer::consumeItem(uint64_t item_consume, uint32 quantity) { int32 new_inventory_handle = 0; - if(SteamInventory() != NULL){ - if(SteamInventory()->ConsumeItem(&new_inventory_handle, (SteamItemInstanceID_t)item_consume, quantity)){ - // Update the internally stored handle + if (SteamInventory() != NULL) { + if (SteamInventory()->ConsumeItem(&new_inventory_handle, (SteamItemInstanceID_t)item_consume, quantity)) { + // Update the internally stored handle inventory_handle = new_inventory_handle; - } + } } return new_inventory_handle; } // Deserializes a result set and verifies the signature bytes. -int32 SteamServer::deserializeResult(PoolByteArray buffer){ +int32 SteamServer::deserializeResult(PoolByteArray buffer) { int32 new_inventory_handle = 0; - if(SteamInventory() != NULL){ - if(SteamInventory()->DeserializeResult(&new_inventory_handle, &buffer, buffer.size(), false)){ + if (SteamInventory() != NULL) { + if (SteamInventory()->DeserializeResult(&new_inventory_handle, &buffer, buffer.size(), false)) { // Update the internally stored handle inventory_handle = new_inventory_handle; } @@ -976,29 +1054,29 @@ int32 SteamServer::deserializeResult(PoolByteArray buffer){ } // Destroys a result handle and frees all associated memory. -void SteamServer::destroyResult(int this_inventory_handle){ - if(SteamInventory() != NULL){ +void SteamServer::destroyResult(int this_inventory_handle) { + if (SteamInventory() != NULL) { // If no inventory handle is passed, use internal one - if(this_inventory_handle == 0){ + if (this_inventory_handle == 0) { this_inventory_handle = inventory_handle; - } + } SteamInventory()->DestroyResult((SteamInventoryResult_t)this_inventory_handle); } } // Grant one item in exchange for a set of other items. -int32 SteamServer::exchangeItems(const PoolIntArray output_items, const PoolIntArray output_quantity, const PoolIntArray input_items, const PoolIntArray input_quantity){ +int32 SteamServer::exchangeItems(const PoolIntArray output_items, const PoolIntArray output_quantity, const PoolIntArray input_items, const PoolIntArray input_quantity) { int32 new_inventory_handle = 0; - if(SteamInventory() != NULL){ - uint32_t* quantity_out = (uint32*) output_quantity.read().ptr(); - uint32_t* quantity_in = (uint32*) input_quantity.read().ptr(); + if (SteamInventory() != NULL) { + uint32_t *quantity_out = (uint32*) output_quantity.read().ptr(); + uint32_t *quantity_in = (uint32*) input_quantity.read().ptr(); int array_size = input_items.size(); SteamItemInstanceID_t *input_item_ids = new SteamItemInstanceID_t[array_size]; - for(int i = 0; i < array_size; i++){ + for (int i = 0; i < array_size; i++) { input_item_ids[i] = input_items[i]; } const SteamItemInstanceID_t *these_item_ids = input_item_ids; - if(SteamInventory()->ExchangeItems(&new_inventory_handle, output_items.read().ptr(), quantity_out, 1, these_item_ids, quantity_in, 1)){ + if (SteamInventory()->ExchangeItems(&new_inventory_handle, output_items.read().ptr(), quantity_out, 1, these_item_ids, quantity_in, 1)) { // Update the internally stored handle inventory_handle = new_inventory_handle; } @@ -1008,11 +1086,11 @@ int32 SteamServer::exchangeItems(const PoolIntArray output_items, const PoolIntA } // Grants specific items to the current user, for developers only. -int32 SteamServer::generateItems(const PoolIntArray items, const PoolIntArray quantity){ +int32 SteamServer::generateItems(const PoolIntArray items, const PoolIntArray quantity) { int32 new_inventory_handle = 0; - if(SteamInventory() != NULL){ - uint32_t* this_quantity = (uint32*) quantity.read().ptr(); - if(SteamInventory()->GenerateItems(&new_inventory_handle, items.read().ptr(), this_quantity, items.size())){ + if (SteamInventory() != NULL) { + uint32_t *this_quantity = (uint32*) quantity.read().ptr(); + if (SteamInventory()->GenerateItems(&new_inventory_handle, items.read().ptr(), this_quantity, items.size())) { // Update the internally stored handle inventory_handle = new_inventory_handle; } @@ -1021,10 +1099,10 @@ int32 SteamServer::generateItems(const PoolIntArray items, const PoolIntArray qu } // Start retrieving all items in the current users inventory. -int32 SteamServer::getAllItems(){ +int32 SteamServer::getAllItems() { int32 new_inventory_handle = 0; - if(SteamInventory() != NULL){ - if(SteamInventory()->GetAllItems(&new_inventory_handle)){ + if (SteamInventory() != NULL) { + if (SteamInventory()->GetAllItems(&new_inventory_handle)) { // Update the internally stored handle inventory_handle = new_inventory_handle; } @@ -1033,8 +1111,8 @@ int32 SteamServer::getAllItems(){ } // Gets a string property from the specified item definition. Gets a property value for a specific item definition. -String SteamServer::getItemDefinitionProperty(uint32 definition, const String& name){ - if(SteamInventory() == NULL){ +String SteamServer::getItemDefinitionProperty(uint32 definition, const String &name) { + if (SteamInventory() == NULL) { return ""; } uint32 buffer_size = STEAM_BUFFER_SIZE; @@ -1046,16 +1124,16 @@ String SteamServer::getItemDefinitionProperty(uint32 definition, const String& n } // Gets the state of a subset of the current user's inventory. -int32 SteamServer::getItemsByID(const PoolIntArray id_array){ +int32 SteamServer::getItemsByID(const PoolIntArray id_array) { int32 new_inventory_handle = 0; - if(SteamInventory() != NULL){ + if (SteamInventory() != NULL) { int array_size = id_array.size(); SteamItemInstanceID_t *item_ids = new SteamItemInstanceID_t[array_size]; - for(int i = 0; i < array_size; i++){ + for (int i = 0; i < array_size; i++) { item_ids[i] = id_array[i]; } const SteamItemInstanceID_t *these_item_ids = item_ids; - if(SteamInventory()->GetItemsByID(&new_inventory_handle, these_item_ids, array_size)) { + if (SteamInventory()->GetItemsByID(&new_inventory_handle, these_item_ids, array_size)) { // Update the internally stored handle inventory_handle = new_inventory_handle; } @@ -1065,19 +1143,22 @@ int32 SteamServer::getItemsByID(const PoolIntArray id_array){ } // After a successful call to RequestPrices, you can call this method to get the pricing for a specific item definition. -uint64_t SteamServer::getItemPrice(uint32 definition){ - if(SteamInventory() == NULL){ - return 0; +Dictionary SteamServer::getItemPrice(uint32 definition) { + Dictionary prices; + if (SteamInventory() == NULL) { + return prices; } uint64 price = 0; - uint64 basePrice = 0; - SteamInventory()->GetItemPrice(definition, &price, &basePrice); - return price; + uint64 base_price = 0; + SteamInventory()->GetItemPrice(definition, &price, &base_price); + prices["price"] = (uint64_t)price; + prices["base_price"] = (uint64_t)base_price; + return prices; } // After a successful call to RequestPrices, you can call this method to get all the pricing for applicable item definitions. Use the result of GetNumItemsWithPrices as the the size of the arrays that you pass in. -Array SteamServer::getItemsWithPrices(){ - if(SteamInventory() == NULL){ +Array SteamServer::getItemsWithPrices() { + if (SteamInventory() == NULL) { return Array(); } uint32 valid_prices = SteamInventory()->GetNumItemsWithPrices(); @@ -1087,8 +1168,8 @@ Array SteamServer::getItemsWithPrices(){ SteamItemDef_t *ids = new SteamItemDef_t[valid_prices]; uint64 *prices = new uint64[valid_prices]; uint64 *base_prices = new uint64[valid_prices]; - if(SteamInventory()->GetItemsWithPrices(ids, prices, base_prices, valid_prices)){ - for(uint32 i = 0; i < valid_prices; i++){ + if (SteamInventory()->GetItemsWithPrices(ids, prices, base_prices, valid_prices)) { + for (uint32 i = 0; i < valid_prices; i++) { Dictionary price_group; price_group["item"] = ids[i]; price_group["price"] = (uint64_t)prices[i]; @@ -1103,13 +1184,13 @@ Array SteamServer::getItemsWithPrices(){ } // Gets the dynamic properties from an item in an inventory result set. -String SteamServer::getResultItemProperty(uint32 index, const String& name, int32 this_inventory_handle){ - if(SteamInventory() != NULL){ +String SteamServer::getResultItemProperty(uint32 index, const String &name, int32 this_inventory_handle) { + if (SteamInventory() != NULL) { // Set up variables to fill uint32 buffer_size = 256; char *value = new char[buffer_size]; // If no inventory handle is passed, use internal one - if(this_inventory_handle == 0){ + if (this_inventory_handle == 0) { this_inventory_handle = inventory_handle; } SteamInventory()->GetResultItemProperty((SteamInventoryResult_t)this_inventory_handle, index, name.utf8().get_data(), (char*)value, &buffer_size); @@ -1121,22 +1202,22 @@ String SteamServer::getResultItemProperty(uint32 index, const String& name, int3 } // Get the items associated with an inventory result handle. -Array SteamServer::getResultItems(int32 this_inventory_handle){ - if(SteamInventory() == NULL){ +Array SteamServer::getResultItems(int32 this_inventory_handle) { + if (SteamInventory() == NULL) { return Array(); } // Set up return array Array items; uint32 size = 0; - if(SteamInventory()->GetResultItems((SteamInventoryResult_t)this_inventory_handle, NULL, &size)){ + if (SteamInventory()->GetResultItems((SteamInventoryResult_t)this_inventory_handle, NULL, &size)) { items.resize(size); SteamItemDetails_t *item_array = new SteamItemDetails_t[size]; // If no inventory handle is passed, use internal one - if(this_inventory_handle == 0){ + if (this_inventory_handle == 0) { this_inventory_handle = inventory_handle; } - if(SteamInventory()->GetResultItems((SteamInventoryResult_t)this_inventory_handle, item_array, &size)){ - for(uint32 i = 0; i < size; i++){ + if (SteamInventory()->GetResultItems((SteamInventoryResult_t)this_inventory_handle, item_array, &size)) { + for (uint32 i = 0; i < size; i++) { Dictionary item_info; item_info["item_id"] = (uint64_t)item_array[i].m_itemId; item_info["item_definition"] = item_array[i].m_iDefinition; @@ -1151,56 +1232,34 @@ Array SteamServer::getResultItems(int32 this_inventory_handle){ } // Find out the status of an asynchronous inventory result handle. -String SteamServer::getResultStatus(int32 this_inventory_handle){ - if(SteamInventory() == NULL){ - return ""; +SteamServer::Result SteamServer::getResultStatus(int32 this_inventory_handle) { + if (SteamInventory() == NULL) { + return RESULT_FAIL; } // If no inventory handle is passed, use internal one - if(this_inventory_handle == 0){ + if (this_inventory_handle == 0) { this_inventory_handle = inventory_handle; } - int result = SteamInventory()->GetResultStatus((SteamInventoryResult_t)this_inventory_handle); - // Parse result - if(result == k_EResultPending){ - return "Still in progress."; - } - else if(result == k_EResultOK){ - return "Finished successfully."; - } - else if(result == k_EResultExpired){ - return "Finished but may be out-of-date."; - } - else if(result == k_EResultInvalidParam){ - return "ERROR: invalid API call parameters."; - } - else if(result == k_EResultServiceUnavailable){ - return "ERROR: server temporarily down; retry later."; - } - else if(result == k_EResultLimitExceeded){ - return "ERROR: operation would exceed per-user inventory limits."; - } - else{ - return "ERROR: generic / unknown."; - } + return (SteamServer::Result)SteamInventory()->GetResultStatus((SteamInventoryResult_t)this_inventory_handle); } // Gets the server time at which the result was generated. -uint32 SteamServer::getResultTimestamp(int32 this_inventory_handle){ - if(SteamInventory() == NULL){ +uint32 SteamServer::getResultTimestamp(int32 this_inventory_handle) { + if (SteamInventory() == NULL) { return 0; } // If no inventory handle is passed, use internal one - if(this_inventory_handle == 0){ + if (this_inventory_handle == 0) { this_inventory_handle = inventory_handle; } return SteamInventory()->GetResultTimestamp((SteamInventoryResult_t)this_inventory_handle); } // Grant all potential one-time promotional items to the current user. -int32 SteamServer::grantPromoItems(){ +int32 SteamServer::grantPromoItems() { int32 new_inventory_handle = 0; - if(SteamInventory() != NULL){ - if(SteamInventory()->GrantPromoItems(&new_inventory_handle)){ + if (SteamInventory() != NULL) { + if (SteamInventory()->GrantPromoItems(&new_inventory_handle)) { // Update the internally stored handle inventory_handle = new_inventory_handle; } @@ -1209,16 +1268,16 @@ int32 SteamServer::grantPromoItems(){ } // Triggers an asynchronous load and refresh of item definitions. -bool SteamServer::loadItemDefinitions(){ - if(SteamInventory() == NULL){ +bool SteamServer::loadItemDefinitions() { + if (SteamInventory() == NULL) { return false; } return SteamInventory()->LoadItemDefinitions(); } // Request the list of "eligible" promo items that can be manually granted to the given user. -void SteamServer::requestEligiblePromoItemDefinitionsIDs(uint64_t steam_id){ - if(SteamInventory() != NULL){ +void SteamServer::requestEligiblePromoItemDefinitionsIDs(uint64_t steam_id) { + if (SteamInventory() != NULL) { CSteamID user_id = (uint64)steam_id; SteamAPICall_t api_call = SteamInventory()->RequestEligiblePromoItemDefinitionsIDs(user_id); callResultEligiblePromoItemDefIDs.Set(api_call, this, &SteamServer::inventory_eligible_promo_item); @@ -1226,25 +1285,25 @@ void SteamServer::requestEligiblePromoItemDefinitionsIDs(uint64_t steam_id){ } // Request prices for all item definitions that can be purchased in the user's local currency. A SteamInventoryRequestPricesResult_t call result will be returned with the user's local currency code. After that, you can call GetNumItemsWithPrices and GetItemsWithPrices to get prices for all the known item definitions, or GetItemPrice for a specific item definition. -void SteamServer::requestPrices(){ - if(SteamInventory() != NULL){ +void SteamServer::requestPrices() { + if (SteamInventory() != NULL) { SteamAPICall_t api_call = SteamInventory()->RequestPrices(); callResultRequestPrices.Set(api_call, this, &SteamServer::inventory_request_prices_result); } } // Serialized result sets contain a short signature which can't be forged or replayed across different game sessions. -String SteamServer::serializeResult(int32 this_inventory_handle){ +String SteamServer::serializeResult(int32 this_inventory_handle) { String result_serialized; - if(SteamInventory() != NULL){ + if (SteamInventory() != NULL) { // If no inventory handle is passed, use internal one - if(this_inventory_handle == 0){ + if (this_inventory_handle == 0) { this_inventory_handle = inventory_handle; } // Set up return array uint32 buffer_size = STEAM_BUFFER_SIZE; char *buffer = new char[buffer_size]; - if(SteamInventory()->SerializeResult((SteamInventoryResult_t)this_inventory_handle, buffer, &buffer_size)){ + if (SteamInventory()->SerializeResult((SteamInventoryResult_t)this_inventory_handle, buffer, &buffer_size)) { result_serialized = String::utf8(buffer, buffer_size); } delete[] buffer; @@ -1253,26 +1312,26 @@ String SteamServer::serializeResult(int32 this_inventory_handle){ } // Starts the purchase process for the user, given a "shopping cart" of item definitions that the user would like to buy. The user will be prompted in the Steam Overlay to complete the purchase in their local currency, funding their Steam Wallet if necessary, etc. -void SteamServer::startPurchase(const PoolIntArray items, const PoolIntArray quantity){ - if(SteamInventory() != NULL){ - uint32_t* these_quantities = (uint32*) quantity.read().ptr(); +void SteamServer::startPurchase(const PoolIntArray items, const PoolIntArray quantity) { + if (SteamInventory() != NULL) { + uint32_t *these_quantities = (uint32*) quantity.read().ptr(); SteamAPICall_t api_call = SteamInventory()->StartPurchase(items.read().ptr(), these_quantities, items.size()); callResultStartPurchase.Set(api_call, this, &SteamServer::inventory_start_purchase_result); } } // Transfer items between stacks within a user's inventory. -int32 SteamServer::transferItemQuantity(uint64_t item_id, uint32 quantity, uint64_t item_destination, bool split){ +int32 SteamServer::transferItemQuantity(uint64_t item_id, uint32 quantity, uint64_t item_destination, bool split) { int32 new_inventory_handle = 0; - if(SteamInventory() != NULL){ - if(split){ - if(SteamInventory()->TransferItemQuantity(&new_inventory_handle, (SteamItemInstanceID_t)item_id, quantity, k_SteamItemInstanceIDInvalid)){ + if (SteamInventory() != NULL) { + if (split) { + if (SteamInventory()->TransferItemQuantity(&new_inventory_handle, (SteamItemInstanceID_t)item_id, quantity, k_SteamItemInstanceIDInvalid)) { // Update the internally stored handle inventory_handle = new_inventory_handle; } } - else{ - if(SteamInventory()->TransferItemQuantity(&new_inventory_handle, (SteamItemInstanceID_t)item_id, quantity, (SteamItemInstanceID_t)item_destination)){ + else { + if (SteamInventory()->TransferItemQuantity(&new_inventory_handle, (SteamItemInstanceID_t)item_id, quantity, (SteamItemInstanceID_t)item_destination)) { // Update the internally stored handle inventory_handle = new_inventory_handle; } @@ -1282,10 +1341,10 @@ int32 SteamServer::transferItemQuantity(uint64_t item_id, uint32 quantity, uint6 } // Trigger an item drop if the user has played a long enough period of time. -int32 SteamServer::triggerItemDrop(uint32 definition){ +int32 SteamServer::triggerItemDrop(uint32 definition) { int32 new_inventory_handle = 0; - if(SteamInventory() != NULL){ - if(SteamInventory()->TriggerItemDrop(&new_inventory_handle, (SteamItemDef_t)definition)){ + if (SteamInventory() != NULL) { + if (SteamInventory()->TriggerItemDrop(&new_inventory_handle, (SteamItemDef_t)definition)) { // Update the internally stored handle inventory_handle = new_inventory_handle; } @@ -1294,21 +1353,21 @@ int32 SteamServer::triggerItemDrop(uint32 definition){ } // Starts a transaction request to update dynamic properties on items for the current user. This call is rate-limited by user, so property modifications should be batched as much as possible (e.g. at the end of a map or game session). After calling SetProperty or RemoveProperty for all the items that you want to modify, you will need to call SubmitUpdateProperties to send the request to the Steam servers. A SteamInventoryResultReady_t callback will be fired with the results of the operation. -void SteamServer::startUpdateProperties(){ - if(SteamInventory() != NULL){ +void SteamServer::startUpdateProperties() { + if (SteamInventory() != NULL) { inventory_update_handle = SteamInventory()->StartUpdateProperties(); } } // Submits the transaction request to modify dynamic properties on items for the current user. See StartUpdateProperties. -int32 SteamServer::submitUpdateProperties(uint64_t this_inventory_update_handle){ +int32 SteamServer::submitUpdateProperties(uint64_t this_inventory_update_handle) { int32 new_inventory_handle = 0; - if(SteamInventory() != NULL){ + if (SteamInventory() != NULL) { // If no inventory update handle is passed, use internal one - if(this_inventory_update_handle == 0){ + if (this_inventory_update_handle == 0) { this_inventory_update_handle = inventory_update_handle; } - if(SteamInventory()->SubmitUpdateProperties((SteamInventoryUpdateHandle_t)this_inventory_update_handle, &new_inventory_handle)){ + if (SteamInventory()->SubmitUpdateProperties((SteamInventoryUpdateHandle_t)this_inventory_update_handle, &new_inventory_handle)) { // Update the internally stored handle inventory_handle = new_inventory_handle; } @@ -1317,76 +1376,75 @@ int32 SteamServer::submitUpdateProperties(uint64_t this_inventory_update_handle) } // Removes a dynamic property for the given item. -bool SteamServer::removeProperty(uint64_t item_id, const String& name, uint64_t this_inventory_update_handle){ - if(SteamInventory() == NULL){ +bool SteamServer::removeProperty(uint64_t item_id, const String &name, uint64_t this_inventory_update_handle) { + if (SteamInventory() == NULL) { return false; } // If no inventory update handle is passed, use internal one - if(this_inventory_update_handle == 0){ + if (this_inventory_update_handle == 0) { this_inventory_update_handle = inventory_update_handle; } return SteamInventory()->RemoveProperty((SteamInventoryUpdateHandle_t)this_inventory_update_handle, (SteamItemInstanceID_t)item_id, name.utf8().get_data()); } // Sets a dynamic property for the given item. Supported value types are strings. -bool SteamServer::setPropertyString(uint64_t item_id, const String& name, const String& value, uint64_t this_inventory_update_handle){ - if(SteamInventory() == NULL){ +bool SteamServer::setPropertyString(uint64_t item_id, const String &name, const String &value, uint64_t this_inventory_update_handle) { + if (SteamInventory() == NULL) { return false; } // If no inventory update handle is passed, use internal one - if(this_inventory_update_handle == 0){ + if (this_inventory_update_handle == 0) { this_inventory_update_handle = inventory_update_handle; } return SteamInventory()->SetProperty((SteamInventoryUpdateHandle_t)this_inventory_update_handle, (SteamItemInstanceID_t)item_id, name.utf8().get_data(), value.utf8().get_data()); } // Sets a dynamic property for the given item. Supported value types are boolean. -bool SteamServer::setPropertyBool(uint64_t item_id, const String& name, bool value, uint64_t this_inventory_update_handle){ - if(SteamInventory() == NULL){ +bool SteamServer::setPropertyBool(uint64_t item_id, const String &name, bool value, uint64_t this_inventory_update_handle) { + if (SteamInventory() == NULL) { return false; } // If no inventory update handle is passed, use internal one - if(this_inventory_update_handle == 0){ + if (this_inventory_update_handle == 0) { this_inventory_update_handle = inventory_update_handle; } return SteamInventory()->SetProperty((SteamInventoryUpdateHandle_t)this_inventory_update_handle, (SteamItemInstanceID_t)item_id, name.utf8().get_data(), value); } // Sets a dynamic property for the given item. Supported value types are 64 bit integers. -bool SteamServer::setPropertyInt(uint64_t item_id, const String& name, uint64_t value, uint64_t this_inventory_update_handle){ - if(SteamInventory() == NULL){ +bool SteamServer::setPropertyInt(uint64_t item_id, const String &name, uint64_t value, uint64_t this_inventory_update_handle) { + if (SteamInventory() == NULL) { return false; } // If no inventory update handle is passed, use internal one - if(this_inventory_update_handle == 0){ + if (this_inventory_update_handle == 0) { this_inventory_update_handle = inventory_update_handle; } return SteamInventory()->SetProperty((SteamInventoryUpdateHandle_t)this_inventory_update_handle, (SteamItemInstanceID_t)item_id, name.utf8().get_data(), (int64)value); } // Sets a dynamic property for the given item. Supported value types are 32 bit floats. -bool SteamServer::setPropertyFloat(uint64_t item_id, const String& name, float value, uint64_t this_inventory_update_handle){ - if(SteamInventory() == NULL){ +bool SteamServer::setPropertyFloat(uint64_t item_id, const String &name, float value, uint64_t this_inventory_update_handle) { + if (SteamInventory() == NULL) { return false; } // If no inventory update handle is passed, use internal one - if(this_inventory_update_handle == 0){ + if (this_inventory_update_handle == 0) { this_inventory_update_handle = inventory_update_handle; } return SteamInventory()->SetProperty((SteamInventoryUpdateHandle_t)this_inventory_update_handle, (SteamItemInstanceID_t)item_id, name.utf8().get_data(), value); } -///////////////////////////////////////////////// ///// NETWORKING ///////////////////////////////////////////////// // // This allows the game to specify accept an incoming packet. -bool SteamServer::acceptP2PSessionWithUser(uint64_t steam_id_remote) { +bool SteamServer::acceptP2PSessionWithUser(uint64_t remote_steam_id) { if (SteamNetworking() == NULL) { return false; } - CSteamID steam_id = createSteamID(steam_id_remote); + CSteamID steam_id = createSteamID(remote_steam_id); return SteamNetworking()->AcceptP2PSessionWithUser(steam_id); } @@ -1399,30 +1457,30 @@ bool SteamServer::allowP2PPacketRelay(bool allow) { } // Closes a P2P channel when you're done talking to a user on the specific channel. -bool SteamServer::closeP2PChannelWithUser(uint64_t steam_id_remote, int channel) { +bool SteamServer::closeP2PChannelWithUser(uint64_t remote_steam_id, int channel) { if (SteamNetworking() == NULL) { return false; } - CSteamID steam_id = createSteamID(steam_id_remote); + CSteamID steam_id = createSteamID(remote_steam_id); return SteamNetworking()->CloseP2PChannelWithUser(steam_id, channel); } // This should be called when you're done communicating with a user, as this will free up all of the resources allocated for the connection under-the-hood. -bool SteamServer::closeP2PSessionWithUser(uint64_t steam_id_remote) { +bool SteamServer::closeP2PSessionWithUser(uint64_t remote_steam_id) { if (SteamNetworking() == NULL) { return false; } - CSteamID steam_id = createSteamID(steam_id_remote); + CSteamID steam_id = createSteamID(remote_steam_id); return SteamNetworking()->CloseP2PSessionWithUser(steam_id); } // Fills out a P2PSessionState_t structure with details about the connection like whether or not there is an active connection. -Dictionary SteamServer::getP2PSessionState(uint64_t steam_id_remote) { +Dictionary SteamServer::getP2PSessionState(uint64_t remote_steam_id) { Dictionary result; if (SteamNetworking() == NULL) { return result; } - CSteamID steam_id = createSteamID(steam_id_remote); + CSteamID steam_id = createSteamID(remote_steam_id); P2PSessionState_t p2pSessionState; bool success = SteamNetworking()->GetP2PSessionState(steam_id, &p2pSessionState); if (!success) { @@ -1440,7 +1498,7 @@ Dictionary SteamServer::getP2PSessionState(uint64_t steam_id_remote) { } // Calls IsP2PPacketAvailable() under the hood, returns the size of the available packet or zero if there is no such packet. -uint32_t SteamServer::getAvailableP2PPacketSize(int channel){ +uint32_t SteamServer::getAvailableP2PPacketSize(int channel) { if (SteamNetworking() == NULL) { return 0; } @@ -1449,7 +1507,7 @@ uint32_t SteamServer::getAvailableP2PPacketSize(int channel){ } // Reads in a packet that has been sent from another user via SendP2PPacket. -Dictionary SteamServer::readP2PPacket(uint32_t packet, int channel){ +Dictionary SteamServer::readP2PPacket(uint32_t packet, int channel) { Dictionary result; if (SteamNetworking() == NULL) { return result; @@ -1458,11 +1516,11 @@ Dictionary SteamServer::readP2PPacket(uint32_t packet, int channel){ data.resize(packet); CSteamID steam_id; uint32_t bytesRead = 0; - if (SteamNetworking()->ReadP2PPacket(data.write().ptr(), packet, &bytesRead, &steam_id, channel)){ + if (SteamNetworking()->ReadP2PPacket(data.write().ptr(), packet, &bytesRead, &steam_id, channel)) { data.resize(bytesRead); - uint64_t steam_id_remote = steam_id.ConvertToUint64(); + uint64_t remote_steam_id = steam_id.ConvertToUint64(); result["data"] = data; - result["steam_id_remote"] = steam_id_remote; + result["remote_steam_id"] = remote_steam_id; } else { data.resize(0); @@ -1471,71 +1529,67 @@ Dictionary SteamServer::readP2PPacket(uint32_t packet, int channel){ } // Sends a P2P packet to the specified user. -bool SteamServer::sendP2PPacket(uint64_t steam_id_remote, PoolByteArray data, P2PSend send_type, int channel){ +bool SteamServer::sendP2PPacket(uint64_t remote_steam_id, PoolByteArray data, P2PSend send_type, int channel) { if (SteamNetworking() == NULL) { return false; } - CSteamID steam_id = createSteamID(steam_id_remote); + CSteamID steam_id = createSteamID(remote_steam_id); return SteamNetworking()->SendP2PPacket(steam_id, data.read().ptr(), data.size(), EP2PSend(send_type), channel); } -///////////////////////////////////////////////// ///// NETWORKING MESSAGES ///////////////////////////////////////////////// // // AcceptSessionWithUser() should only be called in response to a SteamP2PSessionRequest_t callback SteamP2PSessionRequest_t will be posted if another user tries to send you a message, and you haven't tried to talk to them. -bool SteamServer::acceptSessionWithUser(const String& identity_reference){ - if(SteamNetworkingMessages() == NULL){ +bool SteamServer::acceptSessionWithUser(uint64_t remote_steam_id) { + if (SteamNetworkingMessages() == NULL) { return false; } - return SteamNetworkingMessages()->AcceptSessionWithUser(networking_identities[identity_reference.utf8().get_data()]); + return SteamNetworkingMessages()->AcceptSessionWithUser(getIdentityFromSteamID(remote_steam_id)); } // Call this when you're done talking to a user on a specific channel. Once all open channels to a user have been closed, the open session to the user will be closed, and any new data from this user will trigger a SteamP2PSessionRequest_t callback. -bool SteamServer::closeChannelWithUser(const String& identity_reference, int channel){ - if(SteamNetworkingMessages() == NULL){ +bool SteamServer::closeChannelWithUser(uint64_t remote_steam_id, int channel) { + if (SteamNetworkingMessages() == NULL) { return false; } - return SteamNetworkingMessages()->CloseChannelWithUser(networking_identities[identity_reference.utf8().get_data()], channel); + return SteamNetworkingMessages()->CloseChannelWithUser(getIdentityFromSteamID(remote_steam_id), channel); } // Call this when you're done talking to a user to immediately free up resources under-the-hood. -bool SteamServer::closeSessionWithUser(const String& identity_reference){ - if(SteamNetworkingMessages() == NULL){ +bool SteamServer::closeSessionWithUser(uint64_t remote_steam_id) { + if (SteamNetworkingMessages() == NULL) { return false; } - return SteamNetworkingMessages()->CloseSessionWithUser(networking_identities[identity_reference.utf8().get_data()]); + return SteamNetworkingMessages()->CloseSessionWithUser(getIdentityFromSteamID(remote_steam_id)); } // Returns information about the latest state of a connection, if any, with the given peer. -Dictionary SteamServer::getSessionConnectionInfo(const String& identity_reference, bool get_connection, bool get_status){ +Dictionary SteamServer::getSessionConnectionInfo(uint64_t remote_steam_id, bool get_connection, bool get_status) { Dictionary connection_info; - if(SteamNetworkingMessages() != NULL){ + if (SteamNetworkingMessages() != NULL) { SteamNetConnectionInfo_t this_info; SteamNetConnectionRealTimeStatus_t this_status; - int connection_state = SteamNetworkingMessages()->GetSessionConnectionInfo(networking_identities[identity_reference.utf8().get_data()], &this_info, &this_status); + int connection_state = SteamNetworkingMessages()->GetSessionConnectionInfo(getIdentityFromSteamID(remote_steam_id), &this_info, &this_status); // Parse the data to a dictionary connection_info["connection_state"] = connection_state; // If getting the connection information - if(get_connection){ - char identity[STEAM_BUFFER_SIZE]; - this_info.m_identityRemote.ToString(identity, STEAM_BUFFER_SIZE); - connection_info["identity"] = identity; + if (get_connection) { + connection_info["identity"] = getSteamIDFromIdentity(this_info.m_identityRemote); connection_info["user_data"] = (uint64_t)this_info.m_nUserData; connection_info["listen_socket"] = this_info.m_hListenSocket; - char ip_address[STEAM_BUFFER_SIZE]; - this_info.m_addrRemote.ToString(ip_address, STEAM_BUFFER_SIZE, true); - connection_info["remote_address"] = ip_address; + connection_info["remote_address"] = getStringFromSteamIP(this_info.m_addrRemote); connection_info["remote_pop"] = this_info.m_idPOPRemote; connection_info["pop_relay"] = this_info.m_idPOPRelay; connection_info["connection_state"] = this_info.m_eState; connection_info["end_reason"] = this_info.m_eEndReason; connection_info["end_debug"] = this_info.m_szEndDebug; connection_info["debug_description"] = this_info.m_szConnectionDescription; + connection_info["info_flags"] = this_info.m_nFlags; } // If getting the quick status - if(get_status){ + if (get_status) { connection_info["state"] = this_status.m_eState; connection_info["ping"] = this_status.m_nPing; connection_info["local_quality"] = this_status.m_flConnectionQualityLocal; @@ -1555,32 +1609,30 @@ Dictionary SteamServer::getSessionConnectionInfo(const String& identity_referenc } // Reads the next message that has been sent from another user via SendMessageToUser() on the given channel. Returns number of messages returned into your list. (0 if no message are available on that channel.) -Array SteamServer::receiveMessagesOnChannel(int channel, int max_messages){ +Array SteamServer::receiveMessagesOnChannel(int channel, int max_messages) { Array messages; - if(SteamNetworkingMessages() != NULL){ + if (SteamNetworkingMessages() != NULL) { // Allocate the space for the messages - SteamNetworkingMessage_t** channel_messages = new SteamNetworkingMessage_t*[max_messages]; + SteamNetworkingMessage_t **channel_messages = new SteamNetworkingMessage_t*[max_messages]; // Get the messages int available_messages = SteamNetworkingMessages()->ReceiveMessagesOnChannel(channel, channel_messages, max_messages); // Loop through and create the messages as dictionaries then add to the messages array - for(int i = 0; i < available_messages; i++){ + for (int i = 0; i < available_messages; i++) { // Set up the mesage dictionary Dictionary message; // Get the data / message int message_size = channel_messages[i]->m_cbSize; PoolByteArray data; data.resize(message_size); - uint8_t* source_data = (uint8_t*)channel_messages[i]->m_pData; - uint8_t* output_data = data.write().ptr(); - for(int j = 0; j < message_size; j++){ + uint8_t *source_data = (uint8_t*)channel_messages[i]->m_pData; + uint8_t *output_data = data.write().ptr(); + for (int j = 0; j < message_size; j++) { output_data[j] = source_data[j]; } message["payload"] = data; message["size"] = message_size; message["connection"] = channel_messages[i]->m_conn; - char identity[STEAM_BUFFER_SIZE]; - channel_messages[i]->m_identityPeer.ToString(identity, STEAM_BUFFER_SIZE); - message["identity"] = identity; + message["identity"] = getSteamIDFromIdentity(channel_messages[i]->m_identityPeer); message["receiver_user_data"] = (uint64_t)channel_messages[i]->m_nConnUserData; // Not used when sending messages message["time_received"] = (uint64_t)channel_messages[i]->m_usecTimeReceived; message["message_number"] = (uint64_t)channel_messages[i]->m_nMessageNumber; @@ -1597,108 +1649,95 @@ Array SteamServer::receiveMessagesOnChannel(int channel, int max_messages){ } // Sends a message to the specified host. If we don't already have a session with that user, a session is implicitly created. There might be some handshaking that needs to happen before we can actually begin sending message data. -int SteamServer::sendMessageToUser(const String& identity_reference, const PoolByteArray data, int flags, int channel){ - if(SteamNetworkingMessages() == NULL){ +int SteamServer::sendMessageToUser(uint64_t remote_steam_id, const PoolByteArray data, int flags, int channel) { + if (SteamNetworkingMessages() == NULL) { return 0; } - return SteamNetworkingMessages()->SendMessageToUser(networking_identities[identity_reference.utf8().get_data()], data.read().ptr(), data.size(), flags, channel); + return SteamNetworkingMessages()->SendMessageToUser(getIdentityFromSteamID(remote_steam_id), data.read().ptr(), data.size(), flags, channel); } -///////////////////////////////////////////////// ///// NETWORKING SOCKETS ///////////////////////////////////////////////// // // Creates a "server" socket that listens for clients to connect to by calling ConnectByIPAddress, over ordinary UDP (IPv4 or IPv6) -uint32 SteamServer::createListenSocketIP(const String& ip_reference, Array options){ - if(SteamNetworkingSockets() == NULL){ +uint32 SteamServer::createListenSocketIP(String ip_address, Array options) { + if (SteamNetworkingSockets() == NULL) { return 0; } - const SteamNetworkingConfigValue_t *these_options = convertOptionsArray(options); - uint32 listen_socket = SteamNetworkingSockets()->CreateListenSocketIP(ip_addresses[ip_reference.utf8().get_data()], options.size(), these_options); - delete[] these_options; + uint32 listen_socket = SteamNetworkingSockets()->CreateListenSocketIP(getSteamIPFromString(ip_address), options.size(), convertOptionsArray(options)); return listen_socket; } // Like CreateListenSocketIP, but clients will connect using ConnectP2P. The connection will be relayed through the Valve network. -uint32 SteamServer::createListenSocketP2P(int virtual_port, Array options){ - if(SteamNetworkingSockets() == NULL){ +uint32 SteamServer::createListenSocketP2P(int virtual_port, Array options) { + if (SteamNetworkingSockets() == NULL) { return 0; } - const SteamNetworkingConfigValue_t *these_options = convertOptionsArray(options); - uint32 listen_socket = SteamNetworkingSockets()->CreateListenSocketP2P(virtual_port, options.size(), these_options); - delete[] these_options; + uint32 listen_socket = SteamNetworkingSockets()->CreateListenSocketP2P(virtual_port, options.size(), convertOptionsArray(options)); return listen_socket; } // Begin connecting to a server that is identified using a platform-specific identifier. This uses the default rendezvous service, which depends on the platform and library configuration. (E.g. on Steam, it goes through the steam backend.) The traffic is relayed over the Steam Datagram Relay network. -uint32 SteamServer::connectP2P(const String& identity_reference, int virtual_port, Array options){ - if(SteamNetworkingSockets() == NULL){ +uint32 SteamServer::connectP2P(uint64_t remote_steam_id, int virtual_port, Array options) { + if (SteamNetworkingSockets() == NULL) { return 0; } - return SteamNetworkingSockets()->ConnectP2P(networking_identities[identity_reference.utf8().get_data()], virtual_port, sizeof(options), convertOptionsArray(options)); + return SteamNetworkingSockets()->ConnectP2P(getIdentityFromSteamID(remote_steam_id), virtual_port, sizeof(options), convertOptionsArray(options)); } // Begin connecting to a server listen socket that is identified using an [ip-address]:[port], i.e. 127.0.0.1:27015. Used with createListenSocketIP -uint32 SteamServer::connectByIPAddress(const String& ip_address_with_port, Array options){ - if(SteamNetworkingSockets() == NULL){ +uint32 SteamServer::connectByIPAddress(String ip_address_with_port, Array options) { + if (SteamNetworkingSockets() == NULL) { return 0; } - - SteamNetworkingIPAddr steamAddr; - steamAddr.Clear(); - steamAddr.ParseString(ip_address_with_port.utf8().get_data()); - - return SteamNetworkingSockets()->ConnectByIPAddress(steamAddr, options.size(), convertOptionsArray(options)); + return SteamNetworkingSockets()->ConnectByIPAddress(getSteamIPFromString(ip_address_with_port), options.size(), convertOptionsArray(options)); } // Client call to connect to a server hosted in a Valve data center, on the specified virtual port. You must have placed a ticket for this server into the cache, or else this connect attempt will fail! -uint32 SteamServer::connectToHostedDedicatedServer(const String& identity_reference, int virtual_port, Array options){ - if(SteamNetworkingSockets() == NULL){ +uint32 SteamServer::connectToHostedDedicatedServer(uint64_t remote_steam_id, int virtual_port, Array options) { + if (SteamNetworkingSockets() == NULL) { return 0; } - const SteamNetworkingConfigValue_t *these_options = convertOptionsArray(options); - uint32 listen_socket = SteamNetworkingSockets()->ConnectToHostedDedicatedServer(networking_identities[identity_reference.utf8().get_data()], virtual_port, options.size(), these_options); - delete[] these_options; + uint32 listen_socket = SteamNetworkingSockets()->ConnectToHostedDedicatedServer(getIdentityFromSteamID(remote_steam_id), virtual_port, options.size(), convertOptionsArray(options)); return listen_socket; } // Accept an incoming connection that has been received on a listen socket. -int SteamServer::acceptConnection(uint32 connection_handle){ - if(SteamNetworkingSockets() == NULL){ +int SteamServer::acceptConnection(uint32 connection_handle) { + if (SteamNetworkingSockets() == NULL) { return 0; } return SteamNetworkingSockets()->AcceptConnection((HSteamNetConnection)connection_handle); } // Disconnects from the remote host and invalidates the connection handle. Any unread data on the connection is discarded. -bool SteamServer::closeConnection(uint32 peer, int reason, const String& debug_message, bool linger){ - if(SteamNetworkingSockets() == NULL){ +bool SteamServer::closeConnection(uint32 peer, int reason, const String &debug_message, bool linger) { + if (SteamNetworkingSockets() == NULL) { return false; } return SteamNetworkingSockets()->CloseConnection((HSteamNetConnection)peer, reason, debug_message.utf8().get_data(), linger); } // Destroy a listen socket. All the connections that were accepted on the listen socket are closed ungracefully. -bool SteamServer::closeListenSocket(uint32 socket){ - if(SteamNetworkingSockets() == NULL){ +bool SteamServer::closeListenSocket(uint32 socket) { + if (SteamNetworkingSockets() == NULL) { return false; } return SteamNetworkingSockets()->CloseListenSocket((HSteamListenSocket)socket); } // Create a pair of connections that are talking to each other, e.g. a loopback connection. This is very useful for testing, or so that your client/server code can work the same even when you are running a local "server". -Dictionary SteamServer::createSocketPair(bool loopback, const String& identity_reference1, const String& identity_reference2){ +Dictionary SteamServer::createSocketPair(bool loopback, uint64_t remote_steam_id1, uint64_t remote_steam_id2) { // Create a dictionary to populate Dictionary connection_pair; - if(SteamNetworkingSockets() != NULL){ - // Turn the strings back to structs - Should be a check for failure to parse from string - const SteamNetworkingIdentity identity_struct1 = networking_identities[identity_reference1.utf8().get_data()]; - const SteamNetworkingIdentity identity_struct2 = networking_identities[identity_reference2.utf8().get_data()]; + if (SteamNetworkingSockets() != NULL) { // Get connections uint32 connection1 = 0; uint32 connection2 = 0; - bool success = SteamNetworkingSockets()->CreateSocketPair(&connection1, &connection2, loopback, &identity_struct1, &identity_struct2); + SteamNetworkingIdentity remote_identity1 = getIdentityFromSteamID(remote_steam_id1); + SteamNetworkingIdentity remote_identity2 = getIdentityFromSteamID(remote_steam_id2); + bool success = SteamNetworkingSockets()->CreateSocketPair(&connection1, &connection2, loopback, &remote_identity1, &remote_identity2); // Populate the dictionary connection_pair["success"] = success; connection_pair["connection1"] = connection1; @@ -1708,9 +1747,9 @@ Dictionary SteamServer::createSocketPair(bool loopback, const String& identity_r } // Send a message to the remote host on the specified connection. -Dictionary SteamServer::sendMessageToConnection(uint32 connection_handle, const PoolByteArray data, int flags){ +Dictionary SteamServer::sendMessageToConnection(uint32 connection_handle, const PoolByteArray data, int flags) { Dictionary message_response; - if(SteamNetworkingSockets() != NULL){ + if (SteamNetworkingSockets() != NULL) { int64 number; int result = SteamNetworkingSockets()->SendMessageToConnection((HSteamNetConnection)connection_handle, data.read().ptr(), data.size(), flags, &number); // Populate the dictionary @@ -1721,8 +1760,8 @@ Dictionary SteamServer::sendMessageToConnection(uint32 connection_handle, const } // Send one or more messages without copying the message payload. This is the most efficient way to send messages. To use this function, you must first allocate a message object using ISteamNetworkingUtils::AllocateMessage. (Do not declare one on the stack or allocate your own.) -void SteamServer::sendMessages(int messages, const PoolByteArray data, uint32 connection_handle, int flags){ - if(SteamNetworkingSockets() != NULL){ +void SteamServer::sendMessages(int messages, const PoolByteArray data, uint32 connection_handle, int flags) { + if (SteamNetworkingSockets() != NULL) { SteamNetworkingMessage_t *networkMessage; networkMessage = SteamNetworkingUtils()->AllocateMessage(0); networkMessage->m_pData = (void *)data.read().ptr(); @@ -1737,46 +1776,44 @@ void SteamServer::sendMessages(int messages, const PoolByteArray data, uint32 co } // Flush any messages waiting on the Nagle timer and send them at the next transmission opportunity (often that means right now). -int SteamServer::flushMessagesOnConnection(uint32 connection_handle){ - if(SteamNetworkingSockets() == NULL){ +int SteamServer::flushMessagesOnConnection(uint32 connection_handle) { + if (SteamNetworkingSockets() == NULL) { return 0; } return SteamNetworkingSockets()->FlushMessagesOnConnection((HSteamNetConnection)connection_handle); } // Fetch the next available message(s) from the connection, if any. Returns the number of messages returned into your array, up to nMaxMessages. If the connection handle is invalid, -1 is returned. If no data is available, 0, is returned. -Array SteamServer::receiveMessagesOnConnection(uint32 connection_handle, int max_messages){ +Array SteamServer::receiveMessagesOnConnection(uint32 connection_handle, int max_messages) { Array messages; - if(SteamNetworkingSockets() != NULL){ + if (SteamNetworkingSockets() != NULL) { // Allocate the space for the messages - SteamNetworkingMessage_t** connection_messages = new SteamNetworkingMessage_t*[max_messages]; + SteamNetworkingMessage_t **connection_messages = new SteamNetworkingMessage_t*[max_messages]; // Get the messages int available_messages = SteamNetworkingSockets()->ReceiveMessagesOnConnection((HSteamNetConnection)connection_handle, connection_messages, max_messages); // Loop through and create the messages as dictionaries then add to the messages array - for(int i = 0; i < available_messages; i++){ + for (int i = 0; i < available_messages; i++) { // Create the message dictionary to send back Dictionary message; // Get the message data int message_size = connection_messages[i]->m_cbSize; PoolByteArray data; data.resize(message_size); - uint8_t* source_data = (uint8_t*)connection_messages[i]->m_pData; - uint8_t* output_data = data.write().ptr(); - for(int j = 0; j < message_size; j++){ + uint8_t *source_data = (uint8_t*)connection_messages[i]->m_pData; + uint8_t *output_data = data.write().ptr(); + for (int j = 0; j < message_size; j++) { output_data[j] = source_data[j]; } message["payload"] = data; message["size"] = message_size; message["connection"] = connection_messages[i]->m_conn; - char identity[STEAM_BUFFER_SIZE]; - connection_messages[i]->m_identityPeer.ToString(identity, STEAM_BUFFER_SIZE); - message["identity"] = identity; - message["receiver_user_data"] = (uint64_t)connection_messages[i]->m_nConnUserData; // Not used when sending messages + message["identity"] = getSteamIDFromIdentity(connection_messages[i]->m_identityPeer); + message["receiver_user_data"] = (uint64_t)connection_messages[i]->m_nConnUserData; // Not used when sending messages message["time_received"] = (uint64_t)connection_messages[i]->m_usecTimeReceived; message["message_number"] = (uint64_t)connection_messages[i]->m_nMessageNumber; message["channel"] = connection_messages[i]->m_nChannel; message["flags"] = connection_messages[i]->m_nFlags; - message["sender_user_data"] = (uint64_t)connection_messages[i]->m_nUserData; // Not used when receiving messages + message["sender_user_data"] = (uint64_t)connection_messages[i]->m_nUserData; // Not used when receiving messages messages.append(message); // Release the message connection_messages[i]->Release(); @@ -1787,62 +1824,60 @@ Array SteamServer::receiveMessagesOnConnection(uint32 connection_handle, int max } // Create a new poll group. -uint32 SteamServer::createPollGroup(){ - if(SteamNetworkingSockets() == NULL){ +uint32 SteamServer::createPollGroup() { + if (SteamNetworkingSockets() == NULL) { return 0; } return SteamNetworkingSockets()->CreatePollGroup(); } // Destroy a poll group created with CreatePollGroup. -bool SteamServer::destroyPollGroup(uint32 poll_group){ - if(SteamNetworkingSockets() == NULL){ +bool SteamServer::destroyPollGroup(uint32 poll_group) { + if (SteamNetworkingSockets() == NULL) { return false; } return SteamNetworkingSockets()->DestroyPollGroup((HSteamNetPollGroup)poll_group); } // Assign a connection to a poll group. Note that a connection may only belong to a single poll group. Adding a connection to a poll group implicitly removes it from any other poll group it is in. -bool SteamServer::setConnectionPollGroup(uint32 connection_handle, uint32 poll_group){ - if(SteamNetworkingSockets() == NULL){ +bool SteamServer::setConnectionPollGroup(uint32 connection_handle, uint32 poll_group) { + if (SteamNetworkingSockets() == NULL) { return false; } return SteamNetworkingSockets()->SetConnectionPollGroup((HSteamNetConnection)connection_handle, (HSteamNetPollGroup)poll_group); } // Same as ReceiveMessagesOnConnection, but will return the next messages available on any connection in the poll group. Examine SteamNetworkingMessage_t::m_conn to know which connection. (SteamNetworkingMessage_t::m_nConnUserData might also be useful.) -Array SteamServer::receiveMessagesOnPollGroup(uint32 poll_group, int max_messages){ +Array SteamServer::receiveMessagesOnPollGroup(uint32 poll_group, int max_messages) { Array messages; - if(SteamNetworkingSockets() != NULL){ + if (SteamNetworkingSockets() != NULL) { // Allocate the space for the messages - SteamNetworkingMessage_t** poll_messages = new SteamNetworkingMessage_t*[max_messages]; + SteamNetworkingMessage_t **poll_messages = new SteamNetworkingMessage_t*[max_messages]; // Get the messages int available_messages = SteamNetworkingSockets()->ReceiveMessagesOnPollGroup((HSteamNetPollGroup)poll_group, poll_messages, max_messages); // Loop through and create the messages as dictionaries then add to the messages array - for(int i = 0; i < available_messages; i++){ + for (int i = 0; i < available_messages; i++) { // Create the message dictionary to send back Dictionary message; // Get the message data int message_size = poll_messages[i]->m_cbSize; PoolByteArray data; data.resize(message_size); - uint8_t* source_data = (uint8_t*)poll_messages[i]->m_pData; - uint8_t* output_data = data.write().ptr(); - for(int j = 0; j < message_size; j++){ + uint8_t *source_data = (uint8_t *)poll_messages[i]->m_pData; + uint8_t *output_data = data.write().ptr(); + for (int j = 0; j < message_size; j++) { output_data[j] = source_data[j]; } message["payload"] = data; message["size"] = message_size; message["connection"] = poll_messages[i]->m_conn; - char identity[STEAM_BUFFER_SIZE]; - poll_messages[i]->m_identityPeer.ToString(identity, STEAM_BUFFER_SIZE); - message["identity"] = identity; - message["receiver_user_data"] = (uint64_t)poll_messages[i]->m_nConnUserData; + message["identity"] = getSteamIDFromIdentity(poll_messages[i]->m_identityPeer); + message["receiver_user_data"] = (uint64_t)poll_messages[i]->m_nConnUserData; // Not used when sending messages message["time_received"] = (uint64_t)poll_messages[i]->m_usecTimeReceived; message["message_number"] = (uint64_t)poll_messages[i]->m_nMessageNumber; message["channel"] = poll_messages[i]->m_nChannel; message["flags"] = poll_messages[i]->m_nFlags; - message["sender_user_data"] = (uint64_t)poll_messages[i]->m_nUserData; + message["sender_user_data"] = (uint64_t)poll_messages[i]->m_nUserData; // Not used when receiving messages messages.append(message); // Release the message poll_messages[i]->Release(); @@ -1853,126 +1888,105 @@ Array SteamServer::receiveMessagesOnPollGroup(uint32 poll_group, int max_message } // Returns basic information about the high-level state of the connection. Returns false if the connection handle is invalid. -Dictionary SteamServer::getConnectionInfo(uint32 connection_handle){ +Dictionary SteamServer::getConnectionInfo(uint32 connection_handle) { Dictionary connection_info; - if(SteamNetworkingSockets() != NULL){ + if (SteamNetworkingSockets() != NULL) { SteamNetConnectionInfo_t info; - if(SteamNetworkingSockets()->GetConnectionInfo((HSteamNetConnection)connection_handle, &info)){ - char identity[STEAM_BUFFER_SIZE]; - info.m_identityRemote.ToString(identity, STEAM_BUFFER_SIZE); - connection_info["identity"] = identity; + if (SteamNetworkingSockets()->GetConnectionInfo((HSteamNetConnection)connection_handle, &info)) { + connection_info["identity"] = getSteamIDFromIdentity(info.m_identityRemote); connection_info["user_data"] = (uint64_t)info.m_nUserData; connection_info["listen_socket"] = info.m_hListenSocket; - char ip_address[STEAM_BUFFER_SIZE]; - info.m_addrRemote.ToString(ip_address, STEAM_BUFFER_SIZE, true); - connection_info["remote_address"] = ip_address; + connection_info["remote_address"] = getStringFromSteamIP(info.m_addrRemote); connection_info["remote_pop"] = info.m_idPOPRemote; connection_info["pop_relay"] = info.m_idPOPRelay; connection_info["connection_state"] = info.m_eState; connection_info["end_reason"] = info.m_eEndReason; connection_info["end_debug"] = info.m_szEndDebug; connection_info["debug_description"] = info.m_szConnectionDescription; + connection_info["info_flags"] = info.m_nFlags; } } return connection_info; } // Returns very detailed connection stats in diagnostic text format. Useful for dumping to a log, etc. The format of this information is subject to change. -Dictionary SteamServer::getDetailedConnectionStatus(uint32 connection){ - Dictionary connectionStatus; - if(SteamNetworkingSockets() != NULL){ +Dictionary SteamServer::getDetailedConnectionStatus(uint32 connection) { + Dictionary connection_status; + if (SteamNetworkingSockets() != NULL) { char buffer[STEAM_LARGE_BUFFER_SIZE]; int success = SteamNetworkingSockets()->GetDetailedConnectionStatus((HSteamNetConnection)connection, buffer, STEAM_LARGE_BUFFER_SIZE); // Add data to dictionary - connectionStatus["success"] = success; - connectionStatus["status"] = buffer; + connection_status["success"] = success; + connection_status["status"] = buffer; } // Send the data back to the user - return connectionStatus; + return connection_status; } // Fetch connection user data. Returns -1 if handle is invalid or if you haven't set any userdata on the connection. -uint64_t SteamServer::getConnectionUserData(uint32 peer){ - if(SteamNetworkingSockets() == NULL){ +uint64_t SteamServer::getConnectionUserData(uint32 peer) { + if (SteamNetworkingSockets() == NULL) { return 0; } return SteamNetworkingSockets()->GetConnectionUserData((HSteamNetConnection)peer); } // Set a name for the connection, used mostly for debugging -void SteamServer::setConnectionName(uint32 peer, const String& name){ - if(SteamNetworkingSockets() != NULL){ +void SteamServer::setConnectionName(uint32 peer, const String &name) { + if (SteamNetworkingSockets() != NULL) { SteamNetworkingSockets()->SetConnectionName((HSteamNetConnection)peer, name.utf8().get_data()); } } // Fetch connection name into your buffer, which is at least nMaxLen bytes. Returns false if handle is invalid. -String SteamServer::getConnectionName(uint32 peer){ +String SteamServer::getConnectionName(uint32 peer) { // Set empty string variable for use String connection_name = ""; - if(SteamNetworkingSockets() != NULL){ + if (SteamNetworkingSockets() != NULL) { char name[STEAM_BUFFER_SIZE]; - if(SteamNetworkingSockets()->GetConnectionName((HSteamNetConnection)peer, name, STEAM_BUFFER_SIZE)){ - connection_name += name; + if (SteamNetworkingSockets()->GetConnectionName((HSteamNetConnection)peer, name, STEAM_BUFFER_SIZE)) { + connection_name += name; } } return connection_name; } // Returns local IP and port that a listen socket created using CreateListenSocketIP is bound to. -String SteamServer::getListenSocketAddress(uint32 socket, bool with_port){ +String SteamServer::getListenSocketAddress(uint32 socket, bool with_port) { String socket_address = ""; - if(SteamNetworkingSockets() != NULL){ + if (SteamNetworkingSockets() != NULL) { SteamNetworkingIPAddr address; - if(SteamNetworkingSockets()->GetListenSocketAddress((HSteamListenSocket)socket, &address)){ - char *this_address = new char[48]; - address.ToString(this_address, 48, with_port); - socket_address = String(this_address); - delete[] this_address; + if (SteamNetworkingSockets()->GetListenSocketAddress((HSteamListenSocket)socket, &address)) { + socket_address = getStringFromSteamIP(address); } } return socket_address; } -// Get the identity assigned to this interface. -String SteamServer::getIdentity(){ - String identity_string = ""; - if(SteamNetworkingSockets() != NULL){ - SteamNetworkingIdentity this_identity; - if(SteamNetworkingSockets()->GetIdentity(&this_identity)){ - char *this_buffer = new char[128]; - this_identity.ToString(this_buffer, 128); - identity_string = String(this_buffer); - delete[] this_buffer; - } - } - return identity_string; -} - // Indicate our desire to be ready participate in authenticated communications. If we are currently not ready, then steps will be taken to obtain the necessary certificates. (This includes a certificate for us, as well as any CA certificates needed to authenticate peers.) -SteamServer::NetworkingAvailability SteamServer::initAuthentication(){ - if(SteamNetworkingSockets() == NULL){ +SteamServer::NetworkingAvailability SteamServer::initAuthentication() { + if (SteamNetworkingSockets() == NULL) { return NETWORKING_AVAILABILITY_UNKNOWN; } return NetworkingAvailability(SteamNetworkingSockets()->InitAuthentication()); } // Query our readiness to participate in authenticated communications. A SteamNetAuthenticationStatus_t callback is posted any time this status changes, but you can use this function to query it at any time. -SteamServer::NetworkingAvailability SteamServer::getAuthenticationStatus(){ - if(SteamNetworkingSockets() == NULL){ +SteamServer::NetworkingAvailability SteamServer::getAuthenticationStatus() { + if (SteamNetworkingSockets() == NULL) { return NETWORKING_AVAILABILITY_UNKNOWN; } return NetworkingAvailability(SteamNetworkingSockets()->GetAuthenticationStatus(NULL)); } // Call this when you receive a ticket from your backend / matchmaking system. Puts the ticket into a persistent cache, and optionally returns the parsed ticket. -//Dictionary SteamServer::receivedRelayAuthTicket(){ +//Dictionary SteamServer::receivedRelayAuthTicket() { // Dictionary ticket; -// if(SteamNetworkingSockets() != NULL){ +// if (SteamNetworkingSockets() != NULL) { // SteamDatagramRelayAuthTicket parsed_ticket; // PoolByteArray incoming_ticket; -// incoming_ticket.resize(512); -// if(SteamNetworkingSockets()->ReceivedRelayAuthTicket(incoming_ticket.write().ptr(), 512, &parsed_ticket)){ +// incoming_ticket.resize(512); +// if (SteamNetworkingSockets()->ReceivedRelayAuthTicket(incoming_ticket.write().ptr(), 512, &parsed_ticket)) { // char game_server; // parsed_ticket.m_identityGameserver.ToString(&game_server, 128); // ticket["game_server"] = game_server; @@ -1992,56 +2006,52 @@ SteamServer::NetworkingAvailability SteamServer::getAuthenticationStatus(){ //} // Search cache for a ticket to talk to the server on the specified virtual port. If found, returns the number of seconds until the ticket expires, and optionally the complete cracked ticket. Returns 0 if we don't have a ticket. -//int SteamServer::findRelayAuthTicketForServer(int port){ +//int SteamServer::findRelayAuthTicketForServer(int port) { // int expires_in_seconds = 0; -// if(SteamNetworkingSockets() != NULL){ +// if (SteamNetworkingSockets() != NULL) { // expires_in_seconds = SteamNetworkingSockets()->FindRelayAuthTicketForServer(game_server, port, &relay_auth_ticket); // } // return expires_in_seconds; //} - - // Returns the value of the SDR_LISTEN_PORT environment variable. This is the UDP server your server will be listening on. This will configured automatically for you in production environments. -uint16 SteamServer::getHostedDedicatedServerPort(){ - if(SteamNetworkingSockets() == NULL){ +uint16 SteamServer::getHostedDedicatedServerPort() { + if (SteamNetworkingSockets() == NULL) { return 0; } return SteamNetworkingSockets()->GetHostedDedicatedServerPort(); } // Returns 0 if SDR_LISTEN_PORT is not set. Otherwise, returns the data center the server is running in. This will be k_SteamDatagramPOPID_dev in non-production envirionment. -uint32 SteamServer::getHostedDedicatedServerPOPId(){ - if(SteamNetworkingSockets() == NULL){ +uint32 SteamServer::getHostedDedicatedServerPOPId() { + if (SteamNetworkingSockets() == NULL) { return 0; } return SteamNetworkingSockets()->GetHostedDedicatedServerPOPID(); } // Return info about the hosted server. This contains the PoPID of the server, and opaque routing information that can be used by the relays to send traffic to your server. -//int SteamServer::getHostedDedicatedServerAddress(){ +//int SteamServer::getHostedDedicatedServerAddress() { // int result = 2; -// if(SteamNetworkingSockets() != NULL){ +// if (SteamNetworkingSockets() != NULL) { // result = SteamNetworkingSockets()->GetHostedDedicatedServerAddress(&hosted_address); // } // return result; //} // Create a listen socket on the specified virtual port. The physical UDP port to use will be determined by the SDR_LISTEN_PORT environment variable. If a UDP port is not configured, this call will fail. -uint32 SteamServer::createHostedDedicatedServerListenSocket(int port, Array options){ - if(SteamNetworkingSockets() == NULL){ +uint32 SteamServer::createHostedDedicatedServerListenSocket(int port, Array options) { + if (SteamNetworkingSockets() == NULL) { return 0; } - const SteamNetworkingConfigValue_t *these_options = convertOptionsArray(options); - uint32 listen_socket = SteamGameServerNetworkingSockets()->CreateHostedDedicatedServerListenSocket(port, options.size(), these_options); - delete[] these_options; + uint32 listen_socket = SteamGameServerNetworkingSockets()->CreateHostedDedicatedServerListenSocket(port, options.size(), convertOptionsArray(options)); return listen_socket; } // Generate an authentication blob that can be used to securely login with your backend, using SteamDatagram_ParseHostedServerLogin. (See steamdatagram_gamecoordinator.h) -//int SteamServer::getGameCoordinatorServerLogin(const String& app_data){ +//int SteamServer::getGameCoordinatorServerLogin(const String &app_data) { // int result = 2; -// if(SteamNetworkingSockets() != NULL){ +// if (SteamNetworkingSockets() != NULL) { // SteamDatagramGameCoordinatorServerLogin *server_login = new SteamDatagramGameCoordinatorServerLogin; // server_login->m_cbAppData = app_data.size(); // strcpy(server_login->m_appData, app_data.utf8().get_data()); @@ -2054,20 +2064,20 @@ uint32 SteamServer::createHostedDedicatedServerListenSocket(int port, Array opti //} // Returns a small set of information about the real-time state of the connection and the queue status of each lane. -Dictionary SteamServer::getConnectionRealTimeStatus(uint32 connection, int lanes, bool get_status){ +Dictionary SteamServer::getConnectionRealTimeStatus(uint32 connection, int lanes, bool get_status) { // Create the dictionary for returning Dictionary real_time_status; - if(SteamNetworkingSockets() != NULL){ + if (SteamNetworkingSockets() != NULL) { SteamNetConnectionRealTimeStatus_t this_status; SteamNetConnectionRealTimeLaneStatus_t *lanes_array = new SteamNetConnectionRealTimeLaneStatus_t[lanes]; int result = SteamNetworkingSockets()->GetConnectionRealTimeStatus((HSteamNetConnection)connection, &this_status, lanes, lanes_array); // Append the status real_time_status["response"] = result; // If the result is good, get more data - if(result == 0){ + if (result == RESULT_OK) { // Get the connection status if requested Dictionary connection_status; - if(get_status){ + if (get_status) { connection_status["state"] = this_status.m_eState; connection_status["ping"] = this_status.m_nPing; connection_status["local_quality"] = this_status.m_flConnectionQualityLocal; @@ -2085,7 +2095,7 @@ Dictionary SteamServer::getConnectionRealTimeStatus(uint32 connection, int lanes real_time_status["connection_status"] = connection_status; // Get the lane information Array lanes_status; - for(int i = 0; i < lanes; i++){ + for (int i = 0; i < lanes; i++) { Dictionary lane_status; lane_status["pending_unreliable"] = lanes_array[i].m_cbPendingUnreliable; lane_status["pending_reliable"] = lanes_array[i].m_cbPendingReliable; @@ -2104,17 +2114,17 @@ Dictionary SteamServer::getConnectionRealTimeStatus(uint32 connection, int lanes // Messages within a given lane are always sent in the order they are queued, but messages from different lanes may be sent out of order. // Each lane has its own message number sequence. The first message sent on each lane will be assigned the number 1. int SteamServer::configureConnectionLanes(uint32 connection, int lanes, Array priorities, Array weights) { - if(SteamNetworkingSockets() == NULL){ + if (SteamNetworkingSockets() == NULL) { return 0; } // Convert the priorities array to an int int *lane_priorities = new int[lanes]; - for(int i = 0; i < lanes; i++){ + for (int i = 0; i < lanes; i++) { lane_priorities[i] = priorities[i]; } // Convert the weights array to an int uint16 *lane_weights = new uint16[lanes]; - for(int i = 0; i < lanes; i++){ + for (int i = 0; i < lanes; i++) { lane_weights[i] = weights[i]; } int result = SteamNetworkingSockets()->ConfigureConnectionLanes((HSteamNetConnection)connection, lanes, lane_priorities, lane_weights); @@ -2124,13 +2134,13 @@ int SteamServer::configureConnectionLanes(uint32 connection, int lanes, Array pr } // Certificate provision by the application. On Steam, we normally handle all this automatically and you will not need to use these advanced functions. -Dictionary SteamServer::getCertificateRequest(){ +Dictionary SteamServer::getCertificateRequest() { Dictionary cert_information; - if(SteamNetworkingSockets() != NULL){ + if (SteamNetworkingSockets() != NULL) { int *certificate = new int[512]; int cert_size = 0; SteamNetworkingErrMsg error_message; - if(SteamNetworkingSockets()->GetCertificateRequest(&cert_size, &certificate, error_message)){ + if (SteamNetworkingSockets()->GetCertificateRequest(&cert_size, &certificate, error_message)) { cert_information["certificate"] = certificate; cert_information["cert_size"] = cert_size; cert_information["error_message"] = error_message; @@ -2141,13 +2151,13 @@ Dictionary SteamServer::getCertificateRequest(){ } // Set the certificate. The certificate blob should be the output of SteamDatagram_CreateCert. -Dictionary SteamServer::setCertificate(const PoolByteArray& certificate){ +Dictionary SteamServer::setCertificate(const PoolByteArray &certificate) { Dictionary certificate_data; - if(SteamNetworkingSockets() != NULL){ + if (SteamNetworkingSockets() != NULL) { bool success = false; SteamNetworkingErrMsg error_message; - success = SteamNetworkingSockets()->SetCertificate((void*)certificate.read().ptr(), certificate.size(), error_message); - if(success){ + success = SteamNetworkingSockets()->SetCertificate((void *)certificate.read().ptr(), certificate.size(), error_message); + if (success) { certificate_data["response"] = success; certificate_data["error"] = error_message; } @@ -2158,18 +2168,18 @@ Dictionary SteamServer::setCertificate(const PoolByteArray& certificate){ // Reset the identity associated with this instance. Any open connections are closed. Any previous certificates, etc are discarded. // You can pass a specific identity that you want to use, or you can pass NULL, in which case the identity will be invalid until you set it using SetCertificate. // NOTE: This function is not actually supported on Steam! It is included for use on other platforms where the active user can sign out and a new user can sign in. -void SteamServer::resetIdentity(const String& identity_reference){ - if(SteamNetworkingSockets() != NULL){ - SteamNetworkingIdentity resetting_identity = networking_identities[identity_reference.utf8().get_data()]; +void SteamServer::resetIdentity(uint64_t remote_steam_id) { + if (SteamNetworkingSockets() != NULL) { + SteamNetworkingIdentity resetting_identity = getIdentityFromSteamID(remote_steam_id); SteamNetworkingSockets()->ResetIdentity(&resetting_identity); } } // Invoke all callback functions queued for this interface. See k_ESteamNetworkingConfig_Callback_ConnectionStatusChanged, etc. // You don't need to call this if you are using Steam's callback dispatch mechanism (SteamAPI_RunCallbacks and SteamGameserver_RunCallbacks). -void SteamServer::runNetworkingCallbacks(){ - if(SteamNetworkingSockets() != NULL){ - SteamNetworkingSockets()->RunCallbacks(); +void SteamServer::runNetworkingCallbacks() { + if (SteamNetworkingSockets() != NULL) { + SteamNetworkingSockets()->RunCallbacks(); } } @@ -2177,8 +2187,8 @@ void SteamServer::runNetworkingCallbacks(){ // IP addresses returned by this function are globally unique for a given appid. // Returns false if a request was already in progress, true if a new request was started. // A SteamNetworkingFakeIPResult_t will be posted when the request completes. -bool SteamServer::beginAsyncRequestFakeIP(int num_ports){ - if(SteamNetworkingSockets() == NULL){ +bool SteamServer::beginAsyncRequestFakeIP(int num_ports) { + if (SteamNetworkingSockets() == NULL) { return false; } return SteamNetworkingSockets()->BeginAsyncRequestFakeIP(num_ports); @@ -2186,18 +2196,18 @@ bool SteamServer::beginAsyncRequestFakeIP(int num_ports){ // Return info about the FakeIP and port(s) that we have been assigned, if any. // idxFirstPort is currently reserved and must be zero. Make sure and check SteamNetworkingFakeIPResult_t::m_eResult -Dictionary SteamServer::getFakeIP(int first_port){ +Dictionary SteamServer::getFakeIP(int first_port) { // Create the return dictionary Dictionary fake_ip; - if(SteamNetworkingSockets() != NULL){ + if (SteamNetworkingSockets() != NULL) { SteamNetworkingFakeIPResult_t fake_ip_result; SteamNetworkingSockets()->GetFakeIP(first_port, &fake_ip_result); // Populate the dictionary fake_ip["result"] = fake_ip_result.m_eResult; fake_ip["identity_type"] = fake_ip_result.m_identity.m_eType; - fake_ip["ip"] = fake_ip_result.m_unIP; + fake_ip["ip"] = getStringFromIP(fake_ip_result.m_unIP); char ports[8]; - for (size_t i = 0; i < sizeof(fake_ip_result.m_unPorts) / sizeof(fake_ip_result.m_unPorts[0]); i++){ + for (size_t i = 0; i < sizeof(fake_ip_result.m_unPorts) / sizeof(fake_ip_result.m_unPorts[0]); i++) { ports[i] = fake_ip_result.m_unPorts[i]; } fake_ip["ports"] = ports; @@ -2207,31 +2217,28 @@ Dictionary SteamServer::getFakeIP(int first_port){ // Create a listen socket that will listen for P2P connections sent to our FakeIP. // A peer can initiate connections to this listen socket by calling ConnectByIPAddress. -uint32 SteamServer::createListenSocketP2PFakeIP(int fake_port, Array options){ - if(SteamNetworkingSockets() == NULL){ +uint32 SteamServer::createListenSocketP2PFakeIP(int fake_port, Array options) { + if (SteamNetworkingSockets() == NULL) { return 0; } - - const SteamNetworkingConfigValue_t *these_options = convertOptionsArray(options); - uint32 listen_socket = SteamNetworkingSockets()->CreateListenSocketP2PFakeIP(fake_port, options.size(), these_options); - delete[] these_options; + uint32 listen_socket = SteamNetworkingSockets()->CreateListenSocketP2PFakeIP(fake_port, options.size(), convertOptionsArray(options)); return listen_socket; } // If the connection was initiated using the "FakeIP" system, then we we can get an IP address for the remote host. If the remote host had a global FakeIP at the time the connection was established, this function will return that global IP. // Otherwise, a FakeIP that is unique locally will be allocated from the local FakeIP address space, and that will be returned. -Dictionary SteamServer::getRemoteFakeIPForConnection(uint32 connection){ +Dictionary SteamServer::getRemoteFakeIPForConnection(uint32 connection) { // Create the return dictionary Dictionary this_fake_address; - if(SteamNetworkingSockets() != NULL){ + if (SteamNetworkingSockets() != NULL) { SteamNetworkingIPAddr fake_address; int result = SteamNetworkingSockets()->GetRemoteFakeIPForConnection((HSteamNetConnection)connection, &fake_address); // Send back the data this_fake_address["result"] = result; + this_fake_address["ip_address"] = getStringFromSteamIP(fake_address); this_fake_address["port"] = fake_address.m_port; this_fake_address["ip_type"] = fake_address.GetFakeIPType(); - ip_addresses["fake_ip_address"] = fake_address; - } + } return this_fake_address; } @@ -2239,340 +2246,42 @@ Dictionary SteamServer::getRemoteFakeIPForConnection(uint32 connection){ // Get an interface that can be used like a UDP port to send/receive datagrams to a FakeIP address. // This is intended to make it easy to port existing UDP-based code to take advantage of SDR. // To create a "client" port (e.g. the equivalent of an ephemeral UDP port) pass -1. -void SteamServer::createFakeUDPPort(int fake_server_port_index){ - if(SteamNetworkingSockets() != NULL){ +void SteamServer::createFakeUDPPort(int fake_server_port_index) { + if (SteamNetworkingSockets() != NULL) { SteamNetworkingSockets()->CreateFakeUDPPort(fake_server_port_index); } } -///////////////////////////////////////////////// -///// NETWORKING TYPES -///////////////////////////////////////////////// -// -// Create a new network identity and store it for use -bool SteamServer::addIdentity(const String& reference_name){ - networking_identities[reference_name.utf8().get_data()] = SteamNetworkingIdentity(); - if(networking_identities.count(reference_name.utf8().get_data()) > 0){ - return true; - } - return false; -} - -// Clear a network identity's data -void SteamServer::clearIdentity(const String& reference_name){ - networking_identities[reference_name.utf8().get_data()].Clear(); -} - - -// Get a list of all known network identities -Array SteamServer::getIdentities(){ - Array these_identities; - // Loop through the map - for(auto& identity : networking_identities){ - Dictionary this_identity; - this_identity["reference_name"] = identity.first; - this_identity["steam_id"] = (uint64_t)getIdentitySteamID64(identity.first); - this_identity["type"] = networking_identities[identity.first].m_eType; - these_identities.append(this_identity); - } - return these_identities; -} - - -// Return true if we are the invalid type. Does not make any other validity checks (e.g. is SteamID actually valid) -bool SteamServer::isIdentityInvalid(const String& reference_name){ - return networking_identities[reference_name.utf8().get_data()].IsInvalid(); -} - -// Set a 32-bit Steam ID -void SteamServer::setIdentitySteamID(const String& reference_name, uint32 steam_id){ - networking_identities[reference_name.utf8().get_data()].SetSteamID(createSteamID(steam_id)); -} - -// Return CSteamID (!IsValid()) if identity is not a SteamID -uint32 SteamServer::getIdentitySteamID(const String& reference_name){ - CSteamID steam_id = networking_identities[reference_name.utf8().get_data()].GetSteamID(); - return steam_id.ConvertToUint64(); -} - -// Takes SteamID as raw 64-bit number -void SteamServer::setIdentitySteamID64(const String& reference_name, uint64_t steam_id){ - networking_identities[reference_name.utf8().get_data()].SetSteamID64(steam_id); -} - -// Returns 0 if identity is not SteamID -uint64_t SteamServer::getIdentitySteamID64(const String& reference_name){ - return networking_identities[reference_name.utf8().get_data()].GetSteamID64(); -} - -// Set to specified IP:port. -bool SteamServer::setIdentityIPAddr(const String& reference_name, const String& ip_address_name){ - if(ip_addresses.count(ip_address_name.utf8().get_data()) > 0){ - const SteamNetworkingIPAddr this_address = ip_addresses[ip_address_name.utf8().get_data()]; - networking_identities[reference_name.utf8().get_data()].SetIPAddr(this_address); - return true; - } - return false; -} - -// Returns null if we are not an IP address. -uint32 SteamServer::getIdentityIPAddr(const String& reference_name){ - const SteamNetworkingIPAddr* this_address = networking_identities[reference_name.utf8().get_data()].GetIPAddr(); - if (this_address == NULL){ - return 0; - } - return this_address->GetIPv4(); -} - -// Retrieve this identity's Playstation Network ID. -uint64_t SteamServer::getPSNID(const String& reference_name){ - return networking_identities[reference_name.utf8().get_data()].GetPSNID(); -} - -// Retrieve this identity's Google Stadia ID. -uint64_t SteamServer::getStadiaID(const String& reference_name){ - return networking_identities[reference_name.utf8().get_data()].GetStadiaID(); -} - -// Retrieve this identity's XBox pair ID. -String SteamServer::getXboxPairwiseID(const String& reference_name){ - return networking_identities[reference_name.utf8().get_data()].GetXboxPairwiseID(); -} - -// Set to localhost. (We always use IPv6 ::1 for this, not 127.0.0.1). -void SteamServer::setIdentityLocalHost(const String& reference_name){ - networking_identities[reference_name.utf8().get_data()].SetLocalHost(); -} - -// Return true if this identity is localhost. -bool SteamServer::isIdentityLocalHost(const String& reference_name){ - return networking_identities[reference_name.utf8().get_data()].IsLocalHost(); -} - -// Returns false if invalid length. -bool SteamServer::setGenericString(const String& reference_name, const String& this_string){ - return networking_identities[reference_name.utf8().get_data()].SetGenericString(this_string.utf8().get_data()); -} - -// Returns nullptr if not generic string type -String SteamServer::getGenericString(const String& reference_name){ - return networking_identities[reference_name.utf8().get_data()].GetGenericString(); -} - -// Returns false if invalid size. -bool SteamServer::setGenericBytes(const String& reference_name, uint8 data){ - const void *this_data = &data; - return networking_identities[reference_name.utf8().get_data()].SetGenericBytes(this_data, sizeof(data)); -} - -// Returns null if not generic bytes type. -uint8 SteamServer::getGenericBytes(const String& reference_name){ - uint8 these_bytes = 0; - if(!reference_name.empty()){ - int length = 0; - const uint8* generic_bytes = networking_identities[reference_name.utf8().get_data()].GetGenericBytes(length); - these_bytes = *generic_bytes; - } - return these_bytes; -} - -// Add a new IP address struct -bool SteamServer::addIPAddress(const String& reference_name){ - ip_addresses[reference_name.utf8().get_data()] = SteamNetworkingIPAddr(); - if(ip_addresses.count(reference_name.utf8().get_data()) > 0){ - return true; - } - return false; -} - -// Get a list of all IP address structs and their names -Array SteamServer::getIPAddresses(){ - Array these_addresses; - // Loop through the map - for(auto& address : ip_addresses){ - Dictionary this_address; - this_address["reference_name"] = address.first; - this_address["localhost"] = isAddressLocalHost(address.first); - this_address["ip_address"] = getIPv4(address.first); - these_addresses.append(this_address); - } - return these_addresses; -} - -// IP Address - Set everything to zero. E.g. [::]:0 -void SteamServer::clearIPAddress(const String& reference_name){ - ip_addresses[reference_name.utf8().get_data()].Clear(); -} - -// Return true if the IP is ::0. (Doesn't check port.) -bool SteamServer::isIPv6AllZeros(const String& reference_name){ - return ip_addresses[reference_name.utf8().get_data()].IsIPv6AllZeros(); -} - -// Set IPv6 address. IP is interpreted as bytes, so there are no endian issues. (Same as inaddr_in6.) The IP can be a mapped IPv4 address. -void SteamServer::setIPv6(const String& reference_name, uint8 ipv6, uint16 port){ - const uint8 *this_ipv6 = &ipv6; - ip_addresses[reference_name.utf8().get_data()].SetIPv6(this_ipv6, port); -} - -// Sets to IPv4 mapped address. IP and port are in host byte order. -void SteamServer::setIPv4(const String& reference_name, uint32 ip, uint16 port){ - ip_addresses[reference_name.utf8().get_data()].SetIPv4(ip, port); -} - -// Return true if IP is mapped IPv4. -bool SteamServer::isIPv4(const String& reference_name){ - return ip_addresses[reference_name.utf8().get_data()].IsIPv4(); -} - -// Returns IP in host byte order (e.g. aa.bb.cc.dd as 0xaabbccdd). Returns 0 if IP is not mapped IPv4. -uint32 SteamServer::getIPv4(const String& reference_name){ - return ip_addresses[reference_name.utf8().get_data()].GetIPv4(); -} - -// Set to the IPv6 localhost address ::1, and the specified port. -void SteamServer::setIPv6LocalHost(const String& reference_name, uint16 port){ - ip_addresses[reference_name.utf8().get_data()].SetIPv6LocalHost(port); -} - -// Set the Playstation Network ID for this identity. -void SteamServer::setPSNID(const String& reference_name, uint64_t psn_id){ - networking_identities[reference_name.utf8().get_data()].SetPSNID(psn_id); -} - -// Set the Google Stadia ID for this identity. -void SteamServer::setStadiaID(const String& reference_name, uint64_t stadia_id){ - networking_identities[reference_name.utf8().get_data()].SetStadiaID(stadia_id); -} - -// Set the Xbox Pairwise ID for this identity. -bool SteamServer::setXboxPairwiseID(const String& reference_name, const String& xbox_id){ - return networking_identities[reference_name.utf8().get_data()].SetXboxPairwiseID(xbox_id.utf8().get_data()); -} - -// Return true if this identity is localhost. (Either IPv6 ::1, or IPv4 127.0.0.1). -bool SteamServer::isAddressLocalHost(const String& reference_name){ - return ip_addresses[reference_name.utf8().get_data()].IsLocalHost(); -} - -// Parse back a string that was generated using ToString. If we don't understand the string, but it looks "reasonable" (it matches the pattern type: and doesn't have any funky characters, etc), then we will return true, and the type is set to k_ESteamNetworkingIdentityType_UnknownType. -// false will only be returned if the string looks invalid. -bool SteamServer::parseIdentityString(const String& reference_name, const String& string_to_parse){ - if(!reference_name.empty() && !string_to_parse.empty()){ - if(networking_identities[reference_name.utf8().get_data()].ParseString(string_to_parse.utf8().get_data())){ - return true; - } - return false; - } - return false; -} - -// Parse an IP address and optional port. If a port is not present, it is set to 0. (This means that you cannot tell if a zero port was explicitly specified.). -bool SteamServer::parseIPAddressString(const String& reference_name, const String& string_to_parse){ - if(!reference_name.empty() && !string_to_parse.empty()){ - if(ip_addresses[reference_name.utf8().get_data()].ParseString(string_to_parse.utf8().get_data())){ - return true; - } - return false; - } - return false; -} - -// Print to a string, with or without the port. Mapped IPv4 addresses are printed as dotted decimal (12.34.56.78), otherwise this will print the canonical form according to RFC5952. -// If you include the port, IPv6 will be surrounded by brackets, e.g. [::1:2]:80. Your buffer should be at least k_cchMaxString bytes to avoid truncation. -String SteamServer::toIPAddressString(const String& reference_name, bool with_port){ - String ip_address_string = ""; - char *this_buffer = new char[128]; - ip_addresses[reference_name.utf8().get_data()].ToString(this_buffer, 128, with_port); - ip_address_string = String(this_buffer); - delete[] this_buffer; - return ip_address_string; -} - -// Print to a human-readable string. This is suitable for debug messages or any other time you need to encode the identity as a string. -// It has a URL-like format (type:). Your buffer should be at least k_cchMaxString bytes big to avoid truncation. -String SteamServer::toIdentityString(const String& reference_name){ - String identity_string = ""; - char *this_buffer = new char[128]; - networking_identities[reference_name.utf8().get_data()].ToString(this_buffer, 128); - identity_string = String(this_buffer); - delete[] this_buffer; - return identity_string; -} - -// Helper function to turn an array of options into an array of SteamNetworkingConfigValue_t structs -const SteamNetworkingConfigValue_t* SteamServer::convertOptionsArray(Array options){ - // Get the number of option arrays in the array. - int options_size = options.size(); - // Create the array for options. - SteamNetworkingConfigValue_t *option_array = new SteamNetworkingConfigValue_t[options_size]; - // If there are options - if(options_size > 0){ - // Populate the options - for(int i = 0; i < options_size; i++){ - SteamNetworkingConfigValue_t this_option; - Array sent_option = options[i]; - // Get the configuration value. - // This is a convoluted way of doing it but can't seem to cast the value as an enum so here we are. - ESteamNetworkingConfigValue this_value = ESteamNetworkingConfigValue((int)sent_option[0]); - if((int)sent_option[1] == 1){ - this_option.SetInt32(this_value, sent_option[2]); - } - else if((int)sent_option[1] == 2){ - this_option.SetInt64(this_value, sent_option[2]); - } - else if((int)sent_option[1] == 3){ - this_option.SetFloat(this_value, sent_option[2]); - } - else if((int)sent_option[1] == 4){ - char *this_string = { 0 }; - String passed_string = sent_option[2]; - strcpy(this_string, passed_string.utf8().get_data()); - this_option.SetString(this_value, this_string); - } - else{ - Object *this_pointer; - this_pointer = sent_option[2]; - this_option.SetPtr(this_value, this_pointer); - } - option_array[i] = this_option; - } - } - return option_array; -} - - -///////////////////////////////////////////////// ///// NETWORKING UTILS ///////////////////////////////////////////////// // // If you know that you are going to be using the relay network (for example, because you anticipate making P2P connections), call this to initialize the relay network. If you do not call this, the initialization will be delayed until the first time you use a feature that requires access to the relay network, which will delay that first access. -void SteamServer::initRelayNetworkAccess(){ - if(SteamNetworkingUtils() != NULL){ +void SteamServer::initRelayNetworkAccess() { + if (SteamNetworkingUtils() != NULL) { SteamNetworkingUtils()->InitRelayNetworkAccess(); } } // Fetch current status of the relay network. If you want more details, you can pass a non-NULL value. -SteamServer::NetworkingAvailability SteamServer::getRelayNetworkStatus(){ - if(SteamNetworkingUtils() == NULL){ +SteamServer::NetworkingAvailability SteamServer::getRelayNetworkStatus() { + if (SteamNetworkingUtils() == NULL) { return NETWORKING_AVAILABILITY_UNKNOWN; } return NetworkingAvailability(SteamNetworkingUtils()->GetRelayNetworkStatus(NULL)); } // Return location info for the current host. Returns the approximate age of the data, in seconds, or -1 if no data is available. -Dictionary SteamServer::getLocalPingLocation(){ +Dictionary SteamServer::getLocalPingLocation() { Dictionary ping_location; - if(SteamNetworkingUtils() != NULL){ + if (SteamNetworkingUtils() != NULL) { SteamNetworkPingLocation_t location; float age = SteamNetworkingUtils()->GetLocalPingLocation(location); // Populate the dictionary PoolByteArray data; data.resize(512); - uint8_t* output_data = data.write().ptr(); - for(int j = 0; j < 512; j++){ + uint8_t *output_data = data.write().ptr(); + for (int j = 0; j < 512; j++) { output_data[j] = location.m_data[j]; } ping_location["age"] = age; @@ -2582,47 +2291,47 @@ Dictionary SteamServer::getLocalPingLocation(){ } // Estimate the round-trip latency between two arbitrary locations, in milliseconds. This is a conservative estimate, based on routing through the relay network. For most basic relayed connections, this ping time will be pretty accurate, since it will be based on the route likely to be actually used. -int SteamServer::estimatePingTimeBetweenTwoLocations(PoolByteArray location1, PoolByteArray location2){ - if(SteamNetworkingUtils() == NULL){ +int SteamServer::estimatePingTimeBetweenTwoLocations(PoolByteArray location1, PoolByteArray location2) { + if (SteamNetworkingUtils() == NULL) { return 0; } // Add these locations to ping structs SteamNetworkPingLocation_t ping_location1; SteamNetworkPingLocation_t ping_location2; - uint8_t* input_location_1 = (uint8*) location1.read().ptr(); - for(int j = 0; j < 512; j++){ + uint8_t *input_location_1 = (uint8*)location1.read().ptr(); + for (int j = 0; j < 512; j++) { ping_location1.m_data[j] = input_location_1[j]; } - uint8_t* input_location_2 = (uint8*) location2.read().ptr(); - for(int j = 0; j < 512; j++){ - ping_location2.m_data[j] = (uint8) input_location_2[j]; + uint8_t *input_location_2 = (uint8*)location2.read().ptr(); + for (int j = 0; j < 512; j++) { + ping_location2.m_data[j] = (uint8)input_location_2[j]; } return SteamNetworkingUtils()->EstimatePingTimeBetweenTwoLocations(ping_location1, ping_location2); } // Same as EstimatePingTime, but assumes that one location is the local host. This is a bit faster, especially if you need to calculate a bunch of these in a loop to find the fastest one. -int SteamServer::estimatePingTimeFromLocalHost(PoolByteArray location){ - if(SteamNetworkingUtils() == NULL){ +int SteamServer::estimatePingTimeFromLocalHost(PoolByteArray location) { + if (SteamNetworkingUtils() == NULL) { return 0; } // Add this location to ping struct SteamNetworkPingLocation_t ping_location; - uint8_t* input_location = (uint8*) location.read().ptr(); - for(int j = 0; j < 512; j++){ + uint8_t *input_location = (uint8*)location.read().ptr(); + for (int j = 0; j < 512; j++) { ping_location.m_data[j] = input_location[j]; } return SteamNetworkingUtils()->EstimatePingTimeFromLocalHost(ping_location); } // Convert a ping location into a text format suitable for sending over the wire. The format is a compact and human readable. However, it is subject to change so please do not parse it yourself. Your buffer must be at least k_cchMaxSteamNetworkingPingLocationString bytes. -String SteamServer::convertPingLocationToString(PoolByteArray location){ +String SteamServer::convertPingLocationToString(PoolByteArray location) { String location_string = ""; - if(SteamNetworkingUtils() != NULL){ + if (SteamNetworkingUtils() != NULL) { char *buffer = new char[512]; // Add this location to ping struct SteamNetworkPingLocation_t ping_location; - uint8_t* input_location = (uint8*) location.read().ptr(); - for(int j = 0; j < 512; j++){ + uint8_t *input_location = (uint8*)location.read().ptr(); + for (int j = 0; j < 512; j++) { ping_location.m_data[j] = input_location[j]; } SteamNetworkingUtils()->ConvertPingLocationToString(ping_location, buffer, k_cchMaxSteamNetworkingPingLocationString); @@ -2633,16 +2342,16 @@ String SteamServer::convertPingLocationToString(PoolByteArray location){ } // Parse back SteamNetworkPingLocation_t string. Returns false if we couldn't understand the string. -Dictionary SteamServer::parsePingLocationString(const String& location_string){ +Dictionary SteamServer::parsePingLocationString(const String &location_string) { Dictionary parse_string; - if(SteamNetworkingUtils() != NULL){ + if (SteamNetworkingUtils() != NULL) { SteamNetworkPingLocation_t result; bool success = SteamNetworkingUtils()->ParsePingLocationString(location_string.utf8().get_data(), result); // Populate the dictionary PoolByteArray data; data.resize(512); - uint8_t* output_data = data.write().ptr(); - for(int j = 0; j < 512; j++){ + uint8_t *output_data = data.write().ptr(); + for (int j = 0; j < 512; j++) { output_data[j] = result.m_data[j]; } parse_string["success"] = success; @@ -2652,17 +2361,17 @@ Dictionary SteamServer::parsePingLocationString(const String& location_string){ } // Check if the ping data of sufficient recency is available, and if it's too old, start refreshing it. -bool SteamServer::checkPingDataUpToDate(float max_age_in_seconds){ - if(SteamNetworkingUtils() == NULL){ +bool SteamServer::checkPingDataUpToDate(float max_age_in_seconds) { + if (SteamNetworkingUtils() == NULL) { return false; } return SteamNetworkingUtils()->CheckPingDataUpToDate(max_age_in_seconds); } // Fetch ping time of best available relayed route from this host to the specified data center. -Dictionary SteamServer::getPingToDataCenter(uint32 pop_id){ +Dictionary SteamServer::getPingToDataCenter(uint32 pop_id) { Dictionary data_center_ping; - if(SteamNetworkingUtils() != NULL){ + if (SteamNetworkingUtils() != NULL) { SteamNetworkingPOPID via_relay_pop; int ping = SteamNetworkingUtils()->GetPingToDataCenter((SteamNetworkingPOPID)pop_id, &via_relay_pop); // Populate the dictionary @@ -2673,29 +2382,29 @@ Dictionary SteamServer::getPingToDataCenter(uint32 pop_id){ } // Get *direct* ping time to the relays at the point of presence. -int SteamServer::getDirectPingToPOP(uint32 pop_id){ - if(SteamNetworkingUtils() == NULL){ +int SteamServer::getDirectPingToPOP(uint32 pop_id) { + if (SteamNetworkingUtils() == NULL) { return 0; } return SteamNetworkingUtils()->GetDirectPingToPOP((SteamNetworkingPOPID)pop_id); } // Get number of network points of presence in the config -int SteamServer::getPOPCount(){ - if(SteamNetworkingUtils() == NULL){ +int SteamServer::getPOPCount() { + if (SteamNetworkingUtils() == NULL) { return 0; } return SteamNetworkingUtils()->GetPOPCount(); } // Get list of all POP IDs. Returns the number of entries that were filled into your list. -Array SteamServer::getPOPList(){ +Array SteamServer::getPOPList() { Array pop_list; - if(SteamNetworkingUtils() != NULL){ + if (SteamNetworkingUtils() != NULL) { SteamNetworkingPOPID *list = new SteamNetworkingPOPID[256]; int pops = SteamNetworkingUtils()->GetPOPList(list, 256); // Iterate and add - for(int i = 0; i < pops; i++){ + for (int i = 0; i < pops; i++) { int pop_id = list[i]; pop_list.append(pop_id); } @@ -2705,17 +2414,17 @@ Array SteamServer::getPOPList(){ } // Set a configuration value. -//bool SteamServer::setConfigValue(int setting, int scope_type, uint32_t connection_handle, int data_type, auto value){ -// if(SteamNetworkingUtils() == NULL){ +//bool SteamServer::setConfigValue(int setting, int scope_type, uint32_t connection_handle, int data_type, auto value) { +// if (SteamNetworkingUtils() == NULL) { // return false; // } // return SteamNetworkingUtils()->SetConfigValue((ESteamNetworkingConfigValue)setting, (ESteamNetworkingConfigScope)scope_type, connection_handle, (ESteamNetworkingConfigDataType)data_type, value); //} // Get a configuration value. -Dictionary SteamServer::getConfigValue(NetworkingConfigValue config_value, NetworkingConfigScope scope_type, uint32_t connection_handle){ +Dictionary SteamServer::getConfigValue(NetworkingConfigValue config_value, NetworkingConfigScope scope_type, uint32_t connection_handle) { Dictionary config_info; - if(SteamNetworkingUtils() != NULL){ + if (SteamNetworkingUtils() != NULL) { ESteamNetworkingConfigDataType data_type; size_t buffer_size; PoolByteArray config_result; @@ -2730,12 +2439,12 @@ Dictionary SteamServer::getConfigValue(NetworkingConfigValue config_value, Netwo } // Returns info about a configuration value. -Dictionary SteamServer::getConfigValueInfo(NetworkingConfigValue config_value){ +Dictionary SteamServer::getConfigValueInfo(NetworkingConfigValue config_value) { Dictionary config_info; - if(SteamNetworkingUtils() != NULL){ + if (SteamNetworkingUtils() != NULL) { ESteamNetworkingConfigDataType data_type; ESteamNetworkingConfigScope scope; - if(SteamNetworkingUtils()->GetConfigValueInfo((ESteamNetworkingConfigValue)config_value, &data_type, &scope)){ + if (SteamNetworkingUtils()->GetConfigValueInfo((ESteamNetworkingConfigValue)config_value, &data_type, &scope)) { // Populate the dictionary config_info["type"] = data_type; config_info["scope"] = scope; @@ -2745,61 +2454,60 @@ Dictionary SteamServer::getConfigValueInfo(NetworkingConfigValue config_value){ } // The following functions are handy shortcuts for common use cases. -bool SteamServer::setGlobalConfigValueInt32(NetworkingConfigValue config, int32 value){ - if(SteamNetworkingUtils() == NULL){ +bool SteamServer::setGlobalConfigValueInt32(NetworkingConfigValue config, int32 value) { + if (SteamNetworkingUtils() == NULL) { return false; } return SteamNetworkingUtils()->SetGlobalConfigValueInt32((ESteamNetworkingConfigValue)config, value); } -bool SteamServer::setGlobalConfigValueFloat(NetworkingConfigValue config, float value){ - if(SteamNetworkingUtils() == NULL){ +bool SteamServer::setGlobalConfigValueFloat(NetworkingConfigValue config, float value) { + if (SteamNetworkingUtils() == NULL) { return false; } return SteamNetworkingUtils()->SetGlobalConfigValueFloat((ESteamNetworkingConfigValue)config, value); } -bool SteamServer::setGlobalConfigValueString(NetworkingConfigValue config, const String& value){ - if(SteamNetworkingUtils() == NULL){ +bool SteamServer::setGlobalConfigValueString(NetworkingConfigValue config, const String &value) { + if (SteamNetworkingUtils() == NULL) { return false; } return SteamNetworkingUtils()->SetGlobalConfigValueString((ESteamNetworkingConfigValue)config, value.utf8().get_data()); } -bool SteamServer::setConnectionConfigValueInt32(uint32 connection, NetworkingConfigValue config, int32 value){ - if(SteamNetworkingUtils() == NULL){ +bool SteamServer::setConnectionConfigValueInt32(uint32 connection, NetworkingConfigValue config, int32 value) { + if (SteamNetworkingUtils() == NULL) { return false; } return SteamNetworkingUtils()->SetConnectionConfigValueInt32(connection, (ESteamNetworkingConfigValue)config, value); } -bool SteamServer::setConnectionConfigValueFloat(uint32 connection, NetworkingConfigValue config, float value){ - if(SteamNetworkingUtils() == NULL){ +bool SteamServer::setConnectionConfigValueFloat(uint32 connection, NetworkingConfigValue config, float value) { + if (SteamNetworkingUtils() == NULL) { return false; } return SteamNetworkingUtils()->SetConnectionConfigValueFloat(connection, (ESteamNetworkingConfigValue)config, value); } -bool SteamServer::setConnectionConfigValueString(uint32 connection, NetworkingConfigValue config, const String& value){ - if(SteamNetworkingUtils() == NULL){ +bool SteamServer::setConnectionConfigValueString(uint32 connection, NetworkingConfigValue config, const String &value) { + if (SteamNetworkingUtils() == NULL) { return false; } return SteamNetworkingUtils()->SetConnectionConfigValueString(connection, (ESteamNetworkingConfigValue)config, value.utf8().get_data()); } // A general purpose high resolution local timer with the following properties: Monotonicity is guaranteed. The initial value will be at least 24*3600*30*1e6, i.e. about 30 days worth of microseconds. In this way, the timestamp value of 0 will always be at least "30 days ago". Also, negative numbers will never be returned. Wraparound / overflow is not a practical concern. -uint64_t SteamServer::getLocalTimestamp(){ - if(SteamNetworkingUtils() == NULL){ +uint64_t SteamServer::getLocalTimestamp() { + if (SteamNetworkingUtils() == NULL) { return 0; } return SteamNetworkingUtils()->GetLocalTimestamp(); } -///////////////////////////////////////////////// ///// UGC ///////////////////////////////////////////////// // // Adds a dependency between the given item and the appid. This list of dependencies can be retrieved by calling GetAppDependencies. // This is a soft-dependency that is displayed on the web. It is up to the application to determine whether the item can actually be used or not. -void SteamServer::addAppDependency(uint64_t published_file_id, uint32_t app_id){ - if(SteamUGC() != NULL){ +void SteamServer::addAppDependency(uint64_t published_file_id, uint32_t app_id) { + if (SteamUGC() != NULL) { PublishedFileId_t file_id = (uint64_t)published_file_id; AppId_t app = (uint32_t)app_id; SteamAPICall_t api_call = SteamUGC()->AddAppDependency(file_id, app); @@ -2807,8 +2515,8 @@ void SteamServer::addAppDependency(uint64_t published_file_id, uint32_t app_id){ } } -bool SteamServer::addContentDescriptor(uint64_t update_handle, int descriptor_id){ - if(SteamUGC() == NULL){ +bool SteamServer::addContentDescriptor(uint64_t update_handle, int descriptor_id) { + if (SteamUGC() == NULL) { return false; } return SteamUGC()->AddContentDescriptor((UGCUpdateHandle_t)update_handle, (EUGCContentDescriptorID)descriptor_id); @@ -2816,8 +2524,8 @@ bool SteamServer::addContentDescriptor(uint64_t update_handle, int descriptor_id // Adds a workshop item as a dependency to the specified item. If the nParentPublishedFileID item is of type k_EWorkshopFileTypeCollection, than the nChildPublishedFileID is simply added to that collection. // Otherwise, the dependency is a soft one that is displayed on the web and can be retrieved via the ISteamUGC API using a combination of the m_unNumChildren member variable of the SteamUGCDetails_t struct and GetQueryUGCChildren. -void SteamServer::addDependency(uint64_t published_file_id, uint64_t child_published_file_id){ - if(SteamUGC() != NULL){ +void SteamServer::addDependency(uint64_t published_file_id, uint64_t child_published_file_id) { + if (SteamUGC() != NULL) { PublishedFileId_t parent = (uint64_t)published_file_id; PublishedFileId_t child = (uint64_t)child_published_file_id; SteamAPICall_t api_call = SteamUGC()->AddDependency(parent, child); @@ -2826,8 +2534,8 @@ void SteamServer::addDependency(uint64_t published_file_id, uint64_t child_publi } // Adds a excluded tag to a pending UGC Query. This will only return UGC without the specified tag. -bool SteamServer::addExcludedTag(uint64_t query_handle, const String& tag_name){ - if(SteamUGC() == NULL){ +bool SteamServer::addExcludedTag(uint64_t query_handle, const String &tag_name) { + if (SteamUGC() == NULL) { return false; } UGCQueryHandle_t handle = (uint64_t)query_handle; @@ -2835,8 +2543,8 @@ bool SteamServer::addExcludedTag(uint64_t query_handle, const String& tag_name){ } // Adds a key-value tag pair to an item. Keys can map to multiple different values (1-to-many relationship). -bool SteamServer::addItemKeyValueTag(uint64_t update_handle, const String& key, const String& value){ - if(SteamUGC() == NULL){ +bool SteamServer::addItemKeyValueTag(uint64_t update_handle, const String &key, const String &value) { + if (SteamUGC() == NULL) { return false; } UGCUpdateHandle_t handle = (uint64_t)update_handle; @@ -2844,36 +2552,16 @@ bool SteamServer::addItemKeyValueTag(uint64_t update_handle, const String& key, } // Adds an additional preview file for the item. -bool SteamServer::addItemPreviewFile(uint64_t query_handle, const String& preview_file, ItemPreviewType type){ - if(SteamUGC() == NULL){ +bool SteamServer::addItemPreviewFile(uint64_t query_handle, const String &preview_file, ItemPreviewType type) { + if (SteamUGC() == NULL) { return false; } - EItemPreviewType previewType; - UGCQueryHandle_t handle = (uint64_t)query_handle; - if(type == 0){ - previewType = k_EItemPreviewType_Image; - } - else if(type == 1){ - previewType = k_EItemPreviewType_YouTubeVideo; - } - else if(type == 2){ - previewType = k_EItemPreviewType_Sketchfab; - } - else if(type == 3){ - previewType = k_EItemPreviewType_EnvironmentMap_HorizontalCross; - } - else if(type == 4){ - previewType = k_EItemPreviewType_EnvironmentMap_LatLong; - } - else{ - previewType = k_EItemPreviewType_ReservedMax; - } - return SteamUGC()->AddItemPreviewFile(handle, preview_file.utf8().get_data(), previewType); + return SteamUGC()->AddItemPreviewFile((UGCQueryHandle_t)query_handle, preview_file.utf8().get_data(), (EItemPreviewType)type); } // Adds an additional video preview from YouTube for the item. -bool SteamServer::addItemPreviewVideo(uint64_t query_handle, const String& video_id){ - if(SteamUGC() == NULL){ +bool SteamServer::addItemPreviewVideo(uint64_t query_handle, const String &video_id) { + if (SteamUGC() == NULL) { return false; } UGCQueryHandle_t handle = (uint64_t)query_handle; @@ -2881,8 +2569,8 @@ bool SteamServer::addItemPreviewVideo(uint64_t query_handle, const String& video } // Adds a workshop item to the users favorites list. -void SteamServer::addItemToFavorites(uint32_t app_id, uint64_t published_file_id){ - if(SteamUGC() != NULL){ +void SteamServer::addItemToFavorites(uint32_t app_id, uint64_t published_file_id) { + if (SteamUGC() != NULL) { AppId_t app = (uint32_t)app_id; PublishedFileId_t file_id = (uint64_t)published_file_id; SteamAPICall_t api_call = SteamUGC()->AddItemToFavorites(app, file_id); @@ -2891,8 +2579,8 @@ void SteamServer::addItemToFavorites(uint32_t app_id, uint64_t published_file_id } // Adds a required key-value tag to a pending UGC Query. This will only return workshop items that have a key = pKey and a value = pValue. -bool SteamServer::addRequiredKeyValueTag(uint64_t query_handle, const String& key, const String& value){ - if(SteamUGC() == NULL){ +bool SteamServer::addRequiredKeyValueTag(uint64_t query_handle, const String &key, const String &value) { + if (SteamUGC() == NULL) { return false; } UGCQueryHandle_t handle = (uint64_t)query_handle; @@ -2900,8 +2588,8 @@ bool SteamServer::addRequiredKeyValueTag(uint64_t query_handle, const String& ke } // Adds a required tag to a pending UGC Query. This will only return UGC with the specified tag. -bool SteamServer::addRequiredTag(uint64_t query_handle, const String& tag_name){ - if(SteamUGC() == NULL){ +bool SteamServer::addRequiredTag(uint64_t query_handle, const String &tag_name) { + if (SteamUGC() == NULL) { return false; } UGCQueryHandle_t handle = (uint64_t)query_handle; @@ -2909,16 +2597,16 @@ bool SteamServer::addRequiredTag(uint64_t query_handle, const String& tag_name){ } // Adds the requirement that the returned items from the pending UGC Query have at least one of the tags in the given set (logical "or"). For each tag group that is added, at least one tag from each group is required to be on the matching items. -bool SteamServer::addRequiredTagGroup(uint64_t query_handle, Array tag_array){ +bool SteamServer::addRequiredTagGroup(uint64_t query_handle, Array tag_array) { bool added_tag_group = false; - if(SteamUGC() != NULL){ + if (SteamUGC() != NULL) { UGCQueryHandle_t handle = uint64(query_handle); SteamParamStringArray_t *tags = new SteamParamStringArray_t(); - tags->m_ppStrings = new const char*[tag_array.size()]; - uint32 strCount = tag_array.size(); + tags->m_ppStrings = new const char *[tag_array.size()]; + uint32 str_count = tag_array.size(); // Needed to ensure the CharStrings are still alive when submitted Vector tag_char_strs; - for (uint32 i=0; i < strCount; i++) { + for (uint32 i = 0; i < str_count; i++) { String str = (String)tag_array[i]; CharString char_str = str.utf8(); tag_char_strs.push_back(char_str); @@ -2932,142 +2620,44 @@ bool SteamServer::addRequiredTagGroup(uint64_t query_handle, Array tag_array){ } // Lets game servers set a specific workshop folder before issuing any UGC commands. -bool SteamServer::initWorkshopForGameServer(uint32_t workshop_depot_id){ +bool SteamServer::initWorkshopForGameServer(uint32_t workshop_depot_id) { bool initialized_workshop = false; - if(SteamUGC() != NULL){ + if (SteamUGC() != NULL) { DepotId_t workshop = (uint32_t)workshop_depot_id; const char *folder = new char[256]; - initialized_workshop = SteamUGC()->BInitWorkshopForGameServer(workshop, (char*)folder); + initialized_workshop = SteamUGC()->BInitWorkshopForGameServer(workshop, (char *)folder); delete[] folder; } return initialized_workshop; } // Creates a new workshop item with no content attached yet. -void SteamServer::createItem(uint32 app_id, WorkshopFileType file_type){ - if(SteamUGC() != NULL){ +void SteamServer::createItem(uint32 app_id, WorkshopFileType file_type) { + if (SteamUGC() != NULL) { SteamAPICall_t api_call = SteamUGC()->CreateItem((AppId_t)app_id, (EWorkshopFileType)file_type); callResultItemCreate.Set(api_call, this, &SteamServer::item_created); } } // Query for all matching UGC. You can use this to list all of the available UGC for your app. -uint64_t SteamServer::createQueryAllUGCRequest(UGCQuery query_type, UGCMatchingUGCType matching_type, uint32_t creator_id, uint32_t consumer_id, uint32 page){ - if(SteamUGC() == NULL){ +uint64_t SteamServer::createQueryAllUGCRequest(UGCQuery query_type, UGCMatchingUGCType matching_type, uint32_t creator_id, uint32_t consumer_id, uint32 page) { + if (SteamUGC() == NULL) { return 0; } - EUGCQuery query; - if(query_type == 0){ - query = k_EUGCQuery_RankedByVote; - } - else if(query_type == 1){ - query = k_EUGCQuery_RankedByPublicationDate; - } - else if(query_type == 2){ - query = k_EUGCQuery_AcceptedForGameRankedByAcceptanceDate; - } - else if(query_type == 3){ - query = k_EUGCQuery_RankedByTrend; - } - else if(query_type == 4){ - query = k_EUGCQuery_FavoritedByFriendsRankedByPublicationDate; - } - else if(query_type == 5){ - query = k_EUGCQuery_CreatedByFriendsRankedByPublicationDate; - } - else if(query_type == 6){ - query = k_EUGCQuery_RankedByNumTimesReported; - } - else if(query_type == 7){ - query = k_EUGCQuery_CreatedByFollowedUsersRankedByPublicationDate; - } - else if(query_type == 8){ - query = k_EUGCQuery_NotYetRated; - } - else if(query_type == 9){ - query = k_EUGCQuery_RankedByTotalVotesAsc; - } - else if(query_type == 10){ - query = k_EUGCQuery_RankedByVotesUp; - } - else if(query_type == 11){ - query = k_EUGCQuery_RankedByTextSearch; - } - else if(query_type == 12){ - query = k_EUGCQuery_RankedByTotalUniqueSubscriptions; - } - else if(query_type == 13){ - query = k_EUGCQuery_RankedByPlaytimeTrend; - } - else if(query_type == 14){ - query = k_EUGCQuery_RankedByTotalPlaytime; - } - else if(query_type == 15){ - query = k_EUGCQuery_RankedByAveragePlaytimeTrend; - } - else if(query_type == 16){ - query = k_EUGCQuery_RankedByLifetimeAveragePlaytime; - } - else if(query_type == 17){ - query = k_EUGCQuery_RankedByPlaytimeSessionsTrend; - } - else{ - query = k_EUGCQuery_RankedByLifetimePlaytimeSessions; - } - EUGCMatchingUGCType match; - if(matching_type == 0){ - match = k_EUGCMatchingUGCType_All; - } - else if(matching_type == 1){ - match = k_EUGCMatchingUGCType_Items_Mtx; - } - else if(matching_type == 2){ - match = k_EUGCMatchingUGCType_Items_ReadyToUse; - } - else if(matching_type == 3){ - match = k_EUGCMatchingUGCType_Collections; - } - else if(matching_type == 4){ - match = k_EUGCMatchingUGCType_Artwork; - } - else if(matching_type == 5){ - match = k_EUGCMatchingUGCType_Videos; - } - else if(matching_type == 6){ - match = k_EUGCMatchingUGCType_Screenshots; - } - else if(matching_type == 7){ - match = k_EUGCMatchingUGCType_AllGuides; - } - else if(matching_type == 8){ - match = k_EUGCMatchingUGCType_WebGuides; - } - else if(matching_type == 9){ - match = k_EUGCMatchingUGCType_IntegratedGuides; - } - else if(matching_type == 10){ - match = k_EUGCMatchingUGCType_UsableInGame; - } - else if(matching_type == 11){ - match = k_EUGCMatchingUGCType_ControllerBindings; - } - else{ - match = k_EUGCMatchingUGCType_GameManagedItems; - } AppId_t creator = (uint32_t)creator_id; AppId_t consumer = (uint32_t)consumer_id; - UGCQueryHandle_t handle = SteamUGC()->CreateQueryAllUGCRequest(query, match, creator, consumer, page); + UGCQueryHandle_t handle = SteamUGC()->CreateQueryAllUGCRequest((EUGCQuery)query_type, (EUGCMatchingUGCType)matching_type, creator, consumer, page); return (uint64_t)handle; } // Query for the details of specific workshop items. -uint64_t SteamServer::createQueryUGCDetailsRequest(Array published_file_ids){ +uint64_t SteamServer::createQueryUGCDetailsRequest(Array published_file_ids) { uint64_t this_handle = 0; - if(SteamUGC() != NULL){ + if (SteamUGC() != NULL) { uint32 fileCount = published_file_ids.size(); - if(fileCount != 0){ + if (fileCount != 0) { PublishedFileId_t *file_ids = new PublishedFileId_t[fileCount]; - for(uint32 i = 0; i < fileCount; i++){ + for (uint32 i = 0; i < fileCount; i++) { file_ids[i] = (uint64_t)published_file_ids[i]; } UGCQueryHandle_t handle = SteamUGC()->CreateQueryUGCDetailsRequest(file_ids, fileCount); @@ -3079,112 +2669,22 @@ uint64_t SteamServer::createQueryUGCDetailsRequest(Array published_file_ids){ } // Query UGC associated with a user. You can use this to list the UGC the user is subscribed to amongst other things. -uint64_t SteamServer::createQueryUserUGCRequest(uint64_t steam_id, UserUGCList list_type, UGCMatchingUGCType matching_ugc_type, UserUGCListSortOrder sort_order, uint32_t creator_id, uint32_t consumer_id, uint32 page){ - if(SteamUGC() == NULL){ +uint64_t SteamServer::createQueryUserUGCRequest(uint64_t steam_id, UserUGCList list_type, UGCMatchingUGCType matching_ugc_type, UserUGCListSortOrder sort_order, uint32_t creator_id, uint32_t consumer_id, uint32 page) { + if (SteamUGC() == NULL) { return 0; } // Get tue universe ID from the Steam ID CSteamID user_id = (uint64)steam_id; AccountID_t account = (AccountID_t)user_id.ConvertToUint64(); - EUserUGCList list; - if(list_type == 0){ - list = k_EUserUGCList_Published; - } - else if(list_type == 1){ - list = k_EUserUGCList_VotedOn; - } - else if(list_type == 2){ - list = k_EUserUGCList_VotedUp; - } - else if(list_type == 3){ - list = k_EUserUGCList_VotedDown; - } - else if(list_type == 4){ - list = k_EUserUGCList_WillVoteLater; - } - else if(list_type == 5){ - list = k_EUserUGCList_Favorited; - } - else if(list_type == 6){ - list = k_EUserUGCList_Subscribed; - } - else if(list_type == 7){ - list = k_EUserUGCList_UsedOrPlayed; - } - else{ - list = k_EUserUGCList_Followed; - } - EUGCMatchingUGCType match; - if(matching_ugc_type == 0){ - match = k_EUGCMatchingUGCType_All; - } - else if(matching_ugc_type == 1){ - match = k_EUGCMatchingUGCType_Items_Mtx; - } - else if(matching_ugc_type == 2){ - match = k_EUGCMatchingUGCType_Items_ReadyToUse; - } - else if(matching_ugc_type == 3){ - match = k_EUGCMatchingUGCType_Collections; - } - else if(matching_ugc_type == 4){ - match = k_EUGCMatchingUGCType_Artwork; - } - else if(matching_ugc_type == 5){ - match = k_EUGCMatchingUGCType_Videos; - } - else if(matching_ugc_type == 6){ - match = k_EUGCMatchingUGCType_Screenshots; - } - else if(matching_ugc_type == 7){ - match = k_EUGCMatchingUGCType_AllGuides; - } - else if(matching_ugc_type == 8){ - match = k_EUGCMatchingUGCType_WebGuides; - } - else if(matching_ugc_type == 9){ - match = k_EUGCMatchingUGCType_IntegratedGuides; - } - else if(matching_ugc_type == 10){ - match = k_EUGCMatchingUGCType_UsableInGame; - } - else if(matching_ugc_type == 11){ - match = k_EUGCMatchingUGCType_ControllerBindings; - } - else{ - match = k_EUGCMatchingUGCType_GameManagedItems; - } - EUserUGCListSortOrder sort; - if(sort_order == 0){ - sort = k_EUserUGCListSortOrder_CreationOrderDesc; - } - else if(sort_order == 1){ - sort = k_EUserUGCListSortOrder_CreationOrderAsc; - } - else if(sort_order == 2){ - sort = k_EUserUGCListSortOrder_TitleAsc; - } - else if(sort_order == 3){ - sort = k_EUserUGCListSortOrder_LastUpdatedDesc; - } - else if(sort_order == 4){ - sort = k_EUserUGCListSortOrder_SubscriptionDateDesc; - } - else if(sort_order == 5){ - sort = k_EUserUGCListSortOrder_VoteScoreDesc; - } - else{ - sort = k_EUserUGCListSortOrder_ForModeration; - } AppId_t creator = (int)creator_id; AppId_t consumer = (int)consumer_id; - UGCQueryHandle_t handle = SteamUGC()->CreateQueryUserUGCRequest(account, list, match, sort, creator, consumer, page); + UGCQueryHandle_t handle = SteamUGC()->CreateQueryUserUGCRequest(account, (EUserUGCList)list_type, (EUGCMatchingUGCType)matching_ugc_type, (EUserUGCListSortOrder)sort_order, creator, consumer, page); return (uint64_t)handle; } // Deletes the item without prompting the user. -void SteamServer::deleteItem(uint64_t published_file_id){ - if(SteamUGC() != NULL){ +void SteamServer::deleteItem(uint64_t published_file_id) { + if (SteamUGC() != NULL) { PublishedFileId_t file_id = (uint64_t)published_file_id; SteamAPICall_t api_call = SteamUGC()->DeleteItem(file_id); callResultDeleteItem.Set(api_call, this, &SteamServer::item_deleted); @@ -3193,8 +2693,8 @@ void SteamServer::deleteItem(uint64_t published_file_id){ // Download new or update already installed item. If returns true, wait for DownloadItemResult_t. If item is already installed, then files on disk should not be used until callback received. // If item is not subscribed to, it will be cached for some time. If bHighPriority is set, any other item download will be suspended and this item downloaded ASAP. -bool SteamServer::downloadItem(uint64_t published_file_id, bool high_priority){ - if(SteamUGC() == NULL){ +bool SteamServer::downloadItem(uint64_t published_file_id, bool high_priority) { + if (SteamUGC() == NULL) { return false; } PublishedFileId_t file_id = (uint64_t)published_file_id; @@ -3202,15 +2702,15 @@ bool SteamServer::downloadItem(uint64_t published_file_id, bool high_priority){ } // Get info about a pending download of a workshop item that has k_EItemStateNeedsUpdate set. -Dictionary SteamServer::getItemDownloadInfo(uint64_t published_file_id){ +Dictionary SteamServer::getItemDownloadInfo(uint64_t published_file_id) { Dictionary info; - if(SteamUGC() == NULL){ + if (SteamUGC() == NULL) { return info; } uint64 downloaded = 0; uint64 total = 0; info["ret"] = SteamUGC()->GetItemDownloadInfo((PublishedFileId_t)published_file_id, &downloaded, &total); - if(info["ret"]){ + if (info["ret"]) { info["downloaded"] = uint64_t(downloaded); info["total"] = uint64_t(total); } @@ -3218,9 +2718,9 @@ Dictionary SteamServer::getItemDownloadInfo(uint64_t published_file_id){ } // Gets info about currently installed content on the disc for workshop items that have k_EItemStateInstalled set. -Dictionary SteamServer::getItemInstallInfo(uint64_t published_file_id){ +Dictionary SteamServer::getItemInstallInfo(uint64_t published_file_id) { Dictionary info; - if(SteamUGC() == NULL){ + if (SteamUGC() == NULL) { info["ret"] = false; return info; } @@ -3229,7 +2729,7 @@ Dictionary SteamServer::getItemInstallInfo(uint64_t published_file_id){ char folder[1024] = { 0 }; uint32 timeStamp; info["ret"] = SteamUGC()->GetItemInstallInfo((PublishedFileId_t)file_id, &sizeOnDisk, folder, sizeof(folder), &timeStamp); - if(info["ret"]){ + if (info["ret"]) { info["size"] = (int)sizeOnDisk; info["folder"] = folder; info["foldersize"] = (uint32)sizeof(folder); @@ -3239,8 +2739,8 @@ Dictionary SteamServer::getItemInstallInfo(uint64_t published_file_id){ } // Gets the current state of a workshop item on this client. -uint32 SteamServer::getItemState(uint64_t published_file_id){ - if(SteamUGC() == NULL){ +uint32 SteamServer::getItemState(uint64_t published_file_id) { + if (SteamUGC() == NULL) { return 0; } PublishedFileId_t file_id = (uint64_t)published_file_id; @@ -3248,9 +2748,9 @@ uint32 SteamServer::getItemState(uint64_t published_file_id){ } // Gets the progress of an item update. -Dictionary SteamServer::getItemUpdateProgress(uint64_t update_handle){ +Dictionary SteamServer::getItemUpdateProgress(uint64_t update_handle) { Dictionary updateProgress; - if(SteamUGC() == NULL){ + if (SteamUGC() == NULL) { return updateProgress; } UGCUpdateHandle_t handle = (uint64_t)update_handle; @@ -3264,25 +2764,25 @@ Dictionary SteamServer::getItemUpdateProgress(uint64_t update_handle){ } // Gets the total number of items the current user is subscribed to for the game or application. -uint32 SteamServer::getNumSubscribedItems(){ - if(SteamUser() == NULL){ +uint32 SteamServer::getNumSubscribedItems() { + if (SteamUser() == NULL) { return 0; } return SteamUGC()->GetNumSubscribedItems(); } // Retrieve the details of an additional preview associated with an individual workshop item after receiving a querying UGC call result. -Dictionary SteamServer::getQueryUGCAdditionalPreview(uint64_t query_handle, uint32 index, uint32 preview_index){ +Dictionary SteamServer::getQueryUGCAdditionalPreview(uint64_t query_handle, uint32 index, uint32 preview_index) { Dictionary preview; - if(SteamUGC() == NULL){ + if (SteamUGC() == NULL) { return preview; } UGCQueryHandle_t handle = (uint64_t)query_handle; char *url_or_video_id = new char[256]; char *original_filename = new char[256]; EItemPreviewType previewType; - bool success = SteamUGC()->GetQueryUGCAdditionalPreview(handle, index, preview_index, (char*)url_or_video_id, 256, (char*)original_filename, 256, &previewType); - if(success){ + bool success = SteamUGC()->GetQueryUGCAdditionalPreview(handle, index, preview_index, (char *)url_or_video_id, 256, (char *)original_filename, 256, &previewType); + if (success) { preview["success"] = success; preview["handle"] = (uint64_t)handle; preview["index"] = index; @@ -3297,16 +2797,16 @@ Dictionary SteamServer::getQueryUGCAdditionalPreview(uint64_t query_handle, uint } // Retrieve the ids of any child items of an individual workshop item after receiving a querying UGC call result. These items can either be a part of a collection or some other dependency (see AddDependency). -Dictionary SteamServer::getQueryUGCChildren(uint64_t query_handle, uint32 index, uint32_t child_count){ +Dictionary SteamServer::getQueryUGCChildren(uint64_t query_handle, uint32 index, uint32_t child_count) { Dictionary children; - if(SteamUGC() == NULL){ + if (SteamUGC() == NULL) { return children; } UGCQueryHandle_t handle = (uint64_t)query_handle; PoolVector vec; vec.resize(child_count); - bool success = SteamUGC()->GetQueryUGCChildren(handle, index, (PublishedFileId_t*)vec.write().ptr(), child_count); - if(success) { + bool success = SteamUGC()->GetQueryUGCChildren(handle, index, (PublishedFileId_t *)vec.write().ptr(), child_count); + if (success) { Array godot_arr; godot_arr.resize(child_count); for (uint32_t i = 0; i < child_count; i++) { @@ -3321,17 +2821,17 @@ Dictionary SteamServer::getQueryUGCChildren(uint64_t query_handle, uint32 index, return children; } -Dictionary SteamServer::getQueryUGCContentDescriptors(uint64_t query_handle, uint32 index, uint32_t max_entries){ +Dictionary SteamServer::getQueryUGCContentDescriptors(uint64_t query_handle, uint32 index, uint32_t max_entries) { Dictionary descriptors; - if(SteamUGC() != NULL){ + if (SteamUGC() != NULL) { UGCQueryHandle_t handle = (uint64_t)query_handle; PoolVector vec; vec.resize(max_entries); - uint32_t result = SteamUGC()->GetQueryUGCContentDescriptors(handle, index, (EUGCContentDescriptorID*)vec.write().ptr(), max_entries); + uint32_t result = SteamUGC()->GetQueryUGCContentDescriptors(handle, index, (EUGCContentDescriptorID *)vec.write().ptr(), max_entries); Array descriptor_array; descriptor_array.resize(max_entries); - for(uint32_t i = 0; i < max_entries; i++){ + for (uint32_t i = 0; i < max_entries; i++) { descriptor_array[i] = vec[i]; } @@ -3344,16 +2844,16 @@ Dictionary SteamServer::getQueryUGCContentDescriptors(uint64_t query_handle, uin } // Retrieve the details of a key-value tag associated with an individual workshop item after receiving a querying UGC call result. -Dictionary SteamServer::getQueryUGCKeyValueTag(uint64_t query_handle, uint32 index, uint32 key_value_tag_index){ +Dictionary SteamServer::getQueryUGCKeyValueTag(uint64_t query_handle, uint32 index, uint32 key_value_tag_index) { Dictionary tag; - if(SteamUGC() == NULL){ + if (SteamUGC() == NULL) { return tag; } UGCQueryHandle_t handle = (uint64_t)query_handle; char *key = new char[256]; char *value = new char[256]; - bool success = SteamUGC()->GetQueryUGCKeyValueTag(handle, index, key_value_tag_index, (char*)key, 256, (char*)value, 256); - if(success){ + bool success = SteamUGC()->GetQueryUGCKeyValueTag(handle, index, key_value_tag_index, (char *)key, 256, (char *)value, 256); + if (success) { tag["success"] = success; tag["handle"] = (uint64_t)handle; tag["index"] = index; @@ -3367,13 +2867,13 @@ Dictionary SteamServer::getQueryUGCKeyValueTag(uint64_t query_handle, uint32 ind } // Retrieve the developer set metadata of an individual workshop item after receiving a querying UGC call result. -String SteamServer::getQueryUGCMetadata(uint64_t query_handle, uint32 index){ +String SteamServer::getQueryUGCMetadata(uint64_t query_handle, uint32 index) { String query_ugc_metadata = ""; - if(SteamUGC() != NULL){ + if (SteamUGC() != NULL) { UGCQueryHandle_t handle = (uint64_t)query_handle; char *ugc_metadata = new char[5000]; - bool success = SteamUGC()->GetQueryUGCMetadata(handle, index, (char*)ugc_metadata, 5000); - if(success){ + bool success = SteamUGC()->GetQueryUGCMetadata(handle, index, (char *)ugc_metadata, 5000); + if (success) { query_ugc_metadata = ugc_metadata; } delete[] ugc_metadata; @@ -3382,8 +2882,8 @@ String SteamServer::getQueryUGCMetadata(uint64_t query_handle, uint32 index){ } // Retrieve the number of additional previews of an individual workshop item after receiving a querying UGC call result. -uint32 SteamServer::getQueryUGCNumAdditionalPreviews(uint64_t query_handle, uint32 index){ - if(SteamUser() == NULL){ +uint32 SteamServer::getQueryUGCNumAdditionalPreviews(uint64_t query_handle, uint32 index) { + if (SteamUser() == NULL) { return 0; } UGCQueryHandle_t handle = (uint64_t)query_handle; @@ -3391,8 +2891,8 @@ uint32 SteamServer::getQueryUGCNumAdditionalPreviews(uint64_t query_handle, uint } // Retrieve the number of key-value tags of an individual workshop item after receiving a querying UGC call result. -uint32 SteamServer::getQueryUGCNumKeyValueTags(uint64_t query_handle, uint32 index){ - if(SteamUser() == NULL){ +uint32 SteamServer::getQueryUGCNumKeyValueTags(uint64_t query_handle, uint32 index) { + if (SteamUser() == NULL) { return 0; } UGCQueryHandle_t handle = (uint64_t)query_handle; @@ -3400,8 +2900,8 @@ uint32 SteamServer::getQueryUGCNumKeyValueTags(uint64_t query_handle, uint32 ind } // Retrieve the number of tags for an individual workshop item after receiving a querying UGC call result. You should call this in a loop to get the details of all the workshop items returned. -uint32 SteamServer::getQueryUGCNumTags(uint64_t query_handle, uint32 index){ - if(SteamUGC() == NULL){ +uint32 SteamServer::getQueryUGCNumTags(uint64_t query_handle, uint32 index) { + if (SteamUGC() == NULL) { return 0; } UGCQueryHandle_t handle = (uint64_t)query_handle; @@ -3409,13 +2909,13 @@ uint32 SteamServer::getQueryUGCNumTags(uint64_t query_handle, uint32 index){ } // Retrieve the URL to the preview image of an individual workshop item after receiving a querying UGC call result. -String SteamServer::getQueryUGCPreviewURL(uint64_t query_handle, uint32 index){ +String SteamServer::getQueryUGCPreviewURL(uint64_t query_handle, uint32 index) { String query_ugc_preview_url = ""; - if(SteamUGC() != NULL){ + if (SteamUGC() != NULL) { UGCQueryHandle_t handle = (uint64_t)query_handle; char *url = new char[256]; - bool success = SteamUGC()->GetQueryUGCPreviewURL(handle, index, (char*)url, 256); - if(success){ + bool success = SteamUGC()->GetQueryUGCPreviewURL(handle, index, (char *)url, 256); + if (success) { query_ugc_preview_url = url; } delete[] url; @@ -3424,108 +2924,68 @@ String SteamServer::getQueryUGCPreviewURL(uint64_t query_handle, uint32 index){ } // Retrieve the details of an individual workshop item after receiving a querying UGC call result. -Dictionary SteamServer::getQueryUGCResult(uint64_t query_handle, uint32 index){ - Dictionary ugcResult; - if(SteamUGC() == NULL){ - return ugcResult; +Dictionary SteamServer::getQueryUGCResult(uint64_t query_handle, uint32 index) { + Dictionary ugc_result; + if (SteamUGC() == NULL) { + return ugc_result; } UGCQueryHandle_t handle = (uint64_t)query_handle; - SteamUGCDetails_t pDetails; - bool success = SteamUGC()->GetQueryUGCResult(handle, index, &pDetails); - if(success){ - ugcResult["result"] = (uint64_t)pDetails.m_eResult; - ugcResult["file_id"] = (uint64_t)pDetails.m_nPublishedFileId; - ugcResult["file_type"] = (uint64_t)pDetails.m_eFileType; - ugcResult["creator_app_id"] = (uint32_t)pDetails.m_nCreatorAppID; - ugcResult["consumer_app_id"] = (uint32_t)pDetails.m_nConsumerAppID; - ugcResult["title"] = String::utf8(pDetails.m_rgchTitle); - ugcResult["description"] = String::utf8(pDetails.m_rgchDescription); - ugcResult["steam_id_owner"] = (uint64_t)pDetails.m_ulSteamIDOwner; - ugcResult["time_created"] = pDetails.m_rtimeCreated; - ugcResult["time_updated"] = pDetails.m_rtimeUpdated; - ugcResult["time_added_to_user_list"] = pDetails.m_rtimeAddedToUserList; - ugcResult["visibility"] = (uint64_t)pDetails.m_eVisibility; - ugcResult["banned"] = pDetails.m_bBanned; - ugcResult["accepted_for_use"] = pDetails.m_bAcceptedForUse; - ugcResult["tags_truncated"] = pDetails.m_bTagsTruncated; - ugcResult["tags"] = pDetails.m_rgchTags; - ugcResult["handle_file"] = (uint64_t)pDetails.m_hFile; - ugcResult["handle_preview_file"] = (uint64_t)pDetails.m_hPreviewFile; - ugcResult["file_name"] = pDetails.m_pchFileName; - ugcResult["file_size"] = pDetails.m_nFileSize; - ugcResult["preview_file_size"] = pDetails.m_nPreviewFileSize; - ugcResult["url"] = pDetails.m_rgchURL; - ugcResult["votes_up"] = pDetails.m_unVotesUp; - ugcResult["votes_down"] = pDetails.m_unVotesDown; - ugcResult["score"] = pDetails.m_flScore; - ugcResult["num_children"] = pDetails.m_unNumChildren; - } - return ugcResult; + SteamUGCDetails_t query_details; + bool success = SteamUGC()->GetQueryUGCResult(handle, index, &query_details); + if (success) { + ugc_result["result"] = (uint64_t)query_details.m_eResult; + ugc_result["file_id"] = (uint64_t)query_details.m_nPublishedFileId; + ugc_result["file_type"] = (uint64_t)query_details.m_eFileType; + ugc_result["creator_app_id"] = (uint32_t)query_details.m_nCreatorAppID; + ugc_result["consumer_app_id"] = (uint32_t)query_details.m_nConsumerAppID; + ugc_result["title"] = String::utf8(query_details.m_rgchTitle); + ugc_result["description"] = String::utf8(query_details.m_rgchDescription); + ugc_result["steam_id_owner"] = (uint64_t)query_details.m_ulSteamIDOwner; + ugc_result["time_created"] = query_details.m_rtimeCreated; + ugc_result["time_updated"] = query_details.m_rtimeUpdated; + ugc_result["time_added_to_user_list"] = query_details.m_rtimeAddedToUserList; + ugc_result["visibility"] = (uint64_t)query_details.m_eVisibility; + ugc_result["banned"] = query_details.m_bBanned; + ugc_result["accepted_for_use"] = query_details.m_bAcceptedForUse; + ugc_result["tags_truncated"] = query_details.m_bTagsTruncated; + ugc_result["tags"] = query_details.m_rgchTags; + ugc_result["handle_file"] = (uint64_t)query_details.m_hFile; + ugc_result["handle_preview_file"] = (uint64_t)query_details.m_hPreviewFile; + ugc_result["file_name"] = query_details.m_pchFileName; + ugc_result["file_size"] = query_details.m_nFileSize; + ugc_result["preview_file_size"] = query_details.m_nPreviewFileSize; + ugc_result["url"] = query_details.m_rgchURL; + ugc_result["votes_up"] = query_details.m_unVotesUp; + ugc_result["votes_down"] = query_details.m_unVotesDown; + ugc_result["score"] = query_details.m_flScore; + ugc_result["num_children"] = query_details.m_unNumChildren; + } + return ugc_result; } // Retrieve various statistics of an individual workshop item after receiving a querying UGC call result. -Dictionary SteamServer::getQueryUGCStatistic(uint64_t query_handle, uint32 index, ItemStatistic stat_type){ - Dictionary ugcStat; - if(SteamUGC() == NULL){ - return ugcStat; +Dictionary SteamServer::getQueryUGCStatistic(uint64_t query_handle, uint32 index, ItemStatistic stat_type) { + Dictionary ugc_stat; + if (SteamUGC() == NULL) { + return ugc_stat; } UGCQueryHandle_t handle = (uint64_t)query_handle; - EItemStatistic type; - if(stat_type == 0){ - type = k_EItemStatistic_NumSubscriptions; - } - else if(stat_type == 1){ - type = k_EItemStatistic_NumFavorites; - } - else if(stat_type == 2){ - type = k_EItemStatistic_NumFollowers; - } - else if(stat_type == 3){ - type = k_EItemStatistic_NumUniqueSubscriptions; - } - else if(stat_type == 4){ - type = k_EItemStatistic_NumUniqueFavorites; - } - else if(stat_type == 5){ - type = k_EItemStatistic_NumUniqueFollowers; - } - else if(stat_type == 6){ - type = k_EItemStatistic_NumUniqueWebsiteViews; - } - else if(stat_type == 7){ - type = k_EItemStatistic_ReportScore; - } - else if(stat_type == 8){ - type = k_EItemStatistic_NumSecondsPlayed; - } - else if(stat_type == 9){ - type = k_EItemStatistic_NumPlaytimeSessions; - } - else if(stat_type == 10){ - type = k_EItemStatistic_NumComments; - } - else if(stat_type == 11){ - type = k_EItemStatistic_NumSecondsPlayedDuringTimePeriod; - } - else{ - type = k_EItemStatistic_NumPlaytimeSessionsDuringTimePeriod; - } uint64 value = 0; - bool success = SteamUGC()->GetQueryUGCStatistic(handle, index, type, &value); - if(success){ - ugcStat["success"] = success; - ugcStat["handle"] = (uint64_t)handle; - ugcStat["index"] = index; - ugcStat["type"] = type; - ugcStat["value"] = (uint64_t)value; - } - return ugcStat; + bool success = SteamUGC()->GetQueryUGCStatistic(handle, index, (EItemStatistic)stat_type, &value); + if (success) { + ugc_stat["success"] = success; + ugc_stat["handle"] = (uint64_t)handle; + ugc_stat["index"] = index; + ugc_stat["type"] = stat_type; + ugc_stat["value"] = (uint64_t)value; + } + return ugc_stat; } // Retrieve the "nth" tag associated with an individual workshop item after receiving a querying UGC call result. // You should call this in a loop to get the details of all the workshop items returned. -String SteamServer::getQueryUGCTag(uint64_t query_handle, uint32 index, uint32 tag_index){ - if(SteamUGC() == NULL){ +String SteamServer::getQueryUGCTag(uint64_t query_handle, uint32 index, uint32 tag_index) { + if (SteamUGC() == NULL) { return ""; } // Set a default tag to return @@ -3540,8 +3000,8 @@ String SteamServer::getQueryUGCTag(uint64_t query_handle, uint32 index, uint32 t // Retrieve the "nth" display string (usually localized) for a tag, which is associated with an individual workshop item after receiving a querying UGC call result. // You should call this in a loop to get the details of all the workshop items returned. -String SteamServer::getQueryUGCTagDisplayName(uint64_t query_handle, uint32 index, uint32 tag_index){ - if(SteamUGC() == NULL){ +String SteamServer::getQueryUGCTagDisplayName(uint64_t query_handle, uint32 index, uint32 tag_index) { + if (SteamUGC() == NULL) { return ""; } // Set a default tag name to return @@ -3555,15 +3015,15 @@ String SteamServer::getQueryUGCTagDisplayName(uint64_t query_handle, uint32 inde } // Gets a list of all of the items the current user is subscribed to for the current game. -Array SteamServer::getSubscribedItems(){ - if(SteamUGC() == NULL){ +Array SteamServer::getSubscribedItems() { + if (SteamUGC() == NULL) { return Array(); } Array subscribed; uint32 num_items = SteamUGC()->GetNumSubscribedItems(); PublishedFileId_t *items = new PublishedFileId_t[num_items]; uint32 item_list = SteamUGC()->GetSubscribedItems(items, num_items); - for(uint32 i = 0; i < item_list; i++){ + for (uint32 i = 0; i < item_list; i++) { subscribed.append((uint64_t)items[i]); } delete[] items; @@ -3572,12 +3032,12 @@ Array SteamServer::getSubscribedItems(){ // Return the user's community content descriptor preferences // Information is unclear how this actually works so here goes nothing! -Array SteamServer::getUserContentDescriptorPreferences(uint32 max_entries){ +Array SteamServer::getUserContentDescriptorPreferences(uint32 max_entries) { Array descriptors; - if(SteamUGC() != NULL){ + if (SteamUGC() != NULL) { EUGCContentDescriptorID *descriptor_list = new EUGCContentDescriptorID[max_entries]; uint32 num_descriptors = SteamUGC()->GetUserContentDescriptorPreferences(descriptor_list, max_entries); - for(uint32 i = 0; i < num_descriptors; i++){ + for (uint32 i = 0; i < num_descriptors; i++) { descriptors.append(descriptor_list[i]); } } @@ -3585,8 +3045,8 @@ Array SteamServer::getUserContentDescriptorPreferences(uint32 max_entries){ } // Gets the users vote status on a workshop item. -void SteamServer::getUserItemVote(uint64_t published_file_id){ - if(SteamUGC() != NULL){ +void SteamServer::getUserItemVote(uint64_t published_file_id) { + if (SteamUGC() != NULL) { PublishedFileId_t file_id = (uint64_t)published_file_id; SteamAPICall_t api_call = SteamUGC()->GetUserItemVote(file_id); callResultGetUserItemVote.Set(api_call, this, &SteamServer::get_item_vote_result); @@ -3594,8 +3054,8 @@ void SteamServer::getUserItemVote(uint64_t published_file_id){ } // Releases a UGC query handle when you are done with it to free up memory. -bool SteamServer::releaseQueryUGCRequest(uint64_t query_handle){ - if(SteamUGC() == NULL){ +bool SteamServer::releaseQueryUGCRequest(uint64_t query_handle) { + if (SteamUGC() == NULL) { return false; } UGCQueryHandle_t handle = (uint64_t)query_handle; @@ -3603,8 +3063,8 @@ bool SteamServer::releaseQueryUGCRequest(uint64_t query_handle){ } // Removes the dependency between the given item and the appid. This list of dependencies can be retrieved by calling GetAppDependencies. -void SteamServer::removeAppDependency(uint64_t published_file_id, uint32_t app_id){ - if(SteamUGC() != NULL){ +void SteamServer::removeAppDependency(uint64_t published_file_id, uint32_t app_id) { + if (SteamUGC() != NULL) { PublishedFileId_t file_id = (uint64_t)published_file_id; AppId_t app = (uint32_t)app_id; SteamAPICall_t api_call = SteamUGC()->RemoveAppDependency(file_id, app); @@ -3612,16 +3072,16 @@ void SteamServer::removeAppDependency(uint64_t published_file_id, uint32_t app_i } } -bool SteamServer::removeContentDescriptor(uint64_t update_handle, int descriptor_id){ - if(SteamUGC() == NULL){ +bool SteamServer::removeContentDescriptor(uint64_t update_handle, int descriptor_id) { + if (SteamUGC() == NULL) { return false; } return SteamUGC()->RemoveContentDescriptor((UGCUpdateHandle_t)update_handle, (EUGCContentDescriptorID)descriptor_id); } // Removes a workshop item as a dependency from the specified item. -void SteamServer::removeDependency(uint64_t published_file_id, uint64_t child_published_file_id){ - if(SteamUGC() != NULL){ +void SteamServer::removeDependency(uint64_t published_file_id, uint64_t child_published_file_id) { + if (SteamUGC() != NULL) { PublishedFileId_t file_id = (uint64_t)published_file_id; PublishedFileId_t childID = (uint64_t)child_published_file_id; SteamAPICall_t api_call = SteamUGC()->RemoveDependency(file_id, childID); @@ -3630,8 +3090,8 @@ void SteamServer::removeDependency(uint64_t published_file_id, uint64_t child_pu } // Removes a workshop item from the users favorites list. -void SteamServer::removeItemFromFavorites(uint32_t app_id, uint64_t published_file_id){ - if(SteamUGC() != NULL){ +void SteamServer::removeItemFromFavorites(uint32_t app_id, uint64_t published_file_id) { + if (SteamUGC() != NULL) { PublishedFileId_t file_id = (uint64_t)published_file_id; AppId_t app = (uint32_t)app_id; SteamAPICall_t api_call = SteamUGC()->RemoveItemFromFavorites(app, file_id); @@ -3640,8 +3100,8 @@ void SteamServer::removeItemFromFavorites(uint32_t app_id, uint64_t published_fi } // Removes an existing key value tag from an item. -bool SteamServer::removeItemKeyValueTags(uint64_t update_handle, const String& key){ - if(SteamUGC() == NULL){ +bool SteamServer::removeItemKeyValueTags(uint64_t update_handle, const String &key) { + if (SteamUGC() == NULL) { return false; } UGCUpdateHandle_t handle = uint64(update_handle); @@ -3649,8 +3109,8 @@ bool SteamServer::removeItemKeyValueTags(uint64_t update_handle, const String& k } // Removes an existing preview from an item. -bool SteamServer::removeItemPreview(uint64_t update_handle, uint32 index){ - if(SteamUGC() == NULL){ +bool SteamServer::removeItemPreview(uint64_t update_handle, uint32 index) { + if (SteamUGC() == NULL) { return false; } UGCUpdateHandle_t handle = uint64(update_handle); @@ -3658,8 +3118,8 @@ bool SteamServer::removeItemPreview(uint64_t update_handle, uint32 index){ } // Send a UGC query to Steam. -void SteamServer::sendQueryUGCRequest(uint64_t update_handle){ - if(SteamUGC() != NULL){ +void SteamServer::sendQueryUGCRequest(uint64_t update_handle) { + if (SteamUGC() != NULL) { UGCUpdateHandle_t handle = uint64(update_handle); SteamAPICall_t api_call = SteamUGC()->SendQueryUGCRequest(handle); callResultUGCQueryCompleted.Set(api_call, this, &SteamServer::ugc_query_completed); @@ -3667,8 +3127,8 @@ void SteamServer::sendQueryUGCRequest(uint64_t update_handle){ } // Sets whether results will be returned from the cache for the specific period of time on a pending UGC Query. -bool SteamServer::setAllowCachedResponse(uint64_t update_handle, uint32 max_age_seconds){ - if(SteamUGC() == NULL){ +bool SteamServer::setAllowCachedResponse(uint64_t update_handle, uint32 max_age_seconds) { + if (SteamUGC() == NULL) { return false; } UGCUpdateHandle_t handle = uint64(update_handle); @@ -3676,8 +3136,8 @@ bool SteamServer::setAllowCachedResponse(uint64_t update_handle, uint32 max_age_ } // Sets to only return items that have a specific filename on a pending UGC Query. -bool SteamServer::setCloudFileNameFilter(uint64_t update_handle, const String& match_cloud_filename){ - if(SteamUGC() == NULL){ +bool SteamServer::setCloudFileNameFilter(uint64_t update_handle, const String &match_cloud_filename) { + if (SteamUGC() == NULL) { return false; } UGCUpdateHandle_t handle = uint64(update_handle); @@ -3685,8 +3145,8 @@ bool SteamServer::setCloudFileNameFilter(uint64_t update_handle, const String& m } // Sets the folder that will be stored as the content for an item. -bool SteamServer::setItemContent(uint64_t update_handle, const String& content_folder){ - if(SteamUGC() == NULL){ +bool SteamServer::setItemContent(uint64_t update_handle, const String &content_folder) { + if (SteamUGC() == NULL) { return false; } UGCUpdateHandle_t handle = uint64(update_handle); @@ -3694,11 +3154,11 @@ bool SteamServer::setItemContent(uint64_t update_handle, const String& content_f } // Sets a new description for an item. -bool SteamServer::setItemDescription(uint64_t update_handle, const String& description){ - if(SteamUGC() == NULL){ +bool SteamServer::setItemDescription(uint64_t update_handle, const String &description) { + if (SteamUGC() == NULL) { return false; } - if ((uint32_t)description.length() > (uint32_t)k_cchPublishedDocumentDescriptionMax){ + if ((uint32_t)description.length() > (uint32_t)k_cchPublishedDocumentDescriptionMax) { printf("Description cannot have more than %d ASCII characters. Description not set.", k_cchPublishedDocumentDescriptionMax); return false; } @@ -3707,11 +3167,11 @@ bool SteamServer::setItemDescription(uint64_t update_handle, const String& descr } // Sets arbitrary metadata for an item. This metadata can be returned from queries without having to download and install the actual content. -bool SteamServer::setItemMetadata(uint64_t update_handle, const String& ugc_metadata){ - if(SteamUGC() == NULL){ +bool SteamServer::setItemMetadata(uint64_t update_handle, const String &ugc_metadata) { + if (SteamUGC() == NULL) { return false; } - if (ugc_metadata.utf8().length() > 5000){ + if (ugc_metadata.utf8().length() > 5000) { printf("Metadata cannot be more than %d bytes. Metadata not set.", 5000); } UGCUpdateHandle_t handle = uint64(update_handle); @@ -3719,8 +3179,8 @@ bool SteamServer::setItemMetadata(uint64_t update_handle, const String& ugc_meta } // Sets the primary preview image for the item. -bool SteamServer::setItemPreview(uint64_t update_handle, const String& preview_file){ - if(SteamUGC() == NULL){ +bool SteamServer::setItemPreview(uint64_t update_handle, const String &preview_file) { + if (SteamUGC() == NULL) { return false; } UGCUpdateHandle_t handle = uint64(update_handle); @@ -3728,16 +3188,16 @@ bool SteamServer::setItemPreview(uint64_t update_handle, const String& preview_f } // Sets arbitrary developer specified tags on an item. -bool SteamServer::setItemTags(uint64_t update_handle, Array tag_array, bool allow_admin_tags){ +bool SteamServer::setItemTags(uint64_t update_handle, Array tag_array, bool allow_admin_tags) { bool tags_set = false; - if(SteamUGC() != NULL){ + if (SteamUGC() != NULL) { UGCUpdateHandle_t handle = uint64(update_handle); SteamParamStringArray_t *tags = new SteamParamStringArray_t(); - tags->m_ppStrings = new const char*[tag_array.size()]; - uint32 strCount = tag_array.size(); + tags->m_ppStrings = new const char *[tag_array.size()]; + uint32 str_count = tag_array.size(); // Needed to ensure the CharStrings are still alive when submitted Vector tag_char_strs; - for (uint32 i=0; i < strCount; i++) { + for (uint32 i = 0; i < str_count; i++) { String str = (String)tag_array[i]; CharString char_str = str.utf8(); tag_char_strs.push_back(char_str); @@ -3751,11 +3211,11 @@ bool SteamServer::setItemTags(uint64_t update_handle, Array tag_array, bool allo } // Sets a new title for an item. -bool SteamServer::setItemTitle(uint64_t update_handle, const String& title){ - if(SteamUGC() == NULL){ +bool SteamServer::setItemTitle(uint64_t update_handle, const String &title) { + if (SteamUGC() == NULL) { return false; } - if (title.length() > 255){ + if (title.length() > 255) { printf("Title cannot have more than %d ASCII characters. Title not set.", 255); return false; } @@ -3764,8 +3224,8 @@ bool SteamServer::setItemTitle(uint64_t update_handle, const String& title){ } // Sets the language of the title and description that will be set in this item update. -bool SteamServer::setItemUpdateLanguage(uint64_t update_handle, const String& language){ - if(SteamUGC() == NULL){ +bool SteamServer::setItemUpdateLanguage(uint64_t update_handle, const String &language) { + if (SteamUGC() == NULL) { return false; } UGCUpdateHandle_t handle = uint64(update_handle); @@ -3773,8 +3233,8 @@ bool SteamServer::setItemUpdateLanguage(uint64_t update_handle, const String& la } // Sets the visibility of an item. -bool SteamServer::setItemVisibility(uint64_t update_handle, RemoteStoragePublishedFileVisibility visibility){ - if(SteamUGC() == NULL){ +bool SteamServer::setItemVisibility(uint64_t update_handle, RemoteStoragePublishedFileVisibility visibility) { + if (SteamUGC() == NULL) { return false; } UGCUpdateHandle_t handle = uint64(update_handle); @@ -3782,8 +3242,8 @@ bool SteamServer::setItemVisibility(uint64_t update_handle, RemoteStoragePublish } // Sets the language to return the title and description in for the items on a pending UGC Query. -bool SteamServer::setLanguage(uint64_t query_handle, const String& language){ - if(SteamUGC() == NULL){ +bool SteamServer::setLanguage(uint64_t query_handle, const String &language) { + if (SteamUGC() == NULL) { return false; } UGCQueryHandle_t handle = (uint64_t)query_handle; @@ -3791,8 +3251,8 @@ bool SteamServer::setLanguage(uint64_t query_handle, const String& language){ } // Sets whether workshop items will be returned if they have one or more matching tag, or if all tags need to match on a pending UGC Query. -bool SteamServer::setMatchAnyTag(uint64_t query_handle, bool match_any_tag){ - if(SteamUGC() == NULL){ +bool SteamServer::setMatchAnyTag(uint64_t query_handle, bool match_any_tag) { + if (SteamUGC() == NULL) { return false; } UGCQueryHandle_t handle = (uint64_t)query_handle; @@ -3800,8 +3260,8 @@ bool SteamServer::setMatchAnyTag(uint64_t query_handle, bool match_any_tag){ } // Sets whether the order of the results will be updated based on the rank of items over a number of days on a pending UGC Query. -bool SteamServer::setRankedByTrendDays(uint64_t query_handle, uint32 days){ - if(SteamUGC() == NULL){ +bool SteamServer::setRankedByTrendDays(uint64_t query_handle, uint32 days) { + if (SteamUGC() == NULL) { return false; } UGCQueryHandle_t handle = (uint64_t)query_handle; @@ -3809,8 +3269,8 @@ bool SteamServer::setRankedByTrendDays(uint64_t query_handle, uint32 days){ } // Sets whether to return any additional images/videos attached to the items on a pending UGC Query. -bool SteamServer::setReturnAdditionalPreviews(uint64_t query_handle, bool return_additional_previews){ - if(SteamUGC() == NULL){ +bool SteamServer::setReturnAdditionalPreviews(uint64_t query_handle, bool return_additional_previews) { + if (SteamUGC() == NULL) { return false; } UGCQueryHandle_t handle = (uint64_t)query_handle; @@ -3818,8 +3278,8 @@ bool SteamServer::setReturnAdditionalPreviews(uint64_t query_handle, bool return } // Sets whether to return the IDs of the child items of the items on a pending UGC Query. -bool SteamServer::setReturnChildren(uint64_t query_handle, bool return_children){ - if(SteamUGC() == NULL){ +bool SteamServer::setReturnChildren(uint64_t query_handle, bool return_children) { + if (SteamUGC() == NULL) { return false; } UGCQueryHandle_t handle = (uint64_t)query_handle; @@ -3827,8 +3287,8 @@ bool SteamServer::setReturnChildren(uint64_t query_handle, bool return_children) } // Sets whether to return any key-value tags for the items on a pending UGC Query. -bool SteamServer::setReturnKeyValueTags(uint64_t query_handle, bool return_key_value_tags){ - if(SteamUGC() == NULL){ +bool SteamServer::setReturnKeyValueTags(uint64_t query_handle, bool return_key_value_tags) { + if (SteamUGC() == NULL) { return false; } UGCQueryHandle_t handle = (uint64_t)query_handle; @@ -3836,8 +3296,8 @@ bool SteamServer::setReturnKeyValueTags(uint64_t query_handle, bool return_key_v } // Sets whether to return the full description for the items on a pending UGC Query. -bool SteamServer::setReturnLongDescription(uint64_t query_handle, bool return_long_description){ - if(SteamUGC() == NULL){ +bool SteamServer::setReturnLongDescription(uint64_t query_handle, bool return_long_description) { + if (SteamUGC() == NULL) { return false; } UGCQueryHandle_t handle = (uint64_t)query_handle; @@ -3845,8 +3305,8 @@ bool SteamServer::setReturnLongDescription(uint64_t query_handle, bool return_lo } // Sets whether to return the developer specified metadata for the items on a pending UGC Query. -bool SteamServer::setReturnMetadata(uint64_t query_handle, bool return_metadata){ - if(SteamUGC() == NULL){ +bool SteamServer::setReturnMetadata(uint64_t query_handle, bool return_metadata) { + if (SteamUGC() == NULL) { return false; } UGCQueryHandle_t handle = (uint64_t)query_handle; @@ -3854,8 +3314,8 @@ bool SteamServer::setReturnMetadata(uint64_t query_handle, bool return_metadata) } // Sets whether to only return IDs instead of all the details on a pending UGC Query. -bool SteamServer::setReturnOnlyIDs(uint64_t query_handle, bool return_only_ids){ - if(SteamUGC() == NULL){ +bool SteamServer::setReturnOnlyIDs(uint64_t query_handle, bool return_only_ids) { + if (SteamUGC() == NULL) { return false; } UGCQueryHandle_t handle = (uint64_t)query_handle; @@ -3863,8 +3323,8 @@ bool SteamServer::setReturnOnlyIDs(uint64_t query_handle, bool return_only_ids){ } // Sets whether to return the the playtime stats on a pending UGC Query. -bool SteamServer::setReturnPlaytimeStats(uint64_t query_handle, uint32 days){ - if(SteamUGC() == NULL){ +bool SteamServer::setReturnPlaytimeStats(uint64_t query_handle, uint32 days) { + if (SteamUGC() == NULL) { return false; } UGCQueryHandle_t handle = (uint64_t)query_handle; @@ -3872,8 +3332,8 @@ bool SteamServer::setReturnPlaytimeStats(uint64_t query_handle, uint32 days){ } // Sets whether to only return the the total number of matching items on a pending UGC Query. -bool SteamServer::setReturnTotalOnly(uint64_t query_handle, bool return_total_only){ - if(SteamUGC() == NULL){ +bool SteamServer::setReturnTotalOnly(uint64_t query_handle, bool return_total_only) { + if (SteamUGC() == NULL) { return false; } UGCQueryHandle_t handle = (uint64_t)query_handle; @@ -3881,8 +3341,8 @@ bool SteamServer::setReturnTotalOnly(uint64_t query_handle, bool return_total_on } // Sets a string to that items need to match in either the title or the description on a pending UGC Query. -bool SteamServer::setSearchText(uint64_t query_handle, const String& search_text){ - if(SteamUGC() == NULL){ +bool SteamServer::setSearchText(uint64_t query_handle, const String &search_text) { + if (SteamUGC() == NULL) { return false; } UGCQueryHandle_t handle = (uint64_t)query_handle; @@ -3890,8 +3350,8 @@ bool SteamServer::setSearchText(uint64_t query_handle, const String& search_text } // Allows the user to rate a workshop item up or down. -void SteamServer::setUserItemVote(uint64_t published_file_id, bool vote_up){ - if(SteamUGC() != NULL){ +void SteamServer::setUserItemVote(uint64_t published_file_id, bool vote_up) { + if (SteamUGC() != NULL) { PublishedFileId_t file_id = (uint64_t)published_file_id; SteamAPICall_t api_call = SteamUGC()->SetUserItemVote(file_id, vote_up); callResultSetUserItemVote.Set(api_call, this, &SteamServer::set_user_item_vote); @@ -3899,8 +3359,8 @@ void SteamServer::setUserItemVote(uint64_t published_file_id, bool vote_up){ } // Starts the item update process. -uint64_t SteamServer::startItemUpdate(uint32_t app_id, uint64_t published_file_id){ - if(SteamUGC() == NULL){ +uint64_t SteamServer::startItemUpdate(uint32_t app_id, uint64_t published_file_id) { + if (SteamUGC() == NULL) { return 0; } AppId_t app = (uint32_t)app_id; @@ -3909,12 +3369,12 @@ uint64_t SteamServer::startItemUpdate(uint32_t app_id, uint64_t published_file_i } // Start tracking playtime on a set of workshop items. -void SteamServer::startPlaytimeTracking(Array published_file_ids){ - if(SteamUGC() != NULL){ +void SteamServer::startPlaytimeTracking(Array published_file_ids) { + if (SteamUGC() != NULL) { uint32 fileCount = published_file_ids.size(); - if(fileCount > 0){ + if (fileCount > 0) { PublishedFileId_t *file_ids = new PublishedFileId_t[fileCount]; - for(uint32 i = 0; i < fileCount; i++){ + for (uint32 i = 0; i < fileCount; i++) { file_ids[i] = (uint64_t)published_file_ids[i]; } SteamAPICall_t api_call = SteamUGC()->StartPlaytimeTracking(file_ids, fileCount); @@ -3925,13 +3385,13 @@ void SteamServer::startPlaytimeTracking(Array published_file_ids){ } // Stop tracking playtime on a set of workshop items. -void SteamServer::stopPlaytimeTracking(Array published_file_ids){ - if(SteamUGC() != NULL){ +void SteamServer::stopPlaytimeTracking(Array published_file_ids) { + if (SteamUGC() != NULL) { uint32 fileCount = published_file_ids.size(); - if(fileCount > 0){ + if (fileCount > 0) { PublishedFileId_t *file_ids = new PublishedFileId_t[fileCount]; Array files; - for(uint32 i = 0; i < fileCount; i++){ + for (uint32 i = 0; i < fileCount; i++) { file_ids[i] = (uint64_t)published_file_ids[i]; } SteamAPICall_t api_call = SteamUGC()->StopPlaytimeTracking(file_ids, fileCount); @@ -3942,16 +3402,16 @@ void SteamServer::stopPlaytimeTracking(Array published_file_ids){ } // Stop tracking playtime of all workshop items. -void SteamServer::stopPlaytimeTrackingForAllItems(){ - if(SteamUGC() != NULL){ +void SteamServer::stopPlaytimeTrackingForAllItems() { + if (SteamUGC() != NULL) { SteamAPICall_t api_call = SteamUGC()->StopPlaytimeTrackingForAllItems(); callResultStopPlaytimeTracking.Set(api_call, this, &SteamServer::stop_playtime_tracking); } } // Returns any app dependencies that are associated with the given item. -void SteamServer::getAppDependencies(uint64_t published_file_id){ - if(SteamUGC() != NULL){ +void SteamServer::getAppDependencies(uint64_t published_file_id) { + if (SteamUGC() != NULL) { PublishedFileId_t file_id = (uint64_t)published_file_id; SteamAPICall_t api_call = SteamUGC()->GetAppDependencies(file_id); callResultGetAppDependencies.Set(api_call, this, &SteamServer::get_app_dependencies_result); @@ -3959,13 +3419,14 @@ void SteamServer::getAppDependencies(uint64_t published_file_id){ } // Uploads the changes made to an item to the Steam Workshop; to be called after setting your changes. -void SteamServer::submitItemUpdate(uint64_t update_handle, const String& change_note){ - if(SteamUGC() != NULL){ +void SteamServer::submitItemUpdate(uint64_t update_handle, const String &change_note) { + if (SteamUGC() != NULL) { UGCUpdateHandle_t handle = uint64(update_handle); SteamAPICall_t api_call; if (change_note.empty()) { api_call = SteamUGC()->SubmitItemUpdate(handle, NULL); - } else { + } + else { api_call = SteamUGC()->SubmitItemUpdate(handle, change_note.utf8().get_data()); } callResultItemUpdate.Set(api_call, this, &SteamServer::item_updated); @@ -3973,8 +3434,8 @@ void SteamServer::submitItemUpdate(uint64_t update_handle, const String& change_ } // Subscribe to a workshop item. It will be downloaded and installed as soon as possible. -void SteamServer::subscribeItem(uint64_t published_file_id){ - if(SteamUGC() != NULL){ +void SteamServer::subscribeItem(uint64_t published_file_id) { + if (SteamUGC() != NULL) { PublishedFileId_t file_id = (uint64_t)published_file_id; SteamAPICall_t api_call = SteamUGC()->SubscribeItem(file_id); callResultSubscribeItem.Set(api_call, this, &SteamServer::subscribe_item); @@ -3982,15 +3443,15 @@ void SteamServer::subscribeItem(uint64_t published_file_id){ } // SuspendDownloads( true ) will suspend all workshop downloads until SuspendDownloads( false ) is called or the game ends. -void SteamServer::suspendDownloads(bool suspend){ - if(SteamUGC() != NULL){ +void SteamServer::suspendDownloads(bool suspend) { + if (SteamUGC() != NULL) { SteamUGC()->SuspendDownloads(suspend); } } // Unsubscribe from a workshop item. This will result in the item being removed after the game quits. -void SteamServer::unsubscribeItem(uint64_t published_file_id){ - if(SteamUGC() != NULL){ +void SteamServer::unsubscribeItem(uint64_t published_file_id) { + if (SteamUGC() != NULL) { PublishedFileId_t file_id = (uint64_t)published_file_id; SteamAPICall_t api_call = SteamUGC()->UnsubscribeItem(file_id); callResultUnsubscribeItem.Set(api_call, this, &SteamServer::unsubscribe_item); @@ -3998,8 +3459,8 @@ void SteamServer::unsubscribeItem(uint64_t published_file_id){ } // Updates an existing additional preview file for the item. -bool SteamServer::updateItemPreviewFile(uint64_t update_handle, uint32 index, const String& preview_file){ - if(SteamUGC() == NULL){ +bool SteamServer::updateItemPreviewFile(uint64_t update_handle, uint32 index, const String &preview_file) { + if (SteamUGC() == NULL) { return false; } UGCUpdateHandle_t handle = uint64(update_handle); @@ -4007,8 +3468,8 @@ bool SteamServer::updateItemPreviewFile(uint64_t update_handle, uint32 index, co } // Updates an additional video preview from YouTube for the item. -bool SteamServer::updateItemPreviewVideo(uint64_t update_handle, uint32 index, const String& video_id){ - if(SteamUGC() == NULL){ +bool SteamServer::updateItemPreviewVideo(uint64_t update_handle, uint32 index, const String &video_id) { + if (SteamUGC() == NULL) { return false; } UGCUpdateHandle_t handle = uint64(update_handle); @@ -4016,24 +3477,24 @@ bool SteamServer::updateItemPreviewVideo(uint64_t update_handle, uint32 index, c } // Show the app's latest Workshop EULA to the user in an overlay window, where they can accept it or not. -bool SteamServer::showWorkshopEULA(){ - if(SteamUGC() == NULL){ +bool SteamServer::showWorkshopEULA() { + if (SteamUGC() == NULL) { return false; } return SteamUGC()->ShowWorkshopEULA(); } // Retrieve information related to the user's acceptance or not of the app's specific Workshop EULA. -void SteamServer::getWorkshopEULAStatus(){ - if(SteamUGC() != NULL){ +void SteamServer::getWorkshopEULAStatus() { + if (SteamUGC() != NULL) { SteamAPICall_t api_call = SteamUGC()->GetWorkshopEULAStatus(); callResultWorkshopEULAStatus.Set(api_call, this, &SteamServer::workshop_eula_status); } } // Set the time range this item was created. -bool SteamServer::setTimeCreatedDateRange(uint64_t update_handle, uint32 start, uint32 end){ - if(SteamUGC() == NULL){ +bool SteamServer::setTimeCreatedDateRange(uint64_t update_handle, uint32 start, uint32 end) { + if (SteamUGC() == NULL) { return false; } UGCUpdateHandle_t handle = uint64(update_handle); @@ -4041,8 +3502,8 @@ bool SteamServer::setTimeCreatedDateRange(uint64_t update_handle, uint32 start, } // Set the time range this item was updated. -bool SteamServer::setTimeUpdatedDateRange(uint64_t update_handle, uint32 start, uint32 end){ - if(SteamUGC() == NULL){ +bool SteamServer::setTimeUpdatedDateRange(uint64_t update_handle, uint32 start, uint32 end) { + if (SteamUGC() == NULL) { return false; } UGCUpdateHandle_t handle = uint64(update_handle); @@ -4050,146 +3511,47 @@ bool SteamServer::setTimeUpdatedDateRange(uint64_t update_handle, uint32 start, } -///////////////////////////////////////////////// ///// SIGNALS / CALLBACKS ///////////////////////////////////////////////// // // GAME SERVER CALLBACKS //////////////////////// // // Called when a connection attempt has failed. This will occur periodically if the Steam client is not connected, and has failed when retrying to establish a connection. -void SteamServer::server_connect_failure(SteamServerConnectFailure_t* serverData){ - int result = serverData->m_eResult; - bool retrying = serverData->m_bStillRetrying; +void SteamServer::server_connect_failure(SteamServerConnectFailure_t* server_data){ + int result = server_data->m_eResult; + bool retrying = server_data->m_bStillRetrying; emit_signal("server_connect_failure", result, retrying); } -// Server has connected to the Steam back-end; serverData has no fields. -void SteamServer::server_connected(SteamServersConnected_t* serverData){ +// Server has connected to the Steam back-end; server_data has no fields. +void SteamServer::server_connected(SteamServersConnected_t* server_data){ emit_signal("server_connected"); } // Called if the client has lost connection to the Steam servers. Real-time services will be disabled until a matching SteamServersConnected_t has been posted. -void SteamServer::server_disconnected(SteamServersDisconnected_t* serverData){ - int result = serverData->m_eResult; +void SteamServer::server_disconnected(SteamServersDisconnected_t* server_data){ + int result = server_data->m_eResult; emit_signal("server_disconnected", result); } // Client has been approved to connect to this game server. -void SteamServer::client_approved(GSClientApprove_t* clientData){ - uint64_t steam_id = clientData->m_SteamID.ConvertToUint64(); - uint64_t owner_id = clientData->m_OwnerSteamID.ConvertToUint64(); +void SteamServer::client_approved(GSClientApprove_t* client_data){ + uint64_t steam_id = client_data->m_SteamID.ConvertToUint64(); + uint64_t owner_id = client_data->m_OwnerSteamID.ConvertToUint64(); emit_signal("client_approved", steam_id, owner_id); } // Client has been denied to connection to this game server. -void SteamServer::client_denied(GSClientDeny_t* clientData){ - uint64_t steam_id = clientData->m_SteamID.ConvertToUint64(); - int reason; - // Convert reason. - if(clientData->m_eDenyReason == k_EDenyInvalid){ - reason = DENY_INVALID; - } - else if(clientData->m_eDenyReason == k_EDenyInvalidVersion){ - reason = DENY_INVALID_VERSION; - } - else if(clientData->m_eDenyReason == k_EDenyGeneric){ - reason = DENY_GENERIC; - } - else if(clientData->m_eDenyReason == k_EDenyNotLoggedOn){ - reason = DENY_NOT_LOGGED_ON; - } - else if(clientData->m_eDenyReason == k_EDenyNoLicense){ - reason = DENY_NO_LICENSE; - } - else if(clientData->m_eDenyReason == k_EDenyCheater){ - reason = DENY_CHEATER; - } - else if(clientData->m_eDenyReason == k_EDenyLoggedInElseWhere){ - reason = DENY_LOGGED_IN_ELSEWHERE; - } - else if(clientData->m_eDenyReason == k_EDenyUnknownText){ - reason = DENY_UNKNOWN_TEXT; - } - else if(clientData->m_eDenyReason == k_EDenyIncompatibleAnticheat){ - reason = DENY_INCOMPATIBLE_ANTI_CHEAT; - } - else if(clientData->m_eDenyReason == k_EDenyMemoryCorruption){ - reason = DENY_MEMORY_CORRUPTION; - } - else if(clientData->m_eDenyReason == k_EDenyIncompatibleSoftware){ - reason = DENY_INCOMPATIBLE_SOFTWARE; - } - else if(clientData->m_eDenyReason == k_EDenySteamConnectionLost){ - reason = DENY_STEAM_CONNECTION_LOST; - } - else if(clientData->m_eDenyReason == k_EDenySteamConnectionError){ - reason = DENY_STEAM_CONNECTION_ERROR; - } - else if(clientData->m_eDenyReason == k_EDenySteamResponseTimedOut){ - reason = DENY_STEAM_RESPONSE_TIMED_OUT; - } - else if(clientData->m_eDenyReason == k_EDenySteamValidationStalled){ - reason = DENY_STEAM_VALIDATION_STALLED; - } - else{ - reason = DENY_STEAM_OWNER_LEFT_GUEST_USER; - } +void SteamServer::client_denied(GSClientDeny_t* client_data){ + uint64_t steam_id = client_data->m_SteamID.ConvertToUint64(); + SteamServer::DenyReason reason = (SteamServer::DenyReason)client_data->m_eDenyReason; emit_signal("client_denied", steam_id, reason); } // Request the game server should kick the user. -void SteamServer::client_kick(GSClientKick_t* clientData){ - uint64_t steam_id = clientData->m_SteamID.ConvertToUint64(); - int reason; - // Convert reason. - if(clientData->m_eDenyReason == k_EDenyInvalid){ - reason = DENY_INVALID; - } - else if(clientData->m_eDenyReason == k_EDenyInvalidVersion){ - reason = DENY_INVALID_VERSION; - } - else if(clientData->m_eDenyReason == k_EDenyGeneric){ - reason = DENY_GENERIC; - } - else if(clientData->m_eDenyReason == k_EDenyNotLoggedOn){ - reason = DENY_NOT_LOGGED_ON; - } - else if(clientData->m_eDenyReason == k_EDenyNoLicense){ - reason = DENY_NO_LICENSE; - } - else if(clientData->m_eDenyReason == k_EDenyCheater){ - reason = DENY_CHEATER; - } - else if(clientData->m_eDenyReason == k_EDenyLoggedInElseWhere){ - reason = DENY_LOGGED_IN_ELSEWHERE; - } - else if(clientData->m_eDenyReason == k_EDenyUnknownText){ - reason = DENY_UNKNOWN_TEXT; - } - else if(clientData->m_eDenyReason == k_EDenyIncompatibleAnticheat){ - reason = DENY_INCOMPATIBLE_ANTI_CHEAT; - } - else if(clientData->m_eDenyReason == k_EDenyMemoryCorruption){ - reason = DENY_MEMORY_CORRUPTION; - } - else if(clientData->m_eDenyReason == k_EDenyIncompatibleSoftware){ - reason = DENY_INCOMPATIBLE_SOFTWARE; - } - else if(clientData->m_eDenyReason == k_EDenySteamConnectionLost){ - reason = DENY_STEAM_CONNECTION_LOST; - } - else if(clientData->m_eDenyReason == k_EDenySteamConnectionError){ - reason = DENY_STEAM_CONNECTION_ERROR; - } - else if(clientData->m_eDenyReason == k_EDenySteamResponseTimedOut){ - reason = DENY_STEAM_RESPONSE_TIMED_OUT; - } - else if(clientData->m_eDenyReason == k_EDenySteamValidationStalled){ - reason = DENY_STEAM_VALIDATION_STALLED; - } - else{ - reason = DENY_STEAM_OWNER_LEFT_GUEST_USER; - } +void SteamServer::client_kick(GSClientKick_t* client_data){ + uint64_t steam_id = client_data->m_SteamID.ConvertToUint64(); + SteamServer::DenyReason reason = (SteamServer::DenyReason)client_data->m_eDenyReason; emit_signal("client_kick", steam_id, reason); } @@ -4201,74 +3563,56 @@ void SteamServer::policy_response(GSPolicyResponse_t* policyData){ } // Sent as a reply to RequestUserGroupStatus(). -void SteamServer::client_group_status(GSClientGroupStatus_t* clientData){ - uint64_t steam_id = clientData->m_SteamIDUser.ConvertToUint64(); - uint64_t group_id = clientData->m_SteamIDGroup.ConvertToUint64(); - bool member = clientData->m_bMember; - bool officer = clientData->m_bOfficer; +void SteamServer::client_group_status(GSClientGroupStatus_t* client_data){ + uint64_t steam_id = client_data->m_SteamIDUser.ConvertToUint64(); + uint64_t group_id = client_data->m_SteamIDGroup.ConvertToUint64(); + bool member = client_data->m_bMember; + bool officer = client_data->m_bOfficer; emit_signal("client_group_status", steam_id, group_id, member, officer); } // Sent as a reply to AssociateWithClan(). -void SteamServer::associate_clan(AssociateWithClanResult_t* clanData){ - int result; - if(clanData->m_eResult == k_EResultOK){ - result = RESULT_OK; - } - else{ - result = RESULT_FAIL; - } +void SteamServer::associate_clan(AssociateWithClanResult_t* clan_data){ + SteamServer::Result result = (SteamServer::Result)clan_data->m_eResult; emit_signal("associate_clan", result); } // Sent as a reply to ComputeNewPlayerCompatibility(). -void SteamServer::player_compat(ComputeNewPlayerCompatibilityResult_t* playerData){ - int result; - if(playerData->m_eResult == k_EResultNoConnection){ - result = RESULT_NO_CONNECTION; - } - else if(playerData->m_eResult == k_EResultTimeout){ - result = RESULT_TIMEOUT; - } - else if(playerData->m_eResult == k_EResultFail){ - result = RESULT_FAIL; - } - else{ - result = RESULT_OK; - } - int players_dont_like_candidate = playerData->m_cPlayersThatDontLikeCandidate; - int players_candidate_doesnt_like = playerData->m_cPlayersThatCandidateDoesntLike; - int clan_players_dont_like_candidate = playerData->m_cClanPlayersThatDontLikeCandidate; - uint64_t steam_id = playerData->m_SteamIDCandidate.ConvertToUint64(); +void SteamServer::player_compat(ComputeNewPlayerCompatibilityResult_t* player_data){ + int result = player_data->m_eResult; + int players_dont_like_candidate = player_data->m_cPlayersThatDontLikeCandidate; + int players_candidate_doesnt_like = player_data->m_cPlayersThatCandidateDoesntLike; + int clan_players_dont_like_candidate = player_data->m_cClanPlayersThatDontLikeCandidate; + uint64_t steam_id = player_data->m_SteamIDCandidate.ConvertToUint64(); emit_signal("player_compat", result, players_dont_like_candidate, players_candidate_doesnt_like, clan_players_dont_like_candidate, steam_id); } // GAME SERVER STATS CALLBACKS ////////////////// // // Result when getting the latests stats and achievements for a user from the server. -void SteamServer::stats_received(GSStatsReceived_t* callData, bool bioFailure){ - EResult result = callData->m_eResult; - uint64_t steam_id = callData->m_steamIDUser.ConvertToUint64(); +void SteamServer::stats_received(GSStatsReceived_t* call_data, bool io_failure){ + EResult result = call_data->m_eResult; + uint64_t steam_id = call_data->m_steamIDUser.ConvertToUint64(); emit_signal("stats_received", result, steam_id); } // Result of a request to store the user stats. -void SteamServer::stats_stored(GSStatsStored_t* callData){ - EResult result = callData->m_eResult; - uint64_t steam_id = callData->m_steamIDUser.ConvertToUint64(); +void SteamServer::stats_stored(GSStatsStored_t* call_data){ + EResult result = call_data->m_eResult; + uint64_t steam_id = call_data->m_steamIDUser.ConvertToUint64(); emit_signal("stats_stored", result, steam_id); } // Callback indicating that a user's stats have been unloaded. -void SteamServer::stats_unloaded(GSStatsUnloaded_t* callData){ - uint64_t steam_id = callData->m_steamIDUser.ConvertToUint64(); +void SteamServer::stats_unloaded(GSStatsUnloaded_t* call_data){ + uint64_t steam_id = call_data->m_steamIDUser.ConvertToUint64(); emit_signal("stats_unloaded", steam_id); } // HTTP CALLBACKS /////////////////////////////// // -//! Result when an HTTP request completes. If you're using GetHTTPStreamingResponseBodyData then you should be using the HTTPRequestHeadersReceived_t or HTTPRequestDataReceived_t. -void SteamServer::http_request_completed(HTTPRequestCompleted_t* call_data){ +// Result when an HTTP request completes. If you're using GetHTTPStreamingResponseBodyData then you should be using the HTTPRequestHeadersReceived_t or HTTPRequestDataReceived_t. +void SteamServer::http_request_completed(HTTPRequestCompleted_t *call_data) { uint32 cookie_handle = call_data->m_hRequest; uint64_t context_value = call_data->m_ulContextValue; bool request_success = call_data->m_bRequestSuccessful; @@ -4277,8 +3621,8 @@ void SteamServer::http_request_completed(HTTPRequestCompleted_t* call_data){ emit_signal("http_request_completed", cookie_handle, context_value, request_success, status_code, body_size); } -//! Triggered when a chunk of data is received from a streaming HTTP request. -void SteamServer::http_request_data_received(HTTPRequestDataReceived_t* call_data){ +// Triggered when a chunk of data is received from a streaming HTTP request. +void SteamServer::http_request_data_received(HTTPRequestDataReceived_t *call_data) { uint32 cookie_handle = call_data->m_hRequest; uint64_t context_value = call_data->m_ulContextValue; uint32 offset = call_data->m_cOffset; @@ -4286,8 +3630,8 @@ void SteamServer::http_request_data_received(HTTPRequestDataReceived_t* call_dat emit_signal("http_request_data_received", cookie_handle, context_value, offset, bytes_received); } -//! Triggered when HTTP headers are received from a streaming HTTP request. -void SteamServer::http_request_headers_received(HTTPRequestHeadersReceived_t* call_data){ +// Triggered when HTTP headers are received from a streaming HTTP request. +void SteamServer::http_request_headers_received(HTTPRequestHeadersReceived_t *call_data) { uint32 cookie_handle = call_data->m_hRequest; uint64_t context_value = call_data->m_ulContextValue; emit_signal("http_request_headers_received", cookie_handle, context_value); @@ -4296,17 +3640,17 @@ void SteamServer::http_request_headers_received(HTTPRequestHeadersReceived_t* ca // INVENTORY CALLBACKS ////////////////////////// // // This callback is triggered whenever item definitions have been updated, which could be in response to LoadItemDefinitions or any time new item definitions are available (eg, from the dynamic addition of new item types while players are still in-game). -void SteamServer::inventory_definition_update(SteamInventoryDefinitionUpdate_t *call_data){ +void SteamServer::inventory_definition_update(SteamInventoryDefinitionUpdate_t *call_data) { // Create the return array Array definitions; // Set the array size variable uint32 size = 0; // Get the item defition IDs - if(SteamInventory()->GetItemDefinitionIDs(NULL, &size)){ + if (SteamInventory()->GetItemDefinitionIDs(NULL, &size)) { SteamItemDef_t *id_array = new SteamItemDef_t[size]; - if(SteamInventory()->GetItemDefinitionIDs(id_array, &size)){ + if (SteamInventory()->GetItemDefinitionIDs(id_array, &size)) { // Loop through the temporary array and populate the return array - for(uint32 i = 0; i < size; i++){ + for (uint32 i = 0; i < size; i++) { definitions.append(id_array[i]); } } @@ -4319,7 +3663,7 @@ void SteamServer::inventory_definition_update(SteamInventoryDefinitionUpdate_t * // Triggered when GetAllItems successfully returns a result which is newer / fresher than the last known result. (It will not trigger if the inventory hasn't changed, or if results from two overlapping calls are reversed in flight and the earlier result is already known to be stale/out-of-date.) // The regular SteamInventoryResultReady_t callback will still be triggered immediately afterwards; this is an additional notification for your convenience. -void SteamServer::inventory_full_update(SteamInventoryFullUpdate_t *call_data){ +void SteamServer::inventory_full_update(SteamInventoryFullUpdate_t *call_data) { // Set the handle inventory_handle = call_data->m_handle; // Send the handle back to the user @@ -4327,7 +3671,7 @@ void SteamServer::inventory_full_update(SteamInventoryFullUpdate_t *call_data){ } // This is fired whenever an inventory result transitions from k_EResultPending to any other completed state, see GetResultStatus for the complete list of states. There will always be exactly one callback per handle. -void SteamServer::inventory_result_ready(SteamInventoryResultReady_t *call_data){ +void SteamServer::inventory_result_ready(SteamInventoryResultReady_t *call_data) { // Get the result int result = call_data->m_result; // Get the handle and pass it over @@ -4338,30 +3682,27 @@ void SteamServer::inventory_result_ready(SteamInventoryResultReady_t *call_data) // NETWORKING CALLBACKS ///////////////////////// // // Called when packets can't get through to the specified user. All queued packets unsent at this point will be dropped, further attempts to send will retry making the connection (but will be dropped if we fail again). -void SteamServer::p2p_session_connect_fail(P2PSessionConnectFail_t* call_data) { - uint64_t steam_id_remote = call_data->m_steamIDRemote.ConvertToUint64(); +void SteamServer::p2p_session_connect_fail(P2PSessionConnectFail_t *call_data) { + uint64_t remote_steam_id = call_data->m_steamIDRemote.ConvertToUint64(); uint8_t session_error = call_data->m_eP2PSessionError; - emit_signal("p2p_session_connect_fail", steam_id_remote, session_error); + emit_signal("p2p_session_connect_fail", remote_steam_id, session_error); } // A user wants to communicate with us over the P2P channel via the sendP2PPacket. In response, a call to acceptP2PSessionWithUser needs to be made, if you want to open the network channel with them. -void SteamServer::p2p_session_request(P2PSessionRequest_t* call_data){ - uint64_t steam_id_remote = call_data->m_steamIDRemote.ConvertToUint64(); - emit_signal("p2p_session_request", steam_id_remote); +void SteamServer::p2p_session_request(P2PSessionRequest_t *call_data) { + uint64_t remote_steam_id = call_data->m_steamIDRemote.ConvertToUint64(); + emit_signal("p2p_session_request", remote_steam_id); } // NETWORKING MESSAGES CALLBACKS //////////////// // // Posted when a remote host is sending us a message, and we do not already have a session with them. -void SteamServer::network_messages_session_request(SteamNetworkingMessagesSessionRequest_t* call_data){ - SteamNetworkingIdentity remote = call_data->m_identityRemote; - char identity[STEAM_BUFFER_SIZE]; - remote.ToString(identity, STEAM_BUFFER_SIZE); - emit_signal("network_messages_session_request", identity); +void SteamServer::network_messages_session_request(SteamNetworkingMessagesSessionRequest_t *call_data) { + emit_signal("network_messages_session_request", getSteamIDFromIdentity(call_data->m_identityRemote)); } // Posted when we fail to establish a connection, or we detect that communications have been disrupted it an unusual way. -void SteamServer::network_messages_session_failed(SteamNetworkingMessagesSessionFailed_t* call_data){ +void SteamServer::network_messages_session_failed(SteamNetworkingMessagesSessionFailed_t *call_data) { SteamNetConnectionInfo_t info = call_data->m_info; // Parse out the reason for failure int reason = info.m_eEndReason; @@ -4371,21 +3712,17 @@ void SteamServer::network_messages_session_failed(SteamNetworkingMessagesSession // NETWORKING SOCKETS CALLBACKS ///////////////// // // This callback is posted whenever a connection is created, destroyed, or changes state. The m_info field will contain a complete description of the connection at the time the change occurred and the callback was posted. In particular, m_info.m_eState will have the new connection state. -void SteamServer::network_connection_status_changed(SteamNetConnectionStatusChangedCallback_t* call_data){ +void SteamServer::network_connection_status_changed(SteamNetConnectionStatusChangedCallback_t *call_data) { // Connection handle. uint64_t connect_handle = call_data->m_hConn; // Full connection info. SteamNetConnectionInfo_t connection_info = call_data->m_info; // Move connection info into a dictionary Dictionary connection; - char identity[STEAM_BUFFER_SIZE]; - connection_info.m_identityRemote.ToString(identity, STEAM_BUFFER_SIZE); - connection["identity"] = identity; + connection["identity"] = getSteamIDFromIdentity(connection_info.m_identityRemote); connection["user_data"] = (uint64_t)connection_info.m_nUserData; connection["listen_socket"] = connection_info.m_hListenSocket; - char ip_address[STEAM_BUFFER_SIZE]; - connection_info.m_addrRemote.ToString(ip_address, STEAM_BUFFER_SIZE, true); - connection["remote_address"] = ip_address; + connection["remote_address"] = getStringFromSteamIP(connection_info.m_addrRemote); connection["remote_pop"] = connection_info.m_idPOPRemote; connection["pop_relay"] = connection_info.m_idPOPRelay; connection["connection_state"] = connection_info.m_eState; @@ -4399,12 +3736,12 @@ void SteamServer::network_connection_status_changed(SteamNetConnectionStatusChan } // This callback is posted whenever the state of our readiness changes. -void SteamServer::network_authentication_status(SteamNetAuthenticationStatus_t* call_data){ +void SteamServer::network_authentication_status(SteamNetAuthenticationStatus_t *call_data) { // Status. int available = call_data->m_eAvail; // Non-localized English language status. For diagnostic / debugging purposes only. char *debug_message = new char[256]; - sprintf(debug_message, "%s", call_data->m_debugMsg); + snprintf(debug_message, 256, "%s", call_data->m_debugMsg); // Send the data back via signal emit_signal("network_authentication_status", available, debug_message); delete[] debug_message; @@ -4412,38 +3749,28 @@ void SteamServer::network_authentication_status(SteamNetAuthenticationStatus_t* // A struct used to describe a "fake IP" we have been assigned to use as an identifier. // This callback is posted when ISteamNetworkingSoockets::BeginAsyncRequestFakeIP completes. -void SteamServer::fake_ip_result(SteamNetworkingFakeIPResult_t* call_data){ +void SteamServer::fake_ip_result(SteamNetworkingFakeIPResult_t *call_data) { int result = call_data->m_eResult; - // Pass this new networking identity to the map - networking_identities["fake_ip_identity"] = call_data->m_identity; - uint32 ip = call_data->m_unIP; - // Convert the IP address back to a string - const int NBYTES = 4; - uint8 octet[NBYTES]; - char fake_ip[16]; - for(int i = 0; i < NBYTES; i++){ - octet[i] = ip >> (i * 8); - } - sprintf(fake_ip, "%d.%d.%d.%d", octet[0], octet[1], octet[2], octet[3]); + uint32 fake_ip = call_data->m_unIP; // Get the ports as an array Array port_list; - uint16* ports = call_data->m_unPorts; - for(uint16 i = 0; i < sizeof(ports); i++){ + uint16 *ports = call_data->m_unPorts; + for (uint16 i = 0; i < sizeof(ports); i++) { port_list.append(ports[i]); } - emit_signal("fake_ip_result", result, "fake_ip_identity", fake_ip, port_list); + emit_signal("fake_ip_result", result, getSteamIDFromIdentity(call_data->m_identity), getStringFromIP(fake_ip), port_list); } // NETWORKING UTILS CALLBACKS /////////////////// // // A struct used to describe our readiness to use the relay network. -void SteamServer::relay_network_status(SteamRelayNetworkStatus_t* call_data){ +void SteamServer::relay_network_status(SteamRelayNetworkStatus_t *call_data) { int available = call_data->m_eAvail; int ping_measurement = call_data->m_bPingMeasurementInProgress; int available_config = call_data->m_eAvailNetworkConfig; int available_relay = call_data->m_eAvailAnyRelay; char *debug_message = new char[256]; - sprintf(debug_message, "%s", call_data->m_debugMsg); + snprintf(debug_message, 256, "%s", call_data->m_debugMsg); // debug_message = call_data->m_debugMsg; emit_signal("relay_network_status", available, ping_measurement, available_config, available_relay, debug_message); delete[] debug_message; @@ -4453,14 +3780,14 @@ void SteamServer::relay_network_status(SteamRelayNetworkStatus_t* call_data){ // // Purpose: one or more files for this app have changed locally after syncing to remote session changes. // Note: only posted if this happens DURING the local app session. -void SteamServer::local_file_changed(RemoteStorageLocalFileChange_t* call_data){ +void SteamServer::local_file_changed(RemoteStorageLocalFileChange_t *call_data) { emit_signal("local_file_changed"); } // UGC CALLBACKS //////////////////////////////// // // Called when a workshop item has been downloaded. -void SteamServer::item_downloaded(DownloadItemResult_t* call_data){ +void SteamServer::item_downloaded(DownloadItemResult_t *call_data) { EResult result = call_data->m_eResult; PublishedFileId_t file_id = call_data->m_nPublishedFileId; AppId_t app_id = call_data->m_unAppID; @@ -4468,21 +3795,20 @@ void SteamServer::item_downloaded(DownloadItemResult_t* call_data){ } // Called when a workshop item has been installed or updated. -void SteamServer::item_installed(ItemInstalled_t* call_data){ +void SteamServer::item_installed(ItemInstalled_t *call_data) { AppId_t app_id = call_data->m_unAppID; PublishedFileId_t file_id = call_data->m_nPublishedFileId; emit_signal("item_installed", app_id, (uint64_t)file_id); } // Purpose: signal that the list of subscribed items changed. -void SteamServer::user_subscribed_items_list_changed(UserSubscribedItemsListChanged_t* call_data){ +void SteamServer::user_subscribed_items_list_changed(UserSubscribedItemsListChanged_t *call_data) { uint32 app_id = call_data->m_nAppID; emit_signal("user_subscribed_items_list_changed", app_id); } -///////////////////////////////////////////////// -///// SIGNALS / CALL RESULTS //////////////////// +///// SIGNALS / CALL RESULTS ///////////////////////////////////////////////// // // STEAMWORKS ERROR SIGNAL ////////////////////// @@ -4496,11 +3822,11 @@ void SteamServer::steamworksError(const String& failed_signal){ // INVENTORY CALL RESULTS /////////////////////// // // Returned when you have requested the list of "eligible" promo items that can be manually granted to the given user. These are promo items of type "manual" that won't be granted automatically. -void SteamServer::inventory_eligible_promo_item(SteamInventoryEligiblePromoItemDefIDs_t *call_data, bool io_failure){ - if(io_failure){ +void SteamServer::inventory_eligible_promo_item(SteamInventoryEligiblePromoItemDefIDs_t *call_data, bool io_failure) { + if (io_failure) { steamworksError("inventory_eligible_promo_item"); } - else{ + else { // Clean up call data CSteamID steam_id = call_data->m_steamID; int result = call_data->m_result; @@ -4513,9 +3839,9 @@ void SteamServer::inventory_eligible_promo_item(SteamInventoryEligiblePromoItemD // Convert eligible size uint32 array_size = (int)eligible; // Get the list - if(SteamInventory()->GetEligiblePromoItemDefinitionIDs(steam_id, id_array, &array_size)){ + if (SteamInventory()->GetEligiblePromoItemDefinitionIDs(steam_id, id_array, &array_size)) { // Loop through the temporary array and populate the return array - for(int i = 0; i < eligible; i++){ + for (int i = 0; i < eligible; i++) { definitions.append(id_array[i]); } } @@ -4527,28 +3853,28 @@ void SteamServer::inventory_eligible_promo_item(SteamInventoryEligiblePromoItemD } // Returned after StartPurchase is called. -void SteamServer::inventory_start_purchase_result(SteamInventoryStartPurchaseResult_t *call_data, bool io_failure){ - if(io_failure){ +void SteamServer::inventory_start_purchase_result(SteamInventoryStartPurchaseResult_t *call_data, bool io_failure) { + if (io_failure) { steamworksError("inventory_start_purchase_result"); } - else{ - if(call_data->m_result == k_EResultOK){ + else { + if (call_data->m_result == k_EResultOK) { uint64_t order_id = call_data->m_ulOrderID; uint64_t transaction_id = call_data->m_ulTransID; emit_signal("inventory_start_purchase_result", "success", order_id, transaction_id); } - else{ + else { emit_signal("inventory_start_purchase_result", "failure", 0, 0); } } } // Returned after RequestPrices is called. -void SteamServer::inventory_request_prices_result(SteamInventoryRequestPricesResult_t *call_data, bool io_failure){ - if(io_failure){ +void SteamServer::inventory_request_prices_result(SteamInventoryRequestPricesResult_t *call_data, bool io_failure) { + if (io_failure) { steamworksError("inventory_request_prices_result"); } - else{ + else { int result = call_data->m_result; String currency = call_data->m_rgchCurrency; emit_signal("inventory_request_prices_result", result, currency); @@ -4558,11 +3884,11 @@ void SteamServer::inventory_request_prices_result(SteamInventoryRequestPricesRes // REMOTE STORAGE CALL RESULTS ////////////////// // // Response when reading a file asyncrounously with FileReadAsync. -void SteamServer::file_read_async_complete(RemoteStorageFileReadAsyncComplete_t* call_data, bool io_failure){ - if(io_failure){ +void SteamServer::file_read_async_complete(RemoteStorageFileReadAsyncComplete_t *call_data, bool io_failure) { + if (io_failure) { steamworksError("file_read_async_complete"); } - else{ + else { uint64_t handle = call_data->m_hFileReadAsync; int result = call_data->m_eResult; uint32 offset = call_data->m_nOffset; @@ -4584,11 +3910,11 @@ void SteamServer::file_read_async_complete(RemoteStorageFileReadAsyncComplete_t* } // Response to a file being shared. -void SteamServer::file_share_result(RemoteStorageFileShareResult_t* call_data, bool io_failure){ - if(io_failure){ +void SteamServer::file_share_result(RemoteStorageFileShareResult_t *call_data, bool io_failure) { + if (io_failure) { steamworksError("file_share_result"); } - else{ + else { int result = call_data->m_eResult; uint64_t handle = call_data->m_hFile; char name[k_cchFilenameMax]; @@ -4598,22 +3924,22 @@ void SteamServer::file_share_result(RemoteStorageFileShareResult_t* call_data, b } // Response when writing a file asyncrounously with FileWriteAsync. -void SteamServer::file_write_async_complete(RemoteStorageFileWriteAsyncComplete_t* call_data, bool io_failure){ - if(io_failure){ +void SteamServer::file_write_async_complete(RemoteStorageFileWriteAsyncComplete_t *call_data, bool io_failure) { + if (io_failure) { steamworksError("file_write_async_complete"); } - else{ + else { int result = call_data->m_eResult; emit_signal("file_write_async_complete", result); } } // Response when downloading UGC -void SteamServer::download_ugc_result(RemoteStorageDownloadUGCResult_t* call_data, bool io_failure){ - if(io_failure){ +void SteamServer::download_ugc_result(RemoteStorageDownloadUGCResult_t *call_data, bool io_failure) { + if (io_failure) { steamworksError("download_ugc_result"); } - else{ + else { int result = call_data->m_eResult; uint64_t handle = call_data->m_hFile; uint32_t app_id = call_data->m_nAppID; @@ -4633,11 +3959,11 @@ void SteamServer::download_ugc_result(RemoteStorageDownloadUGCResult_t* call_dat } // Called when the user has unsubscribed from a piece of UGC. Result from ISteamUGC::UnsubscribeItem. -void SteamServer::unsubscribe_item(RemoteStorageUnsubscribePublishedFileResult_t* call_data, bool io_failure){ - if(io_failure){ +void SteamServer::unsubscribe_item(RemoteStorageUnsubscribePublishedFileResult_t *call_data, bool io_failure) { + if (io_failure) { steamworksError("unsubscribe_item"); } - else{ + else { int result = call_data->m_eResult; int file_id = call_data->m_nPublishedFileId; emit_signal("unsubscribe_item", result, file_id); @@ -4645,11 +3971,11 @@ void SteamServer::unsubscribe_item(RemoteStorageUnsubscribePublishedFileResult_t } // Called when the user has subscribed to a piece of UGC. Result from ISteamUGC::SubscribeItem. -void SteamServer::subscribe_item(RemoteStorageSubscribePublishedFileResult_t* call_data, bool io_failure){ - if(io_failure){ +void SteamServer::subscribe_item(RemoteStorageSubscribePublishedFileResult_t *call_data, bool io_failure) { + if (io_failure) { steamworksError("subscribe_item"); } - else{ + else { int result = call_data->m_eResult; int file_id = call_data->m_nPublishedFileId; emit_signal("subscribe_item", result, file_id); @@ -4659,11 +3985,11 @@ void SteamServer::subscribe_item(RemoteStorageSubscribePublishedFileResult_t* ca // UGC CALL RESULTS ///////////////////////////// // // The result of a call to AddAppDependency. -void SteamServer::add_app_dependency_result(AddAppDependencyResult_t* call_data, bool io_failure){ - if(io_failure){ +void SteamServer::add_app_dependency_result(AddAppDependencyResult_t *call_data, bool io_failure) { + if (io_failure) { steamworksError("add_app_dependency_result"); } - else{ + else { EResult result = call_data->m_eResult; PublishedFileId_t file_id = call_data->m_nPublishedFileId; AppId_t app_id = call_data->m_nAppID; @@ -4672,11 +3998,11 @@ void SteamServer::add_app_dependency_result(AddAppDependencyResult_t* call_data, } // The result of a call to AddDependency. -void SteamServer::add_ugc_dependency_result(AddUGCDependencyResult_t* call_data, bool io_failure){ - if(io_failure){ +void SteamServer::add_ugc_dependency_result(AddUGCDependencyResult_t *call_data, bool io_failure) { + if (io_failure) { steamworksError("add_ugc_dependency_result"); } - else{ + else { EResult result = call_data->m_eResult; PublishedFileId_t file_id = call_data->m_nPublishedFileId; PublishedFileId_t child_id = call_data->m_nChildPublishedFileId; @@ -4685,11 +4011,11 @@ void SteamServer::add_ugc_dependency_result(AddUGCDependencyResult_t* call_data, } // Result of a workshop item being created. -void SteamServer::item_created(CreateItemResult_t *call_data, bool io_failure){ - if(io_failure){ +void SteamServer::item_created(CreateItemResult_t *call_data, bool io_failure) { + if (io_failure) { steamworksError("item_created"); } - else{ + else { EResult result = call_data->m_eResult; PublishedFileId_t file_id = call_data->m_nPublishedFileId; bool accept_tos = call_data->m_bUserNeedsToAcceptWorkshopLegalAgreement; @@ -4698,11 +4024,11 @@ void SteamServer::item_created(CreateItemResult_t *call_data, bool io_failure){ } // Called when getting the app dependencies for an item. -void SteamServer::get_app_dependencies_result(GetAppDependenciesResult_t* call_data, bool io_failure){ - if(io_failure){ +void SteamServer::get_app_dependencies_result(GetAppDependenciesResult_t *call_data, bool io_failure) { + if (io_failure) { steamworksError("get_app_dependencies_result"); } - else{ + else { EResult result = call_data->m_eResult; PublishedFileId_t file_id = call_data->m_nPublishedFileId; // AppId_t app_id = call_data->m_rgAppIDs; @@ -4714,11 +4040,11 @@ void SteamServer::get_app_dependencies_result(GetAppDependenciesResult_t* call_d } // Called when an attempt at deleting an item completes. -void SteamServer::item_deleted(DeleteItemResult_t* call_data, bool io_failure){ - if(io_failure){ +void SteamServer::item_deleted(DeleteItemResult_t *call_data, bool io_failure) { + if (io_failure) { steamworksError("item_deleted"); } - else{ + else { EResult result = call_data->m_eResult; PublishedFileId_t file_id = call_data->m_nPublishedFileId; emit_signal("item_deleted", result, (uint64_t)file_id); @@ -4726,11 +4052,11 @@ void SteamServer::item_deleted(DeleteItemResult_t* call_data, bool io_failure){ } // Called when getting the users vote status on an item. -void SteamServer::get_item_vote_result(GetUserItemVoteResult_t* call_data, bool io_failure){ - if(io_failure){ +void SteamServer::get_item_vote_result(GetUserItemVoteResult_t *call_data, bool io_failure) { + if (io_failure) { steamworksError("get_item_vote_result"); } - else{ + else { EResult result = call_data->m_eResult; PublishedFileId_t file_id = call_data->m_nPublishedFileId; bool vote_up = call_data->m_bVotedUp; @@ -4741,11 +4067,11 @@ void SteamServer::get_item_vote_result(GetUserItemVoteResult_t* call_data, bool } // Purpose: The result of a call to RemoveAppDependency. -void SteamServer::remove_app_dependency_result(RemoveAppDependencyResult_t* call_data, bool io_failure){ - if(io_failure){ +void SteamServer::remove_app_dependency_result(RemoveAppDependencyResult_t *call_data, bool io_failure) { + if (io_failure) { steamworksError("remove_app_dependency_result"); } - else{ + else { EResult result = call_data->m_eResult; PublishedFileId_t file_id = call_data->m_nPublishedFileId; AppId_t app_id = call_data->m_nAppID; @@ -4754,11 +4080,11 @@ void SteamServer::remove_app_dependency_result(RemoveAppDependencyResult_t* call } // Purpose: The result of a call to RemoveDependency. -void SteamServer::remove_ugc_dependency_result(RemoveUGCDependencyResult_t* call_data, bool io_failure){ - if(io_failure){ +void SteamServer::remove_ugc_dependency_result(RemoveUGCDependencyResult_t *call_data, bool io_failure) { + if (io_failure) { steamworksError("remove_ugc_dependency_result"); } - else{ + else { EResult result = call_data->m_eResult; PublishedFileId_t file_id = call_data->m_nPublishedFileId; PublishedFileId_t child_id = call_data->m_nChildPublishedFileId; @@ -4767,11 +4093,11 @@ void SteamServer::remove_ugc_dependency_result(RemoveUGCDependencyResult_t* call } // Called when the user has voted on an item. -void SteamServer::set_user_item_vote(SetUserItemVoteResult_t* call_data, bool io_failure){ - if(io_failure){ +void SteamServer::set_user_item_vote(SetUserItemVoteResult_t *call_data, bool io_failure) { + if (io_failure) { steamworksError("set_user_item_vote"); } - else{ + else { EResult result = call_data->m_eResult; PublishedFileId_t file_id = call_data->m_nPublishedFileId; bool vote_up = call_data->m_bVoteUp; @@ -4780,22 +4106,22 @@ void SteamServer::set_user_item_vote(SetUserItemVoteResult_t* call_data, bool io } // Called when workshop item playtime tracking has started. -void SteamServer::start_playtime_tracking(StartPlaytimeTrackingResult_t* call_data, bool io_failure){ - if(io_failure){ +void SteamServer::start_playtime_tracking(StartPlaytimeTrackingResult_t *call_data, bool io_failure) { + if (io_failure) { steamworksError("start_playtime_tracking"); } - else{ + else { EResult result = call_data->m_eResult; emit_signal("start_playtime_tracking", result); } } // Called when a UGC query request completes. -void SteamServer::ugc_query_completed(SteamUGCQueryCompleted_t* call_data, bool io_failure){ - if(io_failure){ +void SteamServer::ugc_query_completed(SteamUGCQueryCompleted_t *call_data, bool io_failure) { + if (io_failure) { steamworksError("ugc_query_completed"); } - else{ + else { UGCQueryHandle_t handle = call_data->m_handle; EResult result = call_data->m_eResult; uint32 results_returned = call_data->m_unNumResultsReturned; @@ -4806,22 +4132,22 @@ void SteamServer::ugc_query_completed(SteamUGCQueryCompleted_t* call_data, bool } // Called when workshop item playtime tracking has stopped. -void SteamServer::stop_playtime_tracking(StopPlaytimeTrackingResult_t* call_data, bool io_failure){ - if(io_failure){ +void SteamServer::stop_playtime_tracking(StopPlaytimeTrackingResult_t *call_data, bool io_failure) { + if (io_failure) { steamworksError("stop_playtime_tracking"); } - else{ + else { EResult result = call_data->m_eResult; emit_signal("stop_playtime_tracking", result); } } // Result of a workshop item being updated. -void SteamServer::item_updated(SubmitItemUpdateResult_t *call_data, bool io_failure){ - if(io_failure){ +void SteamServer::item_updated(SubmitItemUpdateResult_t *call_data, bool io_failure) { + if (io_failure) { steamworksError("item_updated"); } - else{ + else { EResult result = call_data->m_eResult; bool need_to_accept_tos = call_data->m_bUserNeedsToAcceptWorkshopLegalAgreement; emit_signal("item_updated", result, need_to_accept_tos); @@ -4829,11 +4155,11 @@ void SteamServer::item_updated(SubmitItemUpdateResult_t *call_data, bool io_fail } // Called when the user has added or removed an item to/from their favorites. -void SteamServer::user_favorite_items_list_changed(UserFavoriteItemsListChanged_t* call_data, bool io_failure){ - if(io_failure){ +void SteamServer::user_favorite_items_list_changed(UserFavoriteItemsListChanged_t *call_data, bool io_failure) { + if (io_failure) { steamworksError("user_favorite_items_list_changed"); } - else{ + else { EResult result = call_data->m_eResult; PublishedFileId_t file_id = call_data->m_nPublishedFileId; bool was_add_request = call_data->m_bWasAddRequest; @@ -4842,11 +4168,11 @@ void SteamServer::user_favorite_items_list_changed(UserFavoriteItemsListChanged_ } // Purpose: Status of the user's acceptable/rejection of the app's specific Workshop EULA. -void SteamServer::workshop_eula_status(WorkshopEULAStatus_t* call_data, bool io_failure){ - if(io_failure){ +void SteamServer::workshop_eula_status(WorkshopEULAStatus_t *call_data, bool io_failure) { + if (io_failure) { steamworksError("workshop_eula_status"); } - else{ + else { int result = call_data->m_eResult; uint32 app_id = call_data->m_nAppID; // Slim down signal arguments since Godot seems to limit them to six max @@ -4860,18 +4186,25 @@ void SteamServer::workshop_eula_status(WorkshopEULAStatus_t* call_data, bool io_ } -///////////////////////////////////////////////// -///// BIND METHODS ////////////////////////////// +///// BIND METHODS ///////////////////////////////////////////////// // void SteamServer::_bind_methods(){ - ///////////////////////////////////////////// - // FUNCTION BINDS /////////////////////////// + + // FUNCTION BINDS ///////////////////////////////////////////// // // MAIN BIND METHODS //////////////////////// - ClassDB::bind_method("isServerSecure", &SteamServer::isServerSecure); ClassDB::bind_method("getServerSteamID", &SteamServer::getServerSteamID); + ClassDB::bind_method(D_METHOD("getSteamID32", "steam_id"), &SteamServer::getSteamID32); + ClassDB::bind_method(D_METHOD("isAnonAccount", "steam_id"), &SteamServer::isAnonAccount); + ClassDB::bind_method(D_METHOD("isAnonUserAccount", "steam_id"), &SteamServer::isAnonUserAccount); + ClassDB::bind_method(D_METHOD("isChatAccount", "steam_id"), &SteamServer::isChatAccount); + ClassDB::bind_method(D_METHOD("isClanAccount", "steam_id"), &SteamServer::isClanAccount); + ClassDB::bind_method(D_METHOD("isConsoleUserAccount", "steam_id"), &SteamServer::isConsoleUserAccount); + ClassDB::bind_method(D_METHOD("isIndividualAccount", "steam_id"), &SteamServer::isIndividualAccount); + ClassDB::bind_method(D_METHOD("isLobby", "steam_id"), &SteamServer::isLobby); + ClassDB::bind_method("isServerSecure", &SteamServer::isServerSecure); ClassDB::bind_method("run_callbacks", &SteamServer::run_callbacks); ClassDB::bind_method(D_METHOD("serverInit", "ip", "game_port", "query_port", "server_mode", "version_number"), &SteamServer::serverInit); ClassDB::bind_method(D_METHOD("serverInitEx", "ip", "game_port", "query_port", "server_mode", "version_number"), &SteamServer::serverInitEx); @@ -4885,7 +4218,7 @@ void SteamServer::_bind_methods(){ ClassDB::bind_method("clearAllKeyValues", &SteamServer::clearAllKeyValues); ClassDB::bind_method(D_METHOD("computeNewPlayerCompatibility", "steam_id"), &SteamServer::computeNewPlayerCompatibility); ClassDB::bind_method(D_METHOD("endAuthSession", "steam_id"), &SteamServer::endAuthSession); - ClassDB::bind_method("getAuthSessionTicket", &SteamServer::getAuthSessionTicket); + ClassDB::bind_method("getAuthSessionTicket", &SteamServer::getAuthSessionTicket, DEFVAL(0)); ClassDB::bind_method("getNextOutgoingPacket", &SteamServer::getNextOutgoingPacket); ClassDB::bind_method("getPublicIP", &SteamServer::getPublicIP); ClassDB::bind_method("getSteamID", &SteamServer::getSteamID); @@ -4936,7 +4269,7 @@ void SteamServer::_bind_methods(){ ClassDB::bind_method(D_METHOD("getHTTPResponseBodyData", "request_handle", "buffer_size"), &SteamServer::getHTTPResponseBodyData); ClassDB::bind_method(D_METHOD("getHTTPResponseBodySize", "request_handle"), &SteamServer::getHTTPResponseBodySize); ClassDB::bind_method(D_METHOD("getHTTPResponseHeaderSize", "request_handle", "header_name"), &SteamServer::getHTTPResponseHeaderSize); - ClassDB::bind_method(D_METHOD("getHTTPResponseHeaderValue","request_handle", "header_name", "buffer_size"), &SteamServer::getHTTPResponseHeaderValue); + ClassDB::bind_method(D_METHOD("getHTTPResponseHeaderValue", "request_handle", "header_name", "buffer_size"), &SteamServer::getHTTPResponseHeaderValue); ClassDB::bind_method(D_METHOD("getHTTPStreamingResponseBodyData", "request_handle", "offset", "buffer_size"), &SteamServer::getHTTPStreamingResponseBodyData); ClassDB::bind_method(D_METHOD("prioritizeHTTPRequest", "request_handle"), &SteamServer::prioritizeHTTPRequest); ClassDB::bind_method(D_METHOD("releaseCookieContainer", "cookie_handle"), &SteamServer::releaseCookieContainer); @@ -4989,43 +4322,43 @@ void SteamServer::_bind_methods(){ ClassDB::bind_method(D_METHOD("setPropertyFloat", "item_id", "name", "value", "this_inventory_update_handle"), &SteamServer::setPropertyFloat, DEFVAL(0)); // NETWORKING BIND METHODS ////////////////// - ClassDB::bind_method(D_METHOD("acceptP2PSessionWithUser", "steam_id_remote"), &SteamServer::acceptP2PSessionWithUser); + ClassDB::bind_method(D_METHOD("acceptP2PSessionWithUser", "remote_steam_id"), &SteamServer::acceptP2PSessionWithUser); ClassDB::bind_method(D_METHOD("allowP2PPacketRelay", "allow"), &SteamServer::allowP2PPacketRelay); - ClassDB::bind_method(D_METHOD("closeP2PChannelWithUser", "steam_id_remote", "channel"), &SteamServer::closeP2PChannelWithUser); - ClassDB::bind_method(D_METHOD("closeP2PSessionWithUser", "steam_id_remote"), &SteamServer::closeP2PSessionWithUser); - ClassDB::bind_method(D_METHOD("getP2PSessionState", "steam_id_remote"), &SteamServer::getP2PSessionState); + ClassDB::bind_method(D_METHOD("closeP2PChannelWithUser", "remote_steam_id", "channel"), &SteamServer::closeP2PChannelWithUser); + ClassDB::bind_method(D_METHOD("closeP2PSessionWithUser", "remote_steam_id"), &SteamServer::closeP2PSessionWithUser); + ClassDB::bind_method(D_METHOD("getP2PSessionState", "remote_steam_id"), &SteamServer::getP2PSessionState); ClassDB::bind_method(D_METHOD("getAvailableP2PPacketSize", "channel"), &SteamServer::getAvailableP2PPacketSize, DEFVAL(0)); ClassDB::bind_method(D_METHOD("readP2PPacket", "packet", "channel"), &SteamServer::readP2PPacket, DEFVAL(0)); - ClassDB::bind_method(D_METHOD("sendP2PPacket", "steam_id_remote", "data", "send_type", "channel"), &SteamServer::sendP2PPacket, DEFVAL(0)); + ClassDB::bind_method(D_METHOD("sendP2PPacket", "remote_steam_id", "data", "send_type", "channel"), &SteamServer::sendP2PPacket, DEFVAL(0)); // NETWORKING MESSAGES BIND METHODS ///////// - ClassDB::bind_method(D_METHOD("acceptSessionWithUser", "identity_reference"), &SteamServer::acceptSessionWithUser); - ClassDB::bind_method(D_METHOD("closeChannelWithUser", "identity_reference", "channel"), &SteamServer::closeChannelWithUser); - ClassDB::bind_method(D_METHOD("closeSessionWithUser", "identity_reference"), &SteamServer::closeSessionWithUser); - ClassDB::bind_method(D_METHOD("getSessionConnectionInfo", "identity_reference", "get_connection", "get_status"), &SteamServer::getSessionConnectionInfo); + ClassDB::bind_method(D_METHOD("acceptSessionWithUser", "remote_steam_id"), &SteamServer::acceptSessionWithUser); + ClassDB::bind_method(D_METHOD("closeChannelWithUser", "remote_steam_id", "channel"), &SteamServer::closeChannelWithUser); + ClassDB::bind_method(D_METHOD("closeSessionWithUser", "remote_steam_id"), &SteamServer::closeSessionWithUser); + ClassDB::bind_method(D_METHOD("getSessionConnectionInfo", "remote_steam_id", "get_connection", "get_status"), &SteamServer::getSessionConnectionInfo); ClassDB::bind_method(D_METHOD("receiveMessagesOnChannel", "channel", "max_messages"), &SteamServer::receiveMessagesOnChannel); - ClassDB::bind_method(D_METHOD("sendMessageToUser", "identity_reference", "data", "flags", "channel"), &SteamServer::sendMessageToUser); - + ClassDB::bind_method(D_METHOD("sendMessageToUser", "remote_steam_id", "data", "flags", "channel"), &SteamServer::sendMessageToUser); + // NETWORKING SOCKETS BIND METHODS ////////// - ClassDB::bind_method(D_METHOD("acceptConnection", "connection"), &SteamServer::acceptConnection); + ClassDB::bind_method(D_METHOD("acceptConnection", "connection_handle"), &SteamServer::acceptConnection); ClassDB::bind_method(D_METHOD("beginAsyncRequestFakeIP", "num_ports"), &SteamServer::beginAsyncRequestFakeIP); ClassDB::bind_method(D_METHOD("closeConnection", "peer", "reason", "debug_message", "linger"), &SteamServer::closeConnection); ClassDB::bind_method(D_METHOD("closeListenSocket", "socket"), &SteamServer::closeListenSocket); ClassDB::bind_method(D_METHOD("configureConnectionLanes", "connection", "lanes", "priorities", "weights"), &SteamServer::configureConnectionLanes); - ClassDB::bind_method(D_METHOD("connectP2P", "identity_reference", "virtual_port", "options"), &SteamServer::connectP2P); + ClassDB::bind_method(D_METHOD("connectP2P", "remote_steam_id", "virtual_port", "options"), &SteamServer::connectP2P); ClassDB::bind_method(D_METHOD("connectByIPAddress", "ip_address_with_port", "options"), &SteamServer::connectByIPAddress); - ClassDB::bind_method(D_METHOD("connectToHostedDedicatedServer", "identity_reference", "virtual_port", "options"), &SteamServer::connectToHostedDedicatedServer); + ClassDB::bind_method(D_METHOD("connectToHostedDedicatedServer", "remote_steam_id", "virtual_port", "options"), &SteamServer::connectToHostedDedicatedServer); ClassDB::bind_method(D_METHOD("createFakeUDPPort", "fake_server_port"), &SteamServer::createFakeUDPPort); ClassDB::bind_method(D_METHOD("createHostedDedicatedServerListenSocket", "virtual_port", "options"), &SteamServer::createHostedDedicatedServerListenSocket); ClassDB::bind_method(D_METHOD("createListenSocketIP", "ip_reference", "options"), &SteamServer::createListenSocketIP); ClassDB::bind_method(D_METHOD("createListenSocketP2P", "virtual_port", "options"), &SteamServer::createListenSocketP2P); ClassDB::bind_method(D_METHOD("createListenSocketP2PFakeIP", "fake_port", "options"), &SteamServer::createListenSocketP2PFakeIP); ClassDB::bind_method("createPollGroup", &SteamServer::createPollGroup); - ClassDB::bind_method(D_METHOD("createSocketPair", "loopback", "identity_reference1", "identity_reference2"), &SteamServer::createSocketPair); + ClassDB::bind_method(D_METHOD("createSocketPair", "loopback", "remote_steam_id1", "remote_steam_id2"), &SteamServer::createSocketPair); ClassDB::bind_method(D_METHOD("destroyPollGroup", "poll_group"), &SteamServer::destroyPollGroup); // ClassDB::bind_method(D_METHOD("findRelayAuthTicketForServer", "port"), &SteamServer::findRelayAuthTicketForServer); <------ Uses datagram relay structs which were removed from base SDK ClassDB::bind_method(D_METHOD("flushMessagesOnConnection", "connection_handle"), &SteamServer::flushMessagesOnConnection); - ClassDB::bind_method("getAuthenticationStatus", &SteamServer::getAuthenticationStatus); + ClassDB::bind_method("getAuthenticationStatus", &SteamServer::getAuthenticationStatus); ClassDB::bind_method("getCertificateRequest", &SteamServer::getCertificateRequest); ClassDB::bind_method(D_METHOD("getConnectionInfo", "connection_handle"), &SteamServer::getConnectionInfo); ClassDB::bind_method(D_METHOD("getConnectionName", "peer"), &SteamServer::getConnectionName); @@ -5037,59 +4370,20 @@ void SteamServer::_bind_methods(){ // ClassDB::bind_method("getHostedDedicatedServerAddress", &SteamServer::getHostedDedicatedServerAddress); <------ Uses datagram relay structs which were removed from base SDK ClassDB::bind_method("getHostedDedicatedServerPOPId", &SteamServer::getHostedDedicatedServerPOPId); ClassDB::bind_method("getHostedDedicatedServerPort", &SteamServer::getHostedDedicatedServerPort); - ClassDB::bind_method(D_METHOD("getListenSocketAddress", "socket"), &SteamServer::getListenSocketAddress); - ClassDB::bind_method("getIdentity", &SteamServer::getIdentity); + ClassDB::bind_method(D_METHOD("getListenSocketAddress", "socket", "with_port"), &SteamServer::getListenSocketAddress, DEFVAL(true)); ClassDB::bind_method(D_METHOD("getRemoteFakeIPForConnection", "connection"), &SteamServer::getRemoteFakeIPForConnection); ClassDB::bind_method("initAuthentication", &SteamServer::initAuthentication); - ClassDB::bind_method(D_METHOD("receiveMessagesOnConnection", "connection", "max_messages"), &SteamServer::receiveMessagesOnConnection); + ClassDB::bind_method(D_METHOD("receiveMessagesOnConnection", "connection", "max_messages"), &SteamServer::receiveMessagesOnConnection); ClassDB::bind_method(D_METHOD("receiveMessagesOnPollGroup", "poll_group", "max_messages"), &SteamServer::receiveMessagesOnPollGroup); // ClassDB::bind_method("receivedRelayAuthTicket", &SteamServer::receivedRelayAuthTicket); <------ Uses datagram relay structs which were removed from base SDK - ClassDB::bind_method(D_METHOD("resetIdentity", "this_identity"), &SteamServer::resetIdentity); + ClassDB::bind_method(D_METHOD("resetIdentity", "remote_steam_id"), &SteamServer::resetIdentity); ClassDB::bind_method("runNetworkingCallbacks", &SteamServer::runNetworkingCallbacks); ClassDB::bind_method(D_METHOD("sendMessages", "messages", "data", "connection_handle", "flags"), &SteamServer::sendMessages); ClassDB::bind_method(D_METHOD("sendMessageToConnection", "connection_handle", "data", "flags"), &SteamServer::sendMessageToConnection); - ClassDB::bind_method(D_METHOD("setCertificate", "certificate"), &SteamServer::setCertificate); + ClassDB::bind_method(D_METHOD("setCertificate", "certificate"), &SteamServer::setCertificate); ClassDB::bind_method(D_METHOD("setConnectionPollGroup", "connection_handle", "poll_group"), &SteamServer::setConnectionPollGroup); ClassDB::bind_method(D_METHOD("setConnectionName", "peer", "name"), &SteamServer::setConnectionName); - - // NETWORKING TYPES BIND METHODS //////////// - ClassDB::bind_method(D_METHOD("addIdentity", "reference_name"), &SteamServer::addIdentity); - ClassDB::bind_method(D_METHOD("addIPAddress", "reference_name"), &SteamServer::addIPAddress); - ClassDB::bind_method(D_METHOD("clearIdentity", "reference_name"), &SteamServer::clearIdentity); - ClassDB::bind_method(D_METHOD("clearIPAddress", "reference_name"), &SteamServer::clearIPAddress); - ClassDB::bind_method(D_METHOD("getGenericBytes", "reference_name"), &SteamServer::getGenericBytes); - ClassDB::bind_method(D_METHOD("getGenericString", "reference_name"), &SteamServer::getGenericString); - ClassDB::bind_method("getIdentities", &SteamServer::getIdentities); - ClassDB::bind_method(D_METHOD("getIdentityIPAddr", "reference_name"), &SteamServer::getIdentityIPAddr); - ClassDB::bind_method(D_METHOD("getIdentitySteamID", "reference_name"), &SteamServer::getIdentitySteamID); - ClassDB::bind_method(D_METHOD("getIdentitySteamID64", "reference_name"), &SteamServer::getIdentitySteamID64); - ClassDB::bind_method("getIPAddresses", &SteamServer::getIPAddresses); - ClassDB::bind_method(D_METHOD("getIPv4", "reference_name"), &SteamServer::getIPv4); - ClassDB::bind_method(D_METHOD("getPSNID", "reference_name"), &SteamServer::getPSNID); - ClassDB::bind_method(D_METHOD("getStadiaID", "reference_name"), &SteamServer::getStadiaID); - ClassDB::bind_method(D_METHOD("getXboxPairwiseID", "reference_name"), &SteamServer::getXboxPairwiseID); - ClassDB::bind_method(D_METHOD("isAddressLocalHost", "reference_name"), &SteamServer::isAddressLocalHost); - ClassDB::bind_method(D_METHOD("isIdentityInvalid", "reference_name"), &SteamServer::isIdentityInvalid); - ClassDB::bind_method(D_METHOD("isIdentityLocalHost", "reference_name"), &SteamServer::isIdentityLocalHost); - ClassDB::bind_method(D_METHOD("isIPv4", "reference_name"), &SteamServer::isIPv4); - ClassDB::bind_method(D_METHOD("isIPv6AllZeros", "reference_name"), &SteamServer::isIPv6AllZeros); - ClassDB::bind_method(D_METHOD("parseIdentityString", "reference_name", "string_to_parse"), &SteamServer::parseIdentityString); - ClassDB::bind_method(D_METHOD("parseIPAddressString", "reference_name", "string_to_parse"), &SteamServer::parseIPAddressString); - ClassDB::bind_method(D_METHOD("setGenericBytes", "reference_name", "data"), &SteamServer::setGenericBytes); - ClassDB::bind_method(D_METHOD("setGenericString", "reference_name", "this_string"), &SteamServer::setGenericString); - ClassDB::bind_method(D_METHOD("setIdentityIPAddr", "reference_name", "ip_address_name"), &SteamServer::setIdentityIPAddr); - ClassDB::bind_method(D_METHOD("setIdentityLocalHost", "reference_name"), &SteamServer::setIdentityLocalHost); - ClassDB::bind_method(D_METHOD("setIdentitySteamID", "reference_name", "steam_id"), &SteamServer::setIdentitySteamID); - ClassDB::bind_method(D_METHOD("setIdentitySteamID64", "reference_name", "steam_id"), &SteamServer::setIdentitySteamID64); - ClassDB::bind_method(D_METHOD("setIPv4", "reference_name", "ip", "port"), &SteamServer::setIPv4); - ClassDB::bind_method(D_METHOD("setIPv6", "reference_name", "ipv6", "port"), &SteamServer::setIPv6); - ClassDB::bind_method(D_METHOD("setIPv6LocalHost", "reference_name", "port"), &SteamServer::setIPv6LocalHost, DEFVAL(0)); - ClassDB::bind_method(D_METHOD("setPSNID", "reference_name", "psn_id"), &SteamServer::setPSNID); - ClassDB::bind_method(D_METHOD("setStadiaID", "reference_name", "stadia_id"), &SteamServer::setStadiaID); - ClassDB::bind_method(D_METHOD("setXboxPairwiseID", "reference_name", "xbox_id"), &SteamServer::setXboxPairwiseID); - ClassDB::bind_method(D_METHOD("toIdentityString", "reference_name"), &SteamServer::toIdentityString); - ClassDB::bind_method(D_METHOD("toIPAddressString", "reference_name", "with_port"), &SteamServer::toIPAddressString); - + // NETWORKING UTILS BIND METHODS //////////// ClassDB::bind_method(D_METHOD("checkPingDataUpToDate", "max_age_in_seconds"), &SteamServer::checkPingDataUpToDate); ClassDB::bind_method(D_METHOD("convertPingLocationToString", "location"), &SteamServer::convertPingLocationToString); @@ -5196,14 +4490,13 @@ void SteamServer::_bind_methods(){ ClassDB::bind_method(D_METHOD("unsubscribeItem", "published_file_id"), &SteamServer::unsubscribeItem); ClassDB::bind_method(D_METHOD("updateItemPreviewFile", "update_handle", "index", "preview_file"), &SteamServer::updateItemPreviewFile); ClassDB::bind_method(D_METHOD("updateItemPreviewVideo", "update_handle", "index", "video_id"), &SteamServer::updateItemPreviewVideo); - ClassDB::bind_method("showWorkshopEULA", &SteamServer::showWorkshopEULA); + ClassDB::bind_method("showWorkshopEULA", &SteamServer::showWorkshopEULA); ClassDB::bind_method("getWorkshopEULAStatus", &SteamServer::getWorkshopEULAStatus); ClassDB::bind_method(D_METHOD("setTimeCreatedDateRange", "update_handle", "start", "end"), &SteamServer::setTimeCreatedDateRange); ClassDB::bind_method(D_METHOD("setTimeUpdatedDateRange", "update_handle", "start", "end"), &SteamServer::setTimeUpdatedDateRange); - ///////////////////////////////////////////// - // CALLBACK SIGNAL BINDS //////////////////// + // CALLBACK SIGNAL BINDS ///////////////////////////////////////////// // // STEAMWORKS SIGNALS /////////////////////// @@ -5240,8 +4533,8 @@ void SteamServer::_bind_methods(){ ADD_SIGNAL(MethodInfo("inventory_request_prices_result", PropertyInfo(Variant::INT, "result"), PropertyInfo(Variant::STRING, "currency"))); // NETWORKING SIGNALS /////////////////////// - ADD_SIGNAL(MethodInfo("p2p_session_request", PropertyInfo(Variant::INT, "steam_id_remote"))); - ADD_SIGNAL(MethodInfo("p2p_session_connect_fail", PropertyInfo(Variant::INT, "steam_id_remote"), PropertyInfo(Variant::INT, "session_error"))); + ADD_SIGNAL(MethodInfo("p2p_session_request", PropertyInfo(Variant::INT, "remote_steam_id"))); + ADD_SIGNAL(MethodInfo("p2p_session_connect_fail", PropertyInfo(Variant::INT, "remote_steam_id"), PropertyInfo(Variant::INT, "session_error"))); // NETWORKING MESSAGES ////////////////////// ADD_SIGNAL(MethodInfo("network_messages_session_request", PropertyInfo(Variant::STRING, "identity"))); @@ -5250,7 +4543,7 @@ void SteamServer::_bind_methods(){ // NETWORKING SOCKETS SIGNALS /////////////// ADD_SIGNAL(MethodInfo("network_connection_status_changed", PropertyInfo(Variant::INT, "connect_handle"), PropertyInfo(Variant::DICTIONARY, "connection"), PropertyInfo(Variant::INT, "old_state"))); ADD_SIGNAL(MethodInfo("network_authentication_status", PropertyInfo(Variant::INT, "available"), PropertyInfo(Variant::STRING, "debug_message"))); - ADD_SIGNAL(MethodInfo("fake_ip_result", PropertyInfo(Variant::INT, "result"), PropertyInfo(Variant::STRING, "identity"), PropertyInfo(Variant::STRING, "fake_ip"), PropertyInfo(Variant::ARRAY, "port_list"))); + ADD_SIGNAL(MethodInfo("fake_ip_result", PropertyInfo(Variant::INT, "result"), PropertyInfo(Variant::INT, "remote_fake_steam_id"), PropertyInfo(Variant::STRING, "fake_ip"), PropertyInfo(Variant::ARRAY, "port_list"))); // NETWORKING UTILS SIGNALS ///////////////// ADD_SIGNAL(MethodInfo("relay_network_status", PropertyInfo(Variant::INT, "available"), PropertyInfo(Variant::INT, "ping_measurement"), PropertyInfo(Variant::INT, "available_config"), PropertyInfo(Variant::INT, "available_relay"), PropertyInfo(Variant::STRING, "debug_message"))); @@ -5279,55 +4572,88 @@ void SteamServer::_bind_methods(){ ADD_SIGNAL(MethodInfo("start_playtime_tracking", PropertyInfo(Variant::INT, "result"))); ADD_SIGNAL(MethodInfo("ugc_query_completed", PropertyInfo(Variant::INT, "handle"), PropertyInfo(Variant::INT, "result"), PropertyInfo(Variant::INT, "results_returned"), PropertyInfo(Variant::INT, "total_matching"), PropertyInfo(Variant::BOOL, "cached"))); ADD_SIGNAL(MethodInfo("stop_playtime_tracking", PropertyInfo(Variant::INT, "result"))); - ADD_SIGNAL(MethodInfo("item_updated", PropertyInfo(Variant::INT, "result"), PropertyInfo(Variant::BOOL, "accept_tos"))); + ADD_SIGNAL(MethodInfo("item_updated", PropertyInfo(Variant::INT, "result"), PropertyInfo(Variant::BOOL, "need_to_accept_tos"))); ADD_SIGNAL(MethodInfo("user_favorite_items_list_changed", PropertyInfo(Variant::INT, "result"), PropertyInfo(Variant::INT, "file_id"), PropertyInfo(Variant::BOOL, "was_add_request"))); ADD_SIGNAL(MethodInfo("workshop_eula_status", PropertyInfo(Variant::INT, "result"), PropertyInfo(Variant::INT, "app_id"), PropertyInfo(Variant::DICTIONARY, "eula_data"))); ADD_SIGNAL(MethodInfo("user_subscribed_items_list_changed", PropertyInfo(Variant::INT, "app_id"))); - - ///////////////////////////////////////////// + // CONSTANT BINDS ///////////////////////////////////////////// // // STEAM API CONSTANTS ////////////////////// BIND_CONSTANT(ACCOUNT_ID_INVALID); - BIND_CONSTANT(API_CALL_INVALID); // 0x0 - BIND_CONSTANT(APP_ID_INVALID); // 0x0 - BIND_CONSTANT(AUTH_TICKET_INVALID); // 0 - BIND_CONSTANT(DEPOT_ID_INVALID); // 0x0 - BIND_CONSTANT(GAME_EXTRA_INFO_MAX); // 64 - BIND_CONSTANT(INVALID_BREAKPAD_HANDLE); // (BREAKPAD_HANDLE)0 - BIND_CONSTANT(QUERY_PORT_ERROR); // 0xFFFE - BIND_CONSTANT(QUERY_PORT_NOT_INITIALIZED); // 0xFFFF - BIND_CONSTANT(STEAM_ACCOUNT_ID_MASK); // 0xFFFFFFFF - BIND_CONSTANT(STEAM_ACCOUNT_INSTANCE_MASK); // 0x000FFFFF - BIND_CONSTANT(STEAM_BUFFER_SIZE); // 255 - BIND_CONSTANT(STEAM_LARGE_BUFFER_SIZE); // 8160 - BIND_CONSTANT(STEAM_MAX_ERROR_MESSAGE); // 1024 - BIND_CONSTANT(STEAM_USER_CONSOLE_INSTANCE); // 2 - BIND_CONSTANT(STEAM_USER_DESKTOP_INSTANCE); // 1 - BIND_CONSTANT(STEAM_USER_WEB_INSTANCE); // 4 + BIND_CONSTANT(API_CALL_INVALID); + BIND_CONSTANT(APP_ID_INVALID); + BIND_CONSTANT(AUTH_TICKET_INVALID); + BIND_CONSTANT(DEPOT_ID_INVALID); + BIND_CONSTANT(GAME_EXTRA_INFO_MAX); + BIND_CONSTANT(INVALID_BREAKPAD_HANDLE); + BIND_CONSTANT(QUERY_PORT_ERROR); + BIND_CONSTANT(QUERY_PORT_NOT_INITIALIZED); + BIND_CONSTANT(STEAM_ACCOUNT_ID_MASK); + BIND_CONSTANT(STEAM_ACCOUNT_INSTANCE_MASK); + BIND_CONSTANT(STEAM_BUFFER_SIZE); + BIND_CONSTANT(STEAM_LARGE_BUFFER_SIZE); + BIND_CONSTANT(STEAM_MAX_ERROR_MESSAGE); + BIND_CONSTANT(STEAM_USER_CONSOLE_INSTANCE); + BIND_CONSTANT(STEAM_USER_DESKTOP_INSTANCE); + BIND_CONSTANT(STEAM_USER_WEB_INSTANCE); // STEAM SERVER API CONSTANTS /////////////// - BIND_CONSTANT(QUERY_PORT_SHARED); // 0xffff + BIND_CONSTANT(QUERY_PORT_SHARED); // HTTP CONSTANTS /////////////////////////// - BIND_CONSTANT(INVALID_HTTPCOOKIE_HANDLE); // 0 - BIND_CONSTANT(INVALID_HTTPREQUEST_HANDLE); // 0 + BIND_CONSTANT(HTTPCOOKIE_INVALID_HANDLE); + BIND_CONSTANT(HTTPREQUEST_INVALID_HANDLE); // INVENTORY CONSTANTS ////////////////////// - BIND_CONSTANT(INVENTORY_RESULT_INVALID); // -1 - BIND_CONSTANT(ITEM_INSTANCE_ID_INVALID); // 0 + BIND_CONSTANT(INVENTORY_RESULT_INVALID); + BIND_CONSTANT(ITEM_INSTANCE_ID_INVALID); + + // NETWORKING SOCKET CONSTANTS ////////////// + BIND_CONSTANT(MAX_STEAM_PACKET_SIZE); + + // NETWORKING TYPES CONSTANT //////////////// + BIND_CONSTANT(LISTEN_SOCKET_INVALID); + BIND_CONSTANT(MAX_NETWORKING_ERROR_MESSAGE); + BIND_CONSTANT(MAX_NETWORKING_PING_LOCATION_STRING); + BIND_CONSTANT(NETWORKING_CONFIG_P2P_TRANSPORT_ICE_DEFAULT); + BIND_CONSTANT(NETWORKING_CONFIG_P2P_TRANSPORT_ICE_DISABLE); + BIND_CONSTANT(NETWORKING_CONFIG_P2P_TRANSPORT_ICE_RELAY); + BIND_CONSTANT(NETWORKING_CONFIG_P2P_TRANSPORT_ICE_PRIVATE); + BIND_CONSTANT(NETWORKING_CONFIG_P2P_TRANSPORT_ICE_PUBLIC); + BIND_CONSTANT(NETWORKING_CONFIG_P2P_TRANSPORT_ICE_ALL); + BIND_CONSTANT(NETWORKING_CONNECTION_INFO_FLAG_UNAUTHENTICATED); + BIND_CONSTANT(NETWORKING_CONNECTION_INFO_FLAG_UNENCRYPTED); + BIND_CONSTANT(NETWORKING_CONNECTION_INFO_FLAG_LOOPBACK_BUFFERS); + BIND_CONSTANT(NETWORKING_CONNECTION_INFO_FLAG_FAST); + BIND_CONSTANT(NETWORKING_CONNECTION_INFO_FLAG_RELAYED); + BIND_CONSTANT(NETWORKING_CONNECTION_INFO_FLAG_DUALWIFI); + BIND_CONSTANT(NETWORKING_CONNECTION_INVALID); + BIND_CONSTANT(NETWORKING_MAX_CONNECTION_APP_NAME); + BIND_CONSTANT(NETWORKING_MAX_CONNECTION_CLOSE_REASON); + BIND_CONSTANT(NETWORKING_MAX_CONNECTION_DESCRIPTION); + BIND_CONSTANT(NETWORKING_PING_FAILED); + BIND_CONSTANT(NETWORKING_PING_UNKNOWN); + BIND_CONSTANT(NETWORKING_SEND_UNRELIABLE); + BIND_CONSTANT(NETWORKING_SEND_NO_NAGLE); + BIND_CONSTANT(NETWORKING_SEND_URELIABLE_NO_NAGLE); + BIND_CONSTANT(NETWORKING_SEND_NO_DELAY); + BIND_CONSTANT(NETWORKING_SEND_UNRELIABLE_NO_DELAY); + BIND_CONSTANT(NETWORKING_SEND_RELIABLE); + BIND_CONSTANT(NETWORKING_SEND_RELIABLE_NO_NAGLE); + BIND_CONSTANT(NETWORKING_SEND_USE_CURRENT_THREAD); + BIND_CONSTANT(NETWORKING_SEND_AUTORESTART_BROKEN_SESSION); // UGC CONSTANTS //////////////////////////// - BIND_CONSTANT(NUM_UGC_RESULTS_PER_PAGE); // 50 - BIND_CONSTANT(DEVELOPER_METADATA_MAX); // 5000 - BIND_CONSTANT(UGC_QUERY_HANDLE_INVALID); // 0xffffffffffffffffull - BIND_CONSTANT(UGC_UPDATE_HANDLE_INVALID); // 0xffffffffffffffffull + BIND_CONSTANT(DEVELOPER_METADATA_MAX); + BIND_CONSTANT(NUM_UGC_RESULTS_PER_PAGE); + BIND_CONSTANT(UGC_QUERY_HANDLE_INVALID); + BIND_CONSTANT(UGC_UPDATE_HANDLE_INVALID); - ///////////////////////////////////////////// - // ENUM CONSTANT BINDS ////////////////////// + // ENUM CONSTANT BINDS ///////////////////////////////////////////// // // AccountType Enums @@ -5357,40 +4683,14 @@ void SteamServer::_bind_methods(){ BIND_ENUM_CONSTANT(AUTH_SESSION_RESPONSE_PUBLISHER_ISSUED_BAN); BIND_ENUM_CONSTANT(AUTH_SESSION_RESPONSE_AUTH_TICKET_NETWORK_IDENTITY_FAILURE); - // AvatarSizes Enums - BIND_ENUM_CONSTANT(AVATAR_SMALL); - BIND_ENUM_CONSTANT(AVATAR_MEDIUM); - BIND_ENUM_CONSTANT(AVATAR_LARGE); - // BeginAuthSessionResult Enums BIND_ENUM_CONSTANT(BEGIN_AUTH_SESSION_RESULT_OK); BIND_ENUM_CONSTANT(BEGIN_AUTH_SESSION_RESULT_INVALID_TICKET); - BIND_ENUM_CONSTANT(BEGIN_AUTH_SESSION_RESULT_DUPLICATE_REQUEST); + BIND_ENUM_CONSTANT(BEGIN_AUTH_SESSION_RESULT_DUPLICATE_REQUEST); BIND_ENUM_CONSTANT(BEGIN_AUTH_SESSION_RESULT_INVALID_VERSION); BIND_ENUM_CONSTANT(BEGIN_AUTH_SESSION_RESULT_GAME_MISMATCH); BIND_ENUM_CONSTANT(BEGIN_AUTH_SESSION_RESULT_EXPIRED_TICKET); - // CommunityProfileItemType Enums - BIND_ENUM_CONSTANT(PROFILE_ITEM_TYPE_ANIMATED_AVATAR); - BIND_ENUM_CONSTANT(PROFILE_ITEM_TYPE_AVATAR_FRAME); - BIND_ENUM_CONSTANT(PROFILE_ITEM_TYPE_PROFILE_MODIFIER); - BIND_ENUM_CONSTANT(PROFILE_ITEM_TYPE_PROFILE_BACKGROUND); - BIND_ENUM_CONSTANT(PROFILE_ITEM_TYPE_MINI_PROFILE_BACKGROUND); - - // CommunityProfileItemProperty Enums - BIND_ENUM_CONSTANT(PROFILE_ITEM_PROPERTY_IMAGE_SMALL); - BIND_ENUM_CONSTANT(PROFILE_ITEM_PROPERTY_IMAGE_LARGE); - BIND_ENUM_CONSTANT(PROFILE_ITEM_PROPERTY_INTERNAL_NAME); - BIND_ENUM_CONSTANT(PROFILE_ITEM_PROPERTY_TITLE); - BIND_ENUM_CONSTANT(PROFILE_ITEM_PROPERTY_DESCRIPTION); - BIND_ENUM_CONSTANT(PROFILE_ITEM_PROPERTY_APP_ID); - BIND_ENUM_CONSTANT(PROFILE_ITEM_PROPERTY_TYPE_ID); - BIND_ENUM_CONSTANT(PROFILE_ITEM_PROPERTY_CLASS); - BIND_ENUM_CONSTANT(PROFILE_ITEM_PROPERTY_MOVIE_WEBM); - BIND_ENUM_CONSTANT(PROFILE_ITEM_PROPERTY_MOVIE_MP4); - BIND_ENUM_CONSTANT(PROFILE_ITEM_PROPERTY_MOVIE_WEBM_SMALL); - BIND_ENUM_CONSTANT(PROFILE_ITEM_PROPERTY_MOVIE_MP4_SMALL); - // DenyReason Enums BIND_ENUM_CONSTANT(DENY_INVALID); BIND_ENUM_CONSTANT(DENY_INVALID_VERSION); @@ -5414,34 +4714,6 @@ void SteamServer::_bind_methods(){ BIND_ENUM_CONSTANT(FILE_PATH_TYPE_ABSOLUTE); BIND_ENUM_CONSTANT(FILE_PATH_TYPE_API_FILENAME); - // FriendFlags Enums - BIND_ENUM_CONSTANT(FRIEND_FLAG_NONE); - BIND_ENUM_CONSTANT(FRIEND_FLAG_BLOCKED); - BIND_ENUM_CONSTANT(FRIEND_FLAG_FRIENDSHIP_REQUESTED); - BIND_ENUM_CONSTANT(FRIEND_FLAG_IMMEDIATE); - BIND_ENUM_CONSTANT(FRIEND_FLAG_CLAN_MEMBER); - BIND_ENUM_CONSTANT(FRIEND_FLAG_ON_GAME_SERVER); - // BIND_ENUM_CONSTANT(FRIEND_FLAG_HAS_PLAYED_WITH); - // BIND_ENUM_CONSTANT(FRIEND_FLAG_FRIEND_OF_FRIEND); - BIND_ENUM_CONSTANT(FRIEND_FLAG_REQUESTING_FRIENDSHIP); - BIND_ENUM_CONSTANT(FRIEND_FLAG_REQUESTING_INFO); - BIND_ENUM_CONSTANT(FRIEND_FLAG_IGNORED); - BIND_ENUM_CONSTANT(FRIEND_FLAG_IGNORED_FRIEND); - // BIND_ENUM_CONSTANT(FRIEND_FLAG_SUGGESTED); - BIND_ENUM_CONSTANT(FRIEND_FLAG_CHAT_MEMBER); - BIND_ENUM_CONSTANT(FRIEND_FLAG_ALL); - - // FriendRelationship Enums - BIND_ENUM_CONSTANT(FRIEND_RELATION_NONE); - BIND_ENUM_CONSTANT(FRIEND_RELATION_BLOCKED); - BIND_ENUM_CONSTANT(FRIEND_RELATION_REQUEST_RECIPIENT); - BIND_ENUM_CONSTANT(FRIEND_RELATION_FRIEND); - BIND_ENUM_CONSTANT(FRIEND_RELATION_REQUEST_INITIATOR); - BIND_ENUM_CONSTANT(FRIEND_RELATION_IGNORED); - BIND_ENUM_CONSTANT(FRIEND_RELATION_IGNORED_FRIEND); - BIND_ENUM_CONSTANT(FRIEND_RELATION_SUGGESTED); - BIND_ENUM_CONSTANT(FRIEND_RELATION_MAX); - // GameIDType Enums BIND_ENUM_CONSTANT(GAME_TYPE_APP); BIND_ENUM_CONSTANT(GAME_TYPE_GAME_MOD); @@ -5506,6 +4778,10 @@ void SteamServer::_bind_methods(){ BIND_ENUM_CONSTANT(HTTP_STATUS_CODE_505_HTTP_VERSION_NOT_SUPPORTED); BIND_ENUM_CONSTANT(HTTP_STATUS_CODE_5XX_UNKNOWN); + // IPType Enums + BIND_ENUM_CONSTANT(IP_TYPE_IPV4); + BIND_ENUM_CONSTANT(IP_TYPE_IPV6); + // ItemFlags Enums BIND_ENUM_CONSTANT(STEAM_ITEM_NO_TRADE); BIND_ENUM_CONSTANT(STEAM_ITEM_REMOVED); @@ -5573,8 +4849,8 @@ void SteamServer::_bind_methods(){ // NetworkingConfigDataType Enums BIND_ENUM_CONSTANT(NETWORKING_CONFIG_TYPE_INT32); BIND_ENUM_CONSTANT(NETWORKING_CONFIG_TYPE_INT64); - BIND_ENUM_CONSTANT(NETWORKING_CONFIG_TYPE_FLOAT); - BIND_ENUM_CONSTANT(ETWORKING_CONFIG_TYPE_STRING); + BIND_ENUM_CONSTANT(NETWORKING_CONFIG_TYPE_FLOAT); + BIND_ENUM_CONSTANT(NETWORKING_CONFIG_TYPE_STRING); BIND_ENUM_CONSTANT(NETWORKING_CONFIG_TYPE_FUNCTION_PTR); BIND_ENUM_CONSTANT(NETWORKING_CONFIG_TYPE_FORCE_32BIT); @@ -5745,15 +5021,6 @@ void SteamServer::_bind_methods(){ BIND_ENUM_CONSTANT(NETWORKING_SOCKET_DEBUG_OUTPUT_TYPE_EVERYTHING); BIND_ENUM_CONSTANT(NETWORKING_SOCKET_DEBUG_OUTPUT_TYPE_FORCE_32BIT); - // OverlayToStoreFlag Enums - BIND_ENUM_CONSTANT(OVERLAY_TO_STORE_FLAG_NONE); - BIND_ENUM_CONSTANT(OVERLAY_TO_STORE_FLAG_ADD_TO_CART); - BIND_ENUM_CONSTANT(OVERLAY_TO_STORE_FLAG_AND_TO_CART_AND_SHOW); - - // OverlayToWebPageMode Enums - BIND_ENUM_CONSTANT(OVERLAY_TO_WEB_PAGE_MODE_DEFAULT); - BIND_ENUM_CONSTANT(OVERLAY_TO_WEB_PAGE_MODE_MODAL); - // P2PSend Enums BIND_ENUM_CONSTANT(P2P_SEND_UNRELIABLE); BIND_ENUM_CONSTANT(P2P_SEND_UNRELIABLE_NO_DELAY); @@ -5768,34 +5035,6 @@ void SteamServer::_bind_methods(){ BIND_ENUM_CONSTANT(P2P_SESSION_ERROR_TIMEOUT); BIND_ENUM_CONSTANT(P2P_SESSION_ERROR_MAX); - // PersonaChange Enums - BIND_ENUM_CONSTANT(PERSONA_CHANGE_NAME); - BIND_ENUM_CONSTANT(PERSONA_CHANGE_STATUS); - BIND_ENUM_CONSTANT(PERSONA_CHANGE_COME_ONLINE); - BIND_ENUM_CONSTANT(PERSONA_CHANGE_GONE_OFFLINE); - BIND_ENUM_CONSTANT(PERSONA_CHANGE_GAME_PLAYED); - BIND_ENUM_CONSTANT(PERSONA_CHANGE_GAME_SERVER); - BIND_ENUM_CONSTANT(PERSONA_CHANGE_AVATAR); - BIND_ENUM_CONSTANT(PERSONA_CHANGE_JOINED_SOURCE); - BIND_ENUM_CONSTANT(PERSONA_CHANGE_LEFT_SOURCE); - BIND_ENUM_CONSTANT(PERSONA_CHANGE_RELATIONSHIP_CHANGED); - BIND_ENUM_CONSTANT(PERSONA_CHANGE_NAME_FIRST_SET); - BIND_ENUM_CONSTANT(PERSONA_CHANGE_FACEBOOK_INFO); - BIND_ENUM_CONSTANT(PERSONA_CHANGE_NICKNAME); - BIND_ENUM_CONSTANT(PERSONA_CHANGE_STEAM_LEVEL); - BIND_ENUM_CONSTANT(PERSONA_CHANGE_RICH_PRESENCE); - - // PersonaState Enums - BIND_ENUM_CONSTANT(PERSONA_STATE_OFFLINE); - BIND_ENUM_CONSTANT(PERSONA_STATE_ONLINE); - BIND_ENUM_CONSTANT(PERSONA_STATE_BUSY); - BIND_ENUM_CONSTANT(PERSONA_STATE_AWAY); - BIND_ENUM_CONSTANT(PERSONA_STATE_SNOOZE); - BIND_ENUM_CONSTANT(PERSONA_STATE_LOOKING_TO_TRADE); - BIND_ENUM_CONSTANT(PERSONA_STATE_LOOKING_TO_PLAY); - BIND_ENUM_CONSTANT(PERSONA_STATE_INVISIBLE); - BIND_ENUM_CONSTANT(PERSONA_STATE_MAX); - // RemoteStoragePlatform Enums BIND_ENUM_CONSTANT(REMOTE_STORAGE_PLATFORM_NONE); BIND_ENUM_CONSTANT(REMOTE_STORAGE_PLATFORM_WINDOWS); @@ -5975,14 +5214,14 @@ void SteamServer::_bind_methods(){ BIND_ENUM_CONSTANT(STEAM_API_INIT_RESULT_VERSION_MISMATCH); // UGCContentDescriptorID Enums - BIND_ENUM_CONSTANT(UGCCONTENTDESCRIPTOR_NUDITY_OR_SEXUAL_CONTENT); - BIND_ENUM_CONSTANT(UGCCONTENTDESCRIPTOR_FREQUENT_VIOLENCE_OR_GORE); - BIND_ENUM_CONSTANT(UGCCONTENTDESCRIPTOR_ADULT_ONLY_SEXUAL_CONTENT); - BIND_ENUM_CONSTANT(UGCCONTENTDESCRIPTOR_GRATUITOUS_SEXUAL_CONTENT); - BIND_ENUM_CONSTANT(UGCCONTENTDESCRIPTOR_ANY_MATURE_CONTENT); + BIND_ENUM_CONSTANT(UGC_CONTENT_DESCRIPTOR_NUDITY_OR_SEXUAL_CONTENT); + BIND_ENUM_CONSTANT(UGC_CONTENT_DESCRIPTOR_FREQUENT_VIOLENCE_OR_GORE); + BIND_ENUM_CONSTANT(UGC_CONTENT_DESCRIPTOR_ADULT_ONLY_SEXUAL_CONTENT); + BIND_ENUM_CONSTANT(UGC_CONTENT_DESCRIPTOR_GRATUITOUS_SEXUAL_CONTENT); + BIND_ENUM_CONSTANT(UGC_CONTENT_DESCRIPTOR_ANY_MATURE_CONTENT); // UGCMatchingUGCType Enums - BIND_ENUM_CONSTANT(UGC_MATCHINGUGCTYPE_ITEMS); + BIND_ENUM_CONSTANT(UGC_MATCHING_UGC_TYPE_ITEMS); BIND_ENUM_CONSTANT(UGC_MATCHING_UGC_TYPE_ITEMS_MTX); BIND_ENUM_CONSTANT(UGC_MATCHING_UGC_TYPE_ITEMS_READY_TO_USE); BIND_ENUM_CONSTANT(UGC_MATCHING_UGC_TYPE_COLLECTIONS); @@ -6032,16 +5271,6 @@ void SteamServer::_bind_methods(){ BIND_ENUM_CONSTANT(UNIVERSE_DEV); BIND_ENUM_CONSTANT(UNIVERSE_MAX); - // UserRestriction Enums - BIND_ENUM_CONSTANT(USER_RESTRICTION_NONE); - BIND_ENUM_CONSTANT(USER_RESTRICTION_UNKNOWN); - BIND_ENUM_CONSTANT(USER_RESTRICTION_ANY_CHAT); - BIND_ENUM_CONSTANT(USER_RESTRICTION_VOICE_CHAT); - BIND_ENUM_CONSTANT(USER_RESTRICTION_GROUP_CHAT); - BIND_ENUM_CONSTANT(USER_RESTRICTION_RATING); - BIND_ENUM_CONSTANT(USER_RESTRICTION_GAME_INVITES); - BIND_ENUM_CONSTANT(USER_RESTRICTION_TRADING); - // UserUGCList Enums BIND_ENUM_CONSTANT(USER_UGC_LIST_PUBLISHED); BIND_ENUM_CONSTANT(USER_UGC_LIST_VOTED_ON); @@ -6054,13 +5283,13 @@ void SteamServer::_bind_methods(){ BIND_ENUM_CONSTANT(USER_UGC_LIST_FOLLOWED); // UserUGCListSortOrder Enums - BIND_ENUM_CONSTANT(USERUGCLISTSORTORDER_CREATIONORDERDESC); - BIND_ENUM_CONSTANT(USERUGCLISTSORTORDER_CREATIONORDERASC); - BIND_ENUM_CONSTANT(USERUGCLISTSORTORDER_TITLEASC); - BIND_ENUM_CONSTANT(USERUGCLISTSORTORDER_LASTUPDATEDDESC); - BIND_ENUM_CONSTANT(USERUGCLISTSORTORDER_SUBSCRIPTIONDATEDESC); - BIND_ENUM_CONSTANT(USERUGCLISTSORTORDER_VOTESCOREDESC); - BIND_ENUM_CONSTANT(SERUGCLISTSORTORDER_FORMODERATION); + BIND_ENUM_CONSTANT(USER_UGC_LIST_SORT_ORDER_CREATION_ORDER_DESC); + BIND_ENUM_CONSTANT(USER_UGC_LIST_SORT_ORDER_CREATION_ORDER_ASC); + BIND_ENUM_CONSTANT(USER_UGC_LIST_SORT_ORDER_TITLE_ASC); + BIND_ENUM_CONSTANT(USER_UGC_LIST_SORT_ORDER_LAST_UPDATED_DESC); + BIND_ENUM_CONSTANT(USER_UGC_LIST_SORT_ORDER_SUBSCRIPTION_DATE_DESC); + BIND_ENUM_CONSTANT(USER_UGC_LIST_SORT_ORDER_VOTE_SCORE_DESC); + BIND_ENUM_CONSTANT(USER_UGC_LIST_SORT_ORDER_FOR_MODERATION); // WorkshopEnumerationType Enums BIND_ENUM_CONSTANT(WORKSHOP_ENUMERATION_TYPE_RANKED_BY_VOTE); @@ -6081,7 +5310,7 @@ void SteamServer::_bind_methods(){ BIND_ENUM_CONSTANT(WORKSHOP_FILE_TYPE_MICROTRANSACTION); BIND_ENUM_CONSTANT(WORKSHOP_FILE_TYPE_COLLECTION); BIND_ENUM_CONSTANT(WORKSHOP_FILE_TYPE_ART); - BIND_ENUM_CONSTANT(wORKSHOP_FILE_TYPE_VIDEO); + BIND_ENUM_CONSTANT(WORKSHOP_FILE_TYPE_VIDEO); BIND_ENUM_CONSTANT(WORKSHOP_FILE_TYPE_SCREENSHOT); BIND_ENUM_CONSTANT(WORKSHOP_FILE_TYPE_GAME); BIND_ENUM_CONSTANT(WORKSHOP_FILE_TYPE_SOFTWARE); @@ -6090,7 +5319,7 @@ void SteamServer::_bind_methods(){ BIND_ENUM_CONSTANT(WORKSHOP_FILE_TYPE_INTEGRATED_GUIDE); BIND_ENUM_CONSTANT(WORKSHOP_FILE_TYPE_MERCH); BIND_ENUM_CONSTANT(WORKSHOP_FILE_TYPE_CONTROLLER_BINDING); - BIND_ENUM_CONSTANT(wORKSHOP_FILE_TYPE_STEAMWORKS_ACCESS_INVITE); + BIND_ENUM_CONSTANT(WORKSHOP_FILE_TYPE_STEAMWORKS_ACCESS_INVITE); BIND_ENUM_CONSTANT(WORKSHOP_FILE_TYPE_STEAM_VIDEO); BIND_ENUM_CONSTANT(WORKSHOP_FILE_TYPE_GAME_MANAGED_ITEM); BIND_ENUM_CONSTANT(WORKSHOP_FILE_TYPE_CLIP); diff --git a/godotsteam_server.h b/godotsteam_server.h index ea1a10e..a64ba96 100644 --- a/godotsteam_server.h +++ b/godotsteam_server.h @@ -1,7 +1,7 @@ #ifndef GODOTSTEAM_SERVER_H #define GODOTSTEAM_SERVER_H -///////////////////////////////////////////////// + // SILENCE STEAMWORKS WARNINGS ///////////////////////////////////////////////// // @@ -12,7 +12,7 @@ #pragma warning(disable:4828) #endif -///////////////////////////////////////////////// + // INCLUDE HEADERS ///////////////////////////////////////////////// // @@ -27,1333 +27,1207 @@ #include "core/object.h" #include "scene/resources/texture.h" #include "core/reference.h" +#include "scene/main/scene_tree.h" #include "core/dictionary.h" #include "core/method_bind_ext.gen.inc" +// Include GodotSteam headers +#include "godotsteam_server_constants.h" + // Include some system headers #include "map" class SteamServer: public Object { GDCLASS(SteamServer, Object); + + +public: + + static SteamServer* get_singleton(); + SteamServer(); + ~SteamServer(); + + + // STEAMWORKS API ENUMS + ///////////////////////////////////////// + // + enum AccountType { + // Found in steamclientpublic.h + ACCOUNT_TYPE_INVALID = k_EAccountTypeInvalid, + ACCOUNT_TYPE_INDIVIDUAL = k_EAccountTypeIndividual, + ACCOUNT_TYPE_MULTISEAT = k_EAccountTypeMultiseat, + ACCOUNT_TYPE_GAME_SERVER = k_EAccountTypeGameServer, + ACCOUNT_TYPE_ANON_GAME_SERVER = k_EAccountTypeAnonGameServer, + ACCOUNT_TYPE_PENDING = k_EAccountTypePending, + ACCOUNT_TYPE_CONTENT_SERVER = k_EAccountTypeContentServer, + ACCOUNT_TYPE_CLAN = k_EAccountTypeClan, + ACCOUNT_TYPE_CHAT = k_EAccountTypeChat, + ACCOUNT_TYPE_CONSOLE_USER = k_EAccountTypeConsoleUser, + ACCOUNT_TYPE_ANON_USER = k_EAccountTypeAnonUser, + ACCOUNT_TYPE_MAX = k_EAccountTypeMax + }; + enum AuthSessionResponse { + // Found in steamclientpublic.h + AUTH_SESSION_RESPONSE_OK = k_EAuthSessionResponseOK, + AUTH_SESSION_RESPONSE_USER_NOT_CONNECTED_TO_STEAM = k_EAuthSessionResponseUserNotConnectedToSteam, + AUTH_SESSION_RESPONSE_NO_LICENSE_OR_EXPIRED = k_EAuthSessionResponseNoLicenseOrExpired, + AUTH_SESSION_RESPONSE_VAC_BANNED = k_EAuthSessionResponseVACBanned, + AUTH_SESSION_RESPONSE_LOGGED_IN_ELSEWHERE = k_EAuthSessionResponseLoggedInElseWhere, + AUTH_SESSION_RESPONSE_VAC_CHECK_TIMED_OUT = k_EAuthSessionResponseVACCheckTimedOut, + AUTH_SESSION_RESPONSE_AUTH_TICKET_CANCELED = k_EAuthSessionResponseAuthTicketCanceled, + AUTH_SESSION_RESPONSE_AUTH_TICKET_INVALID_ALREADY_USED = k_EAuthSessionResponseAuthTicketInvalidAlreadyUsed, + AUTH_SESSION_RESPONSE_AUTH_TICKET_INVALID = k_EAuthSessionResponseAuthTicketInvalid, + AUTH_SESSION_RESPONSE_PUBLISHER_ISSUED_BAN = k_EAuthSessionResponsePublisherIssuedBan, + AUTH_SESSION_RESPONSE_AUTH_TICKET_NETWORK_IDENTITY_FAILURE = k_EAuthSessionResponseAuthTicketNetworkIdentityFailure + }; + enum BeginAuthSessionResult { + // Found in steamclientpublic.h + BEGIN_AUTH_SESSION_RESULT_OK = k_EBeginAuthSessionResultOK, + BEGIN_AUTH_SESSION_RESULT_INVALID_TICKET = k_EBeginAuthSessionResultInvalidTicket, + BEGIN_AUTH_SESSION_RESULT_DUPLICATE_REQUEST = k_EBeginAuthSessionResultDuplicateRequest, + BEGIN_AUTH_SESSION_RESULT_INVALID_VERSION = k_EBeginAuthSessionResultInvalidVersion, + BEGIN_AUTH_SESSION_RESULT_GAME_MISMATCH = k_EBeginAuthSessionResultGameMismatch, + BEGIN_AUTH_SESSION_RESULT_EXPIRED_TICKET = k_EBeginAuthSessionResultExpiredTicket + }; + enum DenyReason { + // Found in steamclientpublic.h + DENY_INVALID = k_EDenyInvalid, + DENY_INVALID_VERSION = k_EDenyInvalidVersion, + DENY_GENERIC = k_EDenyGeneric, + DENY_NOT_LOGGED_ON = k_EDenyNotLoggedOn, + DENY_NO_LICENSE = k_EDenyNoLicense, + DENY_CHEATER = k_EDenyCheater, + DENY_LOGGED_IN_ELSEWHERE = k_EDenyLoggedInElseWhere, + DENY_UNKNOWN_TEXT = k_EDenyUnknownText, + DENY_INCOMPATIBLE_ANTI_CHEAT = k_EDenyIncompatibleAnticheat, + DENY_MEMORY_CORRUPTION = k_EDenyMemoryCorruption, + DENY_INCOMPATIBLE_SOFTWARE = k_EDenyIncompatibleSoftware, + DENY_STEAM_CONNECTION_LOST = k_EDenySteamConnectionLost, + DENY_STEAM_CONNECTION_ERROR = k_EDenySteamConnectionError, + DENY_STEAM_RESPONSE_TIMED_OUT = k_EDenySteamResponseTimedOut, + DENY_STEAM_VALIDATION_STALLED = k_EDenySteamValidationStalled, + DENY_STEAM_OWNER_LEFT_GUEST_USER = k_EDenySteamOwnerLeftGuestUser + }; + enum GameIDType { + GAME_TYPE_APP = CGameID::k_EGameIDTypeApp, + GAME_TYPE_GAME_MOD = CGameID::k_EGameIDTypeGameMod, + GAME_TYPE_SHORTCUT = CGameID::k_EGameIDTypeShortcut, + GAME_TYPE_P2P = CGameID::k_EGameIDTypeP2P + }; + enum IPType { + IP_TYPE_IPV4 = k_ESteamIPTypeIPv4, + IP_TYPE_IPV6 = k_ESteamIPTypeIPv6 + }; + enum Result { + // Found in steamclientpublic.h + RESULT_NONE = k_EResultNone, + RESULT_OK = k_EResultOK, + RESULT_FAIL = k_EResultFail, + RESULT_NO_CONNECTION = k_EResultNoConnection, + RESULT_INVALID_PASSWORD = k_EResultInvalidPassword, + RESULT_LOGGED_IN_ELSEWHERE = k_EResultLoggedInElsewhere, + RESULT_INVALID_PROTOCOL_VER = k_EResultInvalidProtocolVer, + RESULT_INVALID_PARAM = k_EResultInvalidParam, + RESULT_FILE_NOT_FOUND = k_EResultFileNotFound, + RESULT_BUSY = k_EResultBusy, + RESULT_INVALID_STATE = k_EResultInvalidState, + RESULT_INVALID_NAME = k_EResultInvalidName, + RESULT_INVALID_EMAIL = k_EResultInvalidEmail, + RESULT_DUPLICATE_NAME = k_EResultDuplicateName, + RESULT_ACCESS_DENIED = k_EResultAccessDenied, + RESULT_TIMEOUT = k_EResultTimeout, + RESULT_BANNED = k_EResultBanned, + RESULT_ACCOUNT_NOT_FOUND = k_EResultAccountNotFound, + RESULT_INVALID_STEAMID = k_EResultInvalidSteamID, + RESULT_SERVICE_UNAVAILABLE = k_EResultServiceUnavailable, + RESULT_NOT_LOGGED_ON = k_EResultNotLoggedOn, + RESULT_PENDING = k_EResultPending, + RESULT_ENCRYPTION_FAILURE = k_EResultEncryptionFailure, + RESULT_INSUFFICIENT_PRIVILEGE = k_EResultInsufficientPrivilege, + RESULT_LIMIT_EXCEEDED = k_EResultLimitExceeded, + RESULT_REVOKED = k_EResultRevoked, + RESULT_EXPIRED = k_EResultExpired, + RESULT_ALREADY_REDEEMED = k_EResultAlreadyRedeemed, + RESULT_DUPLICATE_REQUEST = k_EResultDuplicateRequest, + RESULT_ALREADY_OWNED = k_EResultAlreadyOwned, + RESULT_IP_NOT_FOUND = k_EResultIPNotFound, + RESULT_PERSIST_FAILED = k_EResultPersistFailed, + RESULT_LOCKING_FAILED = k_EResultLockingFailed, + RESULT_LOG_ON_SESSION_REPLACED = k_EResultLogonSessionReplaced, + RESULT_CONNECT_FAILED = k_EResultConnectFailed, + RESULT_HANDSHAKE_FAILED = k_EResultHandshakeFailed, + RESULT_IO_FAILURE = k_EResultIOFailure, + RESULT_REMOTE_DISCONNECT = k_EResultRemoteDisconnect, + RESULT_SHOPPING_CART_NOT_FOUND = k_EResultShoppingCartNotFound, + RESULT_BLOCKED = k_EResultBlocked, + RESULT_IGNORED = k_EResultIgnored, + RESULT_NO_MATCH = k_EResultNoMatch, + RESULT_ACCOUNT_DISABLED = k_EResultAccountDisabled, + RESULT_SERVICE_READ_ONLY = k_EResultServiceReadOnly, + RESULT_ACCOUNT_NOT_FEATURED = k_EResultAccountNotFeatured, + RESULT_ADMINISTRATO_ROK = k_EResultAdministratorOK, + RESULT_CONTENT_VERSION = k_EResultContentVersion, + RESULT_TRY_ANOTHER_CM = k_EResultTryAnotherCM, + RESULT_PASSWORD_REQUIRED_TO_KICK_SESSION = k_EResultPasswordRequiredToKickSession, + RESULT_ALREADY_LOGGED_IN_ELSEWHERE = k_EResultAlreadyLoggedInElsewhere, + RESULT_SUSPENDED = k_EResultSuspended, + RESULT_CANCELLED = k_EResultCancelled, + RESULT_DATA_CORRUPTION = k_EResultDataCorruption, + RESULT_DISK_FULL = k_EResultDiskFull, + RESULT_REMOTE_CALL_FAILED = k_EResultRemoteCallFailed, + RESULT_PASSWORD_UNSET = k_EResultPasswordUnset, + RESULT_EXTERNAL_ACCOUNT_UNLINKED = k_EResultExternalAccountUnlinked, + RESULT_PSN_TICKET_INVALID = k_EResultPSNTicketInvalid, + RESULT_EXTERNAL_ACCOUNT_ALREADY_LINKED = k_EResultExternalAccountAlreadyLinked, + RESULT_REMOTE_FILE_CONFLICT = k_EResultRemoteFileConflict, + RESULT_ILLEGAL_PASSWORD = k_EResultIllegalPassword, + RESULT_SAME_AS_PREVIOUS_VALUE = k_EResultSameAsPreviousValue, + RESULT_ACCOUNT_LOG_ON_DENIED = k_EResultAccountLogonDenied, + RESULT_CANNOT_USE_OLD_PASSWORD = k_EResultCannotUseOldPassword, + RESULT_INVALID_LOG_IN_AUTH_CODE = k_EResultInvalidLoginAuthCode, + RESULT_ACCOUNT_LOG_ON_DENIED_NO_MAIL = k_EResultAccountLogonDeniedNoMail, + RESULT_HARDWARE_NOT_CAPABLE_OF_IPT = k_EResultHardwareNotCapableOfIPT, + RESULT_IPT_INIT_ERROR = k_EResultIPTInitError, + RESULT_PARENTAL_CONTROL_RESTRICTED = k_EResultParentalControlRestricted, + RESULT_FACEBOOK_QUERY_ERROR = k_EResultFacebookQueryError, + RESULT_EXPIRED_LOGIN_AUTH_CODE = k_EResultExpiredLoginAuthCode, + RESULT_IP_LOGIN_RESTRICTION_FAILED = k_EResultIPLoginRestrictionFailed, + RESULT_ACCOUNT_LOCKED_DOWN = k_EResultAccountLockedDown, + RESULT_ACCOUNT_LOG_ON_DENIED_VERIFIED_EMAIL_REQUIRED = k_EResultAccountLogonDeniedVerifiedEmailRequired, + RESULT_NO_MATCHING_URL = k_EResultNoMatchingURL, + RESULT_BAD_RESPONSE = k_EResultBadResponse, + RESULT_REQUIRE_PASSWORD_REENTRY = k_EResultRequirePasswordReEntry, + RESULT_VALUE_OUT_OF_RANGE = k_EResultValueOutOfRange, + RESULT_UNEXPECTED_ERROR = k_EResultUnexpectedError, + RESULT_DISABLED = k_EResultDisabled, + RESULT_INVALID_CEG_SUBMISSION = k_EResultInvalidCEGSubmission, + RESULT_RESTRICTED_DEVICE = k_EResultRestrictedDevice, + RESULT_REGION_LOCKED = k_EResultRegionLocked, + RESULT_RATE_LIMIT_EXCEEDED = k_EResultRateLimitExceeded, + RESULT_ACCOUNT_LOGIN_DENIED_NEED_TWO_FACTOR = k_EResultAccountLoginDeniedNeedTwoFactor, + RESULT_ITEM_DELETED = k_EResultItemDeleted, + RESULT_ACCOUNT_LOGIN_DENIED_THROTTLE = k_EResultAccountLoginDeniedThrottle, + RESULT_TWO_FACTOR_CODE_MISMATCH = k_EResultTwoFactorCodeMismatch, + RESULT_TWO_FACTOR_ACTIVATION_CODE_MISMATCH = k_EResultTwoFactorActivationCodeMismatch, + RESULT_ACCOUNT_ASSOCIATED_TO_MULTIPLE_PARTNERS = k_EResultAccountAssociatedToMultiplePartners, + RESULT_NOT_MODIFIED = k_EResultNotModified, + RESULT_NO_MOBILE_DEVICE = k_EResultNoMobileDevice, + RESULT_TIME_NOT_SYNCED = k_EResultTimeNotSynced, + RESULT_SMS_CODE_FAILED = k_EResultSmsCodeFailed, + RESULT_ACCOUNT_LIMIT_EXCEEDED = k_EResultAccountLimitExceeded, + RESULT_ACCOUNT_ACTIVITY_LIMIT_EXCEEDED = k_EResultAccountActivityLimitExceeded, + RESULT_PHONE_ACTIVITY_LIMIT_EXCEEDED = k_EResultPhoneActivityLimitExceeded, + RESULT_REFUND_TO_WALLET = k_EResultRefundToWallet, + RESULT_EMAIL_SEND_FAILURE = k_EResultEmailSendFailure, + RESULT_NOT_SETTLED = k_EResultNotSettled, + RESULT_NEED_CAPTCHA = k_EResultNeedCaptcha, + RESULT_GSLT_DENIED = k_EResultGSLTDenied, + RESULT_GS_OWNER_DENIED = k_EResultGSOwnerDenied, + RESULT_INVALID_ITEM_TYPE = k_EResultInvalidItemType, + RESULT_IP_BANNED = k_EResultIPBanned, + RESULT_GSLT_EXPIRED = k_EResultGSLTExpired, + RESULT_INSUFFICIENT_FUNDS = k_EResultInsufficientFunds, + RESULT_TOO_MANY_PENDING = k_EResultTooManyPending, + RESULT_NO_SITE_LICENSES_FOUND = k_EResultNoSiteLicensesFound, + RESULT_WG_NETWORK_SEND_EXCEEDED = k_EResultWGNetworkSendExceeded, + RESULT_ACCOUNT_NOT_FRIENDS = k_EResultAccountNotFriends, + RESULT_LIMITED_USER_ACCOUNT = k_EResultLimitedUserAccount, + RESULT_CANT_REMOVE_ITEM = k_EResultCantRemoveItem, + RESULT_ACCOUNT_DELETED = k_EResultAccountDeleted, + RESULT_EXISTING_USER_CANCELLED_LICENSE = k_EResultExistingUserCancelledLicense, + RESULT_COMMUNITY_COOLDOWN = k_EResultCommunityCooldown, + RESULT_NO_LAUNCHER_SPECIFIED = k_EResultNoLauncherSpecified, + RESULT_MUST_AGREE_TO_SSA = k_EResultMustAgreeToSSA, + RESULT_LAUNCHER_MIGRATED = k_EResultLauncherMigrated, + RESULT_STEAM_REALM_MISMATCH = k_EResultSteamRealmMismatch, + RESULT_INVALID_SIGNATURE = k_EResultInvalidSignature, + RESULT_PARSE_FAILURE = k_EResultParseFailure, + RESULT_NO_VERIFIED_PHONE = k_EResultNoVerifiedPhone, + RESULT_INSUFFICIENT_BATTERY = k_EResultInsufficientBattery, + RESULT_CHARGER_REQUIRED = k_EResultChargerRequired, + RESULT_CACHED_CREDENTIAL_INVALID = k_EResultCachedCredentialInvalid, + RESULT_PHONE_NUMBER_IS_VOIP = K_EResultPhoneNumberIsVOIP, + RESULT_NOT_SUPPORTED = k_EResultNotSupported, + RESULT_FAMILY_SIZE_LIMIT_EXCEEDED = k_EResultFamilySizeLimitExceeded + }; + enum ServerMode { + SERVER_MODE_INVALID = eServerModeInvalid, + SERVER_MODE_NO_AUTHENTICATION = eServerModeNoAuthentication, + SERVER_MODE_AUTHENTICATION = eServerModeAuthentication, + SERVER_MODE_AUTHENTICATION_AND_SECURE = eServerModeAuthenticationAndSecure + }; + enum SteamAPIInitResult { + STEAM_API_INIT_RESULT_OK = k_ESteamAPIInitResult_OK, + STEAM_API_INIT_RESULT_FAILED_GENERIC = k_ESteamAPIInitResult_FailedGeneric, + STEAM_API_INIT_RESULT_NO_STEAM_CLIENT = k_ESteamAPIInitResult_NoSteamClient, + STEAM_API_INIT_RESULT_VERSION_MISMATCH = k_ESteamAPIInitResult_VersionMismatch + }; + enum Universe { + // Found in steamuniverse.h + UNIVERSE_INVALID = k_EUniverseInvalid, + UNIVERSE_PUBLIC = k_EUniversePublic, + UNIVERSE_BETA = k_EUniverseBeta, + UNIVERSE_INTERNAL = k_EUniverseInternal, + UNIVERSE_DEV = k_EUniverseDev, + UNIVERSE_MAX = k_EUniverseMax + }; + + // HTTP enums + enum HTTPMethod { + HTTP_METHOD_INVALID = k_EHTTPMethodInvalid, + HTTP_METHOD_GET = k_EHTTPMethodGET, + HTTP_METHOD_HEAD = k_EHTTPMethodHEAD, + HTTP_METHOD_POST = k_EHTTPMethodPOST, + HTTP_METHOD_PUT = k_EHTTPMethodPUT, + HTTP_METHOD_DELETE = k_EHTTPMethodDELETE, + HTTP_METHOD_OPTIONS = k_EHTTPMethodOPTIONS, + HTTP_METHOD_PATCH = k_EHTTPMethodPATCH + }; + enum HTTPStatusCode { + HTTP_STATUS_CODE_INVALID = k_EHTTPStatusCodeInvalid, + HTTP_STATUS_CODE_100_CONTINUE = k_EHTTPStatusCode100Continue, + HTTP_STATUS_CODE_101_SWITCHING_PROTOCOLS = k_EHTTPStatusCode101SwitchingProtocols, + HTTP_STATUS_CODE_200_OK = k_EHTTPStatusCode200OK, + HTTP_STATUS_CODE_201_CREATED = k_EHTTPStatusCode201Created, + HTTP_STATUS_CODE_202_ACCEPTED = k_EHTTPStatusCode202Accepted, + HTTP_STATUS_CODE_203_NON_AUTHORITATIVE = k_EHTTPStatusCode203NonAuthoritative, + HTTP_STATUS_CODE_204_NO_CONTENT = k_EHTTPStatusCode204NoContent, + HTTP_STATUS_CODE_205_RESET_CONTENT = k_EHTTPStatusCode205ResetContent, + HTTP_STATUS_CODE_206_PARTIAL_CONTENT = k_EHTTPStatusCode206PartialContent, + HTTP_STATUS_CODE_300_MULTIPLE_CHOICES = k_EHTTPStatusCode300MultipleChoices, + HTTP_STATUS_CODE_301_MOVED_PERMANENTLY = k_EHTTPStatusCode301MovedPermanently, + HTTP_STATUS_CODE_302_FOUND = k_EHTTPStatusCode302Found, + HTTP_STATUS_CODE_303_SEE_OTHER = k_EHTTPStatusCode303SeeOther, + HTTP_STATUS_CODE_304_NOT_MODIFIED = k_EHTTPStatusCode304NotModified, + HTTP_STATUS_CODE_305_USE_PROXY = k_EHTTPStatusCode305UseProxy, + HTTP_STATUS_CODE_307_TEMPORARY_REDIRECT = k_EHTTPStatusCode307TemporaryRedirect, + HTTP_STATUS_CODE_308_PERMANENT_REDIRECT = k_EHTTPStatusCode308PermanentRedirect, + HTTP_STATUS_CODE_400_BAD_REQUEST = k_EHTTPStatusCode400BadRequest, + HTTP_STATUS_CODE_401_UNAUTHORIZED = k_EHTTPStatusCode401Unauthorized, + HTTP_STATUS_CODE_402_PAYMENT_REQUIRED = k_EHTTPStatusCode402PaymentRequired, + HTTP_STATUS_CODE_403_FORBIDDEN = k_EHTTPStatusCode403Forbidden, + HTTP_STATUS_CODE_404_NOT_FOUND = k_EHTTPStatusCode404NotFound, + HTTP_STATUS_CODE_405_METHOD_NOT_ALLOWED = k_EHTTPStatusCode405MethodNotAllowed, + HTTP_STATUS_CODE_406_NOT_ACCEPTABLE = k_EHTTPStatusCode406NotAcceptable, + HTTP_STATUS_CODE_407_PROXY_AUTH_REQUIRED = k_EHTTPStatusCode407ProxyAuthRequired, + HTTP_STATUS_CODE_408_REQUEST_TIMEOUT = k_EHTTPStatusCode408RequestTimeout, + HTTP_STATUS_CODE_409_CONFLICT = k_EHTTPStatusCode409Conflict, + HTTP_STATUS_CODE_410_GONE = k_EHTTPStatusCode410Gone, + HTTP_STATUS_CODE_411_LENGTH_REQUIRED = k_EHTTPStatusCode411LengthRequired, + HTTP_STATUS_CODE_412_PRECONDITION_FAILED = k_EHTTPStatusCode412PreconditionFailed, + HTTP_STATUS_CODE_413_REQUEST_ENTITY_TOO_LARGE = k_EHTTPStatusCode413RequestEntityTooLarge, + HTTP_STATUS_CODE_414_REQUEST_URI_TOO_LONG = k_EHTTPStatusCode414RequestURITooLong, + HTTP_STATUS_CODE_415_UNSUPPORTED_MEDIA_TYPE = k_EHTTPStatusCode415UnsupportedMediaType, + HTTP_STATUS_CODE_416_REQUESTED_RANGE_NOT_SATISFIABLE = k_EHTTPStatusCode416RequestedRangeNotSatisfiable, + HTTP_STATUS_CODE_417_EXPECTATION_FAILED = k_EHTTPStatusCode417ExpectationFailed, + HTTP_STATUS_CODE_4XX_UNKNOWN = k_EHTTPStatusCode4xxUnknown, + HTTP_STATUS_CODE_429_TOO_MANY_REQUESTS = k_EHTTPStatusCode429TooManyRequests, + HTTP_STATUS_CODE_444_CONNECTION_CLOSED = k_EHTTPStatusCode444ConnectionClosed, + HTTP_STATUS_CODE_500_INTERNAL_SERVER_ERROR = k_EHTTPStatusCode500InternalServerError, + HTTP_STATUS_CODE_501_NOT_IMPLEMENTED = k_EHTTPStatusCode501NotImplemented, + HTTP_STATUS_CODE_502_BAD_GATEWAY = k_EHTTPStatusCode502BadGateway, + HTTP_STATUS_CODE_503_SERVICE_UNAVAILABLE = k_EHTTPStatusCode503ServiceUnavailable, + HTTP_STATUS_CODE_504_GATEWAY_TIMEOUT = k_EHTTPStatusCode504GatewayTimeout, + HTTP_STATUS_CODE_505_HTTP_VERSION_NOT_SUPPORTED = k_EHTTPStatusCode505HTTPVersionNotSupported, + HTTP_STATUS_CODE_5XX_UNKNOWN = k_EHTTPStatusCode5xxUnknown + }; + + // Inventory enums + enum ItemFlags { + STEAM_ITEM_NO_TRADE = k_ESteamItemNoTrade, + STEAM_ITEM_REMOVED = k_ESteamItemRemoved, + STEAM_ITEM_CONSUMED = k_ESteamItemConsumed + }; + + // Networking enums + enum P2PSend { + P2P_SEND_UNRELIABLE = k_EP2PSendUnreliable, + P2P_SEND_UNRELIABLE_NO_DELAY = k_EP2PSendUnreliableNoDelay, + P2P_SEND_RELIABLE = k_EP2PSendReliable, + P2P_SEND_RELIABLE_WITH_BUFFERING = k_EP2PSendReliableWithBuffering + }; + enum P2PSessionError { + P2P_SESSION_ERROR_NONE = k_EP2PSessionErrorNone, + P2P_SESSION_ERROR_NOT_RUNNING_APP = k_EP2PSessionErrorNotRunningApp_DELETED, + P2P_SESSION_ERROR_NO_RIGHTS_TO_APP = k_EP2PSessionErrorNoRightsToApp, + P2P_SESSION_ERROR_DESTINATION_NOT_LOGGED_ON = k_EP2PSessionErrorDestinationNotLoggedIn_DELETED, + P2P_SESSION_ERROR_TIMEOUT = k_EP2PSessionErrorTimeout, + P2P_SESSION_ERROR_MAX = k_EP2PSessionErrorMax + }; + enum SocketConnectionType { + NET_SOCKET_CONNECTION_TYPE_NOT_CONNECTED = k_ESNetSocketConnectionTypeNotConnected, + NET_SOCKET_CONNECTION_TYPE_UDP = k_ESNetSocketConnectionTypeUDP, + NET_SOCKET_CONNECTION_TYPE_UDP_RELAY = k_ESNetSocketConnectionTypeUDPRelay + }; + enum SocketState { + NET_SOCKET_STATE_INVALID = k_ESNetSocketStateInvalid, + NET_SOCKET_STATE_CONNECTED = k_ESNetSocketStateConnected, + NET_SOCKET_STATE_INITIATED = k_ESNetSocketStateInitiated, + NET_SOCKET_STATE_LOCAL_CANDIDATE_FOUND = k_ESNetSocketStateLocalCandidatesFound, + NET_SOCKET_STATE_RECEIVED_REMOTE_CANDIDATES = k_ESNetSocketStateReceivedRemoteCandidates, + NET_SOCKET_STATE_CHALLENGE_HANDSHAKE = k_ESNetSocketStateChallengeHandshake, + NET_SOCKET_STATE_DISCONNECTING = k_ESNetSocketStateDisconnecting, + NET_SOCKET_STATE_LOCAL_DISCONNECT = k_ESNetSocketStateLocalDisconnect, + NET_SOCKET_STATE_TIMEOUT_DURING_CONNECT = k_ESNetSocketStateTimeoutDuringConnect, + NET_SOCKET_STATE_REMOTE_END_DISCONNECTED = k_ESNetSocketStateRemoteEndDisconnected, + NET_SOCKET_STATE_BROKEN = k_ESNetSocketStateConnectionBroken + }; + + // Networking Sockets enums + enum NetworkingConfigValue { + NETWORKING_CONFIG_INVALID = k_ESteamNetworkingConfig_Invalid, + NETWORKING_CONFIG_FAKE_PACKET_LOSS_SEND = k_ESteamNetworkingConfig_FakePacketLoss_Send, + NETWORKING_CONFIG_FAKE_PACKET_LOSS_RECV = k_ESteamNetworkingConfig_FakePacketLoss_Recv, + NETWORKING_CONFIG_FAKE_PACKET_LAG_SEND = k_ESteamNetworkingConfig_FakePacketLag_Send, + NETWORKING_CONFIG_FAKE_PACKET_LAG_RECV = k_ESteamNetworkingConfig_FakePacketLag_Recv, + NETWORKING_CONFIG_FAKE_PACKET_REORDER_SEND = k_ESteamNetworkingConfig_FakePacketReorder_Send, + NETWORKING_CONFIG_FAKE_PACKET_REORDER_RECV = k_ESteamNetworkingConfig_FakePacketReorder_Recv, + NETWORKING_CONFIG_FAKE_PACKET_REORDER_TIME = k_ESteamNetworkingConfig_FakePacketReorder_Time, + NETWORKING_CONFIG_FAKE_PACKET_DUP_SEND = k_ESteamNetworkingConfig_FakePacketDup_Send, + NETWORKING_CONFIG_FAKE_PACKET_DUP_REVC = k_ESteamNetworkingConfig_FakePacketDup_Recv, + NETWORKING_CONFIG_FAKE_PACKET_DUP_TIME_MAX = k_ESteamNetworkingConfig_FakePacketDup_TimeMax, + NETWORKING_CONFIG_PACKET_TRACE_MAX_BYTES = k_ESteamNetworkingConfig_PacketTraceMaxBytes, + NETWORKING_CONFIG_FAKE_RATE_LIMIT_SEND_RATE = k_ESteamNetworkingConfig_FakeRateLimit_Send_Rate, + NETWORKING_CONFIG_FAKE_RATE_LIMIT_SEND_BURST = k_ESteamNetworkingConfig_FakeRateLimit_Send_Burst, + NETWORKING_CONFIG_FAKE_RATE_LIMIT_RECV_RATE = k_ESteamNetworkingConfig_FakeRateLimit_Recv_Rate, + NETWORKING_CONFIG_FAKE_RATE_LIMIT_RECV_BURST = k_ESteamNetworkingConfig_FakeRateLimit_Recv_Burst, + NETWORKING_CONFIG_OUT_OF_ORDER_CORRECTION_WINDOW_MICROSECONDS = k_ESteamNetworkingConfig_OutOfOrderCorrectionWindowMicroseconds, + NETWORKING_CONFIG_CONNECTION_USER_DATA = k_ESteamNetworkingConfig_ConnectionUserData, + NETWORKING_CONFIG_TIMEOUT_INITIAL = k_ESteamNetworkingConfig_TimeoutInitial, + NETWORKING_CONFIG_TIMEOUT_CONNECTED = k_ESteamNetworkingConfig_TimeoutConnected, + NETWORKING_CONFIG_SEND_BUFFER_SIZE = k_ESteamNetworkingConfig_SendBufferSize, + NETWORKING_CONFIG_RECV_BUFFER_SIZE = k_ESteamNetworkingConfig_RecvBufferSize, + NETWORKING_CONFIG_RECV_BUFFER_MESSAGES = k_ESteamNetworkingConfig_RecvBufferMessages, + NETWORKING_CONFIG_RECV_MAX_MESSAGE_SIZE = k_ESteamNetworkingConfig_RecvMaxMessageSize, + NETWORKING_CONFIG_RECV_MAX_SEGMENTS_PER_PACKET = k_ESteamNetworkingConfig_RecvMaxSegmentsPerPacket, + NETWORKING_CONFIG_SEND_RATE_MIN = k_ESteamNetworkingConfig_SendRateMin, + NETWORKING_CONFIG_SEND_RATE_MAX = k_ESteamNetworkingConfig_SendRateMax, + NETWORKING_CONFIG_NAGLE_TIME = k_ESteamNetworkingConfig_NagleTime, + NETWORKING_CONFIG_IP_ALLOW_WITHOUT_AUTH = k_ESteamNetworkingConfig_IP_AllowWithoutAuth, + NETWORKING_CONFIG_MTU_PACKET_SIZE = k_ESteamNetworkingConfig_MTU_PacketSize, + NETWORKING_CONFIG_MTU_DATA_SIZE = k_ESteamNetworkingConfig_MTU_DataSize, + NETWORKING_CONFIG_UNENCRYPTED = k_ESteamNetworkingConfig_Unencrypted, + NETWORKING_CONFIG_SYMMETRIC_CONNECT = k_ESteamNetworkingConfig_SymmetricConnect, + NETWORKING_CONFIG_LOCAL_VIRTUAL_PORT = k_ESteamNetworkingConfig_LocalVirtualPort, + NETWORKING_CONFIG_DUAL_WIFI_ENABLE = k_ESteamNetworkingConfig_DualWifi_Enable, + NETWORKING_CONFIG_ENABLE_DIAGNOSTICS_UI = k_ESteamNetworkingConfig_EnableDiagnosticsUI, + NETWORKING_CONFIG_SDR_CLIENT_CONSEC_PING_TIMEOUT_FAIL_INITIAL = k_ESteamNetworkingConfig_SDRClient_ConsecutitivePingTimeoutsFailInitial, + NETWORKING_CONFIG_SDR_CLIENT_CONSEC_PING_TIMEOUT_FAIL = k_ESteamNetworkingConfig_SDRClient_ConsecutitivePingTimeoutsFail, + NETWORKING_CONFIG_SDR_CLIENT_MIN_PINGS_BEFORE_PING_ACCURATE = k_ESteamNetworkingConfig_SDRClient_MinPingsBeforePingAccurate, + NETWORKING_CONFIG_SDR_CLIENT_SINGLE_SOCKET = k_ESteamNetworkingConfig_SDRClient_SingleSocket, + NETWORKING_CONFIG_SDR_CLIENT_FORCE_RELAY_CLUSTER = k_ESteamNetworkingConfig_SDRClient_ForceRelayCluster, + NETWORKING_CONFIG_SDR_CLIENT_DEV_TICKET = k_ESteamNetworkingConfig_SDRClient_DevTicket, + NETWORKING_CONFIG_SDR_CLIENT_FORCE_PROXY_ADDR = k_ESteamNetworkingConfig_SDRClient_ForceProxyAddr, + NETWORKING_CONFIG_SDR_CLIENT_FAKE_CLUSTER_PING = k_ESteamNetworkingConfig_SDRClient_FakeClusterPing, + NETWORKING_CONFIG_SDR_CLIENT_LIMIT_PING_PROBES_TO_NEAREST_N = k_ESteamNetworkingConfig_SDRClient_LimitPingProbesToNearestN, + NETWORKING_CONFIG_LOG_LEVEL_ACK_RTT = k_ESteamNetworkingConfig_LogLevel_AckRTT, + NETWORKING_CONFIG_LOG_LEVEL_PACKET_DECODE = k_ESteamNetworkingConfig_LogLevel_PacketDecode, + NETWORKING_CONFIG_LOG_LEVEL_MESSAGE = k_ESteamNetworkingConfig_LogLevel_Message, + NETWORKING_CONFIG_LOG_LEVEL_PACKET_GAPS = k_ESteamNetworkingConfig_LogLevel_PacketGaps, + NETWORKING_CONFIG_LOG_LEVEL_P2P_RENDEZVOUS = k_ESteamNetworkingConfig_LogLevel_P2PRendezvous, + NETWORKING_CONFIG_LOG_LEVEL_SRD_RELAY_PINGS = k_ESteamNetworkingConfig_LogLevel_SDRRelayPings, + NETWORKING_CONFIG_CALLBACK_CONNECTION_STATUS_CHANGED = k_ESteamNetworkingConfig_Callback_ConnectionStatusChanged, + NETWORKING_CONFIG_CALLBACK_AUTH_STATUS_CHANGED = k_ESteamNetworkingConfig_Callback_AuthStatusChanged, + NETWORKING_CONFIG_CALLBACK_RELAY_NETWORK_STATUS_CHANGED = k_ESteamNetworkingConfig_Callback_RelayNetworkStatusChanged, + NETWORKING_CONFIG_CALLBACK_MESSAGE_SESSION_REQUEST = k_ESteamNetworkingConfig_Callback_MessagesSessionRequest, + NETWORKING_CONFIG_CALLBACK_MESSAGES_SESSION_FAILED = k_ESteamNetworkingConfig_Callback_MessagesSessionFailed, + NETWORKING_CONFIG_CALLBACK_CREATE_CONNECTION_SIGNALING = k_ESteamNetworkingConfig_Callback_CreateConnectionSignaling, + NETWORKING_CONFIG_CALLBACK_FAKE_IP_RESULT = k_ESteamNetworkingConfig_Callback_FakeIPResult, + NETWORKING_CONFIG_P2P_STUN_SERVER_LIST = k_ESteamNetworkingConfig_P2P_STUN_ServerList, + NETWORKING_CONFIG_P2P_TRANSPORT_ICE_ENABLE = k_ESteamNetworkingConfig_P2P_Transport_ICE_Enable, + NETWORKING_CONFIG_P2P_TRANSPORT_ICE_PENALTY = k_ESteamNetworkingConfig_P2P_Transport_ICE_Penalty, + NETWORKING_CONFIG_P2P_TRANSPORT_SDR_PENALTY = k_ESteamNetworkingConfig_P2P_Transport_SDR_Penalty, + NETWORKING_CONFIG_P2P_TURN_SERVER_LIST = k_ESteamNetworkingConfig_P2P_TURN_ServerList, + NETWORKING_CONFIG_P2P_TURN_uSER_LIST = k_ESteamNetworkingConfig_P2P_TURN_UserList, + NETWORKING_CONFIG_P2P_TURN_PASS_LIST = k_ESteamNetworkingConfig_P2P_TURN_PassList, + // NETWORKING_CONFIG_P2P_TRANSPORT_LAN_BEACON_PENALTY = k_ESteamNetworkingConfig_P2P_Transport_LANBeacon_Penalty, + NETWORKING_CONFIG_P2P_TRANSPORT_ICE_IMPLEMENTATION = k_ESteamNetworkingConfig_P2P_Transport_ICE_Implementation, + NETWORKING_CONFIG_ECN = k_ESteamNetworkingConfig_ECN, + NETWORKING_CONFIG_VALUE_FORCE32BIT = k_ESteamNetworkingConfigValue__Force32Bit + }; + enum NetworkingConnectionEnd { + CONNECTION_END_INVALID = k_ESteamNetConnectionEnd_Invalid, + CONNECTION_END_APP_MIN = k_ESteamNetConnectionEnd_App_Min, + CONNECTION_END_APP_GENERIC = k_ESteamNetConnectionEnd_App_Generic, + CONNECTION_END_APP_MAX = k_ESteamNetConnectionEnd_App_Max, + CONNECTION_END_APP_EXCEPTION_MIN = k_ESteamNetConnectionEnd_AppException_Min, + CONNECTION_END_APP_EXCEPTION_GENERIC = k_ESteamNetConnectionEnd_AppException_Generic, + CONNECTION_END_APP_EXCEPTION_MAX = k_ESteamNetConnectionEnd_AppException_Max, + CONNECTION_END_LOCAL_MIN = k_ESteamNetConnectionEnd_Local_Min, + CONNECTION_END_LOCAL_OFFLINE_MODE = k_ESteamNetConnectionEnd_Local_OfflineMode, + CONNECTION_END_LOCAL_MANY_RELAY_CONNECTIVITY = k_ESteamNetConnectionEnd_Local_ManyRelayConnectivity, + CONNECTION_END_LOCAL_HOSTED_SERVER_PRIMARY_RELAY = k_ESteamNetConnectionEnd_Local_HostedServerPrimaryRelay, + CONNECTION_END_LOCAL_NETWORK_CONFIG = k_ESteamNetConnectionEnd_Local_NetworkConfig, + CONNECTION_END_LOCAL_RIGHTS = k_ESteamNetConnectionEnd_Local_Rights, + CONNECTION_END_NO_PUBLIC_ADDRESS = k_ESteamNetConnectionEnd_Local_P2P_ICE_NoPublicAddresses, + CONNECTION_END_LOCAL_MAX = k_ESteamNetConnectionEnd_Local_Max, + CONNECTION_END_REMOVE_MIN = k_ESteamNetConnectionEnd_Remote_Min, + CONNECTION_END_REMOTE_TIMEOUT = k_ESteamNetConnectionEnd_Remote_Timeout, + CONNECTION_END_REMOTE_BAD_CRYPT = k_ESteamNetConnectionEnd_Remote_BadCrypt, + CONNECTION_END_REMOTE_BAD_CERT = k_ESteamNetConnectionEnd_Remote_BadCert, + CONNECTION_END_BAD_PROTOCOL_VERSION = k_ESteamNetConnectionEnd_Remote_BadProtocolVersion, + CONNECTION_END_REMOTE_P2P_ICE_NO_PUBLIC_ADDRESSES = k_ESteamNetConnectionEnd_Remote_P2P_ICE_NoPublicAddresses, + CONNECTION_END_REMOTE_MAX = k_ESteamNetConnectionEnd_Remote_Max, + CONNECTION_END_MISC_MIN = k_ESteamNetConnectionEnd_Misc_Min, + CONNECTION_END_MISC_GENERIC = k_ESteamNetConnectionEnd_Misc_Generic, + CONNECTION_END_MISC_INTERNAL_ERROR = k_ESteamNetConnectionEnd_Misc_InternalError, + CONNECTION_END_MISC_TIMEOUT = k_ESteamNetConnectionEnd_Misc_Timeout, + CONNECTION_END_MISC_STEAM_CONNECTIVITY = k_ESteamNetConnectionEnd_Misc_SteamConnectivity, + CONNECTION_END_MISC_NO_RELAY_SESSIONS_TO_CLIENT = k_ESteamNetConnectionEnd_Misc_NoRelaySessionsToClient, + CONNECTION_END_MISC_P2P_RENDEZVOUS = k_ESteamNetConnectionEnd_Misc_P2P_Rendezvous, + CONNECTION_END_MISC_P2P_NAT_FIREWALL = k_ESteamNetConnectionEnd_Misc_P2P_NAT_Firewall, + CONNECTION_END_MISC_PEER_SENT_NO_CONNECTION = k_ESteamNetConnectionEnd_Misc_PeerSentNoConnection, + CONNECTION_END_MISC_MAX = k_ESteamNetConnectionEnd_Misc_Max, + CONNECTION_END_FORCE32BIT = k_ESteamNetConnectionEnd__Force32Bit + }; + enum NetworkingConnectionState { + CONNECTION_STATE_NONE = k_ESteamNetworkingConnectionState_None, + CONNECTION_STATE_CONNECTING = k_ESteamNetworkingConnectionState_Connecting, + CONNECTION_STATE_FINDING_ROUTE = k_ESteamNetworkingConnectionState_FindingRoute, + CONNECTION_STATE_CONNECTED = k_ESteamNetworkingConnectionState_Connected, + CONNECTION_STATE_CLOSED_BY_PEER = k_ESteamNetworkingConnectionState_ClosedByPeer, + CONNECTION_STATE_PROBLEM_DETECTED_LOCALLY = k_ESteamNetworkingConnectionState_ProblemDetectedLocally, + CONNECTION_STATE_FIN_WAIT = k_ESteamNetworkingConnectionState_FinWait, + CONNECTION_STATE_LINGER = k_ESteamNetworkingConnectionState_Linger, + CONNECTION_STATE_DEAD = k_ESteamNetworkingConnectionState_Dead, + CONNECTION_STATE_FORCE_32BIT = k_ESteamNetworkingConnectionState__Force32Bit + }; + enum NetworkingFakeIPType { + FAKE_IP_TYPE_INVALID = k_ESteamNetworkingFakeIPType_Invalid, + FAKE_IP_TYPE_NOT_FAKE = k_ESteamNetworkingFakeIPType_NotFake, + FAKE_IP_TYPE_GLOBAL_IPV4 = k_ESteamNetworkingFakeIPType_GlobalIPv4, + FAKE_IP_TYPE_LOCAL_IPV4 = k_ESteamNetworkingFakeIPType_LocalIPv4, + FAKE_IP_TYPE_FORCE32BIT = k_ESteamNetworkingFakeIPType__Force32Bit + }; + enum NetworkingGetConfigValueResult { + NETWORKING_GET_CONFIG_VALUE_BAD_VALUE = k_ESteamNetworkingGetConfigValue_BadValue, + NETWORKING_GET_CONFIG_VALUE_BAD_SCOPE_OBJ = k_ESteamNetworkingGetConfigValue_BadScopeObj, + NETWORKING_GET_CONFIG_VALUE_BUFFER_TOO_SMALL = k_ESteamNetworkingGetConfigValue_BufferTooSmall, + NETWORKING_GET_CONFIG_VALUE_OK = k_ESteamNetworkingGetConfigValue_OK, + NETWORKING_GET_CONFIG_VALUE_OK_INHERITED = k_ESteamNetworkingGetConfigValue_OKInherited, + NETWORKING_GET_CONFIG_VALUE_FORCE_32BIT = k_ESteamNetworkingGetConfigValueResult__Force32Bit + }; + enum NetworkingIdentityType { + IDENTITY_TYPE_INVALID = k_ESteamNetworkingIdentityType_Invalid, + IDENTITY_TYPE_STEAMID = k_ESteamNetworkingIdentityType_SteamID, + IDENTITY_TYPE_IP_ADDRESS = k_ESteamNetworkingIdentityType_IPAddress, + IDENTITY_TYPE_GENERIC_STRING = k_ESteamNetworkingIdentityType_GenericString, + IDENTITY_TYPE_GENERIC_BYTES = k_ESteamNetworkingIdentityType_GenericBytes, + IDENTITY_TYPE_UNKNOWN_TYPE = k_ESteamNetworkingIdentityType_UnknownType, + IDENTITY_TYPE_XBOX_PAIRWISE = k_ESteamNetworkingIdentityType_XboxPairwiseID, + IDENTITY_TYPE_SONY_PSN = k_ESteamNetworkingIdentityType_SonyPSN, + IDENTITY_TYPE_GOOGLE_STADIA = k_ESteamNetworkingIdentityType_GoogleStadia, + // IDENTITY_TYPE_NINTENDO = k_ESteamNetworkingIdentityType_NintendoNetworkServiceAccount, + // IDENTITY_TYPE_EPIC_GS = k_ESteamNetworkingIdentityType_EpicGameStore, + // IDENTITY_TYPE_WEGAME = k_ESteamNetworkingIdentityType_WeGame, + IDENTITY_TYPE_FORCE_32BIT = k_ESteamNetworkingIdentityType__Force32bit + }; + enum NetworkingSocketsDebugOutputType { + NETWORKING_SOCKET_DEBUG_OUTPUT_TYPE_NONE = k_ESteamNetworkingSocketsDebugOutputType_None, + NETWORKING_SOCKET_DEBUG_OUTPUT_TYPE_BUG = k_ESteamNetworkingSocketsDebugOutputType_Bug, + NETWORKING_SOCKET_DEBUG_OUTPUT_TYPE_ERROR = k_ESteamNetworkingSocketsDebugOutputType_Error, + NETWORKING_SOCKET_DEBUG_OUTPUT_TYPE_IMPORTANT = k_ESteamNetworkingSocketsDebugOutputType_Important, + NETWORKING_SOCKET_DEBUG_OUTPUT_TYPE_WARNING = k_ESteamNetworkingSocketsDebugOutputType_Warning, + NETWORKING_SOCKET_DEBUG_OUTPUT_TYPE_MSG = k_ESteamNetworkingSocketsDebugOutputType_Msg, + NETWORKING_SOCKET_DEBUG_OUTPUT_TYPE_VERBOSE = k_ESteamNetworkingSocketsDebugOutputType_Verbose, + NETWORKING_SOCKET_DEBUG_OUTPUT_TYPE_DEBUG = k_ESteamNetworkingSocketsDebugOutputType_Debug, + NETWORKING_SOCKET_DEBUG_OUTPUT_TYPE_EVERYTHING = k_ESteamNetworkingSocketsDebugOutputType_Everything, + NETWORKING_SOCKET_DEBUG_OUTPUT_TYPE_FORCE_32BIT = k_ESteamNetworkingSocketsDebugOutputType__Force32Bit + }; + + // Networking Utils enums { + enum NetworkingAvailability { + NETWORKING_AVAILABILITY_CANNOT_TRY = k_ESteamNetworkingAvailability_CannotTry, + NETWORKING_AVAILABILITY_FAILED = k_ESteamNetworkingAvailability_Failed, + NETWORKING_AVAILABILITY_PREVIOUSLY = k_ESteamNetworkingAvailability_Previously, + NETWORKING_AVAILABILITY_RETRYING = k_ESteamNetworkingAvailability_Retrying, + NETWORKING_AVAILABILITY_NEVER_TRIED = k_ESteamNetworkingAvailability_NeverTried, + NETWORKING_AVAILABILITY_WAITING = k_ESteamNetworkingAvailability_Waiting, + NETWORKING_AVAILABILITY_ATTEMPTING = k_ESteamNetworkingAvailability_Attempting, + NETWORKING_AVAILABILITY_CURRENT = k_ESteamNetworkingAvailability_Current, + NETWORKING_AVAILABILITY_UNKNOWN = k_ESteamNetworkingAvailability_Unknown, + NETWORKING_AVAILABILITY_FORCE_32BIT = k_ESteamNetworkingAvailability__Force32bit + }; + enum NetworkingConfigDataType { + NETWORKING_CONFIG_TYPE_INT32 = k_ESteamNetworkingConfig_Int32, + NETWORKING_CONFIG_TYPE_INT64 = k_ESteamNetworkingConfig_Int64, + NETWORKING_CONFIG_TYPE_FLOAT = k_ESteamNetworkingConfig_Float, + NETWORKING_CONFIG_TYPE_STRING = k_ESteamNetworkingConfig_String, + NETWORKING_CONFIG_TYPE_FUNCTION_PTR = k_ESteamNetworkingConfig_Ptr, + NETWORKING_CONFIG_TYPE_FORCE_32BIT = k_ESteamNetworkingConfigDataType__Force32Bit + }; + enum NetworkingConfigScope { + NETWORKING_CONFIG_SCOPE_GLOBAL = k_ESteamNetworkingConfig_Global, + NETWORKING_CONFIG_SCOPE_SOCKETS_INTERFACE = k_ESteamNetworkingConfig_SocketsInterface, + NETWORKING_CONFIG_SCOPE_LISTEN_SOCKET = k_ESteamNetworkingConfig_ListenSocket, + NETWORKING_CONFIG_SCOPE_CONNECTION = k_ESteamNetworkingConfig_Connection, + NETWORKING_CONFIG_SCOPE_FORCE_32BIT = k_ESteamNetworkingConfigScope__Force32Bit + }; + + // Remote Storage enums + enum FilePathType { + FILE_PATH_TYPE_INVALID = k_ERemoteStorageFilePathType_Invalid, + FILE_PATH_TYPE_ABSOLUTE = k_ERemoteStorageFilePathType_Absolute, + FILE_PATH_TYPE_API_FILENAME = k_ERemoteStorageFilePathType_APIFilename + }; + enum LocalFileChange { + LOCAL_FILE_CHANGE_INVALID = k_ERemoteStorageLocalFileChange_Invalid, + LOCAL_FILE_CHANGE_FILE_UPDATED = k_ERemoteStorageLocalFileChange_FileUpdated, + LOCAL_FILE_CHANGE_FILE_DELETED = k_ERemoteStorageLocalFileChange_FileDeleted + }; + enum RemoteStoragePlatform { + REMOTE_STORAGE_PLATFORM_NONE = k_ERemoteStoragePlatformNone, + REMOTE_STORAGE_PLATFORM_WINDOWS = k_ERemoteStoragePlatformWindows, + REMOTE_STORAGE_PLATFORM_OSX = k_ERemoteStoragePlatformOSX, + REMOTE_STORAGE_PLATFORM_PS3 = k_ERemoteStoragePlatformPS3, + REMOTE_STORAGE_PLATFORM_LINUX = k_ERemoteStoragePlatformLinux, + REMOTE_STORAGE_PLATFORM_SWITCH = k_ERemoteStoragePlatformSwitch, + REMOTE_STORAGE_PLATFORM_ANDROID = k_ERemoteStoragePlatformAndroid, + REMOTE_STORAGE_PLATFORM_IOS = k_ERemoteStoragePlatformIOS, + REMOTE_STORAGE_PLATFORM_ALL = k_ERemoteStoragePlatformAll + }; + enum RemoteStoragePublishedFileVisibility { + REMOTE_STORAGE_PUBLISHED_VISIBILITY_PUBLIC = k_ERemoteStoragePublishedFileVisibilityPublic, + REMOTE_STORAGE_PUBLISHED_VISIBILITY_FRIENDS_ONLY = k_ERemoteStoragePublishedFileVisibilityFriendsOnly, + REMOTE_STORAGE_PUBLISHED_VISIBILITY_PRIVATE = k_ERemoteStoragePublishedFileVisibilityPrivate, + REMOTE_STORAGE_PUBLISHED_VISIBILITY_UNLISTED = k_ERemoteStoragePublishedFileVisibilityUnlisted + }; + enum UGCReadAction { + UGC_READ_CONTINUE_READING_UNTIL_FINISHED = k_EUGCRead_ContinueReadingUntilFinished, + UGC_READ_CONTINUE_READING = k_EUGCRead_ContinueReading, + UGC_READ_CLOSE = k_EUGCRead_Close + }; + enum WorkshopEnumerationType { + WORKSHOP_ENUMERATION_TYPE_RANKED_BY_VOTE = k_EWorkshopEnumerationTypeRankedByVote, + WORKSHOP_ENUMERATION_TYPE_RECENT = k_EWorkshopEnumerationTypeRecent, + WORKSHOP_ENUMERATION_TYPE_TRENDING = k_EWorkshopEnumerationTypeTrending, + WORKSHOP_ENUMERATION_TYPE_FAVORITES_OF_FRIENDS = k_EWorkshopEnumerationTypeFavoritesOfFriends, + WORKSHOP_ENUMERATION_TYPE_VOTED_BY_FRIENDS = k_EWorkshopEnumerationTypeVotedByFriends, + WORKSHOP_ENUMERATION_TYPE_CONTENT_BY_FRIENDS = k_EWorkshopEnumerationTypeContentByFriends, + WORKSHOP_ENUMERATION_TYPE_RECENT_FROM_FOLLOWED_USERS = k_EWorkshopEnumerationTypeRecentFromFollowedUsers + }; + enum WorkshopFileAction { + WORKSHOP_FILE_ACTION_PLAYED = k_EWorkshopFileActionPlayed, + WORKSHOP_FILE_ACTION_COMPLETED = k_EWorkshopFileActionCompleted + }; + enum WorkshopFileType { + WORKSHOP_FILE_TYPE_FIRST = k_EWorkshopFileTypeFirst, + WORKSHOP_FILE_TYPE_COMMUNITY = k_EWorkshopFileTypeCommunity, + WORKSHOP_FILE_TYPE_MICROTRANSACTION = k_EWorkshopFileTypeMicrotransaction, + WORKSHOP_FILE_TYPE_COLLECTION = k_EWorkshopFileTypeCollection, + WORKSHOP_FILE_TYPE_ART = k_EWorkshopFileTypeArt, + WORKSHOP_FILE_TYPE_VIDEO = k_EWorkshopFileTypeVideo, + WORKSHOP_FILE_TYPE_SCREENSHOT = k_EWorkshopFileTypeScreenshot, + WORKSHOP_FILE_TYPE_GAME = k_EWorkshopFileTypeGame, + WORKSHOP_FILE_TYPE_SOFTWARE = k_EWorkshopFileTypeSoftware, + WORKSHOP_FILE_TYPE_CONCEPT = k_EWorkshopFileTypeConcept, + WORKSHOP_FILE_TYPE_WEB_GUIDE = k_EWorkshopFileTypeWebGuide, + WORKSHOP_FILE_TYPE_INTEGRATED_GUIDE = k_EWorkshopFileTypeIntegratedGuide, + WORKSHOP_FILE_TYPE_MERCH = k_EWorkshopFileTypeMerch, + WORKSHOP_FILE_TYPE_CONTROLLER_BINDING = k_EWorkshopFileTypeControllerBinding, + WORKSHOP_FILE_TYPE_STEAMWORKS_ACCESS_INVITE = k_EWorkshopFileTypeSteamworksAccessInvite, + WORKSHOP_FILE_TYPE_STEAM_VIDEO = k_EWorkshopFileTypeSteamVideo, + WORKSHOP_FILE_TYPE_GAME_MANAGED_ITEM = k_EWorkshopFileTypeGameManagedItem, + WORKSHOP_FILE_TYPE_CLIP = k_EWorkshopFileTypeClip, + WORKSHOP_FILE_TYPE_MAX = k_EWorkshopFileTypeMax + }; + enum WorkshopVideoProvider { + WORKSHOP_VIDEO_PROVIDER_NONE = k_EWorkshopVideoProviderNone, + WORKSHOP_VIDEO_PROVIDER_YOUTUBE = k_EWorkshopVideoProviderYoutube + }; + enum WorkshopVote { + WORKSHOP_VOTE_UNVOTED = k_EWorkshopVoteUnvoted, + WORKSHOP_VOTE_FOR = k_EWorkshopVoteFor, + WORKSHOP_VOTE_AGAINST = k_EWorkshopVoteAgainst, + WORKSHOP_VOTE_LATER = k_EWorkshopVoteLater + }; + + // UGC enums + enum ItemPreviewType { + ITEM_PREVIEW_TYPE_IMAGE = k_EItemPreviewType_Image, + ITEM_PREVIEW_TYPE_YOUTUBE_VIDEO = k_EItemPreviewType_YouTubeVideo, + ITEM_PREVIEW_TYPE_SKETCHFAB = k_EItemPreviewType_Sketchfab, + ITEM_PREVIEW_TYPE_ENVIRONMENTMAP_HORIZONTAL_CROSS = k_EItemPreviewType_EnvironmentMap_HorizontalCross, + ITEM_PREVIEW_TYPE_ENVIRONMENTMAP_LAT_LONG = k_EItemPreviewType_EnvironmentMap_LatLong, + ITEM_PREVIEW_TYPE_CLIP = k_EItemPreviewType_Clip, + ITEM_PREVIEW_TYPE_RESERVED_MAX = k_EItemPreviewType_ReservedMax + }; + enum ItemState { + ITEM_STATE_NONE = k_EItemStateNone, + ITEM_STATE_SUBSCRIBED = k_EItemStateSubscribed, + ITEM_STATE_LEGACY_ITEM = k_EItemStateLegacyItem, + ITEM_STATE_INSTALLED = k_EItemStateInstalled, + ITEM_STATE_NEEDS_UPDATE = k_EItemStateNeedsUpdate, + ITEM_STATE_DOWNLOADING = k_EItemStateDownloading, + ITEM_STATE_DOWNLOAD_PENDING = k_EItemStateDownloadPending, + ITEM_STATE_DISABLED_LOCALLY = k_EItemStateDisabledLocally + }; + enum ItemStatistic { + ITEM_STATISTIC_NUM_SUBSCRIPTIONS = k_EItemStatistic_NumSubscriptions, + ITEM_STATISTIC_NUM_FAVORITES = k_EItemStatistic_NumFavorites, + ITEM_STATISTIC_NUM_FOLLOWERS = k_EItemStatistic_NumFollowers, + ITEM_STATISTIC_NUM_UNIQUE_SUBSCRIPTIONS = k_EItemStatistic_NumUniqueSubscriptions, + ITEM_STATISTIC_NUM_UNIQUE_FAVORITES = k_EItemStatistic_NumUniqueFavorites, + ITEM_STATISTIC_NUM_UNIQUE_FOLLOWERS = k_EItemStatistic_NumUniqueFollowers, + ITEM_STATISTIC_NUM_UNIQUE_WEBSITE_VIEWS = k_EItemStatistic_NumUniqueWebsiteViews, + ITEM_STATISTIC_REPORT_SCORE = k_EItemStatistic_ReportScore, + ITEM_STATISTIC_NUM_SECONDS_PLAYED = k_EItemStatistic_NumSecondsPlayed, + ITEM_STATISTIC_NUM_PLAYTIME_SESSIONS = k_EItemStatistic_NumPlaytimeSessions, + ITEM_STATISTIC_NUM_COMMENTS = k_EItemStatistic_NumComments, + ITEM_STATISTIC_NUM_SECONDS_PLAYED_DURING_TIME_PERIOD = k_EItemStatistic_NumSecondsPlayedDuringTimePeriod, + ITEM_STATISTIC_NUM_PLAYTIME_SESSIONS_DURING_TIME_PERIOD = k_EItemStatistic_NumPlaytimeSessionsDuringTimePeriod + }; + enum ItemUpdateStatus { + ITEM_UPDATE_STATUS_INVALID = k_EItemUpdateStatusInvalid, + ITEM_UPDATE_STATUS_PREPARING_CONFIG = k_EItemUpdateStatusPreparingConfig, + ITEM_UPDATE_STATUS_PREPARING_CONTENT = k_EItemUpdateStatusPreparingContent, + ITEM_UPDATE_STATUS_UPLOADING_CONTENT = k_EItemUpdateStatusUploadingContent, + ITEM_UPDATE_STATUS_UPLOADING_PREVIEW_FILE = k_EItemUpdateStatusUploadingPreviewFile, + ITEM_UPDATE_STATUS_COMMITTING_CHANGES = k_EItemUpdateStatusCommittingChanges + }; + enum UGCContentDescriptorID { + UGC_CONTENT_DESCRIPTOR_NUDITY_OR_SEXUAL_CONTENT = k_EUGCContentDescriptor_NudityOrSexualContent, + UGC_CONTENT_DESCRIPTOR_FREQUENT_VIOLENCE_OR_GORE = k_EUGCContentDescriptor_FrequentViolenceOrGore, + UGC_CONTENT_DESCRIPTOR_ADULT_ONLY_SEXUAL_CONTENT = k_EUGCContentDescriptor_AdultOnlySexualContent, + UGC_CONTENT_DESCRIPTOR_GRATUITOUS_SEXUAL_CONTENT = k_EUGCContentDescriptor_GratuitousSexualContent, + UGC_CONTENT_DESCRIPTOR_ANY_MATURE_CONTENT = k_EUGCContentDescriptor_AnyMatureContent + }; + enum UGCMatchingUGCType { + UGC_MATCHING_UGC_TYPE_ITEMS = k_EUGCMatchingUGCType_Items, + UGC_MATCHING_UGC_TYPE_ITEMS_MTX = k_EUGCMatchingUGCType_Items_Mtx, + UGC_MATCHING_UGC_TYPE_ITEMS_READY_TO_USE = k_EUGCMatchingUGCType_Items_ReadyToUse, + UGC_MATCHING_UGC_TYPE_COLLECTIONS = k_EUGCMatchingUGCType_Collections, + UGC_MATCHING_UGC_TYPE_ARTWORK = k_EUGCMatchingUGCType_Artwork, + UGC_MATCHING_UGC_TYPE_VIDEOS = k_EUGCMatchingUGCType_Videos, + UGC_MATCHING_UGC_TYPE_SCREENSHOTS = k_EUGCMatchingUGCType_Screenshots, + UGC_MATCHING_UGC_TYPE_ALL_GUIDES = k_EUGCMatchingUGCType_AllGuides, + UGC_MATCHING_UGC_TYPE_WEB_GUIDES = k_EUGCMatchingUGCType_WebGuides, + UGC_MATCHING_UGC_TYPE_INTEGRATED_GUIDES = k_EUGCMatchingUGCType_IntegratedGuides, + UGC_MATCHING_UGC_TYPE_USABLE_IN_GAME = k_EUGCMatchingUGCType_UsableInGame, + UGC_MATCHING_UGC_TYPE_CONTROLLER_BINDINGS = k_EUGCMatchingUGCType_ControllerBindings, + UGC_MATCHING_UGC_TYPE_GAME_MANAGED_ITEMS = k_EUGCMatchingUGCType_GameManagedItems, + UGC_MATCHING_UGC_TYPE_ALL = k_EUGCMatchingUGCType_All + }; + enum UGCQuery { + UGC_QUERY_RANKED_BY_VOTE = k_EUGCQuery_RankedByVote, + UGC_QUERY_RANKED_BY_PUBLICATION_DATE = k_EUGCQuery_RankedByPublicationDate, + UGC_QUERY_ACCEPTED_FOR_GAME_RANKED_BY_ACCEPTANCE_DATE = k_EUGCQuery_AcceptedForGameRankedByAcceptanceDate, + UGC_QUERY_RANKED_BY_TREND = k_EUGCQuery_RankedByTrend, + UGC_QUERY_FAVORITED_BY_FRIENDS_RANKED_BY_PUBLICATION_DATE = k_EUGCQuery_FavoritedByFriendsRankedByPublicationDate, + UGC_QUERY_CREATED_BY_FRIENDS_RANKED_BY_PUBLICATION_DATE = k_EUGCQuery_CreatedByFriendsRankedByPublicationDate, + UGC_QUERY_RANKED_BY_NUM_TIMES_REPORTED = k_EUGCQuery_RankedByNumTimesReported, + UGC_QUERY_CREATED_BY_FOLLOWED_USERS_RANKED_BY_PUBLICATION_DATE = k_EUGCQuery_CreatedByFollowedUsersRankedByPublicationDate, + UGC_QUERY_NOT_YET_RATED = k_EUGCQuery_NotYetRated, + UGC_QUERY_RANKED_BY_TOTAL_VOTES_ASC = k_EUGCQuery_RankedByTotalVotesAsc, + UGC_QUERY_RANKED_BY_VOTES_UP = k_EUGCQuery_RankedByVotesUp, + UGC_QUERY_RANKED_BY_TEXT_SEARCH = k_EUGCQuery_RankedByTextSearch, + UGC_QUERY_RANKED_BY_TOTAL_UNIQUE_SUBSCRIPTIONS = k_EUGCQuery_RankedByTotalUniqueSubscriptions, + UGC_QUERY_RANKED_BY_PLAYTIME_TREND = k_EUGCQuery_RankedByPlaytimeTrend, + UGC_QUERY_RANKED_BY_TOTAL_PLAYTIME = k_EUGCQuery_RankedByTotalPlaytime, + UGC_QUERY_RANKED_BY_AVERAGE_PLAYTIME_TREND = k_EUGCQuery_RankedByAveragePlaytimeTrend, + UGC_QUERY_RANKED_BY_LIFETIME_AVERAGE_PLAYTIME = k_EUGCQuery_RankedByLifetimeAveragePlaytime, + UGC_QUERY_RANKED_BY_PLAYTIME_SESSIONS_TREND = k_EUGCQuery_RankedByPlaytimeSessionsTrend, + UGC_QUERY_RANKED_BY_LIFETIME_PLAYTIME_SESSIONS = k_EUGCQuery_RankedByLifetimePlaytimeSessions, + UGC_QUERY_RANKED_BY_LAST_UPDATED_DATE = k_EUGCQuery_RankedByLastUpdatedDate + }; + enum UserUGCList { + USER_UGC_LIST_PUBLISHED = k_EUserUGCList_Published, + USER_UGC_LIST_VOTED_ON = k_EUserUGCList_VotedOn, + USER_UGC_LIST_VOTED_UP = k_EUserUGCList_VotedUp, + USER_UGC_LIST_VOTED_DOWN = k_EUserUGCList_VotedDown, + USER_UGC_LIST_WILL_VOTE_LATER = k_EUserUGCList_WillVoteLater, + USER_UGC_LIST_FAVORITED = k_EUserUGCList_Favorited, + USER_UGC_LIST_SUBSCRIBED = k_EUserUGCList_Subscribed, + USER_UGC_LIST_USED_OR_PLAYED = k_EUserUGCList_UsedOrPlayed, + USER_UGC_LIST_FOLLOWED = k_EUserUGCList_Followed + }; + enum UserUGCListSortOrder { + USER_UGC_LIST_SORT_ORDER_CREATION_ORDER_DESC = k_EUserUGCListSortOrder_CreationOrderDesc, + USER_UGC_LIST_SORT_ORDER_CREATION_ORDER_ASC = k_EUserUGCListSortOrder_CreationOrderAsc, + USER_UGC_LIST_SORT_ORDER_TITLE_ASC = k_EUserUGCListSortOrder_TitleAsc, + USER_UGC_LIST_SORT_ORDER_LAST_UPDATED_DESC = k_EUserUGCListSortOrder_LastUpdatedDesc, + USER_UGC_LIST_SORT_ORDER_SUBSCRIPTION_DATE_DESC = k_EUserUGCListSortOrder_SubscriptionDateDesc, + USER_UGC_LIST_SORT_ORDER_VOTE_SCORE_DESC = k_EUserUGCListSortOrder_VoteScoreDesc, + USER_UGC_LIST_SORT_ORDER_FOR_MODERATION = k_EUserUGCListSortOrder_ForModeration + }; + + + // STEAMWORKS FUNCTIONS + ///////////////////////////////////////// + // + // Main ///////////////////////////////// + uint64_t getServerSteamID(); + uint32_t getSteamID32(uint64_t steam_id); + bool isAnonAccount(uint64_t steam_id); + bool isAnonUserAccount(uint64_t steam_id); + bool isChatAccount(uint64_t steam_id); + bool isClanAccount(uint64_t steam_id); + bool isConsoleUserAccount(uint64_t steam_id); + bool isIndividualAccount(uint64_t steam_id); + bool isLobby(uint64_t steam_id); + bool isServerSecure(); + bool serverInit(const String& ip, uint16 game_port, uint16 query_port, ServerMode server_mode, const String& version_number); + Dictionary serverInitEx(const String& ip, uint16 game_port, uint16 query_port, ServerMode server_mode, const String& version_number); + void serverReleaseCurrentThreadMemory(); + void serverShutdown(); + void steamworksError(const String& failed_signal); + + // Game Server ////////////////////////// + void associateWithClan(uint64_t clan_id); + uint32 beginAuthSession(PoolByteArray ticket, int ticket_size, uint64_t steam_id); + void cancelAuthTicket(uint32_t auth_ticket); + void clearAllKeyValues(); + void computeNewPlayerCompatibility(uint64_t steam_id); + void endAuthSession(uint64_t steam_id); + Dictionary getAuthSessionTicket(uint64_t remote_steam_id = 0); + Dictionary getNextOutgoingPacket(); + Dictionary getPublicIP(); + uint64_t getSteamID(); + Dictionary handleIncomingPacket(int packet, const String& ip, uint16 port); + bool loggedOn(); + void logOff(); + void logOn(const String& token); + void logOnAnonymous(); + bool requestUserGroupStatus(uint64_t steam_id, int group_id); + bool secure(); + void setAdvertiseServerActive(bool active); + void setBotPlayerCount(int bots); + void setDedicatedServer(bool dedicated); + void setGameData(const String& data); + void setGameDescription(const String& description); + void setGameTags(const String& tags); + void setKeyValue(const String& key, const String& value); + void setMapName(const String& map); + void setMaxPlayerCount(int players_max); + void setModDir(const String& mod_directory); + void setPasswordProtected(bool password_protected); + void setProduct(const String& product); + void setRegion(const String& region); + void setServerName(const String& name); + void setSpectatorPort(uint16 port); + void setSpectatorServerName(const String& name); + int userHasLicenceForApp(uint64_t steam_id, uint32 app_id); + bool wasRestartRequested(); + + // Game Server Stats //////////////////// + bool clearUserAchievement(uint64_t steam_id, const String& name); + Dictionary getUserAchievement(uint64_t steam_id, const String& name); + uint32_t getUserStatInt(uint64_t steam_id, const String& name); + float getUserStatFloat(uint64_t steam_id, const String& name); + void requestUserStats(uint64_t steam_id); + bool setUserAchievement(uint64_t steam_id, const String& name); + bool setUserStatInt(uint64_t steam_id, const String& name, int32 stat); + bool setUserStatFloat(uint64_t steam_id, const String& name, float stat); + void storeUserStats(uint64_t steam_id); + bool updateUserAvgRateStat(uint64_t steam_id, const String& name, float this_session, double session_length); + + // HTTP ///////////////////////////////// + uint32_t createCookieContainer(bool allow_responses_to_modify); + uint32_t createHTTPRequest(HTTPMethod request_method, const String &absolute_url); + bool deferHTTPRequest(uint32 request_handle); + float getHTTPDownloadProgressPct(uint32 request_handle); + bool getHTTPRequestWasTimedOut(uint32 request_handle); + PoolByteArray getHTTPResponseBodyData(uint32 request_handle, uint32 buffer_size); + uint32 getHTTPResponseBodySize(uint32 request_handle); + uint32 getHTTPResponseHeaderSize(uint32 request_handle, const String &header_name); + uint8 getHTTPResponseHeaderValue(uint32 request_handle, const String &header_name, uint32 buffer_size); + uint8 getHTTPStreamingResponseBodyData(uint32 request_handle, uint32 offset, uint32 buffer_size); + bool prioritizeHTTPRequest(uint32 request_handle); + bool releaseCookieContainer(uint32 cookie_handle); + bool releaseHTTPRequest(uint32 request_handle); + bool sendHTTPRequest(uint32 request_handle); + bool sendHTTPRequestAndStreamResponse(uint32 request_handle); + bool setHTTPCookie(uint32 cookie_handle, const String &host, const String &url, const String &cookie); + bool setHTTPRequestAbsoluteTimeoutMS(uint32 request_handle, uint32 milliseconds); + bool setHTTPRequestContextValue(uint32 request_handle, uint64_t context_value); + bool setHTTPRequestCookieContainer(uint32 request_handle, uint32 cookie_handle); + bool setHTTPRequestGetOrPostParameter(uint32 request_handle, const String &name, const String &value); + bool setHTTPRequestHeaderValue(uint32 request_handle, const String &header_name, const String &header_value); + bool setHTTPRequestNetworkActivityTimeout(uint32 request_handle, uint32 timeout_seconds); + uint8 setHTTPRequestRawPostBody(uint32 request_handle, const String &content_type, uint32 body_length); + bool setHTTPRequestRequiresVerifiedCertificate(uint32 request_handle, bool require_verified_certificate); + bool setHTTPRequestUserAgentInfo(uint32 request_handle, const String &user_agent_info); + + // Inventory //////////////////////////// + int32 addPromoItem(uint32 item); + int32 addPromoItems(PoolIntArray items); + bool checkResultSteamID(uint64_t steam_id_expected, int32 this_inventory_handle = 0); + int32 consumeItem(uint64_t item_consume, uint32 quantity); + int32 deserializeResult(PoolByteArray buffer); + void destroyResult(int32 this_inventory_handle = 0); + int32 exchangeItems(const PoolIntArray output_items, const PoolIntArray output_quantity, const PoolIntArray input_items, const PoolIntArray input_quantity); + int32 generateItems(const PoolIntArray items, const PoolIntArray quantity); + int32 getAllItems(); + String getItemDefinitionProperty(uint32 definition, const String &name); + int32 getItemsByID(const PoolIntArray id_array); + Dictionary getItemPrice(uint32 definition); + Array getItemsWithPrices(); + String getResultItemProperty(uint32 index, const String &name, int32 this_inventory_handle = 0); + Array getResultItems(int32 this_inventory_handle = 0); + Result getResultStatus(int32 this_inventory_handle = 0); + uint32 getResultTimestamp(int32 this_inventory_handle = 0); + int32 grantPromoItems(); + bool loadItemDefinitions(); + void requestEligiblePromoItemDefinitionsIDs(uint64_t steam_id); + void requestPrices(); + String serializeResult(int32 this_inventory_handle = 0); + void startPurchase(const PoolIntArray items, const PoolIntArray quantity); + int32 transferItemQuantity(uint64_t item_id, uint32 quantity, uint64_t item_destination, bool split); + int32 triggerItemDrop(uint32 definition); + void startUpdateProperties(); + int32 submitUpdateProperties(uint64_t this_inventory_update_handle = 0); + bool removeProperty(uint64_t item_id, const String &name, uint64_t this_inventory_update_handle = 0); + bool setPropertyString(uint64_t item_id, const String &name, const String &value, uint64_t this_inventory_update_handle = 0); + bool setPropertyBool(uint64_t item_id, const String &name, bool value, uint64_t this_inventory_update_handle = 0); + bool setPropertyInt(uint64_t item_id, const String &name, uint64_t value, uint64_t this_inventory_update_handle = 0); + bool setPropertyFloat(uint64_t item_id, const String &name, float value, uint64_t this_inventory_update_handle = 0); + + // Networking /////////////////////////// + bool acceptP2PSessionWithUser(uint64_t remote_steam_id); + bool allowP2PPacketRelay(bool allow); + bool closeP2PChannelWithUser(uint64_t remote_steam_id, int channel); + bool closeP2PSessionWithUser(uint64_t remote_steam_id); + Dictionary getP2PSessionState(uint64_t remote_steam_id); + uint32_t getAvailableP2PPacketSize(int channel = 0); + Dictionary readP2PPacket(uint32_t packet, int channel = 0); + bool sendP2PPacket(uint64_t remote_steam_id, const PoolByteArray data, P2PSend send_type, int channel = 0); + + // Networking Messages ////////////////// + bool acceptSessionWithUser(uint64_t remote_steam_id); + bool closeChannelWithUser(uint64_t remote_steam_id, int channel); + bool closeSessionWithUser(uint64_t remote_steam_id); + Dictionary getSessionConnectionInfo(uint64_t remote_steam_id, bool get_connection, bool get_status); + Array receiveMessagesOnChannel(int channel, int max_messages); + int sendMessageToUser(uint64_t remote_steam_id, const PoolByteArray data, int flags, int channel); - public: - ///////////////////////////////////////// - // STEAMWORKS API ENUMS - ///////////////////////////////////////// - // - enum AccountType { - ACCOUNT_TYPE_INVALID = k_EAccountTypeInvalid, - ACCOUNT_TYPE_INDIVIDUAL = k_EAccountTypeIndividual, - ACCOUNT_TYPE_MULTISEAT = k_EAccountTypeMultiseat, - ACCOUNT_TYPE_GAME_SERVER = k_EAccountTypeGameServer, - ACCOUNT_TYPE_ANON_GAME_SERVER = k_EAccountTypeAnonGameServer, - ACCOUNT_TYPE_PENDING = k_EAccountTypePending, - ACCOUNT_TYPE_CONTENT_SERVER = k_EAccountTypeContentServer, - ACCOUNT_TYPE_CLAN = k_EAccountTypeClan, - ACCOUNT_TYPE_CHAT = k_EAccountTypeChat, - ACCOUNT_TYPE_CONSOLE_USER = k_EAccountTypeConsoleUser, - ACCOUNT_TYPE_ANON_USER = k_EAccountTypeAnonUser, - ACCOUNT_TYPE_MAX = k_EAccountTypeMax - }; - enum AuthSessionResponse { - AUTH_SESSION_RESPONSE_OK = k_EAuthSessionResponseOK, - AUTH_SESSION_RESPONSE_USER_NOT_CONNECTED_TO_STEAM = k_EAuthSessionResponseUserNotConnectedToSteam, - AUTH_SESSION_RESPONSE_NO_LICENSE_OR_EXPIRED = k_EAuthSessionResponseNoLicenseOrExpired, - AUTH_SESSION_RESPONSE_VAC_BANNED = k_EAuthSessionResponseVACBanned, - AUTH_SESSION_RESPONSE_LOGGED_IN_ELSEWHERE = k_EAuthSessionResponseLoggedInElseWhere, - AUTH_SESSION_RESPONSE_VAC_CHECK_TIMED_OUT = k_EAuthSessionResponseVACCheckTimedOut, - AUTH_SESSION_RESPONSE_AUTH_TICKET_CANCELED = k_EAuthSessionResponseAuthTicketCanceled, - AUTH_SESSION_RESPONSE_AUTH_TICKET_INVALID_ALREADY_USED = k_EAuthSessionResponseAuthTicketInvalidAlreadyUsed, - AUTH_SESSION_RESPONSE_AUTH_TICKET_INVALID = k_EAuthSessionResponseAuthTicketInvalid, - AUTH_SESSION_RESPONSE_PUBLISHER_ISSUED_BAN = k_EAuthSessionResponsePublisherIssuedBan, - AUTH_SESSION_RESPONSE_AUTH_TICKET_NETWORK_IDENTITY_FAILURE = k_EAuthSessionResponseAuthTicketNetworkIdentityFailure - }; - enum BeginAuthSessionResult { - BEGIN_AUTH_SESSION_RESULT_OK = k_EBeginAuthSessionResultOK, - BEGIN_AUTH_SESSION_RESULT_INVALID_TICKET = k_EBeginAuthSessionResultInvalidTicket, - BEGIN_AUTH_SESSION_RESULT_DUPLICATE_REQUEST = k_EBeginAuthSessionResultDuplicateRequest, - BEGIN_AUTH_SESSION_RESULT_INVALID_VERSION = k_EBeginAuthSessionResultInvalidVersion, - BEGIN_AUTH_SESSION_RESULT_GAME_MISMATCH = k_EBeginAuthSessionResultGameMismatch, - BEGIN_AUTH_SESSION_RESULT_EXPIRED_TICKET = k_EBeginAuthSessionResultExpiredTicket - }; - enum DenyReason { - DENY_INVALID = k_EDenyInvalid, - DENY_INVALID_VERSION = k_EDenyInvalidVersion, - DENY_GENERIC = k_EDenyGeneric, - DENY_NOT_LOGGED_ON = k_EDenyNotLoggedOn, - DENY_NO_LICENSE = k_EDenyNoLicense, - DENY_CHEATER = k_EDenyCheater, - DENY_LOGGED_IN_ELSEWHERE = k_EDenyLoggedInElseWhere, - DENY_UNKNOWN_TEXT = k_EDenyUnknownText, - DENY_INCOMPATIBLE_ANTI_CHEAT = k_EDenyIncompatibleAnticheat, - DENY_MEMORY_CORRUPTION = k_EDenyMemoryCorruption, - DENY_INCOMPATIBLE_SOFTWARE = k_EDenyIncompatibleSoftware, - DENY_STEAM_CONNECTION_LOST = k_EDenySteamConnectionLost, - DENY_STEAM_CONNECTION_ERROR = k_EDenySteamConnectionError, - DENY_STEAM_RESPONSE_TIMED_OUT = k_EDenySteamResponseTimedOut, - DENY_STEAM_VALIDATION_STALLED = k_EDenySteamValidationStalled, - DENY_STEAM_OWNER_LEFT_GUEST_USER = k_EDenySteamOwnerLeftGuestUser - }; - enum GameIDType { - GAME_TYPE_APP = CGameID::k_EGameIDTypeApp, - GAME_TYPE_GAME_MOD = CGameID::k_EGameIDTypeGameMod, - GAME_TYPE_SHORTCUT = CGameID::k_EGameIDTypeShortcut, - GAME_TYPE_P2P = CGameID::k_EGameIDTypeP2P - }; - enum Result { - RESULT_NONE = k_EResultNone, - RESULT_OK = k_EResultOK, - RESULT_FAIL = k_EResultFail, - RESULT_NO_CONNECTION = k_EResultNoConnection, - RESULT_INVALID_PASSWORD = k_EResultInvalidPassword, - RESULT_LOGGED_IN_ELSEWHERE = k_EResultLoggedInElsewhere, - RESULT_INVALID_PROTOCOL_VER = k_EResultInvalidProtocolVer, - RESULT_INVALID_PARAM = k_EResultInvalidParam, - RESULT_FILE_NOT_FOUND = k_EResultFileNotFound, - RESULT_BUSY = k_EResultBusy, - RESULT_INVALID_STATE = k_EResultInvalidState, - RESULT_INVALID_NAME = k_EResultInvalidName, - RESULT_INVALID_EMAIL = k_EResultInvalidEmail, - RESULT_DUPLICATE_NAME = k_EResultDuplicateName, - RESULT_ACCESS_DENIED = k_EResultAccessDenied, - RESULT_TIMEOUT = k_EResultTimeout, - RESULT_BANNED = k_EResultBanned, - RESULT_ACCOUNT_NOT_FOUND = k_EResultAccountNotFound, - RESULT_INVALID_STEAMID = k_EResultInvalidSteamID, - RESULT_SERVICE_UNAVAILABLE = k_EResultServiceUnavailable, - RESULT_NOT_LOGGED_ON = k_EResultNotLoggedOn, - RESULT_PENDING = k_EResultPending, - RESULT_ENCRYPTION_FAILURE = k_EResultEncryptionFailure, - RESULT_INSUFFICIENT_PRIVILEGE = k_EResultInsufficientPrivilege, - RESULT_LIMIT_EXCEEDED = k_EResultLimitExceeded, - RESULT_REVOKED = k_EResultRevoked, - RESULT_EXPIRED = k_EResultExpired, - RESULT_ALREADY_REDEEMED = k_EResultAlreadyRedeemed, - RESULT_DUPLICATE_REQUEST = k_EResultDuplicateRequest, - RESULT_ALREADY_OWNED = k_EResultAlreadyOwned, - RESULT_IP_NOT_FOUND = k_EResultIPNotFound, - RESULT_PERSIST_FAILED = k_EResultPersistFailed, - RESULT_LOCKING_FAILED = k_EResultLockingFailed, - RESULT_LOG_ON_SESSION_REPLACED = k_EResultLogonSessionReplaced, - RESULT_CONNECT_FAILED = k_EResultConnectFailed, - RESULT_HANDSHAKE_FAILED = k_EResultHandshakeFailed, - RESULT_IO_FAILURE = k_EResultIOFailure, - RESULT_REMOTE_DISCONNECT = k_EResultRemoteDisconnect, - RESULT_SHOPPING_CART_NOT_FOUND = k_EResultShoppingCartNotFound, - RESULT_BLOCKED = k_EResultBlocked, - RESULT_IGNORED = k_EResultIgnored, - RESULT_NO_MATCH = k_EResultNoMatch, - RESULT_ACCOUNT_DISABLED = k_EResultAccountDisabled, - RESULT_SERVICE_READ_ONLY = k_EResultServiceReadOnly, - RESULT_ACCOUNT_NOT_FEATURED = k_EResultAccountNotFeatured, - RESULT_ADMINISTRATO_ROK = k_EResultAdministratorOK, - RESULT_CONTENT_VERSION = k_EResultContentVersion, - RESULT_TRY_ANOTHER_CM = k_EResultTryAnotherCM, - RESULT_PASSWORD_REQUIRED_TO_KICK_SESSION = k_EResultPasswordRequiredToKickSession, - RESULT_ALREADY_LOGGED_IN_ELSEWHERE = k_EResultAlreadyLoggedInElsewhere, - RESULT_SUSPENDED = k_EResultSuspended, - RESULT_CANCELLED = k_EResultCancelled, - RESULT_DATA_CORRUPTION = k_EResultDataCorruption, - RESULT_DISK_FULL = k_EResultDiskFull, - RESULT_REMOTE_CALL_FAILED = k_EResultRemoteCallFailed, - RESULT_PASSWORD_UNSET = k_EResultPasswordUnset, - RESULT_EXTERNAL_ACCOUNT_UNLINKED = k_EResultExternalAccountUnlinked, - RESULT_PSN_TICKET_INVALID = k_EResultPSNTicketInvalid, - RESULT_EXTERNAL_ACCOUNT_ALREADY_LINKED = k_EResultExternalAccountAlreadyLinked, - RESULT_REMOTE_FILE_CONFLICT = k_EResultRemoteFileConflict, - RESULT_ILLEGAL_PASSWORD = k_EResultIllegalPassword, - RESULT_SAME_AS_PREVIOUS_VALUE = k_EResultSameAsPreviousValue, - RESULT_ACCOUNT_LOG_ON_DENIED = k_EResultAccountLogonDenied, - RESULT_CANNOT_USE_OLD_PASSWORD = k_EResultCannotUseOldPassword, - RESULT_INVALID_LOG_IN_AUTH_CODE = k_EResultInvalidLoginAuthCode, - RESULT_ACCOUNT_LOG_ON_DENIED_NO_MAIL = k_EResultAccountLogonDeniedNoMail, - RESULT_HARDWARE_NOT_CAPABLE_OF_IPT = k_EResultHardwareNotCapableOfIPT, - RESULT_IPT_INIT_ERROR = k_EResultIPTInitError, - RESULT_PARENTAL_CONTROL_RESTRICTED = k_EResultParentalControlRestricted, - RESULT_FACEBOOK_QUERY_ERROR = k_EResultFacebookQueryError, - RESULT_EXPIRED_LOGIN_AUTH_CODE = k_EResultExpiredLoginAuthCode, - RESULT_IP_LOGIN_RESTRICTION_FAILED = k_EResultIPLoginRestrictionFailed, - RESULT_ACCOUNT_LOCKED_DOWN = k_EResultAccountLockedDown, - RESULT_ACCOUNT_LOG_ON_DENIED_VERIFIED_EMAIL_REQUIRED = k_EResultAccountLogonDeniedVerifiedEmailRequired, - RESULT_NO_MATCHING_URL = k_EResultNoMatchingURL, - RESULT_BAD_RESPONSE = k_EResultBadResponse, - RESULT_REQUIRE_PASSWORD_REENTRY = k_EResultRequirePasswordReEntry, - RESULT_VALUE_OUT_OF_RANGE = k_EResultValueOutOfRange, - RESULT_UNEXPECTED_ERROR = k_EResultUnexpectedError, - RESULT_DISABLED = k_EResultDisabled, - RESULT_INVALID_CEG_SUBMISSION = k_EResultInvalidCEGSubmission, - RESULT_RESTRICTED_DEVICE = k_EResultRestrictedDevice, - RESULT_REGION_LOCKED = k_EResultRegionLocked, - RESULT_RATE_LIMIT_EXCEEDED = k_EResultRateLimitExceeded, - RESULT_ACCOUNT_LOGIN_DENIED_NEED_TWO_FACTOR = k_EResultAccountLoginDeniedNeedTwoFactor, - RESULT_ITEM_DELETED = k_EResultItemDeleted, - RESULT_ACCOUNT_LOGIN_DENIED_THROTTLE = k_EResultAccountLoginDeniedThrottle, - RESULT_TWO_FACTOR_CODE_MISMATCH = k_EResultTwoFactorCodeMismatch, - RESULT_TWO_FACTOR_ACTIVATION_CODE_MISMATCH = k_EResultTwoFactorActivationCodeMismatch, - RESULT_ACCOUNT_ASSOCIATED_TO_MULTIPLE_PARTNERS = k_EResultAccountAssociatedToMultiplePartners, - RESULT_NOT_MODIFIED = k_EResultNotModified, - RESULT_NO_MOBILE_DEVICE = k_EResultNoMobileDevice, - RESULT_TIME_NOT_SYNCED = k_EResultTimeNotSynced, - RESULT_SMS_CODE_FAILED = k_EResultSmsCodeFailed, - RESULT_ACCOUNT_LIMIT_EXCEEDED = k_EResultAccountLimitExceeded, - RESULT_ACCOUNT_ACTIVITY_LIMIT_EXCEEDED = k_EResultAccountActivityLimitExceeded, - RESULT_PHONE_ACTIVITY_LIMIT_EXCEEDED = k_EResultPhoneActivityLimitExceeded, - RESULT_REFUND_TO_WALLET = k_EResultRefundToWallet, - RESULT_EMAIL_SEND_FAILURE = k_EResultEmailSendFailure, - RESULT_NOT_SETTLED = k_EResultNotSettled, - RESULT_NEED_CAPTCHA = k_EResultNeedCaptcha, - RESULT_GSLT_DENIED = k_EResultGSLTDenied, - RESULT_GS_OWNER_DENIED = k_EResultGSOwnerDenied, - RESULT_INVALID_ITEM_TYPE = k_EResultInvalidItemType, - RESULT_IP_BANNED = k_EResultIPBanned, - RESULT_GSLT_EXPIRED = k_EResultGSLTExpired, - RESULT_INSUFFICIENT_FUNDS = k_EResultInsufficientFunds, - RESULT_TOO_MANY_PENDING = k_EResultTooManyPending, - RESULT_NO_SITE_LICENSES_FOUND = k_EResultNoSiteLicensesFound, - RESULT_WG_NETWORK_SEND_EXCEEDED = k_EResultWGNetworkSendExceeded, - RESULT_ACCOUNT_NOT_FRIENDS = k_EResultAccountNotFriends, - RESULT_LIMITED_USER_ACCOUNT = k_EResultLimitedUserAccount, - RESULT_CANT_REMOVE_ITEM = k_EResultCantRemoveItem, - RESULT_ACCOUNT_DELETED = k_EResultAccountDeleted, - RESULT_EXISTING_USER_CANCELLED_LICENSE = k_EResultExistingUserCancelledLicense, - RESULT_COMMUNITY_COOLDOWN = k_EResultCommunityCooldown, - RESULT_NO_LAUNCHER_SPECIFIED = k_EResultNoLauncherSpecified, - RESULT_MUST_AGREE_TO_SSA = k_EResultMustAgreeToSSA, - RESULT_LAUNCHER_MIGRATED = k_EResultLauncherMigrated, - RESULT_STEAM_REALM_MISMATCH = k_EResultSteamRealmMismatch, - RESULT_INVALID_SIGNATURE = k_EResultInvalidSignature, - RESULT_PARSE_FAILURE = k_EResultParseFailure, - RESULT_NO_VERIFIED_PHONE = k_EResultNoVerifiedPhone, - RESULT_INSUFFICIENT_BATTERY = k_EResultInsufficientBattery, - RESULT_CHARGER_REQUIRED = k_EResultChargerRequired, - RESULT_CACHED_CREDENTIAL_INVALID = k_EResultCachedCredentialInvalid, - RESULT_PHONE_NUMBER_IS_VOIP = K_EResultPhoneNumberIsVOIP, - RESULT_NOT_SUPPORTED = k_EResultNotSupported, - RESULT_FAMILY_SIZE_LIMIT_EXCEEDED = k_EResultFamilySizeLimitExceeded - }; - enum ServerMode { - SERVER_MODE_INVALID = eServerModeInvalid, - SERVER_MODE_NO_AUTHENTICATION = eServerModeNoAuthentication, - SERVER_MODE_AUTHENTICATION = eServerModeAuthentication, - SERVER_MODE_AUTHENTICATION_AND_SECURE = eServerModeAuthenticationAndSecure - }; - enum SteamAPIInitResult { - STEAM_API_INIT_RESULT_OK = k_ESteamAPIInitResult_OK, - STEAM_API_INIT_RESULT_FAILED_GENERIC = k_ESteamAPIInitResult_FailedGeneric, - STEAM_API_INIT_RESULT_NO_STEAM_CLIENT = k_ESteamAPIInitResult_NoSteamClient, - STEAM_API_INIT_RESULT_VERSION_MISMATCH = k_ESteamAPIInitResult_VersionMismatch - }; - enum Universe { - UNIVERSE_INVALID = k_EUniverseInvalid, - UNIVERSE_PUBLIC = k_EUniversePublic, - UNIVERSE_BETA = k_EUniverseBeta, - UNIVERSE_INTERNAL = k_EUniverseInternal, - UNIVERSE_DEV = k_EUniverseDev, - UNIVERSE_MAX = k_EUniverseMax - }; - - // Friends enums - enum AvatarSizes { - AVATAR_SMALL = 1, - AVATAR_MEDIUM = 2, - AVATAR_LARGE = 3 - }; - enum CommunityProfileItemProperty { - PROFILE_ITEM_PROPERTY_IMAGE_SMALL = k_ECommunityProfileItemProperty_ImageSmall, - PROFILE_ITEM_PROPERTY_IMAGE_LARGE = k_ECommunityProfileItemProperty_ImageLarge, - PROFILE_ITEM_PROPERTY_INTERNAL_NAME = k_ECommunityProfileItemProperty_InternalName, - PROFILE_ITEM_PROPERTY_TITLE = k_ECommunityProfileItemProperty_Title, - PROFILE_ITEM_PROPERTY_DESCRIPTION = k_ECommunityProfileItemProperty_Description, - PROFILE_ITEM_PROPERTY_APP_ID = k_ECommunityProfileItemProperty_AppID, - PROFILE_ITEM_PROPERTY_TYPE_ID = k_ECommunityProfileItemProperty_TypeID, - PROFILE_ITEM_PROPERTY_CLASS = k_ECommunityProfileItemProperty_Class, - PROFILE_ITEM_PROPERTY_MOVIE_WEBM = k_ECommunityProfileItemProperty_MovieWebM, - PROFILE_ITEM_PROPERTY_MOVIE_MP4 = k_ECommunityProfileItemProperty_MovieMP4, - PROFILE_ITEM_PROPERTY_MOVIE_WEBM_SMALL = k_ECommunityProfileItemProperty_MovieWebMSmall, - PROFILE_ITEM_PROPERTY_MOVIE_MP4_SMALL = k_ECommunityProfileItemProperty_MovieMP4Small - }; - enum CommunityProfileItemType { - PROFILE_ITEM_TYPE_ANIMATED_AVATAR = k_ECommunityProfileItemType_AnimatedAvatar, - PROFILE_ITEM_TYPE_AVATAR_FRAME = k_ECommunityProfileItemType_AvatarFrame, - PROFILE_ITEM_TYPE_PROFILE_MODIFIER = k_ECommunityProfileItemType_ProfileModifier, - PROFILE_ITEM_TYPE_PROFILE_BACKGROUND = k_ECommunityProfileItemType_ProfileBackground, - PROFILE_ITEM_TYPE_MINI_PROFILE_BACKGROUND = k_ECommunityProfileItemType_MiniProfileBackground - }; - enum FriendFlags { - FRIEND_FLAG_NONE = k_EFriendFlagNone, - FRIEND_FLAG_BLOCKED = k_EFriendFlagBlocked, - FRIEND_FLAG_FRIENDSHIP_REQUESTED = k_EFriendFlagFriendshipRequested, - FRIEND_FLAG_IMMEDIATE = k_EFriendFlagImmediate, - FRIEND_FLAG_CLAN_MEMBER = k_EFriendFlagClanMember, - FRIEND_FLAG_ON_GAME_SERVER = k_EFriendFlagOnGameServer, -// FRIEND_FLAG_HAS_PLAYED_WITH = k_EFriendFlagHasPlayedWith, -// FRIEND_FLAG_FRIEND_OF_FRIEND = k_EFriendFlagFriendOfFriend, - FRIEND_FLAG_REQUESTING_FRIENDSHIP = k_EFriendFlagRequestingFriendship, - FRIEND_FLAG_REQUESTING_INFO = k_EFriendFlagRequestingInfo, - FRIEND_FLAG_IGNORED = k_EFriendFlagIgnored, - FRIEND_FLAG_IGNORED_FRIEND = k_EFriendFlagIgnoredFriend, -// FRIEND_FLAG_SUGGESTED = k_EFriendFlagSuggested, - FRIEND_FLAG_CHAT_MEMBER = k_EFriendFlagChatMember, - FRIEND_FLAG_ALL = k_EFriendFlagAll - }; - enum FriendRelationship { - FRIEND_RELATION_NONE = k_EFriendRelationshipNone, - FRIEND_RELATION_BLOCKED = k_EFriendRelationshipBlocked, - FRIEND_RELATION_REQUEST_RECIPIENT = k_EFriendRelationshipRequestRecipient, - FRIEND_RELATION_FRIEND = k_EFriendRelationshipFriend, - FRIEND_RELATION_REQUEST_INITIATOR = k_EFriendRelationshipRequestInitiator, - FRIEND_RELATION_IGNORED = k_EFriendRelationshipIgnored, - FRIEND_RELATION_IGNORED_FRIEND = k_EFriendRelationshipIgnoredFriend, - FRIEND_RELATION_SUGGESTED = k_EFriendRelationshipSuggested_DEPRECATED, - FRIEND_RELATION_MAX = k_EFriendRelationshipMax - }; - enum OverlayToStoreFlag { - OVERLAY_TO_STORE_FLAG_NONE = k_EOverlayToStoreFlag_None, - OVERLAY_TO_STORE_FLAG_ADD_TO_CART = k_EOverlayToStoreFlag_AddToCart, - OVERLAY_TO_STORE_FLAG_AND_TO_CART_AND_SHOW = k_EOverlayToStoreFlag_AddToCartAndShow - }; - enum OverlayToWebPageMode { - OVERLAY_TO_WEB_PAGE_MODE_DEFAULT = k_EActivateGameOverlayToWebPageMode_Default, - OVERLAY_TO_WEB_PAGE_MODE_MODAL = k_EActivateGameOverlayToWebPageMode_Modal - }; - enum PersonaChange { - PERSONA_CHANGE_NAME = k_EPersonaChangeName, - PERSONA_CHANGE_STATUS = k_EPersonaChangeStatus, - PERSONA_CHANGE_COME_ONLINE = k_EPersonaChangeComeOnline, - PERSONA_CHANGE_GONE_OFFLINE = k_EPersonaChangeGoneOffline, - PERSONA_CHANGE_GAME_PLAYED = k_EPersonaChangeGamePlayed, - PERSONA_CHANGE_GAME_SERVER = k_EPersonaChangeGameServer, - PERSONA_CHANGE_AVATAR = k_EPersonaChangeAvatar, - PERSONA_CHANGE_JOINED_SOURCE = k_EPersonaChangeJoinedSource, - PERSONA_CHANGE_LEFT_SOURCE = k_EPersonaChangeLeftSource, - PERSONA_CHANGE_RELATIONSHIP_CHANGED = k_EPersonaChangeRelationshipChanged, - PERSONA_CHANGE_NAME_FIRST_SET = k_EPersonaChangeNameFirstSet, - PERSONA_CHANGE_FACEBOOK_INFO = k_EPersonaChangeBroadcast, - PERSONA_CHANGE_NICKNAME = k_EPersonaChangeNickname, - PERSONA_CHANGE_STEAM_LEVEL = k_EPersonaChangeSteamLevel, - PERSONA_CHANGE_RICH_PRESENCE = k_EPersonaChangeRichPresence - }; - enum PersonaState { - PERSONA_STATE_OFFLINE = k_EPersonaStateOffline, - PERSONA_STATE_ONLINE = k_EPersonaStateOnline, - PERSONA_STATE_BUSY = k_EPersonaStateBusy, - PERSONA_STATE_AWAY = k_EPersonaStateAway, - PERSONA_STATE_SNOOZE = k_EPersonaStateSnooze, - PERSONA_STATE_LOOKING_TO_TRADE = k_EPersonaStateLookingToTrade, - PERSONA_STATE_LOOKING_TO_PLAY = k_EPersonaStateLookingToPlay, - PERSONA_STATE_INVISIBLE = k_EPersonaStateInvisible, - PERSONA_STATE_MAX = k_EPersonaStateMax - }; - enum UserRestriction { - USER_RESTRICTION_NONE = k_nUserRestrictionNone, - USER_RESTRICTION_UNKNOWN = k_nUserRestrictionUnknown, - USER_RESTRICTION_ANY_CHAT = k_nUserRestrictionAnyChat, - USER_RESTRICTION_VOICE_CHAT = k_nUserRestrictionVoiceChat, - USER_RESTRICTION_GROUP_CHAT = k_nUserRestrictionGroupChat, - USER_RESTRICTION_RATING = k_nUserRestrictionRating, - USER_RESTRICTION_GAME_INVITES = k_nUserRestrictionGameInvites, - USER_RESTRICTION_TRADING = k_nUserRestrictionTrading - }; - - // HTTP enums - enum HTTPMethod { - HTTP_METHOD_INVALID = k_EHTTPMethodInvalid, - HTTP_METHOD_GET = k_EHTTPMethodGET, - HTTP_METHOD_HEAD = k_EHTTPMethodHEAD, - HTTP_METHOD_POST = k_EHTTPMethodPOST, - HTTP_METHOD_PUT = k_EHTTPMethodPUT, - HTTP_METHOD_DELETE = k_EHTTPMethodDELETE, - HTTP_METHOD_OPTIONS = k_EHTTPMethodOPTIONS, - HTTP_METHOD_PATCH = k_EHTTPMethodPATCH - }; - enum HTTPStatusCode { - HTTP_STATUS_CODE_INVALID = k_EHTTPStatusCodeInvalid, - HTTP_STATUS_CODE_100_CONTINUE = k_EHTTPStatusCode100Continue, - HTTP_STATUS_CODE_101_SWITCHING_PROTOCOLS = k_EHTTPStatusCode101SwitchingProtocols, - HTTP_STATUS_CODE_200_OK = k_EHTTPStatusCode200OK, - HTTP_STATUS_CODE_201_CREATED = k_EHTTPStatusCode201Created, - HTTP_STATUS_CODE_202_ACCEPTED = k_EHTTPStatusCode202Accepted, - HTTP_STATUS_CODE_203_NON_AUTHORITATIVE = k_EHTTPStatusCode203NonAuthoritative, - HTTP_STATUS_CODE_204_NO_CONTENT = k_EHTTPStatusCode204NoContent, - HTTP_STATUS_CODE_205_RESET_CONTENT = k_EHTTPStatusCode205ResetContent, - HTTP_STATUS_CODE_206_PARTIAL_CONTENT = k_EHTTPStatusCode206PartialContent, - HTTP_STATUS_CODE_300_MULTIPLE_CHOICES = k_EHTTPStatusCode300MultipleChoices, - HTTP_STATUS_CODE_301_MOVED_PERMANENTLY = k_EHTTPStatusCode301MovedPermanently, - HTTP_STATUS_CODE_302_FOUND = k_EHTTPStatusCode302Found, - HTTP_STATUS_CODE_303_SEE_OTHER = k_EHTTPStatusCode303SeeOther, - HTTP_STATUS_CODE_304_NOT_MODIFIED = k_EHTTPStatusCode304NotModified, - HTTP_STATUS_CODE_305_USE_PROXY = k_EHTTPStatusCode305UseProxy, - HTTP_STATUS_CODE_307_TEMPORARY_REDIRECT = k_EHTTPStatusCode307TemporaryRedirect, - HTTP_STATUS_CODE_308_PERMANENT_REDIRECT = k_EHTTPStatusCode308PermanentRedirect, - HTTP_STATUS_CODE_400_BAD_REQUEST = k_EHTTPStatusCode400BadRequest, - HTTP_STATUS_CODE_401_UNAUTHORIZED = k_EHTTPStatusCode401Unauthorized, - HTTP_STATUS_CODE_402_PAYMENT_REQUIRED = k_EHTTPStatusCode402PaymentRequired, - HTTP_STATUS_CODE_403_FORBIDDEN = k_EHTTPStatusCode403Forbidden, - HTTP_STATUS_CODE_404_NOT_FOUND = k_EHTTPStatusCode404NotFound, - HTTP_STATUS_CODE_405_METHOD_NOT_ALLOWED = k_EHTTPStatusCode405MethodNotAllowed, - HTTP_STATUS_CODE_406_NOT_ACCEPTABLE = k_EHTTPStatusCode406NotAcceptable, - HTTP_STATUS_CODE_407_PROXY_AUTH_REQUIRED = k_EHTTPStatusCode407ProxyAuthRequired, - HTTP_STATUS_CODE_408_REQUEST_TIMEOUT = k_EHTTPStatusCode408RequestTimeout, - HTTP_STATUS_CODE_409_CONFLICT = k_EHTTPStatusCode409Conflict, - HTTP_STATUS_CODE_410_GONE = k_EHTTPStatusCode410Gone, - HTTP_STATUS_CODE_411_LENGTH_REQUIRED = k_EHTTPStatusCode411LengthRequired, - HTTP_STATUS_CODE_412_PRECONDITION_FAILED = k_EHTTPStatusCode412PreconditionFailed, - HTTP_STATUS_CODE_413_REQUEST_ENTITY_TOO_LARGE = k_EHTTPStatusCode413RequestEntityTooLarge, - HTTP_STATUS_CODE_414_REQUEST_URI_TOO_LONG = k_EHTTPStatusCode414RequestURITooLong, - HTTP_STATUS_CODE_415_UNSUPPORTED_MEDIA_TYPE = k_EHTTPStatusCode415UnsupportedMediaType, - HTTP_STATUS_CODE_416_REQUESTED_RANGE_NOT_SATISFIABLE = k_EHTTPStatusCode416RequestedRangeNotSatisfiable, - HTTP_STATUS_CODE_417_EXPECTATION_FAILED = k_EHTTPStatusCode417ExpectationFailed, - HTTP_STATUS_CODE_4XX_UNKNOWN = k_EHTTPStatusCode4xxUnknown, - HTTP_STATUS_CODE_429_TOO_MANY_REQUESTS = k_EHTTPStatusCode429TooManyRequests, - HTTP_STATUS_CODE_444_CONNECTION_CLOSED = k_EHTTPStatusCode444ConnectionClosed, - HTTP_STATUS_CODE_500_INTERNAL_SERVER_ERROR = k_EHTTPStatusCode500InternalServerError, - HTTP_STATUS_CODE_501_NOT_IMPLEMENTED = k_EHTTPStatusCode501NotImplemented, - HTTP_STATUS_CODE_502_BAD_GATEWAY = k_EHTTPStatusCode502BadGateway, - HTTP_STATUS_CODE_503_SERVICE_UNAVAILABLE = k_EHTTPStatusCode503ServiceUnavailable, - HTTP_STATUS_CODE_504_GATEWAY_TIMEOUT = k_EHTTPStatusCode504GatewayTimeout, - HTTP_STATUS_CODE_505_HTTP_VERSION_NOT_SUPPORTED = k_EHTTPStatusCode505HTTPVersionNotSupported, - HTTP_STATUS_CODE_5XX_UNKNOWN = k_EHTTPStatusCode5xxUnknown - }; - - // Inventory enums - enum ItemFlags { - STEAM_ITEM_NO_TRADE = k_ESteamItemNoTrade, - STEAM_ITEM_REMOVED = k_ESteamItemRemoved, - STEAM_ITEM_CONSUMED = k_ESteamItemConsumed - }; - - // Networking enums - enum P2PSend { - P2P_SEND_UNRELIABLE = k_EP2PSendUnreliable, - P2P_SEND_UNRELIABLE_NO_DELAY = k_EP2PSendUnreliableNoDelay, - P2P_SEND_RELIABLE = k_EP2PSendReliable, - P2P_SEND_RELIABLE_WITH_BUFFERING = k_EP2PSendReliableWithBuffering - }; - enum P2PSessionError { - P2P_SESSION_ERROR_NONE = k_EP2PSessionErrorNone, - P2P_SESSION_ERROR_NOT_RUNNING_APP = k_EP2PSessionErrorNotRunningApp_DELETED, - P2P_SESSION_ERROR_NO_RIGHTS_TO_APP = k_EP2PSessionErrorNoRightsToApp, - P2P_SESSION_ERROR_DESTINATION_NOT_LOGGED_ON = k_EP2PSessionErrorDestinationNotLoggedIn_DELETED, - P2P_SESSION_ERROR_TIMEOUT = k_EP2PSessionErrorTimeout, - P2P_SESSION_ERROR_MAX = k_EP2PSessionErrorMax - }; - enum SocketConnectionType { - NET_SOCKET_CONNECTION_TYPE_NOT_CONNECTED = k_ESNetSocketConnectionTypeNotConnected, - NET_SOCKET_CONNECTION_TYPE_UDP = k_ESNetSocketConnectionTypeUDP, - NET_SOCKET_CONNECTION_TYPE_UDP_RELAY = k_ESNetSocketConnectionTypeUDPRelay - }; - enum SocketState { - NET_SOCKET_STATE_INVALID = k_ESNetSocketStateInvalid, - NET_SOCKET_STATE_CONNECTED = k_ESNetSocketStateConnected, - NET_SOCKET_STATE_INITIATED = k_ESNetSocketStateInitiated, - NET_SOCKET_STATE_LOCAL_CANDIDATE_FOUND = k_ESNetSocketStateLocalCandidatesFound, - NET_SOCKET_STATE_RECEIVED_REMOTE_CANDIDATES = k_ESNetSocketStateReceivedRemoteCandidates, - NET_SOCKET_STATE_CHALLENGE_HANDSHAKE = k_ESNetSocketStateChallengeHandshake, - NET_SOCKET_STATE_DISCONNECTING = k_ESNetSocketStateDisconnecting, - NET_SOCKET_STATE_LOCAL_DISCONNECT = k_ESNetSocketStateLocalDisconnect, - NET_SOCKET_STATE_TIMEOUT_DURING_CONNECT = k_ESNetSocketStateTimeoutDuringConnect, - NET_SOCKET_STATE_REMOTE_END_DISCONNECTED = k_ESNetSocketStateRemoteEndDisconnected, - NET_SOCKET_STATE_BROKEN = k_ESNetSocketStateConnectionBroken - }; - - // Networking Sockets enums - enum NetworkingConfigValue { - NETWORKING_CONFIG_INVALID = k_ESteamNetworkingConfig_Invalid, - NETWORKING_CONFIG_FAKE_PACKET_LOSS_SEND = k_ESteamNetworkingConfig_FakePacketLoss_Send, - NETWORKING_CONFIG_FAKE_PACKET_LOSS_RECV = k_ESteamNetworkingConfig_FakePacketLoss_Recv, - NETWORKING_CONFIG_FAKE_PACKET_LAG_SEND = k_ESteamNetworkingConfig_FakePacketLag_Send, - NETWORKING_CONFIG_FAKE_PACKET_LAG_RECV = k_ESteamNetworkingConfig_FakePacketLag_Recv, - NETWORKING_CONFIG_FAKE_PACKET_REORDER_SEND = k_ESteamNetworkingConfig_FakePacketReorder_Send, - NETWORKING_CONFIG_FAKE_PACKET_REORDER_RECV = k_ESteamNetworkingConfig_FakePacketReorder_Recv, - NETWORKING_CONFIG_FAKE_PACKET_REORDER_TIME = k_ESteamNetworkingConfig_FakePacketReorder_Time, - NETWORKING_CONFIG_FAKE_PACKET_DUP_SEND = k_ESteamNetworkingConfig_FakePacketDup_Send, - NETWORKING_CONFIG_FAKE_PACKET_DUP_REVC = k_ESteamNetworkingConfig_FakePacketDup_Recv, - NETWORKING_CONFIG_FAKE_PACKET_DUP_TIME_MAX = k_ESteamNetworkingConfig_FakePacketDup_TimeMax, - NETWORKING_CONFIG_PACKET_TRACE_MAX_BYTES = k_ESteamNetworkingConfig_PacketTraceMaxBytes, - NETWORKING_CONFIG_FAKE_RATE_LIMIT_SEND_RATE = k_ESteamNetworkingConfig_FakeRateLimit_Send_Rate, - NETWORKING_CONFIG_FAKE_RATE_LIMIT_SEND_BURST = k_ESteamNetworkingConfig_FakeRateLimit_Send_Burst, - NETWORKING_CONFIG_FAKE_RATE_LIMIT_RECV_RATE = k_ESteamNetworkingConfig_FakeRateLimit_Recv_Rate, - NETWORKING_CONFIG_FAKE_RATE_LIMIT_RECV_BURST = k_ESteamNetworkingConfig_FakeRateLimit_Recv_Burst, - NETWORKING_CONFIG_OUT_OF_ORDER_CORRECTION_WINDOW_MICROSECONDS = k_ESteamNetworkingConfig_OutOfOrderCorrectionWindowMicroseconds, - NETWORKING_CONFIG_CONNECTION_USER_DATA = k_ESteamNetworkingConfig_ConnectionUserData, - NETWORKING_CONFIG_TIMEOUT_INITIAL = k_ESteamNetworkingConfig_TimeoutInitial, - NETWORKING_CONFIG_TIMEOUT_CONNECTED = k_ESteamNetworkingConfig_TimeoutConnected, - NETWORKING_CONFIG_SEND_BUFFER_SIZE = k_ESteamNetworkingConfig_SendBufferSize, - NETWORKING_CONFIG_RECV_BUFFER_SIZE = k_ESteamNetworkingConfig_RecvBufferSize, - NETWORKING_CONFIG_RECV_BUFFER_MESSAGES = k_ESteamNetworkingConfig_RecvBufferMessages, - NETWORKING_CONFIG_RECV_MAX_MESSAGE_SIZE = k_ESteamNetworkingConfig_RecvMaxMessageSize, - NETWORKING_CONFIG_RECV_MAX_SEGMENTS_PER_PACKET = k_ESteamNetworkingConfig_RecvMaxSegmentsPerPacket, - NETWORKING_CONFIG_SEND_RATE_MIN = k_ESteamNetworkingConfig_SendRateMin, - NETWORKING_CONFIG_SEND_RATE_MAX = k_ESteamNetworkingConfig_SendRateMax, - NETWORKING_CONFIG_NAGLE_TIME = k_ESteamNetworkingConfig_NagleTime, - NETWORKING_CONFIG_IP_ALLOW_WITHOUT_AUTH = k_ESteamNetworkingConfig_IP_AllowWithoutAuth, - NETWORKING_CONFIG_MTU_PACKET_SIZE = k_ESteamNetworkingConfig_MTU_PacketSize, - NETWORKING_CONFIG_MTU_DATA_SIZE = k_ESteamNetworkingConfig_MTU_DataSize, - NETWORKING_CONFIG_UNENCRYPTED = k_ESteamNetworkingConfig_Unencrypted, - NETWORKING_CONFIG_SYMMETRIC_CONNECT = k_ESteamNetworkingConfig_SymmetricConnect, - NETWORKING_CONFIG_LOCAL_VIRTUAL_PORT = k_ESteamNetworkingConfig_LocalVirtualPort, - NETWORKING_CONFIG_DUAL_WIFI_ENABLE = k_ESteamNetworkingConfig_DualWifi_Enable, - NETWORKING_CONFIG_ENABLE_DIAGNOSTICS_UI = k_ESteamNetworkingConfig_EnableDiagnosticsUI, - NETWORKING_CONFIG_SDR_CLIENT_CONSEC_PING_TIMEOUT_FAIL_INITIAL = k_ESteamNetworkingConfig_SDRClient_ConsecutitivePingTimeoutsFailInitial, - NETWORKING_CONFIG_SDR_CLIENT_CONSEC_PING_TIMEOUT_FAIL = k_ESteamNetworkingConfig_SDRClient_ConsecutitivePingTimeoutsFail, - NETWORKING_CONFIG_SDR_CLIENT_MIN_PINGS_BEFORE_PING_ACCURATE = k_ESteamNetworkingConfig_SDRClient_MinPingsBeforePingAccurate, - NETWORKING_CONFIG_SDR_CLIENT_SINGLE_SOCKET = k_ESteamNetworkingConfig_SDRClient_SingleSocket, - NETWORKING_CONFIG_SDR_CLIENT_FORCE_RELAY_CLUSTER = k_ESteamNetworkingConfig_SDRClient_ForceRelayCluster, - NETWORKING_CONFIG_SDR_CLIENT_DEV_TICKET = k_ESteamNetworkingConfig_SDRClient_DevTicket, - NETWORKING_CONFIG_SDR_CLIENT_FORCE_PROXY_ADDR = k_ESteamNetworkingConfig_SDRClient_ForceProxyAddr, - NETWORKING_CONFIG_SDR_CLIENT_FAKE_CLUSTER_PING = k_ESteamNetworkingConfig_SDRClient_FakeClusterPing, - NETWORKING_CONFIG_SDR_CLIENT_LIMIT_PING_PROBES_TO_NEAREST_N = k_ESteamNetworkingConfig_SDRClient_LimitPingProbesToNearestN, - NETWORKING_CONFIG_LOG_LEVEL_ACK_RTT = k_ESteamNetworkingConfig_LogLevel_AckRTT, - NETWORKING_CONFIG_LOG_LEVEL_PACKET_DECODE = k_ESteamNetworkingConfig_LogLevel_PacketDecode, - NETWORKING_CONFIG_LOG_LEVEL_MESSAGE = k_ESteamNetworkingConfig_LogLevel_Message, - NETWORKING_CONFIG_LOG_LEVEL_PACKET_GAPS = k_ESteamNetworkingConfig_LogLevel_PacketGaps, - NETWORKING_CONFIG_LOG_LEVEL_P2P_RENDEZVOUS = k_ESteamNetworkingConfig_LogLevel_P2PRendezvous, - NETWORKING_CONFIG_LOG_LEVEL_SRD_RELAY_PINGS = k_ESteamNetworkingConfig_LogLevel_SDRRelayPings, - NETWORKING_CONFIG_CALLBACK_CONNECTION_STATUS_CHANGED = k_ESteamNetworkingConfig_Callback_ConnectionStatusChanged, - NETWORKING_CONFIG_CALLBACK_AUTH_STATUS_CHANGED = k_ESteamNetworkingConfig_Callback_AuthStatusChanged, - NETWORKING_CONFIG_CALLBACK_RELAY_NETWORK_STATUS_CHANGED = k_ESteamNetworkingConfig_Callback_RelayNetworkStatusChanged, - NETWORKING_CONFIG_CALLBACK_MESSAGE_SESSION_REQUEST = k_ESteamNetworkingConfig_Callback_MessagesSessionRequest, - NETWORKING_CONFIG_CALLBACK_MESSAGES_SESSION_FAILED = k_ESteamNetworkingConfig_Callback_MessagesSessionFailed, - NETWORKING_CONFIG_CALLBACK_CREATE_CONNECTION_SIGNALING = k_ESteamNetworkingConfig_Callback_CreateConnectionSignaling, - NETWORKING_CONFIG_CALLBACK_FAKE_IP_RESULT = k_ESteamNetworkingConfig_Callback_FakeIPResult, - NETWORKING_CONFIG_P2P_STUN_SERVER_LIST = k_ESteamNetworkingConfig_P2P_STUN_ServerList, - NETWORKING_CONFIG_P2P_TRANSPORT_ICE_ENABLE = k_ESteamNetworkingConfig_P2P_Transport_ICE_Enable, - NETWORKING_CONFIG_P2P_TRANSPORT_ICE_PENALTY = k_ESteamNetworkingConfig_P2P_Transport_ICE_Penalty, - NETWORKING_CONFIG_P2P_TRANSPORT_SDR_PENALTY = k_ESteamNetworkingConfig_P2P_Transport_SDR_Penalty, - NETWORKING_CONFIG_P2P_TURN_SERVER_LIST = k_ESteamNetworkingConfig_P2P_TURN_ServerList, - NETWORKING_CONFIG_P2P_TURN_uSER_LIST = k_ESteamNetworkingConfig_P2P_TURN_UserList, - NETWORKING_CONFIG_P2P_TURN_PASS_LIST = k_ESteamNetworkingConfig_P2P_TURN_PassList, -// NETWORKING_CONFIG_P2P_TRANSPORT_LAN_BEACON_PENALTY = k_ESteamNetworkingConfig_P2P_Transport_LANBeacon_Penalty, - NETWORKING_CONFIG_P2P_TRANSPORT_ICE_IMPLEMENTATION = k_ESteamNetworkingConfig_P2P_Transport_ICE_Implementation, - NETWORKING_CONFIG_ECN = k_ESteamNetworkingConfig_ECN, - NETWORKING_CONFIG_VALUE_FORCE32BIT = k_ESteamNetworkingConfigValue__Force32Bit - }; - enum NetworkingConnectionEnd { - CONNECTION_END_INVALID = k_ESteamNetConnectionEnd_Invalid, - CONNECTION_END_APP_MIN = k_ESteamNetConnectionEnd_App_Min, - CONNECTION_END_APP_GENERIC = k_ESteamNetConnectionEnd_App_Generic, - CONNECTION_END_APP_MAX = k_ESteamNetConnectionEnd_App_Max, - CONNECTION_END_APP_EXCEPTION_MIN = k_ESteamNetConnectionEnd_AppException_Min, - CONNECTION_END_APP_EXCEPTION_GENERIC = k_ESteamNetConnectionEnd_AppException_Generic, - CONNECTION_END_APP_EXCEPTION_MAX = k_ESteamNetConnectionEnd_AppException_Max, - CONNECTION_END_LOCAL_MIN = k_ESteamNetConnectionEnd_Local_Min, - CONNECTION_END_LOCAL_OFFLINE_MODE = k_ESteamNetConnectionEnd_Local_OfflineMode, - CONNECTION_END_LOCAL_MANY_RELAY_CONNECTIVITY = k_ESteamNetConnectionEnd_Local_ManyRelayConnectivity, - CONNECTION_END_LOCAL_HOSTED_SERVER_PRIMARY_RELAY = k_ESteamNetConnectionEnd_Local_HostedServerPrimaryRelay, - CONNECTION_END_LOCAL_NETWORK_CONFIG = k_ESteamNetConnectionEnd_Local_NetworkConfig, - CONNECTION_END_LOCAL_RIGHTS = k_ESteamNetConnectionEnd_Local_Rights, - CONNECTION_END_NO_PUBLIC_ADDRESS = k_ESteamNetConnectionEnd_Local_P2P_ICE_NoPublicAddresses, - CONNECTION_END_LOCAL_MAX = k_ESteamNetConnectionEnd_Local_Max, - CONNECTION_END_REMOVE_MIN = k_ESteamNetConnectionEnd_Remote_Min, - CONNECTION_END_REMOTE_TIMEOUT = k_ESteamNetConnectionEnd_Remote_Timeout, - CONNECTION_END_REMOTE_BAD_CRYPT = k_ESteamNetConnectionEnd_Remote_BadCrypt, - CONNECTION_END_REMOTE_BAD_CERT = k_ESteamNetConnectionEnd_Remote_BadCert, - CONNECTION_END_BAD_PROTOCOL_VERSION = k_ESteamNetConnectionEnd_Remote_BadProtocolVersion, - CONNECTION_END_REMOTE_P2P_ICE_NO_PUBLIC_ADDRESSES = k_ESteamNetConnectionEnd_Remote_P2P_ICE_NoPublicAddresses, - CONNECTION_END_REMOTE_MAX = k_ESteamNetConnectionEnd_Remote_Max, - CONNECTION_END_MISC_MIN = k_ESteamNetConnectionEnd_Misc_Min, - CONNECTION_END_MISC_GENERIC = k_ESteamNetConnectionEnd_Misc_Generic, - CONNECTION_END_MISC_INTERNAL_ERROR = k_ESteamNetConnectionEnd_Misc_InternalError, - CONNECTION_END_MISC_TIMEOUT = k_ESteamNetConnectionEnd_Misc_Timeout, - CONNECTION_END_MISC_STEAM_CONNECTIVITY = k_ESteamNetConnectionEnd_Misc_SteamConnectivity, - CONNECTION_END_MISC_NO_RELAY_SESSIONS_TO_CLIENT = k_ESteamNetConnectionEnd_Misc_NoRelaySessionsToClient, - CONNECTION_END_MISC_P2P_RENDEZVOUS = k_ESteamNetConnectionEnd_Misc_P2P_Rendezvous, - CONNECTION_END_MISC_P2P_NAT_FIREWALL = k_ESteamNetConnectionEnd_Misc_P2P_NAT_Firewall, - CONNECTION_END_MISC_PEER_SENT_NO_CONNECTION = k_ESteamNetConnectionEnd_Misc_PeerSentNoConnection, - CONNECTION_END_MISC_MAX = k_ESteamNetConnectionEnd_Misc_Max, - CONNECTION_END_FORCE32BIT = k_ESteamNetConnectionEnd__Force32Bit - }; - enum NetworkingConnectionState { - CONNECTION_STATE_NONE = k_ESteamNetworkingConnectionState_None, - CONNECTION_STATE_CONNECTING = k_ESteamNetworkingConnectionState_Connecting, - CONNECTION_STATE_FINDING_ROUTE = k_ESteamNetworkingConnectionState_FindingRoute, - CONNECTION_STATE_CONNECTED = k_ESteamNetworkingConnectionState_Connected, - CONNECTION_STATE_CLOSED_BY_PEER = k_ESteamNetworkingConnectionState_ClosedByPeer, - CONNECTION_STATE_PROBLEM_DETECTED_LOCALLY = k_ESteamNetworkingConnectionState_ProblemDetectedLocally, - CONNECTION_STATE_FIN_WAIT = k_ESteamNetworkingConnectionState_FinWait, - CONNECTION_STATE_LINGER = k_ESteamNetworkingConnectionState_Linger, - CONNECTION_STATE_DEAD = k_ESteamNetworkingConnectionState_Dead, - CONNECTION_STATE_FORCE_32BIT = k_ESteamNetworkingConnectionState__Force32Bit - }; - enum NetworkingFakeIPType { - FAKE_IP_TYPE_INVALID = k_ESteamNetworkingFakeIPType_Invalid, - FAKE_IP_TYPE_NOT_FAKE = k_ESteamNetworkingFakeIPType_NotFake, - FAKE_IP_TYPE_GLOBAL_IPV4 = k_ESteamNetworkingFakeIPType_GlobalIPv4, - FAKE_IP_TYPE_LOCAL_IPV4 = k_ESteamNetworkingFakeIPType_LocalIPv4, - FAKE_IP_TYPE_FORCE32BIT = k_ESteamNetworkingFakeIPType__Force32Bit - }; - enum NetworkingGetConfigValueResult { - NETWORKING_GET_CONFIG_VALUE_BAD_VALUE = k_ESteamNetworkingGetConfigValue_BadValue, - NETWORKING_GET_CONFIG_VALUE_BAD_SCOPE_OBJ = k_ESteamNetworkingGetConfigValue_BadScopeObj, - NETWORKING_GET_CONFIG_VALUE_BUFFER_TOO_SMALL = k_ESteamNetworkingGetConfigValue_BufferTooSmall, - NETWORKING_GET_CONFIG_VALUE_OK = k_ESteamNetworkingGetConfigValue_OK, - NETWORKING_GET_CONFIG_VALUE_OK_INHERITED = k_ESteamNetworkingGetConfigValue_OKInherited, - NETWORKING_GET_CONFIG_VALUE_FORCE_32BIT = k_ESteamNetworkingGetConfigValueResult__Force32Bit - }; - enum NetworkingIdentityType { - IDENTITY_TYPE_INVALID = k_ESteamNetworkingIdentityType_Invalid, - IDENTITY_TYPE_STEAMID = k_ESteamNetworkingIdentityType_SteamID, - IDENTITY_TYPE_IP_ADDRESS = k_ESteamNetworkingIdentityType_IPAddress, - IDENTITY_TYPE_GENERIC_STRING = k_ESteamNetworkingIdentityType_GenericString, - IDENTITY_TYPE_GENERIC_BYTES = k_ESteamNetworkingIdentityType_GenericBytes, - IDENTITY_TYPE_UNKNOWN_TYPE = k_ESteamNetworkingIdentityType_UnknownType, - IDENTITY_TYPE_XBOX_PAIRWISE = k_ESteamNetworkingIdentityType_XboxPairwiseID, - IDENTITY_TYPE_SONY_PSN = k_ESteamNetworkingIdentityType_SonyPSN, - IDENTITY_TYPE_GOOGLE_STADIA = k_ESteamNetworkingIdentityType_GoogleStadia, -// IDENTITY_TYPE_NINTENDO = k_ESteamNetworkingIdentityType_NintendoNetworkServiceAccount, -// IDENTITY_TYPE_EPIC_GS = k_ESteamNetworkingIdentityType_EpicGameStore, -// IDENTITY_TYPE_WEGAME = k_ESteamNetworkingIdentityType_WeGame, - IDENTITY_TYPE_FORCE_32BIT = k_ESteamNetworkingIdentityType__Force32bit - }; - enum NetworkingSocketsDebugOutputType { - NETWORKING_SOCKET_DEBUG_OUTPUT_TYPE_NONE = k_ESteamNetworkingSocketsDebugOutputType_None, - NETWORKING_SOCKET_DEBUG_OUTPUT_TYPE_BUG = k_ESteamNetworkingSocketsDebugOutputType_Bug, - NETWORKING_SOCKET_DEBUG_OUTPUT_TYPE_ERROR = k_ESteamNetworkingSocketsDebugOutputType_Error, - NETWORKING_SOCKET_DEBUG_OUTPUT_TYPE_IMPORTANT = k_ESteamNetworkingSocketsDebugOutputType_Important, - NETWORKING_SOCKET_DEBUG_OUTPUT_TYPE_WARNING = k_ESteamNetworkingSocketsDebugOutputType_Warning, - NETWORKING_SOCKET_DEBUG_OUTPUT_TYPE_MSG = k_ESteamNetworkingSocketsDebugOutputType_Msg, - NETWORKING_SOCKET_DEBUG_OUTPUT_TYPE_VERBOSE = k_ESteamNetworkingSocketsDebugOutputType_Verbose, - NETWORKING_SOCKET_DEBUG_OUTPUT_TYPE_DEBUG = k_ESteamNetworkingSocketsDebugOutputType_Debug, - NETWORKING_SOCKET_DEBUG_OUTPUT_TYPE_EVERYTHING = k_ESteamNetworkingSocketsDebugOutputType_Everything, - NETWORKING_SOCKET_DEBUG_OUTPUT_TYPE_FORCE_32BIT = k_ESteamNetworkingSocketsDebugOutputType__Force32Bit - }; - - // Networking Utils enums { - enum NetworkingAvailability { - NETWORKING_AVAILABILITY_CANNOT_TRY = k_ESteamNetworkingAvailability_CannotTry, - NETWORKING_AVAILABILITY_FAILED = k_ESteamNetworkingAvailability_Failed, - NETWORKING_AVAILABILITY_PREVIOUSLY = k_ESteamNetworkingAvailability_Previously, - NETWORKING_AVAILABILITY_RETRYING = k_ESteamNetworkingAvailability_Retrying, - NETWORKING_AVAILABILITY_NEVER_TRIED = k_ESteamNetworkingAvailability_NeverTried, - NETWORKING_AVAILABILITY_WAITING = k_ESteamNetworkingAvailability_Waiting, - NETWORKING_AVAILABILITY_ATTEMPTING = k_ESteamNetworkingAvailability_Attempting, - NETWORKING_AVAILABILITY_CURRENT = k_ESteamNetworkingAvailability_Current, - NETWORKING_AVAILABILITY_UNKNOWN = k_ESteamNetworkingAvailability_Unknown, - NETWORKING_AVAILABILITY_FORCE_32BIT = k_ESteamNetworkingAvailability__Force32bit - }; - enum NetworkingConfigDataType { - NETWORKING_CONFIG_TYPE_INT32 = k_ESteamNetworkingConfig_Int32, - NETWORKING_CONFIG_TYPE_INT64 = k_ESteamNetworkingConfig_Int64, - NETWORKING_CONFIG_TYPE_FLOAT = k_ESteamNetworkingConfig_Float, - ETWORKING_CONFIG_TYPE_STRING = k_ESteamNetworkingConfig_String, - NETWORKING_CONFIG_TYPE_FUNCTION_PTR = k_ESteamNetworkingConfig_Ptr, - NETWORKING_CONFIG_TYPE_FORCE_32BIT = k_ESteamNetworkingConfigDataType__Force32Bit - }; - enum NetworkingConfigScope { - NETWORKING_CONFIG_SCOPE_GLOBAL = k_ESteamNetworkingConfig_Global, - NETWORKING_CONFIG_SCOPE_SOCKETS_INTERFACE = k_ESteamNetworkingConfig_SocketsInterface, - NETWORKING_CONFIG_SCOPE_LISTEN_SOCKET = k_ESteamNetworkingConfig_ListenSocket, - NETWORKING_CONFIG_SCOPE_CONNECTION = k_ESteamNetworkingConfig_Connection, - NETWORKING_CONFIG_SCOPE_FORCE_32BIT = k_ESteamNetworkingConfigScope__Force32Bit - }; - - // Remote Storage enums - enum FilePathType { - FILE_PATH_TYPE_INVALID = k_ERemoteStorageFilePathType_Invalid, - FILE_PATH_TYPE_ABSOLUTE = k_ERemoteStorageFilePathType_Absolute, - FILE_PATH_TYPE_API_FILENAME = k_ERemoteStorageFilePathType_APIFilename - }; - enum LocalFileChange { - LOCAL_FILE_CHANGE_INVALID = k_ERemoteStorageLocalFileChange_Invalid, - LOCAL_FILE_CHANGE_FILE_UPDATED = k_ERemoteStorageLocalFileChange_FileUpdated, - LOCAL_FILE_CHANGE_FILE_DELETED = k_ERemoteStorageLocalFileChange_FileDeleted - }; - enum RemoteStoragePlatform { - REMOTE_STORAGE_PLATFORM_NONE = k_ERemoteStoragePlatformNone, - REMOTE_STORAGE_PLATFORM_WINDOWS = k_ERemoteStoragePlatformWindows, - REMOTE_STORAGE_PLATFORM_OSX = k_ERemoteStoragePlatformOSX, - REMOTE_STORAGE_PLATFORM_PS3 = k_ERemoteStoragePlatformPS3, - REMOTE_STORAGE_PLATFORM_LINUX = k_ERemoteStoragePlatformLinux, - REMOTE_STORAGE_PLATFORM_SWITCH = k_ERemoteStoragePlatformSwitch, - REMOTE_STORAGE_PLATFORM_ANDROID = k_ERemoteStoragePlatformAndroid, - REMOTE_STORAGE_PLATFORM_IOS = k_ERemoteStoragePlatformIOS, - REMOTE_STORAGE_PLATFORM_ALL = k_ERemoteStoragePlatformAll - }; - enum RemoteStoragePublishedFileVisibility { - REMOTE_STORAGE_PUBLISHED_VISIBILITY_PUBLIC = k_ERemoteStoragePublishedFileVisibilityPublic, - REMOTE_STORAGE_PUBLISHED_VISIBILITY_FRIENDS_ONLY = k_ERemoteStoragePublishedFileVisibilityFriendsOnly, - REMOTE_STORAGE_PUBLISHED_VISIBILITY_PRIVATE = k_ERemoteStoragePublishedFileVisibilityPrivate, - REMOTE_STORAGE_PUBLISHED_VISIBILITY_UNLISTED = k_ERemoteStoragePublishedFileVisibilityUnlisted - }; - enum UGCReadAction { - UGC_READ_CONTINUE_READING_UNTIL_FINISHED = k_EUGCRead_ContinueReadingUntilFinished, - UGC_READ_CONTINUE_READING = k_EUGCRead_ContinueReading, - UGC_READ_CLOSE = k_EUGCRead_Close - }; - enum WorkshopEnumerationType { - WORKSHOP_ENUMERATION_TYPE_RANKED_BY_VOTE = k_EWorkshopEnumerationTypeRankedByVote, - WORKSHOP_ENUMERATION_TYPE_RECENT = k_EWorkshopEnumerationTypeRecent, - WORKSHOP_ENUMERATION_TYPE_TRENDING = k_EWorkshopEnumerationTypeTrending, - WORKSHOP_ENUMERATION_TYPE_FAVORITES_OF_FRIENDS = k_EWorkshopEnumerationTypeFavoritesOfFriends, - WORKSHOP_ENUMERATION_TYPE_VOTED_BY_FRIENDS = k_EWorkshopEnumerationTypeVotedByFriends, - WORKSHOP_ENUMERATION_TYPE_CONTENT_BY_FRIENDS = k_EWorkshopEnumerationTypeContentByFriends, - WORKSHOP_ENUMERATION_TYPE_RECENT_FROM_FOLLOWED_USERS = k_EWorkshopEnumerationTypeRecentFromFollowedUsers - }; - enum WorkshopFileAction { - WORKSHOP_FILE_ACTION_PLAYED = k_EWorkshopFileActionPlayed, - WORKSHOP_FILE_ACTION_COMPLETED = k_EWorkshopFileActionCompleted - }; - enum WorkshopFileType { - WORKSHOP_FILE_TYPE_FIRST = k_EWorkshopFileTypeFirst, - WORKSHOP_FILE_TYPE_COMMUNITY = k_EWorkshopFileTypeCommunity, - WORKSHOP_FILE_TYPE_MICROTRANSACTION = k_EWorkshopFileTypeMicrotransaction, - WORKSHOP_FILE_TYPE_COLLECTION = k_EWorkshopFileTypeCollection, - WORKSHOP_FILE_TYPE_ART = k_EWorkshopFileTypeArt, - wORKSHOP_FILE_TYPE_VIDEO = k_EWorkshopFileTypeVideo, - WORKSHOP_FILE_TYPE_SCREENSHOT = k_EWorkshopFileTypeScreenshot, - WORKSHOP_FILE_TYPE_GAME = k_EWorkshopFileTypeGame, - WORKSHOP_FILE_TYPE_SOFTWARE = k_EWorkshopFileTypeSoftware, - WORKSHOP_FILE_TYPE_CONCEPT = k_EWorkshopFileTypeConcept, - WORKSHOP_FILE_TYPE_WEB_GUIDE = k_EWorkshopFileTypeWebGuide, - WORKSHOP_FILE_TYPE_INTEGRATED_GUIDE = k_EWorkshopFileTypeIntegratedGuide, - WORKSHOP_FILE_TYPE_MERCH = k_EWorkshopFileTypeMerch, - WORKSHOP_FILE_TYPE_CONTROLLER_BINDING = k_EWorkshopFileTypeControllerBinding, - wORKSHOP_FILE_TYPE_STEAMWORKS_ACCESS_INVITE = k_EWorkshopFileTypeSteamworksAccessInvite, - WORKSHOP_FILE_TYPE_STEAM_VIDEO = k_EWorkshopFileTypeSteamVideo, - WORKSHOP_FILE_TYPE_GAME_MANAGED_ITEM = k_EWorkshopFileTypeGameManagedItem, - WORKSHOP_FILE_TYPE_CLIP = k_EWorkshopFileTypeClip, - WORKSHOP_FILE_TYPE_MAX = k_EWorkshopFileTypeMax - }; - enum WorkshopVideoProvider { - WORKSHOP_VIDEO_PROVIDER_NONE = k_EWorkshopVideoProviderNone, - WORKSHOP_VIDEO_PROVIDER_YOUTUBE = k_EWorkshopVideoProviderYoutube - }; - enum WorkshopVote { - WORKSHOP_VOTE_UNVOTED = k_EWorkshopVoteUnvoted, - WORKSHOP_VOTE_FOR = k_EWorkshopVoteFor, - WORKSHOP_VOTE_AGAINST = k_EWorkshopVoteAgainst, - WORKSHOP_VOTE_LATER = k_EWorkshopVoteLater - }; - - // UGC enums - enum ItemPreviewType { - ITEM_PREVIEW_TYPE_IMAGE = k_EItemPreviewType_Image, - ITEM_PREVIEW_TYPE_YOUTUBE_VIDEO = k_EItemPreviewType_YouTubeVideo, - ITEM_PREVIEW_TYPE_SKETCHFAB = k_EItemPreviewType_Sketchfab, - ITEM_PREVIEW_TYPE_ENVIRONMENTMAP_HORIZONTAL_CROSS = k_EItemPreviewType_EnvironmentMap_HorizontalCross, - ITEM_PREVIEW_TYPE_ENVIRONMENTMAP_LAT_LONG = k_EItemPreviewType_EnvironmentMap_LatLong, - ITEM_PREVIEW_TYPE_CLIP = k_EItemPreviewType_Clip, - ITEM_PREVIEW_TYPE_RESERVED_MAX = k_EItemPreviewType_ReservedMax - }; - enum ItemState { - ITEM_STATE_NONE = k_EItemStateNone, - ITEM_STATE_SUBSCRIBED = k_EItemStateSubscribed, - ITEM_STATE_LEGACY_ITEM = k_EItemStateLegacyItem, - ITEM_STATE_INSTALLED = k_EItemStateInstalled, - ITEM_STATE_NEEDS_UPDATE = k_EItemStateNeedsUpdate, - ITEM_STATE_DOWNLOADING = k_EItemStateDownloading, - ITEM_STATE_DOWNLOAD_PENDING = k_EItemStateDownloadPending, - ITEM_STATE_DISABLED_LOCALLY = k_EItemStateDisabledLocally - }; - enum ItemStatistic { - ITEM_STATISTIC_NUM_SUBSCRIPTIONS = k_EItemStatistic_NumSubscriptions, - ITEM_STATISTIC_NUM_FAVORITES = k_EItemStatistic_NumFavorites, - ITEM_STATISTIC_NUM_FOLLOWERS = k_EItemStatistic_NumFollowers, - ITEM_STATISTIC_NUM_UNIQUE_SUBSCRIPTIONS = k_EItemStatistic_NumUniqueSubscriptions, - ITEM_STATISTIC_NUM_UNIQUE_FAVORITES = k_EItemStatistic_NumUniqueFavorites, - ITEM_STATISTIC_NUM_UNIQUE_FOLLOWERS = k_EItemStatistic_NumUniqueFollowers, - ITEM_STATISTIC_NUM_UNIQUE_WEBSITE_VIEWS = k_EItemStatistic_NumUniqueWebsiteViews, - ITEM_STATISTIC_REPORT_SCORE = k_EItemStatistic_ReportScore, - ITEM_STATISTIC_NUM_SECONDS_PLAYED = k_EItemStatistic_NumSecondsPlayed, - ITEM_STATISTIC_NUM_PLAYTIME_SESSIONS = k_EItemStatistic_NumPlaytimeSessions, - ITEM_STATISTIC_NUM_COMMENTS = k_EItemStatistic_NumComments, - ITEM_STATISTIC_NUM_SECONDS_PLAYED_DURING_TIME_PERIOD = k_EItemStatistic_NumSecondsPlayedDuringTimePeriod, - ITEM_STATISTIC_NUM_PLAYTIME_SESSIONS_DURING_TIME_PERIOD = k_EItemStatistic_NumPlaytimeSessionsDuringTimePeriod - }; - enum ItemUpdateStatus { - ITEM_UPDATE_STATUS_INVALID = k_EItemUpdateStatusInvalid, - ITEM_UPDATE_STATUS_PREPARING_CONFIG = k_EItemUpdateStatusPreparingConfig, - ITEM_UPDATE_STATUS_PREPARING_CONTENT = k_EItemUpdateStatusPreparingContent, - ITEM_UPDATE_STATUS_UPLOADING_CONTENT = k_EItemUpdateStatusUploadingContent, - ITEM_UPDATE_STATUS_UPLOADING_PREVIEW_FILE = k_EItemUpdateStatusUploadingPreviewFile, - ITEM_UPDATE_STATUS_COMMITTING_CHANGES = k_EItemUpdateStatusCommittingChanges - }; - enum UGCContentDescriptorID { - UGCCONTENTDESCRIPTOR_NUDITY_OR_SEXUAL_CONTENT = k_EUGCContentDescriptor_NudityOrSexualContent, - UGCCONTENTDESCRIPTOR_FREQUENT_VIOLENCE_OR_GORE = k_EUGCContentDescriptor_FrequentViolenceOrGore, - UGCCONTENTDESCRIPTOR_ADULT_ONLY_SEXUAL_CONTENT = k_EUGCContentDescriptor_AdultOnlySexualContent, - UGCCONTENTDESCRIPTOR_GRATUITOUS_SEXUAL_CONTENT = k_EUGCContentDescriptor_GratuitousSexualContent, - UGCCONTENTDESCRIPTOR_ANY_MATURE_CONTENT = k_EUGCContentDescriptor_AnyMatureContent - }; - enum UGCMatchingUGCType { - UGC_MATCHINGUGCTYPE_ITEMS = k_EUGCMatchingUGCType_Items, - UGC_MATCHING_UGC_TYPE_ITEMS_MTX = k_EUGCMatchingUGCType_Items_Mtx, - UGC_MATCHING_UGC_TYPE_ITEMS_READY_TO_USE = k_EUGCMatchingUGCType_Items_ReadyToUse, - UGC_MATCHING_UGC_TYPE_COLLECTIONS = k_EUGCMatchingUGCType_Collections, - UGC_MATCHING_UGC_TYPE_ARTWORK = k_EUGCMatchingUGCType_Artwork, - UGC_MATCHING_UGC_TYPE_VIDEOS = k_EUGCMatchingUGCType_Videos, - UGC_MATCHING_UGC_TYPE_SCREENSHOTS = k_EUGCMatchingUGCType_Screenshots, - UGC_MATCHING_UGC_TYPE_ALL_GUIDES = k_EUGCMatchingUGCType_AllGuides, - UGC_MATCHING_UGC_TYPE_WEB_GUIDES = k_EUGCMatchingUGCType_WebGuides, - UGC_MATCHING_UGC_TYPE_INTEGRATED_GUIDES = k_EUGCMatchingUGCType_IntegratedGuides, - UGC_MATCHING_UGC_TYPE_USABLE_IN_GAME = k_EUGCMatchingUGCType_UsableInGame, - UGC_MATCHING_UGC_TYPE_CONTROLLER_BINDINGS = k_EUGCMatchingUGCType_ControllerBindings, - UGC_MATCHING_UGC_TYPE_GAME_MANAGED_ITEMS = k_EUGCMatchingUGCType_GameManagedItems, - UGC_MATCHING_UGC_TYPE_ALL = k_EUGCMatchingUGCType_All - }; - enum UGCQuery { - UGC_QUERY_RANKED_BY_VOTE = k_EUGCQuery_RankedByVote, - UGC_QUERY_RANKED_BY_PUBLICATION_DATE = k_EUGCQuery_RankedByPublicationDate, - UGC_QUERY_ACCEPTED_FOR_GAME_RANKED_BY_ACCEPTANCE_DATE = k_EUGCQuery_AcceptedForGameRankedByAcceptanceDate, - UGC_QUERY_RANKED_BY_TREND = k_EUGCQuery_RankedByTrend, - UGC_QUERY_FAVORITED_BY_FRIENDS_RANKED_BY_PUBLICATION_DATE = k_EUGCQuery_FavoritedByFriendsRankedByPublicationDate, - UGC_QUERY_CREATED_BY_FRIENDS_RANKED_BY_PUBLICATION_DATE = k_EUGCQuery_CreatedByFriendsRankedByPublicationDate, - UGC_QUERY_RANKED_BY_NUM_TIMES_REPORTED = k_EUGCQuery_RankedByNumTimesReported, - UGC_QUERY_CREATED_BY_FOLLOWED_USERS_RANKED_BY_PUBLICATION_DATE = k_EUGCQuery_CreatedByFollowedUsersRankedByPublicationDate, - UGC_QUERY_NOT_YET_RATED = k_EUGCQuery_NotYetRated, - UGC_QUERY_RANKED_BY_TOTAL_VOTES_ASC = k_EUGCQuery_RankedByTotalVotesAsc, - UGC_QUERY_RANKED_BY_VOTES_UP = k_EUGCQuery_RankedByVotesUp, - UGC_QUERY_RANKED_BY_TEXT_SEARCH = k_EUGCQuery_RankedByTextSearch, - UGC_QUERY_RANKED_BY_TOTAL_UNIQUE_SUBSCRIPTIONS = k_EUGCQuery_RankedByTotalUniqueSubscriptions, - UGC_QUERY_RANKED_BY_PLAYTIME_TREND = k_EUGCQuery_RankedByPlaytimeTrend, - UGC_QUERY_RANKED_BY_TOTAL_PLAYTIME = k_EUGCQuery_RankedByTotalPlaytime, - UGC_QUERY_RANKED_BY_AVERAGE_PLAYTIME_TREND = k_EUGCQuery_RankedByAveragePlaytimeTrend, - UGC_QUERY_RANKED_BY_LIFETIME_AVERAGE_PLAYTIME = k_EUGCQuery_RankedByLifetimeAveragePlaytime, - UGC_QUERY_RANKED_BY_PLAYTIME_SESSIONS_TREND = k_EUGCQuery_RankedByPlaytimeSessionsTrend, - UGC_QUERY_RANKED_BY_LIFETIME_PLAYTIME_SESSIONS = k_EUGCQuery_RankedByLifetimePlaytimeSessions, - UGC_QUERY_RANKED_BY_LAST_UPDATED_DATE = k_EUGCQuery_RankedByLastUpdatedDate - }; - enum UserUGCList { - USER_UGC_LIST_PUBLISHED = k_EUserUGCList_Published, - USER_UGC_LIST_VOTED_ON = k_EUserUGCList_VotedOn, - USER_UGC_LIST_VOTED_UP = k_EUserUGCList_VotedUp, - USER_UGC_LIST_VOTED_DOWN = k_EUserUGCList_VotedDown, - USER_UGC_LIST_WILL_VOTE_LATER = k_EUserUGCList_WillVoteLater, - USER_UGC_LIST_FAVORITED = k_EUserUGCList_Favorited, - USER_UGC_LIST_SUBSCRIBED = k_EUserUGCList_Subscribed, - USER_UGC_LIST_USED_OR_PLAYED = k_EUserUGCList_UsedOrPlayed, - USER_UGC_LIST_FOLLOWED = k_EUserUGCList_Followed - }; - enum UserUGCListSortOrder { - USERUGCLISTSORTORDER_CREATIONORDERDESC = k_EUserUGCListSortOrder_CreationOrderDesc, - USERUGCLISTSORTORDER_CREATIONORDERASC = k_EUserUGCListSortOrder_CreationOrderAsc, - USERUGCLISTSORTORDER_TITLEASC = k_EUserUGCListSortOrder_TitleAsc, - USERUGCLISTSORTORDER_LASTUPDATEDDESC = k_EUserUGCListSortOrder_LastUpdatedDesc, - USERUGCLISTSORTORDER_SUBSCRIPTIONDATEDESC = k_EUserUGCListSortOrder_SubscriptionDateDesc, - USERUGCLISTSORTORDER_VOTESCOREDESC = k_EUserUGCListSortOrder_VoteScoreDesc, - SERUGCLISTSORTORDER_FORMODERATION = k_EUserUGCListSortOrder_ForModeration - }; - - static SteamServer* get_singleton(); - SteamServer(); - ~SteamServer(); - - ///////////////////////////////////////// - // STEAMWORKS FUNCTIONS ///////////////// - ///////////////////////////////////////// - // - CSteamID createSteamID(uint64_t steam_id, int account_type=-1); - - // Main ///////////////////////////////// - bool isServerSecure(); - uint64_t getServerSteamID(); - bool serverInit(const String& ip, uint16 game_port, uint16 query_port, ServerMode server_mode, const String& version_number); - Dictionary serverInitEx(const String& ip, uint16 game_port, uint16 query_port, ServerMode server_mode, const String& version_number); - void serverReleaseCurrentThreadMemory(); - void serverShutdown(); - void steamworksError(const String& failed_signal); - - // Game Server ////////////////////////// - void associateWithClan(uint64_t clan_id); - uint32 beginAuthSession(PoolByteArray ticket, int ticket_size, uint64_t steam_id); - void cancelAuthTicket(uint32_t auth_ticket); - void clearAllKeyValues(); - void computeNewPlayerCompatibility(uint64_t steam_id); - void endAuthSession(uint64_t steam_id); - Dictionary getAuthSessionTicket(const String& identity_reference); - Dictionary getNextOutgoingPacket(); - Dictionary getPublicIP(); - uint64_t getSteamID(); - Dictionary handleIncomingPacket(int packet, const String& ip, uint16 port); - bool loggedOn(); - void logOff(); - void logOn(const String& token); - void logOnAnonymous(); - bool requestUserGroupStatus(uint64_t steam_id, int group_id); - bool secure(); - void setAdvertiseServerActive(bool active); - void setBotPlayerCount(int bots); - void setDedicatedServer(bool dedicated); - void setGameData(const String& data); - void setGameDescription(const String& description); - void setGameTags(const String& tags); - void setKeyValue(const String& key, const String& value); - void setMapName(const String& map); - void setMaxPlayerCount(int players_max); - void setModDir(const String& mod_directory); - void setPasswordProtected(bool password_protected); - void setProduct(const String& product); - void setRegion(const String& region); - void setServerName(const String& name); - void setSpectatorPort(uint16 port); - void setSpectatorServerName(const String& name); - int userHasLicenceForApp(uint64_t steam_id, uint32 app_id); - bool wasRestartRequested(); - - // Game Server Stats //////////////////// - bool clearUserAchievement(uint64_t steam_id, const String& name); - Dictionary getUserAchievement(uint64_t steam_id, const String& name); - uint32_t getUserStatInt(uint64_t steam_id, const String& name); - float getUserStatFloat(uint64_t steam_id, const String& name); - void requestUserStats(uint64_t steam_id); - bool setUserAchievement(uint64_t steam_id, const String& name); - bool setUserStatInt(uint64_t steam_id, const String& name, int32 stat); - bool setUserStatFloat(uint64_t steam_id, const String& name, float stat); - void storeUserStats(uint64_t steam_id); - bool updateUserAvgRateStat(uint64_t steam_id, const String& name, float this_session, double session_length); - - // HTTP ///////////////////////////////// - uint32_t createCookieContainer( bool allow_responses_to_modify); - uint32_t createHTTPRequest(HTTPMethod request_method, const String& absolute_url); - bool deferHTTPRequest(uint32 request_handle); - float getHTTPDownloadProgressPct(uint32 request_handle); - bool getHTTPRequestWasTimedOut(uint32 request_handle); - PoolByteArray getHTTPResponseBodyData(uint32 request_handle, uint32 buffer_size); - uint32 getHTTPResponseBodySize(uint32 request_handle); - uint32 getHTTPResponseHeaderSize(uint32 request_handle, const String& header_name); - uint8 getHTTPResponseHeaderValue(uint32 request_handle, const String& header_name, uint32 buffer_size); - uint8 getHTTPStreamingResponseBodyData(uint32 request_handle, uint32 offset, uint32 buffer_size); - bool prioritizeHTTPRequest(uint32 request_handle); - bool releaseCookieContainer(uint32 cookie_handle); - bool releaseHTTPRequest(uint32 request_handle); - bool sendHTTPRequest(uint32 request_handle); - bool sendHTTPRequestAndStreamResponse(uint32 request_handle); - bool setHTTPCookie(uint32 cookie_handle, const String& host, const String& url, const String& cookie); - bool setHTTPRequestAbsoluteTimeoutMS(uint32 request_handle, uint32 milliseconds); - bool setHTTPRequestContextValue(uint32 request_handle, uint64_t context_value); - bool setHTTPRequestCookieContainer(uint32 request_handle, uint32 cookie_handle); - bool setHTTPRequestGetOrPostParameter(uint32 request_handle, const String& name, const String& value); - bool setHTTPRequestHeaderValue(uint32 request_handle, const String& header_name, const String& header_value); - bool setHTTPRequestNetworkActivityTimeout(uint32 request_handle, uint32 timeout_seconds); - uint8 setHTTPRequestRawPostBody(uint32 request_handle, const String& content_type, uint32 body_length); - bool setHTTPRequestRequiresVerifiedCertificate(uint32 request_handle, bool require_verified_certificate); - bool setHTTPRequestUserAgentInfo(uint32 request_handle, const String& user_agent_info); - - // Inventory //////////////////////////// - int32 addPromoItem(uint32 item); - int32 addPromoItems(PoolIntArray items); - bool checkResultSteamID(uint64_t steam_id_expected, int32 this_inventory_handle = 0); - int32 consumeItem(uint64_t item_consume, uint32 quantity); - int32 deserializeResult(PoolByteArray buffer); - void destroyResult(int32 this_inventory_handle = 0); - int32 exchangeItems(const PoolIntArray output_items, const PoolIntArray output_quantity, const PoolIntArray input_items, const PoolIntArray input_quantity); - int32 generateItems(const PoolIntArray items, const PoolIntArray quantity); - int32 getAllItems(); - String getItemDefinitionProperty(uint32 definition, const String& name); - int32 getItemsByID(const PoolIntArray id_array); - uint64_t getItemPrice(uint32 definition); - Array getItemsWithPrices(); - String getResultItemProperty(uint32 index, const String& name, int32 this_inventory_handle = 0); - Array getResultItems(int32 this_inventory_handle = 0); - String getResultStatus(int32 this_inventory_handle = 0); - uint32 getResultTimestamp(int32 this_inventory_handle = 0); - int32 grantPromoItems(); - bool loadItemDefinitions(); - void requestEligiblePromoItemDefinitionsIDs(uint64_t steam_id); - void requestPrices(); - String serializeResult(int32 this_inventory_handle = 0); - void startPurchase(const PoolIntArray items, const PoolIntArray quantity); - int32 transferItemQuantity(uint64_t item_id, uint32 quantity, uint64_t item_destination, bool split); - int32 triggerItemDrop(uint32 definition); - void startUpdateProperties(); - int32 submitUpdateProperties(uint64_t this_inventory_update_handle = 0); - bool removeProperty(uint64_t item_id, const String& name, uint64_t this_inventory_update_handle = 0); - bool setPropertyString(uint64_t item_id, const String& name, const String& value, uint64_t this_inventory_update_handle = 0); - bool setPropertyBool(uint64_t item_id, const String& name, bool value, uint64_t this_inventory_update_handle = 0); - bool setPropertyInt(uint64_t item_id, const String& name, uint64_t value, uint64_t this_inventory_update_handle = 0); - bool setPropertyFloat(uint64_t item_id, const String& name, float value, uint64_t this_inventory_update_handle = 0); - - // Networking /////////////////////////// - bool acceptP2PSessionWithUser(uint64_t steam_id_remote); - bool allowP2PPacketRelay(bool allow); - bool closeP2PChannelWithUser(uint64_t steam_id_remote, int channel); - bool closeP2PSessionWithUser(uint64_t steam_id_remote); - Dictionary getP2PSessionState(uint64_t steam_id_remote); - uint32_t getAvailableP2PPacketSize(int channel = 0); - Dictionary readP2PPacket(uint32_t packet, int channel = 0); - bool sendP2PPacket(uint64_t steam_id_remote, const PoolByteArray data, P2PSend send_type, int channel = 0); - - // Networking Messages ////////////////// - bool acceptSessionWithUser(const String& identity_reference); - bool closeChannelWithUser(const String& identity_reference, int channel); - bool closeSessionWithUser(const String& identity_reference); - Dictionary getSessionConnectionInfo(const String& identity_reference, bool get_connection, bool get_status); - Array receiveMessagesOnChannel(int channel, int max_messages); - int sendMessageToUser(const String& identity_reference, const PoolByteArray data, int flags, int channel); - - // Networking Sockets /////////////////// - int acceptConnection(uint32 connection_handle); - bool beginAsyncRequestFakeIP(int num_ports); - bool closeConnection(uint32 peer, int reason, const String& debug_message, bool linger); - bool closeListenSocket(uint32 socket); - int configureConnectionLanes(uint32 connection, int lanes, Array priorities, Array weights); - uint32 connectP2P(const String& identity_reference, int virtual_port, Array options); - uint32 connectByIPAddress(const String& ip_address_with_port, Array options); - uint32 connectToHostedDedicatedServer(const String& identity_reference, int virtual_port, Array options); - void createFakeUDPPort(int fake_server_port); - uint32 createHostedDedicatedServerListenSocket(int virtual_port, Array options); - uint32 createListenSocketIP(const String& ip_reference, Array options); - uint32 createListenSocketP2P(int virtual_port, Array options); - uint32 createListenSocketP2PFakeIP(int fake_port, Array options); - uint32 createPollGroup(); - Dictionary createSocketPair(bool loopback, const String& identity_reference1, const String& identity_reference2); - bool destroyPollGroup(uint32 poll_group); + // Networking Sockets /////////////////// + int acceptConnection(uint32 connection_handle); + bool beginAsyncRequestFakeIP(int num_ports); + bool closeConnection(uint32 peer, int reason, const String &debug_message, bool linger); + bool closeListenSocket(uint32 socket); + int configureConnectionLanes(uint32 connection, int lanes, Array priorities, Array weights); + uint32 connectP2P(uint64_t remote_steam_id, int virtual_port, Array options); + uint32 connectByIPAddress(String ip_address_with_port, Array options); + uint32 connectToHostedDedicatedServer(uint64_t remote_steam_id, int virtual_port, Array options); + void createFakeUDPPort(int fake_server_port); + uint32 createHostedDedicatedServerListenSocket(int virtual_port, Array options); + uint32 createListenSocketIP(String ip_address, Array options); + uint32 createListenSocketP2P(int virtual_port, Array options); + uint32 createListenSocketP2PFakeIP(int fake_port, Array options); + uint32 createPollGroup(); + Dictionary createSocketPair(bool loopback, uint64_t remote_steam_id1, uint64_t remote_steam_id2); + bool destroyPollGroup(uint32 poll_group); // int findRelayAuthTicketForServer(int port); <------ Uses datagram relay structs which were removed from base SDK - int flushMessagesOnConnection(uint32 connection_handle); - NetworkingAvailability getAuthenticationStatus(); - Dictionary getCertificateRequest(); - Dictionary getConnectionInfo(uint32 connection_handle); - String getConnectionName(uint32 peer); - Dictionary getConnectionRealTimeStatus(uint32 connection_handle, int lanes, bool get_status = true); - uint64_t getConnectionUserData(uint32 peer); - Dictionary getDetailedConnectionStatus(uint32 connection_handle); - Dictionary getFakeIP(int first_port = 0); -// int getGameCoordinatorServerLogin(const String& app_data); <------ Uses datagram relay structs which were removed from base SDK + int flushMessagesOnConnection(uint32 connection_handle); + NetworkingAvailability getAuthenticationStatus(); + Dictionary getCertificateRequest(); + Dictionary getConnectionInfo(uint32 connection_handle); + String getConnectionName(uint32 peer); + Dictionary getConnectionRealTimeStatus(uint32 connection_handle, int lanes, bool get_status = true); + uint64_t getConnectionUserData(uint32 peer); + Dictionary getDetailedConnectionStatus(uint32 connection_handle); + Dictionary getFakeIP(int first_port = 0); +// int getGameCoordinatorServerLogin(const String &app_data); <------ Uses datagram relay structs which were removed from base SDK // int getHostedDedicatedServerAddress(); <------ Uses datagram relay structs which were removed from base SDK - uint32 getHostedDedicatedServerPOPId(); - uint16 getHostedDedicatedServerPort(); - String getListenSocketAddress(uint32 socket, bool with_port = true); - String getIdentity(); - Dictionary getRemoteFakeIPForConnection(uint32 connection); - NetworkingAvailability initAuthentication(); - Array receiveMessagesOnConnection(uint32 connection, int max_messages); - Array receiveMessagesOnPollGroup(uint32 poll_group, int max_messages); + uint32 getHostedDedicatedServerPOPId(); + uint16 getHostedDedicatedServerPort(); + String getListenSocketAddress(uint32 socket, bool with_port = true); + Dictionary getRemoteFakeIPForConnection(uint32 connection); + NetworkingAvailability initAuthentication(); + Array receiveMessagesOnConnection(uint32 connection, int max_messages); + Array receiveMessagesOnPollGroup(uint32 poll_group, int max_messages); // Dictionary receivedRelayAuthTicket(); <------ Uses datagram relay structs which were removed from base SDK - void resetIdentity(const String& this_identity); - void runNetworkingCallbacks(); - void sendMessages(int messages, const PoolByteArray data, uint32 connection_handle, int flags); - Dictionary sendMessageToConnection(uint32 connection_handle, const PoolByteArray data, int flags); - Dictionary setCertificate(const PoolByteArray& certificate); - bool setConnectionPollGroup(uint32 connection_handle, uint32 poll_group); - void setConnectionName(uint32 peer, const String& name); - - // Networking Types ///////////////////// - bool addIdentity(const String& reference_name); - bool addIPAddress(const String& reference_name); - void clearIdentity(const String& reference_name); - void clearIPAddress(const String& reference_name); - uint8 getGenericBytes(const String& reference_name); - String getGenericString(const String& reference_name); - Array getIdentities(); - uint32 getIdentityIPAddr(const String& reference_name); - uint32 getIdentitySteamID(const String& reference_name); - uint64_t getIdentitySteamID64(const String& reference_name); - Array getIPAddresses(); - uint32 getIPv4(const String& reference_name); - uint64_t getPSNID(const String& reference_name); - uint64_t getStadiaID(const String& reference_name); - String getXboxPairwiseID(const String& reference_name); - bool isAddressLocalHost(const String& reference_name); - bool isIdentityInvalid(const String& reference_name); - bool isIdentityLocalHost(const String& reference_name); - bool isIPv4(const String& reference_name); - bool isIPv6AllZeros(const String& reference_name); - bool parseIdentityString(const String& reference_name, const String& string_to_parse); - bool parseIPAddressString(const String& reference_name, const String& string_to_parse); - bool setGenericBytes(const String& reference_name, uint8 data); - bool setGenericString(const String& reference_name, const String& this_string); - bool setIdentityIPAddr(const String& reference_name, const String& ip_address_name); - void setIdentityLocalHost(const String& reference_name); - void setIdentitySteamID(const String& reference_name, uint32 steam_id); - void setIdentitySteamID64(const String& reference_name, uint64_t steam_id); - void setIPv4(const String& reference_name, uint32 ip, uint16 port); - void setIPv6(const String& reference_name, uint8 ipv6, uint16 port); - void setIPv6LocalHost(const String& reference_name, uint16 port = 0); - void setPSNID(const String& reference_name, uint64_t psn_id); - void setStadiaID(const String& reference_name, uint64_t stadia_id); - bool setXboxPairwiseID(const String& reference_name, const String& xbox_id); - String toIdentityString(const String& reference_name); - String toIPAddressString(const String& reference_name, bool with_port); - const SteamNetworkingConfigValue_t* convertOptionsArray(Array options); - - // Networking Utils ///////////////////// - bool checkPingDataUpToDate(float max_age_in_seconds); - String convertPingLocationToString(PoolByteArray location); - int estimatePingTimeBetweenTwoLocations(PoolByteArray location1, PoolByteArray location2); - int estimatePingTimeFromLocalHost(PoolByteArray location); - Dictionary getConfigValue(NetworkingConfigValue config_value, NetworkingConfigScope scope_type, uint32_t connection_handle); - Dictionary getConfigValueInfo(NetworkingConfigValue config_value); - int getDirectPingToPOP(uint32 pop_id); - Dictionary getLocalPingLocation(); - uint64_t getLocalTimestamp(); - Dictionary getPingToDataCenter(uint32 pop_id); - int getPOPCount(); - Array getPOPList(); - NetworkingAvailability getRelayNetworkStatus(); - void initRelayNetworkAccess(); - Dictionary parsePingLocationString(const String& location_string); - bool setConnectionConfigValueFloat(uint32 connection, NetworkingConfigValue config, float value); - bool setConnectionConfigValueInt32(uint32 connection, NetworkingConfigValue config, int32 value); - bool setConnectionConfigValueString(uint32 connection, NetworkingConfigValue config, const String& value); + void resetIdentity(uint64_t remote_steam_id); + void runNetworkingCallbacks(); + void sendMessages(int messages, const PoolByteArray data, uint32 connection_handle, int flags); + Dictionary sendMessageToConnection(uint32 connection_handle, const PoolByteArray data, int flags); + Dictionary setCertificate(const PoolByteArray &certificate); + bool setConnectionPollGroup(uint32 connection_handle, uint32 poll_group); + void setConnectionName(uint32 peer, const String &name); + + // Networking Utils ///////////////////// + bool checkPingDataUpToDate(float max_age_in_seconds); + String convertPingLocationToString(PoolByteArray location); + int estimatePingTimeBetweenTwoLocations(PoolByteArray location1, PoolByteArray location2); + int estimatePingTimeFromLocalHost(PoolByteArray location); + Dictionary getConfigValue(NetworkingConfigValue config_value, NetworkingConfigScope scope_type, uint32_t connection_handle); + Dictionary getConfigValueInfo(NetworkingConfigValue config_value); + int getDirectPingToPOP(uint32 pop_id); + Dictionary getLocalPingLocation(); + uint64_t getLocalTimestamp(); + Dictionary getPingToDataCenter(uint32 pop_id); + int getPOPCount(); + Array getPOPList(); + NetworkingAvailability getRelayNetworkStatus(); + void initRelayNetworkAccess(); + Dictionary parsePingLocationString(const String &location_string); + bool setConnectionConfigValueFloat(uint32 connection, NetworkingConfigValue config, float value); + bool setConnectionConfigValueInt32(uint32 connection, NetworkingConfigValue config, int32 value); + bool setConnectionConfigValueString(uint32 connection, NetworkingConfigValue config, const String &value); // bool setConfigValue(NetworkingConfigValue setting, NetworkingConfigScope scope_type, uint32_t connection_handle, NetworkingConfigDataType data_type, auto value); - bool setGlobalConfigValueFloat(NetworkingConfigValue config, float value); - bool setGlobalConfigValueInt32(NetworkingConfigValue config, int32 value); - bool setGlobalConfigValueString(NetworkingConfigValue config, const String& value); - - // UGC ////////////////////////////////// - void addAppDependency(uint64_t published_file_id, uint32_t app_id); - bool addContentDescriptor(uint64_t update_handle, int descriptor_id); - void addDependency(uint64_t published_file_id, uint64_t child_published_file_id); - bool addExcludedTag(uint64_t query_handle, const String& tag_name); - bool addItemKeyValueTag(uint64_t query_handle, const String& key, const String& value); - bool addItemPreviewFile(uint64_t query_handle, const String& preview_file, ItemPreviewType type); - bool addItemPreviewVideo(uint64_t query_handle, const String& video_id); - void addItemToFavorites(uint32_t app_id, uint64_t published_file_id); - bool addRequiredKeyValueTag(uint64_t query_handle, const String& key, const String& value); - bool addRequiredTag(uint64_t query_handle, const String& tag_name); - bool addRequiredTagGroup(uint64_t query_handle, Array tag_array); - bool initWorkshopForGameServer(uint32_t workshop_depot_id); - void createItem(uint32 app_id, WorkshopFileType file_type); - uint64_t createQueryAllUGCRequest(UGCQuery query_type, UGCMatchingUGCType matching_type, uint32_t creator_id, uint32_t consumer_id, uint32 page); - uint64_t createQueryUGCDetailsRequest(Array published_file_id); - uint64_t createQueryUserUGCRequest(uint64_t steam_id, UserUGCList list_type, UGCMatchingUGCType matching_ugc_type, UserUGCListSortOrder sort_order, uint32_t creator_id, uint32_t consumer_id, uint32 page); - void deleteItem(uint64_t published_file_id); - bool downloadItem(uint64_t published_file_id, bool high_priority); - Dictionary getItemDownloadInfo(uint64_t published_file_id); - Dictionary getItemInstallInfo(uint64_t published_file_id); - uint32 getItemState(uint64_t published_file_id); - Dictionary getItemUpdateProgress(uint64_t update_handle); - uint32 getNumSubscribedItems(); - Dictionary getQueryUGCAdditionalPreview(uint64_t query_handle, uint32 index, uint32 preview_index); - Dictionary getQueryUGCChildren(uint64_t query_handle, uint32 index, uint32_t child_count); - Dictionary getQueryUGCContentDescriptors(uint64_t query_handle, uint32 index, uint32_t max_entries); - Dictionary getQueryUGCKeyValueTag(uint64_t query_handle, uint32 index, uint32 key_value_tag_index); - String getQueryUGCMetadata(uint64_t query_handle, uint32 index); - uint32 getQueryUGCNumAdditionalPreviews(uint64_t query_handle, uint32 index); - uint32 getQueryUGCNumKeyValueTags(uint64_t query_handle, uint32 index); - uint32 getQueryUGCNumTags(uint64_t query_handle, uint32 index); - String getQueryUGCPreviewURL(uint64_t query_handle, uint32 index); - Dictionary getQueryUGCResult(uint64_t query_handle, uint32 index); - Dictionary getQueryUGCStatistic(uint64_t query_handle, uint32 index, ItemStatistic stat_type); - String getQueryUGCTag(uint64_t query_handle, uint32 index, uint32 tag_index); - String getQueryUGCTagDisplayName(uint64_t query_handle, uint32 index, uint32 tag_index); - Array getSubscribedItems(); - Array getUserContentDescriptorPreferences(uint32 max_entries); - void getUserItemVote(uint64_t published_file_id); - bool releaseQueryUGCRequest(uint64_t query_handle); - void removeAppDependency(uint64_t published_file_id, uint32_t app_id); - bool removeContentDescriptor(uint64_t update_handle, int descriptor_id); - void removeDependency(uint64_t published_file_id, uint64_t child_published_file_id); - void removeItemFromFavorites(uint32_t app_id, uint64_t published_file_id); - bool removeItemKeyValueTags(uint64_t update_handle, const String& key); - bool removeItemPreview(uint64_t update_handle, uint32 index); - void sendQueryUGCRequest(uint64_t update_handle); - bool setAllowCachedResponse(uint64_t update_handle, uint32 max_age_seconds); - bool setCloudFileNameFilter(uint64_t update_handle, const String& match_cloud_filename); - bool setItemContent(uint64_t update_handle, const String& content_folder); - bool setItemDescription(uint64_t update_handle, const String& description); - bool setItemMetadata(uint64_t update_handle, const String& ugc_metadata); - bool setItemPreview(uint64_t update_handle, const String& preview_file); - bool setItemTags(uint64_t update_handle, Array tag_array, bool allow_admin_tags = false); - bool setItemTitle(uint64_t update_handle, const String& title); - bool setItemUpdateLanguage(uint64_t update_handle, const String& language); - bool setItemVisibility(uint64_t update_handle, RemoteStoragePublishedFileVisibility visibility); - bool setLanguage(uint64_t query_handle, const String& language); - bool setMatchAnyTag(uint64_t query_handle, bool match_any_tag); - bool setRankedByTrendDays(uint64_t query_handle, uint32 days); - bool setReturnAdditionalPreviews(uint64_t query_handle, bool return_additional_previews); - bool setReturnChildren(uint64_t query_handle, bool return_children); - bool setReturnKeyValueTags(uint64_t query_handle, bool return_key_value_tags); - bool setReturnLongDescription(uint64_t query_handle, bool return_long_description); - bool setReturnMetadata(uint64_t query_handle, bool return_metadata); - bool setReturnOnlyIDs(uint64_t query_handle, bool return_only_ids); - bool setReturnPlaytimeStats(uint64_t query_handle, uint32 days); - bool setReturnTotalOnly(uint64_t query_handle, bool return_total_only); - bool setSearchText(uint64_t query_handle, const String& search_text); - void setUserItemVote(uint64_t published_file_id, bool vote_up); - uint64_t startItemUpdate(uint32_t app_id, uint64_t file_id); - void startPlaytimeTracking(Array published_file_ids); - void stopPlaytimeTracking(Array published_file_ids); - void stopPlaytimeTrackingForAllItems(); - void getAppDependencies(uint64_t published_file_id); - void submitItemUpdate(uint64_t update_handle, const String& change_note); - void subscribeItem(uint64_t published_file_id); - void suspendDownloads(bool suspend); - void unsubscribeItem(uint64_t published_file_id); - bool updateItemPreviewFile(uint64_t update_handle, uint32 index, const String& preview_file); - bool updateItemPreviewVideo(uint64_t update_handle, uint32 index, const String& video_id); - bool showWorkshopEULA(); - void getWorkshopEULAStatus(); - bool setTimeCreatedDateRange(uint64_t update_handle, uint32 start, uint32 end); - bool setTimeUpdatedDateRange(uint64_t update_handle, uint32 start, uint32 end); - - protected: - static void _bind_methods(); - static SteamServer* singleton; - - private: - // Main - bool is_init_success; - - // HTTP - uint32 cookie_handle; - uint32 request_handle; - - // Inventory - SteamInventoryUpdateHandle_t inventory_update_handle; - SteamInventoryResult_t inventory_handle; - SteamItemDetails_t inventory_details; - - // Networking Messages -// std::map network_messages; - - // Networking Sockets - uint32 network_connection; - uint32 listen_socket; - uint32 network_poll_group; - uint64_t networking_microseconds = 0; - SteamNetworkingIdentity networking_identity; - SteamNetworkingIdentity game_server; + bool setGlobalConfigValueFloat(NetworkingConfigValue config, float value); + bool setGlobalConfigValueInt32(NetworkingConfigValue config, int32 value); + bool setGlobalConfigValueString(NetworkingConfigValue config, const String &value); + + // UGC ////////////////////////////////// + void addAppDependency(uint64_t published_file_id, uint32_t app_id); + bool addContentDescriptor(uint64_t update_handle, int descriptor_id); + void addDependency(uint64_t published_file_id, uint64_t child_published_file_id); + bool addExcludedTag(uint64_t query_handle, const String &tag_name); + bool addItemKeyValueTag(uint64_t query_handle, const String &key, const String &value); + bool addItemPreviewFile(uint64_t query_handle, const String &preview_file, ItemPreviewType type); + bool addItemPreviewVideo(uint64_t query_handle, const String &video_id); + void addItemToFavorites(uint32_t app_id, uint64_t published_file_id); + bool addRequiredKeyValueTag(uint64_t query_handle, const String &key, const String &value); + bool addRequiredTag(uint64_t query_handle, const String &tag_name); + bool addRequiredTagGroup(uint64_t query_handle, Array tag_array); + bool initWorkshopForGameServer(uint32_t workshop_depot_id); + void createItem(uint32 app_id, WorkshopFileType file_type); + uint64_t createQueryAllUGCRequest(UGCQuery query_type, UGCMatchingUGCType matching_type, uint32_t creator_id, uint32_t consumer_id, uint32 page); + uint64_t createQueryUGCDetailsRequest(Array published_file_id); + uint64_t createQueryUserUGCRequest(uint64_t steam_id, UserUGCList list_type, UGCMatchingUGCType matching_ugc_type, UserUGCListSortOrder sort_order, uint32_t creator_id, uint32_t consumer_id, uint32 page); + void deleteItem(uint64_t published_file_id); + bool downloadItem(uint64_t published_file_id, bool high_priority); + Dictionary getItemDownloadInfo(uint64_t published_file_id); + Dictionary getItemInstallInfo(uint64_t published_file_id); + uint32 getItemState(uint64_t published_file_id); + Dictionary getItemUpdateProgress(uint64_t update_handle); + uint32 getNumSubscribedItems(); + Dictionary getQueryUGCAdditionalPreview(uint64_t query_handle, uint32 index, uint32 preview_index); + Dictionary getQueryUGCChildren(uint64_t query_handle, uint32 index, uint32_t child_count); + Dictionary getQueryUGCContentDescriptors(uint64_t query_handle, uint32 index, uint32_t max_entries); + Dictionary getQueryUGCKeyValueTag(uint64_t query_handle, uint32 index, uint32 key_value_tag_index); + String getQueryUGCMetadata(uint64_t query_handle, uint32 index); + uint32 getQueryUGCNumAdditionalPreviews(uint64_t query_handle, uint32 index); + uint32 getQueryUGCNumKeyValueTags(uint64_t query_handle, uint32 index); + uint32 getQueryUGCNumTags(uint64_t query_handle, uint32 index); + String getQueryUGCPreviewURL(uint64_t query_handle, uint32 index); + Dictionary getQueryUGCResult(uint64_t query_handle, uint32 index); + Dictionary getQueryUGCStatistic(uint64_t query_handle, uint32 index, ItemStatistic stat_type); + String getQueryUGCTag(uint64_t query_handle, uint32 index, uint32 tag_index); + String getQueryUGCTagDisplayName(uint64_t query_handle, uint32 index, uint32 tag_index); + Array getSubscribedItems(); + Array getUserContentDescriptorPreferences(uint32 max_entries); + void getUserItemVote(uint64_t published_file_id); + bool releaseQueryUGCRequest(uint64_t query_handle); + void removeAppDependency(uint64_t published_file_id, uint32_t app_id); + bool removeContentDescriptor(uint64_t update_handle, int descriptor_id); + void removeDependency(uint64_t published_file_id, uint64_t child_published_file_id); + void removeItemFromFavorites(uint32_t app_id, uint64_t published_file_id); + bool removeItemKeyValueTags(uint64_t update_handle, const String &key); + bool removeItemPreview(uint64_t update_handle, uint32 index); + void sendQueryUGCRequest(uint64_t update_handle); + bool setAllowCachedResponse(uint64_t update_handle, uint32 max_age_seconds); + bool setCloudFileNameFilter(uint64_t update_handle, const String &match_cloud_filename); + bool setItemContent(uint64_t update_handle, const String &content_folder); + bool setItemDescription(uint64_t update_handle, const String &description); + bool setItemMetadata(uint64_t update_handle, const String &ugc_metadata); + bool setItemPreview(uint64_t update_handle, const String &preview_file); + bool setItemTags(uint64_t update_handle, Array tag_array, bool allow_admin_tags = false); + bool setItemTitle(uint64_t update_handle, const String &title); + bool setItemUpdateLanguage(uint64_t update_handle, const String &language); + bool setItemVisibility(uint64_t update_handle, RemoteStoragePublishedFileVisibility visibility); + bool setLanguage(uint64_t query_handle, const String &language); + bool setMatchAnyTag(uint64_t query_handle, bool match_any_tag); + bool setRankedByTrendDays(uint64_t query_handle, uint32 days); + bool setReturnAdditionalPreviews(uint64_t query_handle, bool return_additional_previews); + bool setReturnChildren(uint64_t query_handle, bool return_children); + bool setReturnKeyValueTags(uint64_t query_handle, bool return_key_value_tags); + bool setReturnLongDescription(uint64_t query_handle, bool return_long_description); + bool setReturnMetadata(uint64_t query_handle, bool return_metadata); + bool setReturnOnlyIDs(uint64_t query_handle, bool return_only_ids); + bool setReturnPlaytimeStats(uint64_t query_handle, uint32 days); + bool setReturnTotalOnly(uint64_t query_handle, bool return_total_only); + bool setSearchText(uint64_t query_handle, const String &search_text); + void setUserItemVote(uint64_t published_file_id, bool vote_up); + uint64_t startItemUpdate(uint32_t app_id, uint64_t file_id); + void startPlaytimeTracking(Array published_file_ids); + void stopPlaytimeTracking(Array published_file_ids); + void stopPlaytimeTrackingForAllItems(); + void getAppDependencies(uint64_t published_file_id); + void submitItemUpdate(uint64_t update_handle, const String &change_note); + void subscribeItem(uint64_t published_file_id); + void suspendDownloads(bool suspend); + void unsubscribeItem(uint64_t published_file_id); + bool updateItemPreviewFile(uint64_t update_handle, uint32 index, const String &preview_file); + bool updateItemPreviewVideo(uint64_t update_handle, uint32 index, const String &video_id); + bool showWorkshopEULA(); + void getWorkshopEULAStatus(); + bool setTimeCreatedDateRange(uint64_t update_handle, uint32 start, uint32 end); + bool setTimeUpdatedDateRange(uint64_t update_handle, uint32 start, uint32 end); + + +protected: + static void _bind_methods(); + static SteamServer* singleton; + + +private: + // Main + bool is_init_success; + + const SteamNetworkingConfigValue_t *convertOptionsArray(Array options); + CSteamID createSteamID(uint64_t steam_id, AccountType account_type = AccountType(-1)); + SteamNetworkingIdentity getIdentityFromSteamID(uint64_t steam_id); + uint32 getIPFromSteamIP(SteamNetworkingIPAddr this_address); + uint32 getIPFromString(String ip_string); + uint64_t getSteamIDFromIdentity(SteamNetworkingIdentity this_identity); + SteamNetworkingIPAddr getSteamIPFromInt(uint32 ip_integer); + SteamNetworkingIPAddr getSteamIPFromString(String ip_string); + String getStringFromIP(uint32 ip_address); + String getStringFromSteamIP(SteamNetworkingIPAddr this_address); + + // Inventory + SteamInventoryUpdateHandle_t inventory_update_handle; + SteamInventoryResult_t inventory_handle; + SteamItemDetails_t inventory_details; + + // Networking Sockets + uint32 network_connection; + uint32 network_poll_group; + uint64_t networking_microseconds = 0; // SteamDatagramHostedAddress hosted_address; - PoolByteArray routing_blob; + PoolByteArray routing_blob; // SteamDatagramRelayAuthTicket relay_auth_ticket; - std::map networking_identities; - std::map ip_addresses; - - // Run the Steamworks server API callbacks - void run_callbacks(){ - SteamGameServer_RunCallbacks(); - } - - ///////////////////////////////////////// - // STEAM SERVER CALLBACKS /////////////// - ///////////////////////////////////////// - // - // Game Server callbacks //////////////// - STEAM_GAMESERVER_CALLBACK(SteamServer, server_connect_failure, SteamServerConnectFailure_t, callbackServerConnectFailure); - STEAM_GAMESERVER_CALLBACK(SteamServer, server_connected, SteamServersConnected_t, callbackServerConnected); - STEAM_GAMESERVER_CALLBACK(SteamServer, server_disconnected, SteamServersDisconnected_t, callbackServerDisconnected); - STEAM_GAMESERVER_CALLBACK(SteamServer, client_approved, GSClientApprove_t, callbackClientApproved); - STEAM_GAMESERVER_CALLBACK(SteamServer, client_denied, GSClientDeny_t, callbackClientDenied); - STEAM_GAMESERVER_CALLBACK(SteamServer, client_kick, GSClientKick_t, callbackClientKicked); - STEAM_GAMESERVER_CALLBACK(SteamServer, policy_response, GSPolicyResponse_t, callbackPolicyResponse); - STEAM_GAMESERVER_CALLBACK(SteamServer, client_group_status, GSClientGroupStatus_t, callbackClientGroupStatus); - STEAM_GAMESERVER_CALLBACK(SteamServer, associate_clan, AssociateWithClanResult_t, callbackAssociateClan); - STEAM_GAMESERVER_CALLBACK(SteamServer, player_compat, ComputeNewPlayerCompatibilityResult_t, callbackPlayerCompat); - - // Game Server Stat callbacks /////////// - STEAM_GAMESERVER_CALLBACK(SteamServer, stats_stored, GSStatsStored_t, callbackStatsStored); - STEAM_GAMESERVER_CALLBACK(SteamServer, stats_unloaded, GSStatsUnloaded_t, callbackStatsUnloaded); - - // HTTP callbacks /////////////////////// - STEAM_GAMESERVER_CALLBACK(SteamServer, http_request_completed, HTTPRequestCompleted_t, callbackHTTPRequestCompleted); - STEAM_GAMESERVER_CALLBACK(SteamServer, http_request_data_received, HTTPRequestDataReceived_t, callbackHTTPRequestDataReceived); - STEAM_GAMESERVER_CALLBACK(SteamServer, http_request_headers_received, HTTPRequestHeadersReceived_t, callbackHTTPRequestHeadersReceived); - - // Inventory callbacks ////////////////// - STEAM_GAMESERVER_CALLBACK(SteamServer, inventory_definition_update, SteamInventoryDefinitionUpdate_t, callbackInventoryDefinitionUpdate); - STEAM_GAMESERVER_CALLBACK(SteamServer, inventory_full_update, SteamInventoryFullUpdate_t, callbackInventoryFullUpdate); - STEAM_GAMESERVER_CALLBACK(SteamServer, inventory_result_ready, SteamInventoryResultReady_t, callbackInventoryResultReady); - - // Networking callbacks ///////////////// - STEAM_GAMESERVER_CALLBACK(SteamServer, p2p_session_connect_fail, P2PSessionConnectFail_t, callbackP2PSessionConnectFail); - STEAM_GAMESERVER_CALLBACK(SteamServer, p2p_session_request, P2PSessionRequest_t, callbackP2PSessionRequest); - - // Networking Messages callbacks //////// - STEAM_GAMESERVER_CALLBACK(SteamServer, network_messages_session_request, SteamNetworkingMessagesSessionRequest_t, callbackNetworkMessagesSessionRequest); - STEAM_GAMESERVER_CALLBACK(SteamServer, network_messages_session_failed, SteamNetworkingMessagesSessionFailed_t, callbackNetworkMessagesSessionFailed); - - // Networking Sockets callbacks ///////// - STEAM_GAMESERVER_CALLBACK(SteamServer, network_connection_status_changed, SteamNetConnectionStatusChangedCallback_t, callbackNetworkConnectionStatusChanged); - STEAM_GAMESERVER_CALLBACK(SteamServer, network_authentication_status, SteamNetAuthenticationStatus_t, callbackNetworkAuthenticationStatus); - STEAM_GAMESERVER_CALLBACK(SteamServer, fake_ip_result, SteamNetworkingFakeIPResult_t, callbackNetworkingFakeIPResult); - - // Networking Utils callbacks /////////// - STEAM_GAMESERVER_CALLBACK(SteamServer, relay_network_status, SteamRelayNetworkStatus_t, callbackRelayNetworkStatus); - - // Remote Storage callbacks ///////////// - STEAM_GAMESERVER_CALLBACK(SteamServer, local_file_changed, RemoteStorageLocalFileChange_t, callbackLocalFileChanged); - - // UGC callbacks //////////////////////// - STEAM_GAMESERVER_CALLBACK(SteamServer, item_downloaded, DownloadItemResult_t, callbackItemDownloaded); - STEAM_GAMESERVER_CALLBACK(SteamServer, item_installed, ItemInstalled_t, callbackItemInstalled); - STEAM_GAMESERVER_CALLBACK(SteamServer, user_subscribed_items_list_changed, UserSubscribedItemsListChanged_t, callbackUserSubscribedItemsListChanged); - - - ///////////////////////////////////////// - // STEAM CALL RESULTS /////////////////// - ///////////////////////////////////////// - // - // Game Server Stats call results /////// - CCallResult callResultStatReceived; - void stats_received(GSStatsReceived_t *call_data, bool io_failure); - - // Inventory call results /////////////// - CCallResult callResultEligiblePromoItemDefIDs; - void inventory_eligible_promo_item(SteamInventoryEligiblePromoItemDefIDs_t *call_data, bool io_failure); - CCallResult callResultRequestPrices; - void inventory_request_prices_result(SteamInventoryRequestPricesResult_t *call_data, bool io_failure); - CCallResult callResultStartPurchase; - void inventory_start_purchase_result(SteamInventoryStartPurchaseResult_t *call_data, bool io_failure); - - // Remote Storage call results ////////// - CCallResult callResultFileReadAsyncComplete; - void file_read_async_complete(RemoteStorageFileReadAsyncComplete_t *call_data, bool io_failure); - CCallResult callResultFileShareResult; - void file_share_result(RemoteStorageFileShareResult_t *call_data, bool io_failure); - CCallResult callResultFileWriteAsyncComplete; - void file_write_async_complete(RemoteStorageFileWriteAsyncComplete_t *call_data, bool io_failure); - CCallResult callResultDownloadUGCResult; - void download_ugc_result(RemoteStorageDownloadUGCResult_t *call_data, bool io_failure); - CCallResult callResultUnsubscribeItem; - void unsubscribe_item(RemoteStorageUnsubscribePublishedFileResult_t *call_data, bool io_failure); - CCallResult callResultSubscribeItem; - void subscribe_item(RemoteStorageSubscribePublishedFileResult_t *call_data, bool io_failure); - - // UGC call results ///////////////////// - CCallResult callResultAddAppDependency; - void add_app_dependency_result(AddAppDependencyResult_t *call_data, bool io_failure); - CCallResult callResultAddUGCDependency; - void add_ugc_dependency_result(AddUGCDependencyResult_t *call_data, bool io_failure); - CCallResult callResultItemCreate; - void item_created(CreateItemResult_t *call_data, bool io_failure); - CCallResult callResultGetAppDependencies; - void get_app_dependencies_result(GetAppDependenciesResult_t *call_data, bool io_failure); - CCallResult callResultDeleteItem; - void item_deleted(DeleteItemResult_t *call_data, bool io_failure); - CCallResult callResultGetUserItemVote; - void get_item_vote_result(GetUserItemVoteResult_t *call_data, bool io_failure); - CCallResult callResultRemoveAppDependency; - void remove_app_dependency_result(RemoveAppDependencyResult_t *call_data, bool io_failure); - CCallResult callResultRemoveUGCDependency; - void remove_ugc_dependency_result(RemoveUGCDependencyResult_t *call_data, bool io_failure); - CCallResult callResultSetUserItemVote; - void set_user_item_vote(SetUserItemVoteResult_t *call_data, bool io_failure); - CCallResult callResultStartPlaytimeTracking; - void start_playtime_tracking(StartPlaytimeTrackingResult_t *call_data, bool io_failure); - CCallResult callResultUGCQueryCompleted; - void ugc_query_completed(SteamUGCQueryCompleted_t *call_data, bool io_failure); - CCallResult callResultStopPlaytimeTracking; - void stop_playtime_tracking(StopPlaytimeTrackingResult_t *call_data, bool io_failure); - CCallResult callResultItemUpdate; - void item_updated(SubmitItemUpdateResult_t *call_data, bool io_failure); - CCallResult callResultFavoriteItemListChanged; - void user_favorite_items_list_changed(UserFavoriteItemsListChanged_t *call_data, bool io_failure); - CCallResult callResultWorkshopEULAStatus; - void workshop_eula_status(WorkshopEULAStatus_t *call_data, bool io_failure); + + // Run the Steamworks server API callbacks + void run_callbacks(){ + SteamGameServer_RunCallbacks(); + } + + + // STEAM SERVER CALLBACKS + ///////////////////////////////////////// + // + // Game Server callbacks //////////////// + STEAM_GAMESERVER_CALLBACK(SteamServer, server_connect_failure, SteamServerConnectFailure_t, callbackServerConnectFailure); + STEAM_GAMESERVER_CALLBACK(SteamServer, server_connected, SteamServersConnected_t, callbackServerConnected); + STEAM_GAMESERVER_CALLBACK(SteamServer, server_disconnected, SteamServersDisconnected_t, callbackServerDisconnected); + STEAM_GAMESERVER_CALLBACK(SteamServer, client_approved, GSClientApprove_t, callbackClientApproved); + STEAM_GAMESERVER_CALLBACK(SteamServer, client_denied, GSClientDeny_t, callbackClientDenied); + STEAM_GAMESERVER_CALLBACK(SteamServer, client_kick, GSClientKick_t, callbackClientKicked); + STEAM_GAMESERVER_CALLBACK(SteamServer, policy_response, GSPolicyResponse_t, callbackPolicyResponse); + STEAM_GAMESERVER_CALLBACK(SteamServer, client_group_status, GSClientGroupStatus_t, callbackClientGroupStatus); + STEAM_GAMESERVER_CALLBACK(SteamServer, associate_clan, AssociateWithClanResult_t, callbackAssociateClan); + STEAM_GAMESERVER_CALLBACK(SteamServer, player_compat, ComputeNewPlayerCompatibilityResult_t, callbackPlayerCompat); + + // Game Server Stat callbacks /////////// + STEAM_GAMESERVER_CALLBACK(SteamServer, stats_stored, GSStatsStored_t, callbackStatsStored); + STEAM_GAMESERVER_CALLBACK(SteamServer, stats_unloaded, GSStatsUnloaded_t, callbackStatsUnloaded); + + // HTTP callbacks /////////////////////// + STEAM_GAMESERVER_CALLBACK(SteamServer, http_request_completed, HTTPRequestCompleted_t, callbackHTTPRequestCompleted); + STEAM_GAMESERVER_CALLBACK(SteamServer, http_request_data_received, HTTPRequestDataReceived_t, callbackHTTPRequestDataReceived); + STEAM_GAMESERVER_CALLBACK(SteamServer, http_request_headers_received, HTTPRequestHeadersReceived_t, callbackHTTPRequestHeadersReceived); + + // Inventory callbacks ////////////////// + STEAM_GAMESERVER_CALLBACK(SteamServer, inventory_definition_update, SteamInventoryDefinitionUpdate_t, callbackInventoryDefinitionUpdate); + STEAM_GAMESERVER_CALLBACK(SteamServer, inventory_full_update, SteamInventoryFullUpdate_t, callbackInventoryFullUpdate); + STEAM_GAMESERVER_CALLBACK(SteamServer, inventory_result_ready, SteamInventoryResultReady_t, callbackInventoryResultReady); + + // Networking callbacks ///////////////// + STEAM_GAMESERVER_CALLBACK(SteamServer, p2p_session_connect_fail, P2PSessionConnectFail_t, callbackP2PSessionConnectFail); + STEAM_GAMESERVER_CALLBACK(SteamServer, p2p_session_request, P2PSessionRequest_t, callbackP2PSessionRequest); + + // Networking Messages callbacks //////// + STEAM_GAMESERVER_CALLBACK(SteamServer, network_messages_session_request, SteamNetworkingMessagesSessionRequest_t, callbackNetworkMessagesSessionRequest); + STEAM_GAMESERVER_CALLBACK(SteamServer, network_messages_session_failed, SteamNetworkingMessagesSessionFailed_t, callbackNetworkMessagesSessionFailed); + + // Networking Sockets callbacks ///////// + STEAM_GAMESERVER_CALLBACK(SteamServer, network_connection_status_changed, SteamNetConnectionStatusChangedCallback_t, callbackNetworkConnectionStatusChanged); + STEAM_GAMESERVER_CALLBACK(SteamServer, network_authentication_status, SteamNetAuthenticationStatus_t, callbackNetworkAuthenticationStatus); + STEAM_GAMESERVER_CALLBACK(SteamServer, fake_ip_result, SteamNetworkingFakeIPResult_t, callbackNetworkingFakeIPResult); + + // Networking Utils callbacks /////////// + STEAM_GAMESERVER_CALLBACK(SteamServer, relay_network_status, SteamRelayNetworkStatus_t, callbackRelayNetworkStatus); + + // Remote Storage callbacks ///////////// + STEAM_GAMESERVER_CALLBACK(SteamServer, local_file_changed, RemoteStorageLocalFileChange_t, callbackLocalFileChanged); + + // UGC callbacks //////////////////////// + STEAM_GAMESERVER_CALLBACK(SteamServer, item_downloaded, DownloadItemResult_t, callbackItemDownloaded); + STEAM_GAMESERVER_CALLBACK(SteamServer, item_installed, ItemInstalled_t, callbackItemInstalled); + STEAM_GAMESERVER_CALLBACK(SteamServer, user_subscribed_items_list_changed, UserSubscribedItemsListChanged_t, callbackUserSubscribedItemsListChanged); + + + // STEAM CALL RESULTS + ///////////////////////////////////////// + // + // Game Server Stats call results /////// + CCallResult callResultStatReceived; + void stats_received(GSStatsReceived_t *call_data, bool io_failure); + + // Inventory call results /////////////// + CCallResult callResultEligiblePromoItemDefIDs; + void inventory_eligible_promo_item(SteamInventoryEligiblePromoItemDefIDs_t *call_data, bool io_failure); + CCallResult callResultRequestPrices; + void inventory_request_prices_result(SteamInventoryRequestPricesResult_t *call_data, bool io_failure); + CCallResult callResultStartPurchase; + void inventory_start_purchase_result(SteamInventoryStartPurchaseResult_t *call_data, bool io_failure); + + // Remote Storage call results ////////// + CCallResult callResultFileReadAsyncComplete; + void file_read_async_complete(RemoteStorageFileReadAsyncComplete_t *call_data, bool io_failure); + CCallResult callResultFileShareResult; + void file_share_result(RemoteStorageFileShareResult_t *call_data, bool io_failure); + CCallResult callResultFileWriteAsyncComplete; + void file_write_async_complete(RemoteStorageFileWriteAsyncComplete_t *call_data, bool io_failure); + CCallResult callResultDownloadUGCResult; + void download_ugc_result(RemoteStorageDownloadUGCResult_t *call_data, bool io_failure); + CCallResult callResultUnsubscribeItem; + void unsubscribe_item(RemoteStorageUnsubscribePublishedFileResult_t *call_data, bool io_failure); + CCallResult callResultSubscribeItem; + void subscribe_item(RemoteStorageSubscribePublishedFileResult_t *call_data, bool io_failure); + + // UGC call results ///////////////////// + CCallResult callResultAddAppDependency; + void add_app_dependency_result(AddAppDependencyResult_t *call_data, bool io_failure); + CCallResult callResultAddUGCDependency; + void add_ugc_dependency_result(AddUGCDependencyResult_t *call_data, bool io_failure); + CCallResult callResultItemCreate; + void item_created(CreateItemResult_t *call_data, bool io_failure); + CCallResult callResultGetAppDependencies; + void get_app_dependencies_result(GetAppDependenciesResult_t *call_data, bool io_failure); + CCallResult callResultDeleteItem; + void item_deleted(DeleteItemResult_t *call_data, bool io_failure); + CCallResult callResultGetUserItemVote; + void get_item_vote_result(GetUserItemVoteResult_t *call_data, bool io_failure); + CCallResult callResultRemoveAppDependency; + void remove_app_dependency_result(RemoveAppDependencyResult_t *call_data, bool io_failure); + CCallResult callResultRemoveUGCDependency; + void remove_ugc_dependency_result(RemoveUGCDependencyResult_t *call_data, bool io_failure); + CCallResult callResultSetUserItemVote; + void set_user_item_vote(SetUserItemVoteResult_t *call_data, bool io_failure); + CCallResult callResultStartPlaytimeTracking; + void start_playtime_tracking(StartPlaytimeTrackingResult_t *call_data, bool io_failure); + CCallResult callResultUGCQueryCompleted; + void ugc_query_completed(SteamUGCQueryCompleted_t *call_data, bool io_failure); + CCallResult callResultStopPlaytimeTracking; + void stop_playtime_tracking(StopPlaytimeTrackingResult_t *call_data, bool io_failure); + CCallResult callResultItemUpdate; + void item_updated(SubmitItemUpdateResult_t *call_data, bool io_failure); + CCallResult callResultFavoriteItemListChanged; + void user_favorite_items_list_changed(UserFavoriteItemsListChanged_t *call_data, bool io_failure); + CCallResult callResultWorkshopEULAStatus; + void workshop_eula_status(WorkshopEULAStatus_t *call_data, bool io_failure); }; VARIANT_ENUM_CAST(SteamServer::AccountType); VARIANT_ENUM_CAST(SteamServer::AuthSessionResponse); -VARIANT_ENUM_CAST(SteamServer::AvatarSizes); VARIANT_ENUM_CAST(SteamServer::BeginAuthSessionResult); -VARIANT_ENUM_CAST(SteamServer::CommunityProfileItemProperty); -VARIANT_ENUM_CAST(SteamServer::CommunityProfileItemType); - VARIANT_ENUM_CAST(SteamServer::DenyReason); VARIANT_ENUM_CAST(SteamServer::FilePathType); -VARIANT_ENUM_CAST(SteamServer::FriendFlags); -VARIANT_ENUM_CAST(SteamServer::FriendRelationship); VARIANT_ENUM_CAST(SteamServer::GameIDType); VARIANT_ENUM_CAST(SteamServer::HTTPMethod); VARIANT_ENUM_CAST(SteamServer::HTTPStatusCode); +VARIANT_ENUM_CAST(SteamServer::IPType); VARIANT_ENUM_CAST(SteamServer::ItemFlags); VARIANT_ENUM_CAST(SteamServer::ItemPreviewType); VARIANT_ENUM_CAST(SteamServer::ItemState); @@ -1373,13 +1247,8 @@ VARIANT_ENUM_CAST(SteamServer::NetworkingGetConfigValueResult); VARIANT_ENUM_CAST(SteamServer::NetworkingIdentityType); VARIANT_ENUM_CAST(SteamServer::NetworkingSocketsDebugOutputType); -VARIANT_ENUM_CAST(SteamServer::OverlayToStoreFlag); -VARIANT_ENUM_CAST(SteamServer::OverlayToWebPageMode); - VARIANT_ENUM_CAST(SteamServer::P2PSend); VARIANT_ENUM_CAST(SteamServer::P2PSessionError); -VARIANT_ENUM_CAST(SteamServer::PersonaChange); -VARIANT_ENUM_CAST(SteamServer::PersonaState); VARIANT_ENUM_CAST(SteamServer::RemoteStoragePlatform); VARIANT_ENUM_CAST(SteamServer::RemoteStoragePublishedFileVisibility); @@ -1395,7 +1264,6 @@ VARIANT_ENUM_CAST(SteamServer::UGCMatchingUGCType); VARIANT_ENUM_CAST(SteamServer::UGCQuery); VARIANT_ENUM_CAST(SteamServer::UGCReadAction); VARIANT_ENUM_CAST(SteamServer::Universe); -VARIANT_ENUM_CAST(SteamServer::UserRestriction); VARIANT_ENUM_CAST(SteamServer::UserUGCList); VARIANT_ENUM_CAST(SteamServer::UserUGCListSortOrder); @@ -1405,4 +1273,5 @@ VARIANT_ENUM_CAST(SteamServer::WorkshopFileType); VARIANT_ENUM_CAST(SteamServer::WorkshopVideoProvider); VARIANT_ENUM_CAST(SteamServer::WorkshopVote); + #endif // GODOTSTEAM_SERVER_H \ No newline at end of file diff --git a/godotsteam_server_constants.h b/godotsteam_server_constants.h index 842c641..745db05 100644 --- a/godotsteam_server_constants.h +++ b/godotsteam_server_constants.h @@ -2,6 +2,8 @@ #include "steam/steam_api.h" // Define Steam API constants +// Constants with 'deprecated/': these were listed in the SDK docs but do not exist in the header files; safe to remove probably +// Possibly deprecated or never existed? #define ACCOUNT_ID_INVALID k_uAccountIdInvalid #define API_CALL_INVALID k_uAPICallInvalid #define APP_ID_INVALID k_uAppIdInvalid @@ -31,16 +33,55 @@ #define INVENTORY_RESULT_INVALID k_SteamInventoryResultInvalid #define ITEM_INSTANCE_ID_INVALID k_SteamItemInstanceIDInvalid -// Define Networking Message constants -#define NETWORKING_SEND_AUTO_RESTART_BROKEN_SESSION k_nSteamNetworkingSend_AutoRestartBrokenSession -#define NETWORKING_SEND_NO_DELAY k_EP2PSendReliable -#define NETWORKING_SEND_NO_NAGLE k_EP2PSendUnreliableNoDelay -#define NETWORKING_SEND_RELIABLE k_EP2PSendReliableWithBuffering -#define NETWORKING_SEND_UNRELIABLE k_EP2PSendUnreliable - // Define Networking Socket constants #define MAX_STEAM_PACKET_SIZE k_cbMaxSteamNetworkingSocketsMessageSizeSend +// Define Networking Types constants | Found in steamnetworkingtypes.h +#define LISTEN_SOCKET_INVALID k_HSteamListenSocket_Invalid +#define MAX_NETWORKING_ERROR_MESSAGE k_cchMaxSteamNetworkingErrMsg +#define MAX_NETWORKING_PING_LOCATION_STRING k_cchMaxSteamNetworkingPingLocationString +#define NETWORKING_CONFIG_P2P_TRANSPORT_ICE_DEFAULT k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Default +#define NETWORKING_CONFIG_P2P_TRANSPORT_ICE_DISABLE k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Disable +#define NETWORKING_CONFIG_P2P_TRANSPORT_ICE_RELAY k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Relay +#define NETWORKING_CONFIG_P2P_TRANSPORT_ICE_PRIVATE k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Private +#define NETWORKING_CONFIG_P2P_TRANSPORT_ICE_PUBLIC k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Public +#define NETWORKING_CONFIG_P2P_TRANSPORT_ICE_ALL k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_All +#define NETWORKING_CONNECTION_INFO_FLAG_UNAUTHENTICATED k_nSteamNetworkConnectionInfoFlags_Unauthenticated +#define NETWORKING_CONNECTION_INFO_FLAG_UNENCRYPTED k_nSteamNetworkConnectionInfoFlags_Unencrypted +#define NETWORKING_CONNECTION_INFO_FLAG_LOOPBACK_BUFFERS k_nSteamNetworkConnectionInfoFlags_LoopbackBuffers +#define NETWORKING_CONNECTION_INFO_FLAG_FAST k_nSteamNetworkConnectionInfoFlags_Fast +#define NETWORKING_CONNECTION_INFO_FLAG_RELAYED k_nSteamNetworkConnectionInfoFlags_Relayed +#define NETWORKING_CONNECTION_INFO_FLAG_DUALWIFI k_nSteamNetworkConnectionInfoFlags_DualWifi +#define NETWORKING_CONNECTION_INVALID k_HSteamNetConnection_Invalid +#define NETWORKING_MAX_CONNECTION_APP_NAME k_cchSteamNetworkingMaxConnectionAppName +#define NETWORKING_MAX_CONNECTION_CLOSE_REASON k_cchSteamNetworkingMaxConnectionCloseReason +#define NETWORKING_MAX_CONNECTION_DESCRIPTION k_cchSteamNetworkingMaxConnectionDescription +#define NETWORKING_PING_FAILED k_nSteamNetworkingPing_Failed +#define NETWORKING_PING_UNKNOWN k_nSteamNetworkingPing_Unknown +#define NETWORKING_SEND_UNRELIABLE k_nSteamNetworkingSend_Unreliable +#define NETWORKING_SEND_NO_NAGLE k_nSteamNetworkingSend_NoNagle +#define NETWORKING_SEND_URELIABLE_NO_NAGLE k_nSteamNetworkingSend_UnreliableNoNagle +#define NETWORKING_SEND_NO_DELAY k_nSteamNetworkingSend_NoDelay +#define NETWORKING_SEND_UNRELIABLE_NO_DELAY k_nSteamNetworkingSend_UnreliableNoDelay +#define NETWORKING_SEND_RELIABLE k_nSteamNetworkingSend_Reliable +#define NETWORKING_SEND_RELIABLE_NO_NAGLE k_nSteamNetworkingSend_ReliableNoNagle +#define NETWORKING_SEND_USE_CURRENT_THREAD k_nSteamNetworkingSend_UseCurrentThread +#define NETWORKING_SEND_AUTORESTART_BROKEN_SESSION k_nSteamNetworkingSend_AutoRestartBrokenSession + +// Define Remote Storage constants +#define ENUMERATE_PUBLISHED_FILES_MAX_RESULTS k_unEnumeratePublishedFilesMaxResults +#define FILE_NAME_MAX k_cchFilenameMax +#define MAX_CLOUD_FILE_CHUNK_SIZE k_unMaxCloudFileChunkSize +#define PUBLISHED_DOCUMENT_CHANGE_DESCRIPTION_MAX k_cchPublishedDocumentChangeDescriptionMax +#define PUBLISHED_DOCUMENT_DESCRIPTION_MAX k_cchPublishedDocumentDescriptionMax +#define PUBLISHED_DOCUMENT_TITLE_MAX k_cchPublishedDocumentTitleMax +#define PUBLISHED_FILE_ID_INVALID k_PublishedFileIdInvalid +#define PUBLISHED_FILE_UPDATE_HANDLE_INVALID k_PublishedFileUpdateHandleInvalid +#define PUBLISHED_FILE_URL_MAX k_cchPublishedFileURLMax +#define TAG_LIST_MAX k_cchTagListMax +#define UGC_FILE_STREAM_HANDLE_INVALID k_UGCFileStreamHandleInvalid +#define UGC_HANDLE_INVALID k_UGCHandleInvalid + // Define UGC constants #define DEVELOPER_METADATA_MAX k_cchDeveloperMetadataMax #define NUM_UGC_RESULTS_PER_PAGE kNumUGCResultsPerPage