pyctr.type.sdtitle module

exception pyctr.type.sdtitle.SDTitleError[source]

Bases: PyCTRError

Generic error for SD Title operations.

class pyctr.type.sdtitle.SDTitleSection(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

TitleMetadata = -1

Contains information about all the possible contents.

Application = 0

Main application CXI.

Manual = 1

Manual CFA. It has a RomFS with a single “Manual.bcma” file inside.

DownloadPlayChild = 2

Download Play Child CFA. It has a RomFS with CIA files that are sent to other Nintendo 3DS systems using Download Play. Most games only contain one.

class pyctr.type.sdtitle.SDTitleReader(file, *, fs=None, case_insensitive=False, dev=False, seed=None, load_contents=True, sdfs=None, sd_id1=None)[source]

Bases: object

Reads the contents of files installed on the SD card inside “Nintendo 3DS”.

By default, this only works with contents that do not use SD encryption (i.e. tmd and contents are plaintext). To read contents currently encrypted on an SD card, SDFilesystem is needed, and provides a method to easily open a title’s contents. (NYI)

Only NCCH contents are supported. SRL (DSiWare) contents are currently ignored.

Parameters:
  • file (FilePath) – A path to a tmd file. All the contents should be in the same directory.

  • fs (FS) – An FS() object or an FS URL <https://docs.pyfilesystem.org/en/latest/openers.html>.

  • case_insensitive (bool) – Use case-insensitive paths for the RomFS of each NCCH container.

  • dev (bool) – Use devunit keys.

  • seed (bytes) – Seed to use. This is a quick way to add a seed using add_seed().

  • load_contents (bool) – Load each partition with NCCHReader.

  • sdfs (SDFilesystem) – SDFilesystem object to use, if opening contents that are currently encrypted. Usually this should not be set directly, instead open the title through SDFilesystem.

  • sd_id1 (str) – ID1 to use if opened through SDFilesystem.

closed: bool

True if the reader is closed.

sdfs
sd_id1
contents: Dict[int, NCCHReader]

A dict of NCCHReader objects for each active NCCH content.

content_info: List[ContentChunkRecord]

A list of ContentChunkRecord objects for each content found in the directory at the time of object initialization.

available_sections: List[SDTitleSection | int]

A list of sections available, including contents, ticket, and title metadata.

fs
tmd: TitleMetadataReader

The TitleMetadataReader object with information from the TMD section.

close()[source]

Close the reader.

open_raw_section(section)[source]

Open a raw content for reading.

Parameters:

section (Union[SDTitleSection, int]) – The content to open.

Returns:

A file-like object that reads from the content.

Return type:

io.BufferedIOBase | CTRFileIO