//
// EditorUI::createUndoObject from 0x140110f30 to 0x1401111b3 (643 bytes)
//
// 8 xrefs:
// > EditorUI::scaleChangeBegin @ 0x140114f5a
// > EditorUI::transformChangeBegin @ 0x1401158fa
// > EditorUI::moveObjectCall_1 @ 0x14011fa91
// > EditorUI::transformObjectCall_1 @ 0x140120220
// > EditorUI::alignObjects @ 0x14012222b
// > EditorUI::angleChangeBegin @ 0x14012311a
// > EditorUI::ccTouchBegan @ 0x140123cdb
// > ??> @ 0x1406c8f28
//
// 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
//
// Hidden C++ exception states: #wind=4
UndoObject *EditorUI::createUndoObject(EditorUI *a1, UndoCommand a2, bool a3)
{
cocos2d::CCArray *m_selectedObjects; // rsi
UndoObject *v6; // rdi
unsigned int v7; // ebx
__int64 v8; // rcx
GameObject *v9; // rax
GameObjectCopy *v10; // rax
cocos2d::CCObject *m_objects; // rcx
GameObject *m_selectedObject; // rsi
GameObjectCopy *v13; // rax
GJTransformControl *m_transformControl; // rbx
__int64 v15; // rax
struct cocos2d::CCObject *v16; // rax
__int64 v17; // rax
struct cocos2d::CCObject *v18; // rax
__int64 v19; // rax
LevelEditorLayer *m_editorLayer; // rsi
unsigned int v21; // ebx
if ( cocos2d::CCArray::count(a1->m_selectedObjects) )
{
m_selectedObjects = a1->m_selectedObjects;
v6 = (UndoObject *)operator new(0xA0u);
cocos2d::CCObject::CCObject(v6);
v6->__vftable = (UndoObject_vtbl *)&UndoObject::`vftable';
v7 = 0;
v6->m_objectCopy = nullptr;
v6->m_command = 0;
v6->m_objects = nullptr;
*(_WORD *)&v6->m_redo = 0;
sub_1400DE960((__int64)&v6->m_transformState);
v6->m_objects = (cocos2d::CCArray *)cocos2d::CCArray::create(v8);
if ( cocos2d::CCArray::count(m_selectedObjects) )
{
do
{
v9 = (GameObject *)cocos2d::CCArray::objectAtIndex(m_selectedObjects, v7);
v10 = GameObjectCopy::create(v9);
cocos2d::CCArray::addObject(v6->m_objects, v10);
++v7;
}
while ( v7 < cocos2d::CCArray::count(m_selectedObjects) );
}
m_objects = v6->m_objects;
}
else
{
m_selectedObject = a1->m_selectedObject;
v6 = (UndoObject *)operator new(0xA0u);
cocos2d::CCObject::CCObject(v6);
v6->__vftable = (UndoObject_vtbl *)&UndoObject::`vftable';
v6->m_objectCopy = nullptr;
v6->m_command = 0;
v6->m_objects = nullptr;
*(_WORD *)&v6->m_redo = 0;
sub_1400DE960((__int64)&v6->m_transformState);
if ( !m_selectedObject )
goto LABEL_8;
v13 = GameObjectCopy::create(m_selectedObject);
v6->m_objectCopy = v13;
m_objects = v13;
}
cocos2d::CCObject::retain(m_objects);
LABEL_8:
v6->m_command = Transform;
cocos2d::CCObject::autorelease(v6);
if ( a1->m_transformControl->isVisible(a1->m_transformControl) )
{
m_transformControl = a1->m_transformControl;
a1->m_transformState.m_transformRotationX = m_transformControl->m_rotationX;
a1->m_transformState.m_transformRotationY = m_transformControl->m_rotationY;
a1->m_transformState.m_transformScaleX = m_transformControl->m_scaleX;
a1->m_transformState.m_transformScaleY = m_transformControl->m_scaleY;
v15 = (__int64)m_transformControl->getPosition_0(m_transformControl);
cocos2d::CCPoint::operator=(&a1->m_transformState.m_transformPosition, v15);
v16 = cocos2d::CCArray::objectAtIndex(m_transformControl->m_warpSprites, 9u);
v17 = ((__int64 (__fastcall *)(struct cocos2d::CCObject *))v16->__vftable[2].getTag)(v16);
cocos2d::CCPoint::operator=(&a1->m_transformState.m_transformSkewX, v17);
v18 = cocos2d::CCArray::objectAtIndex(m_transformControl->m_warpSprites, 0xAu);
v19 = ((__int64 (__fastcall *)(struct cocos2d::CCObject *))v18->__vftable[2].getTag)(v18);
cocos2d::CCPoint::operator=(&a1->m_transformState.m_transformSkewY, v19);
sub_1401111C0(&v6->m_transformState, &a1->m_transformState);
v6->m_undoTransform = 1;
}
if ( !a3 )
{
m_editorLayer = a1->m_editorLayer;
cocos2d::CCArray::removeAllObjects(m_editorLayer->m_redoObjects);
v21 = 1000;
if ( !m_editorLayer->m_increaseMaxUndoRedo )
v21 = 200;
if ( cocos2d::CCArray::count(m_editorLayer->m_undoObjects) >= v21 )
cocos2d::CCArray::removeObjectAtIndex(m_editorLayer->m_undoObjects, 0, 1);
cocos2d::CCArray::addObject(m_editorLayer->m_undoObjects, v6);
}
return v6;
}