@@ -7,6 +7,7 @@ namespace XboxKit
77 internal class Program
88 {
99 static readonly int SECTOR_SIZE = 2048 ;
10+ static readonly byte [ ] FILLER = Encoding . ASCII . GetBytes ( "ABCDABCDABCDABCD" ) ;
1011 // XISO Types: XGD1, XGD2, XGD2-Hybrid, XGD3
1112 static readonly long [ ] XISO_OFFSET = [ 0x18300000 , 0xFD90000 , 0x89D80000 , 0x2080000 ] ;
1213 static readonly long [ ] XISO_LENGTH = [ 0x1A2DB0000 , 0x1B3880000 , 0xBF8A0000 , 0x204510000 ] ;
@@ -19,17 +20,17 @@ internal class Program
1920 // Wave Types: XGD2w0, XGD2w1, XGD2w2, XGD2w3, XGD2w4, XGD2w5, XGD2w6, XGD2w7, XGD2w8, XGD2w9, XGD2w10, XGD2w11, XGD2w12, XGD2w13, XGD2w14, XGD2w15, XGD2w16, XGD2w17, XGD2w18, XGD2w19, XGD2w20, XGD2-Hybrid, XGD1
2021 static readonly string [ ] WAVE_PVD = [ "2004083110334900" , "2005100712184600" , "2006030621090700" , "2009011416000000" , "2009082417000000" , "2009100517000000" , "2009102917000000" , "2010022116000000" , "2010090417000000" , "2010091517000000" , "2010102817000000" , "2011011816000000" , "2011061217000000" , "2011071217000000" , "2011120716000000" , "2012022116000000" , "2012062117000000" , "2012110716000000" , "2012111816000000" , "2013082617000000" , "2015042617000000" , "2006041012132800" , "2001091310425500" ] ;
2122
22- static readonly byte [ ] FILLER = Encoding . ASCII . GetBytes ( "ABCDABCDABCDABCD" ) ;
23-
2423 static void PrintHelp ( )
2524 {
2625 Console . WriteLine ( "XboxKit (c) Deterous 2024-2025" ) ;
27- Console . WriteLine ( "Redump Xbox/Xbox360 ISO <-> XISO + Video Partition (+ System Update)" ) ;
28- Console . WriteLine ( "Usage: xboxkit.exe [-s] [-u] <input.iso> [video.iso] [system_update_file]" ) ;
26+ Console . WriteLine ( "Redump Xbox/Xbox360 ISO <--- > XISO + Video Partition (+ System Update)" ) ;
27+ Console . WriteLine ( "Usage: xboxkit.exe [-s] [-u] [-v] <input.iso> [video.iso] [system_update_file]" ) ;
2928 Console . WriteLine ( "" ) ;
29+ Console . WriteLine ( "Extraction Options:" ) ;
3030 Console . WriteLine ( "-s, --skip\t Skips creating video partition (only extract XISO)" ) ;
3131 Console . WriteLine ( "-u, --unpack\t Unpacks XGD3 video partition (separate system update file)" ) ;
32- Console . WriteLine ( "Note: -s and -u cannot be used together" ) ;
32+ Console . WriteLine ( "-v, --video-only\t Skips creating game partition (only extract video ISO)" ) ;
33+ Console . WriteLine ( "Note: -s cannot be used with -u or -v" ) ;
3334 }
3435
3536 static void Main ( string [ ] args )
@@ -40,12 +41,13 @@ static void Main(string[] args)
4041
4142 bool skipVideo = false ;
4243 bool unpackVideo = false ;
44+ bool onlyVideo = false ;
4345 string isoPath = string . Empty ;
4446 string videoPath = string . Empty ;
4547 string updatePath = string . Empty ;
4648
4749 // Check arguments
48- if ( ( args . Length == 0 ) || ( args . Length > 4 ) )
50+ if ( ( args . Length == 0 ) || ( args . Length > 5 ) )
4951 {
5052 PrintHelp ( ) ;
5153 return ;
@@ -66,6 +68,11 @@ static void Main(string[] args)
6668 Console . WriteLine ( "Cannot use both --unpack and --skip" ) ;
6769 return ;
6870 }
71+ else if ( onlyVideo )
72+ {
73+ Console . WriteLine ( "Cannot use both --video-only and --skip" ) ;
74+ return ;
75+ }
6976 skipVideo = true ;
7077 }
7178 else if ( arg . Equals ( "-u" , StringComparison . OrdinalIgnoreCase ) || arg . Equals ( "--unpack" , StringComparison . OrdinalIgnoreCase ) )
@@ -77,6 +84,15 @@ static void Main(string[] args)
7784 }
7885 unpackVideo = true ;
7986 }
87+ else if ( arg . Equals ( "-v" , StringComparison . OrdinalIgnoreCase ) || arg . Equals ( "--video-only" , StringComparison . OrdinalIgnoreCase ) )
88+ {
89+ if ( skipVideo )
90+ {
91+ Console . WriteLine ( "Cannot use both --skip and --video-only" ) ;
92+ return ;
93+ }
94+ onlyVideo = true ;
95+ }
8096 else
8197 {
8298 if ( string . IsNullOrEmpty ( isoPath ) )
@@ -299,25 +315,30 @@ static void Main(string[] args)
299315 return ;
300316 }
301317
302- // Write XISO to file
303- using FileStream xisoFS = new ( xisoPath , FileMode . Create , FileAccess . Write , FileShare . None ) ;
304- Console . WriteLine ( $ "[INFO] Writing game partition to { xisoPath } ") ;
305- isoFS . Seek ( XISO_OFFSET [ outputXISOType ] , SeekOrigin . Begin ) ;
306- long xisoLength = XISO_LENGTH [ outputXISOType ] ;
307- numBytes = 0 ;
308- while ( numBytes < xisoLength )
318+ // Don't create XISO if only extracting video partition
319+ if ( ! onlyVideo )
309320 {
310- int bytesRead = isoFS . Read ( buf , 0 , ( int ) Math . Min ( buf . Length , xisoLength - numBytes ) ) ;
311- if ( bytesRead == 0 )
312- break ;
313321
314- xisoFS . Write ( buf , 0 , bytesRead ) ;
315- numBytes += bytesRead ;
316- }
317- if ( numBytes != xisoLength )
318- {
319- Console . WriteLine ( "[ERROR] Failed writing game partition (XISO)." ) ;
320- return ;
322+ // Write XISO to file
323+ using FileStream xisoFS = new ( xisoPath , FileMode . Create , FileAccess . Write , FileShare . None ) ;
324+ Console . WriteLine ( $ "[INFO] Writing game partition to { xisoPath } ") ;
325+ isoFS . Seek ( XISO_OFFSET [ outputXISOType ] , SeekOrigin . Begin ) ;
326+ long xisoLength = XISO_LENGTH [ outputXISOType ] ;
327+ numBytes = 0 ;
328+ while ( numBytes < xisoLength )
329+ {
330+ int bytesRead = isoFS . Read ( buf , 0 , ( int ) Math . Min ( buf . Length , xisoLength - numBytes ) ) ;
331+ if ( bytesRead == 0 )
332+ break ;
333+
334+ xisoFS . Write ( buf , 0 , bytesRead ) ;
335+ numBytes += bytesRead ;
336+ }
337+ if ( numBytes != xisoLength )
338+ {
339+ Console . WriteLine ( "[ERROR] Failed writing game partition (XISO)." ) ;
340+ return ;
341+ }
321342 }
322343
323344 // If XGD3, try extract system update file from video partition
0 commit comments