feat: bemanitools 6 initial refactoring drop, alpha 1
**THIS IS A HIGHLY WORK/DEVELOPMENT IN PROGRESS VERSION**
**THINGS ARE BROKEN AND EVERYTHING IS SUBJECT TO CHANGE**
First cut after massive refactoring with most critical and fundamental changes implemented.
We need to start somewhere, and this might be as good as anything else, so we can get started
with testing, bug fixing and iterating for the next releases.
The following list is non-exhaustive, does not guarantee anything does work, yet, and is supposed
to give a high level idea of what all of this is about. Updated documentation will reflect all of
this at some later point in time in more detail.
* A common "core" now abstracts logging, thread, property and configuration infrastructure and
provides a common interface. This is used by bemanitools internally as well as all tools, hooks
and APIs provided and don't depend on the game, version of the game or AVS version available
anymore
* New bemanitools (public) API
* Versioned API allowing for handling incremental API changes as well as breaking changes by
providing a new/different version when necessary
* Unified interfaces for bemanitools core API, i.e. logging, threads, configuration
* SDK with examples (TBD)
* Dogfooding approach: Bemanitools uses its own (public) API to implement and provide fundamental
features like configurable keyboard implementations for IO or hooks for different games and
versions
* All bemanitools hooks and IO libraries have been or are about to be re-worked to use the new APIs
* New hook API allows for more fine grained runtime control when stages of the hook are to be
executed, i.e. pre AVS, before main game, iat hooking instead of relying purely on DllMain
(which is still a compatible option though)
* launcher as a replacement for bootstrap: Bring it significantly closer to the original bootstrap
by supporting completely vanilla data and bootstrap.xml configurations to run the games. Note
that bemanitools does not include any code or means to run DRM'd data, only decrypted
* inject is also being reworked to use as much of the same "infrastructure" as launcher to provide
a more seamless bootstrapping process for games that keeps pre-eapki data as vanilla as possible
Summary:
Test Plan:
Summary:
Test Plan:
Summary:
Test Plan:
Summary:
Test Plan:
This commit is contained in:
@@ -4,8 +4,12 @@ libs_procmon := \
|
||||
core \
|
||||
hook \
|
||||
util \
|
||||
iface-core \
|
||||
|
||||
src_procmon := \
|
||||
bt-hook.c \
|
||||
config.c \
|
||||
dllmain.c \
|
||||
file.c \
|
||||
module.c \
|
||||
procmon.c \
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
#define LOG_MODULE "procmon-hook"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "iface-core/config.h"
|
||||
#include "iface-core/log.h"
|
||||
|
||||
#include "sdk/module/core/config.h"
|
||||
#include "sdk/module/core/log.h"
|
||||
#include "sdk/module/hook.h"
|
||||
|
||||
#include "procmon/config.h"
|
||||
#include "procmon/procmon.h"
|
||||
|
||||
bool bt_hook_main_init(HMODULE game_module, const bt_core_config_t *config)
|
||||
{
|
||||
procmon_config_t procmon_config;
|
||||
|
||||
procmon_config_load(config, &procmon_config);
|
||||
|
||||
procmon_init(&procmon_config);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void bt_hook_main_fini()
|
||||
{
|
||||
procmon_fini();
|
||||
}
|
||||
|
||||
void bt_module_core_config_api_set(const bt_core_config_api_t *api)
|
||||
{
|
||||
bt_core_config_api_set(api);
|
||||
}
|
||||
|
||||
void bt_module_core_log_api_set(const bt_core_log_api_t *api)
|
||||
{
|
||||
bt_core_log_api_set(api);
|
||||
}
|
||||
|
||||
void bt_module_hook_api_get(bt_hook_api_t *api)
|
||||
{
|
||||
api->version = 1;
|
||||
|
||||
api->v1.main_init = bt_hook_main_init;
|
||||
api->v1.main_fini = bt_hook_main_fini;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
#define LOG_MODULE "procmon-config"
|
||||
|
||||
#include "iface-core/config.h"
|
||||
#include "iface-core/log.h"
|
||||
|
||||
#include "procmon/config.h"
|
||||
|
||||
static void _procmon_config_init_default(procmon_config_t *config)
|
||||
{
|
||||
config->file_enable = false;
|
||||
config->module_enable = false;
|
||||
config->thread_enable = false;
|
||||
}
|
||||
|
||||
void procmon_config_load(
|
||||
const bt_core_config_t *config, procmon_config_t *procmon_config)
|
||||
{
|
||||
uint32_t version;
|
||||
|
||||
log_assert(config);
|
||||
log_assert(procmon_config);
|
||||
|
||||
_procmon_config_init_default(procmon_config);
|
||||
|
||||
version = 0;
|
||||
|
||||
bt_core_config_u32_get(config, "/version", &version);
|
||||
|
||||
if (version != 1) {
|
||||
log_fatal("Unsupported configuration version: %d", version);
|
||||
}
|
||||
|
||||
bt_core_config_bool_get(
|
||||
config, "/file/enable", &procmon_config->file_enable);
|
||||
bt_core_config_bool_get(
|
||||
config, "/module/enable", &procmon_config->module_enable);
|
||||
bt_core_config_bool_get(
|
||||
config, "/thread/enable", &procmon_config->thread_enable);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef PROCMON_CONFIG_H
|
||||
#define PROCMON_CONFIG_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "api/core/config.h"
|
||||
|
||||
typedef struct procmon_config {
|
||||
bool file_enable;
|
||||
bool module_enable;
|
||||
bool thread_enable;
|
||||
} procmon_config_t;
|
||||
|
||||
void procmon_config_load(
|
||||
const bt_core_config_t *config, procmon_config_t *procmon_config);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <windows.h>
|
||||
|
||||
BOOL WINAPI DllMain(HMODULE mod, DWORD reason, void *ctx)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "core/log.h"
|
||||
|
||||
#include "hook/table.h"
|
||||
|
||||
#include "iface-core/log.h"
|
||||
|
||||
#include "util/str.h"
|
||||
|
||||
static HANDLE(STDCALL *real_CreateFileW)(
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "core/log.h"
|
||||
|
||||
#include "hook/table.h"
|
||||
|
||||
#include "iface-core/log.h"
|
||||
|
||||
#include "util/str.h"
|
||||
|
||||
static HMODULE(STDCALL *real_GetModuleHandleA)(LPCSTR lpModuleName);
|
||||
|
||||
+26
-53
@@ -1,73 +1,46 @@
|
||||
#define LOG_MODULE "procmon"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "core/log.h"
|
||||
#include "iface-core/log.h"
|
||||
|
||||
#include "procmon/file.h"
|
||||
#include "procmon/module.h"
|
||||
#include "procmon/procmon.h"
|
||||
#include "procmon/thread.h"
|
||||
|
||||
static bool _procmon_file_mon_enabled;
|
||||
static bool _procmon_module_mon_enabled;
|
||||
static bool _procmon_thread_mon_enabled;
|
||||
static bool _procmon_file_monitor_enabled;
|
||||
static bool _procmon_module_monitor_enabled;
|
||||
static bool _procmon_thread_monitor_enabled;
|
||||
|
||||
uint32_t procmon_api_version()
|
||||
void procmon_init(const procmon_config_t *config)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
log_assert(config);
|
||||
|
||||
void procmon_set_loggers(
|
||||
core_log_message_t misc,
|
||||
core_log_message_t info,
|
||||
core_log_message_t warning,
|
||||
core_log_message_t fatal)
|
||||
{
|
||||
core_log_impl_set(misc, info, warning, fatal);
|
||||
}
|
||||
_procmon_file_monitor_enabled = config->file_enable;
|
||||
_procmon_module_monitor_enabled = config->module_enable;
|
||||
_procmon_thread_monitor_enabled = config->thread_enable;
|
||||
|
||||
void procmon_init()
|
||||
{
|
||||
_procmon_file_mon_enabled = false;
|
||||
_procmon_module_mon_enabled = false;
|
||||
_procmon_thread_mon_enabled = false;
|
||||
if (_procmon_file_monitor_enabled) {
|
||||
procmon_file_init();
|
||||
}
|
||||
|
||||
log_info("init");
|
||||
}
|
||||
if (_procmon_module_monitor_enabled) {
|
||||
procmon_module_init();
|
||||
}
|
||||
|
||||
void procmon_file_mon_enable()
|
||||
{
|
||||
procmon_file_init();
|
||||
_procmon_file_mon_enabled = true;
|
||||
}
|
||||
|
||||
void procmon_module_mon_enable()
|
||||
{
|
||||
procmon_module_init();
|
||||
_procmon_module_mon_enabled = true;
|
||||
}
|
||||
|
||||
void procmon_thread_mon_enable()
|
||||
{
|
||||
procmon_thread_init();
|
||||
_procmon_thread_mon_enabled = true;
|
||||
if (_procmon_thread_monitor_enabled) {
|
||||
procmon_thread_init();
|
||||
}
|
||||
}
|
||||
|
||||
void procmon_fini()
|
||||
{
|
||||
if (_procmon_file_mon_enabled) {
|
||||
procmon_file_fini();
|
||||
}
|
||||
|
||||
if (_procmon_module_mon_enabled) {
|
||||
procmon_module_fini();
|
||||
}
|
||||
|
||||
if (_procmon_thread_mon_enabled) {
|
||||
if (_procmon_thread_monitor_enabled) {
|
||||
procmon_thread_fini();
|
||||
}
|
||||
|
||||
log_info("fini");
|
||||
if (_procmon_module_monitor_enabled) {
|
||||
procmon_module_fini();
|
||||
}
|
||||
|
||||
if (_procmon_file_monitor_enabled) {
|
||||
procmon_file_fini();
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
LIBRARY procmon
|
||||
|
||||
EXPORTS
|
||||
procmon_api_version
|
||||
procmon_set_loggers
|
||||
procmon_init
|
||||
procmon_file_mon_enable
|
||||
procmon_module_mon_enable
|
||||
procmon_thread_mon_enable
|
||||
procmon_fini
|
||||
; Bemanitools 6 API
|
||||
bt_module_core_config_api_set
|
||||
bt_module_core_log_api_set
|
||||
bt_module_hook_api_get
|
||||
|
||||
DllMain@12 @1 NONAME
|
||||
|
||||
; Direct API
|
||||
bt_hook_main_init
|
||||
bt_hook_main_fini
|
||||
|
||||
@@ -1,21 +1,10 @@
|
||||
#ifndef PROCMON_PROCMON_H
|
||||
#define PROCMON_PROCMON_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "procmon/config.h"
|
||||
|
||||
#include "core/log.h"
|
||||
void procmon_init(const procmon_config_t *config);
|
||||
|
||||
uint32_t procmon_api_version();
|
||||
void procmon_set_loggers(
|
||||
core_log_message_t misc,
|
||||
core_log_message_t info,
|
||||
core_log_message_t warning,
|
||||
core_log_message_t fatal);
|
||||
void procmon_init();
|
||||
void procmon_file_mon_enable();
|
||||
void procmon_module_mon_enable();
|
||||
void procmon_thread_mon_enable();
|
||||
void procmon_fini();
|
||||
|
||||
#endif
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "core/log.h"
|
||||
|
||||
#include "hook/table.h"
|
||||
|
||||
#include "iface-core/log.h"
|
||||
|
||||
#ifdef _WIN64
|
||||
#define SIZE_T_FORMAT_SPECIFIER "llu"
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user