Fixes #118 Introduce a --debug option

This commit is contained in:
Stefan Arentz 2017-01-05 23:06:39 -05:00
parent de64006303
commit 51293dc9de
2 changed files with 8 additions and 0 deletions

View File

@ -537,6 +537,7 @@ static void ewm_two_update_status_bar(struct ewm_two_t *two, double mhz) {
#define EWM_TWO_OPT_MEMORY (4) #define EWM_TWO_OPT_MEMORY (4)
#define EWM_TWO_OPT_TRACE (5) #define EWM_TWO_OPT_TRACE (5)
#define EWM_TWO_OPT_STRICT (6) #define EWM_TWO_OPT_STRICT (6)
#define EWM_TWO_OPT_DEBUG (7)
static struct option one_options[] = { static struct option one_options[] = {
{ "drive1", required_argument, NULL, EWM_TWO_OPT_DRIVE1 }, { "drive1", required_argument, NULL, EWM_TWO_OPT_DRIVE1 },
@ -546,6 +547,7 @@ static struct option one_options[] = {
{ "memory", required_argument, NULL, EWM_TWO_OPT_MEMORY }, { "memory", required_argument, NULL, EWM_TWO_OPT_MEMORY },
{ "trace", optional_argument, NULL, EWM_TWO_OPT_TRACE }, { "trace", optional_argument, NULL, EWM_TWO_OPT_TRACE },
{ "strict", no_argument, NULL, EWM_TWO_OPT_STRICT }, { "strict", no_argument, NULL, EWM_TWO_OPT_STRICT },
{ "debug", no_argument, NULL, EWM_TWO_OPT_DEBUG },
{ NULL, 0, NULL, 0 } { NULL, 0, NULL, 0 }
}; };
@ -559,6 +561,7 @@ int ewm_two_main(int argc, char **argv) {
struct ewm_memory_option_t *extra_memory = NULL; struct ewm_memory_option_t *extra_memory = NULL;
char *trace_path = NULL; char *trace_path = NULL;
bool strict = false; bool strict = false;
bool debug = false;
int ch; int ch;
while ((ch = getopt_long_only(argc, argv, "", one_options, NULL)) != -1) { while ((ch = getopt_long_only(argc, argv, "", one_options, NULL)) != -1) {
@ -590,6 +593,9 @@ int ewm_two_main(int argc, char **argv) {
case EWM_TWO_OPT_STRICT: case EWM_TWO_OPT_STRICT:
strict = true; strict = true;
break; break;
case EWM_TWO_OPT_DEBUG:
debug = true;
break;
} }
} }

View File

@ -97,6 +97,8 @@ struct ewm_two_t {
SDL_Joystick *joystick; SDL_Joystick *joystick;
bool status_bar_visible; bool status_bar_visible;
bool debug;
}; };
struct ewm_two_t *ewm_two_create(int type, SDL_Renderer *renderer, SDL_Joystick *joystick); struct ewm_two_t *ewm_two_create(int type, SDL_Renderer *renderer, SDL_Joystick *joystick);