diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bootinfo.h | 7 | ||||
-rw-r--r-- | src/satmkboot.c | 23 |
2 files changed, 14 insertions, 16 deletions
diff --git a/src/bootinfo.h b/src/bootinfo.h index 976f8e1..a40ca40 100644 --- a/src/bootinfo.h +++ b/src/bootinfo.h @@ -4,20 +4,25 @@ #include <stdint.h> struct systemid { - char title [112]; + char magic [ 16]; char maker [ 16]; char product [ 10]; char version [ 6]; char reldate [ 8]; char device [ 8]; char regions [ 10]; + char padding1 [ 6]; char peripherals[ 16]; + char title [112]; + uint32_t padding2[4]; uint32_t bootsize; + uint32_t padding3; uint32_t stack_master; uint32_t stack_slave; uint32_t load_addr; uint32_t load_size; + uint32_t padding4[2]; }; #endif diff --git a/src/satmkboot.c b/src/satmkboot.c index b86a769..3b71fe5 100644 --- a/src/satmkboot.c +++ b/src/satmkboot.c @@ -1,4 +1,5 @@ #include <errno.h> +#include <stddef.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -8,7 +9,7 @@ #include "symbols.h" static struct systemid sysid = { - .title = "TEST TITLE ", + .magic = "SEGA SEGASATURN ", .maker = "SEGA TP T-000 ", .product = "T-000000G ", .version = "V0.001", @@ -16,6 +17,8 @@ static struct systemid sysid = { .device = "CD-1/1 ", .regions = " ", .peripherals = " ", + .padding1 = " ", + .title = "TEST TITLE ", .bootsize = 0xe00, .stack_master = 0, .stack_slave = 0, @@ -41,29 +44,19 @@ static void serialize_region_code(char *out, const struct symbolname *region) static int write_output(FILE *fp) { - static const unsigned char zeros[16]; extern const unsigned char securitycode[]; extern const size_t securitycode_size; /* system id - 0x100 bytes */ - WRITE (fp, "SEGA SEGASATURN ", 16); - WRITE (fp, sysid.maker, 16); - WRITE (fp, sysid.product, 10); - WRITE (fp, sysid.version, 6); - WRITE (fp, sysid.reldate, 8); - WRITE (fp, sysid.device, 8); - WRITE (fp, sysid.regions, 10); - WRITE (fp, " ", 6); - WRITE (fp, sysid.peripherals, 16); - WRITE (fp, sysid.title, 112); - WRITE (fp, zeros, 16); /* reserved bytes */ + WRITE (fp, &sysid, offsetof(struct systemid, bootsize)); WRITE32(fp, sysid.bootsize); - WRITE (fp, zeros, 4); /* reserved bytes */ + WRITE32(fp, 0); /* reserved bytes */ WRITE32(fp, sysid.stack_master); WRITE32(fp, sysid.stack_slave); WRITE32(fp, sysid.load_addr); WRITE32(fp, sysid.load_size); - WRITE (fp, zeros, 8); /* reserved bytes */ + WRITE32(fp, 0); /* reserved bytes */ + WRITE32(fp, 0); /* reserved bytes */ /* security code */ WRITE(fp, securitycode, securitycode_size); |