//
// GameManager::canShowRewardedVideo from 0x5eb070 to 0x5eb134 (196 bytes)
//
// 4 xrefs:
// > GJGarageLayer::onRewardedVideo @ 0x7904f4
// > RetryLevelLayer::onRewardedVideo @ 0x7ee768
// > FollowRewardPage::onRewardedVideo @ 0x9634b4
// > ??> @ 0xbbd40
//
// 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
//
bool GameManager::canShowRewardedVideo(GameManager *a1)
{
bool hasCachedRewardedVideo; // w20
GameStatsManager *v3; // x0
void *v4; // x0
unsigned int *v5; // x2
int v6; // w1
__int64 v7; // [xsp+30h] [xbp+30h] BYREF
hasCachedRewardedVideo = AdToolbox::hasCachedRewardedVideo();
if ( hasCachedRewardedVideo )
{
v3 = GameStatsManager::sharedState();
GameStatsManager::getNextVideoAdReward(&v7, v3);
v4 = (void *)(v7 - 24);
hasCachedRewardedVideo = *(_QWORD *)(v7 - 24) != 0;
if ( (__int64 *)(v7 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v5 = (unsigned int *)(v7 - 8);
do
v6 = __ldaxr(v5);
while ( __stlxr(v6 - 1, v5) );
}
else
{
v6 = *(_DWORD *)(v7 - 8);
*(_DWORD *)(v7 - 8) = v6 - 1;
}
if ( v6 <= 0 )
operator delete(v4);
}
}
return hasCachedRewardedVideo;
}