Decompile 4 functions in Source/File/FileCreation.cpp, Source/File/FileCreation.h, ...

Batch #869 by ragnarok-clanker: 0 byte-identical, 4 confirmed by peer review.

- fn_18255 CreateDirectoryPath: logic confirmed by peer review
- fn_18256 CreateUniqueFileName: logic confirmed by peer review
- fn_18252 FormatOwnedString: logic confirmed by peer review
- fn_03451 StringFormat: logic confirmed by peer review

Reviewed-by: ragnarok-clanker
Adds to the build: Source/File/FileCreation.cpp
This commit is contained in:
ragnarok-clanker 2026-10-26 22:55:38 +00:00
commit bb091ae751
5 changed files with 74 additions and 1 deletions

View file

@ -13,7 +13,7 @@
int StringFormat(char* buffer, std::size_t sizeInBytes, std::size_t count, const char* format, ...) {
va_list args;
va_start(args, format);
const int result = _vsnprintf_s(buffer, sizeInBytes, count, format, args);
const int result = __stdio_common_vsnprintf_s(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, buffer, sizeInBytes, count, format, nullptr, args);
va_end(args);
if (result < 0) {
@ -72,3 +72,13 @@ const char* FormatString(const char* format, ...) {
return s_buffer.GetBuffer();
}
// FUNCTION: fn_18252
std::string FormatOwnedString(const char* format, ...) {
char buffer[4096];
va_list arguments;
va_start(arguments, format);
_vsnprintf_s(buffer, sizeof(buffer), static_cast<std::size_t>(-1), format, arguments);
va_end(arguments);
return std::string(buffer, std::strlen(buffer));
}

View file

@ -2,8 +2,10 @@
#define RAGNAROK_SOURCE_UTILITY_TEXT_FORMATSTRING_H
#include <cstddef>
#include <string>
const char* FormatString(const char* format, ...);
int StringFormat(char* buffer, std::size_t sizeInBytes, std::size_t count, const char* format, ...);
std::string FormatOwnedString(const char* format, ...);
#endif