Skip to content

Commit

Permalink
Fix test page input for Keyboard Pico games
Browse files Browse the repository at this point in the history
  • Loading branch information
qufb authored and irixxxx committed Jan 5, 2025
1 parent 0c157cf commit dcc492b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
10 changes: 4 additions & 6 deletions pico/pico/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,10 @@ static u32 PicoRead16_pico(u32 a)
case 0x08: d = (PicoPicohw.pen_pos[1] >> 8); break;
case 0x0a: d = PicoPicohw.pen_pos[1] & 0xff; break;
case 0x0c: d = (1 << (PicoPicohw.page & 7)) - 1;
if (PicoPicohw.is_kb_active) {
// Apply 1 of 2 bitmasks, depending on which one preserves the highest set bit.
if (PicoPicohw.page % 2 == 0)
d &= 0x2a; // 0b00101010
else
d &= 0x15; // 0b00010101
if (PicoPicohw.page == 7) {
d = 0x2a; // 0b00101010
} else {
d = ((1 << (PicoPicohw.page & 7)) - 1);
}
break;
case 0x10: d = (PicoPicohw.fifo_bytes > 0x3f) ? 0 : (0x3f - PicoPicohw.fifo_bytes); break;
Expand Down
12 changes: 9 additions & 3 deletions platform/common/emu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1127,9 +1127,15 @@ void run_events_pico(unsigned int events)
}
if (events & PEV_PICO_PNEXT) {
PicoPicohw.page++;
if (PicoPicohw.page > 6)
PicoPicohw.page = 6;
emu_status_msg("Page %i", PicoPicohw.page);
if (PicoPicohw.page > 7)
PicoPicohw.page = 7;
if (PicoPicohw.page == 7) {
// Used in games that require the Keyboard Pico peripheral
emu_status_msg("Test Page");
}
else {
emu_status_msg("Page %i", PicoPicohw.page);
}
}
if (events & PEV_PICO_STORY) {
if (pico_inp_mode == 1) {
Expand Down
12 changes: 9 additions & 3 deletions platform/libretro/libretro.c
Original file line number Diff line number Diff line change
Expand Up @@ -2251,9 +2251,15 @@ void run_events_pico(unsigned int events)
}
if (events & (1 << RETRO_DEVICE_ID_JOYPAD_R)) {
PicoPicohw.page++;
if (PicoPicohw.page > 6)
PicoPicohw.page = 6;
emu_status_msg("Page %i", PicoPicohw.page);
if (PicoPicohw.page > 7)
PicoPicohw.page = 7;
if (PicoPicohw.page == 7) {
// Used in games that require the Keyboard Pico peripheral
emu_status_msg("Test Page");
}
else {
emu_status_msg("Page %i", PicoPicohw.page);
}
}
if (events & (1 << RETRO_DEVICE_ID_JOYPAD_X)) {
if (pico_inp_mode == 2) {
Expand Down

0 comments on commit dcc492b

Please sign in to comment.