summaryrefslogtreecommitdiff
path: root/src/satmkboot.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/satmkboot.c')
-rw-r--r--src/satmkboot.c23
1 files changed, 8 insertions, 15 deletions
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);