A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
chore(native): the self-check asks whether the overlay can draw at all
esengine5dfdf386ad51
diff --git a/native/host/steam/SteamApi.cpp b/native/host/steam/SteamApi.cppindex ff7135e19..9bc356d9a 100644--- a/native/host/steam/SteamApi.cpp+++ b/native/host/steam/SteamApi.cpp@@ -54,6 +54,9 @@ constexpr const char* kUserAccessors[] = {constexpr const char* kFriendsAccessors[] = {"SteamAPI_SteamFriends_v018", "SteamAPI_SteamFriends_v017", "SteamAPI_SteamFriends_v016",};+constexpr const char* kUtilsAccessors[] = {+ "SteamAPI_SteamUtils_v011", "SteamAPI_SteamUtils_v010", "SteamAPI_SteamUtils_v009",+};void* openLibrary(const char* name) {#if defined(_WIN32)@@ -98,6 +101,7 @@ using PfnGetStatInt32 = bool (*)(void* self, const char* name, std::int32_t* outusing PfnGetSteamID = std::uint64_t (*)(void* self);using PfnGetPersonaName = const char* (*)(void* self);using PfnActivateGameOverlay = void (*)(void* self, const char* dialog);+using PfnIsOverlayEnabled = bool (*)(void* self);/*** Manual dispatch — how a binding that carries no Valve header reads callbacks.@@ -150,6 +154,7 @@ struct Fns {PfnManualDispatchGetNextCallback dispatchNext = nullptr;PfnManualDispatchFreeLastCallback dispatchFree = nullptr;PfnActivateGameOverlay activateOverlay = nullptr;+ PfnIsOverlayEnabled isOverlayEnabled = nullptr;PfnSetAchievement setAchievement = nullptr;PfnGetAchievement getAchievement = nullptr;PfnClearAchievement clearAchievement = nullptr;@@ -257,6 +262,11 @@ bool SteamApi::init(std::uint32_t appId, const std::string& directory) {symbol(library_, "SteamAPI_ISteamFriends_GetPersonaName"));g_fns.activateOverlay = reinterpret_cast<PfnActivateGameOverlay>(symbol(library_, "SteamAPI_ISteamFriends_ActivateGameOverlay"));+ const char* utilsVersion = "";+ utils_ = resolveInterface(library_, kUtilsAccessors,+ (int)(sizeof(kUtilsAccessors) / sizeof(char*)), &utilsVersion);+ g_fns.isOverlayEnabled = reinterpret_cast<PfnIsOverlayEnabled>(+ symbol(library_, "SteamAPI_ISteamUtils_IsOverlayEnabled"));// Manual dispatch, AFTER init and before any other dispatch call — that order// is Valve's, and the wrong one leaves a pipe that answers nothing.@@ -341,7 +351,11 @@ void SteamApi::pump() {if (traceCallbacks_ && !selfCheckDone_&& std::chrono::steady_clock::now() - traceStart_ >= kSelfCheckDelay) {selfCheckDone_ = true;- ESHOST_LOGI("steam: self-check opening the overlay");+ // Whether the overlay CAN draw at all. A game not launched by Steam gets+ // the hook injected and the overlay still disabled, and the difference is+ // invisible from the outside: both look like a callback that never came.+ const bool enabled = utils_ && g_fns.isOverlayEnabled && g_fns.isOverlayEnabled(utils_);+ ESHOST_LOGI("steam: self-check opening the overlay (IsOverlayEnabled=%d)", enabled ? 1 : 0);activateOverlay();}g_fns.dispatchRunFrame(pipe_);diff --git a/native/host/steam/SteamApi.hpp b/native/host/steam/SteamApi.hppindex a58c630c9..3beaec956 100644--- a/native/host/steam/SteamApi.hpp+++ b/native/host/steam/SteamApi.hpp@@ -113,6 +113,7 @@ class SteamApi {bool selfCheckDone_ = false;std::chrono::steady_clock::time_point traceStart_{};void* friends_ = nullptr;+ void* utils_ = nullptr;std::string error_;};