| ... | ... |
@@ -81,7 +81,7 @@ file_talk(Device *d, Uint8 b0, Uint8 w) |
| 81 | 81 |
Uint16 result = 0, length = peek16(d->dat, 0xa); |
| 82 | 82 |
long offset = (peek16(d->dat, 0x4) << 16) + peek16(d->dat, 0x6); |
| 83 | 83 |
Uint16 addr = peek16(d->dat, b0 - 1); |
| 84 |
- FILE *f = fopen(name, read ? "r" : (offset ? "a" : "w")); |
|
| 84 |
+ FILE *f = fopen(name, read ? "rb" : (offset ? "ab" : "wb")); |
|
| 85 | 85 |
if(f) {
|
| 86 | 86 |
fprintf(stderr, "%s %s %s #%04x, ", read ? "Loading" : "Saving", name, read ? "to" : "from", addr); |
| 87 | 87 |
if(fseek(f, offset, SEEK_SET) != -1) |
| ... | ... |
@@ -346,7 +346,7 @@ file_talk(Device *d, Uint8 b0, Uint8 w) |
| 346 | 346 |
Uint16 result = 0, length = peek16(d->dat, 0xa); |
| 347 | 347 |
long offset = (peek16(d->dat, 0x4) << 16) + peek16(d->dat, 0x6); |
| 348 | 348 |
Uint16 addr = peek16(d->dat, b0 - 1); |
| 349 |
- FILE *f = fopen(name, read ? "r" : (offset ? "a" : "w")); |
|
| 349 |
+ FILE *f = fopen(name, read ? "rb" : (offset ? "ab" : "wb")); |
|
| 350 | 350 |
if(f) {
|
| 351 | 351 |
fprintf(stderr, "%s %s %s #%04x, ", read ? "Loading" : "Saving", name, read ? "to" : "from", addr); |
| 352 | 352 |
if(fseek(f, offset, SEEK_SET) != -1) |