//BONE TEST
//read ptr at playerPtr + 0xE0
DWORD_PTR bodyPtr = DMA::MemReadPtr<DWORD_PTR>(sharedData.playerPtrs[3] + 0xE0);
printf("playerPtr + 0xE0 (Hex Addr): %p -> bodyPtr: %p\n", (void*)(sharedData.playerPtrs[3] + 0xE0), (void*)bodyPtr);
//read ptr at bodyPtr + 0x20
DWORD_PTR bonePtr = DMA::MemReadPtr<DWORD_PTR>(bodyPtr + 0x20);
printf("bodyPtr + 0x20 (Hex Addr): %p -> bonePtr: %p\n", (void*)(bodyPtr + 0x20), (void*)bonePtr);
//read ptr at bonePtr + 0x10, call it temp
DWORD_PTR temp = DMA::MemReadPtr<DWORD_PTR>(bonePtr + 0x10);
printf("bonePtr + 0x10 (Hex Addr): %p -> temp: %p\n", (void*)(bonePtr + 0x10), (void*)temp);
//read ptr at bonePtr + 0x30, call it object1
DWORD_PTR object1 = DMA::MemReadPtr<DWORD_PTR>(temp + 0x30);
printf("temp + 0x30 (Hex Addr): %p -> object1: %p\n", (void*)(temp + 0x30), (void*)object1);
//read ptr at object1 + 0x30, call it object2
DWORD_PTR object2 = DMA::MemReadPtr<DWORD_PTR>(object1 + 0x30);
printf("object1 + 0x30 (Hex Addr): %p -> object2: %p\n", (void*)(object1 + 0x30), (void*)object2);
//read ptr at object2 + 0x8, call it transform
DWORD_PTR transform = DMA::MemReadPtr<DWORD_PTR>(object2 + 0x8);
printf("object2 + 0x8 (Hex Addr): %p -> transform: %p\n", (void*)(object2 + 0x8), (void*)transform);
//read ptr at transform + 0x28, call it transform2
DWORD_PTR transform2 = DMA::MemReadPtr<DWORD_PTR>(transform + 0x28);
printf("transform + 0x28 (Hex Addr): %p -> transform2: %p\n", (void*)(transform + 0x28), (void*)transform2);
//read ptr at transform2 + 0x10, call it FinalTransform
DWORD_PTR FinalTransform = DMA::MemReadPtr<DWORD_PTR>(transform2 + 0x10);
printf("transform2 + 0x10 (Hex Addr): %p -> FinalTransform: %p\n", (void*)(transform2 + 0x10), (void*)FinalTransform);
get_position(FinalTransform);
Vector3 get_position(DWORD_PTR transform_internal) {
printf("Starting get_position with transform_internal: %p\n", (void*)transform_internal);
DWORD_PTR some_ptr = DMA::MemReadPtr<DWORD_PTR>(transform_internal + 0x38);
int32_t index;
DMA::MemRead(transform_internal + 0x40, &index, sizeof(int32_t));
printf("some_ptr: %p, index: %d\n", (void*)some_ptr, index);
if (!some_ptr) {
printf("some_ptr is null\n");
return Vector3();
}
DWORD_PTR relation_array = DMA::MemReadPtr<DWORD_PTR>(some_ptr + 0x18);
printf("relation_array: %p\n", (void*)relation_array);
if (!relation_array) {
printf("relation_array is null\n");
return Vector3();
}
DWORD_PTR dependency_index_array = DMA::MemReadPtr<DWORD_PTR>(some_ptr + 0x20);
printf("dependency_index_array: %p\n", (void*)dependency_index_array);
if (!dependency_index_array) {
printf("dependency_index_array is null\n");
return Vector3();
}
__m128i temp_0;
__m128 xmmword_1410D1340 = { -2.f, 2.f, -2.f, 0.f };
__m128 xmmword_1410D1350 = { 2.f, -2.f, -2.f, 0.f };
__m128 xmmword_1410D1360 = { -2.f, -2.f, 2.f, 0.f };
__m128 temp_1;
__m128 temp_2;
__m128 temp_main;
DMA::MemRead(relation_array + index * 48, &temp_main, sizeof(__m128));
int32_t dependency_index;
DMA::MemRead(dependency_index_array + 4 * index, &dependency_index, sizeof(int32_t));
while (dependency_index >= 0) {
auto relation_index = 6 * dependency_index;
printf("Processing dependency_index: %d, relation_index: %d\n", dependency_index, relation_index);
DMA::MemRead(relation_array + 8 * relation_index + 16, &temp_0, sizeof(__m128i));
DMA::MemRead(relation_array + 8 * relation_index + 32, &temp_1, sizeof(__m128));
DMA::MemRead(relation_array + 8 * relation_index, &temp_2, sizeof(__m128));
__m128 v10 = _mm_mul_ps(temp_1, temp_main);
__m128 v11 = _mm_castsi128_ps(_mm_shuffle_epi32(temp_0, 0));
__m128 v12 = _mm_castsi128_ps(_mm_shuffle_epi32(temp_0, 85));
__m128 v13 = _mm_castsi128_ps(_mm_shuffle_epi32(temp_0, -114));
__m128 v14 = _mm_castsi128_ps(_mm_shuffle_epi32(temp_0, -37));
__m128 v15 = _mm_castsi128_ps(_mm_shuffle_epi32(temp_0, -86));
__m128 v16 = _mm_castsi128_ps(_mm_shuffle_epi32(temp_0, 113));
__m128 v17 = _mm_add_ps(
_mm_add_ps(
_mm_add_ps(
_mm_mul_ps(
_mm_sub_ps(
_mm_mul_ps(_mm_mul_ps(v11, xmmword_1410D1350), v13),
_mm_mul_ps(_mm_mul_ps(v12, xmmword_1410D1360), v14)),
_mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(v10), -86))),
_mm_mul_ps(
_mm_sub_ps(
_mm_mul_ps(_mm_mul_ps(v15, xmmword_1410D1360), v14),
_mm_mul_ps(_mm_mul_ps(v11, xmmword_1410D1340), v16)),
_mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(v10), 85)))),
_mm_add_ps(
_mm_mul_ps(
_mm_sub_ps(
_mm_mul_ps(_mm_mul_ps(v12, xmmword_1410D1340), v16),
_mm_mul_ps(_mm_mul_ps(v15, xmmword_1410D1350), v13)),
_mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(v10), 0))),
v10)),
temp_2);
temp_main = v17;
DMA::MemRead(dependency_index_array + 4 * dependency_index, &dependency_index, sizeof(int32_t));
}
Vector3 result;
_mm_storeu_ps(&result.x, temp_main);
printf("Resulting position: x=%f, y=%f, z=%f\n", result.x, result.y, result.z);
return result;
}