Skip to main content

Crate codebreaker

Crate codebreaker 

Source
Expand description

Encrypt and decrypt cheat codes for all versions of CodeBreaker PS2.

Uses cb1 and cb7 under the hood to support both CB v1 and v7 codes.

§Quickstart

use codebreaker::Codebreaker;

let input: Vec<(u32, u32)> = vec![
    (0x2043AFCC, 0x2411FFFF),
    (0x2A973DBD, 0x00000000),
    (0xB4336FA9, 0x4DFEFB79),
    (0x973E0B2A, 0xA7D4AF10),
];
let output: Vec<(u32, u32)> = vec![
    (0x2043AFCC, 0x2411FFFF),
    (0x201F6024, 0x00000000),
    (0xBEEFC0DE, 0x00000000),
    (0x2096F5B8, 0x000000BE),
];

let mut cb = Codebreaker::new();
for (i, code) in input.iter().enumerate() {
    assert_eq!(cb.auto_decrypt_code(code.0, code.1), output[i]);
}

§Platform support

This crate is no_std and currently supports little-endian targets only. The CB v7 implementation intentionally preserves byte-level behavior from the original C code.

Modules§

cb1
Encrypt and decrypt cheat codes for CodeBreaker PS2 v1 - v6.
cb7
Encrypt and decrypt cheat codes for CodeBreaker PS2 v7+.

Structs§

Codebreaker
A processor for CB v1 and v7 codes.