//
// sub_1004B1DF0 from 0x1004b1df0 to 0x1004b1ea3 (179 bytes)
//
// 11 xrefs:
// > ??> @ 0x10090c7c8
// > ??> @ 0x100915b80
// > ??> @ 0x100916a88
// > ??> @ 0x100917178
// > ??> @ 0x1009180c0
// > ??> @ 0x10091b5e0
// > ??> @ 0x100924ca0
// > ??> @ 0x100927128
// > ??> @ 0x1009288c8
// > ??> @ 0x100949770
// > ??> @ 0x10098c630
//
// 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 __fastcall sub_1004B1DF0(__int64 a1, unsigned __int16 *a2)
{
__int64 result; // rax
void *v3; // rax
void *v4; // rbx
__int64 v5; // rax
__int16 v6; // [rsp-1Ch] [rbp-1Ch] BYREF
char v7; // [rsp-1Ah] [rbp-1Ah]
*(_BYTE *)(a1 + 15) = *((_BYTE *)a2 + 2);
*(_WORD *)(a1 + 13) = *a2;
result = *a2;
*(_BYTE *)(a1 + 12) = *((_BYTE *)a2 + 2);
*(_WORD *)(a1 + 10) = result;
if ( *(_BYTE *)(a1 + 17) == 1 )
{
v7 = -1;
v6 = -1;
if ( *(_QWORD *)(a1 - 192) )
{
v3 = __dynamic_cast(
*(const void **)(a1 - 192),
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCRGBAProtocol,
-2);
if ( v3 )
{
v4 = v3;
if ( (*(unsigned __int8 (__fastcall **)(void *))(*(_QWORD *)v3 + 64LL))(v3) )
{
v5 = (*(__int64 (__fastcall **)(void *))(*(_QWORD *)v4 + 16LL))(v4);
v6 = *(_WORD *)v5;
v7 = *(_BYTE *)(v5 + 2);
}
}
}
return (*(__int64 (__fastcall **)(__int64, __int16 *))(*(_QWORD *)(a1 - 408) + 1208LL))(a1 - 408, &v6);
}
return result;
}