mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2026-04-11 02:06:07 +00:00
Added IPC and lua definitions
This commit is contained in:
@@ -4,9 +4,27 @@
|
||||
///
|
||||
|
||||
#pragma once
|
||||
#include "Memory/Detours.h"
|
||||
#include "Definitions.h"
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
class BeamNG {
|
||||
public:
|
||||
static void EntryPoint();
|
||||
private:
|
||||
static std::unique_ptr<Detours> TickCountDetour;
|
||||
static std::unique_ptr<Detours> OpenJITDetour;
|
||||
static int lua_open_jit_D(lua_State* State);
|
||||
static uint32_t GetTickCount_D();
|
||||
static uint64_t GameBaseAddr;
|
||||
static uint64_t DllBaseAddr;
|
||||
static def::GetTickCount GetTickCount;
|
||||
static def::lua_open_jit lua_open_jit;
|
||||
static def::lua_push_fstring lua_push_fstring;
|
||||
static def::lua_get_field lua_get_field;
|
||||
static def::lua_p_call lua_p_call;
|
||||
static const char* GameModule;
|
||||
static const char* DllModule;
|
||||
static lua_State* GEState;
|
||||
};
|
||||
|
||||
15
include/Memory/Definitions.h
Normal file
15
include/Memory/Definitions.h
Normal file
@@ -0,0 +1,15 @@
|
||||
///
|
||||
/// Created by Anonymous275 on 1/27/22
|
||||
/// Copyright (c) 2021-present Anonymous275 read the LICENSE file for more info.
|
||||
///
|
||||
|
||||
#pragma once
|
||||
typedef struct lua_State lua_State;
|
||||
|
||||
namespace def {
|
||||
typedef unsigned long (*GetTickCount)();
|
||||
typedef int (*lua_open_jit)(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);
|
||||
}
|
||||
28
include/Memory/IPC.h
Normal file
28
include/Memory/IPC.h
Normal file
@@ -0,0 +1,28 @@
|
||||
///
|
||||
/// Created by Anonymous275 on 1/26/22
|
||||
/// Copyright (c) 2021-present Anonymous275 read the LICENSE file for more info.
|
||||
///
|
||||
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
class IPC {
|
||||
public:
|
||||
IPC() = delete;
|
||||
IPC(const char* MemID, const char* SemID, const char* SemID2, size_t Size) noexcept;
|
||||
[[nodiscard]] size_t size() const noexcept;
|
||||
[[nodiscard]] char* c_str() const noexcept;
|
||||
void send(const std::string& msg) noexcept;
|
||||
[[nodiscard]] void* raw() const noexcept;
|
||||
const std::string& msg() noexcept;
|
||||
void confirm_receive() noexcept;
|
||||
void receive();
|
||||
~IPC() noexcept;
|
||||
private:
|
||||
void* SemConfHandle_;
|
||||
void* MemoryHandle_;
|
||||
void* SemHandle_;
|
||||
std::string Msg_;
|
||||
size_t Size_;
|
||||
char* Data_;
|
||||
};
|
||||
@@ -8,10 +8,11 @@
|
||||
|
||||
class Memory{
|
||||
public:
|
||||
static uint64_t FindByPattern(const char* module, const char* Pattern, const char* Mask);
|
||||
static uint64_t FindPattern(const char* module, const char* Pattern, const char* Mask);
|
||||
static uint64_t GetModuleBase(const char* Name);
|
||||
static void Print(const std::string& msg);
|
||||
static void Inject(uint32_t PID);
|
||||
static uint32_t GetTickCount();
|
||||
static uint32_t GetBeamNGPID();
|
||||
static uint32_t EntryPoint();
|
||||
static uint32_t GetPID();
|
||||
|
||||
Reference in New Issue
Block a user