+ if (jaguar_mainRom[0] == 0x60 && jaguar_mainRom[1] == 0x1B)
+ {
+ uint32 loadAddress = GET32(jaguar_mainRom, 0x16), //runAddress = GET32(jaguar_mainRom, 0x2A),
+ codeSize = GET32(jaguar_mainRom, 0x02) + GET32(jaguar_mainRom, 0x06);
+ WriteLog("GUI: Setting up homebrew (ABS-1)... Run address: %08X, length: %08X\n", loadAddress, codeSize);
+
+ if (loadAddress < 0x800000)
+ memcpy(jaguar_mainRam + loadAddress, jaguar_mainRom + 0x24, codeSize);
+ else
+ {
+ for(int i=codeSize-1; i>=0; i--)
+ jaguar_mainRom[(loadAddress - 0x800000) + i] = jaguar_mainRom[i + 0x24];
+/* memcpy(jaguar_mainRam, jaguar_mainRom + 0x24, codeSize);
+ memset(jaguar_mainRom, 0xFF, 0x600000);
+ memcpy(jaguar_mainRom + (loadAddress - 0x800000), jaguar_mainRam, codeSize);
+ memset(jaguar_mainRam, 0x00, 0x400000);*/
+ }
+
+ jaguarRunAddress = loadAddress;
+ }
+ else if (jaguar_mainRom[0] == 0x01 && jaguar_mainRom[1] == 0x50)
+ {
+ uint32 loadAddress = GET32(jaguar_mainRom, 0x28), runAddress = GET32(jaguar_mainRom, 0x24),
+ codeSize = GET32(jaguar_mainRom, 0x18) + GET32(jaguar_mainRom, 0x1C);
+ WriteLog("GUI: Setting up homebrew (ABS-2)... Run address: %08X, length: %08X\n", runAddress, codeSize);
+
+ if (loadAddress < 0x800000)
+ memcpy(jaguar_mainRam + loadAddress, jaguar_mainRom + 0xA8, codeSize);
+ else
+ {
+ for(int i=codeSize-1; i>=0; i--)
+ jaguar_mainRom[(loadAddress - 0x800000) + i] = jaguar_mainRom[i + 0xA8];
+/* memcpy(jaguar_mainRam, jaguar_mainRom + 0xA8, codeSize);
+ memset(jaguar_mainRom, 0xFF, 0x600000);
+ memcpy(jaguar_mainRom + (loadAddress - 0x800000), jaguar_mainRam, codeSize);
+ memset(jaguar_mainRam, 0x00, 0x400000);*/
+ }
+
+ jaguarRunAddress = runAddress;
+ }
+ else
+ {
+ WriteLog("GUI: Couldn't find correct ABS format: %02X %02X\n", jaguar_mainRom[0], jaguar_mainRom[1]);
+ return false;
+ }
+ }
+ else if (stricmp(ext, ".jag") == 0)
+ {
+ // File extension ".JAG": Atari server file with header
+//NOTE: The bytes 'JAGR' should also be at position $1C...
+// Also, there's *always* a $601A header at position $00...
+ if (jaguar_mainRom[0] == 0x60 && jaguar_mainRom[1] == 0x1A)
+ {
+ uint32 loadAddress = GET32(jaguar_mainRom, 0x22), runAddress = GET32(jaguar_mainRom, 0x2A);
+//This is not always right! Especially when converted via bin2jag1!!!
+//We should have access to the length of the furshlumiger file that was loaded anyway!
+//Now, we do! ;-)
+// uint32 progLength = GET32(jaguar_mainRom, 0x02);
+//jaguarRomSize
+//jaguarRunAddress
+// WriteLog("Jaguar: Setting up PD ROM... Run address: %08X, length: %08X\n", runAddress, progLength);
+// memcpy(jaguar_mainRam + loadAddress, jaguar_mainRom + 0x2E, progLength);
+ WriteLog("GUI: Setting up homebrew (JAG)... Run address: %08X, length: %08X\n", runAddress, jaguarRomSize - 0x2E);
+ memcpy(jaguar_mainRam + loadAddress, jaguar_mainRom + 0x2E, jaguarRomSize - 0x2E);
+// SET32(jaguar_mainRam, 4, runAddress);
+ jaguarRunAddress = runAddress;
+ }
+ else
+ return false;
+ }
+ // .J64 (Jaguar cartridge ROM image) is implied by the FileList object...