57
* Install SynchIdleTime() patch
60
static void patch_idle_time(uint8 *p, uint32 size, int n = 1)
62
if (!PrefsFindBool("idlewait"))
65
static const uint8 dat[] = {0x70, 0x03, 0xa0, 0x9f};
66
uint32 base = find_rsrc_data(p, size, dat, sizeof(dat));
68
uint8 *pbase = p + base - 0x80;
69
static const uint8 dat2[] = {0x20, 0x78, 0x02, 0xb6, 0x41, 0xe8, 0x00, 0x80};
70
base = find_rsrc_data(pbase, 0x80, dat2, sizeof(dat2));
72
uint16 *p16 = (uint16 *)(pbase + base);
73
*p16++ = htons(M68K_EMUL_OP_IDLE_TIME);
74
*p16 = htons(M68K_NOP);
75
FlushCodeCache(pbase + base, 4);
76
D(bug(" patch %d applied\n", n));
56
83
* Resource patches via vCheckLoad
204
231
D(bug(" patch 1 applied\n"));
234
// Patch SynchIdleTime()
235
patch_idle_time(p, size, 2);
207
237
} else if (type == FOURCC('l','p','c','h') && id == 24) {
208
238
D(bug(" lpch 24 found\n"));
246
276
D(bug(" patch 2 applied\n"));
279
// Patch SynchIdleTime()
280
patch_idle_time(p, size, 3);
249
282
} else if (type == FOURCC('t','h','n','g') && id == -16563) {
250
283
D(bug(" thng -16563 found\n"));
306
339
*p16 = htons(M68K_RTS);
307
340
FlushCodeCache(p, 6);
308
341
D(bug(" patch 1 applied\n"));
310
#if REAL_ADDRESSING && !defined(AMIGA)
311
else if (type == FOURCC('D','R','V','R') && id == 41) {
343
} else if (type == FOURCC('D','R','V','R') && id == 41) {
312
344
D(bug(" DRVR 41 found\n"));
314
// gb-- [0x28E (ROM85)] contains 0x3fff that will be placed into a0
315
// Seems to be caused by the AppleShare extension from MacOS 8.1 (3.7.4)
316
// .AFPTranslator (DRVR addr 0x2372)
346
// Don't access ROM85 as it it was a pointer to a ROM version number (8.0, 8.1)
317
347
static const uint8 dat[] = {0x3a, 0x2e, 0x00, 0x0a, 0x55, 0x4f, 0x3e, 0xb8, 0x02, 0x8e, 0x30, 0x1f, 0x48, 0xc0, 0x24, 0x40, 0x20, 0x40};
318
348
base = find_rsrc_data(p, size, dat, sizeof(dat));
320
350
p16 = (uint16 *)(p + base + 4);
321
*p16++ = htons(0x3078); // movea.w ROM85,%a0
351
*p16++ = htons(0x303c); // move.l #ROM85,%d0
322
352
*p16++ = htons(0x028e);
323
*p16++ = htons(0xd1fc); // adda.l #RAMBaseMac,%a0
324
*p16++ = htons((RAMBaseMac >> 16) & 0xffff);
325
*p16++ = htons(RAMBaseMac & 0xffff);
326
*p16++ = htons(0x2448); // movea.l %a0,%a2
327
*p16++ = htons(M68K_NOP);
328
FlushCodeCache(p + base + 4, 14);
353
*p16++ = htons(M68K_NOP);
354
*p16++ = htons(M68K_NOP);
355
FlushCodeCache(p + base + 4, 8);
329
356
D(bug(" patch 1 applied\n"));