mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-27 08:13:01 +00:00
Load rom in chunks of 64kb
This commit is contained in:
parent
390ae8138a
commit
0aa4aeff41
1 changed files with 9 additions and 5 deletions
|
@ -286,9 +286,13 @@ file_dei(Uint8 id, Uint8 *d, Uint8 port)
|
||||||
int
|
int
|
||||||
load_rom(Uxn *u, char *filename)
|
load_rom(Uxn *u, char *filename)
|
||||||
{
|
{
|
||||||
int ret;
|
int l, i = 0;
|
||||||
file_init(uxn_file, filename, strlen(filename) + 1, 1);
|
FILE *f = fopen(filename, "rb");
|
||||||
ret = file_read(uxn_file, &u->ram[PAGE_PROGRAM], 0x100000 - PAGE_PROGRAM);
|
if(!f)
|
||||||
reset(uxn_file);
|
return 0;
|
||||||
return ret;
|
l = fread(&u->ram[PAGE_PROGRAM], 1, 0x10000 - PAGE_PROGRAM, f);
|
||||||
|
while(l && ++i < 15)
|
||||||
|
l = fread(u->ram + 0x10000 * i, 1, 0x10000, f);
|
||||||
|
fclose(f);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue