rpgmaker_mv_decoder package
Submodules
rpgmaker_mv_decoder.callback module
callback module
Used to handle callbacks in a single object rather than multiple parameters
- class rpgmaker_mv_decoder.callback.Callback(progressbar_callback: typing.Callable[[click._termui_impl.ProgressBar], bool] = <function _default_progressbar_callback>, overwrite_callback: typing.Callable[[str], bool] = <function _default_overwrite_callback>, error_callback: typing.Callable[[str], bool] = <function _default_error_callback>, warning_callback: typing.Callable[[str], bool] = <function _default_error_callback>)[source]
Bases:
objectCallbackencapsulates all the callbacks that might be used during execution- property error
errorcallback executed when an error occursReturns:
Callable[[str], bool]: Function to call. Error message should be specified via the parameter. If the user cancels the operation, this should returnTrue
- property overwrite
overwritecallback executed when a file is about to be overwittenReturns:
Callable[[str], bool]: Function to call. Path to overwite should be specified as the string. If the function returnsTruethe file should be overwritten. If the user cancels the operation this function should return None
- property progressbar
progressbarcallback for updating the progress of the operationReturns:
Callable[[ProgressBar], bool]: Function to call. Progress data should be specified via the parameter. If the user cancels the operation, this should returnTrue
- property warning
warningcallback executed when an warning occursReturns:
Callable[[str], bool]: Function to call. Warning message should be specified via the parameter. If the user cancels the operation, this should returnTrue
rpgmaker_mv_decoder.cli_help module
Command line interface help classes
- class rpgmaker_mv_decoder.cli_help.DecodeHelp(name: Optional[str], context_settings: Optional[Dict[str, Any]] = None, callback: Optional[Callable[[...], Any]] = None, params: Optional[List[click.core.Parameter]] = None, help: Optional[str] = None, epilog: Optional[str] = None, short_help: Optional[str] = None, options_metavar: Optional[str] = '[OPTIONS]', add_help_option: bool = True, no_args_is_help: bool = False, hidden: bool = False, deprecated: bool = False)[source]
Bases:
click.core.CommandDecodeHelphelp command overrideUsed to customize click help
- class rpgmaker_mv_decoder.cli_help.EncodeHelp(name: Optional[str], context_settings: Optional[Dict[str, Any]] = None, callback: Optional[Callable[[...], Any]] = None, params: Optional[List[click.core.Parameter]] = None, help: Optional[str] = None, epilog: Optional[str] = None, short_help: Optional[str] = None, options_metavar: Optional[str] = '[OPTIONS]', add_help_option: bool = True, no_args_is_help: bool = False, hidden: bool = False, deprecated: bool = False)[source]
Bases:
click.core.CommandEncodeHelphelp command overrideUsed to customize click help
rpgmaker_mv_decoder.constants module
constants.py Constants for use by modules
rpgmaker_mv_decoder.exceptions module
Custom Exception Types
- exception rpgmaker_mv_decoder.exceptions.Error(message: str)[source]
Bases:
ExceptionBase class for exceptions in this module.
Attributes:
message: Explanation of the error
- exception rpgmaker_mv_decoder.exceptions.FileFormatError(expression: str, message: str)[source]
Bases:
rpgmaker_mv_decoder.exceptions.ErrorException raised for errors in the input. Based on
ErrorclassAttributes:
expression: Input expression in which the error occurredmessage: Explanation of the error
- exception rpgmaker_mv_decoder.exceptions.NoValidFilesFound(message: str)[source]
Bases:
rpgmaker_mv_decoder.exceptions.ErrorException raised when no files are found. Based on
ErrorclassAttributes:
message: Explanation of the error
- exception rpgmaker_mv_decoder.exceptions.PNGHeaderError(expression: str, message: str)[source]
Bases:
rpgmaker_mv_decoder.exceptions.FileFormatErrorException raised for PNG images that when the IHDR section doesn’t checksum correctly.
Attributes:
expression– Input expression in which the error occurredmessage– Explanation of the error
- exception rpgmaker_mv_decoder.exceptions.RPGMakerHeaderError(expression: str, message: str)[source]
Bases:
rpgmaker_mv_decoder.exceptions.FileFormatErrorException raised for files missing the RPGMaker MV header.
Attributes:
expression– Input expression in which the error occurredmessage– Explanation of the error
rpgmaker_mv_decoder.project module
project.py
Module for dealing with RPGMaker projects
- class rpgmaker_mv_decoder.project.Project(source_path: typing.Optional[pathlib.PurePath] = None, destination_path: typing.Optional[pathlib.PurePath] = None, key: typing.Optional[str] = None, callbacks: rpgmaker_mv_decoder.callback.Callback = <rpgmaker_mv_decoder.callback.Callback object>)[source]
Bases:
objectHandles a project and runs operations
- property key: str
Gets the
keyor returnsNoneif the key is not valid
rpgmaker_mv_decoder.projectdecoder module
Class for decoding a project
- class rpgmaker_mv_decoder.projectdecoder.ProjectDecoder(source: pathlib.PurePath, destination: pathlib.PurePath, key: str, callbacks: rpgmaker_mv_decoder.callback.Callback = <rpgmaker_mv_decoder.callback.Callback object>)[source]
Bases:
rpgmaker_mv_decoder.project.ProjectHandles a project and runs operations
- decode_file(input_file: pathlib.PurePath, detect_type: bool) bool[source]
encode_fileTakes a path and decodes a fileArgs:
self(Project): Project objectinput_file(PurePath): File to read and modify
Returns:
bool: True if the operation should continue
- decode_header(file_header: bytes) bytes[source]
decode_headertake a RPGMaker header and return the key or the actual file headerCheck’s the first 16 bytes for the standard RPGMaker header, then drops them. Takes the next 16 bytes and either calculates the key based on a PNG image, or uses the specify key to decode. If png_ihdr_data is provided, checks that the IHDR section checksums correctly.
Args:
file_header(bytes): First 32 bytes from the file, 16 bytes are the RPGMaker header, followed by 16 bytes of the file header
Raises:
RPGMakerHeaderError: The header doesn’t match RPGMaker’s header
Returns:
bytes: If key was None, the key needed for a PNG image header, otherwise the decoded file header.
rpgmaker_mv_decoder.projectencoder module
Class for encoding a project
- class rpgmaker_mv_decoder.projectencoder.ProjectEncoder(encoding_source: pathlib.PurePath, destination: pathlib.PurePath, key: str, encoding_callbacks: rpgmaker_mv_decoder.callback.Callback = <rpgmaker_mv_decoder.callback.Callback object>)[source]
Bases:
rpgmaker_mv_decoder.project.ProjectClass for encoding a project
rpgmaker_mv_decoder.projectkeyfinder module
Class for decoding a project
- class rpgmaker_mv_decoder.projectkeyfinder.ProjectKeyFinder(source: pathlib.PurePath, callbacks: rpgmaker_mv_decoder.callback.Callback = <rpgmaker_mv_decoder.callback.Callback object>)[source]
Bases:
rpgmaker_mv_decoder.project.ProjectHandles finding a project key
- find_key() str[source]
find_keyCheck the path for PNG images and return the decoding keyFinds image files under the specified path and looks for a key to decode all the files. This can fail if only a small number (less than 3) of the .rpgmvp files are .png images.
Raises:
NoValidFilesFound: If no valid PNG images are found
Returns:
str: Decoding key
- property keys: Dict[str, int]
keyssorted dictionary of possible keys for this project
rpgmaker_mv_decoder.projectpaths module
project.py
Module for dealing with RPGMaker projects
- class rpgmaker_mv_decoder.projectpaths.ProjectPaths(source: Optional[pathlib.PurePath] = None, destination: Optional[pathlib.PurePath] = None)[source]
Bases:
objectObject that holds/validates project paths
- property all_files: List[pathlib.Path]
all_fileslist of all files under the source pathCreates a sorted list of
Pathobjects that are files under the source path, orNoneif the source path is unset
- property destination: pathlib.PurePath
Gets the
destinationpath to use or returnsNoneif thedestinationpath is not valid
- property encoded_files: List[pathlib.Path]
encoded_fileslist of encoded files under the source pathCreates a sorted list of
Pathobjects ending with “.rpgmvp” or “.rpgmvo under the source path, orNoneif the source path is unset
- property encoded_images: List[pathlib.Path]
encoded_imageslist of encoded images under the source pathCreates a sorted list of
Pathobjects ending with “.rpgmvp” under the source path, orNoneif the source path is unset
- property output_directory: pathlib.PurePath
output_directoryreturns the name of the output directory including the project name
- property source: pathlib.PurePath
Gets the
sourcepath to use or returnsNoneif thesourcepath is not valid
rpgmaker_mv_decoder.utils module
Utility functions
Module contents
Package for decoding RPGMaker MV/MZ encoded files