aboutsummaryrefslogtreecommitdiff
path: root/fmdsp
diff options
context:
space:
mode:
authorTakamichi Horikawa <takamichiho@gmail.com>2017-02-19 17:25:56 +0900
committerTakamichi Horikawa <takamichiho@gmail.com>2017-02-19 17:25:56 +0900
commitd78900cd1497441d7712805b08072e46ee361ff8 (patch)
tree5a696ac5ffa4e6d71992c9329ff5b13ad14cf977 /fmdsp
parentbe500d48fbc381273dfdc600898f68df725aa954 (diff)
add opna status display
Diffstat (limited to 'fmdsp')
-rw-r--r--fmdsp/fmdsp.c334
-rw-r--r--fmdsp/fmdsp.h16
2 files changed, 299 insertions, 51 deletions
diff --git a/fmdsp/fmdsp.c b/fmdsp/fmdsp.c
index 35ea7fd..43be966 100644
--- a/fmdsp/fmdsp.c
+++ b/fmdsp/fmdsp.c
@@ -3,6 +3,7 @@
#include "font.h"
#include "fmdriver/fmdriver.h"
#include <stdio.h>
+#include "libopna/opna.h"
static void vramblit(uint8_t *vram, int x, int y,
const uint8_t *data, int w, int h) {
@@ -52,6 +53,8 @@ void fmdsp_init(struct fmdsp *fmdsp, const struct fmdsp_font *font98) {
fmdsp->target_palette[i] = s_palettes[0][i];
}
fmdsp->font98 = font98;
+ fmdsp->style = FMDSP_DISPSTYLE_DEFAULT;
+ fmdsp->style_updated = true;
}
@@ -123,48 +126,112 @@ static void fmdsp_putline(const char *strptr, uint8_t *vram,
}
}
-void fmdsp_vram_init(struct fmdsp *fmdsp,
- struct fmdriver_work *work,
- uint8_t *vram) {
- for (int y = 0; y < PC98_H; y++) {
+static const char *track_type_string_table[FMDRIVER_TRACKTYPE_CNT] = {
+ "FM ", "SSG ", "ADPCM"
+};
+
+static struct {
+ uint8_t type;
+ uint8_t num;
+} track_type_table[FMDRIVER_TRACK_NUM] = {
+ {FMDRIVER_TRACKTYPE_FM, 1},
+ {FMDRIVER_TRACKTYPE_FM, 2},
+ {FMDRIVER_TRACKTYPE_FM, 3},
+ {FMDRIVER_TRACKTYPE_FM, 3},
+ {FMDRIVER_TRACKTYPE_FM, 3},
+ {FMDRIVER_TRACKTYPE_FM, 3},
+ {FMDRIVER_TRACKTYPE_FM, 4},
+ {FMDRIVER_TRACKTYPE_FM, 5},
+ {FMDRIVER_TRACKTYPE_FM, 6},
+ {FMDRIVER_TRACKTYPE_SSG, 1},
+ {FMDRIVER_TRACKTYPE_SSG, 2},
+ {FMDRIVER_TRACKTYPE_SSG, 3},
+ {FMDRIVER_TRACKTYPE_ADPCM, 1},
+};
+
+enum {
+ FMDSP_TRACK_DISP_CNT_DEFAULT = 10
+};
+
+static uint8_t track_disp_table_default[FMDSP_TRACK_DISP_CNT_DEFAULT] = {
+ FMDRIVER_TRACK_FM_1,
+ FMDRIVER_TRACK_FM_2,
+ FMDRIVER_TRACK_FM_3,
+ FMDRIVER_TRACK_FM_4,
+ FMDRIVER_TRACK_FM_5,
+ FMDRIVER_TRACK_FM_6,
+ FMDRIVER_TRACK_SSG_1,
+ FMDRIVER_TRACK_SSG_2,
+ FMDRIVER_TRACK_SSG_3,
+ FMDRIVER_TRACK_ADPCM,
+};
+static uint8_t track_disp_table_opn[FMDSP_TRACK_DISP_CNT_DEFAULT] = {
+ FMDRIVER_TRACK_FM_1,
+ FMDRIVER_TRACK_FM_2,
+ FMDRIVER_TRACK_FM_3,
+ FMDRIVER_TRACK_FM_3_EX_1,
+ FMDRIVER_TRACK_FM_3_EX_2,
+ FMDRIVER_TRACK_FM_3_EX_3,
+ FMDRIVER_TRACK_SSG_1,
+ FMDRIVER_TRACK_SSG_2,
+ FMDRIVER_TRACK_SSG_3,
+ FMDRIVER_TRACK_ADPCM,
+};
+
+static void fmdsp_track_init_10(struct fmdsp *fmdsp,
+ uint8_t *vram) {
+ for (int y = 0; y < TRACK_H*FMDSP_TRACK_DISP_CNT_DEFAULT; y++) {
for (int x = 0; x < PC98_W; x++) {
vram[y*PC98_W+x] = 0;
}
}
- for (int t = 0; t < 10; t++) {
- struct fmdriver_track_status *track = &work->track_status[t];
+ for (int i = 0; i < FMDSP_TRACK_DISP_CNT_DEFAULT; i++) {
+ int t = (fmdsp->style == FMDSP_DISPSTYLE_DEFAULT) ?
+ track_disp_table_default[i] :
+ track_disp_table_opn[i];
const char *track_type;
- switch (track->type) {
- case FMDRIVER_TRACK_FM:
+ switch (track_type_table[t].type) {
+ case FMDRIVER_TRACKTYPE_FM:
track_type = "FM ";
break;
- case FMDRIVER_TRACK_SSG:
+ case FMDRIVER_TRACKTYPE_SSG:
track_type = "SSG ";
break;
- case FMDRIVER_TRACK_ADPCM:
+ case FMDRIVER_TRACKTYPE_ADPCM:
track_type = "ADPCM";
break;
}
- fmdsp_putline(track_type, vram, &font_fmdsp_small, 1, TRACK_H*t, 2, true);
- vramblit(vram, NUM_X+NUM_W*0, TRACK_H*t+1, s_num[(track->num/10)%10], NUM_W, NUM_H);
- vramblit(vram, NUM_X+NUM_W*1, TRACK_H*t+1, s_num[track->num%10], NUM_W, NUM_H);
+ fmdsp_putline(track_type, vram, &font_fmdsp_small, 1, TRACK_H*i, 2, true);
+ int tracknum = track_type_table[t].num;
+ vramblit(vram, NUM_X+NUM_W*0, TRACK_H*i+1, s_num[(tracknum/10)%10], NUM_W, NUM_H);
+ vramblit(vram, NUM_X+NUM_W*1, TRACK_H*i+1, s_num[tracknum%10], NUM_W, NUM_H);
- //vramblit(vram, 1, TRACK_H*t+7, s_track, TNAME_W, TNAME_H);
- fmdsp_putline("TRACK.", vram, &font_fmdsp_small, 1, TRACK_H*t+6, 1, true);
- vramblit(vram, KEY_LEFT_X, TRACK_H*t+KEY_Y, s_key_left, KEY_LEFT_W, KEY_H);
- for (int i = 0; i < KEY_OCTAVES; i++) {
- vramblit(vram, KEY_X+KEY_W*i, TRACK_H*t+KEY_Y,
+ fmdsp_putline("TRACK.", vram, &font_fmdsp_small, 1, TRACK_H*i+6, 1, true);
+ vramblit(vram, KEY_LEFT_X, TRACK_H*i+KEY_Y, s_key_left, KEY_LEFT_W, KEY_H);
+ for (int j = 0; j < KEY_OCTAVES; j++) {
+ vramblit(vram, KEY_X+KEY_W*j, TRACK_H*i+KEY_Y,
s_key_bg, KEY_W, KEY_H);
}
- vramblit(vram, KEY_X+KEY_W*KEY_OCTAVES, TRACK_H*t+KEY_Y,
+ vramblit(vram, KEY_X+KEY_W*KEY_OCTAVES, TRACK_H*i+KEY_Y,
s_key_right, KEY_RIGHT_W, KEY_H);
- vramblit_color(vram, BAR_L_X, TRACK_H*t+BAR_Y,
+ vramblit_color(vram, BAR_L_X, TRACK_H*i+BAR_Y,
s_bar_l, BAR_L_W, BAR_H, 3);
- for (int i = 0; i < BAR_CNT; i++) {
- vramblit_color(vram, BAR_X+BAR_W*i, TRACK_H*t+BAR_Y,
+ for (int j = 0; j < BAR_CNT; j++) {
+ vramblit_color(vram, BAR_X+BAR_W*j, TRACK_H*i+BAR_Y,
s_bar, BAR_W, BAR_H, 3);
}
}
+}
+
+void fmdsp_vram_init(struct fmdsp *fmdsp,
+ struct fmdriver_work *work,
+ uint8_t *vram) {
+ fmdsp->style_updated = true;
+ for (int y = 0; y < PC98_H; y++) {
+ for (int x = 0; x < PC98_W; x++) {
+ vram[y*PC98_W+x] = 0;
+ }
+ }
vramblit(vram, PLAYING_X, PLAYING_Y,
s_playing, PLAYING_W, PLAYING_H);
for (int x = 74; x < PC98_W; x++) {
@@ -219,25 +286,187 @@ static void fmdsp_palette_fade(struct fmdsp *fmdsp) {
}
}
+static void fmdsp_track_info_fm(const struct opna *opna,
+ int chi, const bool *slotmask,
+ int x, int y,
+ uint8_t *vram
+) {
+ const struct opna_fm_channel *ch = &opna->fm.channel[chi];
+ for (int si = 0; si < 4; si++) {
+ if (slotmask && slotmask[si]) continue;
+ const struct opna_fm_slot *s = &ch->slot[si];
+ int level = s->tl << 5; // (0 - 4064)
+ int envlevel = level + (s->env<<2);
+ int leveld = (4096 - level) / 64; // (0 - 63)
+ if (leveld < 0) leveld = 0;
+ int envleveld = (4096 - envlevel) / 64;
+ if (envleveld < 0) envleveld = 0;
+ for (int px = 0; px < 64; px++) {
+ int color = 3;
+ if (px < envleveld) color = 2;
+ if (px == leveld) color = 7;
+ for (int py = 0; py < 4; py++) {
+ vram[(y+2+py+si*6)*PC98_W+(x+px*2)] = color;
+ }
+ }
+ const char *envstr = "";
+ switch (s->env_state) {
+ case ENV_ATTACK:
+ envstr = "ATT";
+ break;
+ case ENV_DECAY:
+ envstr = "DEC";
+ break;
+ case ENV_SUSTAIN:
+ envstr = "SUS";
+ break;
+ case ENV_RELEASE:
+ envstr = "REL";
+ break;
+ }
+ fmdsp_putline(envstr, vram, &font_fmdsp_small, x+130, y+si*6, 1, false);
+ char strbuf[4];
+ snprintf(strbuf, sizeof(strbuf), "%03X", s->env);
+ fmdsp_putline(strbuf, vram, &font_fmdsp_small, x+150, y+si*6, 1, false);
+ }
+ char strbuf[5];
+ snprintf(strbuf, sizeof(strbuf), "%04X", ch->fnum);
+ fmdsp_putline(strbuf, vram, &font_fmdsp_small, x+170, y, 1, false);
+}
+
+static void fmdsp_track_info_ssg(const struct opna *opna,
+ int chi,
+ int x, int y,
+ uint8_t *vram
+) {
+ int envleveld = opna_ssg_channel_level(&opna->ssg, chi);
+ for (int px = 0; px < 64; px++) {
+ int color = 3;
+ if (px < (envleveld+31)) color = 2;
+ if (px < 32) color = 7;
+ for (int py = 0; py < 4; py++) {
+ vram[(y+2+py)*PC98_W+(x+px*2)] = color;
+ }
+ }
+}
+
+static void fmdsp_track_info_adpcm(const struct opna *opna,
+ int x, int y,
+ uint8_t *vram) {
+ fmdsp_putline("VOL DELTA START PTR END",
+ vram, &font_fmdsp_small, x, y, 1, false);
+ char buf[7];
+ snprintf(buf, sizeof(buf), "%3d", opna->adpcm.vol);
+ fmdsp_putline(buf, vram, &font_fmdsp_small, x, y+6, 1, false);
+ snprintf(buf, sizeof(buf), "%04X", opna->adpcm.delta);
+ fmdsp_putline(buf, vram, &font_fmdsp_small, x+25, y+6, 1, false);
+ snprintf(buf, sizeof(buf), "%06X", (opna->adpcm.start)<<5);
+ fmdsp_putline(buf, vram, &font_fmdsp_small, x+50, y+6, 1, false);
+ snprintf(buf, sizeof(buf), "%06X", (opna->adpcm.ramptr)<<5);
+ fmdsp_putline(buf, vram, &font_fmdsp_small, x+85, y+6, 1, false);
+ snprintf(buf, sizeof(buf), "%06X", ((opna->adpcm.end+1)<<5)-1);
+ fmdsp_putline(buf, vram, &font_fmdsp_small, x+120, y+6, 1, false);
+}
+
+static void fmdsp_track_info_ppz8(const struct ppz8 *ppz8,
+ int chi,
+ int x, int y,
+ uint8_t *vram) {
+ const struct ppz8_channel *ch = &ppz8->channel[chi];
+ fmdsp_putline("PAN VOL FREQ PTR END LOOPS LOOPE",
+ vram, &font_fmdsp_small, x, y, 1, false);
+ char buf[9];
+ if (ch->pan) {
+ int pan = ch->pan-5;
+ snprintf(buf, sizeof(buf), "%+d", pan);
+ char c = ' ';
+ if (pan < 0) c = 'L';
+ if (pan > 0) c = 'R';
+ buf[0] = c;
+ } else {
+ snprintf(buf, sizeof(buf), "--");
+ }
+ fmdsp_putline(buf, vram, &font_fmdsp_small, x+5, y+6, 1, false);
+ snprintf(buf, sizeof(buf), "%03d", ch->vol);
+ fmdsp_putline(buf, vram, &font_fmdsp_small, x+20, y+6, 1, false);
+ snprintf(buf, sizeof(buf), "%08X", ch->freq);
+ fmdsp_putline(buf, vram, &font_fmdsp_small, x+40, y+6, 1, false);
+ snprintf(buf, sizeof(buf), "%08X", (unsigned)(ch->ptr>>16));
+ fmdsp_putline(buf, vram, &font_fmdsp_small, x+85, y+6, 1, false);
+ snprintf(buf, sizeof(buf), "%08X", (unsigned)(ch->endptr>>16));
+ fmdsp_putline(buf, vram, &font_fmdsp_small, x+130, y+6, 1, false);
+ snprintf(buf, sizeof(buf), "%08X", (unsigned)(ch->loopstartptr>>16));
+ fmdsp_putline(buf, vram, &font_fmdsp_small, x+175, y+6, 1, false);
+ snprintf(buf, sizeof(buf), "%08X", (unsigned)(ch->loopendptr>>16));
+ fmdsp_putline(buf, vram, &font_fmdsp_small, x+220, y+6, 1, false);
+}
+
void fmdsp_update(struct fmdsp *fmdsp,
- const struct fmdriver_work *work, uint8_t *vram) {
- for (int t = 0; t < 10; t++) {
+ const struct fmdriver_work *work,
+ const struct opna *opna,
+ uint8_t *vram) {
+ if (fmdsp->style_updated) fmdsp_track_init_10(fmdsp, vram);
+ fmdsp->style_updated = false;
+ for (int y = 0; y < 320; y++) {
+ for (int x = 320; x < PC98_W; x++) {
+ vram[y*PC98_W+x] = 0;
+ }
+ }
+ for (int it = 0; it < FMDSP_TRACK_DISP_CNT_DEFAULT; it++) {
+ int t = (fmdsp->style == FMDSP_DISPSTYLE_DEFAULT) ?
+ track_disp_table_default[it] :
+ track_disp_table_opn[it];
const struct fmdriver_track_status *track = &work->track_status[t];
- char track_info[5] = " ";
+
+ if ((track->info == FMDRIVER_TRACK_INFO_PPZ8)
+ || (track->info == FMDRIVER_TRACK_INFO_PDZF)
+ && track->ppz8_ch) {
+ fmdsp_track_info_ppz8(work->ppz8, track->ppz8_ch-1,
+ 320, TRACK_H*it+6, vram);
+ } else {
+ switch (track_type_table[t].type) {
+ case FMDRIVER_TRACKTYPE_FM:
+ fmdsp_track_info_fm(opna,
+ track_type_table[t].num-1,
+ track->info == FMDRIVER_TRACK_INFO_FM3EX ? track->fmslotmask : 0,
+ 320, TRACK_H*it+6, vram);
+ break;
+ case FMDRIVER_TRACKTYPE_SSG:
+ fmdsp_track_info_ssg(opna,
+ track_type_table[t].num-1,
+ 320, TRACK_H*it+6, vram);
+ break;
+ case FMDRIVER_TRACKTYPE_ADPCM:
+ fmdsp_track_info_adpcm(opna, 320, TRACK_H*it+6, vram);
+ }
+ }
+
+ const char *track_info1 = " ";
+ char track_info2[5] = " ";
if (track->playing) {
switch (track->info) {
case FMDRIVER_TRACK_INFO_PPZ8:
- snprintf(track_info, sizeof(track_info), "PPZ8");
+ snprintf(track_info2, sizeof(track_info2), "PPZ8");
+ break;
+ case FMDRIVER_TRACK_INFO_PDZF:
+ snprintf(track_info2, sizeof(track_info2), "PDZF");
break;
case FMDRIVER_TRACK_INFO_SSG_NOISE_ONLY:
- snprintf(track_info, sizeof(track_info), "N%02X ", work->ssg_noise_freq);
+ snprintf(track_info2, sizeof(track_info2), "N%02X ", work->ssg_noise_freq);
break;
case FMDRIVER_TRACK_INFO_SSG_NOISE_MIX:
- snprintf(track_info, sizeof(track_info), "M%02X ", work->ssg_noise_freq);
+ snprintf(track_info2, sizeof(track_info2), "M%02X ", work->ssg_noise_freq);
+ break;
+ case FMDRIVER_TRACK_INFO_FM3EX:
+ track_info1 = "EX ";
+ for (int c = 0; c < 4; c++) {
+ track_info2[c] = track->fmslotmask[c] ? ' ' : ('1'+c);
+ }
break;
}
}
- fmdsp_putline(track_info, vram, &font_fmdsp_small, TINFO_X, TRACK_H*t+6, 2, true);
+ fmdsp_putline(track_info1, vram, &font_fmdsp_small, TINFO_X, TRACK_H*it+0, 2, true);
+ fmdsp_putline(track_info2, vram, &font_fmdsp_small, TINFO_X, TRACK_H*it+6, 2, true);
char notestr[5] = " S ";
if (track->playing) {
if ((track->key&0xf) == 0xf) {
@@ -252,52 +481,52 @@ void fmdsp_update(struct fmdsp *fmdsp,
}
}
char numbuf[5];
- fmdsp_putline("KN:", vram, &font_fmdsp_small, TDETAIL_X, TRACK_H*t+6, 1, true);
- fmdsp_putline(notestr, vram, &font_fmdsp_small, TDETAIL_KN_V_X, TRACK_H*t+6, 1, true);
- fmdsp_putline("TN:", vram, &font_fmdsp_small, TDETAIL_TN_X, TRACK_H*t+6, 1, true);
+ fmdsp_putline("KN:", vram, &font_fmdsp_small, TDETAIL_X, TRACK_H*it+6, 1, true);
+ fmdsp_putline(notestr, vram, &font_fmdsp_small, TDETAIL_KN_V_X, TRACK_H*it+6, 1, true);
+ fmdsp_putline("TN:", vram, &font_fmdsp_small, TDETAIL_TN_X, TRACK_H*it+6, 1, true);
snprintf(numbuf, sizeof(numbuf), "%03d", track->tonenum);
- fmdsp_putline(numbuf, vram, &font_fmdsp_small, TDETAIL_TN_V_X, TRACK_H*t+6, 1, true);
- fmdsp_putline("VL:", vram, &font_fmdsp_small, TDETAIL_VL_X, TRACK_H*t+6, 1, true);
+ fmdsp_putline(numbuf, vram, &font_fmdsp_small, TDETAIL_TN_V_X, TRACK_H*it+6, 1, true);
+ fmdsp_putline("VL:", vram, &font_fmdsp_small, TDETAIL_VL_X, TRACK_H*it+6, 1, true);
snprintf(numbuf, sizeof(numbuf), "%03d", track->volume);
- fmdsp_putline(numbuf, vram, &font_fmdsp_small, TDETAIL_VL_V_X, TRACK_H*t+6, 1, true);
- fmdsp_putline("GT:", vram, &font_fmdsp_small, TDETAIL_GT_X, TRACK_H*t+6, 1, true);
+ fmdsp_putline(numbuf, vram, &font_fmdsp_small, TDETAIL_VL_V_X, TRACK_H*it+6, 1, true);
+ fmdsp_putline("GT:", vram, &font_fmdsp_small, TDETAIL_GT_X, TRACK_H*it+6, 1, true);
//snprintf(numbuf, sizeof(numbuf), "%03d", track->tonenum);
- //fmdsp_putline(numbuf, vram, &font_fmdsp_small, TDETAIL_GT_V_X, TRACK_H*t+6, 1, true);
- fmdsp_putline("DT:", vram, &font_fmdsp_small, TDETAIL_DT_X, TRACK_H*t+6, 1, true);
+ //fmdsp_putline(numbuf, vram, &font_fmdsp_small, TDETAIL_GT_V_X, TRACK_H*it+6, 1, true);
+ fmdsp_putline("DT:", vram, &font_fmdsp_small, TDETAIL_DT_X, TRACK_H*it+6, 1, true);
if (track->detune) {
snprintf(numbuf, sizeof(numbuf), "%+04d", track->detune);
} else {
snprintf(numbuf, sizeof(numbuf), " 000");
}
- fmdsp_putline(numbuf, vram, &font_fmdsp_small, TDETAIL_DT_V_X, TRACK_H*t+6, 1, true);
- fmdsp_putline("M:", vram, &font_fmdsp_small, TDETAIL_M_X, TRACK_H*t+6, 1, true);
- fmdsp_putline(track->status, vram, &font_fmdsp_small, TDETAIL_M_V_X, TRACK_H*t+6, 1, true);
+ fmdsp_putline(numbuf, vram, &font_fmdsp_small, TDETAIL_DT_V_X, TRACK_H*it+6, 1, true);
+ fmdsp_putline("M:", vram, &font_fmdsp_small, TDETAIL_M_X, TRACK_H*it+6, 1, true);
+ fmdsp_putline(track->status, vram, &font_fmdsp_small, TDETAIL_M_V_X, TRACK_H*it+6, 1, true);
for (int i = 0; i < KEY_OCTAVES; i++) {
- vramblit(vram, KEY_X+KEY_W*i, TRACK_H*t+KEY_Y,
+ vramblit(vram, KEY_X+KEY_W*i, TRACK_H*it+KEY_Y,
s_key_bg, KEY_W, KEY_H);
if (track->playing) {
if (track->actual_key >> 4 == i) {
- vramblit_key(vram, KEY_X+KEY_W*i, TRACK_H*t+KEY_Y,
+ vramblit_key(vram, KEY_X+KEY_W*i, TRACK_H*it+KEY_Y,
s_key_mask, KEY_W, KEY_H,
track->actual_key & 0xf, 8);
}
if (track->key >> 4 == i) {
- vramblit_key(vram, KEY_X+KEY_W*i, TRACK_H*t+KEY_Y,
+ vramblit_key(vram, KEY_X+KEY_W*i, TRACK_H*it+KEY_Y,
s_key_mask, KEY_W, KEY_H,
- track->key & 0xf, 6);
+ track->key & 0xf, track->masked ? 8 : 6);
}
}
}
- uint8_t color_on = track->key == 0xff ? 7 : 2;
+ uint8_t color_on = ((track->key == 0xff) || track->masked) ? 7 : 2;
if (!track->playing) color_on = 3;
- vramblit_color(vram, BAR_L_X, TRACK_H*t+BAR_Y,
+ vramblit_color(vram, BAR_L_X, TRACK_H*it+BAR_Y,
s_bar_l, BAR_L_W, BAR_H, color_on);
for (int i = 0; i < BAR_CNT; i++) {
int c = (i < (track->ticks_left>>2)) ? color_on : 3;
- vramblit_color(vram, BAR_X+BAR_W*i, TRACK_H*t+BAR_Y,
+ vramblit_color(vram, BAR_X+BAR_W*i, TRACK_H*it+BAR_Y,
s_bar, BAR_W, BAR_H, c);
}
- vramblit_color(vram, BAR_X+BAR_W*(track->ticks>>2), TRACK_H*t+BAR_Y,
+ vramblit_color(vram, BAR_X+BAR_W*(track->ticks>>2), TRACK_H*it+BAR_Y,
s_bar, BAR_W, BAR_H, 7);
}
fmdsp_palette_fade(fmdsp);
@@ -331,3 +560,10 @@ static void fontrom_copy_rows(uint8_t *font, const uint8_t *fontrom,
}
}
}
+
+void fmdsp_dispstyle_set(struct fmdsp *fmdsp, enum FMDSP_DISPSTYLE style) {
+ if (style < 0) return;
+ if (style >= FMDSP_DISPSTYLE_CNT) return;
+ fmdsp->style = style;
+ fmdsp->style_updated = true;
+}
diff --git a/fmdsp/fmdsp.h b/fmdsp/fmdsp.h
index f123138..9a67bc7 100644
--- a/fmdsp/fmdsp.h
+++ b/fmdsp/fmdsp.h
@@ -2,12 +2,15 @@
#define MYON_FMDSP_H_INCLUDED
#include <stdint.h>
+#include <stdbool.h>
#include "font.h"
#ifdef __cplusplus
extern "C" {
#endif
+struct opna;
+
enum {
PC98_W = 640,
PC98_H = 400
@@ -17,11 +20,18 @@ enum {
FMDSP_PALETTE_COLORS = 9
};
+enum FMDSP_DISPSTYLE {
+ FMDSP_DISPSTYLE_DEFAULT,
+ FMDSP_DISPSTYLE_OPN,
+ FMDSP_DISPSTYLE_CNT
+};
+
struct fmdsp {
uint8_t palette[FMDSP_PALETTE_COLORS*3];
uint8_t target_palette[FMDSP_PALETTE_COLORS*3];
const struct fmdsp_font *font98;
-
+ enum FMDSP_DISPSTYLE style;
+ bool style_updated;
};
struct fmdriver_work;
@@ -29,10 +39,12 @@ void fmdsp_init(struct fmdsp *fmdsp, const struct fmdsp_font *font);
void fmdsp_vram_init(struct fmdsp *fmdsp,
struct fmdriver_work *work,
uint8_t *vram);
-void fmdsp_update(struct fmdsp *fmdsp, const struct fmdriver_work *work, uint8_t *vram);
+void fmdsp_update(struct fmdsp *fmdsp, const struct fmdriver_work *work,
+ const struct opna *opna, uint8_t *vram);
void fmdsp_vrampalette(struct fmdsp *fmdsp, const uint8_t *vram, uint8_t *vram32, int stride);
void fmdsp_font_from_fontrom(uint8_t *font, const uint8_t *fontrom);
void fmdsp_palette_set(struct fmdsp *fmdsp, int p);
+void fmdsp_dispstyle_set(struct fmdsp *fmdsp, enum FMDSP_DISPSTYLE style);
#ifdef __cplusplus
}
#endif