//
// DialogLayer::init from 0x140174c40 to 0x1401750a6 (1126 bytes)
//
// 2 xrefs:
// > DialogLayer::createDialogLayer @ 0x140174bf4
// > ??> @ 0x14091841c
//
// 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:27:32 +0000
//
// Hidden C++ exception states: #wind=1
bool __fastcall DialogLayer::init(__int64 a1, __int64 a2, cocos2d::CCObject *a3, int a4)
{
bool result; // al
__int64 v9; // rcx
__int64 v10; // rax
__int64 v11; // rcx
__int64 v12; // rax
cocos2d::CCTouchDispatcher *v13; // rax
__int64 v14; // rdx
__int64 v15; // rdx
__int64 v16; // rdx
__int64 v17; // rax
__int64 *v18; // rdi
__int64 v19; // rbx
__int64 v20; // rax
cocos2d::CCString *v21; // rax
const char *CString; // rax
size_t v23; // r8
__int128 *v24; // rbx
__int64 v25; // rax
__int64 *v26; // rdi
__int64 v27; // rbx
__int64 v28; // rax
struct cocos2d::CCLabelBMFont *v29; // rax
__int64 *v30; // rdi
__int64 v31; // rbx
__int64 v32; // rax
__int64 *v33; // rdi
__int64 v34; // rbx
__int64 v35; // rax
__int64 v36; // rax
_QWORD *v37; // rdi
__int64 v38; // rbx
__int64 v39; // rax
__int64 v40; // rdx
struct cocos2d::CCSprite *v41; // rax
__int64 *v42; // rdi
__int64 v43; // rbx
__int64 v44; // rax
int v45; // [rsp+30h] [rbp-49h] BYREF
float v46[2]; // [rsp+38h] [rbp-41h] BYREF
char v47[8]; // [rsp+40h] [rbp-39h] BYREF
_BYTE v48[16]; // [rsp+48h] [rbp-31h] BYREF
_BYTE v49[16]; // [rsp+58h] [rbp-21h] BYREF
__int128 v50; // [rsp+68h] [rbp-11h] BYREF
__int128 v51; // [rsp+78h] [rbp-1h]
v45 = -1778384896;
result = cocos2d::CCLayerColor::initWithColor((cocos2d::CCLayerColor *)a1, (const struct cocos2d::_ccColor4B *)&v45);
if ( result )
{
if ( a3 )
{
*(_QWORD *)(a1 + 592) = a3;
cocos2d::CCObject::retain(a3);
}
v10 = cocos2d::CCDirector::sharedDirector(v9);
cocos2d::CCDirector::getWinSize(v10, v46);
v12 = cocos2d::CCDirector::sharedDirector(v11);
v13 = (cocos2d::CCTouchDispatcher *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v12 + 144LL))(v12);
cocos2d::CCTouchDispatcher::registerForcePrio(v13, (struct cocos2d::CCObject *)a1, 2, 0);
LOBYTE(v14) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 920LL))(a1, v14);
LOBYTE(v15) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 992LL))(a1, v15);
LOBYTE(v16) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1008LL))(a1, v16);
v17 = cocos2d::CCLayer::create();
*(_QWORD *)(a1 + 560) = v17;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v17);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 560) + 312LL))(*(_QWORD *)(a1 + 560), &unk_14090A4C0);
v18 = *(__int64 **)(a1 + 560);
v19 = *v18;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v45, v46[0] * 0.5, v46[1] * 0.5);
(*(void (__fastcall **)(__int64 *, __int64))(v19 + 184))(v18, v20);
v21 = cocos2d::CCString::createWithFormat("GJ_square%02d.png", a4);
CString = cocos2d::CCString::getCString(v21);
v50 = 0;
v51 = 0;
v23 = -1;
do
++v23;
while ( CString[v23] );
sub_14003D230(&v50, CString, v23);
v24 = &v50;
if ( *((_QWORD *)&v51 + 1) > 0xFu )
v24 = (__int128 *)v50;
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v49, 0.0, 0.0, 80.0, 80.0);
v26 = (__int64 *)cocos2d::extension::CCScale9Sprite::create(v24, v25);
v27 = *v26;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v45, 380.0, 100.0);
(*(void (__fastcall **)(__int64 *, __int64))(v27 + 312))(v26, v28);
(*(void (__fastcall **)(_QWORD, __int64 *, __int64))(**(_QWORD **)(a1 + 560) + 456LL))(
*(_QWORD *)(a1 + 560),
v26,
4294967294LL);
v29 = cocos2d::CCLabelBMFont::create(" ", (const char *)&qword_140704F78);
*(_QWORD *)(a1 + 568) = v29;
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *, __int64))(**(_QWORD **)(a1 + 560) + 456LL))(
*(_QWORD *)(a1 + 560),
v29,
2);
v30 = *(__int64 **)(a1 + 568);
v31 = *v30;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v45, 0.0, 1.0);
(*(void (__fastcall **)(__int64 *, __int64))(v31 + 288))(v30, v32);
v33 = *(__int64 **)(a1 + 568);
v34 = *v33;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v45, -93.0, 36.0);
(*(void (__fastcall **)(__int64 *, __int64))(v34 + 184))(v33, v35);
cocos2d::CCLabelBMFont::limitLabelWidth(*(cocos2d::CCLabelBMFont **)(a1 + 568), 200.0, 0.5, 0.0);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v48, 0.0, 0.0, 80.0, 80.0);
v36 = cocos2d::CCRect::CCRect((cocos2d::CCRect *)v49, (const struct cocos2d::CCRect *)v48);
v37 = (_QWORD *)cocos2d::extension::CCScale9Sprite::create("square02b_001.png", v36);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v47, 280.0, 80.0);
(*(void (__fastcall **)(_QWORD *, char *))(*v37 + 312LL))(v37, v47);
(*(void (__fastcall **)(_QWORD, _QWORD *, __int64))(**(_QWORD **)(a1 + 560) + 456LL))(
*(_QWORD *)(a1 + 560),
v37,
0xFFFFFFFFLL);
v38 = *v37;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v45, 40.0, 0.0);
(*(void (__fastcall **)(_QWORD *, __int64))(v38 + 184))(v37, v39);
LOWORD(v45) = 0;
BYTE2(v45) = 0;
(*(void (__fastcall **)(_QWORD *, int *))v37[40])(v37 + 40, &v45);
LOBYTE(v40) = 50;
(*(void (__fastcall **)(_QWORD *, __int64))(v37[40] + 40LL))(v37 + 40, v40);
v41 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_chatBtn_01_001.png");
*(_QWORD *)(a1 + 608) = v41;
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCSprite *, __int64))(**(_QWORD **)(a1 + 560) + 456LL))(
*(_QWORD *)(a1 + 560),
v41,
3);
v42 = *(__int64 **)(a1 + 608);
v43 = *v42;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v45, 0.0, -50.0);
(*(void (__fastcall **)(__int64 *, __int64))(v43 + 184))(v42, v44);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)(*(_QWORD *)(a1 + 608) + 320LL) + 40LL))(
*(_QWORD *)(a1 + 608) + 320LL,
0);
if ( *(_QWORD *)(a1 + 592) )
DialogLayer::displayNextObject(a1);
else
DialogLayer::displayDialogObject(a1, a2);
DialogLayer::updateNavButtonFrame(a1);
sub_14003D310((__int64)&v50);
return 1;
}
return result;
}