mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-30 17:53:01 +00:00
Fixed printing filename after it can get overwritten
This commit is contained in:
parent
556fd603f8
commit
9a4328ccb5
1 changed files with 4 additions and 2 deletions
|
@ -246,8 +246,10 @@ file_talk(Device *d, Uint8 b0, Uint8 w)
|
||||||
Uint16 addr = mempeek16(d->dat, b0 - 1);
|
Uint16 addr = mempeek16(d->dat, b0 - 1);
|
||||||
FILE *f = fopen(name, read ? "r" : (offset ? "a" : "w"));
|
FILE *f = fopen(name, read ? "r" : (offset ? "a" : "w"));
|
||||||
if(f) {
|
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 %04x %s %s: ", read ? "Loading" : "Saving", addr, read ? "from" : "to", name);
|
||||||
printf("%s %d bytes, at %04x from %s\n", read ? "Loaded" : "Saved", result, addr, 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);
|
fclose(f);
|
||||||
}
|
}
|
||||||
mempoke16(d->dat, 0x2, result);
|
mempoke16(d->dat, 0x2, result);
|
||||||
|
|
Loading…
Reference in a new issue