mirror of
https://github.com/holub/mame
synced 2025-07-04 17:38:08 +03:00
Fix up some stuff:
* formats/cassimg.cpp: Put allocation outside loop again, check more allocations for failure. * pc8801_flop.xml: Actually mark clones as clones, transliterate title for S.F.3.D. * apple/macadb.cpp: Tidy a little.
This commit is contained in:
parent
802bce33eb
commit
fbb446e8ad
@ -29122,7 +29122,7 @@ Start and Program Disks OK, the remaining part is damaged (missing d88 headers?)
|
|||||||
</software>
|
</software>
|
||||||
|
|
||||||
<software name="sf3dthxg">
|
<software name="sf3dthxg">
|
||||||
<description>S.F.3.D - Original Operation Thanksgiving</description>
|
<description>Point X Senryō Sakusen S.F.3.D - Original Operation Thanksgiving</description>
|
||||||
<year>1986</year>
|
<year>1986</year>
|
||||||
<publisher>クロスメディアソフト (Cross Media Soft)</publisher>
|
<publisher>クロスメディアソフト (Cross Media Soft)</publisher>
|
||||||
<!-- PC8801 -->
|
<!-- PC8801 -->
|
||||||
@ -29135,8 +29135,8 @@ Start and Program Disks OK, the remaining part is damaged (missing d88 headers?)
|
|||||||
</part>
|
</part>
|
||||||
</software>
|
</software>
|
||||||
|
|
||||||
<software name="sf3dthxga">
|
<software name="sf3dthxga" cloneof="sf3dthxg">
|
||||||
<description>S.F.3.D - Original Operation Thanksgiving (alt)</description>
|
<description>Point X Senryō Sakusen S.F.3.D - Original Operation Thanksgiving (alt)</description>
|
||||||
<year>1986</year>
|
<year>1986</year>
|
||||||
<publisher>クロスメディアソフト (Cross Media Soft)</publisher>
|
<publisher>クロスメディアソフト (Cross Media Soft)</publisher>
|
||||||
<!-- PC8801 -->
|
<!-- PC8801 -->
|
||||||
|
@ -791,7 +791,8 @@ cassette_image::error cassette_image::legacy_construct(const LegacyWaveFiller *l
|
|||||||
error err;
|
error err;
|
||||||
int length;
|
int length;
|
||||||
int sample_count;
|
int sample_count;
|
||||||
std::vector<int16_t> samples;
|
std::unique_ptr<int16_t []> samples;
|
||||||
|
std::unique_ptr<uint8_t []> chunk;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
uint64_t offset = 0;
|
uint64_t offset = 0;
|
||||||
|
|
||||||
@ -814,15 +815,21 @@ cassette_image::error cassette_image::legacy_construct(const LegacyWaveFiller *l
|
|||||||
/* determine number of samples */
|
/* determine number of samples */
|
||||||
if (args.chunk_sample_calc != nullptr)
|
if (args.chunk_sample_calc != nullptr)
|
||||||
{
|
{
|
||||||
if (size > 0x7FFFFFFF)
|
if (size > 0x7fffffff)
|
||||||
{
|
{
|
||||||
err = error::OUT_OF_MEMORY;
|
err = error::OUT_OF_MEMORY;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<uint8_t> bytes(size);
|
std::unique_ptr<uint8_t []> bytes(new (std::nothrow) uint8_t [size]);
|
||||||
image_read(&bytes[0], 0, size);
|
if (!bytes)
|
||||||
sample_count = args.chunk_sample_calc(&bytes[0], (int)size);
|
{
|
||||||
|
err = error::OUT_OF_MEMORY;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
image_read(bytes.get(), 0, size);
|
||||||
|
sample_count = args.chunk_sample_calc(bytes.get(), (int)size);
|
||||||
|
|
||||||
// chunk_sample_calc functions report errors by returning negative numbers
|
// chunk_sample_calc functions report errors by returning negative numbers
|
||||||
if (sample_count < 0)
|
if (sample_count < 0)
|
||||||
@ -842,7 +849,12 @@ cassette_image::error cassette_image::legacy_construct(const LegacyWaveFiller *l
|
|||||||
sample_count += args.header_samples + args.trailer_samples;
|
sample_count += args.header_samples + args.trailer_samples;
|
||||||
|
|
||||||
/* allocate a buffer for the completed samples */
|
/* allocate a buffer for the completed samples */
|
||||||
samples.resize(sample_count);
|
samples.reset(new (std::nothrow) int16_t [sample_count]);
|
||||||
|
if (!samples)
|
||||||
|
{
|
||||||
|
err = error::OUT_OF_MEMORY;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
/* if there has to be a header */
|
/* if there has to be a header */
|
||||||
if (args.header_samples > 0)
|
if (args.header_samples > 0)
|
||||||
@ -857,11 +869,15 @@ cassette_image::error cassette_image::legacy_construct(const LegacyWaveFiller *l
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* convert the file data to samples */
|
/* convert the file data to samples */
|
||||||
|
chunk.reset(new (std::nothrow) uint8_t [args.chunk_size]);
|
||||||
|
if (!chunk)
|
||||||
|
{
|
||||||
|
err = error::OUT_OF_MEMORY;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
while ((pos < sample_count) && (offset < size))
|
while ((pos < sample_count) && (offset < size))
|
||||||
{
|
{
|
||||||
/* allocate a buffer for the binary data */
|
image_read(chunk.get(), offset, args.chunk_size);
|
||||||
std::vector<uint8_t> chunk(args.chunk_size);
|
|
||||||
image_read(&chunk[0], offset, args.chunk_size);
|
|
||||||
offset += args.chunk_size;
|
offset += args.chunk_size;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -871,10 +887,10 @@ cassette_image::error cassette_image::legacy_construct(const LegacyWaveFiller *l
|
|||||||
without knowing how much data available in the image. Having wrong header with size bigger than image couses illegal
|
without knowing how much data available in the image. Having wrong header with size bigger than image couses illegal
|
||||||
access beyond image data.
|
access beyond image data.
|
||||||
Desired state is:
|
Desired state is:
|
||||||
length = args.fill_wave(&samples[pos], args.chunk_size, &chunk[0]);
|
length = args.fill_wave(&samples[pos], args.chunk_size, chunk.get());
|
||||||
aslo the fix for tap is commented out in 'tap_cas_fill_wave'
|
aslo the fix for tap is commented out in 'tap_cas_fill_wave'
|
||||||
*/
|
*/
|
||||||
length = args.fill_wave(&samples[pos], sample_count - pos, &chunk[0]);
|
length = args.fill_wave(&samples[pos], sample_count - pos, chunk.get());
|
||||||
if (length < 0)
|
if (length < 0)
|
||||||
{
|
{
|
||||||
err = error::INVALID_IMAGE;
|
err = error::INVALID_IMAGE;
|
||||||
@ -884,6 +900,7 @@ cassette_image::error cassette_image::legacy_construct(const LegacyWaveFiller *l
|
|||||||
if (length == 0)
|
if (length == 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
chunk.reset();
|
||||||
|
|
||||||
/* if there has to be a trailer */
|
/* if there has to be a trailer */
|
||||||
if (args.trailer_samples > 0)
|
if (args.trailer_samples > 0)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// copyright-holders:m1macrophage
|
// copyright-holders:m1macrophage
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The Midiverb is a digital delay & reverb unit.
|
The MIDIverb is a digital delay & reverb unit.
|
||||||
|
|
||||||
The computer portion of the device is very simple. The firmware runs on a
|
The computer portion of the device is very simple. The firmware runs on a
|
||||||
80C31 microcontroller. It reads the 4 buttons, drives the two 7-segment
|
80C31 microcontroller. It reads the 4 buttons, drives the two 7-segment
|
||||||
@ -17,7 +17,7 @@ silence program is also enabled temporarily when switching between effects.
|
|||||||
Finally, there is a wet/dry control knob. For more information on the audio
|
Finally, there is a wet/dry control knob. For more information on the audio
|
||||||
hardware, see midiverb_state::configure_audio().
|
hardware, see midiverb_state::configure_audio().
|
||||||
|
|
||||||
An interesting aspect of the Midiverb is its DSP, which is built out of discrete
|
An interesting aspect of the MIDIverb is its DSP, which is built out of discrete
|
||||||
logic components and runs custom microcode. Each microcode instruction consists
|
logic components and runs custom microcode. Each microcode instruction consists
|
||||||
of a 2-bit opcode and 14-bit RAM delta offset. The effects program makes up the
|
of a 2-bit opcode and 14-bit RAM delta offset. The effects program makes up the
|
||||||
top 6 bits of the microcode ROM address, and the DSP just loops over the 128
|
top 6 bits of the microcode ROM address, and the DSP just loops over the 128
|
||||||
@ -653,4 +653,3 @@ ROM_END
|
|||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
SYST(1986, midiverb, 0, 0, midiverb, midiverb, midiverb_state, empty_init, "Alesis", "MIDIverb", MACHINE_SUPPORTS_SAVE)
|
SYST(1986, midiverb, 0, 0, midiverb, midiverb, midiverb_state, empty_init, "Alesis", "MIDIverb", MACHINE_SUPPORTS_SAVE)
|
||||||
|
|
||||||
|
@ -476,27 +476,19 @@ void macadb_device::portable_update_keyboard()
|
|||||||
|
|
||||||
bool macadb_device::adb_pollmouse()
|
bool macadb_device::adb_pollmouse()
|
||||||
{
|
{
|
||||||
s32 NewX, NewY, NewButton;
|
s32 const NewButton = m_mouse0->read() & 0x03;
|
||||||
|
s32 const NewX = m_mouse1->read();
|
||||||
|
s32 const NewY = m_mouse2->read();
|
||||||
|
|
||||||
NewButton = m_mouse0->read() & 0x03;
|
return (NewX != m_lastmousex) || (NewY != m_lastmousey) || (NewButton != m_lastbutton);
|
||||||
NewX = m_mouse1->read();
|
|
||||||
NewY = m_mouse2->read();
|
|
||||||
|
|
||||||
if ((NewX != m_lastmousex) || (NewY != m_lastmousey) || (NewButton != m_lastbutton))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void macadb_device::adb_accummouse(u8 *MouseX, u8 *MouseY )
|
void macadb_device::adb_accummouse(u8 *MouseX, u8 *MouseY )
|
||||||
{
|
{
|
||||||
int MouseCountX = 0, MouseCountY = 0;
|
int MouseCountX = 0, MouseCountY = 0;
|
||||||
int NewX, NewY;
|
|
||||||
|
|
||||||
NewX = m_mouse1->read();
|
int const NewX = m_mouse1->read();
|
||||||
NewY = m_mouse2->read();
|
int const NewY = m_mouse2->read();
|
||||||
|
|
||||||
// printf("pollmouse: X %d Y %d\n", NewX, NewY);
|
// printf("pollmouse: X %d Y %d\n", NewX, NewY);
|
||||||
|
|
||||||
@ -538,10 +530,8 @@ void macadb_device::adb_accummouse(u8 *MouseX, u8 *MouseY )
|
|||||||
|
|
||||||
void macadb_device::adb_talk()
|
void macadb_device::adb_talk()
|
||||||
{
|
{
|
||||||
int addr, reg;
|
int const addr = m_command >> 4;
|
||||||
|
int const reg = m_command & 3;
|
||||||
addr = (m_command>>4);
|
|
||||||
reg = (m_command & 3);
|
|
||||||
|
|
||||||
// printf("Mac sent %x (cmd %d addr %d reg %d mr %d kr %d)\n", m_command, (m_command>>2)&3, addr, reg, m_mouseaddr, m_keybaddr);
|
// printf("Mac sent %x (cmd %d addr %d reg %d mr %d kr %d)\n", m_command, (m_command>>2)&3, addr, reg, m_mouseaddr, m_keybaddr);
|
||||||
|
|
||||||
@ -612,10 +602,8 @@ void macadb_device::adb_talk()
|
|||||||
this->adb_accummouse(&mouseX, &mouseY);
|
this->adb_accummouse(&mouseX, &mouseY);
|
||||||
}
|
}
|
||||||
//printf("X %x Y %x\n", mouseX, mouseY);
|
//printf("X %x Y %x\n", mouseX, mouseY);
|
||||||
m_buffer[0] = (m_lastbutton & 0x01) ? 0x00 : 0x80;
|
m_buffer[0] = (BIT(~m_lastbutton, 0) << 7) | (mouseY & 0x7f);
|
||||||
m_buffer[0] |= mouseY & 0x7f;
|
m_buffer[1] = (BIT(~m_lastbutton, 1) << 7) | (mouseX & 0x7f);
|
||||||
m_buffer[1] = (m_lastbutton & 0x02) ? 0x00 : 0x80;
|
|
||||||
m_buffer[1] |= mouseX & 0x7f;
|
|
||||||
|
|
||||||
if ((m_buffer[0] != m_last_mouse[0]) || (m_buffer[1] != m_last_mouse[1]))
|
if ((m_buffer[0] != m_last_mouse[0]) || (m_buffer[1] != m_last_mouse[1]))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user