//
// sub_180016C80 from 0x180016c80 to 0x180016d97 (279 bytes)
//
// 67 xrefs:
// > sub_1800166E0 @ 0x18001681b
// > DS_Dictionary::cleanStringWhiteSpace @ 0x180019318
// > DS_Dictionary::copyFile @ 0x1800194a1
// > cocos2d::CCBMFontConfiguration::parseConfigFile @ 0x18004aa93
// > cocos2d::CCBMFontConfiguration::parseConfigFile @ 0x18004ac17
// > cocos2d::CCBMFontConfiguration::parseConfigFile @ 0x18004b11a
// > sub_18006C540 @ 0x18006c651
// > cocos2d::CCFileUtils::addSearchPath @ 0x18006d93f
// > cocos2d::CCFileUtils::fullPathForFilename @ 0x18006ec04
// > cocos2d::CCFileUtils::fullPathForFilename @ 0x18006f34c
// > cocos2d::CCFileUtils::fullPathForFilename @ 0x18006f43c
// > cocos2d::CCFileUtils::getPathForFilename @ 0x18007037d
// > cocos2d::CCFileUtils::getPathForFilename @ 0x1800704b3
// > cocos2d::CCFileUtils::init @ 0x180070660
// > cocos2d::CCFileUtils::setSearchPaths @ 0x18007150d
// > cocos2d::CCFileUtils::setSearchPaths @ 0x1800715ef
// > cocos2d::CCFileUtils::setSearchResolutionsOrder @ 0x180071850
// > sub_180073010 @ 0x180073050
// > sub_180073010 @ 0x180073069
// > cocos2d::CCApplication::setResourceRootPath @ 0x180073b06
// > sub_1800798E0 @ 0x1800799c6
// > sub_1800798E0 @ 0x180079a56
// > sub_180079B90 @ 0x180079bf2
// > sub_180079B90 @ 0x180079c00
// > sub_180079D80 @ 0x180079df6
// > cocos2d::CCFileUtils::CCFileUtils @ 0x180079e80
// > cocos2d::CCFileUtils::CCFileUtils @ 0x180079ed3
// > pugi::xml_document::save_string @ 0x180085371
// > cocos2d::ZipUtils::base64DecodeEnc @ 0x1800a2c91
// > cocos2d::ZipUtils::base64DecodeEnc @ 0x1800a2d1f
// > cocos2d::ZipUtils::base64DecodeEnc @ 0x1800a2df2
// > cocos2d::ZipUtils::base64EncodeEnc @ 0x1800a2eab
// > cocos2d::ZipUtils::base64EncodeEnc @ 0x1800a2ec5
// > cocos2d::ZipUtils::base64EncodeEnc @ 0x1800a303d
// > cocos2d::ZipUtils::base64URLDecode @ 0x1800a30c7
// > cocos2d::ZipUtils::base64URLEncode @ 0x1800a31f7
// > cocos2d::ZipUtils::compressString @ 0x1800a3e2b
// > cocos2d::ZipUtils::decompressString @ 0x1800a42db
// > cocos2d::CCTMXMapInfo::startElement @ 0x1800affa5
// > cocos2d::CCTMXMapInfo::startElement @ 0x1800affb9
// > cocos2d::CCActionTween::CCActionTween @ 0x1800c3806
// > cocos2d::CCApplication::CCApplication @ 0x1800c3b27
// > cocos2d::CCApplication::CCApplication @ 0x1800c3b35
// > cocos2d::CCBMFontConfiguration::CCBMFontConfiguration @ 0x1800c3eaf
// > cocos2d::CCComponent::CCComponent @ 0x1800c4601
// > cocos2d::CCLabelAtlas::CCLabelAtlas @ 0x1800c653d
// > cocos2d::CCLabelBMFont::CCLabelBMFont @ 0x1800c65cb
// > cocos2d::CCLabelBMFont::CCLabelBMFont @ 0x1800c65ed
// > cocos2d::CCLabelTTF::CCLabelTTF @ 0x1800c67b2
// > cocos2d::CCMenuItemFont::CCMenuItemFont @ 0x1800c6f5d
// > cocos2d::CCParticleSystem::CCParticleSystem @ 0x1800c7adc
// > cocos2d::CCPrettyPrinter::CCPrettyPrinter @ 0x1800c81fd
// > cocos2d::CCPrettyPrinter::CCPrettyPrinter @ 0x1800c820b
// > cocos2d::CCSpriteFrame::CCSpriteFrame @ 0x1800c97a2
// > cocos2d::CCSpriteFrame::CCSpriteFrame @ 0x1800c97b6
// > cocos2d::CCTMXLayer::CCTMXLayer @ 0x1800c9a1d
// > cocos2d::CCTMXLayerInfo::CCTMXLayerInfo @ 0x1800c9b21
// > cocos2d::CCTMXMapInfo::CCTMXMapInfo @ 0x1800c9c69
// > cocos2d::CCTMXMapInfo::CCTMXMapInfo @ 0x1800c9c7d
// > cocos2d::CCTMXMapInfo::CCTMXMapInfo @ 0x1800c9c91
// > cocos2d::CCTMXObjectGroup::CCTMXObjectGroup @ 0x1800c9d56
// > cocos2d::CCTMXTilesetInfo::CCTMXTilesetInfo @ 0x1800c9e79
// > cocos2d::CCTMXTilesetInfo::CCTMXTilesetInfo @ 0x1800c9ea6
// > cocos2d::CCFileUtils::getAndroidPath @ 0x1800d17b0
// > cocos2d::CCSpriteFrame::getFrameName @ 0x1800d1943
// > sub_1800E3BA0 @ 0x1800e3c12
// > ??> @ 0x1801ae5c0
//
// 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_180016C80(__int64 a1, __int64 a2)
{
_QWORD *v2; // rax
_OWORD *v4; // rbp
unsigned __int64 v5; // rsi
__int64 v6; // rdi
size_t v7; // rax
void *v8; // rax
void *v9; // rcx
v2 = nullptr;
*(_OWORD *)a1 = 0;
*(_QWORD *)(a1 + 16) = 0;
*(_QWORD *)(a1 + 24) = 0;
v4 = (_OWORD *)a2;
if ( *(_QWORD *)(a2 + 24) > 0xFu )
v4 = *(_OWORD **)a2;
v5 = *(_QWORD *)(a2 + 16);
v6 = 0x7FFFFFFFFFFFFFFFLL;
if ( v5 > 0x7FFFFFFFFFFFFFFFLL )
std::vector::_Xlen();
*(_QWORD *)(a1 + 24) = 15;
if ( v5 > 0xF )
{
if ( (v5 | 0xF) <= 0x7FFFFFFFFFFFFFFFLL )
{
v6 = v5 | 0xF;
if ( (v5 | 0xF) < 0x16 )
v6 = 22;
if ( (unsigned __int64)(v6 + 1) < 0x1000 )
{
if ( v6 != -1 )
v2 = operator new(v6 + 1);
goto LABEL_18;
}
v7 = v6 + 40;
if ( v6 + 40 < (unsigned __int64)(v6 + 1) )
Concurrency::cancel_current_task();
}
else
{
v7 = 0x8000000000000027uLL;
}
v8 = operator new(v7);
v9 = v8;
if ( !v8 )
invalid_parameter_noinfo_noreturn();
v2 = (_QWORD *)(((unsigned __int64)v8 + 39) & 0xFFFFFFFFFFFFFFE0uLL);
*(v2 - 1) = v9;
LABEL_18:
*(_QWORD *)a1 = v2;
*(_QWORD *)(a1 + 16) = v5;
*(_QWORD *)(a1 + 24) = v6;
memcpy(v2, v4, v5 + 1);
return a1;
}
*(_QWORD *)(a1 + 16) = v5;
*(_OWORD *)a1 = *v4;
return a1;
}