{"type": "func", "start": 5369273776, "end": 5369274513, "name": "CharacterColorPage::onPlayerColor", "pseudocode": "// \n// CharacterColorPage::onPlayerColor from 0x140089db0 to 0x14008a091 (737 bytes)\n// \n// 2 xrefs:\n// > CharacterColorPage::createColorMenu @ 0x1400891a2\n// > <???> @ 0x1406c6d20\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\n// Hidden C++ exception states: #wind=6\nvoid CharacterColorPage::onPlayerColor(CharacterColorPage *a1, cocos2d::CCObject *a2)\n{\n  UnlockType v4; // edi\n  unsigned int v5; // ebx\n  GameManager *v6; // rcx\n  CharacterColorPage *v7; // rcx\n  CharacterColorDelegate *m_delegate; // rcx\n  cocos2d::ccColor3B *v9; // rcx\n  int m_colorMode; // edx\n  int v11; // edx\n  _DWORD *v12; // rdi\n  float v13; // xmm0_4\n  _DWORD *v14; // rdi\n  float v15; // xmm0_4\n  _DWORD *v16; // rdi\n  float v17; // xmm0_4\n  struct cocos2d::CCObject *v18; // rbx\n  cocos2d::CCObject_vtbl *v19; // rdi\n  struct cocos2d::CCPoint v20; // rax\n  char v21; // [rsp+40h] [rbp+8h] BYREF\n  struct cocos2d::CCPoint v22; // [rsp+48h] [rbp+10h] BYREF\n  struct cocos2d::CCPoint v23; // [rsp+50h] [rbp+18h] BYREF\n\n  v4 = (a1->m_colorMode != 0) + 2;\n  v5 = a2->getTag(a2);\n  v6 = (GameManager *)qword_1406C2ED8;\n  if ( !qword_1406C2ED8 )\n  {\n    v22 = (struct cocos2d::CCPoint)operator new(0x668u);\n    qword_1406C2ED8 = ((__int64 (__fastcall *)(_QWORD))sub_14017AB00)(v22);\n    (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);\n    v6 = (GameManager *)qword_1406C2ED8;\n  }\n  if ( GameManager::isColorUnlocked(v6, v5, v4) && CharacterColorPage::activeColorForMode(v7, a1->m_colorMode) != v5 )\n  {\n    v9 = (cocos2d::ccColor3B *)qword_1406C2ED8;\n    if ( !qword_1406C2ED8 )\n    {\n      v22 = (struct cocos2d::CCPoint)operator new(0x668u);\n      qword_1406C2ED8 = ((__int64 (__fastcall *)(_QWORD))sub_14017AB00)(v22);\n      (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);\n      v9 = (cocos2d::ccColor3B *)qword_1406C2ED8;\n    }\n    v9[216].r = 0;\n    GameManager::colorForIdx(v9, (GameManager *)&v21, v5);\n    m_colorMode = a1->m_colorMode;\n    if ( m_colorMode )\n    {\n      v11 = m_colorMode - 1;\n      if ( v11 )\n      {\n        if ( v11 == 1 )\n        {\n          v12 = (_DWORD *)qword_1406C2ED8;\n          if ( !qword_1406C2ED8 )\n          {\n            v22 = (struct cocos2d::CCPoint)operator new(0x668u);\n            qword_1406C2ED8 = ((__int64 (__fastcall *)(_QWORD))sub_14017AB00)(v22);\n            (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);\n            v12 = (_DWORD *)qword_1406C2ED8;\n          }\n          v12[209] = v5;\n          v13 = (float)((float)rand() / 32767.0) * 1000.0;\n          v12[208] = (int)v13;\n          v12[207] = v5 + (int)v13;\n        }\n      }\n      else\n      {\n        v14 = (_DWORD *)qword_1406C2ED8;\n        if ( !qword_1406C2ED8 )\n        {\n          v22 = (struct cocos2d::CCPoint)operator new(0x668u);\n          qword_1406C2ED8 = ((__int64 (__fastcall *)(_QWORD))sub_14017AB00)(v22);\n          (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);\n          v14 = (_DWORD *)qword_1406C2ED8;\n        }\n        v14[206] = v5;\n        v15 = (float)((float)rand() / 32767.0) * 1000.0;\n        v14[205] = (int)v15;\n        v14[204] = v5 + (int)v15;\n      }\n    }\n    else\n    {\n      v16 = (_DWORD *)qword_1406C2ED8;\n      if ( !qword_1406C2ED8 )\n      {\n        v22 = (struct cocos2d::CCPoint)operator new(0x668u);\n        qword_1406C2ED8 = ((__int64 (__fastcall *)(_QWORD))sub_14017AB00)(v22);\n        (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);\n        v16 = (_DWORD *)qword_1406C2ED8;\n      }\n      v16[203] = v5;\n      v17 = (float)((float)rand() / 32767.0) * 1000.0;\n      v16[202] = (int)v17;\n      v16[201] = v5 + (int)v17;\n    }\n    v18 = cocos2d::CCArray::objectAtIndex(a1->m_cursors, a1->m_colorMode);\n    v19 = v18->__vftable;\n    a2->__vftable[2].getTag(a2);\n    cocos2d::CCNode::convertToWorldSpace(a1->m_buttonMenu, &v22);\n    v20 = cocos2d::CCNode::convertToNodeSpace(a1->m_mainLayer, &v23);\n    ((void (__fastcall *)(struct cocos2d::CCObject *, struct cocos2d::CCPoint))v19[2].encodeWithCoder)(v18, v20);\n    CharacterColorPage::updateIconColors(a1);\n  }\n  else\n  {\n    m_delegate = a1->m_delegate;\n    if ( m_delegate )\n      m_delegate->showUnlockPopup(m_delegate, v5, v4);\n  }\n}", "assembly": "; \n; CharacterColorPage::onPlayerColor from 0x140089db0 to 0x14008a091 (737 bytes)\n; \n; 2 xrefs:\n; > CharacterColorPage::createColorMenu @ 0x1400891a2\n; > <???> @ 0x1406c6d20\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_18], rbx                                              ; +0x0, 0x140089db0\npush    rsi                                                            ; +0x5, 0x140089db5\npush    rdi                                                            ; +0x6, 0x140089db6\npush    r14                                                            ; +0x7, 0x140089db7\nsub     rsp, 20h                                                       ; +0x9, 0x140089db9\nmov     r14, rdx                                                       ; +0xd, 0x140089dbd\nmov     rsi, rcx                                                       ; +0x10, 0x140089dc0\nxor     edi, edi                                                       ; +0x13, 0x140089dc3\ncmp     [rcx+278h], edi                                                ; +0x15, 0x140089dc5\nsetnz   dil                                                            ; +0x1b, 0x140089dcb\nadd     edi, 2                                                         ; +0x1f, 0x140089dcf\nmov     rax, [rdx]                                                     ; +0x22, 0x140089dd2\nmov     rcx, rdx                                                       ; +0x25, 0x140089dd5\ncall    qword ptr [rax+38h]                                            ; +0x28, 0x140089dd8\nmov     ebx, eax                                                       ; +0x2b, 0x140089ddb\nmov     rcx, cs:qword_1406C2ED8                                        ; +0x2d, 0x140089ddd\ntest    rcx, rcx                                                       ; +0x34, 0x140089de4\njnz     short loc_140089E18                                            ; +0x37, 0x140089de7\nmov     ecx, 668h; Size                                                ; +0x39, 0x140089de9\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x3e, 0x140089dee\nmov     [rsp+38h+arg_8], rax                                           ; +0x43, 0x140089df3\nmov     rcx, rax                                                       ; +0x48, 0x140089df8\ncall    sub_14017AB00                                                  ; +0x4b, 0x140089dfb\nnop                                                                    ; +0x50, 0x140089e00\nmov     cs:qword_1406C2ED8, rax                                        ; +0x51, 0x140089e01\nmov     rdx, [rax]                                                     ; +0x58, 0x140089e08\nmov     rcx, rax                                                       ; +0x5b, 0x140089e0b\ncall    qword ptr [rdx+48h]                                            ; +0x5e, 0x140089e0e\nmov     rcx, cs:qword_1406C2ED8                                        ; +0x61, 0x140089e11\nmov     r8d, edi                                                       ; +0x68, 0x140089e18\nmov     edx, ebx                                                       ; +0x6b, 0x140089e1b\ncall    GameManager__isColorUnlocked                                   ; +0x6d, 0x140089e1d\ntest    al, al                                                         ; +0x72, 0x140089e22\njz      short loc_140089E35                                            ; +0x74, 0x140089e24\nmov     edx, [rsi+278h]                                                ; +0x76, 0x140089e26\ncall    CharacterColorPage__activeColorForMode                         ; +0x7c, 0x140089e2c\ncmp     eax, ebx                                                       ; +0x81, 0x140089e31\njnz     short loc_140089E5E                                            ; +0x83, 0x140089e33\nmov     rcx, [rsi+2A8h]                                                ; +0x85, 0x140089e35\ntest    rcx, rcx                                                       ; +0x8c, 0x140089e3c\njz      loc_14008A083                                                  ; +0x8f, 0x140089e3f\nmov     rax, [rcx]                                                     ; +0x95, 0x140089e45\nmov     r8d, edi                                                       ; +0x98, 0x140089e48\nmov     edx, ebx                                                       ; +0x9b, 0x140089e4b\ncall    qword ptr [rax+8]                                              ; +0x9d, 0x140089e4d\nmov     rbx, [rsp+38h+arg_18]                                          ; +0xa0, 0x140089e50\nadd     rsp, 20h                                                       ; +0xa5, 0x140089e55\npop     r14                                                            ; +0xa9, 0x140089e59\npop     rdi                                                            ; +0xab, 0x140089e5b\npop     rsi                                                            ; +0xac, 0x140089e5c\nretn                                                                   ; +0xad, 0x140089e5d\nmov     rcx, cs:qword_1406C2ED8                                        ; +0xae, 0x140089e5e\ntest    rcx, rcx                                                       ; +0xb5, 0x140089e65\njnz     short loc_140089E99                                            ; +0xb8, 0x140089e68\nmov     ecx, 668h; Size                                                ; +0xba, 0x140089e6a\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0xbf, 0x140089e6f\nmov     [rsp+38h+arg_8], rax                                           ; +0xc4, 0x140089e74\nmov     rcx, rax                                                       ; +0xc9, 0x140089e79\ncall    sub_14017AB00                                                  ; +0xcc, 0x140089e7c\nnop                                                                    ; +0xd1, 0x140089e81\nmov     cs:qword_1406C2ED8, rax                                        ; +0xd2, 0x140089e82\nmov     rdx, [rax]                                                     ; +0xd9, 0x140089e89\nmov     rcx, rax                                                       ; +0xdc, 0x140089e8c\ncall    qword ptr [rdx+48h]                                            ; +0xdf, 0x140089e8f\nmov     rcx, cs:qword_1406C2ED8                                        ; +0xe2, 0x140089e92\nmov     byte ptr [rcx+288h], 0                                         ; +0xe9, 0x140089e99\nmov     r8d, ebx                                                       ; +0xf0, 0x140089ea0\nlea     rdx, [rsp+38h+arg_0]                                           ; +0xf3, 0x140089ea3\ncall    GameManager__colorForIdx                                       ; +0xf8, 0x140089ea8\nmov     edx, [rsi+278h]                                                ; +0xfd, 0x140089ead\ntest    edx, edx                                                       ; +0x103, 0x140089eb3\njz      loc_140089FB0                                                  ; +0x105, 0x140089eb5\nsub     edx, 1                                                         ; +0x10b, 0x140089ebb\njz      short loc_140089F3E                                            ; +0x10e, 0x140089ebe\ncmp     edx, 1                                                         ; +0x110, 0x140089ec0\njnz     loc_14008A020                                                  ; +0x113, 0x140089ec3\nmov     rdi, cs:qword_1406C2ED8                                        ; +0x119, 0x140089ec9\ntest    rdi, rdi                                                       ; +0x120, 0x140089ed0\njnz     short loc_140089F04                                            ; +0x123, 0x140089ed3\nmov     ecx, 668h; Size                                                ; +0x125, 0x140089ed5\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x12a, 0x140089eda\nmov     [rsp+38h+arg_8], rax                                           ; +0x12f, 0x140089edf\nmov     rcx, rax                                                       ; +0x134, 0x140089ee4\ncall    sub_14017AB00                                                  ; +0x137, 0x140089ee7\nnop                                                                    ; +0x13c, 0x140089eec\nmov     cs:qword_1406C2ED8, rax                                        ; +0x13d, 0x140089eed\nmov     rdx, [rax]                                                     ; +0x144, 0x140089ef4\nmov     rcx, rax                                                       ; +0x147, 0x140089ef7\ncall    qword ptr [rdx+48h]                                            ; +0x14a, 0x140089efa\nmov     rdi, cs:qword_1406C2ED8                                        ; +0x14d, 0x140089efd\nmov     [rdi+344h], ebx                                                ; +0x154, 0x140089f04\ncall    cs:rand                                                        ; +0x15a, 0x140089f0a\nmovd    xmm0, eax                                                      ; +0x160, 0x140089f10\ncvtdq2ps xmm0, xmm0                                                    ; +0x164, 0x140089f14\ndivss   xmm0, cs:dword_140623644                                       ; +0x167, 0x140089f17\nmulss   xmm0, cs:dword_14062350C                                       ; +0x16f, 0x140089f1f\ncvttss2si eax, xmm0                                                    ; +0x177, 0x140089f27\nmov     [rdi+340h], eax                                                ; +0x17b, 0x140089f2b\nadd     eax, ebx                                                       ; +0x181, 0x140089f31\nmov     [rdi+33Ch], eax                                                ; +0x183, 0x140089f33\njmp     loc_14008A020                                                  ; +0x189, 0x140089f39\nmov     rdi, cs:qword_1406C2ED8                                        ; +0x18e, 0x140089f3e\ntest    rdi, rdi                                                       ; +0x195, 0x140089f45\njnz     short loc_140089F79                                            ; +0x198, 0x140089f48\nmov     ecx, 668h; Size                                                ; +0x19a, 0x140089f4a\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x19f, 0x140089f4f\nmov     [rsp+38h+arg_8], rax                                           ; +0x1a4, 0x140089f54\nmov     rcx, rax                                                       ; +0x1a9, 0x140089f59\ncall    sub_14017AB00                                                  ; +0x1ac, 0x140089f5c\nnop                                                                    ; +0x1b1, 0x140089f61\nmov     cs:qword_1406C2ED8, rax                                        ; +0x1b2, 0x140089f62\nmov     rdx, [rax]                                                     ; +0x1b9, 0x140089f69\nmov     rcx, rax                                                       ; +0x1bc, 0x140089f6c\ncall    qword ptr [rdx+48h]                                            ; +0x1bf, 0x140089f6f\nmov     rdi, cs:qword_1406C2ED8                                        ; +0x1c2, 0x140089f72\nmov     [rdi+338h], ebx                                                ; +0x1c9, 0x140089f79\ncall    cs:rand                                                        ; +0x1cf, 0x140089f7f\nmovd    xmm0, eax                                                      ; +0x1d5, 0x140089f85\ncvtdq2ps xmm0, xmm0                                                    ; +0x1d9, 0x140089f89\ndivss   xmm0, cs:dword_140623644                                       ; +0x1dc, 0x140089f8c\nmulss   xmm0, cs:dword_14062350C                                       ; +0x1e4, 0x140089f94\ncvttss2si eax, xmm0                                                    ; +0x1ec, 0x140089f9c\nmov     [rdi+334h], eax                                                ; +0x1f0, 0x140089fa0\nadd     eax, ebx                                                       ; +0x1f6, 0x140089fa6\nmov     [rdi+330h], eax                                                ; +0x1f8, 0x140089fa8\njmp     short loc_14008A020                                            ; +0x1fe, 0x140089fae\nmov     rdi, cs:qword_1406C2ED8                                        ; +0x200, 0x140089fb0\ntest    rdi, rdi                                                       ; +0x207, 0x140089fb7\njnz     short loc_140089FEB                                            ; +0x20a, 0x140089fba\nmov     ecx, 668h; Size                                                ; +0x20c, 0x140089fbc\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x211, 0x140089fc1\nmov     [rsp+38h+arg_8], rax                                           ; +0x216, 0x140089fc6\nmov     rcx, rax                                                       ; +0x21b, 0x140089fcb\ncall    sub_14017AB00                                                  ; +0x21e, 0x140089fce\nnop                                                                    ; +0x223, 0x140089fd3\nmov     cs:qword_1406C2ED8, rax                                        ; +0x224, 0x140089fd4\nmov     rdx, [rax]                                                     ; +0x22b, 0x140089fdb\nmov     rcx, rax                                                       ; +0x22e, 0x140089fde\ncall    qword ptr [rdx+48h]                                            ; +0x231, 0x140089fe1\nmov     rdi, cs:qword_1406C2ED8                                        ; +0x234, 0x140089fe4\nmov     [rdi+32Ch], ebx                                                ; +0x23b, 0x140089feb\ncall    cs:rand                                                        ; +0x241, 0x140089ff1\nmovd    xmm0, eax                                                      ; +0x247, 0x140089ff7\ncvtdq2ps xmm0, xmm0                                                    ; +0x24b, 0x140089ffb\ndivss   xmm0, cs:dword_140623644                                       ; +0x24e, 0x140089ffe\nmulss   xmm0, cs:dword_14062350C                                       ; +0x256, 0x14008a006\ncvttss2si eax, xmm0                                                    ; +0x25e, 0x14008a00e\nmov     [rdi+328h], eax                                                ; +0x262, 0x14008a012\nadd     eax, ebx                                                       ; +0x268, 0x14008a018\nmov     [rdi+324h], eax                                                ; +0x26a, 0x14008a01a\nmov     edx, [rsi+278h]                                                ; +0x270, 0x14008a020\nmov     rcx, [rsi+2A0h]                                                ; +0x276, 0x14008a026\ncall    cs:?objectAtIndex@CCArray@cocos2d@@QEAAPEAVCCObject@2@I@Z; cocos2d::CCArray::objectAtIndex(uint) ; +0x27d, 0x14008a02d\nmov     rbx, rax                                                       ; +0x283, 0x14008a033\nmov     rdi, [rax]                                                     ; +0x286, 0x14008a036\nmov     rdx, [r14]                                                     ; +0x289, 0x14008a039\nmov     rcx, r14                                                       ; +0x28c, 0x14008a03c\ncall    qword ptr [rdx+0C8h]                                           ; +0x28f, 0x14008a03f\nmov     r8, rax                                                        ; +0x295, 0x14008a045\nlea     rdx, [rsp+38h+arg_8]                                           ; +0x298, 0x14008a048\nmov     rcx, [rsi+220h]                                                ; +0x29d, 0x14008a04d\ncall    cs:?convertToWorldSpace@CCNode@cocos2d@@QEAA?AVCCPoint@2@AEBV32@@Z; cocos2d::CCNode::convertToWorldSpace(cocos2d::CCPoint const &) ; +0x2a4, 0x14008a054\nmov     r8, rax                                                        ; +0x2aa, 0x14008a05a\nlea     rdx, [rsp+38h+arg_10]                                          ; +0x2ad, 0x14008a05d\nmov     rcx, [rsi+240h]                                                ; +0x2b2, 0x14008a062\ncall    cs:?convertToNodeSpace@CCNode@cocos2d@@QEAA?AVCCPoint@2@AEBV32@@Z; cocos2d::CCNode::convertToNodeSpace(cocos2d::CCPoint const &) ; +0x2b9, 0x14008a069\nmov     rdx, rax                                                       ; +0x2bf, 0x14008a06f\nmov     rcx, rbx                                                       ; +0x2c2, 0x14008a072\ncall    qword ptr [rdi+0B8h]                                           ; +0x2c5, 0x14008a075\nmov     rcx, rsi                                                       ; +0x2cb, 0x14008a07b\ncall    CharacterColorPage__updateIconColors                           ; +0x2ce, 0x14008a07e\nmov     rbx, [rsp+38h+arg_18]                                          ; +0x2d3, 0x14008a083\nadd     rsp, 20h                                                       ; +0x2d8, 0x14008a088\npop     r14                                                            ; +0x2dc, 0x14008a08c\npop     rdi                                                            ; +0x2de, 0x14008a08e\npop     rsi                                                            ; +0x2df, 0x14008a08f\nretn                                                                   ; +0x2e0, 0x14008a090", "xrefs": ["CharacterColorPage::createColorMenu @ 0x1400891a2", "<???> @ 0x1406c6d20"], "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"}