src/state.c

branch
experimental_memory_mapper_v2
changeset 145
2d6de28c6e6c
parent 112
a392eb8f9806
     1.1 --- a/src/state.c	Fri Apr 12 16:26:25 2013 +0100
     1.2 +++ b/src/state.c	Tue May 21 22:48:32 2013 +0100
     1.3 @@ -76,8 +76,14 @@
     1.4  	uint8_t *romdat1, *romdat2;
     1.5  	romdat1 = malloc(romlen);
     1.6  	romdat2 = malloc(romlen2);
     1.7 -	fread(romdat1, 1, romlen, r15c);
     1.8 -	fread(romdat2, 1, romlen2, r14c);
     1.9 +	if (fread(romdat1, 1, romlen, r15c) != romlen) {
    1.10 +		fprintf(stderr, "[state] Error reading ROM 15C.\n");
    1.11 +		return -3;
    1.12 +	}
    1.13 +	if (fread(romdat2, 1, romlen2, r14c) != romlen) {
    1.14 +		fprintf(stderr, "[state] Error reading ROM 14C.\n");
    1.15 +		return -3;
    1.16 +	}
    1.17  
    1.18  	// convert the ROM data
    1.19  	for (size_t i=0; i<(romlen + romlen2); i+=2) {