{"type": "func", "start": 5373452448, "end": 5373452880, "name": "ShaderLayer::prePixelateShader", "pseudocode": "// \n// ShaderLayer::prePixelateShader from 0x1404860a0 to 0x140486250 (432 bytes)\n// \n// 2 xrefs:\n// > ShaderLayer::performCalculations @ 0x140488130\n// > <???> @ 0x1406dbd14\n// \n// This function is hookable on this platform!\n// \n// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings\n// \n\nvoid ShaderLayer::prePixelateShader(ShaderLayer *a1)\n{\n  float *p_m_pixelateTargetY; // rdi\n  bool m_configuredAntiAlias; // dl\n  float m_pixelateTargetX; // xmm8_4\n  float v5; // xmm7_4\n  float m_scaleFactor; // xmm9_4\n  GJBaseGameLayer *m_gameLayer; // rcx\n  float v8; // xmm0_4\n  bool m_pixelatePixelating; // al\n  float v10; // xmm0_4\n  cocos2d::CCRenderTexture *m_renderTexture; // rcx\n  float v12; // xmm7_4\n  float v13; // xmm1_4\n  float v14; // xmm2_4\n\n  if ( a1->m_state.m_pixelateTargetX > 1.0\n    || (p_m_pixelateTargetY = &a1->m_state.m_pixelateTargetY, a1->m_state.m_pixelateTargetY > 1.0)\n    || cocos2d::CCNode::getActionByTag(a1, 9)\n    || cocos2d::CCNode::getActionByTag(a1, 10) )\n  {\n    a1->m_state.m_usesShaders = 1;\n    p_m_pixelateTargetY = &a1->m_state.m_pixelateTargetY;\n    a1->m_state.m_pixelatePixelating = 1;\n    m_configuredAntiAlias = !a1->m_state.m_pixelateHardEdges;\n  }\n  else\n  {\n    a1->m_state.m_pixelatePixelating = 0;\n    m_configuredAntiAlias = a1->m_configuredAntiAlias;\n  }\n  ShaderLayer::toggleAntiAlias(a1, m_configuredAntiAlias);\n  m_pixelateTargetX = a1->m_state.m_pixelateTargetX;\n  if ( m_pixelateTargetX < 1.0 )\n  {\n    a1->m_state.m_pixelateTargetX = 1.0;\n    m_pixelateTargetX = 1.0;\n  }\n  v5 = *p_m_pixelateTargetY;\n  if ( *p_m_pixelateTargetY < 1.0 )\n  {\n    *p_m_pixelateTargetY = 1.0;\n    v5 = 1.0;\n  }\n  m_scaleFactor = a1->m_scaleFactor;\n  if ( a1->m_state.m_pixelateRelative && (m_gameLayer = a1->m_gameLayer) != nullptr )\n  {\n    v8 = fabs(COERCE_FLOAT(COERCE_UNSIGNED_INT64(((double (__fastcall *)(cocos2d::CCLayer *))m_gameLayer->m_objectLayer->getScale)(m_gameLayer->m_objectLayer))));\n    m_pixelateTargetX = a1->m_state.m_pixelateTargetX;\n    v5 = *p_m_pixelateTargetY;\n  }\n  else\n  {\n    v8 = 1.0;\n  }\n  m_pixelatePixelating = a1->m_state.m_pixelatePixelating;\n  if ( m_pixelatePixelating )\n    v10 = v8 * m_scaleFactor;\n  else\n    v10 = 1.0;\n  m_renderTexture = a1->m_renderTexture;\n  v12 = v5 * v10;\n  v13 = 1.0 / (float)(m_pixelateTargetX * v10);\n  a1->m_state.m_textureScaleX = v13;\n  a1->m_state.m_textureScaleY = 1.0 / v12;\n  if ( m_pixelatePixelating )\n  {\n    v14 = 1.0 / v12;\n  }\n  else\n  {\n    v14 = 0.0;\n    v13 = 0.0;\n  }\n  cocos2d::CCRenderTexture::updateInternalScale(m_renderTexture, v13, v14);\n  ((void (__fastcall *)(cocos2d::CCSprite *))a1->m_sprite->setScaleX)(a1->m_sprite);\n  ((void (__fastcall *)(cocos2d::CCSprite *))a1->m_sprite->setScaleY)(a1->m_sprite);\n}", "assembly": "; \n; ShaderLayer::prePixelateShader from 0x1404860a0 to 0x140486250 (432 bytes)\n; \n; 2 xrefs:\n; > ShaderLayer::performCalculations @ 0x140488130\n; > <???> @ 0x1406dbd14\n; \n; This function is hookable on this platform!\n; \n; Using BromaIDA 8.0.0 @ https:;github.com/Stazzical/BromaIDA\n; Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https:;github.com/geode-sdk/bindings\n; \n\nmov     [rsp+arg_0], rbx                                               ; +0x0, 0x1404860a0\npush    rdi                                                            ; +0x5, 0x1404860a5\nsub     rsp, 60h                                                       ; +0x6, 0x1404860a6\nmovss   xmm0, dword ptr [rcx+334h]                                     ; +0xa, 0x1404860aa\nmov     rbx, rcx                                                       ; +0x12, 0x1404860b2\nmovaps  [rsp+68h+var_18], xmm6                                         ; +0x15, 0x1404860b5\nmovss   xmm6, cs:flt_140622C24                                         ; +0x1a, 0x1404860ba\ncomiss  xmm0, xmm6                                                     ; +0x22, 0x1404860c2\nmovaps  [rsp+68h+var_28], xmm7                                         ; +0x25, 0x1404860c5\nmovaps  [rsp+68h+var_38], xmm8                                         ; +0x2a, 0x1404860ca\nmovaps  [rsp+68h+var_48], xmm9                                         ; +0x30, 0x1404860d0\nja      short loc_140486118                                            ; +0x36, 0x1404860d6\nlea     rdi, [rcx+338h]                                                ; +0x38, 0x1404860d8\nmovss   xmm0, dword ptr [rdi]                                          ; +0x3f, 0x1404860df\ncomiss  xmm0, xmm6                                                     ; +0x43, 0x1404860e3\nja      short loc_140486118                                            ; +0x46, 0x1404860e6\nmov     edx, 9                                                         ; +0x48, 0x1404860e8\ncall    cs:?getActionByTag@CCNode@cocos2d@@QEAAPEAVCCAction@2@H@Z; cocos2d::CCNode::getActionByTag(int) ; +0x4d, 0x1404860ed\ntest    rax, rax                                                       ; +0x53, 0x1404860f3\njnz     short loc_140486118                                            ; +0x56, 0x1404860f6\nlea     edx, [rax+0Ah]                                                 ; +0x58, 0x1404860f8\nmov     rcx, rbx                                                       ; +0x5b, 0x1404860fb\ncall    cs:?getActionByTag@CCNode@cocos2d@@QEAAPEAVCCAction@2@H@Z; cocos2d::CCNode::getActionByTag(int) ; +0x5e, 0x1404860fe\ntest    rax, rax                                                       ; +0x64, 0x140486104\njnz     short loc_140486118                                            ; +0x67, 0x140486107\nmov     [rbx+33Dh], al                                                 ; +0x69, 0x140486109\nmovzx   edx, byte ptr [rbx+481h]                                       ; +0x6f, 0x14048610f\njmp     short loc_140486137                                            ; +0x76, 0x140486116\nmov     byte ptr [rbx+45Eh], 1                                         ; +0x78, 0x140486118\nlea     rdi, [rbx+338h]                                                ; +0x7f, 0x14048611f\nmov     byte ptr [rbx+33Dh], 1                                         ; +0x86, 0x140486126\ncmp     byte ptr [rbx+33Fh], 0                                         ; +0x8d, 0x14048612d\nsetz    dl                                                             ; +0x94, 0x140486134\nmov     rcx, rbx                                                       ; +0x97, 0x140486137\ncall    ShaderLayer__toggleAntiAlias                                   ; +0x9a, 0x14048613a\nmovss   xmm8, dword ptr [rbx+334h]                                     ; +0x9f, 0x14048613f\ncomiss  xmm6, xmm8                                                     ; +0xa8, 0x140486148\njbe     short loc_14048615C                                            ; +0xac, 0x14048614c\nmov     dword ptr [rbx+334h], 3F800000h                                ; +0xae, 0x14048614e\nmovaps  xmm8, xmm6                                                     ; +0xb8, 0x140486158\nmovss   xmm7, dword ptr [rdi]                                          ; +0xbc, 0x14048615c\ncomiss  xmm6, xmm7                                                     ; +0xc0, 0x140486160\njbe     short loc_14048616E                                            ; +0xc3, 0x140486163\nmov     dword ptr [rdi], 3F800000h                                     ; +0xc5, 0x140486165\nmovaps  xmm7, xmm6                                                     ; +0xcb, 0x14048616b\ncmp     byte ptr [rbx+33Eh], 0                                         ; +0xce, 0x14048616e\nmovss   xmm9, dword ptr [rbx+4A8h]                                     ; +0xd5, 0x140486175\njz      short loc_1404861B2                                            ; +0xde, 0x14048617e\nmov     rcx, [rbx+490h]                                                ; +0xe0, 0x140486180\ntest    rcx, rcx                                                       ; +0xe7, 0x140486187\njz      short loc_1404861B2                                            ; +0xea, 0x14048618a\nmov     rcx, [rcx+0FE8h]                                               ; +0xec, 0x14048618c\nmov     rax, [rcx]                                                     ; +0xf3, 0x140486193\ncall    qword ptr [rax+0A8h]                                           ; +0xf6, 0x140486196\nandps   xmm0, cs:xmmword_1406243C0                                     ; +0xfc, 0x14048619c\nmovss   xmm8, dword ptr [rbx+334h]                                     ; +0x103, 0x1404861a3\nmovss   xmm7, dword ptr [rdi]                                          ; +0x10c, 0x1404861ac\njmp     short loc_1404861B5                                            ; +0x110, 0x1404861b0\nmovaps  xmm0, xmm6                                                     ; +0x112, 0x1404861b2\nmovzx   eax, byte ptr [rbx+33Dh]                                       ; +0x115, 0x1404861b5\ntest    al, al                                                         ; +0x11c, 0x1404861bc\njz      short loc_1404861C7                                            ; +0x11e, 0x1404861be\nmulss   xmm0, xmm9                                                     ; +0x120, 0x1404861c0\njmp     short loc_1404861CA                                            ; +0x125, 0x1404861c5\nmovaps  xmm0, xmm6                                                     ; +0x127, 0x1404861c7\nmov     rcx, [rbx+470h]                                                ; +0x12a, 0x1404861ca\nmovaps  xmm1, xmm6                                                     ; +0x131, 0x1404861d1\nmulss   xmm8, xmm0                                                     ; +0x134, 0x1404861d4\nmulss   xmm7, xmm0                                                     ; +0x139, 0x1404861d9\ndivss   xmm1, xmm8                                                     ; +0x13d, 0x1404861dd\ndivss   xmm6, xmm7                                                     ; +0x142, 0x1404861e2\nmovss   dword ptr [rbx+230h], xmm1                                     ; +0x146, 0x1404861e6\nmovss   dword ptr [rbx+234h], xmm6                                     ; +0x14e, 0x1404861ee\ntest    al, al                                                         ; +0x156, 0x1404861f6\njz      short loc_1404861FF                                            ; +0x158, 0x1404861f8\nmovaps  xmm2, xmm6                                                     ; +0x15a, 0x1404861fa\njmp     short loc_140486205                                            ; +0x15d, 0x1404861fd\nxorps   xmm2, xmm2                                                     ; +0x15f, 0x1404861ff\nxorps   xmm1, xmm1                                                     ; +0x162, 0x140486202\ncall    cs:?updateInternalScale@CCRenderTexture@cocos2d@@QEAAXMM@Z; cocos2d::CCRenderTexture::updateInternalScale(float,float) ; +0x165, 0x140486205\nmov     rcx, [rbx+478h]                                                ; +0x16b, 0x14048620b\nmovaps  xmm1, xmm8                                                     ; +0x172, 0x140486212\nmov     rax, [rcx]                                                     ; +0x176, 0x140486216\ncall    qword ptr [rax+78h]                                            ; +0x179, 0x140486219\nmov     rcx, [rbx+478h]                                                ; +0x17c, 0x14048621c\nmovaps  xmm1, xmm7                                                     ; +0x183, 0x140486223\nmov     rax, [rcx]                                                     ; +0x186, 0x140486226\nmov     rbx, [rsp+68h+arg_0]                                           ; +0x189, 0x140486229\nmovaps  xmm6, [rsp+68h+var_18]                                         ; +0x18e, 0x14048622e\nmovaps  xmm7, [rsp+68h+var_28]                                         ; +0x193, 0x140486233\nmovaps  xmm8, [rsp+68h+var_38]                                         ; +0x198, 0x140486238\nmovaps  xmm9, [rsp+68h+var_48]                                         ; +0x19e, 0x14048623e\nadd     rsp, 60h                                                       ; +0x1a4, 0x140486244\npop     rdi                                                            ; +0x1a8, 0x140486248\njmp     qword ptr [rax+88h]                                            ; +0x1a9, 0x140486249", "xrefs": ["ShaderLayer::performCalculations @ 0x140488130", "<???> @ 0x1406dbd14"], "is_objc": false, "is_arm32": false, "is_arm64": false, "bida_info": "8.0.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings"}