// // ShaderLayer::setupShader from 0x10026dc64 to 0x10026e0a0 (1084 bytes) // // 2 xrefs: // > ShaderLayer::init @ 0x10026dbec // > ShaderLayer::update @ 0x10026ef64 // // 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 __fastcall ShaderLayer::setupShader(ShaderLayer *a1, bool a2) { _BOOL4 v2; // w20 cocos2d::CCSprite *m_sprite; // x0 cocos2d::CCRenderTexture *m_renderTexture; // x0 cocos2d::CCShaderCache *v6; // x0 cocos2d::CCGLProgram *v7; // x0 cocos2d::CCGLProgram *v8; // x20 cocos2d::CCShaderCache *v9; // x0 cocos2d::CCGLProgram *m_shader; // x20 void **v11; // x2 cocos2d::CCDirector *v12; // x0 double *v13; // x0 cocos2d::CCDirector *v19; // x0 float32x2_t v20; // d0 cocos2d::CCDirector *v21; // x0 float v22; // s8 cocos2d::CCDirector *v23; // x0 cocos2d::CCDirector *v24; // x0 cocos2d::CCDirector *v25; // x0 cocos2d::CCSprite *v26; // x20 __int64 v27; // x0 __int64 v28; // x0 __int64 v29; // x0 cocos2d::CCSprite *v30; // x20 GameManager *v31; // x0 bool GameVariable; // w0 __int64 v33; // x0 __int64 v34; // x0 float32x2_t v35; // [xsp+0h] [xbp-60h] __int64 v36; // [xsp+10h] [xbp-50h] BYREF void *__p[2]; // [xsp+18h] [xbp-48h] BYREF char v38; // [xsp+2Fh] [xbp-31h] v2 = a2; m_sprite = a1->m_sprite; if ( m_sprite ) { ((void (__fastcall *)(cocos2d::CCSprite *))m_sprite->removeMeAndCleanup)(m_sprite); a1->m_sprite = nullptr; } m_renderTexture = a1->m_renderTexture; if ( m_renderTexture ) { cocos2d::CCObject::release(m_renderTexture); a1->m_renderTexture = nullptr; } v6 = cocos2d::CCShaderCache::sharedShaderCache(); v7 = cocos2d::CCShaderCache::programForKey(v6, "custom_program"); a1->m_shader = v7; if ( v7 ) { if ( !v2 ) goto LABEL_15; cocos2d::CCGLProgram::reset(v7); } else { v8 = (cocos2d::CCGLProgram *)operator new(0x78u); cocos2d::CCGLProgram::CCGLProgram((__int64)v8); a1->m_shader = v8; v9 = cocos2d::CCShaderCache::sharedShaderCache(); cocos2d::CCShaderCache::addProgram(v9, a1->m_shader, "custom_program"); cocos2d::CCObject::release(a1->m_shader); } m_shader = a1->m_shader; sub_100009900(__p, aIfdefGlEsPreci_7); if ( v38 >= 0 ) v11 = __p; else v11 = (void **)__p[0]; cocos2d::CCGLProgram::initWithVertexShaderByteArray( m_shader, "\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", (const char *)v11); if ( v38 < 0 ) operator delete(__p[0]); cocos2d::CCGLProgram::addAttribute(a1->m_shader, "a_position", 0); cocos2d::CCGLProgram::addAttribute(a1->m_shader, "a_color", 1u); cocos2d::CCGLProgram::addAttribute(a1->m_shader, "a_texCoord", 2u); cocos2d::CCGLProgram::link(a1->m_shader); cocos2d::CCGLProgram::updateUniforms(a1->m_shader); GameManager::sharedState()->m_shouldResetShader = 0; LABEL_15: v12 = cocos2d::CCDirector::sharedDirector(); v13 = (double *)((__int64 (__fastcall *)(cocos2d::CCEGLView *))v12->m_pobOpenGLView->getFrameSize)(v12->m_pobOpenGLView); sub_100022AFC(&v36, v13); sub_100022B14(&a1->m_screenSize, (double *)&v36); __asm { FMOV V0.2S, #1.0 } _D0.i32[0] = HIDWORD(v36); v35 = _D0; v19 = cocos2d::CCDirector::sharedDirector(); cocos2d::CCDirector::getWinSize(v19); v20.i32[0] = HIDWORD(__p[0]); v20.f32[1] = a1->m_screenSize.height / a1->m_screenSize.width; *(float32x2_t *)&a1->m_scaleFactor = vdiv_f32(v35, v20); v21 = cocos2d::CCDirector::sharedDirector(); v22 = sub_1001765E4((__int64)v21); v23 = cocos2d::CCDirector::sharedDirector(); cocos2d::CCDirector::setContentScaleFactor(v23, 1.0); a1->m_renderTexture = cocos2d::CCRenderTexture::create( (int)*(float *)&v36, (int)*((float *)&v36 + 1), kCCTexture2DPixelFormat_RGBA8888); v24 = cocos2d::CCDirector::sharedDirector(); cocos2d::CCDirector::setContentScaleFactor(v24, v22); v25 = cocos2d::CCDirector::sharedDirector(); a1->m_shockWaveTimeMult = (float)(1.0 / sub_1001768C0((__int64)v25)) * *(float *)&dword_10086D7F0; sub_100022988((float *)__p, 0.0, 0.0); sub_100022B14(&a1->m_targetTextureSizeExtra, (double *)__p); cocos2d::CCObject::retain(a1->m_renderTexture); v26 = cocos2d::CCSprite::create_1(); a1->m_sprite = v26; v27 = ((__int64 (__fastcall *)(cocos2d::CCRenderTexture *))a1->m_renderTexture->getSprite)(a1->m_renderTexture); v28 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v27 + 1056LL))(v27); ((void (__fastcall *)(cocos2d::CCSprite *, __int64))v26->setTexture)(v26, v28); v29 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))a1->m_sprite->getTexture)(a1->m_sprite); (*(void (__fastcall **)(void **__return_ptr))(*(_QWORD *)v29 + 144LL))(__p); sub_100022B14(&a1->m_textureContentSize, (double *)__p); sub_100022988((float *)__p, *(float *)&v36, *((float *)&v36 + 1)); sub_100022B14(&a1->m_targetTextureSize, (double *)__p); v30 = a1->m_sprite; sub_100022990((float *)__p, -1.0, -1.0, a1->m_targetTextureSize.width + 2.0, a1->m_targetTextureSize.height + 2.0); ((void (__fastcall *)(cocos2d::CCSprite *, void **))v30->setTextureRect)(v30, __p); ((void (__fastcall *)(cocos2d::CCSprite *, double *))a1->m_sprite->setPosition)(a1->m_sprite, &dbl_10086D7C0); ((void (__fastcall *)(cocos2d::CCSprite *, double *))a1->m_sprite->setAnchorPoint)(a1->m_sprite, &dbl_10086D7C0); cocos2d::CCSprite::setFlipY(a1->m_sprite, 1); ((void (__fastcall *)(ShaderLayer *, cocos2d::CCSprite *))a1->addChild)(a1, a1->m_sprite); v31 = GameManager::sharedState(); GameVariable = GameManager::getGameVariable(v31, "0155"); a1->m_configuredAntiAlias = !GameVariable; ShaderLayer::toggleAntiAlias(a1, !GameVariable); ((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCGLProgram *))a1->m_sprite->setShaderProgram)( a1->m_sprite, a1->m_shader); ShaderLayer::setupCommonUniforms(a1); ShaderLayer::setupShockWaveUniforms(a1); ShaderLayer::setupShockLineUniforms(a1); ShaderLayer::setupGlitchUniforms(a1); ShaderLayer::setupChromaticUniforms(a1); ShaderLayer::setupChromaticGlitchUniforms(a1); ShaderLayer::setupLensCircleShader(a1); ShaderLayer::setupRadialBlurShader(a1); ShaderLayer::setupBulgeShader(a1); ShaderLayer::setupPinchShader(a1); ShaderLayer::setupMotionBlurShader(a1); ShaderLayer::setupGrayscaleShader(a1); v33 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))a1->m_sprite->getShaderProgram)(a1->m_sprite); a1->m_sepiaValueUniform = glGetUniformLocation(*(_DWORD *)(v33 + 56), "_sepiaValue"); v34 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))a1->m_sprite->getShaderProgram)(a1->m_sprite); a1->m_invertColorValueUniform = glGetUniformLocation(*(_DWORD *)(v34 + 56), "_invertColorValue"); ShaderLayer::setupHueShiftShader(a1); ShaderLayer::setupColorChangeShader(a1); ShaderLayer::setupSplitScreenShader(a1); }
GD Web Decomp Icon

GD Web Decomp

Raw Source