debugger/win: Added capability to save/restore window arrangement.

* Format is mostly compatible with the Cocoa debugger, besides reversed
  vertical positioning.
* Made Qt debugger more compatible with configuration format used by
  Win32 and Cocoa debuggers.
* emu/config.cpp: Preserve elements with no registered handlers in
  default and system configuation files.
This commit is contained in:
Vas Crabb 2022-09-16 22:09:58 +10:00
parent 1aae44005b
commit c76cf754b3
57 changed files with 913 additions and 224 deletions

View File

@ -73,6 +73,8 @@ function osdmodulesbuild()
MAME_DIR .. "src/osd/modules/debugger/debugwin.cpp",
MAME_DIR .. "src/osd/modules/debugger/debugimgui.cpp",
MAME_DIR .. "src/osd/modules/debugger/debuggdbstub.cpp",
MAME_DIR .. "src/osd/modules/debugger/xmlconfig.cpp",
MAME_DIR .. "src/osd/modules/debugger/xmlconfig.h",
MAME_DIR .. "src/osd/modules/font/font_sdl.cpp",
MAME_DIR .. "src/osd/modules/font/font_windows.cpp",
MAME_DIR .. "src/osd/modules/font/font_dwrite.cpp",

View File

@ -2,18 +2,18 @@
// copyright-holders:Vas Crabb
/***************************************************************************
Hudson Soft HuC-1 Memory Controller
Hudson Soft HuC1 Memory Controller
Provides ROM and RAM banking and infrared I/O. Supports up to 1 MiB ROM
(64 16 KiB pages) and up to 32 KiB static RAM (4 8 KiB pages). If RAM bank
lines are used for coarse ROM banking, up to 4 MiB ROM (256 16 KiB pages)
can be supported.
The HuC-1 controller appears to only respond to A15-A13 and D6-D0, i.e.
The HuC1 controller appears to only respond to A15-A13 and D6-D0, i.e.
addresses are effectively masked with 0xE000 and data is effectively masked
with 0x3F.
The HuC-1 controller doesn't support disabling cartridge RAM without
The HuC1 controller doesn't support disabling cartridge RAM without
selecting infrared I/O. However, some games still write 0x00 or 0x0A to
the infrared/RAM select register as if it behaved like the Nintendo MBC
series RAM enable register. Some games write to the 0x6000-0x7FFF range,
@ -189,4 +189,4 @@ void huc1_device::write_ir(u8 data)
} // namespace bus::gameboy
DEFINE_DEVICE_TYPE_PRIVATE(GB_ROM_HUC1, device_gb_cart_interface, bus::gameboy::huc1_device, "gb_rom_huc1", "Game Boy Hudson Soft HuC-1 Cartridge")
DEFINE_DEVICE_TYPE_PRIVATE(GB_ROM_HUC1, device_gb_cart_interface, bus::gameboy::huc1_device, "gb_rom_huc1", "Game Boy Hudson Soft HuC1 Cartridge")

View File

@ -1524,7 +1524,10 @@ private:
void bank_switch_fine(u8 data)
{
set_bank_rom_fine(data & 0x7f);
LOG("Protection read %s\n", BIT(data, 7) ? "enabled" : "disabled");
LOG(
"%s: Protection read %s\n",
machine().describe_context(),
BIT(data, 7) ? "enabled" : "disabled");
if (BIT(data, 7))
m_view_prot.select(0);
else
@ -1564,6 +1567,7 @@ private:
};
//**************************************************************************
// Fast Fame VF001 MBC5 variant with protection
//**************************************************************************

View File

@ -16,6 +16,7 @@
#include "romload.h"
#include "chd.h"
#include "xmlfile.h"

View File

@ -11,6 +11,8 @@
#include "emu.h"
#include "config.h"
#include "xmlfile.h"
//**************************************************************************
// BOOKKEEPING MANAGER

View File

@ -15,19 +15,23 @@
#include "emuopts.h"
#include "fileio.h"
#include "xmlfile.h"
#include <system_error>
#include <utility>
#define DEBUG_CONFIG 0
//**************************************************************************
// CONFIGURATION MANAGER
//**************************************************************************
//-------------------------------------------------
// configuration_manager - constructor
//-------------------------------------------------
/*************************************
*
* Construction/destruction
*
*************************************/
configuration_manager::configuration_manager(running_machine &machine) :
m_machine(machine),
@ -35,6 +39,13 @@ configuration_manager::configuration_manager(running_machine &machine) :
{
}
configuration_manager::~configuration_manager()
{
}
/*************************************
*
* Register to be involved in config
@ -256,6 +267,12 @@ bool configuration_manager::load_xml(game_driver const &system, emu_file &file,
for (auto const &type : m_typelist)
type.second.load(which_type, level, systemnode->get_child(type.first.c_str()));
count++;
// save unhandled settings for default and system types
if (config_type::DEFAULT == which_type)
save_unhandled(m_unhandled_default, *systemnode);
else if (config_type::SYSTEM == which_type)
save_unhandled(m_unhandled_system, *systemnode);
}
// error if this isn't a valid match
@ -302,9 +319,48 @@ bool configuration_manager::save_xml(emu_file &file, config_type which_type)
curnode->delete_node();
}
// flush the file
// restore unhandled settings
if ((config_type::DEFAULT == which_type) && m_unhandled_default)
restore_unhandled(*m_unhandled_default, *systemnode);
else if ((config_type::SYSTEM == which_type) && m_unhandled_system)
restore_unhandled(*m_unhandled_system, *systemnode);
// write out the file
root->write(file);
// free and get out of here
return true;
}
/*************************************
*
* Preserving unhandled settings
*
*************************************/
void configuration_manager::save_unhandled(
std::unique_ptr<util::xml::file> &unhandled,
util::xml::data_node const &systemnode)
{
for (util::xml::data_node const *curnode = systemnode.get_first_child(); curnode; curnode = curnode->get_next_sibling())
{
auto const handler = m_typelist.lower_bound(curnode->get_name());
if ((m_typelist.end() == handler) || (handler->first != curnode->get_name()))
{
if (!unhandled)
unhandled = util::xml::file::create();
curnode->copy_into(*unhandled);
}
}
}
void configuration_manager::restore_unhandled(
util::xml::file const &unhandled,
util::xml::data_node &systemnode)
{
for (util::xml::data_node const *curnode = unhandled.get_first_child(); curnode; curnode = curnode->get_next_sibling())
curnode->copy_into(systemnode);
}

View File

@ -13,9 +13,8 @@
#pragma once
#include "xmlfile.h"
#include <map>
#include <memory>
#include <string>
#include <string_view>
@ -49,6 +48,7 @@ public:
// construction/destruction
configuration_manager(running_machine &machine);
~configuration_manager();
void config_register(std::string_view name, load_delegate &&load, save_delegate &&save);
@ -69,9 +69,14 @@ private:
bool load_xml(game_driver const &system, emu_file &file, config_type which_type);
bool save_xml(emu_file &file, config_type which_type);
void save_unhandled(std::unique_ptr<util::xml::file> &unhandled, util::xml::data_node const &systemnode);
void restore_unhandled(util::xml::file const &unhandled, util::xml::data_node &systemnode);
// internal state
running_machine &m_machine;
std::multimap<std::string, config_handler> m_typelist;
std::unique_ptr<util::xml::file> m_unhandled_default;
std::unique_ptr<util::xml::file> m_unhandled_system;
};
#endif // MAME_EMU_CONFIG_H

View File

@ -10,11 +10,14 @@
#include "emu.h"
#include "speaker.h"
#include "emuopts.h"
#include "osdepend.h"
#include "config.h"
#include "emuopts.h"
#include "speaker.h"
#include "wavwrite.h"
#include "xmlfile.h"
#include "osdepend.h"
//**************************************************************************

View File

@ -5,8 +5,10 @@
*
*/
#ifndef DEBUG_MODULE_H_
#define DEBUG_MODULE_H_
#ifndef MAME_OSD_DEBUGGER_DEBUG_MODULE_H
#define MAME_OSD_DEBUGGER_DEBUG_MODULE_H
#pragma once
#include "osdepend.h"
#include "modules/osdmodule.h"
@ -30,4 +32,4 @@ public:
#endif /* DEBUG_MODULE_H_ */
#endif // MAME_OSD_DEBUGGER_DEBUG_MODULE_H

View File

@ -32,6 +32,9 @@
#include "qt/deviceswindow.h"
#include "qt/deviceinformationwindow.h"
#include "util/xmlfile.h"
class debug_qt : public osd_module, public debug_module
#if defined(_WIN32) && !defined(SDLMAME_WIN32)
, public QAbstractNativeEventFilter
@ -89,9 +92,9 @@ void xml_configuration_load(running_machine &machine, config_type cfg_type, conf
// Configuration load
util::xml::data_node const *wnode = nullptr;
for (wnode = parentnode->get_child("window"); wnode; wnode = wnode->get_next_sibling("window"))
for (wnode = parentnode->get_child(osd::debugger::NODE_WINDOW); wnode; wnode = wnode->get_next_sibling(osd::debugger::NODE_WINDOW))
{
WindowQtConfig::WindowType type = (WindowQtConfig::WindowType)wnode->get_attribute_int("type", WindowQtConfig::WIN_TYPE_UNKNOWN);
WindowQtConfig::WindowType type = (WindowQtConfig::WindowType)wnode->get_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, WindowQtConfig::WIN_TYPE_UNKNOWN);
switch (type)
{
case WindowQtConfig::WIN_TYPE_MAIN: xmlConfigurations.push_back(std::make_unique<MainWindowQtConfig>()); break;
@ -119,7 +122,7 @@ void xml_configuration_save(running_machine &machine, config_type cfg_type, util
WindowQtConfig &config = *xmlConfigurations[i];
// Create an xml node
util::xml::data_node *const debugger_node = parentnode->add_child("window", nullptr);
util::xml::data_node *const debugger_node = parentnode->add_child(osd::debugger::NODE_WINDOW, nullptr);
// Insert the appropriate information
if (debugger_node)

View File

@ -22,9 +22,12 @@
#include "win/pointswininfo.h"
#include "win/uimetrics.h"
#include "config.h"
#include "debugger.h"
#include "debug/debugcpu.h"
#include "util/xmlfile.h"
#include "window.h"
#include "../input/input_common.h"
#include "../input/input_windows.h"
@ -73,11 +76,18 @@ protected:
private:
template <typename T> T *create_window();
void config_load(config_type cfgtype, config_level cfglevel, util::xml::data_node const *parentnode);
void config_save(config_type cfgtype, util::xml::data_node *parentnode);
void load_configuration(util::xml::data_node const &parentnode);
running_machine *m_machine;
std::unique_ptr<ui_metrics> m_metrics;
bool m_waiting_for_debugger;
std::vector<std::unique_ptr<debugwin_info>> m_window_list;
consolewin_info *m_main_console;
util::xml::file::ptr m_config;
};
@ -97,22 +107,32 @@ void debugger_windows::init_debugger(running_machine &machine)
{
m_machine = &machine;
m_metrics = std::make_unique<ui_metrics>(downcast<osd_options &>(m_machine->options()));
machine.configuration().config_register(
"debugger",
configuration_manager::load_delegate(&debugger_windows::config_load, this),
configuration_manager::save_delegate(&debugger_windows::config_save, this));
}
void debugger_windows::wait_for_debugger(device_t &device, bool firststop)
{
// create a console window
if (m_main_console == nullptr)
if (!m_main_console)
m_main_console = create_window<consolewin_info>();
// update the views in the console to reflect the current CPU
if (m_main_console != nullptr)
if (m_main_console)
m_main_console->set_cpu(device);
// when we are first stopped, adjust focus to us
if (firststop && (m_main_console != nullptr))
if (firststop && m_main_console)
{
if (m_config)
{
for (util::xml::data_node const *node = m_config->get_first_child(); node; node = node->get_next_sibling())
load_configuration(*node);
m_config.reset();
}
m_main_console->set_foreground();
if (winwindow_has_focus())
m_main_console->set_default_focus();
@ -247,21 +267,90 @@ void debugger_windows::hide_all()
}
template <typename T> T *debugger_windows::create_window()
template <typename T>
T *debugger_windows::create_window()
{
// allocate memory
std::unique_ptr<T> info = std::make_unique<T>(static_cast<debugger_windows_interface &>(*this));
if (info->is_valid())
{
T &result(*info);
m_window_list.push_back(std::move(info));
T *ptr = dynamic_cast<T*>(m_window_list.back().get());
return ptr;
return &result;
}
return nullptr;
}
#else /* not windows */
void debugger_windows::config_load(config_type cfgtype, config_level cfglevel, util::xml::data_node const *parentnode)
{
if (parentnode)
{
if (config_type::SYSTEM == cfgtype)
{
if (m_main_console)
{
load_configuration(*parentnode);
}
else
{
if (!m_config)
m_config = util::xml::file::create();
parentnode->copy_into(*m_config);
}
}
}
}
void debugger_windows::config_save(config_type cfgtype, util::xml::data_node *parentnode)
{
if (config_type::SYSTEM == cfgtype)
{
for (auto &info : m_window_list)
info->save_configuration(*parentnode);
}
}
void debugger_windows::load_configuration(util::xml::data_node const &parentnode)
{
for (util::xml::data_node const *node = parentnode.get_child(osd::debugger::NODE_WINDOW); node; node = node->get_next_sibling(osd::debugger::NODE_WINDOW))
{
debugwin_info *win = nullptr;
switch (node->get_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, -1))
{
case osd::debugger::WINDOW_TYPE_CONSOLE:
m_main_console->restore_configuration_from_node(*node);
break;
case osd::debugger::WINDOW_TYPE_MEMORY_VIEWER:
win = create_window<memorywin_info>();
break;
case osd::debugger::WINDOW_TYPE_DISASSEMBLY_VIEWER:
win = create_window<disasmwin_info>();
break;
case osd::debugger::WINDOW_TYPE_ERROR_LOG_VIEWER:
win = create_window<logwin_info>();
break;
case osd::debugger::WINDOW_TYPE_POINTS_VIEWER:
win = create_window<pointswin_info>();
break;
case osd::debugger::WINDOW_TYPE_DEVICES_VIEWER:
// not supported
break;
case osd::debugger::WINDOW_TYPE_DEVICE_INFO_VIEWER:
// not supported
break;
default:
break;
}
if (win)
win->restore_configuration_from_node(*node);
}
}
#else // not Windows
MODULE_NOT_SUPPORTED(debugger_windows, OSD_DEBUG_PROVIDER, "windows")
#endif

View File

@ -380,30 +380,30 @@
- (void)loadConfiguration:(util::xml::data_node const *)parentnode {
util::xml::data_node const *node = nullptr;
for (node = parentnode->get_child("window"); node; node = node->get_next_sibling("window"))
for (node = parentnode->get_child(osd::debugger::NODE_WINDOW); node; node = node->get_next_sibling(osd::debugger::NODE_WINDOW))
{
MAMEDebugWindowHandler *win = nil;
switch (node->get_attribute_int("type", -1))
switch (node->get_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, -1))
{
case MAME_DEBUGGER_WINDOW_TYPE_CONSOLE:
case osd::debugger::WINDOW_TYPE_CONSOLE:
[self restoreConfigurationFromNode:node];
break;
case MAME_DEBUGGER_WINDOW_TYPE_MEMORY_VIEWER:
case osd::debugger::WINDOW_TYPE_MEMORY_VIEWER:
win = [[MAMEMemoryViewer alloc] initWithMachine:*machine console:self];
break;
case MAME_DEBUGGER_WINDOW_TYPE_DISASSEMBLY_VIEWER:
case osd::debugger::WINDOW_TYPE_DISASSEMBLY_VIEWER:
win = [[MAMEDisassemblyViewer alloc] initWithMachine:*machine console:self];
break;
case MAME_DEBUGGER_WINDOW_TYPE_ERROR_LOG_VIEWER:
case osd::debugger::WINDOW_TYPE_ERROR_LOG_VIEWER:
win = [[MAMEErrorLogViewer alloc] initWithMachine:*machine console:self];
break;
case MAME_DEBUGGER_WINDOW_TYPE_POINTS_VIEWER:
case osd::debugger::WINDOW_TYPE_POINTS_VIEWER:
win = [[MAMEPointsViewer alloc] initWithMachine:*machine console:self];
break;
case MAME_DEBUGGER_WINDOW_TYPE_DEVICES_VIEWER:
case osd::debugger::WINDOW_TYPE_DEVICES_VIEWER:
win = [[MAMEDevicesViewer alloc] initWithMachine:*machine console:self];
break;
case MAME_DEBUGGER_WINDOW_TYPE_DEVICE_INFO_VIEWER:
case osd::debugger::WINDOW_TYPE_DEVICE_INFO_VIEWER:
// FIXME: needs device info on init, make another variant
//win = [[MAMEDeviceInfoViewer alloc] initWithMachine:*machine console:self];
break;
@ -423,15 +423,15 @@
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
[super saveConfigurationToNode:node];
node->set_attribute_int("type", MAME_DEBUGGER_WINDOW_TYPE_CONSOLE);
util::xml::data_node *const splits = node->add_child("splits", nullptr);
node->set_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, osd::debugger::WINDOW_TYPE_CONSOLE);
util::xml::data_node *const splits = node->add_child(osd::debugger::NODE_WINDOW_SPLITS, nullptr);
if (splits)
{
splits->set_attribute_float("state",
splits->set_attribute_float(osd::debugger::ATTR_SPLITS_CONSOLE_STATE,
[regSplit isSubviewCollapsed:[[regSplit subviews] objectAtIndex:0]]
? 0.0
: NSMaxX([[[regSplit subviews] objectAtIndex:0] frame]));
splits->set_attribute_float("disassembly",
splits->set_attribute_float(osd::debugger::ATTR_SPLITS_CONSOLE_DISASSEMBLY,
[dasmSplit isSubviewCollapsed:[[dasmSplit subviews] objectAtIndex:0]]
? 0.0
: NSMaxY([[[dasmSplit subviews] objectAtIndex:0] frame]));
@ -442,12 +442,12 @@
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node {
[super restoreConfigurationFromNode:node];
util::xml::data_node const *const splits = node->get_child("splits");
util::xml::data_node const *const splits = node->get_child(osd::debugger::NODE_WINDOW_SPLITS);
if (splits)
{
[regSplit setPosition:splits->get_attribute_float("state", NSMaxX([[[regSplit subviews] objectAtIndex:0] frame]))
[regSplit setPosition:splits->get_attribute_float(osd::debugger::ATTR_SPLITS_CONSOLE_STATE, NSMaxX([[[regSplit subviews] objectAtIndex:0] frame]))
ofDividerAtIndex:0];
[dasmSplit setPosition:splits->get_attribute_float("disassembly", NSMaxY([[[dasmSplit subviews] objectAtIndex:0] frame]))
[dasmSplit setPosition:splits->get_attribute_float(osd::debugger::ATTR_SPLITS_CONSOLE_DISASSEMBLY, NSMaxY([[[dasmSplit subviews] objectAtIndex:0] frame]))
ofDividerAtIndex:0];
}
[dasmView restoreConfigurationFromNode:node];

View File

@ -6,8 +6,13 @@
//
//============================================================
#ifndef __SDL_DEBUGOSX__
#define __SDL_DEBUGOSX__
#ifndef MAME_OSD_DEBUGGER_OSX_DEBUGOSX_H
#define MAME_OSD_DEBUGGER_OSX_DEBUGOSX_H
#pragma once
#include "../xmlconfig.h"
#define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
@ -20,30 +25,6 @@
// standard Cocoa headers
#import <Cocoa/Cocoa.h>
// workarounds for 10.6 warnings
#ifdef MAC_OS_X_VERSION_MAX_ALLOWED
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
@protocol NSWindowDelegate <NSObject>
@end
@protocol NSSplitViewDelegate <NSObject>
@end
@protocol NSControlTextEditingDelegate <NSObject>
@end
@protocol NSTextFieldDelegate <NSControlTextEditingDelegate>
@end
@protocol NSOutlineViewDataSource <NSObject>
@end
#endif // MAC_OS_X_VERSION_MAX_ALLOWED < 1060
#endif // MAC_OS_X_VERSION_MAX_ALLOWED
#endif // __OBJC__
#endif // __SDL_DEBUGOSX__
#endif // MAME_OSD_DEBUGGER_OSX_DEBUGOSX_H

View File

@ -493,22 +493,22 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
if (view->cursor_supported())
{
util::xml::data_node *const selection = node->add_child("selection", nullptr);
util::xml::data_node *const selection = node->add_child(osd::debugger::NODE_WINDOW_SELECTION, nullptr);
if (selection)
{
debug_view_xy const pos = view->cursor_position();
selection->set_attribute_int("visible", view->cursor_visible() ? 1 : 0);
selection->set_attribute_int("start_x", pos.x);
selection->set_attribute_int("start_y", pos.y);
selection->set_attribute_int(osd::debugger::ATTR_SELECTION_CURSOR_VISIBLE, view->cursor_visible() ? 1 : 0);
selection->set_attribute_int(osd::debugger::ATTR_SELECTION_CURSOR_X, pos.x);
selection->set_attribute_int(osd::debugger::ATTR_SELECTION_CURSOR_Y, pos.y);
}
}
util::xml::data_node *const scroll = node->add_child("scroll", nullptr);
util::xml::data_node *const scroll = node->add_child(osd::debugger::NODE_WINDOW_SCROLL, nullptr);
if (scroll)
{
NSRect const visible = [self visibleRect];
scroll->set_attribute_float("position_x", visible.origin.x);
scroll->set_attribute_float("position_y", visible.origin.y);
scroll->set_attribute_float(osd::debugger::ATTR_SCROLL_ORIGIN_X, visible.origin.x);
scroll->set_attribute_float(osd::debugger::ATTR_SCROLL_ORIGIN_Y, visible.origin.y);
}
}
@ -516,23 +516,23 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node {
if (view->cursor_supported())
{
util::xml::data_node const *const selection = node->get_child("selection");
util::xml::data_node const *const selection = node->get_child(osd::debugger::NODE_WINDOW_SELECTION);
if (selection)
{
debug_view_xy pos = view->cursor_position();
view->set_cursor_visible(0 != selection->get_attribute_int("visible", view->cursor_visible() ? 1 : 0));
pos.x = selection->get_attribute_int("start_x", pos.x);
pos.y = selection->get_attribute_int("start_y", pos.y);
view->set_cursor_visible(0 != selection->get_attribute_int(osd::debugger::ATTR_SELECTION_CURSOR_VISIBLE, view->cursor_visible() ? 1 : 0));
pos.x = selection->get_attribute_int(osd::debugger::ATTR_SELECTION_CURSOR_X, pos.x);
pos.y = selection->get_attribute_int(osd::debugger::ATTR_SELECTION_CURSOR_Y, pos.y);
view->set_cursor_position(pos);
}
}
util::xml::data_node const *const scroll = node->get_child("scroll");
util::xml::data_node const *const scroll = node->get_child(osd::debugger::NODE_WINDOW_SCROLL);
if (scroll)
{
NSRect visible = [self visibleRect];
visible.origin.x = scroll->get_attribute_float("position_x", visible.origin.x);
visible.origin.y = scroll->get_attribute_float("position_y", visible.origin.y);
visible.origin.x = scroll->get_attribute_float(osd::debugger::ATTR_SCROLL_ORIGIN_X, visible.origin.x);
visible.origin.y = scroll->get_attribute_float(osd::debugger::ATTR_SCROLL_ORIGIN_Y, visible.origin.y);
[self scrollRectToVisible:visible];
}
}

View File

@ -23,19 +23,6 @@ extern NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification;
extern NSString *const MAMESaveDebuggerConfigurationNotification;
// for compatibility with the Qt debugger
enum
{
MAME_DEBUGGER_WINDOW_TYPE_CONSOLE = 1,
MAME_DEBUGGER_WINDOW_TYPE_MEMORY_VIEWER,
MAME_DEBUGGER_WINDOW_TYPE_DISASSEMBLY_VIEWER,
MAME_DEBUGGER_WINDOW_TYPE_ERROR_LOG_VIEWER,
MAME_DEBUGGER_WINDOW_TYPE_POINTS_VIEWER,
MAME_DEBUGGER_WINDOW_TYPE_DEVICES_VIEWER,
MAME_DEBUGGER_WINDOW_TYPE_DEVICE_INFO_VIEWER
};
@interface MAMEDebugWindowHandler : NSObject <NSWindowDelegate>
{
NSWindow *window;

View File

@ -276,7 +276,7 @@ NSString *const MAMESaveDebuggerConfigurationNotification = @"MAMESaveDebuggerCo
if (m == machine)
{
util::xml::data_node *parentnode = (util::xml::data_node *)[[[notification userInfo] objectForKey:@"MAMEDebugParentNode"] pointerValue];
util::xml::data_node *node = parentnode->add_child("window", nullptr);
util::xml::data_node *node = parentnode->add_child(osd::debugger::NODE_WINDOW, nullptr);
if (node)
[self saveConfigurationToNode:node];
}
@ -285,19 +285,19 @@ NSString *const MAMESaveDebuggerConfigurationNotification = @"MAMESaveDebuggerCo
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
NSRect frame = [window frame];
node->set_attribute_float("position_x", frame.origin.x);
node->set_attribute_float("position_y", frame.origin.y);
node->set_attribute_float("size_x", frame.size.width);
node->set_attribute_float("size_y", frame.size.height);
node->set_attribute_float(osd::debugger::ATTR_WINDOW_POSITION_X, frame.origin.x);
node->set_attribute_float(osd::debugger::ATTR_WINDOW_POSITION_Y, frame.origin.y);
node->set_attribute_float(osd::debugger::ATTR_WINDOW_WIDTH, frame.size.width);
node->set_attribute_float(osd::debugger::ATTR_WINDOW_HEIGHT, frame.size.height);
}
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node {
NSRect frame = [window frame];
frame.origin.x = node->get_attribute_float("position_x", frame.origin.x);
frame.origin.y = node->get_attribute_float("position_y", frame.origin.y);
frame.size.width = node->get_attribute_float("size_x", frame.size.width);
frame.size.height = node->get_attribute_float("size_y", frame.size.height);
frame.origin.x = node->get_attribute_float(osd::debugger::ATTR_WINDOW_POSITION_X, frame.origin.x);
frame.origin.y = node->get_attribute_float(osd::debugger::ATTR_WINDOW_POSITION_Y, frame.origin.y);
frame.size.width = node->get_attribute_float(osd::debugger::ATTR_WINDOW_WIDTH, frame.size.width);
frame.size.height = node->get_attribute_float(osd::debugger::ATTR_WINDOW_HEIGHT, frame.size.height);
NSSize min = [window minSize];
frame.size.width = std::max(frame.size.width, min.width);
@ -493,13 +493,13 @@ NSString *const MAMESaveDebuggerConfigurationNotification = @"MAMESaveDebuggerCo
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
[super saveConfigurationToNode:node];
node->add_child("expression", [[self expression] UTF8String]);
node->add_child(osd::debugger::NODE_WINDOW_EXPRESSION, [[self expression] UTF8String]);
}
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node {
[super restoreConfigurationFromNode:node];
util::xml::data_node const *const expr = node->get_child("expression");
util::xml::data_node const *const expr = node->get_child(osd::debugger::NODE_WINDOW_EXPRESSION);
if (expr && expr->get_value())
[self setExpression:[NSString stringWithUTF8String:expr->get_value()]];
}

View File

@ -237,7 +237,7 @@
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
[super saveConfigurationToNode:node];
node->set_attribute_int("type", MAME_DEBUGGER_WINDOW_TYPE_DEVICE_INFO_VIEWER);
node->set_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, osd::debugger::WINDOW_TYPE_DEVICE_INFO_VIEWER);
}
@end

View File

@ -185,7 +185,7 @@
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
[super saveConfigurationToNode:node];
node->set_attribute_int("type", MAME_DEBUGGER_WINDOW_TYPE_DEVICES_VIEWER);
node->set_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, osd::debugger::WINDOW_TYPE_DEVICES_VIEWER);
}

View File

@ -274,14 +274,14 @@
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
[super saveConfigurationToNode:node];
debug_view_disasm *const dasmView = downcast<debug_view_disasm *>(view);
node->set_attribute_int("rightbar", dasmView->right_column());
node->set_attribute_int(osd::debugger::ATTR_WINDOW_DISASSEMBLY_RIGHT_COLUMN, dasmView->right_column());
}
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node {
[super restoreConfigurationFromNode:node];
debug_view_disasm *const dasmView = downcast<debug_view_disasm *>(view);
dasmView->set_right_column((disasm_right_column)node->get_attribute_int("rightbar", dasmView->right_column()));
dasmView->set_right_column((disasm_right_column)node->get_attribute_int(osd::debugger::ATTR_WINDOW_DISASSEMBLY_RIGHT_COLUMN, dasmView->right_column()));
}
@end

View File

@ -232,15 +232,15 @@
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
[super saveConfigurationToNode:node];
node->set_attribute_int("type", MAME_DEBUGGER_WINDOW_TYPE_DISASSEMBLY_VIEWER);
node->set_attribute_int("cpu", [dasmView selectedSubviewIndex]);
node->set_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, osd::debugger::WINDOW_TYPE_DISASSEMBLY_VIEWER);
node->set_attribute_int(osd::debugger::ATTR_WINDOW_DISASSEMBLY_CPU, [dasmView selectedSubviewIndex]);
[dasmView saveConfigurationToNode:node];
}
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node {
[super restoreConfigurationFromNode:node];
int const region = node->get_attribute_int("cpu", [dasmView selectedSubviewIndex]);
int const region = node->get_attribute_int(osd::debugger::ATTR_WINDOW_DISASSEMBLY_CPU, [dasmView selectedSubviewIndex]);
[dasmView selectSubviewAtIndex:region];
[window setTitle:[NSString stringWithFormat:@"Disassembly: %@", [dasmView selectedSubviewName]]];
[subviewButton selectItemAtIndex:[subviewButton indexOfItemWithTag:[dasmView selectedSubviewIndex]]];

View File

@ -64,7 +64,7 @@
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
[super saveConfigurationToNode:node];
node->set_attribute_int("type", MAME_DEBUGGER_WINDOW_TYPE_ERROR_LOG_VIEWER);
node->set_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, osd::debugger::WINDOW_TYPE_ERROR_LOG_VIEWER);
}
@end

View File

@ -212,20 +212,22 @@
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
[super saveConfigurationToNode:node];
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", int(memView->get_data_format()));
node->set_attribute_int("rowchunks", memView->chunks_per_row());
node->set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_REVERSE_COLUMNS, memView->reverse() ? 1 : 0);
node->set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_ADDRESS_MODE, memView->physical() ? 1 : 0);
node->get_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_ADDRESS_RADIX, memView->address_radix());
node->set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_DATA_FORMAT, int(memView->get_data_format()));
node->set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_ROW_CHUNKS, memView->chunks_per_row());
}
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node {
[super restoreConfigurationFromNode:node];
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(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()));
memView->set_reverse(0 != node->get_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_REVERSE_COLUMNS, memView->reverse() ? 1 : 0));
memView->set_physical(0 != node->get_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_ADDRESS_MODE, memView->physical() ? 1 : 0));
memView->set_address_radix(node->get_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_ADDRESS_RADIX, memView->address_radix()));
memView->set_data_format(debug_view_memory::data_format(node->get_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_DATA_FORMAT, int(memView->get_data_format()))));
memView->set_chunks_per_row(node->get_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_ROW_CHUNKS, memView->chunks_per_row()));
}

View File

@ -178,15 +178,15 @@
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
[super saveConfigurationToNode:node];
node->set_attribute_int("type", MAME_DEBUGGER_WINDOW_TYPE_MEMORY_VIEWER);
node->set_attribute_int("memoryregion", [memoryView selectedSubviewIndex]);
node->set_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, osd::debugger::WINDOW_TYPE_MEMORY_VIEWER);
node->set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_REGION, [memoryView selectedSubviewIndex]);
[memoryView saveConfigurationToNode:node];
}
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node {
[super restoreConfigurationFromNode:node];
int const region = node->get_attribute_int("memoryregion", [memoryView selectedSubviewIndex]);
int const region = node->get_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_REGION, [memoryView selectedSubviewIndex]);
[memoryView selectSubviewAtIndex:region];
[window setTitle:[NSString stringWithFormat:@"Memory: %@", [memoryView selectedSubviewName]]];
[subviewButton selectItemAtIndex:[subviewButton indexOfItemWithTag:[memoryView selectedSubviewIndex]]];

View File

@ -172,14 +172,14 @@
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
[super saveConfigurationToNode:node];
node->set_attribute_int("type", MAME_DEBUGGER_WINDOW_TYPE_POINTS_VIEWER);
node->set_attribute_int("bwtype", [tabs indexOfTabViewItem:[tabs selectedTabViewItem]]);
node->set_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, osd::debugger::WINDOW_TYPE_POINTS_VIEWER);
node->set_attribute_int(osd::debugger::ATTR_WINDOW_POINTS_TYPE, [tabs indexOfTabViewItem:[tabs selectedTabViewItem]]);
}
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node {
[super restoreConfigurationFromNode:node];
int const tab = node->get_attribute_int("bwtype", [tabs indexOfTabViewItem:[tabs selectedTabViewItem]]);
int const tab = node->get_attribute_int(osd::debugger::ATTR_WINDOW_POINTS_TYPE, [tabs indexOfTabViewItem:[tabs selectedTabViewItem]]);
if ((0 <= tab) && ([tabs numberOfTabViewItems] > tab))
{
[subviewButton selectItemAtIndex:tab];

View File

@ -6,6 +6,8 @@
#include "debug/debugcon.h"
#include "debug/debugcpu.h"
#include "util/xmlfile.h"
#include <QtWidgets/QActionGroup>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QMenu>
@ -140,12 +142,12 @@ void BreakpointsWindowQtConfig::applyToQWidget(QWidget* widget)
void BreakpointsWindowQtConfig::addToXmlDataNode(util::xml::data_node &node) const
{
WindowQtConfig::addToXmlDataNode(node);
node.set_attribute_int("bwtype", m_bwType);
node.set_attribute_int(osd::debugger::ATTR_WINDOW_POINTS_TYPE, m_bwType);
}
void BreakpointsWindowQtConfig::recoverFromXmlNode(util::xml::data_node const &node)
{
WindowQtConfig::recoverFromXmlNode(node);
m_bwType = node.get_attribute_int("bwtype", m_bwType);
m_bwType = node.get_attribute_int(osd::debugger::ATTR_WINDOW_POINTS_TYPE, m_bwType);
}

View File

@ -8,6 +8,8 @@
#include "debug/dvdisasm.h"
#include "debug/points.h"
#include "util/xmlfile.h"
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QAction>
@ -288,11 +290,11 @@ void DasmWindowQtConfig::buildFromQWidget(QWidget *widget)
QActionGroup *rightBarGroup = window->findChild<QActionGroup *>("rightbargroup");
if (rightBarGroup->checkedAction()->text() == "Raw Opcodes")
m_rightBar = 0;
m_rightBar = DASM_RIGHTCOL_RAW;
else if (rightBarGroup->checkedAction()->text() == "Encrypted Opcodes")
m_rightBar = 1;
m_rightBar = DASM_RIGHTCOL_ENCRYPTED;
else if (rightBarGroup->checkedAction()->text() == "Comments")
m_rightBar = 2;
m_rightBar = DASM_RIGHTCOL_COMMENTS;
}
void DasmWindowQtConfig::applyToQWidget(QWidget *widget)
@ -302,20 +304,23 @@ void DasmWindowQtConfig::applyToQWidget(QWidget *widget)
QComboBox *cpu = window->findChild<QComboBox *>("cpu");
cpu->setCurrentIndex(m_cpu);
QActionGroup *rightBarGroup = window->findChild<QActionGroup *>("rightbargroup");
rightBarGroup->actions()[m_rightBar]->trigger();
if ((DASM_RIGHTCOL_RAW <= m_rightBar) && (DASM_RIGHTCOL_COMMENTS >= m_rightBar))
{
QActionGroup *rightBarGroup = window->findChild<QActionGroup *>("rightbargroup");
rightBarGroup->actions()[m_rightBar - 1]->trigger();
}
}
void DasmWindowQtConfig::addToXmlDataNode(util::xml::data_node &node) const
{
WindowQtConfig::addToXmlDataNode(node);
node.set_attribute_int("cpu", m_cpu);
node.set_attribute_int("rightbar", m_rightBar);
node.set_attribute_int(osd::debugger::ATTR_WINDOW_DISASSEMBLY_CPU, m_cpu);
node.set_attribute_int(osd::debugger::ATTR_WINDOW_DISASSEMBLY_RIGHT_COLUMN, m_rightBar);
}
void DasmWindowQtConfig::recoverFromXmlNode(util::xml::data_node const &node)
{
WindowQtConfig::recoverFromXmlNode(node);
m_cpu = node.get_attribute_int("cpu", m_cpu);
m_rightBar = node.get_attribute_int("rightbar", m_rightBar);
m_cpu = node.get_attribute_int(osd::debugger::ATTR_WINDOW_DISASSEMBLY_CPU, m_cpu);
m_rightBar = node.get_attribute_int(osd::debugger::ATTR_WINDOW_DISASSEMBLY_RIGHT_COLUMN, m_rightBar);
}

View File

@ -1,12 +1,14 @@
// license:BSD-3-Clause
// copyright-holders:Andrew Gardner
#include "emu.h"
#include "deviceinformationwindow.h"
#include "util/xmlfile.h"
#include <QtWidgets/QFrame>
#include <QtWidgets/QLabel>
#include <QtWidgets/QVBoxLayout>
#include "deviceinformationwindow.h"
DeviceInformationWindow::DeviceInformationWindow(running_machine &machine, device_t *device, QWidget *parent) :
WindowQt(machine, nullptr),
@ -127,12 +129,12 @@ void DeviceInformationWindowQtConfig::applyToQWidget(QWidget *widget)
void DeviceInformationWindowQtConfig::addToXmlDataNode(util::xml::data_node &node) const
{
WindowQtConfig::addToXmlDataNode(node);
node.set_attribute("device-tag", m_device_tag.c_str());
node.set_attribute(osd::debugger::ATTR_WINDOW_DEVICE_TAG, m_device_tag.c_str());
}
void DeviceInformationWindowQtConfig::recoverFromXmlNode(util::xml::data_node const &node)
{
WindowQtConfig::recoverFromXmlNode(node);
m_device_tag = node.get_attribute_string("device-tag", ":");
m_device_tag = node.get_attribute_string(osd::debugger::ATTR_WINDOW_DEVICE_TAG, ":");
}

View File

@ -2,8 +2,12 @@
// copyright-holders:Andrew Gardner
#include "emu.h"
#include "deviceswindow.h"
#include "deviceinformationwindow.h"
#include "util/xmlfile.h"
DevicesWindowModel::DevicesWindowModel(running_machine &machine, QObject *parent) :
m_machine(machine)
{

View File

@ -1,14 +1,16 @@
// license:BSD-3-Clause
// copyright-holders:Andrew Gardner
#include "emu.h"
#include <QtWidgets/QVBoxLayout>
#include "logwindow.h"
#include "debug/debugcon.h"
#include "debug/debugcpu.h"
#include "debug/dvdisasm.h"
#include "util/xmlfile.h"
#include <QtWidgets/QVBoxLayout>
LogWindow::LogWindow(running_machine &machine, QWidget *parent) :
WindowQt(machine, nullptr)

View File

@ -8,6 +8,8 @@
#include "debug/dvdisasm.h"
#include "debug/points.h"
#include "util/xmlfile.h"
#include <QtGui/QCloseEvent>
#include <QtWidgets/QAction>
#include <QtWidgets/QDockWidget>
@ -499,7 +501,7 @@ void MainWindowQtConfig::applyToQWidget(QWidget *widget)
void MainWindowQtConfig::addToXmlDataNode(util::xml::data_node &node) const
{
WindowQtConfig::addToXmlDataNode(node);
node.set_attribute_int("rightbar", m_rightBar);
node.set_attribute_int(osd::debugger::ATTR_WINDOW_DISASSEMBLY_RIGHT_COLUMN, m_rightBar);
node.set_attribute("qtwindowstate", m_windowState.toPercentEncoding().data());
}
@ -509,7 +511,7 @@ void MainWindowQtConfig::recoverFromXmlNode(util::xml::data_node const &node)
WindowQtConfig::recoverFromXmlNode(node);
const char* state = node.get_attribute_string("qtwindowstate", "");
m_windowState = QByteArray::fromPercentEncoding(state);
m_rightBar = node.get_attribute_int("rightbar", m_rightBar);
m_rightBar = node.get_attribute_int(osd::debugger::ATTR_WINDOW_DISASSEMBLY_RIGHT_COLUMN, m_rightBar);
}
DasmDockWidget::~DasmDockWidget()

View File

@ -7,6 +7,8 @@
#include "debug/debugcon.h"
#include "debug/debugcpu.h"
#include "util/xmlfile.h"
#include <QtGui/QClipboard>
#include <QtGui/QMouseEvent>
#include <QtWidgets/QActionGroup>
@ -76,17 +78,17 @@ MemoryWindow::MemoryWindow(running_machine &machine, QWidget *parent) :
// Create a data format group
QActionGroup *dataFormat = new QActionGroup(this);
dataFormat->setObjectName("dataformat");
QAction *formatActOne = new QAction("1-byte hexadecimal", this);
QAction *formatActTwo = new QAction("2-byte hexadecimal", this);
QAction *formatActFour = new QAction("4-byte hexadecimal", this);
QAction *formatActEight = new QAction("8-byte hexadecimal", this);
QAction *formatActOneOctal = new QAction("1-byte octal", this);
QAction *formatActTwoOctal = new QAction("2-byte octal", this);
QAction *formatActFourOctal = new QAction("4-byte octal", this);
QAction *formatActEightOctal = new QAction("8-byte octal", this);
QAction *formatAct32bitFloat = new QAction("32 bit floating point", this);
QAction *formatAct64bitFloat = new QAction("64 bit floating point", this);
QAction *formatAct80bitFloat = new QAction("80 bit floating point", this);
QAction *formatActOne = new QAction("1-byte Chunks (Hex)", this);
QAction *formatActTwo = new QAction("2-byte Chunks (Hex)", this);
QAction *formatActFour = new QAction("4-byte Chunks (Hex)", this);
QAction *formatActEight = new QAction("8-byte Chunks (Hex)", this);
QAction *formatActOneOctal = new QAction("1-byte Chunks (Octal)", this);
QAction *formatActTwoOctal = new QAction("2-byte Chunks (Octal)", this);
QAction *formatActFourOctal = new QAction("4-byte Chunks (Octal)", this);
QAction *formatActEightOctal = new QAction("8-byte Chunks (Octal)", this);
QAction *formatAct32bitFloat = new QAction("32-bit Floating Point", this);
QAction *formatAct64bitFloat = new QAction("64-bit Floating Point", this);
QAction *formatAct80bitFloat = new QAction("80-bit Floating Point", this);
formatActOne->setObjectName("formatActOne");
formatActTwo->setObjectName("formatActTwo");
formatActFour->setObjectName("formatActFour");
@ -484,35 +486,35 @@ void MemoryWindowQtConfig::buildFromQWidget(QWidget *widget)
QActionGroup *radixGroup = window->findChild<QActionGroup*>("radixgroup");
if (radixGroup->checkedAction()->text() == "Hexadecimal Addresses")
m_addressRadix = 0;
m_addressRadix = 16;
else if (radixGroup->checkedAction()->text() == "Decimal Addresses")
m_addressRadix = 1;
m_addressRadix = 10;
else if (radixGroup->checkedAction()->text() == "Octal Addresses")
m_addressRadix = 2;
m_addressRadix = 8;
QActionGroup *dataFormat = window->findChild<QActionGroup*>("dataformat");
if (dataFormat->checkedAction()->text() == "1-byte hexadecimal")
m_dataFormat = 0;
else if (dataFormat->checkedAction()->text() == "2-byte hexadecimal")
m_dataFormat = 1;
else if (dataFormat->checkedAction()->text() == "4-byte hexadecimal")
m_dataFormat = 2;
else if (dataFormat->checkedAction()->text() == "8-byte hexadecimal")
m_dataFormat = 3;
else if (dataFormat->checkedAction()->text() == "1-byte octal")
m_dataFormat = 4;
else if (dataFormat->checkedAction()->text() == "2-byte octal")
m_dataFormat = 5;
else if (dataFormat->checkedAction()->text() == "4-byte octal")
m_dataFormat = 6;
else if (dataFormat->checkedAction()->text() == "8-byte octal")
m_dataFormat = 7;
else if (dataFormat->checkedAction()->text() == "32 bit floating point")
m_dataFormat = 8;
else if (dataFormat->checkedAction()->text() == "64 bit floating point")
m_dataFormat = 9;
else if (dataFormat->checkedAction()->text() == "80 bit floating point")
m_dataFormat = 10;
if (dataFormat->checkedAction()->text() == "1-byte Chunks (Hex)")
m_dataFormat = int(debug_view_memory::data_format::HEX_8BIT);
else if (dataFormat->checkedAction()->text() == "2-byte Chunks (Hex)")
m_dataFormat = int(debug_view_memory::data_format::HEX_16BIT);
else if (dataFormat->checkedAction()->text() == "4-byte Chunks (Hex)")
m_dataFormat = int(debug_view_memory::data_format::HEX_32BIT);
else if (dataFormat->checkedAction()->text() == "8-byte Chunks (Hex)")
m_dataFormat = int(debug_view_memory::data_format::HEX_64BIT);
else if (dataFormat->checkedAction()->text() == "1-byte Chunks (Octal)")
m_dataFormat = int(debug_view_memory::data_format::OCTAL_8BIT);
else if (dataFormat->checkedAction()->text() == "2-byte Chunks (Octal)")
m_dataFormat = int(debug_view_memory::data_format::OCTAL_16BIT);
else if (dataFormat->checkedAction()->text() == "4-byte Chunks (Octal)")
m_dataFormat = int(debug_view_memory::data_format::OCTAL_32BIT);
else if (dataFormat->checkedAction()->text() == "8-byte Chunks (Octal)")
m_dataFormat = int(debug_view_memory::data_format::OCTAL_64BIT);
else if (dataFormat->checkedAction()->text() == "32-bit floating point")
m_dataFormat = int(debug_view_memory::data_format::FLOAT_32BIT);
else if (dataFormat->checkedAction()->text() == "64-bit Floating Point")
m_dataFormat = int(debug_view_memory::data_format::FLOAT_64BIT);
else if (dataFormat->checkedAction()->text() == "80-bit Floating Point")
m_dataFormat = int(debug_view_memory::data_format::FLOAT_80BIT);
}
@ -531,30 +533,50 @@ void MemoryWindowQtConfig::applyToQWidget(QWidget *widget)
addressGroup->actions()[m_addressMode]->trigger();
QActionGroup *radixGroup = window->findChild<QActionGroup*>("radixgroup");
radixGroup->actions()[m_addressRadix]->trigger();
switch (m_addressRadix)
{
case 16: radixGroup->actions()[0]->trigger(); break;
case 10: radixGroup->actions()[1]->trigger(); break;
case 8: radixGroup->actions()[2]->trigger(); break;
default: break;
}
QActionGroup *dataFormat = window->findChild<QActionGroup*>("dataformat");
dataFormat->actions()[m_dataFormat]->trigger();
switch (debug_view_memory::data_format(m_dataFormat))
{
case debug_view_memory::data_format::HEX_8BIT: dataFormat->actions()[0]->trigger(); break;
case debug_view_memory::data_format::HEX_16BIT: dataFormat->actions()[1]->trigger(); break;
case debug_view_memory::data_format::HEX_32BIT: dataFormat->actions()[2]->trigger(); break;
case debug_view_memory::data_format::HEX_64BIT: dataFormat->actions()[3]->trigger(); break;
case debug_view_memory::data_format::OCTAL_8BIT: dataFormat->actions()[4]->trigger(); break;
case debug_view_memory::data_format::OCTAL_16BIT: dataFormat->actions()[5]->trigger(); break;
case debug_view_memory::data_format::OCTAL_32BIT: dataFormat->actions()[6]->trigger(); break;
case debug_view_memory::data_format::OCTAL_64BIT: dataFormat->actions()[7]->trigger(); break;
case debug_view_memory::data_format::FLOAT_32BIT: dataFormat->actions()[8]->trigger(); break;
case debug_view_memory::data_format::FLOAT_64BIT: dataFormat->actions()[9]->trigger(); break;
case debug_view_memory::data_format::FLOAT_80BIT: dataFormat->actions()[10]->trigger(); break;
default: break;
}
}
void MemoryWindowQtConfig::addToXmlDataNode(util::xml::data_node &node) const
{
WindowQtConfig::addToXmlDataNode(node);
node.set_attribute_int("memoryregion", m_memoryRegion);
node.set_attribute_int("reverse", m_reverse);
node.set_attribute_int("addressmode", m_addressMode);
node.set_attribute_int("addressradix", m_addressRadix);
node.set_attribute_int("dataformat", m_dataFormat);
node.set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_REGION, m_memoryRegion);
node.set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_REVERSE_COLUMNS, m_reverse);
node.set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_ADDRESS_MODE, m_addressMode);
node.set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_ADDRESS_RADIX, m_addressRadix);
node.set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_DATA_FORMAT, m_dataFormat);
}
void MemoryWindowQtConfig::recoverFromXmlNode(util::xml::data_node const &node)
{
WindowQtConfig::recoverFromXmlNode(node);
m_memoryRegion = node.get_attribute_int("memoryregion", m_memoryRegion);
m_reverse = node.get_attribute_int("reverse", m_reverse);
m_addressMode = node.get_attribute_int("addressmode", m_addressMode);
m_addressRadix = node.get_attribute_int("addressradix", m_addressRadix);
m_dataFormat = node.get_attribute_int("dataformat", m_dataFormat);
m_memoryRegion = node.get_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_REGION, m_memoryRegion);
m_reverse = node.get_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_REVERSE_COLUMNS, m_reverse);
m_addressMode = node.get_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_ADDRESS_MODE, m_addressMode);
m_addressRadix = node.get_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_ADDRESS_RADIX, m_addressRadix);
m_dataFormat = node.get_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_DATA_FORMAT, m_dataFormat);
}

View File

@ -12,6 +12,8 @@
#include "debug/debugcon.h"
#include "debug/debugcpu.h"
#include "util/xmlfile.h"
#include <QtWidgets/QMenu>
#include <QtWidgets/QMenuBar>
@ -35,15 +37,15 @@ WindowQt::WindowQt(running_machine &machine, QWidget *parent) :
debugActOpenMemory->setShortcut(QKeySequence("Ctrl+M"));
connect(debugActOpenMemory, &QAction::triggered, this, &WindowQt::debugActOpenMemory);
QAction *debugActOpenDasm = new QAction("New &Dasm Window", this);
QAction *debugActOpenDasm = new QAction("New &Disassembly Window", this);
debugActOpenDasm->setShortcut(QKeySequence("Ctrl+D"));
connect(debugActOpenDasm, &QAction::triggered, this, &WindowQt::debugActOpenDasm);
QAction *debugActOpenLog = new QAction("New &Log Window", this);
QAction *debugActOpenLog = new QAction("New Error &Log Window", this);
debugActOpenLog->setShortcut(QKeySequence("Ctrl+L"));
connect(debugActOpenLog, &QAction::triggered, this, &WindowQt::debugActOpenLog);
QAction *debugActOpenPoints = new QAction("New &Break|Watchpoints Window", this);
QAction *debugActOpenPoints = new QAction("New (&Break|Watch)points Window", this);
debugActOpenPoints->setShortcut(QKeySequence("Ctrl+B"));
connect(debugActOpenPoints, &QAction::triggered, this, &WindowQt::debugActOpenPoints);
@ -261,19 +263,19 @@ void WindowQtConfig::applyToQWidget(QWidget *widget)
void WindowQtConfig::addToXmlDataNode(util::xml::data_node &node) const
{
node.set_attribute_int("type", m_type);
node.set_attribute_int("position_x", m_position.x());
node.set_attribute_int("position_y", m_position.y());
node.set_attribute_int("size_x", m_size.x());
node.set_attribute_int("size_y", m_size.y());
node.set_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, m_type);
node.set_attribute_int(osd::debugger::ATTR_WINDOW_POSITION_X, m_position.x());
node.set_attribute_int(osd::debugger::ATTR_WINDOW_POSITION_Y, m_position.y());
node.set_attribute_int(osd::debugger::ATTR_WINDOW_WIDTH, m_size.x());
node.set_attribute_int(osd::debugger::ATTR_WINDOW_HEIGHT, m_size.y());
}
void WindowQtConfig::recoverFromXmlNode(util::xml::data_node const &node)
{
m_size.setX(node.get_attribute_int("size_x", m_size.x()));
m_size.setY(node.get_attribute_int("size_y", m_size.y()));
m_position.setX(node.get_attribute_int("position_x", m_position.x()));
m_position.setY(node.get_attribute_int("position_y", m_position.y()));
m_type = (WindowQtConfig::WindowType)node.get_attribute_int("type", m_type);
m_size.setX(node.get_attribute_int(osd::debugger::ATTR_WINDOW_WIDTH, m_size.x()));
m_size.setY(node.get_attribute_int(osd::debugger::ATTR_WINDOW_HEIGHT, m_size.y()));
m_position.setX(node.get_attribute_int(osd::debugger::ATTR_WINDOW_POSITION_X, m_position.x()));
m_position.setY(node.get_attribute_int(osd::debugger::ATTR_WINDOW_POSITION_Y, m_position.y()));
m_type = (WindowQtConfig::WindowType)node.get_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, m_type);
}

View File

@ -3,6 +3,8 @@
#ifndef MAME_DEBUGGER_QT_WINDOWQT_H
#define MAME_DEBUGGER_QT_WINDOWQT_H
#include "../xmlconfig.h"
#include "config.h"
#include "debugger.h"

View File

@ -12,6 +12,9 @@
#include "debugviewinfo.h"
#include "uimetrics.h"
// devices
#include "imagedev/cassette.h"
// emu
#include "debug/debugcon.h"
#include "debugger.h"
@ -19,8 +22,8 @@
#include "softlist_dev.h"
#include "debug/debugcpu.h"
// devices
#include "imagedev/cassette.h"
// util
#include "util/xmlfile.h"
// osd/windows
#include "winutf8.h"
@ -496,6 +499,13 @@ bool consolewin_info::handle_command(WPARAM wparam, LPARAM lparam)
}
void consolewin_info::save_configuration_to_node(util::xml::data_node &node)
{
disasmbasewin_info::save_configuration_to_node(node);
node.set_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, osd::debugger::WINDOW_TYPE_CONSOLE);
}
void consolewin_info::process_string(std::string const &string)
{
if (string.empty()) // an empty string is a single step

View File

@ -27,6 +27,7 @@ protected:
virtual void recompute_children() override;
virtual void update_menu() override;
virtual bool handle_command(WPARAM wparam, LPARAM lparam) override;
virtual void save_configuration_to_node(util::xml::data_node &node) override;
private:
enum

View File

@ -12,9 +12,12 @@
#include "debugwininfo.h"
#include "uimetrics.h"
#include "debugger.h"
#include "debug/debugcon.h"
#include "debug/debugcpu.h"
#include "util/xmlfile.h"
#include "strconv.h"
#include "winutil.h"
@ -180,6 +183,18 @@ void debugview_info::send_pagedown()
}
int debugview_info::source_index() const
{
if (m_view)
{
debug_view_source const *const source = m_view->source();
if (source)
return m_view->source_index(*source);
}
return -1;
}
char const *debugview_info::source_name() const
{
if (m_view)
@ -284,6 +299,56 @@ HWND debugview_info::create_source_combobox(HWND parent, LONG_PTR userdata)
}
void debugview_info::restore_configuration_from_node(util::xml::data_node const &node)
{
if (m_view->cursor_supported())
{
util::xml::data_node const *const selection = node.get_child(osd::debugger::NODE_WINDOW_SELECTION);
if (selection)
{
debug_view_xy pos = m_view->cursor_position();
m_view->set_cursor_visible(0 != selection->get_attribute_int(osd::debugger::ATTR_SELECTION_CURSOR_VISIBLE, m_view->cursor_visible() ? 1 : 0));
selection->get_attribute_int(osd::debugger::ATTR_SELECTION_CURSOR_X, pos.x);
selection->get_attribute_int(osd::debugger::ATTR_SELECTION_CURSOR_Y, pos.y);
m_view->set_cursor_position(pos);
}
}
util::xml::data_node const *const scroll = node.get_child(osd::debugger::NODE_WINDOW_SCROLL);
if (scroll)
{
debug_view_xy origin = m_view->visible_position();
origin.x = scroll->get_attribute_int(osd::debugger::ATTR_SCROLL_ORIGIN_X, origin.x * metrics().debug_font_width()) / metrics().debug_font_width();
origin.y = scroll->get_attribute_int(osd::debugger::ATTR_SCROLL_ORIGIN_Y, origin.y * metrics().debug_font_height()) / metrics().debug_font_height();
m_view->set_visible_position(origin);
}
}
void debugview_info::save_configuration_to_node(util::xml::data_node &node)
{
if (m_view->cursor_supported())
{
util::xml::data_node *const selection = node.add_child(osd::debugger::NODE_WINDOW_SELECTION, nullptr);
if (selection)
{
debug_view_xy const pos = m_view->cursor_position();
selection->set_attribute_int(osd::debugger::ATTR_SELECTION_CURSOR_VISIBLE, m_view->cursor_visible() ? 1 : 0);
selection->set_attribute_int(osd::debugger::ATTR_SELECTION_CURSOR_X, pos.x);
selection->set_attribute_int(osd::debugger::ATTR_SELECTION_CURSOR_Y, pos.y);
}
}
util::xml::data_node *const scroll = node.add_child(osd::debugger::NODE_WINDOW_SCROLL, nullptr);
if (scroll)
{
debug_view_xy const origin = m_view->visible_position();
scroll->set_attribute_int(osd::debugger::ATTR_SCROLL_ORIGIN_X, origin.x * metrics().debug_font_width());
scroll->set_attribute_int(osd::debugger::ATTR_SCROLL_ORIGIN_Y, origin.y * metrics().debug_font_height());
}
}
void debugview_info::add_items_to_context_menu(HMENU menu)
{
AppendMenu(menu, MF_ENABLED, ID_CONTEXT_COPY_VISIBLE, TEXT("Copy Visible"));

View File

@ -42,6 +42,7 @@ public:
bool cursor_supported() const { return m_view->cursor_supported(); }
bool cursor_visible() const { return m_view->cursor_visible(); }
int source_index() const;
char const *source_name() const;
device_t *source_device() const;
bool source_is_visible_cpu() const;
@ -51,6 +52,9 @@ public:
HWND create_source_combobox(HWND parent, LONG_PTR userdata);
virtual void restore_configuration_from_node(util::xml::data_node const &node);
virtual void save_configuration_to_node(util::xml::data_node &node);
protected:
enum
{

View File

@ -10,6 +10,8 @@
#pragma once
#include "../xmlconfig.h"
// standard windows headers
#include <windows.h>
#include <windowsx.h>

View File

@ -14,12 +14,17 @@
#include "debugger.h"
#include "debug/debugcon.h"
#include "debug/debugcpu.h"
#include "util/xmlfile.h"
#include "window.h"
#include "winutf8.h"
#include "winutil.h"
#include "modules/lib/osdobj_common.h"
#include <cstring>
bool debugwin_info::s_window_class_registered = false;
@ -251,6 +256,89 @@ bool debugwin_info::handle_key(WPARAM wparam, LPARAM lparam)
}
void debugwin_info::save_configuration(util::xml::data_node &parentnode)
{
util::xml::data_node *const node = parentnode.add_child(osd::debugger::NODE_WINDOW, nullptr);
if (node)
save_configuration_to_node(*node);
}
void debugwin_info::restore_configuration_from_node(util::xml::data_node const &node)
{
// get current size to use for defaults
RECT bounds;
POINT origin;
origin.x = 0;
origin.y = 0;
if (!GetClientRect(window(), &bounds) && ClientToScreen(window(), &origin))
return;
// get saved size and adjust for window chrome
RECT desired;
desired.left = node.get_attribute_int(osd::debugger::ATTR_WINDOW_POSITION_X, origin.x);
desired.top = node.get_attribute_int(osd::debugger::ATTR_WINDOW_POSITION_Y, origin.y);
desired.right = desired.left + node.get_attribute_int(osd::debugger::ATTR_WINDOW_WIDTH, bounds.right);
desired.bottom = desired.top + node.get_attribute_int(osd::debugger::ATTR_WINDOW_HEIGHT, bounds.bottom);
// TODO: sanity checks...
if (!AdjustWindowRectEx(&desired, DEBUG_WINDOW_STYLE, GetMenu(window()) ? TRUE : FALSE, DEBUG_WINDOW_STYLE_EX))
return;
// actually move the window
MoveWindow(
window(),
desired.left,
desired.top,
desired.right - desired.left,
desired.bottom - desired.top,
TRUE);
// restrict to one monitor and avoid toolbars
HMONITOR const nearest_monitor = MonitorFromWindow(window(), MONITOR_DEFAULTTONEAREST);
if (nearest_monitor)
{
MONITORINFO info;
std::memset(&info, 0, sizeof(info));
info.cbSize = sizeof(info);
if (GetMonitorInfo(nearest_monitor, &info))
{
if (desired.right > info.rcWork.right)
{
desired.left -= desired.right - info.rcWork.right;
desired.right = info.rcWork.right;
}
if (desired.bottom > info.rcWork.bottom)
{
desired.top -= desired.bottom - info.rcWork.bottom;
desired.bottom = info.rcWork.bottom;
}
if (desired.left < info.rcWork.left)
{
desired.right += info.rcWork.left - desired.left;
desired.left = info.rcWork.left;
}
if (desired.top < info.rcWork.top)
{
desired.bottom += info.rcWork.top - desired.top;
desired.top = info.rcWork.top;
}
desired.bottom = std::min(info.rcWork.bottom, desired.bottom);
desired.right = std::min(info.rcWork.right, desired.right);
MoveWindow(
window(),
desired.left,
desired.top,
desired.right - desired.left,
desired.bottom - desired.top,
TRUE);
}
}
// sort out contents
recompute_children();
}
void debugwin_info::recompute_children()
{
if (m_views[0] != nullptr)
@ -392,6 +480,22 @@ void debugwin_info::draw_border(HDC dc, RECT &bounds)
}
void debugwin_info::save_configuration_to_node(util::xml::data_node &node)
{
RECT bounds;
POINT origin;
origin.x = 0;
origin.y = 0;
if (GetClientRect(window(), &bounds) && ClientToScreen(window(), &origin))
{
node.set_attribute_int(osd::debugger::ATTR_WINDOW_POSITION_X, origin.x);
node.set_attribute_int(osd::debugger::ATTR_WINDOW_POSITION_Y, origin.y);
node.set_attribute_int(osd::debugger::ATTR_WINDOW_WIDTH, bounds.right);
node.set_attribute_int(osd::debugger::ATTR_WINDOW_HEIGHT, bounds.bottom);
}
}
void debugwin_info::draw_border(HDC dc, HWND child)
{
RECT bounds;

View File

@ -49,6 +49,9 @@ public:
virtual bool handle_key(WPARAM wparam, LPARAM lparam);
void save_configuration(util::xml::data_node &parentnode);
virtual void restore_configuration_from_node(util::xml::data_node const &node);
protected:
static DWORD const DEBUG_WINDOW_STYLE = (WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN) & (~WS_MINIMIZEBOX & ~WS_MAXIMIZEBOX);
static DWORD const DEBUG_WINDOW_STYLE_EX = 0;
@ -125,6 +128,8 @@ protected:
void draw_border(HDC dc, RECT &bounds);
void draw_border(HDC dc, HWND child);
virtual void save_configuration_to_node(util::xml::data_node &node);
std::unique_ptr<debugview_info> m_views[MAX_VIEWS];
private:
@ -141,12 +146,12 @@ private:
HWND m_wnd;
WNDPROC const m_handler;
uint32_t m_minwidth, m_maxwidth;
uint32_t m_minheight, m_maxheight;
uint32_t m_minwidth, m_maxwidth;
uint32_t m_minheight, m_maxheight;
uint16_t m_ignore_char_lparam;
uint16_t m_ignore_char_lparam;
static bool s_window_class_registered;
};
#endif
#endif // MAME_DEBUGGER_WIN_DEBUGWININFO_H

View File

@ -27,7 +27,7 @@ disasmbasewin_info::disasmbasewin_info(debugger_windows_interface &debugger, boo
return;
m_views[0].reset(new disasmview_info(debugger, *this, window()));
if ((m_views[0] == nullptr) || !m_views[0]->is_valid())
if (!m_views[0] || !m_views[0]->is_valid())
{
m_views[0].reset();
return;
@ -118,7 +118,7 @@ void disasmbasewin_info::update_menu()
// first find an existing breakpoint at this address
const debug_breakpoint *bp = debug->breakpoint_find(address);
if (bp == nullptr)
if (!bp)
{
ModifyMenu(menu, ID_TOGGLE_BREAKPOINT, MF_BYCOMMAND, ID_TOGGLE_BREAKPOINT, TEXT("Set breakpoint at cursor\tF9"));
ModifyMenu(menu, ID_DISABLE_BREAKPOINT, MF_BYCOMMAND, ID_DISABLE_BREAKPOINT, TEXT("Disable breakpoint at cursor\tShift+F9"));
@ -131,7 +131,7 @@ void disasmbasewin_info::update_menu()
else
ModifyMenu(menu, ID_DISABLE_BREAKPOINT, MF_BYCOMMAND, ID_DISABLE_BREAKPOINT, TEXT("Enable breakpoint at cursor\tShift+F9"));
}
bool const available = (bp != nullptr) && (!is_main_console() || dasmview->source_is_visible_cpu());
bool const available = bp && (!is_main_console() || dasmview->source_is_visible_cpu());
EnableMenuItem(menu, ID_DISABLE_BREAKPOINT, MF_BYCOMMAND | (available ? MF_ENABLED : MF_GRAYED));
}
else
@ -263,3 +263,17 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam)
}
return editwin_info::handle_command(wparam, lparam);
}
void disasmbasewin_info::restore_configuration_from_node(util::xml::data_node const &node)
{
editwin_info::restore_configuration_from_node(node);
m_views[0]->restore_configuration_from_node(node);
}
void disasmbasewin_info::save_configuration_to_node(util::xml::data_node &node)
{
editwin_info::save_configuration_to_node(node);
m_views[0]->save_configuration_to_node(node);
}

View File

@ -22,10 +22,12 @@ public:
virtual ~disasmbasewin_info();
virtual bool handle_key(WPARAM wparam, LPARAM lparam) override;
virtual void restore_configuration_from_node(util::xml::data_node const &node) override;
protected:
virtual void update_menu() override;
virtual bool handle_command(WPARAM wparam, LPARAM lparam) override;
virtual void save_configuration_to_node(util::xml::data_node &node) override;
};
#endif // MAME_DEBUGGER_WIN_DISASMBASEWININFO_H

View File

@ -9,6 +9,8 @@
#include "emu.h"
#include "disasmviewinfo.h"
#include "util/xmlfile.h"
disasmview_info::disasmview_info(debugger_windows_interface &debugger, debugwin_info &owner, HWND parent) :
debugview_info(debugger, owner, parent, DVT_DISASSEMBLY)
@ -21,6 +23,12 @@ disasmview_info::~disasmview_info()
}
char const *disasmview_info::expression() const
{
return view<debug_view_disasm>()->expression();
}
disasm_right_column disasmview_info::right_column() const
{
return view<debug_view_disasm>()->right_column();
@ -43,3 +51,21 @@ void disasmview_info::set_right_column(disasm_right_column contents)
{
view<debug_view_disasm>()->set_right_column(contents);
}
void disasmview_info::restore_configuration_from_node(util::xml::data_node const &node)
{
debug_view_disasm &dasmview(*view<debug_view_disasm>());
dasmview.set_right_column(disasm_right_column(node.get_attribute_int(osd::debugger::ATTR_WINDOW_DISASSEMBLY_RIGHT_COLUMN, dasmview.right_column())));
debugview_info::restore_configuration_from_node(node);
}
void disasmview_info::save_configuration_to_node(util::xml::data_node &node)
{
debugview_info::save_configuration_to_node(node);
debug_view_disasm &dasmview(*view<debug_view_disasm>());
node.set_attribute_int(osd::debugger::ATTR_WINDOW_DISASSEMBLY_RIGHT_COLUMN, dasmview.right_column());
}

View File

@ -23,11 +23,15 @@ public:
disasmview_info(debugger_windows_interface &debugger, debugwin_info &owner, HWND parent);
virtual ~disasmview_info();
char const *expression() const;
disasm_right_column right_column() const;
offs_t selected_address() const;
void set_expression(const std::string &expression);
void set_right_column(disasm_right_column contents);
virtual void restore_configuration_from_node(util::xml::data_node const &node) override;
virtual void save_configuration_to_node(util::xml::data_node &node) override;
};
#endif // MAME_DEBUGGER_WIN_DISASMVIEWINFO_H

View File

@ -12,6 +12,9 @@
#include "debugviewinfo.h"
#include "disasmviewinfo.h"
#include "uimetrics.h"
#include "util/xmlfile.h"
#include "winutf8.h"
@ -143,3 +146,32 @@ void disasmwin_info::update_caption()
{
win_set_window_text_utf8(window(), std::string("Disassembly: ").append(m_views[0]->source_name()).c_str());
}
void disasmwin_info::restore_configuration_from_node(util::xml::data_node const &node)
{
m_views[0]->set_source_index(node.get_attribute_int(osd::debugger::ATTR_WINDOW_DISASSEMBLY_CPU, m_views[0]->source_index()));
int const cursource = m_views[0]->source_index();
if (0 <= cursource)
SendMessage(m_combownd, CB_SETCURSEL, cursource, 0);
update_caption();
util::xml::data_node const *const expr = node.get_child(osd::debugger::NODE_WINDOW_EXPRESSION);
if (expr && expr->get_value())
{
set_editwnd_text(expr->get_value());
process_string(expr->get_value());
}
disasmbasewin_info::restore_configuration_from_node(node);
}
void disasmwin_info::save_configuration_to_node(util::xml::data_node &node)
{
disasmbasewin_info::save_configuration_to_node(node);
node.set_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, osd::debugger::WINDOW_TYPE_DISASSEMBLY_VIEWER);
node.set_attribute_int(osd::debugger::ATTR_WINDOW_DISASSEMBLY_CPU, m_views[0]->source_index());
node.add_child(osd::debugger::NODE_WINDOW_EXPRESSION, downcast<disasmview_info *>(m_views[0].get())->expression());
}

View File

@ -21,10 +21,13 @@ public:
disasmwin_info(debugger_windows_interface &debugger);
virtual ~disasmwin_info();
virtual void restore_configuration_from_node(util::xml::data_node const &node) override;
protected:
virtual void recompute_children() override;
virtual bool handle_command(WPARAM wparam, LPARAM lparam) override;
virtual void draw_contents(HDC dc) override;
virtual void save_configuration_to_node(util::xml::data_node &node);
private:
virtual void process_string(const std::string &string) override;

View File

@ -12,6 +12,8 @@
#include "debugviewinfo.h"
#include "logviewinfo.h"
#include "util/xmlfile.h"
logwin_info::logwin_info(debugger_windows_interface &debugger) :
debugwin_info(debugger, false, std::string("Errorlog: ").append(debugger.machine().system().type.fullname()).append(" [").append(debugger.machine().system().name).append("]").c_str(), nullptr)
@ -63,3 +65,10 @@ bool logwin_info::handle_command(WPARAM wparam, LPARAM lparam)
}
return debugwin_info::handle_command(wparam, lparam);
}
void logwin_info::save_configuration_to_node(util::xml::data_node &node)
{
debugwin_info::save_configuration_to_node(node);
node.set_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, osd::debugger::WINDOW_TYPE_ERROR_LOG_VIEWER);
}

View File

@ -23,6 +23,7 @@ public:
protected:
virtual bool handle_command(WPARAM wparam, LPARAM lparam) override;
virtual void save_configuration_to_node(util::xml::data_node &node) override;
};
#endif

View File

@ -9,6 +9,8 @@
#include "emu.h"
#include "memoryviewinfo.h"
#include "util/xmlfile.h"
#include "strconv.h"
@ -23,6 +25,12 @@ memoryview_info::~memoryview_info()
}
char const *memoryview_info::expression() const
{
return view<debug_view_memory>()->expression();
}
debug_view_memory::data_format memoryview_info::data_format() const
{
return view<debug_view_memory>()->get_data_format();
@ -83,6 +91,32 @@ void memoryview_info::set_address_radix(int radix)
}
void memoryview_info::restore_configuration_from_node(util::xml::data_node const &node)
{
debug_view_memory &memview(*view<debug_view_memory>());
memview.set_reverse(0 != node.get_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_REVERSE_COLUMNS, memview.reverse() ? 1 : 0));
memview.set_physical(0 != node.get_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_ADDRESS_MODE, memview.physical() ? 1 : 0));
memview.set_address_radix(node.get_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_ADDRESS_RADIX, memview.address_radix()));
memview.set_data_format(debug_view_memory::data_format(node.get_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_DATA_FORMAT, int(memview.get_data_format()))));
memview.set_chunks_per_row(node.get_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_ROW_CHUNKS, memview.chunks_per_row()));
debugview_info::restore_configuration_from_node(node);
}
void memoryview_info::save_configuration_to_node(util::xml::data_node &node)
{
debugview_info::save_configuration_to_node(node);
debug_view_memory &memview(*view<debug_view_memory>());
node.set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_REVERSE_COLUMNS, memview.reverse() ? 1 : 0);
node.set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_ADDRESS_MODE, memview.physical() ? 1 : 0);
node.set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_ADDRESS_RADIX, memview.address_radix());
node.set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_DATA_FORMAT, int(memview.get_data_format()));
node.set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_ROW_CHUNKS, memview.chunks_per_row());
}
void memoryview_info::add_items_to_context_menu(HMENU menu)
{
debugview_info::add_items_to_context_menu(menu);

View File

@ -24,6 +24,7 @@ public:
memoryview_info(debugger_windows_interface &debugger, debugwin_info &owner, HWND parent);
virtual ~memoryview_info();
char const *expression() const;
debug_view_memory::data_format data_format() const;
uint32_t chunks_per_row() const;
bool reverse() const;
@ -37,6 +38,9 @@ public:
void set_physical(bool physical);
void set_address_radix(int radix);
virtual void restore_configuration_from_node(util::xml::data_node const &node) override;
virtual void save_configuration_to_node(util::xml::data_node &node) override;
protected:
enum
{

View File

@ -13,6 +13,8 @@
#include "memoryviewinfo.h"
#include "uimetrics.h"
#include "util/xmlfile.h"
#include "winutf8.h"
@ -388,3 +390,35 @@ void memorywin_info::update_caption()
{
win_set_window_text_utf8(window(), std::string("Memory: ").append(m_views[0]->source_name()).c_str());
}
void memorywin_info::restore_configuration_from_node(util::xml::data_node const &node)
{
m_views[0]->set_source_index(node.get_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_REGION, m_views[0]->source_index()));
int const cursource = m_views[0]->source_index();
if (0 <= cursource)
SendMessage(m_combownd, CB_SETCURSEL, cursource, 0);
update_caption();
util::xml::data_node const *const expr = node.get_child(osd::debugger::NODE_WINDOW_EXPRESSION);
if (expr && expr->get_value())
{
set_editwnd_text(expr->get_value());
process_string(expr->get_value());
}
editwin_info::restore_configuration_from_node(node);
m_views[0]->restore_configuration_from_node(node);
}
void memorywin_info::save_configuration_to_node(util::xml::data_node &node)
{
editwin_info::save_configuration_to_node(node);
node.set_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, osd::debugger::WINDOW_TYPE_MEMORY_VIEWER);
node.set_attribute_int(osd::debugger::ATTR_WINDOW_MEMORY_REGION, m_views[0]->source_index());
node.add_child(osd::debugger::NODE_WINDOW_EXPRESSION, downcast<memoryview_info *>(m_views[0].get())->expression());
m_views[0]->save_configuration_to_node(node);
}

View File

@ -22,12 +22,14 @@ public:
virtual ~memorywin_info();
virtual bool handle_key(WPARAM wparam, LPARAM lparam) override;
virtual void restore_configuration_from_node(util::xml::data_node const &node) override;
protected:
virtual void recompute_children() override;
virtual void update_menu() override;
virtual bool handle_command(WPARAM wparam, LPARAM lparam) override;
virtual void draw_contents(HDC dc) override;
virtual void save_configuration_to_node(util::xml::data_node &node) override;
private:
virtual void process_string(const std::string &string) override;
@ -37,4 +39,4 @@ private:
HWND m_combownd;
};
#endif
#endif // MAME_DEBUGGER_WIN_MEMORYWININFO_H

View File

@ -11,6 +11,8 @@
#include "debugviewinfo.h"
#include "util/xmlfile.h"
#include "winutf8.h"
@ -131,3 +133,44 @@ bool pointswin_info::handle_command(WPARAM wparam, LPARAM lparam)
}
return debugwin_info::handle_command(wparam, lparam);
}
void pointswin_info::restore_configuration_from_node(util::xml::data_node const &node)
{
switch (node.get_attribute_int(osd::debugger::ATTR_WINDOW_POINTS_TYPE, -1))
{
case 0:
SendMessage(window(), WM_COMMAND, ID_SHOW_BREAKPOINTS, 0);
break;
case 1:
SendMessage(window(), WM_COMMAND, ID_SHOW_WATCHPOINTS, 0);
break;
case 2:
SendMessage(window(), WM_COMMAND, ID_SHOW_REGISTERPOINTS, 0);
break;
}
debugwin_info::restore_configuration_from_node(node);
}
void pointswin_info::save_configuration_to_node(util::xml::data_node &node)
{
debugwin_info::save_configuration_to_node(node);
node.set_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, osd::debugger::WINDOW_TYPE_POINTS_VIEWER);
switch (m_views[0]->type())
{
case DVT_BREAK_POINTS:
node.set_attribute_int(osd::debugger::ATTR_WINDOW_POINTS_TYPE, 0);
break;
case DVT_WATCH_POINTS:
node.set_attribute_int(osd::debugger::ATTR_WINDOW_POINTS_TYPE, 1);
break;
case DVT_REGISTER_POINTS:
node.set_attribute_int(osd::debugger::ATTR_WINDOW_POINTS_TYPE, 2);
break;
default:
break;
}
}

View File

@ -22,10 +22,12 @@ public:
virtual ~pointswin_info();
virtual bool handle_key(WPARAM wparam, LPARAM lparam) override;
virtual void restore_configuration_from_node(util::xml::data_node const &node) override;
protected:
virtual void update_menu() override;
virtual bool handle_command(WPARAM wparam, LPARAM lparam) override;
virtual void save_configuration_to_node(util::xml::data_node &node) override;
};
#endif
#endif // MAME_DEBUGGER_WIN_POINTSWININFO_H

View File

@ -41,4 +41,4 @@ private:
uint32_t const m_vscroll_width;
};
#endif
#endif // MAME_DEBUGGER_WIN_UIMETRICS_H

View File

@ -0,0 +1,45 @@
// license:BSD-3-Clause
// copyright-holders:Vas Crabb
#include "xmlconfig.h"
namespace osd::debugger {
char const *const NODE_WINDOW = "window";
char const *const NODE_WINDOW_SPLITS = "splits";
char const *const NODE_WINDOW_SELECTION = "selection";
char const *const NODE_WINDOW_SCROLL = "scroll";
char const *const NODE_WINDOW_EXPRESSION = "expression";
char const *const ATTR_WINDOW_TYPE = "type";
char const *const ATTR_WINDOW_POSITION_X = "position_x";
char const *const ATTR_WINDOW_POSITION_Y = "position_y";
char const *const ATTR_WINDOW_WIDTH = "size_x";
char const *const ATTR_WINDOW_HEIGHT = "size_y";
char const *const ATTR_WINDOW_MEMORY_REGION = "memoryregion";
char const *const ATTR_WINDOW_MEMORY_REVERSE_COLUMNS = "reverse";
char const *const ATTR_WINDOW_MEMORY_ADDRESS_MODE = "addressmode";
char const *const ATTR_WINDOW_MEMORY_ADDRESS_RADIX = "addressradix";
char const *const ATTR_WINDOW_MEMORY_DATA_FORMAT = "dataformat";
char const *const ATTR_WINDOW_MEMORY_ROW_CHUNKS = "rowchunks";
char const *const ATTR_WINDOW_DISASSEMBLY_CPU = "cpu";
char const *const ATTR_WINDOW_DISASSEMBLY_RIGHT_COLUMN = "rightbar";
char const *const ATTR_WINDOW_POINTS_TYPE = "bwtype";
char const *const ATTR_WINDOW_DEVICE_TAG = "device-tag";
char const *const ATTR_SPLITS_CONSOLE_STATE = "state";
char const *const ATTR_SPLITS_CONSOLE_DISASSEMBLY = "disassembly";
char const *const ATTR_SELECTION_CURSOR_VISIBLE = "visible";
char const *const ATTR_SELECTION_CURSOR_X = "start_x";
char const *const ATTR_SELECTION_CURSOR_Y = "start_y";
char const *const ATTR_SCROLL_ORIGIN_X = "position_x";
char const *const ATTR_SCROLL_ORIGIN_Y = "position_y";
} // namespace osd::debugger

View File

@ -0,0 +1,63 @@
// license:BSD-3-Clause
// copyright-holders:Vas Crabb
#ifndef MAME_OSD_DEBUGGER_XMLCONFIG_H
#define MAME_OSD_DEBUGGER_XMLCONFIG_H
#pragma once
namespace osd::debugger {
// Qt debugger started using these numeric types - they should be switched to mnemonics at some point
enum
{
WINDOW_TYPE_CONSOLE = 1,
WINDOW_TYPE_MEMORY_VIEWER,
WINDOW_TYPE_DISASSEMBLY_VIEWER,
WINDOW_TYPE_ERROR_LOG_VIEWER,
WINDOW_TYPE_POINTS_VIEWER,
WINDOW_TYPE_DEVICES_VIEWER,
WINDOW_TYPE_DEVICE_INFO_VIEWER
};
extern char const *const NODE_WINDOW;
extern char const *const NODE_WINDOW_SPLITS;
extern char const *const NODE_WINDOW_SELECTION;
extern char const *const NODE_WINDOW_SCROLL;
extern char const *const NODE_WINDOW_EXPRESSION;
extern char const *const ATTR_WINDOW_TYPE;
extern char const *const ATTR_WINDOW_POSITION_X;
extern char const *const ATTR_WINDOW_POSITION_Y;
extern char const *const ATTR_WINDOW_WIDTH;
extern char const *const ATTR_WINDOW_HEIGHT;
extern char const *const ATTR_WINDOW_MEMORY_REGION;
extern char const *const ATTR_WINDOW_MEMORY_REVERSE_COLUMNS;
extern char const *const ATTR_WINDOW_MEMORY_ADDRESS_MODE;
extern char const *const ATTR_WINDOW_MEMORY_ADDRESS_RADIX;
extern char const *const ATTR_WINDOW_MEMORY_DATA_FORMAT;
extern char const *const ATTR_WINDOW_MEMORY_ROW_CHUNKS;
extern char const *const ATTR_WINDOW_DISASSEMBLY_CPU;
extern char const *const ATTR_WINDOW_DISASSEMBLY_RIGHT_COLUMN;
extern char const *const ATTR_WINDOW_POINTS_TYPE;
extern char const *const ATTR_WINDOW_DEVICE_TAG;
extern char const *const ATTR_SPLITS_CONSOLE_STATE;
extern char const *const ATTR_SPLITS_CONSOLE_DISASSEMBLY;
extern char const *const ATTR_SELECTION_CURSOR_VISIBLE;
extern char const *const ATTR_SELECTION_CURSOR_X;
extern char const *const ATTR_SELECTION_CURSOR_Y;
extern char const *const ATTR_SCROLL_ORIGIN_X;
extern char const *const ATTR_SCROLL_ORIGIN_Y;
} // namespace osd::debugger
#endif // MAME_OSD_DEBUGGER_XMLCONFIG_H