Added steamworks sdk v1.62,

This commit is contained in:
acidicoala
2025-08-13 22:38:48 +05:00
parent 4b337a981e
commit 81dd00195c
19 changed files with 3624 additions and 624 deletions

View File

@@ -34,17 +34,39 @@
// Given that hooking steam_api has no apparent benefits, but has inherent flaws,
// the support for it has been dropped from this project.
void override_app_id() {
const auto override_app_id = smoke_api::config::instance.override_app_id;
if (override_app_id == 0)
return;
LOG_DEBUG("Overriding app id to {}", override_app_id);
SetEnvironmentVariable(
TEXT("SteamAppId"),
std::to_wstring(override_app_id).c_str()
);
}
void init_proxy_mode() {
LOG_INFO("🔀 Detected proxy mode")
globals::steamapi_module = koalabox::loader::load_original_library(paths::get_self_path(), STEAMAPI_DLL);
override_app_id();
globals::steamapi_module = koalabox::loader::load_original_library(
paths::get_self_path(),
STEAMAPI_DLL
);
}
void init_hook_mode() {
LOG_INFO("🪝 Detected hook mode")
override_app_id();
koalabox::dll_monitor::init_listener(
STEAMCLIENT_DLL, [](const HMODULE& library) {
STEAMCLIENT_DLL,
[](const HMODULE &library) {
globals::steamclient_module = library;
DETOUR_STEAMCLIENT(CreateInterface)
@@ -54,7 +76,7 @@ void init_hook_mode() {
);
}
bool is_valve_steam(const String& exe_name) noexcept {
bool is_valve_steam(const String &exe_name) noexcept {
try {
if (exe_name < not_equals > "steam.exe") {
return false;
@@ -63,11 +85,12 @@ bool is_valve_steam(const String& exe_name) noexcept {
// Verify that it's steam from valve, and not some other executable coincidentally named steam
const HMODULE steam_handle = koalabox::win_util::get_module_handle_or_throw(nullptr);
const auto manifest = koalabox::win_util::get_module_manifest(steam_handle);
const auto manifest = koalabox::win_util::get_module_manifest(
steam_handle);
// Steam.exe manifest is expected to contain this string
return manifest < contains > "valvesoftware.steam.steam";
} catch (const Exception& e) {
} catch (const Exception &e) {
LOG_ERROR("{} -> {}", __func__, e.what())
return false;
@@ -75,8 +98,8 @@ bool is_valve_steam(const String& exe_name) noexcept {
}
namespace smoke_api {
void init(HMODULE module_handle) {
void init(const HMODULE module_handle) {
// FIXME: IMPORTANT! Non ascii paths in directories will result in init errors
try {
DisableThreadLibraryCalls(module_handle);
@@ -87,19 +110,28 @@ namespace smoke_api {
config::init_config();
if (config::instance.logging) {
koalabox::logger::init_file_logger(paths::get_log_path());
koalabox::logger::init_file_logger();
}
// This kind of timestamp is reliable only for CI builds, as it will reflect the compilation
// time stamp only when this file gets recompiled.
LOG_INFO("🐨 {} v{} | Compiled at '{}'", PROJECT_NAME, PROJECT_VERSION, __TIMESTAMP__)
LOG_INFO(
"🐨 {} v{} | Compiled at '{}'", PROJECT_NAME,
PROJECT_VERSION,
__TIMESTAMP__
)
const auto exe_path = Path(koalabox::win_util::get_module_file_name_or_throw(nullptr));
const Path exe_path = koalabox::win_util::get_module_file_name_or_throw(nullptr);
const auto exe_name = exe_path.filename().string();
LOG_DEBUG("Process name: '{}' [{}-bit]", exe_name, BITNESS)
if (koalabox::hook::is_hook_mode(globals::smokeapi_handle, STEAMAPI_DLL)) {
const bool is_hook_mode = koalabox::hook::is_hook_mode(
globals::smokeapi_handle,
STEAMAPI_DLL
);
if (is_hook_mode) {
koalabox::hook::init(true);
if (is_valve_steam(exe_name)) {
@@ -115,8 +147,10 @@ namespace smoke_api {
}
LOG_INFO("🚀 Initialization complete")
} catch (const Exception& ex) {
koalabox::util::panic(fmt::format("Initialization error: {}", ex.what()));
} catch (const Exception &ex) {
koalabox::util::panic(
fmt::format("Initialization error: {}", ex.what())
);
}
}
@@ -127,9 +161,8 @@ namespace smoke_api {
}
LOG_INFO("💀 Shutdown complete")
} catch (const Exception& ex) {
} catch (const Exception &ex) {
LOG_ERROR("Shutdown error: {}", ex.what())
}
}
}
}