levilamina::native¶
The native escape hatch: engine addresses and native detours, for an engine call that no other module wraps.
The host checks nothing a mod does with an address. The caller answers for signatures,
calling conventions, the object layouts of this exact engine build, threads and
lifetimes. Getting an address is therefore safe and every use of it is unsafe at the
caller. The host's config.json has to set "native_detour": true; until it does,
every call returns an Err saying so and enabled returns false.
Functions¶
native::enabled¶
| Rust | |
|---|---|
Whether the host answers the native calls, which its config.json decides.
- Return type:
bool - Slots:
native_enabled,native_enabled
native::resolve_symbol¶
| Rust | |
|---|---|
The address of an engine function by its decorated symbol name.
- Parameters:
- symbol :
&str
- symbol :
- Return type:
Result<*mut c_void> - Slots:
native_resolve_symbol
native::resolve_signature¶
| Rust | |
|---|---|
The first match of a byte pattern such as "48 8B ?? 08" in the engine executable.
- Parameters:
- pattern :
&str
- pattern :
- Return type:
Result<*mut c_void> - Slots:
native_resolve_signature
native::module_export¶
| Rust | |
|---|---|
An export of a module already loaded into the process; an empty module names the
engine executable. LeviLamina's API is an export of LeviLamina.dll.
- Parameters:
- module :
&str - name :
&str
- module :
- Return type:
Result<*mut c_void> - Slots:
native_module_export
native::object¶
| Rust | |
|---|---|
The address of one engine service object. An Err while it does not exist yet.
- Parameters:
- kind :
NativeObject
- kind :
- Return type:
Result<*mut c_void> - Slots:
native_object
native::player¶
| Rust | |
|---|---|
The engine's Player object of an online player. Valid while the player stays online.
- Parameters:
- player :
&crate::Player
- player :
- Return type:
Result<*mut c_void> - Slots:
native_player
native::actor¶
| Rust | |
|---|---|
The engine's Actor object of a loaded actor. Valid while the actor stays loaded.
- Parameters:
- entity :
&crate::Entity
- entity :
- Return type:
Result<*mut c_void> - Slots:
native_actor
native::dimension¶
| Rust | |
|---|---|
The engine's Dimension object of a dimension id, custom dimensions included.
- Parameters:
- dim :
i32
- dim :
- Return type:
Result<*mut c_void> - Slots:
native_dimension
native::block_source¶
| Rust | |
|---|---|
The engine's BlockSource of a dimension id.
- Parameters:
- dim :
i32
- dim :
- Return type:
Result<*mut c_void> - Slots:
native_block_source
native::hook_install¶
| Rust | |
|---|---|
Installs a detour on target through ll::memory::hook, at a PRIORITY_* value.
The host removes a detour this mod still holds when the mod unloads, before the dll is unmapped, and does not wait for a call already inside it on another thread.
Safety
detour must be an extern function with the exact signature and calling convention of
target. It must not unwind, and it reaches the engine through original only.
- Parameters:
- target :
*mut c_void - detour :
*mut c_void - priority :
i32
- target :
- Return type:
Result<NativeHook> - Slots:
native_hook_install
native::hook_remove¶
| Rust | |
|---|---|
Removes a detour this mod installed.
- Parameters:
- hook :
NativeHook
- hook :
- Return type:
Result<()> - Slots:
native_hook_remove
NativeObject¶
| Rust | |
|---|---|
The engine service objects object hands out.
- Implements:
Debug,Clone,Copy,PartialEq,Eq
NativeHook¶
One installed detour: the id hook_remove takes, and the address through which the
detour calls the next detour or the engine.
- Implements:
Debug,Clone,Copy,PartialEq,Eq
Constants¶
| Name | Value | Description |
|---|---|---|
PRIORITY_HIGHEST |
0 |
ll::memory::HookPriority::Highest: runs first. |
PRIORITY_HIGH |
100 |
ll::memory::HookPriority::High. |
PRIORITY_NORMAL |
200 |
ll::memory::HookPriority::Normal. |
PRIORITY_LOW |
300 |
ll::memory::HookPriority::Low. |
PRIORITY_LOWEST |
400 |
ll::memory::HookPriority::Lowest: runs last. |