mirror of https://github.com/zeldaret/tp.git
c_lib: Decomp a few functions (#89)
* c_lib: Decomp cLib_memSet and cLib_memCpy Gets rid of some low-hanging fruit. * c_lib: Decomp cLib_distanceAngleS Another super trivial function to make match. * c_lib: Decomp cLib_targetAngleY overload set Fairly trivial in terms of matching. * c_lib: Sate clang-format I didn't touch this code, but the clang-format pass wants this done, and so it is.
This commit is contained in:
parent
f33e47c031
commit
afb426c60c
|
|
@ -4,8 +4,9 @@
|
|||
#include "SComponent/c_xyz.h"
|
||||
#include "global.h"
|
||||
|
||||
void cLib_memCpy(void*, const void*, unsigned long);
|
||||
void cLib_memSet(void*, int, unsigned long);
|
||||
void cLib_memCpy(void* dst, const void* src, unsigned long size);
|
||||
void cLib_memSet(void* ptr, int value, unsigned long size);
|
||||
|
||||
float cLib_addCalc(float*, float, float, float, float);
|
||||
void cLib_addCalc2(float*, float, float, float);
|
||||
void cLib_addCalc0(float*, float, float);
|
||||
|
|
@ -15,17 +16,21 @@ void cLib_addCalcPos2(cXyz*, const cXyz&, float, float);
|
|||
void cLib_addCalcPosXZ2(cXyz*, const cXyz&, float, float);
|
||||
short cLib_addCalcAngleS(short*, short, short, short, short);
|
||||
void cLib_addCalcAngleS2(short*, short, short, short);
|
||||
|
||||
int cLib_chaseUC(unsigned char*, unsigned char, unsigned char);
|
||||
int cLib_chaseS(short*, short, short);
|
||||
int cLib_chaseF(float*, float, float);
|
||||
int cLib_chasePos(cXyz*, const cXyz&, float);
|
||||
int cLib_chasePosXZ(cXyz*, const cXyz&, float);
|
||||
int cLib_chaseAngleS(short*, short, short);
|
||||
short cLib_targetAngleY(const Vec*, const Vec*);
|
||||
short cLib_targetAngleY(const Vec&, const Vec&);
|
||||
|
||||
s16 cLib_targetAngleY(const Vec* lhs, const Vec* rhs);
|
||||
s16 cLib_targetAngleY(const Vec& lhs, const Vec& rhs);
|
||||
short cLib_targetAngleX(const cXyz*, const cXyz*);
|
||||
|
||||
void cLib_offsetPos(cXyz*, const cXyz*, short, const cXyz*);
|
||||
short cLib_distanceAngleS(short, short);
|
||||
s32 cLib_distanceAngleS(s16 x, s16 y);
|
||||
|
||||
void MtxInit(void);
|
||||
void MtxTrans(float, float, float, unsigned char);
|
||||
void MtxScale(float, float, float, unsigned char);
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
/* 8026F93C 0026C87C 94 21 FF F0 */ stwu r1, -0x10(r1)
|
||||
/* 8026F940 0026C880 7C 08 02 A6 */ mflr r0
|
||||
/* 8026F944 0026C884 90 01 00 14 */ stw r0, 0x14(r1)
|
||||
/* 8026F948 0026C888 4B D9 3B F9 */ bl memcpy
|
||||
/* 8026F94C 0026C88C 80 01 00 14 */ lwz r0, 0x14(r1)
|
||||
/* 8026F950 0026C890 7C 08 03 A6 */ mtlr r0
|
||||
/* 8026F954 0026C894 38 21 00 10 */ addi r1, r1, 0x10
|
||||
/* 8026F958 0026C898 4E 80 00 20 */ blr
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
/* 8026F95C 0026C89C 94 21 FF F0 */ stwu r1, -0x10(r1)
|
||||
/* 8026F960 0026C8A0 7C 08 02 A6 */ mflr r0
|
||||
/* 8026F964 0026C8A4 90 01 00 14 */ stw r0, 0x14(r1)
|
||||
/* 8026F968 0026C8A8 4B D9 3A F1 */ bl memset
|
||||
/* 8026F96C 0026C8AC 80 01 00 14 */ lwz r0, 0x14(r1)
|
||||
/* 8026F970 0026C8B0 7C 08 03 A6 */ mtlr r0
|
||||
/* 8026F974 0026C8B4 38 21 00 10 */ addi r1, r1, 0x10
|
||||
/* 8026F978 0026C8B8 4E 80 00 20 */ blr
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
/* 80270C04 0026DB44 94 21 FF F0 */ stwu r1, -0x10(r1)
|
||||
/* 80270C08 0026DB48 7C 08 02 A6 */ mflr r0
|
||||
/* 80270C0C 0026DB4C 90 01 00 14 */ stw r0, 0x14(r1)
|
||||
/* 80270C10 0026DB50 C0 24 00 00 */ lfs f1, 0(r4)
|
||||
/* 80270C14 0026DB54 C0 03 00 00 */ lfs f0, 0(r3)
|
||||
/* 80270C18 0026DB58 EC 21 00 28 */ fsubs f1, f1, f0
|
||||
/* 80270C1C 0026DB5C C0 44 00 08 */ lfs f2, 8(r4)
|
||||
/* 80270C20 0026DB60 C0 03 00 08 */ lfs f0, 8(r3)
|
||||
/* 80270C24 0026DB64 EC 42 00 28 */ fsubs f2, f2, f0
|
||||
/* 80270C28 0026DB68 4B FF 6A 4D */ bl cM_atan2s__Fff
|
||||
/* 80270C2C 0026DB6C 80 01 00 14 */ lwz r0, 0x14(r1)
|
||||
/* 80270C30 0026DB70 7C 08 03 A6 */ mtlr r0
|
||||
/* 80270C34 0026DB74 38 21 00 10 */ addi r1, r1, 0x10
|
||||
/* 80270C38 0026DB78 4E 80 00 20 */ blr
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
/* 80270C3C 0026DB7C 94 21 FF F0 */ stwu r1, -0x10(r1)
|
||||
/* 80270C40 0026DB80 7C 08 02 A6 */ mflr r0
|
||||
/* 80270C44 0026DB84 90 01 00 14 */ stw r0, 0x14(r1)
|
||||
/* 80270C48 0026DB88 C0 24 00 00 */ lfs f1, 0(r4)
|
||||
/* 80270C4C 0026DB8C C0 03 00 00 */ lfs f0, 0(r3)
|
||||
/* 80270C50 0026DB90 EC 21 00 28 */ fsubs f1, f1, f0
|
||||
/* 80270C54 0026DB94 C0 44 00 08 */ lfs f2, 8(r4)
|
||||
/* 80270C58 0026DB98 C0 03 00 08 */ lfs f0, 8(r3)
|
||||
/* 80270C5C 0026DB9C EC 42 00 28 */ fsubs f2, f2, f0
|
||||
/* 80270C60 0026DBA0 4B FF 6A 15 */ bl cM_atan2s__Fff
|
||||
/* 80270C64 0026DBA4 80 01 00 14 */ lwz r0, 0x14(r1)
|
||||
/* 80270C68 0026DBA8 7C 08 03 A6 */ mtlr r0
|
||||
/* 80270C6C 0026DBAC 38 21 00 10 */ addi r1, r1, 0x10
|
||||
/* 80270C70 0026DBB0 4E 80 00 20 */ blr
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
/* 80270E24 0026DD64 94 21 FF F0 */ stwu r1, -0x10(r1)
|
||||
/* 80270E28 0026DD68 7C 08 02 A6 */ mflr r0
|
||||
/* 80270E2C 0026DD6C 90 01 00 14 */ stw r0, 0x14(r1)
|
||||
/* 80270E30 0026DD70 7C 04 18 50 */ subf r0, r4, r3
|
||||
/* 80270E34 0026DD74 7C 03 07 34 */ extsh r3, r0
|
||||
/* 80270E38 0026DD78 48 0F 42 99 */ bl abs
|
||||
/* 80270E3C 0026DD7C 80 01 00 14 */ lwz r0, 0x14(r1)
|
||||
/* 80270E40 0026DD80 7C 08 03 A6 */ mtlr r0
|
||||
/* 80270E44 0026DD84 38 21 00 10 */ addi r1, r1, 0x10
|
||||
/* 80270E48 0026DD88 4E 80 00 20 */ blr
|
||||
|
|
@ -1,19 +1,18 @@
|
|||
/* c_lib.cpp autogenerated by split.py v0.3 at 2021-01-01 14:12:11.766106 */
|
||||
|
||||
#include "SComponent/c_lib.h"
|
||||
#include "SComponent/c_math.h"
|
||||
|
||||
// cLib_memCpy__FPvPCvUl
|
||||
// cLib_memCpy(void*, const void*, unsigned long)
|
||||
asm void cLib_memCpy(void*, const void*, unsigned long) {
|
||||
nofralloc
|
||||
#include "SComponent/c_lib/asm/func_8026F93C.s"
|
||||
void cLib_memCpy(void* dst, const void* src, unsigned long size) {
|
||||
memcpy(dst, src, size);
|
||||
}
|
||||
|
||||
// cLib_memSet__FPviUl
|
||||
// cLib_memSet(void*, int, unsigned long)
|
||||
asm void cLib_memSet(void*, int, unsigned long) {
|
||||
nofralloc
|
||||
#include "SComponent/c_lib/asm/func_8026F95C.s"
|
||||
void cLib_memSet(void* ptr, int value, unsigned long size) {
|
||||
memset(ptr, value, size);
|
||||
}
|
||||
|
||||
// cLib_addCalc__FPfffff
|
||||
|
|
@ -116,23 +115,20 @@ asm int cLib_chasePosXZ(cXyz*, const cXyz&, float) {
|
|||
|
||||
// cLib_chaseAngleS__FPsss
|
||||
// cLib_chaseAngleS(short*, short, short)
|
||||
asm int cLib_chaseAngleS(short*, short, short) {
|
||||
nofralloc
|
||||
asm int cLib_chaseAngleS(short*, short, short){nofralloc
|
||||
#include "SComponent/c_lib/asm/func_80270B90.s"
|
||||
}
|
||||
|
||||
// cLib_targetAngleY__FPC3VecPC3Vec
|
||||
// cLib_targetAngleY(const Vec*, const Vec*)
|
||||
asm short cLib_targetAngleY(const Vec*, const Vec*) {
|
||||
nofralloc
|
||||
#include "SComponent/c_lib/asm/func_80270C04.s"
|
||||
s16 cLib_targetAngleY(const Vec* lhs, const Vec* rhs) {
|
||||
return cM_atan2s(rhs->x - lhs->x, rhs->z - lhs->z);
|
||||
}
|
||||
|
||||
// cLib_targetAngleY__FRC3VecRC3Vec
|
||||
// cLib_targetAngleY(const Vec&, const Vec&)
|
||||
asm short cLib_targetAngleY(const Vec&, const Vec&) {
|
||||
nofralloc
|
||||
#include "SComponent/c_lib/asm/func_80270C3C.s"
|
||||
s16 cLib_targetAngleY(const Vec& lhs, const Vec& rhs) {
|
||||
return cM_atan2s(rhs.x - lhs.x, rhs.z - lhs.z);
|
||||
}
|
||||
|
||||
// cLib_targetAngleX__FPC4cXyzPC4cXyz
|
||||
|
|
@ -144,16 +140,14 @@ asm short cLib_targetAngleX(const cXyz*, const cXyz*) {
|
|||
|
||||
// cLib_offsetPos__FP4cXyzPC4cXyzsPC4cXyz
|
||||
// cLib_offsetPos(cXyz*, const cXyz*, short, const cXyz*)
|
||||
asm void cLib_offsetPos(cXyz*, const cXyz*, short, const cXyz*) {
|
||||
nofralloc
|
||||
asm void cLib_offsetPos(cXyz*, const cXyz*, short, const cXyz*){nofralloc
|
||||
#include "SComponent/c_lib/asm/func_80270DC0.s"
|
||||
}
|
||||
|
||||
// cLib_distanceAngleS__Fss
|
||||
// cLib_distanceAngleS(short, short)
|
||||
asm short cLib_distanceAngleS(short, short) {
|
||||
nofralloc
|
||||
#include "SComponent/c_lib/asm/func_80270E24.s"
|
||||
s32 cLib_distanceAngleS(s16 x, s16 y) {
|
||||
return abs(static_cast<s16>(x - y));
|
||||
}
|
||||
|
||||
// MtxInit__Fv
|
||||
|
|
|
|||
Loading…
Reference in New Issue