StikDebug/StikJIT/Utilities/mountDDI.swift
2026-03-27 18:44:13 -04:00

47 lines
1.3 KiB
Swift

//
// mountDDI.swift
// StikJIT
//
// Created by Stossy11 on 29/03/2025.
//
import Foundation
typealias RpPairingFileHandle = OpaquePointer
typealias AdapterHandle = OpaquePointer
typealias RsdHandshakeHandle = OpaquePointer
typealias ImageMounterHandle = OpaquePointer
typealias LockdowndClientHandle = OpaquePointer
func progressCallback(progress: size_t, total: size_t, context: UnsafeMutableRawPointer?) {
MountingProgress.shared.progressCallback(progress: progress, total: total, context: context)
}
enum MountCheckResult {
case mounted
case notMounted
case unreachable
}
func isMounted() -> Bool {
return checkMountStatus() == .mounted
}
func checkMountStatus() -> MountCheckResult {
do {
let result = try JITEnableContext.shared.getMountedDeviceCount()
return result > 0 ? .mounted : .notMounted
} catch {
return .unreachable
}
}
func mountPersonalDDI(imagePath: String, trustcachePath: String, manifestPath: String) -> String? {
do {
try JITEnableContext.shared.mountPersonalDDI(withImagePath: imagePath, trustcachePath: trustcachePath, manifestPath: manifestPath)
} catch {
LogManager.shared.addErrorLog("Failed to mount DDI: \(error.localizedDescription)")
return error.localizedDescription
}
return nil
}