//
// sub_1800178D0 from 0x1800178d0 to 0x18001799f (207 bytes)
//
// 12 xrefs:
// > sub_180018350 @ 0x180018390
// > sub_1800183C0 @ 0x180018400
// > sub_180018680 @ 0x18001868f
// > DS_Dictionary::copyFile @ 0x180019820
// > DS_Dictionary::copyFile @ 0x180019865
// > DS_Dictionary::saveRootSubDictToCompressedFile @ 0x18001d8b0
// > DS_Dictionary::saveRootSubDictToCompressedFile @ 0x18001d8f8
// > DS_Dictionary::saveRootSubDictToFile @ 0x18001dfce
// > DS_Dictionary::saveRootSubDictToFile @ 0x18001e013
// > sub_1800E0D80 @ 0x1800e0d8b
// > int `Concurrency::agent::agent @ 0x1800e0deb
// > ??> @ 0x1801ae6ec
//
// 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_1800178D0(__int64 a1)
{
*(_QWORD *)a1 = &std::filebuf::`vftable';
if ( *(_QWORD *)(a1 + 128) && ((__int64 (*)(void))std::streambuf::eback)() == a1 + 112 )
std::streambuf::setg(a1, *(_QWORD *)(a1 + 136), *(_QWORD *)(a1 + 136), *(_QWORD *)(a1 + 144));
if ( *(_BYTE *)(a1 + 124) )
{
if ( *(_QWORD *)(a1 + 128) )
{
if ( std::streambuf::eback(a1) == a1 + 112 )
std::streambuf::setg(a1, *(_QWORD *)(a1 + 136), *(_QWORD *)(a1 + 136), *(_QWORD *)(a1 + 144));
sub_180018A50(a1);
fclose(*(FILE **)(a1 + 128));
}
*(_BYTE *)(a1 + 124) = 0;
*(_BYTE *)(a1 + 113) = 0;
std::streambuf::_Init(a1);
*(_QWORD *)(a1 + 128) = 0;
*(_QWORD *)(a1 + 116) = qword_1801A8360;
*(_QWORD *)(a1 + 104) = 0;
}
return std::streambuf::~streambuf>(a1);
}