Conversation
| /// </summary> | ||
| /// <param name="data">Stream representing the XboxISO DiscImage</param> | ||
| /// <returns>An XboxISO DiscImage DiscImage on success, null on failure</returns> | ||
| public static XboxISO? Create(Stream? data) |
There was a problem hiding this comment.
I'll admit that this wasn't quite what I was expecting, but it certainly works for now
There was a problem hiding this comment.
If you think there's a nicer way feel free to tell me, I think its elegant enough (at least the idea, not necessarily my implementation)
There was a problem hiding this comment.
I was expecting most of this logic to live in a reader, not the wrapper directly. This is a unique situation all around so that will take some thinking if that's appropriate or not.
There was a problem hiding this comment.
Because it is possible for standard ISOs to "look like" Xbox ISOs purely based on the sector count, my implementation is intended to prevent wasted compute. Serialization would waste a lot of effort reading the ISO9660 to then later realize that it is not in fact an Xbox ISO, then WrapperFactory would go ahead and parse the entire ISO again. This logic could be moved into a reader, but I figure that there's no unique reading going on, it doesn't make sense to add a dummy reader (a new model definitel make sense, at least). All the wrapper is doing is some logic to read some magic bytes, before calling the two sub-readers.
| var videoWrapper = new SabreTools.Wrappers.ISO9660(VideoPartition, _dataSource, initialOffset, _dataSource.Length); | ||
| bool success = videoWrapper?.Extract(outputDirectory, includeDebug) ?? false; | ||
|
|
||
| var gameWrapper = new SabreTools.Wrappers.XDVDFS(GamePartition, _dataSource, initialOffset + Constants.XisoOffsets[XGDType], Constants.XisoLengths[XGDType]); |
There was a problem hiding this comment.
Nitpick: Is it ever possible for the type and array to mismatch?
There was a problem hiding this comment.
Only if the code is bad. I have the possible types defined in the wrapper constructor, and the length of the array defined in the model's constants
New model for Xbox / Xbox360 disc images. Supports printing and extraction of Xbox / Xbox 360 redump-style ISO files (both video and game partition), through dual ISO9660 and XDVDFS wrappers.
DiscImage is "higher level" than tracks/volumes as it is intended to represent the entire disc (which consists of two separate volumes/tracks). For simplicity, I have not explicitly added padding bytes between the two partitions, and have added a single "XGDType" field in the DiscImage model to indicate which disc type it is (for ease of determining the XDVDFS game partition offset and length in the stream). The constants value will need updating in the future if new disc types are found (pre-production discs with unusual offsets/lengths).