//
// SetupShaderEffectPopup::setupSepia from 0xa0636c to 0xa067b8 (1100 bytes)
//
// 2 xrefs:
// > SetupShaderEffectPopup::init @ 0xa0864c
// > ??> @ 0x40668
//
// 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
//
void SetupShaderEffectPopup::setupSepia(SetupShaderEffectPopup *a1)
{
void *v2; // x0
void *v3; // x0
void *v4; // x0
cocos2d::CCDirector *v5; // x0
void *v6; // x0
void *v7; // x0
float v8; // s2
unsigned int *v9; // x1
int v10; // w2
unsigned int *v11; // x1
int v12; // w2
unsigned int *v13; // x1
int v14; // w2
unsigned int *v15; // x1
int v16; // w2
unsigned int *v17; // x1
int v18; // w2
float v19; // [xsp+70h] [xbp+70h]
float v20; // [xsp+74h] [xbp+74h]
cocos2d::CCPoint v21; // [xsp+78h] [xbp+78h] BYREF
cocos2d::CCPoint v22; // [xsp+80h] [xbp+80h] BYREF
cocos2d::CCPoint v23; // [xsp+88h] [xbp+88h] BYREF
__int64 v24; // [xsp+90h] [xbp+90h] BYREF
cocos2d::CCPoint v25; // 0:s0.4,4:s1.4
sub_D153B8((int)&v24, "Setup Sepia");
SetupTriggerPopup::addTitle((__int64)a1);
v2 = (void *)(v24 - 24);
if ( (__int64 *)(v24 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v9 = (unsigned int *)(v24 - 8);
do
v10 = __ldaxr(v9);
while ( __stlxr(v10 - 1, v9) );
}
else
{
v10 = *(_DWORD *)(v24 - 8);
*(_DWORD *)(v24 - 8) = v10 - 1;
}
if ( v10 <= 0 )
operator delete(v2);
}
sub_D153B8((int)&v23, "Help");
sub_D153B8(
(int)&v24,
"Applies a sepia filter to the screen.\n"
"Target is how much of the filter to apply.\n"
"FadeTime is time until final state is reached.");
SetupTriggerPopup::addHelpButton((__int64)a1, 1.0);
v3 = (void *)(v24 - 24);
if ( (__int64 *)(v24 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v11 = (unsigned int *)(v24 - 8);
do
v12 = __ldaxr(v11);
while ( __stlxr(v12 - 1, v11) );
}
else
{
v12 = *(_DWORD *)(v24 - 8);
*(_DWORD *)(v24 - 8) = v12 - 1;
}
if ( v12 <= 0 )
operator delete(v3);
}
v4 = (void *)(*(_QWORD *)&v23 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v23 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v13 = (unsigned int *)(*(_QWORD *)&v23 - 8LL);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
}
else
{
v14 = *(_DWORD *)(*(_QWORD *)&v23 - 8LL);
*(_DWORD *)(*(_QWORD *)&v23 - 8LL) = v14 - 1;
}
if ( v14 <= 0 )
operator delete(v4);
}
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v5);
cocos2d::CCPoint::CCPoint(&v21, v19 * 0.5, (float)(v20 * 0.5) + 85.0);
sub_D153B8((int)&v24, "Target:");
cocos2d::CCPoint::CCPoint(&v22, -100.0, 0.0);
cocos2d::CCPoint::operator+(&v23, &v21, &v22);
SetupTriggerPopup::createValueControl(a1, 0xB0u, 0.7, 0.0, 0.0, (__int64)&v24, &v23);
v6 = (void *)(v24 - 24);
if ( (__int64 *)(v24 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v15 = (unsigned int *)(v24 - 8);
do
v16 = __ldaxr(v15);
while ( __stlxr(v16 - 1, v15) );
}
else
{
v16 = *(_DWORD *)(v24 - 8);
*(_DWORD *)(v24 - 8) = v16 - 1;
}
if ( v16 <= 0 )
operator delete(v6);
}
sub_D153B8((int)&v24, "FadeTime:");
cocos2d::CCPoint::CCPoint(&v22, 100.0, 0.0);
cocos2d::CCPoint::operator+(&v23, &v21, &v22);
SetupTriggerPopup::createValueControl(a1, 0xAu, 0.7, 0.0, 0.0, (__int64)&v24, &v23);
v7 = (void *)(v24 - 24);
if ( (__int64 *)(v24 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v17 = (unsigned int *)(v24 - 8);
do
v18 = __ldaxr(v17);
while ( __stlxr(v18 - 1, v17) );
}
else
{
v18 = *(_DWORD *)(v24 - 8);
*(_DWORD *)(v24 - 8) = v18 - 1;
}
if ( v18 <= 0 )
operator delete(v7);
}
cocos2d::CCPoint::CCPoint(&v23, 0.0, -100.0);
cocos2d::CCPoint::operator+(&v24, &v21, &v23);
v25.x = 1.0;
SetupTriggerPopup::createEasingControls(a1, v25, v8, (int)&v24, 0);
}