|
@@ -1,42 +1,49 @@
|
|
|
#include "TPitchLineCircle.h"
|
|
|
-#include "memctrl.h"
|
|
|
+
|
|
|
#include <algorithm>
|
|
|
+
|
|
|
+#include "memctrl.h"
|
|
|
int TPitchLineCircle::s_eType;
|
|
|
|
|
|
-void Intersect(float a1,float a2,float a3,float a4,float &a5,float &a6)
|
|
|
-{
|
|
|
- LOGE("Intersect%x%x%x%x%x%x",a1,a2,a3,a4,a5,a6);
|
|
|
+void Intersect(float a1, float a2, float a3, float a4, float& a5, float& a6) {
|
|
|
+ LOGE("Intersect%x%x%x%x%x%x", a1, a2, a3, a4, a5, a6);
|
|
|
}
|
|
|
//-------------------------------------------------------------------------------------------------
|
|
|
-//001BE194 经过单元测试,功能正常
|
|
|
+// 001BE194 经过单元测试,功能正常
|
|
|
//^_^---
|
|
|
-//001BE1BA开始的三条指令的顺序不同
|
|
|
-//001BE1DE开始的三条指令的顺序不同
|
|
|
+// 001BE1BA开始的三条指令的顺序不同
|
|
|
+// 001BE1DE开始的三条指令的顺序不同
|
|
|
//寄存器不同
|
|
|
int LineCircleIntersection(CFTTVector32 cfttvector32_r0_begin,
|
|
|
- CFTTVector32 cfttvector32_r3_begin,
|
|
|
- float f_arg_8,
|
|
|
+ CFTTVector32 cfttvector32_r3_begin, float f_arg_8,
|
|
|
CFTTVector32 cfttvector32_arg_c_begin,
|
|
|
- float f_arg_18,
|
|
|
- float* p_f_arg_1c) {
|
|
|
- LOGE("%x%x%x",cfttvector32_r0_begin.float_0,cfttvector32_r0_begin.float_4,cfttvector32_r0_begin.float_8);
|
|
|
- LOGE("%x%x%x",cfttvector32_r3_begin.float_0,cfttvector32_r3_begin.float_4,cfttvector32_r3_begin.float_8);
|
|
|
- LOGE("%x%x%x",cfttvector32_arg_c_begin.float_0,cfttvector32_arg_c_begin.float_4,cfttvector32_arg_c_begin.float_8);
|
|
|
- LOGE("%f%f%f%x",f_arg_8,f_arg_18,*p_f_arg_1c,p_f_arg_1c);
|
|
|
+ float f_arg_18, float* p_f_arg_1c) {
|
|
|
+ LOGE("%x%x%x", cfttvector32_r0_begin.float_0, cfttvector32_r0_begin.float_4,
|
|
|
+ cfttvector32_r0_begin.float_8);
|
|
|
+ LOGE("%x%x%x", cfttvector32_r3_begin.float_0, cfttvector32_r3_begin.float_4,
|
|
|
+ cfttvector32_r3_begin.float_8);
|
|
|
+ LOGE("%x%x%x", cfttvector32_arg_c_begin.float_0,
|
|
|
+ cfttvector32_arg_c_begin.float_4, cfttvector32_arg_c_begin.float_8);
|
|
|
+ LOGE("%f%f%f%x", f_arg_8, f_arg_18, *p_f_arg_1c, p_f_arg_1c);
|
|
|
return rand();
|
|
|
}
|
|
|
//-------------------------------------------------------------------------------------------------
|
|
|
-//001BE690
|
|
|
+// 001BE690
|
|
|
// TPitchLineCircle::~TPitchLineCircle() {
|
|
|
// //delete this;
|
|
|
// }
|
|
|
//-------------------------------------------------------------------------------------------------
|
|
|
-//001BE184
|
|
|
-int TPitchLineCircle::GetType() {
|
|
|
- return TPitchLineCircle::s_eType;
|
|
|
-}
|
|
|
+// 001BE184
|
|
|
+int TPitchLineCircle::GetType() { return TPitchLineCircle::s_eType; }
|
|
|
//-------------------------------------------------------------------------------------------------
|
|
|
-//001BD85C
|
|
|
+// 001BD85C
|
|
|
+/**
|
|
|
+ * 它将一个圆圈夹在一条线上。
|
|
|
+ *
|
|
|
+ * @param cVec32_arg1 圆的向量
|
|
|
+ *
|
|
|
+ * @return 一条线和一个圆的交点。
|
|
|
+ */
|
|
|
void TPitchLineCircle::Clamp(CFTTVector32 cVec32_arg1) {
|
|
|
float s0 = -0.5f; // 001BD866
|
|
|
float s2 = 0.5f; // 001BD86C
|
|
@@ -46,7 +53,8 @@ void TPitchLineCircle::Clamp(CFTTVector32 cVec32_arg1) {
|
|
|
float s16 = s4 * s2; // 001BD88C
|
|
|
s0 = s6 * s0; // 001BD890
|
|
|
s2 = s6 * s2; // 001BD894
|
|
|
- float s8, s10, s12, s17, s19, s20, s21, s22, s23, s24, s25, s26, s27, s28, s29, s30;
|
|
|
+ float s8, s10, s12, s17, s19, s20, s21, s22, s23, s24, s25, s26, s27, s28,
|
|
|
+ s29, s30;
|
|
|
int i_sp_20;
|
|
|
int i_sp_24 = 0; // 001BD8EC
|
|
|
uint8 i_sp_28 = 0; // 001BD8F0
|
|
@@ -69,8 +77,8 @@ void TPitchLineCircle::Clamp(CFTTVector32 cVec32_arg1) {
|
|
|
cVec32_sp_80[0].float_8 = s0; // 001BD89C 88
|
|
|
|
|
|
cVec32_sp_80[1].float_0 = s16; // 001BD8A0 8C
|
|
|
- cVec32_sp_80[1].float_4 = 0; // 001BD876 90
|
|
|
- cVec32_sp_80[1].float_8 = s0; // 001BD8A4 94
|
|
|
+ cVec32_sp_80[1].float_4 = 0; // 001BD876 90
|
|
|
+ cVec32_sp_80[1].float_8 = s0; // 001BD8A4 94
|
|
|
|
|
|
cVec32_sp_80[2].float_0 = s16; // 001BD8A8 98
|
|
|
cVec32_sp_80[2].float_4 = 0; // 001BD87C 9C
|
|
@@ -118,22 +126,27 @@ void TPitchLineCircle::Clamp(CFTTVector32 cVec32_arg1) {
|
|
|
float f_r6 = this->vec32_4.float_0;
|
|
|
float f_r10 = this->vec32_4.float_4;
|
|
|
float f_r11 = this->vec32_4.float_8;
|
|
|
- s27 = f_r10; // 001BD97A
|
|
|
- s29 = f_r11; // 001BD97E
|
|
|
- s0 = s25 - s27; // 001BD982
|
|
|
- s25 = f_r6; // 001BD986 VMOV S25, R6 ; vec32_4.float_0
|
|
|
- s4 = s24 - s25; // 001BD98A VSUB.F32 S4, S24, S25
|
|
|
- s24 = this->field_14; // 001BD98E VLDR S24, [R0,#0x92+var_80+2] ; this->field_14
|
|
|
- s2 = s0 * s0; // 001BD992 VMUL.F32 S2, S0, S0
|
|
|
- s0 = s26 - s29; // 001BD996 VSUB.F32 S0, S26, S29
|
|
|
- s26 = this->field_10; // 001BD99A VLDR S26, [R0,#0x92+var_84+2] ; this->field_10
|
|
|
- s2 = s2 + s4 * s4; // 001BD99E VMLA.F32 S2, S4, S4
|
|
|
- s2 = s2 + s0 * s0; // 001BD9A2 VMLA.F32 S2, S0, S0
|
|
|
- s0 = sqrtf(s2); // 001BD9B8
|
|
|
+ s27 = f_r10; // 001BD97A
|
|
|
+ s29 = f_r11; // 001BD97E
|
|
|
+ s0 = s25 - s27; // 001BD982
|
|
|
+ s25 = f_r6; // 001BD986 VMOV S25, R6 ;
|
|
|
+ // vec32_4.float_0
|
|
|
+ s4 = s24 - s25; // 001BD98A VSUB.F32 S4, S24, S25
|
|
|
+ s24 = this->field_14; // 001BD98E VLDR S24,
|
|
|
+ // [R0,#0x92+var_80+2] ; this->field_14
|
|
|
+ s2 = s0 * s0; // 001BD992 VMUL.F32 S2, S0, S0
|
|
|
+ s0 = s26 - s29; // 001BD996 VSUB.F32 S0, S26, S29
|
|
|
+ s26 = this->field_10; // 001BD99A VLDR S26,
|
|
|
+ // [R0,#0x92+var_84+2] ; this->field_10
|
|
|
+ s2 = s2 + s4 * s4; // 001BD99E VMLA.F32 S2, S4, S4
|
|
|
+ s2 = s2 + s0 * s0; // 001BD9A2 VMLA.F32 S2, S0, S0
|
|
|
+ s0 = sqrtf(s2); // 001BD9B8
|
|
|
|
|
|
s2 = s23 - s27; // 001BD9C0 VSUB.F32 S2, S23, S27
|
|
|
- // cVec32_sp_60.float_0 = s0; //001BD9C4 VSTR S0, [SP,#0xF0+var_92_vec32_94+2] ; sp+0x60,
|
|
|
- f_sp_60[0] = s0; // 001BD9C4 VSTR S0, [SP,#0xF0+var_92_vec32_94+2] ; sp+0x60,
|
|
|
+ // cVec32_sp_60.float_0 = s0; //001BD9C4 VSTR S0,
|
|
|
+ // [SP,#0xF0+var_92_vec32_94+2] ; sp+0x60,
|
|
|
+ f_sp_60[0] = s0; // 001BD9C4 VSTR S0,
|
|
|
+ // [SP,#0xF0+var_92_vec32_94+2] ; sp+0x60,
|
|
|
s4 = s19 - s25; // 001BD9C8 VSUB.F32 S4, S19, S25
|
|
|
s6 = s21 - s29; // 001BD9CC VSUB.F32 S6, S21, S29
|
|
|
s2 = s2 * s2; // 001BD9D0 VMUL.F32 S2, S2, S2
|
|
@@ -141,8 +154,10 @@ void TPitchLineCircle::Clamp(CFTTVector32 cVec32_arg1) {
|
|
|
s2 = s2 + s6 * s6; // 001BD9D8 VMLA.F32 S2, S6, S6
|
|
|
s4 = sqrtf(s2); // 001BD9EE
|
|
|
s0 = s17 / s22; // 001BD9F6 VDIV.F32 S0, S17, S22
|
|
|
- // cVec32_sp_60.float_4 = s4; //001BD9FE VSTR S4, [SP,#0xF0+var_92_vec32_94+6] ; sp+0x64
|
|
|
- f_sp_60[1] = s4; // 001BD9FE VSTR S4, [SP,#0xF0+var_92_vec32_94+6] ; sp+0x64
|
|
|
+ // cVec32_sp_60.float_4 = s4; //001BD9FE VSTR S4,
|
|
|
+ // [SP,#0xF0+var_92_vec32_94+6] ; sp+0x64
|
|
|
+ f_sp_60[1] = s4; // 001BD9FE VSTR S4,
|
|
|
+ // [SP,#0xF0+var_92_vec32_94+6] ; sp+0x64
|
|
|
|
|
|
int i_r0 = 0; // 001BD9FC
|
|
|
while (i_r0 != 2) {
|
|
@@ -155,10 +170,12 @@ void TPitchLineCircle::Clamp(CFTTVector32 cVec32_arg1) {
|
|
|
i_r0++; // 001BDA26
|
|
|
}
|
|
|
|
|
|
- s2 = s30 / s22; // 001BDA2C VDIV.F32 S2, S30, S22
|
|
|
- uint c_r2 = c_sp_5E[0]; // 001BDA30 LDRB.W R2, [SP,#0xF0+var_92_vec32_94] ; sp_5E
|
|
|
- uint c_r0 = c_sp_5E[1]; // 001BDA34 LDRB.W R0, [SP,#0xF0+var_92_vec32_94+1] ; sp_5F
|
|
|
- s4 = s28 / s22; // 001BDA3A VDIV.F32 S4, S28, S22
|
|
|
+ s2 = s30 / s22; // 001BDA2C VDIV.F32 S2, S30, S22
|
|
|
+ uint c_r2 = c_sp_5E[0]; // 001BDA30 LDRB.W R2,
|
|
|
+ // [SP,#0xF0+var_92_vec32_94] ; sp_5E
|
|
|
+ uint c_r0 = c_sp_5E[1]; // 001BDA34 LDRB.W R0,
|
|
|
+ // [SP,#0xF0+var_92_vec32_94+1] ; sp_5F
|
|
|
+ s4 = s28 / s22; // 001BDA3A VDIV.F32 S4, S28, S22
|
|
|
uint c_r1;
|
|
|
|
|
|
if (c_r2 > c_r0) {
|
|
@@ -176,9 +193,9 @@ void TPitchLineCircle::Clamp(CFTTVector32 cVec32_arg1) {
|
|
|
cVec32_sp_68.float_0 = d17_0; // 001BDA60
|
|
|
cVec32_sp_68.float_4 = d17_4;
|
|
|
cVec32_sp_74.float_8 = f_sp_50[0]; // 001BDA64
|
|
|
- c_r1 = c_sp_5E[0]; // 001BDA66
|
|
|
- c_sp_5E[0] = c_r0 /*c_r0_sp_5F*/; // 001BDA68
|
|
|
- f_sp_48[0] = d16_0; // 001BDA6C
|
|
|
+ c_r1 = c_sp_5E[0]; // 001BDA66
|
|
|
+ c_sp_5E[0] = c_r0 /*c_r0_sp_5F*/; // 001BDA68
|
|
|
+ f_sp_48[0] = d16_0; // 001BDA6C
|
|
|
f_sp_48[1] = d16_4;
|
|
|
cVec32_sp_74.float_0 = d16_0; // 001BDA70
|
|
|
cVec32_sp_74.float_4 = d16_4;
|
|
@@ -204,7 +221,10 @@ void TPitchLineCircle::Clamp(CFTTVector32 cVec32_arg1) {
|
|
|
r0_v38 = 4;
|
|
|
} else {
|
|
|
// 001BDAC0
|
|
|
- r0_v38 = (c_r0 == 2 && c_r1 == 2) ? 5 : -1;
|
|
|
+ if ((c_r0 ^ 2) | (c_r1 ^ 2)) {
|
|
|
+ r0_v38 = -1;
|
|
|
+ } else
|
|
|
+ r0_v38 = 5;
|
|
|
}
|
|
|
} else {
|
|
|
// 001BDA9E
|
|
@@ -218,21 +238,24 @@ void TPitchLineCircle::Clamp(CFTTVector32 cVec32_arg1) {
|
|
|
vec_2.float_0 = LR;
|
|
|
vec_2.float_4 = s0;
|
|
|
vec_2.float_8 = s2;
|
|
|
- i_sp_30 = LineCircleIntersection(cVec32_sp_68, vec_2, s22, this->vec32_4, s26, &f_sp_48[0]);
|
|
|
- f_sp_44 = LR; // 001BDB06
|
|
|
- // 001BDB2E
|
|
|
- vec_2.float_0 = f_sp_44;
|
|
|
- vec_2.float_4 = s0;
|
|
|
- vec_2.float_8 = s2;
|
|
|
- int ret_r0 = LineCircleIntersection(cVec32_sp_68, vec_2, s22, this->vec32_4, s24, &f_sp_50[0]);
|
|
|
+ i_sp_30 = LineCircleIntersection(cVec32_sp_68, vec_2, s22, this->vec32_4,
|
|
|
+ s26, &f_sp_48[0]);
|
|
|
+ // f_sp_44 = LR; // 001BDB06
|
|
|
+ // 001BDB2E
|
|
|
+ // vec_2.float_0 = f_sp_44;
|
|
|
+ // vec_2.float_4 = s0;
|
|
|
+ // vec_2.float_8 = s2;
|
|
|
+ int ret_r0 = LineCircleIntersection(cVec32_sp_68, vec_2, s22, this->vec32_4,
|
|
|
+ s24, &f_sp_50[0]);
|
|
|
|
|
|
- if ((-3 + (uchar)r0_v38 )>= 2) {
|
|
|
+ if (((uint)(-3 + (uchar)r0_v38)) >= 2) {
|
|
|
// 001BDB48
|
|
|
if (((uchar)r0_v38) == 5) {
|
|
|
// 001BDB52
|
|
|
if ((i_sp_30 != 2) && (ret_r0 != 2)) {
|
|
|
// if (ret_r0 != 2) {
|
|
|
- i_sp_24 = i_sp_24 + (((ret_r0 ^ 2) | i_sp_30) != 0);
|
|
|
+ if (((ret_r0 ^ 2) | i_sp_30) != 0) i_sp_24 = i_sp_24 + 1;
|
|
|
+
|
|
|
/*if ((ret_r0 ^ 2) | ret_sp_30 ) {
|
|
|
i_sp_24 += 1;
|
|
|
}*/
|
|
@@ -240,7 +263,7 @@ void TPitchLineCircle::Clamp(CFTTVector32 cVec32_arg1) {
|
|
|
}
|
|
|
} else {
|
|
|
// 001BDB6E
|
|
|
- i_sp_28 = (r0_v38 /*i_sp_3C*/ << 0x18) == 0 ? i_sp_28+1 : i_sp_28;
|
|
|
+ i_sp_28 = (r0_v38 /*i_sp_3C*/ << 0x18) == 0 ? i_sp_28 + 1 : i_sp_28;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -248,26 +271,30 @@ void TPitchLineCircle::Clamp(CFTTVector32 cVec32_arg1) {
|
|
|
// 001BDB80
|
|
|
int r1_v45 = s18 <= s20 ? 1 : 0;
|
|
|
int r2_v46 = s20 <= s16 ? 1 : 0;
|
|
|
- // int i_r3 = (uint32)((uint8)i_sp_24) != 4 ? 1 : -4 + (uint32)((uint8)i_sp_24);
|
|
|
+ // int i_r3 = (uint32)((uint8)i_sp_24) != 4 ? 1 : -4 +
|
|
|
+ // (uint32)((uint8)i_sp_24);
|
|
|
uint8 i_r3 = i_sp_24 != 4 ? 1 : -4 + (uchar)i_sp_24;
|
|
|
// if ((uint32)((uint8)i_sp_28) != 4) {
|
|
|
if ((uchar)i_sp_28 != 4) { // 001BDBB8
|
|
|
r1_v45 &= r2_v46;
|
|
|
r1_v45 &= i_sp_20;
|
|
|
- if ((r1_v45 | i_r3)==0) {
|
|
|
+ if ((r1_v45 | i_r3) == 0) {
|
|
|
this->f_1C = 0;
|
|
|
- return ;
|
|
|
+ return;
|
|
|
}
|
|
|
} else {
|
|
|
- if (r1_v45 | i_r3) {
|
|
|
+ // if (r1_v45 | i_r3) {
|
|
|
+ // this->f_1C = 0;
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
this->f_1C = 0;
|
|
|
- return ;
|
|
|
- }
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
if (r1_v45 == 0) {
|
|
|
// 001BDBD4
|
|
|
- s18 = atan2f(((int)this->vec32_4.float_8) ^ 0x80000000, ((int)this->vec32_4.float_0) ^ 0x80000000);
|
|
|
+ s18 = atan2f(-(this->vec32_4.float_8) ,
|
|
|
+ -(this->vec32_4.float_0) );
|
|
|
s16 = 6.28318548f; // 001BDBEA
|
|
|
s20 = s18 + s16; // 001BDBF2
|
|
|
|
|
@@ -282,7 +309,7 @@ void TPitchLineCircle::Clamp(CFTTVector32 cVec32_arg1) {
|
|
|
s2 = s4 - s2;
|
|
|
// 001BDC20
|
|
|
s0 = atan2f(s2, s0);
|
|
|
- ptrR6_sp68[i_r5] = s0 < 0.0f ? s0+s16 : s0 ;
|
|
|
+ ptrR6_sp68[i_r5] = s0 < 0.0f ? s0 + s16 : s0;
|
|
|
}
|
|
|
s0 = -6.28318548f; // 001BDC4C
|
|
|
int i_r0 = 0;
|
|
@@ -306,6 +333,11 @@ void TPitchLineCircle::Clamp(CFTTVector32 cVec32_arg1) {
|
|
|
s2 = s8;
|
|
|
}
|
|
|
ptrR6_sp68[i_r0] = s2; // 001BDCB0
|
|
|
+ }else{
|
|
|
+ if (s6 < s4) {
|
|
|
+ s2 = s8;
|
|
|
+ }
|
|
|
+ ptrR6_sp68[i_r0] = s2; // 001BDCB0
|
|
|
}
|
|
|
i_r0++;
|
|
|
}
|
|
@@ -332,31 +364,25 @@ void TPitchLineCircle::Clamp(CFTTVector32 cVec32_arg1) {
|
|
|
}
|
|
|
}
|
|
|
//-------------------------------------------------------------------------------------------------
|
|
|
-//001BE378
|
|
|
-bool TPitchLineCircle::Identical(TPitchLineGen*) {
|
|
|
- return false;
|
|
|
-}
|
|
|
+// 001BE378
|
|
|
+bool TPitchLineCircle::Identical(TPitchLineGen*) { return false; }
|
|
|
//-------------------------------------------------------------------------------------------------
|
|
|
-//001BE490
|
|
|
-void TPitchLineCircle::Render() {
|
|
|
-}
|
|
|
+// 001BE490
|
|
|
+void TPitchLineCircle::Render() {}
|
|
|
//-------------------------------------------------------------------------------------------------
|
|
|
-//001BDDE0
|
|
|
-void TPitchLineCircle::Transform(uchar) {
|
|
|
-}
|
|
|
+// 001BDDE0
|
|
|
+void TPitchLineCircle::Transform(uchar) {}
|
|
|
//-------------------------------------------------------------------------------------------------
|
|
|
-//001BD846 //^_^
|
|
|
+// 001BD846 //^_^
|
|
|
void TPitchLineCircle::Translate(CFTTVector32 vec32) {
|
|
|
CFTTVector32 vec32_14 = vec32;
|
|
|
vec32_4 -= vec32_14;
|
|
|
}
|
|
|
//-------------------------------------------------------------------------------------------------
|
|
|
-//001BDD48 //^_^
|
|
|
-bool TPitchLineCircle::Valid() {
|
|
|
- return f_1C != 0.0;
|
|
|
-}
|
|
|
+// 001BDD48 //^_^
|
|
|
+bool TPitchLineCircle::Valid() { return f_1C != 0.0; }
|
|
|
//-------------------------------------------------------------------------------------------------
|
|
|
-//001BE650
|
|
|
+// 001BE650
|
|
|
TPitchLineGen* TPitchLineCircle::Clone() {
|
|
|
TPitchLineCircle* pCircle = new TPitchLineCircle;
|
|
|
|