Mercurial > repos > blastem
changeset 1682:a0aa9e3c9508
Fix SMD ROM support
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 17 Jan 2019 19:14:09 -0800 |
parents | 3f1c8258e20f |
children | 7e044a84268d |
files | blastem.c |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/blastem.c Thu Jan 17 19:13:59 2019 -0800 +++ b/blastem.c Thu Jan 17 19:14:09 2019 -0800 @@ -76,14 +76,16 @@ size_t filesize = 512 * 1024; size_t readsize = 0; - uint16_t *dst = malloc(filesize); + uint16_t *dst, *buf; + dst = buf = malloc(filesize); size_t read; do { if ((readsize + SMD_BLOCK_SIZE > filesize)) { filesize *= 2; - dst = realloc(dst, filesize); + buf = realloc(buf, filesize); + dst = buf + readsize/sizeof(uint16_t); } read = romread(block, 1, SMD_BLOCK_SIZE, f); if (read > 0) { @@ -95,7 +97,7 @@ } while(read > 0); romclose(f); - *buffer = dst; + *buffer = buf; return readsize; }