//
// ShaderLayer::prepareTargetContainer from 0x9f5c2c to 0x9f5f24 (760 bytes)
//
// 2 xrefs:
// > ShaderLayer::visit @ 0x9f7a54
// > ??> @ 0x53418
//
// 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
//
cocos2d::CCPoint ShaderLayer::prepareTargetContainer(ShaderLayer *a1)
{
cocos2d::CCPoint *v1; // x8
GJBaseGameLayer *m_gameLayer; // x0
cocos2d::CCPoint *v4; // x24
const cocos2d::CCPoint *v5; // x0
GJBaseGameLayer *v6; // x0
cocos2d::CCNode *m_objectParent; // x20
float v8; // s0
float v9; // s1
float v10; // s0
float v11; // s1
cocos2d::CCSprite *m_sprite; // x25
void (__fastcall *setTextureRect)(cocos2d::CCSprite *__hidden, const cocos2d::CCRect *); // x26
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x25
float m_textureScaleX; // s5
float v16; // s2
float y; // s1
float m_textureScaleY; // s4
float v19; // s0
float m_scaleFactor; // s8
GJBaseGameLayer *v23; // x0
float v24; // s0
float v25; // s1
float v26; // s2
float v27; // s0
float v28; // s0
float v29; // s1
cocos2d::CCPoint v30; // [xsp+60h] [xbp+60h] BYREF
cocos2d::CCPoint v31; // [xsp+68h] [xbp+68h] BYREF
cocos2d::CCPoint v32; // [xsp+70h] [xbp+70h] BYREF
cocos2d::CCRect v33; // [xsp+78h] [xbp+78h] BYREF
cocos2d::CCPoint result; // 0:s0.4,4:s1.4
m_gameLayer = a1->m_gameLayer;
v4 = v1;
if ( m_gameLayer )
{
v5 = m_gameLayer->m_objectLayer->getPosition(m_gameLayer->m_objectLayer);
cocos2d::CCPoint::CCPoint(&v30, v5);
v6 = a1->m_gameLayer;
if ( a1->m_state.m_minBlendingLayer <= 1 )
m_objectParent = v6->m_objectParent;
else
m_objectParent = v6->m_inShaderParent;
cocos2d::CCPoint::CCPoint(&v31, &stru_1243F90);
if ( !a1->m_state.m_pixelateSnapGrid || !a1->m_state.m_pixelatePixelating )
goto LABEL_5;
m_scaleFactor = a1->m_scaleFactor;
if ( a1->m_state.m_pixelateRelative && (v23 = a1->m_gameLayer) != nullptr )
{
v23->m_objectLayer->getScale(v23->m_objectLayer);
if ( !a1->m_state.m_pixelatePixelating )
{
v25 = a1->m_scaleFactor;
v26 = 1.0;
LABEL_14:
cocos2d::CCPoint::CCPoint(
&v32,
floorf(v30.x / (float)((float)(v26 * a1->m_state.m_pixelateTargetX) / v25))
* (float)((float)(v26 * a1->m_state.m_pixelateTargetX) / v25),
floorf(v30.y / (float)((float)(v26 * a1->m_state.m_pixelateTargetY) / v25))
* (float)((float)(v26 * a1->m_state.m_pixelateTargetY) / v25));
cocos2d::CCPoint::operator-(&v33, &v30, &v32);
cocos2d::CCPoint::operator=(&v31, v28, v29);
LABEL_5:
cocos2d::CCPoint::operator=(&pixelOffset, v8, v9);
v10 = ((float (__fastcall *)(cocos2d::CCNode *))m_objectParent->getPosition)(m_objectParent);
cocos2d::CCPoint::operator=(&a1->m_savedCameraPosition, v10, v11);
m_objectParent->setScaleX(m_objectParent, a1->m_state.m_textureScaleX);
m_objectParent->setScaleY(m_objectParent, a1->m_state.m_textureScaleY);
a1->m_savedCameraRotation = m_objectParent->getRotation(m_objectParent);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v32, &a1->m_screenSize);
m_sprite = a1->m_sprite;
setTextureRect = m_sprite->setTextureRect;
cocos2d::CCRect::CCRect(&v33, -1.0, -1.0, v32.x + 2.0, v32.y + 2.0);
setTextureRect(m_sprite, &v33);
cocos2d::CCSize::CCSize(
(cocos2d::CCSize *)&v33,
a1->m_targetTextureSize.width - v32.x,
a1->m_targetTextureSize.height - v32.y);
cocos2d::CCSize::operator=(&a1->m_targetTextureSizeExtra, &v33);
setPosition = m_objectParent->setPosition;
m_textureScaleX = a1->m_state.m_textureScaleX;
v16 = v31.y - (float)(a1->m_targetTextureSizeExtra.height * 0.5);
y = a1->m_savedCameraPosition.y;
m_textureScaleY = a1->m_state.m_textureScaleY;
v19 = a1->m_savedCameraPosition.x - (float)(v31.x - (float)(a1->m_targetTextureSizeExtra.width * 0.5));
v31.x = v31.x - (float)(a1->m_targetTextureSizeExtra.width * 0.5);
v31.y = v16;
cocos2d::CCPoint::CCPoint(&v33.origin, v19 * m_textureScaleX, (float)(y - v16) * m_textureScaleY);
setPosition(m_objectParent, &v33.origin);
cocos2d::CCPoint::CCPoint(v4, &v31);
return result;
}
v27 = fabsf(v24);
v25 = a1->m_scaleFactor;
}
else
{
v25 = a1->m_scaleFactor;
v27 = 1.0;
}
v26 = v27 * m_scaleFactor;
goto LABEL_14;
}
cocos2d::CCPoint::CCPoint(v1, &stru_1243F90);
return result;
}