//
// sub_18009EE00 from 0x18009ee00 to 0x18009ef81 (385 bytes)
//
// 9 xrefs:
// > cocos2d::CCUserDefault::getBoolForKey @ 0x18009e904
// > cocos2d::CCUserDefault::getDoubleForKey @ 0x18009e9ad
// > cocos2d::CCUserDefault::getIntegerForKey @ 0x18009ea7c
// > cocos2d::CCUserDefault::getStringForKey @ 0x18009ebc2
// > cocos2d::CCUserDefault::setBoolForKey @ 0x18009f2ef
// > cocos2d::CCUserDefault::setDoubleForKey @ 0x18009f466
// > cocos2d::CCUserDefault::setIntegerForKey @ 0x18009f5a1
// > cocos2d::CCUserDefault::setStringForKey @ 0x18009f6af
// > ??> @ 0x1801b762c
//
// 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
const struct tinyxml2::XMLElement *__fastcall sub_18009EE00(__int64 a1, tinyxml2::XMLNode **a2, tinyxml2::XMLNode **a3)
{
const struct tinyxml2::XMLElement *i; // rbx
cocos2d::CCUserDefault *v8; // rax
tinyxml2::XMLNode *v9; // rdi
char **v10; // rbp
const char *v11; // rcx
FILE *v12; // rax
struct cocos2d::CCFileUtils *v13; // rax
_BYTE *v14; // rax
void *v15; // rbp
tinyxml2::XMLNode *ChildElement; // rax
const char *Str; // rax
__int64 v18; // r8
int v19; // ecx
int v20; // edx
unsigned int v21; // [rsp+50h] [rbp+8h] BYREF
cocos2d::CCUserDefault *v22; // [rsp+68h] [rbp+20h]
i = nullptr;
if ( !a1 )
return nullptr;
v8 = (cocos2d::CCUserDefault *)operator new(0x280u);
v22 = v8;
if ( v8 )
v9 = (tinyxml2::XMLNode *)tinyxml2::XMLDocument::XMLDocument((__int64)v8, 1, 0);
else
v9 = nullptr;
*a3 = v9;
cocos2d::CCUserDefault::initXMLFilePath();
v10 = &cocos2d::CCUserDefault::m_sFilePath;
v11 = (const char *)&cocos2d::CCUserDefault::m_sFilePath;
if ( *((_QWORD *)&xmmword_1801A8A40 + 1) > 0xFu )
v11 = cocos2d::CCUserDefault::m_sFilePath;
v12 = fopen(v11, "r");
if ( v12 )
{
fclose(v12);
goto LABEL_11;
}
if ( cocos2d::CCUserDefault::createXMLFile() )
{
LABEL_11:
if ( !cocos2d::CCUserDefault::m_spUserDefault )
{
v22 = (cocos2d::CCUserDefault *)operator new(1u);
cocos2d::CCUserDefault::m_spUserDefault = v22;
}
}
v13 = cocos2d::CCFileUtils::sharedFileUtils();
if ( *((_QWORD *)&xmmword_1801A8A40 + 1) > 0xFu )
v10 = (char **)cocos2d::CCUserDefault::m_sFilePath;
v14 = (_BYTE *)((__int64 (__fastcall *)(struct cocos2d::CCFileUtils *, char **, const char *, unsigned int *))v13->addSearchResolutionsOrder)(
v13,
v10,
"rb",
&v21);
v15 = v14;
if ( v14 )
{
tinyxml2::XMLDocument::Parse((__int64)v9, v14, v21);
j_j_free_0(v15);
ChildElement = tinyxml2::XMLNode::FirstChildElement(v9, nullptr);
*a2 = ChildElement;
if ( ChildElement )
{
for ( i = tinyxml2::XMLNode::FirstChildElement(ChildElement, nullptr);
i;
i = tinyxml2::XMLNode::NextSiblingElement(i, nullptr) )
{
Str = tinyxml2::StrPair::GetStr((const struct tinyxml2::XMLElement *)((char *)i + 24));
v18 = a1 - (_QWORD)Str;
do
{
v19 = (unsigned __int8)Str[v18];
v20 = *(unsigned __int8 *)Str - v19;
if ( v20 )
break;
++Str;
}
while ( v19 );
if ( !v20 )
break;
}
}
}
return i;
}