putnam / binmerge

Tool to merge multiple bin/cue tracks into one. Great for redump.
GNU General Public License v2.0
340 stars 44 forks source link

binmerge

Source code available at: https://github.com/putnam/binmerge

Tool to merge multiple bin/cue tracks into one.

Usage

To get the command line help for binmerge, use ./binmerge --help.

Example: Merge a split image

To merge a set of bin files for a given cuesheet:

./binmerge "/path/to/My Great Game.cue" "My Great Game (Merged)"

This will create two new files, "My Great Game (Merged).bin" and "My Great Game (Merged).cue". These will be created alongside your existing files in the same directory unless specified otherwise.

To control the output directory, use the --outdir flag:

./binmerge --outdir "/mnt/stuff/merged-games" "/path/to/My Great Game.cue" "My Great Game (Merged)"

Example: Split a merged image

If you want to reverse the process and create split files again, binmerge supports that. But do note, for some games, the Redump cuesheet contains information that binmerge cannot reasonably preserve when merging. If you're trying to get back to a pristine Redump set, you may want to download the freely available cuesheets available on Redump's web site.

To split a merged bin/cue:

./binmerge --split --outdir "/mnt/stuff/split-games" "/path/to/My Great Game.cue" "My Great Game"

This will create a new cue sheet and a series of .bin files, like this:

My Great Game.cue
My Great Game (Track 1).bin
My Great Game (Track 2).bin

As before, if outdir is not specified, the new files will be written alongside the existing files.

Rationale

Sometimes discs are ripped in such a way that they have a separate bin file for every track. One example that I know of is the Redump project, specifically for the Playstation 1 or PSX.

Here is a cuesheet for the imaginary PSX game "Big Buddy". You can see it refers to several individual bin files, one for each track:

FILE "Big Buddy (Track 01).bin" BINARY
  TRACK 01 MODE2/2352
    INDEX 01 00:00:00
FILE "Big Buddy (Track 02).bin" BINARY
  TRACK 02 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "Big Buddy (Track 03).bin" BINARY
  TRACK 03 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "Big Buddy (Track 04).bin" BINARY
  TRACK 04 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "Big Buddy (Track 05).bin" BINARY
  TRACK 05 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
...

Some software cannot read this style of disc image, because they only know how to work with a single bin file or are unable to properly parse cuesheets according to the standard.

binmerge reads a cuesheet and its associated series of bin files and generates a new, single merged bin file and cuesheet. It is completely non-destructive and does not touch your existing files.

Here is the new cuesheet generated by binmerge with the above example:

FILE "Big Buddy.bin" BINARY
  TRACK 01 MODE2/2352
    INDEX 01 00:00:00
  TRACK 02 AUDIO
    INDEX 00 32:26:61
    INDEX 01 32:28:61
  TRACK 03 AUDIO
    INDEX 00 35:43:29
    INDEX 01 35:45:29
  TRACK 04 AUDIO
    INDEX 00 36:47:27
    INDEX 01 36:49:27
  TRACK 05 AUDIO
    INDEX 00 38:50:66
    INDEX 01 38:52:66

Have fun!