diff --git a/src/emu/debug/debugcon.cpp b/src/emu/debug/debugcon.cpp index e19d23e6b55..0fc33d32f10 100644 --- a/src/emu/debug/debugcon.cpp +++ b/src/emu/debug/debugcon.cpp @@ -58,6 +58,9 @@ debugger_console::debugger_console(running_machine &machine) /* listen in on the errorlog */ using namespace std::placeholders; m_machine.add_logerror_callback(std::bind(&debugger_console::errorlog_write_line, this, _1)); + + /* register our own custom-command help */ + register_command("helpcustom", CMDFLAG_NONE, 0, 0, 0, std::bind(&debugger_console::execute_help_custom, this, _1, _2)); } @@ -92,6 +95,28 @@ void debugger_console::exit() ***************************************************************************/ +/*------------------------------------------------------------ + execute_help_custom - execute the helpcustom command +------------------------------------------------------------*/ + +void debugger_console::execute_help_custom(int ref, const std::vector ¶ms) +{ + debug_command *cmd = m_commandlist; + char buf[64]; + while (cmd) + { + if (cmd->flags & CMDFLAG_CUSTOM_HELP) + { + snprintf(buf, 63, "%s help", cmd->command); + buf[63] = 0; + char *temp_params[1] = { buf }; + internal_execute_command(true, 1, &temp_params[0]); + } + cmd = cmd->next; + } +} + + /*------------------------------------------------- trim_parameter - executes a command diff --git a/src/emu/debug/debugcon.h b/src/emu/debug/debugcon.h index a64238ed8c6..289123591f0 100644 --- a/src/emu/debug/debugcon.h +++ b/src/emu/debug/debugcon.h @@ -28,6 +28,7 @@ /* flags for command parsing */ #define CMDFLAG_NONE (0x0000) #define CMDFLAG_KEEP_QUOTES (0x0001) +#define CMDFLAG_CUSTOM_HELP (0x0002) /* values for the error code in a command error */ #define CMDERR_NONE (0) @@ -111,6 +112,8 @@ public: private: void exit(); + void execute_help_custom(int ref, const std::vector ¶ms); + void trim_parameter(char **paramptr, bool keep_quotes); CMDERR internal_execute_command(bool execute, int params, char **param); CMDERR internal_parse_command(const std::string &original_command, bool execute); diff --git a/src/emu/debug/debughlp.cpp b/src/emu/debug/debughlp.cpp index 5a272c85a1b..d737c0376aa 100644 --- a/src/emu/debug/debughlp.cpp +++ b/src/emu/debug/debughlp.cpp @@ -78,6 +78,7 @@ static const help_item static_help_list[] = "Type help for further details on each command\n" "\n" " help [] -- get help on a particular topic\n" + " helpcustom -- get help on any custom commands registered by devices\n" " do -- evaluates the given expression\n" " symlist [] -- lists registered symbols\n" " softreset -- executes a soft reset\n" diff --git a/src/mame/machine/model2.cpp b/src/mame/machine/model2.cpp index af38c3e7f26..600619d92b8 100644 --- a/src/mame/machine/model2.cpp +++ b/src/mame/machine/model2.cpp @@ -21,7 +21,7 @@ void model2_state::debug_init() if (machine().debug_flags & DEBUG_FLAG_ENABLED) { using namespace std::placeholders; - machine().debugger().console().register_command("m2", CMDFLAG_NONE, 0, 1, 2, std::bind(&model2_state::debug_commands, this, _1, _2)); + machine().debugger().console().register_command("m2", CMDFLAG_CUSTOM_HELP, 0, 1, 2, std::bind(&model2_state::debug_commands, this, _1, _2)); } } diff --git a/src/mame/machine/xbox.cpp b/src/mame/machine/xbox.cpp index 8deb4ecd352..e31e0a9c479 100644 --- a/src/mame/machine/xbox.cpp +++ b/src/mame/machine/xbox.cpp @@ -822,7 +822,7 @@ void xbox_base_state::machine_start() if (machine().debug_flags & DEBUG_FLAG_ENABLED) { using namespace std::placeholders; - machine().debugger().console().register_command("xbox", CMDFLAG_NONE, 0, 1, 4, std::bind(&xbox_base_state::xbox_debug_commands, this, _1, _2)); + machine().debugger().console().register_command("xbox", CMDFLAG_CUSTOM_HELP, 0, 1, 4, std::bind(&xbox_base_state::xbox_debug_commands, this, _1, _2)); } subdevice("pci:01.1:154")->hack_eeprom = [&](void)