-
-
Notifications
You must be signed in to change notification settings - Fork 195
/
Copy pathcore.pat
50 lines (41 loc) · 1.17 KB
/
core.pat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once
import hex.impl.imhex_check;
/*!
Core intrinsic functions to interact with the ImHex Hex Editor
*/
namespace auto hex::core {
/**
A type representing a selection in the hex editor
*/
struct Selection {
bool valid;
u64 address, size;
};
/**
Returns the current selection in the hex editor
@return The current selection
*/
fn get_selection() {
u128 selection = builtin::hex::core::get_selection();
Selection result;
if (selection == u128(-1)) {
result.valid = false;
result.address = 0x00;
result.size = 0x00;
} else {
result.valid = true;
result.address = selection >> 64;
result.size = selection & u64(-1);
}
return result;
};
/**
Add a file to the Virtual Filesystem
@param path The name of the file
@param pattern The pattern associated with the file
*/
fn add_virtual_file(str path, auto pattern)
{
builtin::hex::core::add_virtual_file(path, pattern);
};
}