mirror of
https://github.com/holub/mame
synced 2025-05-25 15:25:33 +03:00
Delete dynamic_array buffer only if allocated, fixes crash in taitogn, require at least clean lib compile (no whatsnew)
This commit is contained in:
parent
07077bc425
commit
287777d6a1
@ -76,7 +76,7 @@ public:
|
|||||||
|
|
||||||
// helpers
|
// helpers
|
||||||
void append(const _ElementType &element) { if (m_count == m_allocated) expand_internal((m_allocated == 0) ? 16 : (m_allocated << 1), true); m_array[m_count++] = element; }
|
void append(const _ElementType &element) { if (m_count == m_allocated) expand_internal((m_allocated == 0) ? 16 : (m_allocated << 1), true); m_array[m_count++] = element; }
|
||||||
void reset() { delete[] m_array; m_array = NULL; m_count = m_allocated = 0; }
|
void reset() { if (m_array) delete[] m_array; m_array = NULL; m_count = m_allocated = 0; }
|
||||||
void resize(int count, bool keepdata = false) { if (count > m_allocated) expand_internal(count, keepdata); m_count = count; }
|
void resize(int count, bool keepdata = false) { if (count > m_allocated) expand_internal(count, keepdata); m_count = count; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -89,7 +89,7 @@ private:
|
|||||||
if (keepdata)
|
if (keepdata)
|
||||||
for (int index = 0; index < m_count; index++)
|
for (int index = 0; index < m_count; index++)
|
||||||
newarray[index] = m_array[index];
|
newarray[index] = m_array[index];
|
||||||
delete[] m_array;
|
if (m_array) delete[] m_array;
|
||||||
m_array = newarray;
|
m_array = newarray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,8 +357,6 @@ public:
|
|||||||
|
|
||||||
UINT32 m_coin_info;
|
UINT32 m_coin_info;
|
||||||
UINT32 m_mux_data;
|
UINT32 m_mux_data;
|
||||||
|
|
||||||
dynamic_buffer m_key;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -453,6 +451,8 @@ static WRITE32_HANDLER(rf5c296_mem_w)
|
|||||||
taitogn_state *state = space->machine().driver_data<taitogn_state>();
|
taitogn_state *state = space->machine().driver_data<taitogn_state>();
|
||||||
|
|
||||||
if(offset >= 0x140 && offset <= 0x144) {
|
if(offset >= 0x140 && offset <= 0x144) {
|
||||||
|
dynamic_buffer key;
|
||||||
|
|
||||||
int pos = (offset - 0x140)*2;
|
int pos = (offset - 0x140)*2;
|
||||||
UINT8 v, k;
|
UINT8 v, k;
|
||||||
if(ACCESSING_BITS_16_23) {
|
if(ACCESSING_BITS_16_23) {
|
||||||
@ -460,8 +460,8 @@ static WRITE32_HANDLER(rf5c296_mem_w)
|
|||||||
pos++;
|
pos++;
|
||||||
} else
|
} else
|
||||||
v = data;
|
v = data;
|
||||||
get_disk_handle(space->machine(), ":drive_0")->read_metadata(HARD_DISK_KEY_METADATA_TAG, 0, state->m_key);
|
get_disk_handle(space->machine(), ":drive_0")->read_metadata(HARD_DISK_KEY_METADATA_TAG, 0, key);
|
||||||
k = pos < state->m_key.count() ? state->m_key[pos] : 0;
|
k = pos < key.count() ? key[pos] : 0;
|
||||||
if(v == k)
|
if(v == k)
|
||||||
state->m_locked &= ~(1 << pos);
|
state->m_locked &= ~(1 << pos);
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user