From 4c003007f50977ef661943fd8d29bb3961cff669 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Sun, 13 Jun 2021 12:29:23 -0400 Subject: [PATCH] bitbanger support for media. it still needs work to allow sockets and opt-out of disk image drag-and-drop. --- Ample/Media.h | 1 + Ample/Media.m | 3 +++ Ample/MediaViewController.m | 9 +++++++-- Ample/Slot.m | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Ample/Media.h b/Ample/Media.h index 1f87740..296e5a3 100644 --- a/Ample/Media.h +++ b/Ample/Media.h @@ -17,6 +17,7 @@ typedef struct Media { unsigned floppy_5_25; unsigned floppy_3_5; unsigned pseudo_disk; + unsigned bitbanger; } Media; struct Media MediaFromDictionary(NSDictionary *); diff --git a/Ample/Media.m b/Ample/Media.m index dcb1adf..612a562 100644 --- a/Ample/Media.m +++ b/Ample/Media.m @@ -22,6 +22,7 @@ struct Media MediaFromDictionary(NSDictionary *dict) { _(floppy_3_5); _(floppy_5_25); _(pseudo_disk); + _(bitbanger); return m; #undef _ @@ -38,6 +39,7 @@ void MediaAdd(Media *dest, const Media *src) { _(floppy_3_5); _(floppy_5_25); _(pseudo_disk); + _(bitbanger); #undef _ } @@ -53,6 +55,7 @@ BOOL MediaEqual(const Media *lhs, const Media *rhs) { _(floppy_3_5); _(floppy_5_25); _(pseudo_disk); + _(bitbanger); return YES; #undef _ } diff --git a/Ample/MediaViewController.m b/Ample/MediaViewController.m index d4649e6..c14fcc8 100644 --- a/Ample/MediaViewController.m +++ b/Ample/MediaViewController.m @@ -179,6 +179,8 @@ @implementation MediaItem + + -(instancetype)initWithURL: (NSURL *)url { [self setUrl: url]; return self; @@ -219,7 +221,7 @@ @end -#define CATEGORY_COUNT 6 +#define CATEGORY_COUNT 7 #define SIZEOF(x) (sizeof(x) / sizeof(x[0])) @interface MediaViewController () { @@ -242,6 +244,7 @@ enum { kIndexCDROM, kIndexCassette, kIndexDiskImage, + kIndexBitBanger, }; @@ -258,6 +261,7 @@ enum { _data[kIndexCDROM] = [MediaCategory categoryWithTitle: @"CD-ROMs"]; _data[kIndexCassette] = [MediaCategory categoryWithTitle: @"Cassettes"]; _data[kIndexDiskImage] = [MediaCategory categoryWithTitle: @"Hard Disk Images"]; // Mac Nubus psuedo image device + _data[kIndexBitBanger] = [MediaCategory categoryWithTitle: @"Serial Bit Banger"]; // null_modem _root = @[]; @@ -268,7 +272,7 @@ enum { -(void)rebuildArgs { static char* prefix[] = { - "flop", "flop", "hard", "cdrm", "cass", "disk" + "flop", "flop", "hard", "cdrm", "cass", "disk", "bitb", }; static_assert(SIZEOF(prefix) == CATEGORY_COUNT, "Missing item"); NSMutableArray *args = [NSMutableArray new]; @@ -337,6 +341,7 @@ x = media.name; cat = _data[index]; delta |= [cat setItemCount: x] _(floppy_3_5, kIndexFloppy35); _(floppy_5_25, kIndexFloppy525); _(pseudo_disk, kIndexDiskImage); + _(bitbanger, kIndexBitBanger); if (delta) { diff --git a/Ample/Slot.m b/Ample/Slot.m index 1d012b0..e0ad6f9 100644 --- a/Ample/Slot.m +++ b/Ample/Slot.m @@ -485,6 +485,7 @@ https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/KeyVa _(floppy_3_5); _(floppy_5_25); _(pseudo_disk); + _(bitbanger); #undef _ for (Slot *s in _children) {