// // cocos2d::CCImage::_initWithPngData from 0x18007e7d0 to 0x18007eb29 (857 bytes) // // 6 xrefs: // > cocos2d::CCImage::initWithImageData @ 0x18007fc76 // > cocos2d::CCImage::initWithImageFile @ 0x18007fd72 // > cocos2d::CCImage::initWithImageFile @ 0x18007fddd // > cocos2d::CCImage::initWithImageFileThreadSafe @ 0x18007ff1a // > @ 0x18014cf68 // > @ 0x1801bf01c // // This function is hookable on this platform (idp: pc, 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:22:01 +0000 // __int64 __fastcall cocos2d::CCImage::_initWithPngData(cocos2d::CCImage *this, _QWORD *a2, int a3) { unsigned __int8 v3; // bl __int64 v4; // rax __int64 v5; // rax cocos2d::CCImage *v6; // rdi char color_type; // bl char *v8; // r12 unsigned int rowbytes; // esi __int64 v10; // rax unsigned __int16 v11; // r9 unsigned __int16 v12; // dx char *v13; // r8 __int64 v14; // rcx unsigned __int16 v15; // bx unsigned int *i; // r14 unsigned int v17; // r11d char *v18; // r15 int v19; // r10d __int64 v20; // rax unsigned int v21; // r9d __int64 *p_info_struct; // rdx __int64 v24; // [rsp+0h] [rbp-70h] BYREF char v25; // [rsp+20h] [rbp-50h] __int64 v26; // [rsp+28h] [rbp-48h] BYREF __int64 info_struct; // [rsp+30h] [rbp-40h] BYREF int v28; // [rsp+38h] [rbp-38h] _QWORD *v29; // [rsp+40h] [rbp-30h] cocos2d::CCImage *v30; // [rsp+48h] [rbp-28h] _QWORD *v31; // [rsp+50h] [rbp-20h] BYREF int v32; // [rsp+58h] [rbp-18h] int v33; // [rsp+5Ch] [rbp-14h] __int64 v34; // [rsp+60h] [rbp-10h] BYREF v30 = this; v3 = 0; v29 = a2; v28 = a3; v25 = 0; v34 = 0; v26 = 0; info_struct = 0; if ( a3 >= 8 ) { v34 = *a2; if ( !(unsigned int)png_sig_cmp(&v34, 0, 8) ) { v4 = png_create_read_struct("1.6.40", 0, 0, 0); v26 = v4; if ( v4 ) { info_struct = png_create_info_struct(v4); if ( info_struct ) { v5 = png_set_longjmp_fn(v26, longjmp, 256); if ( (unsigned int)_intrinsic_setjmp(v5, &v24) ) goto LABEL_31; v31 = v29; v32 = v28; v33 = 0; png_set_read_fn(v26, &v31, &sub_180080300); png_read_info(v26, info_struct); v6 = v30; *((_WORD *)v6 + 28) = png_get_image_width(v26, info_struct); *((_WORD *)v6 + 29) = png_get_image_height(v26, info_struct); *((_DWORD *)v6 + 15) = (unsigned __int8)png_get_bit_depth(v26, info_struct); color_type = png_get_color_type(v26, info_struct); if ( color_type == 3 ) png_set_palette_to_rgb(v26); if ( !color_type && *((int *)v6 + 15) < 8 ) png_set_expand_gray_1_2_4_to_8(v26); if ( (unsigned int)png_get_valid(v26, info_struct, 16) ) png_set_tRNS_to_alpha(v26); if ( *((_DWORD *)v6 + 15) == 16 ) png_set_strip_16(v26); if ( (color_type & 0xFB) == 0 ) png_set_gray_to_rgb(v26); *((_DWORD *)v6 + 15) = 8; v8 = (char *)malloc(8LL * *((unsigned __int16 *)v6 + 29)); png_read_update_info(v26, info_struct); rowbytes = png_get_rowbytes(v26, info_struct); v10 = sub_1800E4C6C(rowbytes * *((unsigned __int16 *)v6 + 29)); *((_QWORD *)v6 + 8) = v10; if ( !v10 ) { LABEL_31: v3 = v25; } else { v11 = *((_WORD *)v6 + 29); v12 = 0; if ( v11 ) { v13 = v8; do { v13 += 8; v14 = rowbytes * v12++; *((_QWORD *)v13 - 1) = v10 + v14; } while ( v12 < v11 ); } png_read_image(v26, v8); png_read_end(v26, 0); if ( rowbytes / *((unsigned __int16 *)v6 + 28) == 4 ) { *((_BYTE *)v6 + 72) = 1; v15 = 0; for ( i = *((unsigned int **)v6 + 8); v15 < *((_WORD *)v6 + 29); ++v15 ) { if ( rowbytes ) { v17 = 2; v18 = &v8[8 * v15]; do { v19 = *(unsigned __int8 *)(v17 + 1 + *(_QWORD *)v18); v20 = v17 - 2; v21 = ((v19 + 1) * *(unsigned __int8 *)(v17 - 1 + *(_QWORD *)v18)) & 0xFFFFFF00 | ((((v19 + 1) * *(unsigned __int8 *)(v17 + *(_QWORD *)v18)) & 0xFFFFFF00) << 8); v17 += 4; *i++ = (v19 << 24) | (((v19 + 1) * (unsigned int)*(unsigned __int8 *)(v20 + *(_QWORD *)v18)) >> 8) | v21; } while ( v17 - 2 < rowbytes ); } } *((_BYTE *)v6 + 73) = 1; } if ( v8 ) free(v8); v3 = 1; v25 = 1; } } } } } if ( v26 ) { p_info_struct = &info_struct; if ( !info_struct ) p_info_struct = nullptr; png_destroy_read_struct(&v26, p_info_struct, 0); } return v3; }