diff --git a/plugins/adplug/adplug/hsc.cpp b/plugins/adplug/adplug/hsc.cpp index 25b406c007..af6520cb41 100644 --- a/plugins/adplug/adplug/hsc.cpp +++ b/plugins/adplug/adplug/hsc.cpp @@ -51,23 +51,24 @@ bool ChscPlayer::load(const std::string &filename, const CFileProvider &fp) int total_patterns_in_hsc = (fp.filesize(f) - 1587) / 1152; // load section - for(i=0;i<128*12;i++) // load instruments - *((unsigned char *)instr + i) = f->readInt(1); + f->readBuf ((char *)instr, 128*12); for (i=0;i<128;i++) { // correct instruments instr[i][2] ^= (instr[i][2] & 0x40) << 1; instr[i][3] ^= (instr[i][3] & 0x40) << 1; instr[i][11] >>= 4; // slide } + + f->readBuf ((char *)song, 51); // load tracklist + for(i=0;i<51;i++) { // load tracklist - song[i] = f->readInt(1); // if out of range, song ends here if ( ((song[i] & 0x7F) > 0x31) || ((song[i] & 0x7F) >= total_patterns_in_hsc) ) song[i] = 0xFF; } - for(i=0;i<50*64*9;i++) // load patterns - *((char *)patterns + i) = f->readInt(1); + + f->readBuf ((char *)patterns, 50*64*9); // load patterns fp.close(f); rewind(0); // rewind module diff --git a/plugins/adplug/adplug/ksm.cpp b/plugins/adplug/adplug/ksm.cpp index 67259c7e1c..2438c9c7f2 100644 --- a/plugins/adplug/adplug/ksm.cpp +++ b/plugins/adplug/adplug/ksm.cpp @@ -98,7 +98,7 @@ bool CksmPlayer::load(const std::string &filename, const CFileProvider &fp) bool CksmPlayer::update() { - int quanter,chan,drumnum,freq,track,volevel,volval; + int quanter,chan = 0,drumnum = 0,freq,track,volevel,volval; unsigned int i,j,bufnum; unsigned long temp,templong; diff --git a/plugins/adplug/adplug/lds.cpp b/plugins/adplug/adplug/lds.cpp index b02124787e..2c764b4d5b 100644 --- a/plugins/adplug/adplug/lds.cpp +++ b/plugins/adplug/adplug/lds.cpp @@ -557,6 +557,11 @@ void CldsPlayer::rewind(int subsong) void CldsPlayer::playsound(int inst_number, int channel_number, int tunehigh) { Channel *c = &channel[channel_number]; // current channel + + if (inst_number >= numpatch) { + inst_number = numpatch-1; + } + SoundBank *i = &soundbank[inst_number]; // current instrument unsigned int regnum = op_table[channel_number]; // channel's OPL2 register unsigned char volcalc, octave; diff --git a/plugins/adplug/adplug/raw.cpp b/plugins/adplug/adplug/raw.cpp index f41f552ef8..fbdc529775 100644 --- a/plugins/adplug/adplug/raw.cpp +++ b/plugins/adplug/adplug/raw.cpp @@ -137,6 +137,8 @@ bool CrawPlayer::update() setspeed = false; if (this->pos >= this->length) return false; + if (this->pos >= this->length) return false; + switch(this->data[this->pos].command) { case 0: this->del = this->data[this->pos].param - 1; diff --git a/plugins/adplug/adplug/woodyopl.cpp b/plugins/adplug/adplug/woodyopl.cpp index 96fce4149c..04dcd0d543 100644 --- a/plugins/adplug/adplug/woodyopl.cpp +++ b/plugins/adplug/adplug/woodyopl.cpp @@ -945,7 +945,7 @@ static void OPL_INLINE clipit8(Bit32s ival, Bit8s* outval) { *outval = 0; } } else { - *outval = 255; + *outval = -1; } }