eliminate texrels, part 3
[picodrive.git] / tools / mkoffsets.c
CommitLineData
d01fa204 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);
4981de9c 26 DUMP(f, DrawLineDest);
27 DUMP(f, HighCol);
28 DUMP(f, HighPreSpr);
d01fa204 29 DUMP(f, Pico_video);
30 DUMP(f, Pico_vram);
4981de9c 31 DUMP(f, PicoOpt);
7b4813fa 32 DUMP(f, Draw2FB);
33 DUMP(f, HighPal);
d01fa204 34 fclose(f);
35
36 return 0;
37}