src/mame/drivers/taitogn.c
| r14511 | r14512 | |
| 451 | 451 | taitogn_state *state = space->machine().driver_data<taitogn_state>(); |
| 452 | 452 | |
| 453 | 453 | if(offset >= 0x140 && offset <= 0x144) { |
| 454 | | dynamic_buffer key; |
| 454 | dynamic_buffer key; |
| 455 | |
| 455 | 456 | int pos = (offset - 0x140)*2; |
| 456 | 457 | UINT8 v, k; |
| 457 | 458 | if(ACCESSING_BITS_16_23) { |
| r14511 | r14512 | |
| 459 | 460 | pos++; |
| 460 | 461 | } else |
| 461 | 462 | v = data; |
| 462 | | get_disk_handle(space->machine(), ":card")->read_metadata(HARD_DISK_KEY_METADATA_TAG, 0, key); |
| 463 | get_disk_handle(space->machine(), ":drive_0")->read_metadata(HARD_DISK_KEY_METADATA_TAG, 0, key); |
| 463 | 464 | k = pos < key.count() ? key[pos] : 0; |
| 464 | 465 | if(v == k) |
| 465 | 466 | state->m_locked &= ~(1 << pos); |
| r14511 | r14512 | |
| 891 | 892 | |
| 892 | 893 | UINT32 metalength; |
| 893 | 894 | memset(state->m_cis, 0xff, 512); |
| 894 | | if (get_disk_handle(machine, ":card") != NULL) |
| 895 | | get_disk_handle(machine, ":card")->read_metadata(PCMCIA_CIS_METADATA_TAG, 0, state->m_cis, 512, metalength); |
| 895 | if (get_disk_handle(machine, ":drive_0") != NULL) |
| 896 | get_disk_handle(machine, ":drive_0")->read_metadata(PCMCIA_CIS_METADATA_TAG, 0, state->m_cis, 512, metalength); |
| 896 | 897 | } |
| 897 | 898 | |
| 898 | 899 | static DRIVER_INIT( coh3002t_mp ) |
src/lib/util/coretmpl.h
| r14511 | r14512 | |
| 76 | 76 | |
| 77 | 77 | // helpers |
| 78 | 78 | 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; } |
| 79 | | void reset() { delete[] m_array; m_array = NULL; m_count = m_allocated = 0; } |
| 79 | void reset() { if (m_array) delete[] m_array; m_array = NULL; m_count = m_allocated = 0; } |
| 80 | 80 | void resize(int count, bool keepdata = false) { if (count > m_allocated) expand_internal(count, keepdata); m_count = count; } |
| 81 | 81 | |
| 82 | 82 | private: |
| r14511 | r14512 | |
| 89 | 89 | if (keepdata) |
| 90 | 90 | for (int index = 0; index < m_count; index++) |
| 91 | 91 | newarray[index] = m_array[index]; |
| 92 | | delete[] m_array; |
| 92 | if (m_array) delete[] m_array; |
| 93 | 93 | m_array = newarray; |
| 94 | 94 | } |
| 95 | 95 | |