//
// sub_1006AFEB0 from 0x1006afeb0 to 0x1006b0030 (384 bytes)
//
// 10 xrefs:
// > cocos2d::CCUserDefault::getBoolForKey @ 0x1006afd43
// > cocos2d::CCUserDefault::setBoolForKey @ 0x1006b0074
// > cocos2d::CCUserDefault::getIntegerForKey @ 0x1006b01a3
// > cocos2d::CCUserDefault::setIntegerForKey @ 0x1006b0334
// > cocos2d::CCUserDefault::getFloatForKey @ 0x1006b0424
// > cocos2d::CCUserDefault::setFloatForKey @ 0x1006b05b6
// > cocos2d::CCUserDefault::getDoubleForKey @ 0x1006b06b4
// > cocos2d::CCUserDefault::setDoubleForKey @ 0x1006b0846
// > cocos2d::CCUserDefault::getStringForKey @ 0x1006b096a
// > cocos2d::CCUserDefault::setStringForKey @ 0x1006b0c53
//
// This function is hookable on this platform (idp: pc, 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 12:35:24 +0000
//
__int64 __fastcall sub_1006AFEB0(char *__s2, _QWORD *a2)
{
__int64 v2; // rax
FILE *v4; // rax
void *v5; // r14
__int64 v6; // r15
std::string::pointer data; // rsi
const char *v9; // rax
char *v10; // r15
__int64 v11; // rax
__int64 v12; // rdi
__int64 v13; // rax
__int64 v14; // r14
__int64 v15; // r15
const char *v16; // rax
__CFString *v17; // rdi
const std::__fs::filesystem::path *v18; // rdi
_QWORD v19[4]; // [rsp+0h] [rbp-20h] BYREF
v19[0] = v2;
if ( (*(_BYTE *)&stru_100BE8C08.__r_.__value_.__s.0 & 1) != 0 )
{
v4 = fopen(stru_100BE8C08.__r_.__value_.__l.__data_, "r");
if ( !v4 )
return 0;
}
else
{
v4 = fopen(stru_100BE8C08.__r_.__value_.__s.__data_, "r");
if ( !v4 )
return 0;
}
fclose(v4);
if ( !__s2 )
return 0;
v5 = operator new(0x280u);
sub_10005F740((__int64)v5, 1, 0);
*a2 = v5;
v6 = cocos2d::CCFileUtils::sharedFileUtils(v5, 1);
cocos2d::CCUserDefault::sharedUserDefault(v5);
if ( (*(_BYTE *)&stru_100BE8C08.__r_.__value_.__s.0 & 1) != 0 )
data = stru_100BE8C08.__r_.__value_.__l.__data_;
else
data = stru_100BE8C08.__r_.__value_.__s.__data_;
v9 = (const char *)(*(__int64 (__fastcall **)(__int64, std::string::pointer, const char *, _QWORD *))(*(_QWORD *)v6 + 32LL))(
v6,
data,
"rb",
v19);
if ( !v9 )
{
v17 = CFSTR("can not read xml file");
LABEL_19:
v15 = 0;
NSLog(&v17->isa);
return v15;
}
v10 = (char *)v9;
sub_1000603A0((__int64)v5, v9, 0xFFFFFFFFFFFFFFFFLL);
operator delete[](v10);
v11 = sub_10005C490((__int64)v5, nullptr);
if ( !v11 )
{
v17 = (__CFString *)CFSTR("read root node error");
goto LABEL_19;
}
v12 = v11;
v13 = sub_10005C490(v11, nullptr);
if ( v13 )
{
v14 = v13;
v15 = 0;
while ( 1 )
{
v16 = (const char *)sub_10005AD20((int *)(v14 + 24));
if ( !strcmp(v16, __s2) )
break;
v14 = sub_10005C670(v14, nullptr);
if ( !v14 )
return v15;
}
return v14;
}
cocos2d::CCUserDefault::sharedUserDefault(v12);
if ( (*(_BYTE *)&stru_100BE8C08.__r_.__value_.__s.0 & 1) != 0 )
v18 = (const std::__fs::filesystem::path *)stru_100BE8C08.__r_.__value_.__l.__data_;
else
v18 = (const std::__fs::filesystem::path *)((char *)&stru_100BE8C08.__r_.__value_.__l.0 + 1);
remove(v18, nullptr);
return 0;
}