//
// cocos2d::CCGLProgram::initWithVertexShaderFilename from 0x180089c50 to 0x180089ded (413 bytes)
//
// 3 xrefs:
// > ??> @ 0x18014cf68
// > ??> @ 0x1801bf9dc
// > ??> @ 0x1801bf9e8
//
// 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:05 +0000
//
// Hidden C++ exception states: #wind=2
char __fastcall cocos2d::CCGLProgram::initWithVertexShaderFilename(
cocos2d::CCGLProgram *this,
const char *a2,
const char *a3)
{
struct cocos2d::CCFileUtils *v6; // rax
__int64 v7; // rax
cocos2d::CCString *v8; // rax
const char *CString; // rdi
_BYTE *v10; // r8
struct cocos2d::CCFileUtils *v11; // rax
__int64 v12; // rax
cocos2d::CCString *v13; // rax
const char *v14; // rbx
_BYTE *v15; // r8
void *Block; // [rsp+30h] [rbp-68h] BYREF
__m128i si128; // [rsp+40h] [rbp-58h]
void *v19; // [rsp+50h] [rbp-48h] BYREF
__m128i v20; // [rsp+60h] [rbp-38h]
v6 = cocos2d::CCFileUtils::sharedFileUtils();
v7 = (*(__int64 (__fastcall **)(struct cocos2d::CCFileUtils *, void **, const char *, _QWORD))(*(_QWORD *)v6 + 40LL))(
v6,
&Block,
a2,
0);
if ( *(_QWORD *)(v7 + 24) > 0xFu )
v7 = *(_QWORD *)v7;
v8 = cocos2d::CCString::createWithContentsOfFile((const char *)v7);
CString = cocos2d::CCString::getCString(v8);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v10 = Block;
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v10 = *((_BYTE **)Block - 1);
if ( (unsigned __int64)((_BYTE *)Block - v10 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free_0(v10);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_1800EC500);
LOBYTE(Block) = 0;
v11 = cocos2d::CCFileUtils::sharedFileUtils();
v12 = (*(__int64 (__fastcall **)(struct cocos2d::CCFileUtils *, void **, const char *, _QWORD))(*(_QWORD *)v11 + 40LL))(
v11,
&v19,
a3,
0);
if ( *(_QWORD *)(v12 + 24) > 0xFu )
v12 = *(_QWORD *)v12;
v13 = cocos2d::CCString::createWithContentsOfFile((const char *)v12);
v14 = cocos2d::CCString::getCString(v13);
if ( v20.m128i_i64[1] > 0xFuLL )
{
v15 = v19;
if ( (unsigned __int64)(v20.m128i_i64[1] + 1) >= 0x1000 )
{
v15 = *((_BYTE **)v19 - 1);
if ( (unsigned __int64)((_BYTE *)v19 - v15 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free_0(v15);
}
v20 = _mm_load_si128((const __m128i *)&xmmword_1800EC500);
LOBYTE(v19) = 0;
return cocos2d::CCGLProgram::initWithVertexShaderByteArray(this, CString, v14);
}