pyctr.type.tmd module

exception pyctr.type.tmd.TitleMetadataError[source]

Bases: PyCTRError

Generic exception for TitleMetadata operations.

exception pyctr.type.tmd.InvalidSignatureTypeError(sig_type)[source]

Bases: InvalidTMDError

Invalid signature type was used.

exception pyctr.type.tmd.InvalidHashError[source]

Bases: InvalidTMDError

Hash mismatch in the Title Metadata.

class pyctr.type.tmd.ContentInfoRecord(index_offset, command_count, hash)[source]

Bases: NamedTuple

Parameters:
  • index_offset (int) –

  • command_count (int) –

  • hash (bytes) –

index_offset: int

Alias for field number 0

command_count: int

Alias for field number 1

hash: bytes

Alias for field number 2

class pyctr.type.tmd.ContentChunkRecord(id, cindex, type, size, hash)[source]

Bases: NamedTuple

Parameters:
id: str

Alias for field number 0

cindex: int

Alias for field number 1

type: ContentTypeFlags

Alias for field number 2

size: int

Alias for field number 3

hash: bytes

Alias for field number 4

class pyctr.type.tmd.ContentTypeFlags(encrypted, disc, cfm, optional, shared)[source]

Bases: NamedTuple

Parameters:
encrypted: bool

Alias for field number 0

disc: bool

Alias for field number 1

cfm: bool

Alias for field number 2

optional: bool

Alias for field number 3

shared: bool

Alias for field number 4

classmethod from_int(flags)[source]
Parameters:

flags (int) –

Return type:

ContentTypeFlags

class pyctr.type.tmd.TitleVersion(major, minor, micro)[source]

Bases: NamedTuple

Parameters:
  • major (int) –

  • minor (int) –

  • micro (int) –

major: int

Alias for field number 0

minor: int

Alias for field number 1

micro: int

Alias for field number 2

classmethod from_int(ver)[source]
Parameters:

ver (int) –

Return type:

TitleVersion

class pyctr.type.tmd.TitleMetadataReader(*, title_id, save_size, srl_save_size, title_version, info_records, chunk_records, signature=(65540, b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'), _u_issuer='Root-CA00000003-CP0000000b', _u_version=1, _u_ca_crl_version=0, _u_signer_crl_version=0, _u_reserved1=0, _u_system_version=b'\x00\x00\x00\x00\x00\x00\x00\x00', _u_title_type=b'\x00\x00\x00@', _u_group_id=b'\x00\x00', _u_reserved2=b'\x00\x00\x00\x00', _u_srl_flag=0, _u_reserved3=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', _u_access_rights=b'\x00\x00\x00\x00', _u_boot_count=b'\x00\x00', _u_padding=b'\x00\x00')[source]

Bases: object

Class for 3DS Title Metadata.

https://www.3dbrew.org/wiki/Title_metadata

Parameters:
title_id
save_size
srl_save_size
title_version
info_records
chunk_records
content_count
signature
classmethod load(fp, verify_hashes=True)[source]

Load a tmd from a file-like object.

Parameters:
  • fp (BinaryIO) –

  • verify_hashes (bool) –

Return type:

TitleMetadataReader

classmethod from_file(fn, *, fs=None, verify_hashes=True)[source]
Parameters:
  • fn (FilePath) –

  • fs (Optional[FS]) –

  • verify_hashes (bool) –

Return type:

TitleMetadataReader