// // cocos2d::CCImage::_initWithPngData from 0x7eb8c0 to 0x7ebaec (556 bytes) // // 1 xrefs: // > cocos2d::CCImage::initWithImageData @ 0x7ebca6 // // This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False! // // 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 12:00:59 +0000 // int __fastcall cocos2d::CCImage::_initWithPngData(cocos2d::CCImage *this, int *a2, int a3) { int v3; // r0 int v4; // r1 struct __jmp_buf_tag *v5; // r0 __int16 image_width; // r0 int v7; // r1 __int16 image_height; // r0 int v9; // r1 int bit_depth; // r0 int v11; // r1 int color_type; // r0 char v13; // r4 int v14; // r0 _DWORD *v15; // r5 unsigned int rowbytes; // r4 int v17; // r0 _DWORD *v18; // r2 _DWORD *v19; // r3 unsigned __int16 v20; // r6 unsigned int *v21; // r2 unsigned int *v22; // r7 unsigned int i; // r1 unsigned __int8 *v24; // r12 int v25; // r8 int v28; // [sp+4h] [bp-38h] int v31; // [sp+18h] [bp-24h] BYREF int info_struct; // [sp+1Ch] [bp-20h] _DWORD v33[3]; // [sp+20h] [bp-1Ch] BYREF int v34; // [sp+2Ch] [bp-10h] BYREF int v35; // [sp+30h] [bp-Ch] v28 = 0; v34 = 0; v35 = 0; v31 = 0; info_struct = 0; if ( a3 > 7 ) { v3 = *a2; v4 = a2[1]; v34 = v3; v35 = v4; if ( !png_sig_cmp(&v34, 0, 8) ) { v31 = png_create_read_struct("1.6.16", 0, 0, 0); if ( v31 ) { info_struct = png_create_info_struct(); if ( info_struct ) { v5 = (struct __jmp_buf_tag *)png_set_longjmp_fn(v31, &longjmp, 256); if ( !setjmp(v5) ) { v33[2] = 0; v33[0] = a2; v33[1] = a3; png_set_read_fn(v31, v33, sub_7EB660); png_read_info(v31, info_struct); image_width = png_get_image_width(v31, info_struct); v7 = info_struct; *((_WORD *)this + 26) = image_width; image_height = png_get_image_height(v31, v7); v9 = info_struct; *((_WORD *)this + 27) = image_height; bit_depth = png_get_bit_depth(v31, v9); v11 = info_struct; *((_DWORD *)this + 14) = bit_depth; color_type = png_get_color_type(v31, v11); v13 = color_type; if ( color_type == 3 ) { png_set_palette_to_rgb(v31); } else if ( !color_type && *((int *)this + 14) <= 7 ) { png_set_expand_gray_1_2_4_to_8(v31); } if ( png_get_valid(v31, info_struct, 16) ) png_set_tRNS_to_alpha(v31); if ( *((_DWORD *)this + 14) == 16 ) png_set_strip_16(v31); if ( (v13 & 0xFB) == 0 ) png_set_gray_to_rgb(v31); v14 = *((unsigned __int16 *)this + 27); *((_DWORD *)this + 14) = 8; v15 = malloc(4 * v14); png_read_update_info(v31, info_struct); rowbytes = png_get_rowbytes(v31, info_struct); v17 = operator new[](*((unsigned __int16 *)this + 27) * rowbytes); v18 = v15; *((_DWORD *)this + 15) = v17; v19 = &v15[*((unsigned __int16 *)this + 27)]; while ( v18 != v19 ) { *v18++ = v17; v17 += rowbytes; } png_read_image(v31, v15); png_read_end(v31, 0); if ( rowbytes / *((unsigned __int16 *)this + 26) == 4 ) { v20 = 0; *((_BYTE *)this + 64) = 1; v21 = *((unsigned int **)this + 15); while ( *((unsigned __int16 *)this + 27) > (unsigned int)v20 ) { v22 = v21; for ( i = 0; ; i += 4 ) { v21 = v22; if ( i >= rowbytes ) break; v24 = (unsigned __int8 *)(v15[v20] + i); v25 = v24[3]; *v22++ = (v24[1] * (v25 + 1)) & 0xFFFFFF00 | (((v25 + 1) * (unsigned int)*v24) >> 8) | (v25 << 24) | (((v25 + 1) * v24[2]) >> 8 << 16); } ++v20; } *((_BYTE *)this + 65) = 1; } if ( v15 ) free(v15); v28 = 1; } } } } } if ( v31 ) png_destroy_read_struct(&v31); return v28; }
GD Web Decomp Icon

GD Web Decomp

Raw Source