{"type": "func", "start": 5369402304, "end": 5369402694, "name": "CustomizeObjectLayer::getActiveMode", "pseudocode": "// \n// CustomizeObjectLayer::getActiveMode from 0x1400a93c0 to 0x1400a9546 (390 bytes)\n// \n// 11 xrefs:\n// > CustomizeObjectLayer::onLiveEdit @ 0x1400a7f29\n// > CustomizeObjectLayer::onPaste @ 0x1400a8153\n// > CustomizeObjectLayer::onEditColor @ 0x1400a848f\n// > CustomizeObjectLayer::updateColorSprite @ 0x1400a8558\n// > CustomizeObjectLayer::onSelectMode @ 0x1400a918e\n// > CustomizeObjectLayer::toggleVisible @ 0x1400a935e\n// > CustomizeObjectLayer::updateCurrentSelection @ 0x1400a955b\n// > CustomizeObjectLayer::onSelectColor @ 0x1400a9d04\n// > <???> @ 0x14066ab24\n// > <???> @ 0x14066ab34\n// > <???> @ 0x1406c7818\n// \n// This function is hookable on this platform!\n// \n// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings\n// \n\nint CustomizeObjectLayer::getActiveMode(CustomizeObjectLayer *a1, bool a2)\n{\n  GameObject *m_targetObject; // rcx\n  GJSpriteColor *RelativeSpriteColor; // rax\n  int m_defaultColorID; // ecx\n  int result; // eax\n  bool v8; // bp\n  int v9; // ebx\n  unsigned int v10; // esi\n  struct cocos2d::CCObject *v11; // rcx\n  __int16 m_unknown2; // ax\n  bool v13; // al\n  int v14; // edx\n  bool v15; // al\n  int *v16; // rax\n  int v17; // ecx\n  int v18; // eax\n\n  m_targetObject = a1->m_targetObject;\n  if ( m_targetObject )\n  {\n    RelativeSpriteColor = GameObject::getRelativeSpriteColor(m_targetObject, a1->m_selectedMode);\n    if ( !RelativeSpriteColor )\n      return 0;\n    m_defaultColorID = RelativeSpriteColor->m_defaultColorID;\n    result = RelativeSpriteColor->m_colorID;\n    if ( m_defaultColorID == result || !result )\n      result = m_defaultColorID;\n    if ( !a2 && m_defaultColorID == result )\n      return 0;\n    return result;\n  }\n  v8 = !a2;\n  v9 = -1;\n  v10 = 0;\n  if ( !cocos2d::CCArray::count(a1->m_targetObjects) )\n    goto LABEL_36;\n  while ( 1 )\n  {\n    v11 = cocos2d::CCArray::objectAtIndex(a1->m_targetObjects, v10);\n    m_unknown2 = v11[18].m_unknown2;\n    v13 = m_unknown2 ? m_unknown2 == 1 : LOBYTE(v11[23].m_nLuaID);\n    v15 = false;\n    if ( !v13 && !v11[16].__vftable )\n    {\n      v14 = *(_DWORD *)(*(_QWORD *)&v11[19].m_unknown2 + 4LL);\n      if ( v14 != 1004 )\n      {\n        if ( v14 )\n          v15 = true;\n      }\n    }\n    if ( a1->m_selectedMode == 2 )\n      break;\n    if ( !v15 )\n      goto LABEL_23;\nLABEL_33:\n    if ( ++v10 >= cocos2d::CCArray::count(a1->m_targetObjects) )\n      goto LABEL_36;\n  }\n  if ( !v15 )\n  {\n    v16 = *(int **)&v11[19].m_uOrderOfArrival;\n    goto LABEL_24;\n  }\nLABEL_23:\n  v16 = *(int **)&v11[19].m_unknown2;\nLABEL_24:\n  if ( !v16 )\n    goto LABEL_33;\n  v17 = v16[1];\n  v18 = *v16;\n  if ( v17 == v18 || !v18 )\n    v18 = v17;\n  if ( v8 )\n    v8 = v18 == v17;\n  if ( v9 == -1 )\n  {\n    v9 = v18;\n    goto LABEL_33;\n  }\n  if ( v9 == v18 )\n    goto LABEL_33;\n  v9 = -1;\nLABEL_36:\n  if ( v8 )\n    return 0;\n  return v9;\n}", "assembly": "; \n; CustomizeObjectLayer::getActiveMode from 0x1400a93c0 to 0x1400a9546 (390 bytes)\n; \n; 11 xrefs:\n; > CustomizeObjectLayer::onLiveEdit @ 0x1400a7f29\n; > CustomizeObjectLayer::onPaste @ 0x1400a8153\n; > CustomizeObjectLayer::onEditColor @ 0x1400a848f\n; > CustomizeObjectLayer::updateColorSprite @ 0x1400a8558\n; > CustomizeObjectLayer::onSelectMode @ 0x1400a918e\n; > CustomizeObjectLayer::toggleVisible @ 0x1400a935e\n; > CustomizeObjectLayer::updateCurrentSelection @ 0x1400a955b\n; > CustomizeObjectLayer::onSelectColor @ 0x1400a9d04\n; > <???> @ 0x14066ab24\n; > <???> @ 0x14066ab34\n; > <???> @ 0x1406c7818\n; \n; This function is hookable on this platform!\n; \n; Using BromaIDA 8.0.0 @ https:;github.com/Stazzical/BromaIDA\n; Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https:;github.com/geode-sdk/bindings\n; \n\nmov     [rsp+arg_10], rbp                                              ; +0x0, 0x1400a93c0\nmov     [rsp+arg_18], rdi                                              ; +0x5, 0x1400a93c5\npush    r14                                                            ; +0xa, 0x1400a93ca\nsub     rsp, 20h                                                       ; +0xc, 0x1400a93cc\nmov     rdi, rcx                                                       ; +0x10, 0x1400a93d0\nxor     r14d, r14d                                                     ; +0x13, 0x1400a93d3\nmov     rcx, [rcx+298h]                                                ; +0x16, 0x1400a93d6\nmovzx   ebp, dl                                                        ; +0x1d, 0x1400a93dd\ntest    rcx, rcx                                                       ; +0x20, 0x1400a93e0\njz      short loc_1400A9429                                            ; +0x23, 0x1400a93e3\nmov     edx, [rdi+2D0h]                                                ; +0x25, 0x1400a93e5\ncall    GameObject__getRelativeSpriteColor                             ; +0x2b, 0x1400a93eb\ntest    rax, rax                                                       ; +0x30, 0x1400a93f0\njz      short loc_1400A9415                                            ; +0x33, 0x1400a93f3\nmov     ecx, [rax+4]                                                   ; +0x35, 0x1400a93f5\nmov     eax, [rax]                                                     ; +0x38, 0x1400a93f8\ncmp     ecx, eax                                                       ; +0x3a, 0x1400a93fa\njz      short loc_1400A9402                                            ; +0x3c, 0x1400a93fc\ntest    eax, eax                                                       ; +0x3e, 0x1400a93fe\njnz     short loc_1400A9404                                            ; +0x40, 0x1400a9400\nmov     eax, ecx                                                       ; +0x42, 0x1400a9402\ntest    bpl, bpl                                                       ; +0x44, 0x1400a9404\njnz     loc_1400A9535                                                  ; +0x47, 0x1400a9407\ncmp     ecx, eax                                                       ; +0x4d, 0x1400a940d\njnz     loc_1400A9535                                                  ; +0x4f, 0x1400a940f\nmov     eax, r14d                                                      ; +0x55, 0x1400a9415\nmov     rbp, [rsp+28h+arg_10]                                          ; +0x58, 0x1400a9418\nmov     rdi, [rsp+28h+arg_18]                                          ; +0x5d, 0x1400a941d\nadd     rsp, 20h                                                       ; +0x62, 0x1400a9422\npop     r14                                                            ; +0x66, 0x1400a9426\nretn                                                                   ; +0x68, 0x1400a9428\nmov     rcx, [rdi+2A0h]                                                ; +0x69, 0x1400a9429\nxor     bpl, 1                                                         ; +0x70, 0x1400a9430\nmov     [rsp+28h+arg_0], rbx                                           ; +0x74, 0x1400a9434\nmov     ebx, 0FFFFFFFFh                                                ; +0x79, 0x1400a9439\nmov     [rsp+28h+arg_8], rsi                                           ; +0x7e, 0x1400a943e\nmov     esi, r14d                                                      ; +0x83, 0x1400a9443\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x86, 0x1400a9446\ntest    eax, eax                                                       ; +0x8c, 0x1400a944c\njz      loc_1400A9522                                                  ; +0x8e, 0x1400a944e\nnop     dword ptr [rax+00h]                                            ; +0x94, 0x1400a9454\nnop     dword ptr [rax+rax+00000000h]                                  ; +0x98, 0x1400a9458\nmov     rcx, [rdi+2A0h]                                                ; +0xa0, 0x1400a9460\nmov     edx, esi                                                       ; +0xa7, 0x1400a9467\ncall    cs:?objectAtIndex@CCArray@cocos2d@@QEAAPEAVCCObject@2@I@Z; cocos2d::CCArray::objectAtIndex(uint) ; +0xa9, 0x1400a9469\nmov     rcx, rax                                                       ; +0xaf, 0x1400a946f\nmovzx   eax, word ptr [rax+418h]                                       ; +0xb2, 0x1400a9472\ntest    ax, ax                                                         ; +0xb9, 0x1400a9479\njnz     short loc_1400A9487                                            ; +0xbc, 0x1400a947c\nmovzx   eax, byte ptr [rcx+514h]                                       ; +0xbe, 0x1400a947e\njmp     short loc_1400A948E                                            ; +0xc5, 0x1400a9485\ncmp     ax, 1                                                          ; +0xc7, 0x1400a9487\nsetz    al                                                             ; +0xcb, 0x1400a948b\ntest    al, al                                                         ; +0xce, 0x1400a948e\njnz     short loc_1400A94B5                                            ; +0xd0, 0x1400a9490\ncmp     [rcx+380h], r14                                                ; +0xd2, 0x1400a9492\njnz     short loc_1400A94B5                                            ; +0xd9, 0x1400a9499\nmov     rax, [rcx+450h]                                                ; +0xdb, 0x1400a949b\nmov     edx, [rax+4]                                                   ; +0xe2, 0x1400a94a2\ncmp     edx, 3ECh                                                      ; +0xe5, 0x1400a94a5\njz      short loc_1400A94B5                                            ; +0xeb, 0x1400a94ab\ntest    edx, edx                                                       ; +0xed, 0x1400a94ad\njz      short loc_1400A94B5                                            ; +0xef, 0x1400a94af\nmov     al, 1                                                          ; +0xf1, 0x1400a94b1\njmp     short loc_1400A94B7                                            ; +0xf3, 0x1400a94b3\nxor     al, al                                                         ; +0xf5, 0x1400a94b5\ncmp     dword ptr [rdi+2D0h], 2                                        ; +0xf7, 0x1400a94b7\njnz     short loc_1400A94CD                                            ; +0xfe, 0x1400a94be\ntest    al, al                                                         ; +0x100, 0x1400a94c0\njnz     short loc_1400A94D1                                            ; +0x102, 0x1400a94c2\nmov     rax, [rcx+458h]                                                ; +0x104, 0x1400a94c4\njmp     short loc_1400A94D8                                            ; +0x10b, 0x1400a94cb\ntest    al, al                                                         ; +0x10d, 0x1400a94cd\njnz     short loc_1400A9504                                            ; +0x10f, 0x1400a94cf\nmov     rax, [rcx+450h]                                                ; +0x111, 0x1400a94d1\ntest    rax, rax                                                       ; +0x118, 0x1400a94d8\njz      short loc_1400A9504                                            ; +0x11b, 0x1400a94db\nmov     ecx, [rax+4]                                                   ; +0x11d, 0x1400a94dd\nmov     eax, [rax]                                                     ; +0x120, 0x1400a94e0\ncmp     ecx, eax                                                       ; +0x122, 0x1400a94e2\njz      short loc_1400A94EA                                            ; +0x124, 0x1400a94e4\ntest    eax, eax                                                       ; +0x126, 0x1400a94e6\njnz     short loc_1400A94EC                                            ; +0x128, 0x1400a94e8\nmov     eax, ecx                                                       ; +0x12a, 0x1400a94ea\ntest    bpl, bpl                                                       ; +0x12c, 0x1400a94ec\njz      short loc_1400A94F7                                            ; +0x12f, 0x1400a94ef\ncmp     eax, ecx                                                       ; +0x131, 0x1400a94f1\nsetz    bpl                                                            ; +0x133, 0x1400a94f3\ncmp     ebx, 0FFFFFFFFh                                                ; +0x137, 0x1400a94f7\njnz     short loc_1400A9500                                            ; +0x13a, 0x1400a94fa\nmov     ebx, eax                                                       ; +0x13c, 0x1400a94fc\njmp     short loc_1400A9504                                            ; +0x13e, 0x1400a94fe\ncmp     ebx, eax                                                       ; +0x140, 0x1400a9500\njnz     short loc_1400A951D                                            ; +0x142, 0x1400a9502\nmov     rcx, [rdi+2A0h]                                                ; +0x144, 0x1400a9504\ninc     esi                                                            ; +0x14b, 0x1400a950b\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x14d, 0x1400a950d\ncmp     esi, eax                                                       ; +0x153, 0x1400a9513\njb      loc_1400A9460                                                  ; +0x155, 0x1400a9515\njmp     short loc_1400A9522                                            ; +0x15b, 0x1400a951b\nmov     ebx, 0FFFFFFFFh                                                ; +0x15d, 0x1400a951d\nmov     rsi, [rsp+28h+arg_8]                                           ; +0x162, 0x1400a9522\ntest    bpl, bpl                                                       ; +0x167, 0x1400a9527\ncmovnz  ebx, r14d                                                      ; +0x16a, 0x1400a952a\nmov     eax, ebx                                                       ; +0x16e, 0x1400a952e\nmov     rbx, [rsp+28h+arg_0]                                           ; +0x170, 0x1400a9530\nmov     rbp, [rsp+28h+arg_10]                                          ; +0x175, 0x1400a9535\nmov     rdi, [rsp+28h+arg_18]                                          ; +0x17a, 0x1400a953a\nadd     rsp, 20h                                                       ; +0x17f, 0x1400a953f\npop     r14                                                            ; +0x183, 0x1400a9543\nretn                                                                   ; +0x185, 0x1400a9545", "xrefs": ["CustomizeObjectLayer::onLiveEdit @ 0x1400a7f29", "CustomizeObjectLayer::onPaste @ 0x1400a8153", "CustomizeObjectLayer::onEditColor @ 0x1400a848f", "CustomizeObjectLayer::updateColorSprite @ 0x1400a8558", "CustomizeObjectLayer::onSelectMode @ 0x1400a918e", "CustomizeObjectLayer::toggleVisible @ 0x1400a935e", "CustomizeObjectLayer::updateCurrentSelection @ 0x1400a955b", "CustomizeObjectLayer::onSelectColor @ 0x1400a9d04", "<???> @ 0x14066ab24", "<???> @ 0x14066ab34", "<???> @ 0x1406c7818"], "is_objc": false, "is_arm32": false, "is_arm64": false, "bida_info": "8.0.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings"}