Skip to content

Commit 004a436

Browse files
authored
Merge branch 'praydog:master' into master
2 parents d06657c + 66cae93 commit 004a436

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

shared/sdk/ResourceManager.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,20 @@ ResourceManager* ResourceManager::get() {
5555
return (ResourceManager*)sdk::get_native_singleton("via.ResourceManager");
5656
}
5757

58+
// createresource is called in:
59+
// via.Folder.activate
60+
// via.Prefab.duplicate
61+
// via.Prefab.Clone
62+
// via.Prefab.set_Path
63+
// via.prefab.set_Standby
5864
sdk::Resource* ResourceManager::create_resource(void* type_info, std::wstring_view name) {
5965
update_pointers();
6066

6167
return s_create_resource_fn(this, type_info, name.data());
6268
}
6369

70+
// This one is a bit harder but there are a few functions called at the bottom of
71+
// createResource that are called in create_userdata
6472
intrusive_ptr<sdk::ManagedObject> ResourceManager::create_userdata(void* type_info, std::wstring_view name) {
6573
update_pointers();
6674

@@ -119,7 +127,8 @@ void ResourceManager::update_pointers() {
119127
// since they both have the same pattern at the start of the function
120128
const auto valid_patterns = {
121129
"66 83 F8 40 75 ? C6",
122-
"66 83 F8 40 75 ? 48"
130+
"66 83 F8 40 75 ? 48",
131+
"66 41 83 39 40" // DD2+
123132
};
124133

125134
bool found = false;

shared/sdk/ResourceManager.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class Resource {
2929
class ResourceManager {
3030
public:
3131
static ResourceManager* get();
32+
static void update_pointers();
3233

3334
public:
3435
sdk::Resource* create_resource(void* type_info, std::wstring_view name);
@@ -49,7 +50,6 @@ class ResourceManager {
4950
private:
5051
friend class sdk::Resource;
5152

52-
static void update_pointers();
5353
static sdk::Resource* (*s_create_resource_fn)(ResourceManager*, void*, const wchar_t*);
5454
static uintptr_t s_create_resource_reference;
5555

shared/sdk/SDK.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "RETypes.hpp"
55
#include "REGlobals.hpp"
6+
#include "ResourceManager.hpp"
67

78
#include "SDK.hpp"
89

@@ -20,5 +21,7 @@ void initialize_sdk() {
2021

2122
utility::re_managed_object::detail::resolve_add_ref();
2223
utility::re_managed_object::detail::resolve_release();
24+
25+
sdk::ResourceManager::update_pointers();
2326
}
2427
}

0 commit comments

Comments
 (0)