//
// sub_180010050 from 0x180010050 to 0x1800101b1 (353 bytes)
//
// 85 xrefs:
// > cocos2d::CCString::operator= @ 0x18000ff97
// > cocos2d::CCString::initWithFormatAndValist @ 0x180010654
// > DS_Dictionary::loadRootSubDictFromCompressedFile @ 0x18001bb40
// > DS_Dictionary::saveRootSubDictToCompressedFile @ 0x18001d4f3
// > DS_Dictionary::saveRootSubDictToFile @ 0x18001dce3
// > DS_Dictionary::setRectArrayForKey @ 0x18001f8c3
// > DS_Dictionary::setVec2ArrayForKey @ 0x180020795
// > sub_1800214B0 @ 0x18002158b
// > cocos2d::CCActionTween::initWithDuration @ 0x18003d0f1
// > cocos2d::CCLabelAtlas::setString @ 0x1800466f1
// > cocos2d::CCLabelBMFont::initWithString @ 0x180048a45
// > cocos2d::CCBMFontConfiguration::parseImageFileName @ 0x18004b4d5
// > cocos2d::CCLabelBMFont::setFntFile @ 0x18004c5e6
// > cocos2d::CCLabelBMFont::setString @ 0x18004ca64
// > cocos2d::CCLabelTTF::_prepareTextDefinition @ 0x18004d9c3
// > cocos2d::CCLabelTTF::getTextDefinition @ 0x18004e1a3
// > cocos2d::CCLabelTTF::setString @ 0x18004e831
// > cocos2d::CCMenuItemFont::initWithString @ 0x18005b1c3
// > cocos2d::CCMenuItemFont::setFontName @ 0x18005b8e4
// > cocos2d::CCMenuItemFont::setFontNameObj @ 0x18005b921
// > cocos2d::CCFileUtils::addSearchPath @ 0x18006d74b
// > cocos2d::CCFileUtils::getFullPathForDirectoryAndFilename @ 0x1800701c6
// > cocos2d::CCFileUtils::removeSearchPath @ 0x180070d8a
// > cocos2d::CCFileUtils::setSearchPaths @ 0x1800712cf
// > sub_180071FE0 @ 0x1800721c5
// > cocos2d::CCApplication::setResourceRootPath @ 0x18007398c
// > cocos2d::CCApplication::setStartupScriptFilename @ 0x180073c46
// > sub_1800798E0 @ 0x180079a1f
// > sub_1800798E0 @ 0x180079a99
// > cocos2d::CCFileUtils::operator= @ 0x18007a051
// > cocos2d::CCFileUtils::operator= @ 0x18007a0ca
// > cocos2d::CCFileUtilsWin32::init @ 0x18007abb1
// > cocos2d::CCFileUtilsWin32::utf8Togbk @ 0x18007b254
// > sub_18007D8A0 @ 0x18007dc15
// > sub_18007D8A0 @ 0x18007e05d
// > cocos2d::CCSpriteFrame::initWithTextureFilename @ 0x18008ff91
// > cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile @ 0x1800915d7
// > cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile @ 0x180091642
// > cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile @ 0x18009175a
// > cocos2d::CCProfiler::createAndAddTimerWithName @ 0x180094795
// > cocos2d::CCComponent::setName @ 0x18009620e
// > cocos2d::ZipUtils::urlDecode @ 0x1800a4ad4
// > cocos2d::CCTextureCache::addImageAsync @ 0x1800a838d
// > cocos2d::CCTMXLayer::initWithTilesetInfo @ 0x1800ac221
// > cocos2d::CCTMXMapInfo::endElement @ 0x1800af3d4
// > cocos2d::CCTMXMapInfo::internalInit @ 0x1800af934
// > cocos2d::CCTMXMapInfo::internalInit @ 0x1800af9b2
// > cocos2d::CCTMXMapInfo::setCurrentString @ 0x1800afcb1
// > cocos2d::CCTMXObjectGroup::setGroupName @ 0x1800afcde
// > cocos2d::CCTMXMapInfo::startElement @ 0x1800b05ca
// > cocos2d::CCTMXMapInfo::startElement @ 0x1800b0c11
// > cocos2d::CCTMXMapInfo::textHandler @ 0x1800b2473
// > cocos2d::CCTextFieldTTF::setString @ 0x1800b6068
// > cocos2d::CCActionTween::operator= @ 0x1800cbb55
// > cocos2d::CCApplication::operator= @ 0x1800cbdfe
// > cocos2d::CCApplication::operator= @ 0x1800cbe21
// > cocos2d::CCBMFontConfiguration::operator= @ 0x1800cc08c
// > cocos2d::CCComponent::operator= @ 0x1800cc65e
// > cocos2d::CCLabelAtlas::operator= @ 0x1800cd849
// > cocos2d::CCLabelBMFont::operator= @ 0x1800cd8fb
// > cocos2d::CCLabelBMFont::operator= @ 0x1800cd932
// > cocos2d::CCLabelTTF::operator= @ 0x1800cdace
// > cocos2d::CCMenuItemFont::operator= @ 0x1800cdfd5
// > cocos2d::CCParticleSystem::operator= @ 0x1800ce5f3
// > cocos2d::CCPrettyPrinter::operator= @ 0x1800cebe4
// > cocos2d::CCPrettyPrinter::operator= @ 0x1800cec07
// > cocos2d::CCSpriteFrame::operator= @ 0x1800cf89f
// > cocos2d::CCSpriteFrame::operator= @ 0x1800cf8c8
// > cocos2d::CCTMXLayer::operator= @ 0x1800cfa89
// > cocos2d::CCTMXLayerInfo::operator= @ 0x1800cfb8e
// > cocos2d::CCTMXMapInfo::operator= @ 0x1800cfccb
// > cocos2d::CCTMXMapInfo::operator= @ 0x1800cfcf4
// > cocos2d::CCTMXMapInfo::operator= @ 0x1800cfd1d
// > cocos2d::CCTMXObjectGroup::operator= @ 0x1800cfde3
// > cocos2d::CCTMXTilesetInfo::operator= @ 0x1800cfef6
// > cocos2d::CCTMXTilesetInfo::operator= @ 0x1800cff38
// > cocos2d::CCFileUtils::setAndroidPath @ 0x1800d1ed4
// > cocos2d::CCBMFontConfiguration::setAtlasName @ 0x1800d1f5e
// > cocos2d::CCSpriteFrame::setFrameName @ 0x1800d20d7
// > cocos2d::CCTMXLayer::setLayerName @ 0x1800d2211
// > cocos2d::CCTMXMapInfo::setTMXFileName @ 0x1800d2461
// > ??> @ 0x1801322e4
// > ??> @ 0x1801322f4
// > ??> @ 0x180132308
// > ??> @ 0x1801ae0a4
//
// 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
//
void **__fastcall sub_180010050(void **a1, void *Src, size_t Size)
{
unsigned __int64 v3; // rbp
void *v7; // rdi
size_t v8; // rdi
__int64 v9; // rdx
size_t v10; // rcx
void *v11; // rax
_QWORD *v12; // r14
void *v13; // rcx
v3 = (unsigned __int64)a1[3];
if ( Size > v3 )
{
v8 = 0x7FFFFFFFFFFFFFFFLL;
if ( Size > 0x7FFFFFFFFFFFFFFFLL )
std::vector::_Xlen();
if ( (Size | 0xF) > 0x7FFFFFFFFFFFFFFFLL || (v9 = v3 >> 1, v3 > 0x7FFFFFFFFFFFFFFFLL - (v3 >> 1)) )
{
v10 = 0x8000000000000027uLL;
}
else
{
v8 = Size | 0xF;
if ( (Size | 0xF) < v9 + v3 )
v8 = v9 + v3;
if ( v8 + 1 < 0x1000 )
{
if ( v8 == -1 )
v12 = nullptr;
else
v12 = operator new(v8 + 1);
goto LABEL_19;
}
v10 = v8 + 40;
if ( v8 + 40 < v8 + 1 )
Concurrency::cancel_current_task();
}
v11 = operator new(v10);
if ( !v11 )
goto LABEL_26;
v12 = (_QWORD *)(((unsigned __int64)v11 + 39) & 0xFFFFFFFFFFFFFFE0uLL);
*(v12 - 1) = v11;
LABEL_19:
a1[2] = (void *)Size;
a1[3] = (void *)v8;
memcpy(v12, Src, Size);
*((_BYTE *)v12 + Size) = 0;
if ( v3 <= 0xF )
{
LABEL_24:
*a1 = v12;
return a1;
}
v13 = *a1;
if ( v3 + 1 < 0x1000 )
{
LABEL_23:
j_j_free_0(v13);
goto LABEL_24;
}
if ( (unsigned __int64)v13 - *((_QWORD *)v13 - 1) - 8 <= 0x1F )
{
v13 = *((void **)v13 - 1);
goto LABEL_23;
}
LABEL_26:
invalid_parameter_noinfo_noreturn();
}
v7 = a1;
if ( v3 > 0xF )
v7 = *a1;
a1[2] = (void *)Size;
memmove(v7, Src, Size);
*((_BYTE *)v7 + Size) = 0;
return a1;
}