From 4fc2b492512a54b7d3c024591bba5dee54bf448a Mon Sep 17 00:00:00 2001 From: uncor3 Date: Thu, 30 Oct 2025 11:32:05 +0000 Subject: [PATCH] bug fixes & replace idevice_get_device_version with get_device_version --- .gitignore | 9 ++++++++- scripts/deploy-appimage.sh | 11 ++++++----- src/appinstalldialog.h | 2 +- src/core/services/mount_dev_image.cpp | 2 +- src/core/services/set_location.cpp | 2 +- src/devdiskimagehelper.cpp | 2 +- src/devdiskimageswidget.cpp | 2 +- src/devdiskmanager.cpp | 4 ++-- src/deviceimagewidget.cpp | 2 +- src/iDescriptor.h | 25 ++++++++++++++++++++++++- src/ifusewidget.cpp | 14 +++++++++----- src/realtimescreenwidget.cpp | 2 +- src/settingsmanager.cpp | 10 +++++++++- src/settingsmanager.h | 2 +- src/virtuallocationwidget.cpp | 5 ++--- 15 files changed, 68 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index 48aedeb..fe4b57c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,11 @@ CMakeLists.txt.user .DS_Store AppDir *.AppImage -build-dir \ No newline at end of file +build-dir +.flatpak-builder +*.o +*.obj +*.so +*.exe +*.dll +devdiskimgs \ No newline at end of file diff --git a/scripts/deploy-appimage.sh b/scripts/deploy-appimage.sh index 0be2506..51a0e57 100755 --- a/scripts/deploy-appimage.sh +++ b/scripts/deploy-appimage.sh @@ -100,7 +100,6 @@ done mkdir -p "$APPDIR/apprun-hooks" -export QML_MODULES_PATHS="./qml" cat <<'EOF' > "$APPDIR/apprun-hooks/linuxdeploy-plugin-env.sh" #!/bin/bash @@ -111,8 +110,8 @@ export GST_PLUGIN_PATH_1_0="${APPDIR}/usr/lib/gstreamer-1.0" export GST_PLUGIN_SCANNER_1_0="${APPDIR}/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner" export GST_PTP_HELPER_1_0="${APPDIR}/usr/lib/gstreamer1.0/gstreamer-1.0/gst-ptp-helper" -export IPROXY_APPIMAGE="${APPDIR}/usr/bin/iproxy" -export IFUSE_APPIMAGE="${APPDIR}/usr/bin/ifuse" +export IPROXY_BIN_APPIMAGE="${APPDIR}/usr/bin/iproxy" +export IFUSE_BIN_APPIMAGE="${APPDIR}/usr/bin/ifuse" EOF chmod +x "$APPDIR/apprun-hooks/linuxdeploy-plugin-env.sh" @@ -121,11 +120,13 @@ chmod +x "$APPDIR/apprun-hooks/linuxdeploy-plugin-env.sh" cp iDescriptor.desktop "$APPDIR/usr/share/applications/" export LD_LIBRARY_PATH="$APPDIR/usr/local/lib:$LD_LIBRARY_PATH" +export LINUXDEPLOY_EXCLUDED_LIBRARIES="*sql*" +export QML_SOURCES_PATHS="./qml" + ./linuxdeploy-x86_64.AppImage \ --appdir ./AppDir \ --desktop-file AppDir/usr/share/applications/iDescriptor.desktop \ - --plugin qt \ + --plugin qt \ --exclude-library libGL,libGLX,libEGL,libOpenGL,libdrm,libva,libvdpau,libxcb,libxcb-glx,libxcb-dri2,libxcb-dri3,libX11,libXext,libXrandr,libXrender,libXfixes,libXau,libXdmcp,libqsqlmimer,libmysqlclient,libmysqlclient \ --output appimage \ - --deploy-deps-only AppDir/usr/bin/ifuse diff --git a/src/appinstalldialog.h b/src/appinstalldialog.h index 982dfaa..cfcdaf6 100644 --- a/src/appinstalldialog.h +++ b/src/appinstalldialog.h @@ -29,7 +29,7 @@ private: QString m_bundleId; QLabel *m_statusLabel; QFutureWatcher *m_installWatcher; - QTemporaryDir *m_tempDir; + QTemporaryDir *m_tempDir = nullptr; void updateDeviceList(); void performInstallation(const QString &ipaPath, const QString &deviceUdid); }; diff --git a/src/core/services/mount_dev_image.cpp b/src/core/services/mount_dev_image.cpp index fb7b145..5a9a68a 100644 --- a/src/core/services/mount_dev_image.cpp +++ b/src/core/services/mount_dev_image.cpp @@ -102,7 +102,7 @@ mobile_image_mounter_error_t mount_dev_image(const char *udid, goto leave; } - device_version = idevice_get_device_version(device); + device_version = get_device_version(device); if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake( device, &lckd, TOOL_NAME))) { qDebug() << "ERROR: Could not connect to lockdownd service!"; diff --git a/src/core/services/set_location.cpp b/src/core/services/set_location.cpp index ae70f80..e905eea 100644 --- a/src/core/services/set_location.cpp +++ b/src/core/services/set_location.cpp @@ -71,7 +71,7 @@ bool set_location(idevice_t device, char *lat, char *lon) lerr = lockdownd_start_service(lockdown, DT_SIMULATELOCATION_SERVICE, &svc); if (lerr != LOCKDOWN_E_SUCCESS) { - unsigned int device_version = idevice_get_device_version(device); + unsigned int device_version = get_device_version(device); lockdownd_client_free(lockdown); idevice_free(device); diff --git a/src/devdiskimagehelper.cpp b/src/devdiskimagehelper.cpp index 35336c9..18da300 100644 --- a/src/devdiskimagehelper.cpp +++ b/src/devdiskimagehelper.cpp @@ -112,7 +112,7 @@ void DevDiskImageHelper::onMountButtonClicked() m_isMounting = true; // Check if we need to download first - unsigned int device_version = idevice_get_device_version(m_device->device); + unsigned int device_version = get_device_version(m_device->device); unsigned int deviceMajorVersion = (device_version >> 16) & 0xFF; unsigned int deviceMinorVersion = (device_version >> 8) & 0xFF; diff --git a/src/devdiskimageswidget.cpp b/src/devdiskimageswidget.cpp index 9640d37..628e22e 100644 --- a/src/devdiskimageswidget.cpp +++ b/src/devdiskimageswidget.cpp @@ -188,7 +188,7 @@ void DevDiskImagesWidget::displayImages() // todo wtf is this if (m_currentDevice && m_currentDevice->device) { unsigned int device_version = - idevice_get_device_version(m_currentDevice->device); + get_device_version(m_currentDevice->device); deviceMajorVersion = (device_version >> 16) & 0xFF; deviceMinorVersion = (device_version >> 8) & 0xFF; hasConnectedDevice = true; diff --git a/src/devdiskmanager.cpp b/src/devdiskmanager.cpp index dca3f3b..ca1e56a 100644 --- a/src/devdiskmanager.cpp +++ b/src/devdiskmanager.cpp @@ -294,7 +294,7 @@ bool DevDiskManager::isImageDownloaded(const QString &version, bool DevDiskManager::downloadCompatibleImageInternal(iDescriptorDevice *device) { - unsigned int device_version = idevice_get_device_version(device->device); + unsigned int device_version = get_device_version(device->device); unsigned int deviceMajorVersion = (device_version >> 16) & 0xFF; unsigned int deviceMinorVersion = (device_version >> 8) & 0xFF; qDebug() << "Device version:" << deviceMajorVersion << "." @@ -381,7 +381,7 @@ bool DevDiskManager::downloadCompatibleImage(iDescriptorDevice *device) bool DevDiskManager::mountCompatibleImageInternal(iDescriptorDevice *device) { - unsigned int device_version = idevice_get_device_version(device->device); + unsigned int device_version = get_device_version(device->device); unsigned int deviceMajorVersion = (device_version >> 16) & 0xFF; unsigned int deviceMinorVersion = (device_version >> 8) & 0xFF; diff --git a/src/deviceimagewidget.cpp b/src/deviceimagewidget.cpp index abfca4b..1ea2012 100644 --- a/src/deviceimagewidget.cpp +++ b/src/deviceimagewidget.cpp @@ -136,7 +136,7 @@ QString DeviceImageWidget::getMockupNameFromDisplayName( int DeviceImageWidget::getIosVersionFromDevice() const { - unsigned int version = idevice_get_device_version(m_device->device); + unsigned int version = get_device_version(m_device->device); if (version > 0) { int majorVersion = (version >> 16) & 0xFF; diff --git a/src/iDescriptor.h b/src/iDescriptor.h index 53103e5..ee9f995 100644 --- a/src/iDescriptor.h +++ b/src/iDescriptor.h @@ -402,4 +402,27 @@ QByteArray read_afc_file_to_byte_array(afc_client_t afcClient, bool isDarkMode(); instproxy_error_t install_IPA(idevice_t device, afc_client_t afc, - const char *filePath); \ No newline at end of file + const char *filePath); + +typedef struct _idevice_private { + char *udid; + uint32_t mux_id; + enum idevice_connection_type conn_type; + void *conn_data; + int version; + int device_class; +}; + +/* + we need this because idevice_get_device_version + is not always available in libimobiledevice + which could cause issues when installed from package managers +*/ +inline unsigned int get_device_version(idevice_t _device) +{ + _idevice_private *idevice = reinterpret_cast<_idevice_private *>(_device); + if (!idevice) { + return 0; + } + return static_cast(idevice->version); +} \ No newline at end of file diff --git a/src/ifusewidget.cpp b/src/ifusewidget.cpp index 10ac35d..2d969ec 100644 --- a/src/ifusewidget.cpp +++ b/src/ifusewidget.cpp @@ -109,6 +109,9 @@ void iFuseWidget::setupUI() void iFuseWidget::updateDeviceComboBox() { + QList devices = + AppContext::sharedInstance()->getAllDevices(); + m_deviceComboBox->clear(); m_deviceComboBox->setEnabled(true); m_mountButton->setEnabled(true); @@ -330,21 +333,22 @@ void iFuseWidget::onProcessFinished(int exitCode, auto *b = new iFuseDiskUnmountButton(m_currentMountPath); MainWindow::sharedInstance()->statusBar()->addPermanentWidget(b); QProcess *processToKill = m_ifuseProcess; + QString currentMountPath = m_currentMountPath; connect(b, &iFuseDiskUnmountButton::clicked, this, - [b, processToKill]() { - qDebug() << "Unmounting" << m_currentMountPath; - bool ok = iFuseManager::linuxUnmount(m_currentMountPath); + [b, processToKill, currentMountPath]() { + qDebug() << "Unmounting" << currentMountPath; + bool ok = iFuseManager::linuxUnmount(currentMountPath); if (!ok) { QMessageBox::warning(nullptr, "Unmount Failed", "Failed to unmount iFuse at " + - m_currentMountPath + + currentMountPath + ". Please try again."); return; } MainWindow::sharedInstance()->statusBar()->removeWidget(b); b->deleteLater(); }); - QDesktopServices::openUrl(QUrl::fromLocalFile(m_currentMountPath)); + QDesktopServices::openUrl(QUrl::fromLocalFile(currentMountPath)); } else { QString errorOutput = m_ifuseProcess->readAllStandardError(); setStatusMessage("Mount failed: " + errorOutput, true); diff --git a/src/realtimescreenwidget.cpp b/src/realtimescreenwidget.cpp index 1871b47..5dc1459 100644 --- a/src/realtimescreenwidget.cpp +++ b/src/realtimescreenwidget.cpp @@ -20,7 +20,7 @@ RealtimeScreenWidget::RealtimeScreenWidget(iDescriptorDevice *device, { setWindowTitle("Real-time Screen - iDescriptor"); - unsigned int device_version = idevice_get_device_version(m_device->device); + unsigned int device_version = get_device_version(m_device->device); unsigned int deviceMajorVersion = (device_version >> 16) & 0xFF; if (deviceMajorVersion > 16) { diff --git a/src/settingsmanager.cpp b/src/settingsmanager.cpp index cf44f69..03e92c9 100644 --- a/src/settingsmanager.cpp +++ b/src/settingsmanager.cpp @@ -45,7 +45,15 @@ QString SettingsManager::devdiskimgpath() const // Settings implementation QString SettingsManager::downloadPath() const { - return m_settings->value("downloadPath", DEFAULT_DEVDISKIMGPATH).toString(); + return m_settings + ->value("downloadPath", SettingsManager::docsPath() + "/devdiskimages") + .toString(); +} + +QString SettingsManager::docsPath() +{ + return QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) + + "/.idescriptor"; } void SettingsManager::setDownloadPath(const QString &path) diff --git a/src/settingsmanager.h b/src/settingsmanager.h index 3d0202d..5ddef7a 100644 --- a/src/settingsmanager.h +++ b/src/settingsmanager.h @@ -26,7 +26,7 @@ public: Theme, ConnectionTimeout }; - + static QString docsPath(); // Existing methods QString devdiskimgpath() const; void clearKeys(const QString &keyPrefix); diff --git a/src/virtuallocationwidget.cpp b/src/virtuallocationwidget.cpp index 5416418..5e13def 100644 --- a/src/virtuallocationwidget.cpp +++ b/src/virtuallocationwidget.cpp @@ -124,14 +124,13 @@ VirtualLocation::VirtualLocation(iDescriptorDevice *device, QWidget *parent) }); DevDiskManager::sharedInstance()->downloadCompatibleImage(m_device); - - unsigned int device_version = idevice_get_device_version(m_device->device); + unsigned int device_version = get_device_version(m_device->device); unsigned int deviceMajorVersion = (device_version >> 16) & 0xFF; if (deviceMajorVersion > 16) { QMessageBox::warning( this, "Unsupported iOS Version", - "Real-time Screen feature requires iOS 16 or earlier.\n" + "Virtual Location feature requires iOS 16 or earlier.\n" "Your device is running iOS " + QString::number(deviceMajorVersion) + ", which is not yet supported.");