-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Hooks.cpp
38 lines (32 loc) · 1.43 KB
/
Hooks.cpp
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
#include "Hooks.h"
#include "Enums.h"
namespace REFix {
static const float DEFAULT_FOV = 90.0f;
extern const REF::API::Field* camera_param_field;
extern const REF::API::Field* field_of_view_field;
int pre_update_pitch_yaw(int argc, void** argv, REFrameworkTypeDefinitionHandle* arg_tys, unsigned long long ret_addr) {
REF::API::ManagedObject* const camera_param = camera_param_field->get_data<REF::API::ManagedObject*>(argv[1]);
const float fov = field_of_view_field->get_data<float>(camera_param);
float* input = (float*)&argv[2];
*input *= fov;
*input /= DEFAULT_FOV;
return REFRAMEWORK_HOOK_CALL_ORIGINAL;
}
int pre_add_rank_point_direct(int argc, void** argv, REFrameworkTypeDefinitionHandle* arg_tys, unsigned long long ret_addr)
{
const RankPointType rankType = *(RankPointType*)&argv[3];
if (rankType == RankPointType::FromFsm ||
rankType == RankPointType::FromScript ||
rankType == RankPointType::FromDirectSet ||
rankType == RankPointType::FromDebug) {
return REFRAMEWORK_HOOK_CALL_ORIGINAL;
}
return REFRAMEWORK_HOOK_SKIP_ORIGINAL;
}
int pre_set_interval_level(int argc, void** argv, REFrameworkTypeDefinitionHandle* arg_tys, unsigned long long ret_addr)
{
int32_t* level = (int32_t*)&argv[2];
*level = 0;
return REFRAMEWORK_HOOK_CALL_ORIGINAL;
}
}