diff options
| author | Takamichi Horikawa <takamichiho@gmail.com> | 2017-01-18 23:37:07 +0900 | 
|---|---|---|
| committer | Takamichi Horikawa <takamichiho@gmail.com> | 2017-01-18 23:37:07 +0900 | 
| commit | e8fd09abf68b944b05554c82adb577514cad5ca5 (patch) | |
| tree | f8882715e86534cec2dc20154fd24c6bef3c668b /fmdsp/font_rom.c | |
| parent | 09ea1fe272aca6ebb6840f02765acd44ac3ecebc (diff) | |
improve FMDSP and enable title display on win32
Diffstat (limited to 'fmdsp/font_rom.c')
| -rw-r--r-- | fmdsp/font_rom.c | 24 | 
1 files changed, 24 insertions, 0 deletions
| diff --git a/fmdsp/font_rom.c b/fmdsp/font_rom.c new file mode 100644 index 0000000..de6bc19 --- /dev/null +++ b/fmdsp/font_rom.c @@ -0,0 +1,24 @@ +#include "font.h" + +static const void *font_rom_get(const struct fmdsp_font *font, +                                uint16_t jis, enum fmdsp_font_type type) { +  const uint8_t *fontdata = font->data; +  const uint8_t *fontptr; +  if (type == FMDSP_FONT_ANK) { +    fontptr =  fontdata + 0x800 + (jis<<4); +  } else { +    uint8_t row = jis >> 8; +    uint8_t cell = jis; +    fontptr = fontdata + (0x800 + (0x60*16*2*(row-0x20)) + (cell<<5)); +    if (type == FMDSP_FONT_JIS_RIGHT) fontptr += 16; +  } +  if ((fontptr + (16*16/8)) > (fontdata + FONT_ROM_FILESIZE)) fontptr = 0; +  return fontptr; +} + +void fmdsp_font_from_font_rom(struct fmdsp_font *font, const void *data) { +  font->data = data; +  font->width_half = 8; +  font->height = 16; +  font->get = font_rom_get; +} | 
