//
// PlayLayer::updateAttempts from 0x140519d30 to 0x140519f71 (577 bytes)
//
// 3 xrefs:
// > PlayLayer::resetLevel @ 0x140519888
// > ??> @ 0x14092ae00
// > ??> @ 0x14092ae0c
//
// 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:33:35 +0000
//
// Hidden C++ exception states: #wind=8
__int64 __fastcall PlayLayer::updateAttempts(__int64 a1)
{
_DWORD *v2; // rcx
_DWORD *v3; // rbx
cocos2d::CCString *v4; // rax
const char *CString; // rax
__int64 v6; // rcx
__int64 v7; // rax
__int64 v8; // rdi
__int64 v9; // rbx
__int64 v10; // rax
__int64 v11; // rcx
__int64 v12; // rcx
__int64 result; // rax
__int64 v14; // rdx
float v15; // [rsp+40h] [rbp+8h] BYREF
float v16; // [rsp+44h] [rbp+Ch]
void *v17; // [rsp+48h] [rbp+10h] BYREF
void *v18; // [rsp+50h] [rbp+18h]
++*(_DWORD *)(a1 + 12644);
v2 = (_DWORD *)qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v17 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v17);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v2 = (_DWORD *)qword_14090BFD0;
}
v3 = v2;
if ( !v2 )
{
v17 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v17);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v2 = (_DWORD *)qword_14090BFD0;
}
v2[260] = v3[260] + 1;
++v2[261];
if ( !*(_BYTE *)(a1 + 13024) )
++v2[262];
v4 = cocos2d::CCString::createWithFormat("Attempt %i", *(_DWORD *)(a1 + 12644));
CString = cocos2d::CCString::getCString(v4);
(**(void (__fastcall ***)(__int64, const char *))(*(_QWORD *)(a1 + 14984) + 360LL))(
*(_QWORD *)(a1 + 14984) + 360LL,
CString);
v7 = cocos2d::CCDirector::sharedDirector(v6);
cocos2d::CCDirector::getWinSize(v7, &v15);
if ( *(_DWORD *)(a1 + 12644) != 1 || *(_BYTE *)(a1 + 12670) )
{
v8 = **(_QWORD **)(a1 + 14984);
v9 = *(_QWORD *)(a1 + 14984);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v17,
(float)((float)(v15 * 0.5) + *(float *)(a1 + 1040)) + 50.0,
(float)((float)(v16 * 0.5) + *(float *)(a1 + 1044)) + 85.0);
(*(void (__fastcall **)(__int64, __int64))(v8 + 184))(v9, v10);
}
if ( *(_BYTE *)(a1 + 14679) )
goto LABEL_20;
if ( *(_BYTE *)(a1 + 13024) )
{
v11 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v18 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v18);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v11 = qword_14090BFD0;
}
if ( GameManager::getGameVariable(v11, "0134") )
goto LABEL_20;
}
v12 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v18 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v18);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v12 = qword_14090BFD0;
}
result = GameManager::getGameVariable(v12, "0135");
if ( (_BYTE)result )
{
LABEL_20:
v14 = 0;
}
else
{
if ( *(int *)(a1 + 12644) <= 0 )
return result;
LOBYTE(v14) = 1;
}
return (*(__int64 (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 14984) + 336LL))(*(_QWORD *)(a1 + 14984), v14);
}