--- np2/sound/s98.c 2003/10/17 03:52:24 1.2 +++ np2/sound/s98.c 2004/01/13 05:30:59 1.7 @@ -12,24 +12,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 +61,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 +83,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; } @@ -111,6 +108,7 @@ void S98_trash(void) { BOOL S98_open(const char *filename) { UINT i; + S98HDR hdr; // ファイルのオープン s98log.fh = file_create(filename); @@ -119,31 +117,41 @@ BOOL S98_open(const char *filename) { } // 初期化 - s98log.clock = pc.realclock / 1000; + s98log.clock = pccore.realclock / 1000; s98log.p = 0; // ヘッダの保存 - for (i=0; i