//
// sub_D904E4 from 0xd904e4 to 0xd9065c (376 bytes)
//
// 10 xrefs:
// > cocos2d::CCUserDefault::setBoolForKey @ 0xd90694
// > cocos2d::CCUserDefault::getBoolForKey @ 0xd9075c
// > cocos2d::CCUserDefault::setIntegerForKey @ 0xd90840
// > cocos2d::CCUserDefault::getIntegerForKey @ 0xd90908
// > cocos2d::CCUserDefault::setFloatForKey @ 0xd909ec
// > cocos2d::CCUserDefault::getFloatForKey @ 0xd90ab8
// > cocos2d::CCUserDefault::setDoubleForKey @ 0xd90b98
// > cocos2d::CCUserDefault::getDoubleForKey @ 0xd90c64
// > cocos2d::CCUserDefault::setStringForKey @ 0xd90d3c
// > cocos2d::CCUserDefault::getStringForKey @ 0xd90e14
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:08:18 +0000
//
__int64 __fastcall sub_D904E4(const char *a1, tinyxml2::XMLDocument **a2)
{
tinyxml2::XMLDocument *v4; // x22
cocos2d::CCFileUtils *v5; // x0
cocos2d::CCUserDefault **v6; // x19
__int64 (__fastcall *v7)(cocos2d::CCUserDefault **, __int64, char *, _BYTE *); // x23
cocos2d::CCUserDefault *v8; // x0
__int64 *XMLFilePath; // x0
char *v10; // x19
tinyxml2::XMLNode *ChildElement; // x0
__int64 SiblingElement; // x19
const char *Str; // x0
cocos2d::CCUserDefault *v15; // x0
__int64 *v16; // x1
const char *v17; // x0
_BYTE v18[8]; // [xsp+40h] [xbp+40h] BYREF
if ( (a1 == nullptr) >= (unsigned int)(unsigned __int8)cocos2d::CCUserDefault::isXMLFileExist(_stack_chk_guard) )
return 0;
v4 = (tinyxml2::XMLDocument *)operator new(0x280u);
v5 = (cocos2d::CCFileUtils *)tinyxml2::XMLDocument::XMLDocument(v4, 1, 0);
*a2 = v4;
v6 = (cocos2d::CCUserDefault **)cocos2d::CCFileUtils::sharedFileUtils(v5);
v7 = *((__int64 (__fastcall **)(cocos2d::CCUserDefault **, __int64, char *, _BYTE *))*v6 + 4);
v8 = cocos2d::CCUserDefault::sharedUserDefault(*v6);
XMLFilePath = cocos2d::CCUserDefault::getXMLFilePath(v8);
if ( (*(_BYTE *)XMLFilePath & 1) != 0 )
{
v10 = (char *)v7(v6, XMLFilePath[2], "rb", v18);
if ( !v10 )
return 0;
}
else
{
v10 = (char *)v7(v6, (__int64)XMLFilePath + 1, "rb", v18);
if ( !v10 )
return 0;
}
tinyxml2::XMLDocument::Parse(v4, v10, 0xFFFFFFFFFFFFFFFFLL);
operator delete[](v10);
ChildElement = (tinyxml2::XMLNode *)tinyxml2::XMLNode::FirstChildElement(v4, nullptr);
if ( !ChildElement )
return 0;
SiblingElement = tinyxml2::XMLNode::FirstChildElement(ChildElement, nullptr);
if ( SiblingElement )
{
do
{
Str = (const char *)tinyxml2::StrPair::GetStr((tinyxml2::StrPair *)(SiblingElement + 24));
if ( !strcmp(Str, a1) )
break;
SiblingElement = tinyxml2::XMLNode::NextSiblingElement((tinyxml2::XMLNode *)SiblingElement, nullptr);
}
while ( SiblingElement );
return SiblingElement;
}
else
{
v15 = cocos2d::CCUserDefault::sharedUserDefault(nullptr);
v16 = cocos2d::CCUserDefault::getXMLFilePath(v15);
v17 = (char *)v16 + 1;
if ( (*(_BYTE *)v16 & 1) != 0 )
v17 = (const char *)v16[2];
remove(v17);
return 0;
}
}