implement WASD control option (#740)
Some checks failed
CI / clang-format (push) Has been cancelled
CI / ${{ matrix.name }} (false, --toolchain /usr/local/vitasdk/share/vita.toolchain.cmake, false, false, Ninja, Vita, ubuntu-latest, true, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.26100.0, false, false, Visual Studio 17 2022, true, Xbox One, windows-latest, amd64, false, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/3DS.cmake, false, devkitpro/devkitarm:latest, false, Ninja, true, Nintendo 3DS, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake, false, devkitpro/devkita64:latest, false, Ninja, Nintendo Switch, true, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, emcmake, false, false, true, Ninja, Emscripten, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, false, false, Ninja, true, MSVC (arm64), windows-latest, amd64_arm64, false) (push) Has been cancelled
CI / ${{ matrix.name }} (false, false, true, Ninja, true, MSVC (x86), windows-latest, amd64_x86, false) (push) Has been cancelled
CI / ${{ matrix.name }} (false, true, false, Ninja, true, MSVC (x64), windows-latest, amd64, false) (push) Has been cancelled
CI / ${{ matrix.name }} (false, true, true, false, Ninja, true, MSVC (x64 Debug), windows-latest, amd64, false) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, -DCMAKE_SYSTEM_NAME=iOS, false, false, Xcode, true, iOS, macos-15, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, false, Ninja, true, mingw-w64-i686, mingw32, msys2 mingw32, windows-latest, msys2 {0}, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, false, false, Ninja, Android, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, true, false, Ninja, macOS, macos-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, true, false, Ninja, true, mingw-w64-x86_64, mingw64, msys2 mingw64, windows-latest, msys2 {0}, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, true, true, false, Ninja, true, Linux (Debug), ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, true, true, false, Ninja, true, Linux, ubuntu-latest, true) (push) Has been cancelled
CI / Flatpak (${{ matrix.arch }}) (aarch64, ubuntu-22.04-arm) (push) Has been cancelled
CI / Flatpak (${{ matrix.arch }}) (x86_64, ubuntu-latest) (push) Has been cancelled
CI / C++ (push) Has been cancelled
CI / Release (push) Has been cancelled
Docker / Publish web port (push) Has been cancelled

* implement WASD control option

* remove unnecessary getter function
This commit is contained in:
Ramen2X 2025-12-12 23:36:08 -05:00 committed by GitHub
parent 4a1fd5d2f2
commit dc995c9c97
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 72 additions and 12 deletions

View File

@ -64,6 +64,7 @@ CMainDialog::CMainDialog(QWidget* pParent) : QDialog(pParent)
connect(m_ui->musicCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxMusic);
connect(m_ui->sound3DCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckbox3DSound);
connect(m_ui->rumbleCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxRumble);
connect(m_ui->wasdCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxWasd);
connect(m_ui->textureCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxTexture);
connect(m_ui->customAssetsCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxCustomAssets);
connect(m_ui->touchComboBox, &QComboBox::currentIndexChanged, this, &CMainDialog::TouchControlsChanged);
@ -306,6 +307,7 @@ void CMainDialog::UpdateInterface()
}
m_ui->musicCheckBox->setChecked(currentConfigApp->m_music);
m_ui->rumbleCheckBox->setChecked(currentConfigApp->m_haptic);
m_ui->wasdCheckBox->setChecked(currentConfigApp->m_wasd);
m_ui->touchComboBox->setCurrentIndex(currentConfigApp->m_touch_scheme);
m_ui->transitionTypeComboBox->setCurrentIndex(currentConfigApp->m_transition_type);
m_ui->dataPath->setText(QString::fromStdString(currentConfigApp->m_cd_path));
@ -458,6 +460,13 @@ void CMainDialog::OnCheckboxRumble(bool checked)
UpdateInterface();
}
void CMainDialog::OnCheckboxWasd(bool checked)
{
currentConfigApp->m_wasd = checked;
m_modified = true;
UpdateInterface();
}
void CMainDialog::OnCheckboxTexture(bool checked)
{
currentConfigApp->m_texture_load = checked;

View File

@ -48,6 +48,7 @@ private slots:
void OnRadioExclusiveFullscreen(bool checked);
void OnCheckboxMusic(bool checked);
void OnCheckboxRumble(bool checked);
void OnCheckboxWasd(bool checked);
void OnCheckboxTexture(bool checked);
void OnCheckboxCustomAssets(bool checked);
void TouchControlsChanged(int index);

View File

@ -87,6 +87,7 @@ bool CConfigApp::InitInstance()
m_msaa = 1;
m_anisotropy = 1;
m_haptic = TRUE;
m_wasd = FALSE;
m_touch_scheme = 2;
m_texture_load = TRUE;
m_texture_path = "textures/";
@ -182,6 +183,7 @@ bool CConfigApp::ReadRegisterSettings()
m_texture_quality = iniparser_getint(dict, "isle:Island Texture", m_texture_quality);
m_use_joystick = iniparser_getboolean(dict, "isle:UseJoystick", m_use_joystick);
m_haptic = iniparser_getboolean(dict, "isle:Haptic", m_haptic);
m_wasd = iniparser_getboolean(dict, "isle:WASD", m_wasd);
m_music = iniparser_getboolean(dict, "isle:Music", m_music);
m_joystick_index = iniparser_getint(dict, "isle:JoystickIndex", m_joystick_index);
m_max_lod = iniparser_getdouble(dict, "isle:Max LOD", m_max_lod);
@ -392,6 +394,7 @@ void CConfigApp::WriteRegisterSettings() const
SetIniBool(dict, "isle:3DSound", m_3d_sound);
SetIniBool(dict, "isle:Music", m_music);
SetIniBool(dict, "isle:Haptic", m_haptic);
SetIniBool(dict, "isle:WASD", m_wasd);
SetIniBool(dict, "isle:UseJoystick", m_use_joystick);
SetIniInt(dict, "isle:JoystickIndex", m_joystick_index);

View File

@ -82,6 +82,7 @@ class CConfigApp {
bool m_draw_cursor;
bool m_use_joystick;
bool m_haptic;
bool m_wasd;
int m_joystick_index;
int m_model_quality;
int m_texture_quality;

View File

@ -1006,7 +1006,23 @@ The game will gradually increase the number of actors until this maximum is reac
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<widget class="QCheckBox" name="wasdCheckBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Use the WASD keys for navigation.</string>
</property>
<property name="text">
<string>Use WASD</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
@ -1328,6 +1344,7 @@ Double-click a path to edit it.</string>
<tabstop>AFSlider</tabstop>
<tabstop>touchComboBox</tabstop>
<tabstop>rumbleCheckBox</tabstop>
<tabstop>wasdCheckBox</tabstop>
<tabstop>scrollArea</tabstop>
<tabstop>textureCheckBox</tabstop>
<tabstop>texturePath</tabstop>

View File

@ -194,6 +194,7 @@ IsleApp::IsleApp()
m_cursorSensitivity = 4;
m_touchScheme = LegoInputManager::e_gamepad;
m_haptic = TRUE;
m_wasd = FALSE;
m_xRes = 640;
m_yRes = 480;
m_exclusiveXRes = m_xRes;
@ -1027,6 +1028,9 @@ MxResult IsleApp::SetupWindow()
else {
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "Failed to get D3D device name and description");
}
if (LegoOmni::GetInstance()->GetInputManager()) {
LegoOmni::GetInstance()->GetInputManager()->SetWasd(m_wasd);
}
}
return SUCCESS;
@ -1118,6 +1122,7 @@ bool IsleApp::LoadConfig()
iniparser_set(dict, "isle:Transition Type", SDL_itoa(m_transitionType, buf, 10));
iniparser_set(dict, "isle:Touch Scheme", SDL_itoa(m_touchScheme, buf, 10));
iniparser_set(dict, "isle:Haptic", m_haptic ? "true" : "false");
iniparser_set(dict, "isle:WASD", m_wasd ? "true" : "false");
iniparser_set(dict, "isle:Horizontal Resolution", SDL_itoa(m_xRes, buf, 10));
iniparser_set(dict, "isle:Vertical Resolution", SDL_itoa(m_yRes, buf, 10));
iniparser_set(dict, "isle:Exclusive X Resolution", SDL_itoa(m_exclusiveXRes, buf, 10));
@ -1197,6 +1202,7 @@ bool IsleApp::LoadConfig()
(MxTransitionManager::TransitionType) iniparser_getint(dict, "isle:Transition Type", m_transitionType);
m_touchScheme = (LegoInputManager::TouchScheme) iniparser_getint(dict, "isle:Touch Scheme", m_touchScheme);
m_haptic = iniparser_getboolean(dict, "isle:Haptic", m_haptic);
m_wasd = iniparser_getboolean(dict, "isle:WASD", m_wasd);
m_xRes = iniparser_getint(dict, "isle:Horizontal Resolution", m_xRes);
m_yRes = iniparser_getint(dict, "isle:Vertical Resolution", m_yRes);
m_exclusiveXRes = iniparser_getint(dict, "isle:Exclusive X Resolution", m_exclusiveXRes);

View File

@ -107,6 +107,7 @@ class IsleApp {
MxTransitionManager::TransitionType m_transitionType;
LegoInputManager::TouchScheme m_touchScheme;
MxBool m_haptic;
MxBool m_wasd;
MxS32 m_xRes;
MxS32 m_yRes;
MxS32 m_exclusiveXRes;

View File

@ -132,6 +132,8 @@ class LegoInputManager : public MxPresenter {
void SetUnknown335(MxBool p_unk0x335) { m_unk0x335 = p_unk0x335; }
void SetUnknown336(MxBool p_unk0x336) { m_unk0x336 = p_unk0x336; }
void SetWasd(MxBool p_wasd) { m_wasd = p_wasd; }
// FUNCTION: BETA10 0x1002e390
void DisableInputProcessing()
{
@ -197,6 +199,7 @@ class LegoInputManager : public MxPresenter {
MxBool m_unk0x335; // 0x335
MxBool m_unk0x336; // 0x336
MxBool m_wasd;
TouchScheme m_touchScheme = e_none;
SDL_Point m_touchVirtualThumb = {0, 0};
SDL_FPoint m_touchVirtualThumbOrigin;

View File

@ -134,20 +134,39 @@ MxResult LegoInputManager::GetNavigationKeyStates(MxU32& p_keyFlags)
MxU32 keyFlags = 0;
if (m_keyboardState[SDL_SCANCODE_KP_8] || m_keyboardState[SDL_SCANCODE_UP]) {
keyFlags |= c_up;
}
if (!m_wasd) {
if (m_keyboardState[SDL_SCANCODE_KP_8] || m_keyboardState[SDL_SCANCODE_UP]) {
keyFlags |= c_up;
}
if ((m_keyboardState[SDL_SCANCODE_KP_2] || m_keyboardState[SDL_SCANCODE_DOWN])) {
keyFlags |= c_down;
}
if ((m_keyboardState[SDL_SCANCODE_KP_2] || m_keyboardState[SDL_SCANCODE_DOWN])) {
keyFlags |= c_down;
}
if ((m_keyboardState[SDL_SCANCODE_KP_4] || m_keyboardState[SDL_SCANCODE_LEFT])) {
keyFlags |= c_left;
}
if ((m_keyboardState[SDL_SCANCODE_KP_4] || m_keyboardState[SDL_SCANCODE_LEFT])) {
keyFlags |= c_left;
}
if ((m_keyboardState[SDL_SCANCODE_KP_6] || m_keyboardState[SDL_SCANCODE_RIGHT])) {
keyFlags |= c_right;
if ((m_keyboardState[SDL_SCANCODE_KP_6] || m_keyboardState[SDL_SCANCODE_RIGHT])) {
keyFlags |= c_right;
}
}
else {
if (m_keyboardState[SDL_SCANCODE_W]) {
keyFlags |= c_up;
}
if (m_keyboardState[SDL_SCANCODE_S]) {
keyFlags |= c_down;
}
if (m_keyboardState[SDL_SCANCODE_A]) {
keyFlags |= c_left;
}
if (m_keyboardState[SDL_SCANCODE_D]) {
keyFlags |= c_right;
}
}
if (m_keyboardState[SDL_SCANCODE_LCTRL] || m_keyboardState[SDL_SCANCODE_RCTRL]) {