aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakamichi Horikawa <takamichiho@gmail.com>2017-10-22 23:37:05 +0900
committerTakamichi Horikawa <takamichiho@gmail.com>2017-10-22 23:37:05 +0900
commitacb405ba36ec82511525f4f9e2a0775e2d85308e (patch)
tree6825ce49a631783b035b3613fa295d742e3254a2
parentabba98ed83f59263c4b952d61ce9892f9270ee67 (diff)
Implemented filename and PCM filename display
-rw-r--r--common/fmplayer_file.c35
-rw-r--r--common/fmplayer_file.h10
-rw-r--r--common/fmplayer_file_gio.c32
-rw-r--r--common/fmplayer_file_win.c28
-rw-r--r--fmdriver/fmdriver.h18
-rw-r--r--fmdriver/fmdriver_fmp.c2
-rw-r--r--fmdriver/fmdriver_pmd.c16
-rw-r--r--fmdriver/fmdriver_pmd.h1
-rw-r--r--fmdsp/fmdsp-pacc.c58
-rw-r--r--fmdsp/fmdsp-pacc.h6
-rw-r--r--fmdsp/fmdsp_sprites.h6
-rw-r--r--gtk/main.c6
-rw-r--r--win32/main.c4
13 files changed, 200 insertions, 22 deletions
diff --git a/common/fmplayer_file.c b/common/fmplayer_file.c
index 3c05cab..ce7e1dc 100644
--- a/common/fmplayer_file.c
+++ b/common/fmplayer_file.c
@@ -5,6 +5,7 @@
void fmplayer_file_free(const struct fmplayer_file *fmfileptr) {
struct fmplayer_file *fmfile = (struct fmplayer_file *)fmfileptr;
if (!fmfile) return;
+ free((void *)fmfile->filename_sjis);
free(fmfile->path);
free(fmfile->buf);
free(fmfile->ppzbuf[0]);
@@ -109,6 +110,7 @@ struct fmplayer_file *fmplayer_file_alloc(const void *path, enum fmplayer_file_e
if (error) *error = FMPLAYER_FILE_ERR_NOMEM;
goto err;
}
+ fmfile->filename_sjis = fmplayer_path_filename_sjis(path);
size_t filesize;
fmfile->buf = fmplayer_fileread(path, 0, 0, 0xffff, &filesize, error);
if (!fmfile->buf) goto err;
@@ -139,17 +141,17 @@ static void loadppc(struct fmdriver_work *work, struct fmplayer_file *fmfile) {
}
}
-static bool loadppzpvi(struct fmdriver_work *work, struct fmplayer_file *fmfile, const char *name) {
+static bool loadppzpvi(struct fmdriver_work *work, struct fmplayer_file *fmfile, int bnum, const char *name) {
size_t filesize;
void *pvibuf = 0, *ppzbuf = 0;
pvibuf = fmplayer_fileread(fmfile->path, name, ".PVI", 0, &filesize, 0);
if (!pvibuf) goto err;
ppzbuf = calloc(ppz8_pvi_decodebuf_samples(filesize), 2);
if (!ppzbuf) goto err;
- if (!ppz8_pvi_load(work->ppz8, 0, pvibuf, filesize, ppzbuf)) goto err;
+ if (!ppz8_pvi_load(work->ppz8, bnum, pvibuf, filesize, ppzbuf)) goto err;
free(pvibuf);
- free(fmfile->ppzbuf[0]);
- fmfile->ppzbuf[0] = ppzbuf;
+ free(fmfile->ppzbuf[bnum]);
+ fmfile->ppzbuf[bnum] = ppzbuf;
return true;
err:
free(ppzbuf);
@@ -157,17 +159,17 @@ err:
return false;
}
-static bool loadppzpzi(struct fmdriver_work *work, struct fmplayer_file *fmfile, const char *name) {
+static bool loadppzpzi(struct fmdriver_work *work, struct fmplayer_file *fmfile, int bnum, const char *name) {
size_t filesize;
void *pzibuf = 0, *ppzbuf = 0;
pzibuf = fmplayer_fileread(fmfile->path, name, ".PZI", 0, &filesize, 0);
if (!pzibuf) goto err;
ppzbuf = calloc(ppz8_pzi_decodebuf_samples(filesize), 2);
if (!ppzbuf) goto err;
- if (!ppz8_pzi_load(work->ppz8, 0, pzibuf, filesize, ppzbuf)) goto err;
+ if (!ppz8_pzi_load(work->ppz8, bnum, pzibuf, filesize, ppzbuf)) goto err;
free(pzibuf);
- free(fmfile->ppzbuf[0]);
- fmfile->ppzbuf[0] = ppzbuf;
+ free(fmfile->ppzbuf[bnum]);
+ fmfile->ppzbuf[bnum] = ppzbuf;
return true;
err:
free(ppzbuf);
@@ -175,12 +177,13 @@ err:
return false;
}
-static void loadpmdppz(struct fmdriver_work *work, struct fmplayer_file *fmfile) {
- const char *ppzfile = fmfile->driver.pmd.ppzfile;
- if (!strlen(ppzfile)) return;
- if (!loadppzpvi(work, fmfile, ppzfile) && !loadppzpzi(work, fmfile, ppzfile)) {
- fmfile->pmd_ppz_err = true;
+// returns true if error
+static bool loadpmdppz(struct fmdriver_work *work, struct fmplayer_file *fmfile,int bnum, const char *ppzfile) {
+ if (!strlen(ppzfile)) false;
+ if (!loadppzpvi(work, fmfile, bnum, ppzfile) && !loadppzpzi(work, fmfile, bnum, ppzfile)) {
+ return true;
}
+ return false;
}
static void loadpvi(struct fmdriver_work *work, struct fmplayer_file *fmfile) {
@@ -199,7 +202,7 @@ static void loadpvi(struct fmdriver_work *work, struct fmplayer_file *fmfile) {
static void loadfmpppz(struct fmdriver_work *work, struct fmplayer_file *fmfile) {
const char *pvifile = fmfile->driver.fmp.ppz_name;
if (!strlen(pvifile)) return;
- fmfile->fmp_ppz_err = !loadppzpvi(work, fmfile, pvifile);
+ fmfile->fmp_ppz_err = !loadppzpvi(work, fmfile, 0, pvifile);
}
void fmplayer_file_load(struct fmdriver_work *work, struct fmplayer_file *fmfile, int loopcnt) {
@@ -219,9 +222,9 @@ void fmplayer_file_load(struct fmdriver_work *work, struct fmplayer_file *fmfile
}
pmd_init(work, &fmfile->driver.pmd);
loadppc(work, fmfile);
- loadpmdppz(work, fmfile);
+ work->pcmerror[1] = loadpmdppz(work, fmfile, 0, fmfile->driver.pmd.ppzfile);
+ work->pcmerror[2] = loadpmdppz(work, fmfile, 1, fmfile->driver.pmd.ppzfile2);
work->pcmerror[0] = fmfile->pmd_ppc_err;
- work->pcmerror[1] = fmfile->pmd_ppz_err;
break;
case FMPLAYER_FILE_TYPE_FMP:
{
diff --git a/common/fmplayer_file.h b/common/fmplayer_file.h
index 143c349..610a401 100644
--- a/common/fmplayer_file.h
+++ b/common/fmplayer_file.h
@@ -30,11 +30,15 @@ struct fmplayer_file {
struct driver_fmp fmp;
} driver;
bool pmd_ppc_err;
- bool pmd_ppz_err;
bool fmp_pvi_err;
bool fmp_ppz_err;
void *buf;
void *ppzbuf[2];
+ // for display with FMDSP
+ // might be NULL
+ // currently only supports sjis (CP932)
+ // string valid while file object valid
+ const char *filename_sjis;
};
struct fmplayer_file *fmplayer_file_alloc(const void *path, enum fmplayer_file_error *error);
void fmplayer_file_free(const struct fmplayer_file *fmfile);
@@ -49,6 +53,10 @@ const wchar_t *fmplayer_file_strerror_w(enum fmplayer_file_error error);
// fmplayer_fileread("/home/foo/bar.mz", "BAZ", ".PVI", &filesize);
void *fmplayer_fileread(const void *path, const char *pcmname, const char *extension, size_t maxsize, size_t *filesize, enum fmplayer_file_error *error);
+// allocates string in sjis
+// free with free()
+char *fmplayer_path_filename_sjis(const void *path);
+
void *fmplayer_path_dup(const void *path);
#endif // MYON_FMPLAYER_FILE_H_INCLUDED
diff --git a/common/fmplayer_file_gio.c b/common/fmplayer_file_gio.c
index a2b52d2..c690b15 100644
--- a/common/fmplayer_file_gio.c
+++ b/common/fmplayer_file_gio.c
@@ -1,5 +1,6 @@
#include "common/fmplayer_file.h"
#include <gio/gio.h>
+#include <glib.h>
#include <stdlib.h>
#include <string.h>
@@ -119,3 +120,34 @@ err:
void *fmplayer_path_dup(const void *path) {
return strdup(path);
}
+
+char *fmplayer_path_filename_sjis(const void *pathptr) {
+ const char *uri = pathptr;
+ GFile *file = 0;
+ GFileInfo *finfo = 0;
+ const char *filename = 0;
+ char *filenamesjis = 0, *filenamebuf = 0;
+ file = g_file_new_for_uri(uri);
+ if (!file) goto err;
+ finfo = g_file_query_info(
+ file,
+ G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
+ G_FILE_QUERY_INFO_NONE,
+ 0,
+ 0);
+ if (!finfo) goto err;
+ filename = g_file_info_get_attribute_string(
+ finfo, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME);
+ filenamesjis = g_convert_with_fallback(
+ filename, -1,
+ "cp932", "utf-8", "?",
+ 0, 0, 0);
+ if (!filenamesjis) goto err;
+ filenamebuf = strdup(filenamesjis);
+err:
+ if (filenamesjis) g_free(filenamesjis);
+ if (finfo) g_object_unref(G_OBJECT(finfo));
+ if (file) g_object_unref(G_OBJECT(file));
+ return filenamebuf;
+}
+
diff --git a/common/fmplayer_file_win.c b/common/fmplayer_file_win.c
index 5ca57dc..71fb263 100644
--- a/common/fmplayer_file_win.c
+++ b/common/fmplayer_file_win.c
@@ -114,3 +114,31 @@ void *fmplayer_path_dup(const void *pathptr) {
return strdup(path);
#endif
}
+
+char *fmplayer_path_filename_sjis(const void *pathptr) {
+ wchar_t *u16_path = 0;
+ char *filename_sjis = 0;
+#if defined(FMPLAYER_FILE_WIN_UTF16)
+ const wchar_t *path = pathptr;
+ u16_path = wcsdup(path);
+#elif defined(FMPLAYER_FILE_WIN_UTF8)
+ const char *path = pathptr;
+ u16_path = u8tou16(path);
+#endif
+ if (!u16_path) goto err;
+ PathStripPath(u16_path);
+ int bufsize = WideCharToMultiByte(932, 0, u16_path, -1, 0, 0, 0, 0);
+ if (bufsize <= 0) goto err;
+ filename_sjis = malloc(bufsize);
+ if (!filename_sjis) goto err;
+ bufsize = WideCharToMultiByte(
+ 932, 0, u16_path, -1, filename_sjis, bufsize, 0, 0);
+ if (!bufsize) goto err;
+ free(u16_path);
+ return filename_sjis;
+
+err:
+ free(filename_sjis);
+ free(u16_path);
+ return 0;
+}
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 <stddef.h>
+#include <string.h>
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];
};
diff --git a/fmdsp/fmdsp-pacc.c b/fmdsp/fmdsp-pacc.c
index 00fb935..54a37ea 100644
--- a/fmdsp/fmdsp-pacc.c
+++ b/fmdsp/fmdsp-pacc.c
@@ -109,6 +109,7 @@ struct fmdsp_pacc {
struct pacc_ctx *pc;
struct pacc_vtable pacc;
struct pacc_tex *tex_font;
+ struct pacc_tex *tex_fontm;
struct pacc_tex *tex_checker;
struct pacc_tex *tex_key_left;
struct pacc_tex *tex_key_right;
@@ -140,6 +141,7 @@ struct fmdsp_pacc {
struct pacc_buf *buf_font_7;
struct pacc_buf *buf_font_2, *buf_font_2_d;
struct pacc_buf *buf_font_1, *buf_font_1_d;
+ struct pacc_buf *buf_fontm_2, *buf_fontm_3;
struct pacc_buf *buf_checker, *buf_checker_1;
struct pacc_buf *buf_key_left;
struct pacc_buf *buf_key_right;
@@ -193,6 +195,7 @@ struct fmdsp_pacc {
int comment_offset;
bool comment_prev_avail;
bool comment_next_avail;
+ char *filename;
};
static struct pacc_tex *tex_from_font(
@@ -224,6 +227,10 @@ static void fmdsp_pacc_deinit_buf(struct fmdsp_pacc *fp) {
fp->buf_font_2_d = 0;
fp->pacc.buf_delete(fp->buf_font_7);
fp->buf_font_7 = 0;
+ fp->pacc.buf_delete(fp->buf_fontm_2);
+ fp->buf_fontm_2 = 0;
+ fp->pacc.buf_delete(fp->buf_fontm_3);
+ fp->buf_fontm_3 = 0;
fp->pacc.buf_delete(fp->buf_checker);
fp->buf_checker = 0;
fp->pacc.buf_delete(fp->buf_checker_1);
@@ -311,6 +318,8 @@ static void fmdsp_pacc_deinit_buf(struct fmdsp_pacc *fp) {
static void fmdsp_pacc_deinit_tex(struct fmdsp_pacc *fp) {
fp->pacc.tex_delete(fp->tex_font);
fp->tex_font = 0;
+ fp->pacc.tex_delete(fp->tex_fontm);
+ fp->tex_fontm = 0;
fp->pacc.tex_delete(fp->tex_checker);
fp->tex_checker = 0;
fp->pacc.tex_delete(fp->tex_key_left);
@@ -375,6 +384,7 @@ void fmdsp_pacc_release(struct fmdsp_pacc *fp) {
fmdsp_pacc_deinit_buf(fp);
fmdsp_pacc_deinit_tex(fp);
}
+ free(fp->filename);
free(fp);
}
}
@@ -627,6 +637,8 @@ static void update_track_10(struct fmdsp_pacc *fp, const uint8_t *track_table, i
static bool fmdsp_pacc_init_tex(struct fmdsp_pacc *fp) {
fp->tex_font = tex_from_font(fp->pc, &fp->pacc, &font_fmdsp_small);
if (!fp->tex_font) goto err;
+ fp->tex_fontm = tex_from_font(fp->pc, &fp->pacc, &font_fmdsp_medium);
+ if (!fp->tex_fontm) goto err;
fp->tex_checker = fp->pacc.gen_tex(fp->pc, 2, 2);
if (!fp->tex_checker) goto err;
fp->tex_key_left = fp->pacc.gen_tex(fp->pc, KEY_LEFT_W, KEY_H);
@@ -819,6 +831,10 @@ static bool fmdsp_pacc_init_buf(struct fmdsp_pacc *fp) {
if (!fp->buf_font_2_d) goto err;
fp->buf_font_7 = fp->pacc.gen_buf(fp->pc, fp->tex_font, pacc_buf_mode_static);
if (!fp->buf_font_7) goto err;
+ fp->buf_fontm_2 = fp->pacc.gen_buf(fp->pc, fp->tex_fontm, pacc_buf_mode_static);
+ if (!fp->buf_fontm_2) goto err;
+ fp->buf_fontm_3 = fp->pacc.gen_buf(fp->pc, fp->tex_fontm, pacc_buf_mode_static);
+ if (!fp->buf_fontm_3) goto err;
fp->buf_checker = fp->pacc.gen_buf(fp->pc, fp->tex_checker, pacc_buf_mode_static);
if (!fp->buf_checker) goto err;
fp->buf_checker_1 = fp->pacc.gen_buf(fp->pc, fp->tex_checker, pacc_buf_mode_static);
@@ -1632,6 +1648,8 @@ static void mode_update(struct fmdsp_pacc *fp) {
fp->pacc.buf_clear(fp->buf_font_1);
fp->pacc.buf_clear(fp->buf_font_2);
fp->pacc.buf_clear(fp->buf_font_7);
+ fp->pacc.buf_clear(fp->buf_fontm_2);
+ fp->pacc.buf_clear(fp->buf_fontm_3);
fp->pacc.buf_clear(fp->buf_solid_2);
fp->pacc.buf_clear(fp->buf_solid_3);
fp->pacc.buf_clear(fp->buf_solid_7);
@@ -1679,6 +1697,34 @@ static void mode_update(struct fmdsp_pacc *fp) {
fp->pacc.buf_rect(
fp->pc, fp->buf_tri,
FILEBAR_TRI_X, FILEBAR_TRI_Y, FILEBAR_TRI_W, FILEBAR_TRI_H);
+ if (fp->work) {
+ int pcmcount;
+ for (pcmcount = 0; pcmcount < FMDRIVER_PCMCOUNT; pcmcount++) {
+ if (!fp->work->pcmtype[pcmcount][0]) break;
+ }
+ for (int i = 0; i < pcmcount; i++) {
+ int xoff = (pcmcount - i - 1) * FILEBAR_PCM_W;
+ fp->pacc.buf_rect(
+ fp->pc, fp->buf_solid_2, FILEBAR_PCMBAR_X-xoff, PLAYING_Y, 2, 7);
+ fp->pacc.buf_printf(
+ fp->pc, fp->buf_font_2, FILEBAR_PCM_X-xoff, PLAYING_Y+1,
+ "%s", fp->work->pcmtype[i]);
+ fp->pacc.buf_rect(
+ fp->pc, fp->buf_tri,
+ FILEBAR_PCM_TRI_X + 5*strlen(fp->work->pcmtype[i]) - xoff,
+ FILEBAR_TRI_Y, FILEBAR_TRI_W, FILEBAR_TRI_H);
+ fp->pacc.buf_printf(
+ fp->pc, fp->work->pcmerror[i] ? fp->buf_fontm_3 : fp->buf_fontm_2,
+ FILEBAR_PCM_NAME_X-xoff, FILEBAR_PCM_NAME_Y,
+ "%s", fp->work->pcmname[i]);
+ if (fp->filename) {
+ fp->pacc.buf_printf(
+ fp->pc, fp->buf_fontm_2,
+ FILEBAR_FILENAME_X, FILEBAR_PCM_NAME_Y,
+ "%s", fp->filename);
+ }
+ }
+ }
switch (fp->lmode) {
case FMDSP_LEFT_MODE_OPNA:
@@ -1848,6 +1894,7 @@ void fmdsp_pacc_render(struct fmdsp_pacc *fp) {
fp->pacc.draw(fp->pc, fp->buf_solid_3_d, pacc_mode_color);
fp->pacc.draw(fp->pc, fp->buf_vertical_3, pacc_mode_color);
fp->pacc.draw(fp->pc, fp->buf_horizontal_3, pacc_mode_color);
+ fp->pacc.draw(fp->pc, fp->buf_fontm_3, pacc_mode_color);
fp->pacc.color(fp->pc, 2);
fp->pacc.draw(fp->pc, fp->buf_font_2, pacc_mode_color);
fp->pacc.draw(fp->pc, fp->buf_font_2_d, pacc_mode_color);
@@ -1855,6 +1902,7 @@ void fmdsp_pacc_render(struct fmdsp_pacc *fp) {
fp->pacc.draw(fp->pc, fp->buf_solid_2_d, pacc_mode_color);
fp->pacc.draw(fp->pc, fp->buf_vertical_2, pacc_mode_color);
fp->pacc.draw(fp->pc, fp->buf_horizontal_2_d, pacc_mode_color);
+ fp->pacc.draw(fp->pc, fp->buf_fontm_2, pacc_mode_color);
fp->pacc.color(fp->pc, 5);
fp->pacc.draw(fp->pc, fp->buf_panpot_5_d, pacc_mode_color);
fp->pacc.color(fp->pc, 7);
@@ -1939,6 +1987,10 @@ void fmdsp_pacc_set_right_mode(struct fmdsp_pacc *fp, enum fmdsp_right_mode mode
fp->mode_changed = true;
}
+void fmdsp_pacc_update_file(struct fmdsp_pacc *fp) {
+ fp->mode_changed = true;
+}
+
static void font_putchar(
uint8_t *tex, int texwidth,
const void *data,
@@ -2133,3 +2185,9 @@ void fmdsp_pacc_comment_scroll(struct fmdsp_pacc *fp, bool down) {
}
fmdsp_pacc_comment_draw(fp);
}
+
+void fmdsp_pacc_set_filename_sjis(struct fmdsp_pacc *fp, const char *filename) {
+ free(fp->filename);
+ fp->filename = strdup(filename);
+}
+
diff --git a/fmdsp/fmdsp-pacc.h b/fmdsp/fmdsp-pacc.h
index 7fabd0b..3e10e03 100644
--- a/fmdsp/fmdsp-pacc.h
+++ b/fmdsp/fmdsp-pacc.h
@@ -53,9 +53,15 @@ enum fmdsp_left_mode fmdsp_pacc_left_mode(const struct fmdsp_pacc *fp);
void fmdsp_pacc_set_left_mode(struct fmdsp_pacc *fp, enum fmdsp_left_mode mode);
enum fmdsp_right_mode fmdsp_pacc_right_mode(const struct fmdsp_pacc *fp);
void fmdsp_pacc_set_right_mode(struct fmdsp_pacc *fp, enum fmdsp_right_mode mode);
+// redraw filename, PCM filenames
+void fmdsp_pacc_update_file(struct fmdsp_pacc *fp);
void fmdsp_pacc_set_font16(struct fmdsp_pacc *fp, const struct fmdsp_font *font);
void fmdsp_pacc_comment_reset(struct fmdsp_pacc *fp);
void fmdsp_pacc_comment_scroll(struct fmdsp_pacc *fp, bool down);
+// this will strdup the string and fmdsp_pacc will manage the memory
+// currently only supports 1-byte CP932 (ANK)
+void fmdsp_pacc_set_filename_sjis(struct fmdsp_pacc *fp, const char *filename);
+
#endif // MYON_FMDSP_PACC_H_INCLUDED
diff --git a/fmdsp/fmdsp_sprites.h b/fmdsp/fmdsp_sprites.h
index 1553400..5c33554 100644
--- a/fmdsp/fmdsp_sprites.h
+++ b/fmdsp/fmdsp_sprites.h
@@ -181,6 +181,12 @@ enum {
COMMENT_TRI_X = 8,
COMMENT_TRI_U_Y = 349,
COMMENT_TRI_D_Y = 387,
+ FILEBAR_PCMBAR_X = 551,
+ FILEBAR_PCM_X = FILEBAR_PCMBAR_X + 4,
+ FILEBAR_PCM_TRI_X = FILEBAR_PCM_X + 1,
+ FILEBAR_PCM_NAME_X = FILEBAR_PCM_TRI_X + 27,
+ FILEBAR_PCM_NAME_Y = FILEBAR_TRI_Y - 4,
+ FILEBAR_PCM_W = 88,
};
enum {
diff --git a/gtk/main.c b/gtk/main.c
index 92696da..c941896 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -135,7 +135,7 @@ static void on_config(GtkMenuItem *menuitem, gpointer ptr) {
static void msgbox_err(const char *msg) {
GtkWidget *d = gtk_message_dialog_new(GTK_WINDOW(g.mainwin), GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
- msg);
+ "%s", msg);
gtk_dialog_run(GTK_DIALOG(d));
gtk_widget_destroy(d);
}
@@ -208,6 +208,10 @@ static bool openfile(const char *uri) {
strncpy(g.work.filename, uri, sizeof(g.work.filename)-1);
}
fmplayer_file_load(&g.work, g.fmfile, 1);
+ if (g.fmfile->filename_sjis) {
+ fmdsp_pacc_set_filename_sjis(g.fp, g.fmfile->filename_sjis);
+ }
+ fmdsp_pacc_update_file(g.fp);
fmdsp_pacc_comment_reset(g.fp);
g.ss->pause(g.ss, 0, 1);
g.sound_paused = false;
diff --git a/win32/main.c b/win32/main.c
index 5e194fd..026250d 100644
--- a/win32/main.c
+++ b/win32/main.c
@@ -145,6 +145,10 @@ static void openfile(HWND hwnd, const wchar_t *path) {
opna_fm_set_hires_env(&g.opna.fm, fmplayer_config.fm_hires_env);
WideCharToMultiByte(932, WC_NO_BEST_FIT_CHARS, path, -1, g.work.filename, sizeof(g.work.filename), 0, 0);
fmplayer_file_load(&g.work, g.fmfile, 1);
+ if (g.fmfile->filename_sjis) {
+ fmdsp_pacc_set_filename_sjis(g.fp, g.fmfile->filename_sjis);
+ }
+ fmdsp_pacc_update_file(g.fp);
fmdsp_pacc_comment_reset(g.fp);
if (!g.sound) {
g.sound = sound_init(hwnd, SRATE, SECTLEN,