Provenance-Emu / Provenance

iOS & tvOS multi-emulator frontend, supporting various Atari, Bandai, NEC, Nintendo, Sega, SNK and Sony console systems… Get Started: https://wiki.provenance-emu.com |
https://provenance-emu.com
Other
5.97k stars 689 forks source link

After Resolving an "Import Conflict", subsequent imports no longer work #1414

Closed mrjschulte closed 3 years ago

mrjschulte commented 4 years ago

Steps using the current develop branch. Build from scratch and build and dist to the iOS device Import some game roms for a few different systems, all works fine. Now import a .zip containing an .iso for a CD-Rom game (because this will throw up the conflict we need to trigger the issue). Provenance will throw up the conflict dialog because there are several systems that support the .zip -> .iso/.cue format. Select the appropriate system and the game imports as expected and shows up. Within the same running Provenance session attempt to import another game, this will result in nothing happening but the quick notification of "extraction complete". No games show up. You need to exit and relaunch Provenance for the newly imported titles to show up.

mrjschulte commented 4 years ago

Also noticing that after resolving 2, and sometimes 3, conflicts Provenance will "lock-up" or insta-crash.

Reproduction steps: Using the GoodPCE v1.0.9 set to test this Conflict workflow has proven a great way to show where the issue causes the problems. Due to the nature of the various items in that set, it will conflict with the importer because the importer will have to choose between putting the items in the SuperGrafx or TurboGrafx-16 module. When doing a mass-import, with about 100 items or so, over the web-server the conflict list will grow. Attempting to resolve them 1 by 1 will at some point lead to a Provenance crash. I'll run Provenance in debug mode and see if anything obvious shows up.

mrjschulte commented 4 years ago

Here's the error that causes Provenance to crash from running in debug.

2020-08-30 10:54:24.164962-0700 Provenance[9583:3244491] 🕐13.7s 🔀 VERBOSE GameImporter:313.resolveConflicts(withSolutions:) ↩ ☞ Moved /private/var/mobile/Containers/Data/Application/A8CF78A2-5A56-4B0E-8449-2C165353C3DD/Documents/Conflicts/mygame(J).pce to /var/mobile/Containers/Data/Application/A8CF78A2-5A56-4B0E-8449-2C165353C3DD/Documents/com.provenance.pce/mygame(J).pce Fatal error: invalid Collection: count differed in successive traversals: file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-1103.2.25.8/swift/stdlib/public/core/ArrayShared.swift, line 131 2020-08-30 10:54:24.220437-0700 Provenance[9583:3244235] Fatal error: invalid Collection: count differed in successive traversals: file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-1103.2.25.8/swift/stdlib/public/core/ArrayShared.swift, line 131

The Xcode ui shows the following line as being the culprit in PVSystem.swift: // Reverse Links public private(set) var bioses = LinkingObjects(fromType: PVBIOS.self, property: "system") public private(set) var games = LinkingObjects(fromType: PVGame.self, property: "system") public private(set) var cores = LinkingObjects(fromType: PVCore.self, property: "supportedSystems")

public var gameStructs: [Game] {
    **return games.map { Game(withGame: $0) }**                 **Thread 1: Fatal error: invalid Collection: count differed in successive traversals**
}

public var coreStructs: [Core] {
    return cores.map { Core(with: $0) }
}
JoeMatt commented 3 years ago

Is this resolved?

ghost commented 3 years ago

Is this resolved?

Appears to be. I tested in the current 2.0.0 release and was able to import multiple CUE/BIN files in a single session with all appearing.

mrjschulte commented 3 years ago

I will check the repro steps.

mrjschulte commented 3 years ago

This is still a problem. Once the "conflict" has been registered (even though the workflow for that and resolving them is currently broken) I can not import another title. This is on the current develop.

cheif commented 3 years ago

I remember looking into this at some point (maybe a year ago) and IIRC the main problem is that the conflict-handling never goes back from the "has-conflicts" state. IIRC there wasn't even any code for that, so that's probably an oversight when implementing this at some point. At that point you could just restart the app and it worked again.