aboutsummaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorTakamichi Horikawa <takamichiho@gmail.com>2017-01-18 23:37:07 +0900
committerTakamichi Horikawa <takamichiho@gmail.com>2017-01-18 23:37:07 +0900
commite8fd09abf68b944b05554c82adb577514cad5ca5 (patch)
treef8882715e86534cec2dc20154fd24c6bef3c668b /gtk
parent09ea1fe272aca6ebb6840f02765acd44ac3ecebc (diff)
improve FMDSP and enable title display on win32
Diffstat (limited to 'gtk')
-rw-r--r--gtk/Makefile.am3
-rw-r--r--gtk/main.c22
2 files changed, 11 insertions, 14 deletions
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 9a4790b..5864a9a 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -10,7 +10,8 @@ LIBOPNA_SRC=../libopna/opnaadpcm.c \
FMDRIVER_SRC=../fmdriver/fmdriver_fmp.c \
../fmdriver/ppz8.c
-FMDSP_SRC=../fmdsp/fmdsp.c
+FMDSP_SRC=../fmdsp/fmdsp.c \
+ ../fmdsp/font_rom.c
fmplayer_SOURCES=main.c \
$(LIBOPNA_SRC) \
diff --git a/gtk/main.c b/gtk/main.c
index 874bc1d..77bf105 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -18,8 +18,6 @@
enum {
SRATE = 55467,
PPZ8MIX = 0xa000,
- FONT_ROM_SIZE = 0x84000,
- FONT_ROM_FILESIZE = 0x46800,
AUDIOBUFLEN = 0,
};
@@ -39,7 +37,8 @@ static struct {
void *fmpdata;
void *ppzbuf;
uint8_t vram[PC98_W*PC98_H];
- uint8_t font[FONT_ROM_SIZE];
+ struct fmdsp_font font98;
+ uint8_t font98data[FONT_ROM_FILESIZE];
void *vram32;
int vram32_stride;
} g;
@@ -247,6 +246,7 @@ static void load_fontrom(void) {
const char *path = "font.rom";
const char *home = getenv("HOME");
char *dpath = 0;
+ fmdsp_font_from_font_rom(&g.font98, g.font98data);
if (home) {
const char *datadir = DATADIR;
dpath = malloc(strlen(home)+strlen(datadir)+strlen(path) + 1);
@@ -264,15 +264,11 @@ static void load_fontrom(void) {
long size = ftell(font);
if (size != FONT_ROM_FILESIZE) goto err_file;
if (fseek(font, 0, SEEK_SET) != 0) goto err_file;
- uint8_t *fontbuf = malloc(FONT_ROM_FILESIZE);
- if (!fontbuf) goto err_file;
- if (fread(fontbuf, 1, FONT_ROM_FILESIZE, font) != FONT_ROM_FILESIZE) goto err_fontbuf;
- fmdsp_font_from_fontrom(g.font, fontbuf);
- free(fontbuf);
+ if (fread(g.font98data, 1, FONT_ROM_FILESIZE, font) != FONT_ROM_FILESIZE) {
+ goto err_file;
+ }
fclose(font);
return;
-err_fontbuf:
- free(fontbuf);
err_file:
fclose(font);
err:
@@ -361,7 +357,7 @@ static bool openfile(const char *path) {
opna_timer_set_int_callback(&g.opna_timer, opna_int_cb, &g.work);
opna_timer_set_mix_callback(&g.opna_timer, opna_mix_cb, &g.ppz8);
fmp_init(&g.work, g.fmp);
- fmdsp_vram_init(&g.fmdsp, &g.work, g.font, g.vram);
+ fmdsp_vram_init(&g.fmdsp, &g.work, g.vram);
loadpvi(&g.work, g.fmp, path);
loadppzpvi(&g.work, g.fmp, path);
fclose(fmfile);
@@ -472,8 +468,8 @@ int main(int argc, char **argv) {
g.pa_initialized = (Pa_Initialize() == paNoError);
- fmdsp_init(&g.fmdsp);
- fmdsp_vram_init(&g.fmdsp, &g.work, g.font, g.vram);
+ fmdsp_init(&g.fmdsp, &g.font98);
+ fmdsp_vram_init(&g.fmdsp, &g.work, g.vram);
g.vram32_stride = cairo_format_stride_for_width(CAIRO_FORMAT_RGB24, PC98_W);
g.vram32 = malloc((g.vram32_stride*PC98_H)*4);