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