Skip to content

Commit 588224f

Browse files
TeamSpen210craftablescience
authored andcommitted
dmxpp: Add basic handling for srctools' unicode format names
1 parent 0978c60 commit 588224f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

include/dmxpp/dmxpp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ namespace Format {
1313

1414
constexpr std::string_view TEXT = "keyvalues2";
1515
constexpr std::string_view BINARY = "binary";
16+
constexpr std::string_view SRCTOOLS_UTF8_TEXT = "unicode_keyvalues2";
17+
constexpr std::string_view SRCTOOLS_UTF8_BINARY = "unicode_binary";
1618

1719
} // namespace Format
1820

src/dmxpp/dmxpp.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ DMX::DMX(const std::byte* dmxData, std::size_t dmxSize) {
5050
return;
5151
}
5252

53-
if (this->encodingType == Format::BINARY) {
53+
// Srctools formats indicate that all strings are specifically UTF-8.
54+
if (this->encodingType == Format::BINARY || this->encodingType == Format::SRCTOOLS_UTF8_BINARY) {
5455
this->opened = this->openBinary(stream);
55-
} else if (this->encodingType == Format::TEXT) {
56+
} else if (this->encodingType == Format::TEXT || this->encodingType == Format::SRCTOOLS_UTF8_TEXT) {
5657
this->opened = this->openText(dmxData, dmxSize);
5758
}
5859
}

0 commit comments

Comments
 (0)