summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2019-11-18 05:08:36 +1100
committer Vas Crabb <vas@vastheman.com>2019-11-18 05:08:36 +1100
commit88ce545cdda64659894b87fc0b98e1b044eea3e0 (patch)
tree9a1f05f459b773c70a2ef64443cbe8fee2a3ccd1
parent1fbfa9e071fe1824ea47c567c23778d8ab33cacf (diff)
misc cleanup:
* Got rid of some more simple_list in core debugger code * Fixed a buffer overrun in wavwrite (buffer half requried size) * Slightly reduced dependencies and overhead in wavwrite * Made new disassembly windows in Qt debugger default to current CPU
-rw-r--r--src/emu/debug/debugvw.cpp11
-rw-r--r--src/emu/debug/debugvw.h27
-rw-r--r--src/emu/debug/dvbpoints.cpp13
-rw-r--r--src/emu/debug/dvdisasm.cpp13
-rw-r--r--src/emu/debug/dvdisasm.h2
-rw-r--r--src/emu/debug/dvmemory.cpp13
-rw-r--r--src/emu/debug/dvmemory.h2
-rw-r--r--src/emu/debug/dvstate.cpp9
-rw-r--r--src/emu/debug/dvstate.h2
-rw-r--r--src/emu/debug/dvwpoints.cpp15
-rw-r--r--src/emu/debug/express.cpp9
-rw-r--r--src/emu/debug/express.h28
-rw-r--r--src/emu/debug/textbuf.cpp119
-rw-r--r--src/lib/util/corealloc.h2
-rw-r--r--src/lib/util/wavwrite.cpp185
-rw-r--r--src/lib/util/wavwrite.h13
-rw-r--r--src/osd/modules/debugger/debugimgui.cpp38
-rw-r--r--src/osd/modules/debugger/osx/disassemblyview.mm10
-rw-r--r--src/osd/modules/debugger/osx/memoryview.mm10
-rw-r--r--src/osd/modules/debugger/osx/registersview.mm2
-rw-r--r--src/osd/modules/debugger/qt/dasmwindow.cpp25
-rw-r--r--src/osd/modules/debugger/qt/dasmwindow.h1
-rw-r--r--src/osd/modules/debugger/qt/memorywindow.cpp18
-rw-r--r--src/osd/modules/debugger/win/consolewininfo.h5
-rw-r--r--src/osd/modules/debugger/win/debugbaseinfo.h7
-rw-r--r--src/osd/modules/debugger/win/debugviewinfo.cpp8
-rw-r--r--src/osd/modules/debugger/win/debugviewinfo.h5
-rw-r--r--src/osd/modules/debugger/win/debugwin.h6
-rw-r--r--src/osd/modules/debugger/win/debugwininfo.h6
-rw-r--r--src/osd/modules/debugger/win/disasmbasewininfo.h7
-rw-r--r--src/osd/modules/debugger/win/disasmviewinfo.h5
-rw-r--r--src/osd/modules/debugger/win/disasmwininfo.h5
-rw-r--r--src/osd/modules/debugger/win/editwininfo.h5
-rw-r--r--src/osd/modules/debugger/win/logviewinfo.h5
-rw-r--r--src/osd/modules/debugger/win/logwininfo.h5
-rw-r--r--src/osd/modules/debugger/win/memoryviewinfo.h5
-rw-r--r--src/osd/modules/debugger/win/memorywininfo.h5
-rw-r--r--src/osd/modules/debugger/win/pointswininfo.h5
-rw-r--r--src/osd/modules/debugger/win/uimetrics.h5
39 files changed, 326 insertions, 330 deletions
diff --git a/src/emu/debug/debugvw.cpp b/src/emu/debug/debugvw.cpp
index f351896480e..f3b71698dbb 100644
--- a/src/emu/debug/debugvw.cpp
+++ b/src/emu/debug/debugvw.cpp
@@ -32,8 +32,7 @@
//-------------------------------------------------
debug_view_source::debug_view_source(const char *name, device_t *device)
- : m_next(nullptr),
- m_name(name),
+ : m_name(name),
m_device(device)
{
}
@@ -232,10 +231,10 @@ void debug_view::set_source(const debug_view_source &source)
const debug_view_source *debug_view::source_for_device(device_t *device) const
{
- for (debug_view_source &source : m_source_list)
- if (device == source.device())
- return &source;
- return m_source_list.first();
+ for (auto &source : m_source_list)
+ if (device == source->device())
+ return source.get();
+ return first_source();
}
diff --git a/src/emu/debug/debugvw.h b/src/emu/debug/debugvw.h
index 374af7f384e..1386b996b1a 100644
--- a/src/emu/debug/debugvw.h
+++ b/src/emu/debug/debugvw.h
@@ -13,6 +13,12 @@
#include "express.h"
+#include <algorithm>
+#include <iterator>
+#include <memory>
+#include <string>
+#include <vector>
+
//**************************************************************************
// CONSTANTS
@@ -107,8 +113,6 @@ class debug_view_source
{
DISABLE_COPYING(debug_view_source);
- friend class simple_list<debug_view_source>;
-
public:
// construction/destruction
debug_view_source(const char *name, device_t *device = nullptr);
@@ -116,14 +120,12 @@ public:
// getters
const char *name() const { return m_name.c_str(); }
- debug_view_source *next() const { return m_next; }
device_t *device() const { return m_device; }
private:
// internal state
- debug_view_source * m_next; // link to next item
- std::string m_name; // name of the source item
- device_t * m_device; // associated device (if applicable)
+ std::string const m_name; // name of the source item
+ device_t *const m_device; // associated device (if applicable)
};
@@ -149,9 +151,16 @@ public:
debug_view_xy cursor_position() { flush_updates(); return m_cursor; }
bool cursor_supported() { flush_updates(); return m_supports_cursor; }
bool cursor_visible() { flush_updates(); return m_cursor_visible; }
+ size_t source_count() const { return m_source_list.size(); }
const debug_view_source *source() const { return m_source; }
- const debug_view_source *first_source() const { return m_source_list.first(); }
- const simple_list<debug_view_source> &source_list() const { return m_source_list; }
+ const debug_view_source *source(unsigned i) const { return (m_source_list.size() > i) ? m_source_list[i].get() : nullptr; }
+ const debug_view_source *first_source() const { return m_source_list.empty() ? nullptr : m_source_list[0].get(); }
+ auto source_index(const debug_view_source &source) const
+ {
+ const auto it(std::find_if(m_source_list.begin(), m_source_list.end(), [&source] (const auto &x) { return x.get() == &source; }));
+ return (m_source_list.end() != it) ? std::distance(m_source_list.begin(), it) : -1;
+ }
+ const std::vector<std::unique_ptr<const debug_view_source> > &source_list() const { return m_source_list; }
// setters
void set_visible_size(debug_view_xy size);
@@ -188,7 +197,7 @@ protected:
debug_view * m_next; // link to the next view
debug_view_type m_type; // type of view
const debug_view_source *m_source; // currently selected data source
- simple_list<debug_view_source> m_source_list; // list of available data sources
+ std::vector<std::unique_ptr<const debug_view_source> > m_source_list; // list of available data sources
// OSD data
debug_view_osd_update_func m_osdupdate; // callback for the update
diff --git a/src/emu/debug/dvbpoints.cpp b/src/emu/debug/dvbpoints.cpp
index d86ce1150cc..51b9fcffcf7 100644
--- a/src/emu/debug/dvbpoints.cpp
+++ b/src/emu/debug/dvbpoints.cpp
@@ -96,7 +96,7 @@ debug_view_breakpoints::debug_view_breakpoints(running_machine &machine, debug_v
{
// fail if no available sources
enumerate_sources();
- if (m_source_list.count() == 0)
+ if (m_source_list.empty())
throw std::bad_alloc();
}
@@ -118,18 +118,19 @@ debug_view_breakpoints::~debug_view_breakpoints()
void debug_view_breakpoints::enumerate_sources()
{
// start with an empty list
- m_source_list.reset();
+ m_source_list.clear();
// iterate over devices with disassembly interfaces
for (device_disasm_interface &dasm : disasm_interface_iterator(machine().root_device()))
{
std::string name;
name = string_format("%s '%s'", dasm.device().name(), dasm.device().tag());
- m_source_list.append(*global_alloc(debug_view_source(name.c_str(), &dasm.device())));
+ m_source_list.emplace_back(std::make_unique<debug_view_source>(name.c_str(), &dasm.device()));
}
// reset the source to a known good entry
- set_source(*m_source_list.first());
+ if (!m_source_list.empty())
+ set_source(*m_source_list[0]);
}
@@ -189,10 +190,10 @@ void debug_view_breakpoints::pad_ostream_to_length(std::ostream& str, int len)
void debug_view_breakpoints::gather_breakpoints()
{
m_buffer.resize(0);
- for (const debug_view_source &source : m_source_list)
+ for (auto &source : m_source_list)
{
// Collect
- device_debug &debugInterface = *source.device()->debug();
+ device_debug &debugInterface = *source->device()->debug();
for (const device_debug::breakpoint &bp : debugInterface.breakpoint_list())
m_buffer.push_back(&bp);
}
diff --git a/src/emu/debug/dvdisasm.cpp b/src/emu/debug/dvdisasm.cpp
index 667542483a4..f7361ee2229 100644
--- a/src/emu/debug/dvdisasm.cpp
+++ b/src/emu/debug/dvdisasm.cpp
@@ -52,14 +52,14 @@ debug_view_disasm::debug_view_disasm(running_machine &machine, debug_view_osd_up
{
// fail if no available sources
enumerate_sources();
- if(m_source_list.count() == 0)
+ if(m_source_list.empty())
throw std::bad_alloc();
// count the number of comments
int total_comments = 0;
- for(const debug_view_source &source : m_source_list)
+ for(auto &source : m_source_list)
{
- const debug_view_disasm_source &dasmsource = downcast<const debug_view_disasm_source &>(source);
+ const debug_view_disasm_source &dasmsource = downcast<const debug_view_disasm_source &>(*source);
total_comments += dasmsource.device()->debug()->comment_count();
}
@@ -86,7 +86,7 @@ debug_view_disasm::~debug_view_disasm()
void debug_view_disasm::enumerate_sources()
{
// start with an empty list
- m_source_list.reset();
+ m_source_list.clear();
// iterate over devices with disassembly interfaces
std::string name;
@@ -94,11 +94,12 @@ void debug_view_disasm::enumerate_sources()
{
name = string_format("%s '%s'", dasm.device().name(), dasm.device().tag());
if(dasm.device().memory().space_config(AS_PROGRAM)!=nullptr)
- m_source_list.append(*global_alloc(debug_view_disasm_source(name.c_str(), dasm.device())));
+ m_source_list.emplace_back(std::make_unique<debug_view_disasm_source>(name.c_str(), dasm.device()));
}
// reset the source to a known good entry
- set_source(*m_source_list.first());
+ if (!m_source_list.empty())
+ set_source(*m_source_list[0]);
}
diff --git a/src/emu/debug/dvdisasm.h b/src/emu/debug/dvdisasm.h
index ef9e4209f1b..d66f569e050 100644
--- a/src/emu/debug/dvdisasm.h
+++ b/src/emu/debug/dvdisasm.h
@@ -43,10 +43,10 @@ class debug_view_disasm_source : public debug_view_source
{
friend class debug_view_disasm;
+public:
// construction/destruction
debug_view_disasm_source(const char *name, device_t &device);
-public:
// getters
address_space &space() const { return m_space; }
diff --git a/src/emu/debug/dvmemory.cpp b/src/emu/debug/dvmemory.cpp
index 293d1082fc0..282f6a14f3a 100644
--- a/src/emu/debug/dvmemory.cpp
+++ b/src/emu/debug/dvmemory.cpp
@@ -119,7 +119,7 @@ debug_view_memory::debug_view_memory(running_machine &machine, debug_view_osd_up
// fail if no available sources
enumerate_sources();
- if (m_source_list.count() == 0)
+ if (m_source_list.empty())
throw std::bad_alloc();
// configure the view
@@ -135,7 +135,7 @@ debug_view_memory::debug_view_memory(running_machine &machine, debug_view_osd_up
void debug_view_memory::enumerate_sources()
{
// start with an empty list
- m_source_list.reset();
+ m_source_list.clear();
std::string name;
// first add all the devices' address spaces
@@ -145,14 +145,14 @@ void debug_view_memory::enumerate_sources()
{
address_space &space = memintf.space(spacenum);
name = string_format("%s '%s' %s space memory", memintf.device().name(), memintf.device().tag(), space.name());
- m_source_list.append(*global_alloc(debug_view_memory_source(name.c_str(), space)));
+ m_source_list.emplace_back(std::make_unique<debug_view_memory_source>(name.c_str(), space));
}
// then add all the memory regions
for (auto &region : machine().memory().regions())
{
name = string_format("Region '%s'", region.second->name());
- m_source_list.append(*global_alloc(debug_view_memory_source(name.c_str(), *region.second.get())));
+ m_source_list.emplace_back(std::make_unique<debug_view_memory_source>(name.c_str(), *region.second.get()));
}
// finally add all global array symbols in alphabetical order
@@ -174,10 +174,11 @@ void debug_view_memory::enumerate_sources()
std::sort(itemnames.begin(), itemnames.end(), [] (auto const &x, auto const &y) { return std::get<0>(x) < std::get<0>(y); });
for (auto const &item : itemnames)
- m_source_list.append(*global_alloc(debug_view_memory_source(std::get<0>(item).c_str(), std::get<1>(item), std::get<2>(item), std::get<3>(item))));
+ m_source_list.emplace_back(std::make_unique<debug_view_memory_source>(std::get<0>(item).c_str(), std::get<1>(item), std::get<2>(item), std::get<3>(item)));
// reset the source to a known good entry
- set_source(*m_source_list.first());
+ if (!m_source_list.empty())
+ set_source(*m_source_list[0]);
}
diff --git a/src/emu/debug/dvmemory.h b/src/emu/debug/dvmemory.h
index dd252af45e9..cae15317575 100644
--- a/src/emu/debug/dvmemory.h
+++ b/src/emu/debug/dvmemory.h
@@ -27,11 +27,11 @@ class debug_view_memory_source : public debug_view_source
{
friend class debug_view_memory;
+public:
debug_view_memory_source(const char *name, address_space &space);
debug_view_memory_source(const char *name, memory_region &region);
debug_view_memory_source(const char *name, void *base, int element_size, int num_elements);
-public:
address_space *space() const { return m_space; }
private:
diff --git a/src/emu/debug/dvstate.cpp b/src/emu/debug/dvstate.cpp
index e0004f9bb60..4ec9cc3bfa3 100644
--- a/src/emu/debug/dvstate.cpp
+++ b/src/emu/debug/dvstate.cpp
@@ -55,7 +55,7 @@ debug_view_state::debug_view_state(running_machine &machine, debug_view_osd_upda
{
// fail if no available sources
enumerate_sources();
- if (m_source_list.count() == 0)
+ if (m_source_list.empty())
throw std::bad_alloc();
}
@@ -78,18 +78,19 @@ debug_view_state::~debug_view_state()
void debug_view_state::enumerate_sources()
{
// start with an empty list
- m_source_list.reset();
+ m_source_list.clear();
// iterate over devices that have state interfaces
std::string name;
for (device_state_interface &state : state_interface_iterator(machine().root_device()))
{
name = string_format("%s '%s'", state.device().name(), state.device().tag());
- m_source_list.append(*global_alloc(debug_view_state_source(name.c_str(), state.device())));
+ m_source_list.emplace_back(std::make_unique<debug_view_state_source>(name.c_str(), state.device()));
}
// reset the source to a known good entry
- set_source(*m_source_list.first());
+ if (!m_source_list.empty())
+ set_source(*m_source_list[0]);
}
diff --git a/src/emu/debug/dvstate.h b/src/emu/debug/dvstate.h
index 8239a53f5db..80c3365b17e 100644
--- a/src/emu/debug/dvstate.h
+++ b/src/emu/debug/dvstate.h
@@ -25,8 +25,10 @@ class debug_view_state_source : public debug_view_source
{
friend class debug_view_state;
+public:
// construction/destruction
debug_view_state_source(const char *name, device_t &device);
+
private:
// internal state
device_state_interface *m_stateintf; // state interface
diff --git a/src/emu/debug/dvwpoints.cpp b/src/emu/debug/dvwpoints.cpp
index b0584b5d61c..c20332e46eb 100644
--- a/src/emu/debug/dvwpoints.cpp
+++ b/src/emu/debug/dvwpoints.cpp
@@ -113,7 +113,7 @@ debug_view_watchpoints::debug_view_watchpoints(running_machine &machine, debug_v
{
// fail if no available sources
enumerate_sources();
- if (m_source_list.count() == 0)
+ if (m_source_list.empty())
throw std::bad_alloc();
}
@@ -135,18 +135,19 @@ debug_view_watchpoints::~debug_view_watchpoints()
void debug_view_watchpoints::enumerate_sources()
{
// start with an empty list
- m_source_list.reset();
+ m_source_list.clear();
+ std::string name;
// iterate over devices with disassembly interfaces
for (device_disasm_interface &dasm : disasm_interface_iterator(machine().root_device()))
{
- std::string name;
name = string_format("%s '%s'", dasm.device().name(), dasm.device().tag());
- m_source_list.append(*global_alloc(debug_view_source(name.c_str(), &dasm.device())));
+ m_source_list.emplace_back(std::make_unique<debug_view_source>(name.c_str(), &dasm.device()));
}
// reset the source to a known good entry
- set_source(*m_source_list.first());
+ if (!m_source_list.empty())
+ set_source(*m_source_list[0]);
}
@@ -208,10 +209,10 @@ void debug_view_watchpoints::pad_ostream_to_length(std::ostream& str, int len)
void debug_view_watchpoints::gather_watchpoints()
{
m_buffer.resize(0);
- for (const debug_view_source &source : m_source_list)
+ for (auto &source : m_source_list)
{
// Collect
- device_debug &debugInterface = *source.device()->debug();
+ device_debug &debugInterface = *source->device()->debug();
for (int spacenum = 0; spacenum < debugInterface.watchpoint_space_count(); ++spacenum)
{
for (const auto &wp : debugInterface.watchpoint_vector(spacenum))
diff --git a/src/emu/debug/express.cpp b/src/emu/debug/express.cpp
index bcd9269db30..45fad747ab3 100644
--- a/src/emu/debug/express.cpp
+++ b/src/emu/debug/express.cpp
@@ -200,8 +200,7 @@ const char *expression_error::code_string() const
//-------------------------------------------------
symbol_entry::symbol_entry(symbol_table &table, symbol_type type, const char *name, const std::string &format)
- : m_next(nullptr),
- m_table(table),
+ : m_table(table),
m_type(type),
m_name(name),
m_format(format)
@@ -560,7 +559,7 @@ void parsed_expression::parse(const char *expression)
// copy the string and reset our parsing state
m_original_string.assign(expression);
m_tokenlist.reset();
- m_stringlist.reset();
+ m_stringlist.clear();
// first parse the tokens into the token array in order
parse_string_into_tokens();
@@ -1072,7 +1071,7 @@ void parsed_expression::parse_quoted_string(parse_token &token, const char *&str
string++;
// make the token
- token.configure_string(m_stringlist.append(*global_alloc(expression_string(buffer.c_str()))));
+ token.configure_string(m_stringlist.emplace(m_stringlist.end(), buffer.c_str())->c_str());
}
@@ -1089,7 +1088,7 @@ void parsed_expression::parse_memory_operator(parse_token &token, const char *st
const char *dot = strrchr(string, '.');
if (dot != nullptr)
{
- namestring = m_stringlist.append(*global_alloc(expression_string(string, dot - string)));
+ namestring = m_stringlist.emplace(m_stringlist.end(), string, dot)->c_str();
string = dot + 1;
}
diff --git a/src/emu/debug/express.h b/src/emu/debug/express.h
index ee5a500ad0e..a7147b5dd0f 100644
--- a/src/emu/debug/express.h
+++ b/src/emu/debug/express.h
@@ -17,6 +17,7 @@
#include <deque>
#include <functional>
+#include <list>
#include <unordered_map>
@@ -104,8 +105,6 @@ private:
// symbol_entry describes a symbol in a symbol table
class symbol_entry
{
- friend class simple_list<symbol_entry>;
-
protected:
// symbol types
enum symbol_type
@@ -120,7 +119,6 @@ public:
virtual ~symbol_entry();
// getters
- symbol_entry *next() const { return m_next; }
const char *name() const { return m_name.c_str(); }
const std::string &format() const { return m_format; }
@@ -134,7 +132,6 @@ public:
protected:
// internal state
- symbol_entry * m_next; // link to next entry
symbol_table & m_table; // pointer back to the owning table
symbol_type m_type; // type of symbol
std::string m_name; // name of the symbol
@@ -329,27 +326,6 @@ private:
symbol_entry * m_symbol; // symbol pointer
};
- // an expression_string holds an indexed string parsed from the expression
- class expression_string
- {
- friend class simple_list<expression_string>;
-
- public:
- // construction/destruction
- expression_string(const char *string, int length = 0)
- : m_next(nullptr),
- m_string(string, (length == 0) ? strlen(string) : length) { }
-
- // operators
- operator const char *() { return m_string.c_str(); }
- operator const char *() const { return m_string.c_str(); }
-
- private:
- // internal state
- expression_string * m_next; // next string in list
- std::string m_string; // copy of the string
- };
-
// internal helpers
void copy(const parsed_expression &src);
void print_tokens(FILE *out);
@@ -379,7 +355,7 @@ private:
symbol_table * m_symtable; // symbol table
std::string m_original_string; // original string (prior to parsing)
simple_list<parse_token> m_tokenlist; // token list
- simple_list<expression_string> m_stringlist; // string list
+ std::list<std::string> m_stringlist; // string list
std::deque<parse_token> m_token_stack; // token stack (used during execution)
};
diff --git a/src/emu/debug/textbuf.cpp b/src/emu/debug/textbuf.cpp
index 279ce8dead6..48a6f71c5fd 100644
--- a/src/emu/debug/textbuf.cpp
+++ b/src/emu/debug/textbuf.cpp
@@ -8,9 +8,10 @@
***************************************************************************/
-#include "corealloc.h"
#include "textbuf.h"
+#include <new>
+
/***************************************************************************
@@ -27,47 +28,53 @@
struct text_buffer
{
- char * buffer;
- s32 * lineoffs;
- s32 bufsize;
- s32 bufstart;
- s32 bufend;
- s32 linesize;
- s32 linestart;
- s32 lineend;
- u32 linestartseq;
- s32 maxwidth;
-};
-
-
-
-/***************************************************************************
- INLINE FUNCTIONS
-***************************************************************************/
-
-/*-------------------------------------------------
- buffer_used - return the number of bytes
- currently held in the buffer
--------------------------------------------------*/
-
-static inline s32 buffer_used(text_buffer *text)
-{
- s32 used = text->bufend - text->bufstart;
- if (used < 0)
- used += text->bufsize;
- return used;
-}
-
+ text_buffer(u32 bytes, u32 lines) noexcept
+ : buffer(new (std::nothrow) char [bytes])
+ , lineoffs(new (std::nothrow) s32 [lines])
+ , bufsize(buffer ? bytes : 0)
+ , linesize(lineoffs ? lines : 0)
+ {
+ }
+ ~text_buffer()
+ {
+ if (buffer)
+ delete [] buffer;
+ if (lineoffs)
+ delete [] lineoffs;
+ }
-/*-------------------------------------------------
- buffer_space - return the number of bytes
- available in the buffer
--------------------------------------------------*/
+ char *const buffer;
+ s32 *const lineoffs;
+ s32 const bufsize;
+ s32 bufstart = 0;
+ s32 bufend = 0;
+ s32 const linesize;
+ s32 linestart = 0;
+ s32 lineend = 0;
+ u32 linestartseq = 0;
+ s32 maxwidth = 0;
+
+ /*-------------------------------------------------
+ buffer_used - return the number of bytes
+ currently held in the buffer
+ -------------------------------------------------*/
+
+ s32 buffer_used() const noexcept
+ {
+ s32 const used(bufend - bufstart);
+ return (used < 0) ? (used + bufsize) : used;
+ }
-static inline s32 buffer_space(text_buffer *text)
-{
- return text->bufsize - buffer_used(text);
-}
+ /*-------------------------------------------------
+ buffer_space - return the number of bytes
+ available in the buffer
+ -------------------------------------------------*/
+
+ s32 buffer_space() const noexcept
+ {
+ return bufsize - buffer_used();
+ }
+};
@@ -83,33 +90,19 @@ static inline s32 buffer_space(text_buffer *text)
text_buffer *text_buffer_alloc(u32 bytes, u32 lines)
{
- text_buffer *text;
+ // allocate memory for the text buffer object
+ text_buffer *const text(new (std::nothrow) text_buffer(bytes, lines));
- /* allocate memory for the text buffer object */
- text = global_alloc_nothrow(text_buffer);
if (!text)
return nullptr;
- /* allocate memory for the buffer itself */
- text->buffer = global_alloc_array_nothrow(char, bytes);
- if (!text->buffer)
- {
- global_free(text);
- return nullptr;
- }
-
- /* allocate memory for the lines array */
- text->lineoffs = global_alloc_array_nothrow(s32, lines);
- if (!text->lineoffs)
+ if (!text->buffer || !text->lineoffs)
{
- global_free_array(text->buffer);
- global_free(text);
+ delete text;
return nullptr;
}
- /* initialize the buffer description */
- text->bufsize = bytes;
- text->linesize = lines;
+ // initialize the buffer description
text_buffer_clear(text);
return text;
@@ -123,11 +116,7 @@ text_buffer *text_buffer_alloc(u32 bytes, u32 lines)
void text_buffer_free(text_buffer *text)
{
- if (text->lineoffs)
- global_free_array(text->lineoffs);
- if (text->buffer)
- global_free_array(text->buffer);
- global_free(text);
+ delete text;
}
@@ -186,7 +175,7 @@ void text_buffer_print_wrap(text_buffer *text, const char *data, int wrapcol)
needed_space = s32(strlen(data)) + MAX_LINE_LENGTH;
/* make space in the buffer if we need to */
- while (buffer_space(text) < needed_space && text->linestart != text->lineend)
+ while (text->buffer_space() < needed_space && text->linestart != text->lineend)
{
text->linestartseq++;
if (++text->linestart >= text->linesize)
diff --git a/src/lib/util/corealloc.h b/src/lib/util/corealloc.h
index 12dea2fce67..222b1428307 100644
--- a/src/lib/util/corealloc.h
+++ b/src/lib/util/corealloc.h
@@ -32,9 +32,7 @@
// global allocation helpers -- use these instead of new and delete
#define global_alloc(Type) new Type
-#define global_alloc_nothrow(Type) new (std::nothrow) Type
#define global_alloc_array(Type, Num) new Type[Num]
-#define global_alloc_array_nothrow(Type, Num) new (std::nothrow) Type[Num]
#define global_free(Ptr) do { delete Ptr; } while (0)
#define global_free_array(Ptr) do { delete[] Ptr; } while (0)
diff --git a/src/lib/util/wavwrite.cpp b/src/lib/util/wavwrite.cpp
index 0667e9dcaff..93b4b0a6ca7 100644
--- a/src/lib/util/wavwrite.cpp
+++ b/src/lib/util/wavwrite.cpp
@@ -1,88 +1,91 @@
// license:BSD-3-Clause
// copyright-holders:Aaron Giles
-#include "osdcomm.h"
-#include "corealloc.h"
-#include <vector>
#include "wavwrite.h"
+#include "osdcomm.h"
+
+#include <cstdio>
+#include <new>
+#include <memory>
+
+
struct wav_file
{
- FILE *file;
- uint32_t total_offs;
- uint32_t data_offs;
+ FILE *file = nullptr;
+ std::uint32_t total_offs = 0U;
+ std::uint32_t data_offs = 0U;
};
wav_file *wav_open(const char *filename, int sample_rate, int channels)
{
- wav_file *wav;
- uint32_t bps, temp32;
- uint16_t align, temp16;
+ std::uint32_t temp32;
+ std::uint16_t temp16;
- /* allocate memory for the wav struct */
- wav = global_alloc_nothrow(wav_file);
+ // allocate memory for the wav struct
+ wav_file *const wav = new (std::nothrow) wav_file;
if (!wav)
return nullptr;
- /* create the file */
- wav->file = fopen(filename, "wb");
+ // create the file */
+ wav->file = std::fopen(filename, "wb");
if (!wav->file)
{
- global_free(wav);
+ delete wav;
return nullptr;
}
- /* write the 'RIFF' header */
- fwrite("RIFF", 1, 4, wav->file);
+ // write the 'RIFF' header
+ std::fwrite("RIFF", 1, 4, wav->file);
- /* write the total size */
+ // write the total size
temp32 = 0;
- wav->total_offs = ftell(wav->file);
- fwrite(&temp32, 1, 4, wav->file);
+ wav->total_offs = std::ftell(wav->file);
+ std::fwrite(&temp32, 1, 4, wav->file);
- /* write the 'WAVE' type */
- fwrite("WAVE", 1, 4, wav->file);
+ // write the 'WAVE' type
+ std::fwrite("WAVE", 1, 4, wav->file);
- /* write the 'fmt ' tag */
- fwrite("fmt ", 1, 4, wav->file);
+ // write the 'fmt ' tag
+ std::fwrite("fmt ", 1, 4, wav->file);
- /* write the format length */
+ // write the format length
temp32 = little_endianize_int32(16);
- fwrite(&temp32, 1, 4, wav->file);
+ std::fwrite(&temp32, 1, 4, wav->file);
- /* write the format (PCM) */
+ // write the format (PCM)
temp16 = little_endianize_int16(1);
- fwrite(&temp16, 1, 2, wav->file);
+ std::fwrite(&temp16, 1, 2, wav->file);
- /* write the channels */
+ // write the channels
temp16 = little_endianize_int16(channels);
- fwrite(&temp16, 1, 2, wav->file);
+ std::fwrite(&temp16, 1, 2, wav->file);
- /* write the sample rate */
+ // write the sample rate
temp32 = little_endianize_int32(sample_rate);
- fwrite(&temp32, 1, 4, wav->file);
+ std::fwrite(&temp32, 1, 4, wav->file);
- /* write the bytes/second */
- bps = sample_rate * 2 * channels;
+ // write the bytes/second
+ std::uint32_t const bps = sample_rate * 2 * channels;
temp32 = little_endianize_int32(bps);
- fwrite(&temp32, 1, 4, wav->file);
+ std::fwrite(&temp32, 1, 4, wav->file);
- /* write the block align */
- align = 2 * channels;
+ // write the block align
+ std::uint16_t const align = 2 * channels;
temp16 = little_endianize_int16(align);
- fwrite(&temp16, 1, 2, wav->file);
+ std::fwrite(&temp16, 1, 2, wav->file);
- /* write the bits/sample */
+ // write the bits/sample
temp16 = little_endianize_int16(16);
- fwrite(&temp16, 1, 2, wav->file);
+ std::fwrite(&temp16, 1, 2, wav->file);
- /* write the 'data' tag */
- fwrite("data", 1, 4, wav->file);
+ // write the 'data' tag
+ std::fwrite("data", 1, 4, wav->file);
- /* write the data length */
+ // write the data length
temp32 = 0;
- wav->data_offs = ftell(wav->file);
- fwrite(&temp32, 1, 4, wav->file);
+ wav->data_offs = std::ftell(wav->file);
+ std::fwrite(&temp32, 1, 4, wav->file);
return wav;
}
@@ -90,102 +93,96 @@ wav_file *wav_open(const char *filename, int sample_rate, int channels)
void wav_close(wav_file *wav)
{
- uint32_t total;
- uint32_t temp32;
-
- if (!wav) return;
+ if (!wav)
+ return;
- total = ftell(wav->file);
+ std::uint32_t temp32;
+ std::uint32_t const total = std::ftell(wav->file);
- /* update the total file size */
- fseek(wav->file, wav->total_offs, SEEK_SET);
+ // update the total file size
+ std::fseek(wav->file, wav->total_offs, SEEK_SET);
temp32 = total - (wav->total_offs + 4);
temp32 = little_endianize_int32(temp32);
- fwrite(&temp32, 1, 4, wav->file);
+ std::fwrite(&temp32, 1, 4, wav->file);
- /* update the data size */
- fseek(wav->file, wav->data_offs, SEEK_SET);
+ // update the data size
+ std::fseek(wav->file, wav->data_offs, SEEK_SET);
temp32 = total - (wav->data_offs + 4);
temp32 = little_endianize_int32(temp32);
- fwrite(&temp32, 1, 4, wav->file);
+ std::fwrite(&temp32, 1, 4, wav->file);
- fclose(wav->file);
- global_free(wav);
+ std::fclose(wav->file);
+ delete wav;
}
void wav_add_data_16(wav_file *wav, int16_t *data, int samples)
{
- if (!wav) return;
+ if (!wav)
+ return;
- /* just write and flush the data */
- fwrite(data, 2, samples, wav->file);
- fflush(wav->file);
+ // just write and flush the data
+ std::fwrite(data, 2, samples, wav->file);
+ std::fflush(wav->file);
}
void wav_add_data_32(wav_file *wav, int32_t *data, int samples, int shift)
{
- std::vector<int16_t> temp;
- int i;
-
- if (!wav || !samples) return;
+ if (!wav || !samples)
+ return;
- /* resize dynamic array */
- temp.resize(samples);
+ // resize dynamic array
+ std::unique_ptr<int16_t []> temp(new int16_t [samples]);
- /* clamp */
- for (i = 0; i < samples; i++)
+ // clamp
+ for (int i = 0; i < samples; i++)
{
int val = data[i] >> shift;
temp[i] = (val < -32768) ? -32768 : (val > 32767) ? 32767 : val;
}
- /* write and flush */
- fwrite(&temp[0], 2, samples, wav->file);
- fflush(wav->file);
+ // write and flush
+ std::fwrite(&temp[0], 2, samples, wav->file);
+ std::fflush(wav->file);
}
void wav_add_data_16lr(wav_file *wav, int16_t *left, int16_t *right, int samples)
{
- std::vector<int16_t> temp;
- int i;
+ if (!wav || !samples)
+ return;
- if (!wav || !samples) return;
+ // resize dynamic array
+ std::unique_ptr<int16_t []> temp(new int16_t [samples * 2]);
- /* resize dynamic array */
- temp.resize(samples * 2);
-
- /* interleave */
- for (i = 0; i < samples * 2; i++)
+ // interleave
+ for (int i = 0; i < samples * 2; i++)
temp[i] = (i & 1) ? right[i / 2] : left[i / 2];
- /* write and flush */
- fwrite(&temp[0], 4, samples, wav->file);
- fflush(wav->file);
+ // write and flush
+ std::fwrite(&temp[0], 4, samples, wav->file);
+ std::fflush(wav->file);
}
void wav_add_data_32lr(wav_file *wav, int32_t *left, int32_t *right, int samples, int shift)
{
- std::vector<int16_t> temp;
- int i;
-
- if (!wav || !samples) return;
+ if (!wav || !samples)
+ return;
- /* resize dynamic array */
- temp.resize(samples);
+ // resize dynamic array
+ std::unique_ptr<int16_t []> temp(new int16_t [samples * 2]);
- /* interleave */
- for (i = 0; i < samples * 2; i++)
+ // interleave
+ for (int i = 0; i < samples * 2; i++)
{
int val = (i & 1) ? right[i / 2] : left[i / 2];
val >>= shift;
temp[i] = (val < -32768) ? -32768 : (val > 32767) ? 32767 : val;
}
- /* write and flush */
- fwrite(&temp[0], 4, samples, wav->file);
- fflush(wav->file);
+ // write and flush
+ std::fwrite(&temp[0], 4, samples, wav->file);
+ std::fflush(wav->file);
}
diff --git a/src/lib/util/wavwrite.h b/src/lib/util/wavwrite.h
index 8ceb6ad2a0d..cdf6f4d0d78 100644
--- a/src/lib/util/wavwrite.h
+++ b/src/lib/util/wavwrite.h
@@ -5,14 +5,17 @@
#pragma once
+#include <cstdint>
+
+
struct wav_file;
wav_file *wav_open(const char *filename, int sample_rate, int channels);
-void wav_close(wav_file*wavptr);
+void wav_close(wav_file *wavptr);
-void wav_add_data_16(wav_file *wavptr, int16_t *data, int samples);
-void wav_add_data_32(wav_file *wavptr, int32_t *data, int samples, int shift);
-void wav_add_data_16lr(wav_file *wavptr, int16_t *left, int16_t *right, int samples);
-void wav_add_data_32lr(wav_file *wavptr, int32_t *left, int32_t *right, int samples, int shift);
+void wav_add_data_16(wav_file *wavptr, std::int16_t *data, int samples);
+void wav_add_data_32(wav_file *wavptr, std::int32_t *data, int samples, int shift);
+void wav_add_data_16lr(wav_file *wavptr, std::int16_t *left, std::int16_t *right, int samples);
+void wav_add_data_32lr(wav_file *wavptr, std::int32_t *left, std::int32_t *right, int samples, int shift);
#endif // MAME_UTIL_WAVWRITE_H
diff --git a/src/osd/modules/debugger/debugimgui.cpp b/src/osd/modules/debugger/debugimgui.cpp
index 39dcb3310cf..487ad42ecc5 100644
--- a/src/osd/modules/debugger/debugimgui.cpp
+++ b/src/osd/modules/debugger/debugimgui.cpp
@@ -262,7 +262,7 @@ static inline void map_attr_to_fg_bg(unsigned char attr, rgb_t *fg, rgb_t *bg)
bool debug_imgui::get_view_source(void* data, int idx, const char** out_text)
{
debug_view* vw = static_cast<debug_view*>(data);
- *out_text = vw->source_list().find(idx)->name();
+ *out_text = vw->source(idx)->name();
return true;
}
@@ -754,13 +754,9 @@ void debug_imgui::add_log(int id)
void debug_imgui::draw_disasm(debug_area* view_ptr, bool* opened)
{
- const debug_view_source* src;
-
ImGui::SetNextWindowSize(ImVec2(view_ptr->width,view_ptr->height + ImGui::GetTextLineHeight()),ImGuiCond_Once);
if(ImGui::Begin(view_ptr->title.c_str(),opened,ImGuiWindowFlags_MenuBar))
{
- int idx;
- bool done = false;
bool exp_change = false;
view_ptr->is_collapsed = false;
@@ -788,7 +784,7 @@ void debug_imgui::draw_disasm(debug_area* view_ptr, bool* opened)
ImGuiInputTextFlags flags = ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_AutoSelectAll;
if(m_running)
flags |= ImGuiInputTextFlags_ReadOnly;
- ImGui::Combo("##cpu",&view_ptr->src_sel,get_view_source,view_ptr->view,view_ptr->view->source_list().count());
+ ImGui::Combo("##cpu",&view_ptr->src_sel,get_view_source,view_ptr->view,view_ptr->view->source_count());
ImGui::SameLine();
ImGui::PushItemWidth(-1.0f);
if(ImGui::InputText("##addr",view_ptr->console_input,512,flags))
@@ -800,17 +796,15 @@ void debug_imgui::draw_disasm(debug_area* view_ptr, bool* opened)
ImGui::Separator();
// disassembly portion
- src = view_ptr->view->first_source();
- idx = 0;
- while (!done)
+ unsigned idx = 0;
+ const debug_view_source* src = view_ptr->view->source(idx);
+ do
{
if(view_ptr->src_sel == idx)
view_ptr->view->set_source(*src);
- idx++;
- src = src->next();
- if(src == nullptr)
- done = true;
+ src = view_ptr->view->source(++idx);
}
+ while (src);
ImGui::BeginChild("##disasm_output", ImVec2(ImGui::GetWindowWidth() - 16,ImGui::GetWindowHeight() - ImGui::GetTextLineHeight() - ImGui::GetCursorPosY())); // account for title bar and widgets already drawn
draw_view(view_ptr,exp_change);
@@ -841,13 +835,9 @@ void debug_imgui::add_disasm(int id)
void debug_imgui::draw_memory(debug_area* view_ptr, bool* opened)
{
- const debug_view_source* src;
-
ImGui::SetNextWindowSize(ImVec2(view_ptr->width,view_ptr->height + ImGui::GetTextLineHeight()),ImGuiCond_Once);
if(ImGui::Begin(view_ptr->title.c_str(),opened,ImGuiWindowFlags_MenuBar))
{
- int idx;
- bool done = false;
bool exp_change = false;
view_ptr->is_collapsed = false;
@@ -906,22 +896,20 @@ void debug_imgui::draw_memory(debug_area* view_ptr, bool* opened)
ImGui::PopItemWidth();
ImGui::SameLine();
ImGui::PushItemWidth(-1.0f);
- ImGui::Combo("##region",&view_ptr->src_sel,get_view_source,view_ptr->view,view_ptr->view->source_list().count());
+ ImGui::Combo("##region",&view_ptr->src_sel,get_view_source,view_ptr->view,view_ptr->view->source_count());
ImGui::PopItemWidth();
ImGui::Separator();
// memory editor portion
- src = view_ptr->view->first_source();
- idx = 0;
- while (!done)
+ unsigned idx = 0;
+ const debug_view_source* src = view_ptr->view->source(idx);
+ do
{
if(view_ptr->src_sel == idx)
view_ptr->view->set_source(*src);
- idx++;
- src = src->next();
- if(src == nullptr)
- done = true;
+ src = view_ptr->view->source(++idx);
}
+ while (src);
ImGui::BeginChild("##memory_output", ImVec2(ImGui::GetWindowWidth() - 16,ImGui::GetWindowHeight() - ImGui::GetTextLineHeight() - ImGui::GetCursorPosY())); // account for title bar and widgets already drawn
draw_view(view_ptr,exp_change);
diff --git a/src/osd/modules/debugger/osx/disassemblyview.mm b/src/osd/modules/debugger/osx/disassemblyview.mm
index 99bdc485147..f958d793b47 100644
--- a/src/osd/modules/debugger/osx/disassemblyview.mm
+++ b/src/osd/modules/debugger/osx/disassemblyview.mm
@@ -118,16 +118,16 @@
- (int)selectedSubviewIndex {
const debug_view_source *source = view->source();
if (source != nullptr)
- return view->source_list().indexof(*source);
+ return view->source_index(*source);
else
return -1;
}
- (void)selectSubviewAtIndex:(int)index {
- const int selected = view->source_list().indexof(*view->source());
+ const int selected = view->source_index(*view->source());
if (selected != index) {
- view->set_source(*view->source_list().find(index));
+ view->set_source(*view->source(index));
if ([[self window] firstResponder] != self)
view->set_cursor_visible(false);
}
@@ -256,12 +256,12 @@
- (void)insertSubviewItemsInMenu:(NSMenu *)menu atIndex:(NSInteger)index {
- for (const debug_view_source *source = view->source_list().first(); source != nullptr; source = source->next())
+ for (auto &source : view->source_list())
{
[[menu insertItemWithTitle:[NSString stringWithUTF8String:source->name()]
action:NULL
keyEquivalent:@""
- atIndex:index++] setTag:view->source_list().indexof(*source)];
+ atIndex:index++] setTag:view->source_index(*source)];
}
if (index < [menu numberOfItems])
[menu insertItem:[NSMenuItem separatorItem] atIndex:index++];
diff --git a/src/osd/modules/debugger/osx/memoryview.mm b/src/osd/modules/debugger/osx/memoryview.mm
index b2c512d094b..594e32e0fd7 100644
--- a/src/osd/modules/debugger/osx/memoryview.mm
+++ b/src/osd/modules/debugger/osx/memoryview.mm
@@ -101,17 +101,17 @@
- (int)selectedSubviewIndex {
debug_view_source const *source = view->source();
if (source != nullptr)
- return view->source_list().indexof(*source);
+ return view->source_index(*source);
else
return -1;
}
- (void)selectSubviewAtIndex:(int)index {
- int const selected = view->source_list().indexof(*view->source());
+ int const selected = view->source_index(*view->source());
if (selected != index)
{
- view->set_source(*view->source_list().find(index));
+ view->set_source(*view->source(index));
if ([[self window] firstResponder] != self)
view->set_cursor_visible(false);
}
@@ -299,12 +299,12 @@
- (void)insertSubviewItemsInMenu:(NSMenu *)menu atIndex:(NSInteger)index {
- for (const debug_view_source *source = view->source_list().first(); source != nullptr; source = source->next())
+ for (auto &source : view->source_list())
{
[[menu insertItemWithTitle:[NSString stringWithUTF8String:source->name()]
action:NULL
keyEquivalent:@""
- atIndex:index++] setTag:view->source_list().indexof(*source)];
+ atIndex:index++] setTag:view->source_index(*source)];
}
if (index < [menu numberOfItems])
[menu insertItem:[NSMenuItem separatorItem] atIndex:index++];
diff --git a/src/osd/modules/debugger/osx/registersview.mm b/src/osd/modules/debugger/osx/registersview.mm
index 5c3e00a2b89..ae202fa488e 100644
--- a/src/osd/modules/debugger/osx/registersview.mm
+++ b/src/osd/modules/debugger/osx/registersview.mm
@@ -34,7 +34,7 @@
const debug_view_source *source = view->source_for_device(curcpu);
max.x = max.y = 0;
- for (const debug_view_source *source = view->source_list().first(); source != nullptr; source = source->next())
+ for (auto &source : view->source_list())
{
debug_view_xy current;
view->set_source(*source);
diff --git a/src/osd/modules/debugger/qt/dasmwindow.cpp b/src/osd/modules/debugger/qt/dasmwindow.cpp
index 5c575b400b1..04cbd523cdd 100644
--- a/src/osd/modules/debugger/qt/dasmwindow.cpp
+++ b/src/osd/modules/debugger/qt/dasmwindow.cpp
@@ -52,9 +52,7 @@ DasmWindow::DasmWindow(running_machine* machine, QWidget* parent) :
// Populate the combo box & set the proper cpu
populateComboBox();
- //const debug_view_source *source = mem->views[0]->view->source_for_device(curcpu);
- //gtk_combo_box_set_active(zone_w, mem->views[0]->view->source_list().indexof(*source));
- //mem->views[0]->view->set_source(*source);
+ setToCurrentCpu();
// Layout
@@ -121,7 +119,7 @@ DasmWindow::~DasmWindow()
void DasmWindow::cpuChanged(int index)
{
- m_dasmView->view()->set_source(*m_dasmView->view()->source_list().find(index));
+ m_dasmView->view()->set_source(*m_dasmView->view()->source(index));
m_dasmView->viewport()->update();
}
@@ -253,9 +251,24 @@ void DasmWindow::populateComboBox()
return;
m_cpuComboBox->clear();
- for (const debug_view_source &source : m_dasmView->view()->source_list())
+ for (auto &source : m_dasmView->view()->source_list())
{
- m_cpuComboBox->addItem(source.name());
+ m_cpuComboBox->addItem(source->name());
+ }
+}
+
+
+void DasmWindow::setToCurrentCpu()
+{
+ device_t* curCpu = m_machine->debugger().cpu().get_visible_cpu();
+ if (curCpu)
+ {
+ const debug_view_source *source = m_dasmView->view()->source_for_device(curCpu);
+ if (source)
+ {
+ const int listIndex = m_dasmView->view()->source_index(*source);
+ m_cpuComboBox->setCurrentIndex(listIndex);
+ }
}
}
diff --git a/src/osd/modules/debugger/qt/dasmwindow.h b/src/osd/modules/debugger/qt/dasmwindow.h
index 27b652c04e8..9b73fed4534 100644
--- a/src/osd/modules/debugger/qt/dasmwindow.h
+++ b/src/osd/modules/debugger/qt/dasmwindow.h
@@ -36,6 +36,7 @@ private slots:
private:
void populateComboBox();
+ void setToCurrentCpu();
// Widgets
diff --git a/src/osd/modules/debugger/qt/memorywindow.cpp b/src/osd/modules/debugger/qt/memorywindow.cpp
index c799ab66c65..6c95e04df80 100644
--- a/src/osd/modules/debugger/qt/memorywindow.cpp
+++ b/src/osd/modules/debugger/qt/memorywindow.cpp
@@ -166,7 +166,7 @@ MemoryWindow::~MemoryWindow()
void MemoryWindow::memoryRegionChanged(int index)
{
- m_memTable->view()->set_source(*m_memTable->view()->source_list().find(index));
+ m_memTable->view()->set_source(*m_memTable->view()->source(index));
m_memTable->viewport()->update();
// Update the data format radio buttons to the memory region's default
@@ -283,9 +283,9 @@ void MemoryWindow::populateComboBox()
return;
m_memoryComboBox->clear();
- for (const debug_view_source &source : m_memTable->view()->source_list())
+ for (auto &source : m_memTable->view()->source_list())
{
- m_memoryComboBox->addItem(source.name());
+ m_memoryComboBox->addItem(source->name());
}
}
@@ -293,9 +293,15 @@ void MemoryWindow::populateComboBox()
void MemoryWindow::setToCurrentCpu()
{
device_t* curCpu = m_machine->debugger().cpu().get_visible_cpu();
- const debug_view_source *source = m_memTable->view()->source_for_device(curCpu);
- const int listIndex = m_memTable->view()->source_list().indexof(*source);
- m_memoryComboBox->setCurrentIndex(listIndex);
+ if (curCpu)
+ {
+ const debug_view_source *source = m_memTable->view()->source_for_device(curCpu);
+ if (source)
+ {
+ const int listIndex = m_memTable->view()->source_index(*source);
+ m_memoryComboBox->setCurrentIndex(listIndex);
+ }
+ }
}
diff --git a/src/osd/modules/debugger/win/consolewininfo.h b/src/osd/modules/debugger/win/consolewininfo.h
index 7f8ccc13aec..e391100ed33 100644
--- a/src/osd/modules/debugger/win/consolewininfo.h
+++ b/src/osd/modules/debugger/win/consolewininfo.h
@@ -5,9 +5,10 @@
// consolewininfo.h - Win32 debug window handling
//
//============================================================
+#ifndef MAME_DEBUGGER_WIN_CONSOLEWININFO_H
+#define MAME_DEBUGGER_WIN_CONSOLEWININFO_H
-#ifndef __DEBUG_WIN_CONSOLE_WIN_INFO_H__
-#define __DEBUG_WIN_CONSOLE_WIN_INFO_H__
+#pragma once
#include "debugwin.h"
diff --git a/src/osd/modules/debugger/win/debugbaseinfo.h b/src/osd/modules/debugger/win/debugbaseinfo.h
index 03fd5a8018d..15f4b845e7c 100644
--- a/src/osd/modules/debugger/win/debugbaseinfo.h
+++ b/src/osd/modules/debugger/win/debugbaseinfo.h
@@ -5,14 +5,14 @@
// debugbaseinfo.h - Win32 debug window handling
//
//============================================================
+#ifndef MAME_DEBUGGER_WIN_DEBUGBASEINFO_H
+#define MAME_DEBUGGER_WIN_DEBUGBASEINFO_H
-#ifndef __DEBUG_WIN_DEBUG_BASE_INFO_H__
-#define __DEBUG_WIN_DEBUG_BASE_INFO_H__
+#pragma once
#include "debugwin.h"
-
class debugbase_info
{
protected:
@@ -35,5 +35,4 @@ private:
bool const &m_waiting_for_debugger;
};
-
#endif
diff --git a/src/osd/modules/debugger/win/debugviewinfo.cpp b/src/osd/modules/debugger/win/debugviewinfo.cpp
index 97238ff8862..686bd89bb2d 100644
--- a/src/osd/modules/debugger/win/debugviewinfo.cpp
+++ b/src/osd/modules/debugger/win/debugviewinfo.cpp
@@ -111,9 +111,9 @@ uint32_t debugview_info::maxwidth()
{
uint32_t max = m_view->total_size().x;
debug_view_source const *const cursource = m_view->source();
- for (const debug_view_source &source : m_view->source_list())
+ for (auto &source : m_view->source_list())
{
- m_view->set_source(source);
+ m_view->set_source(*source);
uint32_t const chars = m_view->total_size().x;
if (max < chars)
max = chars;
@@ -217,7 +217,7 @@ bool debugview_info::set_source_index(int index)
{
if (m_view != nullptr)
{
- const debug_view_source *const source = m_view->source_list().find(index);
+ const debug_view_source *const source = m_view->source(index);
if (source != nullptr)
{
m_view->set_source(*source);
@@ -274,7 +274,7 @@ HWND debugview_info::create_source_combobox(HWND parent, LONG_PTR userdata)
}
if (cursource != nullptr)
{
- SendMessage(result, CB_SETCURSEL, m_view->source_list().indexof(*cursource), 0);
+ SendMessage(result, CB_SETCURSEL, m_view->source_index(*cursource), 0);
SendMessage(result, CB_SETDROPPEDWIDTH, ((maxlength + 2) * metrics().debug_font_width()) + metrics().vscroll_width(), 0);
m_view->set_source(*cursource);
}
diff --git a/src/osd/modules/debugger/win/debugviewinfo.h b/src/osd/modules/debugger/win/debugviewinfo.h
index 37d6930e445..fd48c7975bf 100644
--- a/src/osd/modules/debugger/win/debugviewinfo.h
+++ b/src/osd/modules/debugger/win/debugviewinfo.h
@@ -5,9 +5,10 @@
// debugviewinfo.h - Win32 debug window handling
//
//============================================================
+#ifndef MAME_DEBUGGER_WIN_DEBUGVIEWINFO_H
+#define MAME_DEBUGGER_WIN_DEBUGVIEWINFO_H
-#ifndef __DEBUG_WIN_DEBUG_VIEW_INFO_H__
-#define __DEBUG_WIN_DEBUG_VIEW_INFO_H__
+#pragma once
#include "debugwin.h"
diff --git a/src/osd/modules/debugger/win/debugwin.h b/src/osd/modules/debugger/win/debugwin.h
index ea78f126d5b..e999b87334f 100644
--- a/src/osd/modules/debugger/win/debugwin.h
+++ b/src/osd/modules/debugger/win/debugwin.h
@@ -5,9 +5,10 @@
// debugwin.h - Win32 debug window handling
//
//============================================================
+#ifndef MAME_DEBUGGER_WIN_DEBUGWIN_H
+#define MAME_DEBUGGER_WIN_DEBUGWIN_H
-#ifndef __DEBUG_WIN_DEBUG_WIN_H__
-#define __DEBUG_WIN_DEBUG_WIN_H__
+#pragma once
// standard windows headers
#include <windows.h>
@@ -19,7 +20,6 @@
#endif
-
class debugview_info;
class debugwin_info;
class ui_metrics;
diff --git a/src/osd/modules/debugger/win/debugwininfo.h b/src/osd/modules/debugger/win/debugwininfo.h
index 2090985d3f9..b930189fffa 100644
--- a/src/osd/modules/debugger/win/debugwininfo.h
+++ b/src/osd/modules/debugger/win/debugwininfo.h
@@ -5,16 +5,16 @@
// debugwininfo.h - Win32 debug window handling
//
//============================================================
+#ifndef MAME_DEBUGGER_WIN_DEBUGWININFO_H
+#define MAME_DEBUGGER_WIN_DEBUGWININFO_H
-#ifndef __DEBUG_WIN_DEBUG_WIN_INFO_H__
-#define __DEBUG_WIN_DEBUG_WIN_INFO_H__
+#pragma once
#include "debugwin.h"
#include "debugbaseinfo.h"
-
class debugwin_info : protected debugbase_info
{
public:
diff --git a/src/osd/modules/debugger/win/disasmbasewininfo.h b/src/osd/modules/debugger/win/disasmbasewininfo.h
index 26cd481b7f6..c22f7f08e78 100644
--- a/src/osd/modules/debugger/win/disasmbasewininfo.h
+++ b/src/osd/modules/debugger/win/disasmbasewininfo.h
@@ -5,9 +5,10 @@
// disasmbasewininfo.h - Win32 debug window handling
//
//============================================================
+#ifndef MAME_DEBUGGER_WIN_DISASMBASEWININFO_H
+#define MAME_DEBUGGER_WIN_DISASMBASEWININFO_H
-#ifndef __DEBUG_WIN_DISASM_BASE_WIN_INFO_H__
-#define __DEBUG_WIN_DISASM_BASE_WIN_INFO_H__
+#pragma once
#include "debugwin.h"
@@ -27,4 +28,4 @@ protected:
virtual bool handle_command(WPARAM wparam, LPARAM lparam) override;
};
-#endif
+#endif // MAME_DEBUGGER_WIN_DISASMBASEWININFO_H
diff --git a/src/osd/modules/debugger/win/disasmviewinfo.h b/src/osd/modules/debugger/win/disasmviewinfo.h
index d1e7090ef2f..a032475af7f 100644
--- a/src/osd/modules/debugger/win/disasmviewinfo.h
+++ b/src/osd/modules/debugger/win/disasmviewinfo.h
@@ -5,9 +5,10 @@
// disasmviewinfo.h - Win32 debug window handling
//
//============================================================
+#ifndef MAME_DEBUGGER_WIN_DISASMVIEWINFO_H
+#define MAME_DEBUGGER_WIN_DISASMVIEWINFO_H
-#ifndef __DEBUG_WIN_DISASM_VIEW_INFO_H__
-#define __DEBUG_WIN_DISASM_VIEW_INFO_H__
+#pragma once
#include "debugwin.h"
diff --git a/src/osd/modules/debugger/win/disasmwininfo.h b/src/osd/modules/debugger/win/disasmwininfo.h
index 34e8275f2f9..71764bab0ef 100644
--- a/src/osd/modules/debugger/win/disasmwininfo.h
+++ b/src/osd/modules/debugger/win/disasmwininfo.h
@@ -5,9 +5,10 @@
// disasmwininfo.h - Win32 debug window handling
//
//============================================================
+#ifndef MAME_DEBUGGER_WIN_DISASMWININFO_H
+#define MAME_DEBUGGER_WIN_DISASMWININFO_H
-#ifndef __DEBUG_WIN_DISASM_WIN_INFO_H__
-#define __DEBUG_WIN_DISASM_WIN_INFO_H__
+#pragma once
#include "debugwin.h"
diff --git a/src/osd/modules/debugger/win/editwininfo.h b/src/osd/modules/debugger/win/editwininfo.h
index 1aaee55f1e9..2156d8ba68d 100644
--- a/src/osd/modules/debugger/win/editwininfo.h
+++ b/src/osd/modules/debugger/win/editwininfo.h
@@ -5,9 +5,10 @@
// editwininfo.h - Win32 debug window handling
//
//============================================================
+#ifndef MAME_DEBUGGER_WIN_EDITWININFO_H
+#define MAME_DEBUGGER_WIN_EDITWININFO_H
-#ifndef MAME_DEBUG_WIN_EDIT_WIN_INFO_H
-#define MAME_DEBUG_WIN_EDIT_WIN_INFO_H
+#pragma once
#include "debugwin.h"
diff --git a/src/osd/modules/debugger/win/logviewinfo.h b/src/osd/modules/debugger/win/logviewinfo.h
index da598038864..e2fa9d31643 100644
--- a/src/osd/modules/debugger/win/logviewinfo.h
+++ b/src/osd/modules/debugger/win/logviewinfo.h
@@ -5,9 +5,10 @@
// logviewinfo.h - Win32 debug log window handling
//
//============================================================
+#ifndef MAME_DEBUGGER_WIN_LOGVIEWINFO_H
+#define MAME_DEBUGGER_WIN_LOGVIEWINFO_H
-#ifndef __DEBUG_WIN_LOG_VIEW_INFO_H__
-#define __DEBUG_WIN_LOG_VIEW_INFO_H__
+#pragma once
#include "debugwin.h"
diff --git a/src/osd/modules/debugger/win/logwininfo.h b/src/osd/modules/debugger/win/logwininfo.h
index a816b6f3da3..b40d184485e 100644
--- a/src/osd/modules/debugger/win/logwininfo.h
+++ b/src/osd/modules/debugger/win/logwininfo.h
@@ -5,9 +5,10 @@
// logwininfo.h - Win32 debug window handling
//
//============================================================
+#ifndef MAME_DEBUGGER_WIN_LOGWININFO_H
+#define MAME_DEBUGGER_WIN_LOGWININFO_H
-#ifndef __DEBUG_WIN_LOG_WIN_INFO_H__
-#define __DEBUG_WIN_LOG_WIN_INFO_H__
+#pragma once
#include "debugwin.h"
diff --git a/src/osd/modules/debugger/win/memoryviewinfo.h b/src/osd/modules/debugger/win/memoryviewinfo.h
index 2ab810654f3..a897698f0bd 100644
--- a/src/osd/modules/debugger/win/memoryviewinfo.h
+++ b/src/osd/modules/debugger/win/memoryviewinfo.h
@@ -5,9 +5,10 @@
// memoryviewinfo.h - Win32 debug window handling
//
//============================================================
+#ifndef MAME_DEBUGGER_WIN_MEMORYVIEWINFO_H
+#define MAME_DEBUGGER_WIN_MEMORYVIEWINFO_H
-#ifndef __DEBUG_WIN_MEMORY_VIEW_INFO_H__
-#define __DEBUG_WIN_MEMORY_VIEW_INFO_H__
+#pragma once
#include "debugwin.h"
diff --git a/src/osd/modules/debugger/win/memorywininfo.h b/src/osd/modules/debugger/win/memorywininfo.h
index 501d7acc76f..e0436605707 100644
--- a/src/osd/modules/debugger/win/memorywininfo.h
+++ b/src/osd/modules/debugger/win/memorywininfo.h
@@ -5,9 +5,10 @@
// memorywininfo.h - Win32 debug window handling
//
//============================================================
+#ifndef MAME_DEBUGGER_WIN_MEMORYWININFO_H
+#define MAME_DEBUGGER_WIN_MEMORYWININFO_H
-#ifndef __DEBUG_WIN_MEMORY_WIN_INFO_H__
-#define __DEBUG_WIN_MEMORY_WIN_INFO_H__
+#pragma once
#include "debugwin.h"
diff --git a/src/osd/modules/debugger/win/pointswininfo.h b/src/osd/modules/debugger/win/pointswininfo.h
index 8ba1b31fc00..4e36155105e 100644
--- a/src/osd/modules/debugger/win/pointswininfo.h
+++ b/src/osd/modules/debugger/win/pointswininfo.h
@@ -5,9 +5,10 @@
// pointswininfo.h - Win32 debug window handling
//
//============================================================
+#ifndef MAME_DEBUGGER_WIN_POINTSWININFO_H
+#define MAME_DEBUGGER_WIN_POINTSWININFO_H
-#ifndef __DEBUG_WIN_POINTS_WIN_INFO_H__
-#define __DEBUG_WIN_POINTS_WIN_INFO_H__
+#pragma once
#include "debugwin.h"
diff --git a/src/osd/modules/debugger/win/uimetrics.h b/src/osd/modules/debugger/win/uimetrics.h
index a360d66924e..2687ada036c 100644
--- a/src/osd/modules/debugger/win/uimetrics.h
+++ b/src/osd/modules/debugger/win/uimetrics.h
@@ -5,9 +5,10 @@
// uimetrics.h - Win32 debug window handling
//
//============================================================
+#ifndef MAME_DEBUGGER_WIN_UIMETRICS_H
+#define MAME_DEBUGGER_WIN_UIMETRICS_H
-#ifndef __DEBUG_WIN_UI_METRICS_H__
-#define __DEBUG_WIN_UI_METRICS_H__
+#pragma once
#include "debugwin.h"