//
// GameLevelManager::rewardSessionToken from 0x14025fa30 to 0x14025fc01 (465 bytes)
//
// 6 xrefs:
// > GameLevelManager::downloadLevel @ 0x140231d62
// > GameLevelManager::claimNotificationReward @ 0x140251e65
// > GameLevelManager::getGJSecretReward @ 0x14025bfff
// > GameLevelManager::getGJRewards @ 0x14025d222
// > GameLevelManager::getGJDailyLevelState @ 0x14025f793
// > ??> @ 0x14091c79c
//
// 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:47 +0000
//
// Hidden C++ exception states: #wind=4
__int64 __fastcall GameLevelManager::rewardSessionToken(__int64 a1, __int64 a2)
{
__int64 v3; // rax
cocos2d::CCString *v4; // rax
const char *CString; // rax
size_t v6; // r8
_QWORD *v7; // rax
void **v8; // rdx
_QWORD *v9; // rax
void *v10; // rcx
void *v12; // [rsp+30h] [rbp-49h]
__int128 v13; // [rsp+40h] [rbp-39h] BYREF
__int64 v14; // [rsp+50h] [rbp-29h]
__int64 v15; // [rsp+58h] [rbp-21h]
void *Block[2]; // [rsp+60h] [rbp-19h] BYREF
__int64 v17; // [rsp+70h] [rbp-9h]
unsigned __int64 v18; // [rsp+78h] [rbp-1h]
void *v19[4]; // [rsp+80h] [rbp+7h] BYREF
_QWORD v20[4]; // [rsp+A0h] [rbp+27h] BYREF
v3 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v12 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v12);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v3 = qword_14090BFD0;
}
v4 = cocos2d::CCString::createWithFormat(
(const char *)&word_1406ED6F8,
(unsigned int)(*(_DWORD *)(v3 + 928) - *(_DWORD *)(v3 + 932)));
CString = cocos2d::CCString::getCString(v4);
*(_OWORD *)Block = 0;
v17 = 0;
v18 = 0;
v6 = -1;
do
++v6;
while ( CString[v6] );
sub_14003D230(Block, CString, v6);
v13 = 0;
v14 = 5;
v15 = 15;
strcpy((char *)&v13, "59182");
cocos2d::ZipUtils::base64EncodeEnc(v19, Block, &v13);
v7 = sub_1402190E0(v20, 5u);
v8 = v19;
if ( v19[3] > (void *)0xF )
v8 = (void **)v19[0];
v9 = sub_140044D80(v7, v8, (size_t)v19[2]);
*(_OWORD *)a2 = 0;
*(_QWORD *)(a2 + 16) = 0;
*(_QWORD *)(a2 + 24) = 0;
*(_OWORD *)a2 = *(_OWORD *)v9;
*(_OWORD *)(a2 + 16) = *((_OWORD *)v9 + 1);
v9[2] = 0;
v9[3] = 15;
*(_BYTE *)v9 = 0;
sub_14003D310((__int64)v20);
sub_14003D310((__int64)v19);
if ( v18 > 0xF )
{
v10 = Block[0];
if ( v18 + 1 >= 0x1000 )
{
v10 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v10 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v10);
}
return a2;
}