summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cheat.cpp
diff options
context:
space:
mode:
author ImJezze <jezze@gmx.net>2016-02-21 11:48:45 +0100
committer ImJezze <jezze@gmx.net>2016-02-21 11:48:45 +0100
commitcc24a339d8c0517259084b5c178d784626ba965c (patch)
tree9868e9687b5802ae0a3733712a3bbeb3bc75c953 /src/emu/cheat.cpp
parentb5daabda5495dea5c50e17961ecfed2ea8619d76 (diff)
Merge remote-tracking branch 'refs/remotes/mamedev/master'
Second attempt
Diffstat (limited to 'src/emu/cheat.cpp')
-rw-r--r--src/emu/cheat.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/emu/cheat.cpp b/src/emu/cheat.cpp
index 16291063985..c055ba5bdb2 100644
--- a/src/emu/cheat.cpp
+++ b/src/emu/cheat.cpp
@@ -1043,6 +1043,9 @@ cheat_manager::cheat_manager(running_machine &machine)
if (!machine.options().cheat())
return;
+ m_output.resize(UI_TARGET_FONT_ROWS*2);
+ m_justify.resize(UI_TARGET_FONT_ROWS*2);
+
// request a callback
machine.add_notifier(MACHINE_NOTIFY_FRAME, machine_notify_delegate(FUNC(cheat_manager::frame_update), this));
@@ -1209,7 +1212,7 @@ bool cheat_manager::save_all(const char *filename)
void cheat_manager::render_text(render_container &container)
{
// render any text and free it along the way
- for (int linenum = 0; linenum < ARRAY_LENGTH(m_output); linenum++)
+ for (int linenum = 0; linenum < m_output.size(); linenum++)
if (!m_output[linenum].empty())
{
// output the text
@@ -1337,7 +1340,7 @@ void cheat_manager::frame_update()
// set up for accumulating output
m_lastline = 0;
m_numlines = floor(1.0f / machine().ui().get_line_height());
- m_numlines = MIN(m_numlines, ARRAY_LENGTH(m_output));
+ m_numlines = MIN(m_numlines, m_output.size());
for (auto & elem : m_output)
elem.clear();
@@ -1358,7 +1361,14 @@ void cheat_manager::frame_update()
void cheat_manager::load_cheats(const char *filename)
{
xml_data_node *rootnode = nullptr;
- emu_file cheatfile(machine().options().cheat_path(), OPEN_FLAG_READ);
+ std::string searchstr(machine().options().cheat_path());
+ path_iterator path(searchstr.c_str());
+ std::string curpath;
+ while (path.next(curpath))
+ {
+ searchstr.append(";").append(curpath).append(PATH_SEPARATOR).append("cheat");
+ }
+ emu_file cheatfile(searchstr.c_str(), OPEN_FLAG_READ);
try
{
// open the file with the proper name