//
// RetryLevelLayer::onRewardedVideo from 0x547358 to 0x54755e (518 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:52:24 +0000
//
unsigned __int8 *__fastcall RetryLevelLayer::onRewardedVideo(unsigned __int8 *this, cocos2d::CCObject *a2, int a3)
{
unsigned __int8 *v3; // r6
GameManager *v4; // r0
int v5; // r1
int v6; // r2
int v7; // r3
_BOOL4 canShowRewardedVideo; // r0
int v9; // r0
int v10; // r2
int v11; // r3
GameStatsManager *NextVideoAdReward; // r0
int v13; // r3
cocos2d::CCArray *v14; // r8
cocos2d::CCObject *v15; // r0
cocos2d::CCObject *v16; // r0
cocos2d::CCObject *v17; // r0
int v18; // r2
DialogLayer *v19; // r4
AdToolbox *v20; // r0
int v21; // r1
int v22; // r2
int v23; // r3
int v24; // [sp+4h] [bp-5Ch]
int v25; // [sp+4h] [bp-5Ch]
int v26; // [sp+4h] [bp-5Ch]
_BYTE v27[4]; // [sp+8h] [bp-58h] BYREF
int v28; // [sp+Ch] [bp-54h]
int v29[3]; // [sp+14h] [bp-4Ch] BYREF
int v30[3]; // [sp+20h] [bp-40h] BYREF
int v31[3]; // [sp+2Ch] [bp-34h] BYREF
int v32[3]; // [sp+38h] [bp-28h] BYREF
int v33[3]; // [sp+44h] [bp-1Ch] BYREF
int v34[3]; // [sp+50h] [bp-10h] BYREF
v3 = this;
if ( !*(this + 489) )
{
this = (unsigned __int8 *)AdToolbox::hasCachedRewardedVideo((AdToolbox *)this, (int)a2, a3, *(this + 489));
if ( this )
{
v4 = (GameManager *)GameManager::sharedState((GameManager *)this);
canShowRewardedVideo = GameManager::canShowRewardedVideo(v4, v5, v6, v7);
if ( canShowRewardedVideo )
{
v3[489] = 1;
v20 = (AdToolbox *)GameManager::sharedState((GameManager *)canShowRewardedVideo);
*((_DWORD *)v20 + 248) = v3 + 480;
return (unsigned __int8 *)AdToolbox::showRewardedVideo(v20, v21, v22, v23);
}
else
{
v9 = GameStatsManager::sharedState(nullptr);
NextVideoAdReward = GameStatsManager::getNextVideoAdReward((GameStatsManager *)v27, v9, v10, v11);
if ( (v27[0] & 1) != 0 )
v13 = v28;
else
v13 = (int)v27[0] >> 1;
if ( !v13 )
{
v14 = (cocos2d::CCArray *)cocos2d::CCArray::create(NextVideoAdReward);
memset(v29, 0, sizeof(v29));
std::string::__init(v29, "Scratch", 7u);
memset(v30, 0, sizeof(v30));
std::string::__init(v30, "I don't have any chests left...", 0x39u);
LOWORD(v24) = -1;
BYTE2(v24) = -1;
v15 = (cocos2d::CCObject *)DialogObject::create(v29, v30, 12, 1065353216, 0, v24);
cocos2d::CCArray::addObject(v14, v15);
std::string::~string((int)v30);
std::string::~string((int)v29);
memset(v31, 0, sizeof(v31));
std::string::__init(v31, "Scratch", 7u);
memset(v32, 0, sizeof(v32));
std::string::__init(v32, "You took EVERYTHING I had!", 0x22u);
LOWORD(v25) = -1;
BYTE2(v25) = -1;
v16 = (cocos2d::CCObject *)DialogObject::create(v31, v32, 14, 1065353216, 0, v25);
cocos2d::CCArray::addObject(v14, v16);
std::string::~string((int)v32);
std::string::~string((int)v31);
memset(v33, 0, sizeof(v33));
std::string::__init(v33, "Scratch", 7u);
memset(v34, 0, sizeof(v34));
std::string::__init(v34, "I need to find new stuff...", 0x23u);
LOWORD(v26) = -1;
BYTE2(v26) = -1;
v17 = (cocos2d::CCObject *)DialogObject::create(v33, v34, 13, 1065353216, 0, v26);
cocos2d::CCArray::addObject(v14, v17);
std::string::~string((int)v34);
std::string::~string((int)v33);
v19 = (DialogLayer *)DialogLayer::createWithObjects(v14, (cocos2d::CCArray *)((char *)&dword_0 + 2), v18);
(*(void (__fastcall **)(_DWORD, DialogLayer *, int))(**((_DWORD **)v3 + 116) + 232))(
*((_DWORD *)v3 + 116),
v19,
100);
DialogLayer::updateChatPlacement(v19, 0);
DialogLayer::animateInRandomSide(v19);
}
return (unsigned __int8 *)std::string::~string((int)v27);
}
}
}
return this;
}