From e5656bace134e759fab904e41a706b839def6bcf Mon Sep 17 00:00:00 2001 From: VoxelTek <53562267+VoxelTek@users.noreply.github.com> Date: Mon, 18 Aug 2025 14:46:15 +1000 Subject: [PATCH] SDL event functions don't seem to work... --- CONFIG/MainDlg.cpp | 11 +++++++++++ CONFIG/MainDlg.h | 2 ++ CONFIG/config.cpp | 24 +++++++++++++++++++++++ CONFIG/config.h | 2 ++ CONFIG/res/maindialog.ui | 8 ++++---- ISLE/isleapp.cpp | 23 ++++++++++++++++++++++ LEGO1/lego/legoomni/include/legokeymaps.h | 7 ------- 7 files changed, 66 insertions(+), 11 deletions(-) diff --git a/CONFIG/MainDlg.cpp b/CONFIG/MainDlg.cpp index 73a85ab3..b5a6a502 100644 --- a/CONFIG/MainDlg.cpp +++ b/CONFIG/MainDlg.cpp @@ -73,6 +73,8 @@ CMainDialog::CMainDialog(QWidget* pParent) : QDialog(pParent) connect(m_ui->cancelButton, &QPushButton::clicked, this, &CMainDialog::reject); connect(m_ui->launchButton, &QPushButton::clicked, this, &CMainDialog::launch); + connect(m_ui->keyForward_1, &QPushButton::clicked, this, &CMainDialog::ForwardKeyChanged); + connect(m_ui->dataPathOpen, &QPushButton::clicked, this, &CMainDialog::SelectDataPathDialog); connect(m_ui->savePathOpen, &QPushButton::clicked, this, &CMainDialog::SelectSavePathDialog); @@ -749,3 +751,12 @@ void CMainDialog::FramerateChanged(int i) m_modified = true; UpdateInterface(); } + +void CMainDialog::ForwardKeyChanged() { + RebindInput(m_ui->keyForward_1); +} + +void CMainDialog::RebindInput(QPushButton* &button) +{ + button->setText(QString("Press a key...")); +} diff --git a/CONFIG/MainDlg.h b/CONFIG/MainDlg.h index 22cf7895..cffb4298 100644 --- a/CONFIG/MainDlg.h +++ b/CONFIG/MainDlg.h @@ -76,6 +76,8 @@ private slots: void AspectRatioChanged(int index); void EnsureAspectRatio(); void FramerateChanged(int i); + void ForwardKeyChanged(); + void RebindInput(QPushButton* &button); }; // SYNTHETIC: CONFIG 0x00403de0 diff --git a/CONFIG/config.cpp b/CONFIG/config.cpp index 4e9d414d..5f6441e0 100644 --- a/CONFIG/config.cpp +++ b/CONFIG/config.cpp @@ -199,6 +199,18 @@ bool CConfigApp::ReadRegisterSettings() m_exf_y_res = iniparser_getint(dict, "isle:Exclusive Y Resolution", m_exf_y_res); m_exf_fps = iniparser_getdouble(dict, "isle:Exclusive Framerate", m_exf_fps); m_frame_delta = iniparser_getdouble(dict, "isle:Frame Delta", m_frame_delta); + + g_keyMaps.k_forward[0] = (SDL_Scancode) iniparser_getint(dict, "input:Forward", g_keyMaps.k_forward[0]); + g_keyMaps.k_forward[1] = (SDL_Scancode) iniparser_getint(dict, "input:Forward Alt", g_keyMaps.k_forward[1]); + g_keyMaps.k_back[0] = (SDL_Scancode) iniparser_getint(dict, "input:Backward", g_keyMaps.k_back[0]); + g_keyMaps.k_back[1] = (SDL_Scancode) iniparser_getint(dict, "input:Backward Alt", g_keyMaps.k_back[1]); + g_keyMaps.k_left[0] = (SDL_Scancode) iniparser_getint(dict, "input:Left", g_keyMaps.k_left[0]); + g_keyMaps.k_left[1] = (SDL_Scancode) iniparser_getint(dict, "input:Left Alt", g_keyMaps.k_left[1]); + g_keyMaps.k_right[0] = (SDL_Scancode) iniparser_getint(dict, "input:Right", g_keyMaps.k_right[0]); + g_keyMaps.k_right[1] = (SDL_Scancode) iniparser_getint(dict, "input:Right Alt", g_keyMaps.k_right[1]); + g_keyMaps.k_sprint[0] = (SDL_Scancode) iniparser_getint(dict, "input:Sprint", g_keyMaps.k_sprint[0]); + g_keyMaps.k_sprint[1] = (SDL_Scancode) iniparser_getint(dict, "input:Sprint Alt", g_keyMaps.k_sprint[1]); + iniparser_freedict(dict); return true; } @@ -370,6 +382,7 @@ void CConfigApp::WriteRegisterSettings() const iniparser_set(dict, "extensions", NULL); iniparser_set(dict, "texture loader", NULL); iniparser_set(dict, "si loader", NULL); + iniparser_set(dict, "input", NULL); if (m_device_enumerator->FormatDeviceName(buffer, m_driver, m_device) >= 0) { iniparser_set(dict, "isle:3D Device ID", buffer); @@ -419,6 +432,17 @@ void CConfigApp::WriteRegisterSettings() const iniparser_set(dict, "isle:Exclusive Framerate", std::to_string(m_exf_fps).c_str()); iniparser_set(dict, "isle:Frame Delta", std::to_string(m_frame_delta).c_str()); + SetIniInt(dict, "input:Forward", g_keyMaps.k_forward[0]); + SetIniInt(dict, "input:Forward Alt", g_keyMaps.k_forward[1]); + SetIniInt(dict, "input:Backward", g_keyMaps.k_back[0]); + SetIniInt(dict, "input:Backward Alt", g_keyMaps.k_back[1]); + SetIniInt(dict, "input:Left", g_keyMaps.k_left[0]); + SetIniInt(dict, "input:Left Alt", g_keyMaps.k_left[1]); + SetIniInt(dict, "input:Right", g_keyMaps.k_right[0]); + SetIniInt(dict, "input:Right Alt", g_keyMaps.k_right[1]); + SetIniInt(dict, "input:Sprint", g_keyMaps.k_sprint[0]); + SetIniInt(dict, "input:Sprint Alt", g_keyMaps.k_sprint[1]); + #undef SetIniBool #undef SetIniInt diff --git a/CONFIG/config.h b/CONFIG/config.h index 71e876f6..169346c3 100644 --- a/CONFIG/config.h +++ b/CONFIG/config.h @@ -4,6 +4,7 @@ #include "AboutDlg.h" #include "compat.h" #include "decomp.h" +#include "lego/legoomni/include/legokeymaps.h" #ifdef MINIWIN #include "miniwin/d3d.h" @@ -12,6 +13,7 @@ #endif #include +#include class LegoDeviceEnumerate; struct Direct3DDeviceInfo; diff --git a/CONFIG/res/maindialog.ui b/CONFIG/res/maindialog.ui index 9d74c1bb..5a835e68 100644 --- a/CONFIG/res/maindialog.ui +++ b/CONFIG/res/maindialog.ui @@ -7,7 +7,7 @@ 0 0 640 - 480 + 502 @@ -958,7 +958,7 @@ The game will gradually increase the number of actors until this maximum is reac - false + true Work-In-Progress, currently non-functional @@ -1155,8 +1155,8 @@ The game will gradually increase the number of actors until this maximum is reac 0 0 - 217 - 217 + 449 + 391 diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index 6715315d..552eff23 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -1107,6 +1107,18 @@ bool IsleApp::LoadConfig() iniparser_set(dict, "isle:Exclusive Framerate", SDL_itoa(m_exclusiveFrameRate, buf, 10)); iniparser_set(dict, "isle:Frame Delta", SDL_itoa(m_frameDelta, buf, 10)); + iniparser_set(dict, "input", NULL); + iniparser_set(dict, "input:Forward", SDL_itoa(g_keyMaps.k_forward[0], buf, 10)); + iniparser_set(dict, "input:Forward Alt", SDL_itoa(g_keyMaps.k_forward[1], buf, 10)); + iniparser_set(dict, "input:Backward", SDL_itoa(g_keyMaps.k_back[0], buf, 10)); + iniparser_set(dict, "input:Backward Alt", SDL_itoa(g_keyMaps.k_back[1], buf, 10)); + iniparser_set(dict, "input:Left", SDL_itoa(g_keyMaps.k_left[0], buf, 10)); + iniparser_set(dict, "input:Left Alt", SDL_itoa(g_keyMaps.k_left[1], buf, 10)); + iniparser_set(dict, "input:Right", SDL_itoa(g_keyMaps.k_right[0], buf, 10)); + iniparser_set(dict, "input:Right Alt", SDL_itoa(g_keyMaps.k_right[1], buf, 10)); + iniparser_set(dict, "input:Sprint", SDL_itoa(g_keyMaps.k_sprint[0], buf, 10)); + iniparser_set(dict, "input:Sprint Alt", SDL_itoa(g_keyMaps.k_sprint[1], buf, 10)); + #ifdef EXTENSIONS iniparser_set(dict, "extensions", NULL); for (const char* key : Extensions::availableExtensions) { @@ -1184,6 +1196,17 @@ bool IsleApp::LoadConfig() m_videoParam.SetMSAASamples((m_msaaSamples = iniparser_getint(dict, "isle:MSAA", m_msaaSamples))); m_videoParam.SetAnisotropic((m_anisotropic = iniparser_getdouble(dict, "isle:Anisotropic", m_anisotropic))); + g_keyMaps.k_forward[0] = (SDL_Scancode) iniparser_getint(dict, "input:Forward", g_keyMaps.k_forward[0]); + g_keyMaps.k_forward[1] = (SDL_Scancode) iniparser_getint(dict, "input:Forward Alt", g_keyMaps.k_forward[1]); + g_keyMaps.k_back[0] = (SDL_Scancode) iniparser_getint(dict, "input:Backward", g_keyMaps.k_back[0]); + g_keyMaps.k_back[1] = (SDL_Scancode) iniparser_getint(dict, "input:Backward Alt", g_keyMaps.k_back[1]); + g_keyMaps.k_left[0] = (SDL_Scancode) iniparser_getint(dict, "input:Left", g_keyMaps.k_left[0]); + g_keyMaps.k_left[1] = (SDL_Scancode) iniparser_getint(dict, "input:Left Alt", g_keyMaps.k_left[1]); + g_keyMaps.k_right[0] = (SDL_Scancode) iniparser_getint(dict, "input:Right", g_keyMaps.k_right[0]); + g_keyMaps.k_right[1] = (SDL_Scancode) iniparser_getint(dict, "input:Right Alt", g_keyMaps.k_right[1]); + g_keyMaps.k_sprint[0] = (SDL_Scancode) iniparser_getint(dict, "input:Sprint", g_keyMaps.k_sprint[0]); + g_keyMaps.k_sprint[1] = (SDL_Scancode) iniparser_getint(dict, "input:Sprint Alt", g_keyMaps.k_sprint[1]); + const char* deviceId = iniparser_getstring(dict, "isle:3D Device ID", NULL); if (deviceId != NULL) { m_deviceId = SDL_strdup(deviceId); diff --git a/LEGO1/lego/legoomni/include/legokeymaps.h b/LEGO1/lego/legoomni/include/legokeymaps.h index 411c9ba8..32fef860 100644 --- a/LEGO1/lego/legoomni/include/legokeymaps.h +++ b/LEGO1/lego/legoomni/include/legokeymaps.h @@ -3,17 +3,10 @@ #include "decomp.h" #include "lego1_export.h" -#include "legoeventnotificationparam.h" -#include "mxlist.h" -#include "mxpresenter.h" -#include "mxqueue.h" -#include -#include #include #include #include -#include #ifdef MINIWIN #include "miniwin/windows.h" #else