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

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

1673
CREDITS.md

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

@ -23,6 +23,7 @@
#define STBI_ONLY_JPEG
#if defined(__WINDOWS__)
#define STBI_WINDOWS_UTF8
#define STBIW_WINDOWS_UTF8
#endif
#include "stb/stb_image.h"
@ -31,7 +32,7 @@
#include "stb/stb_image_write.h"
#define STB_IMAGE_RESIZE_IMPLEMENTATION
#include "stb/stb_image_resize.h"
#include "stb/stb_image_resize2.h"
struct File_Data {
std::string name{};
@ -882,13 +883,13 @@ 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()));
if (img) {
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());
stbi_image_free(img);
}
} else if (image_data.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());
}

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.
MIT License

View File

@ -1395,6 +1395,12 @@ PVOID WINAPI DetourAllocateRegionWithinJumpBounds(_In_ LPCVOID pbTarget,
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)
{
// 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.
// Round pbTarget down to 64KB block.
pbTarget = pbTarget - (PtrToUlong(pbTarget) & 0xffff);
// /RTCc RuntimeChecks breaks PtrToUlong.
pbTarget = pbTarget - (ULONG)((ULONG_PTR)pbTarget & 0xffff);
PVOID pbNewlyAllocated =
detour_alloc_trampoline_allocate_new(pbTarget, pLo, pHi);
@ -2098,6 +2105,12 @@ LONG WINAPI DetourAttachEx(_Inout_ PVOID *ppPointer,
delete o;
o = NULL;
}
if (ppRealDetour != NULL) {
*ppRealDetour = NULL;
}
if (ppRealTarget != NULL) {
*ppRealTarget = NULL;
}
s_ppPendingError = ppPointer;
return error;
}

View File

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

View File

@ -279,7 +279,7 @@ class CDetourDis
PBYTE CopyVex2(REFCOPYENTRY pEntry, PBYTE pbDst, PBYTE pbSrc);
PBYTE CopyVex3(REFCOPYENTRY pEntry, 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 CopyXop(REFCOPYENTRY pEntry, PBYTE pbDst, PBYTE pbSrc);
@ -745,7 +745,7 @@ PBYTE CDetourDis::CopyFF(REFCOPYENTRY pEntry, PBYTE pbDst, PBYTE pbSrc)
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
// 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;
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);
case 1: pEntry = &s_rceCopyTable0F[pbSrc[0]];
return (this->*pEntry->pfCopy)(pEntry, pbDst, pbSrc);
case 5: // fallthrough
case 6: // fallthrough
case 2: return CopyBytes(&ceF38, 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;
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);
BYTE const p1 = pbSrc[2];
@ -876,7 +881,7 @@ PBYTE CDetourDis::CopyEvex(REFCOPYENTRY, PBYTE pbDst, PBYTE pbSrc)
m_bRaxOverride |= !!(p1 & 0x80); // w
#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)

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
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,3 +1,9 @@
============================================================================ 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

View File

@ -1 +1,7 @@
============================================================================ 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)
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.
------------------------------------------------------------------------------
ALTERNATIVE A - MIT License

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

View File

@ -1,4 +1,4 @@
/* stb_image_write - v1.15 - public domain - http://nothings.org/stb
/* stb_image_write - v1.16 - public domain - http://nothings.org/stb
writes out PNG/BMP/TGA/JPEG/HDR images to C stdio - Sean Barrett 2010-2015
no warranty implied; use at your own risk
@ -140,6 +140,7 @@ CREDITS:
Ivan Tikhonov
github:ignotion
Adam Schackart
Andrew Kensler
LICENSE
@ -166,9 +167,9 @@ LICENSE
#endif
#ifndef STB_IMAGE_WRITE_STATIC // C++ forbids static forward declarations
extern int stbi_write_tga_with_rle;
extern int stbi_write_png_compression_level;
extern int stbi_write_force_png_filter;
STBIWDEF int stbi_write_tga_with_rle;
STBIWDEF int stbi_write_png_compression_level;
STBIWDEF int stbi_write_force_png_filter;
#endif
#ifndef STBI_WRITE_NO_STDIO
@ -178,7 +179,7 @@ STBIWDEF int stbi_write_tga(char const* filename, int w, int h, int comp, const
STBIWDEF int stbi_write_hdr(char const *filename, int w, int h, int comp, const float *data);
STBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp, const void *data, int quality);
#ifdef STBI_WINDOWS_UTF8
#ifdef STBIW_WINDOWS_UTF8
STBIWDEF int stbiw_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input);
#endif
#endif
@ -285,7 +286,7 @@ static void stbi__stdio_write(void* context, void* data, int size)
fwrite(data,1,size,(FILE*) context);
}
#if defined(_MSC_VER) && defined(STBI_WINDOWS_UTF8)
#if defined(_WIN32) && defined(STBIW_WINDOWS_UTF8)
#ifdef __cplusplus
#define STBIW_EXTERN extern "C"
#else
@ -303,16 +304,16 @@ STBIWDEF int stbiw_convert_wchar_to_utf8(char* buffer, size_t bufferlen, const w
static FILE *stbiw__fopen(char const *filename, char const *mode)
{
FILE *f;
#if defined(_MSC_VER) && defined(STBI_WINDOWS_UTF8)
#if defined(_WIN32) && defined(STBIW_WINDOWS_UTF8)
wchar_t wMode[64];
wchar_t wFilename[1024];
if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, filename, -1, wFilename, sizeof(wFilename)))
if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, filename, -1, wFilename, sizeof(wFilename)/sizeof(*wFilename)))
return 0;
if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, mode, -1, wMode, sizeof(wMode)))
if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, mode, -1, wMode, sizeof(wMode)/sizeof(*wMode)))
return 0;
#if _MSC_VER >= 1400
#if defined(_MSC_VER) && _MSC_VER >= 1400
if (0 != _wfopen_s(&f, wFilename, wMode))
f = 0;
#else
@ -397,7 +398,7 @@ static void stbiw__putc(stbi__write_context* s, unsigned char c)
static void stbiw__write1(stbi__write_context *s, unsigned char a)
{
if (s->buf_used + 1 > sizeof(s->buffer))
if ((size_t)s->buf_used + 1 > sizeof(s->buffer))
stbiw__write_flush(s);
s->buffer[s->buf_used++] = a;
}
@ -405,7 +406,7 @@ static void stbiw__write1(stbi__write_context* s, unsigned char a)
static void stbiw__write3(stbi__write_context *s, unsigned char a, unsigned char b, unsigned char c)
{
int n;
if (s->buf_used + 3 > sizeof(s->buffer))
if ((size_t)s->buf_used + 3 > sizeof(s->buffer))
stbiw__write_flush(s);
n = s->buf_used;
s->buf_used = n+3;
@ -460,8 +461,7 @@ static void stbiw__write_pixels(stbi__write_context* s, int rgb_dir, int vdir, i
if (vdir < 0) {
j_end = -1; j = y-1;
}
else {
} else {
j_end = y; j = 0;
}
@ -479,8 +479,7 @@ static int stbiw__outfile(stbi__write_context* s, int rgb_dir, int vdir, int x,
{
if (y < 0 || x < 0) {
return 0;
}
else {
} else {
va_list v;
va_start(v, fmt);
stbiw__writefv(s, fmt, v);
@ -492,11 +491,22 @@ static int stbiw__outfile(stbi__write_context* s, int rgb_dir, int vdir, int x,
static int stbi_write_bmp_core(stbi__write_context *s, int x, int y, int comp, const void *data)
{
if (comp != 4) {
// write RGB bitmap
int pad = (-x*3) & 3;
return stbiw__outfile(s,-1,-1,x,y,comp,1,(void *) data,0,pad,
"11 4 22 4" "4 44 22 444444",
'B', 'M', 14+40+(x*3+pad)*y, 0,0, 14+40, // file header
40, x,y, 1,24, 0,0,0,0,0,0); // bitmap header
} else {
// RGBA bitmaps need a v4 header
// use BI_BITFIELDS mode with 32bpp and alpha mask
// (straight BI_RGB with alpha mask doesn't work in most readers)
return stbiw__outfile(s,-1,-1,x,y,comp,1,(void *)data,1,0,
"11 4 22 4" "4 44 22 444444 4444 4 444 444 444 444",
'B', 'M', 14+108+x*y*4, 0, 0, 14+108, // file header
108, x,y, 1,32, 3,0,0,0,0,0, 0xff0000,0xff00,0xff,0xff000000u, 0, 0,0,0, 0,0,0, 0,0,0, 0,0,0); // bitmap V4 header
}
}
STBIWDEF int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data)
@ -514,8 +524,7 @@ STBIWDEF int stbi_write_bmp(char const* filename, int x, int y, int comp, const
int r = stbi_write_bmp_core(&s, x, y, comp, data);
stbi__end_write_file(&s);
return r;
}
else
} else
return 0;
}
#endif //!STBI_WRITE_NO_STDIO
@ -532,8 +541,7 @@ static int stbi_write_tga_core(stbi__write_context* s, int x, int y, int comp, v
if (!stbi_write_tga_with_rle) {
return stbiw__outfile(s, -1, -1, x, y, comp, 0, (void *) data, has_alpha, 0,
"111 221 2222 11", 0, 0, format, 0, 0, 0, 0, 0, x, y, (colorbytes + has_alpha) * 8, has_alpha * 8);
}
else {
} else {
int i,j,k;
int jend, jdir;
@ -543,8 +551,7 @@ static int stbi_write_tga_core(stbi__write_context* s, int x, int y, int comp, v
j = 0;
jend = y;
jdir = 1;
}
else {
} else {
j = y-1;
jend = -1;
jdir = -1;
@ -567,19 +574,16 @@ static int stbi_write_tga_core(stbi__write_context* s, int x, int y, int comp, v
if (memcmp(prev, row + k * comp, comp)) {
prev += comp;
++len;
}
else {
} else {
--len;
break;
}
}
}
else {
} else {
for (k = i + 2; k < x && len < 128; ++k) {
if (!memcmp(begin, row + k * comp, comp)) {
++len;
}
else {
} else {
break;
}
}
@ -592,8 +596,7 @@ static int stbi_write_tga_core(stbi__write_context* s, int x, int y, int comp, v
for (k = 0; k < len; ++k) {
stbiw__write_pixel(s, -1, comp, has_alpha, 0, begin + k * comp);
}
}
else {
} else {
unsigned char header = STBIW_UCHAR(len - 129);
stbiw__write1(s, header);
stbiw__write_pixel(s, -1, comp, has_alpha, 0, begin);
@ -620,8 +623,7 @@ STBIWDEF int stbi_write_tga(char const* filename, int x, int y, int comp, const
int r = stbi_write_tga_core(&s, x, y, comp, (void *) data);
stbi__end_write_file(&s);
return r;
}
else
} else
return 0;
}
#endif
@ -632,6 +634,8 @@ STBIWDEF int stbi_write_tga(char const* filename, int x, int y, int comp, const
#define stbiw__max(a, b) ((a) > (b) ? (a) : (b))
#ifndef STBI_WRITE_NO_STDIO
static void stbiw__linear_to_rgbe(unsigned char *rgbe, float *linear)
{
int exponent;
@ -639,8 +643,7 @@ static void stbiw__linear_to_rgbe(unsigned char* rgbe, float* linear)
if (maxcomp < 1e-32f) {
rgbe[0] = rgbe[1] = rgbe[2] = rgbe[3] = 0;
}
else {
} else {
float normalize = (float) frexp(maxcomp, &exponent) * 256.0f/maxcomp;
rgbe[0] = (unsigned char)(linear[0] * normalize);
@ -692,8 +695,7 @@ static void stbiw__write_hdr_scanline(stbi__write_context* s, int width, int nco
stbiw__linear_to_rgbe(rgbe, linear);
s->func(s->context, rgbe, 4);
}
}
else {
} else {
int c,r;
/* encode into scratch buffer */
for (x=0; x < width; x++) {
@ -768,7 +770,7 @@ static int stbi_write_hdr_core(stbi__write_context* s, int x, int y, int comp, f
char header[] = "#?RADIANCE\n# Written by stb_image_write.h\nFORMAT=32-bit_rle_rgbe\n";
s->func(s->context, header, sizeof(header)-1);
#ifdef __STDC_WANT_SECURE_LIB__
#ifdef __STDC_LIB_EXT1__
len = sprintf_s(buffer, sizeof(buffer), "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x);
#else
len = sprintf(buffer, "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x);
@ -789,7 +791,6 @@ STBIWDEF int stbi_write_hdr_to_func(stbi_write_func* func, void* context, int x,
return stbi_write_hdr_core(&s, x, y, comp, (float *) data);
}
#ifndef STBI_WRITE_NO_STDIO
STBIWDEF int stbi_write_hdr(char const *filename, int x, int y, int comp, const float *data)
{
stbi__write_context s = { 0 };
@ -797,8 +798,7 @@ STBIWDEF int stbi_write_hdr(char const* filename, int x, int y, int comp, const
int r = stbi_write_hdr_core(&s, x, y, comp, (float *) data);
stbi__end_write_file(&s);
return r;
}
else
} else
return 0;
}
#endif // STBI_WRITE_NO_STDIO
@ -964,8 +964,7 @@ STBIWDEF unsigned char* stbi_zlib_compress(unsigned char* data, int data_len, in
stbiw__zlib_add(stbiw__zlib_bitrev(j,5),5);
if (disteb[j]) stbiw__zlib_add(d - distc[j], disteb[j]);
i += best;
}
else {
} else {
stbiw__zlib_huffb(data[i]);
++i;
}
@ -982,6 +981,23 @@ STBIWDEF unsigned char* stbi_zlib_compress(unsigned char* data, int data_len, in
(void) stbiw__sbfree(hash_table[i]);
STBIW_FREE(hash_table);
// store uncompressed instead if compression was worse
if (stbiw__sbn(out) > data_len + 2 + ((data_len+32766)/32767)*5) {
stbiw__sbn(out) = 2; // truncate to DEFLATE 32K window and FLEVEL = 1
for (j = 0; j < data_len;) {
int blocklen = data_len - j;
if (blocklen > 32767) blocklen = 32767;
stbiw__sbpush(out, data_len - j == blocklen); // BFINAL = ?, BTYPE = 0 -- no compression
stbiw__sbpush(out, STBIW_UCHAR(blocklen)); // LEN
stbiw__sbpush(out, STBIW_UCHAR(blocklen >> 8));
stbiw__sbpush(out, STBIW_UCHAR(~blocklen)); // NLEN
stbiw__sbpush(out, STBIW_UCHAR(~blocklen >> 8));
memcpy(out+stbiw__sbn(out), data+j, blocklen);
stbiw__sbn(out) += blocklen;
j += blocklen;
}
}
{
// compute adler32 on input
unsigned int s1=1, s2=0;
@ -1132,8 +1148,7 @@ STBIWDEF unsigned char* stbi_write_png_to_mem(const unsigned char* pixels, int s
if (force_filter > -1) {
filter_type = force_filter;
stbiw__encode_png_line((unsigned char*)(pixels), stride_bytes, x, y, j, n, force_filter, line_buffer);
}
else { // Estimate the best filter by running through all of them:
} else { // Estimate the best filter by running through all of them:
int best_filter = 0, best_filter_val = 0x7fffffff, est, i;
for (filter_type = 0; filter_type < 5; filter_type++) {
stbiw__encode_png_line((unsigned char*)(pixels), stride_bytes, x, y, j, n, filter_type, line_buffer);
@ -1341,8 +1356,7 @@ static int stbiw__jpg_processDU(stbi__write_context* s, int* bitBuf, int* bitCnt
diff = DU[0] - DC;
if (diff == 0) {
stbiw__jpg_writeBits(s, bitBuf, bitCnt, HTDC[0]);
}
else {
} else {
unsigned short bits[2];
stbiw__jpg_calcBits(diff, bits);
stbiw__jpg_writeBits(s, bitBuf, bitCnt, HTDC[bits[1]]);
@ -1554,8 +1568,7 @@ static int stbi_write_jpg_core(stbi__write_context* s, int width, int height, in
}
}
}
}
else {
} else {
for(y = 0; y < height; y += 8) {
for(x = 0; x < width; x += 8) {
float Y[64], U[64], V[64];
@ -1607,8 +1620,7 @@ STBIWDEF int stbi_write_jpg(char const* filename, int x, int y, int comp, const
int r = stbi_write_jpg_core(&s, x, y, comp, data, quality);
stbi__end_write_file(&s);
return r;
}
else
} else
return 0;
}
#endif
@ -1616,6 +1628,10 @@ STBIWDEF int stbi_write_jpg(char const* filename, int x, int y, int comp, const
#endif // STB_IMAGE_WRITE_IMPLEMENTATION
/* Revision history
1.16 (2021-07-11)
make Deflate code emit uncompressed blocks when it would otherwise expand
support writing BMPs with alpha channel
1.15 (2020-07-13) unknown
1.14 (2020-02-02) updated JPEG writer to downsample chroma channels
1.13
1.12

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
Permission is hereby granted, free of charge, to any person or organization

View File

@ -1,87 +1,106 @@
@echo off
setlocal EnableDelayedExpansion
cd /d "%~dp0"
setlocal
pushd "%~dp0"
set /a last_code=0
set "build_base_dir=build\win"
set "out_dir=build\package\win"
set /a MEM_PERCENT=90
set /a DICT_SIZE_MB=384
set "packager=third-party\deps\win\7za\7za.exe"
:: use 70%
set /a THREAD_COUNT=2
set /a "MAX_THREADS=2"
if defined NUMBER_OF_PROCESSORS (
set /a THREAD_COUNT=NUMBER_OF_PROCESSORS*70/100
:: use 70%
set /a "MAX_THREADS=%NUMBER_OF_PROCESSORS% * 70 / 100"
if %MAX_THREADS% lss 1 (
set /a "MAX_THREADS=1"
)
if %THREAD_COUNT% lss 2 (
set /a THREAD_COUNT=2
)
if not exist "%packager%" (
1>&2 echo [X] packager app wasn't found
set /a last_code=1
goto :script_end
set "BUILD_DIR=build\win"
set "OUT_DIR=build\package\win"
if "%~1" equ "" (
1>&2 echo: missing build target folder arg
goto :end_script_with_err
)
if "%~1"=="" (
1>&2 echo [X] missing build folder
set /a last_code=1
goto :script_end
set "TARGET_DIR=%BUILD_DIR%\%~1"
if not exist "%TARGET_DIR%\" (
1>&2 echo: build target folder wasn't found
goto :end_script_with_err
)
set "target_src_dir=%build_base_dir%\%~1"
if not exist "%target_src_dir%" (
1>&2 echo [X] build folder wasn't found
set /a last_code=1
goto :script_end
set /a "BUILD_DEBUG=0"
if "%~2" equ "1" (
set /a "BUILD_DEBUG=1"
)
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"
if not exist "%PKG_EXE%" (
1>&2 echo: packager wasn't found
goto :end_script_with_err
)
::::::::::::::::::::::::::::::::::::::::::
echo // copying readmes + example files
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 "CHANGELOG.md" "%target_src_dir%\"
copy /y "CREDITS.md" "%target_src_dir%\"
if "%~2"=="1" (
copy /y "post_build\README.debug.md" "%target_src_dir%\"
echo: // copying readmes + example files
xcopy /y /s /e /r "post_build\steam_settings.EXAMPLE\" "%TARGET_DIR%\steam_settings.EXAMPLE\"
copy /y "post_build\README.release.md" "%TARGET_DIR%\"
copy /y "CHANGELOG.md" "%TARGET_DIR%\"
copy /y "CREDITS.md" "%TARGET_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\" (
copy /y "post_build\README.experimental.md" "%TARGET_DIR%\experimental\"
)
if exist "%target_src_dir%\steamclient_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\"
copy /y "post_build\README.experimental_steamclient.md" "%TARGET_DIR%\steamclient_experimental\"
copy /y "tools\steamclient_loader\win\ColdClientLoader.ini" "%TARGET_DIR%\steamclient_experimental\"
)
if exist "%target_src_dir%\tools\generate_interfaces\" (
copy /y "post_build\README.generate_interfaces.md" "%target_src_dir%\tools\generate_interfaces\"
if exist "%TARGET_DIR%\tools\generate_interfaces\" (
copy /y "post_build\README.generate_interfaces.md" "%TARGET_DIR%\tools\generate_interfaces\"
)
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\lobby_connect\" (
copy /y "post_build\README.lobby_connect.md" "%TARGET_DIR%\tools\lobby_connect\"
)
::::::::::::::::::::::::::::::::::::::::::
set "archive_dir=%out_dir%\%~1"
if exist "%archive_dir%\" (
rmdir /s /q "%archive_dir%"
)
set "archive_file="
for %%A in ("%archive_dir%") do (
set "archive_file=%%~dpAemu-win-%%~nxA.7z"
set "ACHIVE_DIR=%OUT_DIR%\%~1"
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+
:script_end
popd
endlocal & (
exit /b %last_code%
set "ACHIVE_FILE="
for %%A in ("%ACHIVE_DIR%") do (
set "ACHIVE_FILE=%%~dpAemu-win-%%~nxA.7z"
)
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.