64-bit proxy mode for Linux

This commit is contained in:
acidicoala
2025-09-24 22:37:53 +05:00
parent 81a8ef42ab
commit 59d45c9dab
7 changed files with 33 additions and 19 deletions

View File

@@ -13,12 +13,15 @@
#include "smoke_api.hpp"
#include <polyhook2/MemProtector.hpp>
#include "smoke_api/config.hpp"
#include "smoke_api/steamclient/steamclient.hpp"
#include "steam_api/steam_interfaces.hpp"
#include "steam_api/virtuals/steam_api_virtuals.hpp"
#include "build_config.h"
#include "proxy_exports.hpp"
#ifdef KB_WIN
#include "koalabox/win.hpp"
@@ -208,6 +211,20 @@ namespace smoke_api {
const auto self_path = kb::paths::get_self_dir();
original_steamapi_handle = kb::lib::load_original_library(self_path, STEAM_API_MODULE);
#ifdef KB_LINUX
// We need to enable writing into the instruction memory
// TODO: Move to generated file
const auto code_section = kb::lib::get_section_or_throw(module_handle, kb::lib::CODE_SECTION);
PLH::MemAccessor mem_accessor;
PLH::MemoryProtector const protector(
reinterpret_cast<uint64_t>(code_section.start_address),
code_section.size,
PLH::ProtFlag::RWX,
mem_accessor
);
proxy_exports::init(original_steamapi_handle);
#endif
}
LOG_INFO("Initialization complete");

View File

@@ -9,12 +9,11 @@ constexpr auto STEAM_USER = "SteamUser";
constexpr auto STEAM_INVENTORY = "STEAMINVENTORY_INTERFACE_V";
constexpr auto STEAM_GAME_SERVER = "SteamGameServer";
// IMPORTANT: DLL_EXPORT is hardcoded in exports_generator.cpp,
// IMPORTANT: DLL_EXPORT is hardcoded in windows_exports_generator.cpp & linux_exports_generator.cpp,
// so any name changes here must be reflected there as well.
#define DLL_EXPORT(TYPE) extern "C" [[maybe_unused]] __declspec(dllexport) TYPE __cdecl
namespace smoke_api {
void init(void* module_handle);
void shutdown();