--- SheepShaver/src/rom_patches.cpp 2003/10/05 23:05:03 1.11 +++ SheepShaver/src/rom_patches.cpp 2003/10/06 21:23:53 1.16 @@ -131,7 +131,7 @@ void decode_parcels(const uint8 *src, ui (parcel_type >> 8) & 0xff, parcel_type & 0xff, &parcel_data[6])); if (parcel_type == FOURCC('r','o','m',' ')) { uint32 lzss_offset = ntohl(parcel_data[2]); - uint32 lzss_size = ((uint32)src + parcel_offset) - ((uint32)parcel_data + lzss_offset); + uint32 lzss_size = ((uintptr)src + next_offset) - ((uintptr)parcel_data + lzss_offset); decode_lzss((uint8 *)parcel_data + lzss_offset, dest, lzss_size); } parcel_offset = next_offset; @@ -725,6 +725,16 @@ bool PatchROM(void) else return false; + // Check that other ROM addresses point to really free regions + if (ntohl(*(uint32 *)(ROM_BASE + CHECK_LOAD_PATCH_SPACE)) != 0x6b636b63) + return false; + if (ntohl(*(uint32 *)(ROM_BASE + PUT_SCRAP_PATCH_SPACE)) != 0x6b636b63) + return false; + if (ntohl(*(uint32 *)(ROM_BASE + GET_SCRAP_PATCH_SPACE)) != 0x6b636b63) + return false; + if (ntohl(*(uint32 *)(ROM_BASE + ADDR_MAP_PATCH_SPACE)) != 0x6b636b63) + return false; + // Apply patches if (!patch_nanokernel_boot()) return false; if (!patch_68k_emul()) return false; @@ -1842,25 +1852,17 @@ static bool patch_68k(void) *wp = htons(M68K_RTS); // Don't install Time Manager task for 60Hz interrupt (Enable60HzInts, via 0x2b8) - if (ROMType == ROMTYPE_NEWWORLD) { + if (ROMType == ROMTYPE_NEWWORLD || ROMType == ROMTYPE_GOSSAMER) { static const uint8 tm_task_dat[] = {0x30, 0x3c, 0x4e, 0x2b, 0xa9, 0xc9}; - if ((base = find_rom_data(0x2e0, 0x320, tm_task_dat, sizeof(tm_task_dat))) == 0) return false; + if ((base = find_rom_data(0x2a0, 0x320, tm_task_dat, sizeof(tm_task_dat))) == 0) return false; D(bug("tm_task %08lx\n", base)); - wp = (uint16 *)(ROM_BASE + base + 28); // FIXME: this is not right for all nw ROMs + wp = (uint16 *)(ROM_BASE + base + 28); *wp++ = htons(M68K_NOP); *wp++ = htons(M68K_NOP); *wp++ = htons(M68K_NOP); *wp++ = htons(M68K_NOP); *wp++ = htons(M68K_NOP); *wp = htons(M68K_NOP); - } else if (ROMType == ROMTYPE_GOSSAMER) { - static const uint8 tm_task_dat[] = {0x30, 0x3c, 0x4e, 0x2b, 0xa9, 0xc9}; - if ((base = find_rom_data(0x2a0, 0x2e0, tm_task_dat, sizeof(tm_task_dat))) == 0) return false; - D(bug("tm_task %08lx\n", base)); - wp = (uint16 *)(ROM_BASE + base + 22); - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); - *wp++ = htons(M68K_NOP); } else { static const uint8 tm_task_dat[] = {0x20, 0x3c, 0x73, 0x79, 0x73, 0x61}; if ((base = find_rom_data(0x280, 0x300, tm_task_dat, sizeof(tm_task_dat))) == 0) return false; @@ -2238,9 +2240,9 @@ void InstallDrivers(void) uint8 pb[SIZEOF_IOParam]; // Install floppy driver - if (ROMType == ROMTYPE_NEWWORLD) { + if (ROMType == ROMTYPE_NEWWORLD || ROMType == ROMTYPE_GOSSAMER) { - // Force installation of floppy driver with NewWorld ROMs + // Force installation of floppy driver with NewWorld and Gossamer ROMs r.a[0] = ROM_BASE + sony_offset; r.d[0] = (uint32)SonyRefNum; Execute68kTrap(0xa43d, &r); // DrvrInstallRsrvMem()