forked from sashavol/Frozlunky
-
Notifications
You must be signed in to change notification settings - Fork 0
/
game_hooks.h
179 lines (140 loc) · 3.94 KB
/
game_hooks.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#pragma once
#include "derandom.h"
#define MAX_PLAYERS 4
#define LEVEL_1_1 1
#define LEVEL_5_4 20
#define STATE_PLAYING 0
#define STATE_INPUTLOCK_GENERIC 1
#define STATE_INPUTLOCK_LEVELSTART 2
#define STATE_INPUTLOCK_CIRCLECLOSE 3
#define STATE_GAMEOVER_HUD 30
#define STATE_MAINMENU 15
#define STATE_LEVEL_TRANSITION 11
#define STATE_INTRO 14
#define STATE_TITLE 5
#define STATE_CHARSELECT 17
#define STATE_PLAYERSTATS 21
#define STATE_LOBBY 22
#define STATE_PAUSED 4
#define STATE_WALLS_ARE_SHIFTING 16
//OPT research other states
#define FS_EFFECT_ERR -1
#define FS_EFFECT_OFF 0
#define FS_EFFECT_LOW 1
#define FS_EFFECT_HIGH 2
#define PROHUD_ON 1
#define PROHUD_OFF 0
struct TimeInfo {
unsigned minutes;
unsigned seconds;
double milliseconds;
TimeInfo() : minutes(0), seconds(0), milliseconds(0.0) {}
double total_ms() {
return milliseconds + seconds*1000 + minutes*60*1000;
}
};
class GameHooks {
public:
std::shared_ptr<Spelunky> spel;
std::shared_ptr<DerandomizePatch> dp;
private:
bool is_valid;
bool have_steamid;
std::string steamid;
Address game_state_offset;
Address g_CurrentGamePtr;
Address game_goldcount_offset;
Address game_timer_offset;
Address level_timer_offset;
Address player_bomb_offs;
Address player_health_offs;
Address player_rope_offs;
unsigned player_struct_size;
unsigned player_entity_offs;
unsigned controller_size;
unsigned run_switch_offset;
unsigned ctrl_config_offs;
unsigned ext_object_offset;
unsigned menu_object_offset;
unsigned menu_select_idx_menu_offset;
unsigned ext_player_size;
unsigned ext_character_id_offset;
unsigned ext_fs_effects_offset;
unsigned ext_dyn_shadows_offset;
unsigned ext_prohud_offset;
unsigned ext_fs_offset;
signed int lvl_hmansion_offset;
signed int lvl_worm_offset;
signed int lvl_cog_offset;
signed int lvl_yeti_offset;
signed int lvl_blackmkt_offset;
signed int lvl_mothership_offset;
signed int lvl_dark_offset;
BYTE game_damsel_offset;
signed int ent_grid_offset;
bool discover_steamid();
bool discover_gold_count();
bool discover_timers();
bool discover_game_state();
bool discover_player_data();
bool discover_run_switch_offs();
bool discover_ctrl_size();
bool discover_menu_data();
bool discover_gfx_options();
bool discover_level_flags();
bool discover_entity_data();
public:
GameHooks(std::shared_ptr<Spelunky> spel, std::shared_ptr<DerandomizePatch> dp);
int game_state();
int current_level();
//first player_id = 0
int bombs(int player_id);
void set_bombs(int p, int bombs);
int health(int player_id);
void set_health(int p, int health);
int ropes(int player_id);
void set_ropes(int p, int ropes);
float player_x(int pid);
float player_y(int pid);
int damsel_type();
void damsel_type(int id);
signed entity_x_offset();
signed entity_y_offset();
Address player_entity(int player_id);
unsigned player_entity_offset();
unsigned ctrl_size();
unsigned run_switch_offs();
Address ctrl_object();
unsigned ctrl_offset();
Address ctrl_config(int pid);
void ctrl_reset_x360(int pid);
Address game_state_offs();
unsigned gold_count();
TimeInfo game_timer();
TimeInfo level_timer();
bool valid();
std::string steam_id();
Address ext_object();
int main_menu_select_idx();
int character_id(int pid);
void character_id(int pid, int id);
int fullscreen_effects();
void set_fullscreen_effects(int state);
bool dyn_shadows();
void set_dyn_shadows(bool v);
bool pro_hud();
void set_pro_hud(bool v);
bool fullscreen();
signed worm_offset();
signed blackmkt_offset();
signed haunted_mansion_offset();
signed yeti_offset();
signed cog_offset();
signed mothership_offset();
signed dark_level_offset();
void set_dark_level(bool v);
bool dark_level();
signed char entity_obj_offset();
signed int entity_grid_offset();
signed int entity_row_size();
};