Adds Message Viewer Window to Developer Tools (#3486)

* Adds a MessageViewer window to Developer Tools.

* Properly destroys message viewer window.

* Adds missing ImGui::End()

* Fixes an oopsie crashing non-windows builds after first run.

* Adds C ABI for displaying a custom message

* Fixes a crash and an issue with messages with SFX.

* Remove some osSyncPrintf's that aren't very useful for this case.
This commit is contained in:
Christopher Leggett
2024-02-15 20:23:12 -05:00
committed by GitHub
parent 0932e1e504
commit 3514954ad1
6 changed files with 364 additions and 1 deletions
+13
View File
@@ -336,3 +336,16 @@ std::string SohUtils::Sanitize(std::string stringValue) {
return stringValue;
}
size_t SohUtils::CopyStringToCharBuffer(char* buffer, const std::string& source, const size_t maxBufferSize) {
if (!source.empty()) {
// Prevent potential horrible overflow due to implicit conversion of maxBufferSize to an unsigned. Prevents negatives.
memset(buffer, 0, std::max<size_t>(0, maxBufferSize));
// Gaurentee that this value will be greater than 0, regardless of passed variables.
const size_t copiedCharLen = std::min<size_t>(std::max<size_t>(0, maxBufferSize - 1), source.length());
memcpy(buffer, source.c_str(), copiedCharLen);
return copiedCharLen;
}
return 0;
}