{"type": "func", "start": 4301645008, "end": 4301645591, "name": "CharacterColorPage::onPlayerColor", "pseudocode": "// \n// CharacterColorPage::onPlayerColor from 0x10065e4d0 to 0x10065e717 (583 bytes)\n// \n// 1 xrefs:\n// > CharacterColorPage::createColorMenu @ 0x10065ddea\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\nvoid __fastcall CharacterColorPage::onPlayerColor(CharacterColorPage *a1, cocos2d::CCObject *a2)\n{\n  UnlockType v2; // r12d\n  unsigned int v3; // r15d\n  GameManager *v4; // rax\n  int m_colorMode; // eax\n  int v6; // ecx\n  GameManager *v7; // rax\n  GameManager *v8; // rax\n  CharacterColorDelegate *m_delegate; // rdi\n  GameManager *v10; // rax\n  GameManager *v11; // rax\n  int v12; // eax\n  GameManager *v13; // r12\n  int v14; // eax\n  GameManager *v15; // r12\n  int v16; // eax\n  GameManager *v17; // r12\n  int v18; // eax\n  __int64 v19; // r15\n  cocos2d::CCLayer *m_mainLayer; // r12\n  cocos2d::CCMenu *m_buttonMenu; // r13\n  char v22; // [rsp+8h] [rbp-38h] BYREF\n  char v23; // [rsp+10h] [rbp-30h] BYREF\n  double v24; // 0:xmm0_8.8\n\n  v2 = (((unsigned int)a1->m_colorMode | 0x300000000uLL) - 1) >> 32;\n  v3 = ((__int64 (__fastcall *)(cocos2d::CCObject *))a2->getTag)(a2);\n  v4 = GameManager::sharedState();\n  if ( !GameManager::isColorUnlocked(v4, v3, v2) )\n    goto LABEL_9;\n  m_colorMode = a1->m_colorMode;\n  if ( m_colorMode == 2 )\n  {\n    v10 = GameManager::sharedState();\n    if ( v10->m_playerGlowColor.random - v10->m_playerGlowColor.seed == v3 )\n      goto LABEL_9;\nLABEL_12:\n    GameManager::sharedState()->m_scoreValid = 0;\n    v11 = GameManager::sharedState();\n    GameManager::colorForIdx(v11, v3);\n    v12 = a1->m_colorMode;\n    switch ( v12 )\n    {\n      case 2:\n        v17 = GameManager::sharedState();\n        v17->m_playerGlowColor.value = v3;\n        v18 = (int)(float)((float)((float)rand() * 4.6566129e-10) * 1000.0);\n        v17->m_playerGlowColor.seed = v18;\n        v17->m_playerGlowColor.random = v18 + v3;\n        break;\n      case 1:\n        v15 = GameManager::sharedState();\n        v15->m_playerColor2.value = v3;\n        v16 = (int)(float)((float)((float)rand() * 4.6566129e-10) * 1000.0);\n        v15->m_playerColor2.seed = v16;\n        v15->m_playerColor2.random = v16 + v3;\n        break;\n      case 0:\n        v13 = GameManager::sharedState();\n        v13->m_playerColor.value = v3;\n        v14 = (int)(float)((float)((float)rand() * 4.6566129e-10) * 1000.0);\n        v13->m_playerColor.seed = v14;\n        v13->m_playerColor.random = v14 + v3;\n        break;\n    }\n    v19 = sub_1007200C0(a1->m_cursors, (unsigned int)a1->m_colorMode);\n    m_mainLayer = a1->m_mainLayer;\n    m_buttonMenu = a1->m_buttonMenu;\n    ((void (__fastcall *)(cocos2d::CCObject *))a2->__vftable[2].acceptVisitor)(a2);\n    cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)&v23, (const cocos2d::CCPoint *)m_buttonMenu);\n    *(cocos2d::CCPoint *)&v24 = cocos2d::CCNode::convertToNodeSpace(\n                                  (cocos2d::CCNode *)&v22,\n                                  (const cocos2d::CCPoint *)m_mainLayer);\n    (*(void (__fastcall **)(__int64, char *, double))(*(_QWORD *)v19 + 184LL))(v19, &v22, v24);\n    CharacterColorPage::updateIconColors(a1);\n    return;\n  }\n  if ( m_colorMode == 1 )\n  {\n    v8 = GameManager::sharedState();\n    v6 = v8->m_playerColor2.random - v8->m_playerColor2.seed;\nLABEL_8:\n    if ( v6 == v3 )\n      goto LABEL_9;\n    goto LABEL_12;\n  }\n  v6 = 0;\n  if ( m_colorMode )\n    goto LABEL_8;\n  v7 = GameManager::sharedState();\n  if ( v7->m_playerColor.random - v7->m_playerColor.seed != v3 )\n    goto LABEL_12;\nLABEL_9:\n  m_delegate = a1->m_delegate;\n  if ( m_delegate )\n    ((void (__fastcall *)(CharacterColorDelegate *, _QWORD, _QWORD))m_delegate->showUnlockPopup)(\n      m_delegate,\n      v3,\n      (unsigned int)v2);\n}", "assembly": "; \n; CharacterColorPage::onPlayerColor from 0x10065e4d0 to 0x10065e717 (583 bytes)\n; \n; 1 xrefs:\n; > CharacterColorPage::createColorMenu @ 0x10065ddea\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\npush    rbp                                                            ; +0x0, 0x10065e4d0\nmov     rbp, rsp                                                       ; +0x1, 0x10065e4d1\npush    r15                                                            ; +0x4, 0x10065e4d4\npush    r14                                                            ; +0x6, 0x10065e4d6\npush    r13                                                            ; +0x8, 0x10065e4d8\npush    r12                                                            ; +0xa, 0x10065e4da\npush    rbx                                                            ; +0xc, 0x10065e4dc\nsub     rsp, 18h                                                       ; +0xd, 0x10065e4dd\nmov     r14, rsi                                                       ; +0x11, 0x10065e4e1\nmov     rbx, rdi                                                       ; +0x14, 0x10065e4e4\ncmp     dword ptr [rdi+278h], 1                                        ; +0x17, 0x10065e4e7\nmov     r12d, 3                                                        ; +0x1e, 0x10065e4ee\nsbb     r12d, 0                                                        ; +0x24, 0x10065e4f4\nmov     rax, [rsi]                                                     ; +0x28, 0x10065e4f8\nmov     rdi, rsi                                                       ; +0x2b, 0x10065e4fb\ncall    qword ptr [rax+40h]                                            ; +0x2e, 0x10065e4fe\nmov     r15d, eax                                                      ; +0x31, 0x10065e501\ncall    GameManager__sharedState                                       ; +0x34, 0x10065e504\nmov     rdi, rax                                                       ; +0x39, 0x10065e509\nmov     esi, r15d                                                      ; +0x3c, 0x10065e50c\nmov     edx, r12d                                                      ; +0x3f, 0x10065e50f\ncall    GameManager__isColorUnlocked                                   ; +0x42, 0x10065e512\ntest    al, al                                                         ; +0x47, 0x10065e517\njz      short loc_10065E55F                                            ; +0x49, 0x10065e519\nmov     eax, [rbx+278h]                                                ; +0x4b, 0x10065e51b\ncmp     eax, 2                                                         ; +0x51, 0x10065e521\njz      short loc_10065E58C                                            ; +0x54, 0x10065e524\ncmp     eax, 1                                                         ; +0x56, 0x10065e526\njz      short loc_10065E549                                            ; +0x59, 0x10065e529\nxor     ecx, ecx                                                       ; +0x5b, 0x10065e52b\ntest    eax, eax                                                       ; +0x5d, 0x10065e52d\njnz     short loc_10065E55A                                            ; +0x5f, 0x10065e52f\ncall    GameManager__sharedState                                       ; +0x61, 0x10065e531\nmov     ecx, [rax+304h]                                                ; +0x66, 0x10065e536\nsub     ecx, [rax+308h]                                                ; +0x6c, 0x10065e53c\ncmp     ecx, r15d                                                      ; +0x72, 0x10065e542\njz      short loc_10065E55F                                            ; +0x75, 0x10065e545\njmp     short loc_10065E5A2                                            ; +0x77, 0x10065e547\ncall    GameManager__sharedState                                       ; +0x79, 0x10065e549\nmov     ecx, [rax+310h]                                                ; +0x7e, 0x10065e54e\nsub     ecx, [rax+314h]                                                ; +0x84, 0x10065e554\ncmp     ecx, r15d                                                      ; +0x8a, 0x10065e55a\njnz     short loc_10065E5A2                                            ; +0x8d, 0x10065e55d\nmov     rdi, [rbx+2A8h]                                                ; +0x8f, 0x10065e55f\ntest    rdi, rdi                                                       ; +0x96, 0x10065e566\njz      loc_10065E708                                                  ; +0x99, 0x10065e569\nmov     rax, [rdi]                                                     ; +0x9f, 0x10065e56f\nmov     rax, [rax+8]                                                   ; +0xa2, 0x10065e572\nmov     esi, r15d                                                      ; +0xa6, 0x10065e576\nmov     edx, r12d                                                      ; +0xa9, 0x10065e579\nadd     rsp, 18h                                                       ; +0xac, 0x10065e57c\npop     rbx                                                            ; +0xb0, 0x10065e580\npop     r12                                                            ; +0xb1, 0x10065e581\npop     r13                                                            ; +0xb3, 0x10065e583\npop     r14                                                            ; +0xb5, 0x10065e585\npop     r15                                                            ; +0xb7, 0x10065e587\npop     rbp                                                            ; +0xb9, 0x10065e589\njmp     rax                                                            ; +0xba, 0x10065e58a\ncall    GameManager__sharedState                                       ; +0xbc, 0x10065e58c\nmov     ecx, [rax+31Ch]                                                ; +0xc1, 0x10065e591\nsub     ecx, [rax+320h]                                                ; +0xc7, 0x10065e597\ncmp     ecx, r15d                                                      ; +0xcd, 0x10065e59d\njz      short loc_10065E55F                                            ; +0xd0, 0x10065e5a0\ncall    GameManager__sharedState                                       ; +0xd2, 0x10065e5a2\nmov     byte ptr [rax+268h], 0                                         ; +0xd7, 0x10065e5a7\ncall    GameManager__sharedState                                       ; +0xde, 0x10065e5ae\nmov     rdi, rax                                                       ; +0xe3, 0x10065e5b3\nmov     esi, r15d                                                      ; +0xe6, 0x10065e5b6\ncall    GameManager__colorForIdx                                       ; +0xe9, 0x10065e5b9\nmov     eax, [rbx+278h]                                                ; +0xee, 0x10065e5be\ncmp     eax, 2                                                         ; +0xf4, 0x10065e5c4\njz      loc_10065E65F                                                  ; +0xf7, 0x10065e5c7\ncmp     eax, 1                                                         ; +0xfd, 0x10065e5cd\njz      short loc_10065E61E                                            ; +0x100, 0x10065e5d0\ntest    eax, eax                                                       ; +0x102, 0x10065e5d2\njnz     loc_10065E69E                                                  ; +0x104, 0x10065e5d4\ncall    GameManager__sharedState                                       ; +0x10a, 0x10065e5da\nmov     r12, rax                                                       ; +0x10f, 0x10065e5df\nmov     [rax+30Ch], r15d                                               ; +0x112, 0x10065e5e2\ncall    _rand                                                          ; +0x119, 0x10065e5e9\ncvtsi2ss xmm0, eax                                                     ; +0x11e, 0x10065e5ee\nmulss   xmm0, cs:dword_100815710                                       ; +0x122, 0x10065e5f2\nmulss   xmm0, cs:dword_1008152B8                                       ; +0x12a, 0x10065e5fa\ncvttss2si eax, xmm0                                                    ; +0x132, 0x10065e602\nmov     [r12+308h], eax                                                ; +0x136, 0x10065e606\nadd     r15d, eax                                                      ; +0x13e, 0x10065e60e\nmov     [r12+304h], r15d                                               ; +0x141, 0x10065e611\njmp     loc_10065E69E                                                  ; +0x149, 0x10065e619\ncall    GameManager__sharedState                                       ; +0x14e, 0x10065e61e\nmov     r12, rax                                                       ; +0x153, 0x10065e623\nmov     [rax+318h], r15d                                               ; +0x156, 0x10065e626\ncall    _rand                                                          ; +0x15d, 0x10065e62d\ncvtsi2ss xmm0, eax                                                     ; +0x162, 0x10065e632\nmulss   xmm0, cs:dword_100815710                                       ; +0x166, 0x10065e636\nmulss   xmm0, cs:dword_1008152B8                                       ; +0x16e, 0x10065e63e\ncvttss2si eax, xmm0                                                    ; +0x176, 0x10065e646\nmov     [r12+314h], eax                                                ; +0x17a, 0x10065e64a\nadd     r15d, eax                                                      ; +0x182, 0x10065e652\nmov     [r12+310h], r15d                                               ; +0x185, 0x10065e655\njmp     short loc_10065E69E                                            ; +0x18d, 0x10065e65d\ncall    GameManager__sharedState                                       ; +0x18f, 0x10065e65f\nmov     r12, rax                                                       ; +0x194, 0x10065e664\nmov     [rax+324h], r15d                                               ; +0x197, 0x10065e667\ncall    _rand                                                          ; +0x19e, 0x10065e66e\ncvtsi2ss xmm0, eax                                                     ; +0x1a3, 0x10065e673\nmulss   xmm0, cs:dword_100815710                                       ; +0x1a7, 0x10065e677\nmulss   xmm0, cs:dword_1008152B8                                       ; +0x1af, 0x10065e67f\ncvttss2si eax, xmm0                                                    ; +0x1b7, 0x10065e687\nmov     [r12+320h], eax                                                ; +0x1bb, 0x10065e68b\nadd     r15d, eax                                                      ; +0x1c3, 0x10065e693\nmov     [r12+31Ch], r15d                                               ; +0x1c6, 0x10065e696\nmov     rdi, [rbx+2A0h]                                                ; +0x1ce, 0x10065e69e\nmov     esi, [rbx+278h]                                                ; +0x1d5, 0x10065e6a5\ncall    sub_1007200C0                                                  ; +0x1db, 0x10065e6ab\nmov     r15, rax                                                       ; +0x1e0, 0x10065e6b0\nmov     r12, [rbx+240h]                                                ; +0x1e3, 0x10065e6b3\nmov     r13, [rbx+220h]                                                ; +0x1ea, 0x10065e6ba\nmov     rax, [r14]                                                     ; +0x1f1, 0x10065e6c1\nmov     rdi, r14                                                       ; +0x1f4, 0x10065e6c4\ncall    qword ptr [rax+0C0h]                                           ; +0x1f7, 0x10065e6c7\nlea     r14, [rbp+var_30]                                              ; +0x1fd, 0x10065e6cd\nmov     rdi, r14                                                       ; +0x201, 0x10065e6d1\nmov     rsi, r13                                                       ; +0x204, 0x10065e6d4\nmov     rdx, rax                                                       ; +0x207, 0x10065e6d7\ncall    cocos2d__CCNode__convertToWorldSpace                           ; +0x20a, 0x10065e6da\nlea     r13, [rbp+var_38]                                              ; +0x20f, 0x10065e6df\nmov     rdi, r13                                                       ; +0x213, 0x10065e6e3\nmov     rsi, r12                                                       ; +0x216, 0x10065e6e6\nmov     rdx, r14                                                       ; +0x219, 0x10065e6e9\ncall    cocos2d__CCNode__convertToNodeSpace                            ; +0x21c, 0x10065e6ec\nmov     rax, [r15]                                                     ; +0x221, 0x10065e6f1\nmov     rdi, r15                                                       ; +0x224, 0x10065e6f4\nmov     rsi, r13                                                       ; +0x227, 0x10065e6f7\ncall    qword ptr [rax+0B8h]                                           ; +0x22a, 0x10065e6fa\nmov     rdi, rbx                                                       ; +0x230, 0x10065e700\ncall    CharacterColorPage__updateIconColors                           ; +0x233, 0x10065e703\nadd     rsp, 18h                                                       ; +0x238, 0x10065e708\npop     rbx                                                            ; +0x23c, 0x10065e70c\npop     r12                                                            ; +0x23d, 0x10065e70d\npop     r13                                                            ; +0x23f, 0x10065e70f\npop     r14                                                            ; +0x241, 0x10065e711\npop     r15                                                            ; +0x243, 0x10065e713\npop     rbp                                                            ; +0x245, 0x10065e715\nretn                                                                   ; +0x246, 0x10065e716", "xrefs": ["CharacterColorPage::createColorMenu @ 0x10065ddea"], "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"}