From e5031597fd5ee6de236d5425e81fade9728b37b3 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Fri, 12 Mar 2021 15:21:59 +0000 Subject: [PATCH] Add missing definitions for Retro68. --- setter/src/macos/CMakeLists.txt | 6 ++ setter/src/macos/macos.h | 23 ++++-- setter/src/macos/retro68.h | 141 ++++++++++++++++++++++++++++++++ 3 files changed, 161 insertions(+), 9 deletions(-) create mode 100644 setter/src/macos/retro68.h diff --git a/setter/src/macos/CMakeLists.txt b/setter/src/macos/CMakeLists.txt index 1b9098c..40344a2 100644 --- a/setter/src/macos/CMakeLists.txt +++ b/setter/src/macos/CMakeLists.txt @@ -3,6 +3,7 @@ if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Retro68" AND NOT ${CMAKE_SYSTEM_NAME} MATCH endif() include(CheckIncludeFiles) +include(CheckSymbolExists) project( fssetter-macos @@ -15,6 +16,7 @@ add_definitions(-DRetro68) CHECK_INCLUDE_FILES("Aliases.h" HAVE_ALIASES_H) CHECK_INCLUDE_FILES("FileTypesAndCreators.h" HAVE_FILE_TYPES_AND_CREATORS_H) CHECK_INCLUDE_FILES("Multiverse.h" HAVE_MULTIVERSE_H) +CHECK_SYMBOL_EXISTS(PBXGetVolInfo Files.h HAVE_PBXGETVOLINFO) if(HAVE_ALIASES_H) add_definitions(-DHAVE_ALIASES_H) @@ -28,6 +30,10 @@ if(HAVE_MULTIVERSE_H) add_definitions(-DHAVE_MULTIVERSE_H) endif() +if(NOT HAVE_PBXGETVOLINFO) + add_definitions(-DNO_PBXGETVOLINFO) +endif() + set(PLATFORM_SOURCES attr.c deleted.c dirdepth.c filename.c files.c frag.c links.c os.c perms.c rsrcfork.c sparse.c time.c volume.c xattr.c macos.h macos.r) if(${CMAKE_SYSTEM_NAME} MATCHES "Retro68") diff --git a/setter/src/macos/macos.h b/setter/src/macos/macos.h index cc0c86b..5f2de65 100644 --- a/setter/src/macos/macos.h +++ b/setter/src/macos/macos.h @@ -34,15 +34,20 @@ Copyright (C) 2011-2021 Natalia Portillo #include -const char *noAttributeText = "This file has all flags bits clear.\r"; -const char *desktopText = "This file is on desktop.\r"; -const char *color2Text = "This file is colored brown.\r"; -const char *color4Text = "This file is colored green.\r"; -const char *color6Text = "This file is colored lilac.\r"; -const char *color8Text = "This file is colored blue.\r"; -const char *colorAText = "This file is colored magenta.\r"; -const char *colorCText = "This file is colored red.\r"; -const char *colorEText = "This file is colored orange.\r"; +// Things not included in Retro68 +#if defined(HAVE_MULTIVERSE_H) +#include "retro68.h" +#endif + +const char* noAttributeText = "This file has all flags bits clear.\r"; +const char* desktopText = "This file is on desktop.\r"; +const char* color2Text = "This file is colored brown.\r"; +const char* color4Text = "This file is colored green.\r"; +const char* color6Text = "This file is colored lilac.\r"; +const char* color8Text = "This file is colored blue.\r"; +const char* colorAText = "This file is colored magenta.\r"; +const char* colorCText = "This file is colored red.\r"; +const char* colorEText = "This file is colored orange.\r"; const char *requireSwitchText = "This file requires switch launch.\r"; const char *sharedText = "This file is shared.\r"; const char *noInitText = "This file contains no init.\r"; diff --git a/setter/src/macos/retro68.h b/setter/src/macos/retro68.h new file mode 100644 index 0000000..87de077 --- /dev/null +++ b/setter/src/macos/retro68.h @@ -0,0 +1,141 @@ +// +// Created by claunia on 12/3/21. +// + +#ifndef SETTER_SRC_MACOS_RETRO68_H_ +#define SETTER_SRC_MACOS_RETRO68_H_ + +enum +{ + fsRtParID = 1, + fsRtDirID = 2 +}; + +#define PBHGetVInfo(pb, async) ((async) ? PBHGetVInfoAsync(pb) : PBHGetVInfoSync(pb)) + +#define FOUR_CHAR_CODE(x) (x) + +/************** PC-DOS applications and FileTypes **************/ +enum +{ + ftGenericDocumentPC = FOUR_CHAR_CODE('TEXT'), /* word processor formats */ +}; + +/* Finder flags (finderFlags, fdFlags and frFlags) */ +/* Any flag reserved or not specified should be set to 0. */ +/* If a flag applies to a file, but not to a folder, make sure to check */ +/* that the item is not a folder by checking ((ParamBlockRec.ioFlAttrib & ioDirMask) == 0) */ +enum +{ + kIsOnDesk = 0x0001, /* Files and folders (System 6) */ + kColor = 0x000E, /* Files and folders */ + /* bit 0x0020 was kRequireSwitchLaunch, but is now reserved for future use*/ + kIsShared = 0x0040, /* Files only (Applications only) */ + /* If clear, the application needs to write to */ + /* its resource fork, and therefore cannot be */ + /* shared on a server */ + kHasNoINITs = 0x0080, /* Files only (Extensions/Control Panels only) */ + /* This file contains no INIT resource */ + kHasBeenInited = 0x0100, /* Files only */ + /* Clear if the file contains desktop database */ + /* resources ('BNDL', 'FREF', 'open', 'kind'...) */ + /* that have not been added yet. Set only by the Finder */ + /* Reserved for folders - make sure this bit is cleared for folders */ + /* bit 0x0200 was the letter bit for AOCE, but is now reserved for future use */ + kHasCustomIcon = 0x0400, /* Files and folders */ + kIsStationery = 0x0800, /* Files only */ + kNameLocked = 0x1000, /* Files and folders */ + kHasBundle = 0x2000, /* Files only */ + kIsInvisible = 0x4000, /* Files and folders */ + kIsAlias = 0x8000 /* Files only */ +}; + +typedef uint64_t UInt64; + +#if defined(NO_PBXGETVOLINFO) +#define PBXGetVolInfo(pb, async) ((async) ? PBXGetVolInfoAsync(pb) : PBXGetVolInfoSync(pb)) + +typedef UniversalProcPtr IOCompletionUPP; + +struct XVolumeParam +{ + QElemPtr qLink; + short qType; + short ioTrap; + Ptr ioCmdAddr; + IOCompletionUPP ioCompletion; + volatile OSErr ioResult; + StringPtr ioNamePtr; + short ioVRefNum; + unsigned long ioXVersion; /* this XVolumeParam version (0) */ + short ioVolIndex; + unsigned long ioVCrDate; + unsigned long ioVLsMod; + short ioVAtrb; + unsigned short ioVNmFls; + unsigned short ioVBitMap; + unsigned short ioAllocPtr; + unsigned short ioVNmAlBlks; + unsigned long ioVAlBlkSiz; + unsigned long ioVClpSiz; + unsigned short ioAlBlSt; + unsigned long ioVNxtCNID; + unsigned short ioVFrBlk; + unsigned short ioVSigWord; + short ioVDrvInfo; + short ioVDRefNum; + short ioVFSID; + unsigned long ioVBkUp; + short ioVSeqNum; + unsigned long ioVWrCnt; + unsigned long ioVFilCnt; + unsigned long ioVDirCnt; + long ioVFndrInfo[8]; + UInt64 ioVTotalBytes; /* total number of bytes on volume */ + UInt64 ioVFreeBytes; /* number of free bytes on volume */ +}; +typedef struct XVolumeParam XVolumeParam; +typedef XVolumeParam* XVolumeParamPtr; + +#if defined(TWOWORDINLINE) +EXTERN_API(OSErr) PBXGetVolInfoSync(XVolumeParamPtr paramBlock) TWOWORDINLINE(0x7012, 0xA060); +EXTERN_API(OSErr) PBXGetVolInfoAsync(XVolumeParamPtr paramBlock) TWOWORDINLINE(0x7012, 0xA460); +#elif defined(M68K_INLINE) +pascal OSErr PBXGetVolInfoSync(XVolumeParamPtr paramBlock) M68K_INLINE(0x7012, 0xA060); +pascal OSErr PBXGetVolInfoAsync(XVolumeParamPtr paramBlock) M68K_INLINE(0x7012, 0xA460); +#endif // TWOWORDINLINE + +#endif // NO_PBXGETVOLINFO + +enum +{ + gestaltAliasMgrPresent = 0, /* True if the Alias Mgr is present */ +}; + +enum +{ + gestaltHasHFSPlusAPIs = 12, /* file system supports HFS Plus APIs */ +}; + +enum +{ + gestaltFSSupports2TBVols = 5, /* file system supports 2 terabyte volumes */ +}; + +/*MemoryDispatch errors*/ +enum +{ + notEnoughMemoryErr = -620, /*insufficient physical memory*/ +}; + +enum +{ + ftPICTFile = FOUR_CHAR_CODE('PICT') +}; + +enum +{ + rAliasType = FOUR_CHAR_CODE('alis') /* Aliases are stored as resources of this type */ +}; + +#endif // SETTER_SRC_MACOS_RETRO68_H_