Browse Source

vgm logger: oki m6258 support

vampirefrog 1 year ago
parent
commit
fbdc377f6d
2 changed files with 28 additions and 9 deletions
  1. 27
    9
      vgm.c
  2. 1
    0
      vgm.h

+ 27
- 9
vgm.c View File

@@ -1,14 +1,23 @@
1 1
 #include "vgm.h"
2 2
 
3 3
 static const uint8_t header[] = {
4
-	0x56, 0x67, 0x6d, 0x20, 0x4a, 0x83, 0x01, 0x00, 0x51, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x9a, 0x87, 0x00, 0x00, 0x00, 0x00, 0x00,
6
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7
-	0x00, 0x09, 0x3d, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
8
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
9
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
10
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
11
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4
+	/*         0x-0  0x-1  0x-2  0x-3  0x-4  0x-5  0x-6  0x-7  0x-8  0x-9  0x-a  0x-b  0x-c  0x-d  0x-e  0x-f */
5
+	/* 0x0- */ 0x56, 0x67, 0x6d, 0x20, 0x4a, 0x83, 0x01, 0x00, 0x51, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6
+	/* 0x1- */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x9a, 0x87, 0x00, 0x00, 0x00, 0x00, 0x00,
7
+	/* 0x2- */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
8
+	/* 0x3- */ 0x00, 0x09, 0x3d, 0x00, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
9
+	/* 0x4- */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
10
+	/* 0x5- */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
11
+	/* 0x6- */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
12
+	/* 0x7- */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
13
+	/* 0x8- */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
14
+	/* 0x9- */ 0x00, 0x12, 0x7a, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
15
+	/* 0xa- */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
16
+	/* 0xb- */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
17
+	/* 0xc- */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
18
+	/* 0xd- */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
19
+	/* 0xe- */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
20
+	/* 0xf- */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
12 21
 };
13 22
 
14 23
 int vgm_logger_begin(struct vgm_logger *l, char *filename) {
@@ -90,12 +99,21 @@ void vgm_logger_write_ym2151(struct vgm_logger *l, uint8_t reg, uint8_t data) {
90 99
 	vgm_logger_write(l, buf, 3);
91 100
 }
92 101
 
102
+void vgm_logger_write_okim6258(struct vgm_logger *l, uint8_t reg, uint8_t data) {
103
+	uint8_t buf[3];
104
+	buf[0] = 0xb7;
105
+	buf[1] = reg;
106
+	buf[2] = data;
107
+
108
+	vgm_logger_write(l, buf, 3);
109
+}
110
+
93 111
 void vgm_logger_end(struct vgm_logger *l) {
94 112
 	if(l->last_wait)
95 113
 		vgm_logger_write_wait(l, l->last_wait);
96 114
 
97 115
 	fseek(l->f, 0x04, SEEK_SET);
98
-	l->size += 0x80 - 4;
116
+	l->size += sizeof(header) - 4;
99 117
 	fwrite(&l->size, 1, 4, l->f);
100 118
 	fseek(l->f, 0x18, SEEK_SET);
101 119
 	fwrite(&l->total_samples, 1, 4, l->f);

+ 1
- 0
vgm.h View File

@@ -14,5 +14,6 @@ int vgm_logger_begin(struct vgm_logger *, char *);
14 14
 void vgm_logger_wait(struct vgm_logger *, int samples);
15 15
 void vgm_logger_write_ay(struct vgm_logger *, uint8_t reg, uint8_t data);
16 16
 void vgm_logger_write_ym2151(struct vgm_logger *, uint8_t reg, uint8_t data);
17
+void vgm_logger_write_okim6258(struct vgm_logger *, uint8_t reg, uint8_t data);
17 18
 void vgm_logger_end(struct vgm_logger *);
18 19
 

Loading…
Cancel
Save