Skip to content
CodeBreaker PS2 File Utility
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
contrib Add contrib/README.md Jul 23, 2013
libbig_int @ 51cac51 Include libbig_int as git submodule Jul 29, 2012
libcheats @ 0f4d052 Update to libcheats v0.2 which uses MIT license Oct 14, 2012
test Add MIT license and move GPL text to test folder Oct 13, 2012
.gitignore Auto-generate version info (make only) Jan 3, 2011
.gitmodules Include libbig_int as git submodule Jul 29, 2012
.travis.yml Use new container infra Dec 1, 2015
CB2UTIL-VERSION-GEN Remove unused code to generate version from CMake Jul 30, 2012
CMakeLists.txt Remove unused code to generate version from CMake Jul 30, 2012
HISTORY.md v1.9 Jul 19, 2013
LICENSE Update copyright year to 2013 Jan 2, 2013
Makefile Add MIT license and move GPL text to test folder Oct 13, 2012
README.md Fix Gist URL to grab elf.h from May 22, 2015
arcfour.c Update copyright year to 2013 Jan 2, 2013
arcfour.h Update copyright year to 2013 Jan 2, 2013
cb2_crypto.c Update copyright year to 2013 Jan 2, 2013
cb2_crypto.h Update copyright year to 2013 Jan 2, 2013
cb2util.c Update copyright year to 2013 Jan 2, 2013
cbc.c Update copyright year to 2013 Jan 2, 2013
cheats.c Update copyright year to 2013 Jan 2, 2013
cheats_common.c Update copyright year to 2013 Jan 2, 2013
cheats_common.h Update copyright year to 2013 Jan 2, 2013
compress.c Update copyright year to 2013 Jan 2, 2013
compress.h Update copyright year to 2013 Jan 2, 2013
fileio.c Update copyright year to 2013 Jan 2, 2013
fileio.h Update copyright year to 2013 Jan 2, 2013
pcb.c Update copyright year to 2013 Jan 2, 2013
sha1.h Update copyright year to 2013 Jan 2, 2013
shs.c Fix compiler warnings Nov 17, 2010
shs.h Include stdint.h and get rid of mytypes.h Dec 11, 2010

README.md

cb2util - CodeBreaker PS2 File Utility

cb2util was made to utilize different file formats of CodeBreaker PS2.

It currently supports:

  • Code saves (v7 and v8+/Day1)
  • "cheats" files (v7+)
  • PCB files (upgrades/homebrew/etc)

The features are:

  • extract (and decrypt) all cheats from code saves and "cheats" files
  • compile your own code saves and "cheats" files
  • encrypt or decrypt PCB files
  • convert PCB files into ELF files
  • check digital signature on code saves and PCB files

Installation

The easiest and fastest way to get cb2util is to download the pre-built binaries for Windows or Linux from the Downloads site.

If you want to build cb2util from source, simply run:

$ git clone --recursive git://github.com/mlafeldt/cb2util.git
$ cd cb2util/
$ make
$ make install

CMake is supported too:

$ mkdir build
$ cd build/
$ cmake ..
$ make
$ make install

In case your system lacks elf.h, you can install it this way:

$ curl -Ls https://gist.githubusercontent.com/mlafeldt/3885346/raw/a2d96012828ea82e96a290ae56821c9cecd7023c/elf.h | sudo tee /usr/local/include/elf.h

Usage

As cb2util is a command-line application, you have to pass arguments to it.

Using the --help option will display the following text:

$ cb2util --help
usage: cb2util [--version] [--help] <command> [<args>]

The available commands are:
    cbc
    cheats
    pcb

Try 'cb2util help <command>' for more information.

As written above, you must specify the command to use followed by its arguments. There's one command for each of the supported file formats, e.g. cbc for code saves. To learn how a command is supposed to work, run cb2util help <command>.

Below are some notes and examples concerning the different file formats.

Code saves (v7 and v8+/Day1)

File extension: *.cbc

Code saves (also known as Day1 or CBC files) store cheat codes that can be added to your CodeBreaker's code list. While older code saves for CB v7 are only encrypted, newer files for CB v8+ and CB Day1 are digitally signed as well. The latter is the reason why you need a hacked CB in order to use code saves compiled with cb2util (search the Web for CodeBreaker RSA fix).

usage: cb2util cbc [-d[mode] | -v] <file>...
   or: cb2util cbc -7 [-d[mode]] <file>...
   or: cb2util cbc [-b <banner>] -c <infile> <outfile>...
   or: cb2util cbc -7 -c <infile> <outfile>...

    no option
        extract cheats

    -d[mode], --decrypt[=mode]
        decrypt extracted cheats
        mode can be "auto" (default) or "force"

    -v, --verify
        verify RSA signature

    -c, --compile
        compile text to CBC file

    -b, --banner <banner>
        custom banner inserted into compiled CBC v8+ files

    -7
        files are in CBC v7 format

Examples:

Extract cheats from mgs3.cbc and print them to screen:

$ cb2util cbc mgs3.cbc

Extract cheats, decrypt encrypted cheats, and print them to screen:

$ cb2util cbc --decrypt mgs3.cbc

Same as previous example, but force decryption of all cheats:

$ cb2util cbc --decrypt=force mgs3.cbc

Check digital signature of re4.cbc:

$ cb2util cbc --verify re4.cbc

Extract and decrypt cheats from v7 code save re4.cbc, write them to re4.txt:

$ cb2util cbc --decrypt -7 re4.cbc > re4.txt

Compile cheats in mygame.txt to code save for CB v8+:

$ cb2util cbc --compile mygame.txt /path/to/cbc

Compile cheats in mygame.txt to code save for CB v7:

$ cb2util cbc --compile -7 mygame.txt /path/to/cbc

Note that the format of the text file to be compiled is described below.

"cheats" files

The "cheats" file is CodeBreaker's internal code database. It is usually saved to memory card (mc0:/PCB/cheats) and updated every time the code list is changed.

usage: cb2util cheats [-d[mode]] <file>...
   or: cb2util cheats -c <infile> <outfile>...

    no option
        extract cheats

    -d[mode], --decrypt[=mode]
        decrypt extracted cheats
        mode can be "auto" (default) or "force"

    -c, --compile
        compile text to cheats file

Examples:

Extract all cheats from "cheats" file and print them to screen:

$ cb2util cheats /path/to/cheats

Same as previous example, but write extracted cheats to cheats.txt:

$ cb2util cheats /path/to/cheats > cheats.txt

Extract all cheats, decrypt encrypted cheats, and print them to screen:

$ cb2util cheats --decrypt /path/to/cheats

Same as previous example, but force decryption of all cheats:

$ cb2util cheats --decrypt=force /path/to/cheats

Compile cheats in mygames.txt to "cheats" file:

$ cb2util cheats --compile mygames.txt /path/to/cheats

You can use your own "cheats" file with CodeBreaker in just a few steps:

  1. create a text file containing your cheats; the format is described below
  2. invoke cb2util to compile the text file to a "cheats" file
  3. use your favorite method to transfer the file to mc0:/PCB/cheats
  4. start CodeBreaker to see your cheats ready to be used

Text file format

To compile code saves and "cheats" files, cb2util uses libcheats for parsing cheat codes in text format. The format of the text file is quite simple:

"Game title 1"
Cheat description 1
Cheat code 1
Cheat code 2
Cheat description 2
Cheat code 1
Cheat code 2

"Game title 2"
etc.

Also, C++-style comments are allowed; all text beginning with a // sequence to the end of the line is ignored.

Example:

"TimeSplitters"
// some senseless comment
Mastercode
902D51F8 0C0B95F6
Invincible
203C8728 00000001

PCB files

File extension: *.bin

PCB files are encrypted and digitally signed binaries that can be executed by the CodeBreaker PS2. In theory, this could be any application; we've seen upgrades and homebrew so far.

usage: cb2util pcb [-s] <infile> <outfile>...
   or: cb2util pcb -e <infile> <outfile>...
   or: cb2util pcb -v <file>...

    no option
        encrypt/decrypt file

    -s, --strip
        strip RSA signature

    -e, --elf
        convert into ELF file

    -v, --verify
        verify RSA signature

Note: PCB files are encrypted with a symmetric cipher (RC4) and cb2util actually doesn't care if it's encrypting or decrypting.

Examples:

Decrypt pelican.bin to pelican.raw:

$ cb2util pcb pelican.bin pelican.raw

Decrypt pelican.bin to pelican.raw and strip RSA signature:

$ cb2util pcb --strip pelican.bin pelican.raw

Convert pelican.bin into the ELF file pelican.elf:

$ cb2util pcb --elf pelican.bin pelican.elf

Check RSA signature of pelican.bin:

$ cb2util pcb --verify pelican.bin

Game saves

File extension: *.cbs

Comming soon... ;)

Disclaimer

THIS PROGRAM IS NOT LICENSED, ENDORSED, NOR SPONSORED BY SONY COMPUTER ENTERTAINMENT, INC. NOR PELICAN ACCESSORIES, INC. ALL TRADEMARKS ARE PROPERTY OF THEIR RESPECTIVE OWNERS.

  • cb2util is licensed under the terms of the MIT License. See LICENSE file.
  • The code in arcfour.c is licensed under the terms of the FreeBSD license, which is believed to be compatible with the MIT license.
  • The SHA-1 implementation is placed in the public domain.
  • libcheats is licensed under the terms of the MIT License. See LICENSE file.
  • The license of libbig_int says that it can be redistributed/modified freely.
  • zlib has its own permissive free software license.
  • Sharness and all tests are licensed under the terms of the GNU General Public License version 2 or higher. See file COPYING for full license text.

Special Thanks

  • Alexander Valyalkin for his great libbig_int library.
  • Peter C. Gutmann and Paul Rubin for the fast implementation of SHA-1.
  • Vector for making PS2 Save Builder and saving me some time.
  • Gtlcpimp who has awakened my interest in cb2util again and provided valuable information on the "cheats" compression.
  • Greets to all the people that contribute to our code hacking community!

Contact

You can’t perform that action at this time.