pyctr.type.smdh module

exception pyctr.type.smdh.SMDHError[source]

Bases: PyCTRError

Generic exception for SMDH operations.

exception pyctr.type.smdh.InvalidSMDHError[source]

Bases: SMDHError

Invalid SMDH contents.

class pyctr.type.smdh.AppTitle(short_desc, long_desc, publisher)[source]

Bases: NamedTuple

Parameters:
  • short_desc (str) –

  • long_desc (str) –

  • publisher (str) –

short_desc: str

Alias for field number 0

long_desc: str

Alias for field number 1

publisher: str

Alias for field number 2

classmethod from_bytes(app_title_raw)[source]
Parameters:

app_title_raw (bytes) –

class pyctr.type.smdh.SMDHRegionLockout(Japan, NorthAmerica, Europe, Australia, China, Korea, Taiwan, RegionFree)[source]

Bases: NamedTuple

Parameters:
Japan: bool

Alias for field number 0

NorthAmerica: bool

Alias for field number 1

Europe: bool

Alias for field number 2

Australia: bool

Alias for field number 3

China: bool

Alias for field number 4

Korea: bool

Alias for field number 5

Taiwan: bool

Alias for field number 6

RegionFree: bool

Alias for field number 7

classmethod from_bytes(region_lockout_bytes)[source]
Parameters:

region_lockout_bytes (bytes) –

class pyctr.type.smdh.SMDHFlags(Visible, AutoBoot, Allow3D, RequireEULA, AutoSave, ExtendedBanner, RatingRequired, SaveData, RecordUsage, NoSaveBackups, New3DS)[source]

Bases: NamedTuple

Parameters:
  • Visible (bool) –

  • AutoBoot (bool) –

  • Allow3D (bool) –

  • RequireEULA (bool) –

  • AutoSave (bool) –

  • ExtendedBanner (bool) –

  • RatingRequired (bool) –

  • SaveData (bool) –

  • RecordUsage (bool) –

  • NoSaveBackups (bool) –

  • New3DS (bool) –

Visible: bool

Icon is visible at the HOME Menu

AutoBoot: bool

Auto-boot this game card title (no effect for SD titles)

Allow3D: bool

Title uses 3D (this is only used for a Parental Controls alert, it does not actually enable/disable 3D)

RequireEULA: bool

Require accepting the EULA before being launched from the HOME Menu

AutoSave: bool

Title auto-saves on exit (this means there will not be a prompt to save when attempting to close)

ExtendedBanner: bool

Title uses an extended banner

RatingRequired: bool

Region-specific game rating required

SaveData: bool

Title uses save data (this will prompt the user that unsaved data will be lost, unless AutoSave is set)

RecordUsage: bool

Application usage is recorded (when not set, the icon is not stored in the icon cache)

NoSaveBackups: bool

Disable Save-Data Backup

New3DS: bool

Exclusive to New Nintendo 3DS

classmethod from_bytes(flag_bytes)[source]
Parameters:

flag_bytes (bytes) –

pyctr.type.smdh.next_pow_2(i)[source]
Parameters:

i (int) –

pyctr.type.smdh.rgb565_to_rgb888_tuple(data)[source]
Parameters:

data (bytes) –

Return type:

RGBTuple

pyctr.type.smdh.rgb565_to_rgb888(data)[source]
Parameters:

data (bytes) –

pyctr.type.smdh.load_tiled_rgb565_to_array(data, width, height)[source]
Parameters:
Return type:

List[List[RGBTuple]]

pyctr.type.smdh.rgb888_array_to_image(pixel_array, width, height)[source]
Parameters:
  • pixel_array (List[List[RGBTuple]]) –

  • width (int) –

  • height (int) –

pyctr.type.smdh.load_tiled_rgb565(data, width, height)[source]
Parameters:
class pyctr.type.smdh.SMDH(names, icon_small_array, icon_large_array, flags, region_lockout)[source]

Bases: object

Class for 3DS SMDH.

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

Parameters:
names: Mapping[str, AppTitle]
icon_small_array
icon_large_array
flags
region_lockout
icon_small
icon_large
get_app_title(language=('English', 'Japanese', 'French', 'German', 'Italian', 'Spanish', 'Simplified Chinese', 'Korean', 'Dutch', 'Portuguese', 'Russian', 'Traditional Chinese'))[source]
Parameters:

language (Union[str, Tuple[str, ...]]) –

Return type:

Optional[AppTitle]

classmethod load(fp)[source]

Load an SMDH from a file-like object.

Parameters:

fp (BinaryIO) –

Return type:

SMDH

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

  • fs (Optional[FS]) –

Return type:

SMDH