git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit 0ebfdb840a703611f15729f8ce2f847c02c87a06
parent 14c454832560c190ee89b0fe4b280a2137865ecb
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Fri, 16 Sep 2022 12:20:23 +0300

Channel toggling in SDL

Diffstat:
MSDL/font.c20++++++++++++++++++++
MSDL/font.h1+
MSDL/gui.c3+--
MSDL/main.c10++++++++++
4 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/SDL/font.c b/SDL/font.c @@ -1129,6 +1129,26 @@ uint8_t font[] = { X, _, X, X, _, X, X, _, _, _, _, X, _, X, X, X, X, _, + + /* Alt symbol */ + + _, _, X, X, _, _, + _, X, _, _, X, _, + _, X, _, _, X, _, + _, X, _, _, X, _, + _, X, X, X, X, _, + _, X, _, _, X, _, + _, X, _, _, X, _, + _, _, _, _, _, _, + + X, _, _, X, X, X, + X, _, _, _, X, _, + X, _, _, _, X, _, + X, _, _, _, X, _, + X, _, _, _, X, _, + X, _, _, _, X, _, + X, X, X, _, X, _, + _, _, _, _, _, _, }; const uint8_t font_max = sizeof(font) / GLYPH_HEIGHT / GLYPH_WIDTH + ' '; diff --git a/SDL/font.h b/SDL/font.h @@ -11,6 +11,7 @@ extern const uint8_t font_max; #define SELECTION_STRING RIGHT_ARROW_STRING #define CTRL_STRING "\x80\x81\x82" #define SHIFT_STRING "\x83" +#define ALT_STRING "\x91\x92" #define CMD_STRING "\x84\x85" #define ELLIPSIS_STRING "\x87" #define MOJIBAKE_STRING "\x88" diff --git a/SDL/gui.c b/SDL/gui.c @@ -76,8 +76,6 @@ void render_texture(void *pixels, void *previous) } static const char *help[] = { -"Drop a ROM to play.\n" -"\n" "Keyboard Shortcuts:\n" " Open Menu: Escape\n" " Open ROM: " MODIFIER_NAME "+O\n" @@ -91,6 +89,7 @@ static const char *help[] = { #else " Mute/Unmute: " MODIFIER_NAME "+M\n" #endif +" Toggle channel: " ALT_STRING "+(1-4)\n" " Break Debugger: " CTRL_STRING "+C", "\n" "SameBoy\n" diff --git a/SDL/main.c b/SDL/main.c @@ -441,6 +441,16 @@ static void handle_events(GB_gameboy_t *gb) pending_command = GB_SDL_SAVE_STATE_COMMAND; } } + else if ((event.key.keysym.mod & KMOD_ALT) && event.key.keysym.scancode <= SDL_SCANCODE_4) { + GB_channel_t channel = event.key.keysym.scancode - SDL_SCANCODE_1; + bool state = !GB_is_channel_muted(gb, channel); + + GB_set_channel_muted(gb, channel, state); + + static char message[18]; + sprintf(message, "Channel %d %smuted", channel + 1, state? "" : "un"); + show_osd_text(message); + } } break; }

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.