//
// DialogLayer::init from 0x1003b07f0 to 0x1003b0c9d (1197 bytes)
//
// 1 xrefs:
// > DialogLayer::createDialogLayer @ 0x1003b0791
//
// 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:29:25 +0000
//
__int64 __fastcall DialogLayer::init(_QWORD *a1, __int64 a2, _QWORD *a3)
{
_QWORD *v4; // r14
unsigned int v5; // ebx
__int64 v6; // rsi
__int64 v7; // rax
__int64 v8; // rax
__int64 v9; // rax
__int64 v10; // r15
__int64 v11; // rax
const char *CString; // r13
size_t v13; // rax
size_t v14; // r12
char *v15; // r15
size_t v16; // rbx
char v17; // bl
char *v18; // r15
__int64 v19; // r13
__int64 v20; // r12
__int64 v21; // rax
__int64 v22; // r15
__int64 v23; // r15
__int64 v24; // r12
double v25; // xmm0_8
const char *v26; // r12
char *v27; // rax
__int64 v28; // r15
__int64 v29; // rdi
__int64 v30; // r14
__int64 v31; // rax
__int64 v32; // rax
__m128 v34; // [rsp+0h] [rbp-80h] BYREF
__int64 v35; // [rsp+10h] [rbp-70h]
float v36[2]; // [rsp+18h] [rbp-68h] BYREF
unsigned __int64 v37[2]; // [rsp+20h] [rbp-60h] BYREF
_QWORD __dst[2]; // [rsp+30h] [rbp-50h] BYREF
void *__p; // [rsp+40h] [rbp-40h]
float v40[2]; // [rsp+4Ch] [rbp-34h] BYREF
unsigned __int8 v41; // [rsp+57h] [rbp-29h]
v4 = a1;
LODWORD(__dst[0]) = -1778384896;
v5 = cocos2d::CCLayerColor::initWithColor(a1, __dst);
if ( !(_BYTE)v5 )
return v5;
v35 = a2;
if ( a3 )
{
a1[74] = a3;
a1 = a3;
cocos2d::CCObject::retain(a3);
}
v6 = cocos2d::CCDirector::sharedDirector(a1, __dst);
cocos2d::CCDirector::getWinSize(v36, v6);
v7 = cocos2d::CCDirector::sharedDirector(v36, v6);
v8 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v7 + 160LL))(v7);
cocos2d::CCTouchDispatcher::registerForcePrio(v8, v4, 2, 0);
(*(void (__fastcall **)(_QWORD *, __int64))(*v4 + 1000LL))(v4, 1);
(*(void (__fastcall **)(_QWORD *, __int64))(*v4 + 1072LL))(v4, 1);
(*(void (__fastcall **)(_QWORD *, __int64))(*v4 + 1088LL))(v4, 1);
v9 = cocos2d::CCLayer::create();
v4[70] = v9;
(*(void (__fastcall **)(_QWORD *, __int64))(*v4 + 456LL))(v4, v9);
(*(void (__fastcall **)(_QWORD, void *))(*(_QWORD *)v4[70] + 320LL))(v4[70], &unk_100BE3550);
v10 = v4[70];
sub_100278250((float *)__dst, v36[0] * 0.5, 0.5 * v36[1]);
(*(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)v10 + 184LL))(v10, __dst);
v11 = sub_10088E820("GJ_square%02d.png", v34.i8[0]);
CString = (const char *)cocos2d::CCString::getCString(v11);
v13 = strlen(CString);
if ( v13 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v14 = v13;
v15 = (char *)__dst + 1;
v41 = v5;
if ( v13 >= 0x17 )
{
v16 = 26;
if ( (v13 | 7) != 0x17 )
v16 = (v13 | 7) + 1;
v15 = (char *)operator new(v16);
__p = v15;
__dst[0] = v16 + 1;
__dst[1] = v14;
}
else
{
LOBYTE(__dst[0]) = 2 * v13;
if ( !v13 )
goto LABEL_12;
}
memmove(v15, CString, v14);
LABEL_12:
v15[v14] = 0;
v17 = __dst[0];
v18 = (char *)__p;
sub_100278270((__int64)v37, 0.0, 0.0, (__m128)0x42A00000u, (__m128)0x42A00000u);
v19 = v35;
if ( (v17 & 1) == 0 )
v18 = (char *)__dst + 1;
v20 = cocos2d::extension::CCScale9Sprite::create_2(v18, v37);
sub_100278260((float *)v37, 380.0, 100.0);
(*(void (__fastcall **)(__int64, unsigned __int64 *))(*(_QWORD *)v20 + 320LL))(v20, v37);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)v4[70] + 464LL))(v4[70], v20, 4294967294LL);
v21 = cocos2d::CCLabelBMFont::create_3(" ", "bigFont.fnt");
v4[71] = v21;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)v4[70] + 464LL))(v4[70], v21, 2);
v22 = v4[71];
sub_100278250((float *)v37, 0.0, 1.0);
(*(void (__fastcall **)(__int64, unsigned __int64 *))(*(_QWORD *)v22 + 296LL))(v22, v37);
v23 = v4[71];
sub_100278250((float *)v37, -93.0, 36.0);
(*(void (__fastcall **)(__int64, unsigned __int64 *))(*(_QWORD *)v23 + 184LL))(v23, v37);
cocos2d::CCLabelBMFont::limitLabelWidth(v4[71], 200.0, 0.5, 0.0);
sub_100278270((__int64)v37, 0.0, 0.0, (__m128)0x42A00000u, (__m128)0x42A00000u);
sub_1002787F0(&v34, v37);
v5 = v41;
v24 = cocos2d::extension::CCScale9Sprite::create_2("square02b_001.png", &v34);
sub_100278260(v34.f32, 280.0, 80.0);
(*(void (__fastcall **)(__int64, __m128 *))(*(_QWORD *)v24 + 320LL))(v24, &v34);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)v4[70] + 464LL))(v4[70], v24, 0xFFFFFFFFLL);
sub_100278250(v40, 40.0, 0.0);
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v24 + 184LL))(v24, v40);
BYTE2(v40[0]) = 0;
LOWORD(v40[0]) = 0;
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v24 + 960LL))(v24, v40);
v25 = (*(double (__fastcall **)(__int64, __int64))(*(_QWORD *)v24 + 912LL))(v24, 50);
v26 = "GJ_chatBtn_01_001.png";
v27 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"GJ_chatBtn_01_001.png", v25);
v4[76] = v27;
(*(void (__fastcall **)(_QWORD, char *, __int64))(*(_QWORD *)v4[70] + 464LL))(v4[70], v27, 3);
v28 = v4[76];
sub_100278250(v40, 0.0, -50.0);
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v28 + 184LL))(v28, v40);
(*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)v4[76] + 912LL))(v4[76], 0);
if ( v4[74] )
DialogLayer::displayNextObject(v4);
else
DialogLayer::displayDialogObject(v4, v19);
v29 = v4[74];
if ( v29 )
{
if ( !(unsigned int)sub_1007FEF90(v29) )
v26 = "GJ_chatBtn_02_001.png";
}
else
{
v26 = "GJ_chatBtn_02_001.png";
}
v30 = v4[76];
v31 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v32 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v31, v26);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v30 + 1160LL))(v30, v32);
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
return v5;
}