From acb405ba36ec82511525f4f9e2a0775e2d85308e Mon Sep 17 00:00:00 2001 From: Takamichi Horikawa Date: Sun, 22 Oct 2017 23:37:05 +0900 Subject: Implemented filename and PCM filename display --- fmdriver/fmdriver.h | 18 +++++++++++++++--- fmdriver/fmdriver_fmp.c | 2 ++ fmdriver/fmdriver_pmd.c | 16 +++++++++++++++- fmdriver/fmdriver_pmd.h | 1 + 4 files changed, 33 insertions(+), 4 deletions(-) (limited to 'fmdriver') diff --git a/fmdriver/fmdriver.h b/fmdriver/fmdriver.h index ba36c3e..f84a974 100644 --- a/fmdriver/fmdriver.h +++ b/fmdriver/fmdriver.h @@ -32,6 +32,8 @@ enum { enum { // 1 line = 80 characters, may contain half-width doublebyte characters FMDRIVER_TITLE_BUFLEN = 80*2+1, + + FMDRIVER_PCMCOUNT = 4, }; enum fmdriver_track_type { @@ -108,10 +110,20 @@ struct fmdriver_work { // only single-byte uppercase cp932 char filename[FMDRIVER_TITLE_BUFLEN]; - // always 8 characters and pad with ' ' - char pcmname[2][9]; + + // PCM: 0 1 2 3 + // PMD: PPC PPZ1 PPZ2 PPC + // FMP: PVI PPZ + + // if (!strlen(pcmtype[i])) this pcm is not available on this driver + char pcmtype[FMDRIVER_PCMCOUNT][5]; + // CP932 encoded + char pcmname[FMDRIVER_PCMCOUNT][9]; + // not set by drivers, used by visualizer (FMDSP) + // set to true when for example the PCM file was not found + bool pcmerror[FMDRIVER_PCMCOUNT]; + // driver status (for display) - bool pcmerror[2]; uint8_t ssg_noise_freq; struct fmdriver_track_status track_status[FMDRIVER_TRACK_NUM]; uint8_t loop_cnt; diff --git a/fmdriver/fmdriver_fmp.c b/fmdriver/fmdriver_fmp.c index 9abfaaa..635ae4b 100644 --- a/fmdriver/fmdriver_fmp.c +++ b/fmdriver/fmdriver_fmp.c @@ -3596,6 +3596,8 @@ void fmp_init(struct fmdriver_work *work, struct driver_fmp *fmp) { fmp_work_status_init(work, fmp); fmdriver_fillpcmname(work->pcmname[0], fmp->pvi_name); fmdriver_fillpcmname(work->pcmname[1], fmp->ppz_name); + strcpy(work->pcmtype[0], "PVI"); + strcpy(work->pcmtype[1], "PPZ"); work->playing = true; } diff --git a/fmdriver/fmdriver_pmd.c b/fmdriver/fmdriver_pmd.c index f4eaab7..f5322fa 100644 --- a/fmdriver/fmdriver_pmd.c +++ b/fmdriver/fmdriver_pmd.c @@ -1,6 +1,7 @@ #include "fmdriver_pmd.h" #include "fmdriver_common.h" #include +#include enum { SSG_ENV_STATE_OLD_AL, @@ -5876,7 +5877,7 @@ const char *pmd_get_memo( void pmd_filenamecopy(char *dest, const char *src) { int i; for (i = 0; i < (PMD_FILENAMELEN+1); i++) { - if (src[i] == '.') { + if (src[i] == '.' || src[i] == ',') { dest[i] = 0; return; } @@ -5906,6 +5907,7 @@ void pmd_init(struct fmdriver_work *work, pmd_reset_timer(work, pmd); pmd->playing = true; work->driver_opna_interrupt = pmd_opna_interrupt; + /* static const int memotable[3] = {1, 4, 5}; for (int i = 0; i < 3; i++) { @@ -5923,6 +5925,10 @@ void pmd_init(struct fmdriver_work *work, const char *pcmfile = pmd_get_memo(pmd, -2); if (pcmfile) { pmd_filenamecopy(pmd->ppzfile, pcmfile); + const char *pcm2 = strchr(pcmfile, ','); + if (pcm2) { + pmd_filenamecopy(pmd->ppzfile2, pcm2+1); + } } pcmfile = pmd_get_memo(pmd, -1); if (pcmfile) { @@ -5933,8 +5939,16 @@ void pmd_init(struct fmdriver_work *work, pmd_filenamecopy(pmd->ppcfile, pcmfile); } fmdriver_fillpcmname(work->pcmname[0], pmd->ppcfile); + strcpy(work->pcmtype[0], "PPC"); fmdriver_fillpcmname(work->pcmname[1], pmd->ppzfile); + strcpy(work->pcmtype[1], "PPZ1"); + fmdriver_fillpcmname(work->pcmname[2], pmd->ppzfile2); + strcpy(work->pcmtype[2], "PPZ2"); + fmdriver_fillpcmname(work->pcmname[3], pmd->ppsfile); + strcpy(work->pcmtype[3], "PPS"); work->playing = true; + // PPS currently unsupported + work->pcmerror[3] = true; } enum { diff --git a/fmdriver/fmdriver_pmd.h b/fmdriver/fmdriver_pmd.h index 25d42d7..cf16cdf 100644 --- a/fmdriver/fmdriver_pmd.h +++ b/fmdriver/fmdriver_pmd.h @@ -458,6 +458,7 @@ struct driver_pmd { bool ssgeff_noise_mix; bool ssgeff_on; char ppzfile[PMD_FILENAMELEN+1]; + char ppzfile2[PMD_FILENAMELEN+1]; char ppsfile[PMD_FILENAMELEN+1]; char ppcfile[PMD_FILENAMELEN+1]; }; -- cgit v1.2.3