Compare commits

...

12 Commits

Author SHA1 Message Date
Nemirtingas
2fe755d9d4 Merge branch 'use_cross_compilers_and_vcpkg' into 'master'
Use cross compilers and vcpkg

See merge request Mr_Goldberg/goldberg_emulator!35
2021-02-08 13:36:41 +00:00
Mr_Goldberg
bfa1e95f7b
Use the same interface for both enabled and disabled controller builds. 2021-02-07 19:09:48 -05:00
Mr_Goldberg
69d5facf4f
Cleanup steamclient loader a bit. 2021-02-07 19:05:22 -05:00
Mr_Goldberg
5f8a454e3f
Fixed mouse getting stuck in the middle of the overlay in some games. 2021-02-06 22:38:51 -05:00
Mr_Goldberg
6dfe11503b
Dll loading feature now only tries loading .dll files. 2021-02-06 22:37:59 -05:00
Nemirtingas
4f5d281822 Merge branch 'master' into 'use_cross_compilers_and_vcpkg'
# Conflicts:
#   build_win_debug_experimental_steamclient.bat
2021-01-19 06:33:49 +00:00
Nemirtingas
91031df89b Build curl with only core http and https. 2020-10-14 13:21:40 +02:00
Nemirtingas
bda70f5fd1 Add Big-O libsteam_api.
Big-O are libraries on MacOS that contains both 32 and 64bits variants.
2020-10-14 08:05:13 +02:00
Nemirtingas
1af9715dec Fix prefix 2020-10-14 06:53:57 +02:00
Nemirtingas
bf012e6390 Implementations for MacOS support. 2020-10-14 06:44:44 +02:00
Nemirtingas
0a4fdf1f69 Use cross-compilation docker images. 2020-10-14 06:44:04 +02:00
Nemirtingas
7ad4fc1fdf Change includes for nlohmann libs. 2020-10-14 06:43:33 +02:00
26 changed files with 756 additions and 823 deletions

View File

@ -4,6 +4,205 @@ stages:
- deploy
- page_deploy
static:linux:deps:
stage: dependencies
image: nemirtingas/linux_vcpkg:ubuntu18
#when: manual
script:
- apt update && apt -y install libgl1-mesa-dev libgl1-mesa-dev:i386
- cp -f vcpkg_triplets/*.cmake /vcpkg/triplets/
- VCPKG_PATH=$(pwd)/vcpkg
- TRIPLET=x86-linux-goldberg
- vcpkg "--x-install-root=${VCPKG_PATH}" install protobuf[zlib]:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install curl[core,openssl]:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install stb:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install glew:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install nlohmann-json:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install nlohmann-fifo-map:${TRIPLET} || exit 1
- TRIPLET=x64-linux-goldberg
- vcpkg "--x-install-root=${VCPKG_PATH}" install protobuf[zlib]:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install curl[core,openssl]:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install stb:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install glew:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install nlohmann-json:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install nlohmann-fifo-map:${TRIPLET} || exit 1
- exit 0
cache:
key: static-linux-deps-cache
paths:
- vcpkg
artifacts:
paths:
- vcpkg
expire_in: 1 day
static:windows:deps:
stage: dependencies
image: nemirtingas/windowscross_vcpkg:msvc2019
#when: manual
script:
- VCPKG_PATH=$(pwd)/vcpkg
- cp -f vcpkg_triplets/*.cmake /vcpkg/triplets/
- TRIPLET=x64-linux
- vcpkg "--x-install-root=${VCPKG_PATH}" install protobuf:${TRIPLET} || exit 1
- TRIPLET=x86-windows-goldberg
- vcpkg "--x-install-root=${VCPKG_PATH}" install protobuf[zlib]:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install curl[core,winssl]:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install stb:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install glew:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install nlohmann-json:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install nlohmann-fifo-map:${TRIPLET} || exit 1
- TRIPLET=x64-windows-goldberg
- vcpkg "--x-install-root=${VCPKG_PATH}" install protobuf[zlib]:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install curl[core,winssl]:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install stb:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install glew:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install nlohmann-json:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install nlohmann-fifo-map:${TRIPLET} || exit 1
- exit 0
cache:
key: static-windows-deps-cache
paths:
- vcpkg
artifacts:
paths:
- vcpkg
expire_in: 1 day
static:macosx:deps:
stage: dependencies
image: nemirtingas/osxcross_vcpkg:SDK10.13
#when: manual
script:
- VCPKG_PATH=$(pwd)/vcpkg
- cp -f vcpkg_triplets/*.cmake /vcpkg/triplets/
- TRIPLET=x64-linux
- vcpkg "--x-install-root=${VCPKG_PATH}" install protobuf:${TRIPLET} || exit 1
- TRIPLET=x86-macosx-goldberg
- vcpkg "--x-install-root=${VCPKG_PATH}" install protobuf[zlib]:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install curl[core,openssl]:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install stb:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install nlohmann-json:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install nlohmann-fifo-map:${TRIPLET} || exit 1
- TRIPLET=x64-macosx-goldberg
- vcpkg "--x-install-root=${VCPKG_PATH}" install protobuf[zlib]:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install curl[core,openssl]:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install stb:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install nlohmann-json:${TRIPLET} || exit 1
- vcpkg "--x-install-root=${VCPKG_PATH}" install nlohmann-fifo-map:${TRIPLET} || exit 1
- exit 0
cache:
key: static-macosx-deps-cache
paths:
- vcpkg/
artifacts:
paths:
- vcpkg/
expire_in: 1 day
build:linux:
stage: build
image: nemirtingas/linux_vcpkg:ubuntu18
dependencies:
- static:linux:deps
needs:
- static:linux:deps
script:
- apt update && apt -y install libgl1-mesa-dev libgl1-mesa-dev:i386
- cp -f vcpkg_triplets/*.cmake /vcpkg/triplets/
- VCPKG_PATH=$(pwd)/vcpkg
- TOOLCHAIN="/vcpkg/scripts/buildsystems/vcpkg.cmake"
- TRIPLET=x86-linux-goldberg
- OUT=linux32/Release
- cmake -G Ninja -Wno-dev -DX86=ON -DCMAKE_BUILD_TYPE=Release "-DVCPKG_TARGET_TRIPLET=${TRIPLET}" "-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}" "-D_VCPKG_INSTALLED_DIR=${VCPKG_PATH}" -S . -B "${OUT}"
- cmake --build "${OUT}"
- cmake --install "${OUT}"
- TRIPLET=x64-linux-goldberg
- OUT=linux64/Release
- cmake -G Ninja -Wno-dev -DX64=ON -DCMAKE_BUILD_TYPE=Release "-DVCPKG_TARGET_TRIPLET=${TRIPLET}" "-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}" "-D_VCPKG_INSTALLED_DIR=${VCPKG_PATH}" -S . -B "${OUT}"
- cmake --build "${OUT}"
- cmake --install "${OUT}"
- exit 0
artifacts:
paths:
- release/
- debug/
expire_in: 1 day
build:windows:
stage: build
image: nemirtingas/windowscross_vcpkg:msvc2019
dependencies:
- static:windows:deps
needs:
- static:windows:deps
script:
- cp -f vcpkg_triplets/*.cmake /vcpkg/triplets/
- VCPKG_PATH=$(pwd)/vcpkg
- TOOLCHAIN="/vcpkg/scripts/buildsystems/vcpkg.cmake"
- CHAINLOAD="/clang_windows_sdk/clang-cl-msvc.cmake"
- export HOST_ARCH=x86
- TRIPLET=x86-windows-goldberg
- OUT=win32/Release
- cmake -G Ninja -Wno-dev -DX86=ON -DCMAKE_BUILD_TYPE=Release "-DVCPKG_TARGET_TRIPLET=${TRIPLET}" "-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${CHAINLOAD}" "-D_VCPKG_INSTALLED_DIR=${VCPKG_PATH}" -S . -B "${OUT}"
- cmake --build "${OUT}"
- cmake --install "${OUT}"
- export HOST_ARCH=x64
- TRIPLET=x64-windows-goldberg
- OUT=win64/Release
- cmake -G Ninja -Wno-dev -DX64=ON -DCMAKE_BUILD_TYPE=Release "-DVCPKG_TARGET_TRIPLET=${TRIPLET}" "-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${CHAINLOAD}" "-D_VCPKG_INSTALLED_DIR=${VCPKG_PATH}" -S . -B "${OUT}"
- cmake --build "${OUT}"
- cmake --install "${OUT}"
artifacts:
paths:
- release/
- debug/
expire_in: 1 day
build:macosx:
stage: build
image: nemirtingas/osxcross_vcpkg:SDK10.13
dependencies:
- static:macosx:deps
needs:
- static:macosx:deps
script:
- cp -f vcpkg_triplets/*.cmake /vcpkg/triplets/
- VCPKG_PATH=$(pwd)/vcpkg
- TOOLCHAIN="/vcpkg/scripts/buildsystems/vcpkg.cmake"
- CHAINLOAD="/osxcross/target/toolchain.cmake"
- export OSXCROSS_HOST=i386-apple-${OSXCROSS_TARGET}
- TRIPLET=x86-macosx-goldberg
- OUT=macosx32/Release
- cmake -G Ninja -Wno-dev -DX86=ON -DCMAKE_BUILD_TYPE=Release "-DVCPKG_TARGET_TRIPLET=${TRIPLET}" "-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${CHAINLOAD}" "-D_VCPKG_INSTALLED_DIR=${VCPKG_PATH}" -S . -B "${OUT}"
- cmake --build "${OUT}"
- cmake --install "${OUT}"
- export OSXCROSS_HOST=x86_64-apple-${OSXCROSS_TARGET}
- TRIPLET=x64-macosx-goldberg
- OUT=macosx64/Release
- cmake -G Ninja -Wno-dev -DX64=ON -DCMAKE_BUILD_TYPE=Release "-DVCPKG_TARGET_TRIPLET=${TRIPLET}" "-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${CHAINLOAD}" "-D_VCPKG_INSTALLED_DIR=${VCPKG_PATH}" -S . -B "${OUT}"
- cmake --build "${OUT}"
- cmake --install "${OUT}"
- mkdir release/macosx
- x86_64-apple-${OSXCROSS_TARGET}-lipo -create release/macosx*/steamclient.dylib -output release/macosx/steamclient.dylib
- x86_64-apple-${OSXCROSS_TARGET}-lipo -create release/macosx*/libsteam_api.dylib -output release/macosx/libsteam_api.dylib
artifacts:
paths:
- release/
- debug/
expire_in: 1 day
protobuf_static_steamos:
stage: dependencies
image: tianon/steamos
@ -39,6 +238,8 @@ build_steamos:
image: tianon/steamos
dependencies:
- protobuf_static_steamos
needs:
- protobuf_static_steamos
before_script:
- apt update && apt -y install gcc-4.9 g++-4.9 git libtool g++-4.9-multilib gcc-4.9-multilib
@ -57,6 +258,8 @@ build_steamos:
build_windows:
stage: build
image: fedora:29
needs:
- protobuf_static_steamos
script:
- dnf -y install wine wget p7zip sed dos2unix
@ -94,66 +297,6 @@ build_windows:
- release/
expire_in: 1 day
build_cmake_linux:
stage: build
image: ubuntu
when: manual
before_script:
- export DEBIAN_FRONTEND=noninteractive
- apt update -y
- apt install build-essential cmake libprotobuf-dev protobuf-compiler ninja-build -y
script:
- mkdir cmake-builds && cd cmake-builds
- mkdir x64-release && cd x64-release
- cmake ../../ -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="RelWithDebInfo" && ninja
- cd ..
# - mkdir x64-experimental-release && cd x64-experimental-release
# - cmake ../../ -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="RelWithDebInfo" -DEMU_EXPERIMENTAL_BUILD:BOOL=ON && ninja
# - cd ..
artifacts:
paths:
- cmake-builds/
expire_in: 1 day
build_cmake_windows:
stage: build
image: fedora:29
when: manual
before_script:
- dnf -y install wine wget p7zip sed dos2unix unzip
- wget 'https://gitlab.com/Mr_Goldberg/goldberg_emulator/uploads/48db8f434a193aae872279dc4f5dde6a/sdk_standalone.7z'
- 7za x sdk_standalone.7z -osdk_standalone
- wget 'https://github.com/Kitware/CMake/releases/download/v3.15.0-rc1/cmake-3.15.0-rc1-win64-x64.zip'
- 7za x cmake-3.15.0-rc1-win64-x64.zip
- wget 'https://gitlab.com/Mr_Goldberg/goldberg_emulator/uploads/0119304e030098b4821d73170fe52084/protobuf_x64-windows-static.7z'
- 7za x protobuf_x64-windows-static.7z -oprotobuf_x64-windows-static
script:
- export WINEDEBUG=-all
- wine cmd /c
- mkdir cmake-builds && cd cmake-builds
- mkdir x64-release && cd x64-release
- echo call .\\..\\..\\sdk_standalone\\set_vars64.bat >> cmake-build.bat
- echo .\\..\\..\\cmake-3.15.0-rc1-win64-x64\\bin\\cmake.exe ..\\.. -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE:STRING="RelWithDebInfo" -DCMAKE_PREFIX_PATH="protobuf_x64-windows-static" -DProtobuf_PROTOC_EXECUTABLE:STRING="./../../protobuf_x64-windows-static/tools/protobuf/protoc.exe" >> cmake-build.bat
- echo nmake.exe >> cmake-build.bat
- wine cmd /c cmake-build.bat
- cd ..
- mkdir x64-experimental-release && cd x64-experimental-release
- echo call .\\..\\..\\sdk_standalone\\set_vars64.bat >> cmake-build.bat
- echo .\\..\\..\\cmake-3.15.0-rc1-win64-x64\\bin\\cmake.exe ..\\.. -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE:STRING="RelWithDebInfo" -DEMU_EXPERIMENTAL_BUILD=ON -DEMU_OVERLAY=ON -DCMAKE_PREFIX_PATH="protobuf_x64-windows-static" -DProtobuf_PROTOC_EXECUTABLE:STRING="./../../protobuf_x64-windows-static/tools/protobuf/protoc.exe" >> cmake-build.bat
- echo nmake.exe >> cmake-build.bat
- wine cmd /c cmake-build.bat
- cd ..
artifacts:
paths:
- cmake-builds/
expire_in: 1 day
deploy_all:
stage: deploy
image: fedora

View File

@ -4,33 +4,182 @@ cmake_minimum_required(VERSION 3.6)
# Set the project name
project(goldberg_emulator)
if(MSVC)
# Set static environment (results in static compile flags) if Visual Studio is used (dynamic by default)
# Officially recommended solution: https://gitlab.kitware.com/cmake/community/wikis/FAQ#how-can-i-build-my-msvc-application-with-a-static-runtime
# Should be replaced by a better solution in the future: https://gitlab.kitware.com/cmake/cmake/merge_requests/3211
foreach(flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if(${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif(${flag_var} MATCHES "/MD")
endforeach(flag_var)
# Disable MSVC++ warning C4996: 'may be unsafe/disable deprecation'
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
# Workaround because cross-compiling with CMake + vcpkg fucks up this variable
# making the 'find_*' functions/macros somehow fail to find the right arch.
# There are conditions like
# CMAKE_SIZEOF_VOID_P = "4" then look for i386 libraries...
# or
# CMAKE_SIZEOF_VOID_P = "8" then look for x86_64 libraries...
if(X86 AND NOT X64)
set(CMAKE_SIZEOF_VOID_P "4")
elseif(X64 AND NOT X86)
set(CMAKE_SIZEOF_VOID_P "8")
else()
message(FATAL_ERROR "Please define either -DX86=ON or -DX64=ON")
endif()
# Add option to enable experimental build
option(EMU_EXPERIMENTAL_BUILD "Enable experimental build" OFF)
if(WIN32) # Setup some variables for Windows build
if(MSVC) # If building with MSVC
add_definitions(-D_CRT_SECURE_NO_WARNINGS) # Disable warning about strncpy_s and his friends
#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:\"msvcrtd.lib\"") # Disable this linkage
#set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NODEFAULTLIB:\"msvcrtd.lib\"") # Disable this linkage
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE) # Force to only build Debug & Release projects
set(CompilerFlags
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
)
foreach(CompilerFlag ${CompilerFlags})
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
endforeach()
endif()
if(X64)
set(LIB_STEAM_API steam_api64)
set(LIB_STEAMCLIENT steamclient64)
set(OUT_DIR win64)
elseif(X86)
set(LIB_STEAM_API steam_api)
set(LIB_STEAMCLIENT steamclient)
set(OUT_DIR win32)
else()
message(FATAL_ERROR "Arch unknown")
endif()
file(
GLOB
OVERLAY_EXPERIMENTAL_SRC_SHARED
overlay_experimental/*.cpp
overlay_experimental/windows/*.cpp
ImGui/*.cpp
ImGui/impls/*.cpp
ImGui/impls/windows/*.cpp
)
set(overlay_includes
overlay/
overlay/windows/
)
elseif(APPLE)
if(X64)
# Global flags for building steamapi (64bits)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m64")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m64")
#set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} -m64")
set(OUT_DIR macosx64)
elseif(X86)
# Global flags for building steamapi (32bits)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32")
#set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} -m32")
set(OUT_DIR macosx32)
else()
message(FATAL_ERROR "Arch unknown")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(LIB_STEAM_API steam_api)
set(LIB_STEAMCLIENT steamclient)
file(
GLOB
OVERLAY_EXPERIMENTAL_SRC_SHARED
overlay/*.cpp
)
set(overlay_includes
overlay/
)
elseif(UNIX)
if(X64)
# Global flags for building steamapi (64bits)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m64")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m64")
#set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} -m64")
set(OUT_DIR linux64)
elseif(X86)
# Global flags for building steamapi (32bits)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32")
#set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} -m32")
set(OUT_DIR linux32)
else()
message(FATAL_ERROR "Arch unknown")
endif()
set(LIB_STEAM_API steam_api)
set(LIB_STEAMCLIENT steamclient)
file(
GLOB
OVERLAY_EXPERIMENTAL_SRC_SHARED
overlay_experimental/*.cpp
overlay_experimental/linux/*.cpp
ImGui/*.cpp
ImGui/impls/*.cpp
ImGui/impls/linux/*.cpp
)
set(overlay_includes
overlay/
overlay/linux/
)
else()
message(FATAL_ERROR "No CMake for other platforms")
endif()
# Set CXX standard
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Find the protobuf compiler and libraries
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# Add option to enable experimental build
option(EMU_EXPERIMENTAL_BUILD "Enable experimental build" OFF)
if(EMU_EXPERIMENTAL_BUILD)
if(APPLE)
set(EMU_OVERLAY OFF)
else()
option(EMU_OVERLAY "Enable the emulator overlay" ON)
endif()
else()
set(EMU_OVERLAY OFF)
endif()
set(Protobuf_USE_STATIC_LIBS ON)
include(FindProtobuf)
find_package(Protobuf 3.1.0 REQUIRED)
find_package(Threads REQUIRED)
find_package(Protobuf CONFIG REQUIRED)
find_package(CURL CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
find_package(nlohmann-fifo-map CONFIG REQUIRED)
find_path(STB_INCLUDE_DIRS "stb.h")
if(NOT WIN32)
find_package(OpenSSL REQUIRED)
endif()
if(NOT APPLE)
find_package(GLEW REQUIRED)
endif()
# Generate the .h and .cxx files for dll/net.proto
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS dll/net.proto)
@ -38,34 +187,6 @@ protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS dll/net.proto)
# Print path to generated files
message(STATUS "PROTO_SRCS = ${PROTO_SRCS}")
message(STATUS "PROTO_HDRS = ${PROTO_HDRS}")
message(STATUS "PROTOBUF_INCLUDE_DIRS = ${PROTOBUF_INCLUDE_DIRS}")
message(STATUS "PROTOBUF_LIBRARIES = ${PROTOBUF_LIBRARIES}")
message(STATUS "PROTOBUF_PROTOC_EXECUTABLE = ${PROTOBUF_PROTOC_EXECUTABLE}")
# Setup the lib/exe names for the targets
if(WIN32)
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(LIB_STEAM_API steam_api64)
set(LIB_STEAMCLIENT steamclient64)
set(LIB_STEAMNETWORKINGSOCKETS steamnetworkingsockets64)
set(BIN_LOBBY_CONNECT lobby_connect64)
set(BIN_GENERATE_INTERFACES_FILE generate_interfaces_file64)
else()
set(LIB_STEAM_API steam_api)
set(LIB_STEAMCLIENT steamclient)
set(LIB_STEAMNETWORKINGSOCKETS steamnetworkingsockets)
set(BIN_LOBBY_CONNECT lobby_connect)
set(BIN_GENERATE_INTERFACES_FILE generate_interfaces_file)
endif()
elseif(UNIX AND NOT APPLE)
set(LIB_STEAM_API steam_api)
set(LIB_STEAMCLIENT steamclient)
set(LIB_STEAMNETWORKINGSOCKETS steamnetworkingsockets)
set(BIN_LOBBY_CONNECT lobby_connect)
set(BIN_GENERATE_INTERFACES_FILE generate_interfaces_file)
else()
message(FATAL_ERROR "Other platforms not supported...")
endif()
# Gather the files that are shared between multiple targets
file(GLOB DLL_SRC_SHARED
@ -77,84 +198,69 @@ file(GLOB DETOURS_SRC_SHARED
detours/*.cpp
)
if(WIN32)
file(GLOB OVERLAY_EXPERIMENTAL_SRC_SHARED
overlay_experimental/*.cpp
overlay_experimental/windows/*.cpp
ImGui/*.cpp
ImGui/impls/*.cpp
ImGui/impls/windows/*.cpp
glew/glew.c
)
elseif(UNIX)
file(GLOB OVERLAY_EXPERIMENTAL_SRC_SHARED
overlay_experimental/*.cpp
overlay_experimental/linux/*.cpp
ImGui/*.cpp
ImGui/impls/*.cpp
ImGui/impls/linux/*.cpp
glew/glew.c
)
endif()
###################################################
# Setup for the steam_api(64).dll / libsteam_api.so
###################################################
# Setup the target
add_library(${LIB_STEAM_API}
SHARED
SHARED
$<$<BOOL:${EMU_EXPERIMENTAL_BUILD}>:${DETOURS_SRC_SHARED}>
$<$<AND:$<BOOL:${EMU_EXPERIMENTAL_BUILD}>,$<BOOL:${EMU_OVERLAY}>>:${OVERLAY_EXPERIMENTAL_SRC_SHARED}>
${DLL_SRC_SHARED}
${PROTO_SRCS}
${PROTO_HDRS}
${DLL_SRC_SHARED}
${PROTO_SRCS}
${PROTO_HDRS}
)
# Include the required directories
target_include_directories(${LIB_STEAM_API}
PRIVATE
${PROTOBUF_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/ImGui
${CMAKE_CURRENT_SOURCE_DIR}/glew/include
target_include_directories(
${LIB_STEAM_API}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
${STB_INCLUDE_DIRS}
overlay_experimental
)
# Link the required libraries
target_link_libraries(${LIB_STEAM_API}
PRIVATE
protobuf::libprotobuf
Threads::Threads
protobuf::libprotobuf-lite
#nlohmann_json::nlohmann_json doesn't work
nlohmann-fifo-map::nlohmann-fifo-map
$<$<NOT:$<BOOL:${APPLE}>>:GLEW::GLEW>
$<$<BOOL:${WIN32}>:comdlg32>
$<$<BOOL:${WIN32}>:advapi32>
$<$<BOOL:${WIN32}>:shell32>
$<$<BOOL:${WIN32}>:user32>
$<$<BOOL:${WIN32}>:ws2_32>
$<$<BOOL:${WIN32}>:iphlpapi>
$<$<AND:$<BOOL:${WIN32}>,$<BOOL:${EMU_EXPERIMENTAL_BUILD}>,$<BOOL:${EMU_OVERLAY}>>:opengl32.lib>
$<$<AND:$<BOOL:${WIN32}>,$<BOOL:${EMU_EXPERIMENTAL_BUILD}>,$<BOOL:${EMU_OVERLAY}>>:Winmm.lib>
$<$<AND:$<BOOL:${WIN32}>,$<BOOL:${EMU_EXPERIMENTAL_BUILD}>,$<BOOL:${EMU_OVERLAY}>>:winmm.lib>
# For library UNIX loading
$<$<NOT:$<BOOL:${WIN32}>>:dl>
# For overlay opengl
$<$<AND:$<BOOL:${UNIX}>,$<NOT:$<BOOL:${APPLE}>>>:GL>
)
# Add target compile definitions
target_compile_definitions(${LIB_STEAM_API}
PRIVATE
GLEW_NO_GLU
STBI_NO_SIMD
$<$<CONFIG:>:EMU_RELEASE_BUILD>
$<$<CONFIG:Release>:EMU_RELEASE_BUILD>
$<$<CONFIG:Release>:EMU_RELEASE_BUILD>
$<$<CONFIG:RelWithDebInfo>:EMU_RELEASE_BUILD>
$<$<CONFIG:MinSizeRel>:EMU_RELEASE_BUILD>
$<$<BOOL:${EMU_EXPERIMENTAL_BUILD}>:EMU_EXPERIMENTAL_BUILD>
$<$<BOOL:${EMU_OVERLAY}>:EMU_OVERLAY>
$<$<AND:$<BOOL:${WIN32}>,$<BOOL:${EMU_EXPERIMENTAL_BUILD}>,$<BOOL:${EMU_OVERLAY}>>:GLEW_STATIC>
)
# Install the target
if(WIN32)
install(TARGETS
${LIB_STEAM_API}
RUNTIME DESTINATION ./
)
else()
install(TARGETS
${LIB_STEAM_API}
LIBRARY DESTINATION ./
)
endif()
########################################################
# Setup for the steamclient(64).dll / libsteamclient.so?
########################################################
@ -162,81 +268,95 @@ endif()
# Setup the target
add_library(${LIB_STEAMCLIENT}
SHARED
steamclient.cpp
$<$<BOOL:${EMU_EXPERIMENTAL_BUILD}>:${DETOURS_SRC_SHARED}>
$<$<AND:$<BOOL:${EMU_EXPERIMENTAL_BUILD}>,$<BOOL:${EMU_OVERLAY}>>:${OVERLAY_EXPERIMENTAL_SRC_SHARED}>
${DLL_SRC_SHARED}
${PROTO_SRCS}
${PROTO_HDRS}
)
if(UNIX)
SET_TARGET_PROPERTIES(${LIB_STEAMCLIENT} PROPERTIES PREFIX "")
endif()
# Include the required directories
target_include_directories(
${LIB_STEAMCLIENT}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
${STB_INCLUDE_DIRS}
overlay_experimental
)
# Link the required libraries
target_link_libraries(${LIB_STEAMCLIENT}
PRIVATE
Threads::Threads
protobuf::libprotobuf-lite
#nlohmann_json::nlohmann_json doesn't work
nlohmann-fifo-map::nlohmann-fifo-map
$<$<NOT:$<BOOL:${APPLE}>>:GLEW::GLEW>
$<$<BOOL:${WIN32}>:comdlg32>
$<$<BOOL:${WIN32}>:advapi32>
$<$<BOOL:${WIN32}>:shell32>
$<$<BOOL:${WIN32}>:user32>
$<$<BOOL:${WIN32}>:ws2_32>
$<$<BOOL:${WIN32}>:iphlpapi>
$<$<AND:$<BOOL:${WIN32}>,$<BOOL:${EMU_EXPERIMENTAL_BUILD}>,$<BOOL:${EMU_OVERLAY}>>:opengl32.lib>
$<$<AND:$<BOOL:${WIN32}>,$<BOOL:${EMU_EXPERIMENTAL_BUILD}>,$<BOOL:${EMU_OVERLAY}>>:winmm.lib>
# For library UNIX loading
$<$<NOT:$<BOOL:${WIN32}>>:dl>
# For overlay opengl
$<$<AND:$<BOOL:${UNIX}>,$<NOT:$<BOOL:${APPLE}>>>:GL>
)
# Add target compile definitions
target_compile_definitions(${LIB_STEAMCLIENT}
PRIVATE
GLEW_NO_GLU
STBI_NO_SIMD
STEAMCLIENT_DLL
$<$<CONFIG:>:EMU_RELEASE_BUILD>
$<$<CONFIG:Release>:EMU_RELEASE_BUILD>
$<$<CONFIG:Release>:EMU_RELEASE_BUILD>
$<$<CONFIG:RelWithDebInfo>:EMU_RELEASE_BUILD>
$<$<CONFIG:MinSizeRel>:EMU_RELEASE_BUILD>
$<$<BOOL:${EMU_EXPERIMENTAL_BUILD}>:EMU_EXPERIMENTAL_BUILD>
$<$<BOOL:${EMU_OVERLAY}>:EMU_OVERLAY>
)
# Install the target
if(WIN32)
install(TARGETS
${LIB_STEAMCLIENT}
RUNTIME DESTINATION ./
)
else()
install(TARGETS
${LIB_STEAMCLIENT}
LIBRARY DESTINATION ./
)
endif()
if(NOT WIN32)
message(STATUS "Target library 'steamclient' is only suported for windows at this time... Disabling Build ALL inclusion for this target")
set_target_properties(${LIB_STEAMCLIENT} PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)
endif()
##############################################################################
# Setup for the steamnetworkingsockets(64).dll / libsteamnetworkingsockets.so?
##############################################################################
# Setup the target
add_library(${LIB_STEAMNETWORKINGSOCKETS}
add_library(steamnetworkingsockets
SHARED
steamnetworkingsockets.cpp
)
# Add target compile definitions
target_compile_definitions(${LIB_STEAMNETWORKINGSOCKETS}
target_compile_definitions(steamnetworkingsockets
PRIVATE
$<$<CONFIG:>:EMU_RELEASE_BUILD>
$<$<CONFIG:Release>:EMU_RELEASE_BUILD>
$<$<CONFIG:Release>:EMU_RELEASE_BUILD>
$<$<CONFIG:RelWithDebInfo>:EMU_RELEASE_BUILD>
$<$<CONFIG:MinSizeRel>:EMU_RELEASE_BUILD>
$<$<BOOL:${EMU_EXPERIMENTAL_BUILD}>:EMU_EXPERIMENTAL_BUILD>
)
# Setup install rules for the target
if(WIN32)
install(TARGETS
${LIB_STEAMNETWORKINGSOCKETS}
RUNTIME DESTINATION ./
)
else()
install(TARGETS
${LIB_STEAMNETWORKINGSOCKETS}
LIBRARY DESTINATION ./
)
endif()
if(NOT WIN32)
message(STATUS "Target library 'steamnetworkingsockets' is only supported for windows at this time... Disabling Build ALL inclusion for this target")
set_target_properties(${LIB_STEAMNETWORKINGSOCKETS} PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)
endif()
set_target_properties(steamnetworkingsockets PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)
###########################################################################
# Setup for the lobby_connect(64).exe / lobby_connect
###########################################################################
# Setup the target
add_executable(${BIN_LOBBY_CONNECT}
add_executable(lobby_connect
lobby_connect.cpp
$<$<BOOL:${EMU_EXPERIMENTAL_BUILD}>:${DETOURS_SRC_SHARED}>
${DLL_SRC_SHARED}
@ -244,76 +364,101 @@ add_executable(${BIN_LOBBY_CONNECT}
${PROTO_HDRS}
)
target_include_directories(${BIN_LOBBY_CONNECT}
target_include_directories(lobby_connect
PRIVATE
${PROTOBUF_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
)
# Link the required libraries
target_link_libraries(${BIN_LOBBY_CONNECT}
target_link_libraries(lobby_connect
PRIVATE
protobuf::libprotobuf
Threads::Threads
protobuf::libprotobuf-lite
#nlohmann_json::nlohmann_json doesn't work
nlohmann-fifo-map::nlohmann-fifo-map
$<$<BOOL:${WIN32}>:comdlg32>
$<$<BOOL:${WIN32}>:advapi32>
$<$<BOOL:${WIN32}>:shell32>
$<$<BOOL:${WIN32}>:user32>
$<$<BOOL:${WIN32}>:ws2_32>
$<$<BOOL:${WIN32}>:iphlpapi>
$<$<BOOL:${WIN32}>:comdlg32>
${CMAKE_DL_LIBS}
# For library UNIX loading
$<$<NOT:$<BOOL:${WIN32}>>:dl>
-debug:none
)
# Add target compile definitions
target_compile_definitions(${BIN_LOBBY_CONNECT}
target_compile_definitions(lobby_connect
PRIVATE
NO_DISK_WRITES
LOBBY_CONNECT
$<$<CONFIG:>:EMU_RELEASE_BUILD>
$<$<CONFIG:Release>:EMU_RELEASE_BUILD>
$<$<CONFIG:Release>:EMU_RELEASE_BUILD>
$<$<CONFIG:RelWithDebInfo>:EMU_RELEASE_BUILD>
$<$<CONFIG:MinSizeRel>:EMU_RELEASE_BUILD>
$<$<BOOL:${EMU_EXPERIMENTAL_BUILD}>:EMU_EXPERIMENTAL_BUILD>
)
# Setup install rules for the target
install(TARGETS
${BIN_LOBBY_CONNECT}
RUNTIME DESTINATION lobby_connect/
)
###########################################################################
# Setup for the generate_interfaces_file(64).exe / generate_interfaces_file
###########################################################################
# Setup the target
add_executable(${BIN_GENERATE_INTERFACES_FILE}
add_executable(
generate_interfaces
generate_interfaces_file.cpp
)
# Link the required libraries
target_link_libraries(${BIN_GENERATE_INTERFACES_FILE}
target_link_libraries(
generate_interfaces
PRIVATE
-debug:none
)
# Setup install rules for the target
###########################################################################
# Installation setup
###########################################################################
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(OUT_DIR debug/${OUT_DIR})
else()
set(OUT_DIR release/${OUT_DIR})
endif()
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR})
# emulators
install(
TARGETS ${LIB_STEAM_API} ${LIB_STEAMCLIENT}
RUNTIME DESTINATION ${OUT_DIR}
LIBRARY DESTINATION ${OUT_DIR}
)
# generate_interfaces
install(TARGETS
${BIN_GENERATE_INTERFACES_FILE}
RUNTIME DESTINATION tools/
generate_interfaces
RUNTIME DESTINATION ${OUT_DIR}/tools/generate_interfaces
)
###########################################################################
# Installation setup for non target files and directories
###########################################################################
install(FILES
Readme_lobby_connect.txt
DESTINATION lobby_connect/
)
install(FILES
scripts/find_interfaces.sh
scripts/find_interfaces.ps1
Readme_generate_interfaces.txt
DESTINATION tools/
DESTINATION ${OUT_DIR}/tools/generate_interfaces
)
# lobby_connect
install(TARGETS
lobby_connect
RUNTIME DESTINATION ${OUT_DIR}/tools/lobby_connect
)
install(FILES
Readme_lobby_connect.txt
DESTINATION ${OUT_DIR}/tools/lobby_connect
)
install(FILES
@ -322,10 +467,10 @@ install(FILES
files_example/steam_interfaces.EXAMPLE.txt
$<$<BOOL:${EMU_EXPERIMENTAL_BUILD}>:${PROJECT_SOURCE_DIR}/Readme_experimental.txt>
$<$<CONFIG:Debug>:${PROJECT_SOURCE_DIR}/Readme_debug.txt>
DESTINATION ./
DESTINATION ${OUT_DIR}
)
install(DIRECTORY
files_example/steam_settings.EXAMPLE
DESTINATION ./
DESTINATION ${OUT_DIR}
)

View File

@ -7,10 +7,10 @@ mkdir -p linux/tools
cp scripts/find_interfaces.sh linux/tools/
cp scripts/steamclient_loader.sh linux/tools/
../protobuf/prefix_x86/bin/protoc -I./dll/ --cpp_out=./dll/ ./dll/*.proto
g++ -m32 -shared -fPIC -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DEMU_RELEASE_BUILD -DNDEBUG -DCONTROLLER_SUPPORT -s -o linux/x86/libsteam_api.so dll/*.cpp dll/*.cc controller/*.c -Wno-return-type -I../protobuf/prefix_x86/include/ -L../protobuf/prefix_x86/lib/ -lprotobuf-lite -lpthread -ldl -std=c++11 && echo built32
g++ -m32 -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DEMU_RELEASE_BUILD -DNDEBUG -DNO_DISK_WRITES -DLOBBY_CONNECT -s -o linux/lobby_connect/lobby_connect_x86 lobby_connect.cpp dll/*.cpp dll/*.cc -Wno-return-type -I../protobuf/prefix_x86/include/ -L../protobuf/prefix_x86/lib/ -lprotobuf-lite -lpthread -ldl -std=c++11 && echo built_lobby_connect32
g++ -m32 -shared -fPIC -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DEMU_RELEASE_BUILD -DSTEAMCLIENT_DLL -DNDEBUG -DCONTROLLER_SUPPORT -s -o linux/x86/steamclient.so dll/*.cpp dll/*.cc controller/*.c -Wno-return-type -I../protobuf/prefix_x86/include/ -L../protobuf/prefix_x86/lib/ -lprotobuf-lite -lpthread -ldl -std=c++11 && echo built32_steamclient
g++ -m32 -shared -fPIC -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DEMU_RELEASE_BUILD -DNDEBUG -DCONTROLLER_SUPPORT -s -o linux/x86/libsteam_api.so dll/*.cpp dll/*.cc controller/*.c -Wno-return-type -I. -I../protobuf/prefix_x86/include/ -L../protobuf/prefix_x86/lib/ -lprotobuf-lite -lpthread -ldl -std=c++11 && echo built32
g++ -m32 -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DEMU_RELEASE_BUILD -DNDEBUG -DNO_DISK_WRITES -DLOBBY_CONNECT -s -o linux/lobby_connect/lobby_connect_x86 lobby_connect.cpp dll/*.cpp dll/*.cc -Wno-return-type -I. -I../protobuf/prefix_x86/include/ -L../protobuf/prefix_x86/lib/ -lprotobuf-lite -lpthread -ldl -std=c++11 && echo built_lobby_connect32
g++ -m32 -shared -fPIC -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DEMU_RELEASE_BUILD -DSTEAMCLIENT_DLL -DNDEBUG -DCONTROLLER_SUPPORT -s -o linux/x86/steamclient.so dll/*.cpp dll/*.cc controller/*.c -Wno-return-type -I. -I../protobuf/prefix_x86/include/ -L../protobuf/prefix_x86/lib/ -lprotobuf-lite -lpthread -ldl -std=c++11 && echo built32_steamclient
../protobuf/prefix/bin/protoc -I./dll/ --cpp_out=./dll/ ./dll/*.proto
g++ -shared -fPIC -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DEMU_RELEASE_BUILD -DNDEBUG -DCONTROLLER_SUPPORT -s -o linux/x86_64/libsteam_api.so dll/*.cpp dll/*.cc controller/*.c -Wno-return-type -I../protobuf/prefix/include/ -L../protobuf/prefix/lib/ -lprotobuf-lite -lpthread -ldl -std=c++11 && echo built64
g++ -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DEMU_RELEASE_BUILD -DNDEBUG -DNO_DISK_WRITES -DLOBBY_CONNECT -s -o linux/lobby_connect/lobby_connect_x64 lobby_connect.cpp dll/*.cpp dll/*.cc -Wno-return-type -I../protobuf/prefix/include/ -L../protobuf/prefix/lib/ -lprotobuf-lite -lpthread -ldl -std=c++11 && echo built_lobby_connect64
g++ -shared -fPIC -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DEMU_RELEASE_BUILD -DSTEAMCLIENT_DLL -DNDEBUG -DCONTROLLER_SUPPORT -s -o linux/x86_64/steamclient.so dll/*.cpp dll/*.cc controller/*.c -Wno-return-type -I../protobuf/prefix/include/ -L../protobuf/prefix/lib/ -lprotobuf-lite -lpthread -ldl -std=c++11 && echo built64_steamclient
g++ -shared -fPIC -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DEMU_RELEASE_BUILD -DNDEBUG -DCONTROLLER_SUPPORT -s -o linux/x86_64/libsteam_api.so dll/*.cpp dll/*.cc controller/*.c -Wno-return-type -I. -I../protobuf/prefix/include/ -L../protobuf/prefix/lib/ -lprotobuf-lite -lpthread -ldl -std=c++11 && echo built64
g++ -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DEMU_RELEASE_BUILD -DNDEBUG -DNO_DISK_WRITES -DLOBBY_CONNECT -s -o linux/lobby_connect/lobby_connect_x64 lobby_connect.cpp dll/*.cpp dll/*.cc -Wno-return-type -I. -I../protobuf/prefix/include/ -L../protobuf/prefix/lib/ -lprotobuf-lite -lpthread -ldl -std=c++11 && echo built_lobby_connect64
g++ -shared -fPIC -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DEMU_RELEASE_BUILD -DSTEAMCLIENT_DLL -DNDEBUG -DCONTROLLER_SUPPORT -s -o linux/x86_64/steamclient.so dll/*.cpp dll/*.cc controller/*.c -Wno-return-type -I. -I../protobuf/prefix/include/ -L../protobuf/prefix/lib/ -lprotobuf-lite -lpthread -ldl -std=c++11 && echo built64_steamclient

View File

@ -4,11 +4,11 @@ call build_set_protobuf_directories.bat
"%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto
call build_env_x86.bat
cl dll/rtlgenrandom.c dll/rtlgenrandom.def
cl /LD /IImGui /Iglew\include /I%PROTOBUF_X86_DIRECTORY%\include\ /DGLEW_STATIC /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /DEMU_OVERLAY dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/impls/*.cpp ImGui/impls/windows/*.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp "%PROTOBUF_X86_LIBRARY%" glew\glew.c opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /link /OUT:steam_api.dll
cl /LD /I. /IImGui /Iglew\include /I%PROTOBUF_X86_DIRECTORY%\include\ /DGLEW_STATIC /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /DEMU_OVERLAY dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/impls/*.cpp ImGui/impls/windows/*.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp "%PROTOBUF_X86_LIBRARY%" glew\glew.c opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /link /OUT:steam_api.dll
cl /LD steamclient.cpp /EHsc /MP12 /link /OUT:steamclient.dll
"%PROTOC_X64_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto
call build_env_x64.bat
cl dll/rtlgenrandom.c dll/rtlgenrandom.def
cl /LD /IImGui /Iglew\include /I%PROTOBUF_X64_DIRECTORY%\include\ /DGLEW_STATIC /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /DEMU_OVERLAY dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/impls/*.cpp ImGui/impls/windows/*.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp "%PROTOBUF_X64_LIBRARY%" glew\glew.c opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /link /OUT:steam_api64.dll
cl /LD /I. /IImGui /Iglew\include /I%PROTOBUF_X64_DIRECTORY%\include\ /DGLEW_STATIC /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /DEMU_OVERLAY dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/impls/*.cpp ImGui/impls/windows/*.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp "%PROTOBUF_X64_LIBRARY%" glew\glew.c opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /link /OUT:steam_api64.dll
cl /LD steamclient.cpp /EHsc /MP12 /link /OUT:steamclient64.dll

View File

@ -6,7 +6,7 @@ call build_set_protobuf_directories.bat
"%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto
call build_env_x86.bat
cl dll/rtlgenrandom.c dll/rtlgenrandom.def
cl /DNO_DISK_WRITES /DLOBBY_CONNECT /DEMU_RELEASE_BUILD /DNDEBUG /I%PROTOBUF_X86_DIRECTORY%\include\ lobby_connect.cpp dll/*.cpp dll/*.cc "%PROTOBUF_X86_LIBRARY%" Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Comdlg32.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\lobby_connect\lobby_connect.exe
cl /DNO_DISK_WRITES /DLOBBY_CONNECT /DEMU_RELEASE_BUILD /DNDEBUG /I. /I%PROTOBUF_X86_DIRECTORY%\include\ lobby_connect.cpp dll/*.cpp dll/*.cc "%PROTOBUF_X86_LIBRARY%" Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Comdlg32.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\lobby_connect\lobby_connect.exe
del /Q /S release\lobby_connect\*.lib
del /Q /S release\lobby_connect\*.exp
copy Readme_lobby_connect.txt release\lobby_connect\Readme.txt

View File

@ -10,12 +10,12 @@ call build_set_protobuf_directories.bat
"%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto
call build_env_x86.bat
cl dll/rtlgenrandom.c dll/rtlgenrandom.def
cl /LD /DEMU_RELEASE_BUILD /DNDEBUG /I%PROTOBUF_X86_DIRECTORY%\include\ dll/*.cpp dll/*.cc "%PROTOBUF_X86_LIBRARY%" Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\steam_api.dll
cl /LD /DEMU_RELEASE_BUILD /DNDEBUG /I. /I%PROTOBUF_X86_DIRECTORY%\include\ dll/*.cpp dll/*.cc "%PROTOBUF_X86_LIBRARY%" Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\steam_api.dll
"%PROTOC_X64_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto
call build_env_x64.bat
cl dll/rtlgenrandom.c dll/rtlgenrandom.def
cl /LD /DEMU_RELEASE_BUILD /DNDEBUG /I%PROTOBUF_X64_DIRECTORY%\include\ dll/*.cpp dll/*.cc "%PROTOBUF_X64_LIBRARY%" Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\steam_api64.dll
cl /LD /DEMU_RELEASE_BUILD /DNDEBUG /I. /I%PROTOBUF_X64_DIRECTORY%\include\ dll/*.cpp dll/*.cc "%PROTOBUF_X64_LIBRARY%" Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\steam_api64.dll
copy Readme_release.txt release\Readme.txt
xcopy /s files_example\* release\
call build_win_release_experimental.bat

View File

@ -6,11 +6,11 @@ call build_set_protobuf_directories.bat
"%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto
call build_env_x86.bat
cl dll/rtlgenrandom.c dll/rtlgenrandom.def
cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DGLEW_STATIC /DCONTROLLER_SUPPORT /DEMU_OVERLAY /DNDEBUG /IImGui /Iglew\include /I%PROTOBUF_X86_DIRECTORY%\include\ dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/impls/*.cpp ImGui/impls/windows/*.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp "%PROTOBUF_X86_LIBRARY%" glew\glew.c opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\experimental\steam_api.dll
cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DGLEW_STATIC /DCONTROLLER_SUPPORT /DEMU_OVERLAY /DNDEBUG /I. /IImGui /Iglew\include /I%PROTOBUF_X86_DIRECTORY%\include\ dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/impls/*.cpp ImGui/impls/windows/*.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp "%PROTOBUF_X86_LIBRARY%" glew\glew.c opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\experimental\steam_api.dll
cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DNDEBUG steamclient.cpp /EHsc /MP12 /Ox /link /OUT:release\experimental\steamclient.dll
"%PROTOC_X64_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto
call build_env_x64.bat
cl dll/rtlgenrandom.c dll/rtlgenrandom.def
cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DGLEW_STATIC /DCONTROLLER_SUPPORT /DEMU_OVERLAY /DNDEBUG /IImGui /Iglew\include /I%PROTOBUF_X64_DIRECTORY%\include\ dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/impls/*.cpp ImGui/impls/windows/*.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp "%PROTOBUF_X64_LIBRARY%" glew\glew.c opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\experimental\steam_api64.dll
cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DGLEW_STATIC /DCONTROLLER_SUPPORT /DEMU_OVERLAY /DNDEBUG /I. /IImGui /Iglew\include /I%PROTOBUF_X64_DIRECTORY%\include\ dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/impls/*.cpp ImGui/impls/windows/*.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp "%PROTOBUF_X64_LIBRARY%" glew\glew.c opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\experimental\steam_api64.dll
cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DNDEBUG steamclient.cpp /EHsc /MP12 /Ox /link /OUT:release\experimental\steamclient64.dll
copy Readme_experimental.txt release\experimental\Readme.txt

View File

@ -6,11 +6,11 @@ call build_set_protobuf_directories.bat
"%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto
call build_env_x86.bat
cl dll/rtlgenrandom.c dll/rtlgenrandom.def
cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DSTEAMCLIENT_DLL /DCONTROLLER_SUPPORT /DEMU_OVERLAY /DGLEW_STATIC /IImGui /Iglew\include /DNDEBUG /I%PROTOBUF_X86_DIRECTORY%\include\ dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/impls/*.cpp ImGui/impls/windows/*.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp "%PROTOBUF_X86_LIBRARY%" glew\glew.c opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\experimental_steamclient\steamclient.dll
cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DSTEAMCLIENT_DLL /DCONTROLLER_SUPPORT /DEMU_OVERLAY /DGLEW_STATIC /I. /IImGui /Iglew\include /DNDEBUG /I%PROTOBUF_X86_DIRECTORY%\include\ dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/impls/*.cpp ImGui/impls/windows/*.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp "%PROTOBUF_X86_LIBRARY%" glew\glew.c opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\experimental_steamclient\steamclient.dll
"%PROTOC_X64_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto
cl steamclient_loader/*.cpp advapi32.lib user32.lib /EHsc /MP12 /Od /link /debug:none /OUT:release\experimental_steamclient\steamclient_loader.exe
cl steamclient_loader/*.cpp advapi32.lib user32.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\experimental_steamclient\steamclient_loader.exe
copy steamclient_loader\ColdClientLoader.ini release\experimental_steamclient\
call build_env_x64.bat
cl dll/rtlgenrandom.c dll/rtlgenrandom.def
cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DSTEAMCLIENT_DLL /DCONTROLLER_SUPPORT /DEMU_OVERLAY /DGLEW_STATIC /IImGui /Iglew\include /DNDEBUG /I%PROTOBUF_X64_DIRECTORY%\include\ dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/impls/*.cpp ImGui/impls/windows/*.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp "%PROTOBUF_X64_LIBRARY%" glew\glew.c opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\experimental_steamclient\steamclient64.dll
cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DSTEAMCLIENT_DLL /DCONTROLLER_SUPPORT /DEMU_OVERLAY /DGLEW_STATIC /I. /IImGui /Iglew\include /DNDEBUG /I%PROTOBUF_X64_DIRECTORY%\include\ dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/impls/*.cpp ImGui/impls/windows/*.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp "%PROTOBUF_X64_LIBRARY%" glew\glew.c opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\experimental_steamclient\steamclient64.dll
copy Readme_experimental_steamclient.txt release\experimental_steamclient\Readme.txt

View File

@ -150,44 +150,18 @@ bool check_timedout(std::chrono::high_resolution_clock::time_point old, double t
return false;
}
#ifdef __LINUX__
std::string get_lib_path() {
std::string dir = "/proc/self/map_files";
DIR *dp;
int i = 0;
struct dirent *ep;
dp = opendir (dir.c_str());
uintptr_t p = (uintptr_t)&get_lib_path;
#if defined(__LINUX__) || defined(__APPLE__)
std::string get_lib_path()
{
std::string library_path = "./";
if (dp != NULL)
{
while ((ep = readdir (dp))) {
if (memcmp(ep->d_name, ".", 2) != 0 && memcmp(ep->d_name, "..", 3) != 0) {
char *upper = NULL;
uintptr_t lower_bound = strtoull(ep->d_name, &upper, 16);
if (lower_bound) {
++upper;
uintptr_t upper_bound = strtoull(upper, &upper, 16);
if (upper_bound && (lower_bound < p && p < upper_bound)) {
std::string path = dir + PATH_SEPARATOR + ep->d_name;
char link[PATH_MAX] = {};
if (readlink(path.c_str(), link, sizeof(link)) > 0) {
std::string lib_path = link;
(void) closedir (dp);
return link;
}
}
}
Dl_info infos;
dladdr((void*)&get_lib_path, &infos);
library_path = infos.dli_fname;
i++;
}
}
(void) closedir (dp);
}
return ".";
return library_path;
}
#endif
std::string get_full_lib_path()
@ -222,10 +196,10 @@ std::string get_full_program_path()
std::string get_current_path()
{
std::string path;
#if defined(STEAM_WIN32)
#if defined(__WINDOWS__)
char *buffer = _getcwd( NULL, 0 );
#else
char *buffer = get_current_dir_name();
#elif defined(__LINUX__) || defined(__APPLE__)
char *buffer = getcwd( NULL, 0 );
#endif
if (buffer) {
path = buffer;
@ -239,10 +213,10 @@ std::string get_current_path()
std::string canonical_path(std::string path)
{
std::string output;
#if defined(STEAM_WIN32)
#if defined(__WINDOWS__)
char *buffer = _fullpath(NULL, path.c_str(), 0);
#else
char *buffer = canonicalize_file_name(path.c_str());
#elif defined(__LINUX__) || defined(__APPLE__)
char *buffer = realpath(path.c_str(), NULL);
#endif
if (buffer) {
@ -649,6 +623,13 @@ static void load_dlls()
std::vector<std::string> paths = Local_Storage::get_filenames_path(path);
for (auto & p: paths) {
std::string full_path = path + p;
size_t length = full_path.length();
if (length < 4) continue;
if (std::toupper(full_path[length - 1]) != 'L') continue;
if (std::toupper(full_path[length - 2]) != 'L') continue;
if (std::toupper(full_path[length - 3]) != 'D') continue;
if (full_path[length - 4] != '.') continue;
PRINT_DEBUG("Trying to load %s\n", full_path.c_str());
if (LoadLibraryA(full_path.c_str())) {
PRINT_DEBUG("LOADED %s\n", full_path.c_str());

View File

@ -40,6 +40,16 @@
#define __LINUX__
#endif
#if defined(__APPLE__)
#if defined(__x86_64__)
#define __APPLE_64__
#define __64BITS__
#else
#define __APPLE_32__
#define __32BITS__
#endif
#endif
#if defined(__WINDOWS__)
#define STEAM_WIN32
#ifndef NOMINMAX
@ -59,8 +69,6 @@
#include <iphlpapi.h> // Include winsock2 before this, or winsock2 iphlpapi will be unavailable
#include <shlobj.h>
#define MSG_NOSIGNAL 0
#define SystemFunction036 NTAPI SystemFunction036
#include <ntsecapi.h>
#undef SystemFunction036
@ -84,7 +92,15 @@
#endif
#endif
#elif defined(__LINUX__)
#elif defined(__LINUX__) || defined(__APPLE__)
#if defined(__LINUX__)
// Insert here Linux specific headers
#else
// Insert here MacOS specific headers
#include <sys/sysctl.h>
#include <mach-o/dyld_images.h>
#endif
#include <ifaddrs.h>// getifaddrs
#include <arpa/inet.h>
#include <sys/types.h>
@ -97,7 +113,6 @@
#include <sys/time.h>
#include <netinet/in.h>
#include <linux/netdevice.h>
#include <fcntl.h>
#include <unistd.h>
@ -112,7 +127,13 @@
#define PRINT_DEBUG(...) {FILE *t = fopen("STEAM_LOG.txt", "a"); fprintf(t, __VA_ARGS__); fclose(t);}
#endif
#define PATH_SEPARATOR "/"
#endif
#ifndef MSG_NOSIGNAL
#define MSG_NOSIGNAL 0
#endif
//#define PRINT_DEBUG(...) fprintf(stdout, __VA_ARGS__)
#ifdef EMU_RELEASE_BUILD
#define PRINT_DEBUG(...)
@ -143,7 +164,8 @@
#include <stdio.h>
// Other libs includes
#include "../json/json.hpp"
#include <nlohmann/json.hpp>
#include <nlohmann/fifo_map.hpp>
#include "../controller/gamepad.h"
// Steamsdk includes

View File

@ -120,68 +120,39 @@ static void get_broadcast_info(uint16 port)
}
}
#elif defined(__linux__)
#elif defined(__LINUX__) || defined(__APPLE__)
static void get_broadcast_info(uint16 port)
{
/* Not sure how many platforms this will run on,
* so it's wrapped in __linux for now.
* Definitely won't work like this on Windows...
*/
number_broadcasts = 0;
sock_t sock = 0;
ifaddrs* ifaces_list;
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
return;
number_broadcasts = 0;
if (getifaddrs(&ifaces_list) == 0)
{
const sockaddr_in* sock_addr;
for (ifaddrs* pIface = ifaces_list; pIface != nullptr; pIface = pIface->ifa_next)
{
if (pIface->ifa_addr->sa_family == AF_INET)
{
sock_addr = reinterpret_cast<const sockaddr_in*>(pIface->ifa_addr);
if (sock_addr->sin_addr.s_addr != 0 && pIface->ifa_netmask != nullptr)
{
uint32_t ip = reinterpret_cast<const sockaddr_in*>(pIface->ifa_addr)->sin_addr.s_addr;
uint32_t mask = reinterpret_cast<const sockaddr_in*>(pIface->ifa_netmask)->sin_addr.s_addr;
/* Configure ifconf for the ioctl call. */
struct ifreq i_faces[MAX_BROADCASTS];
memset(i_faces, 0, sizeof(struct ifreq) * MAX_BROADCASTS);
struct ifconf ifconf;
ifconf.ifc_buf = (char *)i_faces;
ifconf.ifc_len = sizeof(i_faces);
if (ioctl(sock, SIOCGIFCONF, &ifconf) < 0) {
close(sock);
return;
}
/* ifconf.ifc_len is set by the ioctl() to the actual length used;
* on usage of the complete array the call should be repeated with
* a larger array, not done (640kB and 16 interfaces shall be
* enough, for everybody!)
*/
int i, count = ifconf.ifc_len / sizeof(struct ifreq);
for (i = 0; i < count; i++) {
/* there are interfaces with are incapable of broadcast */
if (ioctl(sock, SIOCGIFBRDADDR, &i_faces[i]) < 0)
continue;
/* moot check: only AF_INET returned (backwards compat.) */
if (i_faces[i].ifr_broadaddr.sa_family != AF_INET)
continue;
struct sockaddr_in *sock4 = (struct sockaddr_in *)&i_faces[i].ifr_broadaddr;
if (number_broadcasts >= MAX_BROADCASTS) {
close(sock);
return;
}
IP_PORT *ip_port = &broadcasts[number_broadcasts];
ip_port->ip = sock4->sin_addr.s_addr;
if (ip_port->ip == 0) {
continue;
}
ip_port->port = port;
number_broadcasts++;
}
close(sock);
IP_PORT *ip_port = &broadcasts[number_broadcasts++];
ip_port->ip = ip | ~mask;
ip_port->port = port;
}
}
// IPV6
//else if (pIface->ifa_addr->sa_family == AF_INET6)
//{
// const sockaddr_in6* addr = reinterpret_cast<const sockaddr_in6*>(pIface->ifa_addr);));
//}
}
freeifaddrs(ifaces_list);
}
}
#endif

View File

@ -27,11 +27,7 @@
#include "steam_remote_storage.h"
#include "steam_screenshots.h"
#include "steam_http.h"
#ifdef CONTROLLER_SUPPORT
#include "steam_controller.h"
#else
#include "steam_controller_disabled.h"
#endif
#include "steam_ugc.h"
#include "steam_applist.h"
#include "steam_music.h"

View File

@ -16,6 +16,18 @@
<http://www.gnu.org/licenses/>. */
#include "base.h"
#ifndef CONTROLLER_SUPPORT
inline void GamepadInit(void) {}
inline void GamepadShutdown(void) {}
inline void GamepadUpdate(void) {}
inline GAMEPAD_BOOL GamepadIsConnected(GAMEPAD_DEVICE device) { return GAMEPAD_FALSE; }
inline GAMEPAD_BOOL GamepadButtonDown(GAMEPAD_DEVICE device, GAMEPAD_BUTTON button) { return GAMEPAD_FALSE; }
inline float GamepadTriggerLength(GAMEPAD_DEVICE device, GAMEPAD_TRIGGER trigger) { return 0.0; }
inline GAMEPAD_STICKDIR GamepadStickDir(GAMEPAD_DEVICE device, GAMEPAD_STICK stick) { return STICKDIR_CENTER; }
inline void GamepadStickNormXY(GAMEPAD_DEVICE device, GAMEPAD_STICK stick, float* outX, float* outY) {}
inline float GamepadStickLength(GAMEPAD_DEVICE device, GAMEPAD_STICK stick) { return 0.0; }
inline void GamepadSetRumble(GAMEPAD_DEVICE device, float left, float right, unsigned int rumble_length_ms) {}
#endif
struct Controller_Map {
std::map<ControllerDigitalActionHandle_t, std::set<int>> active_digital;
@ -756,7 +768,7 @@ int GetGamepadIndexForController( ControllerHandle_t ulControllerHandle )
// Returns the associated controller handle for the specified emulated gamepad
ControllerHandle_t GetControllerForGamepadIndex( int nIndex )
{
PRINT_DEBUG("Steam_Controller::GetControllerForGamepadIndex\n");
PRINT_DEBUG("Steam_Controller::GetControllerForGamepadIndex %i\n", nIndex);
ControllerHandle_t out = nIndex + 1;
auto controller = controllers.find(out);
if (controller == controllers.end()) return 0;
@ -890,7 +902,7 @@ const char *GetGlyphForActionOrigin( EInputActionOrigin eOrigin )
// Returns the input type for a particular handle
ESteamInputType GetInputTypeForHandle( ControllerHandle_t controllerHandle )
{
PRINT_DEBUG("Steam_Controller::GetInputTypeForHandle\n");
PRINT_DEBUG("Steam_Controller::GetInputTypeForHandle %llu\n", controllerHandle);
auto controller = controllers.find(controllerHandle);
if (controller == controllers.end()) return k_ESteamInputType_Unknown;
return k_ESteamInputType_XBox360Controller;

View File

@ -1,375 +0,0 @@
/* Copyright (C) 2019 Mr Goldberg
This file is part of the Goldberg Emulator
The Goldberg Emulator is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
The Goldberg Emulator is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the Goldberg Emulator; if not, see
<http://www.gnu.org/licenses/>. */
#include "base.h"
class Steam_Controller :
public ISteamController001,
public ISteamController003,
public ISteamController004,
public ISteamController005,
public ISteamController006,
public ISteamController,
public ISteamInput
{
public:
Steam_Controller(class Settings *settings, class SteamCallResults *callback_results, class SteamCallBacks *callbacks, class RunEveryRunCB *run_every_runcb)
{
}
// Init and Shutdown must be called when starting/ending use of this interface
bool Init()
{
PRINT_DEBUG("Steam_Controller::Init()\n");
return true;
}
bool Init( const char *pchAbsolutePathToControllerConfigVDF )
{
PRINT_DEBUG("Steam_Controller::Init() old\n");
return Init();
}
bool Shutdown()
{
PRINT_DEBUG("Steam_Controller::Shutdown()\n");
return true;
}
void SetOverrideMode( const char *pchMode )
{
PRINT_DEBUG("Steam_Controller::SetOverrideMode\n");
}
// Synchronize API state with the latest Steam Controller inputs available. This
// is performed automatically by SteamAPI_RunCallbacks, but for the absolute lowest
// possible latency, you call this directly before reading controller state.
void RunFrame()
{
PRINT_DEBUG("Steam_Controller::RunFrame()\n");
}
bool GetControllerState( uint32 unControllerIndex, SteamControllerState001_t *pState )
{
PRINT_DEBUG("Steam_Controller::GetControllerState()\n");
return false;
}
// Enumerate currently connected controllers
// handlesOut should point to a STEAM_CONTROLLER_MAX_COUNT sized array of ControllerHandle_t handles
// Returns the number of handles written to handlesOut
int GetConnectedControllers( ControllerHandle_t *handlesOut )
{
PRINT_DEBUG("GetConnectedControllers\n");
return 0;
}
// Invokes the Steam overlay and brings up the binding screen
// Returns false is overlay is disabled / unavailable, or the user is not in Big Picture mode
bool ShowBindingPanel( ControllerHandle_t controllerHandle )
{
PRINT_DEBUG("ShowBindingPanel\n");
return false;
}
// ACTION SETS
// Lookup the handle for an Action Set. Best to do this once on startup, and store the handles for all future API calls.
ControllerActionSetHandle_t GetActionSetHandle( const char *pszActionSetName )
{
PRINT_DEBUG("GetActionSetHandle %s\n", pszActionSetName);
return 124;
}
// Reconfigure the controller to use the specified action set (ie 'Menu', 'Walk' or 'Drive')
// This is cheap, and can be safely called repeatedly. It's often easier to repeatedly call it in
// your state loops, instead of trying to place it in all of your state transitions.
void ActivateActionSet( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle )
{
PRINT_DEBUG("ActivateActionSet\n");
}
ControllerActionSetHandle_t GetCurrentActionSet( ControllerHandle_t controllerHandle )
{
PRINT_DEBUG("GetCurrentActionSet\n");
return 124;
}
void ActivateActionSetLayer( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetLayerHandle )
{
PRINT_DEBUG("ActivateActionSetLayer\n");
}
void DeactivateActionSetLayer( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetLayerHandle )
{
PRINT_DEBUG("DeactivateActionSetLayer\n");
}
void DeactivateAllActionSetLayers( ControllerHandle_t controllerHandle )
{
PRINT_DEBUG("DeactivateAllActionSetLayers\n");
}
int GetActiveActionSetLayers( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t *handlesOut )
{
PRINT_DEBUG("GetActiveActionSetLayers\n");
return 0;
}
// ACTIONS
// Lookup the handle for a digital action. Best to do this once on startup, and store the handles for all future API calls.
ControllerDigitalActionHandle_t GetDigitalActionHandle( const char *pszActionName )
{
PRINT_DEBUG("GetDigitalActionHandle %s\n", pszActionName);
return 123;
}
// Returns the current state of the supplied digital game action
ControllerDigitalActionData_t GetDigitalActionData( ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle )
{
PRINT_DEBUG("GetDigitalActionData\n");
ControllerDigitalActionData_t digitalData;
digitalData.bActive = false;
return digitalData;
}
// Get the origin(s) for a digital action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action.
// originsOut should point to a STEAM_CONTROLLER_MAX_ORIGINS sized array of EControllerActionOrigin handles
int GetDigitalActionOrigins( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerDigitalActionHandle_t digitalActionHandle, EControllerActionOrigin *originsOut )
{
PRINT_DEBUG("GetDigitalActionOrigins\n");
return 0;
}
int GetDigitalActionOrigins( InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputDigitalActionHandle_t digitalActionHandle, EInputActionOrigin *originsOut )
{
PRINT_DEBUG("GetDigitalActionOrigins steaminput\n");
return 0;
}
// Lookup the handle for an analog action. Best to do this once on startup, and store the handles for all future API calls.
ControllerAnalogActionHandle_t GetAnalogActionHandle( const char *pszActionName )
{
PRINT_DEBUG("GetAnalogActionHandle %s\n", pszActionName);
return 125;
}
// Returns the current state of these supplied analog game action
ControllerAnalogActionData_t GetAnalogActionData( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle )
{
PRINT_DEBUG("GetAnalogActionData\n");
ControllerAnalogActionData_t data;
data.eMode = k_EInputSourceMode_None;
data.x = data.y = 0;
data.bActive = false;
return data;
}
// Get the origin(s) for an analog action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action.
// originsOut should point to a STEAM_CONTROLLER_MAX_ORIGINS sized array of EControllerActionOrigin handles
int GetAnalogActionOrigins( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerAnalogActionHandle_t analogActionHandle, EControllerActionOrigin *originsOut )
{
PRINT_DEBUG("GetAnalogActionOrigins\n");
return 0;
}
int GetAnalogActionOrigins( InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputAnalogActionHandle_t analogActionHandle, EInputActionOrigin *originsOut )
{
PRINT_DEBUG("GetAnalogActionOrigins steaminput\n");
return 0;
}
void StopAnalogActionMomentum( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t eAction )
{
PRINT_DEBUG("StopAnalogActionMomentum\n");
}
// Trigger a haptic pulse on a controller
void TriggerHapticPulse( ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec )
{
PRINT_DEBUG("TriggerHapticPulse\n");
}
void TriggerHapticPulse( uint32 unControllerIndex, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec )
{
PRINT_DEBUG("TriggerHapticPulse old\n");
TriggerHapticPulse(unControllerIndex, eTargetPad, usDurationMicroSec );
}
// Trigger a pulse with a duty cycle of usDurationMicroSec / usOffMicroSec, unRepeat times.
// nFlags is currently unused and reserved for future use.
void TriggerRepeatedHapticPulse( ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec, unsigned short usOffMicroSec, unsigned short unRepeat, unsigned int nFlags )
{
PRINT_DEBUG("TriggerRepeatedHapticPulse\n");
}
// Tigger a vibration event on supported controllers.
void TriggerVibration( ControllerHandle_t controllerHandle, unsigned short usLeftSpeed, unsigned short usRightSpeed )
{
PRINT_DEBUG("TriggerVibration\n");
}
// Set the controller LED color on supported controllers.
void SetLEDColor( ControllerHandle_t controllerHandle, uint8 nColorR, uint8 nColorG, uint8 nColorB, unsigned int nFlags )
{
PRINT_DEBUG("SetLEDColor\n");
}
// Returns the associated gamepad index for the specified controller, if emulating a gamepad
int GetGamepadIndexForController( ControllerHandle_t ulControllerHandle )
{
PRINT_DEBUG("GetGamepadIndexForController\n");
return 0;
}
// Returns the associated controller handle for the specified emulated gamepad
ControllerHandle_t GetControllerForGamepadIndex( int nIndex )
{
PRINT_DEBUG("GetControllerForGamepadIndex\n");
return 0;
}
// Returns raw motion data from the specified controller
ControllerMotionData_t GetMotionData( ControllerHandle_t controllerHandle )
{
PRINT_DEBUG("GetMotionData\n");
ControllerMotionData_t data = {};
return data;
}
// Attempt to display origins of given action in the controller HUD, for the currently active action set
// Returns false is overlay is disabled / unavailable, or the user is not in Big Picture mode
bool ShowDigitalActionOrigins( ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle, float flScale, float flXPosition, float flYPosition )
{
PRINT_DEBUG("ShowDigitalActionOrigins\n");
return true;
}
bool ShowAnalogActionOrigins( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle, float flScale, float flXPosition, float flYPosition )
{
PRINT_DEBUG("ShowAnalogActionOrigins\n");
return true;
}
// Returns a localized string (from Steam's language setting) for the specified origin
const char *GetStringForActionOrigin( EControllerActionOrigin eOrigin )
{
PRINT_DEBUG("GetStringForActionOrigin\n");
return "Button String";
}
const char *GetStringForActionOrigin( EInputActionOrigin eOrigin )
{
PRINT_DEBUG("GetStringForActionOrigin steaminput\n");
return "Button String";
}
// Get a local path to art for on-screen glyph for a particular origin
const char *GetGlyphForActionOrigin( EControllerActionOrigin eOrigin )
{
PRINT_DEBUG("GetGlyphForActionOrigin\n");
return "";
}
const char *GetGlyphForActionOrigin( EInputActionOrigin eOrigin )
{
PRINT_DEBUG("GetGlyphForActionOrigin steaminput\n");
return "";
}
// Returns the input type for a particular handle
ESteamInputType GetInputTypeForHandle( ControllerHandle_t controllerHandle )
{
PRINT_DEBUG("GetInputTypeForHandle\n");
return k_ESteamInputType_Unknown;
}
const char *GetStringForXboxOrigin( EXboxOrigin eOrigin )
{
PRINT_DEBUG("GetStringForXboxOrigin\n");
return "";
}
const char *GetGlyphForXboxOrigin( EXboxOrigin eOrigin )
{
PRINT_DEBUG("GetGlyphForXboxOrigin\n");
return "";
}
EControllerActionOrigin GetActionOriginFromXboxOrigin_( ControllerHandle_t controllerHandle, EXboxOrigin eOrigin )
{
PRINT_DEBUG("GetActionOriginFromXboxOrigin\n");
return k_EControllerActionOrigin_None;
}
EInputActionOrigin GetActionOriginFromXboxOrigin( InputHandle_t inputHandle, EXboxOrigin eOrigin )
{
PRINT_DEBUG("GetActionOriginFromXboxOrigin steaminput\n");
return k_EInputActionOrigin_None;
}
EControllerActionOrigin TranslateActionOrigin( ESteamInputType eDestinationInputType, EControllerActionOrigin eSourceOrigin )
{
PRINT_DEBUG("TranslateActionOrigin\n");
return k_EControllerActionOrigin_None;
}
EInputActionOrigin TranslateActionOrigin( ESteamInputType eDestinationInputType, EInputActionOrigin eSourceOrigin )
{
PRINT_DEBUG("TranslateActionOrigin steaminput\n");
return k_EInputActionOrigin_None;
}
bool GetControllerBindingRevision( ControllerHandle_t controllerHandle, int *pMajor, int *pMinor )
{
PRINT_DEBUG("GetControllerBindingRevision\n");
return false;
}
bool GetDeviceBindingRevision( InputHandle_t inputHandle, int *pMajor, int *pMinor )
{
PRINT_DEBUG("GetDeviceBindingRevision\n");
return false;
}
uint32 GetRemotePlaySessionID( InputHandle_t inputHandle )
{
PRINT_DEBUG("GetRemotePlaySessionID\n");
return 0;
}
};

View File

@ -15,19 +15,12 @@
License along with the Goldberg Emulator; if not, see
<http://www.gnu.org/licenses/>. */
#if defined(WIN64) || defined(_WIN64) || defined(__MINGW64__)
#define __WINDOWS_64__
#elif defined(WIN32) || defined(_WIN32) || defined(__MINGW32__)
#define __WINDOWS_32__
#endif
#if defined(__WINDOWS_32__) || defined(__WINDOWS_64__)
// Nothing to be done here
#else
#define STEAM_API_FUNCTIONS_IMPL
#include "base.h"
#include "dll.h"
#if defined(__LINUX__)
#define STEAM_API_FUNCTIONS_IMPL
#define PATH_SEPARATOR_CHAR '/'
#define STEAM_PATH_CACHE_SIZE 4096

View File

@ -18,13 +18,15 @@ bool Windows_Hook::start_hook()
{
GetRawInputBuffer = ::GetRawInputBuffer;
GetRawInputData = ::GetRawInputData;
SetCursorPos = ::SetCursorPos;
PRINT_DEBUG("Hooked Windows\n");
BeginHook();
HookFuncs(
std::make_pair<void**, void*>(&(PVOID&)GetRawInputBuffer, &Windows_Hook::MyGetRawInputBuffer),
std::make_pair<void**, void*>(&(PVOID&)GetRawInputData , &Windows_Hook::MyGetRawInputData)
std::make_pair<void**, void*>(&(PVOID&)GetRawInputData , &Windows_Hook::MyGetRawInputData),
std::make_pair<void**, void*>(&(PVOID&)SetCursorPos , &Windows_Hook::MySetCursorPos)
);
EndHook();
@ -169,6 +171,18 @@ UINT WINAPI Windows_Hook::MyGetRawInputData(HRAWINPUT hRawInput, UINT uiCommand,
return 0;
}
BOOL WINAPI Windows_Hook::MySetCursorPos(int x, int y)
{
if (get_steam_client()->steam_overlay->ShowOverlay()) {
POINT p;
GetCursorPos(&p);
x = p.x;
y = p.y;
}
return Windows_Hook::Inst()->SetCursorPos(x, y);
}
/////////////////////////////////////////////////////////////////////////////////////
Windows_Hook::Windows_Hook() :

View File

@ -26,11 +26,13 @@ private:
// Hook to Windows window messages
decltype(GetRawInputBuffer)* GetRawInputBuffer;
decltype(GetRawInputData)* GetRawInputData;
decltype(SetCursorPos)* SetCursorPos;
static LRESULT CALLBACK HookWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
static UINT WINAPI MyGetRawInputBuffer(PRAWINPUT pData, PUINT pcbSize, UINT cbSizeHeader);
static UINT WINAPI MyGetRawInputData(HRAWINPUT hRawInput, UINT uiCommand, LPVOID pData, PUINT pcbSize, UINT cbSizeHeader);
static BOOL WINAPI MySetCursorPos(int x, int y);
public:
virtual ~Windows_Hook();

View File

@ -45,7 +45,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
}
if (GetFileAttributesA(CurrentDirectory) == INVALID_FILE_ATTRIBUTES) {
MessageBoxA(NULL, "Couldn't find the configuration file(ColdClientLoader.ini).", "ColdClientLoader", MB_ICONERROR);
ExitProcess(NULL);
return 0;
}
GetPrivateProfileStringA("SteamClient", "SteamClient64Dll", "", Client64Path, MAX_PATH, CurrentDirectory);
@ -60,27 +60,23 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
SetEnvironmentVariableA("SteamGameId", AppId);
}
CHAR TMP[MAX_PATH] = { 0 };
CHAR TMP[MAX_PATH] = {};
if (!IsNotRelativePathOrRemoveFileName(Client64Path, false)) {
ZeroMemory(TMP, sizeof(TMP));
lstrcpyA(TMP, Client64Path);
ZeroMemory(Client64Path, sizeof(Client64Path));
GetFullPathNameA(TMP, MAX_PATH, Client64Path, NULL);
}
if (!IsNotRelativePathOrRemoveFileName(ClientPath, false)) {
ZeroMemory(TMP, sizeof(TMP));
lstrcpyA(TMP, ClientPath);
ZeroMemory(ClientPath, sizeof(ClientPath));
GetFullPathNameA(TMP, MAX_PATH, ClientPath, NULL);
}
if (!IsNotRelativePathOrRemoveFileName(ExeFile, false)) {
ZeroMemory(TMP, sizeof(TMP));
lstrcpyA(TMP, ExeFile);
ZeroMemory(ExeFile, sizeof(ExeFile));
GetFullPathNameA(TMP, MAX_PATH, ExeFile, NULL);
}
if (!IsNotRelativePathOrRemoveFileName(ExeRunDir, false)) {
ZeroMemory(TMP, sizeof(TMP));
lstrcpyA(TMP, ExeRunDir);
ZeroMemory(ExeRunDir, sizeof(ExeRunDir));
GetFullPathNameA(TMP, MAX_PATH, ExeRunDir, NULL);
@ -88,17 +84,17 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
if (GetFileAttributesA(Client64Path) == INVALID_FILE_ATTRIBUTES) {
MessageBoxA(NULL, "Couldn't find the requested SteamClient64Dll.", "ColdClientLoader", MB_ICONERROR);
ExitProcess(NULL);
return 0;
}
if (GetFileAttributesA(ClientPath) == INVALID_FILE_ATTRIBUTES) {
MessageBoxA(NULL, "Couldn't find the requested SteamClientDll.", "ColdClientLoader", MB_ICONERROR);
ExitProcess(NULL);
return 0;
}
if (GetFileAttributesA(ExeFile) == INVALID_FILE_ATTRIBUTES) {
MessageBoxA(NULL, "Couldn't find the requested Exe file.", "ColdClientLoader", MB_ICONERROR);
ExitProcess(NULL);
return 0;
}
CHAR CommandLine[8192];
@ -106,98 +102,65 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
if (!ExeFile[0] || !CreateProcessA(ExeFile, CommandLine, NULL, NULL, TRUE, CREATE_SUSPENDED, NULL, ExeRunDir, &info, &processInfo))
{
MessageBoxA(NULL, "Unable to load the requested EXE file.", "ColdClientLoader", MB_ICONERROR);
ExitProcess(NULL);
return 0;
}
HKEY Registrykey;
// Declare some variables to be used for Steam registry.
DWORD UserId = 0x03100004771F810D & 0xffffffff;
DWORD ProcessID = GetCurrentProcessId();
if (RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Valve\\Steam\\ActiveProcess", 0, KEY_ALL_ACCESS, &Registrykey) != ERROR_SUCCESS)
bool orig_steam = false;
DWORD keyType = REG_SZ;
CHAR OrgSteamCDir[MAX_PATH] = { 0 };
CHAR OrgSteamCDir64[MAX_PATH] = { 0 };
DWORD Size1 = MAX_PATH;
DWORD Size2 = MAX_PATH;
if (RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Valve\\Steam\\ActiveProcess", 0, KEY_ALL_ACCESS, &Registrykey) == ERROR_SUCCESS)
{
orig_steam = true;
// Get original values to restore later.
RegQueryValueExA(Registrykey, "SteamClientDll", 0, &keyType, (LPBYTE)& OrgSteamCDir, &Size1);
RegQueryValueExA(Registrykey, "SteamClientDll64", 0, &keyType, (LPBYTE)& OrgSteamCDir64, &Size2);
} else {
if (RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Valve\\Steam\\ActiveProcess", 0, 0, REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS, NULL, &Registrykey, NULL) != ERROR_SUCCESS)
{
MessageBoxA(NULL, "Unable to patch Steam process informations on the Windows registry.", "ColdClientLoader", MB_ICONERROR);
TerminateProcess(processInfo.hProcess, NULL);
ExitProcess(NULL);
}
else
{
// Set values to Windows registry.
RegSetValueExA(Registrykey, "ActiveUser", NULL, REG_DWORD, (LPBYTE)& UserId, sizeof(DWORD));
RegSetValueExA(Registrykey, "pid", NULL, REG_DWORD, (LPBYTE)& ProcessID, sizeof(DWORD));
{
// Before saving to the registry check again if the path was valid and if the file exist
if (GetFileAttributesA(ClientPath) != INVALID_FILE_ATTRIBUTES) {
RegSetValueExA(Registrykey, "SteamClientDll", NULL, REG_SZ, (LPBYTE)ClientPath, (DWORD)lstrlenA(ClientPath) + 1);
}
else {
RegSetValueExA(Registrykey, "SteamClientDll", NULL, REG_SZ, (LPBYTE)"", 0);
}
if (GetFileAttributesA(Client64Path) != INVALID_FILE_ATTRIBUTES) {
RegSetValueExA(Registrykey, "SteamClientDll64", NULL, REG_SZ, (LPBYTE)Client64Path, (DWORD)lstrlenA(Client64Path) + 1);
}
else {
RegSetValueExA(Registrykey, "SteamClientDll64", NULL, REG_SZ, (LPBYTE)"", 0);
}
}
RegSetValueExA(Registrykey, "Universe", NULL, REG_SZ, (LPBYTE)"Public", (DWORD)lstrlenA("Public") + 1);
// Close the HKEY Handle.
RegCloseKey(Registrykey);
ResumeThread(processInfo.hThread);
WaitForSingleObject(processInfo.hThread, INFINITE);
CloseHandle(processInfo.hProcess);
CloseHandle(processInfo.hThread);
ExitProcess(NULL);
return 0;
}
}
else
// Set values to Windows registry.
RegSetValueExA(Registrykey, "ActiveUser", NULL, REG_DWORD, (LPBYTE)& UserId, sizeof(DWORD));
RegSetValueExA(Registrykey, "pid", NULL, REG_DWORD, (LPBYTE)& ProcessID, sizeof(DWORD));
{
DWORD keyType = REG_SZ;
CHAR OrgSteamCDir[MAX_PATH] = { 0 };
CHAR OrgSteamCDir64[MAX_PATH] = { 0 };
DWORD Size1 = MAX_PATH;
DWORD Size2 = MAX_PATH;
// Get original values to restore later.
RegQueryValueExA(Registrykey, "SteamClientDll", 0, &keyType, (LPBYTE)& OrgSteamCDir, &Size1);
RegQueryValueExA(Registrykey, "SteamClientDll64", 0, &keyType, (LPBYTE)& OrgSteamCDir64, &Size2);
// Set values to Windows registry.
RegSetValueExA(Registrykey, "ActiveUser", NULL, REG_DWORD, (LPBYTE)& UserId, sizeof(DWORD));
RegSetValueExA(Registrykey, "pid", NULL, REG_DWORD, (LPBYTE)& ProcessID, sizeof(DWORD));
{
// Before saving to the registry check again if the path was valid and if the file exist
if (GetFileAttributesA(ClientPath) != INVALID_FILE_ATTRIBUTES) {
RegSetValueExA(Registrykey, "SteamClientDll", NULL, REG_SZ, (LPBYTE)ClientPath, (DWORD)lstrlenA(ClientPath) + 1);
}
else {
RegSetValueExA(Registrykey, "SteamClientDll", NULL, REG_SZ, (LPBYTE)"", 0);
}
if (GetFileAttributesA(Client64Path) != INVALID_FILE_ATTRIBUTES) {
RegSetValueExA(Registrykey, "SteamClientDll64", NULL, REG_SZ, (LPBYTE)Client64Path, (DWORD)lstrlenA(Client64Path) + 1);
}
else {
RegSetValueExA(Registrykey, "SteamClientDll64", NULL, REG_SZ, (LPBYTE)"", 0);
}
// Before saving to the registry check again if the path was valid and if the file exist
if (GetFileAttributesA(ClientPath) != INVALID_FILE_ATTRIBUTES) {
RegSetValueExA(Registrykey, "SteamClientDll", NULL, REG_SZ, (LPBYTE)ClientPath, (DWORD)lstrlenA(ClientPath) + 1);
}
RegSetValueExA(Registrykey, "Universe", NULL, REG_SZ, (LPBYTE)"Public", (DWORD)lstrlenA("Public") + 1);
else {
RegSetValueExA(Registrykey, "SteamClientDll", NULL, REG_SZ, (LPBYTE)"", 0);
}
if (GetFileAttributesA(Client64Path) != INVALID_FILE_ATTRIBUTES) {
RegSetValueExA(Registrykey, "SteamClientDll64", NULL, REG_SZ, (LPBYTE)Client64Path, (DWORD)lstrlenA(Client64Path) + 1);
}
else {
RegSetValueExA(Registrykey, "SteamClientDll64", NULL, REG_SZ, (LPBYTE)"", 0);
}
}
RegSetValueExA(Registrykey, "Universe", NULL, REG_SZ, (LPBYTE)"Public", (DWORD)lstrlenA("Public") + 1);
// Close the HKEY Handle.
RegCloseKey(Registrykey);
// Close the HKEY Handle.
RegCloseKey(Registrykey);
ResumeThread(processInfo.hThread);
WaitForSingleObject(processInfo.hThread, INFINITE);
CloseHandle(processInfo.hProcess);
CloseHandle(processInfo.hThread);
ResumeThread(processInfo.hThread);
WaitForSingleObject(processInfo.hThread, INFINITE);
CloseHandle(processInfo.hProcess);
CloseHandle(processInfo.hThread);
if (orig_steam) {
if (RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Valve\\Steam\\ActiveProcess", 0, KEY_ALL_ACCESS, &Registrykey) == ERROR_SUCCESS)
{
// Restore the values.
@ -207,9 +170,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
// Close the HKEY Handle.
RegCloseKey(Registrykey);
}
ExitProcess(NULL);
}
return 1;
return 0;
}

View File

@ -0,0 +1,7 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_BUILD_TYPE release)
set(VCPKG_CMAKE_SYSTEM_NAME Linux)

View File

@ -0,0 +1,16 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_BUILD_TYPE release)
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(ENV{OSXCROSS_HOST} "x86_64-apple-$ENV{OSXCROSS_TARGET}")
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE /osxcross/target/toolchain.cmake)
set(ENV{VCPKG_TOOLCHAIN} "/vcpkg/scripts/toolchains/osx.cmake")
set(VCPKG_C_FLAGS "-stdlib=libc++")
set(VCPKG_CXX_FLAGS "-stdlib=libc++")

View File

@ -0,0 +1,11 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_BUILD_TYPE release)
set(ENV{HOST_ARCH} ${VCPKG_TARGET_ARCHITECTURE})
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE /clang_windows_sdk/clang-cl-msvc.cmake)
set(ENV{VCPKG_TOOLCHAIN} "/vcpkg/scripts/toolchains/windows.cmake")

View File

@ -0,0 +1,7 @@
set(VCPKG_TARGET_ARCHITECTURE x86)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_BUILD_TYPE release)
set(VCPKG_CMAKE_SYSTEM_NAME Linux)

View File

@ -0,0 +1,16 @@
set(VCPKG_TARGET_ARCHITECTURE x86)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_BUILD_TYPE release)
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(ENV{OSXCROSS_HOST} "i386-apple-$ENV{OSXCROSS_TARGET}")
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE /osxcross/target/toolchain.cmake)
set(ENV{VCPKG_TOOLCHAIN} "/vcpkg/scripts/toolchains/osx.cmake")
set(VCPKG_C_FLAGS "-stdlib=libc++")
set(VCPKG_CXX_FLAGS "-stdlib=libc++")

View File

@ -0,0 +1,11 @@
set(VCPKG_TARGET_ARCHITECTURE x86)
set(VCPKG_CRT_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_BUILD_TYPE release)
set(ENV{HOST_ARCH} ${VCPKG_TARGET_ARCHITECTURE})
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE /clang_windows_sdk/clang-cl-msvc.cmake)
set(ENV{VCPKG_TOOLCHAIN} "/vcpkg/scripts/toolchains/windows.cmake")