-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new debugger commands to disable PPU layers or APU channels.
- Loading branch information
Showing
18 changed files
with
332 additions
and
84 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
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,81 @@ | ||
/******************************************************************************\ | ||
** | ||
** 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-2024 - The Hades Authors | ||
** | ||
\******************************************************************************/ | ||
|
||
#include <string.h> | ||
#include "hades.h" | ||
#include "app/app.h" | ||
#include "app/dbg.h" | ||
#include "log.h" | ||
|
||
void | ||
debugger_cmd_apu( | ||
struct app *app, | ||
size_t argc, | ||
struct arg const *argv | ||
) { | ||
char const * const names[] = { | ||
"psg0", | ||
"psg1", | ||
"psg2", | ||
"psg3", | ||
"fifo1", | ||
"fifo2", | ||
}; | ||
|
||
bool *values[] = { | ||
&app->config.audio.enable_psg_channels[0], | ||
&app->config.audio.enable_psg_channels[1], | ||
&app->config.audio.enable_psg_channels[2], | ||
&app->config.audio.enable_psg_channels[3], | ||
&app->config.audio.enable_fifo_channels[0], | ||
&app->config.audio.enable_fifo_channels[1], | ||
}; | ||
|
||
if (argc == 0) { | ||
size_t i; | ||
|
||
for (i = 0; i < array_length(names); ++i) { | ||
printf("%s%s%s: %s%s%s\n", | ||
g_light_magenta, | ||
names[i], | ||
g_reset, | ||
*values[i] ? g_light_green : g_light_red, | ||
*values[i] ? "true" : "false", | ||
g_reset | ||
); | ||
} | ||
} else if (argc == 1) { | ||
size_t i; | ||
|
||
if (debugger_check_arg_type(CMD_APU, &argv[0], ARGS_STRING)) { | ||
return ; | ||
} | ||
|
||
for (i = 0; i < array_length(values); ++i) { | ||
if (!strcmp(argv[0].value.s, names[i])) { | ||
*values[i] ^= true; | ||
printf("%s%s%s set to %s%s%s\n", | ||
g_light_magenta, | ||
names[i], | ||
g_reset, | ||
*values[i] ? g_light_green : g_light_red, | ||
*values[i] ? "true" : "false", | ||
g_reset | ||
); | ||
app_emulator_settings(app); | ||
return ; | ||
} | ||
} | ||
|
||
printf("Unknown APU settings \"%s\".", argv[0].value.s); | ||
} else { | ||
printf("Usage: %s\n", g_commands[CMD_APU].usage); | ||
} | ||
} | ||
|
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,79 @@ | ||
/******************************************************************************\ | ||
** | ||
** 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-2024 - The Hades Authors | ||
** | ||
\******************************************************************************/ | ||
|
||
#include <string.h> | ||
#include "hades.h" | ||
#include "app/app.h" | ||
#include "app/dbg.h" | ||
#include "log.h" | ||
|
||
void | ||
debugger_cmd_ppu( | ||
struct app *app, | ||
size_t argc, | ||
struct arg const *argv | ||
) { | ||
char const * const names[] = { | ||
"bg0", | ||
"bg1", | ||
"bg2", | ||
"bg3", | ||
"oam", | ||
}; | ||
|
||
bool *values[] = { | ||
&app->config.video.enable_bg_layers[0], | ||
&app->config.video.enable_bg_layers[1], | ||
&app->config.video.enable_bg_layers[2], | ||
&app->config.video.enable_bg_layers[3], | ||
&app->config.video.enable_oam, | ||
}; | ||
|
||
if (argc == 0) { | ||
size_t i; | ||
|
||
for (i = 0; i < array_length(names); ++i) { | ||
printf("%s%s%s: %s%s%s\n", | ||
g_light_magenta, | ||
names[i], | ||
g_reset, | ||
*values[i] ? g_light_green : g_light_red, | ||
*values[i] ? "true" : "false", | ||
g_reset | ||
); | ||
} | ||
} else if (argc == 1) { | ||
size_t i; | ||
|
||
if (debugger_check_arg_type(CMD_PPU, &argv[0], ARGS_STRING)) { | ||
return ; | ||
} | ||
|
||
for (i = 0; i < array_length(values); ++i) { | ||
if (!strcmp(argv[0].value.s, names[i])) { | ||
*values[i] ^= true; | ||
printf("%s%s%s set to %s%s%s\n", | ||
g_light_magenta, | ||
names[i], | ||
g_reset, | ||
*values[i] ? g_light_green : g_light_red, | ||
*values[i] ? "true" : "false", | ||
g_reset | ||
); | ||
app_emulator_settings(app); | ||
return ; | ||
} | ||
} | ||
|
||
printf("Unknown PPU settings \"%s\".", argv[0].value.s); | ||
} else { | ||
printf("Usage: %s\n", g_commands[CMD_PPU].usage); | ||
} | ||
} | ||
|
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.