📄 bltpatch.cpp
字号:
// Trap is 68K size = sizeof(RoutineDescriptor) + (sizeof(RoutineRecord) * 0); // allocate new descriptor newdesc = (RoutineDescriptorPtr) NewPtrSys(size); if (!newdesc) { return; } // set fields of routine decscriptor newdesc->goMixedModeTrap = _MixedModeMagic; newdesc->version = 7; newdesc->routineDescriptorFlags = 0; newdesc->reserved1 = 0; newdesc->reserved2 = 0; newdesc->selectorInfo = 0; newdesc->routineCount = 0; index = 0; gOriginal_PopupMenuSelect = originaldesc; newdesc->routineRecords[index].procInfo = upp_PopupMenuSelectProcInfo; newdesc->routineRecords[index].reserved1 = 0; newdesc->routineRecords[index].ISA = GetCurrentArchitecture(); newdesc->routineRecords[index].routineFlags = 4; newdesc->routineRecords[index].procDescriptor = (ProcPtr)my_PopupMenuSelectPatch; newdesc->routineRecords[index].reserved2 = 0; newdesc->routineRecords[index].selector = 0; } else { // Trap is PPC size = sizeof(RoutineDescriptor) + (sizeof(RoutineRecord) * originaldesc->routineCount); newdesc = (RoutineDescriptorPtr) NewPtrSys(size); if (!newdesc) { return; } BlockMoveData(originaldesc, newdesc, size); gOriginal_PopupMenuSelect = originaldesc; index = 0; newdesc->routineRecords[index].procDescriptor = (ProcPtr)my_PopupMenuSelectPatch; newdesc->routineRecords[index].ISA = GetCurrentArchitecture(); } NSetTrapAddress((UniversalProcPtr) newdesc, _PopUpMenuSelect, (_PopUpMenuSelect & 0x0800) ? ToolTrap : OSTrap); } originaldesc = NGetTrapAddress(_MoveWindow, (_MoveWindow & 0x0800) ? ToolTrap : OSTrap); if (originaldesc != unImplimentedTrapAddr) { if (originaldesc->goMixedModeTrap != _MixedModeMagic) { // Trap is 68K size = sizeof(RoutineDescriptor) + (sizeof(RoutineRecord) * 0); // allocate new descriptor newdesc = (RoutineDescriptorPtr) NewPtrSys(size); if (!newdesc) { return; } // set fields of routine decscriptor newdesc->goMixedModeTrap = _MixedModeMagic; newdesc->version = 7; newdesc->routineDescriptorFlags = 0; newdesc->reserved1 = 0; newdesc->reserved2 = 0; newdesc->selectorInfo = 0; newdesc->routineCount = 0; index = 0; gOriginal_MoveWindow = originaldesc; newdesc->routineRecords[index].procInfo = upp_MoveWindowProcInfo; newdesc->routineRecords[index].reserved1 = 0; newdesc->routineRecords[index].ISA = GetCurrentArchitecture(); newdesc->routineRecords[index].routineFlags = 4; newdesc->routineRecords[index].procDescriptor = (ProcPtr)my_MoveWindowPatch; newdesc->routineRecords[index].reserved2 = 0; newdesc->routineRecords[index].selector = 0; } else { // Trap is PPC size = sizeof(RoutineDescriptor) + (sizeof(RoutineRecord) * originaldesc->routineCount); newdesc = (RoutineDescriptorPtr) NewPtrSys(size); if (!newdesc) { return; } BlockMoveData(originaldesc, newdesc, size); gOriginal_MoveWindow = originaldesc; index = 0; newdesc->routineRecords[index].procDescriptor = (ProcPtr)my_MoveWindowPatch; newdesc->routineRecords[index].ISA = GetCurrentArchitecture(); } NSetTrapAddress((UniversalProcPtr) newdesc, _MoveWindow, (_MoveWindow & 0x0800) ? ToolTrap : OSTrap); } originaldesc = NGetTrapAddress(_WaitNextEvent, (_WaitNextEvent & 0x0800) ? ToolTrap : OSTrap); if (originaldesc != unImplimentedTrapAddr) { // yeesh, forcing it to 68K! Ouchie // Trap is 68K size = sizeof(RoutineDescriptor) + (sizeof(RoutineRecord) * 0); // allocate new descriptor newdesc = (RoutineDescriptorPtr) NewPtrSys(size); if (!newdesc) { return; } // set fields of routine decscriptor newdesc->goMixedModeTrap = _MixedModeMagic; newdesc->version = 7; newdesc->routineDescriptorFlags = 0; newdesc->reserved1 = 0; newdesc->reserved2 = 0; newdesc->selectorInfo = 0; newdesc->routineCount = 0; index = 0; gOriginal_WaitNextEvent = originaldesc; newdesc->routineRecords[index].procInfo = upp_WaitNextEventProcInfo; newdesc->routineRecords[index].reserved1 = 0; newdesc->routineRecords[index].ISA = GetCurrentArchitecture(); newdesc->routineRecords[index].routineFlags = 4; newdesc->routineRecords[index].procDescriptor = (ProcPtr)my_WaitNextEventPatch; newdesc->routineRecords[index].reserved2 = 0; newdesc->routineRecords[index].selector = 0; NSetTrapAddress((UniversalProcPtr) newdesc, _WaitNextEvent, (_WaitNextEvent & 0x0800) ? ToolTrap : OSTrap); } originaldesc = NGetTrapAddress(_CloseWindow, (_CloseWindow & 0x0800) ? ToolTrap : OSTrap); if (originaldesc != unImplimentedTrapAddr) { if (originaldesc->goMixedModeTrap != _MixedModeMagic) { // Trap is 68K size = sizeof(RoutineDescriptor) + (sizeof(RoutineRecord) * 0); // allocate new descriptor newdesc = (RoutineDescriptorPtr) NewPtrSys(size); if (!newdesc) { return; } // set fields of routine decscriptor newdesc->goMixedModeTrap = _MixedModeMagic; newdesc->version = 7; newdesc->routineDescriptorFlags = 0; newdesc->reserved1 = 0; newdesc->reserved2 = 0; newdesc->selectorInfo = 0; newdesc->routineCount = 0; index = 0; gOriginal_CloseWindow = originaldesc; newdesc->routineRecords[index].procInfo = upp_CloseWindowProcInfo; newdesc->routineRecords[index].reserved1 = 0; newdesc->routineRecords[index].ISA = GetCurrentArchitecture(); newdesc->routineRecords[index].routineFlags = 4; newdesc->routineRecords[index].procDescriptor = (ProcPtr)my_CloseWindowPatch; newdesc->routineRecords[index].reserved2 = 0; newdesc->routineRecords[index].selector = 0; } else { // Trap is PPC size = sizeof(RoutineDescriptor) + (sizeof(RoutineRecord) * originaldesc->routineCount); newdesc = (RoutineDescriptorPtr) NewPtrSys(size); if (!newdesc) { return; } BlockMoveData(originaldesc, newdesc, size); gOriginal_CloseWindow = originaldesc; index = 0; newdesc->routineRecords[index].procDescriptor = (ProcPtr)my_CloseWindowPatch; newdesc->routineRecords[index].ISA = GetCurrentArchitecture(); } NSetTrapAddress((UniversalProcPtr) newdesc, _CloseWindow, (_CloseWindow & 0x0800) ? ToolTrap : OSTrap); } originaldesc = NGetTrapAddress(_SelectWindow, (_SelectWindow & 0x0800) ? ToolTrap : OSTrap); if (originaldesc != unImplimentedTrapAddr) { if (originaldesc->goMixedModeTrap != _MixedModeMagic) { // Trap is 68K size = sizeof(RoutineDescriptor) + (sizeof(RoutineRecord) * 0); // allocate new descriptor newdesc = (RoutineDescriptorPtr) NewPtrSys(size); if (!newdesc) { return; } // set fields of routine decscriptor newdesc->goMixedModeTrap = _MixedModeMagic; newdesc->version = 7; newdesc->routineDescriptorFlags = 0; newdesc->reserved1 = 0; newdesc->reserved2 = 0; newdesc->selectorInfo = 0; newdesc->routineCount = 0; index = 0; gOriginal_SelectWindow = originaldesc; newdesc->routineRecords[index].procInfo = upp_SelectWindowProcInfo; newdesc->routineRecords[index].reserved1 = 0; newdesc->routineRecords[index].ISA = GetCurrentArchitecture(); newdesc->routineRecords[index].routineFlags = 4; newdesc->routineRecords[index].procDescriptor = (ProcPtr)my_SelectWindowPatch; newdesc->routineRecords[index].reserved2 = 0; newdesc->routineRecords[index].selector = 0; } else { // Trap is PPC size = sizeof(RoutineDescriptor) + (sizeof(RoutineRecord) * originaldesc->routineCount); newdesc = (RoutineDescriptorPtr) NewPtrSys(size); if (!newdesc) { return; } BlockMoveData(originaldesc, newdesc, size); gOriginal_SelectWindow = originaldesc; index = 0; newdesc->routineRecords[index].procDescriptor = (ProcPtr)my_SelectWindowPatch; newdesc->routineRecords[index].ISA = GetCurrentArchitecture(); } NSetTrapAddress((UniversalProcPtr) newdesc, _SelectWindow, (_SelectWindow & 0x0800) ? ToolTrap : OSTrap); } originaldesc = NGetTrapAddress(_PaintBehind, (_PaintBehind & 0x0800) ? ToolTrap : OSTrap); if (originaldesc != unImplimentedTrapAddr) { if (originaldesc->goMixedModeTrap != _MixedModeMagic) { // Trap is 68K size = sizeof(RoutineDescriptor) + (sizeof(RoutineRecord) * 0); // allocate new descriptor newdesc = (RoutineDescriptorPtr) NewPtrSys(size); if (!newdesc) { return; } // set fields of routine decscriptor newdesc->goMixedModeTrap = _MixedModeMagic; newdesc->version = 7; newdesc->routineDescriptorFlags = 0; newdesc->reserved1 = 0; newdesc->reserved2 = 0; newdesc->selectorInfo = 0; newdesc->routineCount = 0; index = 0; gOriginal_PaintBehind = originaldesc; newdesc->routineRecords[index].procInfo = upp_PaintBehindProcInfo; newdesc->routineRecords[index].reserved1 = 0; newdesc->routineRecords[index].ISA = GetCurrentArchitecture(); newdesc->routineRecords[index].routineFlags = 4; newdesc->routineRecords[index].procDescriptor = (ProcPtr)my_PaintBehindPatch; newdesc->routineRecords[index].reserved2 = 0; newdesc->routineRecords[index].selector = 0; } else { // Trap is PPC size = sizeof(RoutineDescriptor) + (sizeof(RoutineRecord) * originaldesc->routineCount); newdesc = (RoutineDescriptorPtr) NewPtrSys(size); if (!newdesc) { return; } BlockMoveData(originaldesc, newdesc, size); gOriginal_PaintBehind = originaldesc; index = 0; newdesc->routineRecords[index].procDescriptor = (ProcPtr)my_PaintBehindPatch; newdesc->routineRecords[index].ISA = GetCurrentArchitecture(); } NSetTrapAddress((UniversalProcPtr) newdesc, _PaintBehind, (_PaintBehind & 0x0800) ? ToolTrap : OSTrap); } originaldesc = NGetTrapAddress(_BringToFront, (_BringToFront & 0x0800) ? ToolTrap : OSTrap); if (originaldesc != unImplimentedTrapAddr) { if (originaldesc->goMixedModeTrap != _MixedModeMagic) { // Trap is 68K size = sizeof(RoutineDescriptor) + (sizeof(RoutineRecord) * 0); // allocate new descriptor newdesc = (RoutineDescriptorPtr) NewPtrSys(size); if (!newdesc) { return; } // set fields of routine decscriptor newdesc->goMixedModeTrap = _MixedModeMagic; newdesc->version = 7; newdesc->routineDescriptorFlags = 0; newdesc->reserved1 = 0; newdesc->reserved2 = 0; newdesc->selectorInfo = 0; newdesc->routineCount = 0; index = 0; gOriginal_BringToFront = originaldesc; newdesc->routineRecords[index].procInfo = upp_BringToFrontProcInfo; newdesc->routineRecords[index].reserved1 = 0; newdesc->routineRecords[index].ISA = GetCurrentArchitecture(); newdesc->routineRecords[index].routineFlags = 4; newdesc->routineRecords[index].procDescriptor = (ProcPtr)my_BringToFrontPatch; newdesc->routineRecords[index].reserved2 = 0; newdesc->routineRecords[index].selector = 0; } else { // Trap is PPC size = sizeof(RoutineDescriptor) + (sizeof(RoutineRecord) * originaldesc->routineCount); newdesc = (RoutineDescriptorPtr) NewPtrSys(size); if (!newdesc) { return; } BlockMoveData(originaldesc, newdesc, size); gOriginal_BringToFront = originaldesc; index = 0; newdesc->routineRecords[index].procDescriptor = (ProcPtr)my_BringToFrontPatch; newdesc->routineRecords[index].ISA = GetCurrentArchitecture(); } NSetTrapAddress((UniversalProcPtr) newdesc, _BringToFront, (_BringToFront & 0x0800) ? ToolTrap : OSTrap); } originaldesc = NGetTrapAddress(_SendBehind, (_SendBehind & 0x0800) ? ToolTrap : OSTrap); if (originaldesc != unImplimentedTrapAddr) { if (originaldesc->goMixedModeTrap != _MixedModeMagic) { // Trap is 68K size = sizeof(RoutineDescriptor) + (sizeof(RoutineRecord) * 0); // allocate new descriptor newdesc = (RoutineDescriptorPtr) NewPtrSys(size); if (!newdesc) { return; } // set fields of routine decscriptor newdesc->goMixedModeTrap = _MixedModeMagic; newdesc->version = 7; newdesc->routineDescriptorFlags = 0; newdesc->reserved1 = 0; newdesc->reserved2 = 0; newdesc->selectorInfo = 0; newdesc->routineCount = 0; index = 0; gOriginal_SendBehind = originaldesc; newdesc->routineRecords[index].procInfo = upp_SendBehindProcInfo; newdesc->routineRecords[index].reserved1 = 0; newdesc->routineRecords[index].ISA = GetCurrentArchitecture(); newdesc->routineRecords[index].routineFlags = 4; newdesc->routineRecords[index].procDescriptor = (ProcPtr)my_SendBehindPatch; newdesc->routineRecords[index].reserved2 = 0; newdesc->routineRecords[index].selector = 0; } else { // Trap is PPC size = sizeof(RoutineDescriptor) + (sizeof(RoutineRecord) * originaldesc->routineCount);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -