[WIP] Koalageddon mode

master
acidicoala 2 years ago
parent 5afdd59044
commit 5d1abc6498
No known key found for this signature in database
GPG Key ID: D24C6065B49C645B

@ -4,7 +4,7 @@ on: push
jobs:
ci:
name: CI
uses: acidicoala/KoalaBox/.github/workflows/build-and-package.yml@a1a8661947cc3260ed217ec75fb8cf15825cdf6e
uses: acidicoala/KoalaBox/.github/workflows/build-and-package.yml@67545f50bc9e557eaf43a74395cc1461416d0035
permissions:
contents: write
with:

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeSharedSettings">
<configurations>
<configuration PROFILE_NAME="Debug [32]" ENABLED="true" GENERATION_DIR="build/32" CONFIG_NAME="Debug" TOOLCHAIN_NAME="Visual Studio 2022 [x86]" GENERATION_OPTIONS="-G &quot;Visual Studio 17 2022&quot; -A Win32" />
<configuration PROFILE_NAME="Debug [64]" ENABLED="true" GENERATION_DIR="build/64" CONFIG_NAME="Debug" TOOLCHAIN_NAME="Visual Studio 2022 [amd64]" GENERATION_OPTIONS="-G &quot;Visual Studio 17 2022&quot; -A x64" />
<configuration PROFILE_NAME="Relase [64]" ENABLED="false" GENERATION_DIR="build/64/release" CONFIG_NAME="Release" TOOLCHAIN_NAME="Visual Studio 2022 [amd64]" GENERATION_OPTIONS="-G &quot;Visual Studio 17 2022&quot; -A x64" />
</configurations>
</component>
</project>

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.22)
project(SmokeAPI VERSION 1.0.0)
project(SmokeAPI VERSION 1.0.2)
include(KoalaBox/cmake/KoalaBox.cmake)
@ -53,7 +53,8 @@ set(
src/steam_functions/steam_functions.hpp
src/steam_types/steam_types.hpp
src/steamclient_exports/steamclient.cpp
src/vstdlib/vstdlib.cpp
src/koalageddon/vstdlib.cpp
src/koalageddon/steamclient.cpp
src/main.cpp
${GENERATED_LINKER_EXPORTS}
)

@ -1 +1 @@
Subproject commit a1a8661947cc3260ed217ec75fb8cf15825cdf6e
Subproject commit 67545f50bc9e557eaf43a74395cc1461416d0035

@ -0,0 +1,49 @@
#include <smoke_api/smoke_api.hpp>
#include <steam_functions/steam_functions.hpp>
#include <koalabox/hook.hpp>
#pragma warning(disable: 4731) // 'ebp' modified by inline assembly...
using namespace smoke_api;
DLL_EXPORT(void) Log_Interface(const char* interface_name, const char* function_name) {
void***** parent_ebp;
__asm mov parent_ebp, ebp
auto* interface_address = *((*parent_ebp)[2]);
if (util::strings_are_equal(interface_name, "IClientAppManager")) {
if (util::strings_are_equal(function_name, "IsAppDlcInstalled")) {
auto* function_address = interface_address[0x8]; // TODO: Un-hardcode
logger->debug("{} -> {}::{} @ {}", __func__, interface_name, function_name, function_address);
}
} else if (util::strings_are_equal(interface_name, "IClientApps")) {
if (util::strings_are_equal(function_name, "BGetDLCDataByIndex")) {
auto* function_address = interface_address[0x9]; // TODO: Un-hardcode
logger->debug("{} -> {}::{} @ {}", __func__, interface_name, function_name, function_address);
} else if (util::strings_are_equal(function_name, "GetDLCCount")) {
auto* function_address = interface_address[0x8]; // TODO: Un-hardcode
logger->debug("{} -> {}::{} @ {}", __func__, interface_name, function_name, function_address);
}
} else if (util::strings_are_equal(interface_name, "IClientInventory")) {
if (util::strings_are_equal(function_name, "GetResultItems")) {
auto* function_address = interface_address[0x2]; // TODO: Un-hardcode
logger->debug("{} -> {}::{} @ {}", __func__, interface_name, function_name, function_address);
}
} else if (util::strings_are_equal(interface_name, "IClientUser")) {
if (util::strings_are_equal(function_name, "IsSubscribedApp")) {
auto* function_address = interface_address[0xB5]; // TODO: Un-hardcode
logger->debug("{} -> {}::{} @ {}", __func__, interface_name, function_name, function_address);
}
} else if (util::strings_are_equal(interface_name, "IClientUtils")) {
if (util::strings_are_equal(function_name, "GetAppID")) {
auto* function_address = interface_address[0x12]; // TODO: Un-hardcode
logger->debug("{} -> {}::{} @ {}", __func__, interface_name, function_name, function_address);
}
}
GET_ORIGINAL_FUNCTION(Log_Interface)
Log_Interface_o(interface_name, function_name);
}

@ -2,13 +2,15 @@
#include <steam_functions/steam_functions.hpp>
#include <build_config.h>
#include <koalabox/loader.hpp>
#include <koalabox/config_parser.hpp>
#include <koalabox/dll_monitor.hpp>
#include <koalabox/file_logger.hpp>
#include <koalabox/win_util.hpp>
#include <koalabox/hook.hpp>
#include <koalabox/dll_monitor.hpp>
#include <koalabox/loader.hpp>
#include <koalabox/patcher.hpp>
#include <koalabox/win_util.hpp>
#define DETOUR_EX(FUNC, ADDRESS) hook::detour_or_warn(ADDRESS, #FUNC, reinterpret_cast<FunctionAddress>(FUNC));
#define DETOUR(FUNC) hook::detour_or_warn(original_library, #FUNC, reinterpret_cast<FunctionAddress>(FUNC));
namespace smoke_api {
@ -50,10 +52,23 @@ namespace smoke_api {
if (util::strings_are_equal(exe_name, "steam.exe")) { // target vstdlib_s.dll
logger->info("🐨 Detected Koalageddon mode 💥");
dll_monitor::init(VSTDLIB_DLL, [](const HMODULE& library) {
original_library = library;
DETOUR(Coroutine_Create)
dll_monitor::init({VSTDLIB_DLL, STEAMCLIENT_DLL}, [](const HMODULE& library, const String& name) {
original_library = library; // TODO: Is this necessary?
if (name == VSTDLIB_DLL) {
// Family Sharing functions
DETOUR(Coroutine_Create)
} else if (name == STEAMCLIENT_DLL) {
// Unlocking functions
// TODO: Un-hardcode the pattern
const String pattern("55 8B EC 8B ?? ?? ?? ?? ?? 81 EC ?? ?? ?? ?? 53 FF 15");
auto Log_Interface_address = (FunctionAddress) patcher::find_pattern_address(
win_util::get_module_info(library), "Log_Interface", pattern
);
if (Log_Interface_address) {
DETOUR_EX(Log_Interface, Log_Interface_address)
}
}
});
} else if (config.hook_steamclient) { // target steamclient(64).dll
logger->info("🪝 Detected hook mode for SteamClient");

@ -118,9 +118,10 @@ DLL_EXPORT(bool) SteamAPI_ISteamInventory_GetItemDefinitionProperty(
ISteamInventory*, SteamItemDef_t, const char*, char*, uint32_t*
);
// vstdlib
// koalageddon
DLL_EXPORT(HCoroutine) Coroutine_Create(void* callback_address, struct CoroutineData* data);
DLL_EXPORT(void) Log_Interface(const char* interface_name, const char* function_name);
namespace steam_functions {
using namespace koalabox;

Loading…
Cancel
Save