//
// cocos2d::CCFileUtils::writeToFile from 0x180072200 to 0x18007234c (332 bytes)
//
// 4 xrefs:
// > ??> @ 0x180100428
// > ??> @ 0x180101150
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b4338
//
// 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=1
bool __fastcall cocos2d::CCFileUtils::writeToFile(__int64 a1, __int64 a2, _QWORD *a3)
{
void *v5; // rax
__int64 v6; // rdx
tinyxml2::XMLDocument *v7; // rdi
struct tinyxml2::XMLNode *v8; // rax
tinyxml2::XMLDocument *v9; // rcx
struct tinyxml2::XMLNode *v11; // rax
tinyxml2::XMLElement *v12; // rsi
tinyxml2::XMLAttribute *Attribute; // rax
struct tinyxml2::XMLElement *v14; // rax
bool v15; // bl
v5 = operator new(0x280u);
if ( v5 )
{
LOBYTE(v6) = 1;
v7 = (tinyxml2::XMLDocument *)tinyxml2::XMLDocument::XMLDocument(v5, v6, 0);
}
else
{
v7 = nullptr;
}
if ( !v7 )
return 0;
v8 = tinyxml2::XMLDocument::NewDeclaration(v7, "xml version=\"1.0\" encoding=\"UTF-8\"");
v9 = v7;
if ( !v8
|| (tinyxml2::XMLNode::InsertEndChild(v7, v8),
v11 = tinyxml2::XMLDocument::NewElement(
v7,
"!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\""),
tinyxml2::XMLNode::InsertEndChild(v7, v11),
v12 = tinyxml2::XMLDocument::NewElement(v7, "plist"),
Attribute = tinyxml2::XMLElement::FindOrCreateAttribute(v12, "version"),
tinyxml2::XMLAttribute::SetAttribute(Attribute, "1.0"),
v9 = v7,
!v12) )
{
(*(void (__fastcall **)(tinyxml2::XMLDocument *, __int64))(*(_QWORD *)v7 + 128LL))(v9, 1);
return 0;
}
tinyxml2::XMLNode::InsertEndChild(v7, v12);
v14 = sub_18006F980(a2, v7);
if ( v14 )
{
tinyxml2::XMLNode::InsertEndChild(v12, v14);
if ( a3[3] > 0xFu )
a3 = (_QWORD *)*a3;
v15 = (unsigned int)tinyxml2::XMLDocument::SaveFile(v7, a3, 0) == 0;
(*(void (__fastcall **)(tinyxml2::XMLDocument *, __int64))(*(_QWORD *)v7 + 128LL))(v7, 1);
return v15;
}
else
{
(*(void (__fastcall **)(tinyxml2::XMLDocument *, __int64))(*(_QWORD *)v7 + 128LL))(v7, 1);
return 0;
}
}