//
// cocos2d::extension::CCEditBoxImplWin::openKeyboard from 0x180011670 to 0x180011aa2 (1074 bytes)
//
// 3 xrefs:
// > ??> @ 0x18002a840
// > ??> @ 0x180032408
// > ??> @ 0x18004c1e8
//
// 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:15:40 +0000
//
// Hidden C++ exception states: #wind=3
void __fastcall cocos2d::extension::CCEditBoxImplWin::openKeyboard(cocos2d::extension::CCEditBoxImplWin *this)
{
__int64 v2; // rcx
__int64 v3; // rbx
_QWORD *v4; // rax
_BYTE *v5; // rax
size_t v6; // rdi
size_t v7; // r8
unsigned __int64 v8; // r14
char **v9; // rbx
unsigned __int64 v10; // rcx
__int64 v11; // rbx
_WORD *v12; // r15
char *v13; // rcx
_BYTE *v14; // rax
size_t v15; // r8
const char *v16; // rdx
const char *v17; // rdx
__int64 v18; // rbx
_BYTE *v19; // rax
void *v20; // rcx
char *v21; // rcx
char *v22; // rcx
char *v23[2]; // [rsp+30h] [rbp-D0h] BYREF
__int64 v24; // [rsp+40h] [rbp-C0h]
unsigned __int64 v25; // [rsp+48h] [rbp-B8h]
char *Source[2]; // [rsp+50h] [rbp-B0h] BYREF
__m128i si128; // [rsp+60h] [rbp-A0h]
void *Block[2]; // [rsp+70h] [rbp-90h] BYREF
__int128 v29; // [rsp+80h] [rbp-80h]
char Destination[16]; // [rsp+90h] [rbp-70h] BYREF
__int128 v31; // [rsp+A0h] [rbp-60h]
__int128 v32; // [rsp+B0h] [rbp-50h]
__int128 v33; // [rsp+C0h] [rbp-40h]
__int128 v34; // [rsp+D0h] [rbp-30h]
__int128 v35; // [rsp+E0h] [rbp-20h]
int v36; // [rsp+F0h] [rbp-10h]
v2 = *((_QWORD *)this + 1);
if ( v2 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v2 + 8LL))(v2, *((_QWORD *)this + 2));
v3 = *((_QWORD *)this + 2);
if ( v3 && *(_DWORD *)(v3 + 760) )
{
v4 = (_QWORD *)cocos2d::CCScriptEngineManager::sharedManager();
(*(void (__fastcall **)(_QWORD, _QWORD, const char *, __int64, _QWORD))(*(_QWORD *)*v4 + 136LL))(
*v4,
*(unsigned int *)(v3 + 760),
"began",
v3,
0);
}
v5 = (_BYTE *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)(*((_QWORD *)this + 4) + 600LL) + 8LL))(*((_QWORD *)this + 4) + 600LL);
*(_OWORD *)v23 = 0;
v24 = 0;
v25 = 0;
v6 = -1;
v7 = -1;
do
++v7;
while ( v5[v7] );
sub_180003520(v23, v5, v7);
if ( !v24 )
{
v8 = v25;
if ( v25 < 0xB )
{
v10 = v25 >> 1;
v11 = 0x7FFFFFFFFFFFFFFFLL;
if ( v25 <= 0x7FFFFFFFFFFFFFFFLL - (v25 >> 1) )
{
v11 = 15;
if ( v10 + v25 > 0xF )
v11 = v10 + v25;
}
v12 = (_WORD *)sub_180003940(v11 + 1);
v24 = 11;
v25 = v11;
qmemcpy(v12, "Enter valu", 10);
v12[5] = (unsigned __int8)aEnterValue[10];
if ( v8 > 0xF )
{
v13 = v23[0];
if ( v8 + 1 >= 0x1000 )
{
v13 = *((char **)v23[0] - 1);
if ( (unsigned __int64)(v23[0] - v13 - 8) > 0x1F )
LABEL_44:
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v13);
}
v23[0] = (char *)v12;
}
else
{
v9 = v23;
if ( v25 > 0xF )
v9 = (char **)v23[0];
v24 = 11;
memmove(v9, "Enter value", 0xBu);
*((_BYTE *)v9 + 11) = 0;
}
}
*(_OWORD *)Destination = 0;
v31 = 0;
v32 = 0;
v33 = 0;
v34 = 0;
v35 = 0;
v36 = 0;
v14 = (_BYTE *)(*(__int64 (__fastcall **)(cocos2d::extension::CCEditBoxImplWin *))(*(_QWORD *)this + 104LL))(this);
*(_OWORD *)Source = 0;
si128 = 0;
v15 = -1;
do
++v15;
while ( v14[v15] );
sub_180003520(Source, v14, v15);
if ( si128.m128i_i64[0] )
{
v16 = (const char *)Source;
if ( si128.m128i_i64[1] > 0xFuLL )
v16 = Source[0];
strncpy(Destination, v16, 0x64u);
}
v17 = (const char *)v23;
if ( v25 > 0xF )
v17 = v23[0];
v18 = CWin32InputBox::InputBox("Input", v17, Destination, 0x64u, 0, nullptr);
if ( v18 == 1 )
(*(void (__fastcall **)(cocos2d::extension::CCEditBoxImplWin *, char *))(*(_QWORD *)this + 96LL))(this, Destination);
if ( *((_QWORD *)this + 1) )
{
if ( v18 == 1 )
{
v19 = (_BYTE *)(*(__int64 (__fastcall **)(cocos2d::extension::CCEditBoxImplWin *))(*(_QWORD *)this + 104LL))(this);
*(_OWORD *)Block = 0;
v29 = 0;
do
++v6;
while ( v19[v6] );
sub_180003520(Block, v19, v6);
(*(void (__fastcall **)(_QWORD, _QWORD, void **))(**((_QWORD **)this + 1) + 24LL))(
*((_QWORD *)this + 1),
*((_QWORD *)this + 2),
Block);
if ( *((_QWORD *)&v29 + 1) > 0xFu )
{
v20 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v29 + 1) + 1LL) >= 0x1000 )
{
v20 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v20 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v20);
}
}
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 1) + 16LL))(
*((_QWORD *)this + 1),
*((_QWORD *)this + 2));
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 1) + 32LL))(
*((_QWORD *)this + 1),
*((_QWORD *)this + 2));
}
if ( si128.m128i_i64[1] > 0xFuLL )
{
v21 = Source[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v21 = *((char **)Source[0] - 1);
if ( (unsigned __int64)(Source[0] - v21 - 8) > 0x1F )
goto LABEL_44;
}
j_j_free(v21);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_18002BCB0);
LOBYTE(Source[0]) = 0;
if ( v25 > 0xF )
{
v22 = v23[0];
if ( v25 + 1 >= 0x1000 )
{
v22 = *((char **)v23[0] - 1);
if ( (unsigned __int64)(v23[0] - v22 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v22);
}
}