summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2016-04-23 01:08:43 -0700
committerMichael Pavone <pavone@retrodev.com>2016-04-23 01:08:43 -0700
commit28393dc6c055516b7b03c186ec7bae45f05a61fa (patch)
tree511ec2083f2ed591fa0e1b5c5c51b7c75e7470e2
parent2105a52a24e24b1b34cf397cb76b9df30f94d1b2 (diff)
Fixed loading of SMD format ROMs
-rw-r--r--blastem.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/blastem.c b/blastem.c
index ecf8da0..d8cbb79 100644
--- a/blastem.c
+++ b/blastem.c
@@ -72,7 +72,7 @@ int load_smd_rom(long filesize, FILE * f)
filesize -= SMD_HEADER_SIZE;
fseek(f, SMD_HEADER_SIZE, SEEK_SET);
- uint16_t * dst = cart;
+ uint16_t * dst = cart = malloc(nearest_pow2(filesize));
int rom_size = filesize;
while (filesize > 0) {
fread(block, 1, SMD_BLOCK_SIZE, f);
@@ -81,7 +81,7 @@ int load_smd_rom(long filesize, FILE * f)
}
filesize -= SMD_BLOCK_SIZE;
}
- return filesize;
+ return rom_size;
}
void byteswap_rom(int filesize)