aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakamichi Horikawa <takamichiho@gmail.com>2017-09-20 23:27:18 +0900
committerTakamichi Horikawa <takamichiho@gmail.com>2017-09-20 23:27:18 +0900
commit0e4014dae7727a06a80b59b6ede26d8d08d2c42b (patch)
treef53bd2d6b31566e170da5f118c7ed8604b6d1cb7
parentaa27f073c63cb8120e9debebb627c6282870397a (diff)
fmdsp-pacc: add code to ignore ANSI escape sequences
-rw-r--r--common/fmplayer_work_opna.c1
-rw-r--r--fmdsp/fmdsp-pacc.c29
-rw-r--r--sdl/main.c4
-rw-r--r--sdl/unix/Makefile2
4 files changed, 33 insertions, 3 deletions
diff --git a/common/fmplayer_work_opna.c b/common/fmplayer_work_opna.c
index b3b0c69..16bb85c 100644
--- a/common/fmplayer_work_opna.c
+++ b/common/fmplayer_work_opna.c
@@ -1,4 +1,5 @@
#include "fmplayer_common.h"
+#include "fmplayer_drumrom.h"
#include "fmdriver/fmdriver.h"
#include "fmdriver/ppz8.h"
#include "libopna/opna.h"
diff --git a/fmdsp/fmdsp-pacc.c b/fmdsp/fmdsp-pacc.c
index 02b6e17..39fbdfb 100644
--- a/fmdsp/fmdsp-pacc.c
+++ b/fmdsp/fmdsp-pacc.c
@@ -1794,9 +1794,38 @@ static void font_putline(
int fh = font->height;
int xo = 0;
+ enum {
+ STATE_NORMAL,
+ STATE_ESC,
+ STATE_CSI,
+ STATE_SYNC,
+ } esc_state = STATE_NORMAL;
+
while (*cp932str) {
if (!sjis_is2nd) {
if (!sjis_is_mb_start(*cp932str)) {
+ if (esc_state != STATE_NORMAL || *cp932str == 0x1b) {
+ if (esc_state == STATE_SYNC) {
+ esc_state = STATE_NORMAL;
+ } else if (esc_state == STATE_ESC) {
+ if (*cp932str == '[') {
+ esc_state = STATE_CSI;
+ } else if (*cp932str == '!') {
+ esc_state = STATE_SYNC;
+ } else {
+ esc_state = STATE_NORMAL;
+ }
+ } else if (esc_state == STATE_CSI) {
+ if (('0' <= *cp932str && *cp932str <= '9') || *cp932str == ';') {
+ } else {
+ esc_state = STATE_NORMAL;
+ }
+ } else {
+ esc_state = STATE_ESC;
+ }
+ cp932str++;
+ continue;
+ }
if (*cp932str == '\t') {
xo += fw*8;
xo -= (xo % (fw*8));
diff --git a/sdl/main.c b/sdl/main.c
index 5a103b4..f4bd752 100644
--- a/sdl/main.c
+++ b/sdl/main.c
@@ -9,8 +9,8 @@
#include "fmdriver/fmdriver.h"
#include "common/fmplayer_file.h"
#include "common/fmplayer_common.h"
+#include "common/fmplayer_fontrom.h"
#include "fft/fft.h"
-#include "fmdsp/fontrom_shinonome.inc"
bool loadgl(void);
@@ -160,7 +160,7 @@ int main(int argc, char **argv) {
return 1;
}
fmdsp_pacc_set(g.fp, &g.work, &g.opna, &g.fftin);
- fmdsp_font_from_font_rom(&g.font16, fmdsp_shinonome_font_rom);
+ fmplayer_font_rom_load(&g.font16);
fmdsp_pacc_set_font16(g.fp, &g.font16);
SDL_EventState(SDL_DROPFILE, SDL_ENABLE);
diff --git a/sdl/unix/Makefile b/sdl/unix/Makefile
index 62dd177..274f40d 100644
--- a/sdl/unix/Makefile
+++ b/sdl/unix/Makefile
@@ -11,7 +11,7 @@ OBJS+=pacc-gl.o
OBJS+=fmdsp-pacc.o font_fmdsp_small.o fmdsp_platform_unix.o font_rom.o
OBJS+=opna.o opnafm.o opnassg.o opnadrum.o opnaadpcm.o opnatimer.o opnassg-sinc-c.o opnassg-sinc-sse2.o
OBJS+=fmdriver_pmd.o fmdriver_fmp.o ppz8.o fmdriver_common.o
-OBJS+=fmplayer_file.o fmplayer_work_opna.o fmplayer_file_unix.o fmplayer_drumrom_unix.o
+OBJS+=fmplayer_file.o fmplayer_work_opna.o fmplayer_file_unix.o fmplayer_drumrom_unix.o fmplayer_fontrom_unix.o
OBJS+=fft.o
TARGET:=fmplayersdl