//
// sub_1800E0750 from 0x1800e0750 to 0x1800e0ccd (1405 bytes)
//
// 4 xrefs:
// > sub_1800D7E10 @ 0x1800d7e77
// > ??> @ 0x18014c704
// > ??> @ 0x18014c718
// > ??> @ 0x1801c50f4
//
// 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:36 +0000
//
__int64 sub_1800E0750()
{
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 ( hLibModule )
return 1;
v3 = 0;
v4 = 0;
do
{
hLibModule = LoadLibraryA(v1);
if ( hLibModule )
break;
v1 = (const CHAR *)v38[v3++];
++v4;
}
while ( v1 );
if ( !hLibModule )
{
sub_1800DB260(0x10006u, "EGL: Library not found");
return 0;
}
dword_1801B61F8 = strncmp((const char *)v38[v4 - 1], "lib", 3u) == 0;
eglGetConfigAttrib = (__int64)GetProcAddress(hLibModule, "eglGetConfigAttrib");
eglGetConfigs = (__int64)GetProcAddress(hLibModule, "eglGetConfigs");
eglGetDisplay = (__int64 (__fastcall *)(_QWORD))GetProcAddress(hLibModule, "eglGetDisplay");
eglGetError = (__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD))GetProcAddress(hLibModule, "eglGetError");
eglInitialize = (__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD))GetProcAddress(hLibModule, "eglInitialize");
eglTerminate = (__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD))GetProcAddress(hLibModule, "eglTerminate");
eglBindAPI = (__int64 (__fastcall *)(_QWORD))GetProcAddress(hLibModule, "eglBindAPI");
eglCreateContext = (__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD, _QWORD))GetProcAddress(
hLibModule,
"eglCreateContext");
eglDestroySurface = (__int64)GetProcAddress(hLibModule, "eglDestroySurface");
eglDestroyContext = (__int64)GetProcAddress(hLibModule, "eglDestroyContext");
eglCreateWindowSurface = (__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD, _QWORD))GetProcAddress(
hLibModule,
"eglCreateWindowSurface");
eglMakeCurrent = (__int64)GetProcAddress(hLibModule, "eglMakeCurrent");
eglSwapBuffers = (__int64)GetProcAddress(hLibModule, "eglSwapBuffers");
eglSwapInterval = (__int64)GetProcAddress(hLibModule, "eglSwapInterval");
eglQueryString = (__int64 (__fastcall *)(_QWORD, _QWORD))GetProcAddress(hLibModule, "eglQueryString");
eglGetProcAddress = GetProcAddress(hLibModule, "eglGetProcAddress");
qword_1801B6298 = (__int64)eglGetProcAddress;
if ( !eglGetConfigAttrib
|| !eglGetConfigs
|| !eglGetDisplay
|| !eglGetError
|| !eglInitialize
|| !eglTerminate
|| !eglBindAPI
|| !eglCreateContext
|| !eglDestroySurface
|| !eglDestroyContext
|| !eglCreateWindowSurface
|| !eglMakeCurrent
|| !eglSwapBuffers
|| !eglSwapInterval
|| !eglQueryString
|| !eglGetProcAddress )
{
sub_1800DB260(0x10008u, "EGL: Failed to load required entry points");
if ( qword_1801B61E8 )
{
eglTerminate(qword_1801B61E8, v35, v36);
qword_1801B61E8 = 0;
}
if ( hLibModule )
{
FreeLibrary(hLibModule);
hLibModule = nullptr;
}
return 0;
}
Display = eglGetDisplay(0);
qword_1801B61E8 = Display;
if ( !Display )
{
Error = eglGetError(v8, v7, v9);
v11 = (const char *)sub_1800E1150(Error);
sub_1800DB260(0x10006u, "EGL: Failed to get EGL display: %s", v11);
sub_1800E0CD0(v13, v12, v14);
return 0;
}
if ( !(unsigned int)eglInitialize(Display, &unk_1801B61F0, &unk_1801B61F4) )
{
v18 = eglGetError(v16, v15, v17);
v19 = (const char *)sub_1800E1150(v18);
sub_1800DB260(0x10006u, "EGL: Failed to initialize EGL: %s", v19);
sub_1800E0CD0(v21, v20, v22);
return 0;
}
String = (char *)eglQueryString(qword_1801B61E8, 12373);
if ( !String || (v24 = (unsigned int)sub_1800D7930("EGL_KHR_create_context", String) == 0, v25 = 1, v24) )
v25 = 0;
dword_1801B61FC = v25;
v26 = (char *)eglQueryString(qword_1801B61E8, 12373);
if ( !v26 || (v24 = (unsigned int)sub_1800D7930("EGL_KHR_create_context_no_error", v26) == 0, v27 = 1, v24) )
v27 = 0;
dword_1801B6200 = v27;
v28 = (char *)eglQueryString(qword_1801B61E8, 12373);
if ( !v28 || (v24 = (unsigned int)sub_1800D7930("EGL_KHR_gl_colorspace", v28) == 0, v29 = 1, v24) )
v29 = 0;
dword_1801B6204 = v29;
v30 = (char *)eglQueryString(qword_1801B61E8, 12373);
if ( !v30 || (v24 = (unsigned int)sub_1800D7930("EGL_KHR_get_all_proc_addresses", v30) == 0, v31 = 1, v24) )
v31 = 0;
dword_1801B6208 = v31;
v32 = (char *)eglQueryString(qword_1801B61E8, 12373);
if ( !v32 || (v24 = (unsigned int)sub_1800D7930("EGL_KHR_context_flush_control", v32) == 0, v33 = 1, v24) )
v33 = 0;
dword_1801B620C = v33;
v34 = (char *)eglQueryString(qword_1801B61E8, 12373);
if ( v34 )
{
if ( (unsigned int)sub_1800D7930("EGL_EXT_present_opaque", v34) )
v0 = 1;
}
dword_1801B6210 = v0;
return 1;
}