//
// EditorUI::createUndoObject from 0x1401b37e0 to 0x1401b39b4 (468 bytes)
//
// 12 xrefs:
// > EditorUI::startFreeMoveTouch @ 0x1401bfd5f
// > EditorUI::handleEditorAction @ 0x1401c3bce
// > EditorUI::handleEditorAction @ 0x1401c3dac
// > EditorUI::handleEditorAction @ 0x1401c3fa2
// > EditorUI::moveObjectCall_1 @ 0x1401fec45
// > EditorUI::transformObjectCall_1 @ 0x1401ff407
// > EditorUI::alignObjectsOnAxis @ 0x140201641
// > EditorUI::alignObjects @ 0x140201acb
// > EditorUI::angleChangeBegin @ 0x14020279a
// > EditorUI::scaleChangeBegin @ 0x140202fea
// > EditorUI::transformChangeBegin @ 0x1402038ca
// > ??> @ 0x14091a048
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:27:56 +0000
//
// Hidden C++ exception states: #wind=4
cocos2d::CCArray **__fastcall EditorUI::createUndoObject(__int64 a1, __int64 a2, char a3)
{
cocos2d::CCArray *v5; // rbp
cocos2d::CCArray **v6; // rbx
unsigned int v7; // edi
__int64 v8; // rcx
struct cocos2d::CCObject *v9; // rax
struct cocos2d::CCObject *v10; // rax
cocos2d::CCObject *v11; // rcx
__int64 v12; // rbp
__int64 v13; // rax
__int64 TransformState; // rax
__int64 v15; // rsi
unsigned int v16; // edi
if ( cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 944)) )
{
v5 = *(cocos2d::CCArray **)(a1 + 944);
v6 = (cocos2d::CCArray **)operator new(0xA0u);
cocos2d::CCObject::CCObject((cocos2d::CCObject *)v6);
*v6 = (cocos2d::CCArray *)&UndoObject::`vftable';
v7 = 0;
v6[7] = nullptr;
*((_DWORD *)v6 + 16) = 0;
v6[9] = nullptr;
*((_WORD *)v6 + 40) = 0;
GJTransformState::GJTransformState((__int64)v6 + 84);
v6[9] = (cocos2d::CCArray *)cocos2d::CCArray::create(v8);
if ( cocos2d::CCArray::count(v5) )
{
do
{
v9 = cocos2d::CCArray::objectAtIndex(v5, v7);
v10 = (struct cocos2d::CCObject *)GameObjectCopy::create(v9);
cocos2d::CCArray::addObject(v6[9], v10);
++v7;
}
while ( v7 < cocos2d::CCArray::count(v5) );
}
v11 = v6[9];
}
else
{
v12 = *(_QWORD *)(a1 + 1568);
v6 = (cocos2d::CCArray **)operator new(0xA0u);
cocos2d::CCObject::CCObject((cocos2d::CCObject *)v6);
*v6 = (cocos2d::CCArray *)&UndoObject::`vftable';
v6[7] = nullptr;
*((_DWORD *)v6 + 16) = 0;
v6[9] = nullptr;
*((_WORD *)v6 + 40) = 0;
GJTransformState::GJTransformState((__int64)v6 + 84);
if ( !v12 )
goto LABEL_8;
v13 = GameObjectCopy::create(v12);
v6[7] = (cocos2d::CCArray *)v13;
v11 = (cocos2d::CCObject *)v13;
}
cocos2d::CCObject::retain(v11);
LABEL_8:
*((_DWORD *)v6 + 16) = 5;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v6);
if ( (*(unsigned __int8 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 840) + 344LL))(*(_QWORD *)(a1 + 840)) )
{
TransformState = EditorUI::getTransformState(a1);
sub_1401B39C0((char *)v6 + 84, TransformState);
*((_BYTE *)v6 + 81) = 1;
}
if ( !a3 )
{
v15 = *(_QWORD *)(a1 + 1512);
cocos2d::CCArray::removeAllObjects(*(cocos2d::CCArray **)(v15 + 14920));
v16 = 1000;
if ( !*(_BYTE *)(v15 + 14663) )
v16 = 200;
if ( cocos2d::CCArray::count(*(cocos2d::CCArray **)(v15 + 14912)) >= v16 )
cocos2d::CCArray::removeObjectAtIndex(*(cocos2d::CCArray **)(v15 + 14912), 0, 1);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(v15 + 14912), (struct cocos2d::CCObject *)v6);
}
return v6;
}