{"type": "func", "start": 5371929296, "end": 5371929680, "name": "LevelSearchLayer::toggleDifficultyNum", "pseudocode": "// \n// LevelSearchLayer::toggleDifficultyNum from 0x1403122d0 to 0x140312450 (384 bytes)\n// \n// 10 xrefs:\n// > LevelSearchLayer::init @ 0x14030dd4c\n// > LevelSearchLayer::clearFilters @ 0x14030e8b9\n// > LevelSearchLayer::toggleDifficulty @ 0x140311fd0\n// > LevelSearchLayer::toggleDifficulty @ 0x1403120f8\n// > LevelSearchLayer::toggleDifficulty @ 0x140312128\n// > LevelSearchLayer::toggleDifficulty @ 0x140312158\n// > LevelSearchLayer::toggleDifficulty @ 0x14031216e\n// > LevelSearchLayer::toggleDifficulty @ 0x14031217d\n// > LevelSearchLayer::toggleDifficulty @ 0x14031218c\n// > <???> @ 0x1406d485c\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\nvoid LevelSearchLayer::toggleDifficultyNum(LevelSearchLayer *a1, int a2, bool a3)\n{\n  BOOL v3; // ebx\n  cocos2d::CCString *v6; // rax\n  const char *CString; // rax\n  size_t v8; // r8\n  struct cocos2d::CCString *v9; // rax\n  void *v10; // rcx\n  char *p_m_unknown2; // rcx\n  __int16 *v12; // rdx\n  GameLevelManager *v13; // rcx\n  __int16 v14; // [rsp+20h] [rbp-58h] BYREF\n  char v15; // [rsp+22h] [rbp-56h]\n  _WORD v16[2]; // [rsp+24h] [rbp-54h] BYREF\n  void *v17; // [rsp+28h] [rbp-50h]\n  void *Block[2]; // [rsp+30h] [rbp-48h] BYREF\n  __int64 v19; // [rsp+40h] [rbp-38h]\n  unsigned __int64 v20; // [rsp+48h] [rbp-30h]\n\n  v3 = a3;\n  v6 = cocos2d::CCString::createWithFormat(\"D%i\", a2);\n  CString = cocos2d::CCString::getCString(v6);\n  *(_OWORD *)Block = 0;\n  v19 = 0;\n  v20 = 0;\n  v8 = -1;\n  do\n    ++v8;\n  while ( CString[v8] );\n  sub_14003A930(Block, CString, v8);\n  v9 = cocos2d::CCString::createWithFormat(\"%i\", v3);\n  cocos2d::CCDictionary::setObject(a1->m_difficultyDict, v9, Block);\n  if ( v20 > 0xF )\n  {\n    v10 = Block[0];\n    if ( v20 + 1 >= 0x1000 )\n    {\n      v10 = *((void **)Block[0] - 1);\n      if ( (unsigned __int64)((char *)Block[0] - (char *)v10 - 8) > 0x1F )\n        invalid_parameter_noinfo_noreturn();\n    }\n    j_j_free(v10);\n  }\n  p_m_unknown2 = (char *)&cocos2d::CCArray::objectAtIndex(a1->m_difficultySprites, a2)[5].m_unknown2;\n  if ( v3 )\n  {\n    v14 = -1;\n    v15 = -1;\n    v12 = &v14;\n  }\n  else\n  {\n    v14 = 32125;\n    memset(v16, 125, 3);\n    v12 = v16;\n  }\n  (**(void (__fastcall ***)(char *, __int16 *))p_m_unknown2)(p_m_unknown2, v12);\n  v13 = (GameLevelManager *)qword_1406C2EC0;\n  if ( !qword_1406C2EC0 )\n  {\n    v17 = operator new(0x3D0u);\n    qword_1406C2EC0 = sub_140141280((__int64)v17);\n    (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);\n    v13 = (GameLevelManager *)qword_1406C2EC0;\n  }\n  GameLevelManager::setDiffVal(v13, a2, v3);\n}", "assembly": "; \n; LevelSearchLayer::toggleDifficultyNum from 0x1403122d0 to 0x140312450 (384 bytes)\n; \n; 10 xrefs:\n; > LevelSearchLayer::init @ 0x14030dd4c\n; > LevelSearchLayer::clearFilters @ 0x14030e8b9\n; > LevelSearchLayer::toggleDifficulty @ 0x140311fd0\n; > LevelSearchLayer::toggleDifficulty @ 0x1403120f8\n; > LevelSearchLayer::toggleDifficulty @ 0x140312128\n; > LevelSearchLayer::toggleDifficulty @ 0x140312158\n; > LevelSearchLayer::toggleDifficulty @ 0x14031216e\n; > LevelSearchLayer::toggleDifficulty @ 0x14031217d\n; > LevelSearchLayer::toggleDifficulty @ 0x14031218c\n; > <???> @ 0x1406d485c\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    rbx                                                            ; +0x0, 0x1403122d0\npush    rsi                                                            ; +0x2, 0x1403122d2\npush    rdi                                                            ; +0x3, 0x1403122d3\nsub     rsp, 60h                                                       ; +0x4, 0x1403122d4\nmov     rax, cs:__security_cookie                                      ; +0x8, 0x1403122d8\nxor     rax, rsp                                                       ; +0xf, 0x1403122df\nmov     [rsp+78h+var_28], rax                                          ; +0x12, 0x1403122e2\nmovzx   ebx, r8b                                                       ; +0x17, 0x1403122e7\nmov     edi, edx                                                       ; +0x1b, 0x1403122eb\nmov     rsi, rcx                                                       ; +0x1d, 0x1403122ed\nlea     rcx, aDI_1; \"D%i\"                                              ; +0x20, 0x1403122f0\ncall    cs:?createWithFormat@CCString@cocos2d@@SAPEAV12@PEBDZZ; cocos2d::CCString::createWithFormat(char const *,...) ; +0x27, 0x1403122f7\nmov     rcx, rax                                                       ; +0x2d, 0x1403122fd\ncall    cs:?getCString@CCString@cocos2d@@QEBAPEBDXZ; cocos2d::CCString::getCString(void) ; +0x30, 0x140312300\nxorps   xmm0, xmm0                                                     ; +0x36, 0x140312306\nmovups  xmmword ptr [rsp+78h+Block], xmm0                              ; +0x39, 0x140312309\nxor     ecx, ecx                                                       ; +0x3e, 0x14031230e\nmov     [rsp+78h+var_38], rcx                                          ; +0x40, 0x140312310\nmov     [rsp+78h+var_30], rcx                                          ; +0x45, 0x140312315\nmov     r8, 0FFFFFFFFFFFFFFFFh                                         ; +0x4a, 0x14031231a\ninc     r8                                                             ; +0x51, 0x140312321\ncmp     [rax+r8], cl                                                   ; +0x54, 0x140312324\njnz     short loc_140312321                                            ; +0x58, 0x140312328\nmov     rdx, rax                                                       ; +0x5a, 0x14031232a\nlea     rcx, [rsp+78h+Block]                                           ; +0x5d, 0x14031232d\ncall    sub_14003A930                                                  ; +0x62, 0x140312332\nnop                                                                    ; +0x67, 0x140312337\nmov     edx, ebx                                                       ; +0x68, 0x140312338\nlea     rcx, aI_11; \"%i\"                                               ; +0x6a, 0x14031233a\ncall    cs:?createWithFormat@CCString@cocos2d@@SAPEAV12@PEBDZZ; cocos2d::CCString::createWithFormat(char const *,...) ; +0x71, 0x140312341\nmov     rdx, rax                                                       ; +0x77, 0x140312347\nlea     r8, [rsp+78h+Block]                                            ; +0x7a, 0x14031234a\nmov     rcx, [rsi+1D8h]                                                ; +0x7f, 0x14031234f\ncall    cs:?setObject@CCDictionary@cocos2d@@QEAAXPEAVCCObject@2@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z; cocos2d::CCDictionary::setObject(cocos2d::CCObject *,std::string const &) ; +0x86, 0x140312356\nnop                                                                    ; +0x8c, 0x14031235c\nmov     rdx, [rsp+78h+var_30]                                          ; +0x8d, 0x14031235d\ncmp     rdx, 0Fh                                                       ; +0x92, 0x140312362\njbe     short loc_14031239D                                            ; +0x96, 0x140312366\ninc     rdx                                                            ; +0x98, 0x140312368\nmov     rcx, [rsp+78h+Block]; Block                                    ; +0x9b, 0x14031236b\nmov     rax, rcx                                                       ; +0xa0, 0x140312370\ncmp     rdx, 1000h                                                     ; +0xa3, 0x140312373\njb      short loc_140312398                                            ; +0xaa, 0x14031237a\nadd     rdx, 27h ; '''                                                 ; +0xac, 0x14031237c\nmov     rcx, [rcx-8]                                                   ; +0xb0, 0x140312380\nsub     rax, rcx                                                       ; +0xb4, 0x140312384\nadd     rax, 0FFFFFFFFFFFFFFF8h                                        ; +0xb7, 0x140312387\ncmp     rax, 1Fh                                                       ; +0xbb, 0x14031238b\njbe     short loc_140312398                                            ; +0xbf, 0x14031238f\ncall    cs:_invalid_parameter_noinfo_noreturn                          ; +0xc1, 0x140312391\nalign 8                                                                ; +0xc7, 0x140312397\ncall    j_j_free                                                       ; +0xc8, 0x140312398\nmov     edx, edi                                                       ; +0xcd, 0x14031239d\nmov     rcx, [rsi+1C8h]                                                ; +0xcf, 0x14031239f\ncall    cs:?objectAtIndex@CCArray@cocos2d@@QEAAPEAVCCObject@2@I@Z; cocos2d::CCArray::objectAtIndex(uint) ; +0xd6, 0x1403123a6\nlea     rcx, [rax+140h]                                                ; +0xdc, 0x1403123ac\ntest    bl, bl                                                         ; +0xe3, 0x1403123b3\njz      short loc_1403123D4                                            ; +0xe5, 0x1403123b5\nmov     [rsp+78h+var_58], 0FFFFh                                       ; +0xe7, 0x1403123b7\nmovzx   eax, [rsp+78h+var_58]                                          ; +0xee, 0x1403123be\nmov     [rsp+78h+var_58], ax                                           ; +0xf3, 0x1403123c3\nmov     [rsp+78h+var_56], 0FFh                                         ; +0xf8, 0x1403123c8\nlea     rdx, [rsp+78h+var_58]                                          ; +0xfd, 0x1403123cd\njmp     short loc_1403123EF                                            ; +0x102, 0x1403123d2\nmov     [rsp+78h+var_58], 7D7Dh                                        ; +0x104, 0x1403123d4\nmovzx   eax, [rsp+78h+var_58]                                          ; +0x10b, 0x1403123db\nmov     [rsp+78h+var_54], ax                                           ; +0x110, 0x1403123e0\nmov     [rsp+78h+var_52], 7Dh ; '}'                                    ; +0x115, 0x1403123e5\nlea     rdx, [rsp+78h+var_54]                                          ; +0x11a, 0x1403123ea\nmov     rax, [rcx]                                                     ; +0x11f, 0x1403123ef\ncall    qword ptr [rax]                                                ; +0x122, 0x1403123f2\nmov     rcx, cs:qword_1406C2EC0                                        ; +0x124, 0x1403123f4\ntest    rcx, rcx                                                       ; +0x12b, 0x1403123fb\njnz     short loc_140312430                                            ; +0x12e, 0x1403123fe\nmov     ecx, 3D0h; Size                                                ; +0x130, 0x140312400\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x135, 0x140312405\nmov     [rsp+78h+var_50], rax                                          ; +0x13a, 0x14031240a\nmov     rcx, rax                                                       ; +0x13f, 0x14031240f\ncall    sub_140141280                                                  ; +0x142, 0x140312412\nnop                                                                    ; +0x147, 0x140312417\nmov     cs:qword_1406C2EC0, rax                                        ; +0x148, 0x140312418\nmov     r9, [rax]                                                      ; +0x14f, 0x14031241f\nmov     rcx, rax                                                       ; +0x152, 0x140312422\ncall    qword ptr [r9+48h]                                             ; +0x155, 0x140312425\nmov     rcx, cs:qword_1406C2EC0                                        ; +0x159, 0x140312429\nmovzx   r8d, bl                                                        ; +0x160, 0x140312430\nmov     edx, edi                                                       ; +0x164, 0x140312434\ncall    GameLevelManager__setDiffVal                                   ; +0x166, 0x140312436\nmov     rcx, [rsp+78h+var_28]                                          ; +0x16b, 0x14031243b\nxor     rcx, rsp; StackCookie                                          ; +0x170, 0x140312440\ncall    __security_check_cookie                                        ; +0x173, 0x140312443\nadd     rsp, 60h                                                       ; +0x178, 0x140312448\npop     rdi                                                            ; +0x17c, 0x14031244c\npop     rsi                                                            ; +0x17d, 0x14031244d\npop     rbx                                                            ; +0x17e, 0x14031244e\nretn                                                                   ; +0x17f, 0x14031244f", "xrefs": ["LevelSearchLayer::init @ 0x14030dd4c", "LevelSearchLayer::clearFilters @ 0x14030e8b9", "LevelSearchLayer::toggleDifficulty @ 0x140311fd0", "LevelSearchLayer::toggleDifficulty @ 0x1403120f8", "LevelSearchLayer::toggleDifficulty @ 0x140312128", "LevelSearchLayer::toggleDifficulty @ 0x140312158", "LevelSearchLayer::toggleDifficulty @ 0x14031216e", "LevelSearchLayer::toggleDifficulty @ 0x14031217d", "LevelSearchLayer::toggleDifficulty @ 0x14031218c", "<???> @ 0x1406d485c"], "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"}