diff --git a/SheepShaver/src/include/rom_patches.h b/SheepShaver/src/include/rom_patches.h index c263606a..a4b4e283 100644 --- a/SheepShaver/src/include/rom_patches.h +++ b/SheepShaver/src/include/rom_patches.h @@ -31,6 +31,7 @@ enum { ROMTYPE_NEWWORLD }; extern int ROMType; +extern bool SoundPatchFlag; extern bool DecodeROM(uint8 *data, uint32 size); extern bool PatchROM(void); diff --git a/SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp b/SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp index de7b0d6f..9b6d8794 100755 --- a/SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp +++ b/SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp @@ -765,10 +765,6 @@ static void dump_disassembly(const uint32 pc, const int prefix_count, const int } } -static bool isSegvBinCue(uint32 a) { - return a == 0x389e00 || a == 0x389e08 || a == 0x389fe0 || a == 0x489e00 || a == 0x489e08 || a == 0x489fe0; -} - sigsegv_return_t sigsegv_handler(sigsegv_info_t *sip) { #if ENABLE_VOSF @@ -820,9 +816,6 @@ sigsegv_return_t sigsegv_handler(sigsegv_info_t *sip) else if ((uint32)(addr - SheepMem::ZeroPage()) < (uint32)SheepMem::PageSize()) return SIGSEGV_RETURN_SKIP_INSTRUCTION; - else if (ROMType == ROMTYPE_NEWWORLD && isSegvBinCue(pc - ROMBase)) - return SIGSEGV_RETURN_SKIP_INSTRUCTION; - // Ignore all other faults, if requested if (PrefsFindBool("ignoresegv")) return SIGSEGV_RETURN_SKIP_INSTRUCTION; diff --git a/SheepShaver/src/rom_patches.cpp b/SheepShaver/src/rom_patches.cpp index 8f15b805..804d6a97 100644 --- a/SheepShaver/src/rom_patches.cpp +++ b/SheepShaver/src/rom_patches.cpp @@ -67,6 +67,7 @@ const uint32 ADDR_MAP_PATCH_SPACE = 0x2fd140; // Global variables int ROMType; // ROM type +bool SoundPatchFlag; static uint32 sony_offset; // Offset of .Sony driver resource // Prototypes @@ -694,6 +695,8 @@ bool PatchROM(void) else return false; + SoundPatchFlag = ROMType == ROMTYPE_NEWWORLD && !PrefsFindBool("ignoresegv"); + // Check that other ROM addresses point to really free regions if (!check_rom_patch_space(CHECK_LOAD_PATCH_SPACE, 0x40)) return false; diff --git a/SheepShaver/src/rsrc_patches.cpp b/SheepShaver/src/rsrc_patches.cpp index ccd1c33d..3b30c308 100644 --- a/SheepShaver/src/rsrc_patches.cpp +++ b/SheepShaver/src/rsrc_patches.cpp @@ -517,13 +517,12 @@ void CheckLoad(uint32 type, int16 id, uint16 *p, uint32 size) D(bug(" patch applied\n")); } - // patch for -16501 resource ID not even needed? seems to run off native driver without -/* } else if (type == FOURCC('D','R','V','R') && (id == -16501)){// || id == -16500)) { // -16500 will patch over native driver and traps out to code, but very hard to re-implement there! + } else if (SoundPatchFlag && type == FOURCC('D','R','V','R') && (id == -16501 || id == -16500)) { D(bug("DRVR -16501/-16500 found\n")); // Install sound input driver memcpy(p, sound_input_driver, sizeof(sound_input_driver)); D(bug(" patch 1 applied\n")); -*/ + } else if (type == FOURCC('I','N','I','T') && id == 1 && size == (2416 >> 1)) { D(bug("INIT 1 (size 2416) found\n")); size >>= 1;