diff --git a/src/uxnemu.c b/src/uxnemu.c index fa9b86e..b96417c 100644 --- a/src/uxnemu.c +++ b/src/uxnemu.c @@ -421,11 +421,11 @@ nil_deo(Device *d, Uint8 port) static int load(Uxn *u, char *rom) { - FILE *f; + SDL_RWops *f; int r; - if(!(f = fopen(rom, "rb"))) return 0; - r = fread(u->ram.dat + PAGE_PROGRAM, 1, sizeof(u->ram.dat) - PAGE_PROGRAM, f); - fclose(f); + if(!(f = SDL_RWFromFile(rom, "rb"))) return 0; + r = f->read(f, u->ram.dat + PAGE_PROGRAM, 1, sizeof(u->ram.dat) - PAGE_PROGRAM); + f->close(f); if(r < 1) return 0; fprintf(stderr, "Loaded %s\n", rom); SDL_SetWindowTitle(gWindow, rom);