{"type": "func", "start": 5371537776, "end": 5371537968, "name": "GJSmartTemplate::getTotalChanceForPrefab", "pseudocode": "// \n// GJSmartTemplate::getTotalChanceForPrefab from 0x1402b2970 to 0x1402b2a30 (192 bytes)\n// \n// 4 xrefs:\n// > GJSmartTemplate::getRandomPrefab @ 0x1402b2acc\n// > BrowseSmartKeyLayer::init @ 0x14045b772\n// > BrowseSmartKeyLayer::updateChanceValues @ 0x14045c37a\n// > <???> @ 0x1406d2384\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=2\n__int64 __fastcall GJSmartTemplate::getTotalChanceForPrefab(__int64 a1, __int64 a2)\n{\n  cocos2d::CCArray *v4; // rdi\n  unsigned int v5; // ebx\n  cocos2d::ccArray *data; // rdx\n  __int64 num; // rax\n  cocos2d::CCObject **arr; // rdx\n  cocos2d::CCObject **i; // r9\n  __int64 v11; // [rsp+20h] [rbp-48h]\n  char v12[32]; // [rsp+28h] [rbp-40h] BYREF\n  __int64 v13; // [rsp+48h] [rbp-20h]\n\n  v13 = a2;\n  v11 = sub_14003BDB0((__int64)v12, a2);\n  v4 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 56), v11);\n  sub_14003A830(v11);\n  v5 = 0;\n  if ( v4 )\n  {\n    if ( cocos2d::CCArray::count(v4) )\n    {\n      data = v4->data;\n      num = data->num;\n      if ( (_DWORD)num )\n      {\n        arr = data->arr;\n        for ( i = &arr[num - 1]; arr <= i; ++arr )\n        {\n          if ( !*arr )\n            break;\n          v5 += (*arr)[2].m_nLuaID;\n        }\n      }\n    }\n  }\n  sub_14003A830(a2);\n  return v5;\n}", "assembly": "; \n; GJSmartTemplate::getTotalChanceForPrefab from 0x1402b2970 to 0x1402b2a30 (192 bytes)\n; \n; 4 xrefs:\n; > GJSmartTemplate::getRandomPrefab @ 0x1402b2acc\n; > BrowseSmartKeyLayer::init @ 0x14045b772\n; > BrowseSmartKeyLayer::updateChanceValues @ 0x14045c37a\n; > <???> @ 0x1406d2384\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], rbx                                              ; +0x0, 0x1402b2970\nmov     [rsp+arg_18], rsi                                              ; +0x5, 0x1402b2975\npush    rdi                                                            ; +0xa, 0x1402b297a\nsub     rsp, 60h                                                       ; +0xb, 0x1402b297b\nmov     rax, cs:__security_cookie                                      ; +0xf, 0x1402b297f\nxor     rax, rsp                                                       ; +0x16, 0x1402b2986\nmov     [rsp+68h+var_18], rax                                          ; +0x19, 0x1402b2989\nmov     rsi, rdx                                                       ; +0x1e, 0x1402b298e\nmov     rdi, rcx                                                       ; +0x21, 0x1402b2991\nmov     [rsp+68h+var_20], rdx                                          ; +0x24, 0x1402b2994\nlea     rcx, [rsp+68h+var_40]                                          ; +0x29, 0x1402b2999\ncall    sub_14003BDB0                                                  ; +0x2e, 0x1402b299e\nmov     rbx, rax                                                       ; +0x33, 0x1402b29a3\nmov     [rsp+68h+var_48], rax                                          ; +0x36, 0x1402b29a6\nmov     rdx, rax                                                       ; +0x3b, 0x1402b29ab\nmov     rcx, [rdi+38h]                                                 ; +0x3e, 0x1402b29ae\ncall    cs:?objectForKey@CCDictionary@cocos2d@@QEAAPEAVCCObject@2@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z; cocos2d::CCDictionary::objectForKey(std::string const &) ; +0x42, 0x1402b29b2\nmov     rdi, rax                                                       ; +0x48, 0x1402b29b8\nmov     rcx, rbx                                                       ; +0x4b, 0x1402b29bb\ncall    sub_14003A830                                                  ; +0x4e, 0x1402b29be\nxor     ebx, ebx                                                       ; +0x53, 0x1402b29c3\ntest    rdi, rdi                                                       ; +0x55, 0x1402b29c5\njz      short loc_1402B2A07                                            ; +0x58, 0x1402b29c8\nmov     rcx, rdi                                                       ; +0x5a, 0x1402b29ca\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x5d, 0x1402b29cd\ntest    eax, eax                                                       ; +0x63, 0x1402b29d3\njz      short loc_1402B2A07                                            ; +0x65, 0x1402b29d5\nmov     rdx, [rdi+38h]                                                 ; +0x67, 0x1402b29d7\nmov     eax, [rdx]                                                     ; +0x6b, 0x1402b29db\ntest    eax, eax                                                       ; +0x6d, 0x1402b29dd\njz      short loc_1402B2A07                                            ; +0x6f, 0x1402b29df\nmov     rdx, [rdx+10h]                                                 ; +0x71, 0x1402b29e1\nlea     r9, [rax-1]                                                    ; +0x75, 0x1402b29e5\nlea     r9, [rdx+r9*8]                                                 ; +0x79, 0x1402b29e9\ncmp     rdx, r9                                                        ; +0x7d, 0x1402b29ed\nja      short loc_1402B2A07                                            ; +0x80, 0x1402b29f0\nmov     r8, [rdx]                                                      ; +0x82, 0x1402b29f2\ntest    r8, r8                                                         ; +0x85, 0x1402b29f5\njz      short loc_1402B2A07                                            ; +0x88, 0x1402b29f8\nadd     ebx, [r8+7Ch]                                                  ; +0x8a, 0x1402b29fa\nadd     rdx, 8                                                         ; +0x8e, 0x1402b29fe\ncmp     rdx, r9                                                        ; +0x92, 0x1402b2a02\njbe     short loc_1402B29F2                                            ; +0x95, 0x1402b2a05\nmov     rcx, rsi                                                       ; +0x97, 0x1402b2a07\ncall    sub_14003A830                                                  ; +0x9a, 0x1402b2a0a\nmov     eax, ebx                                                       ; +0x9f, 0x1402b2a0f\nmov     rcx, [rsp+68h+var_18]                                          ; +0xa1, 0x1402b2a11\nxor     rcx, rsp; StackCookie                                          ; +0xa6, 0x1402b2a16\ncall    __security_check_cookie                                        ; +0xa9, 0x1402b2a19\nlea     r11, [rsp+68h+var_8]                                           ; +0xae, 0x1402b2a1e\nmov     rbx, [r11+20h]                                                 ; +0xb3, 0x1402b2a23\nmov     rsi, [r11+28h]                                                 ; +0xb7, 0x1402b2a27\nmov     rsp, r11                                                       ; +0xbb, 0x1402b2a2b\npop     rdi                                                            ; +0xbe, 0x1402b2a2e\nretn                                                                   ; +0xbf, 0x1402b2a2f", "xrefs": ["GJSmartTemplate::getRandomPrefab @ 0x1402b2acc", "BrowseSmartKeyLayer::init @ 0x14045b772", "BrowseSmartKeyLayer::updateChanceValues @ 0x14045c37a", "<???> @ 0x1406d2384"], "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"}