mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-01-01 02:34:43 +00:00
SS: Patch the sound input driver if using New World ROM and ignore SEGV is false
This commit is contained in:
parent
98e12fbc2e
commit
09429e6021
@ -31,6 +31,7 @@ enum {
|
|||||||
ROMTYPE_NEWWORLD
|
ROMTYPE_NEWWORLD
|
||||||
};
|
};
|
||||||
extern int ROMType;
|
extern int ROMType;
|
||||||
|
extern bool SoundPatchFlag;
|
||||||
|
|
||||||
extern bool DecodeROM(uint8 *data, uint32 size);
|
extern bool DecodeROM(uint8 *data, uint32 size);
|
||||||
extern bool PatchROM(void);
|
extern bool PatchROM(void);
|
||||||
|
@ -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)
|
sigsegv_return_t sigsegv_handler(sigsegv_info_t *sip)
|
||||||
{
|
{
|
||||||
#if ENABLE_VOSF
|
#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())
|
else if ((uint32)(addr - SheepMem::ZeroPage()) < (uint32)SheepMem::PageSize())
|
||||||
return SIGSEGV_RETURN_SKIP_INSTRUCTION;
|
return SIGSEGV_RETURN_SKIP_INSTRUCTION;
|
||||||
|
|
||||||
else if (ROMType == ROMTYPE_NEWWORLD && isSegvBinCue(pc - ROMBase))
|
|
||||||
return SIGSEGV_RETURN_SKIP_INSTRUCTION;
|
|
||||||
|
|
||||||
// Ignore all other faults, if requested
|
// Ignore all other faults, if requested
|
||||||
if (PrefsFindBool("ignoresegv"))
|
if (PrefsFindBool("ignoresegv"))
|
||||||
return SIGSEGV_RETURN_SKIP_INSTRUCTION;
|
return SIGSEGV_RETURN_SKIP_INSTRUCTION;
|
||||||
|
@ -67,6 +67,7 @@ const uint32 ADDR_MAP_PATCH_SPACE = 0x2fd140;
|
|||||||
|
|
||||||
// Global variables
|
// Global variables
|
||||||
int ROMType; // ROM type
|
int ROMType; // ROM type
|
||||||
|
bool SoundPatchFlag;
|
||||||
static uint32 sony_offset; // Offset of .Sony driver resource
|
static uint32 sony_offset; // Offset of .Sony driver resource
|
||||||
|
|
||||||
// Prototypes
|
// Prototypes
|
||||||
@ -694,6 +695,8 @@ bool PatchROM(void)
|
|||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
SoundPatchFlag = ROMType == ROMTYPE_NEWWORLD && !PrefsFindBool("ignoresegv");
|
||||||
|
|
||||||
// Check that other ROM addresses point to really free regions
|
// Check that other ROM addresses point to really free regions
|
||||||
if (!check_rom_patch_space(CHECK_LOAD_PATCH_SPACE, 0x40))
|
if (!check_rom_patch_space(CHECK_LOAD_PATCH_SPACE, 0x40))
|
||||||
return false;
|
return false;
|
||||||
|
@ -517,13 +517,12 @@ void CheckLoad(uint32 type, int16 id, uint16 *p, uint32 size)
|
|||||||
D(bug(" patch applied\n"));
|
D(bug(" patch applied\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// patch for -16501 resource ID not even needed? seems to run off native driver without
|
} else if (SoundPatchFlag && type == FOURCC('D','R','V','R') && (id == -16501 || id == -16500)) {
|
||||||
/* } 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!
|
|
||||||
D(bug("DRVR -16501/-16500 found\n"));
|
D(bug("DRVR -16501/-16500 found\n"));
|
||||||
// Install sound input driver
|
// Install sound input driver
|
||||||
memcpy(p, sound_input_driver, sizeof(sound_input_driver));
|
memcpy(p, sound_input_driver, sizeof(sound_input_driver));
|
||||||
D(bug(" patch 1 applied\n"));
|
D(bug(" patch 1 applied\n"));
|
||||||
*/
|
|
||||||
} else if (type == FOURCC('I','N','I','T') && id == 1 && size == (2416 >> 1)) {
|
} else if (type == FOURCC('I','N','I','T') && id == 1 && size == (2416 >> 1)) {
|
||||||
D(bug("INIT 1 (size 2416) found\n"));
|
D(bug("INIT 1 (size 2416) found\n"));
|
||||||
size >>= 1;
|
size >>= 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user