// // GJSmartTemplate::getRandomPrefab from 0x1004112a0 to 0x100411412 (370 bytes) // // 3 xrefs: // > GJSmartTemplate::scanForPrefab @ 0x10041086b // > GJSmartTemplate::getPrefab_1 @ 0x100412588 // > BrowseSmartTemplateLayer::addPrefabMenuItem @ 0x1004e46c7 // // 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 12:30:09 +0000 // __int64 __fastcall GJSmartTemplate::getRandomPrefab(__int64 a1, __int128 *a2) { __int64 v2; // rbx __int64 v3; // r15 int TotalChanceForPrefab; // r14d int v5; // r15d unsigned int v6; // r14d int v7; // r12d __int128 v9; // [rsp+0h] [rbp-60h] BYREF void *__p; // [rsp+10h] [rbp-50h] __int128 v11; // [rsp+20h] [rbp-40h] BYREF void *v12; // [rsp+30h] [rbp-30h] float v13; // [rsp+3Ch] [rbp-24h] if ( (*(_BYTE *)a2 & 1) != 0 ) { sub_10001AD30(&v9, *((const void **)a2 + 2), *((_QWORD *)a2 + 1)); } else { __p = *((void **)a2 + 2); v9 = *a2; } v2 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 56), (char *)&v9); if ( (v9 & 1) != 0 ) operator delete(__p); if ( !v2 || !(unsigned int)sub_1007FEF90(v2) ) return 0; if ( (unsigned int)sub_1007FEF90(v2) < 2 ) return sub_1007FEFE0(v2, 0); if ( (*(_BYTE *)a2 & 1) != 0 ) { sub_10001AD30(&v11, *((const void **)a2 + 2), *((_QWORD *)a2 + 1)); } else { v12 = *((void **)a2 + 2); v11 = *a2; } TotalChanceForPrefab = GJSmartTemplate::getTotalChanceForPrefab(a1, &v11); if ( (v11 & 1) != 0 ) operator delete(v12); v5 = rand(); if ( !(unsigned int)sub_1007FEF90(v2) ) return 0; v13 = (float)TotalChanceForPrefab * (float)((float)v5 * 4.6566129e-10); v6 = 0; v7 = 0; while ( 1 ) { v3 = sub_1007FEFE0(v2, v6); v7 += *(_DWORD *)(v3 + 108); if ( (float)v7 >= v13 || v6 == (unsigned int)sub_1007FEF90(v2) - 1 ) break; if ( ++v6 >= (unsigned int)sub_1007FEF90(v2) ) return 0; } return v3; }
GD Web Decomp Icon

GD Web Decomp

Raw Source