diff options
author | 2021-08-16 14:04:29 -0400 | |
---|---|---|
committer | 2021-08-16 14:05:22 -0400 | |
commit | a77adf33c78b888f3d7ea9ac476f79c8717c7281 (patch) | |
tree | 1ebe37ef6390478a4935e9e35291fbed88a69cc2 | |
parent | f0e85a6e54f8c049509c2d5d9e7652564456c4a2 (diff) |
dvmemory: Substitute strongly typed enum for magic numbers specifying data format
-rw-r--r-- | src/emu/debug/dvmemory.cpp | 104 | ||||
-rw-r--r-- | src/emu/debug/dvmemory.h | 29 | ||||
-rw-r--r-- | src/osd/modules/debugger/debugimgui.cpp | 30 | ||||
-rw-r--r-- | src/osd/modules/debugger/osx/memoryview.mm | 63 | ||||
-rw-r--r-- | src/osd/modules/debugger/qt/memorywindow.cpp | 28 | ||||
-rw-r--r-- | src/osd/modules/debugger/win/memoryviewinfo.cpp | 6 | ||||
-rw-r--r-- | src/osd/modules/debugger/win/memoryviewinfo.h | 7 | ||||
-rw-r--r-- | src/osd/modules/debugger/win/memorywininfo.cpp | 14 |
8 files changed, 161 insertions, 120 deletions
diff --git a/src/emu/debug/dvmemory.cpp b/src/emu/debug/dvmemory.cpp index 3ae8008f0a2..299e4c1e439 100644 --- a/src/emu/debug/dvmemory.cpp +++ b/src/emu/debug/dvmemory.cpp @@ -25,22 +25,21 @@ const debug_view_memory::memory_view_pos debug_view_memory::s_memory_pos_table[12] = { - /* 0 bytes per chunk: */ { 0, { 0 } }, - /* 1 byte per chunk: 00 11 22 33 44 55 66 77 */ { 3, { 0x04, 0x00, 0x80 } }, - /* 2 bytes per chunk: 0011 2233 4455 6677 */ { 6, { 0x8c, 0x0c, 0x08, 0x04, 0x00, 0x80 } }, - /* 3 bytes per chunk: */ { 0, { 0 } }, - /* 4 bytes per chunk: 00112233 44556677 */ { 12, { 0x9c, 0x9c, 0x1c, 0x18, 0x14, 0x10, 0x0c, 0x08, 0x04, 0x00, 0x80, 0x80 } }, - /* 5 bytes per chunk: */ { 0, { 0 } }, - /* 6 bytes per chunk: */ { 0, { 0 } }, - /* 7 bytes per chunk: */ { 0, { 0 } }, - /* 8 bytes per chunk: 0011223344556677 */ { 24, { 0xbc, 0xbc, 0xbc, 0xbc, 0x3c, 0x38, 0x34, 0x30, 0x2c, 0x28, 0x24, 0x20, 0x1c, 0x18, 0x14, 0x10, 0x0c, 0x08, 0x04, 0x00, 0x80, 0x80, 0x80, 0x80 } }, - /* 32 bit floating point: */ { 16, { 0 } }, - /* 64 bit floating point: */ { 32, { 0 } }, - /* 80 bit floating point: */ { 32, { 0 } }, + /* 0 bytes per chunk: */ { 0, 0, { 0 } }, + /* 1 byte per chunk: 00 11 22 33 44 55 66 77 */ { 1, 3, { 0x04, 0x00, 0x80 } }, + /* 2 bytes per chunk: 0011 2233 4455 6677 */ { 2, 6, { 0x8c, 0x0c, 0x08, 0x04, 0x00, 0x80 } }, + /* 3 bytes per chunk: */ { 0, 0, { 0 } }, + /* 4 bytes per chunk: 00112233 44556677 */ { 4, 12, { 0x9c, 0x9c, 0x1c, 0x18, 0x14, 0x10, 0x0c, 0x08, 0x04, 0x00, 0x80, 0x80 } }, + /* 5 bytes per chunk: */ { 0, 0, { 0 } }, + /* 6 bytes per chunk: */ { 0, 0, { 0 } }, + /* 7 bytes per chunk: */ { 0, 0, { 0 } }, + /* 8 bytes per chunk: 0011223344556677 */ { 8, 24, { 0xbc, 0xbc, 0xbc, 0xbc, 0x3c, 0x38, 0x34, 0x30, 0x2c, 0x28, 0x24, 0x20, 0x1c, 0x18, 0x14, 0x10, 0x0c, 0x08, 0x04, 0x00, 0x80, 0x80, 0x80, 0x80 } }, + /* 32 bit floating point: */ { 4, 16, { 0 } }, + /* 64 bit floating point: */ { 8, 32, { 0 } }, + /* 80 bit floating point: */ { 10, 32, { 0 } }, }; - //************************************************************************** // DEBUG VIEW MEMORY SOURCE //************************************************************************** @@ -107,7 +106,7 @@ debug_view_memory::debug_view_memory(running_machine &machine, debug_view_osd_up m_chunks_per_row(16), m_bytes_per_chunk(1), m_steps_per_chunk(1), - m_data_format(1), + m_data_format(data_format::HEX_8BIT), m_reverse_view(false), m_ascii_view(true), m_no_translation(false), @@ -214,7 +213,24 @@ void debug_view_memory::view_notify(debug_view_notification type) m_bytes_per_chunk = source.m_prefsize; if (m_bytes_per_chunk > 8) m_bytes_per_chunk = 8; - m_data_format = m_bytes_per_chunk; + switch (m_bytes_per_chunk) + { + case 1: + m_data_format = data_format::HEX_8BIT; + break; + + case 2: + m_data_format = data_format::HEX_16BIT; + break; + + case 4: + m_data_format = data_format::HEX_32BIT; + break; + + case 8: + m_data_format = data_format::HEX_64BIT; + break; + } m_steps_per_chunk = source.m_space ? source.m_space->byte_to_address(m_bytes_per_chunk) : m_bytes_per_chunk; if (source.m_space != nullptr) m_expression.set_context(&source.m_space->device().debug()->symtable()); @@ -264,7 +280,7 @@ static inline float u64_to_double(u64 value) void debug_view_memory::generate_row(debug_view_char *destmin, debug_view_char *destmax, debug_view_char *destrow, offs_t address) { // get positional data - const memory_view_pos &posdata = s_memory_pos_table[m_data_format]; + const memory_view_pos &posdata = get_posdata(m_data_format); int spacing = posdata.m_spacing; // generate the address @@ -277,7 +293,7 @@ void debug_view_memory::generate_row(debug_view_char *destmin, debug_view_char * // generate the data and the ascii string std::string chunkascii; - if (m_data_format <= 8) + if (is_hex_format(m_data_format)) { for (int chunknum = 0; chunknum < m_chunks_per_row; chunknum++) { @@ -310,7 +326,7 @@ void debug_view_memory::generate_row(debug_view_char *destmin, debug_view_char * extFloat80_t chunkdata80 = { 0, 0 }; bool ismapped; - if (m_data_format != 11) + if (m_data_format != data_format::FLOAT_80BIT) ismapped = read(m_bytes_per_chunk, address + chunknum * m_steps_per_chunk, chunkdata); else ismapped = read(m_bytes_per_chunk, address + chunknum * m_steps_per_chunk, chunkdata80); @@ -318,17 +334,21 @@ void debug_view_memory::generate_row(debug_view_char *destmin, debug_view_char * if (ismapped) switch (m_data_format) { - case 9: + case data_format::FLOAT_32BIT: sprintf(valuetext, "%.8g", u32_to_float(u32(chunkdata))); break; - case 10: + case data_format::FLOAT_64BIT: sprintf(valuetext, "%.24g", u64_to_double(chunkdata)); break; - case 11: + case data_format::FLOAT_80BIT: + { float64_t f64 = extF80M_to_f64(&chunkdata80); sprintf(valuetext, "%.24g", u64_to_double(f64.v)); break; } + default: + break; + } else { valuetext[0] = '*'; @@ -621,10 +641,10 @@ void debug_view_memory::recompute() // compute the section widths m_section[0].m_width = 1 + 8 + 1; - if (m_data_format <= 8) + if (is_hex_format(m_data_format)) m_section[1].m_width = 1 + 3 * m_bytes_per_row + 1; else { - const memory_view_pos &posdata = s_memory_pos_table[m_data_format]; + const memory_view_pos &posdata = get_posdata(m_data_format); m_section[1].m_width = 1 + posdata.m_spacing * m_chunks_per_row + 1; } @@ -693,11 +713,11 @@ debug_view_memory::cursor_pos debug_view_memory::get_cursor_pos(const debug_view { // start with the base address for this row cursor_pos pos; - const memory_view_pos &posdata = s_memory_pos_table[m_data_format]; + const memory_view_pos &posdata = get_posdata(m_data_format); pos.m_address = m_byte_offset + cursor.y * m_bytes_per_chunk * m_chunks_per_row; // determine the X position within the middle section, clamping as necessary - if (m_data_format <= 8) { + if (is_hex_format(m_data_format)) { int xposition = cursor.x - m_section[1].m_pos - 1; if (xposition < 0) xposition = 0; @@ -744,7 +764,7 @@ debug_view_memory::cursor_pos debug_view_memory::get_cursor_pos(const debug_view void debug_view_memory::set_cursor_pos(cursor_pos pos) { - const memory_view_pos &posdata = s_memory_pos_table[m_data_format]; + const memory_view_pos &posdata = get_posdata(m_data_format); // offset the address by the byte offset if (pos.m_address < m_byte_offset) @@ -759,7 +779,7 @@ void debug_view_memory::set_cursor_pos(cursor_pos pos) if (m_reverse_view) chunknum = m_chunks_per_row - 1 - chunknum; - if (m_data_format <= 8) { + if (is_hex_format(m_data_format)) { // scan within the chunk to find the shift for (m_cursor.x = 0; m_cursor.x < posdata.m_spacing; m_cursor.x++) if (posdata.m_shift[m_cursor.x] == pos.m_shift) @@ -968,12 +988,12 @@ void debug_view_memory::set_chunks_per_row(u32 rowchunks) // are shown, 1-8 8-64 bits, 9 32bit floating point //------------------------------------------------- -void debug_view_memory::set_data_format(int format) +void debug_view_memory::set_data_format(data_format format) { cursor_pos pos; // should never be - if ((format <= 0) || (format > 11)) + if (!is_valid_format(format)) return; // no need to change if (format == m_data_format) @@ -981,44 +1001,30 @@ void debug_view_memory::set_data_format(int format) pos = begin_update_and_get_cursor_pos(); const debug_view_memory_source &source = downcast<const debug_view_memory_source &>(*m_source); - if ((format <= 8) && (m_data_format <= 8)) { - + if (is_hex_format(format) && is_hex_format(m_data_format)) { pos.m_address += (pos.m_shift / 8) ^ ((source.m_endianness == ENDIANNESS_LITTLE) ? 0 : (m_bytes_per_chunk - 1)); pos.m_shift %= 8; - m_bytes_per_chunk = format; + m_bytes_per_chunk = get_posdata(format).m_bytes; m_steps_per_chunk = source.m_space ? source.m_space->byte_to_address(m_bytes_per_chunk) : m_bytes_per_chunk; - m_chunks_per_row = m_bytes_per_row / format; + m_chunks_per_row = m_bytes_per_row / m_bytes_per_chunk; if (m_chunks_per_row < 1) m_chunks_per_row = 1; pos.m_shift += 8 * ((pos.m_address % m_bytes_per_chunk) ^ ((source.m_endianness == ENDIANNESS_LITTLE) ? 0 : (m_bytes_per_chunk - 1))); pos.m_address -= pos.m_address % m_bytes_per_chunk; } else { - if (format <= 8) { + if (is_hex_format(format)) { m_supports_cursor = true; m_edit_enabled = true; - - m_bytes_per_chunk = format; } else { m_supports_cursor = false; m_edit_enabled = false; m_cursor_visible = false; - - switch (format) - { - case 9: - m_bytes_per_chunk = 4; - break; - case 10: - m_bytes_per_chunk = 8; - break; - case 11: - m_bytes_per_chunk = 10; - break; - } } + + m_bytes_per_chunk = get_posdata(format).m_bytes; m_chunks_per_row = m_bytes_per_row / m_bytes_per_chunk; m_steps_per_chunk = source.m_space ? source.m_space->byte_to_address(m_bytes_per_chunk) : m_bytes_per_chunk; pos.m_shift = 0; diff --git a/src/emu/debug/dvmemory.h b/src/emu/debug/dvmemory.h index 8aa5df7cbeb..da92ae43bf7 100644 --- a/src/emu/debug/dvmemory.h +++ b/src/emu/debug/dvmemory.h @@ -55,10 +55,24 @@ class debug_view_memory : public debug_view // construction/destruction debug_view_memory(running_machine &machine, debug_view_osd_update_func osdupdate, void *osdprivate); + struct memory_view_pos; + public: + enum class data_format + { + HEX_8BIT = 1, + HEX_16BIT = 2, + HEX_32BIT = 4, + HEX_64BIT = 8, + FLOAT_32BIT = 9, + FLOAT_64BIT = 10, + FLOAT_80BIT = 11 + }; + static bool is_valid_format(data_format format) { return int(format) >= 0 && int(format) < std::size(s_memory_pos_table) && get_posdata(format).m_bytes != 0; } + // getters const char *expression() const { return m_expression.string(); } - int get_data_format() { flush_updates(); return m_data_format; } + data_format get_data_format() { flush_updates(); return m_data_format; } u32 chunks_per_row() { flush_updates(); return m_chunks_per_row; } bool reverse() const { return m_reverse_view; } bool ascii() const { return m_ascii_view; } @@ -68,7 +82,7 @@ public: // setters void set_expression(const std::string &expression); void set_chunks_per_row(u32 rowchunks); - void set_data_format(int format); // 1-8 current values 9 32bit floating point + void set_data_format(data_format format); void set_reverse(bool reverse); void set_ascii(bool reverse); void set_physical(bool physical); @@ -88,6 +102,10 @@ private: u8 m_shift; }; + // data format helpers + static bool is_hex_format(data_format format) { return int(format) <= 8; } + static const memory_view_pos &get_posdata(data_format format) { return s_memory_pos_table[int(format)]; } + // internal helpers void enumerate_sources(); void recompute(); @@ -111,7 +129,7 @@ private: u32 m_chunks_per_row; // number of chunks displayed per line u8 m_bytes_per_chunk; // bytes per chunk u8 m_steps_per_chunk; // bytes per chunk - int m_data_format; // 1-8 current values 9 32bit floating point + data_format m_data_format; // 1-8 current values 9 32bit floating point bool m_reverse_view; // reverse-endian view? bool m_ascii_view; // display ASCII characters? bool m_no_translation; // don't run addresses through the cpu translation hook @@ -131,8 +149,9 @@ private: struct memory_view_pos { - u8 m_spacing; /* spacing between each entry */ - u8 m_shift[24]; /* shift for each character */ + u8 m_bytes; // bytes per entry + u8 m_spacing; // spacing between each entry + u8 m_shift[24]; // shift for each character }; static const memory_view_pos s_memory_pos_table[12]; // table for rendering at different data formats diff --git a/src/osd/modules/debugger/debugimgui.cpp b/src/osd/modules/debugger/debugimgui.cpp index 23cc8ef66ba..8fe382a8d72 100644 --- a/src/osd/modules/debugger/debugimgui.cpp +++ b/src/osd/modules/debugger/debugimgui.cpp @@ -844,23 +844,23 @@ void debug_imgui::draw_memory(debug_area* view_ptr, bool* opened) auto* mem = downcast<debug_view_memory*>(view_ptr->view); bool physical = mem->physical(); bool rev = mem->reverse(); - int format = mem->get_data_format(); + debug_view_memory::data_format format = mem->get_data_format(); uint32_t chunks = mem->chunks_per_row(); - if(ImGui::MenuItem("1-byte chunks", nullptr,(format == 1) ? true : false)) - mem->set_data_format(1); - if(ImGui::MenuItem("2-byte chunks", nullptr,(format == 2) ? true : false)) - mem->set_data_format(2); - if(ImGui::MenuItem("4-byte chunks", nullptr,(format == 4) ? true : false)) - mem->set_data_format(4); - if(ImGui::MenuItem("8-byte chunks", nullptr,(format == 8) ? true : false)) - mem->set_data_format(8); - if(ImGui::MenuItem("32-bit floating point", nullptr,(format == 9) ? true : false)) - mem->set_data_format(9); - if(ImGui::MenuItem("64-bit floating point", nullptr,(format == 10) ? true : false)) - mem->set_data_format(10); - if(ImGui::MenuItem("80-bit floating point", nullptr,(format == 11) ? true : false)) - mem->set_data_format(11); + if(ImGui::MenuItem("1-byte chunks", nullptr,(format == debug_view_memory::data_format::HEX_8BIT) ? true : false)) + mem->set_data_format(debug_view_memory::data_format::HEX_8BIT); + if(ImGui::MenuItem("2-byte chunks", nullptr,(format == debug_view_memory::data_format::HEX_16BIT) ? true : false)) + mem->set_data_format(debug_view_memory::data_format::HEX_16BIT); + if(ImGui::MenuItem("4-byte chunks", nullptr,(format == debug_view_memory::data_format::HEX_32BIT) ? true : false)) + mem->set_data_format(debug_view_memory::data_format::HEX_32BIT); + if(ImGui::MenuItem("8-byte chunks", nullptr,(format == debug_view_memory::data_format::HEX_64BIT) ? true : false)) + mem->set_data_format(debug_view_memory::data_format::HEX_64BIT); + if(ImGui::MenuItem("32-bit floating point", nullptr,(format == debug_view_memory::data_format::FLOAT_32BIT) ? true : false)) + mem->set_data_format(debug_view_memory::data_format::FLOAT_32BIT); + if(ImGui::MenuItem("64-bit floating point", nullptr,(format == debug_view_memory::data_format::FLOAT_64BIT) ? true : false)) + mem->set_data_format(debug_view_memory::data_format::FLOAT_64BIT); + if(ImGui::MenuItem("80-bit floating point", nullptr,(format == debug_view_memory::data_format::FLOAT_80BIT) ? true : false)) + mem->set_data_format(debug_view_memory::data_format::FLOAT_80BIT); ImGui::Separator(); if(ImGui::MenuItem("Logical addresses", nullptr,!physical)) mem->set_physical(false); diff --git a/src/osd/modules/debugger/osx/memoryview.mm b/src/osd/modules/debugger/osx/memoryview.mm index 0db48236b79..17d0ea639d4 100644 --- a/src/osd/modules/debugger/osx/memoryview.mm +++ b/src/osd/modules/debugger/osx/memoryview.mm @@ -35,7 +35,7 @@ if (action == @selector(showChunkSize:)) { - [item setState:((tag == memview->get_data_format()) ? NSOnState : NSOffState)]; + [item setState:((tag == int(memview->get_data_format())) ? NSOnState : NSOffState)]; return YES; } else if (action == @selector(showPhysicalAddresses:)) @@ -176,7 +176,7 @@ - (IBAction)showChunkSize:(id)sender { - downcast<debug_view_memory *>(view)->set_data_format([sender tag]); + downcast<debug_view_memory *>(view)->set_data_format(debug_view_memory::data_format([sender tag])); } @@ -206,7 +206,7 @@ debug_view_memory *const memView = downcast<debug_view_memory *>(view); node->set_attribute_int("reverse", memView->reverse() ? 1 : 0); node->set_attribute_int("addressmode", memView->physical() ? 1 : 0); - node->set_attribute_int("dataformat", memView->get_data_format()); + node->set_attribute_int("dataformat", int(memView->get_data_format())); node->set_attribute_int("rowchunks", memView->chunks_per_row()); } @@ -216,43 +216,60 @@ debug_view_memory *const memView = downcast<debug_view_memory *>(view); memView->set_reverse(0 != node->get_attribute_int("reverse", memView->reverse() ? 1 : 0)); memView->set_physical(0 != node->get_attribute_int("addressmode", memView->physical() ? 1 : 0)); - memView->set_data_format(node->get_attribute_int("dataformat", memView->get_data_format())); + memView->set_data_format(debug_view_memory::data_format(node->get_attribute_int("dataformat", int(memView->get_data_format())))); memView->set_chunks_per_row(node->get_attribute_int("rowchunks", memView->chunks_per_row())); } - (void)insertActionItemsInMenu:(NSMenu *)menu atIndex:(NSInteger)index { - NSInteger tag; - for (tag = 1; tag <= 8; tag <<= 1) { - NSString *title = [NSString stringWithFormat:@"%ld-byte Chunks", (long)tag]; - NSMenuItem *chunkItem = [menu insertItemWithTitle:title - action:@selector(showChunkSize:) - keyEquivalent:[NSString stringWithFormat:@"%ld", (long)tag] - atIndex:index++]; - [chunkItem setTarget:self]; - [chunkItem setTag:tag]; - } + NSMenuItem *chunkItem1 = [menu insertItemWithTitle:@"1-byte Chunks" + action:@selector(showChunkSize:) + keyEquivalent:@"1" + atIndex:index++]; + [chunkItem1 setTarget:self]; + [chunkItem1 setTag:int(debug_view_memory::data_format::HEX_8BIT)]; + + NSMenuItem *chunkItem2 = [menu insertItemWithTitle:@"2-byte Chunks" + action:@selector(showChunkSize:) + keyEquivalent:@"2" + atIndex:index++]; + [chunkItem2 setTarget:self]; + [chunkItem2 setTag:int(debug_view_memory::data_format::HEX_16BIT)]; - NSMenuItem *chunkItem = [menu insertItemWithTitle:@"32-bit floats" + NSMenuItem *chunkItem4 = [menu insertItemWithTitle:@"4-byte Chunks" + action:@selector(showChunkSize:) + keyEquivalent:@"4" + atIndex:index++]; + [chunkItem4 setTarget:self]; + [chunkItem4 setTag:int(debug_view_memory::data_format::HEX_32BIT)]; + + NSMenuItem *chunkItem8 = [menu insertItemWithTitle:@"8-byte Chunks" + action:@selector(showChunkSize:) + keyEquivalent:@"8" + atIndex:index++]; + [chunkItem8 setTarget:self]; + [chunkItem8 setTag:int(debug_view_memory::data_format::HEX_64BIT)]; + + NSMenuItem *chunkItem9 = [menu insertItemWithTitle:@"32-bit floats" action:@selector(showChunkSize:) keyEquivalent:@"F" atIndex:index++]; - [chunkItem setTarget:self]; - [chunkItem setTag:9]; + [chunkItem9 setTarget:self]; + [chunkItem9 setTag:int(debug_view_memory::data_format::FLOAT_32BIT)]; - NSMenuItem *chunkItem2 = [menu insertItemWithTitle:@"64-bit floats" + NSMenuItem *chunkItem10 = [menu insertItemWithTitle:@"64-bit floats" action:@selector(showChunkSize:) keyEquivalent:@"D" atIndex:index++]; - [chunkItem2 setTarget:self]; - [chunkItem2 setTag:10]; + [chunkItem10 setTarget:self]; + [chunkItem10 setTag:int(debug_view_memory::data_format::FLOAT_64BIT)]; - NSMenuItem *chunkItem3 = [menu insertItemWithTitle:@"80-bit floats" + NSMenuItem *chunkItem11 = [menu insertItemWithTitle:@"80-bit floats" action:@selector(showChunkSize:) keyEquivalent:@"E" atIndex:index++]; - [chunkItem3 setTarget:self]; - [chunkItem3 setTag:11]; + [chunkItem11 setTarget:self]; + [chunkItem11 setTag:int(debug_view_memory::data_format::FLOAT_80BIT)]; [menu insertItem:[NSMenuItem separatorItem] atIndex:index++]; diff --git a/src/osd/modules/debugger/qt/memorywindow.cpp b/src/osd/modules/debugger/qt/memorywindow.cpp index 9989ac6d66d..c4b4ce9a429 100644 --- a/src/osd/modules/debugger/qt/memorywindow.cpp +++ b/src/osd/modules/debugger/qt/memorywindow.cpp @@ -178,13 +178,13 @@ void MemoryWindow::memoryRegionChanged(int index) debug_view_memory *memView = downcast<debug_view_memory*>(m_memTable->view()); switch (memView->get_data_format()) { - case 1: dataFormatMenuItem("formatActOne")->setChecked(true); break; - case 2: dataFormatMenuItem("formatActTwo")->setChecked(true); break; - case 4: dataFormatMenuItem("formatActFour")->setChecked(true); break; - case 8: dataFormatMenuItem("formatActEight")->setChecked(true); break; - case 9: dataFormatMenuItem("formatAct32bitFloat")->setChecked(true); break; - case 10: dataFormatMenuItem("formatAct64bitFloat")->setChecked(true); break; - case 11: dataFormatMenuItem("formatAct80bitFloat")->setChecked(true); break; + case debug_view_memory::data_format::HEX_8BIT: dataFormatMenuItem("formatActOne")->setChecked(true); break; + case debug_view_memory::data_format::HEX_16BIT: dataFormatMenuItem("formatActTwo")->setChecked(true); break; + case debug_view_memory::data_format::HEX_32BIT: dataFormatMenuItem("formatActFour")->setChecked(true); break; + case debug_view_memory::data_format::HEX_64BIT: dataFormatMenuItem("formatActEight")->setChecked(true); break; + case debug_view_memory::data_format::FLOAT_32BIT: dataFormatMenuItem("formatAct32bitFloat")->setChecked(true); break; + case debug_view_memory::data_format::FLOAT_64BIT: dataFormatMenuItem("formatAct64bitFloat")->setChecked(true); break; + case debug_view_memory::data_format::FLOAT_80BIT: dataFormatMenuItem("formatAct80bitFloat")->setChecked(true); break; default: break; } } @@ -214,19 +214,19 @@ void MemoryWindow::formatChanged(QAction* changedTo) debug_view_memory *memView = downcast<debug_view_memory*>(m_memTable->view()); if (changedTo->text() == "1-byte chunks") - memView->set_data_format(1); + memView->set_data_format(debug_view_memory::data_format::HEX_8BIT); else if (changedTo->text() == "2-byte chunks") - memView->set_data_format(2); + memView->set_data_format(debug_view_memory::data_format::HEX_16BIT); else if (changedTo->text() == "4-byte chunks") - memView->set_data_format(4); + memView->set_data_format(debug_view_memory::data_format::HEX_32BIT); else if (changedTo->text() == "8-byte chunks") - memView->set_data_format(8); + memView->set_data_format(debug_view_memory::data_format::HEX_64BIT); else if (changedTo->text() == "32 bit floating point") - memView->set_data_format(9); + memView->set_data_format(debug_view_memory::data_format::FLOAT_32BIT); else if (changedTo->text() == "64 bit floating point") - memView->set_data_format(10); + memView->set_data_format(debug_view_memory::data_format::FLOAT_64BIT); else if (changedTo->text() == "80 bit floating point") - memView->set_data_format(11); + memView->set_data_format(debug_view_memory::data_format::FLOAT_80BIT); m_memTable->viewport()->update(); } diff --git a/src/osd/modules/debugger/win/memoryviewinfo.cpp b/src/osd/modules/debugger/win/memoryviewinfo.cpp index 9575a128c33..15dc46ebb98 100644 --- a/src/osd/modules/debugger/win/memoryviewinfo.cpp +++ b/src/osd/modules/debugger/win/memoryviewinfo.cpp @@ -9,8 +9,6 @@ #include "emu.h" #include "memoryviewinfo.h" -#include "debug/dvmemory.h" - #include "strconv.h" @@ -25,7 +23,7 @@ memoryview_info::~memoryview_info() } -uint8_t memoryview_info::data_format() const +debug_view_memory::data_format memoryview_info::data_format() const { return view<debug_view_memory>()->get_data_format(); } @@ -54,7 +52,7 @@ void memoryview_info::set_expression(const std::string &string) view<debug_view_memory>()->set_expression(string); } -void memoryview_info::set_data_format(uint8_t dataformat) +void memoryview_info::set_data_format(debug_view_memory::data_format dataformat) { view<debug_view_memory>()->set_data_format(dataformat); } diff --git a/src/osd/modules/debugger/win/memoryviewinfo.h b/src/osd/modules/debugger/win/memoryviewinfo.h index 7766da9ac30..95436e507e6 100644 --- a/src/osd/modules/debugger/win/memoryviewinfo.h +++ b/src/osd/modules/debugger/win/memoryviewinfo.h @@ -11,9 +11,10 @@ #pragma once #include "debugwin.h" - #include "debugviewinfo.h" +#include "debug/dvmemory.h" + #include <string> @@ -23,13 +24,13 @@ public: memoryview_info(debugger_windows_interface &debugger, debugwin_info &owner, HWND parent); virtual ~memoryview_info(); - uint8_t data_format() const; + debug_view_memory::data_format data_format() const; uint32_t chunks_per_row() const; bool reverse() const; bool physical() const; void set_expression(const std::string &string); - void set_data_format(uint8_t dataformat); + void set_data_format(debug_view_memory::data_format dataformat); void set_chunks_per_row(uint32_t rowchunks); void set_reverse(bool reverse); void set_physical(bool physical); diff --git a/src/osd/modules/debugger/win/memorywininfo.cpp b/src/osd/modules/debugger/win/memorywininfo.cpp index 18f28252f12..66e130b0cad 100644 --- a/src/osd/modules/debugger/win/memorywininfo.cpp +++ b/src/osd/modules/debugger/win/memorywininfo.cpp @@ -180,13 +180,13 @@ void memorywin_info::update_menu() auto *const memview = downcast<memoryview_info *>(m_views[0].get()); HMENU const menu = GetMenu(window()); - CheckMenuItem(menu, ID_1_BYTE_CHUNKS, MF_BYCOMMAND | (memview->data_format() == 1 ? MF_CHECKED : MF_UNCHECKED)); - CheckMenuItem(menu, ID_2_BYTE_CHUNKS, MF_BYCOMMAND | (memview->data_format() == 2 ? MF_CHECKED : MF_UNCHECKED)); - CheckMenuItem(menu, ID_4_BYTE_CHUNKS, MF_BYCOMMAND | (memview->data_format() == 4 ? MF_CHECKED : MF_UNCHECKED)); - CheckMenuItem(menu, ID_8_BYTE_CHUNKS, MF_BYCOMMAND | (memview->data_format() == 8 ? MF_CHECKED : MF_UNCHECKED)); - CheckMenuItem(menu, ID_FLOATING_POINT_32BIT, MF_BYCOMMAND | (memview->data_format() == 9 ? MF_CHECKED : MF_UNCHECKED)); - CheckMenuItem(menu, ID_FLOATING_POINT_64BIT, MF_BYCOMMAND | (memview->data_format() == 10 ? MF_CHECKED : MF_UNCHECKED)); - CheckMenuItem(menu, ID_FLOATING_POINT_80BIT, MF_BYCOMMAND | (memview->data_format() == 11 ? MF_CHECKED : MF_UNCHECKED)); + CheckMenuItem(menu, ID_1_BYTE_CHUNKS, MF_BYCOMMAND | (memview->data_format() == debug_view_memory::data_format::HEX_8BIT ? MF_CHECKED : MF_UNCHECKED)); + CheckMenuItem(menu, ID_2_BYTE_CHUNKS, MF_BYCOMMAND | (memview->data_format() == debug_view_memory::data_format::HEX_16BIT ? MF_CHECKED : MF_UNCHECKED)); + CheckMenuItem(menu, ID_4_BYTE_CHUNKS, MF_BYCOMMAND | (memview->data_format() == debug_view_memory::data_format::HEX_32BIT ? MF_CHECKED : MF_UNCHECKED)); + CheckMenuItem(menu, ID_8_BYTE_CHUNKS, MF_BYCOMMAND | (memview->data_format() == debug_view_memory::data_format::HEX_64BIT ? MF_CHECKED : MF_UNCHECKED)); + CheckMenuItem(menu, ID_FLOATING_POINT_32BIT, MF_BYCOMMAND | (memview->data_format() == debug_view_memory::data_format::FLOAT_32BIT ? MF_CHECKED : MF_UNCHECKED)); + CheckMenuItem(menu, ID_FLOATING_POINT_64BIT, MF_BYCOMMAND | (memview->data_format() == debug_view_memory::data_format::FLOAT_64BIT ? MF_CHECKED : MF_UNCHECKED)); + CheckMenuItem(menu, ID_FLOATING_POINT_80BIT, MF_BYCOMMAND | (memview->data_format() == debug_view_memory::data_format::FLOAT_80BIT ? MF_CHECKED : MF_UNCHECKED)); CheckMenuItem(menu, ID_LOGICAL_ADDRESSES, MF_BYCOMMAND | (memview->physical() ? MF_UNCHECKED : MF_CHECKED)); CheckMenuItem(menu, ID_PHYSICAL_ADDRESSES, MF_BYCOMMAND | (memview->physical() ? MF_CHECKED : MF_UNCHECKED)); CheckMenuItem(menu, ID_REVERSE_VIEW, MF_BYCOMMAND | (memview->reverse() ? MF_CHECKED : MF_UNCHECKED)); |