- fix launcher pinning a thread

- add fall back lua state listener
This commit is contained in:
Anonymous-275
2023-01-21 19:02:47 +00:00
parent ca4fbd10dd
commit 19e28a3d4d
8 changed files with 54 additions and 25 deletions

View File

@@ -16,13 +16,14 @@ class BeamNG {
static void SendIPC(const std::string& Data);
private:
static inline std::unique_ptr<Hook<def::GEUpdate>> TickCountDetour;
static inline std::unique_ptr<Hook<def::update_function>> UpdateDetour;
static inline std::unique_ptr<Hook<def::lua_open_jit>> OpenJITDetour;
static inline std::unique_ptr<IPC> IPCFromLauncher;
static inline std::unique_ptr<IPC> IPCToLauncher;
static inline uint64_t GameBaseAddr;
static inline uint64_t DllBaseAddr;
static int lua_open_jit_D(lua_State* State);
static uint64_t update_D(lua_State* State);
static void RegisterGEFunctions();
// static int GetTickCount_D(void* GEState, void* Param2, void* Param3, void*
// Param4);

View File

@@ -14,6 +14,7 @@ namespace def {
void* Param4);
typedef uint32_t (*GetTickCount)();
typedef int (*lua_open_jit)(lua_State* L);
typedef uint64_t (*update_function)(lua_State* L);
typedef void (*lua_get_field)(lua_State* L, int idx, const char* k);
typedef const char* (*lua_push_fstring)(lua_State* L, const char* fmt, ...);
typedef int (*lua_p_call)(lua_State* L, int arg, int res, int err);

View File

@@ -13,6 +13,7 @@ class GELua {
static inline def::lua_settop lua_settop;
static inline def::GetTickCount GetTickCount;
static inline def::lua_open_jit lua_open_jit;
static inline def::update_function update_function;
static inline def::lua_push_fstring lua_push_fstring;
static inline def::lua_get_field lua_get_field;
static inline def::lua_p_call lua_p_call;

View File

@@ -14,6 +14,7 @@ class Memory {
static uint32_t GetLauncherPID(const std::set<uint32_t>& BL);
static uint64_t GetModuleBase(const char* Name);
static void Print(const std::string& msg);
static std::string GetHex(uint64_t num);
static void Inject(uint32_t PID);
static uint32_t GetTickCount();
static uint32_t EntryPoint();

View File

@@ -64,4 +64,8 @@ namespace Patterns {
const char* lua_settop[2]{
"\x4c\x8b\xc1\x85\xd2\x7e\x00\x48\x8b\x41\x00\x48\x8b\x49",
"xxxxxx?xxx?xxx"};
const char* update_function[2] {
"\x48\x89\x4c\x24\x00\x48\x83\xec\x00\xba\x00\x00\x00\x00\xe8\x00\x00\x00\x00\x48\x8b\x48",
"xxxx?xxx?x????x????xxx"
};
}