//
// cocos2d::CCImage::initWithStringShadowStroke from 0x10002ed38 to 0x10002f1cc (1172 bytes)
//
// 1 xrefs:
// > cocos2d::CCTexture2D::initWithString @ 0x1001ab6d0
//
// This function is hookable on this platform (idp: arm, 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 10:57:30 +0000
//
UIFont *__fastcall cocos2d::CCImage::initWithStringShadowStroke(
__int64 a1,
__int64 a2,
unsigned int a3,
unsigned int a4,
unsigned __int8 a5,
__int64 a6,
int a7,
int a8,
float a9,
float a10,
float a11,
float a12,
float a13,
double a14,
float a15,
float a16,
char a17,
float a18,
float a19,
float a20)
{
NSString *v33; // x27
UIFont *result; // x0
UIFont *v35; // x22
double v36; // d11
NSArray *v37; // x26
double height; // d8
double width; // d14
void *v40; // x0
void *v41; // x27
double v42; // d15
double v43; // d10
__int64 v44; // x28
void *i; // x21
double v46; // d0
double v47; // d1
float v48; // s0
double v49; // d1
float v50; // s0
double v51; // d2
float v52; // s0
float v53; // s15
int v54; // w8
int v55; // w8
bool v56; // zf
float v58; // s3
float v59; // s3
float v60; // s4
float v61; // s14
double v62; // d8
double v63; // d11
double v64; // d13
int v65; // w8
size_t v66; // x25
size_t v67; // x0
void *v68; // x24
CGColorSpace *DeviceRGB; // x26
CGContext *v70; // x25
__int64 v71; // x23
float v72; // s2
float v73; // s3
double v74; // d0
float v75; // s1
unsigned __int64 v76; // [xsp+0h] [xbp-180h]
float v77; // [xsp+0h] [xbp-180h]
float v78; // [xsp+4h] [xbp-17Ch]
float v79; // [xsp+8h] [xbp-178h]
float v80; // [xsp+Ch] [xbp-174h]
NSString *v81; // [xsp+10h] [xbp-170h]
__int128 v83; // [xsp+20h] [xbp-160h] BYREF
__int128 v84; // [xsp+30h] [xbp-150h]
__int128 v85; // [xsp+40h] [xbp-140h]
__int128 v86; // [xsp+50h] [xbp-130h]
_BYTE v87[128]; // [xsp+60h] [xbp-120h] BYREF
CGSize v88; // 0:d0.8,8:d1.8
if ( !a2 )
return nullptr;
v33 = +[NSString stringWithUTF8String:](&OBJC_CLASS___NSString, "stringWithUTF8String:", a2);
result = +[UIFont fontWithName:size:](
&OBJC_CLASS___UIFont,
"fontWithName:size:",
-[NSString stringByDeletingPathExtension](
-[NSString lastPathComponent](
+[NSString stringWithUTF8String:](&OBJC_CLASS___NSString, "stringWithUTF8String:", a6),
"lastPathComponent"),
"stringByDeletingPathExtension"),
(double)a7);
if ( !result )
{
result = +[UIFont systemFontOfSize:](&OBJC_CLASS___UIFont, "systemFontOfSize:", (double)a7);
if ( !result )
return result;
}
v35 = result;
v79 = a10;
v80 = a11;
v76 = __PAIR64__(LODWORD(a15), LODWORD(a16));
v36 = (double)a4;
v81 = v33;
v37 = -[NSString componentsSeparatedByString:](v33, "componentsSeparatedByString:", CFSTR("\n"), v76);
width = CGSizeZero.width;
height = CGSizeZero.height;
v83 = 0u;
v84 = 0u;
v85 = 0u;
v86 = 0u;
v40 = -[NSArray countByEnumeratingWithState:objects:count:](
v37,
"countByEnumeratingWithState:objects:count:",
&v83,
v87,
16);
if ( v40 )
{
v41 = v40;
if ( a4 )
v42 = (double)a4;
else
v42 = 2147483650.0;
if ( a3 )
v43 = (double)a3;
else
v43 = 2147483650.0;
v44 = *(_QWORD *)v84;
do
{
for ( i = nullptr; i != v41; i = (char *)i + 1 )
{
if ( *(_QWORD *)v84 != v44 )
objc_enumerationMutation(v37);
objc_msgSend(*(id *)(*((_QWORD *)&v83 + 1) + 8LL * (_QWORD)i), "sizeWithFont:constrainedToSize:", v35, v43, v42);
if ( v46 > width )
width = v46;
height = height + v47;
}
v41 = -[NSArray countByEnumeratingWithState:objects:count:](
v37,
"countByEnumeratingWithState:objects:count:",
&v83,
v87,
16);
}
while ( v41 );
}
v48 = width;
v49 = ceilf(v48);
v50 = height;
v51 = ceilf(v50);
v52 = 0.0;
v53 = 0.0;
if ( v51 < v36 )
{
v54 = a5 >> 4;
if ( v54 == 1 )
{
v55 = 0;
}
else
{
v56 = v54 == 3;
v55 = (int)((v36 - v51) * 0.5);
if ( !v56 )
v55 = (int)(v36 - v51);
}
v53 = (float)v55;
}
v56 = v49 >= (double)a3 || a3 == 0;
if ( !v56 )
v49 = (double)a3;
if ( v51 < v36 && a4 != 0 )
v51 = (double)a4;
v58 = ceilf(a20);
if ( a17 )
v52 = v58;
v59 = fabsf(a12);
if ( v52 >= v59 )
v59 = v52;
v60 = fabsf(a13);
if ( v52 >= v60 )
v60 = v52;
if ( a8 )
v61 = v60;
else
v61 = v52;
if ( a8 )
v52 = v59;
v62 = v52;
v63 = v49 + v52;
v64 = v51 + v61;
v65 = vcvtd_n_s64_f64(v64 * v63, 2u);
v66 = v65;
if ( v65 < 0 )
v67 = -1;
else
v67 = v65;
v68 = operator new[](v67);
bzero(v68, v66);
DeviceRGB = CGColorSpaceCreateDeviceRGB();
v70 = CGBitmapContextCreate(v68, (unsigned __int64)v63, (unsigned __int64)v64, 8u, 4 * (int)v63, DeviceRGB, 0x4001u);
CGColorSpaceRelease(DeviceRGB);
if ( !v70 )
{
operator delete[](v68);
return nullptr;
}
CGContextSetRGBFillColor(v70, a9, v79, v80, 1.0);
CGContextTranslateCTM(v70, 0.0, v64 - v61);
CGContextScaleCTM(v70, 1.0, -1.0);
UIGraphicsPushContext(v70);
if ( (a5 & 0xF) == 2 )
v71 = 2;
else
v71 = (a5 & 0xF) == 3;
if ( a17 )
{
CGContextSetTextDrawingMode(v70, kCGTextFillStroke);
CGContextSetRGBStrokeColor(v70, v77, a18, a19, 1.0);
CGContextSetLineWidth(v70, a20);
}
if ( a8 )
{
v88.width = a12;
v88.height = a13;
CGContextSetShadow(v70, v88, v78);
}
v74 = 0.0;
if ( a12 < 0.0 )
v74 = v62;
v75 = 0.0;
if ( a13 <= 0.0 )
v75 = v61;
v72 = v63 - v62;
v73 = v64 - v61;
-[NSString drawInRect:withFont:lineBreakMode:alignment:](
v81,
"drawInRect:withFont:lineBreakMode:alignment:",
v35,
0,
v71,
v74,
(float)(v53 - v75),
v72,
v73);
UIGraphicsPopContext();
CGContextRelease(v70);
*(_WORD *)(a1 + 58) = (unsigned int)v64;
*(_WORD *)(a1 + 56) = (unsigned int)v63;
*(_DWORD *)(a1 + 60) = 8;
*(_WORD *)(a1 + 72) = 257;
*(_QWORD *)(a1 + 64) = v68;
return (UIFont *)1;
}