###############################################
#
#                        .__        ________    _______________   
#  __ __ ___  __________ |__|______ \_____  \  /  _____/\   _  \  
# |  |  \\  \/  /\_  __ \|  |\____ \  _(__  < /   __  \ /  /_\  \ 
# |  |  / >    <  |  | \/|  ||  |_> >/       \\  |__\  \\  \_/   \
# |____/ /__/\_ \ |__|   |__||   __//______  / \_____  / \_____  /
#             \/            |__|          \/        \/        \/ 
#
# uxrip360 - Linux Based  XBOX360 game dumper 0.3
#			klewan - 2008
#
#   REMEMBER IT IS ALPHA!!!
#   after you got a 'final.iso' use Schtrom3.4/XBC/Mulleter whatever, to verify your files (Wine or Virtual BOX)
#			best at this time is to use XDVDMulleter in virtualbox-osd and do a full CRC check against the online DB
#
#   we WARNED you :)
#
################################################
# if you have modified something -> meet us @uxrip360 EFNET
################################################
#
#
#
# Verified to Work on following Drives
# 				Samsung SH162C
#                               Samsung-H943A (seems to work look @youtube :)
#                               Benq-VAD6038
#                               Samsung D163B  
#                               Samsung D162D  
#
# Drives wich are supported but not yet verified:
#				Benq-VAD6038 (not verified, if you have one please contact me)
#

Changes from 0.2 to 0.3:
------------------------
	+ xtract-stealth also extracts now default.xex (required for a full stealth check)
        + check-stealthfiles checks a set of SS/DMI/PFI and default.xex against all implemented stealth checks
                + needed to verify those marked-as-bad-stealth-by-schtrom bourne files (thx @stacker69)
	+ extraction of default.xex added
	+ full stealth check even before game partition dump starts :)
	+ XEX-ID code clean up, reorganisation
	+ Game name is now goin to get looked up :)
		+ the XEX Media ID is used to match against a CSV file (see below in additional notes)
		+ gives you the game name on verifing a iso
		+ gives the name on rip-a-rip's
		+ gives the name right a few seconds after a rip has started
	+ colors can be turned of with "-C" flag
	+ more colorful output
	+ autodiscover now trys to find the kreon drive with a disc inside, if you have more than one :)
	+ verified the VAD6038 drive with benq0800 FW
	+ a few compile warnings on Kubuntu fixed
	+ non-cmdline progressbar improved (watch out for a GUI on its way)
	+ a .dvd file is created after rip for those who use cloneCD or whoever needs it :)
	

Changes from 0.1 to 0.2:
------------------------
	+ tested on an exploitable kernel xbox using a H934A drive (thx zouzzz)
		+ http://fr.youtube.com/watch?v=zzTxfes5fDo
		+ also verify that H934A drive work's :)
	+ read errors from disc will get retried, and after 10 fail's you have the choice
	+ detects now max blocks per IO automaticly (again a fix for another USB enclosure)
	+ now most USB encluseres should work, as my cheap and my expensive one work now ;)
	+ splitVid Conversion (-a convert-splitvid)	
	+ extract/inject stealth files from/to an iso
		+ DMI
		+ PFI
		+ SS
	+ ETA and MB/s are displayed on all progressbar's
	+ -a test display's a few parts of Kreon's Feature  List (if kreon drive)
	+ major code housekeeping, split up clean up etc......
	+ auto discover drive if "-D" is not specified (requires libHAL, on ubuntu atleast its standard)
		+ initial by klewan
		+ more asskicking version by f0rk
	+ verify function:
		+ gives you CRC of following components:
				* SS-CRC
				* SS-RAW-CRC
				* PFI-CRC
				* Video/L0/L1 - CRC
				* DMI-CRC
				* GAME-CRC
				* XEX-Hash
				* Region-Flags
				* XEXMediaID
				* checks if image is splitvid
					* if splitvid verif's CRC of L1 part is same as expected part of L0
					* if not present displays fat warning that only IX14 should be used
				* Checks if DMI matches SS
				* Checks if MediaID matches DMI
				* Checks PFI start LBA is correct
				* Checks if XBOX (string) is in DMI
	+ progressbar from hell (tm)
	+ f0rk all-around cleanup 1001 patches ;)
	+ PFI decode by f0rk based on redline + wolfieNUKE code on Xboxhacker	
	+ f0rk tried hard to explain me the difference between "long" and "long long"
			- atleast mine is the largest ;)
	+ alot a code cleanup and small patches by "f0rk"


INSTALLATION:
-------------------
unpack the tar.bz2 you got:
			tar xjvf uxrip360.tar.bz2
			make
			sudo make install

after that put in a XBOX360-dvd:
	to test drive:
		sudo uxrip360 -a test 

	and run following:
		#--------- non split vid image:
		sudo uxrip360 -a rip -o /path/where/files/should/be/stored
		#--------- rip with splitvid:
		sudo uxrip360 -a rip -o /path/where/files/should/be/stored -s
		
	if you want to convert an existing image to SplitVid format:
		sudo uxrip360 -a convert-splitvid -o /path/where/files/should/be/stored/final.iso

	if your drive is not getting detected automaticly (should work in most cases)
	use the "-D" flag to specify your dvd-rom e.g.: -D /dev/dvd

NOTES:
--------------------
	* GameNameLookup
		NOTE: this gamename lookup doesnt verify if you SS/DMI/PFI or whatever are valid, it just checks against a list of known "XEX-Signatures"
		there is a database arround the net :) i am not allowed to include in the release
		even i am not allowed to tell you where to get it :=)
		but if you have found "THAT" url do the following
				mkdir /etc/uxrip360/
				wget -O /etc/uxrip360/GameNameLookup.csv http://THAT-URL

		for auto-update run it via a cron job or do a wget before a rip :)
				@those guys workin on the DB, thanks nicework!!  (i know who you are, i asked, and i didn't brake the rules)
				@sucks a little bit to have public accessable DB bound to one single app!!!
				
		@Cosworth1: better for you to use the older script too :)

	* ESPECIALLY INJECTION SHOULD BE HANDLED WITH CARE!!!! (there is no backup made at all)
	  DO YOURSELF A FAVOUR AND BACKUP BEFORE INJECTING ANYTHING

	* To Burn a ISO:
		growisofs -use-the-force-luke=dao -use-the-force-luke=break:1913760 -dvd-compat -speed=2 -Z /dev/dvdrw=image.iso


	* Sometimes on my SH162-C it looks like if i start "-a rip"
	  and cancle during the game.iso extraction and after that i do again a "-a rip" the video isn't read out ok, either the OS doesn't report any 
	  error it seems that this has something to do with kreon FW or any hardware issue with my hardware
	  in this case a rerun of "-a rip" work's for me, seems to reset the drive or so.

	* TO verify a ISO:
		uxrip360 -o /path/to/iso.iso -a verify

	* TO RIP A RIP: Insert original :-)
	  or do a:
		uxrip360 -D /dev/srX -o /where/to/store -a rip-a-rip