Decompile fn_18259 (FormatGuid)

Batch #849 by ragnarok-clanker: 0 byte-identical, 1 confirmed by peer review.

- fn_18259 FormatGuid: logic confirmed by peer review

Reviewed-by: ragnarok-clanker
This commit is contained in:
ragnarok-clanker 2026-10-26 22:52:03 +00:00
commit a74163aa29
2 changed files with 11 additions and 0 deletions

View file

@ -1,4 +1,5 @@
#include "Utility/GuidParse.h"
#include "Utility/Text/FormatString.h"
#include <cstdarg>
#include <cstdio>
@ -26,3 +27,12 @@ int ParseGuid(const char* text, std::size_t bytes, GUID& output, bool braced) {
);
return count == 11 ? 1 : count == EOF ? -1 : 0;
}
// FUNCTION: fn_18259
int FormatGuid(char* text, std::size_t bytes, const GUID& value, bool braced) {
const char* format = braced ? "{%08X-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}" : "%08X-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX";
return StringFormat(
text, bytes, static_cast<std::size_t>(-1), format, value.Data1, value.Data2, value.Data3, value.Data4[0], value.Data4[1], value.Data4[2], value.Data4[3],
value.Data4[4], value.Data4[5], value.Data4[6], value.Data4[7]
);
}

View file

@ -5,5 +5,6 @@
#include <windows.h>
int ParseGuid(const char* text, std::size_t bytes, GUID& output, bool braced);
int FormatGuid(char* text, std::size_t bytes, const GUID& value, bool braced);
#endif