mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-10 04:46:48 -04:00
Decompile some SComponent data and some MSL_C.PPCEABI.bare.H headers (#115)
* data for c_angle * data c_sxyz * partially migrated c_xyz data * c_xyz data * c_xyz data decomp * c_math data * c_math data * c_lib data, some cleanup * rename some unnamed functions and create header for them * header for string functions * format and fix fabsf * cleanup * remove more unneded function prototypes * move fpclassify to math.h
This commit is contained in:
@@ -2,11 +2,9 @@
|
||||
|
||||
#include "SComponent/c_angle.h"
|
||||
#include "global.h"
|
||||
#include "msl_c/math.h"
|
||||
|
||||
extern "C" {
|
||||
double func_8036C028(double);
|
||||
double func_8036C590(double);
|
||||
double func_8036C668(double);
|
||||
double func_8036CA54(double);
|
||||
void __ct__7cSAngleFs(void);
|
||||
void cSAngle_NS_dtor(void);
|
||||
@@ -14,21 +12,7 @@ void func_80361C24(void);
|
||||
float cAngle_NS_Adjust(float, float, float);
|
||||
}
|
||||
|
||||
// additional symbols needed for c_angle.cpp
|
||||
// autogenerated by split.py v0.3 at 2020-12-31 13:27:46.742344
|
||||
extern float lbl_80455208; // SComponent::@2248, 182.04445f
|
||||
extern float lbl_8045520C; // SComponent::@2260, 0.005493164f
|
||||
extern double lbl_80455210; // SComponent::@2263, 4.503601774854144E15
|
||||
extern float lbl_80455218; // SComponent::@2269, 9.58738E-5
|
||||
extern float lbl_8045521C; // SComponent::@2277, 3.0517578E-5
|
||||
extern float lbl_80455220; // SComponent::@2440, -180.0f
|
||||
extern float lbl_80455224; // SComponent::@2441, 180.0
|
||||
extern float lbl_80455228; // SComponent::@2474, 0.017453292
|
||||
extern float lbl_8045522C; // SComponent::@2491, 0.0f
|
||||
extern double lbl_80455230; // SComponent::@2671, 0.0
|
||||
extern float lbl_80455238; // SComponent::@2672, 10430.378f
|
||||
extern float lbl_8045523C; // SComponent::@2744, 1.0
|
||||
extern u8 lbl_80430F98; // SComponent::@2401
|
||||
extern u8 lbl_80430F98; // SComponent::@2401
|
||||
|
||||
// __ct__7cSAngleFRC7cSAngle
|
||||
cSAngle::cSAngle(const cSAngle& angle) {
|
||||
@@ -57,39 +41,22 @@ void cSAngle::Val(s16 val) {
|
||||
|
||||
// Val__7cSAngleFf
|
||||
void cSAngle::Val(float f) {
|
||||
this->mAngle = lbl_80455208 * f;
|
||||
this->mAngle = 182.04445f * f;
|
||||
}
|
||||
|
||||
// Degree__7cSAngleCFv
|
||||
#ifdef NON_MATCHING
|
||||
float cSAngle::Degree(void) const {
|
||||
// matches, but adds a double constant for the s16 -> float conversion
|
||||
return lbl_8045520C * this->angle;
|
||||
return (360.0f / 65536.0f) * this->mAngle;
|
||||
}
|
||||
#else
|
||||
asm float cSAngle::Degree(void) const {
|
||||
nofralloc
|
||||
#include "SComponent/c_angle/asm/func_80271030.s"
|
||||
}
|
||||
#endif
|
||||
|
||||
// Radian__7cSAngleCFv
|
||||
#ifdef NON_MATCHING
|
||||
float cSAngle::Radian(void) const {
|
||||
// matches, but adds a double constant for the s16 -> float conversion
|
||||
return lbl_80455218 * this->angle;
|
||||
return 9.58738E-5f * this->mAngle;
|
||||
}
|
||||
#else
|
||||
asm float cSAngle::Radian(void) const {
|
||||
nofralloc
|
||||
#include "SComponent/c_angle/asm/func_80271064.s"
|
||||
}
|
||||
#endif
|
||||
|
||||
// Norm__7cSAngleCFv
|
||||
// cSAngle::Norm(void) const
|
||||
asm float cSAngle::Norm(void) const {nofralloc
|
||||
#include "SComponent/c_angle/asm/func_80271098.s"
|
||||
float cSAngle::Norm(void) const {
|
||||
return 3.0517578E-5f * this->mAngle;
|
||||
}
|
||||
|
||||
// Abs__7cSAngleCFv
|
||||
@@ -104,27 +71,27 @@ s16 cSAngle::Inv(void) const {
|
||||
|
||||
// Sin__7cSAngleCFv
|
||||
float cSAngle::Sin(void) const {
|
||||
return func_8036C590(this->Radian());
|
||||
return sin(this->Radian());
|
||||
}
|
||||
|
||||
// Cos__7cSAngleCFv
|
||||
float cSAngle::Cos(void) const {
|
||||
return func_8036C028(this->Radian());
|
||||
return cos(this->Radian());
|
||||
}
|
||||
|
||||
// __mi__7cSAngleCFv
|
||||
cSAngle cSAngle::operator-(void) const {
|
||||
return cSAngle((s16)-mAngle);
|
||||
return cSAngle(static_cast<s16>(-mAngle));
|
||||
}
|
||||
|
||||
// __pl__7cSAngleCFRC7cSAngle
|
||||
cSAngle cSAngle::operator+(const cSAngle& other) const {
|
||||
return cSAngle((s16)(mAngle + other.mAngle));
|
||||
return cSAngle(static_cast<s16>(mAngle + other.mAngle));
|
||||
}
|
||||
|
||||
// __mi__7cSAngleCFRC7cSAngle
|
||||
cSAngle cSAngle::operator-(const cSAngle& other) const {
|
||||
return cSAngle((s16)(mAngle - other.mAngle));
|
||||
return cSAngle(static_cast<s16>(mAngle - other.mAngle));
|
||||
}
|
||||
|
||||
// __apl__7cSAngleFRC7cSAngle
|
||||
@@ -139,12 +106,12 @@ void cSAngle::operator-=(const cSAngle& other) {
|
||||
|
||||
// __pl__7cSAngleCFs
|
||||
cSAngle cSAngle::operator+(short other) const {
|
||||
return cSAngle((s16)(mAngle + other));
|
||||
return cSAngle(static_cast<s16>(mAngle + other));
|
||||
}
|
||||
|
||||
// __mi__7cSAngleCFs
|
||||
cSAngle cSAngle::operator-(short other) const {
|
||||
return cSAngle((s16)(mAngle - other));
|
||||
return cSAngle(static_cast<s16>(mAngle - other));
|
||||
}
|
||||
|
||||
// __apl__7cSAngleFs
|
||||
@@ -153,37 +120,23 @@ void cSAngle::operator+=(short other) {
|
||||
}
|
||||
|
||||
// __ml__7cSAngleCFf
|
||||
#ifdef NON_MATCHING
|
||||
cSAngle cSAngle::operator*(float f1) const {
|
||||
return cSAngle((s16)(angle * f1));
|
||||
return cSAngle(static_cast<s16>(mAngle * f1));
|
||||
}
|
||||
#else
|
||||
asm cSAngle cSAngle::operator*(float) const {
|
||||
nofralloc
|
||||
#include "SComponent/c_angle/asm/func_80271264.s"
|
||||
}
|
||||
#endif
|
||||
|
||||
// __amu__7cSAngleFf
|
||||
#ifdef NON_MATCHING
|
||||
void cSAngle::operator*=(float f1) {
|
||||
this->angle *= f1;
|
||||
this->mAngle *= f1;
|
||||
}
|
||||
#else
|
||||
asm void cSAngle::operator*=(float) {
|
||||
nofralloc
|
||||
#include "SComponent/c_angle/asm/func_802712B4.s"
|
||||
}
|
||||
#endif
|
||||
|
||||
// __pl__FsRC7cSAngle
|
||||
cSAngle operator+(short other, const cSAngle& angle) {
|
||||
return cSAngle((s16)(other + angle.Val()));
|
||||
return cSAngle(static_cast<s16>(other + angle.Val()));
|
||||
}
|
||||
|
||||
// __mi__FsRC7cSAngle
|
||||
cSAngle operator-(short other, const cSAngle& angle) {
|
||||
return cSAngle((s16)(other - angle.Val()));
|
||||
return cSAngle(static_cast<s16>(other - angle.Val()));
|
||||
}
|
||||
|
||||
// __ct__7cDegreeFf
|
||||
@@ -193,7 +146,7 @@ cDegree::cDegree(float f) {
|
||||
|
||||
// Formal__7cDegreeFv
|
||||
cDegree& cDegree::Formal(void) {
|
||||
mDegree = cAngle_NS_Adjust(mDegree, lbl_80455220, lbl_80455224);
|
||||
mDegree = cAngle_NS_Adjust(mDegree, -180.0f, 180.0f);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -205,22 +158,22 @@ void cDegree::Val(float f) {
|
||||
|
||||
// Radian__7cDegreeCFv
|
||||
float cDegree::Radian(void) const {
|
||||
return lbl_80455228 * mDegree;
|
||||
return 0.017453292f * mDegree;
|
||||
}
|
||||
|
||||
// Sin__7cDegreeCFv
|
||||
float cDegree::Sin(void) const {
|
||||
return func_8036C590(this->Radian());
|
||||
return sin(this->Radian());
|
||||
}
|
||||
|
||||
// Cos__7cDegreeCFv
|
||||
float cDegree::Cos(void) const {
|
||||
return func_8036C028(this->Radian());
|
||||
return cos(this->Radian());
|
||||
}
|
||||
|
||||
// Tan__7cDegreeCFv
|
||||
float cDegree::Tan(void) const {
|
||||
return func_8036C668(this->Radian());
|
||||
return tan(this->Radian());
|
||||
}
|
||||
|
||||
// __ct__7cSPolarFRC4cXyz
|
||||
@@ -230,9 +183,9 @@ cSPolar::cSPolar(const cXyz& xyz) {
|
||||
|
||||
// Formal__7cSPolarFv
|
||||
cSPolar& cSPolar::Formal(void) {
|
||||
if (mRadial < /* 0.0 */ lbl_8045522C) {
|
||||
if (mRadial < 0.0f) {
|
||||
mRadial = -mRadial;
|
||||
cSAngle tmp((s16)-0x8000);
|
||||
cSAngle tmp(static_cast<s16>(-0x8000));
|
||||
mAngle1.Val(tmp - mAngle1);
|
||||
mAngle2.Val(mAngle2.Inv());
|
||||
}
|
||||
@@ -263,10 +216,10 @@ void cSPolar::Val(const cXyz& xyz) {
|
||||
z = xyz.z;
|
||||
double tmp = square(z) + square(x);
|
||||
double tmp2 = square(y) + tmp;
|
||||
tmp4 = (tmp > lbl_80455230) ? (float)func_8036CA54(tmp) : lbl_8045522C;
|
||||
mRadial = (tmp2 > lbl_80455230) ? (float)func_8036CA54(tmp2) : lbl_8045522C;
|
||||
mAngle1.Val((s16)(cM_atan2f(tmp4, y) * lbl_80455238));
|
||||
mAngle2.Val((s16)(cM_atan2f(x, z) * lbl_80455238));
|
||||
tmp4 = (tmp > 0.0) ? (float)func_8036CA54(tmp) : 0.0f;
|
||||
mRadial = (tmp2 > 0.0) ? (float)func_8036CA54(tmp2) : 0.0f;
|
||||
mAngle1.Val(static_cast<s16>(cM_atan2f(tmp4, y) * 10430.378f));
|
||||
mAngle2.Val(static_cast<s16>(cM_atan2f(x, z) * 10430.378f));
|
||||
this->Formal();
|
||||
}
|
||||
|
||||
@@ -274,10 +227,10 @@ void cSPolar::Val(const cXyz& xyz) {
|
||||
cXyz cSPolar::Xyz(void) const {
|
||||
float ang1Cos;
|
||||
float ang2Cos;
|
||||
float ang1Sin = mRadial * (float)func_8036C590(mAngle1.Radian());
|
||||
ang2Cos = (float)func_8036C028(mAngle2.Radian());
|
||||
ang1Cos = mRadial * (float)func_8036C028(mAngle1.Radian());
|
||||
float ang2Sin = func_8036C590(mAngle2.Radian());
|
||||
float ang1Sin = mRadial * (float)sin(mAngle1.Radian());
|
||||
ang2Cos = (float)cos(mAngle2.Radian());
|
||||
ang1Cos = mRadial * (float)cos(mAngle1.Radian());
|
||||
float ang2Sin = sin(mAngle2.Radian());
|
||||
return cXyz(ang1Sin * ang2Sin, ang1Cos, ang1Sin * ang2Cos);
|
||||
}
|
||||
|
||||
@@ -308,7 +261,7 @@ cSGlobe::cSGlobe(const cXyz& xyz) {
|
||||
|
||||
// Formal__7cSGlobeFv
|
||||
cSGlobe& cSGlobe::Formal(void) {
|
||||
if (mRadius < lbl_8045522C) {
|
||||
if (mRadius < 0.0f) {
|
||||
mRadius = -mRadius;
|
||||
mAzimuth = -mAzimuth;
|
||||
mInclination.Val(mInclination.Inv());
|
||||
@@ -366,7 +319,7 @@ void cSGlobe::Polar(cSPolar* csp) const {
|
||||
|
||||
// Norm__7cSGlobeCFv
|
||||
cXyz cSGlobe::Norm(void) const {
|
||||
cSGlobe glob(/* 1.0 */ lbl_8045523C, mAzimuth, mInclination);
|
||||
cSGlobe glob(1.0f, mAzimuth, mInclination);
|
||||
return glob.Xyz();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user