Save decompiled inner functions for transform44 reference

Ghidra decompilation of all inner functions called by transformMatrix4x4,
plus the full 2263-line main function decompilation.
This commit is contained in:
MarcelineVQ
2026-03-12 10:55:19 -07:00
parent 572635dd9f
commit b771d7a982
12 changed files with 2834 additions and 0 deletions
@@ -0,0 +1,20 @@
void __thiscall ApplyTranslationMatrix(void *this,float *param_1)
{
/* WARNING: Load size is inaccurate */
*(float *)((int)this + 0x30) =
*param_1 * *this +
*(float *)((int)this + 0x10) * param_1[1] + *(float *)((int)this + 0x20) * param_1[2] +
*(float *)((int)this + 0x30);
*(float *)((int)this + 0x34) =
*(float *)((int)this + 4) * *param_1 +
*(float *)((int)this + 0x14) * param_1[1] + *(float *)((int)this + 0x24) * param_1[2] +
*(float *)((int)this + 0x34);
*(float *)((int)this + 0x38) =
*(float *)((int)this + 8) * *param_1 +
*(float *)((int)this + 0x18) * param_1[1] + *(float *)((int)this + 0x28) * param_1[2] +
*(float *)((int)this + 0x38);
return;
}
@@ -0,0 +1,93 @@
/* WARNING: Variable defined which should be unmapped: local_a4 */
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
undefined ** __thiscall calculateScaledInverseMatrix(void *this,undefined **param_1,float param_2)
{
int iVar1;
undefined **ppuVar2;
undefined **ppuVar3;
undefined *local_a4;
undefined *local_98;
undefined *local_94;
undefined *local_90;
undefined *local_8c;
undefined *local_88;
undefined *local_84;
undefined *local_80;
undefined *local_7c;
undefined *local_78;
undefined *local_74;
undefined *local_70;
undefined *local_6c;
undefined *local_68;
undefined *local_64;
undefined *local_60;
undefined *local_5c;
undefined *local_58;
undefined *local_54;
undefined *local_50;
undefined *local_4c;
undefined *local_48;
undefined *local_44;
undefined *local_40;
undefined *local_3c;
undefined *local_38;
undefined *local_34;
undefined *local_30;
undefined *local_2c;
undefined *local_28;
undefined *local_24;
undefined *local_20;
undefined *local_1c;
undefined *local_18;
undefined *local_14;
undefined *local_10;
undefined *local_c;
undefined *local_8;
if (ABS(param_2 - StaticFloat1_0) < _MOVEMENT_EPSILON) {
calculateInverseTransformMatrix(this,param_1);
return param_1;
}
/* WARNING: Load size is inaccurate */
InitializeStructWith9Pointers
(&local_74,*this,*(undefined **)((int)this + 4),*(undefined **)((int)this + 8),
*(undefined **)((int)this + 0x10),*(undefined **)((int)this + 0x14),
*(undefined **)((int)this + 0x18),*(undefined **)((int)this + 0x20),
*(undefined **)((int)this + 0x24),*(undefined **)((int)this + 0x28));
InitializeStructWith9Pointers
(&local_98,local_74,local_68,local_5c,local_70,local_64,local_58,local_6c,local_60,
local_54);
local_4c = local_94;
local_50 = local_98;
local_48 = local_90;
local_3c = local_88;
local_40 = local_8c;
local_38 = local_84;
local_2c = local_7c;
local_44 = (undefined *)0x0;
local_34 = (undefined *)0x0;
local_30 = local_80;
local_28 = local_78;
local_24 = (undefined *)0x0;
local_20 = (undefined *)0x0;
local_1c = (undefined *)0x0;
local_18 = (undefined *)0x0;
local_14 = (undefined *)0x3f800000;
scaleMatrix3x3ByScalar(&local_50,StaticFloat1_0 / (param_2 * param_2));
local_10 = (undefined *)-*(float *)((int)this + 0x30);
local_c = (undefined *)-*(float *)((int)this + 0x34);
local_8 = (undefined *)-*(float *)((int)this + 0x38);
ApplyTranslationMatrix(&local_50,(float *)&local_10);
ppuVar2 = &local_50;
ppuVar3 = param_1;
for (iVar1 = 0x10; iVar1 != 0; iVar1 = iVar1 + -1) {
*ppuVar3 = *ppuVar2;
ppuVar2 = ppuVar2 + 1;
ppuVar3 = ppuVar3 + 1;
}
return param_1;
}
@@ -0,0 +1,97 @@
void __thiscall
findInterpolationIndices
(SceneObject *this,uint searchValue,uint trackIndex,AnimationData *animationData,
uint *outputIndices)
{
uint search_distance;
uint search_delta;
uint min_index;
uint *timestamp_ptr;
uint start_index;
int current_timestamp;
ushort time_index;
uint timestamps_addr;
if (animationData->track_count_flag == 0) {
min_index = 0;
start_index = animationData->keyframe_count - 1;
}
else {
start_index = *(uint *)(animationData->keyframe_ranges_ptr + 4 + trackIndex * 8);
min_index = *(uint *)(animationData->keyframe_ranges_ptr + trackIndex * 8);
}
if (start_index <= min_index) {
*outputIndices = min_index;
outputIndices[1] = min_index;
outputIndices[2] = 0;
return;
}
time_index = *(ushort *)((int)&animationData->interpolationModeAndTimeIndex + 2);
if (time_index != 0xffff) {
searchValue = *(uint *)(this->search_data_count + (uint)time_index * 4);
}
timestamps_addr = animationData->timestamps_ptr;
search_delta = *outputIndices;
search_distance = searchValue - *(int *)(timestamps_addr + search_delta * 4);
if (search_distance < 500) {
if (search_delta < start_index) {
timestamp_ptr = (uint *)(timestamps_addr + 4 + search_delta * 4);
do {
if (searchValue < *timestamp_ptr) break;
search_delta = search_delta + 1;
timestamp_ptr = timestamp_ptr + 1;
} while (search_delta < start_index);
}
}
else if (search_distance < 0xfffffe0c) {
if (searchValue - *(int *)(timestamps_addr + min_index * 4) < 500) {
timestamp_ptr = (uint *)(timestamps_addr + 4 + min_index * 4);
do {
search_delta = min_index;
if (searchValue < *timestamp_ptr) break;
min_index = min_index + 1;
timestamp_ptr = timestamp_ptr + 1;
search_delta = min_index;
} while (min_index < start_index);
}
else {
do {
search_delta = start_index + min_index >> 1;
if (searchValue < *(uint *)(timestamps_addr + search_delta * 4)) {
start_index = search_delta - 1;
}
else {
min_index = search_delta + 1;
if (searchValue < *(uint *)(timestamps_addr + 4 + search_delta * 4)) break;
}
search_delta = min_index;
} while (min_index < start_index);
}
}
else if (min_index < search_delta) {
timestamp_ptr = (uint *)(timestamps_addr + search_delta * 4);
do {
if (*timestamp_ptr <= searchValue) break;
search_delta = search_delta - 1;
timestamp_ptr = timestamp_ptr + -1;
} while (min_index < search_delta);
}
start_index = search_delta + 1;
if (animationData->keyframe_count <= start_index) {
outputIndices[1] = search_delta;
*outputIndices = search_delta;
outputIndices[2] = 0;
return;
}
*outputIndices = search_delta;
outputIndices[1] = start_index;
current_timestamp = *(int *)(animationData->timestamps_ptr + search_delta * 4);
outputIndices[2] =
(uint)((float)(searchValue - current_timestamp) /
(float)(*(int *)(animationData->timestamps_ptr + start_index * 4) - current_timestamp))
;
return;
}
@@ -0,0 +1,7 @@
int __thiscall getIndexOffset(void *this,int param_1)
{
return *(int *)((int)this + 4) + param_1 * 2;
}
@@ -0,0 +1,32 @@
void __fastcall getInterpolatedFloat(void *param_1,int param_2,short *param_3,uint *param_4)
{
float fVar1;
undefined *local_8;
findInterpolationIndices
((SceneObject *)param_1,*(uint *)(param_2 + 0x98),*(uint *)(param_2 + 0x9c),
(AnimationData *)param_3,param_4);
if (*param_3 == 0) {
param_4[3] = *(uint *)(*(int *)(param_3 + 0xc) + *param_4 * 4);
return;
}
fVar1 = *(float *)(*(int *)(param_3 + 0xc) + *param_4 * 4);
param_4[3] = (uint)((*(float *)(*(int *)(param_3 + 0xc) + param_4[1] * 4) - fVar1) *
(float)param_4[2] + fVar1);
if (((float)COLLISION_PLANE_ZERO_THRESHOLD != *(float *)(param_2 + 0x10c)) && (param_3[1] == -1))
{
findInterpolationIndices
((SceneObject *)param_1,*(uint *)(param_2 + 0xc4),*(uint *)(param_2 + 200),
(AnimationData *)param_3,param_4 + 4);
fVar1 = *(float *)(*(int *)(param_3 + 0xc) + param_4[4] * 4);
fVar1 = (*(float *)(*(int *)(param_3 + 0xc) + param_4[5] * 4) - fVar1) * (float)param_4[6] +
fVar1;
param_4[7] = (uint)fVar1;
param_4[3] = (uint)((fVar1 - (float)param_4[3]) * *(float *)(param_2 + 0x10c) +
(float)param_4[3]);
}
return;
}
@@ -0,0 +1,12 @@
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
void initParticlePixelShaderGeneration(void)
{
/* WARNING: Could not recover jumptable at 0x0074a7c0. Too many branches */
/* WARNING: Treating indirect jump as call */
(*_DAT_00876504)();
return;
}
@@ -0,0 +1,79 @@
/* WARNING: Variable defined which should be unmapped: local_18 */
void __fastcall
interpolateAnimationKeyframes
(void *animationObject,uint animationState,AnimationData *keyframeData,
InterpolationOutputBuffer *outputBuffer)
{
int iVar1;
float *source_keyframe_ptr;
float *first_keyframe_ptr;
int second_keyframe_ptr;
int iVar2;
undefined *local_18;
undefined *local_8;
float interpolation_factor;
uint keyframe_base_ptr;
findInterpolationIndices
((SceneObject *)animationObject,*(uint *)(animationState + 0x98),
*(uint *)(animationState + 0x9c),keyframeData,&outputBuffer->first_keyframe_index);
iVar1 = outputBuffer->first_keyframe_index * 0x10;
if ((short)keyframeData->interpolationModeAndTimeIndex == 0) {
source_keyframe_ptr = (float *)(iVar1 + keyframeData->keyframe_base_ptr);
outputBuffer->primary_result[0] = *source_keyframe_ptr;
outputBuffer->primary_result[1] = source_keyframe_ptr[1];
outputBuffer->primary_result[2] = source_keyframe_ptr[2];
outputBuffer->primary_result[3] = source_keyframe_ptr[3];
return;
}
keyframe_base_ptr = keyframeData->keyframe_base_ptr;
interpolation_factor = (float)outputBuffer->interpolation_factor;
first_keyframe_ptr = (float *)(iVar1 + keyframe_base_ptr);
iVar1 = outputBuffer->second_keyframe_index * 0x10;
second_keyframe_ptr = iVar1 + keyframe_base_ptr;
source_keyframe_ptr = outputBuffer->primary_result;
*source_keyframe_ptr =
(*(float *)(iVar1 + keyframe_base_ptr) - *first_keyframe_ptr) * interpolation_factor +
*first_keyframe_ptr;
outputBuffer->primary_result[1] =
(*(float *)(second_keyframe_ptr + 4) - first_keyframe_ptr[1]) * interpolation_factor +
first_keyframe_ptr[1];
outputBuffer->primary_result[2] =
(*(float *)(second_keyframe_ptr + 8) - first_keyframe_ptr[2]) * interpolation_factor +
first_keyframe_ptr[2];
outputBuffer->primary_result[3] =
(*(float *)(second_keyframe_ptr + 0xc) - first_keyframe_ptr[3]) * interpolation_factor +
first_keyframe_ptr[3];
if (((float)COLLISION_PLANE_ZERO_THRESHOLD != *(float *)(animationState + 0x10c)) &&
(*(short *)((int)&keyframeData->interpolationModeAndTimeIndex + 2) == -1)) {
findInterpolationIndices
((SceneObject *)animationObject,*(uint *)(animationState + 0xc4),
*(uint *)(animationState + 200),keyframeData,&outputBuffer->secondary_first_index);
interpolation_factor = (float)outputBuffer->secondary_factor;
keyframe_base_ptr = keyframeData->keyframe_base_ptr;
second_keyframe_ptr = outputBuffer->secondary_second_index * 0x10;
iVar2 = second_keyframe_ptr + keyframe_base_ptr;
iVar1 = outputBuffer->secondary_first_index * 0x10;
first_keyframe_ptr = (float *)(iVar1 + keyframe_base_ptr);
outputBuffer->secondary_result[0] =
(*(float *)(second_keyframe_ptr + keyframe_base_ptr) -
*(float *)(iVar1 + keyframe_base_ptr)) * interpolation_factor + *first_keyframe_ptr;
outputBuffer->secondary_result[1] =
(*(float *)(iVar2 + 4) - first_keyframe_ptr[1]) * interpolation_factor +
first_keyframe_ptr[1];
outputBuffer->secondary_result[2] =
(*(float *)(iVar2 + 8) - first_keyframe_ptr[2]) * interpolation_factor +
first_keyframe_ptr[2];
outputBuffer->secondary_result[3] =
(*(float *)(iVar2 + 0xc) - first_keyframe_ptr[3]) * interpolation_factor +
first_keyframe_ptr[3];
blendAnimationResults
((undefined *)source_keyframe_ptr,(undefined *)source_keyframe_ptr,
(undefined *)outputBuffer->secondary_result,*(undefined **)(animationState + 0x10c));
}
return;
}
@@ -0,0 +1,86 @@
void __thiscall rotateMatrixByQuaternion(void *this,float *param_1)
{
float fVar1;
float fVar2;
float fVar3;
Matrix4x4 *pMVar4;
int iVar5;
undefined *local_7c;
undefined *local_78;
undefined *local_74;
undefined *local_70;
undefined *local_6c;
undefined *local_68;
undefined *local_64;
undefined *local_60;
undefined *local_5c;
undefined *local_58;
undefined *local_54;
undefined *local_50;
undefined *local_4c;
undefined *local_48;
undefined *local_44;
undefined *local_40;
undefined *local_3c;
undefined *local_38;
undefined *local_34;
undefined *local_30;
undefined *local_2c;
undefined *local_28;
undefined *local_24;
undefined *local_20;
undefined *local_1c;
undefined *local_18;
undefined *local_14;
undefined *local_10;
undefined *local_c;
undefined *local_8;
fVar1 = *param_1 + *param_1;
local_54 = (undefined *)0x0;
fVar3 = param_1[1] + param_1[1];
local_44 = (undefined *)0x0;
fVar2 = param_1[2] + param_1[2];
local_10 = (undefined *)(fVar1 * param_1[3]);
local_20 = (undefined *)(fVar3 * param_1[3]);
local_1c = (undefined *)(fVar2 * param_1[3]);
local_18 = (undefined *)(fVar1 * *param_1);
local_c = (undefined *)(fVar3 * *param_1);
local_14 = (undefined *)(fVar2 * *param_1);
local_8 = (undefined *)(fVar2 * param_1[1]);
local_60 = (undefined *)(StaticFloat1_0 - (fVar2 * param_1[2] + fVar3 * param_1[1]));
local_5c = (undefined *)((float)local_c + (float)local_1c);
local_7c = (undefined *)((float)local_14 - (float)local_20);
local_78 = (undefined *)((float)local_c - (float)local_1c);
local_74 = (undefined *)(StaticFloat1_0 - (fVar2 * param_1[2] + (float)local_18));
local_70 = (undefined *)((float)local_8 + (float)local_10);
local_6c = (undefined *)((float)local_14 + (float)local_20);
local_68 = (undefined *)((float)local_8 - (float)local_10);
local_64 = (undefined *)(StaticFloat1_0 - (fVar3 * param_1[1] + (float)local_18));
local_34 = (undefined *)0x0;
local_30 = (undefined *)0x0;
local_2c = (undefined *)0x0;
local_28 = (undefined *)0x0;
local_24 = (undefined *)0x3f800000;
local_58 = local_7c;
local_50 = local_78;
local_4c = local_74;
local_48 = local_70;
local_40 = local_6c;
local_3c = local_68;
local_38 = local_64;
pMVar4 = multiplyMatrix4x4_SSE_Optimized
((Matrix4x4 *)&stack0xffffff60,(Matrix4x4 *)&local_60,(Matrix4x4 *)this);
iVar5 = 8;
do {
*(float *)this = pMVar4->m00;
*(float *)((int)this + 4) = pMVar4->m01;
this = (void *)((int)this + 8);
pMVar4 = (Matrix4x4 *)&pMVar4->m02;
iVar5 = iVar5 + -1;
} while (iVar5 != 0);
return;
}
@@ -0,0 +1,22 @@
void __thiscall scaleMatrix3x3ByVector(void *this,float *param_1)
{
float fVar1;
fVar1 = *param_1;
/* WARNING: Load size is inaccurate */
*(float *)this = fVar1 * *this;
*(float *)((int)this + 4) = fVar1 * *(float *)((int)this + 4);
*(float *)((int)this + 8) = fVar1 * *(float *)((int)this + 8);
fVar1 = param_1[1];
*(float *)((int)this + 0x10) = fVar1 * *(float *)((int)this + 0x10);
*(float *)((int)this + 0x14) = fVar1 * *(float *)((int)this + 0x14);
*(float *)((int)this + 0x18) = fVar1 * *(float *)((int)this + 0x18);
fVar1 = param_1[2];
*(float *)((int)this + 0x20) = fVar1 * *(float *)((int)this + 0x20);
*(float *)((int)this + 0x24) = fVar1 * *(float *)((int)this + 0x24);
*(float *)((int)this + 0x28) = fVar1 * *(float *)((int)this + 0x28);
return;
}
@@ -0,0 +1,8 @@
void __thiscall setShortValue(void *this,undefined2 *param_1)
{
*(undefined2 *)this = *param_1;
return;
}
@@ -0,0 +1,115 @@
void __fastcall updateAnimationTransform(SceneObject *param_1)
{
int iVar1;
int **ppiVar2;
Matrix4x4 *pMVar3;
int iVar4;
void *pvVar5;
undefined4 *puVar6;
int iVar7;
undefined **ppuVar8;
undefined *local_5c;
undefined *local_58;
undefined *local_54;
undefined *local_4c;
undefined *local_48;
undefined *local_44;
undefined *local_3c;
undefined *local_38;
undefined *local_34;
undefined *local_2c;
undefined *local_28;
undefined *local_24;
undefined *local_1c;
undefined *local_18;
undefined *local_14;
undefined *local_10;
undefined *local_c;
undefined *local_8;
if (param_1->transform_sync_value != *(int *)((int)param_1->animation_context_ptr + 0x10)) {
if (*(int *)&param_1->field_0x1cc == 0) {
local_10 = (undefined *)0x0;
local_c = (undefined *)0x0;
local_8 = (undefined *)0x0;
local_1c = (undefined *)0x3f800000;
local_18 = (undefined *)0x3f800000;
local_14 = (undefined *)0x3f800000;
transformMatrix4x4(param_1,(Matrix4x4 *)((int)param_1->animation_context_ptr + 0x9c),
(Matrix4x4 *)&local_1c,(Matrix4x4 *)&local_10,(Matrix4x4 *)0x3f800000);
}
else {
updateAnimationTransform();
}
pvVar5 = param_1->animation_context_ptr;
if (param_1->transform_sync_value != *(int *)((int)pvVar5 + 0x10)) {
iVar7 = *(int *)&param_1->field_0x1cc;
if ((iVar7 != 0) && (param_1->model_data_ptr != (void *)0x0)) {
if ((*(int *)(iVar7 + 0x10) == 0) ||
((*(int *)(iVar7 + 0x40) != *(int *)((int)pvVar5 + 0x10) ||
(param_1->field_0x184 == 9.18341e-41)))) {
transformMatrix4x4(param_1,(Matrix4x4 *)(iVar7 + 0xfc),(Matrix4x4 *)(iVar7 + 0x1a0),
(Matrix4x4 *)(iVar7 + 0x1ac),*(Matrix4x4 **)(iVar7 + 0x19c));
}
else {
iVar1 = (int)param_1->field_0x184 * 0x30 +
*(int *)(*(int *)(*(int *)(iVar7 + 0x30) + 0x130) + 0x108);
puVar6 = (undefined4 *)((uint)*(ushort *)(iVar1 + 4) * 0x40 + *(int *)(iVar7 + 0x94));
ppuVar8 = &local_5c;
for (iVar4 = 0x10; iVar4 != 0; iVar4 = iVar4 + -1) {
*ppuVar8 = (undefined *)*puVar6;
puVar6 = puVar6 + 1;
ppuVar8 = ppuVar8 + 1;
}
local_2c = (undefined *)
((float)local_5c * *(float *)(iVar1 + 8) +
(float)local_4c * *(float *)(iVar1 + 0xc) +
(float)local_3c * *(float *)(iVar1 + 0x10) + (float)local_2c);
local_28 = (undefined *)
((float)local_58 * *(float *)(iVar1 + 8) +
(float)local_48 * *(float *)(iVar1 + 0xc) +
(float)local_38 * *(float *)(iVar1 + 0x10) + (float)local_28);
local_24 = (undefined *)
((float)local_54 * *(float *)(iVar1 + 8) +
(float)local_44 * *(float *)(iVar1 + 0xc) +
(float)local_34 * *(float *)(iVar1 + 0x10) + (float)local_24);
transformMatrix4x4(param_1,(Matrix4x4 *)&local_5c,(Matrix4x4 *)(iVar7 + 0x1a0),
(Matrix4x4 *)(iVar7 + 0x1ac),*(Matrix4x4 **)(iVar7 + 0x19c));
}
pvVar5 = param_1->animation_context_ptr;
if (param_1->transform_sync_value == *(int *)((int)pvVar5 + 0x10)) {
return;
}
}
if (*(int *)&param_1->field_0x1cc != 0) {
puVar6 = (undefined4 *)(*(int *)&param_1->field_0x1cc + 0xfc);
ppiVar2 = &param_1->model_attachment_list1;
iVar7 = 8;
do {
*ppiVar2 = (int *)*puVar6;
ppiVar2[1] = (int *)puVar6[1];
ppiVar2 = ppiVar2 + 2;
puVar6 = puVar6 + 2;
iVar7 = iVar7 + -1;
} while (iVar7 != 0);
return;
}
pMVar3 = multiplyMatrix4x4_SSE_Optimized
((Matrix4x4 *)&local_5c,(Matrix4x4 *)&param_1->field_a0,
(Matrix4x4 *)((int)pvVar5 + 0x9c));
ppiVar2 = &param_1->model_attachment_list1;
iVar7 = 8;
do {
*ppiVar2 = (int *)pMVar3->m00;
ppiVar2[1] = (int *)pMVar3->m01;
ppiVar2 = ppiVar2 + 2;
pMVar3 = (Matrix4x4 *)&pMVar3->m02;
iVar7 = iVar7 + -1;
} while (iVar7 != 0);
}
}
return;
}
File diff suppressed because it is too large Load Diff