Fixed file memory location

This commit is contained in:
Andrew Alderwick 2021-04-20 23:05:27 +01:00
parent cdfcb5ae0a
commit 751d198606
1 changed files with 1 additions and 1 deletions

View File

@ -233,7 +233,7 @@ file_poke(Uxn *u, Uint8 *m, Uint8 b0, Uint8 b1)
Uint16 addr = (m[b0 - 1] << 8) | b1; Uint16 addr = (m[b0 - 1] << 8) | b1;
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(&m[addr], 1, length, f) : fwrite(&m[addr], 1, length, f))) if(fseek(f, offset, SEEK_SET) != -1 && (result = read ? fread(&u->ram.dat[addr], 1, length, f) : fwrite(&u->ram.dat[addr], 1, length, f)))
printf("%s %d bytes, at %04x from %s\n", read ? "Loaded" : "Saved", length, addr, name); printf("%s %d bytes, at %04x from %s\n", read ? "Loaded" : "Saved", length, addr, name);
fclose(f); fclose(f);
} }