--- np2/sound/rhythmc.c 2003/10/16 17:58:05 1.1.1.1 +++ np2/sound/rhythmc.c 2004/02/18 18:29:29 1.7 @@ -2,6 +2,7 @@ #include #include "wavefile.h" #include "dosio.h" +#include "pccore.h" #include "sound.h" #include "rhythm.h" @@ -22,6 +23,7 @@ static const char *rhythmfile[RHYTHM_MAX static BOOL pcmload(RHYTHMPCM *pcm, const char *fname, UINT rate) { + char path[MAX_PATH]; FILEH fh; RIFF_HEADER riff; BOOL head; @@ -35,7 +37,8 @@ static BOOL pcmload(RHYTHMPCM *pcm, cons UINT pos; BYTE work[256]; - fh = file_open_c(fname); + getbiospath(path, fname, sizeof(path)); + fh = file_open_rb(path); if (fh == FILEH_INVALID) { goto pld_err1; } @@ -79,6 +82,9 @@ static BOOL pcmload(RHYTHMPCM *pcm, cons goto pld_err2; } step = 44100 / rate; + if (step == 0) { + goto pld_err2; + } samples = size / 2 / step; if (samples == 0) { goto pld_err2; @@ -166,10 +172,10 @@ void rhythm_update(RHYTHM rhy) { } while(++r < rterm); } -void rhythm_setreg(RHYTHM rhy, BYTE reg, BYTE value) { +void rhythm_setreg(RHYTHM rhy, REG8 reg, REG8 value) { RHYTHMCH *r; - BYTE bit; + REG8 bit; int i; if (reg == 0x10) { @@ -191,7 +197,7 @@ void rhythm_setreg(RHYTHM rhy, BYTE reg, r++; } } - else if (reg == 0x11) { // ver0.28 + else if (reg == 0x11) { sound_sync(); rhy->vol = (~value) & 0x3f; rhythm_update(rhy);