From 099bfed806bb3b72824ac6ae8015df99ce90b392 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 1 Oct 2016 12:27:24 +0300 Subject: [PATCH] Fixed endianness issue with precaching of MUS files --- src/sound/music_mus_midiout.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sound/music_mus_midiout.cpp b/src/sound/music_mus_midiout.cpp index 17426a798..58b86201a 100644 --- a/src/sound/music_mus_midiout.cpp +++ b/src/sound/music_mus_midiout.cpp @@ -211,11 +211,11 @@ bool MUSSong2::CheckDone() void MUSSong2::Precache() { - TArray work(MusHeader->NumInstruments); + TArray work(LittleShort(MusHeader->NumInstruments)); const BYTE *used = (BYTE *)MusHeader + sizeof(MUSHeader) / sizeof(BYTE); int i, k; - for (i = k = 0; i < MusHeader->NumInstruments; ++i) + for (i = k = 0; i < LittleShort(MusHeader->NumInstruments); ++i) { BYTE instr = used[k++]; WORD val;