decompile calcLagrange

also minor cleanup of .s
This commit is contained in:
EpochFlame 2022-03-03 16:34:54 -05:00
parent 6f7e54cf86
commit 50b4568556
4 changed files with 33 additions and 87 deletions

View File

@ -10,37 +10,39 @@ lbl_80498670:
.4byte 0x00000000
.4byte 0x00000000
.4byte 0x00000000
.balign 4
.global lbl_8049867C
lbl_8049867C:
.asciz "khReadyGo.cpp"
.skip 2
.balign 4
.global lbl_8049868C
lbl_8049868C:
.asciz "disp member err"
.balign 4
.global lbl_8049869C
lbl_8049869C:
.asciz "ready_go.blo"
.skip 3
.balign 4
.global lbl_804986AC
lbl_804986AC:
.asciz "ready_go.bck"
.skip 3
.balign 4
.global lbl_804986BC
lbl_804986BC:
.asciz "ready_go.bpk"
.skip 3
.balign 4
.global lbl_804986CC
lbl_804986CC:
.asciz "ready_go_reverse.blo"
.skip 3
.balign 4
.global lbl_804986E4
lbl_804986E4:
.asciz "ready_go_reverse.bck"
.skip 3
.balign 4
.global lbl_804986FC
lbl_804986FC:
.asciz "ready_go_reverse.bpk"
.skip 3
.balign 4
.4byte lbl_8049869C
.4byte lbl_804986AC
.4byte lbl_804986BC
@ -50,10 +52,10 @@ lbl_804986FC:
.global lbl_8049872C
lbl_8049872C:
.asciz "ready_go.szs"
.skip 3
.balign 4
.asciz "screenObj.h"
.balign 4
.asciz "P2Assert"
.skip 7
.section .data, "wa" # 0x8049E220 - 0x804EFC20
.balign 8
@ -150,33 +152,24 @@ lbl_8051612C:
.section .sdata2, "a" # 0x80516360 - 0x80520E40
.balign 8
.global lbl_80520058
lbl_80520058:
.4byte 0x00000000
.global lbl_8052005C
lbl_8052005C:
.4byte 0x42700000
.global lbl_80520060
lbl_80520060:
.4byte 0x429C0000
.4byte 0x00000000
.global lbl_80520068
lbl_80520068:
.4byte 0x43300000
.4byte 0x80000000
.global lbl_80520070
lbl_80520070:
.4byte 0xC2F00000
.global lbl_80520074
lbl_80520074:
.4byte 0x42F00000
.global lbl_80520078
lbl_80520078:
.float 0.7
.global lbl_8052007C
lbl_8052007C:
.4byte 0xC1400000
.global lbl_80520080
lbl_80520080:
.4byte 0xC1B00000
.4byte 0x00000000
@ -918,8 +911,7 @@ lbl_80401CB8:
/* 80401CCC 003FEC0C 38 21 00 10 */ addi r1, r1, 0x10
/* 80401CD0 003FEC10 4E 80 00 20 */ blr
.global __sinit_khReadyGo_cpp
__sinit_khReadyGo_cpp:
__sinit_khReadyGo_cpp: # static initializer
/* 80401CD4 003FEC14 3C 60 80 51 */ lis r3, __float_nan@ha
/* 80401CD8 003FEC18 38 00 FF FF */ li r0, -1
/* 80401CDC 003FEC1C 38 A3 48 B0 */ addi r5, r3, __float_nan@l

View File

@ -1,22 +1,16 @@
.include "macros.inc"
.section .sdata2, "a" # 0x80516360 - 0x80520E40
.balign 8
.global lbl_8051A600
lbl_8051A600:
.float 1.0
.global lbl_8051A604
lbl_8051A604:
.4byte 0x40000000
.global lbl_8051A608
.float 2.0
lbl_8051A608:
.float 0.5
.global lbl_8051A60C
lbl_8051A60C:
.4byte 0x358637BD
.global lbl_8051A610
.float 1.0E-6
lbl_8051A610:
.4byte 0x00000000
.4byte 0x00000000
.float 0.0
.section .text, "ax" # 0x800056C0 - 0x80472F00
.global "calcLagrange__Q24Game9NsMathExpFPC10Vector3<f>fR10Vector3<f>"

View File

@ -2418,8 +2418,7 @@ lbl_8031E9DC:
/* 8031EA24 0031B964 38 21 00 10 */ addi r1, r1, 0x10
/* 8031EA28 0031B968 4E 80 00 20 */ blr
.global __sinit_ogObjAnaDemo_cpp
__sinit_ogObjAnaDemo_cpp:
__sinit_ogObjAnaDemo_cpp: # static initalizer
/* 8031EA2C 0031B96C C0 42 F8 DC */ lfs f2, lbl_8051DC3C@sda21(r2)
/* 8031EA30 0031B970 3C 60 80 51 */ lis r3, msVal__Q32og9newScreen10ObjAnaDemo@ha
/* 8031EA34 0031B974 C0 22 F8 E0 */ lfs f1, lbl_8051DC40@sda21(r2)

View File

@ -1,78 +1,37 @@
#include "types.h"
#include "Vector3.h"
/*
Generated from dpostproc
.section .sdata2, "a" # 0x80516360 - 0x80520E40
.global lbl_8051A600
lbl_8051A600:
.float 1.0
.global lbl_8051A604
lbl_8051A604:
.4byte 0x40000000
.global lbl_8051A608
.float 2.0
lbl_8051A608:
.float 0.5
.global lbl_8051A60C
lbl_8051A60C:
.4byte 0x358637BD
.global lbl_8051A610
.float 1.0E-6
lbl_8051A610:
.4byte 0x00000000
.4byte 0x00000000
.float 0.0
*/
namespace Game {
namespace NsMathExp {
/*
* --INFO--
* Address: 8023D7B0
* Size: 0000A8
* Matches!
*/
void calcLagrange__Q24Game9NsMathExpFPC10Vector3f fR10Vector3f(void)
void calcLagrange(const Vector3f* p_vec, float p2, Vector3f& new_vec)
// calculates Lagrange, stores in new_vec
{
/*
lfs f0, lbl_8051A600@sda21(r2)
lfs f2, lbl_8051A604@sda21(r2)
lfs f3, 0xc(r3)
fsubs f0, f1, f0
lfs f4, 0x10(r3)
fsubs f2, f1, f2
fmuls f6, f3, f1
lfs f3, 0x14(r3)
fmuls f5, f4, f1
fmuls f3, f3, f1
lfs f12, lbl_8051A608@sda21(r2)
lfs f7, 0(r3)
lfs f4, 4(r3)
fmuls f9, f2, f6
fmuls f8, f12, f7
lfs f10, 0x18(r3)
fmuls f7, f12, f4
lfs f4, 8(r3)
fmuls f6, f2, f5
fmuls f11, f12, f10
fmuls f10, f8, f0
lfs f8, 0x1c(r3)
fmuls f4, f12, f4
lfs f5, 0x20(r3)
fmuls f8, f12, f8
fmuls f7, f7, f0
fmuls f5, f12, f5
fmuls f11, f11, f1
fmsubs f9, f2, f10, f9
fmuls f4, f4, f0
fmuls f3, f2, f3
fmadds f9, f0, f11, f9
fmuls f8, f8, f1
fmsubs f6, f2, f7, f6
fmuls f5, f5, f1
stfs f9, 0(r4)
fmsubs f1, f2, f4, f3
fmadds f2, f0, f8, f6
fmadds f0, f0, f5, f1
stfs f2, 4(r4)
stfs f0, 8(r4)
blr
*/
float p2_sub1 = p2 - 1.0f;
float p2_sub2 = p2 - 2.0f;
new_vec.x = p2_sub1 * (p_vec[2].x * 0.5f * p2) + (p2_sub2 * (p_vec[0].x * 0.5f * p2_sub1) - (p2_sub2 * (p_vec[1].x * p2)));
new_vec.y = p2_sub1 * (p_vec[2].y * 0.5f * p2) + (p2_sub2 * (p_vec[0].y * 0.5f * p2_sub1) - (p2_sub2 * (p_vec[1].y * p2)));
new_vec.z = p2_sub1 * (p_vec[2].z * 0.5f * p2) + (p2_sub2 * (p_vec[0].z * 0.5f * p2_sub1) - (p2_sub2 * (p_vec[1].z * p2)));
}
/*
@ -80,7 +39,7 @@ void calcLagrange__Q24Game9NsMathExpFPC10Vector3f fR10Vector3f(void)
* Address: 8023D858
* Size: 0001D8
*/
void calcJointPos__Q24Game9NsMathExpFRC10Vector3f RC10Vector3f ffR10Vector3f R10Vector3f(void)
void calcJointPos(const Vector3f&, const Vector3f&, float, float, Vector3f&, Vector3f&)
{
/*
.loc_0x0:
@ -220,3 +179,5 @@ void calcJointPos__Q24Game9NsMathExpFRC10Vector3f RC10Vector3f ffR10Vector3f R10
blr
*/
}
} // namespace NsMathExp
} // namespace Game