nulleric
/Fix-a-Fork
/amendments
/7
Learned cpt and dc6
eric made amendment 7 about 1 year ago
--- main.c Wed Nov 8 21:00:59 2023
+++ main.c Thu Nov 9 08:15:36 2023
@@ -88,7 +88,19 @@ OSErr openFile(unsigned char *fName, short fRefNum, sh
found = true;
else if(isSit15())
found = true;
+ else if(isCpt())
+ found = true;
+ // Checks @ 1024
+ if(!found)
+ {
+ SetFPos(fRefNum, fsFromStart, 1024);
+ FSRead(fRefNum, &count, gBuf);
+
+ if(isDsk_1024())
+ found = true;
+ }
+
if(found)
{
if(gCreator != 0 && gType != 0)
@@ -138,10 +150,30 @@ Boolean isSit15()
return magicCheck("SIT!", 0, 'SIT!', 'SIT!');
}
+// Disk Copy 6
+Boolean isDsk_1024()
+{
+ return magicCheck("BD", 0, 'DDim', 'ddsk');
+}
+
+// Very loose check, do last.
+Boolean isCpt()
+{
+ char magic[] = {0x01, 0x00};
+ return magicCheck(magic, 0, 'PACT', 'CPCT');
+}
+
+short strlen(const char *str)
+{
+ const char *s;
+ for (s = str; *s; ++s);
+ return (s-str);
+}
+
Boolean magicCheck(char *magic, short offset, OSType type, OSType creator)
{
short i;
- for(i = 0; i < sizeof(magic) - 1; i++)
+ for(i = 0; i < strlen(magic) - 1; i++)
if(gBuf[offset+i] != magic[i])
return false;
gType = type;
--- main.h Wed Nov 8 20:50:57 2023
+++ main.h Thu Nov 9 08:13:01 2023
@@ -20,4 +20,6 @@ pascal OSErr DoOpenDoc(AppleEvent *event, AppleEvent *
// checks
Boolean magicCheck(char *magic, short offset, OSType type, OSType creator);
Boolean isBinHex4();
-Boolean isSit15();
+Boolean isSit15();
+Boolean isCpt();
+Boolean isDsk_1024();