//
// cocos2d::CCFileUtils::writeToFile from 0xb046d0 to 0xb047f4 (292 bytes)
//
// 3 xrefs:
// > ??> @ 0xc93a8
// > ??> @ 0x1217b88
// > ??> @ 0x1218048
//
// 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 cocos2d::CCFileUtils::writeToFile(__int64 a1, __int64 a2, const char **a3)
{
tinyxml2::XMLDocument *v5; // x19
tinyxml2::XMLNode *v6; // x0
tinyxml2::XMLNode *v7; // x0
tinyxml2::XMLElement *v8; // x20
tinyxml2::XMLAttribute *Attribute; // x0
tinyxml2::XMLNode *v10; // x0
bool v11; // zf
__int64 v12; // x1
tinyxml2::XMLDocument *v13; // x0
unsigned int v14; // w19
v5 = (tinyxml2::XMLDocument *)operator new(0x280u);
tinyxml2::XMLDocument::XMLDocument(v5, 1, 0);
v6 = (tinyxml2::XMLNode *)tinyxml2::XMLDocument::NewDeclaration(v5, "xml version=\"1.0\" encoding=\"UTF-8\"");
if ( !v6 )
goto LABEL_8;
tinyxml2::XMLNode::InsertEndChild(v5, v6);
v7 = (tinyxml2::XMLNode *)tinyxml2::XMLDocument::NewElement(
v5,
"!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"");
tinyxml2::XMLNode::InsertEndChild(v5, v7);
v8 = (tinyxml2::XMLElement *)tinyxml2::XMLDocument::NewElement(v5, "plist");
Attribute = (tinyxml2::XMLAttribute *)tinyxml2::XMLElement::FindOrCreateAttribute(v8, "version");
tinyxml2::XMLAttribute::SetAttribute(Attribute, "1.0");
if ( !v8 )
goto LABEL_8;
tinyxml2::XMLNode::InsertEndChild(v5, v8);
v10 = sub_B0460C(a2, v5);
if ( v10 )
{
tinyxml2::XMLNode::InsertEndChild(v8, v10);
v11 = (unsigned int)tinyxml2::XMLDocument::SaveFile(v5, *a3, 0) == 0;
v12 = *(_QWORD *)v5;
v13 = v5;
v14 = v11;
(*(void (__fastcall **)(tinyxml2::XMLDocument *))(v12 + 136))(v13);
return v14;
}
else
{
LABEL_8:
(*(void (__fastcall **)(tinyxml2::XMLDocument *))(*(_QWORD *)v5 + 136LL))(v5);
return 0;
}
}