//
// cocos2d::CCGLProgram::initWithVertexShaderFilename from 0x180086ab0 to 0x180086c15 (357 bytes)
//
// 2 xrefs:
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b5718
//
// 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
//
// 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
std::string *CString; // rdi
_BYTE *v10; // rcx
struct cocos2d::CCFileUtils *v11; // rax
__int64 v12; // rax
cocos2d::CCString *v13; // rax
std::string *v14; // rbx
_BYTE *v15; // rcx
void *Block; // [rsp+20h] [rbp-68h] BYREF
__m128i si128; // [rsp+30h] [rbp-58h]
void *v19; // [rsp+40h] [rbp-48h] BYREF
__m128i v20; // [rsp+50h] [rbp-38h]
v6 = cocos2d::CCFileUtils::sharedFileUtils();
v7 = ((__int64 (__fastcall *)(struct cocos2d::CCFileUtils *, void **, const char *, _QWORD))v6->createCCArrayWithContentsOfFile)(
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 )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v10);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_1800E7160);
LOBYTE(Block) = 0;
v11 = cocos2d::CCFileUtils::sharedFileUtils();
v12 = ((__int64 (__fastcall *)(struct cocos2d::CCFileUtils *, void **, const char *, _QWORD))v11->createCCArrayWithContentsOfFile)(
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 )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v15);
}
v20 = _mm_load_si128((const __m128i *)&xmmword_1800E7160);
LOBYTE(v19) = 0;
return cocos2d::CCGLProgram::initWithVertexShaderByteArray(
this,
CString->m_data.m_smallStorage._Elems,
v14->m_data.m_smallStorage._Elems);
}