// FILE.CPP
//
// File support
-// by James L. Hammons
+// by James Hammons
// (C) 2010 Underground Software
//
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
//
// Who When What
// --- ---------- -------------------------------------------------------------
EepromInit();
jaguarRunAddress = 0x802000; // For non-BIOS runs, this is true
int fileType = ParseFileType(buffer[0], buffer[1], jaguarROMSize);
+ jaguarCartInserted = false;
if (fileType == JST_ROM)
{
+ jaguarCartInserted = true;
memcpy(jagMemSpace + 0x800000, buffer, jaguarROMSize);
delete[] buffer;
return true;
//
// "Alpine" file loading
// Since the developers were coming after us with torches and pitchforks, we decided to
-// allow this kind of thing. ;-) But ONLY FOR THE DEVS, DAMMIT! O_O
+// allow this kind of thing. ;-) But ONLY FOR THE DEVS, DAMMIT! >:-U O_O
//
bool AlpineLoadFile(char * path)
{
// Maybe instead of this, we could try requiring the STUBULATOR ROM? Just a thought...
// Try setting the vector to say, $1000 and putting an instruction there that loops forever:
// This kludge works! Yeah!
- SET32(jaguarMainRAM, 0x10, 0x00001000);
+ SET32(jaguarMainRAM, 0x10, 0x00001000); // Set Exception #4 (Illegal Instruction)
SET16(jaguarMainRAM, 0x1000, 0x60FE); // Here: bra Here
return true;
//
static bool CheckExtension(const char * filename, const char * ext)
{
+ // Sanity checking...
+ if ((filename == NULL) || (ext == NULL))
+ return false;
+
const char * filenameExt = strrchr(filename, '.'); // Get the file's extension (if any)
+
+ if (filenameExt == NULL)
+ return false;
+
return (strcasecmp(filenameExt, ext) == 0 ? true : false);
}
if ((type == FT_SOFTWARE) && (CheckExtension(ze->name, ".j64")
|| CheckExtension(ze->name, ".rom") || CheckExtension(ze->name, ".abs")
- || CheckExtension(ze->name, ".cof") || CheckExtension(ze->name, ".jag")))
+ || CheckExtension(ze->name, ".cof") || CheckExtension(ze->name, ".coff")
+ || CheckExtension(ze->name, ".jag")))
{
found = true;
WriteLog("FILE: Found software file '%s'.\n", ze->name);
// If the file size is divisible by 1M, we probably have an regular ROM.
// We can also check our CRC32 against the internal ROM database to be sure.
- if ((size % 1048576) == 0)
+ // (We also check for the Memory Track cartridge size here as well...)
+ if ((size % 1048576) == 0 || size == 131072)
return JST_ROM;
// If the file size + 8192 bytes is divisible by 1M, we probably have an