Skip to content

Commit 73e5483

Browse files
committed
Add mode "On (Only On-Screen Keyboard While in Game)" to "Use L3 Button to Show Menu" core input option (#715)
1 parent 6fe60a6 commit 73e5483

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

core_options.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020-2025 Bernhard Schelling
2+
* Copyright (C) 2020-2026 Bernhard Schelling
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by
@@ -233,7 +233,7 @@ static retro_core_option_v2_definition option_defs[DBP_Option::_OPTIONS_TOTAL] =
233233
},
234234
#endif
235235
{
236-
"dosbox_pure_force60fps", // legacy name
236+
"dosbox_pure_force60fps", // legacy name (now forcefps)
237237
"Force Output FPS", NULL,
238238
"Enable this to force output at a fixed rate. Try 60 FPS if you encounter screen tearing or vsync issues." "\n"
239239
"Output will have frames skipped at lower rates and frames duplicated at higher rates.", NULL,
@@ -325,11 +325,11 @@ static retro_core_option_v2_definition option_defs[DBP_Option::_OPTIONS_TOTAL] =
325325

326326
// Input
327327
{
328-
"dosbox_pure_on_screen_keyboard", // legacy name
328+
"dosbox_pure_on_screen_keyboard", // legacy name (now map_osd)
329329
"Use L3 Button to Show Menu", NULL,
330330
"Always bind the L3 controller button to show the menu to swap CDs/Disks and use the On-Screen Keyboard.", NULL,
331331
DBP_OptionCat::Input,
332-
{ { "true", "On (Default to Menu)" }, { "keyboard", "On (Default to On-Screen Keyboard)" }, { "false", "Off" } },
332+
{ { "true", "On (Default to Menu)" }, { "keyboard", "On (Default to On-Screen Keyboard)" }, { "onlyosk", "On (Only On-Screen Keyboard While in Game)" }, { "false", "Off" } },
333333
"true"
334334
},
335335
{

dosbox_pure_osd.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,9 +1229,9 @@ struct DBP_OnScreenKeyboardState
12291229

12301230
DBP_ASSERT(draww);
12311231
int rl = (int)((oskx + x) * fx), rr = (int)((oskx + x + draww) * fx), rt = (int)((osky + y) * fy), rb = (int)((osky + y + drawh) * fy);
1232-
bool hovered = (cX >= rl-1 && cX <= rr && cY >= rt-1 && cY <= rb);
12331232

1234-
KBD_KEYS kbd_key = keyboard_keys[row][k - keyboard_rows[row]];
1233+
const KBD_KEYS kbd_key = keyboard_keys[row][k - keyboard_rows[row]];
1234+
const bool hovered = (cX >= rl-1 && cX <= rr && cY >= rt-1 && cY <= rb && (dbp_map_osd != 'o' || !dbp_game_running || kbd_key != KBD_LAST));
12351235
if (hovered) hovered_key = kbd_key;
12361236

12371237
buf.AlphaBlendFillRect(rl, rt, rr-rl, rb-rt, (pressed_key == kbd_key ? buf.BGCOL_KEYPRESS : (held[kbd_key] ? buf.BGCOL_KEYHELD : (hovered ? buf.BGCOL_KEYHOVER : buf.BGCOL_KEY))));
@@ -2162,8 +2162,9 @@ struct DBP_OnScreenDisplay : DBP_MenuInterceptor
21622162
case DBPOSD_SETTINGS: delete ptr.settings; break;
21632163
#endif
21642164
}
2165-
if (in_mode != _DBPOSD_OPEN && in_mode != _DBPOSD_CLOSE) { mode = in_mode; if (!ptr._all) default_shown = 0; }
2166-
else if (in_mode == _DBPOSD_OPEN && (!default_shown || last_map != dbp_map_osd)) { mode = ((last_map = dbp_map_osd) == 'k' ? DBPOSD_OSK : DBPOSD_MAIN); default_shown = true; }
2165+
if (dbp_map_osd == 'o' && dbp_game_running) { mode = DBPOSD_OSK; } // only osk
2166+
else if (in_mode != _DBPOSD_OPEN && in_mode != _DBPOSD_CLOSE) { mode = in_mode; if (!ptr._all) default_shown = 0; }
2167+
else if (in_mode == _DBPOSD_OPEN && (!default_shown || last_map != dbp_map_osd)) { mode = (((last_map = dbp_map_osd) == 'k' || last_map == 'o') ? DBPOSD_OSK : DBPOSD_MAIN); default_shown = true; }
21672168
ptr._all = NULL;
21682169
StartIntercept();
21692170
switch (in_mode == _DBPOSD_CLOSE ? _DBPOSD_CLOSE : mode)
@@ -2191,7 +2192,7 @@ struct DBP_OnScreenDisplay : DBP_MenuInterceptor
21912192
bool isOSK = (mode == DBPOSD_OSK);
21922193
bool mouseMoved = mouse.Update(buf, isOSK);
21932194

2194-
if (1) // now always show button bar, was (DBP_FullscreenOSD || !isOSK) before
2195+
if (dbp_map_osd != 'o' || !dbp_game_running)
21952196
{
21962197
int btny = h - 13 - lh, btnmrgn = (w >= 296 ? 34 : 8), ydist = (isOSK ? (int)(127 - (btny - mouse.y) / (h*0.001f)) : 0xFF);
21972198
Bit32u btnblend = (DBP_FullscreenOSD ? 0xFF000000 : ((ydist > dbp_alphablend_base ? dbp_alphablend_base : (ydist < 30 ? 30 : ydist)) << 24));

0 commit comments

Comments
 (0)