-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a
screenshot
and key
command to the debuggrer.
- Loading branch information
Showing
14 changed files
with
215 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,9 @@ enum keys { | |
KEY_RIGHT, | ||
KEY_START, | ||
KEY_SELECT, | ||
|
||
KEY_MAX, | ||
KEY_MIN = KEY_A, | ||
}; | ||
|
||
struct shared_data { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/******************************************************************************\ | ||
** | ||
** This file is part of the Hades GBA Emulator, and is made available under | ||
** the terms of the GNU General Public License version 2. | ||
** | ||
** Copyright (C) 2021-2023 - The Hades Authors | ||
** | ||
\******************************************************************************/ | ||
|
||
#include "hades.h" | ||
#include "app.h" | ||
#include "dbg/dbg.h" | ||
|
||
static char const * const key_names[] = { | ||
[KEY_A] = "a", | ||
[KEY_B] = "b", | ||
[KEY_L] = "l", | ||
[KEY_R] = "r", | ||
[KEY_UP] = "up", | ||
[KEY_DOWN] = "down", | ||
[KEY_LEFT] = "left", | ||
[KEY_RIGHT] = "right", | ||
[KEY_START] = "start", | ||
[KEY_SELECT] = "select", | ||
}; | ||
|
||
void | ||
debugger_cmd_key( | ||
struct app *app, | ||
size_t argc, | ||
struct arg const *argv | ||
) { | ||
if (!app->debugger.is_started) { | ||
logln(HS_ERROR, "%s%s%s", g_red, "This command cannot be used when no game is running.", g_reset); | ||
return; | ||
} | ||
|
||
if (argc == 2) { | ||
enum keys i; | ||
|
||
if (debugger_check_arg_type(CMD_KEY, &argv[0], ARGS_STRING) | ||
|| debugger_check_arg_type(CMD_KEY, &argv[1], ARGS_INTEGER) | ||
) { | ||
return ; | ||
} | ||
|
||
for (i = KEY_MIN; i < KEY_MAX; ++i) { | ||
if (!strcmp(argv[0].value.s, key_names[i])) { | ||
app_game_key(app, i, (bool)argv[1].value.i64); | ||
printf( | ||
"Key \"%s\" set to %s.\n", | ||
argv[0].value.s, | ||
argv[1].value.i64 ? "true" : "false" | ||
); | ||
return ; | ||
} | ||
} | ||
|
||
printf("Error: unknown key \"%s\".\n", argv[0].value.s); | ||
} else { | ||
printf("Usage: %s\n", g_commands[CMD_KEY].usage); | ||
return ; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/******************************************************************************\ | ||
** | ||
** This file is part of the Hades GBA Emulator, and is made available under | ||
** the terms of the GNU General Public License version 2. | ||
** | ||
** Copyright (C) 2021-2023 - The Hades Authors | ||
** | ||
\******************************************************************************/ | ||
|
||
#include "hades.h" | ||
#include "app.h" | ||
#include "dbg/dbg.h" | ||
|
||
void | ||
debugger_cmd_screenshot( | ||
struct app *app, | ||
size_t argc, | ||
struct arg const *argv | ||
) { | ||
if (!app->debugger.is_started) { | ||
logln(HS_ERROR, "%s%s%s", g_red, "This command cannot be used when no game is running.", g_reset); | ||
return; | ||
} | ||
|
||
if (argc == 0) { | ||
app_game_screenshot(app); | ||
} else if (argc == 1) { | ||
if (debugger_check_arg_type(CMD_SCREENSHOT, &argv[0], ARGS_STRING)) { | ||
return ; | ||
} | ||
|
||
app_game_screenshot_path(app, argv[0].value.s); | ||
} else { | ||
printf("Usage: %s\n", g_commands[CMD_SCREENSHOT].usage); | ||
return ; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.