diff --git a/src/xenia/cpu/xex_module.cc b/src/xenia/cpu/xex_module.cc index 4d5e6801b..28fdd9b8c 100644 --- a/src/xenia/cpu/xex_module.cc +++ b/src/xenia/cpu/xex_module.cc @@ -264,8 +264,7 @@ bool XexModule::Load(const std::string& name, const std::string& path, for (uint32_t i = 0; i < library_count; i++) { auto library = reinterpret_cast(libraries_ptr + library_offset); - SetupLibraryImports(string_table[library->name_index % library_count], - library); + SetupLibraryImports(string_table[library->name_index & 0xFF], library); library_offset += library->size; } diff --git a/src/xenia/kernel/user_module.cc b/src/xenia/kernel/user_module.cc index b831c8adb..36e11470f 100644 --- a/src/xenia/kernel/user_module.cc +++ b/src/xenia/kernel/user_module.cc @@ -479,7 +479,7 @@ void UserModule::Dump() { for (uint32_t l = 0; l < library_count; l++) { auto library = reinterpret_cast( libraries + library_offset); - auto name = string_table[library->name_index % library_count]; + auto name = string_table[library->name_index & 0xFF]; sb.AppendFormat(" %s - %d imports\n", name, (uint16_t)library->count); diff --git a/src/xenia/kernel/util/xex2.cc b/src/xenia/kernel/util/xex2.cc index 2bfe11ca3..823ec22f3 100644 --- a/src/xenia/kernel/util/xex2.cc +++ b/src/xenia/kernel/util/xex2.cc @@ -286,7 +286,7 @@ int xe_xex2_read_header(const uint8_t* addr, const size_t length, library->min_version.value = src_library->version_min.value; std::strncpy(library->name, - string_table[src_library->name_index % count], + string_table[src_library->name_index & 0xFF], xe::countof(library->name)); library->record_count = src_library->count;