// // cocos2d::CCImage::initWithString from 0x10047f740 to 0x10047fe13 (1747 bytes) // // 1 xrefs: // > cocos2d::CCTexture2D::initWithString @ 0x10046d9b6 // // 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 12:30:39 +0000 // __int64 __fastcall cocos2d::CCImage::initWithString( __int64 a1, __int64 a2, int a3, int a4, unsigned int a5, __int64 a6, double a7, double a8, int a9) { NSFontManager *v10; // r12 NSString *v11; // rax double v12; // xmm0_8 NSFont *v13; // rax NSFontManager *v14; // rax unsigned int v15; // r14d NSFont *v16; // rbx NSColor *v17; // r14 int v18; // eax __int64 v19; // r12 NSMutableParagraphStyle *v20; // rax NSMutableParagraphStyle *v21; // r15 NSParagraphStyle *v22; // rax NSDictionary *v23; // rax int v24; // ebx NSMutableString *v25; // r14 NSMutableString *v26; // rax NSMutableString *v27; // r12 char *v28; // r14 char *i; // rbx NSString *v30; // r15 unsigned __int64 v31; // rax id v32; // rax id v33; // rax id v34; // r12 double v35; // xmm0_8 double v36; // xmm3_8 double v37; // xmm5_8 double v38; // xmm2_8 unsigned int v39; // esi unsigned int v40; // esi unsigned __int64 v41; // rbx int v42; // esi unsigned __int64 v43; // rdi double v44; // xmm5_8 double v45; // xmm4_8 void *v46; // r14 __m128d v47; // xmm2 NSGraphicsContext *v48; // rax id v49; // rax __m128d v50; // xmm1 double v51; // xmm0_8 unsigned __int64 v52; // r13 NSAffineTransform *v53; // rax __int64 v54; // rdx __int64 v55; // rcx __int64 v56; // r8 __int64 v57; // r9 id v58; // rax __int64 v59; // rdx __int64 v60; // rcx __int64 v61; // r8 __int64 v62; // r9 id v63; // rbx id v64; // r12 __int16 v65; // r15 size_t v66; // r13 void *v67; // rdi __int64 v70; // [rsp+28h] [rbp-C8h] double v71; // [rsp+30h] [rbp-C0h] double v72; // [rsp+50h] [rbp-A0h] char *v74; // [rsp+90h] [rbp-60h] SEL v75; // [rsp+98h] [rbp-58h] NSString *v76; // [rsp+A0h] [rbp-50h] double v77; // [rsp+A0h] [rbp-50h] void *v78; // [rsp+A0h] [rbp-50h] id v80; // [rsp+B0h] [rbp-40h] NSDictionary *v82; // [rsp+C0h] [rbp-30h] double v83; // [rsp+C0h] [rbp-30h] v76 = +[NSString stringWithUTF8String:](&OBJC_CLASS___NSString, "stringWithUTF8String:", a2); v10 = +[NSFontManager sharedFontManager](&OBJC_CLASS___NSFontManager, "sharedFontManager"); v11 = +[NSString stringWithUTF8String:](&OBJC_CLASS___NSString, "stringWithUTF8String:", a6); v12 = (double)a9; v13 = -[NSFontManager fontWithFamily:traits:weight:size:](v10, "fontWithFamily:traits:weight:size:", v11, 16777220, 0); if ( v13 || (v14 = +[NSFontManager sharedFontManager](&OBJC_CLASS___NSFontManager, "sharedFontManager"), v15 = 0, v12 = (double)a9, (v13 = -[NSFontManager fontWithFamily:traits:weight:size:]( v14, "fontWithFamily:traits:weight:size:", CFSTR("Arial"), 16777220, 0, (double)a9)) != nullptr) ) { v16 = v13; v17 = +[NSColor whiteColor](&OBJC_CLASS___NSColor, "whiteColor"); v18 = a5 & 0xF; v19 = 1; if ( v18 != 2 ) v19 = 2 * (unsigned int)(v18 == 3); v20 = objc_alloc_init(&OBJC_CLASS___NSMutableParagraphStyle); v21 = objc_autorelease(v20); v22 = +[NSParagraphStyle defaultParagraphStyle](&OBJC_CLASS___NSParagraphStyle, "defaultParagraphStyle"); -[NSMutableParagraphStyle setParagraphStyle:](v21, "setParagraphStyle:", v22); -[NSMutableParagraphStyle setLineBreakMode:](v21, "setLineBreakMode:", 1); v70 = v19; -[NSMutableParagraphStyle setAlignment:](v21, "setAlignment:", v19); v23 = +[NSDictionary dictionaryWithObjectsAndKeys:]( &OBJC_CLASS___NSDictionary, "dictionaryWithObjectsAndKeys:", v17, NSForegroundColorAttributeName, v16, NSFontAttributeName, v21, NSParagraphStyleAttributeName, 0); v24 = a3; v82 = v23; if ( a3 ) { v25 = (NSMutableString *)v76; -[NSString sizeWithAttributes:](v76, "sizeWithAttributes:", v23); a8 = (double)a3; if ( v12 > (double)a3 ) { v26 = objc_alloc_init(&OBJC_CLASS___NSMutableString); v27 = objc_autorelease(v26); v74 = -[NSString length](v76, "length"); if ( v74 ) { v28 = nullptr; for ( i = nullptr; i != v74; ++i ) { v30 = -[NSString substringWithRange:](v76, "substringWithRange:", i, 1); -[NSMutableString appendString:](v27, "appendString:", v30); if ( objc_msgSend(CFSTR("!?.,-= "), "rangeOfString:", v30) != (id)0x7FFFFFFFFFFFFFFFLL ) v28 = i; -[NSMutableString sizeWithAttributes:](v27, "sizeWithAttributes:", v82); v31 = (unsigned int)(int)v12; v12 = v12 - 9.223372036854776e18; if ( v31 > (unsigned int)a3 ) { if ( !v28 ) -[NSMutableString length](v27, "length"); -[NSMutableString insertString:atIndex:](v27, "insertString:atIndex:", CFSTR("\r\n")); } } v25 = v27; v24 = a3; } else { v25 = v27; } } } else { v25 = (NSMutableString *)v76; } v32 = objc_alloc((Class)&OBJC_CLASS___NSAttributedString); v33 = objc_msgSend(v32, "initWithString:attributes:", v25, v82); v34 = objc_autorelease(v33); v35 = ((double (__fastcall *)(id, const char *))objc_msgSend)(v34, "size"); v15 = 0; if ( v35 > 0.0 && a8 > 0.0 ) { v36 = a8; v37 = v35; if ( v24 | a4 ) { v37 = (double)a3; v36 = (double)a4; v38 = (double)a4; v39 = a5; if ( a4 ) { LABEL_23: v40 = v39 >> 4; if ( !v24 ) { LABEL_25: v41 = (unsigned int)(int)v37; v42 = v40 & 0xF; v43 = (unsigned int)(int)fmax(v36, a8); if ( v70 ) { v44 = v37 - v35; if ( (_DWORD)v70 != 1 ) v44 = v44 * 0.5; } else { v44 = 0.0; } v83 = v35; v72 = v44; v75 = *(SEL *)&a8; if ( v42 == 1 || a8 >= v36 ) { v46 = v34; v45 = v36 - a8; } else { v45 = 0.0; if ( v42 != 2 ) v45 = (v36 - a8) * 0.5; v46 = v34; } v47 = _mm_sub_pd( (__m128d)_mm_unpacklo_epi32((__m128i)v43, (__m128i)xmmword_100A07950), (__m128d)xmmword_100A07960); v77 = _mm_unpackhi_pd(v47, v47).f64[0] + v47.f64[0]; v71 = v77 - v36 + v45; v48 = +[NSGraphicsContext currentContext](&OBJC_CLASS___NSGraphicsContext, "currentContext", v70, 0); -[NSGraphicsContext setShouldAntialias:](v48, "setShouldAntialias:", 0); v49 = objc_alloc((Class)&OBJC_CLASS___NSImage); v50 = _mm_sub_pd( (__m128d)_mm_unpacklo_epi32((__m128i)v41, (__m128i)xmmword_100A07950), (__m128d)xmmword_100A07960); v51 = _mm_unpackhi_pd(v50, v50).f64[0] + v50.f64[0]; v52 = v41; v80 = objc_msgSend(v49, "initWithSize:", v51, v77); objc_msgSend(v80, "lockFocus"); v53 = +[NSAffineTransform transform](&OBJC_CLASS___NSAffineTransform, "transform"); -[NSAffineTransform set](v53, "set"); objc_msgSend(v46, "drawInRect:", v54, v55, v56, v57, *(_QWORD *)&v72, *(_QWORD *)&v71, *(_QWORD *)&v83, v75); v58 = objc_alloc((Class)&OBJC_CLASS___NSBitmapImageRep); v63 = objc_msgSend( v58, "initWithFocusedViewRect:", v59, v60, v61, v62, 0, 0, *(_QWORD *)&v51, *(_QWORD *)&v77); objc_msgSend(v80, "unlockFocus"); v64 = objc_msgSend(v63, "bitmapData"); v65 = v52; v15 = v43; v66 = 4 * v43 * v52; v78 = operator new[](v66); memcpy(v78, v64, v66); objc_release(v63); objc_release(v80); *(_WORD *)(a1 + 58) = v43; *(_WORD *)(a1 + 56) = v65; *(_DWORD *)(a1 + 60) = 8; *(_WORD *)(a1 + 72) = 257; v67 = *(void **)(a1 + 64); if ( v67 ) operator delete[](v67); *(_QWORD *)(a1 + 64) = v78; LOBYTE(v15) = 1; return v15; } LABEL_24: v36 = v38; goto LABEL_25; } } else { v38 = a8; v39 = a5; if ( a4 ) goto LABEL_23; } v38 = a8; v40 = v39 >> 4; if ( !v24 ) goto LABEL_25; goto LABEL_24; } } return v15; }
GD Web Decomp Icon

GD Web Decomp

Raw Source