uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 9a4328ccb5efb683efac66761b64a4afe26a9fb5
parent 556fd603f85f04924677f2fc4675b8ccaef5205f
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date:   Mon, 17 May 2021 21:48:04 +0100

Fixed printing filename after it can get overwritten

Diffstat:
Msrc/emulator.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/emulator.c b/src/emulator.c @@ -246,8 +246,10 @@ file_talk(Device *d, Uint8 b0, Uint8 w) Uint16 addr = mempeek16(d->dat, b0 - 1); FILE *f = fopen(name, read ? "r" : (offset ? "a" : "w")); if(f) { - if(fseek(f, offset, SEEK_SET) != -1 && (result = read ? fread(&d->mem[addr], 1, length, f) : fwrite(&d->mem[addr], 1, length, f))) - printf("%s %d bytes, at %04x from %s\n", read ? "Loaded" : "Saved", result, addr, name); + printf("%s %04x %s %s: ", read ? "Loading" : "Saving", addr, read ? "from" : "to", name); + if(fseek(f, offset, SEEK_SET) != -1) + result = read ? fread(&d->mem[addr], 1, length, f) : fwrite(&d->mem[addr], 1, length, f); + printf("%04x bytes\n", result); fclose(f); } mempoke16(d->dat, 0x2, result);