summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd
diff options
context:
space:
mode:
author Aaron Giles <aaronsgiles@users.noreply.github.com>2021-06-22 00:58:05 -0700
committer GitHub <noreply@github.com>2021-06-22 09:58:05 +0200
commit9b7f0f499f0fedf9176499b0a8710736e20f6e6f (patch)
tree821ea3c25328d8ae1718d9ddc525854840f5205e /src/osd
parent86d1ef260440adbd0db84a897d624383f23526ed (diff)
Eliminate remaining uses of auto_alloc and friends (#8210)
* Split off auto_alloc changes from deprecated branch. * Make the keymap reader non-static so it can access the unique_ptr. * Fix SDL input for real.
Diffstat (limited to 'src/osd')
-rw-r--r--src/osd/modules/input/input_sdl.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/osd/modules/input/input_sdl.cpp b/src/osd/modules/input/input_sdl.cpp
index 5ecab0a479b..9612b9d3700 100644
--- a/src/osd/modules/input/input_sdl.cpp
+++ b/src/osd/modules/input/input_sdl.cpp
@@ -845,7 +845,7 @@ public:
}
private:
- static keyboard_trans_table* sdlinput_read_keymap(running_machine &machine)
+ keyboard_trans_table* sdlinput_read_keymap(running_machine &machine)
{
char *keymap_filename;
FILE *keymap_file;
@@ -875,7 +875,7 @@ private:
key_trans_entries[i] = default_table[i];
// Allocate the trans table to be associated with the machine so we don't have to free it
- keyboard_trans_table *custom_table = auto_alloc(machine, keyboard_trans_table(std::move(key_trans_entries), default_table.size()));
+ m_custom_table = std::make_unique<keyboard_trans_table>(std::move(key_trans_entries), default_table.size());
while (!feof(keymap_file))
{
@@ -907,10 +907,9 @@ private:
if (sk >= 0 && index >= 0)
{
- key_trans_entry &entry = (*custom_table)[index];
+ key_trans_entry &entry = (*m_custom_table)[index];
entry.sdl_scancode = sk;
- entry.ui_name = auto_alloc_array(machine, char, strlen(kns) + 1);
- strcpy(entry.ui_name, kns);
+ entry.ui_name = const_cast<char *>(m_ui_names.emplace_back(kns).c_str());
osd_printf_verbose("Keymap: Mapped <%s> to <%s> with ui-text <%s>\n", sks, mks, kns);
}
else
@@ -922,8 +921,11 @@ private:
fclose(keymap_file);
osd_printf_verbose("Keymap: Processed %d lines\n", line);
- return custom_table;
+ return m_custom_table.get();
}
+
+ std::unique_ptr<keyboard_trans_table> m_custom_table;
+ std::list<std::string> m_ui_names;
};
//============================================================