Skip to content

Commit b11a97f

Browse files
andy5995claude
andcommitted
steam: Fix float stat truncation, outdated macOS SDK path, and VS detection
steamshim_child.c: Fix float stat values being silently truncated to integers. In processEvent(), SHIMEVENT_SETSTATF/GETSTATF was assigning float values as: event.fvalue = (int)*((float *)buf); The erroneous (int) cast discarded the fractional part before assigning to the float field. This meant stats like stat_online_minutes_played (a float) were always rounded down to whole numbers. Remove the cast so the float value is assigned directly. steamshim_parent/Makefile: Update macOS redistributable library path from osx32 to osx. Valve renamed the directory when they dropped 32-bit macOS support in Steamworks SDK ~1.42 (2018). Building the Steam shim for HOST=osx would fail to link because the path no longer exists in any recent SDK. steamshim_parent/build.bat: Add support for Visual Studio 2017, 2019, and 2022. Previously the script only detected VS2015 (VS140COMNTOOLS). Now it first tries vswhere.exe (available since VS2017, the standard Microsoft-recommended discovery mechanism) to locate the latest installed VS with C++ tools. Falls back to the legacy VS2015 check if vswhere is not found. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 178f13b commit b11a97f

3 files changed

Lines changed: 19 additions & 4 deletions

File tree

source/glest_game/steamshim/steamshim_child.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ static const STEAMSHIM_Event *processEvent(const uint8 *buf, size_t buflen) {
268268
case SHIMEVENT_SETSTATF:
269269
case SHIMEVENT_GETSTATF:
270270
event.okay = *(buf++) ? 1 : 0;
271-
event.fvalue = (int)*((float *)buf);
271+
event.fvalue = *((float *)buf);
272272
buf += sizeof(float);
273273
strcpy(event.name, (const char *)buf);
274274
break;

source/steamshim_parent/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ else ifeq ($(HOST),linux32)
1818
else ifeq ($(HOST),linux64)
1919
FLAGS += -L$(STEAMWORKS)/redistributable_bin/linux64 -m64
2020
else ifeq ($(HOST),osx)
21-
FLAGS += -L$(STEAMWORKS)/redistributable_bin/osx32
21+
FLAGS += -L$(STEAMWORKS)/redistributable_bin/osx
2222
endif
2323

2424
FLAGS += -lsteam_api

source/steamshim_parent/build.bat

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,31 @@ cd /d "%~dp0"
1414
ECHO using msbuild config [%MSBUILD_CONFIG%]
1515
ECHO Checking for windows binary runtime tools...
1616

17-
rem setup the Visual Studio 2015 environment
17+
rem setup the Visual Studio environment (2022, 2019, 2017, or 2015)
1818
ECHO --------------------------------
19-
ECHO Setting up Visual Studio 2015 environment vars...
19+
ECHO Setting up Visual Studio environment vars...
2020
REM Ensure ultifds HP doesn't mess the build up
2121
SET Platform=
2222
if "%DevEnvDir%." == "." goto SETVCVARS
2323
GOTO GITSECTION
2424

2525
:SETVCVARS
2626

27+
rem Try vswhere.exe to locate VS2017+ installations
28+
SET VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
29+
IF NOT EXIST %VSWHERE% SET VSWHERE="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"
30+
IF EXIST %VSWHERE% (
31+
FOR /F "usebackq tokens=*" %%i IN (`%VSWHERE% -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) DO (
32+
SET VS_INSTALL_PATH=%%i
33+
)
34+
)
35+
IF DEFINED VS_INSTALL_PATH (
36+
ECHO Found Visual Studio at: %VS_INSTALL_PATH%
37+
call "%VS_INSTALL_PATH%\VC\Auxiliary\Build\vcvarsall.bat" %VCVARS_PLATFORM%
38+
goto GITSECTION
39+
)
40+
41+
rem Fall back to VS2015
2742
IF EXIST "%VS140COMNTOOLS%..\..\" GOTO VC_Common_15
2843
IF EXIST "\Program Files\Microsoft Visual Studio 14.0\" GOTO VC_32_15
2944
IF EXIST "\Program Files (x86)\Microsoft Visual Studio 14.0\" GOTO VC_64_15

0 commit comments

Comments
 (0)