//
// sub_1800179A0 from 0x1800179a0 to 0x180017a70 (208 bytes)
//
// 15 xrefs:
// > sub_180018430 @ 0x18001846d
// > std::basic_stringbuf,std::allocator>::`scalar deleting destructor' @ 0x18001874f
// > sub_180018780 @ 0x1800187cc
// > DS_Dictionary::setRectArrayForKey @ 0x18001f98e
// > DS_Dictionary::setRectForKey @ 0x18001fd58
// > DS_Dictionary::setVec2ArrayForKey @ 0x180020860
// > DS_Dictionary::setVec2ForKey @ 0x180020be6
// > sub_1800A2A30 @ 0x1800a2a6d
// > sub_1800A2A90 @ 0x1800a2acd
// > sub_1800A2B10 @ 0x1800a2b5c
// > sub_1800A2BB0 @ 0x1800a2bfc
// > cocos2d::ZipUtils::hexToChar @ 0x1800a461b
// > cocos2d::ZipUtils::urlDecode @ 0x1800a494b
// > cocos2d::ZipUtils::urlDecode @ 0x1800a4b02
// > ??> @ 0x1801ae6f8
//
// 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 sub_1800179A0(__int64 a1)
{
bool v1; // zf
__int64 v3; // rax
__int64 v4; // rdi
_QWORD *v5; // rsi
v1 = (*(_BYTE *)(a1 + 112) & 1) == 0;
*(_QWORD *)a1 = &std::stringbuf::`vftable';
if ( !v1 )
{
if ( std::streambuf::pptr() )
v3 = std::streambuf::epptr(a1);
else
v3 = std::streambuf::egptr(a1);
v4 = v3;
v5 = (_QWORD *)std::streambuf::eback(a1);
if ( (unsigned __int64)(v4 - std::streambuf::eback(a1)) >= 0x1000 )
{
if ( (unsigned __int64)v5 - *(v5 - 1) - 8 > 0x1F )
invalid_parameter_noinfo_noreturn();
v5 = (_QWORD *)*(v5 - 1);
}
j_j_free_0(v5);
}
std::streambuf::setg(a1, 0, 0, 0);
std::streambuf::setp(a1, 0, 0);
*(_DWORD *)(a1 + 112) &= ~1u;
*(_QWORD *)(a1 + 104) = 0;
return std::streambuf::~streambuf>(a1);
}