//
// sub_1800D7B50 from 0x1800d7b50 to 0x1800d7be3 (147 bytes)
//
// 4 xrefs:
// > cocos2d::CCEGLView::setupWindow @ 0x18007b91b
// > sub_1800DC220 @ 0x1800dc503
// > sub_1800DC680 @ 0x1800dc701
// > ??> @ 0x1801c4968
//
// 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:22:33 +0000
//
__int64 __fastcall sub_1800D7B50(__int64 a1)
{
__int64 result; // rax
__int64 v3; // rdx
if ( !*(_DWORD *)&ModuleName )
return sub_1800DB260(65537, nullptr);
result = sub_1800DE110(&unk_1801B520C);
v3 = result;
if ( a1 && !*(_DWORD *)(a1 + 512) )
return sub_1800DB260(65546, "Cannot make current with a window that has no OpenGL or OpenGL ES context");
if ( !result )
{
LABEL_10:
if ( !a1 )
return result;
return (*(__int64 (__fastcall **)(__int64, __int64))(a1 + 584))(a1, v3);
}
if ( !a1 || *(_DWORD *)(a1 + 516) != *(_DWORD *)(result + 516) )
{
result = (*(__int64 (__fastcall **)(_QWORD))(result + 584))(0);
goto LABEL_10;
}
return (*(__int64 (__fastcall **)(__int64, __int64))(a1 + 584))(a1, v3);
}