diff --git a/CMakeLists.txt b/CMakeLists.txt index e3dc60ab..7ce72206 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -534,6 +534,9 @@ if (ISLE_BUILD_APP) # Allow unconditional include of miniwin/miniwindevice.h target_link_libraries(isle PRIVATE miniwin-headers) + # Vector math + target_link_libraries(isle PRIVATE Vec::Vec) + # Link DSOUND and WINMM if (WIN32) target_link_libraries(isle PRIVATE winmm) @@ -791,7 +794,7 @@ if(NINTENDO_3DS) DESCRIPTION "LEGO Island for the Nintendo 3DS" AUTHOR "isledecomp/isle-portable" VERSION "${PROJECT_VERSION}" - ICON "ISLE/res/3ds/icon.png" + ICON "${CMAKE_SOURCE_DIR}/packaging/3ds/icon.png" ) ctr_create_3dsx(isle SMDH isle.smdh) @@ -799,10 +802,10 @@ if(NINTENDO_3DS) add_custom_command( OUTPUT "isle.bnr" COMMAND "${BANNERTOOL}" makebanner - -i "${CMAKE_SOURCE_DIR}/ISLE/res/3ds/banner.png" - -a "${CMAKE_SOURCE_DIR}/ISLE/res/3ds/banner.wav" + -i "${CMAKE_SOURCE_DIR}/packaging/3ds/banner.png" + -a "${CMAKE_SOURCE_DIR}/packaging/3ds/banner.wav" -o "isle.bnr" - DEPENDS "${CMAKE_SOURCE_DIR}/ISLE/res/3ds/banner.png" "${CMAKE_SOURCE_DIR}/ISLE/res/3ds/banner.wav" + DEPENDS "${CMAKE_SOURCE_DIR}/packaging/3ds/banner.png" "${CMAKE_SOURCE_DIR}/packaging/3ds/banner.wav" VERBATIM ) @@ -812,14 +815,14 @@ if(NINTENDO_3DS) -f cia -exefslogo -o "isle.cia" - -rsf "${CMAKE_SOURCE_DIR}/ISLE/res/3ds/template.rsf" + -rsf "${CMAKE_SOURCE_DIR}/packaging/3ds/template.rsf" -major "${CMAKE_PROJECT_VERSION_MAJOR}" -minor "${CMAKE_PROJECT_VERSION_MINOR}" -micro 0 -icon "isle.smdh" -banner "isle.bnr" -elf "isle.elf" - DEPENDS "${CMAKE_SOURCE_DIR}/ISLE/res/3ds/template.rsf" "isle.smdh" "isle.bnr" + DEPENDS "${CMAKE_SOURCE_DIR}/packaging/3ds/template.rsf" "isle.smdh" "isle.bnr" COMMENT "Building CIA executable target isle.cia" VERBATIM ) diff --git a/CONFIG/MainDlg.cpp b/CONFIG/MainDlg.cpp index 828395bd..dfba47ea 100644 --- a/CONFIG/MainDlg.cpp +++ b/CONFIG/MainDlg.cpp @@ -57,8 +57,10 @@ CMainDialog::CMainDialog(QWidget* pParent) : QDialog(pParent) connect(m_ui->devicesList, &QListWidget::currentRowChanged, this, &CMainDialog::OnList3DevicesSelectionChanged); connect(m_ui->musicCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxMusic); connect(m_ui->sound3DCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckbox3DSound); - connect(m_ui->joystickCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxJoystick); connect(m_ui->fullscreenCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxFullscreen); + connect(m_ui->rumbleCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxRumble); + connect(m_ui->textureCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxTexture); + connect(m_ui->touchComboBox, &QComboBox::currentIndexChanged, this, &CMainDialog::TouchControlsChanged); connect(m_ui->transitionTypeComboBox, &QComboBox::currentIndexChanged, this, &CMainDialog::TransitionTypeChanged); connect(m_ui->okButton, &QPushButton::clicked, this, &CMainDialog::accept); connect(m_ui->cancelButton, &QPushButton::clicked, this, &CMainDialog::reject); @@ -70,8 +72,13 @@ CMainDialog::CMainDialog(QWidget* pParent) : QDialog(pParent) connect(m_ui->dataPath, &QLineEdit::editingFinished, this, &CMainDialog::DataPathEdited); connect(m_ui->savePath, &QLineEdit::editingFinished, this, &CMainDialog::SavePathEdited); + connect(m_ui->texturePathOpen, &QPushButton::clicked, this, &CMainDialog::SelectTexturePathDialog); + connect(m_ui->texturePath, &QLineEdit::editingFinished, this, &CMainDialog::TexturePathEdited); + connect(m_ui->maxLoDSlider, &QSlider::valueChanged, this, &CMainDialog::MaxLoDChanged); + connect(m_ui->maxLoDSlider, &QSlider::sliderMoved, this, &CMainDialog::MaxLoDChanged); connect(m_ui->maxActorsSlider, &QSlider::valueChanged, this, &CMainDialog::MaxActorsChanged); + connect(m_ui->maxActorsSlider, &QSlider::sliderMoved, this, &CMainDialog::MaxActorsChanged); layout()->setSizeConstraint(QLayout::SetFixedSize); } @@ -115,7 +122,9 @@ bool CMainDialog::OnInitDialog() m_ui->devicesList->setCurrentRow(selected); m_ui->maxLoDSlider->setValue((int) currentConfigApp->m_max_lod * 10); + m_ui->LoDNum->setNum((int) currentConfigApp->m_max_lod * 10); m_ui->maxActorsSlider->setValue(currentConfigApp->m_max_actors); + m_ui->maxActorsNum->setNum(currentConfigApp->m_max_actors); UpdateInterface(); return true; } @@ -210,12 +219,18 @@ void CMainDialog::UpdateInterface() else { m_ui->textureQualityHighRadioButton->setChecked(true); } - m_ui->joystickCheckBox->setChecked(currentConfigApp->m_use_joystick); m_ui->musicCheckBox->setChecked(currentConfigApp->m_music); m_ui->fullscreenCheckBox->setChecked(currentConfigApp->m_full_screen); + m_ui->rumbleCheckBox->setChecked(currentConfigApp->m_haptic); + 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)); m_ui->savePath->setText(QString::fromStdString(currentConfigApp->m_save_path)); + m_ui->textureCheckBox->setChecked(currentConfigApp->m_texture_load); + m_ui->texturePath->setText(QString::fromStdString(currentConfigApp->m_texture_path)); + + m_ui->texturePath->setEnabled(currentConfigApp->m_texture_load); + m_ui->texturePathOpen->setEnabled(currentConfigApp->m_texture_load); } // FUNCTION: CONFIG 0x004045e0 @@ -275,14 +290,6 @@ void CMainDialog::OnRadiobuttonTextureHighQuality(bool checked) } } -// FUNCTION: CONFIG 0x00404790 -void CMainDialog::OnCheckboxJoystick(bool checked) -{ - currentConfigApp->m_use_joystick = checked; - m_modified = true; - UpdateInterface(); -} - // FUNCTION: CONFIG 0x004048c0 void CMainDialog::OnCheckboxMusic(bool checked) { @@ -298,6 +305,27 @@ void CMainDialog::OnCheckboxFullscreen(bool checked) UpdateInterface(); } +void CMainDialog::OnCheckboxRumble(bool checked) +{ + currentConfigApp->m_haptic = checked; + m_modified = true; + UpdateInterface(); +} + +void CMainDialog::OnCheckboxTexture(bool checked) +{ + currentConfigApp->m_texture_load = checked; + m_modified = true; + UpdateInterface(); +} + +void CMainDialog::TouchControlsChanged(int index) +{ + currentConfigApp->m_touch_scheme = index; + m_modified = true; + UpdateInterface(); +} + void CMainDialog::TransitionTypeChanged(int index) { currentConfigApp->m_transition_type = index; @@ -376,11 +404,43 @@ void CMainDialog::SavePathEdited() void CMainDialog::MaxLoDChanged(int value) { currentConfigApp->m_max_lod = static_cast(value) / 10.0f; + m_ui->LoDNum->setNum(value); m_modified = true; } void CMainDialog::MaxActorsChanged(int value) { currentConfigApp->m_max_actors = value; + m_ui->maxActorsNum->setNum(value); m_modified = true; } + +void CMainDialog::SelectTexturePathDialog() +{ + QString texture_path = QString::fromStdString(currentConfigApp->m_texture_path); + texture_path = QFileDialog::getExistingDirectory( + this, + tr("Open Directory"), + texture_path, + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks + ); + + QDir texture_dir = QDir(texture_path); + + if (texture_dir.exists()) { + currentConfigApp->m_texture_path = texture_dir.absolutePath().toStdString(); + m_modified = true; + } + UpdateInterface(); +} + +void CMainDialog::TexturePathEdited() +{ + QDir texture_dir = QDir(m_ui->texturePath->text()); + + if (texture_dir.exists()) { + currentConfigApp->m_texture_path = texture_dir.absolutePath().toStdString(); + m_modified = true; + } + UpdateInterface(); +} diff --git a/CONFIG/MainDlg.h b/CONFIG/MainDlg.h index 72062486..40156790 100644 --- a/CONFIG/MainDlg.h +++ b/CONFIG/MainDlg.h @@ -40,9 +40,11 @@ private slots: void OnRadiobuttonModelHighQuality(bool checked); void OnRadiobuttonTextureLowQuality(bool checked); void OnRadiobuttonTextureHighQuality(bool checked); - void OnCheckboxJoystick(bool checked); void OnCheckboxMusic(bool checked); void OnCheckboxFullscreen(bool checked); + void OnCheckboxRumble(bool checked); + void OnCheckboxTexture(bool checked); + void TouchControlsChanged(int index); void TransitionTypeChanged(int index); void accept() override; void reject() override; @@ -53,6 +55,8 @@ private slots: void SavePathEdited(); void MaxLoDChanged(int value); void MaxActorsChanged(int value); + void SelectTexturePathDialog(); + void TexturePathEdited(); }; // SYNTHETIC: CONFIG 0x00403de0 diff --git a/CONFIG/config.cpp b/CONFIG/config.cpp index b4435298..c88f779b 100644 --- a/CONFIG/config.cpp +++ b/CONFIG/config.cpp @@ -78,6 +78,10 @@ bool CConfigApp::InitInstance() m_3d_video_ram = FALSE; m_joystick_index = -1; m_display_bit_depth = 16; + m_haptic = TRUE; + m_touch_scheme = 2; + m_texture_load = TRUE; + m_texture_path = "/textures/"; int totalRamMiB = SDL_GetSystemRAM(); if (totalRamMiB < 12) { m_3d_sound = FALSE; @@ -155,6 +159,7 @@ bool CConfigApp::ReadRegisterSettings() m_flip_surfaces = iniparser_getboolean(dict, "isle:Flip Surfaces", m_flip_surfaces); m_full_screen = iniparser_getboolean(dict, "isle:Full Screen", m_full_screen); m_transition_type = iniparser_getint(dict, "isle:Transition Type", m_transition_type); + m_touch_scheme = iniparser_getint(dict, "isle:Touch Scheme", m_touch_scheme); m_3d_video_ram = iniparser_getboolean(dict, "isle:Back Buffers in Video RAM", m_3d_video_ram); m_wide_view_angle = iniparser_getboolean(dict, "isle:Wide View Angle", m_wide_view_angle); m_3d_sound = iniparser_getboolean(dict, "isle:3DSound", m_3d_sound); @@ -162,10 +167,13 @@ bool CConfigApp::ReadRegisterSettings() m_model_quality = iniparser_getint(dict, "isle:Island Quality", m_model_quality); 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_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); m_max_actors = iniparser_getint(dict, "isle:Max Allowed Extras", m_max_actors); + m_texture_load = iniparser_getboolean(dict, "extensions:texture loader", m_texture_load); + m_texture_path = iniparser_getstring(dict, "texture loader:texture path", m_texture_path.c_str()); iniparser_freedict(dict); return true; } @@ -230,6 +238,14 @@ bool CConfigApp::ValidateSettings() m_max_actors = 20; is_modified = TRUE; } + if (!m_use_joystick) { + m_use_joystick = true; + is_modified = TRUE; + } + if (m_touch_scheme < 0 || m_touch_scheme > 2) { + m_touch_scheme = 2; + is_modified = TRUE; + } return is_modified; } @@ -298,6 +314,8 @@ void CConfigApp::WriteRegisterSettings() const dictionary* dict = dictionary_new(0); iniparser_set(dict, "isle", NULL); + iniparser_set(dict, "extensions", NULL); + iniparser_set(dict, "texture loader", NULL); if (m_device_enumerator->FormatDeviceName(buffer, m_driver, m_device) >= 0) { iniparser_set(dict, "isle:3D Device ID", buffer); } @@ -311,14 +329,19 @@ void CConfigApp::WriteRegisterSettings() const SetIniBool(dict, "isle:Wide View Angle", m_wide_view_angle); SetIniInt(dict, "isle:Transition Type", m_transition_type); + SetIniInt(dict, "isle:Touch Scheme", m_touch_scheme); SetIniBool(dict, "isle:3DSound", m_3d_sound); SetIniBool(dict, "isle:Music", m_music); + SetIniBool(dict, "isle:Haptic", m_haptic); SetIniBool(dict, "isle:UseJoystick", m_use_joystick); SetIniInt(dict, "isle:JoystickIndex", m_joystick_index); SetIniBool(dict, "isle:Draw Cursor", m_draw_cursor); + SetIniBool(dict, "extensions:texture loader", m_texture_load); + iniparser_set(dict, "texture loader:texture path", m_texture_path.c_str()); + SetIniBool(dict, "isle:Back Buffers in Video RAM", m_3d_video_ram); SetIniInt(dict, "isle:Island Quality", m_model_quality); diff --git a/CONFIG/config.h b/CONFIG/config.h index dffc2b6c..796a5659 100644 --- a/CONFIG/config.h +++ b/CONFIG/config.h @@ -71,16 +71,20 @@ class CConfigApp { bool m_3d_sound; bool m_draw_cursor; bool m_use_joystick; + bool m_haptic; int m_joystick_index; int m_model_quality; int m_texture_quality; bool m_music; + bool m_texture_load; + std::string m_texture_path; std::string m_iniPath; std::string m_base_path; std::string m_cd_path; std::string m_save_path; float m_max_lod; int m_max_actors; + int m_touch_scheme; }; extern CConfigApp g_theApp; diff --git a/CONFIG/res/maindialog.ui b/CONFIG/res/maindialog.ui index 66e2b52e..526c31d8 100644 --- a/CONFIG/res/maindialog.ui +++ b/CONFIG/res/maindialog.ui @@ -6,8 +6,8 @@ 0 0 - 575 - 600 + 550 + 700 @@ -23,7 +23,7 @@ :/lego1.png:/lego1.png - + @@ -56,13 +56,16 @@ false - - Qt::AlignmentFlag::AlignCenter - + + + 0 + 0 + + @@ -89,7 +92,7 @@ - 55 + 50 16777215 @@ -108,7 +111,7 @@ - 55 + 50 16777215 @@ -129,17 +132,15 @@ Save Path: - Qt::TextFormat::PlainText - - - Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter + Qt::PlainText - Path to the game data files. Set this to the CD image root. + Path to the game data files. +Set this to the CD image root. @@ -162,10 +163,7 @@ Data Path: - Qt::TextFormat::PlainText - - - Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter + Qt::PlainText @@ -187,13 +185,166 @@ 0 + + + + + 0 + 0 + + + + Maximum number of LEGO actors to exist in the world at a time. +The game will gradually increase the number of actors until this maximum is reached and while performance is acceptable. + + + Maximum Actors (5..40) + + + + + + + 0 + 0 + + + + 5 + + + 40 + + + 5 + + + 20 + + + 20 + + + false + + + Qt::Horizontal + + + QSlider::NoTicks + + + 5 + + + + + + + + 0 + 0 + + + + + 15 + 0 + + + + 20 + + + + + + + + + + + 0 + 0 + + + + + 0 + 70 + + + + Maximum Level of Detail (LOD). +A higher setting will cause higher quality textures to be drawn regardless of distance. + + + Maximum LOD + + + + + + + 0 + 0 + + + + 50 + + + 5 + + + 10 + + + 35 + + + false + + + Qt::Horizontal + + + QSlider::NoTicks + + + 10 + + + + + + + + 0 + 0 + + + + + 15 + 0 + + + + 35 + + + + + + - - - 16777215 - 120 - + + + 0 + 0 + Set 3D model detail level. @@ -204,8 +355,14 @@ + + Broken, not recommended. + + + color: rgb(255, 0, 0); + - Low + Low - BROKEN! @@ -226,63 +383,26 @@ - - - - - 0 - 70 - - - - Maximum Level of Detail (LOD). A higher setting will cause higher quality textures to be drawn regardless of distance. - - - Maximum LOD - - - Qt::AlignmentFlag::AlignCenter - - - - - - 50 - - - 5 - - - 10 - - - 35 - - - false - - - Qt::Orientation::Horizontal - - - QSlider::TickPosition::TicksBothSides - - - 10 - - - - - - + + true + + + + 0 + 0 + + Set texture detail level. Island Texture Quality + + false + 0 @@ -307,58 +427,24 @@ - - - - Maximum number of LEGO actors to exist in the world at a time. The game will gradually increase the number of actors until this maximum is reached and while performance is acceptable. - - - Maximum Actors (5..40) - - - Qt::AlignmentFlag::AlignCenter - - - - - - 5 - - - 40 - - - 5 - - - 20 - - - 20 - - - false - - - Qt::Orientation::Horizontal - - - QSlider::TickPosition::TicksBothSides - - - 5 - - - - - - + + + 0 + 0 + + + + 0 + + + 0 + @@ -379,16 +465,6 @@ - - - - Enable joystick and gamepad support for LEGO Island. - - - Use Joystick - - - @@ -399,80 +475,201 @@ + + + + true + + + Enable controller rumble. + + + Rumble + + + true + + + - - - Transition Type - + + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + Sets the transition effect to be used in game. + + + Transition Type + + + + + + Mosaic + + + 3 + + + + Idle - Broken + + + + + No Animation + + + + + Dissolve + + + + + Mosaic + + + + + Wipe Down + + + + + Windows + + + + + Unknown - Broken + + + + + + + + + + + <html><head/><body><p><span style=" font-weight:600;">Virtual Gamepad (Recommended):</span> Slide your finger to move and turn.</p><p><span style=" font-weight:600;">Virtual Arrow Keys:</span> Tap screen areas to move. The top moves forward, the bottom turns or moves back.</p><p><span style=" font-weight:600;">Virtual Mouse:</span> Emulates classic mouse controls with touch.</p></body></html> + + + Touch Control Scheme + + + + + + 2 + + + + Virtual Mouse + + + + + Virtual Arrow Keys + + + + + Virtual Gamepad + + + + + + + + - - - Sets the transition effect to be used in game. + + + Texture Loader Extension - - Idle - Broken - - - - - - - Idle - Broken - - - - - No Animation - - - - - Dissolve - - - - - Mosaic - - - - - Wipe Down - - - - - Windows - - - - - Unknown - Broken - - + + + + + false + + + Path to texture replacements. + + + textures/ + + + + + + + false + + + + 0 + 0 + + + + + 50 + 16777215 + + + + Open + + + + + + + Enabled + + + + - - - 16777215 - 225 - + + + 0 + 0 + 3D graphics device used to render the game. - - - - Qt::AlignmentFlag::AlignCenter + Graphics Devices false @@ -490,28 +687,6 @@ 6 - - - - - 0 - 0 - - - - - 0 - 25 - - - - Direct 3D Devices - - - Qt::AlignmentFlag::AlignCenter - - - @@ -526,17 +701,17 @@ 16777215 - 125 + 100 - QAbstractItemView::EditTrigger::NoEditTriggers + QAbstractItemView::NoEditTriggers true - QAbstractItemView::SelectionBehavior::SelectRows + QAbstractItemView::SelectItems @@ -545,9 +720,15 @@ + + + 0 + 0 + + - 30 + 10 0 @@ -616,8 +797,6 @@ maxActorsSlider sound3DCheckBox musicCheckBox - joystickCheckBox - fullscreenCheckBox devicesList okButton launchButton diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index a30549b8..6edfa261 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -37,8 +37,10 @@ #include "tgl/d3drm/impl.h" #include "viewmanager/viewmanager.h" +#include #include #include +#include #define SDL_MAIN_USE_CALLBACKS #include @@ -429,17 +431,6 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event) return SDL_APP_CONTINUE; } - // [library:window] - // Remaining functionality to be implemented: - // WM_TIMER - use SDL_Timer functionality instead - -#ifdef __EMSCRIPTEN__ - // Workaround for the fact we are getting both mouse & touch events on mobile devices running Emscripten. - // On desktops, we are only getting mouse events, but a touch device (pen_input) may also be present... - // See: https://github.com/libsdl-org/SDL/issues/13161 - static bool detectedTouchEvents = false; -#endif - switch (event->type) { case SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED: case SDL_EVENT_MOUSE_MOTION: @@ -624,11 +615,7 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event) g_mouseWarped = FALSE; break; } -#ifdef __EMSCRIPTEN__ - if (detectedTouchEvents) { - break; - } -#endif + g_mousemoved = TRUE; if (InputManager()) { @@ -651,9 +638,6 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event) } break; case SDL_EVENT_FINGER_MOTION: { -#ifdef __EMSCRIPTEN__ - detectedTouchEvents = true; -#endif g_mousemoved = TRUE; float x = SDL_clamp(event->tfinger.x, 0, 1) * g_targetWidth; @@ -679,11 +663,6 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event) break; } case SDL_EVENT_MOUSE_BUTTON_DOWN: -#ifdef __EMSCRIPTEN__ - if (detectedTouchEvents) { - break; - } -#endif g_mousedown = TRUE; if (InputManager()) { @@ -697,9 +676,6 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event) } break; case SDL_EVENT_FINGER_DOWN: { -#ifdef __EMSCRIPTEN__ - detectedTouchEvents = true; -#endif g_mousedown = TRUE; float x = SDL_clamp(event->tfinger.x, 0, 1) * g_targetWidth; @@ -721,17 +697,6 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event) break; } case SDL_EVENT_MOUSE_BUTTON_UP: -#ifdef __EMSCRIPTEN__ - if (detectedTouchEvents) { - // Abusing the fact (bug?) that we are always getting mouse events on Emscripten. - // This functionality should be enabled in a more general way with touch events, - // but SDL touch event's don't have a "double tap" indicator right now. - if (event->button.clicks == 2) { - InputManager()->QueueEvent(c_notificationKeyPress, SDLK_SPACE, 0, 0, SDLK_SPACE); - } - break; - } -#endif g_mousedown = FALSE; if (InputManager()) { @@ -745,14 +710,13 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event) } break; case SDL_EVENT_FINGER_UP: { -#ifdef __EMSCRIPTEN__ - detectedTouchEvents = true; -#endif g_mousedown = FALSE; float x = SDL_clamp(event->tfinger.x, 0, 1) * g_targetWidth; float y = SDL_clamp(event->tfinger.y, 0, 1) * g_targetHeight; + g_isle->DetectDoubleTap(event->tfinger); + if (InputManager()) { InputManager()->HandleTouchEvent(event, g_isle->GetTouchScheme()); InputManager()->QueueEvent(c_notificationButtonUp, 0, x, y, 0); @@ -1485,3 +1449,26 @@ void IsleApp::MoveVirtualMouseViaJoystick() } } } + +void IsleApp::DetectDoubleTap(const SDL_TouchFingerEvent& p_event) +{ + typedef std::pair> LastTap; + + const MxU32 doubleTapMs = 500; + const float doubleTapDist = 0.001; + static LastTap lastTap = {0, {0, 0}}; + + LastTap currentTap = {p_event.timestamp, {p_event.x, p_event.y}}; + if (SDL_NS_TO_MS(currentTap.first - lastTap.first) < doubleTapMs && + DISTSQRD2(currentTap.second, lastTap.second) < doubleTapDist) { + + if (InputManager()) { + InputManager()->QueueEvent(c_notificationKeyPress, SDLK_SPACE, 0, 0, SDLK_SPACE); + } + + lastTap = {0, {0, 0}}; + } + else { + lastTap = currentTap; + } +} diff --git a/ISLE/isleapp.h b/ISLE/isleapp.h index 180c2252..4bec7dd6 100644 --- a/ISLE/isleapp.h +++ b/ISLE/isleapp.h @@ -65,6 +65,7 @@ class IsleApp { MxResult VerifyFilesystem(); void DetectGameVersion(); void MoveVirtualMouseViaJoystick(); + void DetectDoubleTap(const SDL_TouchFingerEvent& p_event); private: char* m_hdPath; // 0x00 diff --git a/ISLE/res/3ds/banner.wav b/ISLE/res/3ds/banner.wav deleted file mode 100644 index ce7849e7..00000000 Binary files a/ISLE/res/3ds/banner.wav and /dev/null differ diff --git a/LEGO1/omni/src/video/mxdisplaysurface.cpp b/LEGO1/omni/src/video/mxdisplaysurface.cpp index 2039a7e2..f676dd0a 100644 --- a/LEGO1/omni/src/video/mxdisplaysurface.cpp +++ b/LEGO1/omni/src/video/mxdisplaysurface.cpp @@ -1258,7 +1258,7 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::CreateCursorSurface(const CursorBitmap* p_ MxS32 pixel; if (!isOpaque) { - pixel = RGB8888_CREATE(0, 0, 0, 0); // Transparent pixel + pixel = RGB8888_CREATE(0xff, 0, 0xff, 0); // Transparent pixel } else { pixel = isBlack ? RGB8888_CREATE(0, 0, 0, 0xff) : RGB8888_CREATE(0xff, 0xff, 0xff, 0xff); @@ -1289,8 +1289,8 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::CreateCursorSurface(const CursorBitmap* p_ } default: { DDCOLORKEY colorkey; - colorkey.dwColorSpaceHighValue = RGB8888_CREATE(0, 0, 0, 0); - colorkey.dwColorSpaceLowValue = RGB8888_CREATE(0, 0, 0, 0); + colorkey.dwColorSpaceHighValue = RGB8888_CREATE(0xff, 0, 0xff, 0); + colorkey.dwColorSpaceLowValue = RGB8888_CREATE(0xff, 0, 0xff, 0); newSurface->SetColorKey(DDCKEY_SRCBLT, &colorkey); break; } diff --git a/docker/emscripten/Dockerfile b/docker/emscripten/Dockerfile index 707b3c7a..40c17cce 100644 --- a/docker/emscripten/Dockerfile +++ b/docker/emscripten/Dockerfile @@ -1,4 +1,4 @@ -FROM emscripten/emsdk:latest AS builder +FROM emscripten/emsdk:4.0.10 AS builder ARG CMAKE_VERSION=3.29.3 diff --git a/ISLE/res/3ds/banner.png b/packaging/3ds/banner.png similarity index 100% rename from ISLE/res/3ds/banner.png rename to packaging/3ds/banner.png diff --git a/packaging/3ds/banner.wav b/packaging/3ds/banner.wav new file mode 100644 index 00000000..8eeb79ba Binary files /dev/null and b/packaging/3ds/banner.wav differ diff --git a/ISLE/res/3ds/icon.png b/packaging/3ds/icon.png similarity index 100% rename from ISLE/res/3ds/icon.png rename to packaging/3ds/icon.png diff --git a/ISLE/res/3ds/logo.bcma.lz b/packaging/3ds/logo.bcma.lz similarity index 100% rename from ISLE/res/3ds/logo.bcma.lz rename to packaging/3ds/logo.bcma.lz diff --git a/ISLE/res/3ds/template.rsf b/packaging/3ds/template.rsf similarity index 100% rename from ISLE/res/3ds/template.rsf rename to packaging/3ds/template.rsf