From 2224cc63d0b90ba3ad00c734dafd192b6f395a2b Mon Sep 17 00:00:00 2001 From: gbeauche <> Date: Sun, 20 Jun 2004 19:10:02 +0000 Subject: [PATCH] MacOS 9.0.4 support. ;-) --- SheepShaver/src/emul_op.cpp | 8 ++++++++ SheepShaver/src/include/emul_op.h | 3 ++- SheepShaver/src/rsrc_patches.cpp | 21 ++++++++++++++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/SheepShaver/src/emul_op.cpp b/SheepShaver/src/emul_op.cpp index c8005ece..c31805e4 100644 --- a/SheepShaver/src/emul_op.cpp +++ b/SheepShaver/src/emul_op.cpp @@ -435,6 +435,14 @@ void EmulOp(M68kRegisters *r, uint32 pc, int selector) PatchNativeResourceManager(); break; + case OP_NTRB_17_PATCH4: + r->d[0] = ReadMacInt16(r->a[7]); + r->a[7] += 2; + D(bug("%d %d\n", ReadMacInt16(r->a[2]), ReadMacInt16(r->a[2] + 6))); + if (ReadMacInt16(r->a[2]) == 11 && ReadMacInt16(r->a[2] + 6) == 17) + PatchNativeResourceManager(); + break; + case OP_CHECKLOAD: { // vCheckLoad() patch uint32 type = ReadMacInt32(r->a[7]); r->a[7] += 4; diff --git a/SheepShaver/src/include/emul_op.h b/SheepShaver/src/include/emul_op.h index eaa9472a..079915f5 100644 --- a/SheepShaver/src/include/emul_op.h +++ b/SheepShaver/src/include/emul_op.h @@ -47,7 +47,7 @@ enum { // Selectors for EMUL_OP opcodes OP_ADBOP, OP_INSTIME, OP_RMVTIME, OP_PRIMETIME, OP_MICROSECONDS, OP_PUT_SCRAP, OP_GET_SCRAP, OP_DEBUG_STR, OP_INSTALL_DRIVERS, OP_NAME_REGISTRY, OP_RESET, OP_IRQ, OP_SCSI_DISPATCH, OP_SCSI_ATOMIC, - OP_NTRB_17_PATCH, OP_NTRB_17_PATCH2, OP_NTRB_17_PATCH3, OP_CHECKLOAD, + OP_NTRB_17_PATCH, OP_NTRB_17_PATCH2, OP_NTRB_17_PATCH3, OP_NTRB_17_PATCH4, OP_CHECKLOAD, OP_EXTFS_COMM, OP_EXTFS_HFS, OP_IDLE_TIME, OP_IDLE_TIME_2, OP_MAX }; @@ -99,6 +99,7 @@ const uint16 M68K_EMUL_OP_SCSI_ATOMIC = M68K_EMUL_BREAK + OP_SCSI_ATOMIC; const uint16 M68K_EMUL_OP_NTRB_17_PATCH = M68K_EMUL_BREAK + OP_NTRB_17_PATCH; const uint16 M68K_EMUL_OP_NTRB_17_PATCH2 = M68K_EMUL_BREAK + OP_NTRB_17_PATCH2; const uint16 M68K_EMUL_OP_NTRB_17_PATCH3 = M68K_EMUL_BREAK + OP_NTRB_17_PATCH3; +const uint16 M68K_EMUL_OP_NTRB_17_PATCH4 = M68K_EMUL_BREAK + OP_NTRB_17_PATCH4; const uint16 M68K_EMUL_OP_CHECKLOAD = M68K_EMUL_BREAK + OP_CHECKLOAD; const uint16 M68K_EMUL_OP_EXTFS_COMM = M68K_EMUL_BREAK + OP_EXTFS_COMM; const uint16 M68K_EMUL_OP_EXTFS_HFS = M68K_EMUL_BREAK + OP_EXTFS_HFS; diff --git a/SheepShaver/src/rsrc_patches.cpp b/SheepShaver/src/rsrc_patches.cpp index 9db36247..2d80fbd4 100644 --- a/SheepShaver/src/rsrc_patches.cpp +++ b/SheepShaver/src/rsrc_patches.cpp @@ -136,10 +136,15 @@ void CheckLoad(uint32 type, int16 id, uint16 *p, uint32 size) // Check when ntrb 17 is installed (for native Resource Manager patch) (7.6, 7.6.1, 8.0, 8.1) p[7] = htons(M68K_EMUL_OP_NTRB_17_PATCH); D(bug(" patch 3 applied\n")); - } else if (PM(0,0x3f2a) && PM(1,0x0006) && PM(2,0x3f2a) && PM(3,0x0002) && PM(4,0x61ff)) { + } else if (PM(0,0x3f2a) && PM(1,0x0006) && PM(2,0x3f2a) && PM(3,0x0002) && PM(4,0x61ff) && PM(8,0x245f)) { // Check when ntrb 17 is installed (for native Resource Manager patch) (8.5, 8.6) p[8] = htons(M68K_EMUL_OP_NTRB_17_PATCH); D(bug(" patch 4 applied\n")); + } else if (PM(0,0x3f2a) && PM(1,0x0006) && PM(2,0x3f2a) && PM(3,0x0002) && PM(4,0x61ff) && PM(7,0x301f)) { + // Check when ntrb 17 is installed (for native Resource Manager patch) (9.0) + p[7] = htons(M68K_EMUL_OP_NTRB_17_PATCH4); + p[8] = htons(ntohs(p[8]) & 0xf0ff); // bra + D(bug(" patch 8 applied\n")); } else if (PM(0,0x0c39) && PM(1,0x0001) && PM(2,0xf800) && PM(3,0x0008) && PM(4,0x6f00)) { // Don't read from 0xf8000008 (8.5 with Zanzibar ROM, 8.6) p[0] = htons(M68K_NOP); @@ -179,6 +184,20 @@ void CheckLoad(uint32 type, int16 id, uint16 *p, uint32 size) D(bug(" patch 1 applied\n")); } + } else if (type == FOURCC('p','t','c','h') && id == 156) { + D(bug("ptch 156 found\n")); + size >>= 1; + while (size--) { + if (PM(0,0x4e56) && PM(1,0xfffa) && PM(2,0x48e7) && PM(3,0x1f18) && PM(4,0x7800) && PM(5,0x267c) && PM(6,0x6900) && PM(7,0x0000)) { + // Don't call FE0A opcode (9.0) + p[0] = htons(0x7000); // moveq #0,d0 + p[1] = htons(M68K_RTS); + D(bug(" patch 1 applied\n")); + break; + } + p++; + } + } else if (type == FOURCC('p','t','c','h') && id == 420) { D(bug("ptch 420 found\n")); size >>= 1;