//
// ShaderLayer::prepareTargetContainer from 0x683d88 to 0x683fe0 (600 bytes)
//
// 1 xrefs:
// > ShaderLayer::visit @ 0x685410
//
// 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:56:03 +0000
//
ShaderLayer *__fastcall ShaderLayer::prepareTargetContainer(ShaderLayer *this, int a2)
{
ShaderLayer *v2; // r9
int v4; // r2
const cocos2d::CCPoint *v5; // r1
const cocos2d::CCPoint *v6; // r0
int v7; // r3
int v8; // r5
float v9; // s16
int v10; // r3
float v11; // s15
float v12; // s15
float v13; // s14
float v14; // s17
float v15; // s16
float v16; // s18
float v17; // r0
int v18; // r0
int v19; // r10
void (__fastcall *v20)(int, _BYTE *); // r11
float v21; // s15
float v22; // s12
float v23; // s13
void (__fastcall *v24)(int, _BYTE *); // r10
float v26[2]; // [sp+Ch] [bp-30h] BYREF
float v27; // [sp+14h] [bp-28h] BYREF
float v28; // [sp+18h] [bp-24h]
float v29; // [sp+1Ch] [bp-20h] BYREF
float v30; // [sp+20h] [bp-1Ch]
_BYTE v31[16]; // [sp+24h] [bp-18h] BYREF
v2 = this;
v4 = *(_DWORD *)(a2 + 976);
if ( v4 )
{
v6 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(_DWORD))(**(_DWORD **)(v4 + 2436) + 96))(*(_DWORD *)(v4 + 2436));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v26, v6);
v7 = *(_DWORD *)(a2 + 976);
if ( *(int *)(a2 + 940) <= 1 )
v8 = *(_DWORD *)(v7 + 2424);
else
v8 = *(_DWORD *)(v7 + 2428);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v27, (const cocos2d::CCPoint *)&unk_D2D368);
if ( *(_BYTE *)(a2 + 652) && *(_BYTE *)(a2 + 653) )
{
v9 = *(float *)(a2 + 996);
if ( *(_BYTE *)(a2 + 654) && (v10 = *(_DWORD *)(a2 + 976)) != 0 )
v11 = fabsf((*(float (__fastcall **)(_DWORD))(**(_DWORD **)(v10 + 2436) + 84))(*(_DWORD *)(v10 + 2436)));
else
v11 = 1.0;
if ( *(_BYTE *)(a2 + 653) )
v12 = v11 * v9;
else
v12 = 1.0;
v13 = *(float *)(a2 + 996);
v14 = (float)(v12 * *(float *)(a2 + 644)) / v13;
v15 = (float)(v12 * *(float *)(a2 + 648)) / v13;
v16 = floorf(v26[0] / v14);
v17 = floorf(v26[1] / v15);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v29, v14 * v16, v15 * v17);
cocos2d::CCPoint::operator-(v31, v26, &v29);
cocos2d::CCPoint::operator=(&v27, v31);
}
cocos2d::CCPoint::operator=(&pixelOffset, &v27);
v18 = (*(int (__fastcall **)(int))(*(_DWORD *)v8 + 96))(v8);
cocos2d::CCPoint::operator=(a2 + 980, v18);
(*(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v8 + 64))(v8, *(_DWORD *)(a2 + 384));
(*(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v8 + 72))(v8, *(_DWORD *)(a2 + 388));
*(_DWORD *)(a2 + 988) = (*(int (__fastcall **)(int))(*(_DWORD *)v8 + 184))(v8);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v29, (const cocos2d::CCSize *)(a2 + 1004));
v19 = *(_DWORD *)(a2 + 964);
v20 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v19 + 568);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v31, -1.0, -1.0, v29 + 2.0, v30 + 2.0);
v20(v19, v31);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v31, *(float *)(a2 + 1020) - v29, *(float *)(a2 + 1024) - v30);
cocos2d::CCSize::operator=(a2 + 1028, v31);
v21 = v28 - (float)(*(float *)(a2 + 1032) * 0.5);
v22 = *(float *)(a2 + 980);
v23 = *(float *)(a2 + 984);
v27 = v27 - (float)(*(float *)(a2 + 1028) * 0.5);
v28 = v21;
v24 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v8 + 92);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v31,
(float)(v22 - v27) * *(float *)(a2 + 384),
(float)(v23 - v21) * *(float *)(a2 + 388));
v24(v8, v31);
this = v2;
v5 = (const cocos2d::CCPoint *)&v27;
}
else
{
v5 = (const cocos2d::CCPoint *)&unk_D2D368;
}
cocos2d::CCPoint::CCPoint(this, v5);
return v2;
}