43 |
|
uint32 PutScrapPatch; // Mac address of PutScrap() patch |
44 |
|
uint32 ROMBreakpoint = 0; // ROM offset of breakpoint (0 = disabled, 0x2310 = CritError) |
45 |
|
bool PrintROMInfo = false; // Flag: print ROM information in PatchROM() |
46 |
+ |
bool PatchHWBases = true; // Flag: patch hardware base addresses |
47 |
|
|
48 |
|
static uint32 sony_offset; // ROM offset of .Sony driver |
49 |
|
static uint32 serd_offset; // ROM offset of SERD resource (serial drivers) |
53 |
|
// Prototypes |
54 |
|
uint16 ROMVersion; |
55 |
|
|
55 |
– |
|
56 |
|
/* |
57 |
< |
* Convenience functions for retrieving a particular 16-bit word from |
58 |
< |
* a 32-bit word value. |
59 |
< |
* |
60 |
< |
* gb-- probably put those elsewhere... |
57 |
> |
* Macros used to extract one of the 16-bit words from a 32-bit word value |
58 |
|
*/ |
59 |
|
|
60 |
|
#define HiWord(X) (((X) >> 16) & 0xffff) |
1029 |
|
bp = ROMBaseHost + UniversalInfo + 18; // productKind |
1030 |
|
*bp = PrefsFindInt32("modelid"); |
1031 |
|
|
1032 |
+ |
#if !ROM_IS_WRITE_PROTECTED |
1033 |
+ |
#if defined(USE_SCRATCHMEM_SUBTERFUGE) |
1034 |
+ |
// Set hardware base addresses to scratch memory area |
1035 |
+ |
if (PatchHWBases) { |
1036 |
+ |
extern uint8 *ScratchMem; |
1037 |
+ |
const uint32 ScratchMemBase = Host2MacAddr(ScratchMem); |
1038 |
+ |
|
1039 |
+ |
D(bug("LMGlob\tOfs/4\tBase\n")); |
1040 |
+ |
base = ROMBaseMac + UniversalInfo + ReadMacInt32(ROMBaseMac + UniversalInfo); // decoderInfoPtr |
1041 |
+ |
wp = (uint16 *)(ROMBaseHost + 0x94a); |
1042 |
+ |
while (*wp != 0xffff) { |
1043 |
+ |
int16 ofs = ntohs(*wp++); // offset in decoderInfo (/4) |
1044 |
+ |
int16 lmg = ntohs(*wp++); // address of LowMem global |
1045 |
+ |
D(bug("0x%04x\t%d\t0x%08x\n", lmg, ofs, ReadMacInt32(base + ofs*4))); |
1046 |
+ |
|
1047 |
+ |
// Fake address only if this is not the ASC base |
1048 |
+ |
if (lmg != 0xcc0) |
1049 |
+ |
WriteMacInt32(base + ofs*4, ScratchMemBase); |
1050 |
+ |
} |
1051 |
+ |
} |
1052 |
+ |
#else |
1053 |
+ |
#error System specific handling for writable ROM is required here |
1054 |
+ |
#endif |
1055 |
+ |
#endif |
1056 |
+ |
|
1057 |
|
// Make FPU optional |
1058 |
|
if (FPUType == 0) { |
1059 |
|
bp = ROMBaseHost + UniversalInfo + 22; // defaultRSRCs |