emu/load: use RWops - it's more portable and allows loading roms from assets of an apk on Android
This commit is contained in:
parent
62f740416d
commit
9bc6a83873
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue