mirror of
https://github.com/holub/mame
synced 2025-06-07 13:23:50 +03:00
-heathzenith: Removed trivia file - content should be on wiki, etc.
-Fixed various warnings.
This commit is contained in:
parent
c4c5197e16
commit
5242675956
@ -807,7 +807,7 @@ void alto2_cpu_device::debug_write_mem(uint32_t addr, uint16_t data)
|
|||||||
*/
|
*/
|
||||||
void alto2_cpu_device::init_memory()
|
void alto2_cpu_device::init_memory()
|
||||||
{
|
{
|
||||||
memset(&m_mem, 0, sizeof(m_mem));
|
m_mem = decltype(m_mem)();
|
||||||
save_item(NAME(m_mem.mar));
|
save_item(NAME(m_mem.mar));
|
||||||
save_item(NAME(m_mem.rmdd));
|
save_item(NAME(m_mem.rmdd));
|
||||||
save_item(NAME(m_mem.wmdd));
|
save_item(NAME(m_mem.wmdd));
|
||||||
@ -826,23 +826,19 @@ void alto2_cpu_device::exit_memory()
|
|||||||
|
|
||||||
void alto2_cpu_device::reset_memory()
|
void alto2_cpu_device::reset_memory()
|
||||||
{
|
{
|
||||||
if (m_mem.ram) {
|
m_mem.ram.reset();
|
||||||
m_mem.ram = nullptr;
|
m_mem.hpb.reset();
|
||||||
}
|
|
||||||
if (m_mem.hpb) {
|
|
||||||
m_mem.hpb = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// allocate 64K or 128K words of main memory
|
// allocate 64K or 128K words of main memory
|
||||||
ioport_port* config = ioport(":CONFIG");
|
ioport_port *const config = ioport(":CONFIG");
|
||||||
m_mem.size = ALTO2_RAM_SIZE;
|
m_mem.size = ALTO2_RAM_SIZE;
|
||||||
// config should be valid, unless the driver doesn't define it
|
// config should be valid, unless the driver doesn't define it
|
||||||
if (config && 0 == config->read())
|
if (config && 0 == config->read())
|
||||||
m_mem.size *= 2;
|
m_mem.size *= 2;
|
||||||
logerror("Main memory %u KiB\n", static_cast<uint32_t>(sizeof(uint16_t) * m_mem.size / 1024));
|
logerror("Main memory %u KiB\n", sizeof(uint16_t) * m_mem.size / 1024);
|
||||||
|
|
||||||
m_mem.ram = make_unique_clear<uint32_t[]>(sizeof(uint16_t) * m_mem.size);
|
m_mem.ram = make_unique_clear<uint32_t []>(sizeof(uint16_t) * m_mem.size);
|
||||||
m_mem.hpb = make_unique_clear<uint8_t[]> (sizeof(uint16_t) * m_mem.size);
|
m_mem.hpb = make_unique_clear<uint8_t []> (sizeof(uint16_t) * m_mem.size);
|
||||||
|
|
||||||
// Initialize the hamming codes and parity bits
|
// Initialize the hamming codes and parity bits
|
||||||
for (uint32_t addr = 0; addr < m_mem.size; addr++)
|
for (uint32_t addr = 0; addr < m_mem.size; addr++)
|
||||||
|
@ -25,14 +25,14 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
uint32_t size; //!< main memory size (64K or 128K)
|
uint32_t size = 0; //!< main memory size (64K or 128K)
|
||||||
std::unique_ptr<uint32_t[]> ram; //!< main memory organized as double-words
|
std::unique_ptr<uint32_t []> ram; //!< main memory organized as double-words
|
||||||
std::unique_ptr<uint8_t[]> hpb; //!< Hamming Code bits (6) and Parity bits (1) per double word
|
std::unique_ptr<uint8_t []> hpb; //!< Hamming Code bits (6) and Parity bits (1) per double word
|
||||||
uint32_t mar; //!< memory address register
|
uint32_t mar = 0; //!< memory address register
|
||||||
uint32_t rmdd; //!< read memory data double-word
|
uint32_t rmdd = 0; //!< read memory data double-word
|
||||||
uint32_t wmdd; //!< write memory data double-word
|
uint32_t wmdd = 0; //!< write memory data double-word
|
||||||
uint32_t md; //!< memory data register
|
uint32_t md = 0; //!< memory data register
|
||||||
uint64_t cycle; //!< cycle when the memory address register was loaded
|
uint64_t cycle = 0; //!< cycle when the memory address register was loaded
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief memory access under the way if non-zero
|
* @brief memory access under the way if non-zero
|
||||||
@ -41,11 +41,11 @@ struct {
|
|||||||
* 2: memory access even word (MEM_RAM)
|
* 2: memory access even word (MEM_RAM)
|
||||||
* 3: memory access odd word (MEM_RAM | MEM_ODD)
|
* 3: memory access odd word (MEM_RAM | MEM_ODD)
|
||||||
*/
|
*/
|
||||||
int access;
|
int access = 0;
|
||||||
bool error; //!< non-zero after a memory error was detected
|
bool error = false; //!< non-zero after a memory error was detected
|
||||||
uint32_t mear; //!< memory error address register
|
uint32_t mear = 0; //!< memory error address register
|
||||||
uint32_t mesr; //!< memory error status register
|
uint32_t mesr = 0; //!< memory error status register
|
||||||
uint32_t mecr; //!< memory error control register
|
uint32_t mecr = 0; //!< memory error control register
|
||||||
} m_mem;
|
} m_mem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -585,11 +585,8 @@ void atom_state::atom_8271_interrupt_callback(int state)
|
|||||||
|
|
||||||
void atom_state::motor_w(int state)
|
void atom_state::motor_w(int state)
|
||||||
{
|
{
|
||||||
for (u8 i = 0; i < 2; i++)
|
for (auto &con : m_floppies)
|
||||||
{
|
{
|
||||||
char devname[8];
|
|
||||||
sprintf(devname, "%d", i);
|
|
||||||
floppy_connector *con = m_fdc->subdevice<floppy_connector>(devname);
|
|
||||||
if (con)
|
if (con)
|
||||||
con->get_device()->mon_w(!state);
|
con->get_device()->mon_w(!state);
|
||||||
}
|
}
|
||||||
@ -765,8 +762,8 @@ void atom_state::atom(machine_config &config)
|
|||||||
I8271(config, m_fdc, 4_MHz_XTAL / 2);
|
I8271(config, m_fdc, 4_MHz_XTAL / 2);
|
||||||
m_fdc->intrq_wr_callback().set(FUNC(atom_state::atom_8271_interrupt_callback));
|
m_fdc->intrq_wr_callback().set(FUNC(atom_state::atom_8271_interrupt_callback));
|
||||||
m_fdc->hdl_wr_callback().set(FUNC(atom_state::motor_w));
|
m_fdc->hdl_wr_callback().set(FUNC(atom_state::motor_w));
|
||||||
FLOPPY_CONNECTOR(config, I8271_TAG ":0", atom_floppies, "525sssd", atom_state::floppy_formats).enable_sound(true);
|
FLOPPY_CONNECTOR(config, m_floppies[0], atom_floppies, "525sssd", atom_state::floppy_formats).enable_sound(true);
|
||||||
FLOPPY_CONNECTOR(config, I8271_TAG ":1", atom_floppies, "525sssd", atom_state::floppy_formats).enable_sound(true);
|
FLOPPY_CONNECTOR(config, m_floppies[1], atom_floppies, "525sssd", atom_state::floppy_formats).enable_sound(true);
|
||||||
|
|
||||||
QUICKLOAD(config, "quickload", "atm", attotime::from_seconds(2)).set_load_callback(FUNC(atom_state::quickload_cb));
|
QUICKLOAD(config, "quickload", "atm", attotime::from_seconds(2)).set_load_callback(FUNC(atom_state::quickload_cb));
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ public:
|
|||||||
, m_vdg(*this, MC6847_TAG)
|
, m_vdg(*this, MC6847_TAG)
|
||||||
, m_cassette(*this, "cassette")
|
, m_cassette(*this, "cassette")
|
||||||
, m_fdc(*this, I8271_TAG)
|
, m_fdc(*this, I8271_TAG)
|
||||||
|
, m_floppies(*this, I8271_TAG ":%u", 0U)
|
||||||
, m_centronics(*this, CENTRONICS_TAG)
|
, m_centronics(*this, CENTRONICS_TAG)
|
||||||
, m_speaker(*this, "speaker")
|
, m_speaker(*this, "speaker")
|
||||||
, m_cart(*this, "cartslot")
|
, m_cart(*this, "cartslot")
|
||||||
@ -65,6 +66,7 @@ protected:
|
|||||||
required_device<mc6847_base_device> m_vdg;
|
required_device<mc6847_base_device> m_vdg;
|
||||||
required_device<cassette_image_device> m_cassette;
|
required_device<cassette_image_device> m_cassette;
|
||||||
optional_device<i8271_device> m_fdc;
|
optional_device<i8271_device> m_fdc;
|
||||||
|
optional_device_array<floppy_connector, 2> m_floppies;
|
||||||
required_device<centronics_device> m_centronics;
|
required_device<centronics_device> m_centronics;
|
||||||
required_device<speaker_sound_device> m_speaker;
|
required_device<speaker_sound_device> m_speaker;
|
||||||
optional_device<generic_slot_device> m_cart;
|
optional_device<generic_slot_device> m_cart;
|
||||||
|
@ -21,6 +21,7 @@ public:
|
|||||||
: driver_device(mconfig, type, tag)
|
: driver_device(mconfig, type, tag)
|
||||||
, m_maincpu(*this, "maincpu")
|
, m_maincpu(*this, "maincpu")
|
||||||
, m_fdc(*this, "fdc")
|
, m_fdc(*this, "fdc")
|
||||||
|
, m_floppies(*this, "fdc:%u", 0U)
|
||||||
, m_scsi(*this, "scsibus:7:ncr5380")
|
, m_scsi(*this, "scsibus:7:ncr5380")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -37,6 +38,7 @@ private:
|
|||||||
|
|
||||||
required_device<i80186_cpu_device> m_maincpu;
|
required_device<i80186_cpu_device> m_maincpu;
|
||||||
required_device<wd1772_device> m_fdc;
|
required_device<wd1772_device> m_fdc;
|
||||||
|
required_device_array<floppy_connector, 4> m_floppies;
|
||||||
required_device<ncr5380_device> m_scsi;
|
required_device<ncr5380_device> m_scsi;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -50,8 +52,6 @@ void lb186_state::drive_sel_w(uint8_t data)
|
|||||||
{
|
{
|
||||||
m_fdc->dden_w(BIT(data, 5));
|
m_fdc->dden_w(BIT(data, 5));
|
||||||
|
|
||||||
floppy_image_device *floppy;
|
|
||||||
char devname[8];
|
|
||||||
unsigned int drive = data & 0xf;
|
unsigned int drive = data & 0xf;
|
||||||
switch(drive)
|
switch(drive)
|
||||||
{
|
{
|
||||||
@ -74,8 +74,7 @@ void lb186_state::drive_sel_w(uint8_t data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(devname, "%d", drive);
|
floppy_image_device *const floppy = m_floppies[drive]->get_device();
|
||||||
floppy = m_fdc->subdevice<floppy_connector>(devname)->get_device();
|
|
||||||
m_fdc->set_floppy(floppy);
|
m_fdc->set_floppy(floppy);
|
||||||
floppy->ss_w(BIT(data, 4));
|
floppy->ss_w(BIT(data, 4));
|
||||||
}
|
}
|
||||||
@ -141,10 +140,10 @@ void lb186_state::lb186(machine_config &config)
|
|||||||
WD1772(config, m_fdc, 16_MHz_XTAL / 2);
|
WD1772(config, m_fdc, 16_MHz_XTAL / 2);
|
||||||
m_fdc->intrq_wr_callback().set(m_maincpu, FUNC(i80186_cpu_device::int2_w));
|
m_fdc->intrq_wr_callback().set(m_maincpu, FUNC(i80186_cpu_device::int2_w));
|
||||||
m_fdc->drq_wr_callback().set(m_maincpu, FUNC(i80186_cpu_device::drq0_w));
|
m_fdc->drq_wr_callback().set(m_maincpu, FUNC(i80186_cpu_device::drq0_w));
|
||||||
FLOPPY_CONNECTOR(config, "fdc:0", lb186_floppies, "525dd", lb186_state::floppy_formats);
|
FLOPPY_CONNECTOR(config, m_floppies[0], lb186_floppies, "525dd", lb186_state::floppy_formats);
|
||||||
FLOPPY_CONNECTOR(config, "fdc:1", lb186_floppies, nullptr, lb186_state::floppy_formats);
|
FLOPPY_CONNECTOR(config, m_floppies[1], lb186_floppies, nullptr, lb186_state::floppy_formats);
|
||||||
FLOPPY_CONNECTOR(config, "fdc:2", lb186_floppies, nullptr, lb186_state::floppy_formats);
|
FLOPPY_CONNECTOR(config, m_floppies[2], lb186_floppies, nullptr, lb186_state::floppy_formats);
|
||||||
FLOPPY_CONNECTOR(config, "fdc:3", lb186_floppies, nullptr, lb186_state::floppy_formats);
|
FLOPPY_CONNECTOR(config, m_floppies[3], lb186_floppies, nullptr, lb186_state::floppy_formats);
|
||||||
|
|
||||||
NSCSI_BUS(config, "scsibus");
|
NSCSI_BUS(config, "scsibus");
|
||||||
NSCSI_CONNECTOR(config, "scsibus:0", scsi_devices, "harddisk");
|
NSCSI_CONNECTOR(config, "scsibus:0", scsi_devices, "harddisk");
|
||||||
|
@ -1,53 +0,0 @@
|
|||||||
# Heath Company / Zenith Data Systems
|
|
||||||
|
|
||||||
## History
|
|
||||||
When Heath Company first developed their computers, Heath Company was owned by Schlumberger. In October 1979, Heath was sold to Zenith, which then created the [Zenith Data Systems](https://en.wikipedia.org/wiki/Zenith_Data_Systems) division for all the computer related products. The division was headquartered in the
|
|
||||||
Heath plant.
|
|
||||||
|
|
||||||
## Models
|
|
||||||
Prior to the Zenith purchase, Heath offered both kits and assembled products. For kits, model number starts an "H" and the assembled products started with "WH". The "W" was referred to as "Wired". After the acquisition, kit naming remained the same. The assembled products were rebranded as Zenith or ZDS (Zenith Data Systems) and model number starts with "Z". For example, prior to the acquisition, the models were H89 and WH89. After the acquisition, the models were H-89 and Z-89.
|
|
||||||
|
|
||||||
The systems were basically identical other than being either a kit or assembled. The combined company continued to make many of their new products available as both a kit and assembled.
|
|
||||||
|
|
||||||
### H8
|
|
||||||
An 8080 based system released in 1977 by Heath Company.
|
|
||||||
|
|
||||||
### H11 / H11A / WH11
|
|
||||||
A PDP-11 compatible system released by Heath Company in 1977. This system is not currently emulated in MAME.
|
|
||||||
|
|
||||||
### H/Z-89 Series (H88, H88A, H-89, H-89A, WH89, Z-89, Z-90)
|
|
||||||
A Z80-based computer introduced in 1979 by Heath Company. Shares same cabinet as the H-19 terminal.
|
|
||||||
|
|
||||||
#### Heath H89 add-on cards
|
|
||||||
##### H-88-3 Serial port
|
|
||||||
3 port serial card. Based on the 8250 UART.
|
|
||||||
|
|
||||||
##### H-88-1 (not currently implemented)
|
|
||||||
5.25" Hard-sectored disk controller. Connects with internal drives and external H-17, H-77, and Z-87 drives.
|
|
||||||
|
|
||||||
##### Z-89-37
|
|
||||||
5.25" Soft-sectored disk controller. Connects with internal drives and external H-17, H/Z-37 H-77, and Z-87 drives.
|
|
||||||
|
|
||||||
##### Z-89-47 (not currently implemented)
|
|
||||||
8" Interface card for the H/Z-47 and REMEX Floppy drives.
|
|
||||||
|
|
||||||
##### Z-89-67 (not currently implemented)
|
|
||||||
Interface card for the Z-67 - SASI 10M Winchester Drive & 8" Floppy.
|
|
||||||
|
|
||||||
#### H88 / H88A
|
|
||||||
The H88 came standard with a cassette interface board, and supported adding a H-88-1 hard-sectored controller. It came with the MTR-88 ROM. ROM/System could be upgraded to support MTR-89 or MTR-90 and their supported cards.
|
|
||||||
|
|
||||||
#### H89 / H89A / WH89 / Z-89
|
|
||||||
These systems came with the MTR-89 ROM. It came with the H-88-1 hard-sectored controller. It also supported the Z-89-47 interface card. ROM/System could be upgraded to support MTR-90 and their supported cards.
|
|
||||||
|
|
||||||
#### Z-90
|
|
||||||
The Z-90 came standard with the Z-89-37 soft-sectored controller. It has the MTR-90 ROM. Supported all of Heath's disk drive add-on cards: H-88-1, Z-89-37, Z-89-47, and Z-89-67, although at most only 2 could be installed at the same time.
|
|
||||||
|
|
||||||
### H19 (Z-19)
|
|
||||||
A Z80-based terminal introduced in 1979 by Heath Company.
|
|
||||||
|
|
||||||
### H22
|
|
||||||
A 6512-based terminal.
|
|
||||||
|
|
||||||
### H/Z-100 Series
|
|
||||||
A dual processor (8088 and 8085) computer. It could run 8-bit and 16-bit software.
|
|
@ -432,15 +432,15 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
|
|||||||
NSRange const run = NSMakeRange(0, [text length]);
|
NSRange const run = NSMakeRange(0, [text length]);
|
||||||
[text addAttribute:NSFontAttributeName value:font range:run];
|
[text addAttribute:NSFontAttributeName value:font range:run];
|
||||||
NSPasteboard *const board = [NSPasteboard generalPasteboard];
|
NSPasteboard *const board = [NSPasteboard generalPasteboard];
|
||||||
[board declareTypes:[NSArray arrayWithObject:NSRTFPboardType] owner:nil];
|
[board declareTypes:[NSArray arrayWithObject:NSPasteboardTypeRTF] owner:nil];
|
||||||
[board setData:[text RTFFromRange:run documentAttributes:[NSDictionary dictionary]] forType:NSRTFPboardType];
|
[board setData:[text RTFFromRange:run documentAttributes:[NSDictionary dictionary]] forType:NSPasteboardTypeRTF];
|
||||||
[text deleteCharactersInRange:run];
|
[text deleteCharactersInRange:run];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (IBAction)paste:(id)sender {
|
- (IBAction)paste:(id)sender {
|
||||||
NSPasteboard *const board = [NSPasteboard generalPasteboard];
|
NSPasteboard *const board = [NSPasteboard generalPasteboard];
|
||||||
NSString *const avail = [board availableTypeFromArray:[NSArray arrayWithObject:NSStringPboardType]];
|
NSString *const avail = [board availableTypeFromArray:[NSArray arrayWithObject:NSPasteboardTypeString]];
|
||||||
if (avail == nil)
|
if (avail == nil)
|
||||||
{
|
{
|
||||||
NSBeep();
|
NSBeep();
|
||||||
@ -921,7 +921,7 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
|
|||||||
if (action == @selector(paste:))
|
if (action == @selector(paste:))
|
||||||
{
|
{
|
||||||
NSPasteboard *const board = [NSPasteboard generalPasteboard];
|
NSPasteboard *const board = [NSPasteboard generalPasteboard];
|
||||||
return [board availableTypeFromArray:[NSArray arrayWithObject:NSStringPboardType]] != nil;
|
return [board availableTypeFromArray:[NSArray arrayWithObject:NSPasteboardTypeString]] != nil;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -88,15 +88,14 @@ private:
|
|||||||
netdev_tap::netdev_tap(const char *name, network_handler &ifdev)
|
netdev_tap::netdev_tap(const char *name, network_handler &ifdev)
|
||||||
: osd_network_device(ifdev)
|
: osd_network_device(ifdev)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#if defined(__linux__)
|
||||||
struct ifreq ifr;
|
|
||||||
|
|
||||||
m_fd = -1;
|
m_fd = -1;
|
||||||
if((m_fd = open("/dev/net/tun", O_RDWR)) == -1) {
|
if((m_fd = open("/dev/net/tun", O_RDWR)) == -1) {
|
||||||
osd_printf_verbose("tap: open failed %d\n", errno);
|
osd_printf_verbose("tap: open failed %d\n", errno);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct ifreq ifr;
|
||||||
memset(&ifr, 0, sizeof(ifr));
|
memset(&ifr, 0, sizeof(ifr));
|
||||||
ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
|
ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
|
||||||
sprintf(ifr.ifr_name, "tap-mess-%d-0", getuid());
|
sprintf(ifr.ifr_name, "tap-mess-%d-0", getuid());
|
||||||
|
@ -902,31 +902,78 @@ CFPropertyListRef sound_coreaudio::load_property_list(char const *name) const
|
|||||||
(UInt8 const *)name,
|
(UInt8 const *)name,
|
||||||
strlen(name),
|
strlen(name),
|
||||||
false);
|
false);
|
||||||
if (nullptr == url)
|
if (!url)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
CFNumberRef size_prop = nullptr;
|
||||||
|
if (!CFURLCopyResourcePropertyForKey(url, kCFURLFileSizeKey, &size_prop, nullptr))
|
||||||
{
|
{
|
||||||
|
CFRelease(url);
|
||||||
|
osd_printf_error("Error getting size of file %s\n", name);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CFDataRef data = nullptr;
|
CFIndex size = 0;
|
||||||
SInt32 err;
|
Boolean const status = CFNumberGetValue(size_prop, kCFNumberCFIndexType, &size);
|
||||||
Boolean const status = CFURLCreateDataAndPropertiesFromResource(
|
CFRelease(size_prop);
|
||||||
nullptr,
|
|
||||||
url,
|
|
||||||
&data,
|
|
||||||
nullptr,
|
|
||||||
nullptr,
|
|
||||||
&err);
|
|
||||||
CFRelease(url);
|
|
||||||
if (!status)
|
if (!status)
|
||||||
{
|
{
|
||||||
osd_printf_error(
|
CFRelease(url);
|
||||||
"Error reading data from %s (%ld)\n",
|
osd_printf_error("Error getting size of file %s\n", name);
|
||||||
name,
|
|
||||||
(long)err);
|
|
||||||
if (nullptr != data) CFRelease(data);
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CFReadStreamRef const stream = CFReadStreamCreateWithFile(nullptr, url);
|
||||||
|
CFRelease(url);
|
||||||
|
if (!stream)
|
||||||
|
{
|
||||||
|
osd_printf_error("Error opening file %s\n", name);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
if (!CFReadStreamOpen(stream))
|
||||||
|
{
|
||||||
|
CFRelease(stream);
|
||||||
|
osd_printf_error("Error opening file %s\n", name);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
CFMutableDataRef const data = CFDataCreateMutable(nullptr, size);
|
||||||
|
if (!data)
|
||||||
|
{
|
||||||
|
CFRelease(stream);
|
||||||
|
osd_printf_error("Error allocating data to read %s\n", name);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
CFDataSetLength(data, size);
|
||||||
|
UInt8 *const bytes = CFDataGetMutableBytePtr(data);
|
||||||
|
|
||||||
|
for (CFIndex read = 0; size > read; )
|
||||||
|
{
|
||||||
|
CFIndex const chunk = CFReadStreamRead(stream, bytes + read, size - read);
|
||||||
|
if (0 >= chunk)
|
||||||
|
{
|
||||||
|
CFReadStreamClose(stream);
|
||||||
|
CFRelease(stream);
|
||||||
|
CFRelease(data);
|
||||||
|
if (0 > chunk)
|
||||||
|
{
|
||||||
|
osd_printf_error("Error reading file %s\n", name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
osd_printf_error(
|
||||||
|
"Expected %d bytes but got %d when reading file %s\n",
|
||||||
|
size,
|
||||||
|
read,
|
||||||
|
name);
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
read += chunk;
|
||||||
|
}
|
||||||
|
CFReadStreamClose(stream);
|
||||||
|
CFRelease(stream);
|
||||||
|
|
||||||
CFErrorRef msg = nullptr;
|
CFErrorRef msg = nullptr;
|
||||||
CFPropertyListRef const result = CFPropertyListCreateWithData(
|
CFPropertyListRef const result = CFPropertyListCreateWithData(
|
||||||
nullptr,
|
nullptr,
|
||||||
@ -935,10 +982,13 @@ CFPropertyListRef sound_coreaudio::load_property_list(char const *name) const
|
|||||||
nullptr,
|
nullptr,
|
||||||
&msg);
|
&msg);
|
||||||
CFRelease(data);
|
CFRelease(data);
|
||||||
if ((nullptr == result) || (nullptr != msg))
|
if (!result || msg)
|
||||||
{
|
{
|
||||||
std::unique_ptr<char []> const buf = (nullptr != msg) ? convert_cfstring_to_utf8(CFErrorCopyDescription(msg)) : nullptr;
|
CFStringRef const desc = msg ? CFErrorCopyDescription(msg) : nullptr;
|
||||||
if (nullptr != msg)
|
std::unique_ptr<char []> const buf = desc ? convert_cfstring_to_utf8(desc) : nullptr;
|
||||||
|
if (desc)
|
||||||
|
CFRelease(desc);
|
||||||
|
if (msg)
|
||||||
CFRelease(msg);
|
CFRelease(msg);
|
||||||
|
|
||||||
if (buf)
|
if (buf)
|
||||||
@ -954,7 +1004,8 @@ CFPropertyListRef sound_coreaudio::load_property_list(char const *name) const
|
|||||||
"Error creating property list from %s\n",
|
"Error creating property list from %s\n",
|
||||||
name);
|
name);
|
||||||
}
|
}
|
||||||
if (nullptr != result) CFRelease(result);
|
if (result)
|
||||||
|
CFRelease(result);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,29 +16,12 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
|
|
||||||
#ifdef MAC_OS_X_VERSION_MAX_ALLOWED
|
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
|
|
||||||
|
|
||||||
typedef ComponentDescription AudioComponentDescription;
|
|
||||||
|
|
||||||
@protocol NSApplicationDelegate <NSObject>
|
|
||||||
@end
|
|
||||||
|
|
||||||
@protocol NSWindowDelegate <NSObject>
|
|
||||||
@end
|
|
||||||
|
|
||||||
#endif // MAC_OS_X_VERSION_MAX_ALLOWED < 1060
|
|
||||||
|
|
||||||
#endif // MAC_OS_X_VERSION_MAX_ALLOWED
|
|
||||||
|
|
||||||
|
|
||||||
struct EffectInfo
|
struct EffectInfo
|
||||||
{
|
{
|
||||||
Component component;
|
AudioComponent component;
|
||||||
OSType type;
|
OSType type;
|
||||||
OSType subtype;
|
OSType subtype;
|
||||||
OSType manufacturer;
|
OSType manufacturer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -173,7 +156,7 @@ static void UpdateChangeCountCallback(
|
|||||||
if (!customViewValid)
|
if (!customViewValid)
|
||||||
{
|
{
|
||||||
forceGenericView = YES;
|
forceGenericView = YES;
|
||||||
[genericViewButton setState:NSOnState];
|
[genericViewButton setState:NSControlStateValueOn];
|
||||||
}
|
}
|
||||||
|
|
||||||
CFIndex const presetCount = (NULL != presets) ? CFArrayGetCount(presets) : 0;
|
CFIndex const presetCount = (NULL != presets) ? CFArrayGetCount(presets) : 0;
|
||||||
@ -256,11 +239,11 @@ static void UpdateChangeCountCallback(
|
|||||||
- (void)makeWindowControllers {
|
- (void)makeWindowControllers {
|
||||||
genericViewButton = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 100, 18)];
|
genericViewButton = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 100, 18)];
|
||||||
[genericViewButton setAutoresizingMask:NSViewNotSizable];
|
[genericViewButton setAutoresizingMask:NSViewNotSizable];
|
||||||
[[genericViewButton cell] setControlSize:NSSmallControlSize];
|
[[genericViewButton cell] setControlSize:NSControlSizeSmall];
|
||||||
[genericViewButton setButtonType:NSSwitchButton];
|
[genericViewButton setButtonType:NSButtonTypeSwitch];
|
||||||
[genericViewButton setBordered:NO];
|
[genericViewButton setBordered:NO];
|
||||||
[genericViewButton setAllowsMixedState:NO];
|
[genericViewButton setAllowsMixedState:NO];
|
||||||
[genericViewButton setState:(forceGenericView ? NSOnState : NSOffState)];
|
[genericViewButton setState:(forceGenericView ? NSControlStateValueOn : NSControlStateValueOff)];
|
||||||
[genericViewButton setTitle:@"Use generic editor view"];
|
[genericViewButton setTitle:@"Use generic editor view"];
|
||||||
[genericViewButton setAction:@selector(toggleGenericView:)];
|
[genericViewButton setAction:@selector(toggleGenericView:)];
|
||||||
[genericViewButton setTarget:self];
|
[genericViewButton setTarget:self];
|
||||||
@ -268,8 +251,8 @@ static void UpdateChangeCountCallback(
|
|||||||
|
|
||||||
presetButton = [[NSPopUpButton alloc] initWithFrame:NSMakeRect(0, 0, 100, 22) pullsDown:YES];
|
presetButton = [[NSPopUpButton alloc] initWithFrame:NSMakeRect(0, 0, 100, 22) pullsDown:YES];
|
||||||
[presetButton setAutoresizingMask:NSViewNotSizable];
|
[presetButton setAutoresizingMask:NSViewNotSizable];
|
||||||
[[presetButton cell] setControlSize:NSSmallControlSize];
|
[[presetButton cell] setControlSize:NSControlSizeSmall];
|
||||||
[[presetButton cell] setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]]];
|
[[presetButton cell] setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSControlSizeSmall]]];
|
||||||
[presetButton setTitle:@"Load preset"];
|
[presetButton setTitle:@"Load preset"];
|
||||||
[[[presetButton menu] addItemWithTitle:@"Load preset" action:NULL keyEquivalent:@""] setHidden:YES];
|
[[[presetButton menu] addItemWithTitle:@"Load preset" action:NULL keyEquivalent:@""] setHidden:YES];
|
||||||
[presetButton sizeToFit];
|
[presetButton sizeToFit];
|
||||||
@ -297,9 +280,9 @@ static void UpdateChangeCountCallback(
|
|||||||
[presetButton release];
|
[presetButton release];
|
||||||
|
|
||||||
window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, headerSize.width, headerSize.height)
|
window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, headerSize.width, headerSize.height)
|
||||||
styleMask:(NSTitledWindowMask |
|
styleMask:(NSWindowStyleMaskTitled |
|
||||||
NSClosableWindowMask |
|
NSWindowStyleMaskClosable |
|
||||||
NSMiniaturizableWindowMask)
|
NSWindowStyleMaskMiniaturizable)
|
||||||
backing:NSBackingStoreBuffered
|
backing:NSBackingStoreBuffered
|
||||||
defer:YES];
|
defer:YES];
|
||||||
[window setReleasedWhenClosed:NO];
|
[window setReleasedWhenClosed:NO];
|
||||||
@ -346,22 +329,20 @@ static void UpdateChangeCountCallback(
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString *errDesc = nil;
|
NSError *errDesc = nil;
|
||||||
id const desc = [NSPropertyListSerialization propertyListFromData:data
|
id const desc = [NSPropertyListSerialization propertyListWithData:data
|
||||||
mutabilityOption:0
|
options:NSPropertyListImmutable
|
||||||
format:NULL
|
format:NULL
|
||||||
errorDescription:&errDesc];
|
error:&errDesc];
|
||||||
if (!desc || ![desc isKindOfClass:[NSDictionary class]] || errDesc)
|
if (!desc || ![desc isKindOfClass:[NSDictionary class]] || errDesc)
|
||||||
{
|
{
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
NSString *const message = [NSString stringWithFormat:@"Error in file format (%@)", errDesc];
|
NSString *const message = [NSString stringWithFormat:@"Error in file format (%@)", [errDesc localizedDescription]];
|
||||||
NSDictionary *const info = [NSDictionary dictionaryWithObjectsAndKeys:message, NSLocalizedDescriptionKey,
|
NSDictionary *const info = [NSDictionary dictionaryWithObjectsAndKeys:message, NSLocalizedDescriptionKey,
|
||||||
nil];
|
nil];
|
||||||
*error = [NSError errorWithDomain:AUEffectUtilErrorDomain code:0 userInfo:info];
|
*error = [NSError errorWithDomain:AUEffectUtilErrorDomain code:0 userInfo:info];
|
||||||
}
|
}
|
||||||
if (errDesc)
|
|
||||||
[errDesc release];
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -579,7 +560,7 @@ static void UpdateChangeCountCallback(
|
|||||||
&& [[desc objectForKey:ForceGenericViewKey] respondsToSelector:@selector(boolValue)])
|
&& [[desc objectForKey:ForceGenericViewKey] respondsToSelector:@selector(boolValue)])
|
||||||
{
|
{
|
||||||
forceGenericView = [[desc objectForKey:ForceGenericViewKey] boolValue];
|
forceGenericView = [[desc objectForKey:ForceGenericViewKey] boolValue];
|
||||||
[genericViewButton setState:(forceGenericView ? NSOnState : NSOffState)];
|
[genericViewButton setState:(forceGenericView ? NSControlStateValueOn : NSControlStateValueOff)];
|
||||||
}
|
}
|
||||||
if ([desc objectForKey:WindowFrameKey]
|
if ([desc objectForKey:WindowFrameKey]
|
||||||
&& [[desc objectForKey:WindowFrameKey] isKindOfClass:[NSString class]])
|
&& [[desc objectForKey:WindowFrameKey] isKindOfClass:[NSString class]])
|
||||||
@ -672,7 +653,7 @@ static void UpdateChangeCountCallback(
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)toggleGenericView:(id)sender {
|
- (IBAction)toggleGenericView:(id)sender {
|
||||||
forceGenericView = (NSOnState == [sender state]);
|
forceGenericView = (NSControlStateValueOn == [sender state]);
|
||||||
if (view)
|
if (view)
|
||||||
{
|
{
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self
|
[[NSNotificationCenter defaultCenter] removeObserver:self
|
||||||
@ -793,7 +774,7 @@ static void UpdateChangeCountCallback(
|
|||||||
|
|
||||||
item = [menu addItemWithTitle:[NSString stringWithFormat:@"Hide %@", appName] action:@selector(hide:) keyEquivalent:@"h"];
|
item = [menu addItemWithTitle:[NSString stringWithFormat:@"Hide %@", appName] action:@selector(hide:) keyEquivalent:@"h"];
|
||||||
item = [menu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
|
item = [menu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
|
||||||
[item setKeyEquivalentModifierMask:NSCommandKeyMask | NSAlternateKeyMask];
|
[item setKeyEquivalentModifierMask:NSEventModifierFlagCommand | NSEventModifierFlagOption];
|
||||||
item = [menu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
|
item = [menu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
|
||||||
|
|
||||||
[menu addItem:[NSMenuItem separatorItem]];
|
[menu addItem:[NSMenuItem separatorItem]];
|
||||||
@ -895,7 +876,7 @@ static void UpdateChangeCountCallback(
|
|||||||
if ((0 > index) || (0 == effects[index].component))
|
if ((0 > index) || (0 == effects[index].component))
|
||||||
{
|
{
|
||||||
NSAlert *const alert = [[NSAlert alloc] init];
|
NSAlert *const alert = [[NSAlert alloc] init];
|
||||||
[alert setAlertStyle:NSWarningAlertStyle];
|
[alert setAlertStyle:NSAlertStyleWarning];
|
||||||
[alert setMessageText:@"Invalid effect component"];
|
[alert setMessageText:@"Invalid effect component"];
|
||||||
[alert addButtonWithTitle:@"OK"];
|
[alert addButtonWithTitle:@"OK"];
|
||||||
[alert runModal];
|
[alert runModal];
|
||||||
@ -917,7 +898,7 @@ static void UpdateChangeCountCallback(
|
|||||||
if (!data || errDesc)
|
if (!data || errDesc)
|
||||||
{
|
{
|
||||||
NSAlert *const alert = [[NSAlert alloc] init];
|
NSAlert *const alert = [[NSAlert alloc] init];
|
||||||
[alert setAlertStyle:NSWarningAlertStyle];
|
[alert setAlertStyle:NSAlertStyleWarning];
|
||||||
[alert setMessageText:@"Error serialising properties for new effect"];
|
[alert setMessageText:@"Error serialising properties for new effect"];
|
||||||
if (errDesc)
|
if (errDesc)
|
||||||
[alert setInformativeText:[errDesc autorelease]];
|
[alert setInformativeText:[errDesc autorelease]];
|
||||||
@ -939,7 +920,7 @@ static void UpdateChangeCountCallback(
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
NSAlert *const alert = [[NSAlert alloc] init];
|
NSAlert *const alert = [[NSAlert alloc] init];
|
||||||
[alert setAlertStyle:NSWarningAlertStyle];
|
[alert setAlertStyle:NSAlertStyleWarning];
|
||||||
[alert setMessageText:@"Error creating new effect document"];
|
[alert setMessageText:@"Error creating new effect document"];
|
||||||
[alert addButtonWithTitle:@"OK"];
|
[alert addButtonWithTitle:@"OK"];
|
||||||
[alert runModal];
|
[alert runModal];
|
||||||
@ -978,38 +959,35 @@ static void UpdateChangeCountCallback(
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationDidFinishLaunching:(NSNotification *)notification {
|
- (void)applicationDidFinishLaunching:(NSNotification *)notification {
|
||||||
ComponentDescription effectFilter = { kAudioUnitType_Effect, 0, 0, 0, 0 };
|
AudioComponentDescription effectFilter = { kAudioUnitType_Effect, 0, 0, 0, 0 };
|
||||||
long const count = CountComponents(&effectFilter);
|
long const count = AudioComponentCount(&effectFilter);
|
||||||
if (0 == count)
|
if (0 == count)
|
||||||
{
|
{
|
||||||
NSAlert *const alert = [[NSAlert alloc] init];
|
NSAlert *const alert = [[NSAlert alloc] init];
|
||||||
[alert setAlertStyle:NSWarningAlertStyle];
|
[alert setAlertStyle:NSAlertStyleWarning];
|
||||||
[alert setMessageText:@"No AudioUnit effects found"];
|
[alert setMessageText:@"No AudioUnit effects found"];
|
||||||
[alert addButtonWithTitle:@"OK"];
|
[alert addButtonWithTitle:@"OK"];
|
||||||
[alert runModal];
|
[alert runModal];
|
||||||
[alert release];
|
[alert release];
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::pair<Component, OSStatus> > failed;
|
std::vector<std::pair<AudioComponent, OSStatus> > failed;
|
||||||
effects = (EffectInfo *)malloc(count * sizeof(*effects));
|
effects = (EffectInfo *)malloc(count * sizeof(*effects));
|
||||||
Component effect = FindNextComponent(0, &effectFilter);
|
AudioComponent effect = AudioComponentFindNext(nullptr, &effectFilter);
|
||||||
for (long i = 0; (i < count) && (effect != 0); i++, effect = FindNextComponent(effect, &effectFilter))
|
for (long i = 0; (i < count) && effect; i++, effect = AudioComponentFindNext(effect, &effectFilter))
|
||||||
{
|
{
|
||||||
ComponentDescription effectDesc;
|
OSStatus err;
|
||||||
Handle const nameHandle = NewHandle(4);
|
AudioComponentDescription effectDesc;
|
||||||
OSStatus const err = GetComponentInfo(effect, &effectDesc, nameHandle, NULL, NULL);
|
CFStringRef name = nullptr;
|
||||||
|
err = AudioComponentGetDescription(effect, &effectDesc);
|
||||||
|
if (noErr == err)
|
||||||
|
err = AudioComponentCopyName(effect, &name);
|
||||||
if (noErr == err)
|
if (noErr == err)
|
||||||
{
|
{
|
||||||
effects[i].component = effect;
|
effects[i].component = effect;
|
||||||
effects[i].type = effectDesc.componentType;
|
effects[i].type = effectDesc.componentType;
|
||||||
effects[i].subtype = effectDesc.componentSubType;
|
effects[i].subtype = effectDesc.componentSubType;
|
||||||
effects[i].manufacturer = effectDesc.componentManufacturer;
|
effects[i].manufacturer = effectDesc.componentManufacturer;
|
||||||
HLock(nameHandle);
|
|
||||||
CFStringRef const name = CFStringCreateWithPascalString(
|
|
||||||
NULL,
|
|
||||||
(unsigned char const *)*nameHandle,
|
|
||||||
kCFStringEncodingMacRoman);
|
|
||||||
HUnlock(nameHandle);
|
|
||||||
NSMenuItem *const item = [newEffectMenu addItemWithTitle:(NSString *)name
|
NSMenuItem *const item = [newEffectMenu addItemWithTitle:(NSString *)name
|
||||||
action:@selector(newEffect:)
|
action:@selector(newEffect:)
|
||||||
keyEquivalent:@""];
|
keyEquivalent:@""];
|
||||||
@ -1020,9 +998,8 @@ static void UpdateChangeCountCallback(
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
effects[i].component = 0;
|
effects[i].component = 0;
|
||||||
failed.push_back(std::make_pair(effect, err));
|
failed.emplace_back(effect, err);
|
||||||
}
|
}
|
||||||
DisposeHandle(nameHandle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!failed.empty())
|
if (!failed.empty())
|
||||||
@ -1040,7 +1017,7 @@ static void UpdateChangeCountCallback(
|
|||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
NSAlert *const alert = [[NSAlert alloc] init];
|
NSAlert *const alert = [[NSAlert alloc] init];
|
||||||
[alert setAlertStyle:NSWarningAlertStyle];
|
[alert setAlertStyle:NSAlertStyleWarning];
|
||||||
[alert setMessageText:message];
|
[alert setMessageText:message];
|
||||||
[alert setInformativeText:[NSString stringWithString:detail]];
|
[alert setInformativeText:[NSString stringWithString:detail]];
|
||||||
[alert addButtonWithTitle:@"OK"];
|
[alert addButtonWithTitle:@"OK"];
|
||||||
|
Loading…
Reference in New Issue
Block a user