more logging, intendation fixes

This commit is contained in:
markwkidd 2018-01-27 13:28:14 -05:00 committed by GitHub
parent 4f96be6e12
commit cd5a8f971a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,7 +43,7 @@ int pos = 0; // current position in data
int LoadCart(char *path) int LoadCart(char *path)
{ {
printf("[INFO] [FREEINTV] Attempting to load cartridge ROM from: %s\n", path); printf("[INFO] [FREEINTV] Attempting to load cartridge ROM from: %s\n", path);
unsigned char word[1]; unsigned char word[1];
FILE *fp; FILE *fp;
@ -56,34 +56,41 @@ int LoadCart(char *path)
data[size] = word[0]; data[size] = word[0];
size++; size++;
} }
fclose(fp); fclose(fp);
if (feof(fp))
if(isROM()) // intellicart format {
{ printf("[INFO] [FREEINTV] Successful cartridge load: EOF indicator set");
printf("[INFO] [FREEINTV] Intellicart cartridge format detected\n"); }
return loadROM(); if (ferror(fp))
} {
else printf("[ERROR] [FREEINTV] Cartridge load error indicator set");
{ }
// check cartinfo database for load method if(isROM()) // intellicart format
printf("[INFO] [FREEINTV] Intelllicart format not detected. Determining load method via database.\n"); {
switch(getLoadMethod()) printf("[INFO] [FREEINTV] Intellicart cartridge format detected\n");
{ return loadROM();
case 0: printf("[INFO] [FREEINTV] Cartridge database match: memory map 0\n"); load0(); break; }
case 1: printf("[INFO] [FREEINTV] Cartridge database match: memory map 1\n"); load1(); break; else
case 2: printf("[INFO] [FREEINTV] Cartridge database match: memory map 2\n"); load2(); break; {
case 3: printf("[INFO] [FREEINTV] Cartridge database match: memory map 3\n"); load3(); break; // check cartinfo database for load method
case 4: printf("[INFO] [FREEINTV] Cartridge database match: memory map 4\n"); load4(); break; printf("[INFO] [FREEINTV] Intelllicart format not detected. Determining load method via database.\n");
case 5: printf("[INFO] [FREEINTV] Cartridge database match: memory map 5\n"); load5(); break; switch(getLoadMethod())
case 6: printf("[INFO] [FREEINTV] Cartridge database match: memory map 6\n"); load6(); break; {
case 7: printf("[INFO] [FREEINTV] Cartridge database match: memory map 7\n"); load7(); break; case 0: printf("[INFO] [FREEINTV] Cartridge database match: memory map 0\n"); load0(); break;
case 8: printf("[INFO] [FREEINTV] Cartridge database match: memory map 8\n"); load8(); break; case 1: printf("[INFO] [FREEINTV] Cartridge database match: memory map 1\n"); load1(); break;
case 9: printf("[INFO] [FREEINTV] Cartridge database match: memory map 9\n"); load9(); break; case 2: printf("[INFO] [FREEINTV] Cartridge database match: memory map 2\n"); load2(); break;
default: printf("[INFO] [FREEINTV] No database match. Using default cartridge memory map.\n"); load0(); case 3: printf("[INFO] [FREEINTV] Cartridge database match: memory map 3\n"); load3(); break;
} case 4: printf("[INFO] [FREEINTV] Cartridge database match: memory map 4\n"); load4(); break;
} case 5: printf("[INFO] [FREEINTV] Cartridge database match: memory map 5\n"); load5(); break;
printf("[INFO] [FREEINTV] Cartridge ROM loaded into memory.\n"); case 6: printf("[INFO] [FREEINTV] Cartridge database match: memory map 6\n"); load6(); break;
return 1; case 7: printf("[INFO] [FREEINTV] Cartridge database match: memory map 7\n"); load7(); break;
case 8: printf("[INFO] [FREEINTV] Cartridge database match: memory map 8\n"); load8(); break;
case 9: printf("[INFO] [FREEINTV] Cartridge database match: memory map 9\n"); load9(); break;
default: printf("[INFO] [FREEINTV] No database match. Using default cartridge memory map.\n"); load0();
}
}
printf("[INFO] [FREEINTV] Cartridge ROM loaded into memory.\n");
return 1;
} }
else else
{ {