7
7
8
8
#if WINDOWS_MODE || LINUX_MODE
9
9
#include < format>
10
+ #include < numbers>
10
11
#include < ranges>
11
12
#include < regex>
12
13
#endif
@@ -571,7 +572,7 @@ class UnityResolve final {
571
572
[](void * ptr, std::vector<Assembly*>& v) {
572
573
if (ptr == nullptr ) return ;
573
574
574
- Assembly* assembly = new Assembly{ .address = ptr };
575
+ auto assembly = new Assembly{ .address = ptr };
575
576
void * image;
576
577
try {
577
578
image = Invoke<void *>(" mono_assembly_get_image" , ptr);
@@ -852,7 +853,7 @@ class UnityResolve final {
852
853
}
853
854
854
855
auto ToVectors (Vector3* m_pForward, Vector3* m_pRight, Vector3* m_pUp) const -> void {
855
- constexpr auto m_fDeg2Rad = static_cast <float >( 3.1415926 ) / 180 .F ;
856
+ constexpr auto m_fDeg2Rad = std::numbers::pi_v <float > / 180 .F ;
856
857
857
858
const auto m_fSinX = sinf (x * m_fDeg2Rad);
858
859
const auto m_fCosX = cosf (x * m_fDeg2Rad);
@@ -1107,7 +1108,7 @@ class UnityResolve final {
1107
1108
}
1108
1109
1109
1110
auto Euler (float m_fX, float m_fY, float m_fZ) -> Quaternion {
1110
- constexpr auto m_fDeg2Rad = static_cast <float >( 3.1415926 ) / 180 .F ;
1111
+ constexpr auto m_fDeg2Rad = std::numbers::pi_v <float > / 180 .F ;
1111
1112
1112
1113
m_fX = m_fX * m_fDeg2Rad * 0 .5F ;
1113
1114
m_fY = m_fY * m_fDeg2Rad * 0 .5F ;
@@ -1138,12 +1139,12 @@ class UnityResolve final {
1138
1139
const auto m_fDist = (x * x) + (y * y) + (z * z) + (w * w);
1139
1140
1140
1141
if (const auto m_fTest = x * w - y * z; m_fTest > 0 .4995F * m_fDist) {
1141
- m_vEuler.x = static_cast <float >( 3.1415926 ) * 0 .5F ;
1142
+ m_vEuler.x = std::numbers::pi_v <float > * 0 .5F ;
1142
1143
m_vEuler.y = 2 .F * atan2f (y, x);
1143
1144
m_vEuler.z = 0 .F ;
1144
1145
}
1145
1146
else if (m_fTest < -0 .4995F * m_fDist) {
1146
- m_vEuler.x = static_cast <float >( 3.1415926 ) * -0 .5F ;
1147
+ m_vEuler.x = std::numbers::pi_v <float > * -0 .5F ;
1147
1148
m_vEuler.y = -2 .F * atan2f (y, x);
1148
1149
m_vEuler.z = 0 .F ;
1149
1150
}
@@ -1153,7 +1154,7 @@ class UnityResolve final {
1153
1154
m_vEuler.z = atan2f (2 .F * w * z + 2 .F * x * y, 1 .F - 2 .F * (z * z + x * x));
1154
1155
}
1155
1156
1156
- constexpr auto m_fRad2Deg = 180 .F / static_cast <float >( 3.1415926 ) ;
1157
+ constexpr auto m_fRad2Deg = 180 .F / std::numbers::pi_v <float >;
1157
1158
m_vEuler.x *= m_fRad2Deg;
1158
1159
m_vEuler.y *= m_fRad2Deg;
1159
1160
m_vEuler.z *= m_fRad2Deg;
@@ -1808,7 +1809,7 @@ class UnityResolve final {
1808
1809
}*bounds{ nullptr };
1809
1810
1810
1811
std::uintptr_t max_length{ 0 };
1811
- __declspec (align( 8 )) T** vector {};
1812
+ T** vector {};
1812
1813
1813
1814
auto GetData () -> uintptr_t { return reinterpret_cast <uintptr_t >(&vector); }
1814
1815
@@ -2261,22 +2262,17 @@ class UnityResolve final {
2261
2262
auto GetPosition () -> Vector3 {
2262
2263
static Method* method;
2263
2264
2264
- if (!method) method = Get (" UnityEngine.CoreModule.dll" )->Get (" Transform" )->Get <Method>(mode_ == Mode::Mono ? " get_position_Injected" : " get_position" );
2265
- if (mode_ == Mode::Mono && method) {
2266
- const Vector3 vec3{};
2267
- method->Invoke <void >(this , &vec3);
2268
- return vec3;
2269
- }
2270
- if (method) return method->Invoke <Vector3>(this );
2271
- return {};
2265
+ if (!method) method = Get (" UnityEngine.CoreModule.dll" )->Get (" Transform" )->Get <Method>(" get_position_Injected" );
2266
+ const Vector3 vec3{};
2267
+ method->Invoke <void >(this , &vec3);
2268
+ return vec3;
2272
2269
}
2273
2270
2274
2271
auto SetPosition (const Vector3& position) -> void {
2275
2272
static Method* method;
2276
2273
2277
- if (!method) method = Get (" UnityEngine.CoreModule.dll" )->Get (" Transform" )->Get <Method>(mode_ == Mode::Mono ? " set_position_Injected" : " set_position" );
2278
- if (mode_ == Mode::Mono && method) return method->Invoke <void >(this , &position);
2279
- if (method) return method->Invoke <void >(this , position);
2274
+ if (!method) method = Get (" UnityEngine.CoreModule.dll" )->Get (" Transform" )->Get <Method>(" set_position_Injected" );
2275
+ return method->Invoke <void >(this , &position);
2280
2276
}
2281
2277
2282
2278
auto GetRight () -> Vector3 {
@@ -2390,14 +2386,10 @@ class UnityResolve final {
2390
2386
auto GetLocalScale () -> Vector3 {
2391
2387
static Method* method;
2392
2388
2393
- if (!method) method = Get (" UnityEngine.CoreModule.dll" )->Get (" Transform" )->Get <Method>(mode_ == Mode::Mono ? " get_localScale_Injected" : " get_localScale" );
2394
- if (mode_ == Mode::Mono && method) {
2395
- const Vector3 vec3{};
2396
- method->Invoke <void >(this , &vec3);
2397
- return vec3;
2398
- }
2399
- if (method) return method->Invoke <Vector3>(this );
2400
- return {};
2389
+ if (!method) method = Get (" UnityEngine.CoreModule.dll" )->Get (" Transform" )->Get <Method>(" get_localScale_Injected" );
2390
+ const Vector3 vec3{};
2391
+ method->Invoke <void >(this , &vec3);
2392
+ return vec3;
2401
2393
}
2402
2394
2403
2395
auto SetLocalScale (const Vector3& position) -> void {
0 commit comments