mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-14 13:45:59 +00:00
added controller shortcuts to key configuration
This commit is contained in:
parent
3bfff4eee0
commit
9f5afa812e
4 changed files with 287 additions and 196 deletions
|
@ -1,229 +1,248 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "core/libraries/pad/pad.h"
|
||||
#include "ime_keyboard_layouts.h"
|
||||
using B = Libraries::Pad::OrbisPadButtonDataOffset;
|
||||
|
||||
constexpr auto L1 = B::L1;
|
||||
constexpr auto R1 = B::R1;
|
||||
constexpr auto L2 = B::L2;
|
||||
constexpr auto R2 = B::R2;
|
||||
constexpr auto L3 = B::L3;
|
||||
constexpr auto R3 = B::R3;
|
||||
constexpr auto Up = B::Up;
|
||||
constexpr auto Down = B::Down;
|
||||
constexpr auto Left = B::Left;
|
||||
constexpr auto Right = B::Right;
|
||||
constexpr auto Cross = B::Cross;
|
||||
constexpr auto Circle = B::Circle;
|
||||
constexpr auto Square = B::Square;
|
||||
constexpr auto Triangle = B::Triangle;
|
||||
constexpr auto TouchPad = B::TouchPad;
|
||||
|
||||
const std::vector<Key> kUppercaseLayout = {
|
||||
// Row 1
|
||||
{0, 0, 1, 1, "1", "", KeyType::Text},
|
||||
{0, 1, 1, 1, "2", "", KeyType::Text},
|
||||
{0, 2, 1, 1, "3", "", KeyType::Text},
|
||||
{0, 3, 1, 1, "4", "", KeyType::Text},
|
||||
{0, 4, 1, 1, "5", "", KeyType::Text},
|
||||
{0, 5, 1, 1, "6", "", KeyType::Text},
|
||||
{0, 6, 1, 1, "7", "", KeyType::Text},
|
||||
{0, 7, 1, 1, "8", "", KeyType::Text},
|
||||
{0, 8, 1, 1, "9", "", KeyType::Text},
|
||||
{0, 9, 1, 1, "0", "", KeyType::Text},
|
||||
{0, 0, 1, 1, "1", "", KeyType::Text, {}},
|
||||
{0, 1, 1, 1, "2", "", KeyType::Text, {}},
|
||||
{0, 2, 1, 1, "3", "", KeyType::Text, {}},
|
||||
{0, 3, 1, 1, "4", "", KeyType::Text, {}},
|
||||
{0, 4, 1, 1, "5", "", KeyType::Text, {}},
|
||||
{0, 5, 1, 1, "6", "", KeyType::Text, {}},
|
||||
{0, 6, 1, 1, "7", "", KeyType::Text, {}},
|
||||
{0, 7, 1, 1, "8", "", KeyType::Text, {}},
|
||||
{0, 8, 1, 1, "9", "", KeyType::Text, {}},
|
||||
{0, 9, 1, 1, "0", "", KeyType::Text, {}},
|
||||
|
||||
// Row 2
|
||||
{1, 0, 1, 1, "Q", "", KeyType::Text},
|
||||
{1, 1, 1, 1, "W", "", KeyType::Text},
|
||||
{1, 2, 1, 1, "E", "", KeyType::Text},
|
||||
{1, 3, 1, 1, "R", "", KeyType::Text},
|
||||
{1, 4, 1, 1, "T", "", KeyType::Text},
|
||||
{1, 5, 1, 1, "Y", "", KeyType::Text},
|
||||
{1, 6, 1, 1, "U", "", KeyType::Text},
|
||||
{1, 7, 1, 1, "I", "", KeyType::Text},
|
||||
{1, 8, 1, 1, "O", "", KeyType::Text},
|
||||
{1, 9, 1, 1, "P", "", KeyType::Text},
|
||||
{1, 0, 1, 1, "Q", "", KeyType::Text, {}},
|
||||
{1, 1, 1, 1, "W", "", KeyType::Text, {}},
|
||||
{1, 2, 1, 1, "E", "", KeyType::Text, {}},
|
||||
{1, 3, 1, 1, "R", "", KeyType::Text, {}},
|
||||
{1, 4, 1, 1, "T", "", KeyType::Text, {}},
|
||||
{1, 5, 1, 1, "Y", "", KeyType::Text, {}},
|
||||
{1, 6, 1, 1, "U", "", KeyType::Text, {}},
|
||||
{1, 7, 1, 1, "I", "", KeyType::Text, {}},
|
||||
{1, 8, 1, 1, "O", "", KeyType::Text, {}},
|
||||
{1, 9, 1, 1, "P", "", KeyType::Text, {}},
|
||||
|
||||
// Row 3
|
||||
{2, 0, 1, 1, "A", "", KeyType::Text},
|
||||
{2, 1, 1, 1, "S", "", KeyType::Text},
|
||||
{2, 2, 1, 1, "D", "", KeyType::Text},
|
||||
{2, 3, 1, 1, "F", "", KeyType::Text},
|
||||
{2, 4, 1, 1, "G", "", KeyType::Text},
|
||||
{2, 5, 1, 1, "H", "", KeyType::Text},
|
||||
{2, 6, 1, 1, "J", "", KeyType::Text},
|
||||
{2, 7, 1, 1, "K", "", KeyType::Text},
|
||||
{2, 8, 1, 1, "L", "", KeyType::Text},
|
||||
{2, 9, 1, 1, "\"", "", KeyType::Text},
|
||||
{2, 0, 1, 1, "A", "", KeyType::Text, {}},
|
||||
{2, 1, 1, 1, "S", "", KeyType::Text, {}},
|
||||
{2, 2, 1, 1, "D", "", KeyType::Text, {}},
|
||||
{2, 3, 1, 1, "F", "", KeyType::Text, {}},
|
||||
{2, 4, 1, 1, "G", "", KeyType::Text, {}},
|
||||
{2, 5, 1, 1, "H", "", KeyType::Text, {}},
|
||||
{2, 6, 1, 1, "J", "", KeyType::Text, {}},
|
||||
{2, 7, 1, 1, "K", "", KeyType::Text, {}},
|
||||
{2, 8, 1, 1, "L", "", KeyType::Text, {}},
|
||||
{2, 9, 1, 1, "\"", "", KeyType::Text, {}},
|
||||
|
||||
// Row 4
|
||||
{3, 0, 1, 1, "Z", "", KeyType::Text},
|
||||
{3, 1, 1, 1, "X", "", KeyType::Text},
|
||||
{3, 2, 1, 1, "C", "", KeyType::Text},
|
||||
{3, 3, 1, 1, "V", "", KeyType::Text},
|
||||
{3, 4, 1, 1, "B", "", KeyType::Text},
|
||||
{3, 5, 1, 1, "N", "", KeyType::Text},
|
||||
{3, 6, 1, 1, "M", "", KeyType::Text},
|
||||
{3, 7, 1, 1, "-", "", KeyType::Text},
|
||||
{3, 8, 1, 1, "_", "", KeyType::Text},
|
||||
{3, 9, 1, 1, "/", "", KeyType::Text},
|
||||
{3, 0, 1, 1, "Z", "", KeyType::Text, {}},
|
||||
{3, 1, 1, 1, "X", "", KeyType::Text, {}},
|
||||
{3, 2, 1, 1, "C", "", KeyType::Text, {}},
|
||||
{3, 3, 1, 1, "V", "", KeyType::Text, {}},
|
||||
{3, 4, 1, 1, "B", "", KeyType::Text, {}},
|
||||
{3, 5, 1, 1, "N", "", KeyType::Text, {}},
|
||||
{3, 6, 1, 1, "M", "", KeyType::Text, {}},
|
||||
{3, 7, 1, 1, "-", "", KeyType::Text, {}},
|
||||
{3, 8, 1, 1, "_", "", KeyType::Text, {}},
|
||||
{3, 9, 1, 1, "/", "", KeyType::Text, {}},
|
||||
|
||||
// Row 5
|
||||
{4, 0, 1, 1, "⬆", "L2", KeyType::Shift},
|
||||
{4, 1, 1, 1, "@#:", "L2+△", KeyType::SymbolsLayout},
|
||||
{4, 2, 1, 1, "à", "L3", KeyType::UnknownFunction},
|
||||
{4, 3, 4, 1, "Space", "△", KeyType::Space},
|
||||
//{4, 4, 4, 1, "Space", "△", KeyType::Space},
|
||||
//{4, 5, 4, 1, "Space", "△", KeyType::Space},
|
||||
//{4, 6, 4, 1, "Space", "△", KeyType::Space},
|
||||
{4, 7, 1, 1, "", "", KeyType::Disabled},
|
||||
{4, 8, 2, 1, "⇦", "□", KeyType::Backspace}, //{4, 8, 2, 1, "⌫", "□", KeyType::Backspace},
|
||||
//{4, 9, 2, 1, "⌫", "□", KeyType::Backspace},
|
||||
{4, 0, 1, 1, "⬆", "L2", KeyType::Shift, {L2}},
|
||||
|
||||
{4, 1, 1, 1, "@#:", "L2+△", KeyType::SymbolsLayout, {L3, Triangle}},
|
||||
{4, 2, 1, 1, "à", "L3", KeyType::UnknownFunction, {L3}},
|
||||
{4, 3, 4, 1, "Space", "△", KeyType::Space, {Triangle}},
|
||||
//{4, 4, 4, 1, "Space", "△", KeyType::Space,{}},
|
||||
//{4, 5, 4, 1, "Space", "△", KeyType::Space,{}},
|
||||
//{4, 6, 4, 1, "Space", "△", KeyType::Space,{}},
|
||||
{4, 7, 1, 1, "", "", KeyType::Disabled, {}},
|
||||
{4, 8, 2, 1, "⇦", "□", KeyType::Backspace, {Square}},
|
||||
//{4, 9, 2, 1, "⇦", "□", KeyType::Backspace,{}},
|
||||
|
||||
// Row 6
|
||||
{5, 0, 1, 1, "▲", "", KeyType::CursorUp},
|
||||
{5, 1, 1, 1, "▼", "", KeyType::CursorDown},
|
||||
{5, 2, 1, 1, "◀", "L1", KeyType::CursorLeft},
|
||||
{5, 3, 1, 1, "▶", "R1", KeyType::CursorRight},
|
||||
{5, 4, 1, 1, "KB", "",
|
||||
KeyType::ToggleKeyboard}, //{5, 4, 1, 1, "⌨", "", KeyType::ToggleKeyboard},
|
||||
{5, 5, 1, 1, "...", "", KeyType::MoreOptions}, //{5, 5, 1, 1, "…", "", KeyType::MoreOptions},
|
||||
{5, 6, 1, 1, "+/⊗", "R3", KeyType::ControllerAction},
|
||||
{5, 7, 1, 1, "", "", KeyType::Disabled},
|
||||
{5, 8, 2, 1, "Done", "R2", KeyType::Done},
|
||||
//{5, 9, 2, 1, "Done", "R2", KeyType::Done},
|
||||
{5, 0, 1, 1, "▲", "", KeyType::CursorUp, {Up}},
|
||||
{5, 1, 1, 1, "▼", "", KeyType::CursorDown, {Down}},
|
||||
{5, 2, 1, 1, "◀", "L1", KeyType::CursorLeft, {L1}},
|
||||
{5, 3, 1, 1, "▶", "R1", KeyType::CursorRight, {R1}},
|
||||
{5, 4, 1, 1, "KB", "", KeyType::ToggleKeyboard, {}},
|
||||
//{5, 4, 1, 1, "⌨", "", KeyType::ToggleKeyboard,{}},
|
||||
{5, 5, 1, 1, "...", "", KeyType::MoreOptions, {}},
|
||||
//{5, 5, 1, 1, "…", "", KeyType::MoreOptions,{}},
|
||||
{5, 6, 1, 1, "+/⊗", "R3", KeyType::ControllerAction, {R3}},
|
||||
{5, 7, 1, 1, "", "", KeyType::Disabled, {}},
|
||||
{5, 8, 2, 1, "Done", "R2", KeyType::Done, {R2}},
|
||||
//{5, 9, 2, 1, "Done", "R2", KeyType::Done,{}},
|
||||
};
|
||||
|
||||
const std::vector<Key> kLowercaseLayout = {
|
||||
// Row 1
|
||||
{0, 0, 1, 1, "1", "", KeyType::Text},
|
||||
{0, 1, 1, 1, "2", "", KeyType::Text},
|
||||
{0, 2, 1, 1, "3", "", KeyType::Text},
|
||||
{0, 3, 1, 1, "4", "", KeyType::Text},
|
||||
{0, 4, 1, 1, "5", "", KeyType::Text},
|
||||
{0, 5, 1, 1, "6", "", KeyType::Text},
|
||||
{0, 6, 1, 1, "7", "", KeyType::Text},
|
||||
{0, 7, 1, 1, "8", "", KeyType::Text},
|
||||
{0, 8, 1, 1, "9", "", KeyType::Text},
|
||||
{0, 9, 1, 1, "0", "", KeyType::Text},
|
||||
{0, 0, 1, 1, "1", "", KeyType::Text, {}},
|
||||
{0, 1, 1, 1, "2", "", KeyType::Text, {}},
|
||||
{0, 2, 1, 1, "3", "", KeyType::Text, {}},
|
||||
{0, 3, 1, 1, "4", "", KeyType::Text, {}},
|
||||
{0, 4, 1, 1, "5", "", KeyType::Text, {}},
|
||||
{0, 5, 1, 1, "6", "", KeyType::Text, {}},
|
||||
{0, 6, 1, 1, "7", "", KeyType::Text, {}},
|
||||
{0, 7, 1, 1, "8", "", KeyType::Text, {}},
|
||||
{0, 8, 1, 1, "9", "", KeyType::Text, {}},
|
||||
{0, 9, 1, 1, "0", "", KeyType::Text, {}},
|
||||
|
||||
// Row 2
|
||||
{1, 0, 1, 1, "q", "", KeyType::Text},
|
||||
{1, 1, 1, 1, "w", "", KeyType::Text},
|
||||
{1, 2, 1, 1, "e", "", KeyType::Text},
|
||||
{1, 3, 1, 1, "r", "", KeyType::Text},
|
||||
{1, 4, 1, 1, "t", "", KeyType::Text},
|
||||
{1, 5, 1, 1, "y", "", KeyType::Text},
|
||||
{1, 6, 1, 1, "u", "", KeyType::Text},
|
||||
{1, 7, 1, 1, "i", "", KeyType::Text},
|
||||
{1, 8, 1, 1, "o", "", KeyType::Text},
|
||||
{1, 9, 1, 1, "p", "", KeyType::Text},
|
||||
{1, 0, 1, 1, "q", "", KeyType::Text, {}},
|
||||
{1, 1, 1, 1, "w", "", KeyType::Text, {}},
|
||||
{1, 2, 1, 1, "e", "", KeyType::Text, {}},
|
||||
{1, 3, 1, 1, "r", "", KeyType::Text, {}},
|
||||
{1, 4, 1, 1, "t", "", KeyType::Text, {}},
|
||||
{1, 5, 1, 1, "y", "", KeyType::Text, {}},
|
||||
{1, 6, 1, 1, "u", "", KeyType::Text, {}},
|
||||
{1, 7, 1, 1, "i", "", KeyType::Text, {}},
|
||||
{1, 8, 1, 1, "o", "", KeyType::Text, {}},
|
||||
{1, 9, 1, 1, "p", "", KeyType::Text, {}},
|
||||
|
||||
// Row 3
|
||||
{2, 0, 1, 1, "a", "", KeyType::Text},
|
||||
{2, 1, 1, 1, "s", "", KeyType::Text},
|
||||
{2, 2, 1, 1, "d", "", KeyType::Text},
|
||||
{2, 3, 1, 1, "f", "", KeyType::Text},
|
||||
{2, 4, 1, 1, "g", "", KeyType::Text},
|
||||
{2, 5, 1, 1, "h", "", KeyType::Text},
|
||||
{2, 6, 1, 1, "j", "", KeyType::Text},
|
||||
{2, 7, 1, 1, "k", "", KeyType::Text},
|
||||
{2, 8, 1, 1, "l", "", KeyType::Text},
|
||||
{2, 9, 1, 1, "-", "", KeyType::Text},
|
||||
{2, 0, 1, 1, "a", "", KeyType::Text, {}},
|
||||
{2, 1, 1, 1, "s", "", KeyType::Text, {}},
|
||||
{2, 2, 1, 1, "d", "", KeyType::Text, {}},
|
||||
{2, 3, 1, 1, "f", "", KeyType::Text, {}},
|
||||
{2, 4, 1, 1, "g", "", KeyType::Text, {}},
|
||||
{2, 5, 1, 1, "h", "", KeyType::Text, {}},
|
||||
{2, 6, 1, 1, "j", "", KeyType::Text, {}},
|
||||
{2, 7, 1, 1, "k", "", KeyType::Text, {}},
|
||||
{2, 8, 1, 1, "l", "", KeyType::Text, {}},
|
||||
{2, 9, 1, 1, "-", "", KeyType::Text, {}},
|
||||
|
||||
// Row 4
|
||||
{3, 0, 1, 1, "z", "", KeyType::Text},
|
||||
{3, 1, 1, 1, "x", "", KeyType::Text},
|
||||
{3, 2, 1, 1, "c", "", KeyType::Text},
|
||||
{3, 3, 1, 1, "v", "", KeyType::Text},
|
||||
{3, 4, 1, 1, "b", "", KeyType::Text},
|
||||
{3, 5, 1, 1, "n", "", KeyType::Text},
|
||||
{3, 6, 1, 1, "m", "", KeyType::Text},
|
||||
{3, 7, 1, 1, "@", "", KeyType::Text},
|
||||
{3, 8, 1, 1, ".", "", KeyType::Text},
|
||||
{3, 9, 1, 1, "_", "", KeyType::Text},
|
||||
{3, 0, 1, 1, "z", "", KeyType::Text, {}},
|
||||
{3, 1, 1, 1, "x", "", KeyType::Text, {}},
|
||||
{3, 2, 1, 1, "c", "", KeyType::Text, {}},
|
||||
{3, 3, 1, 1, "v", "", KeyType::Text, {}},
|
||||
{3, 4, 1, 1, "b", "", KeyType::Text, {}},
|
||||
{3, 5, 1, 1, "n", "", KeyType::Text, {}},
|
||||
{3, 6, 1, 1, "m", "", KeyType::Text, {}},
|
||||
{3, 7, 1, 1, "@", "", KeyType::Text, {}},
|
||||
{3, 8, 1, 1, ".", "", KeyType::Text, {}},
|
||||
{3, 9, 1, 1, "_", "", KeyType::Text, {}},
|
||||
|
||||
// Row 5
|
||||
{4, 0, 1, 1, "⇧", "L2", KeyType::Shift},
|
||||
{4, 1, 1, 1, "@#:", "L2+△", KeyType::SymbolsLayout},
|
||||
{4, 2, 1, 1, "à", "L3", KeyType::UnknownFunction},
|
||||
{4, 3, 4, 1, "Space", "△", KeyType::Space},
|
||||
//{4, 4, 4, 1, "Space", "△", KeyType::Space},
|
||||
//{4, 5, 4, 1, "Space", "△", KeyType::Space},
|
||||
//{4, 6, 4, 1, "Space", "△", KeyType::Space},
|
||||
{4, 7, 1, 1, "", "", KeyType::Disabled},
|
||||
{4, 8, 2, 1, "⇦", "□", KeyType::Backspace}, //{4, 8, 2, 1, "⌫", "□", KeyType::Backspace},
|
||||
//{4, 8, 2, 1, "⌫", "□", KeyType::Backspace},
|
||||
{4, 0, 1, 1, "⇧", "L2", KeyType::Shift, {L2}},
|
||||
{4, 1, 1, 1, "@#:", "L2+△", KeyType::SymbolsLayout, {L2, Triangle}},
|
||||
{4, 2, 1, 1, "à", "L3", KeyType::UnknownFunction, {L3}},
|
||||
{4, 3, 4, 1, "Space", "△", KeyType::Space, {Triangle}},
|
||||
//{4, 4, 4, 1, "Space", "△", KeyType::Space, {Triangle}},
|
||||
//{4, 5, 4, 1, "Space", "△", KeyType::Space, {Triangle}},
|
||||
//{4, 6, 4, 1, "Space", "△", KeyType::Space, {Triangle}},
|
||||
{4, 7, 1, 1, "", "", KeyType::Disabled, {}},
|
||||
{4, 8, 2, 1, "⇦", "□", KeyType::Backspace, {Square}},
|
||||
//{4, 8, 2, 1, "⇦", "□", KeyType::Backspace, {Square}},
|
||||
|
||||
// Row 6
|
||||
{5, 0, 1, 1, "▲", "", KeyType::CursorUp},
|
||||
{5, 1, 1, 1, "▼", "", KeyType::CursorDown},
|
||||
{5, 2, 1, 1, "◀", "L1", KeyType::CursorLeft},
|
||||
{5, 3, 1, 1, "▶", "R1", KeyType::CursorRight},
|
||||
{5, 4, 1, 1, "KB", "",
|
||||
KeyType::ToggleKeyboard}, //{5, 4, 1, 1, "⌨", "", KeyType::ToggleKeyboard},
|
||||
{5, 5, 1, 1, "...", "", KeyType::MoreOptions}, //{5, 5, 1, 1, "…", "", KeyType::MoreOptions},
|
||||
{5, 6, 1, 1, "+/⊗", "R3", KeyType::ControllerAction},
|
||||
{5, 7, 1, 1, "", "", KeyType::Disabled},
|
||||
{5, 8, 2, 1, "Done", "R2", KeyType::Done},
|
||||
//{5, 9, 2, 1, "Done", "R2", KeyType::Done},
|
||||
{5, 0, 1, 1, "▲", "", KeyType::CursorUp, {Up}},
|
||||
{5, 1, 1, 1, "▼", "", KeyType::CursorDown, {Down}},
|
||||
{5, 2, 1, 1, "◀", "L1", KeyType::CursorLeft, {L1}},
|
||||
{5, 3, 1, 1, "▶", "R1", KeyType::CursorRight, {R1}},
|
||||
{5, 4, 1, 1, "KB", "", KeyType::ToggleKeyboard, {}},
|
||||
{5, 5, 1, 1, "...", "", KeyType::MoreOptions, {}},
|
||||
{5, 6, 1, 1, "+/⊗", "R3", KeyType::ControllerAction, {R3}},
|
||||
{5, 7, 1, 1, "", "", KeyType::Disabled, {}},
|
||||
{5, 8, 2, 1, "Done", "R2", KeyType::Done, {R2}},
|
||||
//{5, 9, 2, 1, "Done", "R2", KeyType::Done, {R2}},
|
||||
};
|
||||
|
||||
const std::vector<Key> kSymbols1Layout = {
|
||||
// Row 1
|
||||
{0, 0, 1, 1, "!", "", KeyType::Text},
|
||||
{0, 1, 1, 1, "?", "", KeyType::Text},
|
||||
{0, 2, 1, 1, "\"", "", KeyType::Text},
|
||||
{0, 3, 1, 1, "'", "", KeyType::Text},
|
||||
{0, 4, 1, 1, "#", "", KeyType::Text},
|
||||
{0, 5, 1, 1, "%", "", KeyType::Text},
|
||||
{0, 6, 1, 1, "(", "", KeyType::Text},
|
||||
{0, 7, 1, 1, ")", "", KeyType::Text},
|
||||
{0, 8, 1, 1, "()", "", KeyType::Text},
|
||||
{0, 9, 1, 1, "/", "", KeyType::Text},
|
||||
{0, 0, 1, 1, "!", "", KeyType::Text, {}},
|
||||
{0, 1, 1, 1, "?", "", KeyType::Text, {}},
|
||||
{0, 2, 1, 1, "\"", "", KeyType::Text, {}},
|
||||
{0, 3, 1, 1, "'", "", KeyType::Text, {}},
|
||||
{0, 4, 1, 1, "#", "", KeyType::Text, {}},
|
||||
{0, 5, 1, 1, "%", "", KeyType::Text, {}},
|
||||
{0, 6, 1, 1, "(", "", KeyType::Text, {}},
|
||||
{0, 7, 1, 1, ")", "", KeyType::Text, {}},
|
||||
{0, 8, 1, 1, "()", "", KeyType::Text, {}},
|
||||
{0, 9, 1, 1, "/", "", KeyType::Text, {}},
|
||||
|
||||
// Row 2
|
||||
{1, 0, 1, 1, "-", "", KeyType::Text},
|
||||
{1, 1, 1, 1, "_", "", KeyType::Text},
|
||||
{1, 2, 1, 1, ",", "", KeyType::Text},
|
||||
{1, 3, 1, 1, ".", "", KeyType::Text},
|
||||
{1, 4, 1, 1, ":", "", KeyType::Text},
|
||||
{1, 5, 1, 1, ";", "", KeyType::Text},
|
||||
{1, 6, 1, 1, "*", "", KeyType::Text},
|
||||
{1, 7, 1, 1, "+", "", KeyType::Text},
|
||||
{1, 8, 1, 1, "=", "", KeyType::Text},
|
||||
{1, 9, 1, 1, "&", "", KeyType::Text},
|
||||
{1, 0, 1, 1, "-", "", KeyType::Text, {}},
|
||||
{1, 1, 1, 1, "_", "", KeyType::Text, {}},
|
||||
{1, 2, 1, 1, ",", "", KeyType::Text, {}},
|
||||
{1, 3, 1, 1, ".", "", KeyType::Text, {}},
|
||||
{1, 4, 1, 1, ":", "", KeyType::Text, {}},
|
||||
{1, 5, 1, 1, ";", "", KeyType::Text, {}},
|
||||
{1, 6, 1, 1, "*", "", KeyType::Text, {}},
|
||||
{1, 7, 1, 1, "+", "", KeyType::Text, {}},
|
||||
{1, 8, 1, 1, "=", "", KeyType::Text, {}},
|
||||
{1, 9, 1, 1, "&", "", KeyType::Text, {}},
|
||||
|
||||
// Row 3
|
||||
{2, 0, 1, 1, "<", "", KeyType::Text},
|
||||
{2, 1, 1, 1, ">", "", KeyType::Text},
|
||||
{2, 2, 1, 1, "@", "", KeyType::Text},
|
||||
{2, 3, 1, 1, "[", "", KeyType::Text},
|
||||
{2, 4, 1, 1, "]", "", KeyType::Text},
|
||||
{2, 5, 1, 1, "[]", "", KeyType::Text},
|
||||
{2, 6, 1, 1, "{", "", KeyType::Text},
|
||||
{2, 7, 1, 1, "}", "", KeyType::Text},
|
||||
{2, 8, 1, 1, "{}", "", KeyType::Text},
|
||||
{2, 9, 1, 2, "→", "", KeyType::UnknownFunction}, // Next symbols page (SYM2)
|
||||
{2, 0, 1, 1, "<", "", KeyType::Text, {}},
|
||||
{2, 1, 1, 1, ">", "", KeyType::Text, {}},
|
||||
{2, 2, 1, 1, "@", "", KeyType::Text, {}},
|
||||
{2, 3, 1, 1, "[", "", KeyType::Text, {}},
|
||||
{2, 4, 1, 1, "]", "", KeyType::Text, {}},
|
||||
{2, 5, 1, 1, "[]", "", KeyType::Text, {}},
|
||||
{2, 6, 1, 1, "{", "", KeyType::Text, {}},
|
||||
{2, 7, 1, 1, "}", "", KeyType::Text, {}},
|
||||
{2, 8, 1, 1, "{}", "", KeyType::Text, {}},
|
||||
{2, 9, 1, 2, "→", "", KeyType::UnknownFunction, {}},
|
||||
|
||||
// Row 4
|
||||
{3, 0, 1, 1, "\\", "", KeyType::Text},
|
||||
{3, 1, 1, 1, "|", "", KeyType::Text},
|
||||
{3, 2, 1, 1, "^", "", KeyType::Text},
|
||||
{3, 3, 1, 1, "`", "", KeyType::Text},
|
||||
{3, 4, 1, 1, "$", "", KeyType::Text},
|
||||
{3, 5, 1, 1, "€", "", KeyType::Text},
|
||||
{3, 6, 1, 1, "´", "", KeyType::Text},
|
||||
{3, 7, 1, 1, "ˊ", "", KeyType::Text},
|
||||
{3, 8, 1, 1, "ˊ", "", KeyType::Text},
|
||||
//{3, 9, 1, 2, "→", "", KeyType::UnknownFunction}, // Next symbols page (SYM2)
|
||||
{3, 0, 1, 1, "\\", "", KeyType::Text, {}},
|
||||
{3, 1, 1, 1, "|", "", KeyType::Text, {}},
|
||||
{3, 2, 1, 1, "^", "", KeyType::Text, {}},
|
||||
{3, 3, 1, 1, "`", "", KeyType::Text, {}},
|
||||
{3, 4, 1, 1, "$", "", KeyType::Text, {}},
|
||||
{3, 5, 1, 1, "€", "", KeyType::Text, {}},
|
||||
{3, 6, 1, 1, "´", "", KeyType::Text, {}},
|
||||
{3, 7, 1, 1, "ˊ", "", KeyType::Text, {}},
|
||||
{3, 8, 1, 1, "ˊ", "", KeyType::Text, {}},
|
||||
//{3, 9, 1, 2, "→", "", KeyType::UnknownFunction,{}},
|
||||
|
||||
// Row 5
|
||||
{4, 0, 1, 1, "", "", KeyType::Disabled},
|
||||
{4, 1, 1, 1, "ABC", "L2+△", KeyType::TextLayout},
|
||||
{4, 2, 1, 1, "", "", KeyType::Disabled},
|
||||
{4, 3, 4, 1, "Space", "△", KeyType::Space},
|
||||
//{4, 4, 4, 1, "Space", "△", KeyType::Space},
|
||||
//{4, 5, 4, 1, "Space", "△", KeyType::Space},
|
||||
//{4, 6, 4, 1, "Space", "△", KeyType::Space},
|
||||
{4, 7, 1, 1, "", "", KeyType::Disabled},
|
||||
{4, 8, 2, 1, "⇦", "□", KeyType::Backspace}, //{4, 8, 2, 1, "⌫", "□", KeyType::Backspace},
|
||||
//{4, 9, 2, 1, "⌫", "□", KeyType::Backspace},
|
||||
{4, 0, 1, 1, "", "", KeyType::Disabled, {}},
|
||||
{4, 1, 1, 1, "ABC", "L2+△", KeyType::TextLayout, {L2, Triangle}},
|
||||
{4, 2, 1, 1, "", "", KeyType::Disabled, {}},
|
||||
{4, 3, 4, 1, "Space", "△", KeyType::Space, {Triangle}},
|
||||
//{4, 4, 4, 1, "Space", "△", KeyType::Space, {Triangle}},
|
||||
//{4, 5, 4, 1, "Space", "△", KeyType::Space, {Triangle}},
|
||||
//{4, 6, 4, 1, "Space", "△", KeyType::Space, {Triangle}},
|
||||
{4, 7, 1, 1, "", "", KeyType::Disabled, {}},
|
||||
{4, 8, 2, 1, "⇦", "□", KeyType::Backspace, {Square}},
|
||||
//{4, 9, 2, 1, "⇦", "□", KeyType::Backspace, {Square}},
|
||||
|
||||
// Row 6
|
||||
{5, 0, 1, 1, "▲", "", KeyType::CursorUp},
|
||||
{5, 1, 1, 1, "▼", "", KeyType::CursorDown},
|
||||
{5, 2, 1, 1, "◀", "L1", KeyType::CursorLeft},
|
||||
{5, 3, 1, 1, "▶", "R1", KeyType::CursorRight},
|
||||
{5, 4, 1, 1, "KB", "",
|
||||
KeyType::ToggleKeyboard}, //{5, 4, 1, 1, "⌨", "", KeyType::ToggleKeyboard},
|
||||
{5, 5, 1, 1, "...", "", KeyType::MoreOptions}, //{5, 5, 1, 1, "…", "", KeyType::MoreOptions},
|
||||
{5, 6, 1, 1, "+/⊗", "R3", KeyType::ControllerAction},
|
||||
{5, 7, 1, 1, "", "", KeyType::Disabled},
|
||||
{5, 8, 2, 1, "Done", "R2", KeyType::Done},
|
||||
//{5, 9, 2, 1, "Done", "R2", KeyType::Done},
|
||||
{5, 0, 1, 1, "▲", "", KeyType::CursorUp, {Up}},
|
||||
{5, 1, 1, 1, "▼", "", KeyType::CursorDown, {Down}},
|
||||
{5, 2, 1, 1, "◀", "L1", KeyType::CursorLeft, {L1}},
|
||||
{5, 3, 1, 1, "▶", "R1", KeyType::CursorRight, {R1}},
|
||||
{5, 4, 1, 1, "KB", "", KeyType::ToggleKeyboard, {}},
|
||||
{5, 5, 1, 1, "...", "", KeyType::MoreOptions, {}},
|
||||
{5, 6, 1, 1, "+/⊗", "R3", KeyType::ControllerAction, {R3}},
|
||||
{5, 7, 1, 1, "", "", KeyType::Disabled, {}},
|
||||
{5, 8, 2, 1, "Done", "R2", KeyType::Done, {R2}},
|
||||
//{5, 9, 2, 1, "Done", "R2", KeyType::Done, {R2}},
|
||||
|
||||
};
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "core/libraries/pad/pad.h"
|
||||
// using B = Libraries::Pad::OrbisPadButtonDataOffset;
|
||||
|
||||
enum class KeyType {
|
||||
Text, // Inserts character(s) into input buffer
|
||||
|
@ -34,6 +36,7 @@ struct Key {
|
|||
std::string label;
|
||||
std::string controller_hint;
|
||||
KeyType type = KeyType::Text; // default to Text input
|
||||
std::vector<Libraries::Pad::OrbisPadButtonDataOffset> bound_buttons = {}; // new field
|
||||
};
|
||||
|
||||
extern const std::vector<Key> kUppercaseLayout;
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
#include <imgui.h>
|
||||
#include "ime_keyboard_layouts.h"
|
||||
#include "ime_keyboard_ui.h"
|
||||
#include "input/controller.h"
|
||||
|
||||
#include "common/singleton.h"
|
||||
|
||||
using namespace ImGui;
|
||||
|
||||
|
@ -18,13 +21,17 @@ void DrawVirtualKeyboard(char* buffer, std::size_t buffer_capacity, bool* input_
|
|||
layout = shift_enabled ? &kUppercaseLayout : &kLowercaseLayout;
|
||||
}
|
||||
|
||||
auto current_pad_button =
|
||||
Common::Singleton<Input::GameController>::Instance()->GetLastState().buttonsState;
|
||||
|
||||
RenderKeyboardLayout(*layout, buffer, buffer_capacity, input_changed, kb_mode, shift_enabled,
|
||||
done_pressed);
|
||||
done_pressed, current_pad_button);
|
||||
}
|
||||
|
||||
void RenderKeyboardLayout(const std::vector<Key>& layout, char* buffer, std::size_t buffer_capacity,
|
||||
bool* input_changed, KeyboardMode& kb_mode, bool& shift_enabled,
|
||||
bool* done_pressed) {
|
||||
bool* done_pressed,
|
||||
Libraries::Pad::OrbisPadButtonDataOffset current_pad_button) {
|
||||
// Define desired total layout size (in pixels)
|
||||
const float layout_width = 485.0f;
|
||||
const float layout_height = 200.0f;
|
||||
|
@ -70,6 +77,72 @@ void RenderKeyboardLayout(const std::vector<Key>& layout, char* buffer, std::siz
|
|||
if (input_changed)
|
||||
*input_changed = true;
|
||||
}
|
||||
// Controller debug injection
|
||||
for (Libraries::Pad::OrbisPadButtonDataOffset button : key.bound_buttons) {
|
||||
if (current_pad_button == button) {
|
||||
// DEBUG: always insert "ok" when a key is triggered via gamepad
|
||||
size_t len = std::strlen(buffer);
|
||||
if (len + 2 < buffer_capacity) {
|
||||
std::strcat(buffer, "ok");
|
||||
if (input_changed)
|
||||
*input_changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Controller press simulation
|
||||
for (Libraries::Pad::OrbisPadButtonDataOffset button : key.bound_buttons) {
|
||||
if (current_pad_button == button) {
|
||||
switch (key.type) {
|
||||
case KeyType::Text:
|
||||
if (!key.label.empty()) {
|
||||
size_t len = std::strlen(buffer);
|
||||
if (len + key.label.size() < buffer_capacity) {
|
||||
std::strcat(buffer, key.label.c_str());
|
||||
if (input_changed)
|
||||
*input_changed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case KeyType::Backspace:
|
||||
if (buffer[0] != '\0') {
|
||||
size_t len = std::strlen(buffer);
|
||||
buffer[len - 1] = '\0';
|
||||
if (input_changed)
|
||||
*input_changed = true;
|
||||
}
|
||||
break;
|
||||
case KeyType::Space:
|
||||
if (std::strlen(buffer) + 1 < buffer_capacity) {
|
||||
std::strcat(buffer, " ");
|
||||
if (input_changed)
|
||||
*input_changed = true;
|
||||
}
|
||||
break;
|
||||
case KeyType::Enter:
|
||||
case KeyType::Done:
|
||||
if (done_pressed)
|
||||
*done_pressed = true;
|
||||
break;
|
||||
case KeyType::Shift:
|
||||
shift_enabled = !shift_enabled;
|
||||
break;
|
||||
case KeyType::SymbolsLayout:
|
||||
kb_mode = KeyboardMode::Symbols;
|
||||
break;
|
||||
case KeyType::TextLayout:
|
||||
kb_mode = KeyboardMode::Letters;
|
||||
break;
|
||||
case KeyType::ToggleKeyboard:
|
||||
kb_mode = (kb_mode == KeyboardMode::Letters)
|
||||
? KeyboardMode::Symbols
|
||||
: KeyboardMode::Letters;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case KeyType::Backspace:
|
||||
|
@ -131,4 +204,4 @@ void RenderKeyboardLayout(const std::vector<Key>& layout, char* buffer, std::siz
|
|||
key.controller_hint.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,21 +3,17 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "common/cstring.h"
|
||||
#include "common/types.h"
|
||||
#include "core/libraries/ime/ime_dialog.h"
|
||||
#include "core/libraries/ime/ime_keyboard_layouts.h"
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include "ime_keyboard_layouts.h"
|
||||
|
||||
enum class KeyboardMode { Letters, Symbols };
|
||||
|
||||
// Renders the virtual keyboard and modifies buffer if a key is pressed.
|
||||
// Flags:
|
||||
// - `input_changed`: set to true if the text buffer changes
|
||||
// - `done_pressed`: set to true if the Done/Enter key was pressed
|
||||
void DrawVirtualKeyboard(char* buffer, std::size_t buffer_capacity, bool* input_changed,
|
||||
KeyboardMode& kb_mode, bool& shift_enabled, bool* done_pressed);
|
||||
|
||||
// Renders a specific keyboard layout and processes key events.
|
||||
void RenderKeyboardLayout(const std::vector<Key>& layout, char* buffer, std::size_t buffer_capacity,
|
||||
bool* input_changed, KeyboardMode& kb_mode, bool& shift_enabled,
|
||||
bool* done_pressed);
|
||||
bool* done_pressed,
|
||||
Libraries::Pad::OrbisPadButtonDataOffset current_pad_button);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue