//
// sub_1800174E0 from 0x1800174e0 to 0x1800175c3 (227 bytes)
//
// 15 xrefs:
// > sub_180018080 @ 0x1800180bd
// > sub_180018430 @ 0x18001843f
// > sub_180018470 @ 0x1800184bb
// > DS_Dictionary::setRectArrayForKey @ 0x18001fb46
// > DS_Dictionary::setRectForKey @ 0x18001ff48
// > DS_Dictionary::setVec2ArrayForKey @ 0x180020a61
// > DS_Dictionary::setVec2ForKey @ 0x180020e1d
// > sub_1800A6540 @ 0x1800a657d
// > sub_1800A65A0 @ 0x1800a65dd
// > sub_1800A6620 @ 0x1800a666b
// > sub_1800A66B0 @ 0x1800a66fb
// > cocos2d::ZipUtils::hexToChar @ 0x1800a7f0a
// > cocos2d::ZipUtils::urlDecode @ 0x1800a84ca
// > cocos2d::ZipUtils::urlDecode @ 0x1800a8584
// > ??> @ 0x1801b874c
//
// 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 11:21:25 +0000
//
__int64 __fastcall sub_1800174E0(__int64 a1)
{
bool v1; // zf
__int64 v3; // rax
__int64 v4; // rsi
_QWORD *v5; // rdi
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 )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
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);
}