Skip to content

Commit 50ec277

Browse files
committed
MHWilds: Fix reflection structures
1 parent e402ad5 commit 50ec277

File tree

3 files changed

+41
-39
lines changed

3 files changed

+41
-39
lines changed

reversing/mhwilds.rcnet

73.1 KB
Binary file not shown.

shared/sdk/ReClass_Internal_MHWILDS.hpp

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -133,18 +133,18 @@ class REType
133133
uint32_t typeIndexProbably; //0x0018
134134
char pad_001C[4]; //0x001C
135135
char *name; //0x0020
136-
char pad_0028[4]; //0x0028
137-
uint32_t typeCRC; //0x002C
138-
uint32_t size : 24; //0x0030
139-
uint32_t unkFlags : 8;
140-
uint32_t miscFlags; //0x0034
141-
class REType *super; //0x0038
142-
class REType *childType; //0x0040
143-
class REType *chainType; //0x0048
144-
class REFieldList *fields; //0x0050
145-
class REClassInfo *classInfo; //0x0058 is a managed type if this is not null
146-
}; //Size: 0x0060
147-
static_assert(sizeof(REType) == 0x60);
136+
char pad_0028[8]; //0x0028
137+
uint32_t size; //0x0030
138+
uint32_t typeCRC; //0x0034
139+
uint32_t miscFlags; //0x0038
140+
char pad_003C[4]; //0x003C
141+
class REType *super; //0x0040
142+
class REType *childType; //0x0048
143+
class REType *chainType; //0x0050
144+
class REFieldList *fields; //0x0058
145+
class REClassInfo *classInfo; //0x0060 is a managed type if this is not null
146+
}; //Size: 0x0068
147+
static_assert(sizeof(REType) == 0x68);
148148

149149
class N000003DE
150150
{
@@ -408,24 +408,22 @@ class REClassInfo
408408
uint16_t typeIndex; //0x0000 index into global type array
409409
char pad_0002[5]; //0x0002
410410
uint8_t objectFlags; //0x0007 flags >> 5 == 1 == normal type ? ??
411-
uint32_t _; //0x0008
412-
uint32_t elementBitField; //0x000C >> 4 is the value type index (RETypeImpl)
413-
uint32_t typeFlags; //0x0010 System::Reflection::TypeAttributes or via::clr::TypeFlag
414-
uint32_t size; //0x0014
415-
uint32_t fqnHash; //0x0018
416-
uint32_t typeCRC; //0x001C
417-
uint32_t defaultCtor; //0x0020
418-
uint32_t vt; //0x0024 vtable byte pool
419-
uint32_t memberMethod; //0x0028
420-
uint32_t memberField; //0x002C
421-
uint32_t memberProp; //0x0030
422-
uint32_t memberEvent; //0x0034
423-
int32_t interfaces; //0x0038
424-
int32_t generics; //0x003C byte pool
425-
class RETypeCLR *type; //0x0040
426-
class REObjectInfo *parentInfo; //0x0048
427-
}; //Size: 0x0050
428-
static_assert(sizeof(REClassInfo) == 0x50);
411+
uint32_t elementBitField; //0x0008 >> 4 is the value type index (RETypeImpl)
412+
uint32_t typeFlags; //0x000C System::Reflection::TypeAttributes or via::clr::TypeFlag
413+
uint32_t size; //0x0010
414+
uint32_t fqnHash; //0x0014
415+
uint32_t typeCRC; //0x0018
416+
uint32_t defaultCtor; //0x001C
417+
uint32_t vt; //0x0020 vtable byte pool
418+
uint32_t memberMethod; //0x0024
419+
uint32_t memberField; //0x0028
420+
uint32_t memberProp; //0x002C
421+
uint32_t memberEvent; //0x0030
422+
int32_t interfaces; //0x0034
423+
class RETypeCLR *type; //0x0038
424+
class REObjectInfo *parentInfo; //0x0040
425+
}; //Size: 0x0048
426+
static_assert(sizeof(REClassInfo) == 0x48);
429427

430428
class N00000CF1
431429
{
@@ -1307,8 +1305,8 @@ class TypeListArray
13071305
{
13081306
public:
13091307
class REClassInfo N00000A51[100000]; //0x0000
1310-
}; //Size: 0x7A1200
1311-
static_assert(sizeof(TypeListArray) == 0x7A1200);
1308+
}; //Size: 0x6DDD00
1309+
static_assert(sizeof(TypeListArray) == 0x6DDD00);
13121310

13131311
class GlobalArrayData2
13141312
{
@@ -4019,11 +4017,11 @@ static_assert(sizeof(ArrayDeserializeSequence) == 0x10);
40194017
class RETypeCLR : public REType
40204018
{
40214019
public:
4022-
class ArrayDeserializeSequence deserializeThing; //0x0060
4023-
class REType *nativeType; //0x0070
4024-
char *name2; //0x0078
4025-
}; //Size: 0x0080
4026-
static_assert(sizeof(RETypeCLR) == 0x80);
4020+
class ArrayDeserializeSequence deserializeThing; //0x0068
4021+
class REType *nativeType; //0x0078
4022+
char *name2; //0x0080
4023+
}; //Size: 0x0088
4024+
static_assert(sizeof(RETypeCLR) == 0x88);
40274025

40284026
class DeserializeSequence
40294027
{

src/mods/FreeCam.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,12 @@ void FreeCam::on_update_transform(RETransform* transform) {
222222

223223
// Move direction
224224
// It's not a Vector2f because via.vec2 is not actually 8 bytes, we don't want stack corruption to occur.
225-
const auto axis_l = *re_managed_object::get_field<Vector3f*>(pad, "AxisL");
226-
const auto axis_r = *re_managed_object::get_field<Vector3f*>(pad, "AxisR");
225+
auto axis_l_field = re_managed_object::get_field<Vector3f*>(pad, "AxisL");
226+
auto axis_r_field = re_managed_object::get_field<Vector3f*>(pad, "AxisR");
227+
228+
// TODO: Fix for Wilds
229+
const auto axis_l = axis_l_field != nullptr ? *axis_l_field : Vector3f{};
230+
const auto axis_r = axis_r_field != nullptr ? *axis_r_field : Vector3f{};
227231

228232
bool is_using_up_down_modifier = false;
229233
bool is_using_twist_modifier = false;

0 commit comments

Comments
 (0)