//
// sub_1800DE0E0 from 0x1800de0e0 to 0x1800de65d (1405 bytes)
//
// 4 xrefs:
// > sub_1800D6480 @ 0x1800d64e7
// > ??> @ 0x180143450
// > ??> @ 0x180143464
// > ??> @ 0x1801bae90
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 sub_1800DE0E0()
{
int v0; // edi
const CHAR *v1; // rax
__int64 v3; // rbx
int v4; // esi
FARPROC eglGetProcAddress; // rax
__int64 Display; // rax
__int64 v7; // rdx
__int64 v8; // rcx
__int64 v9; // r8
unsigned int Error; // eax
const char *v11; // rax
__int64 v12; // rdx
__int64 v13; // rcx
__int64 v14; // r8
__int64 v15; // rdx
__int64 v16; // rcx
__int64 v17; // r8
unsigned int v18; // eax
const char *v19; // rax
__int64 v20; // rdx
__int64 v21; // rcx
__int64 v22; // r8
char *String; // rax
bool v24; // zf
int v25; // eax
char *v26; // rax
int v27; // eax
char *v28; // rax
int v29; // eax
char *v30; // rax
int v31; // eax
char *v32; // rax
int v33; // eax
char *v34; // rax
__int64 v35; // rdx
__int64 v36; // r8
char *Str1; // [rsp+20h] [rbp-28h]
_QWORD v38[2]; // [rsp+28h] [rbp-20h]
v0 = 0;
v1 = "libEGL.dll";
Str1 = "libEGL.dll";
v38[0] = "EGL.dll";
v38[1] = 0;
if ( qword_1801AC198 )
return 1;
v3 = 0;
v4 = 0;
do
{
qword_1801AC198 = LoadLibraryA(v1);
if ( qword_1801AC198 )
break;
v1 = (const CHAR *)v38[v3++];
++v4;
}
while ( v1 );
if ( !qword_1801AC198 )
{
sub_1800D3530(0x10006u, "EGL: Library not found");
return 0;
}
dword_1801AC178 = strncmp((const char *)v38[v4 - 1], "lib", 3u) == 0;
eglGetConfigAttrib = (__int64)GetProcAddress(qword_1801AC198, "eglGetConfigAttrib");
eglGetConfigs = (__int64)GetProcAddress(qword_1801AC198, "eglGetConfigs");
eglGetDisplay = (__int64 (__fastcall *)(_QWORD))GetProcAddress(qword_1801AC198, "eglGetDisplay");
eglGetError = (__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD))GetProcAddress(qword_1801AC198, "eglGetError");
eglInitialize = (__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD))GetProcAddress(qword_1801AC198, "eglInitialize");
eglTerminate = (__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD))GetProcAddress(qword_1801AC198, "eglTerminate");
eglBindAPI = (__int64 (__fastcall *)(_QWORD))GetProcAddress(qword_1801AC198, "eglBindAPI");
eglCreateContext = (__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD, _QWORD))GetProcAddress(
qword_1801AC198,
"eglCreateContext");
eglDestroySurface = (__int64)GetProcAddress(qword_1801AC198, "eglDestroySurface");
eglDestroyContext = (__int64)GetProcAddress(qword_1801AC198, "eglDestroyContext");
eglCreateWindowSurface = (__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD, _QWORD))GetProcAddress(
qword_1801AC198,
"eglCreateWindowSurface");
eglMakeCurrent = (__int64)GetProcAddress(qword_1801AC198, "eglMakeCurrent");
eglSwapBuffers = (__int64)GetProcAddress(qword_1801AC198, "eglSwapBuffers");
eglSwapInterval = (__int64)GetProcAddress(qword_1801AC198, "eglSwapInterval");
eglQueryString = (__int64 (__fastcall *)(_QWORD, _QWORD))GetProcAddress(qword_1801AC198, "eglQueryString");
eglGetProcAddress = GetProcAddress(qword_1801AC198, "eglGetProcAddress");
qword_1801AC218 = (__int64)eglGetProcAddress;
if ( !eglGetConfigAttrib
|| !eglGetConfigs
|| !eglGetDisplay
|| !eglGetError
|| !eglInitialize
|| !eglTerminate
|| !eglBindAPI
|| !eglCreateContext
|| !eglDestroySurface
|| !eglDestroyContext
|| !eglCreateWindowSurface
|| !eglMakeCurrent
|| !eglSwapBuffers
|| !eglSwapInterval
|| !eglQueryString
|| !eglGetProcAddress )
{
sub_1800D3530(0x10008u, "EGL: Failed to load required entry points");
if ( qword_1801AC168 )
{
eglTerminate(qword_1801AC168, v35, v36);
qword_1801AC168 = 0;
}
if ( qword_1801AC198 )
{
FreeLibrary(qword_1801AC198);
qword_1801AC198 = nullptr;
}
return 0;
}
Display = eglGetDisplay(0);
qword_1801AC168 = Display;
if ( !Display )
{
Error = eglGetError(v8, v7, v9);
v11 = (const char *)sub_1800DEAE0(Error);
sub_1800D3530(0x10006u, "EGL: Failed to get EGL display: %s", v11);
sub_1800DE660(v13, v12, v14);
return 0;
}
if ( !(unsigned int)eglInitialize(Display, &unk_1801AC170, &unk_1801AC174) )
{
v18 = eglGetError(v16, v15, v17);
v19 = (const char *)sub_1800DEAE0(v18);
sub_1800D3530(0x10006u, "EGL: Failed to initialize EGL: %s", v19);
sub_1800DE660(v21, v20, v22);
return 0;
}
String = (char *)eglQueryString(qword_1801AC168, 12373);
if ( !String || (v24 = (unsigned int)sub_1800D31D0("EGL_KHR_create_context", String) == 0, v25 = 1, v24) )
v25 = 0;
dword_1801AC17C = v25;
v26 = (char *)eglQueryString(qword_1801AC168, 12373);
if ( !v26 || (v24 = (unsigned int)sub_1800D31D0("EGL_KHR_create_context_no_error", v26) == 0, v27 = 1, v24) )
v27 = 0;
dword_1801AC180 = v27;
v28 = (char *)eglQueryString(qword_1801AC168, 12373);
if ( !v28 || (v24 = (unsigned int)sub_1800D31D0("EGL_KHR_gl_colorspace", v28) == 0, v29 = 1, v24) )
v29 = 0;
dword_1801AC184 = v29;
v30 = (char *)eglQueryString(qword_1801AC168, 12373);
if ( !v30 || (v24 = (unsigned int)sub_1800D31D0("EGL_KHR_get_all_proc_addresses", v30) == 0, v31 = 1, v24) )
v31 = 0;
dword_1801AC188 = v31;
v32 = (char *)eglQueryString(qword_1801AC168, 12373);
if ( !v32 || (v24 = (unsigned int)sub_1800D31D0("EGL_KHR_context_flush_control", v32) == 0, v33 = 1, v24) )
v33 = 0;
dword_1801AC18C = v33;
v34 = (char *)eglQueryString(qword_1801AC168, 12373);
if ( v34 )
{
if ( (unsigned int)sub_1800D31D0("EGL_EXT_present_opaque", v34) )
v0 = 1;
}
dword_1801AC190 = v0;
return 1;
}