From: kub Date: Thu, 23 Jan 2025 20:09:06 +0000 (+0100) Subject: platform, merge keyboard config into one option X-Git-Tag: v2.04~76 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a03469c2a88dce678020f95e68269e026fdb5f7e;p=picodrive.git platform, merge keyboard config into one option --- diff --git a/platform/common/emu.c b/platform/common/emu.c index ae711325..1aa33459 100644 --- a/platform/common/emu.c +++ b/platform/common/emu.c @@ -1288,7 +1288,7 @@ static void run_events_ui(unsigned int which) { if (! (PicoIn.opt & POPT_EN_KBD)) { kbd_mode = 0; - emu_status_msg("Keyboard not enabled"); + emu_status_msg("No keyboard"); } else { kbd_mode = !kbd_mode; emu_status_msg("Keyboard %s", kbd_mode ? "on" : "off"); @@ -1322,9 +1322,9 @@ void emu_update_input(void) if (kbd_mode) { int mask = (PicoIn.AHW & PAHW_PICO ? 0xf : 0x0); - if (currentConfig.keyboard == 0) + if (currentConfig.keyboard == 1) count_kbd = in_update_kbd(actions_kbd); - else if (currentConfig.keyboard == 1) + else if (currentConfig.keyboard == 2) count_kbd = vkbd_update(vkbd, pl_actions[0], actions_kbd); // FIXME: Only passthrough joystick input to avoid collisions @@ -1547,12 +1547,12 @@ static void emu_loop_prep(void) plat_target_gamma_set(currentConfig.gamma, 0); vkbd = NULL; - if (currentConfig.keyboard == 1) { + if (currentConfig.keyboard == 2) { if (PicoIn.AHW & PAHW_SMS) vkbd = &vkbd_sc3000; else if (PicoIn.AHW & PAHW_PICO) vkbd = &vkbd_pico; } PicoIn.opt &= ~POPT_EN_KBD; - if ((currentConfig.EmuOpt & EOPT_PICO_KBD) || (PicoIn.AHW & PAHW_SMS)) + if (((PicoIn.AHW & PAHW_PICO) || (PicoIn.AHW & PAHW_SC)) && currentConfig.keyboard) PicoIn.opt |= POPT_EN_KBD; pemu_loop_prep(); diff --git a/platform/common/emu.h b/platform/common/emu.h index 1e6c9920..beb4955b 100644 --- a/platform/common/emu.h +++ b/platform/common/emu.h @@ -35,7 +35,6 @@ extern int g_screen_ppitch; // pitch in pixels #define EOPT_WIZ_TEAR_FIX (1<<19) #define EOPT_EXT_FRMLIMIT (1<<20) // no internal frame limiter (limited by snd, etc) #define EOPT_PICO_PEN (1<<21) -#define EOPT_PICO_KBD (1<<22) enum { EOPT_SCALE_NONE = 0, diff --git a/platform/common/menu_pico.c b/platform/common/menu_pico.c index 2fb9cf15..bf14cca5 100644 --- a/platform/common/menu_pico.c +++ b/platform/common/menu_pico.c @@ -571,8 +571,8 @@ static int key_config_players(int id, int keys) static const char *mgn_keyboard(int id, int *offs) { - static char *kbds[] = { "physical", "virtual" }; - if (currentConfig.keyboard < 0 || currentConfig.keyboard > 1) + static char *kbds[] = { "OFF", "physical", "virtual" }; + if (currentConfig.keyboard < 0 || currentConfig.keyboard > 2) return kbds[0]; return kbds[currentConfig.keyboard]; } @@ -582,13 +582,13 @@ static int key_config_keyboard(int id, int keys) int kid = currentConfig.keyboard; if (keys & PBTN_LEFT) - if (--kid < 0) kid = 1; + if (--kid < 0) kid = 2; if (keys & PBTN_RIGHT) - if (++kid > 1) kid = 0; + if (++kid > 2) kid = 0; currentConfig.keyboard = kid; - e_menu_keyconfig[2].help = (currentConfig.keyboard == 0 ? h_kbd : NULL); + e_menu_keyconfig[2].help = (currentConfig.keyboard == 1 ? h_kbd : NULL); if (keys & PBTN_MOK) if (currentConfig.keyboard == 1) @@ -636,7 +636,7 @@ static int menu_loop_keyconfig(int id, int keys) player[strlen(player)-1] = '1'; e_menu_keyconfig[0].help = h_play12; - e_menu_keyconfig[2].help = (currentConfig.keyboard == 0 ? h_kbd : NULL); + e_menu_keyconfig[2].help = (currentConfig.keyboard == 1 ? h_kbd : NULL); me_loop_d(e_menu_keyconfig, &sel, menu_draw_prep, NULL); @@ -664,7 +664,6 @@ static menu_entry e_menu_md_options[] = mee_onoff_h ("FM filter", MA_OPT_FM_FILTER, PicoIn.opt, POPT_EN_FM_FILTER, h_fmfilter), mee_onoff_h ("FM DAC noise", MA_OPT2_ENABLE_YM_DAC, PicoIn.opt, POPT_EN_FM_DAC, h_dacnoise), mee_onoff_h ("Pen button shows screen", MA_OPT_PICO_PEN, currentConfig.EmuOpt, EOPT_PICO_PEN, h_picopen), - mee_onoff ("Pico keyboard", MA_OPT_PICO_KBD, currentConfig.EmuOpt, EOPT_PICO_KBD), mee_end, }; diff --git a/platform/gp2x/emu.c b/platform/gp2x/emu.c index 68222af4..fe87c3b1 100644 --- a/platform/gp2x/emu.c +++ b/platform/gp2x/emu.c @@ -451,7 +451,7 @@ void pemu_finalize_frame(const char *fps, const char *notice) draw_pico_ptr(); } // draw virtual keyboard on display - if (kbd_mode && currentConfig.keyboard == 1 && vkbd) + if (kbd_mode && currentConfig.keyboard == 2 && vkbd) vkbd_draw(vkbd); } diff --git a/platform/linux/emu.c b/platform/linux/emu.c index f26689da..0c66c547 100644 --- a/platform/linux/emu.c +++ b/platform/linux/emu.c @@ -229,7 +229,7 @@ void pemu_finalize_frame(const char *fps, const char *notice) } // draw virtual keyboard on display - if (kbd_mode && currentConfig.keyboard == 1 && vkbd) + if (kbd_mode && currentConfig.keyboard == 2 && vkbd) vkbd_draw(vkbd); if (notice) diff --git a/platform/pandora/plat.c b/platform/pandora/plat.c index b9a91d39..54c28f3d 100644 --- a/platform/pandora/plat.c +++ b/platform/pandora/plat.c @@ -182,7 +182,7 @@ void pemu_finalize_frame(const char *fps, const char *notice) if ((PicoIn.AHW & PAHW_MCD) && (currentConfig.EmuOpt & EOPT_EN_CD_LEDS)) draw_cd_leds(); // draw virtual keyboard on display - if (kbd_mode && currentConfig.keyboard == 1 && vkbd) + if (kbd_mode && currentConfig.keyboard == 2 && vkbd) vkbd_draw(vkbd); } diff --git a/platform/ps2/emu.c b/platform/ps2/emu.c index 03153ac6..e9b1581e 100644 --- a/platform/ps2/emu.c +++ b/platform/ps2/emu.c @@ -822,7 +822,7 @@ void pemu_finalize_frame(const char *fps, const char *notice) } // draw virtual keyboard on display - if (kbd_mode && currentConfig.keyboard == 1 && vkbd) + if (kbd_mode && currentConfig.keyboard == 2 && vkbd) vkbd_draw(vkbd); osd_buf_cnt = 0; diff --git a/platform/psp/emu.c b/platform/psp/emu.c index fca8cd72..052968b8 100644 --- a/platform/psp/emu.c +++ b/platform/psp/emu.c @@ -715,7 +715,7 @@ void pemu_finalize_frame(const char *fps, const char *notice) } // draw virtual keyboard on display - if (kbd_mode && currentConfig.keyboard == 1 && vkbd) + if (kbd_mode && currentConfig.keyboard == 2 && vkbd) vkbd_draw(vkbd); osd_buf_cnt = 0;