eliminate texrels, part 3
[picodrive.git] / tools / mkoffsets.c
CommitLineData
ea38612f 1#include <stdio.h>
2#include <stddef.h>
3
4#include "../pico/pico_int.h"
5
6#define DUMP(f, field) \
7 fprintf(f, "#define %-20s 0x%02x\n", \
8 "OFS_" #field, \
9 (int)offsetof(struct PicoEState, field))
10
11int main(int argc, char *argv[])
12{
13 char buf[128];
14 FILE *f;
15
16 snprintf(buf, sizeof(buf), "pico/pico_int_o%d.h", sizeof(void *) * 8);
17 f = fopen(buf, "w");
18 if (!f) {
19 perror("fopen");
20 return 1;
21 }
22
23 fprintf(f, "/* autogenerated by %s, do not edit */\n", argv[0]);
24 DUMP(f, DrawScanline);
25 DUMP(f, rendstatus);
99bdfd31 26 DUMP(f, DrawLineDest);
27 DUMP(f, HighCol);
28 DUMP(f, HighPreSpr);
ea38612f 29 DUMP(f, Pico_video);
30 DUMP(f, Pico_vram);
99bdfd31 31 DUMP(f, PicoOpt);
98a27142 32 DUMP(f, Draw2FB);
33 DUMP(f, HighPal);
ea38612f 34 fclose(f);
35
36 return 0;
37}