// // __crt_mbstring::__wcsrtombs_utf8 from 0x180137108 to 0x180137223 (283 bytes) // // 2 xrefs: // > _wcstombs_l_helper @ 0x18012b530 // > @ 0x1802035b4 // // 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 // unsigned __int64 __fastcall __crt_mbstring::__wcsrtombs_utf8( __crt_mbstring *this, char *a2, const wchar_t **a3, struct _Mbstatet *a4) { unsigned __int16 *v4; // rsi char16_t v5; // bp __crt_mbstring *v9; // rbx unsigned __int16 *v10; // rdi __crt_mbstring *v11; // r12 size_t v12; // rax size_t v13; // rbp unsigned __int64 result; // rax __int64 v15; // rbx struct _Mbstatet *v16; // [rsp+20h] [rbp-58h] _BYTE v17[8]; // [rsp+28h] [rbp-50h] BYREF v4 = *(unsigned __int16 **)a2; v5 = (unsigned __int16)a4; v16 = a4; if ( this ) { v9 = this; v10 = v4; while ( 1 ) { v11 = (__crt_mbstring *)v17; if ( (unsigned __int64)a3 >= 4 ) v11 = v9; v12 = __crt_mbstring::__c16rtomb_utf8(v11, (char *)*v4, v5, a4); v13 = v12; if ( v12 == -1 ) break; if ( v11 != v9 ) { if ( (unsigned __int64)a3 < v12 ) goto LABEL_15; memmove(v9, v11, v12); } if ( v13 && !*((_BYTE *)v9 + v13 - 1) ) { v10 = nullptr; v9 = (__crt_mbstring *)((char *)v9 + v13 - 1); LABEL_15: *(_QWORD *)a2 = v10; return v9 - this; } ++v4; if ( v13 ) v10 = v4; a3 = (const wchar_t **)((char *)a3 - v13); v9 = (__crt_mbstring *)((char *)v9 + v13); v5 = (unsigned __int16)v16; } *(_QWORD *)a2 = v10; return -1; } else { v15 = 0; while ( 1 ) { result = __crt_mbstring::__c16rtomb_utf8((__crt_mbstring *)v17, (char *)*v4, v5, a4); if ( result == -1 ) break; if ( result && !v17[result - 1] ) return v15 + result - 1; v15 += result; ++v4; } } return result; }