forked from RyanJGray/AlienIsolation.DevTools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathZONE_LOADER.cpp
More file actions
58 lines (48 loc) · 1.27 KB
/
Copy pathZONE_LOADER.cpp
File metadata and controls
58 lines (48 loc) · 1.27 KB
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
#include "ZONE_LOADER.h"
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <atomic>
namespace
{
std::atomic<bool> g_forced = false;
}
void ZONE_LOADER::SetForced(bool forced)
{
g_forced = forced;
}
bool ZONE_LOADER::IsForced()
{
return g_forced;
}
__declspec(noinline)
void __cdecl ZONE_LOADER::h_match_current_zones_to_povs()
{
match_current_zones_to_povs();
if (!g_forced)
return;
char* zoneManager = static_cast<char*>(*zone_manager_instance);
if (!zoneManager)
return;
char* zones = *reinterpret_cast<char**>(zoneManager + kZoneArrayOffset);
if (!zones)
return;
const int count = *reinterpret_cast<int*>(zones + kArrayCountOffset);
char** allocations = *reinterpret_cast<char***>(zones + kArrayDataOffset);
if (!allocations)
return;
for (int i = 0; i < count; i++)
{
char* allocation = allocations[i];
if (!allocation)
continue;
char* zone = *reinterpret_cast<char**>(allocation + kAllocationObjectOffset);
if (!zone)
continue;
add_viewpoint(zoneManager, kPlayerViewer, *reinterpret_cast<unsigned int*>(zone + kZoneIdOffset));
}
}
// For other tools injected into the game (Cinematic Tools toggles this with its free camera).
extern "C" __declspec(dllexport) void OpenCAGE_SetForceZoneLoading(bool forced)
{
ZONE_LOADER::SetForced(forced);
}