From be8a18b8d5c6bc61e0be78b64d5a2270ca6ce9f0 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Mon, 2 May 2022 01:24:45 +0200 Subject: [PATCH] Ports: Work around `halflife` formatting NaN values endlessly --- Ports/halflife/patches/ReadMe.md | 5 ++++ .../patches/fwgs-dont-format-nan-loop.patch | 24 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 Ports/halflife/patches/fwgs-dont-format-nan-loop.patch diff --git a/Ports/halflife/patches/ReadMe.md b/Ports/halflife/patches/ReadMe.md index 6443812e34..155a564b30 100644 --- a/Ports/halflife/patches/ReadMe.md +++ b/Ports/halflife/patches/ReadMe.md @@ -4,6 +4,11 @@ Add SerenityOS to the supported architectures of FWGS. +## `fwgs-dont-format-nan-loop.patch` + +This keeps FWGS from formatting a NaN value multiple times each frame, +which would otherwise result in a big performance hit. + ## `hlsdk-add-serenity.patch` Add SerenityOS to the supported architectures of hlsdk. diff --git a/Ports/halflife/patches/fwgs-dont-format-nan-loop.patch b/Ports/halflife/patches/fwgs-dont-format-nan-loop.patch new file mode 100644 index 0000000000..1db752911f --- /dev/null +++ b/Ports/halflife/patches/fwgs-dont-format-nan-loop.patch @@ -0,0 +1,24 @@ +From 1bc4a88e6a34b89538f07916479228758dd13155 Mon Sep 17 00:00:00 2001 +From: Tim Schumacher +Date: Mon, 2 May 2022 01:22:35 +0200 +Subject: [PATCH] Engine: Keep HTTP from endlessly formatting NaN values + +For whatever reason, our progress count for HTTP downloads stays at 0. +This results in the engine calculating a NaN progress value many times +each frame, which results in a significant performance hit. +--- + xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/engine/common/net_ws.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/engine/common/net_ws.c b/xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/engine/common/net_ws.c +--- a/xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/engine/common/net_ws.c ++++ b/xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/engine/common/net_ws.c +@@ -2280,7 +2280,7 @@ + } + + // update progress +- if( !Host_IsDedicated() ) ++ if( !Host_IsDedicated() && iProgressCount != 0 ) + Cvar_SetValue( "scr_download", flProgress/iProgressCount * 100 ); + + HTTP_AutoClean();