gditools.py, a Python program/library to handle GDI files!

Chat about the Sega Dreamcast and get cheat codes for it in the subforums.

cheatengine

Member
Vgcheat Member
Hey guys!

I've been a lurker here for a long time, helping some members in different projects behind the scene. Most of you might know me from various Dreamcast projects and development, like binhack32 and my Selfboot Pack.

I registered today to share with you my latest project, as it seems your community is one of the few last strong one built around the Dreamcast!

So here it goes! (The main thread for this project is on AssemblerGames but I'll monitor both ones!)

Cheers!

FG

==============================

Hi folks,

Here's a project I've been working on a lot in the last months: an open-source Python program/library to handle (extract, generate sorttxt.txt etc.) GDI files. Python 2.7.x is required, it works on Linux and Windows and should also work on ARM or whatever as long as Python 2.7 runs.

It has so far been tested to work well under both Windows and Linux, with x86 64-bit version of Python. It should be quite fast, dumping Sonic Adventure in under 2 seconds using an SSD and a i7 CPU (with bin tracks being converted to iso on-the-fly while parsing).

Here's the project sourceforge page: gditools download | SourceForge.net

It should be quite practical to extract gdi files and retrieve ip.bin and sorttxt.txt files, in fact here's the line that'd do that (on Windows). BTW it preserves the original timestamps of the extracted files:
python gditools.py -i C:\MyGDI\disc.gdi -s sorttxt.txt -b ip.bin --extract-all

This would dump the ip.bin and generate the sorttxt file to C:\MyGDI, and extract all the files in the GDI in the C:\MyGDI\data folder.
Using the --data-folder __volume_label__ argument, the "data" folder would be rename to the volume label of the iso9660 filesystem for both the extraction subfolder and the sorttxt.txt file.
python gditools.py -i C:\MyGDI\disc.gdi -s sorttxt.txt -b ip.bin --data-folder __volume_label__ --extract-all

It can also extract a single file from the GDI:
python gditools.py -i /folder/disc.gdi -e 1st_read.bin

Someone that's good at making Qt/Tk GUI should find a lot of useful tools to write a simple GUI interface for dumping file, but I'm not so I leave that to others. I'd gladly merge such modification or any other pertinent one in the master branch upon request. See the readme for more examples. Quoting it right now:
Description:

gditools, a python library to extract files, sorttxt.txt and
bootsector (ip.bin) from SEGA Gigabyte Disc (GD-ROM) dumps.

The goals is to make it efficient, readable and multiplatform.

As of December 2014 it's tested working on Linux and Win7 under python 2.7 but it was only tested on x86_64 processors. The performances are typically limited by the usage of a platter HDD. When using a SSD, the CPU can be the bottleneck if it's an old one or if it's used in power-saving mode. 3-tracks gdi can be extracted in less than 2 seconds with the right configuration (~1GiB of data).

To get the most recent version, browse code on:
gditools download | SourceForge.net

or using git:
git clone git://git.code.sf.net/p/dcisotools/code dcisotools-code

Releases of stable code might be sporadically packaged into a .zip archive for convenience, and made available on the sourceforge page download section.

bin2iso.py and gdifix.py (creating a single .iso from a gdi dump) are provided in the Examples folder. They can be used as is or be used to see how to incorporate gditools.py in another project.

See the Legal Stuff section at the end of this readme for the infos on licensing and using this project in another one.

Enjoy!

FamilyGuy 2014

Thanks to SiZiOUS for testing the code and providing support.

****************

Requirements:
- Python 2.7.x, Python 3 won't work.
- On Windows you have to add the python folder to your path manually.

****************

Usage:
python gditools.py -i input_gdi [options]

-h, --help Display this help
-l, --list List all files in the filesystem and exit
-o [outdir] Output directory. Default: gdi folder
-s [filename] Create a sorttxt file with custom name
(It uses *data-folder* as prefix)
-b [ipname] Dump the ip.bin with custom name
-e [filename] Dump a single file from the filesystem
--extract-all Dump all the files in the *data-folder*
--data-folder [name] *data-folder* subfolder. Default: data
(__volume_label__ --> Use ISO9660 volume label)
--silent Minimal verbosity mode
[no option] Display gdi infos if not silent

****************

Usage examples:
0- Listing all files in the gdi:
gditools.py -i /folder/disc.gdi --list

1- Displaying gdi infos:
gditools.py -i /folder/disc.gdi

2- Dumping bootsector/initial program/ip.bin:
gditools.py -i /folder/disc.gdi -b ip.bin

3- Generating a sorttxt file:
gditools.py -i /folder/disc.gdi -s sorttxt.txt

4- Generating a sorttxt file with a different "data" folder (see example 9):
gditools.py -i /folder/disc.gdi -s sorttxt.txt --data-folder MyDump

5- Extracting a single file:
gditools.py -i /folder/disc.gdi -e 1st_read.bin

6- Specifying a different output folder:
(default one is the gdi folder)
gditools.py -i /folder/disc.gdi -e 1st_read.bin -o /OtherFolder

7- Extracting all the files from the gdi:
gditools.py -i /folder/disc.gdi --extract-all

8- Specifying a different subfolder name:
(default one is "data")
gditools.py -i /folder/disc.gdi --extract-all --data-folder MyFolder

9- Using the iso9660 filesystem volume label as the subfolder name:
gditools.py -i /folder/disc.gdi --extract-all --data-folder __volume_label__

10- Doing most of the above at once:
gditools.py -i /folder/disc.gdi -s sorttxt.txt -b ip.bin -o /OtherFolder --data-folder __volume_label__ --extract-all

****************

Legal Stuff:
gditools.py and provided examples are licensed under the GNU General Public License (version 3), a copy of which is provided in the licences folder: GNU_GPL_v3.txt

Original iso9660.py by Barney Gale : github.com/barneygale/iso9660
iso9660.py is licensed under a BSD license, a copy of which is provided in the licences folder: iso9660_licente.txt

Two tools that use gditools.py as a library are also provided in the Examples folder. One gdifix.py is a modern remake of isofix.exe -> You point it to a gdi file and it spits a BIG iso with all the files in the GDI, parseable with most programs. The other, bin2iso.py is a simple bin2iso converter.

Constructive comments/suggestions are welcome! Keep in mind I'm a scientist, not a programmer, and my code might not be at a professional-level quality, though I'm trying to make it as clean and readable as possible.

Cheers! And Merry 16th Christmas to the Dreamcast!

FG


P.S. Thanks to SiZiOUS for testing and helping with the sourceforge!
 
Our free community is dedicated to US-based video gamers to provide a platform for exchange and support.
Join discussions on cheating, guides, exploits & tips, secrets, mods and so much more!
PSA: we do not support cheating for online/mobile/multiplayer games, which may include trainers,
mod menu's, software to modify apps etc.
Back
Top Bottom