//
// EditorUI::getGridSnappedPos from 0x100035690 to 0x100035759 (201 bytes)
//
// 3 xrefs:
// > EditorUI::ccTouchMoved @ 0x10004f8c4
// > EditorUI::ccTouchEnded @ 0x10004fcaf
// > SetupSmartBlockLayer::onPasteTemplate @ 0x1004e7068
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
cocos2d::CCPoint __fastcall EditorUI::getGridSnappedPos(EditorUI *a1, cocos2d::CCPoint a2)
{
double v2; // rax
unsigned int *v3; // rdx
__int64 v4; // rsi
float v5; // xmm2_4
__m128 v6; // xmm0
__m128 v7; // xmm1
__m128 v8; // xmm0
double v10[4]; // [rsp+0h] [rbp-20h] BYREF
cocos2d::CCPoint result; // 0:xmm0_8.8
v10[0] = v2;
v5 = *(float *)(*(_QWORD *)(*(_QWORD *)(v4 + 1256) + 13976LL) + 604LL);
v6 = (__m128)*v3;
v7 = (__m128)v3[1];
v6.f32[0] = v6.f32[0] / v5;
v7.f32[0] = v7.f32[0] / v5;
sub_10028CBE0(
v10,
(float)(_mm_round_ss(v6, v6, 9).f32[0] + 0.5) * v5,
(float)(_mm_round_ss(v7, v7, 9).f32[0] + 0.5) * v5);
if ( *(_BYTE *)(*(_QWORD *)(*(_QWORD *)(v4 + 1256) + 3248LL) + 453LL) )
v8 = (__m128)0x46EB1400u;
else
v8 = (__m128)0x451BA000u;
_mm_storel_ps(
v10,
_mm_min_ps(
_mm_max_ps((__m128)*(unsigned __int64 *)&v10[0], (__m128)xmmword_100815470),
_mm_insert_ps((__m128)xmmword_100815490, v8, 16)));
*(double *)&result = sub_10028CC60(a1, v10);
return result;
}