mirror of
https://github.com/holub/mame
synced 2025-05-03 13:06:47 +03:00
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
This commit is contained in:
parent
1fbfa9e071
commit
88ce545cdd
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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; }
|
||||
|
||||
|
@ -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 ®ion : 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]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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 ®ion);
|
||||
debug_view_memory_source(const char *name, void *base, int element_size, int num_elements);
|
||||
|
||||
public:
|
||||
address_space *space() const { return m_space; }
|
||||
|
||||
private:
|
||||
|
@ -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]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
};
|
||||
|
||||
|
@ -8,9 +8,10 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "corealloc.h"
|
||||
#include "textbuf.h"
|
||||
|
||||
#include <new>
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
@ -27,50 +28,56 @@
|
||||
|
||||
struct text_buffer
|
||||
{
|
||||
char * buffer;
|
||||
s32 * lineoffs;
|
||||
s32 bufsize;
|
||||
s32 bufstart;
|
||||
s32 bufend;
|
||||
s32 linesize;
|
||||
s32 linestart;
|
||||
s32 lineend;
|
||||
u32 linestartseq;
|
||||
s32 maxwidth;
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
buffer_space - return the number of bytes
|
||||
available in the buffer
|
||||
-------------------------------------------------*/
|
||||
|
||||
s32 buffer_space() const noexcept
|
||||
{
|
||||
return bufsize - buffer_used();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
buffer_space - return the number of bytes
|
||||
available in the buffer
|
||||
-------------------------------------------------*/
|
||||
|
||||
static inline s32 buffer_space(text_buffer *text)
|
||||
{
|
||||
return text->bufsize - buffer_used(text);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Buffer object management
|
||||
@ -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)
|
||||
if (!text->buffer || !text->lineoffs)
|
||||
{
|
||||
global_free(text);
|
||||
delete text;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* allocate memory for the lines array */
|
||||
text->lineoffs = global_alloc_array_nothrow(s32, lines);
|
||||
if (!text->lineoffs)
|
||||
{
|
||||
global_free_array(text->buffer);
|
||||
global_free(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)
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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;
|
||||
std::uint32_t temp32;
|
||||
std::uint32_t const total = std::ftell(wav->file);
|
||||
|
||||
total = 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
|
||||
std::unique_ptr<int16_t []> temp(new int16_t [samples]);
|
||||
|
||||
/* resize dynamic array */
|
||||
temp.resize(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
|
||||
std::unique_ptr<int16_t []> temp(new int16_t [samples * 2]);
|
||||
|
||||
/* resize dynamic array */
|
||||
temp.resize(samples);
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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++];
|
||||
|
@ -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++];
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@ private slots:
|
||||
|
||||
private:
|
||||
void populateComboBox();
|
||||
void setToCurrentCpu();
|
||||
|
||||
|
||||
// Widgets
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user