--- np2/sound/s98.c 2003/10/17 03:52:24 1.2 +++ np2/sound/s98.c 2005/05/13 05:47:25 1.12 @@ -4,6 +4,9 @@ // #include "compiler.h" + +#if defined(SUPPORT_S98) + #include "dosio.h" #include "pccore.h" #include "iocore.h" @@ -12,30 +15,27 @@ #include "s98.h" -#define S98LOG_BUFSIZE (32*1024) +#define S98LOG_BUFSIZE (32 * 1024) -typedef struct { // UINT32は 常に 0fillされてる - BYTE magic[3]; - BYTE formatversion; - UINT32 timerinfo; - UINT32 timerinfo2; - UINT32 compressing; - UINT32 offset; - UINT32 dumpdata; - UINT32 looppoint; - BYTE headerreserved[0x24]; - BYTE title[0x40]; +typedef struct { + UINT8 magic[3]; + UINT8 formatversion; + UINT8 timerinfo[4]; + UINT8 timerinfo2[4]; + UINT8 compressing[4]; + UINT8 offset[4]; + UINT8 dumpdata[4]; + UINT8 looppoint[4]; + UINT8 headerreserved[0x24]; + UINT8 title[0x40]; } S98HDR; -static const S98HDR s98hdr = - {{'S','9','8'}, '1', 1, 0, 0, 0x40, 0x80, 0, {0}, {0}}; - static struct { FILEH fh; UINT32 intcount; SINT32 clock; UINT p; - BYTE buf[S98LOG_BUFSIZE]; + UINT8 buf[S98LOG_BUFSIZE]; } s98log; @@ -64,7 +64,7 @@ static void S98_flush(void) { } } -static void S98_putc(BYTE data) { +static void S98_putc(REG8 data) { s98log.buf[s98log.p++] = data; if (s98log.p == S98LOG_BUFSIZE) { @@ -86,10 +86,10 @@ static void S98_putint(void) { S98_putc(0xFE); /* SYNC(n) */ s98log.intcount -= 2; while (s98log.intcount > 0x7f) { - S98_putc((BYTE)(0x80 | (s98log.intcount & 0x7f))); + S98_putc((REG8)(0x80 | (s98log.intcount & 0x7f))); s98log.intcount >>= 7; } - S98_putc((BYTE)(s98log.intcount & 0x7f)); + S98_putc((REG8)(s98log.intcount & 0x7f)); } s98log.intcount = 0; } @@ -108,9 +108,10 @@ void S98_trash(void) { S98_close(); } -BOOL S98_open(const char *filename) { +BRESULT S98_open(const OEMCHAR *filename) { UINT i; + S98HDR hdr; // ファイルのオープン s98log.fh = file_create(filename); @@ -119,31 +120,40 @@ BOOL S98_open(const char *filename) { } // 初期化 - s98log.clock = pc.realclock / 1000; + s98log.clock = pccore.realclock / 1000; s98log.p = 0; // ヘッダの保存 - for (i=0; i