Refactored linux exports generator with inja

This commit is contained in:
acidicoala
2025-09-25 01:24:53 +05:00
parent 59d45c9dab
commit d829396c08
5 changed files with 10 additions and 25 deletions

View File

@@ -213,17 +213,7 @@ namespace smoke_api {
original_steamapi_handle = kb::lib::load_original_library(self_path, STEAM_API_MODULE); original_steamapi_handle = kb::lib::load_original_library(self_path, STEAM_API_MODULE);
#ifdef KB_LINUX #ifdef KB_LINUX
// We need to enable writing into the instruction memory proxy_exports::init(module_handle, original_steamapi_handle);
// 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 #endif
} }

View File

@@ -2,12 +2,6 @@
#include "smoke_api/types.hpp" #include "smoke_api/types.hpp"
constexpr auto STEAM_APPS = "STEAMAPPS_INTERFACE_VERSION";
constexpr auto STEAM_CLIENT = "SteamClient";
constexpr auto STEAM_HTTP = "STEAMHTTP_INTERFACE_VERSION";
constexpr auto STEAM_USER = "SteamUser";
constexpr auto STEAM_INVENTORY = "STEAMINVENTORY_INTERFACE_V";
constexpr auto STEAM_GAME_SERVER = "SteamGameServer";
// IMPORTANT: DLL_EXPORT is hardcoded in windows_exports_generator.cpp & linux_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. // so any name changes here must be reflected there as well.

View File

@@ -9,7 +9,6 @@
#include "smoke_api/steamclient/steamclient.hpp" #include "smoke_api/steamclient/steamclient.hpp"
#include "steam_api/steam_interfaces.hpp" #include "steam_api/steam_interfaces.hpp"
#include "smoke_api/smoke_api.hpp"
#include "virtuals/steam_api_virtuals.hpp" #include "virtuals/steam_api_virtuals.hpp"
namespace { namespace {
@@ -37,7 +36,7 @@ namespace {
return { return {
{ {
STEAM_APPS, "STEAMAPPS_INTERFACE_VERSION",
interface_data_t{ interface_data_t{
.fallback_version = "STEAMAPPS_INTERFACE_VERSION008", .fallback_version = "STEAMAPPS_INTERFACE_VERSION008",
.entry_map = { .entry_map = {
@@ -49,7 +48,7 @@ namespace {
} }
}, },
{ {
STEAM_CLIENT, steam_interfaces::STEAM_CLIENT,
interface_data_t{ interface_data_t{
.fallback_version = "SteamClient021", .fallback_version = "SteamClient021",
.entry_map = { .entry_map = {
@@ -61,7 +60,7 @@ namespace {
} }
}, },
{ {
STEAM_GAME_SERVER, "SteamGameServer",
interface_data_t{ interface_data_t{
.fallback_version = "SteamGameServer015", .fallback_version = "SteamGameServer015",
.entry_map = { .entry_map = {
@@ -70,7 +69,7 @@ namespace {
} }
}, },
{ {
STEAM_HTTP, "STEAMHTTP_INTERFACE_VERSION",
interface_data_t{ interface_data_t{
.fallback_version = "STEAMHTTP_INTERFACE_VERSION003", .fallback_version = "STEAMHTTP_INTERFACE_VERSION003",
.entry_map = { .entry_map = {
@@ -81,7 +80,7 @@ namespace {
} }
}, },
{ {
STEAM_INVENTORY, "STEAMINVENTORY_INTERFACE_V",
interface_data_t{ interface_data_t{
.fallback_version = "STEAMINVENTORY_INTERFACE_V003", .fallback_version = "STEAMINVENTORY_INTERFACE_V003",
.entry_map = { .entry_map = {
@@ -96,7 +95,7 @@ namespace {
} }
}, },
{ {
STEAM_USER, "SteamUser",
interface_data_t{ interface_data_t{
.fallback_version = "SteamUser023", .fallback_version = "SteamUser023",
.entry_map = { .entry_map = {

View File

@@ -9,6 +9,8 @@
) )
namespace steam_interfaces { namespace steam_interfaces {
constexpr auto STEAM_CLIENT = "SteamClient";
void hook_virtuals(const void* interface_ptr, const std::string& version_string); void hook_virtuals(const void* interface_ptr, const std::string& version_string);
/** /**