-
Notifications
You must be signed in to change notification settings - Fork 1
/
search.h
33 lines (26 loc) · 1.33 KB
/
search.h
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
#pragma once
#include <cstddef> // for size_t
#include <cstdint> // for uint8_t
#include <optional> // for optional, nullopt
#include <string> // for string
#include <string_view> // for operator""sv, string_view, string_view_literals
#include <unordered_map>
using namespace std::string_view_literals;
size_t decode_pc(const char *exe, size_t offset, uint8_t opcode_offset = 3,
uint8_t opcode_suffix_offset = 0,
uint8_t opcode_addr_size = 4);
size_t decode_imm(const char *exe, size_t offset, uint8_t opcode_offset = 3,
uint8_t value_size = 4);
// Find the location of the instruction (needle) with wildcard (* or \x2a)
// support Optional pattern_name for better error messages If is_required is
// true the function will call std::terminate when the needle can't be found
// Else it will throw std::logic_error
size_t find_inst(const char *exe, std::string_view needle, size_t start,
std::optional<size_t> end = std::nullopt,
std::string_view pattern_name = ""sv, bool is_required = true);
size_t find_after_bundle(size_t exe);
void preload_addresses();
size_t get_address(std::string_view address_name);
void register_application_version(std::string s);
std::unordered_map<std::string_view, size_t> &get_addresses();
std::string game_version();