forked from tetl/Frozlunky
-
Notifications
You must be signed in to change notification settings - Fork 0
/
derandom.h
57 lines (43 loc) · 1.14 KB
/
derandom.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#pragma once
#include "patches.h"
#define RAND_ARR_SIZE 4992
#define FUNC_RAND_ARRAY_SIZE 0xD0
#define FUNC_MERSENNE_SIZE 0x14B
#define FUNC_SEED_GEN_SIZE 0x40
class DerandomizePatch : public Patch {
private:
BYTE* new_mersenne_code;
BYTE* new_rand_arr_code;
BYTE* new_seed_gen_code;
BYTE* original_mersenne_code;
BYTE* original_rand_arr_code;
BYTE* original_seed_gen_code;
BYTE* original_cont_loc1;
BYTE* original_cont_loc2;
Address mersenne_address;
Address rand_arr_address;
Address seed_gen_address;
Address g_RandomBytes;
Address g_RandomIdx;
Address g_PtrCurrentGame;
Address g_LevelOffset;
Address seed_cont_loc1;
Address seed_cont_loc2;
bool is_valid;
//block move
DerandomizePatch(DerandomizePatch& oth) : Patch(oth.spel) {}
DerandomizePatch(DerandomizePatch&& oth) : Patch(oth.spel) {}
public:
~DerandomizePatch();
DerandomizePatch(std::shared_ptr<Spelunky> spel);
int current_level();
Address current_level_offset();
Address game_ptr();
Address random_bytes_address();
Address random_idx_address();
private:
virtual bool _undo() override;
virtual bool _perform() override;
public:
virtual bool valid() override;
};