Skip to content

Commit

Permalink
Prevent GB_workboy_is_enabled incorrectly returning true, prevent GB_…
Browse files Browse the repository at this point in the history
…workboy_set_key from affecting other accessories if Workboy isn't connected
  • Loading branch information
LIJI32 committed Dec 18, 2023
1 parent 9619500 commit 00e1c92
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Core/workboy.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,13 @@ void GB_connect_workboy(GB_gameboy_t *gb,

bool GB_workboy_is_enabled(GB_gameboy_t *gb)
{
return gb->workboy.mode;
return gb->accessory == GB_ACCESSORY_WORKBOY && gb->workboy.mode;
}

void GB_workboy_set_key(GB_gameboy_t *gb, uint8_t key)
{
if (gb->accessory != GB_ACCESSORY_WORKBOY) return;

if (gb->workboy.user_shift_down != gb->workboy.shift_down &&
(key & (GB_WORKBOY_REQUIRE_SHIFT | GB_WORKBOY_FORBID_SHIFT)) == 0) {
if (gb->workboy.user_shift_down) {
Expand Down

0 comments on commit 00e1c92

Please sign in to comment.