//
// GameLevelManager::likeItem from 0x140163c60 to 0x14016426a (1546 bytes)
//
// 2 xrefs:
// > LikeItemLayer::triggerLike @ 0x14032e2b6
// > ??> @ 0x1406cac68
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Hidden C++ exception states: #wind=13
void GameLevelManager::likeItem(GameLevelManager *a1, LikeItemType a2, int a3, bool a4, int a5)
{
BOOL v5; // esi
GameManager *v9; // rcx
cocos2d::CCString *v10; // rax
const char *CString; // r12
__int64 v12; // rcx
cocos2d::CCString *v13; // rax
const char *v14; // rax
cocos2d::CCString *v15; // rax
char *v16; // rax
size_t v17; // r15
size_t v18; // r8
void **v19; // rdx
size_t v20; // r8
__int64 v21; // rdx
__int64 v22; // rax
int v23; // r14d
const char *v24; // rsi
GJAccountManager *v25; // rax
int v26; // edi
void **v27; // rbx
cocos2d::CCString *v28; // rax
const char *v29; // rax
cocos2d::CCString *v30; // rax
const char *v31; // rax
size_t v32; // r8
void **v33; // rax
void **v34; // rcx
__int64 v35; // rdx
size_t v36; // r8
void *v37; // rcx
void **v38; // rdx
size_t v39; // r8
_QWORD *v40; // rdx
void *v41; // rcx
int v42; // [rsp+20h] [rbp-E0h]
__int64 v43; // [rsp+20h] [rbp-E0h]
__int64 v44; // [rsp+20h] [rbp-E0h]
__int64 v45; // [rsp+28h] [rbp-D8h]
void *v46; // [rsp+50h] [rbp-B0h]
BOOL v47; // [rsp+50h] [rbp-B0h]
void *v48; // [rsp+58h] [rbp-A8h]
void *v49; // [rsp+58h] [rbp-A8h]
__int128 v52; // [rsp+78h] [rbp-88h] BYREF
__int64 v53; // [rsp+88h] [rbp-78h]
__int64 v54; // [rsp+90h] [rbp-70h]
__int128 v55; // [rsp+98h] [rbp-68h] BYREF
__int64 v56; // [rsp+A8h] [rbp-58h]
__int64 v57; // [rsp+B0h] [rbp-50h]
void *Block[2]; // [rsp+B8h] [rbp-48h] BYREF
__int64 v59; // [rsp+C8h] [rbp-38h]
unsigned __int64 v60; // [rsp+D0h] [rbp-30h]
__int128 v61; // [rsp+D8h] [rbp-28h] BYREF
__int64 v62; // [rsp+E8h] [rbp-18h]
unsigned __int64 v63; // [rsp+F0h] [rbp-10h]
void *v64[2]; // [rsp+F8h] [rbp-8h] BYREF
__int64 v65; // [rsp+108h] [rbp+8h]
unsigned __int64 v66; // [rsp+110h] [rbp+10h]
_QWORD Src[4]; // [rsp+118h] [rbp+18h] BYREF
void *v68[3]; // [rsp+138h] [rbp+38h] BYREF
unsigned __int64 v69; // [rsp+150h] [rbp+50h]
void *v70[4]; // [rsp+158h] [rbp+58h] BYREF
__int128 v71; // [rsp+178h] [rbp+78h] BYREF
__int64 v72; // [rsp+188h] [rbp+88h]
__int64 v73; // [rsp+190h] [rbp+90h]
v5 = a4;
if ( a2 == 1 )
{
v9 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v46 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v46);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v9 = (GameManager *)qword_1406C2ED8;
}
GameManager::reportAchievementWithID(v9, "geometry.ach.like", 100, a4);
}
if ( !GameLevelManager::hasLikedItemFullCheck(a1, a2, a3, a5, v42) )
{
GameLevelManager::markItemAsLiked(a1, a2, a3, v5, a5);
v47 = v5;
v10 = cocos2d::CCString::createWithFormat("like_%i_%i_%i_%i", a2, a3, v5, a5);
CString = cocos2d::CCString::getCString(v10);
GameLevelManager::getBasePostString(v12, Src);
LODWORD(v43) = 103;
v13 = cocos2d::CCString::createWithFormat("%c%s%s%c%c%s", 87, "mfd", "2893", v43, 98, (const char *)&word_140531E88);
v14 = cocos2d::CCString::getCString(v13);
v15 = cocos2d::CCString::createWithFormat("&itemID=%i&like=%i&type=%i&secret=%s&special=%i", a3, v5, a2, v14, a5);
v16 = (char *)cocos2d::CCString::getCString(v15);
v17 = -1;
v18 = -1;
do
++v18;
while ( v16[v18] );
sub_140041270(Src, v16, v18);
sub_140142B90(v68, 0xAu);
sub_140041270(Src, "&rs=", 4u);
v19 = v68;
if ( v69 > 0xF )
v19 = (void **)v68[0];
v20 = -1;
do
++v20;
while ( *((_BYTE *)v19 + v20) );
sub_140041270(Src, v19, v20);
v21 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v48 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v48);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v21 = qword_1406C2ED8;
}
sub_14003BDB0((__int64)&v61, v21 + 584);
v22 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v49 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v49);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v22 = qword_1406C2ED8;
}
v23 = *(_DWORD *)(v22 + 652) - *(_DWORD *)(v22 + 656);
v24 = (const char *)&v61;
if ( v63 > 0xF )
v24 = (const char *)v61;
v25 = GJAccountManager::sharedState();
v26 = v25->m_accountID - v25->m_unkInt1;
v27 = v68;
if ( v69 > 0xF )
v27 = (void **)v68[0];
LODWORD(v45) = 110;
LODWORD(v44) = 106;
v28 = cocos2d::CCString::createWithFormat("%c%s%s%c%c%s", 121, "sg6", "pUrt", v44, v45, "0J");
v29 = cocos2d::CCString::getCString(v28);
v30 = cocos2d::CCString::createWithFormat(
"%i%i%i%i%s%i%s%i%s",
a5,
a3,
v47,
a2,
(const char *)v27,
v26,
v24,
v23,
v29);
v31 = cocos2d::CCString::getCString(v30);
*(_OWORD *)v64 = 0;
v65 = 0;
v66 = 0;
v32 = -1;
do
++v32;
while ( v31[v32] );
sub_14003A930(v64, v31, v32);
sub_14003A830((__int64)&v61);
v33 = v64;
if ( v66 <= 0xF )
{
v34 = v64;
}
else
{
v34 = (void **)v64[0];
v33 = (void **)v64[0];
}
v35 = -1;
do
++v35;
while ( *((_BYTE *)v33 + v35) );
sub_140070860((__int64)v34, v35, Block);
sub_140070B30((unsigned __int8 *)Block, &v71);
*(_OWORD *)Block = 0;
v59 = 0;
v60 = 0;
v36 = -1;
do
++v36;
while ( *((_BYTE *)&v71 + v36) );
sub_14003A930(Block, &v71, v36);
v52 = 0;
v53 = 5;
v54 = 15;
strcpy((char *)&v52, "58281");
cocos2d::ZipUtils::base64EncodeEnc(v70, Block, &v52);
if ( v60 > 0xF )
{
v37 = Block[0];
if ( v60 + 1 >= 0x1000 )
{
v37 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v37 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v37);
}
v59 = 0;
v60 = 15;
LOBYTE(Block[0]) = 0;
sub_140041270(Src, "&chk=", 5u);
v38 = v70;
if ( v70[3] > (void *)0xF )
v38 = (void **)v70[0];
sub_140041270(Src, v38, (size_t)v70[2]);
v71 = 0;
v72 = 0;
v73 = 0;
v39 = -1;
do
++v39;
while ( CString[v39] );
sub_14003A930(&v71, CString, v39);
v40 = Src;
if ( Src[3] > 0xFu )
v40 = (_QWORD *)Src[0];
v61 = 0;
v62 = 0;
v63 = 0;
do
++v17;
while ( *((_BYTE *)v40 + v17) );
sub_14003A930(&v61, v40, v17);
v55 = 0;
v56 = 0;
v57 = 15;
*(_QWORD *)&v55 = sub_14003AA10(0x40u);
v56 = 52;
v57 = 63;
strcpy((char *)v55, "https://www.boomlings.com/database/likeGJItem211.php");
GameLevelManager::ProcessHttpRequest(a1, (__int64)&v55, (const char *)&v61, (const char *)&v71, 15);
sub_14003A830((__int64)v70);
if ( v66 > 0xF )
{
v41 = v64[0];
if ( v66 + 1 >= 0x1000 )
{
v41 = *((void **)v64[0] - 1);
if ( (unsigned __int64)((char *)v64[0] - (char *)v41 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v41);
}
sub_14003A830((__int64)v68);
sub_14003A830((__int64)Src);
}
}