-debugcon: Added CMDFLAG_CUSTOM_HELP, in order to flag custom device-specific commands that have custom help text. [Ryan Holtz]

This commit is contained in:
MooglyGuy 2019-07-07 05:05:02 +02:00
parent 6cbac0ee2a
commit 6421e6c31c
5 changed files with 31 additions and 2 deletions

View File

@ -58,6 +58,9 @@ debugger_console::debugger_console(running_machine &machine)
/* listen in on the errorlog */ /* listen in on the errorlog */
using namespace std::placeholders; using namespace std::placeholders;
m_machine.add_logerror_callback(std::bind(&debugger_console::errorlog_write_line, this, _1)); 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<std::string> &params)
{
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 trim_parameter - executes a
command command

View File

@ -28,6 +28,7 @@
/* flags for command parsing */ /* flags for command parsing */
#define CMDFLAG_NONE (0x0000) #define CMDFLAG_NONE (0x0000)
#define CMDFLAG_KEEP_QUOTES (0x0001) #define CMDFLAG_KEEP_QUOTES (0x0001)
#define CMDFLAG_CUSTOM_HELP (0x0002)
/* values for the error code in a command error */ /* values for the error code in a command error */
#define CMDERR_NONE (0) #define CMDERR_NONE (0)
@ -111,6 +112,8 @@ public:
private: private:
void exit(); void exit();
void execute_help_custom(int ref, const std::vector<std::string> &params);
void trim_parameter(char **paramptr, bool keep_quotes); void trim_parameter(char **paramptr, bool keep_quotes);
CMDERR internal_execute_command(bool execute, int params, char **param); CMDERR internal_execute_command(bool execute, int params, char **param);
CMDERR internal_parse_command(const std::string &original_command, bool execute); CMDERR internal_parse_command(const std::string &original_command, bool execute);

View File

@ -78,6 +78,7 @@ static const help_item static_help_list[] =
"Type help <command> for further details on each command\n" "Type help <command> for further details on each command\n"
"\n" "\n"
" help [<topic>] -- get help on a particular topic\n" " help [<topic>] -- get help on a particular topic\n"
" helpcustom -- get help on any custom commands registered by devices\n"
" do <expression> -- evaluates the given expression\n" " do <expression> -- evaluates the given expression\n"
" symlist [<CPU>] -- lists registered symbols\n" " symlist [<CPU>] -- lists registered symbols\n"
" softreset -- executes a soft reset\n" " softreset -- executes a soft reset\n"

View File

@ -21,7 +21,7 @@ void model2_state::debug_init()
if (machine().debug_flags & DEBUG_FLAG_ENABLED) if (machine().debug_flags & DEBUG_FLAG_ENABLED)
{ {
using namespace std::placeholders; 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));
} }
} }

View File

@ -822,7 +822,7 @@ void xbox_base_state::machine_start()
if (machine().debug_flags & DEBUG_FLAG_ENABLED) if (machine().debug_flags & DEBUG_FLAG_ENABLED)
{ {
using namespace std::placeholders; 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<xbox_eeprom_device>("pci:01.1:154")->hack_eeprom = subdevice<xbox_eeprom_device>("pci:01.1:154")->hack_eeprom =
[&](void) [&](void)