1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2025-02-06 16:47:47 -05:00

Fixed MPQ load issue on french localized D2 (#103)

This commit is contained in:
Tim Sarbin 2019-11-07 17:26:36 -05:00 committed by GitHub
parent eaeaf5adb9
commit ed237307bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -259,8 +259,11 @@ func (v *Engine) LoadFile(fileName string) []byte {
if !mpq.FileExists(fileName) {
continue
}
v.Files[fileName] = path.Join(v.Settings.MpqPath, mpqFile)
result, _ := mpq.ReadFile(fileName)
if len(result) == 0 {
continue
}
v.Files[fileName] = path.Join(v.Settings.MpqPath, mpqFile)
return result
}
log.Fatalf("Could not load %s from MPQs", fileName)

View File

@ -227,7 +227,7 @@ func (v MPQ) getFileHashEntry(fileName string) (HashTableEntry, error) {
func (v MPQ) GetFileBlockData(fileName string) (BlockTableEntry, error) {
fileName = strings.ReplaceAll(fileName, "{LANG}", resourcepaths.LanguageCode)
fileEntry, err := v.getFileHashEntry(fileName)
if err != nil {
if err != nil || fileEntry.BlockIndex >= uint32(len(v.BlockTableEntries)) {
return BlockTableEntry{}, err
}
return v.BlockTableEntries[fileEntry.BlockIndex], nil