From clauflibitFriiDump-0.5.3.1

This commit is contained in:
Braden McDaniel 2013-11-01 12:26:04 -04:00
parent fe937e7f4b
commit 87b108d6a1
63 changed files with 11067 additions and 26 deletions

41
docs/AUTHORS Normal file
View file

@ -0,0 +1,41 @@
FriiDump came to existance thanks to the work by a lot of people, most of which
are probably not aware of this fact ;). So here is proper credit:
The DVD seed bruteforcing algorithm and code were taken from unscrambler 0.4
by Victor Muñoz (xt5@ingenieria-inversa.cl,
http://www.ingenieria-inversa.cl/?lp_lang_pref=en).
The theoritical basis of the dumping methods were suggested in several comments
to Victor's post. The most important comments came from Victor himself (xt5),
FuzzyLogic and svpe.
The code to actually perform the dumping was derived from the work of Kevin
East, AKA SeventhSon (kev@kev.nu, http://www.kev.nu/360/), which, in turn,
derives from work by a lot of other people. See his page for full details.
Many hints were taken from RawDump, whose author is unknown.
A program that helped me a lot to understand the drive cache behaviour is
PLScsi by Pat LaVarre (http://members.aol.com/plscsi/).
Nintendo disc structure information was taken from:
- http://www.gc-linux.org/docs/yagcd.html
- http://www.wiili.org/index.php/GameCube_Optical_Disc
Code to tell whether a Wii disc contains an update or was inspired by a program
by wiidevel@stacktic.org. Sorry but I cannot find the URL anymore :(.
Other minor pieces of code were taken from tcpdump (www.tcpdump.org), Python
(www.python.org) and the glibc printf manpage.
GDR8163B and Windows testing was performed by tasso85.
Thanks also go out to the ConsoleTribe staff for giving me the possibility to
use their forum for the program support.
Glue, endless hours spent understanding drive cache behaviour and rest of the
code are by me, Arep <arep@no.net>.
Finally, obvious thanks go out to Nintendo for making all of their great
consoles, who constantly help me to waste the rest of my spare time I do not
spend coding ;).

340
docs/COPYING Normal file
View file

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

45
docs/ChangeLog Normal file
View file

@ -0,0 +1,45 @@
0.5.3 (15/03/2010)
- Fixed failing after 1st DL media layer with non-Hitachi methods.
- Fixed still hashing with 'nohash' parameter when resuming.
- Fixed resuming larger files (~4 GB).
- Fixed unscrambling larger files.
- Faster file unscrambling.
- Slight modifications to methods;
possible performance increase with Hitachi based devices.
- Restructured methods and added some new ones.
- Added layer break information.
- Added current position output when error occurs.
- Added SH-D162A, SH-D162B, SH-D162C & SH-D162D as supported.
> Jackal, gorelord4e, themabus
0.5.2 (10/01/2010)
- Corrected handling of standard DVDs
(type should be forced to 3, when dumping or unscrambling).
- Better response to 'speed' parameter.
- Uniform raw output for all devices: unscrambled data + headers.
- Slight performance increase (~1650 MB/h on LH-18A1H).
- Added LH-18A1P, LH-20A1H, LH-20A1P to list of supported devices.
> Jackal, themabus
0.5.1 (01/12/2009)
- New command 'vanilla 2384'.
- Restructured methods, some now support optional parameters.
- Ability to select standard DVDs as source.
- Limited recognized Lite-On drives to LH-18A1H.
> Jackal, themabus
0.5.0 (27/11/2009)
- Regions: Italy, France, Germany, Spain, Australia, PAL-X, PAL-Y.
- Updated publisher list from http://wiitdb.com/Company/HomePage
- Included GDR8082N & GDR8161B as supported Hitachi drives.
- Lite-On, Renesas & vanilla memory buffer access commands.
Lite-On tested on LH-18A1H, should work on many more
(LH*, SH, DH*, DW* & possibly other MediaTek drives)
- Shifted methods 1..4 to 0..3 and added new ones 4..6
Associated known drives with default methods.
- Additional commandline parameters:
stop, speed, command, type, size
- Some minor changes and fixes.
> Jackal, Truman, themabus
0.4 (08/03/2008)
- Support for DL Wii DVDs.
> mado3689
0.3 (06/10/2007)
- First public release.

1
docs/INSTALL Normal file
View file

@ -0,0 +1 @@
See README.

53
docs/NEWS Normal file
View file

@ -0,0 +1,53 @@
Since last official version original method 1 have been renamed to method 0
and it undergone certain changes. Methods 2, 3, 4 have been renamed to 7, 8
and 9 respectively. Method 0 should work with all drives as long as they
are supported by one of memory dump commands, so if drive is unrecognized it
is preferable to keep method at 0, and try all commands. If one of such
combinations turns out to work, you can proceed then testing other methods
with this commad. In case none of commands work, you could try to determine
drive's Read Buffer command's parameters with supplied 'BruteForce3C.exe'.
Generally program's overall bahaviour regarding commandline haven't changed
and you should be able to use same options as with official versions, though
in case you were using unrecognized drive, which would nevertheless work with
Hitachi command, you'll need to set command to 2 now (e.g. --command 2) and
method to 7, 8 or 9.
Performance have increased since official release and should be now about the
same as with 'RawDump'.
Regarding supported drives:
1. Hitachi-LG GDR8161B, GDR8162B, GDR8163B, GDR8164B, GDR8082N
Those drives can read GC/Wii media without swapping. Expected performance is
1600..1900 MB/h for *4B, *3B and 2100..2600 MB/h for *2B, *1B. Custom memory
dump command is used, which returns 2064 bytes of data. It was reproted that
they can not read other (e.g. PC) discs this way though, this needs
confirmation.
2. Lite-On LH-18A1H, DVDRW LH-18A1P, DVDRW LH-20A1H, DVDRW LH-20A1P
Reading performance for PC DVDs can go up to 5000 MB/h, which means program's
core as well as new methods are capable to output data at least at this rate.
Reading performance for GC was about 1600..1700 MB/h so likely this slowdown is
caused by drive logic itself. Though I only had one GC game to test with, so
possibly better results can be achieved depending on media. Best results were
obtained, when using method 5 with parameter 16,27 (--method5=16,27). This
combination isn't set as default because it can cause noticable delays
depending on medium quality and to make methods more general for use with other
devices. Lite-On won't read GC/Wii DVDs at all without swapping. Lite-On
returns 2384 bytes of data (2064 + ECC) by means of vendor specific READ BUFFER
command. Tested with models LH-18A1H, LH-18A1P and LH-20A1H.
3. Plextor
Plextor would return 2064 bytes of already unscrambled data with READ BUFFER
command. It works good with ordinary DVDs but due the lack of streamed reading
support is practically useless for GC/Wii dumping because of very low
performance. Works nevertheless and could be used for some experiments and
testing. Results from PX-760A.
4. Toshiba Samsung SH-D162A, SH-D162B, SH-D162C, SH-D162D
Returns 2384 data bytes per sector like Lite-On does. Appears to support
streamed reading but performance with tested model (SH-D162D) was somewhat low
and unstable even with ordinary DVDs. Looks promising, if only good-working
method could be determined. Latest drives added, definitely need more testing
at this point.

187
docs/README Normal file
View file

@ -0,0 +1,187 @@
FriiDump - A program to dump Nintendo Wii and GameCube disc
===============================================================================
FriiDump is a program that lets you dump Nintendo Wii and GameCube disc from
your computer, without using original Nintendo hardware. It basically performs
the same functions as the famous "RawDump" program, but with a big difference,
which should be clear straight from its name: FriiDump is free software, where
"free" is to be intended both as in "free speech" and in "free beer". As such,
FriiDump is distributed with its sources.
This leads to a number of good consequences:
- Having the sources available, it can be easily ported to different operating
systems and hardware platforms. At the moment it is developed under a
GNU/Linux system, but it also runs natively on Windows. A MacOS X version can
be easily created, although I don't have a Mac, so I can't do it myself.
- Also, having the sources and these being well-organized (I know I'm a modest
guy) allows support for new DVD-ROM drives to be added relatively easily. At
the moment the same drives as RawDump are supported, but this might improve
in the future, if anyone takes the effort... See README.technical for
details.
- The sources might also be used as a reference for several things regarding
Nintendo Wii/GameCube discs and the hacks used to read them on an ordinary
drive.
Furthermore, FriiDump also features some functional improvements over RawDump:
- FriiDump can use 4 different methods to read the disc, with different
performance.
- FriiDump dumps a lot of useful information about the discs it dumps,
such as whether the disc contains an update or not, which can help avoid
bricking your Wii ;).
- FriiDump calculates the CRC32, MD4, MD5, SHA-1 and ED2K hashes of dumped
discs, so you can immediately know if your dump is good or not, by comparing
the hashes with the well-known ones available on several Internet sites.
- FriiDump comes in the form of a library and a command-line front-end, which
allows its functions to be easily reused in other programs.
Unfortunately, there is also a main downfall:
- Even the fastest dump method used by FriiDump is not as fast as RawDump (but
not that much slower, either, see the table below).
Anyway, I'm sure that people who cannot use RawDump (i.e.: GNU/Linux, *BSD and
MacOS X users) will be happy anyway. Besides, you get the sources, so you can
improve them yourself.
Note that FriiDump is only useful to dump *original* Nintendo discs. To dump
backup copies you can use any DVD-dumping program (i.e.: dd under UNIX ;)).
FriiDump came to existance thanks to the work by a lot of people, most of which
are probably not aware of this fact ;). Please see the AUTHORS file for the
credits.
===============================================================================
Supported drives
===============================================================================
At the moment the same drives as RawDump are supported. This is due to various
reasons, explained in the README.technical file, which also contains
information about what is needed to add support for more drives.
Currently supported drives are:
- LG GDR-8161B (untested, but should work)
- LG GDR-8162B (ditto)
- LG GDR-8163B (HL-DT-ST/DVD-ROM GDR8163B)
- LG GDR-8164B (HL-DT-ST/DVD-ROM GDR8164B)
Other drives might work, most likely those based on the Hitachi MN103
microcontroller. If you find any of them, please report so that they can be
added to the compatibility list.
===============================================================================
Installation
===============================================================================
If you are a Windows user, probably you will have downloaded the binaries,
either zipped or together with an installer, so the installation should be
straightforward.
If you downloaded the sources, you will need to compile them. FriiDump uses
CMake, for easy portability, so you will need to get it from cmake.org. On
Windows you will also need a compiler like Visual Studio (the only tested one,
so far) or CygWin/MinGW. On UNIX just do the following, from the directory
where you unpacked the sources into:
$ mkdir BUILD
$ cd BUILD
$ cmake ..
$ make
$ make install
Linux-specific note: You need root privileges to issue certain commands to the
DVD-ROM drive. Hence you have the following possibilities:
- Run FriiDump as root: discouraged.
- Run it through sudo: better but nevertheless discouraged.
- Set the setuid bit on the executable: this is the recommended way to run
FriiDump under Linux. This way, the code run with superuser privileges will
be reduced to a minimum, guaranteeing a certain level of security (note that
security-related bugs might exist anyway!!!). Also note that, even when the
setuid bit is set, the attempt to open the drive for reading will be done
after privileges have been dropped, so you will need explicit read access to
the DVD-ROM drive. Usually having the system administrator add you to the
"cdrom" group is enough. To set the setuid bit on the executable, run as
root:
$ chown root:root /usr/local/bin/friidump
$ chmod u+s /usr/local/bin/friidump
===============================================================================
Usage
===============================================================================
FriiDump is a command-line program, so you will need to run it from a terminal
or a command-prompt under Windows. The basic usage is as follows:
friidump -d <drive> -a
where <drive> will usually be something like "/dev/hda" on Unix-like systems,
and something like "e:" for Windows users. With this command, the disc will be
dumped to an ISO image file with an automatically-chosen name. Drop -a and use
the -i option if you prefer to specify the filename yourself. If you want to
resume an existing dump, use -s. If you want to dump the disc to a raw format
image file, use -r. Note that you can create a raw and an ISO image at the same
time.
Other options you might want to use are -1 through -4, to set the dump method,
although the default is method 4, which is the fastest one, so most likely you
will not need them.
Finally, use -h for a listing of all available options.
===============================================================================
Performance
===============================================================================
As stated above, FriiDump is not as fast as RawDump. On my PC (Athlon64 3200+),
performance is as follows:
-------------------------------------------------------------------------------
| Method | Dump speed | GameCube disc dump time | Wii disc dump time |
-------------------------------------------------------------------------------
| 1 | Too slow ;) | Eternity | More than eternity |
| 2 | ~570 MB/h | 2.5 hours | 8 hours |
| 3 | ~740 MB/h | 2 hours | 6 hours |
| 4 | ~1250 MB/h | 1.2 hours | 3.5 hours |
-------------------------------------------------------------------------------
===============================================================================
Support
===============================================================================
I'm releasing this program under the nickname of "Arep". This is because I am
not sure about the legal status of the program, and I do not want to encounter
any consequences. Actually, I'm pretty sure FriiDump goes against the DMCA,
being a program that circumvents copy-protection, but it might be objected that
the format used by Nintendo discs is not a copy-protection method, but just
their own, undocumented, disc format. Although, I think it can be freely used
in Europe and other coutries without laws similar to the DMCA.
For the same reason, I am not putting an e-mail address here (that @no.net you
find in the program is obviously a pun), but support will be provided through
the forums of the Italian ConsoleTribe forum, at http://wii.console-tribe.com.
If you need help, just open a thread in any section there, even in English: I
will *not* reply, but you might stand assured I will read everything you write.
FriiDump users are encouraged to help each other there ;).
Patches are welcome, too: just attach them to your post, and maybe put
something like "[PATCH]" in the topic subject, so that I can easily spot them.
New releases will be announced on that forum, and also on QJ.net, if I find a
good way to notify them.
If you want to donate to the project, do not do it, and donate to one of the
free Wii modchip projects out there, such as OpenWii, WiiFree or YAOSM.
===============================================================================
Disclaimer
===============================================================================
FriiDump is distributed under the GNU General Public License version 2. See the
COPYING file for details.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Also, please note that this program is not meant to be used to spread game
piracy, but rather to be instrument to make backups of your own precious
legally-bought games.

234
docs/README.technical Normal file
View file

@ -0,0 +1,234 @@
FriiDump Techincal info
===============================================================================
This document is a reworking and unification of information found all over the
net, regarding the structure of Nintendo Gamecube/Wii Optical Discs and how to
read them on an ordinary DVD-ROM drive. All the due credits can be found in the
AUTHORS file.
===============================================================================
Nintendo Gamecube/Wii Optical Disc (GOD/WOD) structure
===============================================================================
In order to understand how a Gamecube or WII Optical Disk is made, let us
first take a look at a standard DVD-ROM. The complete standard is explained in
the ECMA-267 Standard.
The user data stored on the DVD is divided in blocks, each 2048 bytes long.
Each 2048-byte block is then encapsulated in a 2064-byte structure, adding some
other data needed for error-correction and head positioning. A 2064-byte block
is called a "Data frame", and its logical layout is as follows:
4bytes 2bytes 6bytes 2048bytes 4bytes
- - - - - - - - - - - - - - - - - - - - - - - - - -
| ID | IED | CPR_MAI | User Data Frame | EDC |
- - - - - - - - - - - - - - - - - - - - - - - - - -
- Identification Data (ID): Contains the PSN (Physical Sector Number), info
about the sector itself, like the layer, reflectivity, zone, etc.
- ID Error Detection Code (IED)
- Copyright Management Information (CPR_MAI): Its use is application-specific,
for instance it can be used to store a sector key in videos that use CSS, or
a scrambling key in the XBox and XBox360 Security Sectors.
- User Data: This is the data available for the end user.
- Error Detection Code (EDC): It is the checksum data for all the fields above,
its polinomial is x^32 + x^31 + x^4 + 1.
For various reasons (not related to copy protection), the User Data Frame is
XOR'ed with a stream cipher generated by an 15bits LFSR (Linear Feedback Shift
Register), with bits 10 and 14 used as taps. The seeds are obtained from a
table of the ECMA-267 standard, the index of the seed is the 4 MSB of the last
byte of the "ID" field of the Data Frame. The same stream cipher is then used
by 16 consecutive Data Frames: for this and other reasons (again related to
error correction), data from the DVD are always read in 16-data frame blocks.
4bytes 2bytes 6bytes 2048bytes 4bytes
- - - - - - - - - - - - - - - - - - - - - - - - - -
| ID | IED | CPR_MAI | User Data Frame | EDC |
- - - - - - - - - - - - - - - - - - - - - - - - - -
^ | 2048bytes cipher stream |
^ - - - - - - - - - -
Scrambling
seed index
Now, the first problem when dealing with Gamecube/Wii Optical Discs is that
they use a different (and yet unknown) set of seeds. This means that when an
ordinary DVD-ROM drive tries to read a GOD/WOD disc, it will unscramble the
User Data Frame with the wrong seed, causing the EDC check to fail and a read
error to be reported to the operating system, which means the inability to read
the disc.
Furthermore, Gamecube/Wii Optical Disks use a slightly different structure for
the Data Frame, as shown in the following figure:
4bytes 2bytes 2048bytes 6bytes 4bytes
- - - - - - - - - - - - - - - - - - - - - - - - - -
| ID | IED | User Data Frame | CPR_MAI | EDC |
- - - - - - - - - - - - - - - - - - - - - - - - - -
| 2048bytes cipher stream |
- - - - - - - - - -
Basically, the User Data Frame and the CPR_MAI fields are swapped, while the
scrambled bytes remain the same.
===============================================================================
Tricks used to read a GOD/WOD on a standard DVD-ROM drive.
===============================================================================
To cope with the above-mentioned problems, some methods have been suggested by
many people on the net. They vary in performance, but the basic idea is always
the same:
1. Issue a read command for the sector of interest (this is actually a
16-sector block, not a single sector, as stated above).
2. Let the read return failure.
3. At this moment, the DVD-ROM drive must have cached the data read from the
disc somewhere in its internal memory, to be able to unscramble them and to
check the EDC. So, we can dump the data from the drive's internal RAM.
Unfortunately, this is not as easy as it seems, due to the fact that there is
no standard "Dump drive memory" command. This is probably implemented in many
drives for firmware debugging purposes, but, as such, it is a vendor-specific
command, which are usually undocumented and vary from vendor to vendor (or even
from drive model to drive model).
This is where the work that many hackers around the world have done, in order
to crack the Microsoft XBox360 console, becomes useful. They needed some way to
read and write data to the XBox360 drive's internal memory, so they
disassembled the drive's firmware and patiently tried to understand what each
of the vendor-specific commands did. This way, they discovered that a certain
command could be used to read an arbitrary portion of the drive's internal RAM.
They also managed to map the RAM addresses, so that it is known where data
read from the disc are temporarily stored.
Fortunately, the XBox360 drive is not too different from some retail DVD-ROM
drives, namely some models from LG, which means that the discovered command
works on them as well. Hence, we now have some sort of access to the disc data.
Although, this comes at the price of speed: dumping the drive's internal memory
is a slow process, as it uses Programmed I/O (PIO) instead of Direct Memory
Access (DMA) to transfer data from the drive to the computer's memory. For this
reason, some have proposed the use of the "streaming read" command: it is a
standard command thought for those applications where the constant flow of data
is more important than its absolute correctness, such as audio or video
applications. Thus, this command does not perform the EDC on the data read from
the disc, but returns it immediately. Anyway, the command will only return the
User Data Frame, which means that only a portion of the data will be read this
way, while the rest (i.e.: the first 12 and the last 4 bytes) will have to be
read using the memory dump method. Nevertheless, this combined method will be
faster overall, as only some dozens of bytes have to be transfered through PIO,
instead of the whole sectors.
We still have to cope with the unknown seeds. This problem can be easily solved
through the use of brute force: as there are only 15 bits to try (and commonly
only 17 seeds per GOD/WOD), this approach only takes about 30 seconds. The
bruteforce process is very simple: the LFSR is seeded from 0 to 7FFFh and for
each seed the corresponding stream cipher is generated and XOR'ed with the
proper section of the Data Frame and the EDC is computed. If the EDC is the same
as the one in the EDC field then we have the correct seed.
===============================================================================
The FriiDump approach
===============================================================================
FriiDump can use four different disc dump methods. They have been developed
gradually, empirically and heuristically, by experimenting with the PLScsi tool
and comparing the retrieved data with a known-good dump. In this section the
inner working of every dump method will be described. The code implementing the
different methods can be found in the "disc_read_sector_X" functions of disc.c.
Please note that the desibed behaviour is that of my LG GDR8164B drive, which I
assume to be shared by similar drives. Other, more different drives, might
behave differently and require totally different methods.
Also note that all of the methods read 16-sector blocks.
Method 1
This method is very slow. So slow that I have never dumped a whole disc with
it. Although, it served me to prove that I was going in the right direction and
that my efforts could eventually come to a working end. It also showed me that
the first versions of RawDump create bad dumps, sometimes.
Basically this method is the same used by those early versions of RawDump,
which took 50+ hours to dump a whole disc. It works like this:
1. Issue a read command for the required sector. This will cause the 16-sector
block to which the sector belongs to be placed at the beginning of the
drive's cache memory. Do not even bother to see what the read command
returns, as it will surely be a data read error.
2. Dump the 16-sector block.
Method 2
Method 2 is similar to method 1, but uses the above-mentioned "streaming read"
method, which somehow allows us to dump 5 blocks at a time.
1. Issue a "streaming read" command for the required sector. This will cause
the 16-sector block to which the sector belongs to be placed at the
beginning of the drive's cache memory, together with the 4 following
16-sector blocks. Do not bother to see what the read command returns.
2. Dump the 5 16-sector blocks.
Method 3
This is similar to the previous method, but instead of dumping the whole
sectors from memory, it uses the (not EDC checked) data returned by the
"streaming read" command. and completes it dumping only the missing bits from
memory.
1. Issue a "streaming read" command for the required sector. This will cause
the 16-sector block to which the sector belongs to be placed at the
beginning of the drive's cache memory, together with the 4 following
16-sector blocks.
2. For each sector of each block, reconstruct the whole Data Frame, as follows:
- Dump 12 bytes from memory.
- Use 2048 bytes returned by the read command.
- Dump 4 more bytes from memory.
Note that this method has a small issue, as sometimes the beginning of the
cache will be dirty and contain invalid data, needing the sector to be read
again. As this seems to happen quite often, we always read a dummy sector
before the requested sector.
Method 4
Method 4 is just method 3 with a trick to use a single dump command for every
sector that has to be reconstructed, instead of two. It is the faster dump
method currently supported and, as such, the default one.
1. Issue a "streaming read" command for the required sector. This will cause
the 16-sector block to which the sector belongs to be placed at the
beginning of the drive's cache memory, together with the 4 following
16-sector blocks.
2. For each sector of each block, reconstruct the whole Data Frame, as follows:
- If this is the first sector of a block, dump 12 bytes from memory.
Otherwise, use the last 12 bytes of the preceding dump.
- Use 2048 bytes returned by the read command.
- Dump 16 bytes from memory, and use the first 4. This leaves 12 bytes to be
used for the reconstruction of the next sector.
Note that the issue of method 3 applies to this method, too.
===============================================================================
How to add support for a new drive
===============================================================================
If you read all the above stuff, it should be clear that, in order to add
support for a new DVD-ROM drive, all that is needed is a way to dump the
drive's internal memory, in particular the portion where the data read from the
disc is cached. As explained above, this function might not be present in all
drives, and might not be easy to find or to use. In case you manage to discover
it, just copy the file "hitachi.c" to a new one, and modify it opportunely.
Some modifications will also be needed in "dvd_drive.c", in order to add
autodetection for the new drive, in the "dvd_assign_functions" function.
Apart from this, the cache behaviour of the new drive might not be the same
as that of the currently supported models, so the program architecture might
need radical changes. In this case, please report.

13
docs/TODO Normal file
View file

@ -0,0 +1,13 @@
- Hashes are wrongly calculated on big-endian machines. This just needs fixing
of some #define's in the multihash library.
- Add MacOS X-specific code. All that is needed is a way to send MMC commands
to the DVD-ROM drive. Inspiration can be taken from the libcdio sources. If
only I had a Mac... Same goes for *BSD, anyway.
- Maybe write a graphical client. I will not do this as I am no GUI fanatic,
but I am sure many Windows users will still use RawDump as it has a GUI,
while we do not. This is actually quite easy, as the program is split into a
library (libfriidump) and a frontend. If anybody does it, please try to make
a portable GUI, maybe by using GTK+, qt, wxWidgets or whatever similar
toolkit you might find.
- Make FriiDump as fast as RawDump (i.e.: 2.5 hours for a Wii disc).
- Improve and better document the library API.

64
docs/options Normal file
View file

@ -0,0 +1,64 @@
FriiDump 0.5.3 - Copyright (C) 2007 Arep
This software comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; see COPYING for details.
Official support forum: http://wii.console-tribe.com
Forum for this UNOFFICIAL VERSION: http://forum.redump.org
Available command line options:
-h, --help Show this help
-a, --autodump Dump the disc to an ISO file with an
automatically-generated name, resuming the dump
if possible
-g, --gui Use more verbose output that can be easily
parsed by a GUI frontend
-d, --device <device> Dump disc from device <device>
-p, --stop Instruct device to stop disc rotation
-c, --command <nr> Force memory dump command:
0 - vanilla 2064
1 - vanilla 2384
2 - Hitachi
3 - Lite-On
4 - Renesas
-x, --speed <x> Set streaming speed (1, 24, 32, 64, etc.,
where 1 = 150 KiB/s and so on)
-T, --type <nr> Force disc type:
0 - GameCube
1 - Wii
2 - Wii_DL
3 - DVD
-S, --size <sectors> Force disc size
-r, --raw <file> Output to file <file> in raw format (2064-byte
sectors)
-i, --iso <file> Output to file <file> in ISO format (2048-byte
sectors)
-u, --unscramble <file> Convert (unscramble) raw image contained in
<file> to ISO format
-H, --nohash Do not compute CRC32/MD5/SHA-1 hashes
for generated files
-s, --resume Resume partial dump
- General -----------------------------------
-0, --method0[=<req>,<exp>] Use dumping method 0 (Optional argument
specifies how many sectors to request from disc
and read from cache at a time. Values should be
separated with a comma. Default 16,16)
- Non-Streaming -----------------------------
-1, --method1[=<req>,<exp>] Use dumping method 1 (Default 16,16)
-2, --method2[=<req>,<exp>] Use dumping method 2 (Default 16,16)
-3, --method3[=<req>,<exp>] Use dumping method 3 (Default 16,16)
- Streaming ---------------------------------
-4, --method4[=<req>,<exp>] Use dumping method 4 (Default 27,27)
-5, --method5[=<req>,<exp>] Use dumping method 5 (Default 27,27)
-6, --method6[=<req>,<exp>] Use dumping method 6 (Default 27,27)
- Hitachi -----------------------------------
-7, --method7 Use dumping method 7 (Read and dump 5 blocks
at a time, using streaming read)
-8, --method8 Use dumping method 8 (Read and dump 5 blocks
at a time, using streaming read, using DMA)
-9, --method9 Use dumping method 9 (Read and dump 5 blocks
at a time, using streaming read, using DMA and
some speed tricks)