Merge pull request #12 from Sak32009/dev

Updated third-party and libs deps + improved package_win_release.bat and build_win_premake.bat + added generate_credits.bat from SOURCE.txt files.
This commit is contained in:
Detanup01 2024-08-18 20:49:58 +02:00 committed by GitHub
commit c1a3856b20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
34 changed files with 13740 additions and 4864 deletions

View File

@ -2,7 +2,7 @@ name: Prepare release
on: on:
push: push:
tags: tags:
- release-* - release-*
workflow_dispatch: workflow_dispatch:
# allows manual trigger # allows manual trigger
@ -58,12 +58,12 @@ jobs:
dir /s /b /a:-d build\win dir /s /b /a:-d build\win
### remove linker files ### remove linker files
- name: Remove linker files ### - name: Remove linker files
shell: cmd ### shell: cmd
working-directory: ${{ github.workspace }} ### working-directory: ${{ github.workspace }}
run: | ### run: |
del /f /s /q build\win\*.exp,build\win\*.lib ### del /f /s /q build\win\*.exp,build\win\*.lib
exit /b 0 ### exit /b 0
### package (release mode) ### package (release mode)
- name: Package build (release) - name: Package build (release)

1761
CREDITS.md

File diff suppressed because it is too large Load Diff

View File

@ -1,120 +1,117 @@
@echo off @echo off
setlocal setlocal EnableDelayedExpansion
cd /d "%~dp0"
:: use 70%
set /a build_threads=2 set /a "MAX_THREADS=2"
if defined NUMBER_OF_PROCESSORS ( if defined NUMBER_OF_PROCESSORS (
set /a build_threads=NUMBER_OF_PROCESSORS*70/100 :: use 70%
) set /a "MAX_THREADS=%NUMBER_OF_PROCESSORS% * 70 / 100"
if %build_threads% lss 1 ( if %MAX_THREADS% lss 1 (
set /a build_threads=1 set /a "MAX_THREADS=1"
) )
)
set /a BUILD_DEPS=0
:args_loop set /a "BUILD_DEPS=0"
if "%~1"=="" (
goto :args_loop_end :args_loop
) else if "%~1"=="--deps" ( if "%~1" equ "" (
set /a BUILD_DEPS=1 goto :args_loop_end
) else if "%~1"=="--help" ( ) else if "%~1" equ "--deps" (
call :help_page set /a "BUILD_DEPS=1"
goto :end_script ) else if "%~1" equ "--help" (
) else ( goto :help_page
1>&2 echo "invalid arg %~1" ) else (
goto :end_script_with_err 1>&2 echo: invalid arg %~1
) goto :end_script_with_err
shift /1 )
goto :args_loop
:args_loop_end shift /1
goto :args_loop
set "premake_exe=third-party\common\win\premake\premake5.exe"
if not exist "%premake_exe%" ( :args_loop_end
1>&2 echo "preamke wasn't found" :: check premake
goto :end_script_with_err set "PREMAKE_EXE=third-party\common\win\premake\premake5.exe"
) if not exist "%PREMAKE_EXE%" (
1>&2 echo: premake wasn't found
:: build deps goto :end_script_with_err
if %BUILD_DEPS%==0 ( )
goto :build_deps_end
) :: build deps
set "CMAKE_GENERATOR=Visual Studio 17 2022" if %BUILD_DEPS% equ 1 (
call "%premake_exe%" --file="premake5-deps.lua" --all-ext --all-build --64-build --32-build --verbose --clean --os=windows vs2022 set "CMAKE_GENERATOR=Visual Studio 17 2022"
if %errorlevel% neq 0 ( call "%PREMAKE_EXE%" --file="premake5-deps.lua" --64-build --32-build --all-ext --all-build --j=2 --verbose --clean --os=windows vs2022
goto :end_script_with_err if %errorlevel% neq 0 (
) goto :end_script_with_err
:build_deps_end )
goto :end_script
:: VS WHERE to get MSBUILD )
set "vswhere_exe=third-party\common\win\vswhere\vswhere.exe"
if not exist "%vswhere_exe%" ( :: check vswhere
1>&2 echo "vswhere wasn't found" set "VSWHERE_EXE=third-party\common\win\vswhere\vswhere.exe"
goto :end_script_with_err if not exist "%VSWHERE_EXE%" (
) 1>&2 echo: vswhere wasn't found
goto :end_script_with_err
:: .sln file )
set "sln_file=build\project\vs2022\win\gbe.sln"
:: check msbuild
:: get msbuild path set "MSBUILD_EXE="
set "my_vs_path=" for /f "tokens=* delims=" %%A in ('"%VSWHERE_EXE%" -prerelease -latest -nocolor -nologo -property installationPath 2^>nul') do (
for /f "tokens=* delims=" %%A in ('"%vswhere_exe%" -prerelease -latest -nocolor -nologo -property installationPath 2^>nul') do ( set "MSBUILD_EXE=%%~A\MSBuild\Current\Bin\MSBuild.exe"
set "my_vs_path=%%~A\MSBuild\Current\Bin\MSBuild.exe" )
) if not exist "%MSBUILD_EXE%" (
if not exist "%my_vs_path%" ( 1>&2 echo: MSBuild wasn't found
1>&2 echo "MSBuild wasn't found" goto :end_script_with_err
goto :end_script_with_err )
)
:: create .sln
call "%premake_exe%" --file="premake5.lua" --dosstub --winrsrc --winsign --genproto --os=windows vs2022 call "%PREMAKE_EXE%" --file="premake5.lua" --genproto --dosstub --winrsrc --winsign --os=windows vs2022
if %errorlevel% neq 0 ( if %errorlevel% neq 0 (
goto :end_script_with_err goto :end_script_with_err
) )
if not exist "%sln_file%" (
1>&2 echo "project solution file wasn't found" :: check .sln
goto :end_script_with_err set "SLN_FILE=build\project\vs2022\win\gbe.sln"
) if not exist "%SLN_FILE%" (
1>&2 echo: .sln file wasn't found
:: -v:n make it so we can actually see what commands it runs goto :end_script_with_err
echo: & echo building debug x64 )
call "%my_vs_path%" /nologo "%sln_file%" /p:Configuration=debug /p:Platform=x64 -v:n -m:%build_threads%
if %errorlevel% neq 0 ( :: build .sln
goto :end_script_with_err set "BUILD_TYPES=release debug"
) set "BUILD_PLATFORMS=x64 Win32"
set "BUILD_TARGETS=api_regular api_experimental steamclient_experimental_stub steamclient_experimental steamclient_experimental_loader steamclient_experimental_extra lib_game_overlay_renderer tool_lobby_connect tool_generate_interfaces"
echo: & echo building debug x32
call "%my_vs_path%" /nologo "%sln_file%" /p:Configuration=debug /p:Platform=Win32 -v:n -m:%build_threads% for %%A in (%BUILD_TYPES%) do (
if %errorlevel% neq 0 ( set "BUILD_TYPE=%%A"
goto :end_script_with_err for %%B in (%BUILD_PLATFORMS%) do (
) set "BUILD_PLATFORM=%%B"
for %%C in (%BUILD_TARGETS%) do (
echo: & echo building release x64 set "BUILD_TARGET=%%C"
call "%my_vs_path%" /nologo "%sln_file%" /p:Configuration=release /p:Platform=x64 -v:n -m:%build_threads% echo. & echo: building !BUILD_TARGET! !BUILD_TYPE! !BUILD_PLATFORM!
if %errorlevel% neq 0 ( call "%MSBUILD_EXE%" /nologo -m:%MAX_THREADS% -v:n /p:Configuration=!BUILD_TYPE!,Platform=!BUILD_PLATFORM! /target:!BUILD_TARGET! "%SLN_FILE%"
goto :end_script_with_err if %errorlevel% neq 0 (
) goto :end_script_with_err
)
echo: & echo building release x32 )
call "%my_vs_path%" /nologo "%sln_file%" /p:Configuration=release /p:Platform=Win32 -v:n -m:%build_threads% )
if %errorlevel% neq 0 ( )
goto :end_script_with_err
) goto :end_script
:: exit without error
:: if all ok :end_script
:end_script endlocal
endlocal exit /b 0
exit /b 0
:: exit with error
:end_script_with_err
:: exit with error endlocal
:end_script_with_err exit /b 1
endlocal
exit /b 1 :: show help page
:help_page
echo: "%~nx0" [switches]
:help_page echo: switches:
echo: echo: --deps: rebuild third-party dependencies
echo "%~nx0" [switches] echo: --help: show this page
echo switches: goto :end_script
echo --deps: rebuild third-party dependencies
echo --help: show this page
exit /b 0

View File

@ -0,0 +1,3 @@
@echo off
call "build_win_premake.bat" --deps

View File

@ -23,6 +23,7 @@
#define STBI_ONLY_JPEG #define STBI_ONLY_JPEG
#if defined(__WINDOWS__) #if defined(__WINDOWS__)
#define STBI_WINDOWS_UTF8 #define STBI_WINDOWS_UTF8
#define STBIW_WINDOWS_UTF8
#endif #endif
#include "stb/stb_image.h" #include "stb/stb_image.h"
@ -31,7 +32,7 @@
#include "stb/stb_image_write.h" #include "stb/stb_image_write.h"
#define STB_IMAGE_RESIZE_IMPLEMENTATION #define STB_IMAGE_RESIZE_IMPLEMENTATION
#include "stb/stb_image_resize.h" #include "stb/stb_image_resize2.h"
struct File_Data { struct File_Data {
std::string name{}; std::string name{};
@ -328,7 +329,7 @@ static int mkdir_p(const char *dir, const mode_t mode) {
char *p = NULL; char *p = NULL;
struct stat sb; struct stat sb;
size_t len; size_t len;
/* copy path */ /* copy path */
len = strnlen (dir, PATH_MAX_STRING_SIZE); len = strnlen (dir, PATH_MAX_STRING_SIZE);
if (len == 0 || len == PATH_MAX_STRING_SIZE) { if (len == 0 || len == PATH_MAX_STRING_SIZE) {
@ -348,7 +349,7 @@ static int mkdir_p(const char *dir, const mode_t mode) {
return 0; return 0;
} }
} }
/* recursive mkdir */ /* recursive mkdir */
for(p = tmp + 1; *p; p++) { for(p = tmp + 1; *p; p++) {
if(*p == '/') { if(*p == '/') {
@ -448,7 +449,7 @@ static std::vector<struct File_Data> get_filenames_recursive(std::string base_pa
} }
#endif #endif
std::string Local_Storage::get_program_path() std::string Local_Storage::get_program_path()
{ {
@ -473,7 +474,7 @@ std::string Local_Storage::get_user_appdata_path()
} }
#else #else
/* $XDG_DATA_HOME defines the base directory relative to which user specific data files should be stored. /* $XDG_DATA_HOME defines the base directory relative to which user specific data files should be stored.
If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used. */ If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used. */
char *datadir = getenv("XDG_DATA_HOME"); char *datadir = getenv("XDG_DATA_HOME");
if (datadir) { if (datadir) {
@ -500,7 +501,7 @@ static std::string replace_with(std::string s, std::string const &old, const cha
static std::string sanitize_file_name(std::string name) static std::string sanitize_file_name(std::string name)
{ {
if (name.empty()) return name; if (name.empty()) return name;
//I'm not sure all of these are necessary but just to be sure //I'm not sure all of these are necessary but just to be sure
if (name[0] == '.' && name.size() > 2 && (name[1] == '\\' || name[1] == '/')) name.erase(0, 2); if (name[0] == '.' && name.size() > 2 && (name[1] == '\\' || name[1] == '/')) name.erase(0, 2);
@ -523,7 +524,7 @@ static std::string sanitize_file_name(std::string name)
static std::string desanitize_file_name(std::string name) static std::string desanitize_file_name(std::string name)
{ {
if (name.empty()) return name; if (name.empty()) return name;
//I'm not sure all of these are necessary but just to be sure //I'm not sure all of these are necessary but just to be sure
name = replace_with(name, ".SLASH.", "/"); name = replace_with(name, ".SLASH.", "/");
name = replace_with(name, ".B_SLASH.", "\\"); name = replace_with(name, ".B_SLASH.", "\\");
@ -627,7 +628,7 @@ std::vector<std::string> Local_Storage::get_folders_path(std::string path)
} }
} }
} catch(...) { } } catch(...) { }
return output; return output;
} }
@ -847,7 +848,7 @@ bool Local_Storage::write_json_file(std::string folder, std::string const&file,
inventory_file << std::setw(2) << json; inventory_file << std::setw(2) << json;
return true; return true;
} }
PRINT_DEBUG("Couldn't open file '%s' to write json", full_path.c_str()); PRINT_DEBUG("Couldn't open file '%s' to write json", full_path.c_str());
reset_LastError(); reset_LastError();
@ -882,23 +883,23 @@ std::string Local_Storage::load_image_resized(std::string const& image_path, std
PRINT_DEBUG("stbi_load('%s') -> %s", image_path.c_str(), (img ? "loaded" : stbi_failure_reason())); PRINT_DEBUG("stbi_load('%s') -> %s", image_path.c_str(), (img ? "loaded" : stbi_failure_reason()));
if (img) { if (img) {
std::vector<char> out_resized(resized_img_size); std::vector<char> out_resized(resized_img_size);
stbir_resize_uint8(img, width, height, 0, (unsigned char*)&out_resized[0], resolution, resolution, 0, 4); stbir_resize_uint8_linear(img, width, height, 0, (unsigned char*)&out_resized[0], resolution, resolution, 0, STBIR_RGBA);
resized_image = std::string((char*)&out_resized[0], out_resized.size()); resized_image = std::string((char*)&out_resized[0], out_resized.size());
stbi_image_free(img); stbi_image_free(img);
} }
} else if (image_data.size()) { } else if (image_data.size()) {
std::vector<char> out_resized(resized_img_size); std::vector<char> out_resized(resized_img_size);
stbir_resize_uint8((unsigned char*)image_data.c_str(), 184, 184, 0, (unsigned char*)&out_resized[0], resolution, resolution, 0, 4); stbir_resize_uint8_linear((unsigned char*)image_data.c_str(), 184, 184, 0, (unsigned char*)&out_resized[0], resolution, resolution, 0, STBIR_RGBA);
resized_image = std::string((char*)&out_resized[0], out_resized.size()); resized_image = std::string((char*)&out_resized[0], out_resized.size());
} }
reset_LastError(); reset_LastError();
return resized_image; return resized_image;
} }
bool Local_Storage::save_screenshot(std::string const& image_path, uint8_t* img_ptr, int32_t width, int32_t height, int32_t channels) bool Local_Storage::save_screenshot(std::string const& image_path, uint8_t* img_ptr, int32_t width, int32_t height, int32_t channels)
{ {
std::string screenshot_path(save_directory + appid + screenshots_folder + PATH_SEPARATOR); std::string screenshot_path(save_directory + appid + screenshots_folder + PATH_SEPARATOR);
create_directory(screenshot_path); create_directory(screenshot_path);
screenshot_path += image_path; screenshot_path += image_path;
return stbi_write_png(screenshot_path.c_str(), width, height, channels, img_ptr, 0) == 1; return stbi_write_png(screenshot_path.c_str(), width, height, channels, img_ptr, 0) == 1;

26
generate_credits.bat Normal file
View File

@ -0,0 +1,26 @@
@echo off
setlocal EnableDelayedExpansion
cd /d "%~dp0"
set "CREDITS_FILE=CREDITS.md"
if exist "%CREDITS_FILE%" (
del /f /s /q "%CREDITS_FILE%"
)
set "GLOB=third-party libs tools\steamclient_loader"
set "FILTER=SOURCE.txt"
echo:# Many thanks for these sources>> "%CREDITS_FILE%"
for %%A in (%GLOB%) do (
powershell -Command "Get-ChildItem -LiteralPath \"%%~A\" -Filter \"%FILTER%\" -File -Recurse | foreach { $parent = Split-Path -Path $_.FullName -Parent; $relative = (Resolve-Path -Path $parent -Relative).replace(\".\\\",\"\"); Write-Output \"- ^[$^($relative^)^]^(#$^($relative^)^)\"; }">> "%CREDITS_FILE%"
)
echo.>> "%CREDITS_FILE%"
for %%B in (%GLOB%) do (
powershell -Command "Get-ChildItem -LiteralPath \"%%~B\" -Filter \"%FILTER%\" -File -Recurse | foreach { $parent = Split-Path -Path $_.FullName -Parent; $relative = (Resolve-Path -Path $parent -Relative).replace(\".\\\",\"\"); Write-Output \"### $^($relative^)\"; Write-Output \"\"; Get-Content -LiteralPath $_.FullName -Raw -Encoding utf8; }">> "%CREDITS_FILE%"
)
endlocal

View File

@ -1,23 +0,0 @@
# Copyright (c) Microsoft Corporation
All rights reserved.
# MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,3 +1,9 @@
============================================================================ INFO
https://github.com/microsoft/Detours
VERSION: https://github.com/microsoft/Detours/tree/4b8c659f549b0ab21cf649377c7a84eb708f5e68
============================================================================ LICENSE
Copyright (c) Microsoft Corporation. Copyright (c) Microsoft Corporation.
MIT License MIT License

View File

@ -1395,6 +1395,12 @@ PVOID WINAPI DetourAllocateRegionWithinJumpBounds(_In_ LPCVOID pbTarget,
return pbNewlyAllocated; return pbNewlyAllocated;
} }
BOOL WINAPI DetourIsFunctionImported(_In_ PBYTE pbCode,
_In_ PBYTE pbAddress)
{
return detour_is_imported(pbCode, pbAddress);
}
static PDETOUR_TRAMPOLINE detour_alloc_trampoline(PBYTE pbTarget) static PDETOUR_TRAMPOLINE detour_alloc_trampoline(PBYTE pbTarget)
{ {
// We have to place trampolines within +/- 2GB of target. // We have to place trampolines within +/- 2GB of target.
@ -1437,7 +1443,8 @@ static PDETOUR_TRAMPOLINE detour_alloc_trampoline(PBYTE pbTarget)
// We need to allocate a new region. // We need to allocate a new region.
// Round pbTarget down to 64KB block. // Round pbTarget down to 64KB block.
pbTarget = pbTarget - (PtrToUlong(pbTarget) & 0xffff); // /RTCc RuntimeChecks breaks PtrToUlong.
pbTarget = pbTarget - (ULONG)((ULONG_PTR)pbTarget & 0xffff);
PVOID pbNewlyAllocated = PVOID pbNewlyAllocated =
detour_alloc_trampoline_allocate_new(pbTarget, pLo, pHi); detour_alloc_trampoline_allocate_new(pbTarget, pLo, pHi);
@ -2098,6 +2105,12 @@ LONG WINAPI DetourAttachEx(_Inout_ PVOID *ppPointer,
delete o; delete o;
o = NULL; o = NULL;
} }
if (ppRealDetour != NULL) {
*ppRealDetour = NULL;
}
if (ppRealTarget != NULL) {
*ppRealTarget = NULL;
}
s_ppPendingError = ppPointer; s_ppPendingError = ppPointer;
return error; return error;
} }

View File

@ -56,6 +56,7 @@
#define __try #define __try
#define __except(x) if (0) #define __except(x) if (0)
#include <strsafe.h> #include <strsafe.h>
#include <intsafe.h>
#endif #endif
// From winerror.h, as this error isn't found in some SDKs: // From winerror.h, as this error isn't found in some SDKs:
@ -380,7 +381,11 @@ extern const GUID DETOUR_EXE_RESTORE_GUID;
extern const GUID DETOUR_EXE_HELPER_GUID; extern const GUID DETOUR_EXE_HELPER_GUID;
#define DETOUR_TRAMPOLINE_SIGNATURE 0x21727444 // Dtr! #define DETOUR_TRAMPOLINE_SIGNATURE 0x21727444 // Dtr!
typedef struct _DETOUR_TRAMPOLINE DETOUR_TRAMPOLINE, *PDETOUR_TRAMPOLINE; typedef struct _DETOUR_TRAMPOLINE DETOUR_TRAMPOLINE, *PDETOUR_TRAMPOLINE;
#ifndef DETOUR_MAX_SUPPORTED_IMAGE_SECTION_HEADERS
#define DETOUR_MAX_SUPPORTED_IMAGE_SECTION_HEADERS 32
#endif // !DETOUR_MAX_SUPPORTED_IMAGE_SECTION_HEADERS
/////////////////////////////////////////////////////////// Binary Structures. /////////////////////////////////////////////////////////// Binary Structures.
// //
@ -453,9 +458,9 @@ typedef struct _DETOUR_EXE_RESTORE
#endif #endif
#ifdef IMAGE_NT_OPTIONAL_HDR64_MAGIC // some environments do not have this #ifdef IMAGE_NT_OPTIONAL_HDR64_MAGIC // some environments do not have this
BYTE raw[sizeof(IMAGE_NT_HEADERS64) + BYTE raw[sizeof(IMAGE_NT_HEADERS64) +
sizeof(IMAGE_SECTION_HEADER) * 32]; sizeof(IMAGE_SECTION_HEADER) * DETOUR_MAX_SUPPORTED_IMAGE_SECTION_HEADERS];
#else #else
BYTE raw[0x108 + sizeof(IMAGE_SECTION_HEADER) * 32]; BYTE raw[0x108 + sizeof(IMAGE_SECTION_HEADER) * DETOUR_MAX_SUPPORTED_IMAGE_SECTION_HEADERS];
#endif #endif
}; };
DETOUR_CLR_HEADER clr; DETOUR_CLR_HEADER clr;
@ -589,7 +594,9 @@ PVOID WINAPI DetourCopyInstruction(_In_opt_ PVOID pDst,
BOOL WINAPI DetourSetCodeModule(_In_ HMODULE hModule, BOOL WINAPI DetourSetCodeModule(_In_ HMODULE hModule,
_In_ BOOL fLimitReferencesToModule); _In_ BOOL fLimitReferencesToModule);
PVOID WINAPI DetourAllocateRegionWithinJumpBounds(_In_ LPCVOID pbTarget, PVOID WINAPI DetourAllocateRegionWithinJumpBounds(_In_ LPCVOID pbTarget,
_Out_ PDWORD pcbAllocatedSize); _Out_ PDWORD pcbAllocatedSize);
BOOL WINAPI DetourIsFunctionImported(_In_ PBYTE pbCode,
_In_ PBYTE pbAddress);
///////////////////////////////////////////////////// Loaded Binary Functions. ///////////////////////////////////////////////////// Loaded Binary Functions.
// //
@ -951,10 +958,10 @@ typedef DWORD (NTAPI *PF_SymSetOptions)(_In_ DWORD SymOptions);
typedef DWORD (NTAPI *PF_SymGetOptions)(VOID); typedef DWORD (NTAPI *PF_SymGetOptions)(VOID);
typedef DWORD64 (NTAPI *PF_SymLoadModule64)(_In_ HANDLE hProcess, typedef DWORD64 (NTAPI *PF_SymLoadModule64)(_In_ HANDLE hProcess,
_In_opt_ HANDLE hFile, _In_opt_ HANDLE hFile,
_In_ LPSTR ImageName, _In_opt_ LPSTR ImageName,
_In_opt_ LPSTR ModuleName, _In_opt_ LPSTR ModuleName,
_In_ DWORD64 BaseOfDll, _In_ DWORD64 BaseOfDll,
_In_opt_ DWORD SizeOfDll); _In_ DWORD SizeOfDll);
typedef BOOL (NTAPI *PF_SymGetModuleInfo64)(_In_ HANDLE hProcess, typedef BOOL (NTAPI *PF_SymGetModuleInfo64)(_In_ HANDLE hProcess,
_In_ DWORD64 qwAddr, _In_ DWORD64 qwAddr,
_Out_ PIMAGEHLP_MODULE64 ModuleInfo); _Out_ PIMAGEHLP_MODULE64 ModuleInfo);

View File

@ -279,7 +279,7 @@ class CDetourDis
PBYTE CopyVex2(REFCOPYENTRY pEntry, PBYTE pbDst, PBYTE pbSrc); PBYTE CopyVex2(REFCOPYENTRY pEntry, PBYTE pbDst, PBYTE pbSrc);
PBYTE CopyVex3(REFCOPYENTRY pEntry, PBYTE pbDst, PBYTE pbSrc); PBYTE CopyVex3(REFCOPYENTRY pEntry, PBYTE pbDst, PBYTE pbSrc);
PBYTE CopyVexCommon(BYTE m, PBYTE pbDst, PBYTE pbSrc); PBYTE CopyVexCommon(BYTE m, PBYTE pbDst, PBYTE pbSrc);
PBYTE CopyVexEvexCommon(BYTE m, PBYTE pbDst, PBYTE pbSrc, BYTE p); PBYTE CopyVexEvexCommon(BYTE m, PBYTE pbDst, PBYTE pbSrc, BYTE p, BYTE fp16 = 0);
PBYTE CopyEvex(REFCOPYENTRY pEntry, PBYTE pbDst, PBYTE pbSrc); PBYTE CopyEvex(REFCOPYENTRY pEntry, PBYTE pbDst, PBYTE pbSrc);
PBYTE CopyXop(REFCOPYENTRY pEntry, PBYTE pbDst, PBYTE pbSrc); PBYTE CopyXop(REFCOPYENTRY pEntry, PBYTE pbDst, PBYTE pbSrc);
@ -745,7 +745,7 @@ PBYTE CDetourDis::CopyFF(REFCOPYENTRY pEntry, PBYTE pbDst, PBYTE pbSrc)
return pbOut; return pbOut;
} }
PBYTE CDetourDis::CopyVexEvexCommon(BYTE m, PBYTE pbDst, PBYTE pbSrc, BYTE p) PBYTE CDetourDis::CopyVexEvexCommon(BYTE m, PBYTE pbDst, PBYTE pbSrc, BYTE p, BYTE fp16)
// m is first instead of last in the hopes of pbDst/pbSrc being // m is first instead of last in the hopes of pbDst/pbSrc being
// passed along efficiently in the registers they were already in. // passed along efficiently in the registers they were already in.
{ {
@ -762,10 +762,13 @@ PBYTE CDetourDis::CopyVexEvexCommon(BYTE m, PBYTE pbDst, PBYTE pbSrc, BYTE p)
REFCOPYENTRY pEntry; REFCOPYENTRY pEntry;
switch (m) { // see https://software.intel.com/content/www/us/en/develop/download/intel-avx512-fp16-architecture-specification.html
switch (m | fp16) {
default: return Invalid(&ceInvalid, pbDst, pbSrc); default: return Invalid(&ceInvalid, pbDst, pbSrc);
case 1: pEntry = &s_rceCopyTable0F[pbSrc[0]]; case 1: pEntry = &s_rceCopyTable0F[pbSrc[0]];
return (this->*pEntry->pfCopy)(pEntry, pbDst, pbSrc); return (this->*pEntry->pfCopy)(pEntry, pbDst, pbSrc);
case 5: // fallthrough
case 6: // fallthrough
case 2: return CopyBytes(&ceF38, pbDst, pbSrc); case 2: return CopyBytes(&ceF38, pbDst, pbSrc);
case 3: return CopyBytes(&ceF3A, pbDst, pbSrc); case 3: return CopyBytes(&ceF3A, pbDst, pbSrc);
} }
@ -859,7 +862,9 @@ PBYTE CDetourDis::CopyEvex(REFCOPYENTRY, PBYTE pbDst, PBYTE pbSrc)
static const COPYENTRY ceInvalid = /* 62 */ ENTRY_Invalid; static const COPYENTRY ceInvalid = /* 62 */ ENTRY_Invalid;
if ((p0 & 0x0C) != 0) // This could also be handled by default in CopyVexEvexCommon
// if 4u changed to 4|8.
if (p0 & 8u)
return Invalid(&ceInvalid, pbDst, pbSrc); return Invalid(&ceInvalid, pbDst, pbSrc);
BYTE const p1 = pbSrc[2]; BYTE const p1 = pbSrc[2];
@ -876,7 +881,7 @@ PBYTE CDetourDis::CopyEvex(REFCOPYENTRY, PBYTE pbDst, PBYTE pbSrc)
m_bRaxOverride |= !!(p1 & 0x80); // w m_bRaxOverride |= !!(p1 & 0x80); // w
#endif #endif
return CopyVexEvexCommon(p0 & 3u, pbDst + 4, pbSrc + 4, p1 & 3u); return CopyVexEvexCommon(p0 & 3u, pbDst + 4, pbSrc + 4, p1 & 3u, p0 & 4u);
} }
PBYTE CDetourDis::CopyXop(REFCOPYENTRY, PBYTE pbDst, PBYTE pbSrc) PBYTE CDetourDis::CopyXop(REFCOPYENTRY, PBYTE pbDst, PBYTE pbSrc)
@ -1595,8 +1600,8 @@ const CDetourDis::COPYENTRY CDetourDis::s_rceCopyTable0F[] =
}; };
BOOL CDetourDis::SanityCheckSystem() BOOL CDetourDis::SanityCheckSystem()
{ {
C_ASSERT(ARRAYSIZE(CDetourDis::s_rceCopyTable) == 256); C_ASSERT(ARRAYSIZE(CDetourDis::s_rceCopyTable) == 256);
C_ASSERT(ARRAYSIZE(CDetourDis::s_rceCopyTable0F) == 256); C_ASSERT(ARRAYSIZE(CDetourDis::s_rceCopyTable0F) == 256);
return TRUE; return TRUE;
} }

View File

@ -1684,7 +1684,7 @@ BOOL CImage::Write(HANDLE hFile)
m_nNextFileAddr = Max(m_SectionHeaders[n].PointerToRawData + m_nNextFileAddr = Max(m_SectionHeaders[n].PointerToRawData +
m_SectionHeaders[n].SizeOfRawData, m_SectionHeaders[n].SizeOfRawData,
m_nNextFileAddr); m_nNextFileAddr);
// Old images have VirtualSize == 0 as a matter of course, e.g. NT 3.1. // Old images have VirtualSize == 0 as a matter of course, e.g. NT 3.1.
// In which case, use SizeOfRawData instead. // In which case, use SizeOfRawData instead.
m_nNextVirtAddr = Max(m_SectionHeaders[n].VirtualAddress + m_nNextVirtAddr = Max(m_SectionHeaders[n].VirtualAddress +
(m_SectionHeaders[n].Misc.VirtualSize (m_SectionHeaders[n].Misc.VirtualSize

27
libs/fifo_map/SOURCE.txt Normal file
View File

@ -0,0 +1,27 @@
============================================================================ INFO
https://github.com/nlohmann/fifo_map
VERSION: https://github.com/nlohmann/fifo_map/tree/d732aaf9a315415ae8fd7eb11e3a4c1f80e42a48
============================================================================ LICENSE
MIT License
Copyright (c) 2015-2017 Niels Lohmann
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

26
libs/gamepad/SOURCE.txt Normal file
View File

@ -0,0 +1,26 @@
============================================================================ INFO
https://github.com/mtwilliams/libgamepad
VERSION: ????
============================================================================ LICENSE
Copyright (c) 2014 Michael Williams
Copyright (c) 2010-2011 Sean Middleditch
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -1,6 +1,12 @@
MIT License ============================================================================ INFO
https://github.com/ocornut/imgui
Copyright (c) 2015-2017 Niels Lohmann VERSION: ????
============================================================================ LICENSE
The MIT License (MIT)
Copyright (c) 2014-2024 Omar Cornut
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,4 +1,10 @@
MIT License ============================================================================ INFO
https://github.com/nlohmann/json
VERSION: https://github.com/nlohmann/json/releases/tag/v3.11.3
============================================================================ LICENSE
MIT License
Copyright (c) 2013-2022 Niels Lohmann Copyright (c) 2013-2022 Niels Lohmann

View File

@ -1 +1,7 @@
https://github.com/vog/sha1 ============================================================================ INFO
https://github.com/vog/sha1
VERSION: https://github.com/vog/sha1/tree/3f8a4aa032d144309d00dbfe972906a49b3631b9
============================================================================ LICENSE
PUBLIC DOMAIN

View File

@ -1,3 +1,9 @@
============================================================================ INFO
https://github.com/brofield/simpleini
VERSION: https://github.com/brofield/simpleini/releases/tag/v4.22
============================================================================ LICENSE
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2006-2022 Brodie Thiesfield Copyright (c) 2006-2022 Brodie Thiesfield

View File

@ -1,3 +1,9 @@
============================================================================ INFO
https://github.com/nothings/stb
VERSION: https://github.com/nothings/stb/tree/f75e8d1cad7d90d72ef7a4661f1b994ef78b4e31
============================================================================ LICENSE
This software is available under 2 licenses -- choose whichever you prefer. This software is available under 2 licenses -- choose whichever you prefer.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
ALTERNATIVE A - MIT License ALTERNATIVE A - MIT License
@ -34,4 +40,4 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

10572
libs/stb/stb_image_resize2.h Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,9 @@
============================================================================ INFO
https://github.com/nemtrif/utfcpp
VERSION: https://github.com/nemtrif/utfcpp/releases/tag/v4.0.5
============================================================================ LICENSE
Boost Software License - Version 1.0 - August 17th, 2003 Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization Permission is hereby granted, free of charge, to any person or organization

View File

@ -1,87 +1,106 @@
@echo off @echo off
setlocal EnableDelayedExpansion
setlocal cd /d "%~dp0"
pushd "%~dp0"
set /a "MAX_THREADS=2"
set /a last_code=0 if defined NUMBER_OF_PROCESSORS (
:: use 70%
set "build_base_dir=build\win" set /a "MAX_THREADS=%NUMBER_OF_PROCESSORS% * 70 / 100"
set "out_dir=build\package\win" if %MAX_THREADS% lss 1 (
set /a "MAX_THREADS=1"
set /a MEM_PERCENT=90 )
set /a DICT_SIZE_MB=384 )
set "packager=third-party\deps\win\7za\7za.exe"
set "BUILD_DIR=build\win"
:: use 70% set "OUT_DIR=build\package\win"
set /a THREAD_COUNT=2
if defined NUMBER_OF_PROCESSORS ( if "%~1" equ "" (
set /a THREAD_COUNT=NUMBER_OF_PROCESSORS*70/100 1>&2 echo: missing build target folder arg
) goto :end_script_with_err
if %THREAD_COUNT% lss 2 ( )
set /a THREAD_COUNT=2
) set "TARGET_DIR=%BUILD_DIR%\%~1"
if not exist "%TARGET_DIR%\" (
if not exist "%packager%" ( 1>&2 echo: build target folder wasn't found
1>&2 echo [X] packager app wasn't found goto :end_script_with_err
set /a last_code=1 )
goto :script_end
) set /a "BUILD_DEBUG=0"
if "%~2" equ "1" (
if "%~1"=="" ( set /a "BUILD_DEBUG=1"
1>&2 echo [X] missing build folder )
set /a last_code=1
goto :script_end set /a "PKG_EXE_MEM_PERCENT=90"
) set /a "PKG_EXE_DICT_SIZE_MB=384"
set "PKG_EXE=third-party\deps\win\7za\7za.exe"
set "target_src_dir=%build_base_dir%\%~1" if not exist "%PKG_EXE%" (
if not exist "%target_src_dir%" ( 1>&2 echo: packager wasn't found
1>&2 echo [X] build folder wasn't found goto :end_script_with_err
set /a last_code=1 )
goto :script_end
) ::::::::::::::::::::::::::::::::::::::::::
echo: // copying readmes + example files
::::::::::::::::::::::::::::::::::::::::::
echo // copying readmes + example files xcopy /y /s /e /r "post_build\steam_settings.EXAMPLE\" "%TARGET_DIR%\steam_settings.EXAMPLE\"
xcopy /y /s /e /r "post_build\steam_settings.EXAMPLE\" "%target_src_dir%\steam_settings.EXAMPLE\"
copy /y "post_build\README.release.md" "%target_src_dir%\" copy /y "post_build\README.release.md" "%TARGET_DIR%\"
copy /y "CHANGELOG.md" "%target_src_dir%\" copy /y "CHANGELOG.md" "%TARGET_DIR%\"
copy /y "CREDITS.md" "%target_src_dir%\" copy /y "CREDITS.md" "%TARGET_DIR%\"
if "%~2"=="1" (
copy /y "post_build\README.debug.md" "%target_src_dir%\" if %BUILD_DEBUG% equ 1 (
) copy /y "post_build\README.debug.md" "%TARGET_DIR%\"
if exist "%target_src_dir%\experimental\" ( )
copy /y "post_build\README.experimental.md" "%target_src_dir%\experimental\"
) if exist "%TARGET_DIR%\experimental\" (
if exist "%target_src_dir%\steamclient_experimental\" ( copy /y "post_build\README.experimental.md" "%TARGET_DIR%\experimental\"
xcopy /y /s /e /r "post_build\win\ColdClientLoader.EXAMPLE\" "%target_src_dir%\steamclient_experimental\dll_injection.EXAMPLE\" )
copy /y "post_build\README.experimental_steamclient.md" "%target_src_dir%\steamclient_experimental\"
copy /y "tools\steamclient_loader\win\ColdClientLoader.ini" "%target_src_dir%\steamclient_experimental\" if exist "%TARGET_DIR%\steamclient_experimental\" (
) xcopy /y /s /e /r "post_build\win\ColdClientLoader.EXAMPLE\" "%TARGET_DIR%\steamclient_experimental\dll_injection.EXAMPLE\"
if exist "%target_src_dir%\tools\generate_interfaces\" ( copy /y "post_build\README.experimental_steamclient.md" "%TARGET_DIR%\steamclient_experimental\"
copy /y "post_build\README.generate_interfaces.md" "%target_src_dir%\tools\generate_interfaces\" copy /y "tools\steamclient_loader\win\ColdClientLoader.ini" "%TARGET_DIR%\steamclient_experimental\"
) )
if exist "%target_src_dir%\tools\lobby_connect\" (
copy /y "post_build\README.lobby_connect.md" "%target_src_dir%\tools\lobby_connect\" if exist "%TARGET_DIR%\tools\generate_interfaces\" (
) copy /y "post_build\README.generate_interfaces.md" "%TARGET_DIR%\tools\generate_interfaces\"
:::::::::::::::::::::::::::::::::::::::::: )
set "archive_dir=%out_dir%\%~1" if exist "%TARGET_DIR%\tools\lobby_connect\" (
if exist "%archive_dir%\" ( copy /y "post_build\README.lobby_connect.md" "%TARGET_DIR%\tools\lobby_connect\"
rmdir /s /q "%archive_dir%" )
) ::::::::::::::::::::::::::::::::::::::::::
set "archive_file="
for %%A in ("%archive_dir%") do ( set "ACHIVE_DIR=%OUT_DIR%\%~1"
set "archive_file=%%~dpAemu-win-%%~nxA.7z" if exist "%ACHIVE_DIR%\" (
) rmdir /s /q "%ACHIVE_DIR%"
)
for %%A in ("%archive_dir%") do (
mkdir "%%~dpA" for %%A in ("%ACHIVE_DIR%") do (
) md "%%~dpA"
"%packager%" a "%archive_file%" ".\%target_src_dir%" -t7z -slp -ssw -mx -myx -mmemuse=p%MEM_PERCENT% -ms=on -mqs=off -mf=on -mhc+ -mhe- -m0=LZMA2:d=%DICT_SIZE_MB%m -mmt=%THREAD_COUNT% -mmtf+ -mtm- -mtc- -mta- -mtr+ )
set "ACHIVE_FILE="
:script_end for %%A in ("%ACHIVE_DIR%") do (
popd set "ACHIVE_FILE=%%~dpAemu-win-%%~nxA.7z"
endlocal & ( )
exit /b %last_code%
) if exist "%ACHIVE_FILE%" (
del /f /s /q "%ACHIVE_FILE%"
)
call "%PKG_EXE%" a "%ACHIVE_FILE%" ".\%TARGET_DIR%" -t7z -xr^^!*.lib -xr^^!*.exp -slp -ssw -mx -myx -mmemuse=p%PKG_EXE_MEM_PERCENT% -ms=on -mqs=off -mf=on -mhc+ -mhe- -m0=LZMA2:d=%PKG_EXE_DICT_SIZE_MB%m -mmt=%MAX_THREADS% -mmtf+ -mtm- -mtc- -mta- -mtr+
if %errorlevel% neq 0 (
goto :end_script_with_err
)
goto :end_script
:: exit without error
:end_script
endlocal
exit /b 0
:: exit with error
:end_script_with_err
endlocal
exit /b 1

3
package_win_debug.bat Normal file
View File

@ -0,0 +1,3 @@
@echo off
call "package_win.bat" vs2022/debug 1

3
package_win_release.bat Normal file
View File

@ -0,0 +1,3 @@
@echo off
call "package_win.bat" vs2022/release

@ -1 +1 @@
Subproject commit 07336fafed51cccbb1438bf32f90bb0d20634529 Subproject commit 89d0bbf43221dc758efa56f988cb0f0a34b84342

@ -1 +1 @@
Subproject commit ecaee3fbfc14352b79609bc781db4881b150bd42 Subproject commit b4194b9019386d456031a9a0fd6b63a867ab0108

@ -1 +1 @@
Subproject commit b7761d06842f7799a653f61a4d29f382b9873053 Subproject commit a70c58d93377d1a472d9320842183bc533d87e5d

@ -1 +1 @@
Subproject commit 1c1acc03760113ce5a440f46bc89c6832c695f8f Subproject commit 22197753b2a01b5097610f4c62f6c9f7eb1e27d2

@ -1 +1 @@
Subproject commit 6cb47a3e46e49b03be7b9c0e9b3d7c5953cf038a Subproject commit be07085cc615800304acf619fcc9f4b6107c0574

@ -1 +1 @@
Subproject commit 6eb71e5e7aa0f1ead9e7d0d10c6b9efb14566b26 Subproject commit 3171da4672b2f10a06edfed6e54e5999872f1b22

View File

@ -0,0 +1,4 @@
============================================================================ INFO
https://github.com/Rat431/ColdAPI_Steam
Original version of ColdClientLoader by Rat431.