mirror of
https://github.com/holub/mame
synced 2025-06-11 15:16:09 +03:00
Changing some arrays to use std::array<> in natkeyboard
This commit is contained in:
parent
d5b3dca0ad
commit
35e5616ca8
@ -609,7 +609,7 @@ void natural_keyboard::build_codes(ioport_manager &manager)
|
|||||||
{
|
{
|
||||||
// find all shift keys
|
// find all shift keys
|
||||||
unsigned mask = 0;
|
unsigned mask = 0;
|
||||||
ioport_field *shift[SHIFT_COUNT];
|
std::array<ioport_field *, SHIFT_COUNT> shift;
|
||||||
std::fill(std::begin(shift), std::end(shift), nullptr);
|
std::fill(std::begin(shift), std::end(shift), nullptr);
|
||||||
for (auto const &port : manager.ports())
|
for (auto const &port : manager.ports())
|
||||||
{
|
{
|
||||||
@ -663,7 +663,6 @@ void natural_keyboard::build_codes(ioport_manager &manager)
|
|||||||
newcode.field[fieldnum++] = shift[i];
|
newcode.field[fieldnum++] = shift[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(fieldnum < ARRAY_LENGTH(newcode.field));
|
|
||||||
newcode.field[fieldnum] = &field;
|
newcode.field[fieldnum] = &field;
|
||||||
if (m_keycode_map.end() == found)
|
if (m_keycode_map.end() == found)
|
||||||
m_keycode_map.emplace(code, newcode);
|
m_keycode_map.emplace(code, newcode);
|
||||||
@ -802,8 +801,6 @@ void natural_keyboard::timer(void *ptr, int param)
|
|||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
assert(m_fieldnum < ARRAY_LENGTH(code->field));
|
|
||||||
|
|
||||||
ioport_field *const field = code->field[m_fieldnum];
|
ioport_field *const field = code->field[m_fieldnum];
|
||||||
if (field)
|
if (field)
|
||||||
{
|
{
|
||||||
@ -814,8 +811,8 @@ void natural_keyboard::timer(void *ptr, int param)
|
|||||||
field->set_value(!field->digital_value());
|
field->set_value(!field->digital_value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (code->field[m_fieldnum] && (++m_fieldnum < ARRAY_LENGTH(code->field)) && m_status_keydown);
|
while (code->field[m_fieldnum] && (++m_fieldnum < code->field.size()) && m_status_keydown);
|
||||||
advance = (m_fieldnum >= ARRAY_LENGTH(code->field)) || !code->field[m_fieldnum];
|
advance = (m_fieldnum >= code->field.size()) || !code->field[m_fieldnum];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -909,7 +906,7 @@ void natural_keyboard::dump(std::ostream &str) const
|
|||||||
util::stream_format(str, "%-*s", left_column_width, description);
|
util::stream_format(str, "%-*s", left_column_width, description);
|
||||||
|
|
||||||
// identify the keys used
|
// identify the keys used
|
||||||
for (std::size_t field = 0; (ARRAY_LENGTH(code.second.field) > field) && code.second.field[field]; ++field)
|
for (std::size_t field = 0; (code.second.field.size() > field) && code.second.field[field]; ++field)
|
||||||
util::stream_format(str, "%s'%s'", first ? "" : ", ", code.second.field[field]->name());
|
util::stream_format(str, "%s'%s'", first ? "" : ", ", code.second.field[field]->name());
|
||||||
|
|
||||||
// carriage return
|
// carriage return
|
||||||
|
@ -72,8 +72,8 @@ private:
|
|||||||
// internal keyboard code information
|
// internal keyboard code information
|
||||||
struct keycode_map_entry
|
struct keycode_map_entry
|
||||||
{
|
{
|
||||||
ioport_field * field[SHIFT_COUNT + 1];
|
std::array<ioport_field *, SHIFT_COUNT + 1> field;
|
||||||
unsigned shift;
|
unsigned shift;
|
||||||
};
|
};
|
||||||
typedef std::unordered_map<char32_t, keycode_map_entry> keycode_map;
|
typedef std::unordered_map<char32_t, keycode_map_entry> keycode_map;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user