Skip to: Download | Installation | Usage | Technical Details
Introduction
Many console makers assign unique IDs to their games. While these IDs primarily serve as a method to uniquely identify the games, they're also used in various other capacities. Eg., game save data may be written to a directory based on the game ID rather than game title, game updates and DLC generally uses the ID, online databases (such as this GameTDB entry for Mass Effect 3) are frequently indexed by ID. Game IDs can also be used to help determine the region and even publisher of a particular game; eg., BCUS is typically used for first-party published PS3 games in the US, BLES for third-party published PS3 games in the EU, etc.
While end users generally don't need to be aware of a games ID, it can be helpful when collecting or verifying games, playing on emulators, downloading artwork, and any kind of hacking or modding. As a result, I wrote Read Game ID to easily extracted the ID from supported ISOs. Note that this requires that you already have a good rip of a game to your computer; it's not possible to use this to read the ID directly off a disc.
Read Game ID currently supports the following systems and game formats:
- Microsoft Xbox 360 - ISO, XEX
- Sega CD - BIN/CUE
- Sega Saturn - BIN/CUE
- Sony PlayStation - ISO, BIN/CUE
- Sony PlayStation 2 - ISO, BIN/CUE
- Sony PlayStation 3 - ISO, PSN PKG
- Sony PlayStation 4 - ISO, PSN PKG
- Sony PlayStation Portable - ISO, CSO
- Sony PlayStation Vita - NoNpDrm Zip, PSN PKG
It's only been tested against Redump-verified images and No-Intro-verified packages, so if you have any trouble I recommend first verifying your rip; Linux users may want to look at my Verify Game script for this.
Download Current Version: 1.3, Released: 08/21/2021
read-game-id.sh (21.35 KB) - The Read Game ID BASH shell script
The Read Game ID changelog is included in the beginning of the script.
Installation
Read Game ID requires a few steps to properly configure:
- Download
read-game-id.sh
and move to a directory in your $PATH (eg,/usr/local/bin/
) - Ensure that
read-game-id.sh
has the execute bit set (eg,chmod a+x /usr/local/bin/read-game-id.sh
) - Verify the required helper utilities are installed;
- 7z, from p7zip - used to unpack ISOs
- sfo, from SFO PS3 Reader - used to parse Sony SFO files
- bchunk - used to convert BIN/CUE images to ISO
- UnPKG tool, by flatz - used to unpack metadata from PS4 games
- maxcso - used to decompress PSP CSO images
- abgx360 - used to parse Xbox 360 ISOs and XEX files
Note: If you want to read PS4 game IDs, some extra work needs to be done. Save the UnPKG tool code linked above to a file named
unpkg.py
, make it executable, and prepend the following line to the top of it:#!/usr/bin/python2
Edit the path as necessary to ensure it's pointing to a Python 2 interpreter installed on your system.
Alternatively, just download the copy I've already prepared: unpkg.py. Note that this will still need to be made executable and moved to a directory in your $PATH.
Usage
Execute read-game-id.sh -h
to display help information. This will describe the syntax for running the program and list all available options.
You may provide pass one or more ISO files; if multiple files passed (such as *.iso
), it'll check multiple files in parallel up to your number of CPU threads in order to speed up the verification process.
By default, read-game-id.sh
will only output the filename and game ID:
$ read-game-id.sh Mass\ Effect\ 3.iso
Mass Effect 3: BLUS30853
You may also pass the -m
option to output additional metadata for all formats except PSN PKG files. Output will vary depending on the system. Eg., here's the output from a PS3 game:
$ read-game-id.sh -m Mass\ Effect\ 3.iso
Mass Effect 3
Game ID: BLUS30853
Title: Mass Effect™ 3
Version: 01.00 (Disc Ver. 01.00)
Min Sys Ver: 04.0100
NP Comm ID: NPWR01814_00
Attributes: 0x00 (Decimal: 0)
Resolution: 0x07 (Decimal: 7)
Audio: 0x307 (Decimal: 775)
If reading BIN/CUE files, you must reference the .cue file. read-game-id.sh
determines which BIN file(s) to read from the contents of the CUE file.
Technical Details
Read Game ID begins execution by determining the type of file. ISO, PSN PKG, and NoNpDRM Zip files are natively supported, but BIN/CUE images are usually first converted to ISO using bchunk
, and CSO images must first be decompressed using maxcso
. If the conversion is necessary, the temporary ISO file(s) will be written to to $TEMPDIR (defaulting to /tmp, but can be overridden by modifying $TEMPDIR in the script).
Note: There's a bug in bchunk that prevents successful conversion of some multi-track PS1 BIN/CUE images. For my personal redump-verified collection, roughly 20% of my games hit this bug and, as a result, the game ID cannot be successfully read. Most PS1 games should work fine, and all BIN/CUE PS2 images I've tested work fine.
read-game-id.sh
then uses 7z
to list the contents of the converted ISO or package and search for supported metadata files. If no valid metadata files are found, execution ends. Otherwise, the metadata file is extracted to $TEMPDIR. For PS4 games, the metadata is stored within a file named app.pkg
that contains all game-related data; this file will be additionally unpacked using unpkg.py
Note that because all game data is essentially being unpacked twice, reading the game ID for PS4 games is significantly slower, and takes up significantly more space in $TEMPDIR, than all other games.
After the metadata is fully extracted, read-game-id.sh
will parse the file is appropriate for the given system:
- PS1 and PS2 games use a simple text file named SYSTEM.CNF that includes the game ID and some other basic metadata
- PS3 and PS4 games include a file named PARAM.SFO that must be parsed with
read-sfo
to obtain the metadata - Sega CD and Saturn images include ID info in the primary volume descriptor (PVD); this is read with hexdump
The retrieved metadata is then output to the terminal. By default, each read game will be output on one line, with the file name followed by the game ID. If the -m
parameter is passed to read-game-id.sh
, it will instead output additional metadata in blocks for each game, headered by the game title.
Note that the data extracted from PS4 games can be quite large, especially if you are batch reading multiple games at once. This can consume a LOT of disk space under $TEMPDIR, potentially filling up that filesystem in the worst case scenario. Depending on the disk space you have available, I recommend using -t1
or -t2
to limit the amount of PS4 games being read in parallel.