// // GameLevelManager::limitSavedLevels from 0x140222220 to 0x140222665 (1093 bytes) // // 3 xrefs: // > GameLevelManager::encodeDataTo @ 0x140224b94 // > GameLevelManager::dataLoaded @ 0x14022642c // > @ 0x14091bc44 // // This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True! // // Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings // Generated at Fri, 27 Nov 2026 11:28:25 +0000 // // Hidden C++ exception states: #wind=4 unsigned int __fastcall GameLevelManager::limitSavedLevels(__int64 a1) { cocos2d::CCArray *SavedLevels; // rsi cocos2d::CCArray *v3; // rbp char v4; // r14 unsigned int v5; // edi cocos2d::CCString *v6; // rax const char *CString; // rax size_t v8; // r8 __int64 v9; // rbx void *v10; // rcx int v11; // edx int v12; // eax __int64 v13; // rcx int v14; // ebp __int64 v15; // rcx signed int i; // ebx __int64 v17; // rcx unsigned int result; // eax cocos2d::CCArray *v19; // r14 unsigned int v20; // edi unsigned int v21; // eax cocos2d::CCString *v22; // rax const char *v23; // rax size_t v24; // r8 __int64 v25; // rsi void *v26; // rcx void *v27; // [rsp+30h] [rbp-58h] void *v28; // [rsp+30h] [rbp-58h] void *v29; // [rsp+30h] [rbp-58h] __int128 v30; // [rsp+38h] [rbp-50h] BYREF __int64 v31; // [rsp+48h] [rbp-40h] unsigned __int64 v32; // [rsp+50h] [rbp-38h] SavedLevels = GameLevelManager::getSavedLevels(a1, 0, 0); v3 = cocos2d::CCDictionary::allKeys(*(cocos2d::CCDictionary **)(a1 + 944)); v4 = 0; v5 = 0; if ( !cocos2d::CCArray::count(v3) ) goto LABEL_20; do { v6 = cocos2d::CCArray::objectAtIndex(v3, v5); CString = cocos2d::CCString::getCString(v6); v30 = 0; v31 = 0; v32 = 0; v8 = -1; do ++v8; while ( CString[v8] ); sub_14003D230(&v30, CString, v8); v9 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 944), &v30); if ( v32 > 0xF ) { v10 = (void *)v30; if ( v32 + 1 >= 0x1000 ) { v10 = *(void **)(v30 - 8); if ( (unsigned __int64)(v30 - (_QWORD)v10 - 8) > 0x1F ) invoke_watson(nullptr, nullptr, nullptr, 0, 0); } j_j_free(v10); } v31 = 0; v32 = 15; LOBYTE(v30) = 0; if ( !*(_BYTE *)(v9 + 1185) ) { v11 = *(_DWORD *)(v9 + 992) - *(_DWORD *)(v9 + 996); if ( v11 > 0 ) { if ( v11 <= 200000 ) { if ( v11 <= 100000 ) { v12 = *(_DWORD *)(a1 + 960); } else { if ( v11 <= 100000 ) { if ( v11 > 100000 != 2 ) { LABEL_16: cocos2d::CCArray::addObject(SavedLevels, (struct cocos2d::CCObject *)v9); v4 = 1; goto LABEL_17; } goto LABEL_14; } v12 = *(_DWORD *)(a1 + 972); } LABEL_15: if ( v11 == v12 ) goto LABEL_17; goto LABEL_16; } LABEL_14: v12 = *(_DWORD *)(a1 + 984); goto LABEL_15; } } LABEL_17: ++v5; } while ( v5 < cocos2d::CCArray::count(v3) ); if ( v4 ) qsort( *(void **)(*((_QWORD *)SavedLevels + 7) + 16LL), **((unsigned int **)SavedLevels + 7), 8u, (_CoreCrtNonSecureSearchSortCompareFunction)sub_140219080); LABEL_20: v13 = qword_14090BFD0; if ( !qword_14090BFD0 ) { v27 = operator new(0x6E8u); qword_14090BFD0 = GameManager::GameManager(v27); (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0); v13 = qword_14090BFD0; } v14 = 10; if ( (unsigned __int8)GameManager::getGameVariable(v13, "0042") ) v14 = 100; v15 = qword_14090BFD0; if ( !qword_14090BFD0 ) { v28 = operator new(0x6E8u); qword_14090BFD0 = GameManager::GameManager(v28); (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0); v15 = qword_14090BFD0; } if ( (unsigned __int8)GameManager::getGameVariable(v15, "0119") ) v14 = -1; for ( i = 0; i < cocos2d::CCArray::count(SavedLevels); ++i ) *((_BYTE *)cocos2d::CCArray::objectAtIndex(SavedLevels, i) + 1184) = i > v14; v17 = qword_14090BFD0; if ( !qword_14090BFD0 ) { v29 = operator new(0x6E8u); qword_14090BFD0 = GameManager::GameManager(v29); (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0); v17 = qword_14090BFD0; } result = GameManager::getGameVariable(v17, "0127"); if ( !(_BYTE)result ) { v19 = cocos2d::CCDictionary::allKeys(*(cocos2d::CCDictionary **)(a1 + 1032)); v20 = 0; result = cocos2d::CCArray::count(v19); if ( result ) { do { v21 = cocos2d::CCArray::count(v19); v22 = cocos2d::CCArray::objectAtIndex(v19, v21 + -1 - v20); v23 = cocos2d::CCString::getCString(v22); v30 = 0; v31 = 0; v32 = 0; v24 = -1; do ++v24; while ( v23[v24] ); sub_14003D230(&v30, v23, v24); v25 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 1032), &v30); if ( v32 > 0xF ) { v26 = (void *)v30; if ( v32 + 1 >= 0x1000 ) { v26 = *(void **)(v30 - 8); if ( (unsigned __int64)(v30 - (_QWORD)v26 - 8) > 0x1F ) invoke_watson(nullptr, nullptr, nullptr, 0, 0); } j_j_free(v26); } *(_BYTE *)(v25 + 1184) = i++ > v14; ++v20; result = cocos2d::CCArray::count(v19); } while ( v20 < result ); } } return result; }
GD Web Decomp Icon

GD Web Decomp

Raw Source