[Kernel] Add comment about Shadowrun bug.

[Kernel] Add comment about Shadowrun thread name bug and a bonus lint fix.
This commit is contained in:
gibbed 2020-11-22 15:46:56 -06:00 committed by Rick Gibbed
parent a6868d1f8a
commit bdeae25353
1 changed files with 5 additions and 2 deletions

View File

@ -47,10 +47,13 @@ void HandleSetThreadName(pointer_t<X_EXCEPTION_RECORD> record) {
return;
}
// Shadowrun (and its demo) has a bug where it ends up passing freed memory
// for the name, so at the point of SetThreadName it's filled with junk.
// TODO(gibbed): cvar for thread name encoding for conversion, some games use
// SJIS and there's no way to automatically know this.
auto name =
std::string(kernel_memory()->TranslateVirtual<const char*>(thread_info->name_ptr));
auto name = std::string(
kernel_memory()->TranslateVirtual<const char*>(thread_info->name_ptr));
std::replace_if(
name.begin(), name.end(), [](auto c) { return c < 32 || c > 127; }, '?');