From a704ed7b1b121c3bcff52d49bff8372360fe907c Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Fri, 29 Jun 2018 10:58:19 +0200 Subject: emumem: Backend modernization [O. Galibert] --- src/frontend/mame/luaengine.cpp | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'src/frontend/mame/luaengine.cpp') diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp index c4e7bbbbfdd..edc56ee13b9 100644 --- a/src/frontend/mame/luaengine.cpp +++ b/src/frontend/mame/luaengine.cpp @@ -1287,42 +1287,40 @@ void lua_engine::initialize() return table; }, "wpset", [](device_debug &dev, addr_space &sp, const std::string &type, offs_t addr, offs_t len, const char *cond, const char *act) { - int wptype = WATCHPOINT_READ; + read_or_write wptype = read_or_write::READ; if(type == "w") - wptype = WATCHPOINT_WRITE; + wptype = read_or_write::WRITE; else if((type == "rw") || (type == "wr")) - wptype = WATCHPOINT_READ | WATCHPOINT_WRITE; + wptype = read_or_write::READWRITE; return dev.watchpoint_set(sp.space, wptype, addr, len, cond, act); }, "wpclr", &device_debug::watchpoint_clear, "wplist", [this](device_debug &dev, addr_space &sp) { sol::table table = sol().create_table(); - device_debug::watchpoint *list = dev.watchpoint_first(sp.space.spacenum()); - while(list) + for(auto &wpp : dev.watchpoint_vector(sp.space.spacenum())) { sol::table wp = sol().create_table(); - wp["enabled"] = list->enabled(); - wp["address"] = list->address(); - wp["length"] = list->length(); - switch(list->type()) + wp["enabled"] = wpp->enabled(); + wp["address"] = wpp->address(); + wp["length"] = wpp->length(); + switch(wpp->type()) { - case WATCHPOINT_READ: + case read_or_write::READ: wp["type"] = "r"; break; - case WATCHPOINT_WRITE: + case read_or_write::WRITE: wp["type"] = "w"; break; - case WATCHPOINT_READ | WATCHPOINT_WRITE: + case read_or_write::READWRITE: wp["type"] = "rw"; break; default: // huh? wp["type"] = ""; break; } - wp["condition"] = list->condition(); - wp["action"] = list->action(); - table[list->index()] = wp; - list = list->next(); + wp["condition"] = wpp->condition(); + wp["action"] = wpp->action(); + table[wpp->index()] = wp; } return table; }); -- cgit v1.2.3-70-g09d2