1 |
|
/* |
2 |
|
* rsrc_patches.cpp - Resource patches |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-1999 Christian Bauer |
4 |
> |
* Basilisk II (C) 1997-2000 Christian Bauer |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
22 |
|
|
23 |
|
#include "sysdeps.h" |
24 |
|
#include "cpu_emulation.h" |
25 |
+ |
#include "macos_util.h" |
26 |
|
#include "main.h" |
27 |
|
#include "emul_op.h" |
28 |
|
#include "audio.h" |
68 |
|
{ |
69 |
|
uint16 *p16; |
70 |
|
uint32 base; |
71 |
< |
D(bug("vCheckLoad %c%c%c%c (%08lx) ID %d, data %08lx, size %ld\n", (char)(type >> 24), (char)((type >> 16) & 0xff), (char )((type >> 8) & 0xff), (char )(type & 0xff), type, id, p, size)); |
71 |
> |
D(bug("vCheckLoad %c%c%c%c (%08x) ID %d, data %08x, size %d\n", (char)(type >> 24), (char)((type >> 16) & 0xff), (char )((type >> 8) & 0xff), (char )(type & 0xff), type, id, p, size)); |
72 |
|
|
73 |
< |
if (type == 'boot' && id == 3) { |
73 |
> |
if (type == FOURCC('b','o','o','t') && id == 3) { |
74 |
|
D(bug(" boot 3 found\n")); |
75 |
|
|
76 |
|
// Set boot stack pointer (7.5, 7.6, 7.6.1, 8.0) |
90 |
|
if (base) { |
91 |
|
p16 = (uint16 *)(p + base); |
92 |
|
|
93 |
< |
#if defined(AMIGA) |
93 |
> |
#if defined(AMIGA) || defined(__NetBSD__) |
94 |
|
// Set 0x0000 to scratch memory area |
95 |
|
extern uint32 ScratchMem; |
96 |
|
*p16++ = htons(0x207c); // move.l #ScratchMem,a0 |
105 |
|
D(bug(" patch 2 applied\n")); |
106 |
|
} |
107 |
|
|
108 |
< |
} else if (type == 'boot' && id == 2) { |
108 |
> |
} else if (type == FOURCC('b','o','o','t') && id == 2) { |
109 |
|
D(bug(" boot 2 found\n")); |
110 |
|
|
111 |
|
// Set fake handle at 0x0000 to some safe place (so broken Mac programs won't write into Mac ROM) (7.5, 8.0) |
114 |
|
if (base) { |
115 |
|
p16 = (uint16 *)(p + base); |
116 |
|
|
117 |
< |
#if defined(AMIGA) |
117 |
> |
#if defined(AMIGA) || defined(__NetBSD__) |
118 |
|
// Set 0x0000 to scratch memory area |
119 |
|
extern uint32 ScratchMem; |
120 |
|
*p16++ = htons(0x207c); // move.l #ScratchMem,a0 |
130 |
|
} |
131 |
|
#endif |
132 |
|
|
133 |
< |
} else if (type == 'PTCH' && id == 630) { |
133 |
> |
} else if (type == FOURCC('P','T','C','H') && id == 630) { |
134 |
|
D(bug("PTCH 630 found\n")); |
135 |
|
|
136 |
|
// Don't replace Time Manager (Classic ROM, 6.0.3) |
157 |
|
D(bug(" patch 1 applied\n")); |
158 |
|
} |
159 |
|
|
160 |
< |
} else if (type == 'ptch' && id == 26) { |
160 |
> |
} else if (type == FOURCC('p','t','c','h') && id == 26) { |
161 |
|
D(bug(" ptch 26 found\n")); |
162 |
|
|
163 |
|
// Trap ABC4 is initialized with absolute ROM address (7.5, 7.6, 7.6.1, 8.0) |
171 |
|
D(bug(" patch 1 applied\n")); |
172 |
|
} |
173 |
|
|
174 |
< |
} else if (type == 'ptch' && id == 34) { |
174 |
> |
} else if (type == FOURCC('p','t','c','h') && id == 34) { |
175 |
|
D(bug(" ptch 34 found\n")); |
176 |
|
|
177 |
|
// Don't wait for VIA (Classic ROM, 6.0.8) |
196 |
|
} |
197 |
|
|
198 |
|
#if !EMULATED_68K |
199 |
< |
} else if (CPUIs68060 && (type == 'gpch' && id == 669 || type == 'lpch' && id == 63)) { |
199 |
> |
} else if (CPUIs68060 && (type == FOURCC('g','p','c','h') && id == 669 || type == FOURCC('l','p','c','h') && id == 63)) { |
200 |
|
D(bug(" gpch 669/lpch 63 found\n")); |
201 |
|
|
202 |
|
static uint16 ThPatchSpace[1024]; // Replacement routines are constructed here |
455 |
|
} |
456 |
|
#endif |
457 |
|
|
458 |
< |
} else if (type == 'gpch' && id == 750) { |
458 |
> |
} else if (type == FOURCC('g','p','c','h') && id == 750) { |
459 |
|
D(bug(" gpch 750 found\n")); |
460 |
|
|
461 |
|
// Don't use PTEST instruction in BlockMove() (7.5, 7.6, 7.6.1, 8.0) |
468 |
|
D(bug(" patch 1 applied\n")); |
469 |
|
} |
470 |
|
|
471 |
< |
} else if (type == 'lpch' && id == 24) { |
471 |
> |
} else if (type == FOURCC('l','p','c','h') && id == 24) { |
472 |
|
D(bug(" lpch 24 found\n")); |
473 |
|
|
474 |
|
// Don't replace Time Manager (7.0.1, 7.1, 7.5, 7.6, 7.6.1, 8.0) |
485 |
|
D(bug(" patch 1 applied\n")); |
486 |
|
} |
487 |
|
|
488 |
< |
} else if (type == 'lpch' && id == 31) { |
488 |
> |
} else if (type == FOURCC('l','p','c','h') && id == 31) { |
489 |
|
D(bug(" lpch 31 found\n")); |
490 |
|
|
491 |
|
// Don't write to VIA in vSoundDead() (7.0.1, 7.1, 7.5, 7.6, 7.6.1, 8.0) |
511 |
|
} |
512 |
|
|
513 |
|
#if !EMULATED_68K |
514 |
< |
} else if (CPUIs68060 && type == 'scod' && (id == -16463 || id == -16464)) { |
514 |
> |
} else if (CPUIs68060 && type == FOURCC('s','c','o','d') && (id == -16463 || id == -16464)) { |
515 |
|
D(bug(" scod -16463/-16464 found\n")); |
516 |
|
|
517 |
|
// Correct 68060 FP frame handling in Process Manager task switches (7.1, 7.5, 8.0) |
539 |
|
} |
540 |
|
#endif |
541 |
|
|
542 |
< |
} else if (type == 'thng' && id == -16563) { |
542 |
> |
} else if (type == FOURCC('t','h','n','g') && id == -16563) { |
543 |
|
D(bug(" thng -16563 found\n")); |
544 |
|
|
545 |
|
// Set audio component flags (7.5, 7.6, 7.6.1, 8.0) |
546 |
|
*(uint32 *)(p + componentFlags) = htonl(audio_component_flags); |
547 |
|
D(bug(" patch 1 applied\n")); |
548 |
|
|
549 |
< |
} else if (type == 'sift' && id == -16563) { |
549 |
> |
} else if (type == FOURCC('s','i','f','t') && id == -16563) { |
550 |
|
D(bug(" sift -16563 found\n")); |
551 |
|
|
552 |
|
// Replace audio component (7.5, 7.6, 7.6.1, 8.0) |
563 |
|
FlushCodeCache(p, 32); |
564 |
|
D(bug(" patch 1 applied\n")); |
565 |
|
|
566 |
< |
} else if (type == 'inst' && id == -19069) { |
566 |
> |
} else if (type == FOURCC('i','n','s','t') && id == -19069) { |
567 |
|
D(bug(" inst -19069 found\n")); |
568 |
|
|
569 |
|
// Don't replace Microseconds (QuickTime 2.0) |
576 |
|
D(bug(" patch 1 applied\n")); |
577 |
|
} |
578 |
|
|
579 |
< |
} else if (type == 'DRVR' && id == -20066) { |
579 |
> |
} else if (type == FOURCC('D','R','V','R') && id == -20066) { |
580 |
|
D(bug("DRVR -20066 found\n")); |
581 |
|
|
582 |
|
// Don't access SCC in .Infra driver |
589 |
|
D(bug(" patch 1 applied\n")); |
590 |
|
} |
591 |
|
|
592 |
< |
} else if (type == 'ltlk' && id == 0) { |
592 |
> |
} else if (type == FOURCC('l','t','l','k') && id == 0) { |
593 |
|
D(bug(" ltlk 0 found\n")); |
594 |
|
|
595 |
|
// Disable LocalTalk (7.0.1, 7.5, 7.6, 7.6.1, 8.0) |