--- np2/sound/s98.c 2003/10/16 17:58:09 1.1 +++ np2/sound/s98.c 2004/08/15 11:17:58 1.9 @@ -4,6 +4,9 @@ // #include "compiler.h" + +#if defined(SUPPORT_S98) + #include "dosio.h" #include "pccore.h" #include "iocore.h" @@ -12,24 +15,21 @@ #include "s98.h" -#define S98LOG_BUFSIZE (32*1024) +#define S98LOG_BUFSIZE (32 * 1024) -typedef struct { // UINT32は 常に 0fillされてる +typedef struct { BYTE magic[3]; - BYTE formatversion; - UINT32 timerinfo; - UINT32 timerinfo2; - UINT32 compressing; - UINT32 offset; - UINT32 dumpdata; - UINT32 looppoint; + UINT8 formatversion; + BYTE timerinfo[4]; + BYTE timerinfo2[4]; + BYTE compressing[4]; + BYTE offset[4]; + BYTE dumpdata[4]; + BYTE looppoint[4]; BYTE headerreserved[0x24]; BYTE 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; @@ -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; } @@ -110,7 +110,8 @@ void S98_trash(void) { BOOL S98_open(const char *filename) { - int i; + 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