| 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 | |
| 11 | int 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); |
| 26 | DUMP(f, DrawLineDest); |
| 27 | DUMP(f, HighCol); |
| 28 | DUMP(f, HighPreSpr); |
| 29 | DUMP(f, Pico_video); |
| 30 | DUMP(f, Pico_vram); |
| 31 | DUMP(f, PicoOpt); |
| 32 | fclose(f); |
| 33 | |
| 34 | return 0; |
| 35 | } |