Skip to content

Commit

Permalink
+ swap A<->B buttons
Browse files Browse the repository at this point in the history
+ correct palleter
  • Loading branch information
DnCraptor committed Feb 14, 2025
1 parent af38c90 commit 5d5a790
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion inc/gbcolors.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ void get_colour_palette(palette_t selected_palette,uint8_t table_entry,uint8_t s
const palette_t palette = {
{ 0xFFFF, 0xFC30, 0x91C7, 0x0000 }, /* OBJ0 */
{ 0xFFFF, 0xFC30, 0x91C7, 0x0000 }, /* OBJ1 */
{ 0xFFFF, 0x14c8, 0x0318, 0x0000 } /* BG */
{ 0xFFFF, 0x7FE6, 0x0318, 0x0000 } /* BG */ /// Олег попросил вернуть оригинал на 0x7FE6 (оригинал)
};
memcpy(selected_palette, palette, PALETTE_SIZE_IN_BYTES);
return;
Expand Down
11 changes: 9 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,21 @@ struct input_bits_t {
bool down: true;
};

uint8_t swap_ab = 0;
static input_bits_t keyboard = { false, false, false, false, false, false, false, false }; //Keyboard
static input_bits_t gamepad_bits = { false, false, false, false, false, false, false, false }; //Joypad
//-----------------------------------------------------------------------------

void nespad_tick() {
nespad_read();

gamepad_bits.a = keyboard.a || (nespad_state & DPAD_A) != 0;
gamepad_bits.b = keyboard.b || (nespad_state & DPAD_B) != 0;
if (swap_ab) {
gamepad_bits.b = keyboard.a || (nespad_state & DPAD_A) != 0;
gamepad_bits.a = keyboard.b || (nespad_state & DPAD_B) != 0;
} else {
gamepad_bits.a = keyboard.a || (nespad_state & DPAD_A) != 0;
gamepad_bits.b = keyboard.b || (nespad_state & DPAD_B) != 0;
}
gamepad_bits.select = keyboard.select || (nespad_state & DPAD_SELECT) != 0;
gamepad_bits.start = keyboard.start || (nespad_state & DPAD_START) != 0;
gamepad_bits.up = keyboard.up || (nespad_state & DPAD_UP) != 0;
Expand Down Expand Up @@ -739,6 +745,7 @@ bool toggle_color() {
const MenuItem menu_items[] = {
//{ "Player 1: %s", ARRAY, &player_1_input, 2, { "Keyboard ", "Gamepad 1", "Gamepad 2" }},
//{ "Player 2: %s", ARRAY, &player_2_input, 2, { "Keyboard ", "Gamepad 1", "Gamepad 2" }},
{ "Swap AB <> BA: %s", ARRAY, &swap_ab, nullptr, 1, {"NO ", "YES"}},
{ "Palette: %i ", INT, &manual_palette_selected, nullptr, 12 },
{},
{ "Save state: %i", INT, &save_slot, &save, 5 },
Expand Down

0 comments on commit 5d5a790

Please sign in to comment.