diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b7253c..b1b62a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,9 +37,9 @@ set(SMOKE_API_SOURCES ${SMOKE_API_STATIC_SOURCES} src/smoke_api/smoke_api.cpp src/smoke_api/smoke_api.hpp - src/steam_api/exports/steam_api.cpp - src/steam_api/exports/steam_api.hpp - src/steam_api/exports/steam_api_unversioned.cpp +# src/steam_api/exports/steam_api.cpp +# src/steam_api/exports/steam_api.hpp +# src/steam_api/exports/steam_api_unversioned.cpp src/steam_api/virtuals/isteamapps.cpp src/steam_api/virtuals/isteamclient.cpp src/steam_api/virtuals/isteamgameserver.cpp diff --git a/README.adoc b/README.adoc index 9419341..8326a41 100644 --- a/README.adoc +++ b/README.adoc @@ -64,7 +64,7 @@ SmokeAPI supports 2 installation modes: hook mode and proxy mode. |Mode |Advantages |Disadvantages |🪝 Hook mode -|Persists after game updates +|Persists after game updates; Can be loaded by other injectors. |Might need an additional DLL (Koaloader) |🔀 Proxy mode @@ -81,7 +81,10 @@ If it doesn't work, try installing it in proxy mode. . Download the latest SmokeAPI release zip from {smokeapi_release}. . From SmokeAPI archive unpack `steam_api.dll` or `steam_api64.dll`, depending on the game bitness, rename it to `version.dll`, and place it next to the game exe file. -=== 🪝 Hook mode (Alternative) +=== 🪝 Hook mode (Alternative installation) + +:special_k: https://www.special-k.info[Special K] +:custom_plugin: https://wiki.special-k.info/en/SpecialK/Tools#custom-plugin[custom plugin] If a game doesn't load `version.dll`, you can use one of the {koaloader} DLLs that the game does in fact load. For example, assuming that the game loads `winmm.dll`: @@ -91,18 +94,27 @@ For example, assuming that the game loads `winmm.dll`: . Download the latest SmokeAPI release zip from {smokeapi_release}. . From SmokeAPI archive unpack `steam_api.dll` or `steam_api64.dll`, depending on the game bitness, rename it to `SmokeAPI.dll`, and place it next to the game exe file. +[[special_k_note]] +IMPORTANT: There are games which have extra protections that break hook mode. +In such cases, it might be worth trying {special_k}, which can inject SmokeAPI as a {custom_plugin}. + ==== 🔀 Proxy mode . Find `steam_api.dll` / `steam_api64.dll` file in game directory, and rename it to `steam_api_o.dll` / `steam_api64_o.dll`. . Download the latest SmokeAPI release zip from {smokeapi_release}. . From SmokeAPI archive unpack `steam_api.dll`/`steam_api64.dll`, depending on the game bitness, and place it next to the original steam_api DLL file. +IMPORTANT: There are games which have extra protections that break proxy mode. +In such cases, see the note on <> + +--- + If the unlocker is not working as expected, then please fully read the https://gist.github.com/acidicoala/2c131cb90e251f97c0c1dbeaf2c174dc[Generic Unlocker Installation Instructions] before seeking support in the {forum-topic}. == ⚙ Configuration -NOTE: This document describes configuration for version 3 of SmokeAPI. -You can find the version 2 documentation https://github.com/acidicoala/SmokeAPI/blob/v2.0.5/README.md#-configuration[here]. +NOTE: This document describes configuration for version 4 of SmokeAPI. +You can find the version 3 documentation https://github.com/acidicoala/SmokeAPI/blob/v3.0.0/README.adoc#-configuration[here]. :fn-app-id: footnote:fn-app-id[App/DLC IDs can be obtained from https://steamdb.info[SteamDB] or https://steambase.io[Steambase]. Keep in mind that you need to be signed in with a steam account in order to see accurate inventory item IDs on that website.] diff --git a/res/README.txt b/res/README.txt index 9367139..d382f9a 100644 --- a/res/README.txt +++ b/res/README.txt @@ -1,3 +1,12 @@ -Project page: https://github.com/acidicoala/SmokeAPI?tab=readme-ov-file#smokeapi +Project page: https://github.com/acidicoala/SmokeAPI#readme Forum topic: https://cs.rin.ru/forum/viewtopic.php?p=2597932#p2597932 -DLC Database: https://steamdb.info/ \ No newline at end of file +DLC Database: https://steamdb.info/ + +### NOTE ### + +Do NOT use the SmokeAPI.config.json file unless you have a good reason. +The default config file enables logging, which might have a negative impact on performance in games. +So, unless you really need to see logs for debugging issues, it is advised to either: + disable logging in the config file by setting the "logging" field to false +or + not use the SmokeAPI.config.json file at all diff --git a/res/SmokeAPI.schema.json b/res/SmokeAPI.schema.json index d745cc0..c0c9c2d 100644 --- a/res/SmokeAPI.schema.json +++ b/res/SmokeAPI.schema.json @@ -115,7 +115,7 @@ }, "examples": [ { - "$schema": "https://raw.githubusercontent.com/acidicoala/SmokeAPI/refs/tags/v3.0.0/res/SmokeAPI.schema.json", + "$schema": "https://raw.githubusercontent.com/acidicoala/SmokeAPI/refs/tags/v3.1.0/res/SmokeAPI.schema.json", "$version": 4, "logging": true, "log_steam_http": true, diff --git a/src/smoke_api/smoke_api.cpp b/src/smoke_api/smoke_api.cpp index aa519f3..41d5a19 100644 --- a/src/smoke_api/smoke_api.cpp +++ b/src/smoke_api/smoke_api.cpp @@ -15,7 +15,7 @@ #include "smoke_api.hpp" #include "smoke_api/config.hpp" #include "smoke_api/steamclient/steamclient.hpp" -#include "steam_api/exports/steam_api.hpp" +// #include "steam_api/exports/steam_api.hpp" // Hooking steam_api has shown itself to be less desirable than steamclient // for the reasons outlined below: @@ -49,26 +49,14 @@ namespace { LOG_INFO("Detected hook mode"); kb::dll_monitor::init_listener( - {STEAMCLIENT_DLL, STEAMAPI_DLL}, + {STEAMCLIENT_DLL}, [&](const HMODULE& module_handle, const std::string& library_name) { - if(kb::str::eq(library_name, STEAMCLIENT_DLL)) { - KB_HOOK_DETOUR_MODULE(CreateInterface, module_handle); - } else if(kb::str::eq(library_name, STEAMAPI_DLL)) { - // TODO: SteamAPI_Init will be too small to hook on x64. - // Ideally, we should inspect the address it jumps to and hook that instead. - // Moreover, SteamAPI_InitSafe calls the same address, - // so it could be used as a sanity check + KB_HOOK_DETOUR_MODULE(CreateInterface, module_handle); - KB_HOOK_DETOUR_MODULE(SteamAPI_Init, module_handle); - KB_HOOK_DETOUR_MODULE(SteamAPI_InitSafe, module_handle); - KB_HOOK_DETOUR_MODULE(SteamAPI_InitFlat, module_handle); - KB_HOOK_DETOUR_MODULE(SteamInternal_SteamAPI_Init, module_handle); - KB_HOOK_DETOUR_MODULE(SteamAPI_RestartAppIfNecessary, module_handle); - KB_HOOK_DETOUR_MODULE(SteamAPI_Shutdown, module_handle); - - // Note: It is not necessary to hook flat functions or interface accessors - // since the underlying interfaces will be hooked through steamclient. - } + // TODO: What if we just request all relevant interfaces ahead of time? + // This could help in situations where SmokeAPI was injected + // after a game has obtained the interfaces. + // After that, we could just unhook SteamClient. } ); } diff --git a/src/steam_api/exports/steam_api.cpp b/src/steam_api/exports/steam_api.cpp index e55ba6a..bf22dc1 100644 --- a/src/steam_api/exports/steam_api.cpp +++ b/src/steam_api/exports/steam_api.cpp @@ -1,3 +1,5 @@ +// Not included in project due atm due to lack of usage + #include #include "steam_api/exports/steam_api.hpp" diff --git a/src/steam_api/exports/steam_api.hpp b/src/steam_api/exports/steam_api.hpp index 9d5903b..fb43dee 100644 --- a/src/steam_api/exports/steam_api.hpp +++ b/src/steam_api/exports/steam_api.hpp @@ -1,3 +1,5 @@ +// Not included in project due atm due to lack of usage + #pragma once #include "smoke_api/smoke_api.hpp" diff --git a/src/steamclient/steamclient.cpp b/src/steamclient/steamclient.cpp index 7fa0227..b5112d8 100644 --- a/src/steamclient/steamclient.cpp +++ b/src/steamclient/steamclient.cpp @@ -2,7 +2,6 @@ #include "smoke_api/steamclient/steamclient.hpp" -#include "smoke_api/smoke_api.hpp" #include "smoke_api/types.hpp" #include "steam_api/steam_client.hpp"