//
// sub_10030BA7C from 0x10030ba7c to 0x10030beb8 (1084 bytes)
//
// 2 xrefs:
// > ShaderLayer::init @ 0x10030ba04
// > ShaderLayer::update @ 0x10030cd7c
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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:03:11 +0000
//
__int64 __fastcall sub_10030BA7C(__int64 a1, int a2)
{
__int64 v4; // x0
_DWORD *v5; // x0
__int64 v6; // x0
__int64 v7; // x0
void *v8; // x20
__int64 v9; // x0
__int64 v10; // x20
void **v11; // x2
__int64 updated; // x0
__int64 v13; // x0
double *v14; // x0
__int64 v20; // x0
float32x2_t v21; // d0
__int64 v22; // x0
float v23; // s8
__int64 v24; // x0
__int64 v25; // x0
__int64 v26; // x0
void *v27; // x20
__int64 v28; // x0
__int64 v29; // x0
__int64 v30; // x0
__int64 v31; // x20
__int64 v32; // x0
__int64 v33; // x0
__n128 GameVariable; // q0
char v35; // w0
__int64 v36; // x0
__int64 v37; // x0
float32x2_t v39; // [xsp+0h] [xbp-60h]
__int64 v40; // [xsp+10h] [xbp-50h] BYREF
void *__p[2]; // [xsp+18h] [xbp-48h] BYREF
char v42; // [xsp+2Fh] [xbp-31h]
v4 = *(_QWORD *)(a1 + 1104);
if ( v4 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v4 + 536LL))(v4);
*(_QWORD *)(a1 + 1104) = 0;
}
v5 = *(_DWORD **)(a1 + 1096);
if ( v5 )
{
cocos2d::CCObject::release(v5);
*(_QWORD *)(a1 + 1096) = 0;
}
v6 = cocos2d::CCShaderCache::sharedShaderCache();
v7 = cocos2d::CCShaderCache::programForKey(v6, "custom_program");
*(_QWORD *)(a1 + 1088) = v7;
if ( v7 )
{
if ( !a2 )
goto LABEL_15;
cocos2d::CCGLProgram::reset(v7);
}
else
{
v8 = operator new(0x78u);
cocos2d::CCGLProgram::CCGLProgram((__int64)v8);
*(_QWORD *)(a1 + 1088) = v8;
v9 = cocos2d::CCShaderCache::sharedShaderCache();
cocos2d::CCShaderCache::addProgram(v9, *(_QWORD *)(a1 + 1088), "custom_program");
cocos2d::CCObject::release(*(_DWORD **)(a1 + 1088));
}
v10 = *(_QWORD *)(a1 + 1088);
sub_100009900(__p, aIfdefGlEsPreci_7);
if ( v42 >= 0 )
v11 = __p;
else
v11 = (void **)__p[0];
cocos2d::CCGLProgram::initWithVertexShaderByteArray(
v10,
(__int64)"\t\t\t\t\t\t\t\t\t\t\t\t\t\n"
"\t\tattribute vec4 a_position;\t\t\t\t\t\t\t\n"
"\t\tattribute vec2 a_texCoord;\t\t\t\t\t\t\t\n"
"\t\tattribute vec4 a_color;\t\t\t\t\t\t\t\t\n"
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n"
"\t\t#ifdef GL_ES\t\t\t\t\t\t\t\t\t\t\n"
"\t\t\tvarying lowp vec4 v_fragmentColor;\t\t\t\t\n"
"\t\t\tvarying mediump vec2 v_texCoord;\t\t\t\t\n"
"\t\t#else\t\t\t\t\t\t\t\t\t\t\t\t\n"
"\t\t\tvarying vec4 v_fragmentColor;\t\t\t\t\t\n"
"\t\t\tvarying vec2 v_texCoord;\t\t\t\t\t\t\n"
"\t\t#endif\t\t\t\t\t\t\t\t\t\t\t\t\n"
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n"
"\t\tvoid main()\t\t\t\t\t\t\t\t\t\t\t\n"
"\t\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\n"
"\t\t\tgl_Position = CC_MVPMatrix * a_position;\t\t\n"
"\t\t\tv_fragmentColor = a_color;\t\t\t\t\t\t\n"
"\t\t\tv_texCoord = a_texCoord;\t\t\t\t\t\t\n"
"\t\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\n"
"\t\t",
(__int64)v11);
if ( v42 < 0 )
operator delete(__p[0]);
cocos2d::CCGLProgram::addAttribute(*(_QWORD *)(a1 + 1088), "a_position", 0);
cocos2d::CCGLProgram::addAttribute(*(_QWORD *)(a1 + 1088), "a_color", 1u);
cocos2d::CCGLProgram::addAttribute(*(_QWORD *)(a1 + 1088), "a_texCoord", 2u);
cocos2d::CCGLProgram::link(*(GLuint **)(a1 + 1088));
updated = cocos2d::CCGLProgram::updateUniforms(*(_QWORD *)(a1 + 1088));
*(_BYTE *)(GameManager::sharedState(updated) + 1700) = 0;
LABEL_15:
v13 = cocos2d::CCDirector::sharedDirector();
v14 = (double *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(v13 + 192) + 48LL))(*(_QWORD *)(v13 + 192));
sub_100026438(&v40, v14);
sub_100026450((_QWORD *)(a1 + 1160), (double *)&v40);
__asm { FMOV V0.2S, #1.0 }
_D0.i32[0] = HIDWORD(v40);
v39 = _D0;
v20 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v20, __p);
v21.i32[0] = HIDWORD(__p[0]);
v21.f32[1] = *(float *)(a1 + 1164) / *(float *)(a1 + 1160);
*(float32x2_t *)(a1 + 1152) = vdiv_f32(v39, v21);
v22 = cocos2d::CCDirector::sharedDirector();
v23 = sub_100207B64(v22);
v24 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::setContentScaleFactor(v24, 1.0);
*(_QWORD *)(a1 + 1096) = cocos2d::CCRenderTexture::create(
(unsigned int)(int)*(float *)&v40,
(unsigned int)(int)*((float *)&v40 + 1),
0);
v25 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::setContentScaleFactor(v25, v23);
v26 = cocos2d::CCDirector::sharedDirector();
*(float *)(a1 + 1148) = (float)(1.0 / sub_100207E90(v26)) * *(float *)&dword_1009F66B0;
sub_1000262C4((float *)__p, 0.0, 0.0);
sub_100026450((_QWORD *)(a1 + 1184), (double *)__p);
cocos2d::CCObject::retain(*(_QWORD *)(a1 + 1096));
v27 = cocos2d::CCSprite::create_1();
*(_QWORD *)(a1 + 1104) = v27;
v28 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1096) + 896LL))(*(_QWORD *)(a1 + 1096));
v29 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v28 + 1072LL))(v28);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v27 + 1064LL))(v27, v29);
v30 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1104) + 1072LL))(*(_QWORD *)(a1 + 1104));
(*(void (__fastcall **)(void **__return_ptr))(*(_QWORD *)v30 + 144LL))(__p);
sub_100026450((_QWORD *)(a1 + 1168), (double *)__p);
sub_1000262C4((float *)__p, *(float *)&v40, *((float *)&v40 + 1));
sub_100026450((_QWORD *)(a1 + 1176), (double *)__p);
v31 = *(_QWORD *)(a1 + 1104);
sub_1000262CC((float *)__p, -1.0, -1.0, *(float *)(a1 + 1176) + 2.0, *(float *)(a1 + 1180) + 2.0);
(*(void (__fastcall **)(__int64, void **))(*(_QWORD *)v31 + 1136LL))(v31, __p);
(*(void (__fastcall **)(_QWORD, double *))(**(_QWORD **)(a1 + 1104) + 184LL))(*(_QWORD *)(a1 + 1104), &dbl_1009F6680);
(*(void (__fastcall **)(_QWORD, double *))(**(_QWORD **)(a1 + 1104) + 296LL))(*(_QWORD *)(a1 + 1104), &dbl_1009F6680);
cocos2d::CCSprite::setFlipY(*(unsigned __int8 **)(a1 + 1104), 1);
v32 = (*(__int64 (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 456LL))(a1, *(_QWORD *)(a1 + 1104));
v33 = GameManager::sharedState(v32);
GameVariable = GameManager::getGameVariable(v33, "0155");
*(_BYTE *)(a1 + 1113) = v35 ^ 1;
sub_10030BF54(a1, GameVariable);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 1104) + 664LL))(
*(_QWORD *)(a1 + 1104),
*(_QWORD *)(a1 + 1088));
sub_10030BFB8(a1);
sub_10030C13C(a1);
sub_10030C308(a1);
sub_10030C4D4(a1);
sub_10030C5A4(a1);
sub_10030C608(a1);
sub_10030C720(a1);
sub_10030C814(a1);
sub_10030C878(a1);
sub_10030C924(a1);
sub_10030C9D0(a1);
sub_10030CA58(a1);
v36 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1104) + 656LL))(*(_QWORD *)(a1 + 1104));
*(_DWORD *)(a1 + 1536) = glGetUniformLocation(*(_DWORD *)(v36 + 56), "_sepiaValue");
v37 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1104) + 656LL))(*(_QWORD *)(a1 + 1104));
*(_DWORD *)(a1 + 1540) = glGetUniformLocation(*(_DWORD *)(v37 + 56), "_invertColorValue");
sub_10030CAE0(a1);
sub_10030CB44(a1);
return sub_10030CBA8(a1);
}