From 266c4efab3326bf86b567d079ad1aeef09f0bd0d Mon Sep 17 00:00:00 2001 From: a Date: Fri, 1 Nov 2024 23:53:39 +0200 Subject: [PATCH 1/2] fix a scenario in which apps send invalid handle and expect failure callback + call-result --- dll/steam_ugc.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/dll/steam_ugc.cpp b/dll/steam_ugc.cpp index 81dd8228..755f05d5 100644 --- a/dll/steam_ugc.cpp +++ b/dll/steam_ugc.cpp @@ -294,11 +294,24 @@ SteamAPICall_t Steam_UGC::SendQueryUGCRequest( UGCQueryHandle_t handle ) { PRINT_DEBUG("%llu", handle); std::lock_guard lock(global_mutex); - if (handle == k_UGCQueryHandleInvalid) return k_uAPICallInvalid; + + const auto trigger_failure = [handle, this](){ + SteamUGCQueryCompleted_t data{}; + data.m_handle = handle; + data.m_eResult = k_EResultFail; + data.m_unNumResultsReturned = 0; + data.m_unTotalMatchingResults = 0; + data.m_bCachedData = false; + + auto ret = callback_results->addCallResult(data.k_iCallback, &data, sizeof(data)); + callbacks->addCBResult(data.k_iCallback, &data, sizeof(data)); + return ret; + }; + + if (handle == k_UGCQueryHandleInvalid) return trigger_failure(); auto request = std::find_if(ugc_queries.begin(), ugc_queries.end(), [&handle](struct UGC_query const& item) { return item.handle == handle; }); - if (ugc_queries.end() == request) - return k_uAPICallInvalid; + if (ugc_queries.end() == request) return trigger_failure(); if (request->return_all_subscribed) { request->results = std::set(ugc_bridge->subbed_mods_itr_begin(), ugc_bridge->subbed_mods_itr_end()); From 2c49c8645f0932b2018451d0f6f74321946ed816 Mon Sep 17 00:00:00 2001 From: Detanup01 <91248446+Detanup01@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:23:59 +0100 Subject: [PATCH 2/2] Fix find_ to generate_ --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f04c6b17..9953c513 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ This project depends on many third-party libraries and tools, credits to them fo --- # How to use the emu -* **Always generate the interfaces file using the `find_interfaces` tool.** +* **Always generate the interfaces file using the `generate_interfaces` tool.** * **Generate the proper app configuration using the `generate_emu_config` tool.** * **If things don't work, try the `ColdClientLoader` setup.**