From c0087369f07b1539360fdc83dfdfaa5082febf53 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 4 Jun 2024 08:00:06 +1000 Subject: [PATCH] Try again with re-declaring system header functions --- src/Platform_MacClassic.c | 20 +++++++++++++++++++- src/Window_MacClassic.c | 34 +++++++++++++++++++++++++++++++--- 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/src/Platform_MacClassic.c b/src/Platform_MacClassic.c index 9f50212a4..0bfaf8ba6 100644 --- a/src/Platform_MacClassic.c +++ b/src/Platform_MacClassic.c @@ -33,8 +33,26 @@ cc_bool Platform_SingleProcess = true; /*########################################################################################################################* *---------------------------------------------------Imported headers------------------------------------------------------* *#########################################################################################################################*/ +// On 68k these are implemented using direct 68k opcodes +// On PPC these are implemented using function calls +#if TARGET_CPU_68K + #define MAC_SYSAPI(_type) static _type + #define MAC_ONEWORDINLINE(w1) = w1 + #define MAC_TWOWORDINLINE(w1,w2) = {w1, w2} + #define MAC_THREEWORDINLINE(w1,w2,w3) = {w1, w2, w3} + #define MAC_FOURWORDINLINE(w1,w2,w3,w4) = {w1, w2, w3, w4} +#else + #define MAC_SYSAPI(_type) extern pascal _type + #define MAC_ONEWORDINLINE(w1) + #define MAC_TWOWORDINLINE(w1,w2) + #define MAC_THREEWORDINLINE(w1,w2,w3) + #define MAC_FOURWORDINLINE(w1,w2,w3,w4) +#endif +typedef unsigned long MAC_FourCharCode; + +// ==================================== IMPORTS FROM TIMER.H ==================================== // Availability: in InterfaceLib 7.1 and later -static void Microseconds(UnsignedWide* microTickCount) FOURWORDINLINE(0xA193, 0x225F, 0x22C8, 0x2280); +MAC_SYSAPI(void) Microseconds(UnsignedWide* microTickCount) MAC_FOURWORDINLINE(0xA193, 0x225F, 0x22C8, 0x2280); /*########################################################################################################################* *---------------------------------------------------------Memory----------------------------------------------------------* diff --git a/src/Window_MacClassic.c b/src/Window_MacClassic.c index 01a4e208c..0e0444eb7 100644 --- a/src/Window_MacClassic.c +++ b/src/Window_MacClassic.c @@ -14,18 +14,46 @@ #include #include #include -#include static WindowPtr win; /*########################################################################################################################* *---------------------------------------------------Imported headers------------------------------------------------------* *#########################################################################################################################*/ +// On 68k these are implemented using direct 68k opcodes +// On PPC these are implemented using function calls +#if TARGET_CPU_68K + #define MAC_SYSAPI(_type) static _type + #define MAC_ONEWORDINLINE(w1) = w1 + #define MAC_TWOWORDINLINE(w1,w2) = {w1, w2} + #define MAC_THREEWORDINLINE(w1,w2,w3) = {w1, w2, w3} + #define MAC_FOURWORDINLINE(w1,w2,w3,w4) = {w1, w2, w3, w4} +#else + #define MAC_SYSAPI(_type) extern pascal _type + #define MAC_ONEWORDINLINE(w1) + #define MAC_TWOWORDINLINE(w1,w2) + #define MAC_THREEWORDINLINE(w1,w2,w3) + #define MAC_FOURWORDINLINE(w1,w2,w3,w4) +#endif +typedef unsigned long MAC_FourCharCode; + +// ==================================== IMPORTS FROM DISKINIT.H ==================================== +// Availability: in InterfaceLib 7.1 and later +MAC_SYSAPI(void) DILoad(void) MAC_THREEWORDINLINE(0x7002, 0x3F00, 0xA9E9); // Availability: in InterfaceLib 7.1 and later -static long GetScrap(Handle dst, FourCharCode type, SInt32* offset) ONEWORDINLINE(0xA9FD); +MAC_SYSAPI(void) DIUnload(void) MAC_THREEWORDINLINE(0x7004, 0x3F00, 0xA9E9); + // Availability: in InterfaceLib 7.1 and later -static OSStatus PutScrap(SInt32 srcLen, FourCharCode type, const void* src) ONEWORDINLINE(0xA9FE); +MAC_SYSAPI(short) DIBadMount(Point where, UInt32 evtMessage) MAC_THREEWORDINLINE(0x7000, 0x3F00, 0xA9E9); + + +// ==================================== IMPORTS FROM SCRAP.H ==================================== +// Availability: in InterfaceLib 7.1 and later +MAC_SYSAPI(long) GetScrap(Handle dst, MAC_FourCharCode type, SInt32* offset) MAC_ONEWORDINLINE(0xA9FD); + +// Availability: in InterfaceLib 7.1 and later +MAC_SYSAPI(OSStatus) PutScrap(SInt32 srcLen, MAC_FourCharCode type, const void* src) MAC_ONEWORDINLINE(0xA9FE); /*########################################################################################################################*